diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..583986729d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +patreon: Fabsol diff --git a/.gitignore b/.gitignore index 516f1ca200..057b56f873 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# manually added cronscript +cronpull.sh + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. *.csproj diff --git a/BossDamageValues2.txt b/BossDamageValues2.txt deleted file mode 100644 index cce45745ab..0000000000 --- a/BossDamageValues2.txt +++ /dev/null @@ -1,1463 +0,0 @@ -Boss Damage Values 2.0 - -KING SLIME - -Contact damage: -King Slime -N - 40 -E - 67 -R - 80 -D - 88 - -Projectile damage: -Crown Jewel Ruby Bolt -N - NA -E - NA -R - 44 -D - 48 - -DESERT SCOURGE - -Contact damage: -Desert Scourge Head -N - 30 -E - 66 -R - 79 -D - 87 -Body -N - 16 -E - 27 -R - 33 -D - 37 -Tail -N - 12 -E - 20 -R - 25 -D - 28 -Desert Scourge Head Small -N - NA -E - NA -R - 45 -D - 51 -Body -N - NA -E - NA -R - 25 -D - 28 -Tail -N - NA -E - NA -R - 20 -D - 23 -Dried Seeker Head -N - 14 -E - 28 -R - 35 -D - 40 -Body -N - 8 -E - 16 -R - 16 -D - 16 -Tail -N - 6 -E - 12 -R - 12 -D - 12 - -Projectile damage: -Sand Blast -N - NA -E - NA -R - 60 -D - 67 - -EYE OF CTHULHU - -Contact damage: -Eye of Cthulhu -N - 15 (phase 1), 23 (phase 2) -E - 30 (phase 1), 36 (phase 2), 40 (berserk phase, below 4%) -R - 37 (phase 1), 45 (phase 2), 52 (final phase, below 50%) -D - 58 -Servant of Cthulhu -N - 12 -E - 24 -R - 30 -D - 33 - -CRABULON - -Contact damage: -Crabulon -N - 40 -E - 64 -R - 76 -D - 84 -Crab Shroom -N - 25 -E - 50 -R - 62 -D - 70 - -Projectile damage: -Mushroom -N - 32 -E - 48 -R - 60 -D - 67 -Mushmash (used when Crabulon slams down) -N - 40 -E - 80 -R - 96 -D - 105 - -EATER OF WORLDS - -Contact damage: -Eater of Worlds Head -N - 22 -E - 48 -R - 60 (normal), 65 (less than 40% of EoW parts left), 71 (less than 10% of EoW parts left) -D - 72 (normal), 79 (less than 33% of EoW parts left) -Body -N - 13 -E - 20 -R - 25 -D - 28 -Tail -N - 11 -E - 17 -R - 21 -D - 23 -Vile Spit -N - NA -E - 65 -R - 65 -D - 65 - -Projectile damage: -Cursed Flame -N - NA -E - NA -R - 60 -D - 68 - -BRAIN OF CTHULHU - -Contact damage: -Brain of Cthulhu -N - 30 -E - 54 -R - 64 (normal), 76 (final phase, below 30%) -D - 84 -Creeper -N - 20 -E - 40 -R - 50 -D - 56 - -Projectile damage: -Blood Geyser -N - NA -E - NA -R - 60 -D - 67 - -HIVE MIND - -Contact damage: -Hive Mind -N - 20 (phase 1), 35 (phase 2) -E - 32 (phase 1), 63 (phase 2) -R - 40 (phase 1), 75 (phase 2) -D - 44 (phase 1), 83 (phase 2) -Dank Creeper -N - 25 -E - 50 -R - 62 -D - 70 - -Projectile damage: -Shaderain -N - 36 -E - 56 -R - 67 -D - 73 -Vile Clot -N - 30 -E - 48 -R - 48 -D - 48 - -PERFORATORS - -Contact damage: -Perforator Hive -N - 30 -E - 48 -R - 60 -D - 67 -Perf Large Head -N - 45 -E - 90 -R - 108 -D - 118 -Body -N - 24 -E - 38 -R - 38 -D - 38 -Tail -N - 18 -E - 28 -R - 28 -D - 28 -Perf Medium Head -N - 35 -E - 70 -R - 84 -D - 92 -Body -N - 21 -E - 33 -R - 33 -D - 33 -Tail -N - 14 -E - 22 -R - 22 -D - 22 -Perf Small Head -N - 30 -E - 60 -R - 72 -D - 79 -Body -N - 18 -E - 28 -R - 28 -D - 28 -Tail -N - 10 -E - 16 -R - 16 -D - 16 - -Projectile damage: -Blood Geyser/Ichor Shot -N - 36 -E - 56 -R - 70 -D - 78 -Blood Clot -N - 30 -E - 48 -R - 48 -D - 48 - -QUEEN BEE - -Contact damage: -Queen Bee -N - 30 -E - 54 -R - 64 to 88 (depending on life) -D - 97 -Bee -N - 20 (large), 15 (small) -E - 24 (large), 18 (small) -R - 30 (large), 22 (small) -D - 33 (large), 25 (small) - -Projectile damage: -Stinger -N - 22 -E - 44 -R - 56 (target is not poison immune), 72 (target is poison immune) -D - 64 (target is not poison immune), 80 (target is poison immune) - -SKELETRON - -Contact damage: -Skeletron Head -N - 32 -E - 70 (normal), 91 (spin) -R - 84 (normal), 109 (spin) -D - 92 (normal), 120 (spin) -Hand -N - 20 -E - 44 -R - 55 -D - 61 - -Projectile damage: -Skull -N - NA -E - 68 -R - 84 -D - 92 -Shadowflames -N - NA -E - NA -R - 76 -D - 84 - -SLIME GOD - -Contact damage: -Slime God Core -N - 40 -E - 80 -R - 96 -D - 105 -Ebonian Slime God -N - 45 (not split), 40 (split) -E - 76 (not split), 68 (split) -R - 91 (not split), 81 (split) -D - 100 (not split), 89 (split) -Crimulan Slime God -N - 50 (not split), 45 (split) -E - 85 (not split), 76 (split) -R - 102 (not split), 91 (split) -D - 112 (not split), 100 (split) -Corrupt Slime Spawn -N - 40 (wings), 30 (no wings) -E - 80 (wings), 60 (no wings) -R - 96 (wings), 60 (no wings) -D - 105 (wings), 60 (no wings) -Crimson Slime Spawn -N - 45 (spikes), 35 (no spikes) -E - 90 (spikes), 70 (no spikes) -R - 108 (spikes), 70 (no spikes) -D - 118 (spikes), 70 (no spikes) - -Projectile damage: -Abyss Ball Volley -N - 42 (purple), 38 (red) -E - 68 (purple), 64 (red) -R - 81 (purple), 76 (red) -D - 89 (purple), 84 (red) -Abyss Mine -N - NA -E - 96 (purple), 88 (red) -R - 115 (purple), 105 (red) -D - 126 (purple), 116 (red) - -WALL OF FLESH - -Contact damage: -Wall of Flesh -N - 50 -E - 150 -R - 172 -D - 186 -Hungry -N - 30 to 75 (depending on Wall of Flesh life) -E - 60 to 150 (depending on Wall of Flesh life) -R - 60 to 150 (depending on Wall of Flesh life) -D - 60 to 150 (depending on Wall of Flesh life) -Hungry 2 -N - 30 -E - 60 -R - 72 -D - 79 -Leech Head -N - 26 -E - 52 -R - 62 -D - 68 - -Projectile damage: -Eye Laser -N - 22 to 30 (depending on life) -E - 44 to 60 (depending on life) -R - 68 -D - 76 -Death Laser -N - NA -E - NA -R - 88 -D - 96 - -CRYOGEN - -Contact damage: -Cryogen -N - 50 (normal), 75 (derp out phase) -E - 90 (normal), 135 (derp out phase) -R - 103 (normal), 155 (derp out phase) -D - 111 (normal), 167 (derp out phase) -Ice Shield -N - 50 -E - 100 -R - 115 -D - 124 -Cryocore -N - 35 (small), 40 (large) -E - 70 (small), 80 (large) -R - 84 (small), 96 (large) -D - 92 (small), 105 (large) -Aurora Spirit -N - 40 -E - 80 -R - 96 -D - 105 - -Projectile damage: -Ice Bomb -N - NA -E - 100 -R - 120 -D - 132 -Ice Blast -N - 46 -E - 80 -R - 96 -D - 105 -Ice Rain -N - 52 -E - 92 -R - 110 -D - 121 - -THE TWINS - -Contact damage: -Spazmatism -N - 50 (phase 1), 75 (phase 2) -E - 85 (phase 1), 127 (phase 2) -R - 97 (phase 1), 146 (phase 2) -D - 105 (phase 1), 157 (phase 2) -Retinazer -N - 45 (phase 1), 67 (phase 2) -E - 76 (phase 1), 114 (phase 2) -R - 87 (phase 1), 131 (phase 2) -D - 94 (phase 1), 141 (phase 2) - -Projectile damage: -Eye Laser -N - 40 -E - 76 -R - 92 -D - 100 -Death Laser -N - 50 (normal), 36 (rapid fire) -E - 92 (normal), 68 (rapid fire) -R - 112 (normal), 84 (rapid fire) -D - 124 (normal), 92 (rapid fire) -Homing Dart -N - NA -E - NA -R - 120 -D - 132 -Cursed Flame -N - 50 -E - 88 -R - 108 -D - 120 -Cursed Flamethrower -N - 60 -E - 108 -R - NA -D - NA -Shadow Flamethrower -N - NA -E - NA -R - 132 -D - 144 -Shadow Flame -N - NA -E - NA -R - 124 -D - 136 - -AQUATIC SCOURGE - -Contact damage: -Aquatic Scourge Head -N - 80 -E - 160 -R - 184 -D - 198 -Body -N - 65 (toothy), 55 (not toothy) -E - 110 (toothy), 93 (not toothy) -R - 126 (toothy), 106 (not toothy) -D - 136 (toothy), 115 (not toothy) -Tail -N - 45 -E - 76 -R - 91 -D - 100 - -Projectile damage: -Sand Blast -N - 56 -E - 92 -R - 115 -D - 128 -Sand Tooth -N - 60 -E - 100 -R - 120 -D - 132 -Sand Poison Cloud -N - 66 -E - 112 -R - 128 -D - 138 - -THE DESTROYER - -Contact damage: -The Destroyer Head -N - 70 -E - 280 -R - 308 -D - 324 -Body -N - 55 -E - 93 -R - 111 -D - 122 -Tail -N - 40 -E - 68 -R - 81 -D - 89 -Probe -N - 50 -E - 80 -R - 96 -D - 105 - -Projectile damage: -Death Laser -N - 44 -E - 72 -R - 92 -D - 100 -Frost Beam -N - NA -E - NA -R - 100 -D - 108 -Homing Laser -N - NA -E - NA -R - 108 -D - 116 -Scrap -N - NA -E - NA -R - 92 -D - 100 -Probe Laser -N - 50 -E - 88 -R - 88 -D - 88 - -BRIMSTONE ELEMENTAL - -Contact damage: -Brimstone Elemental -N - 60 -E - 96 -R - 115 -D - 126 - -Projectile damage: -Brimstone Hellfireball -N - 70 -E - 112 -R - 128 -D - 138 -Brimstone Barrage -N - 60 -E - 100 -R - 105 -D - 108 -Brimstone Hellblast -N - 60 -E - 100 -R - 105 -D - 108 -Brimstone Ray -N - NA -E - NA -R - 184 -D - 198 - -SKELETRON PRIME - -Contact damage: -Skeletron Prime -N - 47 (normal), 94 (spin) -E - 79 (normal), 158 (spin) -R - 90 (normal), 181 (spin) -D - 97 (normal), 195 (spin) -Vice -N - 52 -E - 88 -R - 105 -D - 116 -Saw -N - 56 -E - 95 -R - 114 -D - 125 -Cannon -N - 30 -E - 51 -R - 61 -D - 67 -Laser -N - 29 -E - 49 -R - 58 -D - 64 - -Projectile damage: -Death Laser -N - 50 -E - 100 -R - 124 -D - 136 -Bomb (why the fuck do these exist) -N - 40 -E - 40 -R - NA -D - NA -Missile -N - NA -E - NA -R - 132 -D - 144 -Skull -N - NA -E - NA -R - 112 -D - 124 -Homing Missile -N - NA -E - NA -R - 132 -D - 144 - -CALAMITAS CLONE - -Contact damage: -Calamitas -N - 55 (phase 1), 70 (phase 2) -E - 88 (phase 1), 112 (phase 2) -R - 101 (phase 1), 128 (phase 2) -D - 109 (phase 1), 138 (phase 2) -Cataclysm -N - 60 -E - 120 -R - 138 -D - 148 -Catastrophe -N - 65 -E - 130 -R - 149 -D - 161 -Soul Seeker -N - 40 -E - 80 -R - 96 -D - 105 -Life Seeker -N - 30 -E - 60 -R - 72 -D - 79 - -Projectile damage: -Brimstone Laser -N - 70 (normal or phase 2), 48 (rapid fire) -E - 112 (normal or phase 2), 80 (rapid fire) -R - 128 (normal or phase 2), 92 (rapid fire) -D - 138 (normal or phase 2), 99 (rapid fire) -Brimstone Hellfireball/Explosion -N - 84 -E - 136 -R - 156 -D - 168 -Brimstone Flamethrower -N - 76 -E - 120 -R - 138 -D - 148 -Brimstone Ball -N - 72 -E - 116 -R - 133 -D - 143 -Soul Seeker Barrage -N - 60 -E - 100 -R - 105 -D - 108 -Life Seeker Laser -N - 50 -E - 88 -R - 88 -D - 88 - -PLANTERA - -Contact damage: -Plantera -N - 50 (phase 1), 70 (phase 2) -E - 100 (phase 1), 140 (phase 2) -R - 132 (phase 1), 185 (phase 2) -D - 142 (phase 1), 199 (phase 2) -Hook -N - 60 -E - 120 -R - 0 -D - 0 -Tentacle -N - 60 -E - 120 -R - 138 -D - 148 -Spore -N - 70 -E - 126 -R - 144 -D - 156 - -Projectile damage: -Seed -N - 44 -E - 76 -R - 96 -D - 108 -Poison Seed -N - 54 -E - 96 -R - 120 -D - 132 -Thorn Ball -N - 62 -E - 108 -R - 136 -D - 148 -Spore Gas -N - NA -E - NA -R - 140 -D - 152 - -LEVIATHAN AND SIREN - -Contact damage: -Leviathan -N - 90 -E - 153 -R - 175 -D - 189 -Siren -N - 70 -E - 119 -R - 136 -D - 147 -Ice Shield -N - 55 -E - 110 -R - 126 -D - 136 -Bubble -N - 100 -E - 140 -R - 161 -D - 173 -Aquatic Aberration -N - 55 -E - 110 -R - 126 -D - 136 -Parasea -N - 50 -E - 100 -R - 115 -D - 124 - -Projectile damage: -Leviathan Bomb -N - 80 -E - 132 -R - 151 -D - 163 -Water Spear/Frost Mist/Siren Song -N - 64 -E - 104 -R - 119 -D - 128 - -ASTRUM AUREUS - -Contact damage: -Astrum Aureus -N - 80 -E - 136 -R - 156 -D - 168 -Aureus Spawn -N - NA -E - NA -R - 150 -D - 150 - -Projectile damage: -Astral Laser/Astral Flame -N - 74 -E - 128 -R - 147 -D - 158 - -GOLEM - -Contact damage: -Golem Body -N - 72 -E - 115 -R - 132 (head attached), 197 (head free) -D - 142 (head attached), 213 (head free) -Head -N - 64 (attached), 80 (free) -E - 102 (attached), 128 (free) -R - 117 (attached), 147 (free) -D - 126 (attached), 158 (free) -Fist -N - 59 -E - 94 -R - 108 -D - 116 - -Projectile damage: -Fireball -N - 36 to 58 (depending on life) -E - 72 to 116 (depending on life) -R - 148 -D - 160 -Laser -N - 56 -E - 112 -R - 140 -D - 152 -Inferno Fireball/Explosion -N - NA -E - NA -R - 160 -D - 176 - -PLAGUEBRINGER GOLIATH - -Contact damage: -Plaguebringer Goliath -N - 100 -E - 180 -R - 207 -D - 223 -Plaguebringer -N - 70 -E - 140 -R - 161 -D - 173 -Plague Homing Missile -N - 90 -E - 180 -R - 207 -D - 223 -Plague Mine -N - NA -E - 200 -R - 200 -D - 200 -Plague Charger -N - 60 (small), 65 (large) -E - 120 (small), 130 (large) -R - 138 (small), 149 (large) -D - 148 (small), 161 (large) - -Projectile damage: -Plague Stinger -N - 80 (goliath), 52 (shade) -E - 128 to 148 (goliath, depending on life), 104 (shade) -R - 147 to 170 (goliath, depending on life), 130 (shade) -D - 183 (goliath), 149 (shade) -Plague Missile -N - 100 (goliath), 66 (shade) -E - 160 to 180 (goliath, depending on life), 132 (shade) -R - 184 to 207 (goliath, depending on life), 165 (shade) -D - 223 (goliath), 189 (shade) -Plague Nuke Barrage -N - 120 -E - 192 -R - 220 -D - 238 - -DUKE FISHRON - -Contact damage: -Duke Fishron -N - 100 (phase 1), 120 (phase 2) -E - 140 (phase 1), 201 (phase 2), 184 (phase 3) -R - 161 (phase 1), 231 (phase 2), 211 (phase 3) -D - 173 (phase 1), 249 (phase 2), 228 (phase 3) -Sharkron -N - 100 (small), 120 (large) -E - 150 (small), 180 (large) -R - 172 (small), 207 (large) -D - 186 (small), 223 (large) -Bubble -N - 100 -E - 140 -R - 161 -D - 173 - -Projectile damage: -Sharknado -N - 90 -E - 100 -R - 115 -D - 124 -Cthulhunado -N - 160 -E - 200 -R - 230 -D - 248 - -RAVAGER - -Contact damage: -Ravager -N - 120 -E - 192 -R - 220 -D - 238 -Claws -N - 80 -E - 160 -R - 184 -D - 198 -Rock Pillar -N - 120 -E - 200 -R - 200 -D - 200 -Flame Pillar -N - 100 -E - 180 -R - 180 -D - 180 - -Projectile damage: -Laser -N - 90 -E - 180 -R - 180 -D - 180 -Fireball -N - 80 -E - 160 -R - 160 -D - 160 -Falling Fire -N - 70 -E - 140 -R - 140 -D - 140 -Homing Dart -N - 80 -E - 160 -R - 160 -D - 160 -Homing Nuke -N - 120 -E - 180 -R - 207 -D - 223 -Blue Flame -N - 90 -E - 180 -R - 180 -D - 180 - -LUNATIC CULTIST - -Contact damage: -Cultist -N - 50 -E - 75 -R - 0 -D - 0 -Dragon Head -N - 80 -E - 120 -R - 138 -D - 148 -Squid Head -N - 90 -E - 180 -R - 207 -D - 223 -Ancient Doom -N - 30 -E - 45 -R - 0 -D - 0 -Ancient Light -N - 120 -E - 180 -R - 207 -D - 223 - -Projectile damage: -Clone Fireball -N - 36 -E - 72 -R - 108 -D - 120 -Fireball -N - 60 -E - 80 -R - 120 -D - 132 -Ice Mist -N - 70 -E - 100 -R - 152 -D - 164 -Lightning -N - 90 -E - 120 -R - 180 -D - 196 -Ancient Doom Shot -N - 90 -E - 180 -R - 200 -D - 220 - -ASTRUM DEUS - -Contact damage: -Astrum Deus Head -N - 100 (non-boss), 120 (boss) -E - 200 (non-boss), 240 (boss) -R - 220 (non-boss), 264 (boss) -D - 232 (non-boss), 278 (boss) -Body -N - 85 (non-boss), 100 (boss) -E - 144 (non-boss), 170 (boss) -R - 144 (non-boss), 170 (boss) -D - 144 (non-boss), 170 (boss) -Tail -N - 70 (non-boss), 80 (boss) -E - 119 (non-boss), 136 (boss) -R - 119 (non-boss), 136 (boss) -D - 119 (non-boss), 136 (boss) - -Projectile damage: -Astral Laser -N - 90 -E - 152 -R - 174 -D - 188 -Deus Mine -N - 120 -E - 180 -R - 207 -D - 223 -Astrum Deus Probe Laser -N - 90 -E - 152 -R - 152 -D - 152 - -MOON LORD - -Contact damage: -Moon Lord Open Hand -N - 80 -E - 80 -R - NA -D - NA -True Eye -N - 60 -E - 108 -R - NA -D - NA - -Projectile damage: -Deathray -N - 150 (moon lord), 100 (true eye) -E - 300 (moon lord), 200 (true eye) -R - 380 (moon lord), NA -D - 420 (moon lord), NA -Sphere -N - 100 (moon lord), 110 (true eye) -E - 200 (moon lord), 220 (true eye) -R - 260 (moon lord), NA -D - 284 (moon lord), NA -Bolt/Eye -N - 60 (moon lord), 70 (true eye) -E - 120 (moon lord), 140 (true eye) -R - 160 (moon lord), NA -D - 176 (moon lord), NA - -PROFANED GUARDIANS - -Contact damage: -Profaned Guardian Boss -N - 140 -E - 224 -R - 246 -D - 259 -Defender -N - 110 -E - 176 -R - 202 -D - 218 -Healer -N - 90 -E - 144 -R - 165 -D - 178 - -Projectile damage: -Profaned Spear -N - 120 -E - 200 -R - 220 -D - 232 -Flare Dust -N - 140 -E - 220 -R - 242 -D - 255 -Anti-heal Orb (ignores defense and DR) -N - 32 -E - 32 -R - 32 -D - 32 - -BUMBLEBIRB - -Contact damage: -Bumblebirb -N - 160 (normal), 240 (charge) -E - 256 (normal), 384 (charge) -R - 281 (normal), 422 (charge) -D - 296 (normal), 445 (charge) -Bumblebirb Small -N - 110 (normal), 165 (charge) -E - 220 (normal), 330 (charge) -R - 242 (normal), 363 (charge) -D - 255 (normal), 382 (charge) - -Projectile damage: -Red Feather -N - 120 -E - 200 -R - 220 -D - 232 - -PROVIDENCE - -Contact damage: -Providence (she can't hit the player anyways) -N - 100 -E - 160 -R - 160 -D - 160 -Profaned Guardian Offense -N - 120 -E - 240 -R - 264 -D - 278 -Defense -N - 100 -E - 200 -R - 220 -D - 232 - -Projectile damage: -Holy Blast/Holy Spear -N - 130 -E - 208 -R - 228 -D - 241 -Holy Fire/Holy Bomb/Holy Flare -N - 120 -E - 192 -R - 220 -D - 238 -Anti-heal Flame (ignores defense and DR) -N - 100 -E - 150 -R - 150 -D - 200 -Heal Flame (ignores defense and DR) -N - 35 -E - 50 -R - 50 -D - NA -Molten Blast/Molten Blob -N - 110 -E - 168 -R - 193 -D - 208 -Crystal Shards -N - 140 -E - 228 -R - 250 -D - 264 -Holy Ray -N - 200 -E - 400 -R - 440 -D - 464 - -CEASELESS VOID - -Contact damage: -Ceaseless Void -N - 150 -E - 300 -R - 330 -D - 348 -Dark Energy -N - 120 -E - 240 -R - 300 -D - 300 - -Projectile damage: -Homing Laser/Dark Energy Ball -N - 120 -E - 200 -R - 230 -D - 248 - -STORM WEAVER - -Contact damage: -Storm Weaver Head -N - 140 (phase 1), 180 (phase 2) -E - 280 (phase 1), 360 (phase 2) -R - 308 (phase 1), 396 (phase 2) -D - 324 (phase 1), 417 (phase 2) -Body -N - 100 (phase 1), 120 (phase 2) -E - 170 (phase 1), 204 (phase 2) -R - 170 (phase 1), 204 (phase 2) -D - 170 (phase 1), 204 (phase 2) -Tail -N - 80 (phase 1), 100 (phase 2) -E - 136 (phase 1), 170 (phase 2) -R - 136 (phase 1), 170 (phase 2) -D - 136 (phase 1), 170 (phase 2) -Probe -N - 70 (phase 1), 80 (phase 2) -E - 140 (phase 1), 160 (phase 2) -R - 140 (phase 1), 160 (phase 2) -D - 140 (phase 1), 160 (phase 2) - -Projectile damage: -Lightning -N - 150 -E - 248 -R - 248 -D - 248 -Probe Laser -N - 120 -E - 200 -R - 200 -D - 200 - -SIGNUS - -Contact damage: -Signus -N - 175 -E - 297 -R - 326 -D - 344 -Cosmic Lantern -N - 110 -E - 220 -R - 242 -D - 255 -Cosmic Mine -N - NA -E - NA -R - 300 -D - 300 - -Projectile damage: -Cosmic Flame Burst -N - 130 -E - 208 -R - 228 -D - 241 -Homing Scythe -N - 120 -E - 192 -R - 211 -D - 222 -Essence Dust -N - 140 -E - 240 -R - 264 -D - 278 - -POLTERGHAST - -Contact damage: -Polterghast -N - 150 (phase 1), 180 (phase 2), 210 (phase 3) -E - 240 (phase 1), 288 (phase 2), 336 (phase 3) -R - 264 (phase 1), 316 (phase 2), 369 (phase 3) -D - 278 (phase 1), 334 (phase 2), 389 (phase 3) -Clone -N - 210 -E - 336 -R - 369 -D - 389 - -Projectile damage: -Phantom Shot -N - 120 (blue), 130 (red) -E - 192 (blue), 212 (red) -R - 211 (blue), 233 (red) -D - 222 (blue), 245 (red) -Phantom Blast -N - 140 (blue), 150 (red) -E - 240 (blue), 260 (red) -R - 264 (blue), 286 (red) -D - 278 (blue), 301 (red) -Phantom Mine -N - 150 -E - 248 -R - 272 -D - 287 - -DEVOURER OF GODS - -Contact damage: -DoG Head -N - 250 (phase 1), 300 (phase 2) -E - 500 (phase 1), 600 (phase 2) -R - 525 (phase 1), 630 (phase 2) -D - 540 (phase 1), 648 (phase 2) (instant death, but these are the damage values regardless) -Body -N - 180 (phase 1), 220 (phase 2) -E - 306 (phase 1), 374 (phase 2) -R - 336 (phase 1), 411 (phase 2) -D - 354 (phase 1), 433 (phase 2) -Tail -N - 150 (phase 1), 180 (phase 2) -E - 255 (phase 1), 306 (phase 2) -R - 280 (phase 1), 336 (phase 2) -D - 295 (phase 1), 354 (phase 2) -Cosmic Guardian Head -N - 180 -E - 360 -R - 396 -D - 417 -Body -N - 130 -E - 260 -R - 260 -D - 260 -Tail -N - 100 -E - 200 -R - 200 -D - 200 - -Projectile damage: -Nebula Shot -N - 140 -E - 232 -R - 255 -D - 269 -Laser Wall/God Slayer Fireball -N - 160 -E - 276 -R - 303 -D - 320 - -YHARON - -Contact damage: -Yharon -N - 330 (normal), 363 (phase 2, low HP) -E - 528 (normal), 580 (phase 2, low HP) -R - 554 (normal), 609 (phase 2, low HP) -D - 570 (normal), 626 (phase 2, low HP) -Detonating Flame -N - 100 (ranged flame), 220 (melee flame) -E - 200 (ranged flame), 440 (melee flame) -R - 220 (ranged flame), 462 (melee flame) -D - 232 (ranged flame), 475 (melee flame) - -Projectile damage: -Flare Bomb -N - 180 (normal), 312 (on death) -E - 300 (normal), 548 (on death) -R - 330 (normal), 602 (on death) -D - 348 (normal), 635 (on death) -Flarenado -N - 200 -E - 340 -R - 374 -D - 394 -Infernado -N - 300 -E - 520 -R - 546 -D - 561 -Flare Dust (type 1 only does damage when it explodes, type 2 does damage at all times) -N - 180 (normal), 250 (type 2, phase 2), 274 (type 2, phase 2, low HP) -E - 300 (normal), 440 (type 2, phase 2), 484 (type 2, phase 2, low HP) -R - 375 (normal), 462 (type 2, phase 2), 508 (type 2, phase 2, low HP) -D - 375 (normal), 475 (type 2, phase 2), 522 (type 2, phase 2, low HP) -Splitting Fireballs (these are phase 2 only) -N - 250 (normal), 274 (low HP) -E - 440 (normal), 484 (low HP) -R - 462 (normal), 508 (low HP) -D - 475 (normal), 522 (low HP) -Detonating Flame Fireball -N - 180 -E - 300 -R - 300 -D - 300 - -SUPREME CALAMITAS - -Contact damage: -SCal -N - 350 -E - 560 -R - 588 -D - 604 - -Projectile damage: -All projectiles in bullet hell 1 -N - 500 -E - 800 -R - 840 -D - 864 -All other projectiles -N - 400 -E - 600 -R - 630 -D - 648 diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 425eb7dd0d..2a9e74d96e 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -10,7 +11,19 @@ namespace CalamityMod.Buffs { public override void Update(int type, Player player, ref int buffIndex) { - if (type == BuffID.Shine) + if (type == BuffID.Panic) + { + player.moveSpeed -= 0.5f; + } + else if (type == BuffID.SugarRush) + { + player.moveSpeed -= 0.1f; + } + else if (type == BuffID.Swiftness) + { + player.moveSpeed -= 0.1f; + } + else if (type == BuffID.Shine) { player.Calamity().shine = true; } @@ -24,12 +37,12 @@ namespace CalamityMod.Buffs } else if (type >= BuffID.NebulaUpDmg1 && type <= BuffID.NebulaUpDmg3) { - float nebulaDamage = 0.075f * player.nebulaLevelDamage; //7.5% to 22.5% + float nebulaDamage = 0.075f * player.nebulaLevelDamage; // 15% to 45% changed to 7.5% to 22.5% player.allDamage -= nebulaDamage; } else if (type >= BuffID.NebulaUpLife1 && type <= BuffID.NebulaUpLife3) { - player.lifeRegen -= 5 * player.nebulaLevelLife; //10 to 30 changed to 5 to 15 + player.lifeRegen -= 5 * player.nebulaLevelLife; // 10 to 30 changed to 5 to 15 } else if (type == BuffID.Warmth) { @@ -45,6 +58,8 @@ namespace CalamityMod.Buffs { if (npc.Calamity().webbed < npc.buffTime[buffIndex]) npc.Calamity().webbed = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().webbed; npc.DelBuff(buffIndex); buffIndex--; } @@ -52,7 +67,9 @@ namespace CalamityMod.Buffs { if (npc.Calamity().slowed < npc.buffTime[buffIndex]) npc.Calamity().slowed = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().slowed; + npc.DelBuff(buffIndex); buffIndex--; } if (type == BuffID.Electrified) @@ -71,6 +88,18 @@ namespace CalamityMod.Buffs //Vanilla buffs switch (type) { + case BuffID.Archery: + tip = "20% increased arrow speed and 1.05x arrow damage"; + break; + + case BuffID.Swiftness: + tip = "15% increased movement speed"; + break; + + case BuffID.SugarRush: + tip = "10% increased movement speed and 20% increased mining speed"; + break; + case BuffID.NebulaUpDmg1: tip = "7.5% increased damage"; break; @@ -83,7 +112,19 @@ namespace CalamityMod.Buffs tip = "22.5% increased damage"; break; - case BuffID.BeetleEndurance1: + case BuffID.BeetleMight1: + tip = "Melee damage increased by 10%"; + break; + + case BuffID.BeetleMight2: + tip = "Melee damage increased by 20%"; + break; + + case BuffID.BeetleMight3: + tip = "Melee damage increased by 30%"; + break; + + case BuffID.BeetleEndurance1: tip = "Damage taken reduced by 10%"; break; @@ -118,8 +159,7 @@ namespace CalamityMod.Buffs break; case BuffID.CursedInferno: - if (CalamityWorld.revenge) - tip += ". All damage taken increased by 20%"; + tip += ". All damage taken increased by 20%"; break; case BuffID.Warmth: diff --git a/Buffs/Cooldowns/AbyssalDivingSuitPlatesBroken.png b/Buffs/Cooldowns/AbyssalDivingSuitPlatesBroken.png index 15d0c56138..33065ad331 100644 Binary files a/Buffs/Cooldowns/AbyssalDivingSuitPlatesBroken.png and b/Buffs/Cooldowns/AbyssalDivingSuitPlatesBroken.png differ diff --git a/Buffs/Cooldowns/DivineBlessCooldown.cs b/Buffs/Cooldowns/DivineBlessCooldown.cs new file mode 100644 index 0000000000..7bfeebdbdb --- /dev/null +++ b/Buffs/Cooldowns/DivineBlessCooldown.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class DivineBlessCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Divine Recharge"); + Description.SetDefault("Your divine powers are recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().divineBlessCooldown = true; + } + } +} diff --git a/Buffs/Cooldowns/DivineBlessCooldown.png b/Buffs/Cooldowns/DivineBlessCooldown.png new file mode 100644 index 0000000000..2057238c4e Binary files /dev/null and b/Buffs/Cooldowns/DivineBlessCooldown.png differ diff --git a/Buffs/Cooldowns/GodSlayerCooldown.cs b/Buffs/Cooldowns/GodSlayerCooldown.cs index 304c33027d..954f20ce40 100644 --- a/Buffs/Cooldowns/GodSlayerCooldown.cs +++ b/Buffs/Cooldowns/GodSlayerCooldown.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Cooldowns public override void SetDefaults() { DisplayName.SetDefault("God Slayer Cooldown"); - Description.SetDefault("10% increase to all damage; godslayer effect is recharging"); + Description.SetDefault("God Slayer dash is recharging"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/Cooldowns/UniverseSplitterCooldown.cs b/Buffs/Cooldowns/UniverseSplitterCooldown.cs new file mode 100644 index 0000000000..03270a884e --- /dev/null +++ b/Buffs/Cooldowns/UniverseSplitterCooldown.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class UniverseSplitterCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Universe Splitter Cooldown"); + Description.SetDefault("You cannot use the Universe Splitter"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + } +} diff --git a/Buffs/Cooldowns/UniverseSplitterCooldown.png b/Buffs/Cooldowns/UniverseSplitterCooldown.png new file mode 100644 index 0000000000..f24e416ef2 Binary files /dev/null and b/Buffs/Cooldowns/UniverseSplitterCooldown.png differ diff --git a/Buffs/Cooldowns/Withered.cs b/Buffs/Cooldowns/Withered.cs new file mode 100644 index 0000000000..5a68168394 --- /dev/null +++ b/Buffs/Cooldowns/Withered.cs @@ -0,0 +1,21 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Cooldowns +{ + public class Withered : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Withered"); + Description.SetDefault("Holding withered weapons causes you to suffer but makes your weapons strong"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().witheredDebuff = true; + } +} diff --git a/Buffs/Cooldowns/Withered.png b/Buffs/Cooldowns/Withered.png new file mode 100644 index 0000000000..c51dae7b2a Binary files /dev/null and b/Buffs/Cooldowns/Withered.png differ diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs new file mode 100644 index 0000000000..50750405fe --- /dev/null +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class BanishingFire : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Banishing Fire"); + Description.SetDefault("You shall not be forgiven for your sins"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().banishingFire = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().banishingFire < npc.buffTime[buffIndex]) + npc.Calamity().banishingFire = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + } +} diff --git a/Buffs/DamageOverTime/BanishingFire.png b/Buffs/DamageOverTime/BanishingFire.png new file mode 100644 index 0000000000..32abe939dd Binary files /dev/null and b/Buffs/DamageOverTime/BanishingFire.png differ diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs new file mode 100644 index 0000000000..e44fb8e344 --- /dev/null +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -0,0 +1,20 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class HeavyBleeding : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Heavy Bleeding"); + Description.SetDefault("You're losing a lot of blood"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().waterLeechBleeding = true; + } +} diff --git a/Buffs/DamageOverTime/HeavyBleeding.png b/Buffs/DamageOverTime/HeavyBleeding.png new file mode 100644 index 0000000000..26ea11ef6b Binary files /dev/null and b/Buffs/DamageOverTime/HeavyBleeding.png differ diff --git a/Buffs/DamageOverTime/LethalLavaBurn.cs b/Buffs/DamageOverTime/LethalLavaBurn.cs index 9ed4184336..94992976d7 100644 --- a/Buffs/DamageOverTime/LethalLavaBurn.cs +++ b/Buffs/DamageOverTime/LethalLavaBurn.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void SetDefaults() { DisplayName.SetDefault("Lethal Lava Burn"); - Description.SetDefault("Losing life"); + Description.SetDefault("Losing life, reduced movement speed"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs new file mode 100644 index 0000000000..b1763d9e41 --- /dev/null +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class SagePoison : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sage Poison"); + Description.SetDefault("Poisoned"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + } + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().sagePoisonTime < npc.buffTime[buffIndex]) + npc.Calamity().sagePoisonTime = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + } +} diff --git a/Buffs/DamageOverTime/SagePoison.png b/Buffs/DamageOverTime/SagePoison.png new file mode 100644 index 0000000000..369f52e1ef Binary files /dev/null and b/Buffs/DamageOverTime/SagePoison.png differ diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index cdcb28b518..a2398cbde3 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -17,7 +18,10 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - npc.Calamity().vaporfied = npc.buffTime[buffIndex]; + if (npc.Calamity().vaporfied < npc.buffTime[buffIndex]) + npc.Calamity().vaporfied = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vaporfied; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 17b1addd7e..6b5109867c 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -16,9 +17,16 @@ namespace CalamityMod.Buffs.DamageOverTime canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) + public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true; + + public override void Update(NPC npc, ref int buffIndex) { - player.Calamity().vHex = true; + if (npc.Calamity().vulnerabilityHex < npc.buffTime[buffIndex]) + npc.Calamity().vulnerabilityHex = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vulnerabilityHex; + npc.DelBuff(buffIndex); + buffIndex--; } } } diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs new file mode 100644 index 0000000000..edf6f12830 --- /dev/null +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -0,0 +1,21 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class WeakBrimstoneFlames : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Weak Brimstone Flames"); + Description.SetDefault("Health loss"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) => player.Calamity().weakBrimstoneFlames = true; + } +} diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.png b/Buffs/DamageOverTime/WeakBrimstoneFlames.png new file mode 100644 index 0000000000..e2be863c4b Binary files /dev/null and b/Buffs/DamageOverTime/WeakBrimstoneFlames.png differ diff --git a/Buffs/Mounts/AlicornBuff.png b/Buffs/Mounts/AlicornBuff.png index fb4d3a116e..f821a3a2bb 100644 Binary files a/Buffs/Mounts/AlicornBuff.png and b/Buffs/Mounts/AlicornBuff.png differ diff --git a/Buffs/Mounts/AndromedaBuff.cs b/Buffs/Mounts/AndromedaBuff.cs index 344610c871..87e673f814 100644 --- a/Buffs/Mounts/AndromedaBuff.cs +++ b/Buffs/Mounts/AndromedaBuff.cs @@ -3,7 +3,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Mounts { - public class AndromedaBuff : ModBuff + public class AndromedaBuff : ModBuff { public override void SetDefaults() { @@ -12,5 +12,20 @@ namespace CalamityMod.Buffs.Mounts Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; } + + public override void Update(Player player, ref int buffIndex) + { + // Disables crouching with the Crouch, Crawl, and Roll Mod + Mod crouchMod = CalamityMod.Instance.crouchMod; + if (crouchMod != null) + { + // Mod Call inputs + // 1) "CanCrouch" -- name of operation + // 2) int for the player's index + // 3) bool for whether the player can use the crouch input this frame + // 4) bool for whether the player should be force-uncrouched this frame + crouchMod.Call("CanCrouch", player.whoAmI, false, true); + } + } } } diff --git a/Buffs/Pets/LittleLightBuff.cs b/Buffs/Pets/LittleLightBuff.cs new file mode 100644 index 0000000000..e1d860ee05 --- /dev/null +++ b/Buffs/Pets/LittleLightBuff.cs @@ -0,0 +1,28 @@ +using CalamityMod.Projectiles.Pets; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Pets +{ + public class LittleLightBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Little Light"); + Description.SetDefault("Endearing"); + Main.buffNoTimeDisplay[Type] = true; + Main.lightPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + + player.Calamity().littleLightPet = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + Projectile.NewProjectile(player.Center, -Vector2.UnitY * 10f, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } +} diff --git a/Buffs/Pets/LittleLightBuff.png b/Buffs/Pets/LittleLightBuff.png new file mode 100644 index 0000000000..9d35e2b3f6 Binary files /dev/null and b/Buffs/Pets/LittleLightBuff.png differ diff --git a/Buffs/Summon/ReaverSummonSetBuff.cs b/Buffs/Pets/ReaverOrbBuff.cs similarity index 77% rename from Buffs/Summon/ReaverSummonSetBuff.cs rename to Buffs/Pets/ReaverOrbBuff.cs index 381bbfdada..98fb1ba970 100644 --- a/Buffs/Summon/ReaverSummonSetBuff.cs +++ b/Buffs/Pets/ReaverOrbBuff.cs @@ -1,19 +1,20 @@ using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ModLoader; -namespace CalamityMod.Buffs.Summon +namespace CalamityMod.Buffs.Pets { - public class ReaverSummonSetBuff : ModBuff + public class ReaverOrbBuff : ModBuff { public override void SetDefaults() { DisplayName.SetDefault("Reaver Orb"); - Description.SetDefault("The reaver orb will protect you"); + Description.SetDefault("The reaver orb will light your way"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { @@ -33,4 +34,4 @@ namespace CalamityMod.Buffs.Summon } } } -} +} \ No newline at end of file diff --git a/Buffs/Summon/ReaverSummonSetBuff.png b/Buffs/Pets/ReaverOrbBuff.png similarity index 100% rename from Buffs/Summon/ReaverSummonSetBuff.png rename to Buffs/Pets/ReaverOrbBuff.png diff --git a/Buffs/Pets/SCalPetBuff.cs b/Buffs/Pets/SCalPetBuff.cs index bef829c02f..97c5974f70 100644 --- a/Buffs/Pets/SCalPetBuff.cs +++ b/Buffs/Pets/SCalPetBuff.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Pets public override void SetDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Description.SetDefault("Watching over you with supreme calamitous energy... How adorable"); + Description.SetDefault("Watching over you with supreme calamitous energy...how adorable"); Main.buffNoTimeDisplay[Type] = true; Main.vanityPet[Type] = true; } diff --git a/Buffs/Pets/SCalPetBuff.png b/Buffs/Pets/SCalPetBuff.png index ccce6a3ad1..39869b3c91 100644 Binary files a/Buffs/Pets/SCalPetBuff.png and b/Buffs/Pets/SCalPetBuff.png differ diff --git a/Buffs/Potions/AbyssalWeapon.cs b/Buffs/Potions/AbyssalWeapon.cs index 9b7ee491ef..a728e072ed 100644 --- a/Buffs/Potions/AbyssalWeapon.cs +++ b/Buffs/Potions/AbyssalWeapon.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetDefaults() { DisplayName.SetDefault("Abyssal Weapon"); - Description.SetDefault("Melee weapons inflict abyssal flames, 15% increased movement speed"); + Description.SetDefault("Melee weapons inflict abyssal flames, 10% increased movement speed"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/Potions/AbyssalWeapon.png b/Buffs/Potions/AbyssalWeapon.png index 5bfb5b1bf5..a88f3cea90 100644 Binary files a/Buffs/Potions/AbyssalWeapon.png and b/Buffs/Potions/AbyssalWeapon.png differ diff --git a/Buffs/Potions/AnechoicCoatingBuff.png b/Buffs/Potions/AnechoicCoatingBuff.png index bc28d7e811..06da0c6823 100644 Binary files a/Buffs/Potions/AnechoicCoatingBuff.png and b/Buffs/Potions/AnechoicCoatingBuff.png differ diff --git a/Buffs/Potions/Cadence.png b/Buffs/Potions/Cadence.png index 3f42e24f69..2cf41f1a0f 100644 Binary files a/Buffs/Potions/Cadence.png and b/Buffs/Potions/Cadence.png differ diff --git a/Buffs/Potions/ProfanedRageBuff.cs b/Buffs/Potions/ProfanedRageBuff.cs index 883e131a87..fa93c8b202 100644 --- a/Buffs/Potions/ProfanedRageBuff.cs +++ b/Buffs/Potions/ProfanedRageBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetDefaults() { DisplayName.SetDefault("Profaned Rage"); - Description.SetDefault("Increased crit chance, increased movement and flight speed, and you gain more rage when damaged"); + Description.SetDefault("Increased crit chance, movement and flight speed"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/StatBuffs/AbsoluteRage.png b/Buffs/StatBuffs/AbsoluteRage.png deleted file mode 100644 index bafad70a7b..0000000000 Binary files a/Buffs/StatBuffs/AbsoluteRage.png and /dev/null differ diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.png b/Buffs/StatBuffs/AbyssalDivingSuitBuff.png index 54470f90ca..574d5145e2 100644 Binary files a/Buffs/StatBuffs/AbyssalDivingSuitBuff.png and b/Buffs/StatBuffs/AbyssalDivingSuitBuff.png differ diff --git a/Buffs/StatBuffs/AbyssalDivingSuitPlates.png b/Buffs/StatBuffs/AbyssalDivingSuitPlates.png index 94f799fdbb..a89877f9ad 100644 Binary files a/Buffs/StatBuffs/AbyssalDivingSuitPlates.png and b/Buffs/StatBuffs/AbyssalDivingSuitPlates.png differ diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index 868a334e50..78752bc5f9 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Adrenaline Mode"); - Description.SetDefault("150% damage boost."); + Description.SetDefault("200% damage boost. Can be boosted by other items up to 245%."); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.StatBuffs canBeCleared = false; } - public override void Update(Player player, ref int buffIndex) + public override void Update(Player player, ref int buffIndex) { player.Calamity().adrenalineModeActive = true; } diff --git a/Buffs/StatBuffs/AdrenalineMode.png b/Buffs/StatBuffs/AdrenalineMode.png index 555478a614..bedcc91f12 100644 Binary files a/Buffs/StatBuffs/AdrenalineMode.png and b/Buffs/StatBuffs/AdrenalineMode.png differ diff --git a/Buffs/StatBuffs/Afflicted.cs b/Buffs/StatBuffs/Afflicted.cs index 368e6a2f37..2a6b9ec8c0 100644 --- a/Buffs/StatBuffs/Afflicted.cs +++ b/Buffs/StatBuffs/Afflicted.cs @@ -9,9 +9,11 @@ namespace CalamityMod.Buffs.StatBuffs { DisplayName.SetDefault("Afflicted"); Description.SetDefault("Empowered by otherworldly spirits"); + Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/AvertorBonus.cs b/Buffs/StatBuffs/AvertorBonus.cs new file mode 100644 index 0000000000..81b1f5f6d2 --- /dev/null +++ b/Buffs/StatBuffs/AvertorBonus.cs @@ -0,0 +1,23 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class AvertorBonus : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Avertor Bonus"); + Description.SetDefault("Boosted damage and life regeneration"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().avertorBonus = true; + } + } +} diff --git a/Buffs/StatBuffs/AvertorBonus.png b/Buffs/StatBuffs/AvertorBonus.png new file mode 100644 index 0000000000..020e7e63c1 Binary files /dev/null and b/Buffs/StatBuffs/AvertorBonus.png differ diff --git a/Buffs/StatBuffs/BloodyBoost.cs b/Buffs/StatBuffs/BloodyBoost.cs index b9dbc83448..3f2d09b79c 100644 --- a/Buffs/StatBuffs/BloodyBoost.cs +++ b/Buffs/StatBuffs/BloodyBoost.cs @@ -10,11 +10,10 @@ namespace CalamityMod.Buffs.StatBuffs DisplayName.SetDefault("Bloody Boost"); Description.SetDefault("Increased offensive and defensive stats\n" + "Healing potions grant more health"); - Main.debuff[Type] = true; + Main.debuff[Type] = false; Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; + Main.buffNoSave[Type] = true; longerExpertDebuff = false; - canBeCleared = false; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatBuffs/BossZen.cs b/Buffs/StatBuffs/BossZen.cs index 17f3500cc4..9a089e80c3 100644 --- a/Buffs/StatBuffs/BossZen.cs +++ b/Buffs/StatBuffs/BossZen.cs @@ -7,8 +7,8 @@ namespace CalamityMod.Buffs.StatBuffs { public override void SetDefaults() { - DisplayName.SetDefault("Boss Zen"); - Description.SetDefault("The active boss is reducing spawn rates...a lot"); + DisplayName.SetDefault("Boss Effects"); + Description.SetDefault("This tooltip is edited in the function below"); Main.debuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; @@ -19,5 +19,15 @@ namespace CalamityMod.Buffs.StatBuffs { player.Calamity().bossZen = true; } - } + + public override void ModifyBuffTip(ref string tip, ref int rare) + { + tip = "The nearby boss is:\n" + + "Greatly reducing enemy spawn rates\n" + + "Disabling teleportation effects\n" + + "Increasing Nurse healing cost by 400%\n" + + "Disabling Death Mode weather and biome effects\n" + + "Disabling Target and Super Dummy hitboxes"; + } + } } diff --git a/Buffs/StatBuffs/ScarfMeleeBoost.cs b/Buffs/StatBuffs/DivineBless.cs similarity index 54% rename from Buffs/StatBuffs/ScarfMeleeBoost.cs rename to Buffs/StatBuffs/DivineBless.cs index 2a769c3254..4a75db454f 100644 --- a/Buffs/StatBuffs/ScarfMeleeBoost.cs +++ b/Buffs/StatBuffs/DivineBless.cs @@ -3,21 +3,22 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - public class ScarfMeleeBoost : ModBuff + public class DivineBless : ModBuff { public override void SetDefaults() { - DisplayName.SetDefault("Scarf Boost"); - Description.SetDefault("10% increased damage, 5% increased crit chance, and 5% increased melee speed"); - Main.debuff[Type] = false; + DisplayName.SetDefault("Divine Bless"); + Description.SetDefault("Increased health regen and minions inflict Banishing Fire"); + Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; longerExpertDebuff = false; + canBeCleared = false; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().sMeleeBoost = true; + player.Calamity().divineBless = true; } } } diff --git a/Buffs/StatBuffs/DivineBless.png b/Buffs/StatBuffs/DivineBless.png new file mode 100644 index 0000000000..3d9c73ec00 Binary files /dev/null and b/Buffs/StatBuffs/DivineBless.png differ diff --git a/Buffs/StatBuffs/Encased.cs b/Buffs/StatBuffs/Encased.cs index 3cb9a9afab..ba6d00a94f 100644 --- a/Buffs/StatBuffs/Encased.cs +++ b/Buffs/StatBuffs/Encased.cs @@ -25,7 +25,9 @@ namespace CalamityMod.Buffs.StatBuffs player.immune = true; player.immuneNoBlink = false; player.immuneTime = 90; - } + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; + } } } } diff --git a/Buffs/StatBuffs/EvasionScarfBoost.png b/Buffs/StatBuffs/EvasionScarfBoost.png deleted file mode 100644 index 5e45380f0e..0000000000 Binary files a/Buffs/StatBuffs/EvasionScarfBoost.png and /dev/null differ diff --git a/Buffs/StatBuffs/GraxDefense.png b/Buffs/StatBuffs/GraxDefense.png index 1542ee271c..df09bd9f57 100644 Binary files a/Buffs/StatBuffs/GraxDefense.png and b/Buffs/StatBuffs/GraxDefense.png differ diff --git a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs index 7299addb51..a7dd6475f3 100644 --- a/Buffs/StatBuffs/HallowedRuneAtkBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneAtkBuff.cs @@ -8,17 +8,17 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Hallowed Power"); - Description.SetDefault("Minion damage boosted by 15%"); + Description.SetDefault("Minion damage boosted by 10%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().hallowedPower = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().hallowedPower = true; + player.minionDamage += 0.1f; + } + } } diff --git a/Buffs/StatBuffs/HallowedRuneDefBuff.cs b/Buffs/StatBuffs/HallowedRuneDefBuff.cs index 3e581e9d36..22ed3eb7b9 100644 --- a/Buffs/StatBuffs/HallowedRuneDefBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneDefBuff.cs @@ -8,17 +8,17 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Hallowed Defense"); - Description.SetDefault("Defense boosted by 7 and damage reduction boosted by 7%"); + Description.SetDefault("Defense boosted by 8 and damage reduction boosted by 4%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().hallowedDefense = true; - } + player.statDefense += 8; + player.endurance += 0.04f; + } } } diff --git a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs index c85e46f920..50968cfcde 100644 --- a/Buffs/StatBuffs/HallowedRuneRegenBuff.cs +++ b/Buffs/StatBuffs/HallowedRuneRegenBuff.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Buffs.StatBuffs Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; - Main.buffNoTimeDisplay[Type] = true; longerExpertDebuff = false; } diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs index 0e89d7656b..308e8075fb 100644 --- a/Buffs/StatBuffs/KamiBuff.cs +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -5,12 +5,12 @@ namespace CalamityMod.Buffs.StatBuffs { public class KamiBuff : ModBuff { - public const float RunSpeedBoost = 0.2f; - public const float RunAccelerationBoost = 0.4f; + public const float RunSpeedBoost = 0.15f; + public const float RunAccelerationBoost = 0.15f; public override void SetDefaults() { DisplayName.SetDefault("Kami Injection"); - Description.SetDefault("Increased defense, movement speed, and damage"); + Description.SetDefault("Increased max movement speed, acceleration and damage"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/StatBuffs/EvasionScarfBoost.cs b/Buffs/StatBuffs/PhantomicArmourBuff.cs similarity index 52% rename from Buffs/StatBuffs/EvasionScarfBoost.cs rename to Buffs/StatBuffs/PhantomicArmourBuff.cs index 8e06699c94..82e4305808 100644 --- a/Buffs/StatBuffs/EvasionScarfBoost.cs +++ b/Buffs/StatBuffs/PhantomicArmourBuff.cs @@ -1,14 +1,16 @@ -using Terraria; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - public class EvasionScarfBoost : ModBuff + class PhantomicArmourBuff : ModBuff { public override void SetDefaults() { - DisplayName.SetDefault("Evasion Scarf Boost"); - Description.SetDefault("10% increased damage, 10% increased crit chance, and 15% increased melee speed"); + DisplayName.SetDefault("Phantomic Shield"); + Description.SetDefault("Defense boosted by 10 and damage reduction boosted by 5%\n" + + "An ephemeral bulwark protects you"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -17,7 +19,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().eScarfBoost = true; + player.endurance += 0.05f; + player.statDefense += 10; } } } diff --git a/Buffs/StatBuffs/PhantomicArmourBuff.png b/Buffs/StatBuffs/PhantomicArmourBuff.png new file mode 100644 index 0000000000..4d1a7b731e Binary files /dev/null and b/Buffs/StatBuffs/PhantomicArmourBuff.png differ diff --git a/Buffs/StatBuffs/AbsoluteRage.cs b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs similarity index 62% rename from Buffs/StatBuffs/AbsoluteRage.cs rename to Buffs/StatBuffs/PhantomicEmpowermentBuff.cs index 6ccc912945..868a457554 100644 --- a/Buffs/StatBuffs/AbsoluteRage.cs +++ b/Buffs/StatBuffs/PhantomicEmpowermentBuff.cs @@ -1,14 +1,15 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - public class AbsoluteRage : ModBuff + class PhantomicEmpowermentBuff : ModBuff { public override void SetDefaults() { - DisplayName.SetDefault("Absolute Rage"); - Description.SetDefault("Anger hardens the heart. Boosts max life by 5%."); + DisplayName.SetDefault("Phantomic Empowerment"); + Description.SetDefault("Empowering minion damage by 10%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().absoluteRage = true; + player.minionDamage += 0.1f; } } } diff --git a/Buffs/StatBuffs/PhantomicEmpowermentBuff.png b/Buffs/StatBuffs/PhantomicEmpowermentBuff.png new file mode 100644 index 0000000000..b12fc67afe Binary files /dev/null and b/Buffs/StatBuffs/PhantomicEmpowermentBuff.png differ diff --git a/Buffs/StatBuffs/PhantomicRestorationBuff.cs b/Buffs/StatBuffs/PhantomicRestorationBuff.cs new file mode 100644 index 0000000000..936c8c7af2 --- /dev/null +++ b/Buffs/StatBuffs/PhantomicRestorationBuff.cs @@ -0,0 +1,29 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + class PhantomicRestorationBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Phantomic Regen"); + Description.SetDefault("Regenerating life"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer calPlayer = player.Calamity(); + if (calPlayer.phantomicHeartRegen <= 0) + { + calPlayer.phantomicHeartRegen = 1000; + } + player.lifeRegen += 2; + } + } +} diff --git a/Buffs/StatBuffs/PhantomicRestorationBuff.png b/Buffs/StatBuffs/PhantomicRestorationBuff.png new file mode 100644 index 0000000000..806d74e358 Binary files /dev/null and b/Buffs/StatBuffs/PhantomicRestorationBuff.png differ diff --git a/Buffs/StatBuffs/ProfanedCrystalBuff.cs b/Buffs/StatBuffs/ProfanedCrystalBuff.cs index a8918d9379..72bfce7a05 100644 --- a/Buffs/StatBuffs/ProfanedCrystalBuff.cs +++ b/Buffs/StatBuffs/ProfanedCrystalBuff.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Buffs.StatBuffs tip = "You are an emissary of the profaned goddess now!\n" + (offense ? "The " + (Main.dayTime ? "light of the sun" : "heat of the lava") + " empowers your offensive capabilities" : "The " + (player.wet ? (player.honeyWet ? "honey cools" : "water douses") : "darkness of night cools") + " your flames, empowering your defensive capabilities") + - (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); + (enrage ? "\nYour weakened life force fuels your desperate attacks" : ""); } } else if (CalamityWorld.downedSCal) diff --git a/Buffs/StatBuffs/RageMode.cs b/Buffs/StatBuffs/RageMode.cs index 3b4b889811..9c2a245ac4 100644 --- a/Buffs/StatBuffs/RageMode.cs +++ b/Buffs/StatBuffs/RageMode.cs @@ -1,24 +1,41 @@ +using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatBuffs { - public class RageMode : ModBuff + public class RageMode : ModBuff { public override void SetDefaults() { DisplayName.SetDefault("Rage Mode"); - Description.SetDefault("50% damage boost. Can be boosted by other items up to 110%."); + Description.SetDefault("35% damage boost."); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; + Main.buffNoTimeDisplay[Type] = true; // Because duration is variable, time is not displayed. longerExpertDebuff = false; canBeCleared = false; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().rageModeActive = true; + CalamityPlayer mp = player.Calamity(); + + // If the player still has Rage left to burn, the buff stays active indefinitely. + if (mp.rage > 0f) + { + player.buffTime[buffIndex] = 2; // Every frame, give another frame for the buff to live. + mp.rageModeActive = true; + } + + // Otherwise, Rage Mode ends instantly. + else + { + 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/ScarfMeleeBoost.png b/Buffs/StatBuffs/ScarfMeleeBoost.png deleted file mode 100644 index 60b9c9e6db..0000000000 Binary files a/Buffs/StatBuffs/ScarfMeleeBoost.png and /dev/null differ diff --git a/Buffs/StatBuffs/ShellBoost.png b/Buffs/StatBuffs/ShellBoost.png index e4fa934dc2..72926348cd 100644 Binary files a/Buffs/StatBuffs/ShellBoost.png and b/Buffs/StatBuffs/ShellBoost.png differ diff --git a/Buffs/StatBuffs/SilvaRevival.cs b/Buffs/StatBuffs/SilvaRevival.cs index d8a6574a55..160890cc95 100644 --- a/Buffs/StatBuffs/SilvaRevival.cs +++ b/Buffs/StatBuffs/SilvaRevival.cs @@ -7,8 +7,8 @@ namespace CalamityMod.Buffs.StatBuffs { public override void SetDefaults() { - DisplayName.SetDefault("Silva Invulnerability"); - Description.SetDefault("You are invulnerable"); + DisplayName.SetDefault("Silva Immunity"); + Description.SetDefault("You are unkillable and immune to most debuffs"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs b/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs index 0a4ebc1aa8..50a4402d21 100644 --- a/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorAtkBuff.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Buffs.StatBuffs longerExpertDebuff = false; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().sPower = true; - } - } + public override void Update(Player player, ref int buffIndex) + { + player.minionDamage += 0.1f; + } + } } diff --git a/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs b/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs index 3dcf4b7f7c..d4136d4bc4 100644 --- a/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs +++ b/Buffs/StatBuffs/SpiritGeneratorDefBuff.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void SetDefaults() { DisplayName.SetDefault("Spirit Defense"); - Description.SetDefault("Defense boosted by 5 and damage reduction boosted by 5%"); + Description.SetDefault("Defense boosted by 6 and damage reduction boosted by 3%"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -18,7 +18,8 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().sDefense = true; - } + player.statDefense += 6; + player.endurance += 0.03f; + } } } diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index 9b38185583..6041669534 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -19,6 +20,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().eutrophication < npc.buffTime[buffIndex]) npc.Calamity().eutrophication = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().eutrophication; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/ExoFreeze.cs b/Buffs/StatDebuffs/ExoFreeze.cs index 157c74ec41..a28b0b02c7 100644 --- a/Buffs/StatDebuffs/ExoFreeze.cs +++ b/Buffs/StatDebuffs/ExoFreeze.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -19,6 +20,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().eFreeze < npc.buffTime[buffIndex]) npc.Calamity().eFreeze = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().eFreeze; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/ExtremeGrav.cs b/Buffs/StatDebuffs/ExtremeGrav.cs index 6109c1b548..5c9b9538c7 100644 --- a/Buffs/StatDebuffs/ExtremeGrav.cs +++ b/Buffs/StatDebuffs/ExtremeGrav.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void SetDefaults() { DisplayName.SetDefault("Extreme Gravity"); - Description.SetDefault("Your wing time is reduced by 50%, infinite flight is disabled"); + Description.SetDefault("Your wing time is reduced by 25%, infinite flight is disabled"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = true; Main.pvpBuff[Type] = true; diff --git a/Buffs/StatDebuffs/ExtremeGravity.cs b/Buffs/StatDebuffs/ExtremeGravity.cs index 90ea126bbf..d1c18b0f93 100644 --- a/Buffs/StatDebuffs/ExtremeGravity.cs +++ b/Buffs/StatDebuffs/ExtremeGravity.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void SetDefaults() { DisplayName.SetDefault("Icarus' Folly"); - Description.SetDefault("Your wing time is reduced by 75%, infinite flight is disabled"); + Description.SetDefault("Your wing time is reduced by 33%, infinite flight is disabled"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index fd6d0e04bd..adc1477f38 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -26,6 +27,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().gState < npc.buffTime[buffIndex]) npc.Calamity().gState = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().gState; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/Horror.cs b/Buffs/StatDebuffs/Horror.cs deleted file mode 100644 index 7c50ba4797..0000000000 --- a/Buffs/StatDebuffs/Horror.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatDebuffs -{ - public class Horror : ModBuff - { - public override void SetDefaults() - { - DisplayName.SetDefault("Horror"); - Description.SetDefault("The horror..."); - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - longerExpertDebuff = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().horror = true; - } - - public override void ModifyBuffTip(ref string tip, ref int rare) - { - Player player = Main.player[Main.myPlayer]; - if (player.Calamity().laudanum || player.Calamity().draedonsHeart) - { - tip = "The horror fuels your strength"; - } - } - } -} diff --git a/Buffs/StatDebuffs/Irradiated.png b/Buffs/StatDebuffs/Irradiated.png index 3518163824..60106814b8 100644 Binary files a/Buffs/StatDebuffs/Irradiated.png and b/Buffs/StatDebuffs/Irradiated.png differ diff --git a/Buffs/StatDebuffs/KamiDebuff.cs b/Buffs/StatDebuffs/KamiDebuff.cs index d554fa2441..deb76094a7 100644 --- a/Buffs/StatDebuffs/KamiDebuff.cs +++ b/Buffs/StatDebuffs/KamiDebuff.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -6,7 +7,8 @@ namespace CalamityMod.Buffs.StatDebuffs public class KamiDebuff : ModBuff { public const float MultiplicativeDamageReduction = 0.8f; - public const float MaxNPCSpeed = 16f; // 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). + // 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() { DisplayName.SetDefault("Kami Flu"); @@ -21,6 +23,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().kamiFlu; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/MarkedforDeath.cs b/Buffs/StatDebuffs/MarkedforDeath.cs index be18d5d313..6f56f672ff 100644 --- a/Buffs/StatDebuffs/MarkedforDeath.cs +++ b/Buffs/StatDebuffs/MarkedforDeath.cs @@ -24,10 +24,5 @@ namespace CalamityMod.Buffs.StatDebuffs npc.DelBuff(buffIndex); buffIndex--; } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().marked = true; - } } } diff --git a/Buffs/StatDebuffs/SilvaStun.cs b/Buffs/StatDebuffs/SilvaStun.cs index e186e72022..6388e2e8f2 100644 --- a/Buffs/StatDebuffs/SilvaStun.cs +++ b/Buffs/StatDebuffs/SilvaStun.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -19,6 +20,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().silvaStun < npc.buffTime[buffIndex]) npc.Calamity().silvaStun = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().silvaStun; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index fb7bc94f0d..a98e113444 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -19,6 +20,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tSad < npc.buffTime[buffIndex]) npc.Calamity().tSad = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tSad; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/TeslaFreeze.cs b/Buffs/StatDebuffs/TeslaFreeze.cs index 737c889a20..633211b0b5 100644 --- a/Buffs/StatDebuffs/TeslaFreeze.cs +++ b/Buffs/StatDebuffs/TeslaFreeze.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -19,6 +20,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tesla < npc.buffTime[buffIndex]) npc.Calamity().tesla = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tesla; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/TimeSlow.cs b/Buffs/StatDebuffs/TimeSlow.cs index 1e0607b3b1..fad83a3d71 100644 --- a/Buffs/StatDebuffs/TimeSlow.cs +++ b/Buffs/StatDebuffs/TimeSlow.cs @@ -1,3 +1,4 @@ +using CalamityMod.NPCs; using Terraria; using Terraria.ModLoader; @@ -20,6 +21,8 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().timeSlow < npc.buffTime[buffIndex]) npc.Calamity().timeSlow = npc.buffTime[buffIndex]; + if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().timeSlow; npc.DelBuff(buffIndex); buffIndex--; } diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index 5a27e7c6b0..75e5a271d6 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void SetDefaults() { DisplayName.SetDefault("Whispering Death"); - Description.SetDefault("Death approaches; defense, attack power, and life regen reduced"); + Description.SetDefault("Death approaches; defense, movement speed, attack power and life regen reduced"); Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; diff --git a/Buffs/Summon/AerospecSummonSetBuff.cs b/Buffs/Summon/AerospecSummonSetBuff.cs index 37d8bef107..a95ef8e8f7 100644 --- a/Buffs/Summon/AerospecSummonSetBuff.cs +++ b/Buffs/Summon/AerospecSummonSetBuff.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The valkyrie will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Summon/ApexSharkBuff.cs b/Buffs/Summon/ApexSharkBuff.cs index a0fc7aae8f..918c599947 100644 --- a/Buffs/Summon/ApexSharkBuff.cs +++ b/Buffs/Summon/ApexSharkBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Ancient yet so dangerous"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/AquaticStar.cs b/Buffs/Summon/AquaticStar.cs index b39e07eb93..4c90da5b18 100644 --- a/Buffs/Summon/AquaticStar.cs +++ b/Buffs/Summon/AquaticStar.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The aquatic star will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/AquaticStar.png b/Buffs/Summon/AquaticStar.png index 7f06fa9055..d99a0b8a19 100644 Binary files a/Buffs/Summon/AquaticStar.png and b/Buffs/Summon/AquaticStar.png differ diff --git a/Buffs/Summon/AstrageldonBuff.cs b/Buffs/Summon/AstrageldonBuff.cs index c5e3899221..41ffe09314 100644 --- a/Buffs/Summon/AstrageldonBuff.cs +++ b/Buffs/Summon/AstrageldonBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The mini astrageldon slime will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/AstralProbeBuff.cs b/Buffs/Summon/AstralProbeBuff.cs index d2e2aa00f4..ec79cf665c 100644 --- a/Buffs/Summon/AstralProbeBuff.cs +++ b/Buffs/Summon/AstralProbeBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The astral probe will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/AstralProbeBuff.png b/Buffs/Summon/AstralProbeBuff.png index d8d97e9fab..41527d4fb7 100644 Binary files a/Buffs/Summon/AstralProbeBuff.png and b/Buffs/Summon/AstralProbeBuff.png differ diff --git a/Buffs/Summon/AtaxiaSummonSetBuff.cs b/Buffs/Summon/AtaxiaSummonSetBuff.cs index 74410d174b..99db5f664d 100644 --- a/Buffs/Summon/AtaxiaSummonSetBuff.cs +++ b/Buffs/Summon/AtaxiaSummonSetBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The hydrothermic vent will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/BelladonnaSpiritBuff.cs b/Buffs/Summon/BelladonnaSpiritBuff.cs index ad0d47453d..d19200e5cc 100644 --- a/Buffs/Summon/BelladonnaSpiritBuff.cs +++ b/Buffs/Summon/BelladonnaSpiritBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A cute forest spirit is following you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/BlackHawkBuff.cs b/Buffs/Summon/BlackHawkBuff.cs index 6f4a5bed3e..2e864b05c6 100644 --- a/Buffs/Summon/BlackHawkBuff.cs +++ b/Buffs/Summon/BlackHawkBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The fighter jet will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/BloodClot.cs b/Buffs/Summon/BloodClot.cs index 548da363c2..c531351efb 100644 --- a/Buffs/Summon/BloodClot.cs +++ b/Buffs/Summon/BloodClot.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The blood clot will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/BloodDragonsBuff.cs b/Buffs/Summon/BloodDragonsBuff.cs index 503292544b..ee0cc8c5ab 100644 --- a/Buffs/Summon/BloodDragonsBuff.cs +++ b/Buffs/Summon/BloodDragonsBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Big happy family"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/BrimstoneWaifu.cs b/Buffs/Summon/BrimstoneWaifu.cs index f76f1420e5..6c2abd436d 100644 --- a/Buffs/Summon/BrimstoneWaifu.cs +++ b/Buffs/Summon/BrimstoneWaifu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The brimstone elemental will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/BrittleStar.cs b/Buffs/Summon/BrittleStar.cs index d5b1d85040..9c6b0ca3e1 100644 --- a/Buffs/Summon/BrittleStar.cs +++ b/Buffs/Summon/BrittleStar.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The brittle star will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/Calamari.cs b/Buffs/Summon/Calamari.cs index 91b3f2726d..12878cdac7 100644 --- a/Buffs/Summon/Calamari.cs +++ b/Buffs/Summon/Calamari.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The squid will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CalamitasEyes.cs b/Buffs/Summon/CalamitasEyes.cs index a2c9c3b9c5..a33ee47b09 100644 --- a/Buffs/Summon/CalamitasEyes.cs +++ b/Buffs/Summon/CalamitasEyes.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Calamitas and her brothers will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CausticStaffBuff.cs b/Buffs/Summon/CausticStaffBuff.cs index 2c905a1c88..1ae34f974f 100644 --- a/Buffs/Summon/CausticStaffBuff.cs +++ b/Buffs/Summon/CausticStaffBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A mini jungle dragon is following you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CinderBlossomBuff.cs b/Buffs/Summon/CinderBlossomBuff.cs index 3b3c2dba89..a4bd4bce5e 100644 --- a/Buffs/Summon/CinderBlossomBuff.cs +++ b/Buffs/Summon/CinderBlossomBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A hot, searing flower is floating uncomfortably close to you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CloudyWaifu.cs b/Buffs/Summon/CloudyWaifu.cs index 9a2cb48fae..9dc93e5a53 100644 --- a/Buffs/Summon/CloudyWaifu.cs +++ b/Buffs/Summon/CloudyWaifu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The cloud elemental will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ColdDivinityBuff.cs b/Buffs/Summon/ColdDivinityBuff.cs index f0a86170d7..9a12a2a952 100644 --- a/Buffs/Summon/ColdDivinityBuff.cs +++ b/Buffs/Summon/ColdDivinityBuff.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The magic of the ancient ice castle will aid you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/Corroslime.cs b/Buffs/Summon/Corroslime.cs index 4ffd7714e1..2e382b45a2 100644 --- a/Buffs/Summon/Corroslime.cs +++ b/Buffs/Summon/Corroslime.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The corroslime will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CorvidHarbringerBuff.cs b/Buffs/Summon/CorvidHarbringerBuff.cs index 4a591c6455..ffaaf1234d 100644 --- a/Buffs/Summon/CorvidHarbringerBuff.cs +++ b/Buffs/Summon/CorvidHarbringerBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The powerful raven will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CosmicEnergy.cs b/Buffs/Summon/CosmicEnergy.cs index efc871a22f..9cb70f24f5 100644 --- a/Buffs/Summon/CosmicEnergy.cs +++ b/Buffs/Summon/CosmicEnergy.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The cosmic energy will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CosmicViperEngineBuff.cs b/Buffs/Summon/CosmicViperEngineBuff.cs index bad55ac031..83f8987f42 100644 --- a/Buffs/Summon/CosmicViperEngineBuff.cs +++ b/Buffs/Summon/CosmicViperEngineBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The cosmic gunship will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/CosmilampBuff.cs b/Buffs/Summon/CosmilampBuff.cs index 8cefa9079e..77464bc8cd 100644 --- a/Buffs/Summon/CosmilampBuff.cs +++ b/Buffs/Summon/CosmilampBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The cosmilamp will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/Crimslime.cs b/Buffs/Summon/Crimslime.cs index d34856484c..7fd7a035a3 100644 --- a/Buffs/Summon/Crimslime.cs +++ b/Buffs/Summon/Crimslime.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The crimslime will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/DaedalusGolemBuff.cs b/Buffs/Summon/DaedalusGolemBuff.cs new file mode 100644 index 0000000000..6c0972e123 --- /dev/null +++ b/Buffs/Summon/DaedalusGolemBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class DaedalusGolemBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Daedalus Golem"); + Description.SetDefault("A crystal golem is following you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.daedalusGolem = true; + } + if (!modPlayer.daedalusGolem) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/DaedalusGolemBuff.png b/Buffs/Summon/DaedalusGolemBuff.png new file mode 100644 index 0000000000..011938595e Binary files /dev/null and b/Buffs/Summon/DaedalusGolemBuff.png differ diff --git a/Buffs/Summon/DaedalusSummonSetBuff.cs b/Buffs/Summon/DaedalusSummonSetBuff.cs index e7e9d0d86f..a6affebc01 100644 --- a/Buffs/Summon/DaedalusSummonSetBuff.cs +++ b/Buffs/Summon/DaedalusSummonSetBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The daedalus crystal will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/DankCreeperBuff.cs b/Buffs/Summon/DankCreeperBuff.cs index e28fa746b0..9dc3c0a443 100644 --- a/Buffs/Summon/DankCreeperBuff.cs +++ b/Buffs/Summon/DankCreeperBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The dank creeper will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/DazzlingStabberBuff.cs b/Buffs/Summon/DazzlingStabberBuff.cs index 617011a0dd..bb6118fe65 100644 --- a/Buffs/Summon/DazzlingStabberBuff.cs +++ b/Buffs/Summon/DazzlingStabberBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("En garde"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/DeathstareBuff.cs b/Buffs/Summon/DeathstareBuff.cs new file mode 100644 index 0000000000..8c3de83967 --- /dev/null +++ b/Buffs/Summon/DeathstareBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class DeathstareBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Miniature Eye of Cthulhu"); + Description.SetDefault("It's watching you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.deathstareEyeball = true; + } + if (!modPlayer.deathstareEyeball) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/DeathstareBuff.png b/Buffs/Summon/DeathstareBuff.png new file mode 100644 index 0000000000..eaf73dcf4e Binary files /dev/null and b/Buffs/Summon/DeathstareBuff.png differ diff --git a/Buffs/Summon/DemonshadeSetDevilBuff.cs b/Buffs/Summon/DemonshadeSetDevilBuff.cs index 7e80a547c2..51514b57e2 100644 --- a/Buffs/Summon/DemonshadeSetDevilBuff.cs +++ b/Buffs/Summon/DemonshadeSetDevilBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The red devil will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/DormantBrimseekerBuff.cs b/Buffs/Summon/DormantBrimseekerBuff.cs index ad5a137102..10fd57279a 100644 --- a/Buffs/Summon/DormantBrimseekerBuff.cs +++ b/Buffs/Summon/DormantBrimseekerBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Does it want something from you?"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ElementalAxeBuff.cs b/Buffs/Summon/ElementalAxeBuff.cs index a9385b935c..b3336ea651 100644 --- a/Buffs/Summon/ElementalAxeBuff.cs +++ b/Buffs/Summon/ElementalAxeBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The elemental axe will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/EndoCooperBuff.cs b/Buffs/Summon/EndoCooperBuff.cs index 92b0cf846a..5681b1117a 100644 --- a/Buffs/Summon/EndoCooperBuff.cs +++ b/Buffs/Summon/EndoCooperBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The ascened Cooper will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/EndoHydraBuff.cs b/Buffs/Summon/EndoHydraBuff.cs index 4881c756db..22c942ca01 100644 --- a/Buffs/Summon/EndoHydraBuff.cs +++ b/Buffs/Summon/EndoHydraBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The endo hydra will protect you... for some reason"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/EyeOfNightBuff.cs b/Buffs/Summon/EyeOfNightBuff.cs new file mode 100644 index 0000000000..db3f86b42b --- /dev/null +++ b/Buffs/Summon/EyeOfNightBuff.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class EyeOfNightBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Eye of Night"); + Description.SetDefault("It eerily watches"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.eyeOfNight = true; + + if (modPlayer.eyeOfNight) + player.buffTime[buffIndex] = 18000; + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/Summon/EyeOfNightBuff.png b/Buffs/Summon/EyeOfNightBuff.png new file mode 100644 index 0000000000..e4f07e8ac0 Binary files /dev/null and b/Buffs/Summon/EyeOfNightBuff.png differ diff --git a/Buffs/Summon/FleshOfInfidelityBuff.cs b/Buffs/Summon/FleshOfInfidelityBuff.cs new file mode 100644 index 0000000000..fea7a77d87 --- /dev/null +++ b/Buffs/Summon/FleshOfInfidelityBuff.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class FleshOfInfidelityBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Flesh Ball"); + Description.SetDefault("Why is it following you?"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.fleshBall = true; + + if (modPlayer.fleshBall) + player.buffTime[buffIndex] = 18000; + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/Summon/FleshOfInfidelityBuff.png b/Buffs/Summon/FleshOfInfidelityBuff.png new file mode 100644 index 0000000000..5fadbf39f8 Binary files /dev/null and b/Buffs/Summon/FleshOfInfidelityBuff.png differ diff --git a/Buffs/Summon/FlowersOfMortalityBuff.cs b/Buffs/Summon/FlowersOfMortalityBuff.cs new file mode 100644 index 0000000000..a27ece7655 --- /dev/null +++ b/Buffs/Summon/FlowersOfMortalityBuff.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class FlowersOfMortalityBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Flowers of Mortality"); + Description.SetDefault("Celestial blossoms surround you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.flowersOfMortality = true; + + if (!modPlayer.flowersOfMortality) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/FlowersOfMortalityBuff.png b/Buffs/Summon/FlowersOfMortalityBuff.png new file mode 100644 index 0000000000..dbba97dc87 Binary files /dev/null and b/Buffs/Summon/FlowersOfMortalityBuff.png differ diff --git a/Buffs/Summon/FrostBlossomBuff.cs b/Buffs/Summon/FrostBlossomBuff.cs index 3a122b9b10..ea3b506cb3 100644 --- a/Buffs/Summon/FrostBlossomBuff.cs +++ b/Buffs/Summon/FrostBlossomBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A cold, prickly flower is floating uncomfortably close to you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/FuelCellBundleBuff.cs b/Buffs/Summon/FuelCellBundleBuff.cs index 8516a54014..ee2d51fb4d 100644 --- a/Buffs/Summon/FuelCellBundleBuff.cs +++ b/Buffs/Summon/FuelCellBundleBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A small plague bee is following you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/FungalClumpBuff.cs b/Buffs/Summon/FungalClumpBuff.cs index 94cd8cde15..d863ceb510 100644 --- a/Buffs/Summon/FungalClumpBuff.cs +++ b/Buffs/Summon/FungalClumpBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The fungal clump will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/GammaHeadBuff.cs b/Buffs/Summon/GammaHeadBuff.cs index 0f4e4a7780..750afdbaf6 100644 --- a/Buffs/Summon/GammaHeadBuff.cs +++ b/Buffs/Summon/GammaHeadBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("..."); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/GastricBelcherBuff.cs b/Buffs/Summon/GastricBelcherBuff.cs index e45bba25a9..fea1b0801f 100644 --- a/Buffs/Summon/GastricBelcherBuff.cs +++ b/Buffs/Summon/GastricBelcherBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The aquatic aberration will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/GladiatorSwords.cs b/Buffs/Summon/GladiatorSwords.cs index 41c70bcd19..d0dcb8e1c2 100644 --- a/Buffs/Summon/GladiatorSwords.cs +++ b/Buffs/Summon/GladiatorSwords.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The gladiator swords will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/GladiatorSwords.png b/Buffs/Summon/GladiatorSwords.png index cd4eb7b512..2df6ad7858 100644 Binary files a/Buffs/Summon/GladiatorSwords.png and b/Buffs/Summon/GladiatorSwords.png differ diff --git a/Buffs/Summon/HauntedDishesBuff.cs b/Buffs/Summon/HauntedDishesBuff.cs index 47c6bb93d9..8a7989a18c 100644 --- a/Buffs/Summon/HauntedDishesBuff.cs +++ b/Buffs/Summon/HauntedDishesBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The haunted dishes will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/HermitCrab.cs b/Buffs/Summon/HermitCrab.cs index 993e4c790d..d3a71c9d60 100644 --- a/Buffs/Summon/HermitCrab.cs +++ b/Buffs/Summon/HermitCrab.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The hermit crab will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/Herring.cs b/Buffs/Summon/Herring.cs index 8d43413354..fb7ddb02d8 100644 --- a/Buffs/Summon/Herring.cs +++ b/Buffs/Summon/Herring.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The herring will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/HotE.cs b/Buffs/Summon/HotE.cs index cd1317c2df..db7f0f970b 100644 --- a/Buffs/Summon/HotE.cs +++ b/Buffs/Summon/HotE.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("All elementals will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/HowlTrio.cs b/Buffs/Summon/HowlTrio.cs index ea712a2957..2feb16d8e2 100644 --- a/Buffs/Summon/HowlTrio.cs +++ b/Buffs/Summon/HowlTrio.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Howl protects you, Calcifer lights your way, Turnip-Head stalks you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/IceClasper.cs b/Buffs/Summon/IceClasper.cs index 8386cb470e..4e3c378a9e 100644 --- a/Buffs/Summon/IceClasper.cs +++ b/Buffs/Summon/IceClasper.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The ice clasper will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/IgneousExaltationBuff.cs b/Buffs/Summon/IgneousExaltationBuff.cs index c44d973dfa..9294ea8b97 100644 --- a/Buffs/Summon/IgneousExaltationBuff.cs +++ b/Buffs/Summon/IgneousExaltationBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A blade is orbiting you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs index 5492e4063a..dcae1e8800 100644 --- a/Buffs/Summon/MagicHatBuff.cs +++ b/Buffs/Summon/MagicHatBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The hat carries your soul, bound by a contract"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/Mechworm.cs b/Buffs/Summon/Mechworm.cs index f659c0ae82..622fabdbb6 100644 --- a/Buffs/Summon/Mechworm.cs +++ b/Buffs/Summon/Mechworm.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The mechworm will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/MidnightSunBuff.cs b/Buffs/Summon/MidnightSunBuff.cs index 1170e9ec53..57512cc571 100644 --- a/Buffs/Summon/MidnightSunBuff.cs +++ b/Buffs/Summon/MidnightSunBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A strange UFO is observing you, and it's making you very uncomfortable"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/MountedScannerBuff.cs b/Buffs/Summon/MountedScannerBuff.cs index 46ac809919..e04d349368 100644 --- a/Buffs/Summon/MountedScannerBuff.cs +++ b/Buffs/Summon/MountedScannerBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Powerful machinery surrounds you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/MutatedTruffleBuff.cs b/Buffs/Summon/MutatedTruffleBuff.cs index 44679632b7..52abdb72cc 100644 --- a/Buffs/Summon/MutatedTruffleBuff.cs +++ b/Buffs/Summon/MutatedTruffleBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The young duke will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/PerditionBuff.cs b/Buffs/Summon/PerditionBuff.cs new file mode 100644 index 0000000000..1773a82e3e --- /dev/null +++ b/Buffs/Summon/PerditionBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class PerditionBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Perdition"); + Description.SetDefault("How unfortunate"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.perditionBeacon = true; + + if (!modPlayer.perditionBeacon) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/PerditionBuff.png b/Buffs/Summon/PerditionBuff.png new file mode 100644 index 0000000000..256653f0de Binary files /dev/null and b/Buffs/Summon/PerditionBuff.png differ diff --git a/Buffs/Summon/Phantom.cs b/Buffs/Summon/Phantom.cs index f1816c2448..7fb60bc693 100644 --- a/Buffs/Summon/Phantom.cs +++ b/Buffs/Summon/Phantom.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The phantom will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/PlaguePrincessBuff.cs b/Buffs/Summon/PlaguePrincessBuff.cs index 21c0a8df4d..ef4ec31272 100644 --- a/Buffs/Summon/PlaguePrincessBuff.cs +++ b/Buffs/Summon/PlaguePrincessBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("It’s a shame you can’t hug her"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/PlaguebringerSummonBuff.cs b/Buffs/Summon/PlaguebringerSummonBuff.cs index d8c85cf10b..14407a9d54 100644 --- a/Buffs/Summon/PlaguebringerSummonBuff.cs +++ b/Buffs/Summon/PlaguebringerSummonBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The plaguebringer will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/PlantationBuff.cs b/Buffs/Summon/PlantationBuff.cs index c8e7c2711d..5922ae7e0e 100644 --- a/Buffs/Summon/PlantationBuff.cs +++ b/Buffs/Summon/PlantationBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The miniature plantera will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/PoleWarperBuff.cs b/Buffs/Summon/PoleWarperBuff.cs index bc0ae8af1d..4c66ae794e 100644 --- a/Buffs/Summon/PoleWarperBuff.cs +++ b/Buffs/Summon/PoleWarperBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Sentient magnets are attracted to you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ProfanedBabs.cs b/Buffs/Summon/ProfanedBabs.cs index 9edf4b243e..dbf7f73f2a 100644 --- a/Buffs/Summon/ProfanedBabs.cs +++ b/Buffs/Summon/ProfanedBabs.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The healer will heal your wounds!"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/RadiantResolutionBuff.cs b/Buffs/Summon/RadiantResolutionBuff.cs index 460968bc6f..72cec1f0ea 100644 --- a/Buffs/Summon/RadiantResolutionBuff.cs +++ b/Buffs/Summon/RadiantResolutionBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A radiant aura protects you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ResurrectionButterflyBuff.cs b/Buffs/Summon/ResurrectionButterflyBuff.cs index f72ddf19d1..60a5811e93 100644 --- a/Buffs/Summon/ResurrectionButterflyBuff.cs +++ b/Buffs/Summon/ResurrectionButterflyBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Sleep beneath the Cherry Blossoms, Red-White Butterfly"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/RustyDroneBuff.cs b/Buffs/Summon/RustyDroneBuff.cs index c2186b33dc..31b44129c3 100644 --- a/Buffs/Summon/RustyDroneBuff.cs +++ b/Buffs/Summon/RustyDroneBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A pitifully fragile drone is observing you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SageSpiritBuff.cs b/Buffs/Summon/SageSpiritBuff.cs new file mode 100644 index 0000000000..45034d0575 --- /dev/null +++ b/Buffs/Summon/SageSpiritBuff.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SageSpiritBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sage Spirit"); + Description.SetDefault("It's uncomfortably close"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.sageSpirit = true; + + if (modPlayer.sageSpirit) + player.buffTime[buffIndex] = 18000; + else + { + player.DelBuff(buffIndex); + buffIndex--; + } + } + } +} diff --git a/Buffs/Summon/SageSpiritBuff.png b/Buffs/Summon/SageSpiritBuff.png new file mode 100644 index 0000000000..6f96cea427 Binary files /dev/null and b/Buffs/Summon/SageSpiritBuff.png differ diff --git a/Buffs/Summon/Sandnado.cs b/Buffs/Summon/Sandnado.cs index 5dc6c30805..f29e060c85 100644 --- a/Buffs/Summon/Sandnado.cs +++ b/Buffs/Summon/Sandnado.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The sandnado will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SandyHealingWaifu.cs b/Buffs/Summon/SandyHealingWaifu.cs index e733a62a75..6f33129535 100644 --- a/Buffs/Summon/SandyHealingWaifu.cs +++ b/Buffs/Summon/SandyHealingWaifu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The sand elemental will heal you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SandyWaifu.cs b/Buffs/Summon/SandyWaifu.cs index 7abdd05fd2..b3c5b379be 100644 --- a/Buffs/Summon/SandyWaifu.cs +++ b/Buffs/Summon/SandyWaifu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The sand elemental will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ScabRipperBuff.cs b/Buffs/Summon/ScabRipperBuff.cs index 2136bacae3..da31bcba76 100644 --- a/Buffs/Summon/ScabRipperBuff.cs +++ b/Buffs/Summon/ScabRipperBuff.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The baby blood crawler will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SepulcherMinionBuff.cs b/Buffs/Summon/SepulcherMinionBuff.cs new file mode 100644 index 0000000000..34910472ba --- /dev/null +++ b/Buffs/Summon/SepulcherMinionBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SepulcherMinionBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Sepulcher"); + Description.SetDefault("It is not benevolent"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.sepulcher = true; + + if (!modPlayer.sepulcher) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/SepulcherMinionBuff.png b/Buffs/Summon/SepulcherMinionBuff.png new file mode 100644 index 0000000000..5eeae4fa2b Binary files /dev/null and b/Buffs/Summon/SepulcherMinionBuff.png differ diff --git a/Buffs/Summon/ShellfishBuff.cs b/Buffs/Summon/ShellfishBuff.cs index bda0345ae6..b3657f45b5 100644 --- a/Buffs/Summon/ShellfishBuff.cs +++ b/Buffs/Summon/ShellfishBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The shellfish will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SilvaSummonSetBuff.cs b/Buffs/Summon/SilvaSummonSetBuff.cs index 28fdad2904..73bae9adc7 100644 --- a/Buffs/Summon/SilvaSummonSetBuff.cs +++ b/Buffs/Summon/SilvaSummonSetBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The crystal will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SiriusBuff.cs b/Buffs/Summon/SiriusBuff.cs index cf492ce041..9bc62aafd9 100644 --- a/Buffs/Summon/SiriusBuff.cs +++ b/Buffs/Summon/SiriusBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A bit too bright, but it helps you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SnakeEyesBuff.cs b/Buffs/Summon/SnakeEyesBuff.cs index bc3234a40d..15fbc0c159 100644 --- a/Buffs/Summon/SnakeEyesBuff.cs +++ b/Buffs/Summon/SnakeEyesBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Always watching..."); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SolarSpirit.cs b/Buffs/Summon/SolarSpirit.cs index 2216a3c3ed..c6cb35c54a 100644 --- a/Buffs/Summon/SolarSpirit.cs +++ b/Buffs/Summon/SolarSpirit.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The solar spirit will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SolarSpiritGod.cs b/Buffs/Summon/SolarSpiritGod.cs index fa9c842496..a2629c246d 100644 --- a/Buffs/Summon/SolarSpiritGod.cs +++ b/Buffs/Summon/SolarSpiritGod.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The solar god spirit will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/SoulSeekerBuff.cs b/Buffs/Summon/SoulSeekerBuff.cs new file mode 100644 index 0000000000..e552084a4b --- /dev/null +++ b/Buffs/Summon/SoulSeekerBuff.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class SoulSeekerBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Soul Seeker"); + Description.SetDefault("It definitely wants something from you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.soulSeeker = true; + + if (!modPlayer.soulSeeker) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/SoulSeekerBuff.png b/Buffs/Summon/SoulSeekerBuff.png new file mode 100644 index 0000000000..fe6b96bed3 Binary files /dev/null and b/Buffs/Summon/SoulSeekerBuff.png differ diff --git a/Buffs/Summon/SquirrelSquireBuff.cs b/Buffs/Summon/SquirrelSquireBuff.cs index 520a2b48d2..1f74d53b1f 100644 --- a/Buffs/Summon/SquirrelSquireBuff.cs +++ b/Buffs/Summon/SquirrelSquireBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The squirrel squire will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/StaffOfNecrosteocytesBuff.cs b/Buffs/Summon/StaffOfNecrosteocytesBuff.cs index 5b26a4103b..06d352fa34 100644 --- a/Buffs/Summon/StaffOfNecrosteocytesBuff.cs +++ b/Buffs/Summon/StaffOfNecrosteocytesBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A skeleton is observing you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/StarSwallowerBuff.cs b/Buffs/Summon/StarSwallowerBuff.cs index 62c01a7f7e..264233b4ff 100644 --- a/Buffs/Summon/StarSwallowerBuff.cs +++ b/Buffs/Summon/StarSwallowerBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Mmmm myes"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/StatigelSummonSetBuff.cs b/Buffs/Summon/StatigelSummonSetBuff.cs index b319cf7328..27d8e1deb3 100644 --- a/Buffs/Summon/StatigelSummonSetBuff.cs +++ b/Buffs/Summon/StatigelSummonSetBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The slime god will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/StormjawBuff.cs b/Buffs/Summon/StormjawBuff.cs index f5e283f0dc..29f00f42ce 100644 --- a/Buffs/Summon/StormjawBuff.cs +++ b/Buffs/Summon/StormjawBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The baby stormlion will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.cs b/Buffs/Summon/TacticalPlagueEngineBuff.cs index 353a7bf3a2..79c38a7a82 100644 --- a/Buffs/Summon/TacticalPlagueEngineBuff.cs +++ b/Buffs/Summon/TacticalPlagueEngineBuff.cs @@ -13,12 +13,13 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A giant plague jet is following you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; } public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { modPlayer.plagueEngine = true; } diff --git a/Buffs/Summon/TundraFlameBlossomsBuff.cs b/Buffs/Summon/TundraFlameBlossomsBuff.cs index dfa6c4eefa..1207c5bca1 100644 --- a/Buffs/Summon/TundraFlameBlossomsBuff.cs +++ b/Buffs/Summon/TundraFlameBlossomsBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("A perfect unison of balance and beauty"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/VictideSummonSetBuff.cs b/Buffs/Summon/VictideSummonSetBuff.cs index 1e8cf040cb..024eb09ff2 100644 --- a/Buffs/Summon/VictideSummonSetBuff.cs +++ b/Buffs/Summon/VictideSummonSetBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The urchin will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/VileFeederBuff.cs b/Buffs/Summon/VileFeederBuff.cs index 0d85710b64..43a80f081c 100644 --- a/Buffs/Summon/VileFeederBuff.cs +++ b/Buffs/Summon/VileFeederBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The baby eater of souls will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs new file mode 100644 index 0000000000..ef7f387078 --- /dev/null +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class ViridVanguardBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Virid Vanguard"); + Description.SetDefault("A perfect act of unity surrounds you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + modPlayer.viridVanguard = true; + } + if (!modPlayer.viridVanguard) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/ViridVanguardBuff.png b/Buffs/Summon/ViridVanguardBuff.png new file mode 100644 index 0000000000..5a824b9ddd Binary files /dev/null and b/Buffs/Summon/ViridVanguardBuff.png differ diff --git a/Buffs/Summon/VoidConcentrationBuff.cs b/Buffs/Summon/VoidConcentrationBuff.cs new file mode 100644 index 0000000000..a83a737d5f --- /dev/null +++ b/Buffs/Summon/VoidConcentrationBuff.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + class VoidConcentrationBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Concentrated Void"); + Description.SetDefault("The infinite void yearns for more..."); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + //Main.persistentBuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer mp = player.Calamity(); + int count = player.ownedProjectileCounts[ModContent.ProjectileType()]; + player.minionDamage += 0.05f; //5% + player.armorPenetration += 10; + if (!mp.voidAuraDamage && count == 0) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/VoidConcentrationBuff.png b/Buffs/Summon/VoidConcentrationBuff.png new file mode 100644 index 0000000000..0aff2acf15 Binary files /dev/null and b/Buffs/Summon/VoidConcentrationBuff.png differ diff --git a/Buffs/Summon/WaterWaifu.cs b/Buffs/Summon/WaterWaifu.cs index 15581a1952..22bdf54fd6 100644 --- a/Buffs/Summon/WaterWaifu.cs +++ b/Buffs/Summon/WaterWaifu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("Anahita will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/WitherBlossomsBuff.cs b/Buffs/Summon/WitherBlossomsBuff.cs new file mode 100644 index 0000000000..2518bc18a0 --- /dev/null +++ b/Buffs/Summon/WitherBlossomsBuff.cs @@ -0,0 +1,35 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class WitherBlossomsBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Wither Blossoms"); + Description.SetDefault("Pestilence surrounds you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.Calamity(); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.witherBlossom = true; + + if (!modPlayer.witherBlossom) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} diff --git a/Buffs/Summon/WitherBlossomsBuff.png b/Buffs/Summon/WitherBlossomsBuff.png new file mode 100644 index 0000000000..334f026255 Binary files /dev/null and b/Buffs/Summon/WitherBlossomsBuff.png differ diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs index 7e2f0bfcd5..a91a54c48d 100644 --- a/Buffs/Summon/WulfrumDroidBuff.cs +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The wulfrum droid will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/Buffs/Summon/YharonKindleBuff.cs b/Buffs/Summon/YharonKindleBuff.cs index 4a74b567ea..f087aacd93 100644 --- a/Buffs/Summon/YharonKindleBuff.cs +++ b/Buffs/Summon/YharonKindleBuff.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Buffs.Summon Description.SetDefault("The Son of Yharon will protect you"); Main.buffNoTimeDisplay[Type] = true; Main.buffNoSave[Type] = true; - } + //Main.persistentBuff[Type] = true; + } public override void Update(Player player, ref int buffIndex) { diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index f9206a91a4..4308553677 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4,32 +4,37 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.Dyes; using CalamityMod.Items.Mounts; +using CalamityMod.Items.Tools; using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; @@ -38,15 +43,18 @@ using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Enemy; using CalamityMod.Projectiles.Environment; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; -using CalamityMod.TileEntities; +using CalamityMod.Skies; using CalamityMod.Tiles; using CalamityMod.UI; using CalamityMod.World; @@ -65,32 +73,12 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using CalamityMod.Projectiles.DraedonsArsenal; + +using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; namespace CalamityMod.CalPlayer { - public enum GaelSwitchPhase - { - LoseRage = 0, - None = 1 - } - - public enum AnimationType - { - Idle, - Jump, - Walk - } - - public enum AndromedaPlayerState - { - Inactive, - SmallRobot, - LargeRobot, - SpecialAttack - } - - public class CalamityPlayer : ModPlayer + public partial class CalamityPlayer : ModPlayer { #region Variables @@ -117,24 +105,42 @@ namespace CalamityMod.CalPlayer public float KameiTrailXScale = 0.1f; public int KameiBladeUseDelay = 0; public Vector2[] KameiOldPositions = new Vector2[4]; - public double trueMeleeDamage = 0D; - public double contactDamageReduction = 0D; - public double projectileDamageReduction = 0D; - public bool brimlashBusterBoost = false; - public float animusBoost = 1f; - public int potionTimer = 0; - #endregion + public double trueMeleeDamage = 0D; + public double contactDamageReduction = 0D; + public double projectileDamageReduction = 0D; + public bool brimlashBusterBoost = false; + public int evilSmasherBoost = 0; + public int hellbornBoost = 0; + public float animusBoost = 1f; + public int potionTimer = 0; + public bool noWings = false; + public bool blockAllDashes = false; + public bool resetHeightandWidth = false; + public bool noLifeRegen = false; + public int itemTypeLastReforged = 0; + public int reforgeTierSafety = 0; + public bool finalTierAccessoryReforge = false; + public int defenseDamage = 0; + public const int defaultTimeBeforeDefenseDamageRecovery = 5; + public int timeBeforeDefenseDamageRecovery = 0; + public float rangedAmmoCost = 1f; + public bool heldGaelsLastFrame = false; + public bool disableVoodooSpawns = false; + public bool disablePerfCystSpawns = false; + public bool disableHiveCystSpawns = false; + public bool disableNaturalScourgeSpawns = false; + public bool disableAnahitaSpawns = false; + public bool blazingMouseDamageEffects = false; + public bool ableToDrawBlazingMouse = false; + public float blazingMouseAuraFade = 0f; + public float GeneralScreenShakePower = 0f; + public bool GivenBrimstoneLocus = false; + #endregion - public int CurrentlyViewedFactoryX = -1; - public int CurrentlyViewedFactoryY = -1; - public TEDraedonFuelFactory CurrentlyViewedFactory; - - public int CurrentlyViewedChargerX = -1; - public int CurrentlyViewedChargerY = -1; - public TEDraedonItemCharger CurrentlyViewedCharger; - - public int CurrentlyViewedHologramX = -1; - public int CurrentlyViewedHologramY = -1; + #region Tile Entity Trackers + public int CurrentlyViewedFactoryID = -1; + public int CurrentlyViewedChargerID = -1; + public int CurrentlyViewedHologramID = -1; public string CurrentlyViewedHologramText; #endregion @@ -142,38 +148,38 @@ namespace CalamityMod.CalPlayer public int externalAbyssLight = 0; public bool externalColdImmunity = false; public bool externalHeatImmunity = false; - #endregion + #endregion - #region Town NPC Shop Variables - public bool newMerchantInventory = false; - public bool newPainterInventory = false; - public bool newDyeTraderInventory = false; - public bool newPartyGirlInventory = false; - public bool newStylistInventory = false; - public bool newDemolitionistInventory = false; - public bool newDryadInventory = false; - public bool newTavernkeepInventory = false; - public bool newArmsDealerInventory = false; - public bool newGoblinTinkererInventory = false; - public bool newWitchDoctorInventory = false; - public bool newClothierInventory = false; - public bool newMechanicInventory = false; - public bool newPirateInventory = false; - public bool newTruffleInventory = false; - public bool newWizardInventory = false; - public bool newSteampunkerInventory = false; - public bool newCyborgInventory = false; - public bool newSkeletonMerchantInventory = false; - public bool newPermafrostInventory = false; - public bool newCirrusInventory = false; - public bool newAmidiasInventory = false; - public bool newBanditInventory = false; - #endregion + #region Town NPC Shop Variables + public bool newMerchantInventory = false; + public bool newPainterInventory = false; + public bool newDyeTraderInventory = false; + public bool newPartyGirlInventory = false; + public bool newStylistInventory = false; + public bool newDemolitionistInventory = false; + public bool newDryadInventory = false; + public bool newTavernkeepInventory = false; + public bool newArmsDealerInventory = false; + public bool newGoblinTinkererInventory = false; + public bool newWitchDoctorInventory = false; + public bool newClothierInventory = false; + public bool newMechanicInventory = false; + public bool newPirateInventory = false; + public bool newTruffleInventory = false; + public bool newWizardInventory = false; + public bool newSteampunkerInventory = false; + public bool newCyborgInventory = false; + public bool newSkeletonMerchantInventory = false; + public bool newPermafrostInventory = false; + public bool newCirrusInventory = false; + public bool newAmidiasInventory = false; + public bool newBanditInventory = false; + public bool newCalamitasInventory = false; + #endregion - #region Stat Meter - public int[] damageStats = new int[6]; + #region Stat Meter + public int[] damageStats = new int[6]; public int[] critStats = new int[4]; - public float actualMeleeDamageStat = 0f; public int defenseStat = 0; public int DRStat = 0; public int meleeSpeedStat = 0; @@ -186,9 +192,10 @@ namespace CalamityMod.CalPlayer public int ammoReductionRogue = 0; public int armorPenetrationStat = 0; public float wingFlightTimeStat = 0f; - public float jumpSpeedStat = 0f; - public int adrenalineChargeStat = 0; + public float jumpSpeedStat = 0f; public int rageDamageStat = 0; + public int adrenalineDamageStat = 0; + public int adrenalineDRStat = 0; public int moveSpeedStat = 0; public int abyssLightLevelStat = 0; public int abyssBreathLossStat = 0; @@ -202,6 +209,8 @@ namespace CalamityMod.CalPlayer #endregion #region Timer and Counter + public int gaelSwipes = 0; + public int gaelRageAttackCooldown = 0; public int bossRushImmunityFrameCurseTimer = 0; public int aBulwarkRareMeleeBoostTimer = 0; public int nebulaManaNerfCounter = 0; @@ -210,19 +219,17 @@ namespace CalamityMod.CalPlayer public int dashTimeMod; public int hInfernoBoost = 0; public int pissWaterBoost = 0; - public int gaelRageCooldown = 0; public int packetTimer = 0; public int navyRodAuraTimer = 0; public int brimLoreInfernoTimer = 0; public int tarraLifeAuraTimer = 0; - public int bloodflareHeartTimer = 180; - public int bloodflareManaTimer = 180; + public int bloodflareHeartTimer = 300; public int polarisBoostCounter = 0; - public int gaelSwipes = 0; + public int dragonRageHits = 0; public float modStealth = 1f; - public float aquaticBoost = 1f; + public float aquaticBoostMax = 10000f; + public float aquaticBoost = 0f; public float shieldInvinc = 5f; - public GaelSwitchPhase gaelSwitchTimer = 0; public int galileoCooldown = 0; public int soundCooldown = 0; public int planarSpeedBoost = 0; @@ -232,6 +239,25 @@ namespace CalamityMod.CalPlayer public int danceOfLightCharge = 0; public int shadowPotCooldown = 0; public int dogTextCooldown = 0; + public float auralisStealthCounter = 0f; + public int auralisAuroraCounter = 0; + public int auralisAuroraCooldown = 0; + public int auralisAurora = 0; + public int fungalSymbioteTimer = 0; + public int aBulwarkRareTimer = 0; + + public const int BeltDodgeCooldown = 3600; + public const int MirrorDodgeCooldown = 4500; + public const int DaedalusReflectCooldown = 5400; + public const int ArcanumReflectCooldown = 5400; + public const int EvolutionReflectCooldown = 7200; + public int dodgeCooldownTimer = 0; + + public bool canFireAtaxiaRangedProjectile = false; + public bool canFireAtaxiaRogueProjectile = false; + public bool canFireGodSlayerRangedProjectile = false; + public bool canFireBloodflareMageProjectile = false; + public bool canFireBloodflareRangedProjectile = false; #endregion #region Sound @@ -241,6 +267,9 @@ namespace CalamityMod.CalPlayer #endregion #region Proficiency + private const int levelTier1 = 1500; + private const int levelTier2 = 5500; + private const int levelTier3 = 12500; public int meleeLevel = 0; public int rangedLevel = 0; public int magicLevel = 0; @@ -260,22 +289,29 @@ namespace CalamityMod.CalPlayer #endregion #region Rogue + // If stealth is too weak, increase this number. If stealth is too strong, decrease this number. + public static double StealthDamageConstant = 0.5; + public float rogueStealth = 0f; public float rogueStealthMax = 0f; public float stealthGenStandstill = 1f; public float stealthGenMoving = 1f; + public int flatStealthLossReduction = 0; public const float StealthAccelerationCap = 2f; public float stealthAcceleration = 1f; public bool stealthStrikeThisFrame = false; public bool stealthStrikeHalfCost = false; + public bool stealthStrike75Cost = false; public bool stealthStrikeAlwaysCrits = false; public bool wearingRogueArmor = false; public float accStealthGenBoost = 0f; public float throwingDamage = 1f; + public float stealthDamage = 0f; // This is extra Rogue Damage that is only added for stealth strikes. + public float RogueDamageWithStealth => throwingDamage + stealthDamage; public float throwingVelocity = 1f; public int throwingCrit = 0; - public float throwingAmmoCost = 1f; + public float throwingAmmoCost = 1f; #endregion #region Mount @@ -285,11 +321,13 @@ namespace CalamityMod.CalPlayer public bool crysthamyr = false; public AndromedaPlayerState andromedaState; public int andromedaCripple; - #endregion + public const float UnicornSpeedNerfPower = 0.8f; + public const float MechanicalCartSpeedNerfPower = 0.7f; + #endregion - #region Pet - public bool thirdSage = false; - public bool thirdSageH = true; // Third sage healing + #region Pet + public bool thirdSage = false; + public bool thirdSageH = true; public bool perfmini = false; public bool akato = false; public bool leviPet = false; @@ -313,22 +351,34 @@ namespace CalamityMod.CalPlayer public bool scalPet = false; public bool hiveMindPet = false; public bool bendyPet = false; + public bool littleLightPet = false; #endregion #region Rage - public float rage = 0f; - public float rageMax = 10000f; - public const int RageDuration = 300; - public const float AbsoluteRageThreshold = 0.98f; // 98% or higher for Absolute Rage public bool rageModeActive = false; - public int gainRageCooldown = 60; + public float rage = 0f; + public float rageMax = 100f; // 0 to 100% by default + public static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default. + public static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(1); // Each booster is +1 second: 10, 11, 12. + public int RageDuration = DefaultRageDuration; + public int rageGainCooldown = 0; + public static readonly int DefaultRageGainCooldown = 10; // It is pretty hard to have less than 10 iframes for any reason + public int rageCombatFrames = 0; + public static readonly int RageCombatDelayTime = CalamityUtils.SecondsToFrames(10); + public static readonly int RageFadeTime = CalamityUtils.SecondsToFrames(30); + public static readonly double DefaultRageDamageBoost = 0.35D; // +35% + public double RageDamageBoost = DefaultRageDamageBoost; #endregion #region Adrenaline - public float adrenaline = 0f; - public float adrenalineMax = 10000f; - public const int AdrenalineDuration = 300; public bool adrenalineModeActive = false; + public float adrenaline = 0f; + public float adrenalineMax = 100f; // 0 to 100% by default + public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); + public int AdrenalineChargeTime = CalamityUtils.SecondsToFrames(30); + public int AdrenalineFadeTime = CalamityUtils.SecondsToFrames(2); + public static readonly double AdrenalineDamageBoost = 2.0D; // +200% + public static readonly double AdrenalineDamagePerBooster = 0.15D; // +15% #endregion #region Permanent Buff @@ -350,46 +400,6 @@ namespace CalamityMod.CalPlayer public bool healToFull = false; #endregion - #region Lore - public bool kingSlimeLore = false; - public bool desertScourgeLore = false; - public bool crabulonLore = false; - public bool eaterOfWorldsLore = false; - public bool hiveMindLore = false; - public bool perforatorLore = false; - public bool queenBeeLore = false; - public bool skeletronLore = false; - // This lore boolean is a bit different from the others. It just stops Slime God lore effects from stacking. - public bool slimeGodLoreProcessed = false; - public bool wallOfFleshLore = false; - public bool twinsLore = false; - public bool destroyerLore = false; - public bool aquaticScourgeLore = false; - public bool skeletronPrimeLore = false; - public bool brimstoneElementalLore = false; - public bool calamitasLore = false; - public bool planteraLore = false; - public bool leviathanAndSirenLore = false; - public bool astrumAureusLore = false; - public bool astrumDeusLore = false; - public bool golemLore = false; - public bool plaguebringerGoliathLore = false; - public bool dukeFishronLore = false; - public bool boomerDukeLore = false; - public bool ravagerLore = false; - public bool lunaticCultistLore = false; - public bool moonLordLore = false; - public bool providenceLore = false; - public bool polterghastLore = false; - public bool DoGLore = false; - public bool yharonLore = false; - public bool SCalLore = false; - public bool oceanLore = false; - public bool corruptionLore = false; - public bool crimsonLore = false; - public bool underworldLore = false; - #endregion - #region Accessory public bool fasterMeleeLevel = false; public bool fasterRangedLevel = false; @@ -413,7 +423,6 @@ namespace CalamityMod.CalPlayer public bool affliction = false; public bool stressPills = false; public bool laudanum = false; - public bool doubledHorror = false; public bool heartOfDarkness = false; public bool draedonsHeart = false; public bool rampartOfDeities = false; @@ -423,7 +432,10 @@ namespace CalamityMod.CalPlayer public bool evasionScarf = false; public bool badgeOfBravery = false; public bool badgeOfBraveryRare = false; - public bool scarfCooldown = false; + public float warBannerBonus = 0f; + private const float maxWarBannerBonus = 0.2f; + private const float maxWarBannerDistance = 480f; + public bool scarfCooldown = false; public bool eScarfCooldown = false; public bool cryogenSoul = false; public bool yInsignia = false; @@ -453,6 +465,7 @@ namespace CalamityMod.CalPlayer public bool seaShell = false; public bool absorber = false; public bool aAmpoule = false; + public bool sponge = false; public bool rOoze = false; public bool pAmulet = false; public bool fBarrier = false; @@ -466,8 +479,6 @@ namespace CalamityMod.CalPlayer public int gSabatonFall = 0; public int gSabatonCooldown = 0; public bool sGenerator = false; - public bool sDefense = false; - public bool sPower = false; public bool sRegen = false; public bool IBoots = false; public bool elysianFire = false; @@ -483,31 +494,34 @@ namespace CalamityMod.CalPlayer public bool nanotech = false; public bool eQuiver = false; public bool shadowMinions = false; - public bool tearMinions = false; + public bool holyMinions = false; public bool alchFlask = false; public bool reducedPlagueDmg = false; - public bool abaddon = false; + public bool abaddon = false; + public bool aeroStone = false; public bool community = false; + public bool shatteredCommunity = false; public bool fleshTotem = false; public bool fleshTotemCooldown = false; public bool bloodPact = false; - public bool bloodPactBoost = false; + public bool bloodPactBoost = false; public bool bloodflareCore = false; + public int bloodflareCoreLostDefense = 0; public bool coreOfTheBloodGod = false; public bool elementalHeart = false; public bool crownJewel = false; public bool celestialJewel = false; public bool astralArcanum = false; public bool harpyRing = false; + public bool angelTreads = false; public bool harpyWingBoost = false; //harpy wings + harpy ring public bool ironBoots = false; public bool depthCharm = false; public bool anechoicPlating = false; public bool jellyfishNecklace = false; - public bool abyssDivingGear = false; + public bool abyssDivingGear = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; - public bool reaperToothNecklace = false; public bool aquaticEmblem = false; public bool darkSunRing = false; public bool calamityRing = false; @@ -567,11 +581,9 @@ namespace CalamityMod.CalPlayer public bool hasJetpack = false; public int jetPackCooldown = 0; public bool plaguedFuelPack = false; - public int plaguedFuelPackDash = 0; - public int plaguedFuelPackDirection = 0; public bool blunderBooster = false; - public int blunderBoosterDash = 0; - public int blunderBoosterDirection = 0; + public int jetPackDash = 0; + public int jetPackDirection = 0; public bool veneratedLocket = false; public bool camper = false; public bool corrosiveSpine = false; @@ -579,9 +591,12 @@ namespace CalamityMod.CalPlayer public bool starbusterCore = false; public bool starTaintedGenerator = false; public bool hallowedRune = false; - public int hallowedRuneCooldown = 0; - public bool silvaWings = false; - public int icicleCooldown = 0; + public int hallowedRuneCooldown = 0; + public bool phantomicArtifact = false; + public int phantomicBulwarkCooldown = 0; + public int phantomicHeartRegen = 0; // 0 = can spawn, 720 = regen applied, 600 = regen stops and 10 sec cd before it can spawn again + public bool silvaWings = false; + public int icicleCooldown = 0; public bool rustyMedal = false; public bool noStupidNaturalARSpawns = false; public bool burdenBreakerYeet = false; @@ -589,25 +604,30 @@ namespace CalamityMod.CalPlayer public int roverDriveTimer = 0; public int roverFrameCounter = 0; public int roverFrame = 0; + public int voidFrameCounter = 0; + public int voidFrame = 0; + public bool rottenDogTooth = false; + public bool angelicAlliance = false; + public int angelicActivate = -1; #endregion #region Armor Set public bool desertProwler = false; public bool snowRuffianSet = false; public bool forbiddenCirclet = false; - public int forbiddenCooldown = 0; - public int tornadoCooldown = 0; + public int forbiddenCooldown = 0; + public int tornadoCooldown = 0; public bool eskimoSet = false; //vanilla armor public bool meteorSet = false; //vanilla armor, for space gun nerf public bool victideSet = false; public bool sulfurSet = false; public bool sulfurJump = false; - public bool jumpAgainSulfur = false; - public int sulphurBubbleCooldown = 0; + public bool jumpAgainSulfur = false; + public int sulphurBubbleCooldown = 0; public bool aeroSet = false; public bool statigelSet = false; public bool statigelJump = false; - public bool jumpAgainStatigel = false; + public bool jumpAgainStatigel = false; public bool tarraSet = false; public bool tarraMelee = false; public bool tarragonCloak = false; @@ -617,7 +637,8 @@ namespace CalamityMod.CalPlayer public int tarraMageHealCooldown = 0; public int tarraCrits = 0; public bool tarraRanged = false; - public bool tarraThrowing = false; + public int tarraRangedCooldown = 0; + public bool tarraThrowing = false; public bool tarragonImmunityCooldown = false; public bool tarragonImmunity = false; public int tarraThrowingCrits = 0; @@ -629,6 +650,7 @@ namespace CalamityMod.CalPlayer public int bloodflareMeleeHits = 0; public bool bloodflareRanged = false; public bool bloodflareSoulCooldown = false; + public int bloodflareSoulTimer = 0; public bool bloodflareThrowing = false; public bool bloodflareMage = false; public int bloodflareMageCooldown = 0; @@ -636,13 +658,10 @@ namespace CalamityMod.CalPlayer public int bloodflareSummonTimer = 0; public bool godSlayer = false; public bool godSlayerDamage = false; - public bool godSlayerMage = false; public bool godSlayerRanged = false; public bool godSlayerThrowing = false; - public bool godSlayerSummon = false; - public float godSlayerDmg; - public bool godSlayerReflect = false; public bool godSlayerCooldown = false; + public bool godSlayerDashHotKeyPressed = false; public bool ataxiaBolt = false; public bool ataxiaFire = false; public bool ataxiaVolley = false; @@ -653,8 +672,7 @@ namespace CalamityMod.CalPlayer public bool brimflameSet = false; public bool brimflameFrenzy = false; public bool brimflameFrenzyCooldown = false; - public bool reaverSpore = false; - public bool reaverDoubleTap = false; + public int brimflameFrenzyTimer = 0; public bool flamethrowerBoost = false; public bool hoverboardBoost = false; //hoverboard + shroomite visage public bool shadeRegen = false; @@ -669,14 +687,17 @@ namespace CalamityMod.CalPlayer public bool titanHeartBoots = false; public int titanCooldown = 0; public bool umbraphileSet = false; - public bool reaverBlast = false; - public bool reaverBurst = false; + public bool reaverSpeed = false; + public bool reaverRegen = false; + public int reaverRegenCooldown = 0; + public bool reaverDefense = false; + public bool reaverExplore = false; public bool fathomSwarmer = false; public bool fathomSwarmerVisage = false; public bool fathomSwarmerBreastplate = false; public bool fathomSwarmerTail = false; - int tailFrameUp = 0; - int tailFrame = 0; + public int tailFrameUp = 0; + public int tailFrame = 0; public bool astralStarRain = false; public int astralStarRainCooldown = 0; public bool plagueReaper = false; @@ -694,16 +715,13 @@ namespace CalamityMod.CalPlayer public bool prismaticHelmet = false; public bool prismaticRegalia = false; public bool prismaticGreaves = false; - public int prismaticLasers = 0; + public int prismaticLasers = 0; public bool silvaSet = false; - public bool silvaMelee = false; - public bool silvaRanged = false; - public bool silvaThrowing = false; public bool silvaMage = false; - public bool silvaSummon = false; + public int silvaMageCooldown = 0; + public bool silvaSummon = false; public bool hasSilvaEffect = false; - public int silvaCountdown = 600; - public int silvaHitCounter = 0; + public int silvaCountdown = 480; public bool auricSet = false; public bool omegaBlueChestplate = false; public bool omegaBlueSet = false; @@ -716,7 +734,6 @@ namespace CalamityMod.CalPlayer public bool fearmongerSet = false; public int fearmongerRegenFrames = 0; public bool daedalusCrystal = false; - public bool reaverOrb = false; public bool chaosSpirit = false; public bool redDevil = false; #endregion @@ -727,10 +744,9 @@ namespace CalamityMod.CalPlayer public bool wDeath = false; public bool lethalLavaBurn = false; public bool aCrunch = false; - public bool absoluteRage = false; - public bool horror = false; public bool irradiated = false; public bool bFlames = false; + public bool weakBrimstoneFlames = false; public bool aFlames = false; public bool gsInferno = false; public bool astralInfection = false; @@ -744,7 +760,6 @@ namespace CalamityMod.CalPlayer public bool vHex = false; public bool eGrav = false; public bool warped = false; - public bool marked = false; public bool cDepth = false; public bool fishAlert = false; public bool bOut = false; @@ -760,6 +775,9 @@ namespace CalamityMod.CalPlayer public bool vaporfied = false; public bool energyShellCooldown = false; public bool prismaticCooldown = false; + public bool waterLeechBleeding = false; + public bool divineBlessCooldown = false; + public bool banishingFire = false; #endregion #region Buff @@ -774,8 +792,6 @@ namespace CalamityMod.CalPlayer public bool xWrath = false; public bool graxDefense = false; public bool encased = false; - public bool sMeleeBoost = false; - public bool eScarfBoost = false; public bool tFury = false; public bool cadence = false; public bool omniscience = false; @@ -850,11 +866,12 @@ namespace CalamityMod.CalPlayer public bool polarisBoostThree = false; public bool bloodfinBoost = false; public int bloodfinTimer = 30; - public bool hallowedDefense = false; - public bool hallowedPower = false; public bool hallowedRegen = false; + public bool hallowedPower = false; public bool kamiBoost = false; - #endregion + public bool avertorBonus = false; + public bool divineBless = false; + #endregion #region Minion public bool wDroid = false; @@ -922,6 +939,8 @@ namespace CalamityMod.CalPlayer public bool plaguebringerMK2 = false; public bool igneousExaltation = false; public bool coldDivinity = false; + public bool voidAura = false; + public bool voidAuraDamage = false; public bool youngDuke = false; public bool virili = false; public bool frostBlossom = false; @@ -934,7 +953,6 @@ namespace CalamityMod.CalPlayer public bool brimseeker = false; public bool necrosteocytesDudes = false; public bool gammaHead = false; - public List GammaCanisters = new List(); public bool rustyDrone = false; public bool tundraFlameBlossom = false; public bool starSwallowerPetFroge = false; @@ -944,6 +962,40 @@ namespace CalamityMod.CalPlayer public bool plaguebringerPatronSummon = false; public bool howlTrio = false; public bool mountedScanner = false; + public bool sepulcher = false; + public bool daedalusGolem = false; + public bool deathstareEyeball = false; + public bool witherBlossom = false; + public bool flowersOfMortality = false; + public bool viridVanguard = false; + public bool sageSpirit = false; + public bool fleshBall = false; + public bool eyeOfNight = false; + public bool soulSeeker = false; + public bool perditionBeacon = false; + + public List PendingProjectilesToRespawn = new List(); + + // Due to the way vanilla summons work, the buff must be applied manually for it to properly register, since + // the buff is typically created via the minion's item usage, not its idle existence. + public static Dictionary VanillaMinionBuffRelationship = new Dictionary() + { + [ProjectileID.BabySlime] = BuffID.BabySlime, + [ProjectileID.BabyHornet] = BuffID.BabyHornet, + [ProjectileID.FlyingImp] = BuffID.ImpMinion, + [ProjectileID.VenomSpider] = BuffID.SpiderMinion, + [ProjectileID.JumperSpider] = BuffID.SpiderMinion, + [ProjectileID.DangerousSpider] = BuffID.SpiderMinion, + [ProjectileID.Spazmamini] = BuffID.TwinEyesMinion, + [ProjectileID.Retanimini] = BuffID.TwinEyesMinion, + [ProjectileID.Raven] = BuffID.Ravens, + [ProjectileID.DeadlySphere] = BuffID.DeadlySphere, + [ProjectileID.Tempest] = BuffID.SharknadoMinion, + [ProjectileID.UFOMinion] = BuffID.UFOMinion, + [ProjectileID.StardustCellMinion] = BuffID.StardustMinion, + [ProjectileID.StardustDragon1] = BuffID.StardustDragonMinion, + }; + #endregion #region Biome @@ -993,54 +1045,84 @@ namespace CalamityMod.CalPlayer public bool omegaBlueTransformation; public bool omegaBlueTransformationForce; public bool omegaBlueTransformationPower; - #endregion + #endregion - #region SavingAndLoading - public override void Initialize() - { - extraAccessoryML = false; - eCore = false; - mFruit = false; - bOrange = false; - eBerry = false; - dFruit = false; - pHeart = false; - cShard = false; - revJamDrop = false; - rageBoostOne = false; - rageBoostTwo = false; - rageBoostThree = false; - adrenalineBoostOne = false; - adrenalineBoostTwo = false; - adrenalineBoostThree = false; - drawBossHPBar = true; - shouldDrawSmallText = true; - healToFull = false; + #region Calamitas Enchant Effects + public bool cursedSummonsEnchant = false; + public bool flamingItemEnchant = false; + public bool lifeManaEnchant = false; + public bool farProximityRewardEnchant = false; + public bool closeProximityRewardEnchant = false; + public bool dischargingItemEnchant = false; + public bool explosiveMinionsEnchant = false; + public bool bladeArmEnchant = false; + public bool manaMonsterEnchant = false; - newMerchantInventory = false; - newPainterInventory = false; - newDyeTraderInventory = false; - newPartyGirlInventory = false; - newStylistInventory = false; - newDemolitionistInventory = false; - newDryadInventory = false; - newTavernkeepInventory = false; - newArmsDealerInventory = false; - newGoblinTinkererInventory = false; - newWitchDoctorInventory = false; - newClothierInventory = false; - newMechanicInventory = false; - newPirateInventory = false; - newTruffleInventory = false; - newWizardInventory = false; - newSteampunkerInventory = false; - newCyborgInventory = false; - newSkeletonMerchantInventory = false; - newPermafrostInventory = false; - newCirrusInventory = false; - newAmidiasInventory = false; - newBanditInventory = false; - } + public bool witheringWeaponEnchant = false; + public bool witheredDebuff = false; + public int witheredWeaponHoldTime = 0; + public int witheringDamageDone = 0; + + public bool persecutedEnchant = false; + public int persecutedEnchantSummonTimer = 0; + + public bool lecherousOrbEnchant = false; + public bool awaitingLecherousOrbSpawn = false; + #endregion Calamitas Enchant Effects + + #region Draw Effects + public FireParticleSet ProvidenceBurnEffectDrawer = new FireParticleSet(-1, int.MaxValue, Color.Yellow, Color.Red * 1.2f, 10f, 0.65f); + #endregion Draw Effects + + #endregion + + #region SavingAndLoading + public override void Initialize() + { + extraAccessoryML = false; + eCore = false; + mFruit = false; + bOrange = false; + eBerry = false; + dFruit = false; + pHeart = false; + cShard = false; + revJamDrop = false; + rageBoostOne = false; + rageBoostTwo = false; + rageBoostThree = false; + adrenalineBoostOne = false; + adrenalineBoostTwo = false; + adrenalineBoostThree = false; + drawBossHPBar = true; + shouldDrawSmallText = true; + healToFull = false; + + newMerchantInventory = false; + newPainterInventory = false; + newDyeTraderInventory = false; + newPartyGirlInventory = false; + newStylistInventory = false; + newDemolitionistInventory = false; + newDryadInventory = false; + newTavernkeepInventory = false; + newArmsDealerInventory = false; + newGoblinTinkererInventory = false; + newWitchDoctorInventory = false; + newClothierInventory = false; + newMechanicInventory = false; + newPirateInventory = false; + newTruffleInventory = false; + newWizardInventory = false; + newSteampunkerInventory = false; + newCyborgInventory = false; + newSkeletonMerchantInventory = false; + newPermafrostInventory = false; + newCirrusInventory = false; + newAmidiasInventory = false; + newBanditInventory = false; + newCalamitasInventory = false; + } public override TagCompound Save() { @@ -1063,36 +1145,41 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("bossHPBar", drawBossHPBar); boost.AddWithCondition("drawSmallText", shouldDrawSmallText); boost.AddWithCondition("fullHPRespawn", healToFull); + boost.AddWithCondition("finalTierAccessoryReforge", finalTierAccessoryReforge); - boost.AddWithCondition("newMerchantInventory", newMerchantInventory); - boost.AddWithCondition("newPainterInventory", newPainterInventory); - boost.AddWithCondition("newDyeTraderInventory", newDyeTraderInventory); - boost.AddWithCondition("newPartyGirlInventory", newPartyGirlInventory); - boost.AddWithCondition("newStylistInventory", newStylistInventory); - boost.AddWithCondition("newDemolitionistInventory", newDemolitionistInventory); - boost.AddWithCondition("newDryadInventory", newDryadInventory); - boost.AddWithCondition("newTavernkeepInventory", newTavernkeepInventory); - boost.AddWithCondition("newArmsDealerInventory", newArmsDealerInventory); - boost.AddWithCondition("newGoblinTinkererInventory", newGoblinTinkererInventory); - boost.AddWithCondition("newWitchDoctorInventory", newWitchDoctorInventory); - boost.AddWithCondition("newClothierInventory", newClothierInventory); - boost.AddWithCondition("newMechanicInventory", newMechanicInventory); - boost.AddWithCondition("newPirateInventory", newPirateInventory); - boost.AddWithCondition("newTruffleInventory", newTruffleInventory); - boost.AddWithCondition("newWizardInventory", newWizardInventory); - boost.AddWithCondition("newSteampunkerInventory", newSteampunkerInventory); - boost.AddWithCondition("newCyborgInventory", newCyborgInventory); - boost.AddWithCondition("newSkeletonMerchantInventory", newSkeletonMerchantInventory); - boost.AddWithCondition("newPermafrostInventory", newPermafrostInventory); - boost.AddWithCondition("newCirrusInventory", newCirrusInventory); - boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); - boost.AddWithCondition("newBanditInventory", newBanditInventory); + boost.AddWithCondition("newMerchantInventory", newMerchantInventory); + boost.AddWithCondition("newPainterInventory", newPainterInventory); + boost.AddWithCondition("newDyeTraderInventory", newDyeTraderInventory); + boost.AddWithCondition("newPartyGirlInventory", newPartyGirlInventory); + boost.AddWithCondition("newStylistInventory", newStylistInventory); + boost.AddWithCondition("newDemolitionistInventory", newDemolitionistInventory); + boost.AddWithCondition("newDryadInventory", newDryadInventory); + boost.AddWithCondition("newTavernkeepInventory", newTavernkeepInventory); + boost.AddWithCondition("newArmsDealerInventory", newArmsDealerInventory); + boost.AddWithCondition("newGoblinTinkererInventory", newGoblinTinkererInventory); + boost.AddWithCondition("newWitchDoctorInventory", newWitchDoctorInventory); + boost.AddWithCondition("newClothierInventory", newClothierInventory); + boost.AddWithCondition("newMechanicInventory", newMechanicInventory); + boost.AddWithCondition("newPirateInventory", newPirateInventory); + boost.AddWithCondition("newTruffleInventory", newTruffleInventory); + boost.AddWithCondition("newWizardInventory", newWizardInventory); + boost.AddWithCondition("newSteampunkerInventory", newSteampunkerInventory); + boost.AddWithCondition("newCyborgInventory", newCyborgInventory); + boost.AddWithCondition("newSkeletonMerchantInventory", newSkeletonMerchantInventory); + boost.AddWithCondition("newPermafrostInventory", newPermafrostInventory); + boost.AddWithCondition("newCirrusInventory", newCirrusInventory); + boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); + boost.AddWithCondition("newBanditInventory", newBanditInventory); + boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); + boost.AddWithCondition("GivenBrimstoneLocus", GivenBrimstoneLocus); - return new TagCompound + return new TagCompound { { "boost", boost }, - { "stress", rage }, + { "rage", rage }, + { "stress", rage * 10000f }, { "adrenaline", adrenaline }, + { "aquaticBoostPower", aquaticBoost }, { "sCalDeathCount", sCalDeathCount }, { "sCalKillCount", sCalKillCount }, { "meleeLevel", meleeLevel }, @@ -1107,7 +1194,11 @@ namespace CalamityMod.CalPlayer { "exactRogueLevel", exactRogueLevel }, { "deathCount", deathCount }, { "deathModeUnderworldTime", deathModeUnderworldTime }, - { "deathModeBlizzardTime", deathModeBlizzardTime } + { "deathModeBlizzardTime", deathModeBlizzardTime }, + { "itemTypeLastReforged", itemTypeLastReforged }, + { "reforgeTierSafety", reforgeTierSafety }, + { "moveSpeedStat", moveSpeedStat }, + { "defenseDamage", defenseDamage } }; } @@ -1132,33 +1223,43 @@ namespace CalamityMod.CalPlayer drawBossHPBar = boost.Contains("bossHPBar"); shouldDrawSmallText = boost.Contains("drawSmallText"); healToFull = boost.Contains("fullHPRespawn"); + finalTierAccessoryReforge = boost.Contains("finalTierAccessoryReforge"); newMerchantInventory = boost.Contains("newMerchantInventory"); - newPainterInventory = boost.Contains("newPainterInventory"); - newDyeTraderInventory = boost.Contains("newDyeTraderInventory"); - newPartyGirlInventory = boost.Contains("newPartyGirlInventory"); - newStylistInventory = boost.Contains("newStylistInventory"); - newDemolitionistInventory = boost.Contains("newDemolitionistInventory"); - newDryadInventory = boost.Contains("newDryadInventory"); - newTavernkeepInventory = boost.Contains("newTavernkeepInventory"); - newArmsDealerInventory = boost.Contains("newArmsDealerInventory"); - newGoblinTinkererInventory = boost.Contains("newGoblinTinkererInventory"); - newWitchDoctorInventory = boost.Contains("newWitchDoctorInventory"); - newClothierInventory = boost.Contains("newClothierInventory"); - newMechanicInventory = boost.Contains("newMechanicInventory"); - newPirateInventory = boost.Contains("newPirateInventory"); - newTruffleInventory = boost.Contains("newTruffleInventory"); - newWizardInventory = boost.Contains("newWizardInventory"); - newSteampunkerInventory = boost.Contains("newSteampunkerInventory"); - newCyborgInventory = boost.Contains("newCyborgInventory"); - newSkeletonMerchantInventory = boost.Contains("newSkeletonMerchantInventory"); - newPermafrostInventory = boost.Contains("newPermafrostInventory"); - newCirrusInventory = boost.Contains("newCirrusInventory"); - newAmidiasInventory = boost.Contains("newAmidiasInventory"); - newBanditInventory = boost.Contains("newBanditInventory"); + newPainterInventory = boost.Contains("newPainterInventory"); + newDyeTraderInventory = boost.Contains("newDyeTraderInventory"); + newPartyGirlInventory = boost.Contains("newPartyGirlInventory"); + newStylistInventory = boost.Contains("newStylistInventory"); + newDemolitionistInventory = boost.Contains("newDemolitionistInventory"); + newDryadInventory = boost.Contains("newDryadInventory"); + newTavernkeepInventory = boost.Contains("newTavernkeepInventory"); + newArmsDealerInventory = boost.Contains("newArmsDealerInventory"); + newGoblinTinkererInventory = boost.Contains("newGoblinTinkererInventory"); + newWitchDoctorInventory = boost.Contains("newWitchDoctorInventory"); + newClothierInventory = boost.Contains("newClothierInventory"); + newMechanicInventory = boost.Contains("newMechanicInventory"); + newPirateInventory = boost.Contains("newPirateInventory"); + newTruffleInventory = boost.Contains("newTruffleInventory"); + newWizardInventory = boost.Contains("newWizardInventory"); + newSteampunkerInventory = boost.Contains("newSteampunkerInventory"); + newCyborgInventory = boost.Contains("newCyborgInventory"); + newSkeletonMerchantInventory = boost.Contains("newSkeletonMerchantInventory"); + newPermafrostInventory = boost.Contains("newPermafrostInventory"); + newCirrusInventory = boost.Contains("newCirrusInventory"); + newAmidiasInventory = boost.Contains("newAmidiasInventory"); + newBanditInventory = boost.Contains("newBanditInventory"); + newCalamitasInventory = boost.Contains("newCalamitasInventory"); + GivenBrimstoneLocus = boost.Contains("GivenBrimstoneLocus"); - rage = tag.GetAsInt("stress"); - adrenaline = tag.GetAsInt("adrenaline"); + // Load rage if it's there, which it will be for any players saved with 1.5. + // Older players have "stress" instead, which will be ignored. This is intentional. + // Stress ranged from 0 to 10,000. Rage ranges from 0.0 to 1.0. + if (tag.ContainsKey("rage")) + rage = tag.GetFloat("rage"); + + adrenaline = tag.GetFloat("adrenaline"); + if (tag.ContainsKey("aquaticBoostPower")) + aquaticBoost = tag.GetFloat("aquaticBoostPower"); sCalDeathCount = tag.GetInt("sCalDeathCount"); sCalKillCount = tag.GetInt("sCalKillCount"); deathCount = tag.GetInt("deathCount"); @@ -1172,6 +1273,9 @@ namespace CalamityMod.CalPlayer deathModeUnderworldTime = tag.GetInt("deathModeUnderworldTime"); deathModeBlizzardTime = tag.GetInt("deathModeBlizzardTime"); + itemTypeLastReforged = tag.GetInt("itemTypeLastReforged"); + reforgeTierSafety = tag.GetInt("reforgeTierSafety"); + meleeLevel = tag.GetInt("meleeLevel"); rangedLevel = tag.GetInt("rangedLevel"); magicLevel = tag.GetInt("magicLevel"); @@ -1182,13 +1286,18 @@ namespace CalamityMod.CalPlayer exactMagicLevel = tag.GetInt("exactMagicLevel"); exactSummonLevel = tag.GetInt("exactSummonLevel"); exactRogueLevel = tag.GetInt("exactRogueLevel"); + + moveSpeedStat = tag.GetInt("moveSpeedStat"); + + defenseDamage = tag.GetInt("defenseDamage"); } public override void LoadLegacy(BinaryReader reader) { int loadVersion = reader.ReadInt32(); - rage = reader.ReadInt32(); - adrenaline = reader.ReadInt32(); + rage = reader.ReadSingle(); + adrenaline = reader.ReadSingle(); + aquaticBoost = reader.ReadSingle(); sCalDeathCount = reader.ReadInt32(); sCalKillCount = reader.ReadInt32(); deathCount = reader.ReadInt32(); @@ -1202,6 +1311,9 @@ namespace CalamityMod.CalPlayer deathModeUnderworldTime = reader.ReadInt32(); deathModeBlizzardTime = reader.ReadInt32(); + itemTypeLastReforged = reader.ReadInt32(); + reforgeTierSafety = reader.ReadInt32(); + meleeLevel = reader.ReadInt32(); rangedLevel = reader.ReadInt32(); magicLevel = reader.ReadInt32(); @@ -1213,6 +1325,10 @@ namespace CalamityMod.CalPlayer exactSummonLevel = reader.ReadInt32(); exactRogueLevel = reader.ReadInt32(); + moveSpeedStat = reader.ReadInt32(); + + defenseDamage = reader.ReadInt32(); + if (loadVersion == 0) { BitsByte flags = reader.ReadByte(); @@ -1238,36 +1354,38 @@ namespace CalamityMod.CalPlayer BitsByte flags3 = reader.ReadByte(); shouldDrawSmallText = flags3[0]; healToFull = flags3[1]; - newMerchantInventory = flags3[2]; - newPainterInventory = flags3[3]; - newDyeTraderInventory = flags3[4]; - newPartyGirlInventory = flags3[5]; - newStylistInventory = flags3[6]; - newDemolitionistInventory = flags3[7]; + newMerchantInventory = flags3[2]; + newPainterInventory = flags3[3]; + newDyeTraderInventory = flags3[4]; + newPartyGirlInventory = flags3[5]; + newStylistInventory = flags3[6]; + newDemolitionistInventory = flags3[7]; - BitsByte flags4 = reader.ReadByte(); - newDryadInventory = flags4[0]; - newTavernkeepInventory = flags4[1]; - newArmsDealerInventory = flags4[2]; - newGoblinTinkererInventory = flags4[3]; - newWitchDoctorInventory = flags4[4]; - newClothierInventory = flags4[5]; - newMechanicInventory = flags4[6]; - newPirateInventory = flags4[7]; + BitsByte flags4 = reader.ReadByte(); + newDryadInventory = flags4[0]; + newTavernkeepInventory = flags4[1]; + newArmsDealerInventory = flags4[2]; + newGoblinTinkererInventory = flags4[3]; + newWitchDoctorInventory = flags4[4]; + newClothierInventory = flags4[5]; + newMechanicInventory = flags4[6]; + newPirateInventory = flags4[7]; - BitsByte flags5 = reader.ReadByte(); - newTruffleInventory = flags5[0]; - newWizardInventory = flags5[1]; - newSteampunkerInventory = flags5[2]; - newCyborgInventory = flags5[3]; - newSkeletonMerchantInventory = flags5[4]; - newPermafrostInventory = flags5[5]; - newCirrusInventory = flags5[6]; - newAmidiasInventory = flags5[7]; + BitsByte flags5 = reader.ReadByte(); + newTruffleInventory = flags5[0]; + newWizardInventory = flags5[1]; + newSteampunkerInventory = flags5[2]; + newCyborgInventory = flags5[3]; + newSkeletonMerchantInventory = flags5[4]; + newPermafrostInventory = flags5[5]; + newCirrusInventory = flags5[6]; + newAmidiasInventory = flags5[7]; - BitsByte flags6 = reader.ReadByte(); - newBanditInventory = flags6[0]; - } + BitsByte flags6 = reader.ReadByte(); + newBanditInventory = flags6[0]; + finalTierAccessoryReforge = flags6[1]; + newCalamitasInventory = flags6[2]; + } else { ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); @@ -1280,7 +1398,7 @@ namespace CalamityMod.CalPlayer { // Max health bonuses if (absorber) - player.statLifeMax2 += 20; + player.statLifeMax2 += sponge ? 30 : 20; player.statLifeMax2 += (mFruit ? 25 : 0) + (bOrange ? 25 : 0) + @@ -1292,89 +1410,74 @@ namespace CalamityMod.CalPlayer player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; if (bloodPact) player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; - if (leviathanAndSirenLore) - { - if (sirenBoobsPrevious) - player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; - } - if (absoluteRage) - player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; if (affliction || afflicted) player.statLifeMax2 += player.statLifeMax / 5 / 20 * 10; if (cadence) player.statLifeMax2 += player.statLifeMax / 5 / 20 * 25; if (community) { - float floatTypeBoost = 0.01f + + float floatTypeBoost = 0.05f + (NPC.downedSlimeKing ? 0.01f : 0f) + (NPC.downedBoss1 ? 0.01f : 0f) + (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + + (NPC.downedBoss3 ? 0.01f : 0f) + // 0.1 (Main.hardMode ? 0.01f : 0f) + (NPC.downedMechBossAny ? 0.01f : 0f) + (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + + (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + (CalamityWorld.downedProvidence ? 0.01f : 0f) + + (CalamityWorld.downedDoG ? 0.01f : 0f) + + (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 int integerTypeBoost = (int)(floatTypeBoost * 50f); 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; // Max health reductions if (crimEffigy) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.8); - if (badgeOfBraveryRare) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.75); + player.statLifeMax2 = (int)(player.statLifeMax2 * 0.9); if (regenator) player.statLifeMax2 = (int)(player.statLifeMax2 * 0.5); - if (skeletronLore) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.9); - if (calamitasLore) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.75); - if (providenceLore) - player.statLifeMax2 = (int)(player.statLifeMax2 * 0.8); // Extra accessory slots - // This is probably fucked in 1.4 + // This is probably fucked in 1.4 if (extraAccessoryML) player.extraAccessorySlots = 1; if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) player.extraAccessorySlots = 2; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { if (CalamityConfig.Instance.BossRushAccessoryCurse) - { player.extraAccessorySlots = 0; - } } ResetRogueStealth(); - contactDamageReduction = 0D; - projectileDamageReduction = 0D; + contactDamageReduction = 0D; + projectileDamageReduction = 0D; throwingDamage = 1f; throwingVelocity = 1f; throwingCrit = 0; - throwingAmmoCost = 1f; - accStealthGenBoost = 0f; + throwingAmmoCost = 1f; + accStealthGenBoost = 0f; - trueMeleeDamage = 0D; + trueMeleeDamage = 0D; + warBannerBonus = 0f; dashMod = 0; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; alcoholPoisonLevel = 0; + noLifeRegen = false; thirdSage = false; - if (player.immuneTime <= 0) - thirdSageH = false; - perfmini = false; akato = false; leviPet = false; @@ -1396,6 +1499,8 @@ namespace CalamityMod.CalPlayer scalPet = false; hiveMindPet = false; bendyPet = false; + littleLightPet = false; + onyxExcavator = false; angryDog = false; fab = false; @@ -1421,7 +1526,7 @@ namespace CalamityMod.CalPlayer fasterRogueLevel = false; dodgeScarf = false; - evasionScarf = false; + evasionScarf = false; scarfCooldown = false; eScarfCooldown = false; @@ -1431,17 +1536,11 @@ namespace CalamityMod.CalPlayer godSlayer = false; godSlayerDamage = false; - godSlayerMage = false; godSlayerRanged = false; godSlayerThrowing = false; - godSlayerSummon = false; - godSlayerReflect = false; godSlayerCooldown = false; silvaSet = false; - silvaMelee = false; - silvaRanged = false; - silvaThrowing = false; silvaMage = false; silvaSummon = false; @@ -1471,42 +1570,10 @@ namespace CalamityMod.CalPlayer dsSetBonus = false; wearingRogueArmor = false; - kingSlimeLore = false; - desertScourgeLore = false; - crabulonLore = false; - eaterOfWorldsLore = false; - hiveMindLore = false; - perforatorLore = false; - queenBeeLore = false; - skeletronLore = false; - slimeGodLoreProcessed = false; - wallOfFleshLore = false; - twinsLore = false; - destroyerLore = false; - aquaticScourgeLore = false; - skeletronPrimeLore = false; - brimstoneElementalLore = false; - calamitasLore = false; - planteraLore = false; - leviathanAndSirenLore = false; - astrumAureusLore = false; - astrumDeusLore = false; - golemLore = false; - plaguebringerGoliathLore = false; - dukeFishronLore = false; - boomerDukeLore = false; - ravagerLore = false; - lunaticCultistLore = false; - moonLordLore = false; - providenceLore = false; - polterghastLore = false; - DoGLore = false; - yharonLore = false; - SCalLore = false; - oceanLore = false; - corruptionLore = false; - crimsonLore = false; - underworldLore = false; + noWings = false; + blockAllDashes = false; + blazingMouseDamageEffects = false; + ableToDrawBlazingMouse = false; luxorsGift = false; fungalSymbiote = false; @@ -1536,6 +1603,7 @@ namespace CalamityMod.CalPlayer seaShell = false; absorber = false; aAmpoule = false; + sponge = false; rOoze = false; pAmulet = false; fBarrier = false; @@ -1557,11 +1625,13 @@ namespace CalamityMod.CalPlayer nuclearRod = false; heartOfDarkness = false; shadowMinions = false; - tearMinions = false; + holyMinions = false; alchFlask = false; reducedPlagueDmg = false; - abaddon = false; + abaddon = false; + aeroStone = false; community = false; + shatteredCommunity = false; stressPills = false; laudanum = false; fleshTotem = false; @@ -1574,7 +1644,8 @@ namespace CalamityMod.CalPlayer celestialJewel = false; astralArcanum = false; harpyRing = false; - harpyWingBoost = false; //harpy wings + harpy ring + angelTreads = false; + harpyWingBoost = false; //harpy wings + harpy ring darkSunRing = false; calamityRing = false; voidOfExtinction = false; @@ -1592,13 +1663,11 @@ namespace CalamityMod.CalPlayer raiderTalisman = false; gSabaton = false; sGenerator = false; - sDefense = false; sRegen = false; - sPower = false; hallowedRune = false; - hallowedDefense = false; + phantomicArtifact = false; hallowedRegen = false; - hallowedPower = false; + hallowedPower = false; kamiBoost = false; IBoots = false; elysianFire = false; @@ -1618,12 +1687,14 @@ namespace CalamityMod.CalPlayer starbusterCore = false; starTaintedGenerator = false; camper = false; - silvaWings = false; - corrosiveSpine = false; + silvaWings = false; + corrosiveSpine = false; rustyMedal = false; noStupidNaturalARSpawns = false; burdenBreakerYeet = false; roverDrive = false; + rottenDogTooth = false; + angelicAlliance = false; daedalusReflect = false; daedalusSplit = false; @@ -1634,19 +1705,22 @@ namespace CalamityMod.CalPlayer brimflameFrenzy = false; brimflameFrenzyCooldown = false; - reaverSpore = false; - reaverDoubleTap = false; - reaverBlast = false; - reaverBurst = false; + rangedAmmoCost = 1f; + + avertorBonus = false; + + reaverRegen = false; + reaverSpeed = false; + reaverDefense = false; + reaverExplore = false; ironBoots = false; depthCharm = false; anechoicPlating = false; jellyfishNecklace = false; - abyssDivingGear = false; + abyssDivingGear = false; abyssalAmulet = false; lumenousAmulet = false; - reaperToothNecklace = false; aquaticEmblem = false; astralStarRain = false; @@ -1663,12 +1737,12 @@ namespace CalamityMod.CalPlayer victideSet = false; sulfurSet = false; - sulfurJump = false; + sulfurJump = false; aeroSet = false; statigelSet = false; - statigelJump = false; + statigelJump = false; titanHeartSet = false; titanHeartMask = false; @@ -1676,9 +1750,9 @@ namespace CalamityMod.CalPlayer titanHeartBoots = false; umbraphileSet = false; plagueReaper = false; - plaguebringerPatronSet = false; - plaguebringerCarapace = false; - plaguebringerPistons = false; + plaguebringerPatronSet = false; + plaguebringerCarapace = false; + plaguebringerPistons = false; fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; @@ -1743,10 +1817,10 @@ namespace CalamityMod.CalPlayer wDeath = false; lethalLavaBurn = false; aCrunch = false; - absoluteRage = false; - horror = false; irradiated = false; bFlames = false; + witheredDebuff = false; + weakBrimstoneFlames = false; aFlames = false; gsInferno = false; astralInfection = false; @@ -1759,7 +1833,6 @@ namespace CalamityMod.CalPlayer vHex = false; eGrav = false; warped = false; - marked = false; cDepth = false; fishAlert = false; bOut = false; @@ -1775,8 +1848,11 @@ namespace CalamityMod.CalPlayer iCantBreathe = false; cragsLava = false; vaporfied = false; - energyShellCooldown = false; - prismaticCooldown = false; + energyShellCooldown = false; + prismaticCooldown = false; + waterLeechBleeding = false; + divineBlessCooldown = false; + banishingFire = false; revivify = false; trinketOfChiBuff = false; @@ -1788,8 +1864,6 @@ namespace CalamityMod.CalPlayer xWrath = false; graxDefense = false; encased = false; - sMeleeBoost = false; - eScarfBoost = false; tFury = false; cadence = false; omniscience = false; @@ -1836,6 +1910,7 @@ namespace CalamityMod.CalPlayer polarisBoostThree = false; bloodfinBoost = false; bloodPactBoost = false; + divineBless = false; killSpikyBalls = false; @@ -1932,7 +2007,6 @@ namespace CalamityMod.CalPlayer slimeGod = false; urchin = false; chaosSpirit = false; - reaverOrb = false; daedalusCrystal = false; shellfish = false; hCrab = false; @@ -1944,6 +2018,8 @@ namespace CalamityMod.CalPlayer plaguebringerMK2 = false; igneousExaltation = false; coldDivinity = false; + voidAura = false; + voidAuraDamage = false; radiantResolution = false; virili = false; frostBlossom = false; @@ -1962,9 +2038,26 @@ namespace CalamityMod.CalPlayer snakeEyes = false; poleWarper = false; causticDragon = false; - plaguebringerPatronSummon = false; - howlTrio = false; + plaguebringerPatronSummon = false; + howlTrio = false; mountedScanner = false; + sepulcher = false; + daedalusGolem = false; + deathstareEyeball = false; + witherBlossom = false; + flowersOfMortality = false; + viridVanguard = false; + sageSpirit = false; + fleshBall = false; + eyeOfNight = false; + soulSeeker = false; + perditionBeacon = false; + + disableVoodooSpawns = false; + disablePerfCystSpawns = false; + disableHiveCystSpawns = false; + disableNaturalScourgeSpawns = false; + disableAnahitaSpawns = false; abyssalDivingSuitPrevious = abyssalDivingSuit; abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; @@ -1986,34 +2079,39 @@ namespace CalamityMod.CalPlayer rageModeActive = false; adrenalineModeActive = false; + RageDuration = DefaultRageDuration; + RageDamageBoost = DefaultRageDamageBoost; + + cursedSummonsEnchant = false; + flamingItemEnchant = false; + lifeManaEnchant = false; + farProximityRewardEnchant = false; + closeProximityRewardEnchant = false; + dischargingItemEnchant = false; + explosiveMinionsEnchant = false; + bladeArmEnchant = false; + manaMonsterEnchant = false; + witheringWeaponEnchant = false; + persecutedEnchant = false; + lecherousOrbEnchant = false; + flatStealthLossReduction = 0; lastProjectileHit = null; + + CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); } #endregion #region Screen Position Movements public override void ModifyScreenPosition() { - if (CalamityWorld.ScreenShakeSpots.Count > 0) - { - // Fail-safe to ensure that spots don't last forever. - Dictionary screenShakeSpots = new Dictionary(); - List screenShakeUUIDs = CalamityWorld.ScreenShakeSpots.Keys.ToList(); - for (int i = 0; i < CalamityWorld.ScreenShakeSpots.Count; i++) - { - int uuid = screenShakeUUIDs[i]; - if (Main.projectile[uuid].active) - { - screenShakeSpots.Add(uuid, CalamityWorld.ScreenShakeSpots[uuid]); - } - } - CalamityWorld.ScreenShakeSpots = screenShakeSpots; + if (CalamityConfig.Instance.DisableScreenShakes) + return; - foreach (var spot in CalamityWorld.ScreenShakeSpots) - { - float maxPower = Utils.InverseLerp(1300f, 0f, Vector2.Distance(spot.Value.Position, player.Center), true) * spot.Value.ScreenShakePower; - Main.screenPosition += Main.rand.NextVector2Circular(maxPower, maxPower); - } + if (GeneralScreenShakePower > 0f) + { + Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower, GeneralScreenShakePower); + GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f); } } #endregion @@ -2021,39 +2119,49 @@ namespace CalamityMod.CalPlayer #region UpdateDead public override void UpdateDead() { - #region Debuffs + #region Debuffs + dodgeCooldownTimer = 0; + defenseDamage = 0; + timeBeforeDefenseDamageRecovery = 0; deathModeBlizzardTime = 0; deathModeUnderworldTime = 0; - gaelRageCooldown = 0; + heldGaelsLastFrame = false; + gaelRageAttackCooldown = 0; gaelSwipes = 0; - gaelSwitchTimer = 0; andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; galileoCooldown = 0; soundCooldown = 0; shadowPotCooldown = 0; - dogTextCooldown = 0; - rage = 0; - adrenaline = 0; + dogTextCooldown = 0; + auralisStealthCounter = 0f; + auralisAuroraCounter = 0; + auralisAuroraCooldown = 0; + auralisAurora = 0; + fungalSymbioteTimer = 0; + aBulwarkRareTimer = 0; + rage = 0f; + adrenaline = 0f; raiderStack = 0; raiderCooldown = 0; gSabatonFall = 0; gSabatonCooldown = 0; astralStarRainCooldown = 0; - bloodflareMageCooldown = 0; - tarraMageHealCooldown = 0; + silvaMageCooldown = 0; + bloodflareMageCooldown = 0; + tarraRangedCooldown = 0; + tarraMageHealCooldown = 0; bossRushImmunityFrameCurseTimer = 0; aBulwarkRareMeleeBoostTimer = 0; acidRoundMultiplier = 1D; externalAbyssLight = 0; externalColdImmunity = externalHeatImmunity = false; polarisBoostCounter = 0; + dragonRageHits = 0; spectralVeilImmunity = 0; jetPackCooldown = 0; - blunderBoosterDash = 0; - blunderBoosterDirection = 0; - plaguedFuelPackDash = 0; - plaguedFuelPackDirection = 0; + jetPackDash = 0; + jetPackDirection = 0; andromedaCripple = 0; theBeeCooldown = 0; killSpikyBalls = false; @@ -2065,21 +2173,22 @@ namespace CalamityMod.CalPlayer icicleCooldown = 0; statisTimer = 0; hallowedRuneCooldown = 0; - doubledHorror = false; sulphurBubbleCooldown = 0; ladHearts = 0; prismaticLasers = 0; roverDriveTimer = 0; - + angelicActivate = -1; + resetHeightandWidth = false; + noLifeRegen = false; alcoholPoisoning = false; shadowflame = false; wDeath = false; lethalLavaBurn = false; aCrunch = false; - absoluteRage = false; - horror = false; irradiated = false; bFlames = false; + witheredDebuff = false; + weakBrimstoneFlames = false; aFlames = false; gsInferno = false; astralInfection = false; @@ -2092,7 +2201,6 @@ namespace CalamityMod.CalPlayer vHex = false; eGrav = false; warped = false; - marked = false; cDepth = false; fishAlert = false; bOut = false; @@ -2116,20 +2224,24 @@ namespace CalamityMod.CalPlayer iCantBreathe = false; cragsLava = false; vaporfied = false; - energyShellCooldown = false; - prismaticCooldown = false; - #endregion + energyShellCooldown = false; + prismaticCooldown = false; + waterLeechBleeding = false; + divineBlessCooldown = false; + banishingFire = false; + #endregion - #region Rogue - // Stealth - rogueStealth = 0f; + #region Rogue + // Stealth + rogueStealth = 0f; rogueStealthMax = 0f; stealthAcceleration = 1f; throwingDamage = 1f; + stealthDamage = 0f; throwingVelocity = 1f; throwingCrit = 0; - throwingAmmoCost = 1f; + throwingAmmoCost = 1f; #endregion #region UI @@ -2141,12 +2253,9 @@ namespace CalamityMod.CalPlayer #endregion #region Buffs - sDefense = false; sRegen = false; - sPower = false; - hallowedDefense = false; hallowedRegen = false; - hallowedPower = false; + hallowedPower = false; onyxExcavator = false; angryDog = false; fab = false; @@ -2164,8 +2273,6 @@ namespace CalamityMod.CalPlayer kamiBoost = false; graxDefense = false; encased = false; - sMeleeBoost = false; - eScarfBoost = false; tFury = false; cadence = false; omniscience = false; @@ -2196,7 +2303,7 @@ namespace CalamityMod.CalPlayer yPower = false; aWeapon = false; tScale = false; - titanBoost = 0; + titanBoost = 0; fabsolVodka = false; invincible = false; shine = false; @@ -2246,7 +2353,10 @@ namespace CalamityMod.CalPlayer healCounter = 300; danceOfLightCharge = 0; bloodPactBoost = false; - #endregion + rangedAmmoCost = 1f; + avertorBonus = false; + divineBless = false; + #endregion #region Armorbonuses flamethrowerBoost = false; @@ -2254,21 +2364,15 @@ namespace CalamityMod.CalPlayer shadowSpeed = false; godSlayer = false; godSlayerDamage = false; - godSlayerMage = false; godSlayerRanged = false; godSlayerThrowing = false; - godSlayerSummon = false; - godSlayerReflect = false; + godSlayerDashHotKeyPressed = false; auricBoost = false; silvaSet = false; - silvaMelee = false; - silvaRanged = false; - silvaThrowing = false; silvaMage = false; silvaSummon = false; hasSilvaEffect = false; - silvaCountdown = 600; - silvaHitCounter = 0; + silvaCountdown = 480; auricSet = false; omegaBlueChestplate = false; omegaBlueSet = false; @@ -2282,18 +2386,20 @@ namespace CalamityMod.CalPlayer brimflameSet = false; brimflameFrenzy = false; brimflameFrenzyCooldown = false; - reaverSpore = false; - reaverDoubleTap = false; + brimflameFrenzyTimer = 0; + reaverSpeed = false; + reaverRegen = false; + reaverRegenCooldown = 0; + reaverDefense = false; + reaverExplore = false; shadeRegen = false; dsSetBonus = false; titanHeartSet = false; titanHeartMask = false; titanHeartMantle = false; titanHeartBoots = false; - titanCooldown = 0; + titanCooldown = 0; umbraphileSet = false; - reaverBlast = false; - reaverBurst = false; fathomSwarmer = false; fathomSwarmerVisage = false; fathomSwarmerBreastplate = false; @@ -2305,9 +2411,9 @@ namespace CalamityMod.CalPlayer astralStarRain = false; plagueReaper = false; plagueReaperCooldown = 0; - plaguebringerPatronSet = false; - plaguebringerCarapace = false; - plaguebringerPistons = false; + plaguebringerPatronSet = false; + plaguebringerCarapace = false; + plaguebringerPistons = false; pistonsCounter = 0; ataxiaMage = false; ataxiaBolt = false; @@ -2319,18 +2425,18 @@ namespace CalamityMod.CalPlayer desertProwler = false; snowRuffianSet = false; forbiddenCirclet = false; - forbiddenCooldown = 0; - tornadoCooldown = 0; + forbiddenCooldown = 0; + tornadoCooldown = 0; eskimoSet = false; //vanilla armor meteorSet = false; //vanilla armor, for Space Gun nerf victideSet = false; aeroSet = false; - sulfurSet = false; - sulfurJump = false; - jumpAgainSulfur = false; + sulfurSet = false; + sulfurJump = false; + jumpAgainSulfur = false; statigelSet = false; - statigelJump = false; - jumpAgainStatigel = false; + statigelJump = false; + jumpAgainStatigel = false; tarraSet = false; tarraMelee = false; tarragonCloak = false; @@ -2350,6 +2456,7 @@ namespace CalamityMod.CalPlayer bloodflareMeleeHits = 0; bloodflareRanged = false; bloodflareSoulCooldown = false; + bloodflareSoulTimer = 0; bloodflareThrowing = false; bloodflareMage = false; bloodflareSummon = false; @@ -2363,33 +2470,33 @@ namespace CalamityMod.CalPlayer elysianGuard = false; #endregion - CurrentlyViewedFactoryX = CurrentlyViewedFactoryY = -1; - CurrentlyViewedFactory = null; - - CurrentlyViewedChargerX = CurrentlyViewedChargerY = -1; - CurrentlyViewedCharger = null; - - CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1; + CurrentlyViewedFactoryID = -1; + CurrentlyViewedChargerID = -1; + CurrentlyViewedHologramID = -1; CurrentlyViewedHologramText = string.Empty; KameiBladeUseDelay = 0; lastProjectileHit = null; - brimlashBusterBoost = false; - animusBoost = 1f; - potionTimer = 0; + brimlashBusterBoost = false; + evilSmasherBoost = 0; + hellbornBoost = 0; + animusBoost = 1f; + potionTimer = 0; + bloodflareCoreLostDefense = 0; + persecutedEnchantSummonTimer = 0; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { if (!CalamityGlobalNPC.AnyLivingPlayers()) { - CalamityWorld.bossRushActive = false; - CalamityWorld.bossRushStage = 0; - CalamityMod.UpdateServerBoolean(); + BossRushEvent.BossRushActive = false; + BossRushEvent.BossRushStage = 0; + CalamityNetcode.SyncWorld(); if (Main.netMode == NetmodeID.Server) { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Write(BossRushEvent.BossRushStage); netMessage.Send(); } for (int doom = 0; doom < Main.maxNPCs; doom++) @@ -2402,14 +2509,14 @@ namespace CalamityMod.CalPlayer } } } - if (CalamityWorld.armageddon && !areThereAnyDamnBosses) - { - player.respawnTimer -= 5; - } - else if (player.respawnTimer > 300 && Main.expertMode) //600 normal 900 expert - { - player.respawnTimer--; - } + + if (player.respawnTimer > 300) + { + if (CalamityWorld.armageddon && !areThereAnyDamnBosses) + player.respawnTimer -= 5; + else if (Main.expertMode) // 600 normal 900 expert + player.respawnTimer--; + } } #endregion @@ -2422,6 +2529,15 @@ namespace CalamityMod.CalPlayer bool useNebulaS = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:DevourerofGodsHeadS", useNebulaS); + 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); + else + SkyManager.Instance.Deactivate("CalamityMod:StormWeaverFlash"); + } + bool useBrimstone = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:CalamitasRun3", useBrimstone); @@ -2432,13 +2548,9 @@ namespace CalamityMod.CalPlayer if (SkyManager.Instance["CalamityMod:Cryogen"] != null && useCryogen != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) { if (useCryogen) - { SkyManager.Instance.Activate("CalamityMod:Cryogen", player.Center); - } else - { SkyManager.Instance.Deactivate("CalamityMod:Cryogen"); - } } Point point = player.Center.ToTileCoordinates(); @@ -2455,10 +2567,13 @@ namespace CalamityMod.CalPlayer bool useHoly = NPC.AnyNPCs(ModContent.NPCType()); player.ManageSpecialBiomeVisuals("CalamityMod:Providence", useHoly); - bool useSBrimstone = NPC.AnyNPCs(ModContent.NPCType()); + bool useSBrimstone = NPC.AnyNPCs(ModContent.NPCType()) || SCalSky.OverridingIntensity > 0f; player.ManageSpecialBiomeVisuals("CalamityMod:SupremeCalamitas", useSBrimstone); - bool inAstral = ZoneAstral; + bool useWyrmWater = NPC.AnyNPCs(ModContent.NPCType()); + player.ManageSpecialBiomeVisuals("CalamityMod:AdultEidolonWyrm", useWyrmWater); + + bool inAstral = ZoneAstral; player.ManageSpecialBiomeVisuals("CalamityMod:Astral", inAstral); bool cryogenActive = NPC.AnyNPCs(ModContent.NPCType()); @@ -2466,13 +2581,17 @@ namespace CalamityMod.CalPlayer if (SkyManager.Instance["CalamityMod:Cryogen"] != null && cryogenActive != SkyManager.Instance["CalamityMod:Cryogen"].IsActive()) { if (cryogenActive) - { SkyManager.Instance.Activate("CalamityMod:Cryogen"); - } else - { SkyManager.Instance.Deactivate("CalamityMod:Cryogen"); - } + } + + if (SkyManager.Instance["CalamityMod:StormWeaverFlash"] != null && useFlash != SkyManager.Instance["CalamityMod:StormWeaverFlash"].IsActive()) + { + if (useFlash) + SkyManager.Instance.Activate("CalamityMod:StormWeaverFlash", player.Center); + else + SkyManager.Instance.Deactivate("CalamityMod:StormWeaverFlash"); } } @@ -2534,30 +2653,30 @@ namespace CalamityMod.CalPlayer ZoneAbyssLayer4 = ZoneAbyss && point.Y > (Main.rockLayer + y * 0.26); + + ZoneSulphur = (CalamityWorld.sulphurTiles >= 300 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; - ZoneSulphur = (CalamityWorld.sulphurTiles > 30 || (player.ZoneOverworldHeight && sulphurPosX)) && !ZoneAbyss; + //Overriding 1.4's ass req boosts + if (Main.snowTiles > 300) + player.ZoneSnow = true; - //Overriding 1.4's ass req boosts - if (Main.snowTiles > 300) - player.ZoneSnow = true; - - Mod fargos = ModLoader.GetMod("Fargowiltas"); - if (fargos != null) - { - //Fargo's fountain effects - if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SunkenSeaWater").Type) - { - ZoneSunkenSea = true; - } - if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SulphuricWater").Type) - { - ZoneSulphur = true; - } - if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AstralWater").Type) - { - ZoneAstral = true; - } - } + Mod fargos = CalamityMod.Instance.fargos; + if (fargos != null) + { + //Fargo's fountain effects + if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SunkenSeaWater").Type) + { + ZoneSunkenSea = true; + } + if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "SulphuricWater").Type) + { + ZoneSulphur = true; + } + if (Main.fountainColor == CalamityGlobalTile.WaterStyles.FirstOrDefault((style) => style.Name == "AstralWater").Type) + { + ZoneAstral = true; + } + } } public override bool CustomBiomesMatch(Player other) @@ -2704,24 +2823,51 @@ namespace CalamityMod.CalPlayer 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 = chaosStateDurationBoss; - if (eScarfCooldown) - duration = (int)(duration * 1.5); - else if (scarfCooldown) - duration *= 2; - player.AddBuff(BuffID.ChaosState, duration, true); + int duration = chaosStateDuration; + if (areThereAnyDamnBosses || areThereAnyDamnEvents) + duration = (int)(chaosStateDurationBoss * 1.5); + if (eScarfCooldown) + duration = (int)(duration * 1.5); + else if (scarfCooldown) + duration *= 2; + player.AddBuff(BuffID.ChaosState, duration, true); } } } } + if (CalamityMod.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == player.whoAmI && !divineBless && !divineBlessCooldown) + { + int seconds = CalamityUtils.SecondsToFrames(15f); + player.AddBuff(ModContent.BuffType(), seconds, false); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AngelicAllianceActivation"), player.Center); + + // Spawn an archangel for every minion you have + float angelAmt = 0f; + for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) + { + Projectile proj = Main.projectile[projIndex]; + if (proj.minionSlots <= 0f || !proj.IsSummon()) + continue; + if (proj.active && proj.owner == player.whoAmI) + { + angelAmt += 1f; + } + } + for (int projIndex = 0; projIndex < angelAmt; projIndex++) + { + 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); + } + } if (CalamityMod.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && !sandCloakCooldown) { player.AddBuff(ModContent.BuffType(), 1800, false); //30 seconds rogueStealth -= rogueStealthMax * 0.25f; - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI, 0, 0); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 7, 8, player.whoAmI); Main.PlaySound(SoundID.Item, player.position, 45); } if (CalamityMod.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && @@ -2759,14 +2905,14 @@ namespace CalamityMod.CalPlayer player.Teleport(teleportLocation, 1, 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 = chaosStateDurationBoss; - if (eScarfCooldown) - duration = (int)(duration * 1.5); - else if (scarfCooldown) - duration *= 2; - player.AddBuff(BuffID.ChaosState, duration, true); + int duration = chaosStateDuration; + if (areThereAnyDamnBosses || areThereAnyDamnEvents) + duration = chaosStateDurationBoss; + if (eScarfCooldown) + duration = (int)(duration * 1.5); + else if (scarfCooldown) + duration *= 2; + player.AddBuff(BuffID.ChaosState, duration, true); int numDust = 40; Vector2 step = playerToTeleport / numDust; @@ -2781,9 +2927,7 @@ namespace CalamityMod.CalPlayer player.immuneTime = 120; spectralVeilImmunity = 120; for (int k = 0; k < player.hurtCooldowns.Length; k++) - { player.hurtCooldowns[k] = player.immuneTime; - } } } } @@ -2791,24 +2935,12 @@ namespace CalamityMod.CalPlayer if (CalamityMod.PlaguePackHotKey.JustPressed && hasJetpack && Main.myPlayer == player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && wearingRogueArmor && rogueStealthMax > 0 && jetPackCooldown == 0 && !player.mount.Active) { - if (blunderBooster) - { - jetPackCooldown = 90; - blunderBoosterDash = 15; - blunderBoosterDirection = player.direction; - rogueStealth -= rogueStealthMax * 0.25f; - Main.PlaySound(SoundID.Item66, player.Center); - Main.PlaySound(SoundID.Item34, player.Center); - } - else if (plaguedFuelPack) - { - jetPackCooldown = 90; - plaguedFuelPackDash = 10; - plaguedFuelPackDirection = player.direction; - rogueStealth -= rogueStealthMax * 0.25f; - Main.PlaySound(SoundID.Item66, player.Center); - Main.PlaySound(SoundID.Item34, player.Center); - } + jetPackDash = blunderBooster ? 15 : 10; + jetPackDirection = player.direction; + jetPackCooldown = 60; + rogueStealth -= rogueStealthMax * 0.25f; + Main.PlaySound(SoundID.Item66, player.Center); + Main.PlaySound(SoundID.Item34, player.Center); } if (CalamityMod.TarraHotKey.JustPressed) { @@ -2825,7 +2957,7 @@ namespace CalamityMod.CalPlayer { brimflameFrenzy = true; player.AddBuff(ModContent.BuffType(), 10 * 60, true); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimflameAbility"), player.Center); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/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); @@ -2858,30 +2990,31 @@ namespace CalamityMod.CalPlayer if (player.whoAmI == Main.myPlayer) { player.AddBuff(ModContent.BuffType(), 1800, false); + bloodflareSoulTimer = 1800; } - Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); - for (int num502 = 0; num502 < 64; num502++) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/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); Main.dust[dust].velocity *= 3f; Main.dust[dust].scale *= 1.15f; } - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) { - 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.Phantoplasm, 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; + 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 deltaAngle = spread / 8f; double offsetAngle; - int damage = (int)(800 * player.RangedDamage()); + int damage = (int)(300 * player.RangedDamage()); if (player.whoAmI == Main.myPlayer) { for (int i = 0; i < 8; i++) @@ -2890,9 +3023,13 @@ 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; - 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); - 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 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); + if (soul2.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul2].Calamity().forceTypeless = true; + } } } if (omegaBlueSet && omegaBlueCooldown <= 0) @@ -2914,7 +3051,7 @@ namespace CalamityMod.CalPlayer } if (dsSetBonus) { - Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/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); @@ -2949,13 +3086,13 @@ namespace CalamityMod.CalPlayer } } if (plagueReaper && plagueReaperCooldown <= 0) - { + { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueReaperAbility"), player.Center); plagueReaperCooldown = 1800; - } - if (forbiddenCirclet && forbiddenCooldown <= 0) - { - forbiddenCooldown = 45; + } + if (forbiddenCirclet && forbiddenCooldown <= 0) + { + forbiddenCooldown = 45; int stormMana = (int)(ForbiddenCirclet.manaCost * player.manaCost); if (player.statMana < stormMana) { @@ -2968,30 +3105,32 @@ namespace CalamityMod.CalPlayer { player.manaRegenDelay = (int)player.maxRegenDelay; player.statMana -= stormMana; - float dmgMult = player.RogueDamage() + player.minionDamage - 1f; - int damage = (int)(ForbiddenCirclet.tornadoBaseDmg * dmgMult); + float dmgMult = player.RogueDamage() + player.minionDamage - 1f; + int damage = (int)(ForbiddenCirclet.tornadoBaseDmg * dmgMult); if (player.HasBuff(BuffID.ManaSickness)) { 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) - { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, player.whoAmI, 0f, 0f); + 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); + if (mark.WithinBounds(Main.maxProjectiles)) + Main.projectile[mark].Calamity().forceTypeless = true; } - } - } - if (prismaticSet && !prismaticCooldown && prismaticLasers <= 0) - prismaticLasers = CalamityUtils.SecondsToFrames(35f); + } + } + if (prismaticSet && !prismaticCooldown && prismaticLasers <= 0) + prismaticLasers = CalamityUtils.SecondsToFrames(35f); } - if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum) + if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum && !areThereAnyDamnBosses) { AstralArcanumUI.Toggle(); } if (CalamityMod.AstralTeleportHotKey.JustPressed) { - if (celestialJewel) + if (celestialJewel && !areThereAnyDamnBosses) { if (Main.netMode == NetmodeID.SinglePlayer) { @@ -3011,16 +3150,21 @@ namespace CalamityMod.CalPlayer elysianGuard = !elysianGuard; } } + + // Trigger for pressing the God Slayer dash key + if (CalamityMod.GodSlayerDashHotKey.JustPressed && (player.controlUp || player.controlDown || player.controlLeft || player.controlRight)) + godSlayerDashHotKeyPressed = true; + + // Trigger for pressing the Rage hotkey. if (CalamityMod.RageHotKey.JustPressed) { - if (gaelRageCooldown == 0 && player.ActiveItem().type == ModContent.ItemType() && - rage > 0) + // Gael's Greatsword replaces Rage Mode with an uber skull attack + if (gaelRageAttackCooldown == 0 && player.ActiveItem().type == ModContent.ItemType() && rage > 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); + for (int i = 0; i < 3; i++) - { 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; @@ -3032,26 +3176,11 @@ namespace CalamityMod.CalPlayer Main.dust[dustIndex].noGravity = true; Dust.NewDust(player.Center + angle.ToRotationVector2() * 160f, 0, 0, 218, 0f, 0f, 100, default, 1f); } - gaelRageCooldown = 60 * GaelsGreatsword.SkullsplosionCooldownSeconds; + float rageRatio = rage / rageMax; - int damage = (int)(rageRatio * GaelsGreatsword.MaxRageBoost * GaelsGreatsword.BaseDamage * player.MeleeDamage()); - float skullCount = 5f; - float skullSpeed = 5f; - if (CalamityWorld.downedYharon) - { - skullCount = 20f; - skullSpeed = 12f; - } - else if (NPC.downedMoonlord) - { - skullCount = 13f; - skullSpeed = 10f; - } - else if (Main.hardMode) - { - skullCount = 9f; - skullSpeed = 6.8f; - } + int damage = (int)(rageRatio * GaelsGreatsword.SkullsplosionDamageMultiplier * GaelsGreatsword.BaseDamage * player.MeleeDamage()); + float skullCount = 20f; + float skullSpeed = 12f; for (float i = 0; i < skullCount; i += 1f) { float angle = MathHelper.TwoPi * i / skullCount; @@ -3060,12 +3189,25 @@ namespace CalamityMod.CalPlayer 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(); - } - rage = 0; + if (projectileIndex.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectileIndex].Calamity().forceTypeless = true; + } + + // Remove all rage when the special attack is used, and apply the cooldown. + rage = 0f; + gaelRageAttackCooldown = CalamityUtils.SecondsToFrames(GaelsGreatsword.SkullsplosionCooldownSeconds); } - if (rage == rageMax && CalamityConfig.Instance.Rippers && !rageModeActive) + + // Activating Rage Mode + if (rage >= rageMax && CalamityConfig.Instance.Rippers && !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); + + // Moon Lord deathray sound. Should probably be replaced some day Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); + + // 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); @@ -3083,14 +3225,20 @@ namespace CalamityMod.CalPlayer Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - player.AddBuff(ModContent.BuffType(), RageDuration); } } + + // Trigger for pressing the Adrenaline hotkey. if (CalamityMod.AdrenalineHotKey.JustPressed && CalamityConfig.Instance.Rippers && CalamityWorld.revenge) { if (adrenaline == adrenalineMax && !adrenalineModeActive) { + player.AddBuff(ModContent.BuffType(), AdrenalineDuration); + + // Moon Lord deathray sound. Should probably be replaced some day Main.PlaySound(SoundID.Zombie, (int)player.position.X, (int)player.position.Y, 104); + + // 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); @@ -3108,74 +3256,74 @@ namespace CalamityMod.CalPlayer Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } - player.AddBuff(ModContent.BuffType(), AdrenalineDuration); } } - 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 (statigelJump && jumpAgainStatigel) - { - jumpAgainStatigel = false; - 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); - 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); - if (d % 2 == 0) - Main.dust[goo].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f; - else - Main.dust[goo].velocity.X -= (float)Main.rand.Next(30, 71) * 0.1f; - Main.dust[goo].velocity.Y += (float)Main.rand.Next(-10, 31) * 0.1f; - Main.dust[goo].noGravity = true; - Main.dust[goo].scale += (float)Main.rand.Next(-10, 41) * 0.01f; - Main.dust[goo].velocity *= Main.dust[goo].scale * 0.7f; - } - } - else if (sulfurJump && jumpAgainSulfur) - { - jumpAgainSulfur = false; - 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); - 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); - if (d % 2 == 0) - Main.dust[sulfur].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f; - else - Main.dust[sulfur].velocity.X -= (float)Main.rand.Next(30, 71) * 0.1f; - Main.dust[sulfur].velocity.Y += (float)Main.rand.Next(-10, 31) * 0.1f; - Main.dust[sulfur].noGravity = true; - Main.dust[sulfur].scale += (float)Main.rand.Next(-10, 41) * 0.01f; - Main.dust[sulfur].velocity *= Main.dust[sulfur].scale * 0.7f; - } - 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); - Main.projectile[bubble].Calamity().forceRogue = true; - sulphurBubbleCooldown = 20; - } - } - } + 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 (statigelJump && jumpAgainStatigel) + { + jumpAgainStatigel = false; + 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); + 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); + if (d % 2 == 0) + Main.dust[goo].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f; + else + Main.dust[goo].velocity.X -= (float)Main.rand.Next(30, 71) * 0.1f; + Main.dust[goo].velocity.Y += (float)Main.rand.Next(-10, 31) * 0.1f; + Main.dust[goo].noGravity = true; + Main.dust[goo].scale += (float)Main.rand.Next(-10, 41) * 0.01f; + Main.dust[goo].velocity *= Main.dust[goo].scale * 0.7f; + } + } + else if (sulfurJump && jumpAgainSulfur) + { + jumpAgainSulfur = false; + 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); + 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); + if (d % 2 == 0) + Main.dust[sulfur].velocity.X += (float)Main.rand.Next(30, 71) * 0.1f; + else + Main.dust[sulfur].velocity.X -= (float)Main.rand.Next(30, 71) * 0.1f; + Main.dust[sulfur].velocity.Y += (float)Main.rand.Next(-10, 31) * 0.1f; + Main.dust[sulfur].noGravity = true; + Main.dust[sulfur].scale += (float)Main.rand.Next(-10, 41) * 0.01f; + Main.dust[sulfur].velocity *= Main.dust[sulfur].scale * 0.7f; + } + 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); + if (bubble.WithinBounds(Main.maxProjectiles)) + Main.projectile[bubble].Calamity().forceTypeless = true; + sulphurBubbleCooldown = 20; + } + } + } } #endregion @@ -3454,6 +3602,7 @@ namespace CalamityMod.CalPlayer for (int n = 13; n < 18 + player.extraAccessorySlots; n++) { Item item = player.armor[n]; + if (item.type == ModContent.ItemType()) { snowmanHide = false; @@ -3483,6 +3632,13 @@ 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++) + { + if (player.armor[i].type == ItemID.AnkhShield) + player.buffImmune[BuffID.WindPushed] = true; + } + if (CalamityConfig.Instance.BossHealthBar) { drawBossHPBar = true; @@ -3491,20 +3647,22 @@ namespace CalamityMod.CalPlayer { drawBossHPBar = false; } - if (CalamityConfig.Instance.BossHealthBarExtraInfo) - { - shouldDrawSmallText = true; - } - else - { - shouldDrawSmallText = false; - } + + CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; if (CalamityConfig.Instance.MiningSpeedBoost) { player.pickSpeed *= 0.75f; } + // 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; + + if (player.accRunSpeed < accRunSpeedMin) + player.accRunSpeed = accRunSpeedMin; + #region MeleeSpeed float meleeSpeedMult = 0f; if (bBlood) @@ -3515,18 +3673,6 @@ namespace CalamityMod.CalPlayer { meleeSpeedMult += 0.05f; } - if (graxDefense) - { - meleeSpeedMult += 0.1f; - } - if (sMeleeBoost) - { - meleeSpeedMult += 0.05f; - } - if (eScarfBoost) - { - meleeSpeedMult += 0.15f; - } if (yPower) { meleeSpeedMult += 0.05f; @@ -3541,7 +3687,51 @@ namespace CalamityMod.CalPlayer } if (badgeOfBraveryRare) { - meleeSpeedMult += 0.2f; + int closestNPC = -1; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage) + { + closestNPC = i; + break; + } + } + float distance = -1f; + for (int j = 0; j < Main.maxNPCs; j++) + { + 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))); + if (distance == -1f || distance2 < distance) + { + distance = distance2; + closestNPC = j; + } + } + } + + if (closestNPC != -1) + { + NPC actualClosestNPC = Main.npc[closestNPC]; + + float generousHitboxWidth = Math.Max(actualClosestNPC.Hitbox.Width / 2f, actualClosestNPC.Hitbox.Height / 2f); + float hitboxEdgeDist = actualClosestNPC.Distance(player.Center) - generousHitboxWidth; + + if (hitboxEdgeDist < 0) + hitboxEdgeDist = 0; + + if (hitboxEdgeDist < maxWarBannerDistance) + { + warBannerBonus = MathHelper.Lerp(0f, maxWarBannerBonus, 1f - (hitboxEdgeDist / maxWarBannerDistance)); + + if (warBannerBonus > maxWarBannerBonus) + warBannerBonus = maxWarBannerBonus; + } + + meleeSpeedMult += warBannerBonus; + } } if (eGauntlet) { @@ -3554,68 +3744,61 @@ namespace CalamityMod.CalPlayer if (bloodyMary) { if (Main.bloodMoon) - { meleeSpeedMult += 0.15f; - } } if (community) { - float floatTypeBoost = 0.01f + + float floatTypeBoost = 0.05f + (NPC.downedSlimeKing ? 0.01f : 0f) + (NPC.downedBoss1 ? 0.01f : 0f) + (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + + (NPC.downedBoss3 ? 0.01f : 0f) + // 0.1 (Main.hardMode ? 0.01f : 0f) + (NPC.downedMechBossAny ? 0.01f : 0f) + (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + + (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + (CalamityWorld.downedProvidence ? 0.01f : 0f) + + (CalamityWorld.downedDoG ? 0.01f : 0f) + + (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 meleeSpeedMult += floatTypeBoost * 0.25f; } if (eArtifact) { meleeSpeedMult += 0.1f; } - if (bloodyWormTooth) + if (bloodyWormTooth) + { + if (player.statLife < (int)(player.statLifeMax2 * 0.5)) + meleeSpeedMult += 0.1f; + else + meleeSpeedMult += 0.05f; + } + if (player.beetleOffense && player.beetleOrbs > 0) { - if (player.statLife < (int)(player.statLifeMax2 * 0.5)) - meleeSpeedMult += 0.1f; - else - meleeSpeedMult += 0.05f; + meleeSpeedMult -= 0.1f * player.beetleOrbs; } - if (aquaticScourgeLore) - { - if (player.wellFed) - meleeSpeedMult += 0.025f; - else - meleeSpeedMult -= 0.025f; - } - if (CalamityConfig.Instance.Proficiency) + if (CalamityConfig.Instance.Proficiency) { meleeSpeedMult += GetMeleeSpeedBonus(); } player.meleeSpeed += meleeSpeedMult; - 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; - } - #endregion + 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; + } + #endregion - if (snowman) + if (snowman) { if (player.whoAmI == Main.myPlayer && !snowmanNoseless) - { player.AddBuff(ModContent.BuffType(), 60, true); - } } if (abyssalDivingSuit) { @@ -3659,6 +3842,46 @@ namespace CalamityMod.CalPlayer } #endregion + #region PreUpdate + public override void PreUpdate() + { + tailFrameUp++; + if (tailFrameUp == 8) + { + tailFrame++; + if (tailFrame >= 4) + { + tailFrame = 0; + } + tailFrameUp = 0; + } + + int frameAmt = 11; + if (roverFrameCounter >= 7) + { + roverFrameCounter = -1; + roverFrame = roverFrame == frameAmt - 1 ? 0 : roverFrame + 1; + } + roverFrameCounter++; + + int frames = 4; + if (voidFrameCounter >= 6) + { + voidFrameCounter = 0; + voidFrame = voidFrame == frames - 1 ? 0 : voidFrame + 1; + } + voidFrameCounter++; + + for (int i = 0; i < player.dye.Length; i++) + { + if (player.dye[i].type == ModContent.ItemType()) + { + GameShaders.Armor.GetSecondaryShader(player.dye[i].dye, player)?.UseColor(CalamityPlayerDrawEffects.GetCurrentMoonlightDyeColor()); + } + } + } + #endregion + #region PreUpdateBuffs public override void PreUpdateBuffs() { @@ -3671,143 +3894,30 @@ namespace CalamityMod.CalPlayer #endregion #region PostUpdateBuffs - public override void PostUpdateBuffs() - { - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - - if (player.mount.Active || player.mount.Cart || (CalamityConfig.Instance.BossRushDashCurse && CalamityWorld.bossRushActive)) - DashExploitFix(true); - - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - - if (boomerDukeLore) - player.buffImmune[ModContent.BuffType()] = false; - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - player.yoraiz0rEye = 0; - } + public override void PostUpdateBuffs() => ForceVariousEffects(); #endregion #region PostUpdateEquips - public override void PostUpdateEquips() - { - if (CalamityWorld.defiled) - Defiled(); + public override void PostUpdateEquips() => ForceVariousEffects(); + #endregion - if (weakPetrification) - WeakPetrification(); - - if (player.mount.Active || player.mount.Cart || (CalamityConfig.Instance.BossRushDashCurse && CalamityWorld.bossRushActive)) - DashExploitFix(true); - - if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) - { - if (player.lifeRegen < 0) - player.lifeRegen = 0; - } - - if (boomerDukeLore) - player.buffImmune[ModContent.BuffType()] = false; - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - player.yoraiz0rEye = 0; - } - #endregion - - #region Dash Exploit Fix - private void DashExploitFix(bool mount) - { - if (player.dashDelay != 0) - { - player.velocity *= 0.3f; - player.dashDelay = 0; - } - - if (!mount) - return; - - player.dash = 0; - dashMod = 0; - } - #endregion - - #region PostUpdate - - public override void PostUpdateMiscEffects() + #region PostUpdate + public override void PostUpdateMiscEffects() { CalamityPlayerMiscEffects.CalamityPostUpdateMiscEffects(player, mod); if (player.ActiveItem().type == ModContent.ItemType()) - { - gaelSwitchTimer = GaelSwitchPhase.LoseRage; - rage += (int)MathHelper.Min(5, 10000 - rage); - } - else if (player.ActiveItem().type != ModContent.ItemType() && gaelSwitchTimer == GaelSwitchPhase.LoseRage) - { - rage = 0; - gaelSwitchTimer = GaelSwitchPhase.None; - } + heldGaelsLastFrame = true; - // Disable the factory UI if the player is far from the associated factory. - if (CurrentlyViewedFactory != null) + // De-equipping Gael's Greatsword deletes all rage. + else if (heldGaelsLastFrame) { - Vector2 factoryPosition = new Vector2(CurrentlyViewedFactoryX, CurrentlyViewedFactoryY); - if (player.Distance(factoryPosition) > 1200f) - { - CurrentlyViewedFactory = null; - CurrentlyViewedFactoryX = CurrentlyViewedFactoryY = -1; - } - } - - // Disable the charger UI if the player is far from the associated charger. - if (CurrentlyViewedCharger != null) - { - Vector2 chargerPosition = new Vector2(CurrentlyViewedChargerX, CurrentlyViewedChargerY); - if (player.Distance(chargerPosition) > 1200f) - { - CurrentlyViewedCharger = null; - CurrentlyViewedChargerX = CurrentlyViewedChargerY = -1; - } - } - - // Disable the hologram UI if the player is far from the associated hologram. - Vector2 hologramPosition = new Vector2(CurrentlyViewedHologramX, CurrentlyViewedHologramY) * 16f; - if (player.Distance(hologramPosition) > 120f) - { - CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1; - CurrentlyViewedHologramText = string.Empty; + heldGaelsLastFrame = false; + rage = 0f; } } - #region Dragon Scale Logic - public override void PostBuyItem(NPC vendor, Item[] shopInventory, Item item) - { - if (item.type == ModContent.ItemType() && !CalamityWorld.dragonScalesBought) - { - CalamityWorld.dragonScalesBought = true; - } - } - #endregion - #region Shop Restrictions - - public override bool CanBuyItem(NPC vendor, Item[] shopInventory, Item item) - { - if (item.type == ModContent.ItemType()) - { - return !CalamityWorld.dragonScalesBought; - } - return base.CanBuyItem(vendor, shopInventory, item); - } - public override bool CanSellItem(NPC vendor, Item[] shopInventory, Item item) { if (item.type == ModContent.ItemType()) @@ -3823,7 +3933,6 @@ namespace CalamityMod.CalPlayer float runAccMult = 1f + (shadowSpeed ? 0.5f : 0f) + (stressPills ? 0.05f : 0f) + - (laudanum && horror ? 0.1f : 0f) + ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + @@ -3834,56 +3943,37 @@ namespace CalamityMod.CalPlayer (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + - (etherealExtorter && player.ZoneBeach ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 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) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (auricSet ? 0.1f : 0f) + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + - (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + - (etherealExtorter && player.ZoneBeach ? 0.05f : 0f) + - (stressPills ? 0.05f : 0f) + - (laudanum && horror ? 0.1f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - if (destroyerLore) - { - runAccMult *= 0.95f; - } - if (twinsLore) - { - if (player.statLife < (int)(player.statLifeMax2 * 0.5)) - runAccMult *= 0.95f; - } - if (skeletronPrimeLore) - { - runAccMult *= 0.95f; - } if (abyssalDivingSuit && !player.IsUnderwater()) { - runAccMult *= 0.4f; - runSpeedMult *= 0.4f; - } - if (horror) - { - runAccMult *= 0.85f; - runSpeedMult *= 0.85f; + float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; + runAccMult *= multiplier; + runSpeedMult *= multiplier; } if (fabledTortoise) { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; + float multiplier = shellBoost ? 0.8f : 0.5f; + runAccMult *= multiplier; + runSpeedMult *= multiplier; } if (ursaSergeant) { @@ -3895,18 +3985,11 @@ namespace CalamityMod.CalPlayer runAccMult *= 0.5f; runSpeedMult *= 0.5f; } - if (CalamityWorld.revenge) - { - if (player.powerrun) - { - runSpeedMult *= 0.6666667f; - } - if ((player.slippy || player.slippy2) && player.iceSkate) - { - runAccMult *= 0.6666667f; - } - } - if (CalamityWorld.death && deathModeBlizzardTime > 0) + if ((player.slippy || player.slippy2) && player.iceSkate) + { + runAccMult *= 0.6f; + } + if (CalamityWorld.death && deathModeBlizzardTime > 0) { float speedMult = (3600 - deathModeBlizzardTime) / 3600f; runAccMult *= speedMult; @@ -3921,15 +4004,15 @@ namespace CalamityMod.CalPlayer if (player.pulley && dashMod > 0) { ModDashMovement(); - } + } else if (player.grappling[0] == -1 && !player.tongued) { ModHorizontalMovement(); - if (dashMod > 0) + if (dashMod > 0) ModDashMovement(); - if (pAmulet && modStealth < 1f) + if (pAmulet && modStealth < 1f) { float num43 = player.maxRunSpeed / 2f * (1f - modStealth); player.maxRunSpeed -= num43; @@ -3940,12 +4023,150 @@ namespace CalamityMod.CalPlayer } #endregion - #region Rogue Mirrors + #region Dodges + private bool HandleDodges() + { + if (player.whoAmI != Main.myPlayer) + return false; + + if (spectralVeil && spectralVeilImmunity > 0) + { + SpectralVeil(); + return true; + } + + // Neither scarf can be used if either is on cooldown + bool playerDashing = player.pulley || (player.grappling[0] == -1 && !player.tongued); + if (playerDashing && dashMod == 9 && player.dashDelay < 0) + { + GodSlayerDodge(); + return true; + } + if (playerDashing && dashMod == 1 && player.dashDelay < 0 && dodgeScarf && !scarfCooldown && !eScarfCooldown) + { + OnDodge(); + return true; + } + + // Neither mirror can be used if either is on cooldown + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + + if (dodgeCooldownTimer == 0 && !isImmune && !eclipseMirrorCooldown && !abyssalMirrorCooldown) + { + if (eclipseMirror) + { + EclipseMirrorEvade(); + return true; + } + else if (abyssalMirror) + { + AbyssMirrorEvade(); + return true; + } + } + return false; + } + + private void SpectralVeil() + { + player.immune = true; + player.immuneTime = spectralVeilImmunity; //Set immunity before setting this variable to 0 + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + rogueStealth = rogueStealthMax; + spectralVeilImmunity = 0; + + Vector2 sVeilDustDir = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + sVeilDustDir.Normalize(); + sVeilDustDir *= 0.5f; + + 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); + 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/SilvaDispel"), player.Center); + + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + + private void GodSlayerDodge() + { + player.immune = true; + player.immuneTime = player.longInvince ? 100 : 60; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + + Main.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.PurpleCosmolite, 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); + if (Main.rand.NextBool(2)) + { + dust.scale *= 1f + Main.rand.Next(40) * 0.01f; + dust.noGravity = true; + } + } + + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + + private void OnDodge() + { + if (evasionScarf) + player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); + else + player.AddBuff(ModContent.BuffType(), player.chaosState ? 1800 : 900); + + player.immune = true; + player.immuneTime = player.longInvince ? 100 : 60; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + + for (int j = 0; j < 100; j++) + { + 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); + if (Main.rand.NextBool(2)) + { + dust.scale *= 1f + Main.rand.Next(40) * 0.01f; + dust.noGravity = true; + } + } + + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } + public void AbyssMirrorEvade() { if (player.whoAmI == Main.myPlayer && abyssalMirror && !abyssalMirrorCooldown && !eclipseMirror) { - player.AddBuff(ModContent.BuffType(), 1200); + dodgeCooldownTimer = MirrorDodgeCooldown; + player.AddBuff(ModContent.BuffType(), dodgeCooldownTimer); player.immune = true; player.immuneTime = player.longInvince ? 100 : 60; player.noKnockback = true; @@ -3963,12 +4184,19 @@ namespace CalamityMod.CalPlayer 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)) + Main.projectile[lumenyl].Calamity().forceTypeless = true; + } + // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust if (player.whoAmI == Main.myPlayer) { NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } + + // Send a Calamity dodge cooldown packet. + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + SyncDodgeCooldown(false); } } @@ -3976,7 +4204,8 @@ namespace CalamityMod.CalPlayer { if (player.whoAmI == Main.myPlayer && eclipseMirror && !eclipseMirrorCooldown) { - player.AddBuff(ModContent.BuffType(), 1200); + dodgeCooldownTimer = MirrorDodgeCooldown; + player.AddBuff(ModContent.BuffType(), dodgeCooldownTimer); player.immune = true; player.immuneTime = player.longInvince ? 100 : 60; player.noKnockback = true; @@ -3988,12 +4217,19 @@ namespace CalamityMod.CalPlayer } Main.PlaySound(SoundID.Item68, player.Center); - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(7000 * 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; - if (player.whoAmI == Main.myPlayer) + // TODO -- Calamity dodges should probably not send a vanilla dodge packet considering that causes Tabi dust + if (player.whoAmI == Main.myPlayer) { NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } + + // Send a Calamity dodge cooldown packet. + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + SyncDodgeCooldown(false); } } #endregion @@ -4002,6 +4238,59 @@ namespace CalamityMod.CalPlayer public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { PopupGUIManager.SuspendAll(); + + // Determine which minions need to be respawned. + if (Main.myPlayer == player.whoAmI) + { + int endoHydraHeadCount = 0; + int endoCooperType = ModContent.ProjectileType(); + int endoHydraHeadType = ModContent.ProjectileType(); + int endoHydraBodyType = ModContent.ProjectileType(); + int mechwormHeadType = ModContent.ProjectileType(); + + // Claim data to cache before respawning as necessary. + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.type != endoHydraHeadType || projectile.owner != player.whoAmI || !projectile.active) + continue; + endoHydraHeadCount++; + } + + for (int i = 0; i < Main.maxProjectiles; i++) + { + 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)) + continue; + + DeadMinionProperties deadMinionProperties; + + // Handle unique edge-cases in terms of summoning logic. + if (projectile.type == endoHydraBodyType) + deadMinionProperties = new DeadEndoHydraProperties(endoHydraHeadCount, projectile.damage, projectile.knockBack); + else if (projectile.type == endoCooperType) + deadMinionProperties = new DeadEndoCooperProperties((int)projectile.ai[0], projectile.minionSlots, projectile.damage, projectile.knockBack); + else + { + float[] aiToCopy = projectile.ai; + + // If blacklisted from copying AI state values, zero out the AI values to feed to the copy. + if (CalamityLists.DontCopyOriginalMinionAIList.Contains(projectile.type)) + aiToCopy = new float[aiToCopy.Length]; + deadMinionProperties = new DeadMinionProperties(projectile.type, projectile.minionSlots, projectile.damage, projectile.knockBack, aiToCopy); + } + + // Refuse to add duplicate entries of a certain type if an entry already exists and + // the minion properties signify that it should be unique. + if (deadMinionProperties.DisallowMultipleEntries && PendingProjectilesToRespawn.ContainsType(deadMinionProperties.GetType())) + continue; + + // Otherwise, cache the minion's data for when the player respawns. + PendingProjectilesToRespawn.Add(deadMinionProperties); + } + } + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) { if (!Main.dedServ) @@ -4013,252 +4302,232 @@ namespace CalamityMod.CalPlayer 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)); - } } } + if (invincible && player.ActiveItem().type != ModContent.ItemType()) { if (player.statLife <= 0) - { player.statLife = 1; - } + return false; } + if (hInferno) { for (int x = 0; x < Main.maxNPCs; x++) { if (Main.npc[x].active && Main.npc[x].type == ModContent.NPCType()) - { Main.npc[x].active = false; - } } } + if (nCore && Main.rand.NextBool(10)) { Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 67); + for (int j = 0; j < 25; j++) { int num = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 100, default, 2f); Dust dust = Main.dust[num]; - dust.position.X += (float)Main.rand.Next(-20, 21); - dust.position.Y += (float)Main.rand.Next(-20, 21); + dust.position.X += Main.rand.Next(-20, 21); + dust.position.Y += Main.rand.Next(-20, 21); dust.velocity *= 0.9f; - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; + dust.scale *= 1f + Main.rand.Next(40) * 0.01f; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); if (Main.rand.NextBool(2)) - { - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } + dust.scale *= 1f + Main.rand.Next(40) * 0.01f; } + player.statLife += 100; player.HealEffect(100); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - return false; - } - if (godSlayer && !godSlayerCooldown) - { - Main.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); - Dust dust = Main.dust[num]; - dust.position.X += (float)Main.rand.Next(-20, 21); - dust.position.Y += (float)Main.rand.Next(-20, 21); - dust.velocity *= 0.9f; - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - } - } - int heal = draconicSurge && !draconicSurgeCooldown ? (player.statLifeMax2 / 2) : 150; - player.statLife += heal; - player.HealEffect(heal); - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - { - player.ClearBuff(ModContent.BuffType()); - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(60f)); - // 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]; - } - float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); - player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); - } - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(45f)); + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + return false; } + + if (dashMod == 9 && player.dashDelay < 0) + { + if (player.statLife < 1) + player.statLife = 1; + + return false; + } + if (silvaSet && silvaCountdown > 0) { - if (hasSilvaEffect) - { - silvaHitCounter++; - } if (player.FindBuffIndex(ModContent.BuffType()) == -1) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); - player.AddBuff(ModContent.BuffType(), auricSet ? 300 : 600); + + player.AddBuff(ModContent.BuffType(), 480); + if (draconicSurge && !draconicSurgeCooldown) { player.statLife += player.statLifeMax2 / 2; player.HealEffect(player.statLifeMax2 / 2); + if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } + if (player.FindBuffIndex(ModContent.BuffType()) > -1) { player.ClearBuff(ModContent.BuffType()); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(60f)); - // 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]; - } - float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); - player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); - } + // 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]; + } + + float potionSicknessTime = 30f + (float)Math.Ceiling(additionalTime / 60D); + player.AddBuff(BuffID.PotionSickness, CalamityUtils.SecondsToFrames(potionSicknessTime)); + } } - else if (silvaWings) - { + else if (silvaWings) + { player.statLife += player.statLifeMax2 / 2; player.HealEffect(player.statLifeMax2 / 2); + if (player.statLife > player.statLifeMax2) - { player.statLife = player.statLifeMax2; - } - } + } } + hasSilvaEffect = true; + if (player.statLife < 1) - { player.statLife = 1; - } + return false; } + if (permafrostsConcoction && player.FindBuffIndex(ModContent.BuffType()) == -1) { player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(180f)); player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(3f)); + player.statLife = player.statLifeMax2 * 3 / 10; + Main.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); Main.dust[d].noGravity = true; Main.dust[d].velocity *= 5f; } + return false; } - //Custom Death Messages + // Custom Death Messages - if (alcoholPoisoning && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) + if (damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) { - if (Main.rand.Next(2) == 0) - damageSource = PlayerDeathReason.ByCustomReason(player.name + " downed too many shots."); - else - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s liver failed."); - } - if (vHex && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was charred by the brimstone inferno."); - } - if ((ZoneCalamity && player.lavaWet) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was released by the lava."); - } - if (gsInferno && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was extinguished."); - } - if (sulphurPoison && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - if (Main.rand.NextBool(2)) - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was melted by the toxic waste."); - else - damageSource = PlayerDeathReason.ByOther(9); - } - if (lethalLavaBurn && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " disintegrated into ashes."); - } - if (hInferno && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was turned to ashes by the Profaned Goddess."); - } - if (hFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " fell prey to their sins."); - } - if (shadowflame && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s spirit was turned to ash."); - } - if (bBlood && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " became a blood geyser."); - } - if (cDepth && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - if (Main.rand.NextBool(2)) - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was crushed by the pressure."); - else - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s lungs collapsed."); - } - if ((bFlames || aFlames) && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was consumed by the black flames."); - } - if (pFlames && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - if (Main.rand.NextBool(2)) - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s flesh was melted by the plague."); - else - damageSource = PlayerDeathReason.ByCustomReason(player.name + " didn't vaccinate."); - } - if (astralInfection && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - if (Main.rand.NextBool(2)) - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s infection spread too far."); - else - damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s skin was replaced by the astral virus."); - } - if (nightwither && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " was incinerated by lunar rays."); - } - if (vaporfied && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air."); - } - if (manaOverloader && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - 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) - && damage == 10.0 && hitDirection == 0 && damageSource.SourceOtherIndex == 8) - { - damageSource = PlayerDeathReason.ByCustomReason(player.name + " succumbed to alcohol sickness."); + if (alcoholPoisoning) + { + if (Main.rand.NextBool()) + damageSource = PlayerDeathReason.ByCustomReason(player.name + " downed too many shots."); + else + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s liver failed."); + } + if (vHex) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " was charred by the brimstone inferno."); + } + if (ZoneCalamity && player.lavaWet) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s soul was released by the lava."); + } + if (gsInferno) + { + 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."); + else + damageSource = PlayerDeathReason.ByOther(9); + } + if (lethalLavaBurn) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " disintegrated into ashes."); + } + if (hInferno) + { + 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."); + } + if (waterLeechBleeding) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " lost too much blood."); + } + if (shadowflame) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s spirit was turned to ash."); + } + if (bBlood) + { + 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."); + else + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s lungs collapsed."); + } + if (bFlames || aFlames || weakBrimstoneFlames) + { + 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."); + else + damageSource = PlayerDeathReason.ByCustomReason(player.name + " didn't vaccinate."); + } + if (astralInfection) + { + if (Main.rand.NextBool()) + damageSource = PlayerDeathReason.ByCustomReason(player.name + "'s infection spread too far."); + else + 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."); + } + if (vaporfied) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " vaporized into thin air."); + } + if (manaOverloader) + { + 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."); + } + if (witheredDebuff) + { + damageSource = PlayerDeathReason.ByCustomReason(player.name + " withered away."); + } } if (profanedCrystalBuffs && !profanedCrystalHide) { @@ -4273,16 +4542,16 @@ namespace CalamityMod.CalPlayer } } - if (CalamityWorld.ironHeart) - { - KillPlayer(); - return false; - } + if (CalamityWorld.ironHeart) + { + KillPlayer(); + return false; + } - deathCount++; + deathCount++; if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { - DeathPacket(false); + SyncDeathCount(false); } return true; @@ -4294,141 +4563,119 @@ namespace CalamityMod.CalPlayer { thirdSageH = true; + // Order the list such that less expensive minions are at the top. + // This way cheaper minions will be spawned first, and at the end, the most expensive + // ones can be ignored if the player ultimately has insufficient slots. + PendingProjectilesToRespawn = PendingProjectilesToRespawn.OrderBy(proj => proj.RequiredMinionSlots).ToList(); + + // Resurrect all pending minions as necessary. + if (Main.myPlayer == player.whoAmI) + { + float remainingSlots = player.maxMinions; + for (int i = 0; i < PendingProjectilesToRespawn.Count; i++) + { + // Stop checking if the player has exhausted all of their base minion slots. + if (remainingSlots - PendingProjectilesToRespawn[i].RequiredMinionSlots < 0f) + break; + + PendingProjectilesToRespawn[i].SummonCopy(player.whoAmI); + + + // Apply vanilla buffs as usual to the player. + if (VanillaMinionBuffRelationship.ContainsKey(PendingProjectilesToRespawn[i].Type)) + player.AddBuff(VanillaMinionBuffRelationship[PendingProjectilesToRespawn[i].Type], 3600); + + remainingSlots -= PendingProjectilesToRespawn[i].RequiredMinionSlots; + } + PendingProjectilesToRespawn.Clear(); + } + // The player rotation can be off if the player dies at the right time when using Final Dawn. player.fullRotation = 0f; } #endregion - #region Use Time Mult - public override float UseTimeMultiplier(Item item) + #region Get Heal Life + public override void GetHealLife(Item item, bool quickHeal, ref int healValue) { - if (silvaRanged) - { - if (item.ranged && item.useTime > 3) - return auricSet ? 1.2f : 1.1f; - } - if (silvaThrowing) - { - if (player.statLife > (int)(player.statLifeMax2 * 0.5) && - item.Calamity().rogue && item.useTime > 3) - return 1.1f; - } - if (etherealExtorter) - { - if (Main.moonPhase == 1 && item.Calamity().rogue && item.useTime > 3) //Waning gibbous - return 1.1f; - } - return 1f; + double healMult = 1D + + (coreOfTheBloodGod ? 0.15 : 0) + + (bloodPactBoost ? 0.5 : 0); + healValue = (int)(healValue * healMult); + if (CalamityWorld.ironHeart) + healValue = 0; } - #endregion + #endregion - #region Get Heal Life - public override void GetHealLife(Item item, bool quickHeal, ref int healValue) - { - if (bloodPactBoost) - healValue = (int)(healValue * 1.5); - if (CalamityWorld.ironHeart) - healValue = 0; - } - #endregion - - #region Get Weapon Damage And KB - public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) + #region Get Weapon Damage And KB + public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) { if (item.type == ModContent.ItemType()) - { - add += GaelsGreatsword.BaseDamage / (float)GaelsGreatsword.BaseDamage - 1f; - } - if (flamethrowerBoost && item.ranged && (item.useAmmo == 23 || CalamityMod.flamethrowerList.Contains(item.type))) - { - add += hoverboardBoost ? 0.35f : 0.25f; - } - if (cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) - { - add += 0.15f; - } - if (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type)) - { - add += 0.15f; - } - if (fireball && CalamityMod.fireWeaponList.Contains(item.type)) - { - add += 0.1f; - } - if (eskimoSet && CalamityMod.iceWeaponList.Contains(item.type)) - { - add += 0.1f; - } - if (etherealExtorter && player.ZoneDungeon && item.Calamity().rogue && !item.consumable) - { - add += 0.05f; - } + mult += GaelsGreatsword.BaseDamage / (float)GaelsGreatsword.BaseDamage - 1f; + + if (flamethrowerBoost && item.ranged && (item.useAmmo == AmmoID.Gel || CalamityLists.flamethrowerList.Contains(item.type))) + mult += hoverboardBoost ? 0.35f : 0.25f; + + if (fireball && cinnamonRoll && CalamityLists.fireWeaponList.Contains(item.type)) + { + mult += 0.125f; + } + else + { + if (fireball && CalamityLists.fireWeaponList.Contains(item.type)) + mult += 0.05f; + + if (cinnamonRoll && CalamityLists.fireWeaponList.Contains(item.type)) + mult += 0.1f; + } + + if (evergreenGin && CalamityLists.natureWeaponList.Contains(item.type)) + mult += 0.1f; + + if (eskimoSet && CalamityLists.iceWeaponList.Contains(item.type)) + mult += 0.1f; if (item.ranged) - { acidRoundMultiplier = item.useTime / 20D; - } else - { acidRoundMultiplier = 1D; - } - //Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me - if (desertProwler && (item.ranged || item.type == ModContent.ItemType()) && item.ammo == AmmoID.None) - { - flat += 1f; - } + + // Prismatic Breaker is a weird hybrid melee-ranged weapon so include it too. Why are you using desert prowler post-Yharon? don't ask me + if (desertProwler && (item.ranged || item.type == ModContent.ItemType()) && item.ammo == AmmoID.None) + flat += 1f; } public override void GetWeaponKnockback(Item item, ref float knockback) { if (auricBoost) - { knockback *= 1f + (1f - modStealth) * 0.5f; - } + if (whiskey) - { knockback *= 1.04f; - } + if (tequila && Main.dayTime) - { knockback *= 1.03f; - } + if (tequilaSunrise && Main.dayTime) - { knockback *= 1.07f; - } + if (moscowMule) - { knockback *= 1.09f; - } + if (titanHeartMask && item.Calamity().rogue) - { knockback *= 1.05f; - } + if (titanHeartMantle && item.Calamity().rogue) - { knockback *= 1.05f; - } + if (titanHeartBoots && item.Calamity().rogue) - { knockback *= 1.05f; - } + if (titanHeartSet && item.Calamity().rogue) - { knockback *= 1.2f; - } + if (titanHeartSet && StealthStrikeAvailable() && item.Calamity().rogue) - { knockback *= 2f; - } - bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; - if (etherealExtorter) - { - if (player.ZoneOverworldHeight && ZoneForest) - { - knockback *= 1.15f; - } - } } #endregion @@ -4473,7 +4720,7 @@ namespace CalamityMod.CalPlayer } if (item.melee) { - if (fungalSymbiote && player.whoAmI == Main.myPlayer) + if (fungalSymbiote && player.whoAmI == Main.myPlayer && fungalSymbioteTimer == 0) { if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1) || player.itemAnimation == (int)(player.itemAnimationMax * 0.3) || @@ -4481,6 +4728,7 @@ namespace CalamityMod.CalPlayer 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; @@ -4536,7 +4784,7 @@ namespace CalamityMod.CalPlayer 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.25f * player.MeleeDamage()), 0f, player.whoAmI, 0f, 0f); + 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) @@ -4568,13 +4816,6 @@ namespace CalamityMod.CalPlayer 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 (reaverBlast) - { - if (Main.rand.NextBool(3)) - { - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + player.direction * 3f, player.velocity.Y * 0.2f, 100, default, 0.75f); - } - } if (dsSetBonus) { if (Main.rand.NextBool(3)) @@ -4586,31 +4827,93 @@ namespace CalamityMod.CalPlayer } #endregion + #region On Hit Anything + public override void OnHitAnything(float x, float y, Entity victim) + { + // Currently only used for Rage combat frames. + rageCombatFrames = RageCombatDelayTime; + } + #endregion + #region On Hit NPC public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit) { - if (desertProwler && item.ranged && crit) //for obscure stuff like marnite bayonet - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - if (Main.rand.NextBool(15)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.RangedDamage()), knockback, player.whoAmI, 0f, 0f); - } - } - } - } - if (!item.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(target.Center, target.velocity, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); + if (player.whoAmI != Main.myPlayer) + return; + + if (witheringWeaponEnchant) + witheringDamageDone += (int)(damage * (crit ? 2D : 1D)); - if (omegaBlueChestplate) - target.AddBuff(ModContent.BuffType(), 240); - if (sulfurSet) - target.AddBuff(BuffID.Poisoned, 120); switch (item.type) { + case ItemID.CobaltSword: + target.Calamity().miscDefenseLoss = (int)(target.defense * 0.25); + break; + + case ItemID.PalladiumSword: + if (!target.canGhostHeal || player.moonLeech) + return; + player.lifeRegenTime += 2; + break; + + case ItemID.MythrilSword: + target.damage = (int)(target.defDamage * 0.9); + break; + + case ItemID.OrichalcumSword: + if (player.petalTimer > 0) + player.petalTimer /= 2; + break; + + case ItemID.AdamantiteSword: + float slowDownMult = 0.5f; + if (CalamityLists.enemyImmunityList.Contains(target.type) || target.boss) + slowDownMult = 0.95f; + target.velocity *= slowDownMult; + break; + + case ItemID.CandyCaneSword: + if (!target.canGhostHeal || player.moonLeech) + return; + player.statLife += 2; + player.HealEffect(2); + break; + + case ItemID.TheHorsemansBlade: + if (target.SpawnedFromStatue) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.type == ProjectileID.FlamingJack && proj.owner == Main.myPlayer) + proj.Kill(); + } + } + break; + + case ItemID.Excalibur: + case ItemID.TrueExcalibur: + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ItemID.BeeKeeper: + target.AddBuff(BuffID.Poisoned, 240); + break; + + case ItemID.LightsBane: + case ItemID.NightsEdge: + target.AddBuff(BuffID.ShadowFlame, 120); + break; + + case ItemID.TrueNightsEdge: + target.AddBuff(BuffID.CursedInferno, 60); + target.AddBuff(BuffID.ShadowFlame, 120); + break; + + case ItemID.BloodButcherer: + target.AddBuff(ModContent.BuffType(), 60); + break; + case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn, 600); @@ -4624,116 +4927,99 @@ namespace CalamityMod.CalPlayer break; } - if (item.melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes - { - titanBoost = 600; - if (eGauntlet) - { - int duration = 90; - target.AddBuff(BuffID.CursedInferno, duration / 2, false); - target.AddBuff(BuffID.Frostburn, duration, false); - target.AddBuff(BuffID.Ichor, duration, false); - target.AddBuff(BuffID.Venom, duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), duration, false); - } - } - if (cryogenSoul || frostFlare) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn); - } - if (yInsignia) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (ataxiaFire) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire, 4f); - } - if (aWeapon) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - } - if (abyssalAmulet) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (dsSetBonus) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (alchFlask) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (armorCrumbling || armorShattering) - { - if (item.melee || item.Calamity().rogue) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - } - if (item.Calamity().rogue) - { - switch (player.meleeEnchant) - { - case 1: - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - break; - case 2: - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - break; - case 3: - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - break; - case 5: - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - break; - case 6: - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - break; - case 8: - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - break; - case 4: - target.AddBuff(BuffID.Midas, 120, false); - break; - } - if (titanHeartMask) - { - target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds - } - } - if (holyWrath) - { - target.AddBuff(ModContent.BuffType(), 600, false); - } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.CursedInferno, 90, false); - target.AddBuff(BuffID.Venom, 120, false); - } - } + CalamityPlayerOnHit.ItemLifesteal(player, mod, target, item, damage); + CalamityPlayerOnHit.ItemOnHit(player, mod, item, damage, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); + CalamityPlayerOnHit.NPCDebuffs(player, mod, target, item.melee, item.ranged, item.magic, item.summon, item.Calamity().rogue, false); + + // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). + if (target.type == NPCID.TargetDummy || target.type == ModContent.NPCType()) + return; + if (rageModeActive && shatteredCommunity) + 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) + return; + + if (witheringWeaponEnchant) + witheringDamageDone += (int)(damage * (crit ? 2D : 1D)); + switch (proj.type) { + case ProjectileID.CobaltNaginata: + target.Calamity().miscDefenseLoss = (int)(target.defense * 0.25); + break; + + case ProjectileID.PalladiumPike: + if (!target.canGhostHeal || player.moonLeech) + return; + player.lifeRegenTime += 2; + break; + + case ProjectileID.MythrilHalberd: + target.damage = (int)(target.defDamage * 0.9); + break; + + case ProjectileID.OrichalcumHalberd: + if (player.petalTimer > 0) + player.petalTimer /= 2; + break; + + case ProjectileID.AdamantiteGlaive: + float slowDownMult = 0.5f; + if (CalamityLists.enemyImmunityList.Contains(target.type) || target.boss) + slowDownMult = 0.95f; + target.velocity *= slowDownMult; + break; + + case ProjectileID.FruitcakeChakram: + if (!target.canGhostHeal || player.moonLeech) + return; + player.statLife += 2; + player.HealEffect(2); + break; + + case ProjectileID.TheRottedFork: + case ProjectileID.TheMeatball: + target.AddBuff(ModContent.BuffType(), 60); + break; + + case ProjectileID.BallOHurt: + target.AddBuff(BuffID.ShadowFlame, 60); + break; + + case ProjectileID.ObsidianSwordfish: + target.AddBuff(BuffID.OnFire, 180); + break; + + case ProjectileID.GolemFist: + target.AddBuff(ModContent.BuffType(), 180); + break; + + case ProjectileID.LightBeam: + case ProjectileID.Gungnir: + case ProjectileID.PaladinsHammerFriendly: + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ProjectileID.DarkLance: + target.AddBuff(BuffID.ShadowFlame, 120); + break; + + case ProjectileID.Bee: + case ProjectileID.GiantBee: + target.AddBuff(BuffID.Poisoned, 120); + break; + + case ProjectileID.Wasp: + target.AddBuff(BuffID.Poisoned, 120); + target.AddBuff(BuffID.Venom, 120); + break; + case ProjectileID.BoneArrow: target.AddBuff(ModContent.BuffType(), 300); break; @@ -4771,204 +5057,89 @@ namespace CalamityMod.CalPlayer else if (Main.rand.NextBool(3)) target.AddBuff(BuffID.Frostburn, 120); break; + + case ProjectileID.NightBeam: + target.AddBuff(BuffID.CursedInferno, 60); + target.AddBuff(BuffID.ShadowFlame, 120); + break; } - if (!proj.npcProj && !proj.trap) + if (ProjectileID.Sets.StardustDragon[proj.type]) + target.immune[proj.owner] = 10; + + if (!proj.npcProj && !proj.trap && proj.friendly) { - if (desertProwler && proj.ranged && crit) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - if (Main.rand.NextBool(15)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), proj.damage, proj.knockBack, player.whoAmI, 0f, 0f); - } - } - } - } - - if (proj.Calamity().trueMelee) - titanBoost = 600; - - if (sulfurSet && proj.friendly && !target.friendly) - target.AddBuff(BuffID.Poisoned, 120); - - if (omegaBlueChestplate && proj.friendly && !target.friendly) - target.AddBuff(ModContent.BuffType(), 240); - - if (proj.melee && silvaMelee && Main.rand.NextBool(4)) - target.AddBuff(ModContent.BuffType(), 20); - - if (abyssalAmulet) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (dsSetBonus) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if ((plaguebringerCarapace || uberBees) && CalamityMod.friendlyBeeList.Contains(proj.type)) - { + if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) target.AddBuff(ModContent.BuffType(), 360); - } - else if (alchFlask) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (proj.melee) - { - if (eGauntlet) - { - int duration = 90; - target.AddBuff(BuffID.CursedInferno, duration / 2, false); - target.AddBuff(BuffID.Frostburn, duration, false); - target.AddBuff(BuffID.Ichor, duration, false); - target.AddBuff(BuffID.Venom, duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), duration, false); - } - } - if (aWeapon) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (cryogenSoul || frostFlare) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn); - } - if (yInsignia) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - if (ataxiaFire) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire, 4f); - } - } - if (armorCrumbling || armorShattering) - { - if (proj.melee || proj.Calamity().rogue) - { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); - } - } - if (perforatorLore) - { - target.AddBuff(BuffID.Ichor, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(ModContent.BuffType(), 600, false); - } - else if (providenceLore) - { - target.AddBuff(ModContent.BuffType(), 420, false); - } - if (proj.Calamity().rogue) - { - switch (player.meleeEnchant) - { - case 1: - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - break; - case 2: - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - break; - case 3: - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - break; - case 5: - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - break; - case 6: - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - break; - case 8: - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - break; - case 4: - target.AddBuff(BuffID.Midas, 120, false); - break; - } - if (etherealExtorter) - { - if (ZoneSunkenSea) - { - target.AddBuff(ModContent.BuffType(), 60, false); - } - if (ZoneSulphur) - { - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 300, false); - } - if (Main.moonPhase == 6) //first quarter - { - target.AddBuff(BuffID.Midas, 120, false); - } - if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - } - if (titanHeartMask) - { - target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds - } - } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.CursedInferno, 90, false); - target.AddBuff(BuffID.Venom, 120, false); - } - } + + if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ModContent.ItemType()) + target.AddBuff(BuffID.Midas, 300, false); + + CalamityPlayerOnHit.ProjLifesteal(player, mod, target, proj, damage, crit); + CalamityPlayerOnHit.ProjOnHit(player, mod, proj, target.Center, crit, (target.damage > 5 || target.boss) && !target.SpawnedFromStatue); + CalamityPlayerOnHit.NPCDebuffs(player, mod, target, proj.melee, proj.ranged, proj.magic, proj.IsSummon(), proj.Calamity().rogue, true); + + // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). + if (target.type == NPCID.TargetDummy || target.type == ModContent.NPCType()) + return; + + if (rageModeActive && shatteredCommunity) + ShatteredCommunity.AccumulateRageDamage(player, this, damage); } - proj.Calamity().stealthStrikeHitCount++; } #endregion #region PvP public override void OnHitPvp(Item item, Player target, int damage, bool crit) { - if (desertProwler && item.ranged && crit) //for obscure stuff like Marnite Bayonet - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - if (Main.rand.NextBool(15)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.RangedDamage()), item.knockBack, player.whoAmI, 0f, 0f); - } - } - } - } + if (player.whoAmI != Main.myPlayer) + return; - if (!item.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(target.Center, target.velocity, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI, 0f, 0f); - - if (omegaBlueChestplate) - target.AddBuff(ModContent.BuffType(), 240); - if (sulfurSet) - target.AddBuff(BuffID.Poisoned, 120); switch (item.type) { + case ItemID.PalladiumSword: + case ItemID.PalladiumPike: + if (player.moonLeech) + return; + player.lifeRegenTime += 2; + break; + + case ItemID.OrichalcumSword: + case ItemID.OrichalcumHalberd: + if (player.petalTimer > 0) + player.petalTimer /= 2; + break; + + case ItemID.CandyCaneSword: + if (player.moonLeech) + return; + player.statLife += 2; + player.HealEffect(2); + break; + + case ItemID.Excalibur: + case ItemID.TrueExcalibur: + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ItemID.BeeKeeper: + target.AddBuff(BuffID.Poisoned, 240); + break; + + case ItemID.LightsBane: + case ItemID.NightsEdge: + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ItemID.TrueNightsEdge: + target.AddBuff(BuffID.CursedInferno, 60); + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ItemID.BloodButcherer: + target.AddBuff(ModContent.BuffType(), 60); + break; + case ItemID.IceSickle: case ItemID.Frostbrand: target.AddBuff(BuffID.Frostburn, 600); @@ -4981,104 +5152,67 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffID.Frostburn, 120); break; } - - if (item.melee) - { - titanBoost = 600; - if (eGauntlet) - { - int duration = 90; - target.AddBuff(BuffID.CursedInferno, duration / 2, false); - target.AddBuff(BuffID.Frostburn, duration, false); - target.AddBuff(BuffID.Ichor, duration, false); - target.AddBuff(BuffID.Venom, duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), duration, false); - } - } - if (aWeapon) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (cryogenSoul || frostFlare) - { - CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn); - } - if (yInsignia) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (ataxiaFire) - { - CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire, 4f); - } - } - if (alchFlask) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (abyssalAmulet) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (item.Calamity().rogue) - { - switch (player.meleeEnchant) - { - case 1: - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - break; - case 2: - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - break; - case 3: - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - break; - case 5: - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - break; - case 6: - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - break; - case 8: - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - break; - /*case 4: - target.AddBuff(BuffID.Midas, 120, false); - break;*/ - } - if (titanHeartMask) - { - target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds - } - } - if (holyWrath) - { - target.AddBuff(ModContent.BuffType(), 600, false); - } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.CursedInferno, 90, false); - target.AddBuff(BuffID.Venom, 120, false); - } - } + CalamityPlayerOnHit.ItemOnHit(player, mod, item, damage, target.Center, crit, true); + CalamityPlayerOnHit.PvpDebuffs(player, mod, target, item.melee, item.ranged, item.magic, item.summon, item.Calamity().rogue, false); } public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) { + if (player.whoAmI != Main.myPlayer) + return; + switch (proj.type) { + case ProjectileID.PalladiumPike: + if (player.moonLeech) + return; + player.lifeRegenTime += 2; + break; + + case ProjectileID.OrichalcumHalberd: + if (player.petalTimer > 0) + player.petalTimer /= 2; + break; + + case ProjectileID.FruitcakeChakram: + if (player.moonLeech) + return; + player.statLife += 2; + player.HealEffect(2); + break; + + case ProjectileID.TheRottedFork: + target.AddBuff(ModContent.BuffType(), 60); + break; + + case ProjectileID.ObsidianSwordfish: + target.AddBuff(BuffID.OnFire, 180); + break; + + case ProjectileID.GolemFist: + target.AddBuff(ModContent.BuffType(), 180); + break; + + case ProjectileID.LightBeam: + case ProjectileID.Gungnir: + case ProjectileID.PaladinsHammerFriendly: + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ProjectileID.DarkLance: + target.AddBuff(ModContent.BuffType(), 120); + break; + + case ProjectileID.Bee: + case ProjectileID.GiantBee: + target.AddBuff(BuffID.Poisoned, 120); + break; + + case ProjectileID.Wasp: + target.AddBuff(BuffID.Poisoned, 120); + target.AddBuff(BuffID.Venom, 120); + break; + case ProjectileID.BoneArrow: target.AddBuff(ModContent.BuffType(), 300); break; @@ -5116,174 +5250,21 @@ namespace CalamityMod.CalPlayer else if (Main.rand.NextBool(3)) target.AddBuff(BuffID.Frostburn, 120); break; + + case ProjectileID.NightBeam: + target.AddBuff(BuffID.CursedInferno, 60); + target.AddBuff(ModContent.BuffType(), 120); + break; } - if (!proj.npcProj && !proj.trap) + if (!proj.npcProj && !proj.trap && proj.friendly) { - if (desertProwler && proj.ranged && crit) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - if (Main.rand.NextBool(15)) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), proj.damage, proj.knockBack, player.whoAmI, 0f, 0f); - } - } - } - } - - if (proj.Calamity().trueMelee) - titanBoost = 600; - - if (sulfurSet && proj.friendly) - target.AddBuff(BuffID.Poisoned, 120); - - if (omegaBlueChestplate && proj.friendly) - target.AddBuff(ModContent.BuffType(), 240); - - if (proj.melee && silvaMelee && Main.rand.NextBool(4)) - target.AddBuff(ModContent.BuffType(), 20); - - - if (abyssalAmulet) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if ((plaguebringerCarapace || uberBees) && CalamityMod.friendlyBeeList.Contains(proj.type)) + if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) { target.AddBuff(ModContent.BuffType(), 360); } - else if (alchFlask) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (proj.melee) - { - if (eGauntlet) - { - int duration = 90; - target.AddBuff(BuffID.CursedInferno, duration / 2, false); - target.AddBuff(BuffID.Frostburn, duration, false); - target.AddBuff(BuffID.Ichor, duration, false); - target.AddBuff(BuffID.Venom, duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - target.AddBuff(ModContent.BuffType(), duration, false); - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), duration, false); - } - } - if (aWeapon) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (cryogenSoul || frostFlare) - { - CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn); - } - if (yInsignia) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - if (ataxiaFire) - { - CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire, 4f); - } - } - if (armorCrumbling || armorShattering) - { - if (proj.melee || proj.Calamity().rogue) - { - CalamityUtils.Inflict246DebuffsPvp(target, ModContent.BuffType()); - } - } - if (perforatorLore) - { - target.AddBuff(BuffID.Ichor, 90); - } - if (hiveMindLore) - { - target.AddBuff(BuffID.CursedInferno, 90); - } - if (holyWrath) - { - target.AddBuff(ModContent.BuffType(), 600, false); - } - else if (providenceLore) - { - target.AddBuff(ModContent.BuffType(), 420, false); - } - if (proj.Calamity().rogue) - { - switch (player.meleeEnchant) - { - case 1: - target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); - break; - case 2: - target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); - break; - case 3: - target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); - break; - case 5: - target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); - break; - case 6: - target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); - break; - case 8: - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); - break; - /*case 4: - target.AddBuff(BuffID.Midas, 120, false); - break;*/ - } - if (etherealExtorter) - { - if (ZoneSunkenSea) - { - target.AddBuff(ModContent.BuffType(), 60, false); - } - if (ZoneSulphur) - { - target.AddBuff(ModContent.BuffType(), 120, false); - target.AddBuff(ModContent.BuffType(), 300, false); - } - /*if (Main.moonPhase == 6) //first quarter - { - target.AddBuff(BuffID.Midas, 120, false); - }*/ - if (ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) - { - target.AddBuff(ModContent.BuffType(), 240, false); - } - } - if (titanHeartMask) - { - target.AddBuff(ModContent.BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds - } - } - if (vexation) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - target.AddBuff(BuffID.CursedInferno, 90, false); - target.AddBuff(BuffID.Venom, 120, false); - } - } - if (proj.type == ProjectileID.IchorArrow && player.ActiveItem().type == ModContent.ItemType()) - { - target.AddBuff(BuffID.Midas, 300, false); - } + CalamityPlayerOnHit.ProjOnHit(player, mod, proj, target.Center, crit, true); + CalamityPlayerOnHit.PvpDebuffs(player, mod, target, proj.melee, proj.ranged, proj.magic, proj.IsSummon(), proj.Calamity().rogue, true); } } #endregion @@ -5293,56 +5274,30 @@ namespace CalamityMod.CalPlayer { #region MultiplierBoosts double damageMult = 1.0; - if (silvaMelee && Main.rand.NextBool(4) && item.melee) + if (item.melee && item.type != ModContent.ItemType() && item.type != ModContent.ItemType()) { - damageMult += 4.0; - } - if (item.melee) - { damageMult += trueMeleeDamage; - } - if (enraged && !CalamityConfig.Instance.BossRushXerocCurse) + } + if (enraged) { damageMult += 1.25; } + + if (witheredDebuff && witheringWeaponEnchant) + damageMult += 0.6; + if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) { - bool DHorHoD = draedonsHeart || heartOfDarkness; - if (rageModeActive && adrenalineModeActive) - { - if (item.melee) - { - damageMult += (DHorHoD ? 2.3 : 2.0); - } - } - else if (rageModeActive) - { - if (item.melee) - { - double rageDamageBoost = 0.0 + - (rageBoostOne ? 0.15 : 0.0) + - (rageBoostTwo ? 0.15 : 0.0) + - (rageBoostThree ? 0.15 : 0.0); - double rageDamage = (DHorHoD ? 0.65 : 0.5) + rageDamageBoost; - damageMult += rageDamage; - } - } - else if (adrenalineModeActive) - { - if (item.melee) - { - damageMult += 1.5; - } - } + CalamityUtils.ApplyRippersToDamage(this, ref damageMult); } damage = (int)(damage * damageMult); if (oldDie) { - float diceMult = Main.rand.NextFloat(0.8824f, 1.1565f); + float diceMult = Main.rand.NextFloat(0.9215f, 1.1205f); if (item.Calamity().rogue || wearingRogueArmor) { - float roll2 = Main.rand.NextFloat(0.8824f, 1.1565f); + float roll2 = Main.rand.NextFloat(0.9215f, 1.1205f); diceMult = roll2 > diceMult ? roll2 : diceMult; } damage = (int)(damage * diceMult); @@ -5350,126 +5305,67 @@ namespace CalamityMod.CalPlayer #endregion #region AdditiveBoosts - if (item.melee && badgeOfBravery) + if (item.type == ItemID.Excalibur || item.type == ItemID.TrueExcalibur) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); - int penetratedDefense = Math.Min(penetratableDefense, 10); - damage += (int)(0.5f * penetratedDefense); - } + if (target.life > (int)(target.lifeMax * 0.75)) + damage *= 2; } + if (item.type == ItemID.TitaniumSword) + { + int knockbackAdd = (int)(damage * 0.15 * (1f - target.knockBackResist)); + damage += knockbackAdd; + } + if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) + { + int defenseAdd = (int)(target.defense * 0.25); + damage += defenseAdd; + } + if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber)) + { + int defenseAdd = (int)(target.defense * 0.5); + damage += defenseAdd; + } + if (item.melee && badgeOfBravery) + { + int penetratableDefense = Math.Max(target.defense - player.armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, 5); + damage += (int)(0.5f * penetratedDefense); + } #endregion - if (yharonLore) - damage = (int)(damage * 0.75); - - if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) + if (draedonsHeart) { - if (item.melee && 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)); + if (player.StandingStill() && player.itemAnimation == 0) + damage = (int)(damage * 0.5); + } - if (player.wingTime < player.wingTimeMax) - player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - - if (player.wingTime > player.wingTimeMax) - player.wingTime = player.wingTimeMax; - } - if (item.melee && !item.noMelee && !item.noUseGraphic) - { - if (ataxiaGeyser) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) - { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.15), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (unstablePrism && crit) - { - for (int s = 0; s < 3; s++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI); - } - } - if (astralStarRain && crit && astralStarRainCooldown <= 0) - { - astralStarRainCooldown = 60; - for (int n = 0; n < 3; n++) - { - int projectileType = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ProjectileID.HallowStar, - ModContent.ProjectileType() - }); - CalamityUtils.ProjectileRain(target.Center, 400f, 100f, 500f, 800f, 25f, projectileType, (int)(120 * player.AverageDamage()), 5f, player.whoAmI, 6); - } - } - if (bloodflareMelee && item.melee) - { - if (bloodflareMeleeHits < 15 && !bloodflareFrenzy && !bloodFrenzyCooldown) - { - bloodflareMeleeHits++; - } - if (player.whoAmI == Main.myPlayer && target.canGhostHeal) - { - int healAmount = Main.rand.Next(3) + 1; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } + if ((target.damage > 0 || target.boss) && !target.SpawnedFromStatue && player.whoAmI == Main.myPlayer) + { if (CalamityConfig.Instance.Proficiency) { if (gainLevelCooldown <= 0) { gainLevelCooldown = 120; - if (item.melee && meleeLevel <= 12500) + if (meleeLevel <= 12500) { - if (!Main.hardMode && meleeLevel >= 1500) + if (!ReduceCooldown((int)ClassType.Melee)) { - gainLevelCooldown = 1200; //20 seconds - } - if (!NPC.downedMoonlord && meleeLevel >= 5500) - { - gainLevelCooldown = 2400; //40 seconds + if (!Main.hardMode && meleeLevel >= 1500) + gainLevelCooldown = 1200; //20 seconds + if (!NPC.downedMoonlord && meleeLevel >= 5500) + gainLevelCooldown = 2400; //40 seconds } + else + gainLevelCooldown /= 2; + + if (fasterMeleeLevel) + gainLevelCooldown /= 2; + meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - meleeLevel++; shootFireworksLevelUpMelee = true; + if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 0); - } - } - } - } - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) - { - if (item.melee) - { - int stressGain = (int)(damage * 0.1); - int stressMaxGain = 10; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - rage += stressGain; - if (rage >= rageMax) - { - rage = rageMax; + SyncLevel(false, (int)ClassType.Melee); } } } @@ -5483,23 +5379,8 @@ namespace CalamityMod.CalPlayer bool isTrueMelee = proj.Calamity().trueMelee; bool isSummon = proj.IsSummon(); - bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.Calamity().rogue; - Item heldItem = player.ActiveItem(); - if (isTrueMelee && 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); - - if (player.wingTime < player.wingTimeMax) - player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); - - if (player.wingTime > player.wingTimeMax) - player.wingTime = player.wingTimeMax; - } - #region MultiplierBoosts double damageMult = 1.0; if (isSummon) @@ -5507,126 +5388,43 @@ namespace CalamityMod.CalPlayer if (heldItem.type > ItemID.None) { if (heldItem.summon && !heldItem.melee && !heldItem.ranged && !heldItem.magic && !heldItem.Calamity().rogue) - { damageMult += 0.1; - } } } - if (isTrueMelee) - { - damageMult += trueMeleeDamage; - } + + if (isTrueMelee) + { + // 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); + } + if (screwdriver) { if (proj.penetrate > 1 || proj.penetrate == -1) - damageMult += 0.1; + damageMult += 0.05; } - if (sPower) - { - if (isSummon) - damageMult += 0.1; - } - if (hallowedPower) - { - if (isSummon) - damageMult += 0.15; - } - if (providenceLore && hasClassType) - { - damageMult += 0.1; - } - if (silvaMelee && Main.rand.NextBool(4) && isTrueMelee) - { - damageMult += 4.0; - } - if (enraged && !CalamityConfig.Instance.BossRushXerocCurse) - { - damageMult += 1.25; - } - if (auricSet) - { - if (silvaThrowing && proj.Calamity().rogue && - crit && player.statLife > (int)(player.statLifeMax2 * 0.5)) - { - damageMult += 0.25; - } - if (silvaMelee && proj.melee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - damageMult += multiplier * 0.2; - } - } - if (godSlayerRanged && crit && proj.ranged) - { - int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap - if (randomChance < 15) - randomChance = 15; - if (Main.rand.NextBool(randomChance)) - damageMult += 1.0; - } - if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) - { - damageMult += 0.4; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.Calamity().rogue) - { - damageMult += 0.1; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) - { - damageMult += 0.1; - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && isSummon) - { - damageMult += 0.1; - } - if (proj.type == ModContent.ProjectileType()) - { - if (target.buffImmune[ModContent.BuffType()]) - damageMult += 0.1; - } - else if (proj.type == ProjectileID.InfernoFriendlyBlast) - { + if (enraged) + damageMult += 1.25; + + // Calamity buffs Inferno Fork by 33%. + // However, because the weapon is coded like spaghetti, you have to multiply the explosion's damage too. + if (proj.type == ProjectileID.InfernoFriendlyBlast) damageMult += 0.33; - } + if (brimflameFrenzy && brimflameSet) { if (proj.magic) - { - damageMult += 0.5; - } + damageMult += 0.3; } + + if (witheredDebuff) + damageMult += 0.6; + if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) - { - bool DHorHoD = draedonsHeart || heartOfDarkness; - if (rageModeActive && adrenalineModeActive) - { - if (hasClassType) - { - damageMult += (DHorHoD ? 2.3 : 2.0); - } - } - else if (rageModeActive) - { - if (hasClassType) - { - double rageDamageBoost = 0.0 + - (rageBoostOne ? 0.15 : 0.0) + - (rageBoostTwo ? 0.15 : 0.0) + - (rageBoostThree ? 0.15 : 0.0); - double rageDamage = (DHorHoD ? 0.65 : 0.5) + rageDamageBoost; - damageMult += rageDamage; - } - } - else if (adrenalineModeActive) - { - if (hasClassType) - { - damageMult += 1.5; - } - } - } + CalamityUtils.ApplyRippersToDamage(this, ref damageMult); + if ((filthyGlove || electricianGlove) && proj.Calamity().stealthStrike && proj.Calamity().rogue) { if (nanotech) @@ -5634,40 +5432,17 @@ namespace CalamityMod.CalPlayer else damageMult += 0.1; } - if (etherealExtorter && proj.Calamity().rogue) - { - bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; - if (Main.moonPhase == 7 && crit) //Waxing Gibbous - { - damageMult += 0.05; - } - if (Main.moonPhase == 5) //Waxing Cresent - { - if (proj.penetrate == -1) - damageMult += 0.1; - else if (proj.penetrate >= 5) - damageMult += 0.08; - else if (proj.penetrate == 4) - damageMult += 0.06; - else if (proj.penetrate == 3) - damageMult += 0.03; - else if (proj.penetrate == 2) - damageMult += 0.02; - } - if (player.ZoneDirtLayerHeight && ZoneForest) - { - if (Main.rand.NextBool(20) && !crit) //5% chance to minicrit - damageMult += 0.5; - } - } + + // Adjust damage based on the damage multiplier damage = (int)(damage * damageMult); + // Old Die damage multiplier, rolls again and takes the higher roll if it's a rogue projectile or the player is wearing rogue armor if (oldDie) { - float diceMult = Main.rand.NextFloat(0.8824f, 1.1565f); + float diceMult = Main.rand.NextFloat(0.9215f, 1.1205f); if (proj.Calamity().rogue || wearingRogueArmor) { - float roll2 = Main.rand.NextFloat(0.8824f, 1.1565f); + float roll2 = Main.rand.NextFloat(0.9215f, 1.1205f); diceMult = roll2 > diceMult ? roll2 : diceMult; } damage = (int)(damage * diceMult); @@ -5675,110 +5450,95 @@ namespace CalamityMod.CalPlayer #endregion #region AdditiveBoosts + if (proj.type == ProjectileID.Gungnir) + { + if (target.life > (int)(target.lifeMax * 0.75)) + damage *= 2; + } + if (proj.type == ProjectileID.TitaniumTrident) + { + int knockbackAdd = (int)(damage * 0.15 * (1f - target.knockBackResist)); + damage += knockbackAdd; + } if (proj.type == ModContent.ProjectileType()) { int defenseAdd = (int)(target.defense * 0.05 * (proj.damage / 50D) * acidRoundMultiplier); //100 defense * 0.05 = 5 damage += defenseAdd; } - if (uberBees && CalamityMod.friendlyBeeList.Contains(proj.type)) + if (uberBees && CalamityLists.friendlyBeeList.Contains(proj.type)) { damage += Main.rand.Next(20, 31); } - if (plaguebringerPatronSummon) - { - if (isSummon && proj.active && proj.friendly && !proj.npcProj && !proj.trap && proj.damage > 0) - { - if (proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) - { - for (int j = 0; j < Main.maxProjectiles; j++) - { - Projectile miniPBG = Main.projectile[j]; - if (miniPBG.type == ModContent.ProjectileType() && Vector2.Distance(proj.Center, miniPBG.Center) <= PlaguebringerSummon.auraRange && miniPBG.owner == proj.owner) - { - damage += Main.rand.Next(10, 21); - break; - } - } - } - } - } - int penetrateAmt = 0; + if (plaguebringerPatronSummon) + { + if (isSummon && proj.active && proj.friendly && !proj.npcProj && !proj.trap && proj.damage > 0) + { + if (proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) + { + for (int j = 0; j < Main.maxProjectiles; j++) + { + Projectile miniPBG = Main.projectile[j]; + if (miniPBG.type == ModContent.ProjectileType() && Vector2.Distance(proj.Center, miniPBG.Center) <= PlaguebringerSummon.auraRange && miniPBG.owner == proj.owner) + { + damage += Main.rand.Next(10, 21); + break; + } + } + } + } + } + int penetrateAmt = 0; if (proj.Calamity().stealthStrike && proj.Calamity().rogue) { - if (nanotech) - penetrateAmt += 20; //nanotech is weaker - else if (electricianGlove) - penetrateAmt += 30; - else if (filthyGlove || bloodyGlove) - penetrateAmt += 10; + if (nanotech) + penetrateAmt += 20; //nanotech is weaker + else if (electricianGlove) + penetrateAmt += 20; + else if (filthyGlove || bloodyGlove) + penetrateAmt += 10; } - if (proj.Calamity().rogue && etherealExtorter) - { - if (CalamityMod.boomerangProjList.Contains(proj.type) && player.ZoneCorrupt) - { - penetrateAmt += 6; - } - } - if (proj.melee && badgeOfBravery) - { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - penetrateAmt += 10; - } - } - 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); + if (proj.melee && badgeOfBravery) + { + penetrateAmt += 5; + } + 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 #region MultiplicativeReductions // Fearmonger armor reduces the summoner cross-class nerf - // Forbidden armor reduces said nerf when holding the respective helmet's preferred weapon type + // 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 reducedNerf = fearmongerSet || (forbidden && heldItem.magic); + bool reducedNerf = fearmongerSet || (forbidden && heldItem.magic); - double summonNerfMult = reducedNerf ? 0.75 : 0.5; + double summonNerfMult = reducedNerf ? 0.75 : 0.5; if (isSummon && !profanedCrystalBuffs) { - if (heldItem.type > ItemID.None) - { - if (!heldItem.summon && - (heldItem.melee || heldItem.ranged || heldItem.magic || heldItem.Calamity().rogue) && - heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0 && - !heldItem.accessory && heldItem.ammo == AmmoID.None) - { - damage = (int)(damage * summonNerfMult); - } - } + if (heldItem.type > ItemID.None) + { + if (!heldItem.summon && + (heldItem.melee || heldItem.ranged || heldItem.magic || heldItem.Calamity().rogue) && + heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0 && + !heldItem.accessory && heldItem.ammo == AmmoID.None) + { + damage = (int)(damage * summonNerfMult); + } + } } if (proj.ranged) { - // Nerfed in prehardmode due to bullet damage being a balance meme - if (heldItem.type == ModContent.ItemType()) - { - if (!Main.hardMode) - damage = (int)(damage * 0.5); - if (proj.type == ProjectileID.IchorBullet || proj.type == ModContent.ProjectileType()) - damage = (int)(damage * 0.85); - } - switch (proj.type) { case ProjectileID.CrystalShard: damage = (int)(damage * 0.6); break; - case ProjectileID.ChlorophyteBullet: - damage = (int)(damage * 0.8); - break; case ProjectileID.HallowStar: - damage = (int)(damage * 0.7); + damage = (int)(damage * 0.5); break; } @@ -5789,290 +5549,193 @@ namespace CalamityMod.CalPlayer if (proj.type == ProjectileID.SpectreWrath && player.ghostHurt) damage = (int)(damage * 0.7); - if (yharonLore) - damage = (int)(damage * 0.75); - #endregion - if (tarraMage && crit && proj.magic) + if ((target.damage > 0 || target.boss) && !target.SpawnedFromStatue && CalamityConfig.Instance.Proficiency) { - tarraCrits++; - } - if (tarraThrowing && !tarragonImmunity && !tarragonImmunityCooldown && tarraThrowingCrits < 25 && crit && proj.Calamity().rogue) - { - tarraThrowingCrits++; - } - - if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) - { - if (theBee && player.statLife >= player.statLifeMax2) + if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever { - Main.PlaySound(SoundID.Item110, proj.Center); - } - if (unstablePrism && crit) - { - for (int s = 0; s < 3; s++) + gainLevelCooldown = 120; //2 seconds + if (proj.melee && meleeLevel <= 12500) { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.15), 0f, player.whoAmI); - } - } - if (electricianGlove && proj.Calamity().stealthStrike && proj.Calamity().rogue && proj.Calamity().stealthStrikeHitCount < 5) - { - for (int s = 0; s < 3; s++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - int spark = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.1), 0f, player.whoAmI); - Main.projectile[spark].Calamity().forceRogue = true; - Main.projectile[spark].localNPCHitCooldown = -1; - } - } - if (astralStarRain && crit && astralStarRainCooldown <= 0) - { - astralStarRainCooldown = 60; - for (int n = 0; n < 3; n++) - { - int projectileType = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ProjectileID.HallowStar, - ModContent.ProjectileType() - }); - CalamityUtils.ProjectileRain(target.Center, 400f, 100f, 500f, 800f, 25f, projectileType, (int)(120 * player.AverageDamage()), 5f, player.whoAmI, 6); - } - } - if (tarraRanged && crit && proj.ranged) - { - int leafAmt = Main.rand.Next(2, 4); - for (int l = 0; l < leafAmt; l++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int FUCKYOU = Projectile.NewProjectile(target.Center, velocity, ProjectileID.Leaf, (int)(damage * 0.25), 0f, player.whoAmI); - Main.projectile[FUCKYOU].Calamity().forceTypeless = true; - Main.projectile[FUCKYOU].netUpdate = true; - } - } - if (bloodflareThrowing && proj.Calamity().rogue && crit && Main.rand.NextBool(2)) - { - if (target.canGhostHeal) - { - float projHitMult = 0.03f; - projHitMult -= (float)proj.numHits * 0.015f; - if (projHitMult < 0f) - { - projHitMult = 0f; - } - float cooldownMult = proj.damage * projHitMult; - if (cooldownMult < 0f) - { - cooldownMult = 0f; - } - if (player.lifeSteal > 0f) - { - player.statLife += 1; - player.HealEffect(1); - player.lifeSteal -= cooldownMult * 2f; - } - } - } - if (bloodflareMage && bloodflareMageCooldown <= 0 && crit && proj.magic) - { - bloodflareMageCooldown = 120; - for (int i = 0; i < 3; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int fire = Projectile.NewProjectile(target.Center, velocity, ProjectileID.BallofFire, (int)(damage * 0.5), 0f, player.whoAmI); - Main.projectile[fire].Calamity().forceTypeless = true; - Main.projectile[fire].netUpdate = true; - } - } - if (umbraphileSet && proj.Calamity().rogue && (Main.rand.NextBool(4) || (proj.Calamity().stealthStrike && proj.Calamity().stealthStrikeHitCount < 5)) && proj.type != ModContent.ProjectileType()) - { - Projectile.NewProjectile(proj.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI); - } - if (bloodflareMelee && isTrueMelee) - { - if (bloodflareMeleeHits < 15 && !bloodflareFrenzy && !bloodFrenzyCooldown) - { - bloodflareMeleeHits++; - } - if (player.whoAmI == Main.myPlayer && target.canGhostHeal) - { - int healAmount = Main.rand.Next(3) + 1; - player.statLife += healAmount; - player.HealEffect(healAmount); - } - } - if (proj.type == ModContent.ProjectileType()) - { - polarisBoostCounter += 1; - } - if (CalamityConfig.Instance.Proficiency) - { - if (gainLevelCooldown <= 0) //max is 12501 to avoid setting off fireworks forever - { - gainLevelCooldown = 120; //2 seconds - if (proj.melee && meleeLevel <= 12500) + if (!ReduceCooldown((int)ClassType.Melee)) { if (!Main.hardMode && meleeLevel >= 1500) - { gainLevelCooldown = 1200; //20 seconds - } if (!NPC.downedMoonlord && meleeLevel >= 5500) - { gainLevelCooldown = 2400; //40 seconds - } - meleeLevel++; - if (fasterMeleeLevel && meleeLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - meleeLevel++; - shootFireworksLevelUpMelee = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 0); - } } - else if (proj.ranged && rangedLevel <= 12500) + else + gainLevelCooldown /= 2; + + if (fasterMeleeLevel) + gainLevelCooldown /= 2; + + meleeLevel++; + shootFireworksLevelUpMelee = true; + + if (Main.netMode == NetmodeID.MultiplayerClient) + SyncLevel(false, (int)ClassType.Melee); + } + else if (proj.ranged && rangedLevel <= 12500) + { + if (!ReduceCooldown((int)ClassType.Ranged)) { if (!Main.hardMode && rangedLevel >= 1500) - { gainLevelCooldown = 1200; //20 seconds - } if (!NPC.downedMoonlord && rangedLevel >= 5500) - { gainLevelCooldown = 2400; //40 seconds - } - rangedLevel++; - if (fasterRangedLevel && rangedLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - rangedLevel++; - shootFireworksLevelUpRanged = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 1); - } } - else if (proj.magic && magicLevel <= 12500) + else + gainLevelCooldown /= 2; + + if (fasterRangedLevel) + gainLevelCooldown /= 2; + + rangedLevel++; + shootFireworksLevelUpRanged = true; + + if (Main.netMode == NetmodeID.MultiplayerClient) + SyncLevel(false, (int)ClassType.Ranged); + } + else if (proj.magic && magicLevel <= 12500) + { + if (!ReduceCooldown((int)ClassType.Magic)) { if (!Main.hardMode && magicLevel >= 1500) - { gainLevelCooldown = 1200; //20 seconds - } if (!NPC.downedMoonlord && magicLevel >= 5500) - { gainLevelCooldown = 2400; //40 seconds - } - magicLevel++; - if (fasterMagicLevel && magicLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - magicLevel++; - shootFireworksLevelUpMagic = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 2); - } } - else if (isSummon && summonLevel <= 12500) + else + gainLevelCooldown /= 2; + + if (fasterMagicLevel) + gainLevelCooldown /= 2; + + magicLevel++; + shootFireworksLevelUpMagic = true; + + if (Main.netMode == NetmodeID.MultiplayerClient) + SyncLevel(false, (int)ClassType.Magic); + } + else if (proj.IsSummon() && summonLevel <= 12500) + { + if (!ReduceCooldown((int)ClassType.Summon)) { if (!Main.hardMode && summonLevel >= 1500) - { gainLevelCooldown = 1200; //20 seconds - } if (!NPC.downedMoonlord && summonLevel >= 5500) - { gainLevelCooldown = 2400; //40 seconds - } - summonLevel++; - if (fasterSummonLevel && summonLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - summonLevel++; - shootFireworksLevelUpSummon = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 3); - } } - else if (proj.Calamity().rogue && rogueLevel <= 12500) + else + gainLevelCooldown /= 2; + + if (fasterSummonLevel) + gainLevelCooldown /= 2; + + summonLevel++; + shootFireworksLevelUpSummon = true; + + if (Main.netMode == NetmodeID.MultiplayerClient) + SyncLevel(false, (int)ClassType.Summon); + } + else if (proj.Calamity().rogue && rogueLevel <= 12500) + { + if (!ReduceCooldown((int)ClassType.Rogue)) { if (!Main.hardMode && rogueLevel >= 1500) - { gainLevelCooldown = 1200; //20 seconds - } if (!NPC.downedMoonlord && rogueLevel >= 5500) - { gainLevelCooldown = 2400; //40 seconds - } - rogueLevel++; - if (fasterRogueLevel && rogueLevel % 100 != 0 && Main.rand.NextBool(10)) //add only to non-multiples of 100 - rogueLevel++; - shootFireworksLevelUpRogue = true; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - LevelPacket(false, 4); - } - } - } - } - if (raiderTalisman && raiderStack < 150 && proj.Calamity().rogue && crit && raiderCooldown <= 0) - { - raiderStack++; - raiderCooldown = 30; - } - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) - { - if (isTrueMelee) - { - int stressGain = (int)(damage * 0.1); - int stressMaxGain = 10; - if (stressGain < 1) - { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - rage += stressGain; - if (rage >= rageMax) - { - rage = rageMax; } + else + gainLevelCooldown /= 2; + + if (fasterRogueLevel) + gainLevelCooldown /= 2; + + rogueLevel++; + shootFireworksLevelUpRogue = true; + + if (Main.netMode == NetmodeID.MultiplayerClient) + SyncLevel(false, (int)ClassType.Rogue); } } } } - #endregion + #endregion - #region Modify Hit By NPC - public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) - { - int bossRushDamage = (Main.expertMode ? 500 : 300) + (CalamityWorld.bossRushStage * 2); - if (CalamityWorld.bossRushActive) - { - if (damage < bossRushDamage) - damage = bossRushDamage; - } + #region Modify Hit By NPC + public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) + { + int bossRushDamage = (Main.expertMode ? 400 : 240) + (BossRushEvent.BossRushStage * 2); + if (BossRushEvent.BossRushActive) + { + if (damage < bossRushDamage) + damage = bossRushDamage; + } - if (areThereAnyDamnBosses && CalamityMod.bossVelocityDamageScaleValues.ContainsKey(npc.type)) - { - CalamityMod.bossVelocityDamageScaleValues.TryGetValue(npc.type, out float velocityScalar); + // Player takes defense stat damage + if (npc.Calamity().canBreakPlayerDefense) + { + // Checks all immunity frame timers + bool isImmune = false; + for (int i = 0; i < player.hurtCooldowns.Length; i++) + { + if (player.hurtCooldowns[i] > 0) + isImmune = true; + } + if (!isImmune && !invincible && !lol) + { + double defenseStatDamageMult = (CalamityWorld.death || CalamityWorld.malice) ? 0.15 : CalamityWorld.revenge ? 0.125 : Main.expertMode ? 0.1 : 0.05; + if (draedonsHeart) + defenseStatDamageMult *= 0.5; - if (((npc.type == NPCID.EyeofCthulhu || npc.type == NPCID.Spazmatism) && npc.ai[0] >= 2f) || (npc.type == NPCID.Plantera && npc.life / (float)npc.lifeMax <= 0.5f)) - velocityScalar = CalamityMod.bitingEnemeyVelocityScale; + int damageToDefense = (int)(damage * defenseStatDamageMult); + defenseDamage += damageToDefense; - if (npc.velocity == Vector2.Zero) - { - contactDamageReduction += 1f - velocityScalar; - } - else - { - float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.5f); - if (amount > 1f) - amount = 1f; + if (timeBeforeDefenseDamageRecovery < defaultTimeBeforeDefenseDamageRecovery) + timeBeforeDefenseDamageRecovery = defaultTimeBeforeDefenseDamageRecovery; - float damageReduction = MathHelper.Lerp(velocityScalar, 1.1f, amount); - if (damageReduction < 1f) - contactDamageReduction += 1f - damageReduction; - else - damage = (int)(damage * damageReduction); - } - } + if (hurtSoundTimer == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DefenseDamage"), (int)player.position.X, (int)player.position.Y); + hurtSoundTimer = 30; + } + + string text = (-damageToDefense).ToString(); + Color messageColor = Color.LightGray; + Rectangle location = new Rectangle((int)player.position.X, (int)player.position.Y - 16, player.width, player.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text)); + } + } + + if (areThereAnyDamnBosses && CalamityMod.bossVelocityDamageScaleValues.ContainsKey(npc.type)) + { + CalamityMod.bossVelocityDamageScaleValues.TryGetValue(npc.type, out float velocityScalar); + + if (((npc.type == NPCID.EyeofCthulhu || npc.type == NPCID.Spazmatism) && npc.ai[0] >= 2f) || (npc.type == NPCID.Plantera && npc.life / (float)npc.lifeMax <= 0.5f) || + (npc.type == ModContent.NPCType() && npc.life / (float)npc.lifeMax < 0.6f)) + velocityScalar = CalamityMod.bitingEnemeyVelocityScale; + + if (npc.velocity == Vector2.Zero) + { + contactDamageReduction += 1f - velocityScalar; + } + else + { + float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.5f); + if (amount > 1f) + amount = 1f; + + float damageReduction = MathHelper.Lerp(velocityScalar, 1.1f, amount); + if (damageReduction < 1f) + contactDamageReduction += 1f - damageReduction; + else + damage = (int)(damage * damageReduction); + } + } if (triumph) contactDamageReduction += 0.15 * (1D - (npc.life / (double)npc.lifeMax)); @@ -6088,176 +5751,163 @@ namespace CalamityMod.CalPlayer if (fleshTotem && !fleshTotemCooldown) { player.AddBuff(ModContent.BuffType(), 1200, false); //20 seconds - contactDamageReduction += 0.5; - } + contactDamageReduction += 0.5; + } if (tarragonCloak && !tarragonCloakCooldown && tarraMelee) - contactDamageReduction += 0.5; + contactDamageReduction += 0.5; if (bloodflareMelee && bloodflareFrenzy && !bloodFrenzyCooldown) - contactDamageReduction += 0.5; + contactDamageReduction += 0.5; - if (silvaMelee && silvaCountdown <= 0 && hasSilvaEffect) - contactDamageReduction += 0.2; + if (npc.Calamity().tSad > 0) + contactDamageReduction += 0.5; - if (npc.Calamity().tSad > 0) - contactDamageReduction += 0.5; - - if (npc.Calamity().relicOfResilienceWeakness > 0) - { - contactDamageReduction += RelicOfResilience.WeaknessDR; - npc.Calamity().relicOfResilienceWeakness = 0; - } - - if (beeResist) - { - if (CalamityMod.beeEnemyList.Contains(npc.type)) - contactDamageReduction += 0.25; - } - - if (eskimoSet) - { - if (npc.coldDamage) - contactDamageReduction += 0.1; - } - - if (trinketOfChiBuff) - contactDamageReduction += 0.15; - - // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. - // To prevent abuse, this effect does not work if there are any bosses alive. - if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) - contactDamageReduction += 0.15; - - if (abyssalDivingSuitPlates) - contactDamageReduction += 0.15; - - if (sirenIce) - contactDamageReduction += 0.2; - - if (encased) - contactDamageReduction += 0.3; - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) - contactDamageReduction += 0.5; - - if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) - { - contactDamageReduction += 0.5; - theBeeCooldown = 600; - } - - if (CalamityWorld.revenge) - { - if (!CalamityWorld.downedBossAny) - contactDamageReduction += 0.2; - - if (CalamityConfig.Instance.Rippers) - { - if (adrenaline == adrenalineMax && !adrenalineModeActive) - contactDamageReduction += 0.5; - } - } - - 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 (leviathanAndSirenLore) - { - if (!player.IsUnderwater()) - contactDamageReduction -= 0.05; - } - - if (vHex) - contactDamageReduction -= 0.3; - - if (irradiated) - contactDamageReduction -= 0.1; - - if (corrEffigy) - contactDamageReduction -= 0.2; - - if (calamityRing && !voidOfExtinction) - contactDamageReduction -= 0.15; - - // 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 (contactDamageReduction > 0D) - { - if (marked || reaperToothNecklace) - contactDamageReduction *= 0.5; - - if (aCrunch) - contactDamageReduction *= 0.33; - - if (wCleave) - contactDamageReduction *= 0.75; - - // Scale with base damage reduction - if (DRStat > 0) - contactDamageReduction *= 1f - (DRStat * 0.01f); - - contactDamageReduction = 1D / (1D + contactDamageReduction); - damage = (int)(damage * contactDamageReduction); - } - - if (Main.hardMode && Main.expertMode) - { - bool reduceChaosBallDamage = npc.type == NPCID.ChaosBall && !NPC.AnyNPCs(NPCID.GoblinSummoner); - - if (reduceChaosBallDamage || npc.type == NPCID.BurningSphere || npc.type == NPCID.WaterSphere) - damage = (int)(damage * 0.6); - } - - if (CalamityWorld.ironHeart) - { - int damageMin = 60 + (player.statLifeMax2 / 10); - int damageWithDR = (int)(damage * (1f - player.endurance)); - if (damage < damageMin) - { - player.endurance = 0f; - damage = damageMin; - } - } - - if (aBulwarkRare) - { - aBulwarkRareMeleeBoostTimer += 3 * damage; - if (aBulwarkRareMeleeBoostTimer > 900) - aBulwarkRareMeleeBoostTimer = 900; - } - - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + if (npc.Calamity().relicOfResilienceWeakness > 0) { - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !npc.SpawnedFromStatue) + contactDamageReduction += RelicOfResilience.WeaknessDR; + npc.Calamity().relicOfResilienceWeakness = 0; + } + + if (beeResist) + { + if (CalamityLists.beeEnemyList.Contains(npc.type)) + contactDamageReduction += 0.25; + } + + if (eskimoSet) + { + if (npc.coldDamage) + contactDamageReduction += 0.1; + } + + if (trinketOfChiBuff) + contactDamageReduction += 0.15; + + // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. + // To prevent abuse, this effect does not work if there are any bosses alive. + if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) + contactDamageReduction += 0.15; + + if (abyssalDivingSuitPlates) + contactDamageReduction += 0.15 - abyssalDivingSuitPlateHits * 0.03; + + if (sirenIce) + contactDamageReduction += 0.2; + + if (encased) + contactDamageReduction += 0.3; + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) + contactDamageReduction += 0.5; + + if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) + { + contactDamageReduction += 0.5; + theBeeCooldown = 600; + } + + if (CalamityWorld.revenge) + { + if (CalamityConfig.Instance.Rippers) { - gainRageCooldown = 60; - int stressGain = damage * (profanedRage ? 3 : 2); - int stressMaxGain = 2500; - if (stressGain < 1) + if (adrenaline == adrenalineMax && !adrenalineModeActive) { - stressGain = 1; - } - if (stressGain > stressMaxGain) - { - stressGain = stressMaxGain; - } - rage += stressGain; - if (rage >= rageMax) - { - rage = rageMax; + double adrenalineDRBoost = 0D + + (adrenalineBoostOne ? 0.05 : 0D) + + (adrenalineBoostTwo ? 0.05 : 0D) + + (adrenalineBoostThree ? 0.05 : 0D); + contactDamageReduction += 0.5 + adrenalineDRBoost; } } } - } + + 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) + contactDamageReduction -= 0.1; + + if (irradiated) + contactDamageReduction -= 0.1; + + if (corrEffigy) + contactDamageReduction -= 0.05; + + if (calamityRing && !voidOfExtinction) + contactDamageReduction -= 0.15; + + // 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 (contactDamageReduction > 0D) + { + if (aCrunch) + contactDamageReduction *= 0.33; + + if (wCleave) + contactDamageReduction *= 0.75; + + if (defenseDamage > 0) + { + // Reduce player DR based on defense stat damage accumulated, this is done before defense is reduced + if (defenseStat > 0) + { + double defenseDamageReduction = defenseDamage / (double)defenseStat; + if (defenseDamageReduction > 1D) + defenseDamageReduction = 1D; + + contactDamageReduction -= contactDamageReduction * defenseDamageReduction; + } + + if (contactDamageReduction < 0D) + contactDamageReduction = 0D; + } + + // Scale with base damage reduction + if (DRStat > 0) + contactDamageReduction *= 1f - (DRStat * 0.01f); + + contactDamageReduction = 1D / (1D + contactDamageReduction); + damage = (int)(damage * contactDamageReduction); + } + + if (Main.hardMode && Main.expertMode) + { + bool reduceChaosBallDamage = npc.type == NPCID.ChaosBall && !NPC.AnyNPCs(NPCID.GoblinSummoner); + + if (reduceChaosBallDamage || npc.type == NPCID.BurningSphere || npc.type == NPCID.WaterSphere) + { + damage = (int)(damage * 0.6); + + if (damage < 1) + damage = 1; + } + } + + if (CalamityWorld.ironHeart) + { + int damageMin = 40 + (player.statLifeMax2 / 10); + if (damage < damageMin) + { + player.endurance = 0f; + damage = damageMin; + } + } + + if (aBulwarkRare) + { + aBulwarkRareMeleeBoostTimer += 3 * damage; + if (aBulwarkRareMeleeBoostTimer > 900) + aBulwarkRareMeleeBoostTimer = 900; + } + } #endregion #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile) { - if (player.ActiveItem().type == ModContent.ItemType() - && proj.active && proj.hostile && player.altFunctionUse == 2 && Main.rand.NextBool(2)) + if (player.ActiveItem().type == ModContent.ItemType() && player.altFunctionUse == 2 && Main.rand.NextBool(2)) { for (int j = 0; j < 3; j++) { @@ -6270,115 +5920,298 @@ namespace CalamityMod.CalPlayer proj.velocity *= -1f; proj.damage = damage2; proj.penetrate = 1; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = 4; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; + } damage = 0; return; } - } - if (proj.type == ModContent.ProjectileType()) - { - damage = 0; - return; - } - - // Reduce damage from vanilla traps - // 350 in normal, 450 in expert - if (proj.type == ProjectileID.Explosives) - damage = (int)(damage * (Main.expertMode ? 0.225 : 0.35)); - if (Main.expertMode) - { - // 140 in normal, 182 in expert - if (proj.type == ProjectileID.Boulder) - damage = (int)(damage * 0.65); - } - - // Reduce the bullshit damage Ichor Stickers do - if (proj.type == ProjectileID.GoldenShowerHostile) - damage = (int)(damage * 0.35); - - if (CalamityWorld.revenge) - { - double damageMultiplier = 1D; - if (CalamityMod.revengeanceProjectileBuffList25Percent.Contains(proj.type)) + if (aSparkRare) { - damageMultiplier += 0.25; - } - else if (CalamityMod.revengeanceProjectileBuffList20Percent.Contains(proj.type)) - { - damageMultiplier += 0.2; - } - else if (CalamityMod.revengeanceProjectileBuffList15Percent.Contains(proj.type)) - { - damageMultiplier += 0.15; - } - else if (CalamityMod.revengeanceProjectileBuffList10Percent.Contains(proj.type)) - { - damageMultiplier += 0.1; - } - else if (CalamityMod.revengeanceProjectileBuffList5Percent.Contains(proj.type)) - { - damageMultiplier += 0.05; - } - - if (CalamityWorld.death) - damageMultiplier += (damageMultiplier - 1D) * 0.6; - - damage = (int)(damage * damageMultiplier); - } - - int bossRushDamage = (Main.expertMode ? 125 : 150) + (CalamityWorld.bossRushStage / 2); - if (CalamityWorld.bossRushActive) - { - if (damage < bossRushDamage) - damage = bossRushDamage; - } - - // Reduce projectile damage based on banner type - // IMPORTANT NOTE: Rework this in 1.4! - 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)); - bool[] NPCBannerBuff = new bool[Main.MaxBannerTypes]; - bool hasBanner = false; - - // Scan area around the player for banners - for (int i = rectangle.Left; i < rectangle.Right; i++) - { - for (int j = rectangle.Top; j < rectangle.Bottom; j++) - { - if (!rectangle.Contains(i, j)) - continue; - - Tile tile = Main.tile[i, j]; - if (tile is null || !tile.active()) - continue; - - if (tile.type == TileID.Banners && (tile.frameX >= 396 || tile.frameY >= 54)) + if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) { - int bannerType = tile.frameX / 18 - 21; - for (int k = tile.frameY; k >= 54; k -= 54) + int damage2 = (int)(proj.damage * 8 * player.AverageDamage()); + proj.hostile = false; + proj.friendly = true; + proj.velocity *= -1f; + proj.damage = damage2; + proj.penetrate = 1; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) { - bannerType += 90; - bannerType += 21; + if (player.hurtCooldowns[j] > 0) + isImmune = true; } - - int bannerItemType = Item.BannerToItem(bannerType); - if (ItemID.Sets.BannerStrength[bannerItemType].Enabled) + if (!isImmune) { - NPCBannerBuff[bannerType] = true; - hasBanner = true; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 20; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; } } } + + if (dodgeCooldownTimer == 0) + { + // The Evolution + if (projRefRare) + { + int damage2 = (int)(proj.damage * 10 * player.AverageDamage()); + proj.hostile = false; + proj.friendly = true; + proj.velocity *= -2f; + proj.damage = damage2; + proj.extraUpdates += 1; + proj.penetrate = 1; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 20; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; + } + damage = 0; + projRefRareLifeRegenCounter = 300; + projTypeJustHitBy = proj.type; + + dodgeCooldownTimer = EvolutionReflectCooldown; + // Send a Calamity dodge cooldown packet. + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + SyncDodgeCooldown(false); + return; + } + + // Arcanum of the Void + else if (projRef) + { + int damage2 = (int)(proj.damage * 5 * player.AverageDamage()); + proj.hostile = false; + proj.friendly = true; + proj.velocity *= -1f; + proj.damage = damage2; + proj.extraUpdates += 1; + proj.penetrate = 1; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 20; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; + } + damage = 0; + + dodgeCooldownTimer = ArcanumReflectCooldown; + // Send a Calamity dodge cooldown packet. + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + SyncDodgeCooldown(false); + return; + } + + // Daedalus Melee set bonus + else if (daedalusReflect) + { + int damage2 = (int)(proj.damage * player.AverageDamage()); + proj.hostile = false; + proj.friendly = true; + proj.velocity *= -1f; + proj.damage = damage2; + proj.penetrate = 1; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 20; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; + } + damage /= 2; + + dodgeCooldownTimer = DaedalusReflectCooldown; + // Send a Calamity dodge cooldown packet. + if (Main.netMode == NetmodeID.MultiplayerClient && player.whoAmI == Main.myPlayer) + SyncDodgeCooldown(false); + + // No return because the projectile hit isn't canceled -- it only does half damage. + } + } } - // Reduce damage - if (hasBanner) - BannerProjectileDamageReduction(proj, ref damage, NPCBannerBuff); + 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(); + phantomicBulwarkCooldown = 1800; // 30 second cooldown + pro.Kill(); + projectileDamageReduction += 0.2; + } + + if (auralisAuroraCounter >= 300) + { + damage -= 100; + if (damage < 1) + damage = 1; + auralisAuroraCounter = 0; + auralisAuroraCooldown = CalamityUtils.SecondsToFrames(30f); + } + + // Reduce damage from vanilla traps + // 350 in normal, 450 in expert + if (proj.type == ProjectileID.Explosives) + damage = (int)(damage * (Main.expertMode ? 0.225 : 0.35)); + if (Main.expertMode) + { + // 140 in normal, 182 in expert + if (proj.type == ProjectileID.Boulder) + damage = (int)(damage * 0.65); + } + + if (CalamityWorld.revenge) + { + double damageMultiplier = 1D; + bool containsProjectile = false; + if (CalamityLists.revengeanceProjectileBuffList25Percent.Contains(proj.type)) + { + damageMultiplier += 0.25; + containsProjectile = true; + } + else if (CalamityLists.revengeanceProjectileBuffList20Percent.Contains(proj.type)) + { + damageMultiplier += 0.2; + containsProjectile = true; + } + else if (CalamityLists.revengeanceProjectileBuffList15Percent.Contains(proj.type)) + { + damageMultiplier += 0.15; + containsProjectile = true; + } + + if (containsProjectile) + { + if (CalamityWorld.death) + damageMultiplier += (damageMultiplier - 1D) * 0.6; + + damage = (int)(damage * damageMultiplier); + } + } + + int bossRushDamage = (Main.expertMode ? 90 : 110) + (BossRushEvent.BossRushStage / 2); + if (BossRushEvent.BossRushActive) + { + if (damage < bossRushDamage) + damage = bossRushDamage; + } + + // Player takes defense stat damage + if (proj.Calamity().canBreakPlayerDefense) + { + // Checks all immunity frame timers + bool isImmune = false; + for (int i = 0; i < player.hurtCooldowns.Length; i++) + { + if (player.hurtCooldowns[i] > 0) + isImmune = true; + } + if (!isImmune && !invincible && !lol) + { + double defenseStatDamageMult = (CalamityWorld.death || CalamityWorld.malice) ? 0.15 : CalamityWorld.revenge ? 0.125 : Main.expertMode ? 0.1 : 0.05; + if (draedonsHeart) + defenseStatDamageMult *= 0.5; + + int damageToDefense = (int)(damage * defenseStatDamageMult); + defenseDamage += damageToDefense; + + if (timeBeforeDefenseDamageRecovery < defaultTimeBeforeDefenseDamageRecovery) + timeBeforeDefenseDamageRecovery = defaultTimeBeforeDefenseDamageRecovery; + + if (hurtSoundTimer == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DefenseDamage"), (int)player.position.X, (int)player.position.Y); + hurtSoundTimer = 30; + } + + string text = (-damageToDefense).ToString(); + Color messageColor = Color.LightGray; // Light Gray text because it's visible and defense icon is gray in the UI + Rectangle location = new Rectangle((int)player.position.X, (int)player.position.Y - 16, player.width, player.height); + CombatText.NewText(location, messageColor, Language.GetTextValue(text)); + } + } + + // Reduce projectile damage based on banner type + // IMPORTANT NOTE: Rework this in 1.4! + 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)); + bool[] NPCBannerBuff = new bool[Main.MaxBannerTypes]; + bool hasBanner = false; + + // Scan area around the player for banners + for (int i = rectangle.Left; i < rectangle.Right; i++) + { + for (int j = rectangle.Top; j < rectangle.Bottom; j++) + { + if (!rectangle.Contains(i, j)) + continue; + + Tile tile = Main.tile[i, j]; + if (tile is null || !tile.active()) + continue; + + if (tile.type == TileID.Banners && (tile.frameX >= 396 || tile.frameY >= 54)) + { + int bannerType = tile.frameX / 18 - 21; + for (int k = tile.frameY; k >= 54; k -= 54) + { + bannerType += 90; + bannerType += 21; + } + + int bannerItemType = Item.BannerToItem(bannerType); + if (ItemID.Sets.BannerStrength[bannerItemType].Enabled) + { + NPCBannerBuff[bannerType] = true; + hasBanner = true; + } + } + } + } + + // Reduce damage + if (hasBanner) + BannerProjectileDamageReduction(proj, ref damage, NPCBannerBuff); if (projRefRare) { @@ -6396,694 +6229,667 @@ namespace CalamityMod.CalPlayer if (beeResist) { - if (CalamityMod.beeProjectileList.Contains(proj.type)) + if (CalamityLists.beeProjectileList.Contains(proj.type)) projectileDamageReduction += 0.25; } - if (Main.hardMode && Main.expertMode && !CalamityWorld.spawnedHardBoss && proj.active && !proj.friendly && proj.hostile && damage > 0) + if (trinketOfChiBuff) + projectileDamageReduction += 0.15; + + // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. + // To prevent abuse, this effect does not work if there are any bosses alive. + if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) + projectileDamageReduction += 0.15; + + if (abyssalDivingSuitPlates) + projectileDamageReduction += 0.15 - abyssalDivingSuitPlateHits * 0.03; + + if (sirenIce) + projectileDamageReduction += 0.2; + + if (encased) + projectileDamageReduction += 0.3; + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) + projectileDamageReduction += 0.5; + + if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) { - if (CalamityMod.hardModeNerfList.Contains(proj.type)) - projectileDamageReduction += 0.25; + projectileDamageReduction += 0.5; + theBeeCooldown = 600; } - if (trinketOfChiBuff) - projectileDamageReduction += 0.15; - - // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. - // To prevent abuse, this effect does not work if there are any bosses alive. - if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) - projectileDamageReduction += 0.15; - - if (abyssalDivingSuitPlates) - projectileDamageReduction += 0.15; - - if (sirenIce) - projectileDamageReduction += 0.2; - - if (encased) - projectileDamageReduction += 0.3; - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && player.ActiveItem().type == ModContent.ItemType()) - projectileDamageReduction += 0.5; - - if (theBee && player.statLife >= player.statLifeMax2 && theBeeCooldown <= 0) - { - projectileDamageReduction += 0.5; - theBeeCooldown = 600; - } - - if (CalamityWorld.revenge) - { - if (!CalamityWorld.downedBossAny) - projectileDamageReduction += 0.2; - - if (CalamityConfig.Instance.Rippers) - { - if (adrenaline == adrenalineMax && !adrenalineModeActive) - projectileDamageReduction += 0.5; - } - } - - 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 (leviathanAndSirenLore) - { - if (!player.IsUnderwater()) - projectileDamageReduction -= 0.05; - } - - if (vHex) - projectileDamageReduction -= 0.3; - - if (irradiated) - projectileDamageReduction -= 0.1; - - if (corrEffigy) - projectileDamageReduction -= 0.2; - - if (calamityRing && !voidOfExtinction) - projectileDamageReduction -= 0.15; - - // 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 (projectileDamageReduction > 0D) - { - if (marked || reaperToothNecklace) - projectileDamageReduction *= 0.5; - - if (aCrunch) - projectileDamageReduction *= 0.33; - - if (wCleave) - projectileDamageReduction *= 0.75; - - // Scale with base damage reduction - if (DRStat > 0) - projectileDamageReduction *= 1f - (DRStat * 0.01f); - - projectileDamageReduction = 1D / (1D + projectileDamageReduction); - damage = (int)(damage * projectileDamageReduction); - } - - if (CalamityWorld.ironHeart) - { - int damageMin = 60 + (player.statLifeMax2 / 10); - int damageWithDR = (int)(damage * (1f - player.endurance)); - if (damage < damageMin) - { - player.endurance = 0f; - damage = damageMin; - } - } - - if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) + if (CalamityWorld.revenge) { - if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && !CalamityMod.trapProjectileList.Contains(proj.type)) + if (CalamityConfig.Instance.Rippers) { - gainRageCooldown = 60; - int stressGain = damage * (profanedRage ? 3 : 2); - int stressMaxGain = 2500; - if (stressGain < 1) + if (adrenaline == adrenalineMax && !adrenalineModeActive) { - stressGain = 1; + double adrenalineDRBoost = 0D + + (adrenalineBoostOne ? 0.05 : 0D) + + (adrenalineBoostTwo ? 0.05 : 0D) + + (adrenalineBoostThree ? 0.05 : 0D); + projectileDamageReduction += 0.5 + adrenalineDRBoost; } - if (stressGain > stressMaxGain) + } + } + + 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) + projectileDamageReduction -= 0.1; + + if (irradiated) + projectileDamageReduction -= 0.1; + + if (corrEffigy) + projectileDamageReduction -= 0.05; + + if (calamityRing && !voidOfExtinction) + projectileDamageReduction -= 0.15; + + // 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 (projectileDamageReduction > 0D) + { + if (aCrunch) + projectileDamageReduction *= 0.33; + + if (wCleave) + projectileDamageReduction *= 0.75; + + if (defenseDamage > 0) + { + // Reduce player DR based on defense stat damage accumulated, this is done before defense is reduced + if (defenseStat > 0) + { + double defenseDamageReduction = defenseDamage / (double)defenseStat; + if (defenseDamageReduction > 1D) + defenseDamageReduction = 1D; + + projectileDamageReduction -= projectileDamageReduction * defenseDamageReduction; + } + + if (projectileDamageReduction < 0D) + projectileDamageReduction = 0D; + } + + // Scale with base damage reduction + if (DRStat > 0) + projectileDamageReduction *= 1f - (DRStat * 0.01f); + + projectileDamageReduction = 1D / (1D + projectileDamageReduction); + damage = (int)(damage * projectileDamageReduction); + } + + if (CalamityWorld.ironHeart) + { + int damageMin = (Main.expertMode ? 10 : 20) + (player.statLifeMax2 / (Main.expertMode ? 40 : 20)); + if (damage < damageMin) + { + player.endurance = 0f; + damage = damageMin; + } + } + } + #endregion + + #region Banner Projectile Damage Reduction + private void BannerProjectileDamageReduction(Projectile proj, ref int damage, bool[] NPCBannerBuffs) + { + bool? reduceDamage = null; + double bannerDamageMultiplier = Main.expertMode ? 0.5 : 0.75; + + for (int l = 0; l < Main.MaxBannerTypes; l++) + { + int bannerNPCType = Item.BannerToNPC(l); + if (bannerNPCType != 0 && NPCBannerBuffs[l]) + { + if (proj.type == ModContent.ProjectileType()) { - stressGain = stressMaxGain; + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; } - rage += stressGain; - if (rage >= rageMax) + else if (proj.type == ModContent.ProjectileType()) { - rage = rageMax; + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType() || (bannerNPCType == ModContent.NPCType() && proj.type == ModContent.ProjectileType())) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = true; + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ProjectileID.EyeBeam) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(NPCID.Golem) && !NPC.AnyNPCs(ModContent.NPCType()); + } + else if (proj.type == ProjectileID.CultistBossIceMist || proj.type == ProjectileID.CultistBossLightningOrbArc) + { + if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) + reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(NPCID.CultistBoss) && proj.Calamity().lineColor != 1; + } + else if (proj.type == ProjectileID.SaucerScrap) + { + if (bannerNPCType == ModContent.NPCType()) + reduceDamage = Main.invasionType != InvasionID.MartianMadness; + } + else + { + switch (proj.type) + { + case ProjectileID.Stinger: + if (CalamityLists.hornetList.Contains(bannerNPCType) || CalamityLists.mossHornetList.Contains(bannerNPCType)) + { + reduceDamage = !NPC.AnyNPCs(NPCID.QueenBee); + } + break; + + case ProjectileID.PinkLaser: + if (bannerNPCType == NPCID.Gastropod || bannerNPCType == ModContent.NPCType()) + { + reduceDamage = !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(ModContent.NPCType()); + } + break; + + case ProjectileID.SandBallFalling: + if (bannerNPCType == NPCID.Antlion) + { + reduceDamage = true; + } + break; + + case ProjectileID.DemonSickle: + if (bannerNPCType == NPCID.Demon || bannerNPCType == NPCID.VoodooDemon) + { + reduceDamage = true; + } + break; + + case ProjectileID.HarpyFeather: + if (bannerNPCType == NPCID.Harpy) + { + reduceDamage = true; + } + break; + + case ProjectileID.JavelinHostile: + if (bannerNPCType == NPCID.GreekSkeleton) + { + reduceDamage = true; + } + break; + + case ProjectileID.IceSpike: + if (bannerNPCType == NPCID.SpikedIceSlime) + { + reduceDamage = true; + } + break; + + case ProjectileID.JungleSpike: + if (bannerNPCType == NPCID.SpikedJungleSlime) + { + reduceDamage = true; + } + break; + + case ProjectileID.WebSpit: + if (bannerNPCType == NPCID.BlackRecluse || bannerNPCType == NPCID.BlackRecluseWall) + { + reduceDamage = true; + } + break; + + case ProjectileID.CursedFlameHostile: + if (bannerNPCType == NPCID.Clinger) + { + reduceDamage = !NPC.AnyNPCs(NPCID.Spazmatism) && (!NPC.AnyNPCs(NPCID.EaterofWorldsHead) || !CalamityWorld.revenge); + } + break; + + case ProjectileID.DesertDjinnCurse: + if (bannerNPCType == NPCID.DesertDjinn) + { + reduceDamage = true; + } + break; + + case ProjectileID.InfernoHostileBlast: + case ProjectileID.InfernoHostileBolt: + if (bannerNPCType == NPCID.DiabolistRed || bannerNPCType == NPCID.DiabolistWhite) + { + reduceDamage = !NPC.AnyNPCs(NPCID.Golem) || !CalamityWorld.revenge; + } + break; + + case ProjectileID.Shadowflames: + if (bannerNPCType == NPCID.GiantCursedSkull) + { + reduceDamage = !NPC.AnyNPCs(NPCID.SkeletronHead) || !CalamityWorld.revenge; + } + break; + + case ProjectileID.FrostBlastHostile: + if (bannerNPCType == NPCID.IceElemental || bannerNPCType == ModContent.NPCType()) + { + reduceDamage = true; + } + break; + + case ProjectileID.IcewaterSpit: + if (bannerNPCType == NPCID.IcyMerman) + { + reduceDamage = true; + } + break; + + case ProjectileID.GoldenShowerHostile: + if (bannerNPCType == NPCID.IchorSticker) + { + reduceDamage = true; + } + break; + + case ProjectileID.ShadowBeamHostile: + if (bannerNPCType == NPCID.Necromancer || bannerNPCType == NPCID.NecromancerArmored) + { + reduceDamage = true; + } + break; + + case ProjectileID.PaladinsHammerHostile: + if (bannerNPCType == NPCID.Paladin) + { + reduceDamage = true; + } + break; + + case ProjectileID.LostSoulHostile: + if (bannerNPCType == NPCID.RaggedCaster || bannerNPCType == NPCID.RaggedCasterOpenCoat) + { + reduceDamage = true; + } + break; + + case ProjectileID.UnholyTridentHostile: + if (bannerNPCType == NPCID.RedDevil) + { + reduceDamage = true; + } + break; + + case ProjectileID.RuneBlast: + if (bannerNPCType == NPCID.RuneWizard) + { + reduceDamage = true; + } + break; + + case ProjectileID.WoodenArrowHostile: + if (bannerNPCType == NPCID.GoblinArcher || bannerNPCType == NPCID.CultistArcherBlue || bannerNPCType == NPCID.CultistArcherWhite) + { + reduceDamage = true; + } + break; + + case ProjectileID.FlamingArrow: + if (bannerNPCType == NPCID.SkeletonArcher || bannerNPCType == NPCID.PirateCrossbower || bannerNPCType == NPCID.ElfArcher) + { + reduceDamage = true; + } + break; + + case ProjectileID.SalamanderSpit: + if (bannerNPCType >= NPCID.Salamander && bannerNPCType <= NPCID.Salamander9) + { + reduceDamage = true; + } + break; + + case ProjectileID.SkeletonBone: + if (bannerNPCType == NPCID.Skeleton) + { + reduceDamage = true; + } + break; + + case ProjectileID.RocketSkeleton: + if (bannerNPCType == NPCID.SkeletonCommando) + { + reduceDamage = !NPC.AnyNPCs(NPCID.SkeletronPrime) || !CalamityWorld.revenge; + } + break; + + case ProjectileID.SniperBullet: + if (bannerNPCType == NPCID.SkeletonSniper) + { + reduceDamage = true; + } + break; + + case ProjectileID.BulletDeadeye: + if (bannerNPCType == NPCID.TacticalSkeleton || bannerNPCType == NPCID.SnowmanGangsta || bannerNPCType == NPCID.PirateCaptain || bannerNPCType == NPCID.PirateDeadeye || bannerNPCType == NPCID.ElfCopter) + { + reduceDamage = !NPC.AnyNPCs(NPCID.SantaNK1); + } + break; + + case ProjectileID.RainNimbus: + if (bannerNPCType == NPCID.AngryNimbus) + { + reduceDamage = true; + } + break; + + case ProjectileID.FrostShard: + if (bannerNPCType == NPCID.AngryNimbus) + { + reduceDamage = !NPC.AnyNPCs(NPCID.IceQueen) && CalamityWorld.death; + } + break; + + case ProjectileID.FrostBeam: + if (bannerNPCType == NPCID.IceGolem) + { + reduceDamage = true; + } + break; + + case ProjectileID.SandnadoHostile: + case ProjectileID.SandnadoHostileMark: + if (bannerNPCType == NPCID.SandElemental) + { + reduceDamage = true; + } + break; + + case ProjectileID.SnowBallHostile: + if (bannerNPCType == NPCID.SnowBalla) + { + reduceDamage = true; + } + break; + + case ProjectileID.CannonballHostile: + if (bannerNPCType == NPCID.PirateCaptain) + { + reduceDamage = !NPC.AnyNPCs(NPCID.PirateShip); + } + break; + + case ProjectileID.DrManFlyFlask: + if (bannerNPCType == NPCID.DrManFly) + { + reduceDamage = true; + } + break; + + case ProjectileID.EyeLaser: + if (bannerNPCType == NPCID.Eyezor) + { + reduceDamage = !NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.WallofFleshEye); + } + break; + + case ProjectileID.Nail: + if (bannerNPCType == NPCID.Nailhead) + { + reduceDamage = true; + } + break; + + case ProjectileID.NebulaSphere: + if (bannerNPCType == NPCID.NebulaBeast) + { + reduceDamage = true; + } + break; + + case ProjectileID.NebulaLaser: + if (bannerNPCType == NPCID.NebulaBrain) + { + reduceDamage = true; + } + break; + + case ProjectileID.NebulaBolt: + if (bannerNPCType == NPCID.NebulaSoldier) + { + reduceDamage = true; + } + break; + + case ProjectileID.StardustJellyfishSmall: + if (bannerNPCType == NPCID.StardustJellyfishBig) + { + reduceDamage = true; + } + break; + + case ProjectileID.StardustSoldierLaser: + if (bannerNPCType == NPCID.StardustSoldier) + { + reduceDamage = true; + } + break; + + case ProjectileID.Twinkle: + if (bannerNPCType == NPCID.StardustSpiderBig) + { + reduceDamage = true; + } + break; + + case ProjectileID.VortexAcid: + if (bannerNPCType == NPCID.VortexHornetQueen) + { + reduceDamage = true; + } + break; + + case ProjectileID.VortexLaser: + if (bannerNPCType == NPCID.VortexRifleman) + { + reduceDamage = true; + } + break; + + case ProjectileID.VortexLightning: + if (bannerNPCType == NPCID.VortexSoldier) + { + reduceDamage = true; + } + break; + + case ProjectileID.RayGunnerLaser: + if (bannerNPCType == NPCID.RayGunner) + { + reduceDamage = true; + } + break; + + case ProjectileID.BrainScramblerBolt: + if (bannerNPCType == NPCID.BrainScrambler) + { + reduceDamage = true; + } + break; + + case ProjectileID.MartianWalkerLaser: + if (bannerNPCType == NPCID.MartianWalker) + { + reduceDamage = true; + } + break; + + case ProjectileID.MartianTurretBolt: + if ((bannerNPCType == NPCID.MartianTurret && Main.invasionType == InvasionID.MartianMadness) || ((bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) && Main.invasionType != InvasionID.MartianMadness)) + { + reduceDamage = true; + } + break; + + case ProjectileID.SaucerLaser: + if (bannerNPCType == ModContent.NPCType() && Main.invasionType != InvasionID.MartianMadness) + { + reduceDamage = true; + } + break; + + case ProjectileID.HappyBomb: + if (bannerNPCType == NPCID.Clown) + { + reduceDamage = true; + } + break; + } + } + + if (reduceDamage.HasValue) + { + if (reduceDamage.Value) + damage = (int)(damage * bannerDamageMultiplier); + + break; } } } } #endregion - #region Banner Projectile Damage Reduction - private void BannerProjectileDamageReduction(Projectile proj, ref int damage, bool[] NPCBannerBuffs) - { - bool? reduceDamage = null; - double bannerDamageMultiplier = Main.expertMode ? 0.5 : 0.75; - - for (int l = 0; l < Main.MaxBannerTypes; l++) - { - int bannerNPCType = Item.BannerToNPC(l); - if (bannerNPCType != 0 && NPCBannerBuffs[l]) - { - if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType() || (bannerNPCType == ModContent.NPCType() && proj.type == ModContent.ProjectileType())) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = true; - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); - } - else if (proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); - } - else if (proj.type == ModContent.ProjectileType() || proj.type == ModContent.ProjectileType()) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()); - } - else if (proj.type == ProjectileID.EyeBeam) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(NPCID.Golem) && !NPC.AnyNPCs(ModContent.NPCType()); - } - else if (proj.type == ProjectileID.CultistBossIceMist || proj.type == ProjectileID.CultistBossLightningOrbArc) - { - if (bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) - reduceDamage = !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(NPCID.CultistBoss) && proj.Calamity().lineColor != 1; - } - else if (proj.type == ProjectileID.SaucerScrap) - { - if (bannerNPCType == ModContent.NPCType()) - reduceDamage = Main.invasionType != InvasionID.MartianMadness && (!NPC.AnyNPCs(NPCID.TheDestroyer) || !CalamityWorld.revenge); - } - else - { - switch (proj.type) - { - case ProjectileID.Stinger: - if (CalamityMod.hornetList.Contains(bannerNPCType) || CalamityMod.mossHornetList.Contains(bannerNPCType)) - { - reduceDamage = !NPC.AnyNPCs(NPCID.QueenBee); - } - break; - - case ProjectileID.PinkLaser: - if (bannerNPCType == NPCID.Gastropod || bannerNPCType == ModContent.NPCType()) - { - reduceDamage = !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); - } - break; - - case ProjectileID.SandBallFalling: - if (bannerNPCType == NPCID.Antlion) - { - reduceDamage = true; - } - break; - - case ProjectileID.DemonSickle: - if (bannerNPCType == NPCID.Demon || bannerNPCType == NPCID.VoodooDemon) - { - reduceDamage = true; - } - break; - - case ProjectileID.HarpyFeather: - if (bannerNPCType == NPCID.Harpy) - { - reduceDamage = true; - } - break; - - case ProjectileID.JavelinHostile: - if (bannerNPCType == NPCID.GreekSkeleton) - { - reduceDamage = true; - } - break; - - case ProjectileID.IceSpike: - if (bannerNPCType == NPCID.SpikedIceSlime) - { - reduceDamage = true; - } - break; - - case ProjectileID.JungleSpike: - if (bannerNPCType == NPCID.SpikedJungleSlime) - { - reduceDamage = true; - } - break; - - case ProjectileID.WebSpit: - if (bannerNPCType == NPCID.BlackRecluse || bannerNPCType == NPCID.BlackRecluseWall) - { - reduceDamage = true; - } - break; - - case ProjectileID.CursedFlameHostile: - if (bannerNPCType == NPCID.Clinger) - { - reduceDamage = !NPC.AnyNPCs(NPCID.Spazmatism) && (!NPC.AnyNPCs(NPCID.EaterofWorldsHead) || !CalamityWorld.revenge); - } - break; - - case ProjectileID.DesertDjinnCurse: - if (bannerNPCType == NPCID.DesertDjinn) - { - reduceDamage = true; - } - break; - - case ProjectileID.InfernoHostileBlast: - case ProjectileID.InfernoHostileBolt: - if (bannerNPCType == NPCID.DiabolistRed || bannerNPCType == NPCID.DiabolistWhite) - { - reduceDamage = !NPC.AnyNPCs(NPCID.Golem) || !CalamityWorld.revenge; - } - break; - - case ProjectileID.Shadowflames: - if (bannerNPCType == NPCID.GiantCursedSkull) - { - reduceDamage = !NPC.AnyNPCs(NPCID.SkeletronHead) || !CalamityWorld.revenge; - } - break; - - case ProjectileID.FrostBlastHostile: - if (bannerNPCType == NPCID.IceElemental || bannerNPCType == ModContent.NPCType()) - { - reduceDamage = true; - } - break; - - case ProjectileID.IcewaterSpit: - if (bannerNPCType == NPCID.IcyMerman) - { - reduceDamage = true; - } - break; - - case ProjectileID.GoldenShowerHostile: - if (bannerNPCType == NPCID.IchorSticker) - { - reduceDamage = true; - } - break; - - case ProjectileID.ShadowBeamHostile: - if (bannerNPCType == NPCID.Necromancer || bannerNPCType == NPCID.NecromancerArmored) - { - reduceDamage = true; - } - break; - - case ProjectileID.PaladinsHammerHostile: - if (bannerNPCType == NPCID.Paladin) - { - reduceDamage = true; - } - break; - - case ProjectileID.LostSoulHostile: - if (bannerNPCType == NPCID.RaggedCaster || bannerNPCType == NPCID.RaggedCasterOpenCoat) - { - reduceDamage = true; - } - break; - - case ProjectileID.UnholyTridentHostile: - if (bannerNPCType == NPCID.RedDevil) - { - reduceDamage = true; - } - break; - - case ProjectileID.RuneBlast: - if (bannerNPCType == NPCID.RuneWizard) - { - reduceDamage = true; - } - break; - - case ProjectileID.WoodenArrowHostile: - if (bannerNPCType == NPCID.GoblinArcher || bannerNPCType == NPCID.CultistArcherBlue || bannerNPCType == NPCID.CultistArcherWhite) - { - reduceDamage = true; - } - break; - - case ProjectileID.FlamingArrow: - if (bannerNPCType == NPCID.SkeletonArcher || bannerNPCType == NPCID.PirateCrossbower || bannerNPCType == NPCID.ElfArcher) - { - reduceDamage = true; - } - break; - - case ProjectileID.SalamanderSpit: - if (bannerNPCType >= NPCID.Salamander && bannerNPCType <= NPCID.Salamander9) - { - reduceDamage = true; - } - break; - - case ProjectileID.SkeletonBone: - if (bannerNPCType == NPCID.Skeleton) - { - reduceDamage = true; - } - break; - - case ProjectileID.RocketSkeleton: - if (bannerNPCType == NPCID.SkeletonCommando) - { - reduceDamage = !NPC.AnyNPCs(NPCID.SkeletronPrime) || !CalamityWorld.revenge; - } - break; - - case ProjectileID.SniperBullet: - if (bannerNPCType == NPCID.SkeletonSniper) - { - reduceDamage = true; - } - break; - - case ProjectileID.BulletDeadeye: - if (bannerNPCType == NPCID.TacticalSkeleton || bannerNPCType == NPCID.SnowmanGangsta || bannerNPCType == NPCID.PirateCaptain || bannerNPCType == NPCID.PirateDeadeye || bannerNPCType == NPCID.ElfCopter) - { - reduceDamage = !NPC.AnyNPCs(NPCID.SantaNK1); - } - break; - - case ProjectileID.RainNimbus: - if (bannerNPCType == NPCID.AngryNimbus) - { - reduceDamage = true; - } - break; - - case ProjectileID.FrostShard: - if (bannerNPCType == NPCID.AngryNimbus) - { - reduceDamage = !NPC.AnyNPCs(NPCID.IceQueen) && CalamityWorld.death; - } - break; - - case ProjectileID.FrostBeam: - if (bannerNPCType == NPCID.IceGolem) - { - reduceDamage = true; - } - break; - - case ProjectileID.SandnadoHostile: - case ProjectileID.SandnadoHostileMark: - if (bannerNPCType == NPCID.SandElemental) - { - reduceDamage = true; - } - break; - - case ProjectileID.SnowBallHostile: - if (bannerNPCType == NPCID.SnowBalla) - { - reduceDamage = true; - } - break; - - case ProjectileID.CannonballHostile: - if (bannerNPCType == NPCID.PirateCaptain) - { - reduceDamage = !NPC.AnyNPCs(NPCID.PirateShip); - } - break; - - case ProjectileID.DrManFlyFlask: - if (bannerNPCType == NPCID.DrManFly) - { - reduceDamage = true; - } - break; - - case ProjectileID.EyeLaser: - if (bannerNPCType == NPCID.Eyezor) - { - reduceDamage = !NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.WallofFleshEye); - } - break; - - case ProjectileID.Nail: - if (bannerNPCType == NPCID.Nailhead) - { - reduceDamage = true; - } - break; - - case ProjectileID.NebulaSphere: - if (bannerNPCType == NPCID.NebulaBeast) - { - reduceDamage = true; - } - break; - - case ProjectileID.NebulaLaser: - if (bannerNPCType == NPCID.NebulaBrain) - { - reduceDamage = true; - } - break; - - case ProjectileID.NebulaBolt: - if (bannerNPCType == NPCID.NebulaSoldier) - { - reduceDamage = true; - } - break; - - case ProjectileID.StardustJellyfishSmall: - if (bannerNPCType == NPCID.StardustJellyfishBig) - { - reduceDamage = true; - } - break; - - case ProjectileID.StardustSoldierLaser: - if (bannerNPCType == NPCID.StardustSoldier) - { - reduceDamage = true; - } - break; - - case ProjectileID.Twinkle: - if (bannerNPCType == NPCID.StardustSpiderBig) - { - reduceDamage = true; - } - break; - - case ProjectileID.VortexAcid: - if (bannerNPCType == NPCID.VortexHornetQueen) - { - reduceDamage = true; - } - break; - - case ProjectileID.VortexLaser: - if (bannerNPCType == NPCID.VortexRifleman) - { - reduceDamage = true; - } - break; - - case ProjectileID.VortexLightning: - if (bannerNPCType == NPCID.VortexSoldier) - { - reduceDamage = true; - } - break; - - case ProjectileID.RayGunnerLaser: - if (bannerNPCType == NPCID.RayGunner) - { - reduceDamage = true; - } - break; - - case ProjectileID.BrainScramblerBolt: - if (bannerNPCType == NPCID.BrainScrambler) - { - reduceDamage = true; - } - break; - - case ProjectileID.MartianWalkerLaser: - if (bannerNPCType == NPCID.MartianWalker) - { - reduceDamage = true; - } - break; - - case ProjectileID.MartianTurretBolt: - if ((bannerNPCType == NPCID.MartianTurret && Main.invasionType == InvasionID.MartianMadness) || ((bannerNPCType == ModContent.NPCType() || bannerNPCType == ModContent.NPCType()) && Main.invasionType != InvasionID.MartianMadness)) - { - reduceDamage = true; - } - break; - - case ProjectileID.SaucerLaser: - if (bannerNPCType == ModContent.NPCType() && Main.invasionType != InvasionID.MartianMadness) - { - reduceDamage = true; - } - break; - - case ProjectileID.HappyBomb: - if (bannerNPCType == NPCID.Clown) - { - reduceDamage = true; - } - break; - } - } - - if (reduceDamage.HasValue) - { - if (reduceDamage.Value) - damage = (int)(damage * bannerDamageMultiplier); - - break; - } - } - } - } - #endregion - #region On Hit public override void OnHitByNPC(NPC npc, int damage, bool crit) - { - if (sulfurSet) - npc.AddBuff(BuffID.Poisoned, 120); - if (CalamityWorld.revenge) - { - if (npc.type == NPCID.ShadowFlameApparition || (npc.type == NPCID.ChaosBall && Main.hardMode)) - { - 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); - } - else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) - { - player.AddBuff(BuffID.Poisoned, 180); - player.AddBuff(BuffID.Venom, 180); - player.AddBuff(BuffID.Bleeding, 300); - } - else if (npc.type == NPCID.PlanterasTentacle) - { - player.AddBuff(BuffID.Poisoned, 120); - player.AddBuff(BuffID.Venom, 120); - player.AddBuff(BuffID.Bleeding, 180); - } - else if (npc.type == NPCID.AncientDoom) - { - player.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(ModContent.BuffType(), 120); - } - else if (npc.type == NPCID.AncientLight) - { - player.AddBuff(ModContent.BuffType(), 180); - } + { + if (sulfurSet) + npc.AddBuff(BuffID.Poisoned, 120); + + if (npc.type == NPCID.ShadowFlameApparition || (npc.type == NPCID.ChaosBall && (Main.hardMode || areThereAnyDamnBosses))) + { + 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); + } + else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) + { + player.AddBuff(BuffID.Poisoned, 300); + } + else if (npc.type == NPCID.PlanterasTentacle) + { + player.AddBuff(BuffID.Poisoned, 180); + } + else if (npc.type == NPCID.AncientDoom) + { + player.AddBuff(ModContent.BuffType(), 120); + } + else if (npc.type == NPCID.AncientLight) + { + player.AddBuff(ModContent.BuffType(), 180); + } + } public override void OnHitByProjectile(Projectile proj, int damage, bool crit) { @@ -7102,7 +6908,7 @@ namespace CalamityMod.CalPlayer } } - if (CalamityWorld.revenge && proj.hostile) + if (proj.hostile) { if (proj.type == ProjectileID.Explosives) { @@ -7127,8 +6933,7 @@ namespace CalamityMod.CalPlayer else if (proj.type == ProjectileID.ThornBall) { player.AddBuff(BuffID.Poisoned, 240); - player.AddBuff(BuffID.Venom, 120); - } + } else if (proj.type == ProjectileID.CultistBossIceMist) { player.AddBuff(BuffID.Frozen, 60); @@ -7137,83 +6942,31 @@ namespace CalamityMod.CalPlayer } 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); + int deathModeDuration = NPC.downedMoonlord ? 80 : NPC.downedPlantBoss ? 40 : Main.hardMode ? 20 : 10; + 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(), 180); - player.AddBuff(ModContent.BuffType(), 120); - } - else if (proj.type == ProjectileID.CultistBossFireBallClone) - { - player.AddBuff(ModContent.BuffType(), 120); - } - } - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => proj.type != x)) - { - if (projRef && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(20)) - { - player.statLife += damage; - player.HealEffect(damage); - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - } - if (projRefRare && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(2)) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X * 2f; - proj.velocity.Y = -proj.velocity.Y * 2f; - proj.damage *= 10; - projRefRareLifeRegenCounter = 120; - projTypeJustHitBy = proj.type; - } - if (aSparkRare && proj.active && !proj.friendly && proj.hostile && damage > 0) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - proj.damage *= 8; - } - } - if (daedalusReflect && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.NextBool(3)) - { - int healAmt = damage / 5; - player.statLife += healAmt; - player.HealEffect(healAmt); - proj.hostile = false; - proj.friendly = true; - proj.velocity.X = -proj.velocity.X; - proj.velocity.Y = -proj.velocity.Y; - } - } - } - #endregion - - #region Can Hit - public override bool? CanHitNPC(Item item, NPC target) - { - if (camper && !player.StandingStill()) - { - return false; + else if (proj.type == ProjectileID.AncientDoomProjectile) + { + player.AddBuff(ModContent.BuffType(), 120); + } + else if (proj.type == ProjectileID.CultistBossFireBallClone) + { + player.AddBuff(ModContent.BuffType(), 120); + } + else if (proj.type == ProjectileID.PhantasmalBolt || proj.type == ProjectileID.PhantasmalEye) + { + player.AddBuff(ModContent.BuffType(), 180); + } + else if (proj.type == ProjectileID.PhantasmalSphere) + { + player.AddBuff(ModContent.BuffType(), 360); + } + else if (proj.type == ProjectileID.PhantasmalDeathray) + { + player.AddBuff(ModContent.BuffType(), 600); + } } - return null; - } - - public override bool? CanHitNPCWithProj(Projectile proj, NPC target) - { - if (camper && !player.StandingStill()) - { - return false; - } - return null; } #endregion @@ -7230,9 +6983,14 @@ namespace CalamityMod.CalPlayer #endregion #region Shoot - public override bool Shoot(Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { + if (bladeArmEnchant) + return false; + + if (rottenDogTooth && item.Calamity().rogue && item.type != ModContent.ItemType()) + damage = (int)(damage * (1f + RottenDogtooth.StealthStrikeDamageMultiplier)); + if (veneratedLocket) { if (item.Calamity().rogue && item.type != ModContent.ItemType()) @@ -7276,16 +7034,21 @@ 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.15f), knockBack * 0.5f, player.whoAmI); - Main.projectile[p].Calamity().forceRogue = true; //in case melee/rogue variants bug out - if (item.type == ModContent.ItemType()) - { - Main.projectile[p].ai[1] = 1f; - } + 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 + + // Handle AI edge-cases. + if (item.type == ModContent.ItemType()) + Main.projectile[p].ai[1] = 1f; + if (item.type == ModContent.ItemType()) + Main.projectile[p].ai[0] = -1f; + if (StealthStrikeAvailable()) { int knifeCount = 15; - int knifeDamage = (int)(150 * player.RogueDamage()); + int knifeDamage = (int)(35 * player.RogueDamage()); float angleStep = MathHelper.TwoPi / knifeCount; float speed = 15f; @@ -7295,8 +7058,10 @@ namespace CalamityMod.CalPlayer velocity = velocity.RotatedBy(angleStep * i); int knifeCol = Main.rand.Next(0, 2); - 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; + } } } } @@ -7311,8 +7076,10 @@ namespace CalamityMod.CalPlayer { Vector2 startingPosition = Main.MouseWorld - Vector2.UnitY.RotatedByRandom(0.4f) * 1250f; Vector2 directionToMouse = (startingPosition - Main.MouseWorld).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.1f); - Projectile.NewProjectileDirect(startingPosition, directionToMouse * 12f, ModContent.ProjectileType(), (int)(damage * 0.3f), 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; + } } } } @@ -7321,63 +7088,63 @@ namespace CalamityMod.CalPlayer } #endregion - #region Frame Effects - public override void FrameEffects() - { - 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. - } - 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; + #region Frame Effects + public override void FrameEffects() + { + 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. + } + 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; - 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) - { - int key = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); - } + if (profanedCrystalWingCounter.Value == 0) + { + int key = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); + } - player.wingFrame = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); - player.armorEffectDrawOutlines = true; - if (profanedCrystalBuffs) - { - player.armorEffectDrawShadow = true; - if (enrage) - { - 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; - } - 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; - } - 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.wingFrame = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); + player.armorEffectDrawOutlines = true; + if (profanedCrystalBuffs) + { + player.armorEffectDrawShadow = true; + if (enrage) + { + 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; + } + 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; + } + 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; + } else if (meldTransformationPower || meldTransformationForce) { player.legs = mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs); @@ -7388,49 +7155,86 @@ namespace CalamityMod.CalPlayer { player.head = mod.GetEquipSlot("OmegaBlueTransformationHead", EquipType.Head); } - else - { - if (profanedCrystalWingCounter.Key != 1) - profanedCrystalWingCounter = new KeyValuePair(1, 7); - if (profanedCrystalAnimCounter.Key != 0) - profanedCrystalAnimCounter = new KeyValuePair(0, 10); - } - 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.velocity.Y *= 0.9f; - player.wingFrame = 3; - player.noFallDmg = true; - player.fallStart = (int)(player.position.Y / 16f); - } - } - if (abyssDivingGear && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) - { - player.head = mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); - player.face = -1; - } - - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - } - #endregion + else + { + if (profanedCrystalWingCounter.Key != 1) + profanedCrystalWingCounter = new KeyValuePair(1, 7); + if (profanedCrystalAnimCounter.Key != 0) + profanedCrystalAnimCounter = new KeyValuePair(0, 10); + } + 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.velocity.Y *= 0.9f; + player.wingFrame = 3; + player.noFallDmg = true; + player.fallStart = (int)(player.position.Y / 16f); + } + } + if (abyssDivingGear && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + { + player.head = mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); + player.face = -1; + } + } + #endregion #region Limitations + private void ForceVariousEffects() + { + if (noWings) + RemoveWingTime(); + if (blockAllDashes || (CalamityConfig.Instance.BossRushDashCurse && BossRushEvent.BossRushActive)) + DisableDashes(); + if (weakPetrification) + WeakPetrification(); + + if (lol || (silvaCountdown > 0 && hasSilvaEffect && silvaSet) || (dashMod == 9 && player.dashDelay < 0)) + { + if (player.lifeRegen < 0) + player.lifeRegen = 0; + } + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + player.yoraiz0rEye = 0; + } + + private void RemoveWingTime() + { + player.wingTimeMax = 0; + } + + private const int DashDisableCooldown = 12; + private void DisableDashes() + { + // Set the player to have no registered dashes. + 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; + + // Prevent the possibility of Shield of Cthulhu invulnerability exploits. + 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; - statigelJump = false; - sulfurJump = false; + player.doubleJumpSail = false; + player.doubleJumpFart = false; + statigelJump = false; + sulfurJump = false; player.rocketBoots = 0; player.jumpBoost = false; player.slowFall = false; @@ -7439,35 +7243,30 @@ namespace CalamityMod.CalPlayer player.jumpSpeedBoost = 0f; player.wingTimeMax = (int)(player.wingTimeMax * 0.5); player.balloon = -1; - weakPetrification = true; - } - - private void Defiled() - { - player.wingTimeMax = 0; } #endregion #region Pre Hurt public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { - if (CalamityWorld.armageddon || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) + #region Ignore Incoming Hits + // If any dodges are active which could dodge this hit, the hurting event is canceled (and the dodge is used). + if (HandleDodges()) + return false; + + // Lul makes the player completely invincible. + if (lol) + return false; + + // Unless holding Coldheart Icicle, the Purified Jam makes you completely invincible. + 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. + if (CalamityWorld.armageddon || (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0)) { - if (areThereAnyDamnBosses || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) + if (areThereAnyDamnBosses || (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0)) { - if (SCalLore) - { - string key = "Mods.CalamityMod.SupremeBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } if (CalamityWorld.DoGSecondStageCountdown > 0) { CalamityWorld.DoGSecondStageCountdown = 0; @@ -7482,16 +7281,16 @@ namespace CalamityMod.CalPlayer KillPlayer(); } } + #endregion - if (lol || (invincible && player.ActiveItem().type != ModContent.ItemType())) - { - return false; - } - if (godSlayerReflect && Main.rand.NextBool(50)) - { - return false; - } - if (hurtSoundTimer == 0) //hurtsounds + // + // At this point, the player is guaranteed to be hit. + // The amount of damage that will be dealt is yet to be determined. + // + + #region Custom Hurt Sounds + // TODO -- Shouldn't these all not occur in favor of the Iron Heart hurt noise if Iron Heart is on? + if (hurtSoundTimer == 0) { if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) { @@ -7511,96 +7310,106 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.FemaleHit, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise hurtSoundTimer = 10; } - else if (titanHeartSet) - { - 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") - }); - Main.PlaySound(atlasHurt, (int)player.position.X, (int)player.position.Y); - hurtSoundTimer = 10; - } + else if (titanHeartSet) + { + 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") + }); + Main.PlaySound(atlasHurt, (int)player.position.X, (int)player.position.Y); + hurtSoundTimer = 10; + } } + #endregion - #region MultiplierBoosts - double damageMult = 1.0 + - (dArtifact ? 0.25 : 0.0) + - (DoGLore ? 0.1 : 0.0) + - ((player.beetleDefense && player.beetleOrbs > 0) ? (0.05 * player.beetleOrbs) : 0.0) + - (enraged ? 0.25 : 0.0) + - ((CalamityWorld.defiled && Main.rand.NextBool(4)) ? 0.5 : 0.0); + #region Player Incoming Damage Multiplier (Increases) + double damageMult = 1D; + if (dArtifact) // Dimensional Soul Artifact increases incoming damage by 15%. + damageMult += 0.15; + if (enraged) // Demonshade Enrage increases incoming damage by 25%. + damageMult += 0.25; - if (bloodPact && Main.rand.NextBool(4)) - { - player.AddBuff(ModContent.BuffType(), 600); - damageMult += 1.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; - // Equivalent to reducing the player's DR by 20% because they have Cursed Inferno. - if (CalamityWorld.revenge && player.onFire2) - damageMult += 0.2; + // 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) + 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); + damageMult += 1.25; + } damage = (int)(damage * damageMult); #endregion + // + // At this point, the true, final incoming damage to the player has been calculated. + // It has not yet been mitigated by any means. + // + + // God Slayer Damage Resistance makes you ignore hits that came in as less than 80. + if ((godSlayerDamage && damage <= 80) || damage < 1) + damage = 1; + + // Shattered Community makes the player gain rage based on the amount of damage taken. + // Also set the Rage gain cooldown to prevent bizarre abuse cases. + if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers && shatteredCommunity && rageGainCooldown == 0) + { + float HPRatio = (float)damage / player.statLifeMax2; + float rageConversionRatio = 0.8f; + + // Damage to rage conversion is half as effective while Rage Mode is active. + if (rageModeActive) + rageConversionRatio *= 0.5f; + // If Rage is over 100%, damage to rage conversion scales down asymptotically based on how full Rage is. + if (rage >= rageMax) + rageConversionRatio *= 3f / (3f + rage / rageMax); + + rage += rageMax * HPRatio * rageConversionRatio; + rageGainCooldown = DefaultRageGainCooldown; + // Rage capping is handled in MiscEffects + } + if (CalamityWorld.revenge) { + // Apply custom damage in Revengeance Mode. All this actually does is provide a minimum damage customDamage = true; - double defenseMultiplier = /*Main.masterMode ? 1D :*/ 0.75; + // Revengeance uses the same defense effectiveness as Expert, 75%. + double defenseMultiplier = /*Main.masterMode ? 1D :*/ 0.75; double newDamage = damage - (player.statDefense * defenseMultiplier); - double bossDamageLimitIncrease = CalamityWorld.death ? 40D : 20D; // dude why would you even do that? super uncool fab, 0/10, you should jump off a bridge for having the audacity to do something like this :((((( - double newDamageLimit = NPC.downedMoonlord ? 20D : (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) ? 15D : Main.hardMode ? 10D : 5D; - /*if (areThereAnyDamnBosses && Main.masterMode) - newDamageLimit += bossDamageLimitIncrease;*/ + + double newDamageLimit = NPC.downedMoonlord ? 20D : (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) ? 15D : Main.hardMode ? 10D : 5D; if (newDamage < newDamageLimit) - { newDamage = newDamageLimit; - } + damage = (int)newDamage; } - if (CalamityWorld.ironHeart) - { - int damageMin = 60 + (player.statLifeMax2 / 10); - playSound = false; - hurtSoundTimer = 20; - if (damage <= damageMin) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartHurt"), (int)player.position.X, (int)player.position.Y); - else - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartBigHurt"), (int)player.position.X, (int)player.position.Y); - } + // 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)); - if (purpleCandle) - damage = (int)(damage - (player.statDefense * 0.05)); - - if ((godSlayerDamage && damage <= 80) || damage < 1) - damage = 1; - - #region HealingEffects - if (revivify) + if (CalamityWorld.ironHeart) { - int healAmt = damage / 15; - player.statLife += healAmt; - player.HealEffect(healAmt); + int damageMin = 80 + (player.statLifeMax2 / 10); + playSound = false; + hurtSoundTimer = 20; + if (damage <= damageMin) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartHurt"), (int)player.position.X, (int)player.position.Y); + else + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartBigHurt"), (int)player.position.X, (int)player.position.Y); } - if (daedalusAbsorb && Main.rand.NextBool(10)) - { - int healAmt = damage / 2; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - if (absorber) - { - int healAmt = damage / 20; - player.statLife += healAmt; - player.HealEffect(healAmt); - } - #endregion return true; } @@ -7610,29 +7419,82 @@ namespace CalamityMod.CalPlayer public override void Hurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) { modStealth = 1f; + + // Give Rage combat frames because being hurt counts as combat. + if (CalamityConfig.Instance.Rippers && CalamityWorld.revenge) + rageCombatFrames = RageCombatDelayTime; + if (player.whoAmI == Main.myPlayer) { + // Summon a portal if needed. + if (player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + { + Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); + CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType(), player); + } + + if (revivify) + { + int healAmt = (int)(damage / 15D); + player.statLife += healAmt; + player.HealEffect(healAmt); + } + + if (daedalusAbsorb && Main.rand.NextBool(10)) + { + int healAmt = (int)(damage / 2D); + player.statLife += healAmt; + player.HealEffect(healAmt); + } + + if (absorber) + { + int healAmt = (int)(damage / (sponge ? 16D : 20D)); + player.statLife += healAmt; + player.HealEffect(healAmt); + } + + if (witheringDamageDone > 0) + { + double healCompenstationRatio = Math.Log(witheringDamageDone) * Math.Pow(witheringDamageDone, 2D / 3D) / 177000D; + if (healCompenstationRatio > 1D) + healCompenstationRatio = 1D; + int healCompensation = (int)(healCompenstationRatio * damage); + player.statLife += (int)(healCompenstationRatio * damage); + player.HealEffect(healCompensation); + player.AddBuff(ModContent.BuffType(), 1080); + witheringDamageDone = 0; + } + if (CalamityConfig.Instance.Rippers && CalamityWorld.revenge) { - if (!adrenalineModeActive && damage > 0) //to prevent paladin's shield ruining adren even with 0 dmg taken - { + if (!adrenalineModeActive && damage > 0) // To prevent paladin's shield ruining adren even with 0 dmg taken + { adrenaline -= stressPills ? adrenalineMax / 2 : adrenalineMax; - if (adrenaline < 0) - adrenaline = 0; - } + if (adrenaline < 0) + adrenaline = 0; + } } + + if (evilSmasherBoost > 0) + evilSmasherBoost -= 1; + + hellbornBoost = 0; + if (amidiasBlessing) { player.ClearBuff(ModContent.BuffType()); Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 96); } + if ((gShell || fabledTortoise) && !player.panic) - { - player.AddBuff(ModContent.BuffType(), 300); - } + player.AddBuff(ModContent.BuffType(), 180); + if (abyssalDivingSuitPlates && damage > 50) { - abyssalDivingSuitPlateHits++; + if (abyssalDivingSuitPlateHits < 3) + abyssalDivingSuitPlateHits++; + if (abyssalDivingSuitPlateHits >= 3) { Main.PlaySound(SoundID.NPCKilled, (int)player.position.X, (int)player.position.Y, 14); @@ -7644,7 +7506,7 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(2)) { Main.dust[dust].scale = 0.5f; - Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int d = 0; d < 35; d++) @@ -7655,9 +7517,10 @@ namespace CalamityMod.CalPlayer 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); @@ -7681,88 +7544,87 @@ namespace CalamityMod.CalPlayer Main.dust[ice].velocity *= 2f; } } + if (tarraMelee) { if (Main.rand.NextBool(4)) - { player.AddBuff(ModContent.BuffType(), 120); - } } else if (xerocSet) { player.AddBuff(ModContent.BuffType(), 240); player.AddBuff(ModContent.BuffType(), 240); } - else if (reaverBlast) + else if (reaverDefense) { - player.AddBuff(ModContent.BuffType(), 180); + if (Main.rand.NextBool(4)) + player.AddBuff(ModContent.BuffType(), 180); } - if (fBarrier || (sirenBoobs && NPC.downedBoss3)) + + if ((fBarrier || (sirenBoobs && NPC.downedBoss3)) && !areThereAnyDamnBosses) { Main.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 freezeDist = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (freezeDist > 500f) - { - freezeDist = 500f + (freezeDist - 500f) * 0.75f; - } - if (freezeDist > 700f) - { - freezeDist = 700f + (freezeDist - 700f) * 0.5f; - } - if (freezeDist > 900f) - { - freezeDist = 900f + (freezeDist - 900f) * 0.25f; - } - if (npcDist < freezeDist) - { - float duration = (float)Main.rand.Next(90 + (int)damage / 3, 240 + (int)damage / 2); - npc.AddBuff(ModContent.BuffType(), (int)duration, false); - } + NPC npc = Main.npc[m]; + if (!npc.active || npc.friendly || npc.dontTakeDamage) + continue; + + 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; + if (freezeDist > 700f) + freezeDist = 700f + (freezeDist - 700f) * 0.5f; + if (freezeDist > 900f) + freezeDist = 900f + (freezeDist - 900f) * 0.25f; + + if (npcDist < freezeDist) + { + float duration = Main.rand.Next(10 + (int)damage / 4, 20 + (int)damage / 3); + if (duration > 120) + duration = 120; + + npc.AddBuff(ModContent.BuffType(), (int)duration, false); + } } } + if (aBrain || amalgam) { 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 range = (float)Main.rand.Next(200 + (int)damage / 2, 301 + (int)damage * 2); - if (range > 500f) - { - range = 500f + (range - 500f) * 0.75f; - } - if (range > 700f) - { - range = 700f + (range - 700f) * 0.5f; - } - if (range > 900f) - { - range = 900f + (range - 900f) * 0.25f; - } - if (npcDist < range) - { - float duration = (float)Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); - npc.AddBuff(BuffID.Confused, (int)duration, false); - if (amalgam) - { - npc.AddBuff(ModContent.BuffType(), (int)duration, false); - npc.AddBuff(ModContent.BuffType(), (int)duration, false); - npc.AddBuff(ModContent.BuffType(), (int)duration, false); - npc.AddBuff(ModContent.BuffType(), (int)duration, false); - } - } + NPC npc = Main.npc[m]; + if (!npc.active || npc.friendly || npc.dontTakeDamage) + continue; + + 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; + if (range > 700f) + range = 700f + (range - 700f) * 0.5f; + if (range > 900f) + range = 900f + (range - 900f) * 0.25f; + + if (npcDist < range) + { + float duration = Main.rand.Next(90 + (int)damage / 3, 300 + (int)damage / 2); + npc.AddBuff(BuffID.Confused, (int)duration, false); + if (amalgam) + { + npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(ModContent.BuffType(), (int)duration); + } + } } - //Spawn the harmless brain images that are actually projectiles - Projectile.NewProjectile(player.Center.X + (float)Main.rand.Next(-40, 40), player.Center.Y - (float)Main.rand.Next(20, 60), player.velocity.X * 0.3f, player.velocity.Y * 0.3f, ProjectileID.BrainOfConfusion, 0, 0f, player.whoAmI, 0f, 0f); + + // 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); } + if (polarisBoost) { polarisBoostCounter = 0; @@ -7770,9 +7632,10 @@ namespace CalamityMod.CalPlayer polarisBoostTwo = false; polarisBoostThree = false; if (player.FindBuffIndex(ModContent.BuffType()) > -1) - { player.ClearBuff(ModContent.BuffType()); } + player.ClearBuff(ModContent.BuffType()); } } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { for (int i = 0; i < Main.maxProjectiles; i++) @@ -7783,6 +7646,7 @@ namespace CalamityMod.CalPlayer break; } } + if (player.wingTime > player.wingTimeMax / 2) player.wingTime = player.wingTimeMax / 2; } @@ -7793,58 +7657,103 @@ namespace CalamityMod.CalPlayer public override void PostHurt(bool pvp, bool quiet, double damage, int hitDirection, bool crit) { if (!profanedCrystal && pArtifact) - { player.AddBuff(ModContent.BuffType(), 300, true); + + // 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; + + // Every hit adds its damage as shattered defense. + int newLostDefense = Math.Min(bloodflareCoreLostDefense + (int)damage, shatterDefenseCap); + + // Suddenly reducing your base defense stat does not let you suddenly reduce your shattered defense cap. + // In other words, you can't ever reduce your lost defense by taking another hit. + if (bloodflareCoreLostDefense < newLostDefense) + bloodflareCoreLostDefense = newLostDefense; + + // Play a sound and make dust to signify that defense has been shattered + Main.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); + d.velocity = dustVel; + d.noGravity = true; + d.scale *= Main.rand.NextFloat(1.1f, 1.4f); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.PiOver2); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 1.5f); + } } + bool hardMode = Main.hardMode; - int iFramesToAdd = 0; if (player.whoAmI == Main.myPlayer) { + int iFramesToAdd = 0; if (cTracers && damage > 200) - { - iFramesToAdd += 60; - } + iFramesToAdd += 30; if (godSlayerThrowing && damage > 80) - { iFramesToAdd += 30; - } if (statigelSet && damage > 100) - { iFramesToAdd += 30; - } + if (dAmulet) { - if (damage == 1.0) - { - iFramesToAdd += 10; - } + if (damage == 1) + iFramesToAdd += 5; else - { - iFramesToAdd += 20; - } + iFramesToAdd += 10; } + if (fabsolVodka) { - if (damage == 1.0) - { + if (damage == 1) iFramesToAdd += 5; - } else - { iFramesToAdd += 10; + } + + if (lastProjectileHit != null) + { + switch (lastProjectileHit.modProjectile.cooldownSlot) + { + case 0: + case 1: + player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; + break; + case -1: + default: + player.immune = true; + player.immuneTime += iFramesToAdd; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] += iFramesToAdd; + break; } } - if (CalamityWorld.bossRushActive && CalamityConfig.Instance.BossRushImmunityFrameCurse) + else { - bossRushImmunityFrameCurseTimer = 300 + player.immuneTime; + player.immune = true; + player.immuneTime += iFramesToAdd; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] += iFramesToAdd; } + + if (BossRushEvent.BossRushActive && CalamityConfig.Instance.BossRushImmunityFrameCurse) + bossRushImmunityFrameCurseTimer = 180 + player.immuneTime; + if (damage > 25) { if (aeroSet) { 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); } } } @@ -7858,35 +7767,33 @@ namespace CalamityMod.CalPlayer int starAmt = aBulwarkRare ? 12 : 5; for (int n = 0; n < starAmt; 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++) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(130 * player.AverageDamage()), 4f, player.whoAmI, 6, 1, 5); + 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; + star.usesLocalNPCImmunity = true; + star.localNPCHitCooldown = 5; + } } - - /*int num = 1; - if (Main.rand.NextBool(3)) - ++num; - if (Main.rand.NextBool(3)) - ++num; - if (player.strongBees && Main.rand.NextBool(3)) - ++num; - for (int index = 0; index < num; ++index) - { - int bee = Projectile.NewProjectile(player.position.X, player.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, player.beeType(), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[bee].usesLocalNPCImmunity = true; - Main.projectile[bee].localNPCHitCooldown = 5; - }*/ } if (theBee) { for (int n = 0; n < 3; n++) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(150 * player.AverageDamage()), 4f, player.whoAmI, 6, 1, 5); + Projectile star = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileID.HallowStar, (int)(150 * player.AverageDamage()), 4f, player.whoAmI); + if (star.whoAmI.WithinBounds(Main.maxProjectiles)) + { + star.Calamity().forceTypeless = true; + star.usesLocalNPCImmunity = true; + star.localNPCHitCooldown = 5; + } } int num = 1; if (Main.rand.NextBool(3)) @@ -7897,10 +7804,12 @@ namespace CalamityMod.CalPlayer ++num; for (int index = 0; index < num; ++index) { - int bee = Projectile.NewProjectile(player.position.X, player.position.Y, (float) Main.rand.Next(-35, 36) * 0.02f, (float) Main.rand.Next(-35, 36) * 0.02f, (Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType()), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); + int bee = Projectile.NewProjectile(player.position.X, player.position.Y, Main.rand.Next(-35, 36) * 0.02f, Main.rand.Next(-35, 36) * 0.02f, Main.rand.NextBool(4) ? ModContent.ProjectileType() : player.beeType(), player.beeDamage(7), player.beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[bee].usesLocalNPCImmunity = true; Main.projectile[bee].localNPCHitCooldown = 5; - } + if (bee.WithinBounds(Main.maxProjectiles)) + Main.projectile[bee].Calamity().forceTypeless = true; + } } } if (fCarapace) @@ -7912,7 +7821,7 @@ namespace CalamityMod.CalPlayer double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int fDamage = (int)(56 * player.AverageDamage()); + int fDamage = (int)(70 * player.AverageDamage()); if (player.whoAmI == Main.myPlayer) { for (int i = 0; i < 4; i++) @@ -7922,8 +7831,8 @@ namespace CalamityMod.CalPlayer 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); - Main.projectile[spore1].timeLeft = 120; - Main.projectile[spore2].timeLeft = 120; + Main.projectile[spore1].timeLeft = 300; + Main.projectile[spore2].timeLeft = 300; } } } @@ -7947,10 +7856,16 @@ namespace CalamityMod.CalPlayer 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); - Main.projectile[spark1].timeLeft = 120; - Main.projectile[spark2].timeLeft = 120; - Main.projectile[spark1].Calamity().forceTypeless = true; - Main.projectile[spark2].Calamity().forceTypeless = true; + if (spark1.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark1].timeLeft = 120; + Main.projectile[spark1].Calamity().forceTypeless = true; + } + if (spark2.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark2].timeLeft = 120; + Main.projectile[spark2].Calamity().forceTypeless = true; + } } } } @@ -7964,8 +7879,10 @@ namespace CalamityMod.CalPlayer 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); - Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, player.whoAmI); - } + 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; + } } } if (blazingCore) @@ -7978,13 +7895,13 @@ namespace CalamityMod.CalPlayer 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)(1690 * player.AverageDamage()), 0f, player.whoAmI, 0f, 0f); + 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 && Main.rand.NextBool(5)) + if (ataxiaBlaze) { if (damage > 0) { @@ -8010,41 +7927,27 @@ namespace CalamityMod.CalPlayer { for (int i = 0; i < 8; i++) { - float randomSpeed = (float)Main.rand.Next(1, 7); - float randomSpeed2 = (float)Main.rand.Next(1, 7); + 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); - Main.projectile[shard].Calamity().forceTypeless = true; - Main.projectile[shard2].Calamity().forceTypeless = true; + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceTypeless = true; + if (shard2.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard2].Calamity().forceTypeless = true; } } } } - else if (reaverSpore) + else if (reaverDefense) //Defense and DR Helm { if (damage > 0) { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 1); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int rDamage = (int)(58 * player.RogueDamage()); //Reaver rogue helm + int rDamage = (int)(80 * 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)); - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int rspore1 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), rDamage, 2f, player.whoAmI, 0f, 0f); - Main.projectile[rspore1].usesLocalNPCImmunity = true; - Main.projectile[rspore1].localNPCHitCooldown = 60; - int rspore2 = Projectile.NewProjectile(spawnPos.X, spawnPos.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), rDamage, 2f, player.whoAmI, 1f, 0f); - Main.projectile[rspore2].usesLocalNPCImmunity = true; - Main.projectile[rspore2].localNPCHitCooldown = 60; - } + Projectile.NewProjectile(player.Center.X, player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), rDamage, 0f, player.whoAmI, 0f, 0f); } } } @@ -8062,55 +7965,38 @@ namespace CalamityMod.CalPlayer 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)(900 * 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)(900 * 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 (godSlayerMage) - { - if (damage > 0) - { - Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 74); - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)((auricSet ? 2400 : 1200) * player.MagicDamage()), 1f, player.whoAmI, 0f, 0f); - } - } - } else if (dsSetBonus) { if (player.whoAmI == Main.myPlayer) { for (int l = 0; l < 2; l++) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, (int)(3000 * player.AverageDamage()), 7f, player.whoAmI, 6, 1); + 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; + beam.usesLocalNPCImmunity = true; + beam.localNPCHitCooldown = 10; + } } for (int l = 0; l < 5; l++) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, (int)(5000 * player.AverageDamage()), 7f, player.whoAmI, 6, 1); + 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; + scythe.usesLocalNPCImmunity = true; + scythe.localNPCHitCooldown = 10; + } } } } - if (lastProjectileHit != null) - { - switch (lastProjectileHit.modProjectile.cooldownSlot) - { - case 0: - case 1: - player.hurtCooldowns[lastProjectileHit.modProjectile.cooldownSlot] += iFramesToAdd; - break; - case -1: - default: - player.immuneTime += iFramesToAdd; - break; - } - } - else - { - player.immuneTime += iFramesToAdd; - } } #endregion @@ -8120,7 +8006,7 @@ namespace CalamityMod.CalPlayer deathCount++; if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { - DeathPacket(false); + SyncDeathCount(false); } player.lastDeathPostion = player.Center; player.lastDeathTime = DateTime.Now; @@ -8229,15 +8115,11 @@ namespace CalamityMod.CalPlayer deathModeBlizzardTime = 0; damageSource = PlayerDeathReason.ByCustomReason(player.name + " was chilled to the bone by the frigid environment."); } - else if (SCalLore) - { - damageSource = PlayerDeathReason.ByCustomReason(player.Male ? player.name + " was consumed by his inner hatred." : player.name + " was consumed by her inner hatred."); - } else if (CalamityWorld.armageddon && areThereAnyDamnBosses) { damageSource = PlayerDeathReason.ByCustomReason(player.name + " failed the challenge at hand."); } - else if (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0) + else if (BossRushEvent.BossRushActive && bossRushImmunityFrameCurseTimer > 0) { damageSource = PlayerDeathReason.ByCustomReason(player.name + " was destroyed by a mysterious force."); } @@ -8254,6 +8136,7 @@ namespace CalamityMod.CalPlayer { Main.NewText(deathText.ToString(), 225, 25, 25, false); } + if (player.whoAmI == Main.myPlayer && player.difficulty == 0) { player.DropCoins(); @@ -8276,232 +8159,244 @@ namespace CalamityMod.CalPlayer #region Dash Stuff public void ModDashMovement() { - if (dashMod == 6 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //cryo lore + 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); for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + 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))) - { - float num = 50f * player.AverageDamage(); - float num2 = 3f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - npc.AddBuff(ModContent.BuffType(), 300); - player.immune = true; - player.immuneNoBlink = true; - if (player.immuneTime < 4) - player.immuneTime = 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + { + float num = 300f * player.AverageDamage(); + float num2 = 15f; + bool crit = false; + if (player.kbGlove) { - player.hurtCooldowns[k] = player.immuneTime; + num2 *= 2f; } - } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + 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; + npc.AddBuff(ModContent.BuffType(), 300); + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } } } } - if (dashMod == 4 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //Asgardian 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); for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + 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))) - { - float num = 500f * player.AverageDamage(); - float num2 = 15f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(300 * player.AverageDamage()), 20f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(200 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - npc.AddBuff(ModContent.BuffType(), 300); - player.immune = true; - player.immuneNoBlink = true; - if (player.immuneTime < 4) - player.immuneTime = 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + { + float num = 250f * player.AverageDamage(); + float num2 = 12f; + bool crit = false; + if (player.kbGlove) { - player.hurtCooldowns[k] = player.immuneTime; + num2 *= 2f; } - } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + 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; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } } } } - if (dashMod == 3 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //Elysian Aegis + 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); for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + 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))) - { - float num = 350f * player.AverageDamage(); - float num2 = 12f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(210 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(140 * player.AverageDamage()), 5f, Main.myPlayer, 0f, 0f); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - player.immune = true; - player.immuneNoBlink = true; - if (player.immuneTime < 4) - player.immuneTime = 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) + { + float num = 100f * player.AverageDamage(); + float num2 = 9f; + bool crit = false; + if (player.kbGlove) { - player.hurtCooldowns[k] = player.immuneTime; + num2 *= 2f; } - } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + 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; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } } } } - 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); - for (int i = 0; i < Main.maxNPCs; i++) - { + 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); + for (int i = 0; i < Main.maxNPCs; i++) + { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) - { - Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) - { - float num = 100f * player.AverageDamage(); - float num2 = 9f; - bool crit = false; - if (player.kbGlove) - { - num2 *= 2f; - } - if (player.kbBuff) - { - num2 *= 1.5f; - } - if (Main.rand.Next(100) < player.meleeCrit) - { - crit = true; - } - int direction = player.direction; - if (player.velocity.X < 0f) - { - direction = -1; - } - if (player.velocity.X > 0f) - { - direction = 1; - } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 15f, Main.myPlayer, 0f, 0f); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[player.whoAmI] = 6; - player.immune = true; - player.immuneNoBlink = true; - if (player.immuneTime < 4) - player.immuneTime = 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) + 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))) + { + float num = 50f * player.AverageDamage(); + float num2 = 3f; + bool crit = false; + if (player.kbGlove) { - player.hurtCooldowns[k] = player.immuneTime; + num2 *= 2f; } - } - } - } - } - if (dashMod == 8 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //plaguebringer armor + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + 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; + npc.AddBuff(ModContent.BuffType(), 60); + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } + } + } + } + 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); for (int i = 0; i < Main.maxNPCs; i++) { - NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] <= 0) + NPC npc = Main.npc[i]; + 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))) @@ -8518,56 +8413,101 @@ namespace CalamityMod.CalPlayer { direction = 1; } - if (player.whoAmI == Main.myPlayer) - { - player.ApplyDamageToNPC(npc, (int)num, num2, direction, crit); - } - if (npc.immune[player.whoAmI] < 6) - npc.immune[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.immune = true; - player.immuneNoBlink = true; - if (player.immuneTime < 4) - player.immuneTime = 4; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } } } } } - if (dashMod == 1 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) //Counter Scarf - { - 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++) - { + 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); + for (int i = 0; i < Main.maxNPCs; i++) + { NPC npc = Main.npc[i]; - if (npc.active && !npc.dontTakeDamage && !npc.friendly && !npc.townNPC && npc.immune[player.whoAmI] <= 0 && npc.damage > 0) - { - Rectangle rect = npc.getRect(); - if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) - { - OnDodge(); - break; - } - } - } - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile proj = Main.projectile[i]; - if (proj.active && !proj.friendly && proj.hostile && proj.damage > 0) - { - Rectangle rect = proj.getRect(); - if (rectangle.Intersects(rect)) - { - OnDodge(); - break; - } - } - } - } - if (player.dashDelay > 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))) + { + Main.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.PurpleCosmolite, 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); + if (Main.rand.NextBool(2)) + dust2.scale *= 1f + Main.rand.Next(40) * 0.01f; + } + + float num = 3000f * player.AverageDamage(); + float num2 = 15f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + 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; + npc.AddBuff(ModContent.BuffType(), 600); + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += 4; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; + } + } + } + } + } + if (player.dashDelay > 0) { return; } @@ -8578,7 +8518,7 @@ namespace CalamityMod.CalPlayer float num9 = Math.Max(player.accRunSpeed, player.maxRunSpeed); float num10 = 0.94f; int delay = 20; - if (dashMod == 1) //Counter Scarf + if (dashMod == 1) // Counter Scarf { for (int k = 0; k < 2; k++) { @@ -8596,7 +8536,7 @@ namespace CalamityMod.CalPlayer Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } } - else if (dashMod == 2) //Asgard's Valor + else if (dashMod == 2) // Asgard's Valor { for (int m = 0; m < 4; m++) { @@ -8611,7 +8551,7 @@ namespace CalamityMod.CalPlayer } } } - else if (dashMod == 3) //Elysian Aegis + else if (dashMod == 3) // Elysian Aegis { for (int m = 0; m < 12; m++) { @@ -8625,9 +8565,9 @@ namespace CalamityMod.CalPlayer Main.dust[num14].fadeIn = 0.5f; } } - num7 = 14f; //14 + num7 = 14f; } - else if (dashMod == 4) //Asgardian Aegis + else if (dashMod == 4) // Asgardian Aegis { for (int m = 0; m < 24; m++) { @@ -8641,9 +8581,9 @@ namespace CalamityMod.CalPlayer Main.dust[num14].fadeIn = 0.5f; } } - num7 = 16f; //14 + num7 = 16f; } - else if (dashMod == 5) //Deep Diver + else if (dashMod == 5) // Deep Diver { for (int m = 0; m < 24; m++) { @@ -8657,28 +8597,27 @@ namespace CalamityMod.CalPlayer Main.dust[num14].fadeIn = 0.5f; } } - num7 = 18f; //14 + num7 = 18f; } - else if (dashMod == 6) //Cryogen Lore + else if (dashMod == 6) // Ornate Shield + { + 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); + 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].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 12.5f; + } + else if (dashMod == 7) // Statis' Belt of Curses { - 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); - 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].noGravity = true; - if (Main.rand.NextBool(2)) - { - Main.dust[num14].fadeIn = 0.5f; - } - } - num7 = 12.5f; //14 - delay = 30; - } - else if (dashMod == 7) //Statis' Belt of Curses - { - statisTimer++; + statisTimer++; for (int k = 0; k < 2; k++) { int num12; @@ -8694,16 +8633,19 @@ namespace CalamityMod.CalPlayer Main.dust[num12].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } - num7 = 14f; //14 - if (statisTimer % 5 == 0) - { - int scythe = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(500 * player.AverageDamage()), 5f, player.whoAmI); - Main.projectile[scythe].Calamity().forceTypeless = true; - Main.projectile[scythe].usesIDStaticNPCImmunity = true; - Main.projectile[scythe].idStaticNPCHitCooldown = 10; - } + num7 = 14f; + if (statisTimer % 5 == 0) + { + 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; + Main.projectile[scythe].usesIDStaticNPCImmunity = true; + Main.projectile[scythe].idStaticNPCHitCooldown = 10; + } + } } - else if (dashMod == 8) //Plaguebringer armor + else if (dashMod == 8) // Plaguebringer Armor { for (int m = 0; m < 24; m++) { @@ -8717,582 +8659,456 @@ namespace CalamityMod.CalPlayer Main.dust[num14].fadeIn = 0.5f; } } - num7 = 12.5f; //14 + num7 = 12.5f; } - if (dashMod > 0) + else if (dashMod == 9) // God Slayer Armor + { + 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.PurpleCosmolite, 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].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 40f; + } + if (dashMod > 0) { player.vortexStealthActive = false; - if (player.velocity.X > num7 || player.velocity.X < -num7) - { - player.velocity.X = player.velocity.X * num8; - return; - } - if (player.velocity.X > num9 || player.velocity.X < -num9) - { - player.velocity.X = player.velocity.X * num10; - return; - } + + if (dashMod == 9) + { + if (player.velocity.Length() > num7) + { + player.velocity *= num8; + return; + } + if (player.velocity.Length() > num9) + { + player.velocity *= num10; + return; + } + } + else + { + if (player.velocity.X > num7 || player.velocity.X < -num7) + { + player.velocity.X *= num8; + return; + } + if (player.velocity.X > num9 || player.velocity.X < -num9) + { + player.velocity.X *= num10; + return; + } + } + player.dashDelay = delay; - if (player.velocity.X < 0f) - { - player.velocity.X = -num9; - return; - } - if (player.velocity.X > 0f) - { - player.velocity.X = num9; - return; - } + + // Cooldown for God Slayer Armor dash + if (dashMod == 9) + { + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f)); + godSlayerDashHotKeyPressed = false; + } + + if (dashMod == 9) + { + if (player.velocity.Length() < 0f) + { + player.velocity.Normalize(); + player.velocity *= -num9; + return; + } + if (player.velocity.Length() > 0f) + { + player.velocity.Normalize(); + player.velocity *= num9; + return; + } + } + else + { + if (player.velocity.X < 0f) + { + player.velocity.X = -num9; + return; + } + if (player.velocity.X > 0f) + { + player.velocity.X = num9; + return; + } + } } } else if (dashMod > 0 && !player.mount.Active) { - float dashDistance; - if (dashMod == 1) //Counter and Evasion Scarf + if (dashMod == 1) // Counter and Evasion Scarf { - dashDistance = evasionScarf ? 16.3f : 14.5f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(evasionScarf ? 16.3f : 15f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 20; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; //eoc dash amount (evasion = asgard's) - Point point = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point2 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num17 = 0; num17 < 20; num17++) - { - int num18 = Dust.NewDust(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num18]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } - return; } } - else if (dashMod == 2) //Asgard's Valor + else if (dashMod == 2) // Asgard's Valor { - dashDistance = 16.9f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(16.9f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 20; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; //tabi dash amount - Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 20; num24++) - { - int num25 = Dust.NewDust(player.position, player.width, player.height, 246, 0f, 0f, 100, default, 3f); - Dust dust = Main.dust[num25]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); dust.noGravity = true; dust.fadeIn = 0.5f; } } } - else if (dashMod == 3) //Elysian Aegis + else if (dashMod == 3) // Elysian Aegis { - dashDistance = 21.9f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(21.5f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 40; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; //solar dash amount - Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 40; num24++) - { - int num25 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Dust dust = Main.dust[num25]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); dust.noGravity = true; dust.fadeIn = 0.5f; } } } - else if (dashMod == 4) //Asgardian Aegis + else if (dashMod == 4) // Asgardian Aegis { - dashDistance = 23.9f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(23.3f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 60; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; //slighty more powerful solar dash - Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Dust dust = Main.dust[num25]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); dust.noGravity = true; dust.fadeIn = 0.5f; } } } - else if (dashMod == 5) //Deep Diver + else if (dashMod == 5) // Deep Diver { - dashDistance = 25.9f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(25.9f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 60; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; - Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(player.position, player.width, player.height, 33, 0f, 0f, 100, default, 3f); - Dust dust = Main.dust[num25]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); dust.noGravity = true; dust.fadeIn = 0.5f; } } } - else if (dashMod == 6) //Cryogen Lore + else if (dashMod == 6) // Ornate Shield + { + if (DoADash(16.9f)) + { + for (int d = 0; d < 60; d++) + { + 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.noGravity = true; + dust.fadeIn = 0.5f; + } + } + } + else if (dashMod == 7) // Statis' Belt of Curses { - dashDistance = 15.7f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(25.4f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 20; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; - Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num25]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); - dust.noGravity = true; - dust.fadeIn = 0.5f; - } - } - } - else if (dashMod == 7) //Statis' Belt of Curses - { - dashDistance = 21.9f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) - { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) - { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; //solar dash amount - Point point = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point2 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y) || WorldGen.SolidOrSlopedTile(point2.X, point2.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num17 = 0; num17 < 20; num17++) - { - int num18 = Dust.NewDust(player.position, player.width, player.height, 70, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num18]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); - dust.velocity *= 0.2f; - dust.scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } - return; } } - else if (dashMod == 8) //Plaguebringer armor + else if (dashMod == 8) // Plaguebringer armor { - dashDistance = 19f; - int direction = 0; - bool justDashed = false; - if (dashTimeMod > 0) + if (DoADash(19f)) { - dashTimeMod--; - } - if (dashTimeMod < 0) - { - dashTimeMod++; - } - if (player.controlRight && player.releaseRight) - { - if (dashTimeMod > 0) + for (int d = 0; d < 60; d++) { - direction = 1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = 15; - } - } - else if (player.controlLeft && player.releaseLeft) - { - if (dashTimeMod < 0) - { - direction = -1; - justDashed = true; - dashTimeMod = 0; - } - else - { - dashTimeMod = -15; - } - } - if (justDashed) - { - player.velocity.X = dashDistance * (float)direction; - Point point5 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), player.gravDir * (float)-(float)player.height / 2f + player.gravDir * 2f)).ToTileCoordinates(); - Point point6 = (player.Center + new Vector2((float)(direction * player.width / 2 + 2), 0f)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) - { - player.velocity.X = player.velocity.X / 2f; - } - player.dashDelay = -1; - for (int num24 = 0; num24 < 60; num24++) - { - int num25 = Dust.NewDust(player.position, player.width, player.height, 89, 0f, 0f, 100, default, 1.25f); - Dust dust = Main.dust[num25]; - dust.position.X += (float)Main.rand.Next(-5, 6); - dust.position.Y += (float)Main.rand.Next(-5, 6); + 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 *= 1f + (float)Main.rand.Next(20) * 0.01f; + dust.scale *= Main.rand.NextFloat(1f, 1.2f); dust.shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); dust.noGravity = true; dust.fadeIn = 0.5f; } } } - } + else if (dashMod == 9) // God Slayer Armor + { + if (DoADash(80f)) + { + Main.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.PurpleCosmolite, 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.noGravity = true; + dust.fadeIn = 0.5f; + } + } + } + } } - private void OnDodge() + private bool DoADash(float dashDistance) { - if (player.whoAmI == Main.myPlayer && dodgeScarf && !scarfCooldown && !eScarfCooldown) + bool godSlayerDash = dashMod == 9; + bool justDashed = false; + int direction = 0; + + if (dashTimeMod > 0) + dashTimeMod--; + if (dashTimeMod < 0) + dashTimeMod++; + + if (godSlayerDash) + { + if (player.controlUp && player.controlLeft) + { + if (dashTimeMod < 0) + { + direction = -4; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = -15; + } + else if (player.controlUp && player.controlRight) + { + if (dashTimeMod > 0) + { + direction = 4; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = 15; + } + else if (player.controlDown && player.controlLeft) + { + if (dashTimeMod < 0) + { + direction = -3; + justDashed = true; + dashTimeMod = 0; + player.maxFallSpeed = 50f; + } + else + dashTimeMod = -15; + } + else if (player.controlDown && player.controlRight) + { + if (dashTimeMod > 0) + { + direction = 3; + justDashed = true; + dashTimeMod = 0; + player.maxFallSpeed = 50f; + } + else + dashTimeMod = 15; + } + else if (player.controlUp) + { + if (dashTimeMod < 0) + { + direction = -2; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = -15; + } + else if (player.controlDown) + { + if (dashTimeMod > 0) + { + direction = 2; + justDashed = true; + dashTimeMod = 0; + player.maxFallSpeed = 50f; + } + else + dashTimeMod = 15; + } + else if (player.controlLeft) + { + if (dashTimeMod < 0) + { + direction = -1; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = -15; + } + else if (player.controlRight) + { + if (dashTimeMod > 0) + { + direction = 1; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = 15; + } + } + else + { + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + direction = 1; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = 15; + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + direction = -1; + justDashed = true; + dashTimeMod = 0; + } + else + dashTimeMod = -15; + } + } + + if (justDashed) { - if (evasionScarf) + int totalDirections = 8; + float radians = MathHelper.TwoPi / totalDirections; + Vector2 spinningPoint = new Vector2(0f, -dashDistance); + Vector2[] possibleVelocities = new Vector2[totalDirections]; + for (int k = 0; k < totalDirections; k++) + possibleVelocities[k] = spinningPoint.RotatedBy(radians * k); + + switch (direction) { - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(9f)); - player.AddBuff(ModContent.BuffType(), player.chaosState ? CalamityUtils.SecondsToFrames(20f) : CalamityUtils.SecondsToFrames(13f)); + // Up Left + case -4: + player.velocity = possibleVelocities[7]; + break; + + // Down Left + case -3: + player.velocity = possibleVelocities[5]; + break; + + // Up + case -2: + player.velocity = possibleVelocities[0]; + break; + + // Left + case -1: + player.velocity = godSlayerDash ? possibleVelocities[6] : new Vector2(possibleVelocities[6].X, player.velocity.Y); + break; + + // Nothing + case 0: + break; + + // Right + case 1: + player.velocity = godSlayerDash ? possibleVelocities[2] : new Vector2(possibleVelocities[2].X, player.velocity.Y); + break; + + // Down + case 2: + player.velocity = possibleVelocities[4]; + break; + + // Down Right + case 3: + player.velocity = possibleVelocities[3]; + break; + + // Up Right + case 4: + player.velocity = possibleVelocities[1]; + break; } - else - { - player.AddBuff(ModContent.BuffType(), 540); - player.AddBuff(ModContent.BuffType(), player.chaosState ? 1800 : 900); - } - player.immune = true; - player.immuneTime = player.longInvince ? 100 : 60; - for (int k = 0; k < player.hurtCooldowns.Length; k++) - { - player.hurtCooldowns[k] = player.immuneTime; - } - for (int j = 0; j < 100; j++) - { - int num = Dust.NewDust(player.position, player.width, player.height, 235, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num]; - dust.position.X += (float)Main.rand.Next(-20, 21); - dust.position.Y += (float)Main.rand.Next(-20, 21); - dust.velocity *= 0.4f; - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cWaist, player); - if (Main.rand.NextBool(2)) - { - dust.scale *= 1f + (float)Main.rand.Next(40) * 0.01f; - dust.noGravity = true; - } - } - if (player.whoAmI == Main.myPlayer) - { - NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); - } + + 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.dashDelay = -1; } + + return justDashed; } public void ModHorizontalMovement() @@ -9307,7 +9123,7 @@ namespace CalamityMod.CalPlayer { num3 -= player.height; } - if (dashMod == 1) + 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); Main.dust[num7].velocity.X *= 0.2f; @@ -9363,7 +9179,14 @@ namespace CalamityMod.CalPlayer Main.dust[num7].velocity.Y *= 0.2f; 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.PurpleCosmolite, -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); + } + } } else if (player.controlRight && player.velocity.X < player.accRunSpeed && player.dashDelay >= 0) { @@ -9374,7 +9197,7 @@ namespace CalamityMod.CalPlayer { num8 -= player.height; } - if (dashMod == 1) + 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); Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; @@ -9402,7 +9225,7 @@ namespace CalamityMod.CalPlayer Main.dust[num12].velocity.Y *= 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } - else if (dashMod == 5) + 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); Main.dust[num12].velocity.X *= 0.2f; @@ -9430,7 +9253,14 @@ namespace CalamityMod.CalPlayer Main.dust[num12].velocity.Y *= 0.2f; 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.PurpleCosmolite, -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); + } + } } if (player.mount.Active && player.mount.Type == ModContent.MountType() && Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f) @@ -9444,9 +9274,9 @@ namespace CalamityMod.CalPlayer rect.Inflate(6, 12); float damage = 800f * player.MinionDamage(); float knockback = 10f; - int nPCImmuneTime = 30; + int NPCImmuneTime = 30; int playerImmuneTime = 6; - ModCollideWithNPCs(rect, damage, knockback, nPCImmuneTime, playerImmuneTime); + ModCollideWithNPCs(rect, damage, knockback, NPCImmuneTime, playerImmuneTime); } if (player.mount.Active && player.mount.Type == ModContent.MountType() && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) @@ -9460,9 +9290,9 @@ namespace CalamityMod.CalPlayer rect2.Inflate(6, 12); float damage2 = 50f * player.MinionDamage(); float knockback2 = 8f; - int nPCImmuneTime2 = 30; - int playerImmuneTime2 = 6; - ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); + 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) @@ -9476,9 +9306,9 @@ namespace CalamityMod.CalPlayer rect2.Inflate(6, 12); float damage2 = 25f * player.MinionDamage(); float knockback2 = 5f; - int nPCImmuneTime2 = 30; - int playerImmuneTime2 = 6; - ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); + int NPCImmuneTime = 30; + int playerImmuneTime = 6; + ModCollideWithNPCs(rect2, damage2, knockback2, NPCImmuneTime, playerImmuneTime); } } @@ -9488,7 +9318,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.immune[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))) @@ -9506,10 +9336,21 @@ namespace CalamityMod.CalPlayer { player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); } - nPC.immune[player.whoAmI] = NPCImmuneTime; - player.immune = true; - player.immuneNoBlink = true; - player.immuneTime = PlayerImmuneTime; + nPC.Calamity().dashImmunityTime[player.whoAmI] = NPCImmuneTime; + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) + { + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime += PlayerImmuneTime; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + player.hurtCooldowns[j] = player.immuneTime; + } num++; break; } @@ -9519,1284 +9360,10 @@ namespace CalamityMod.CalPlayer } #endregion - #region Drawing - public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - { - return; - } - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (modPlayer.sirenIce) - { - Texture2D texture = ModContent.GetTexture("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); //4 - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Cyan, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); - Main.playerDrawData.Add(data); - } - if (modPlayer.amidiasBlessing) - { - Texture2D texture = ModContent.GetTexture("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, new Vector2(texture.Width / 2f, texture.Height / 2f), 1f, SpriteEffects.None, 0); - Main.playerDrawData.Add(data); - } - }); - - public static readonly PlayerLayer MiscEffects = new PlayerLayer("CalamityMod", "MiscEffects", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - return; - Player drawPlayer = drawInfo.drawPlayer; - Item item = drawPlayer.ActiveItem(); - - // Kamei trail/afterimage effect. - if (drawPlayer.Calamity().kamiBoost) - { - for (int i = drawPlayer.Calamity().KameiOldPositions.Length - 1; i > 0; i--) - { - if (drawPlayer.Calamity().KameiOldPositions[i - 1] == Vector2.Zero) - drawPlayer.Calamity().KameiOldPositions[i - 1] = drawPlayer.position; - drawPlayer.Calamity().KameiOldPositions[i] = drawPlayer.Calamity().KameiOldPositions[i - 1]; - } - drawPlayer.Calamity().KameiOldPositions[0] = drawPlayer.position; - - List existingDrawData = Main.playerDrawData; - for (int i = 0; i < drawPlayer.Calamity().KameiOldPositions.Length; i++) - { - float scale = MathHelper.Lerp(1f, 0.5f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); - float opacity = MathHelper.Lerp(0.25f, 0.08f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); - List afterimage = new List(); - for (int j = 0; j < existingDrawData.Count; j++) - { - var drawData = existingDrawData[j]; - drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; - drawData.color = Color.Cyan * opacity; - drawData.color.G = (byte)(drawData.color.G * 1.6); - drawData.color.B = (byte)(drawData.color.B * 1.2); - drawData.scale = new Vector2(scale); - afterimage.Add(drawData); - } - Main.playerDrawData.InsertRange(0, afterimage); - } - } - - if (!drawPlayer.frozen && - item.type > ItemID.None && - !drawPlayer.dead && - !item.noUseGraphic && - (!drawPlayer.wet || !item.noWet)) - { - Vector2 vector = drawPlayer.position + (drawPlayer.itemLocation - drawPlayer.position); - SpriteEffects effect = SpriteEffects.FlipHorizontally; - - if (drawPlayer.gravDir == 1f) - { - if (drawPlayer.direction == 1) - effect = SpriteEffects.None; - else - effect = SpriteEffects.FlipHorizontally; - } - else - { - if (drawPlayer.direction == 1) - effect = SpriteEffects.FlipVertically; - else - effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; - } - if ((drawPlayer.itemAnimation > 0 && item.useStyle != 0) || (item.holdStyle > 0 && !drawPlayer.pulley)) - { - // Staff - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || (item.type == ModContent.ItemType() && item.useStyle == 5)) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); - if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/VesuviusGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); - - float num104 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; - int num105 = 0; - Vector2 zero3 = new Vector2(0f, (float)Main.itemTexture[item.type].Height); - - if (drawPlayer.gravDir == -1f) - { - if (drawPlayer.direction == -1) - { - num104 += 1.57f; - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, 0f); - num105 -= Main.itemTexture[item.type].Width; - } - else - { - num104 -= 1.57f; - zero3 = Vector2.Zero; - } - } - else if (drawPlayer.direction == -1) - { - zero3 = new Vector2((float)Main.itemTexture[item.type].Width, (float)Main.itemTexture[item.type].Height); - num105 -= Main.itemTexture[item.type].Width; - } - - DrawData data = new DrawData(texture, - new Vector2((float)(int)(vector.X - Main.screenPosition.X + zero3.X + (float)num105), (float)(int)(vector.Y - Main.screenPosition.Y + 0f)), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - num104, - zero3, - item.scale, - effect, - 0); - - Main.playerDrawData.Add(data); - } - - // Bow and Book - else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); - int offsetX = 10; - if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"); - offsetX = 6; - } - else if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"); - offsetX = 37; - } - else if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); - offsetX = 9; - } - else if (item.type == ModContent.ItemType()) - { - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); - offsetX = 44; - } - - Vector2 vector13 = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / 2)); - Vector2 vector14 = vector13; - int num107 = (int)vector14.X - offsetX; - vector13.Y = vector14.Y; - - Vector2 origin4 = new Vector2(-(float)num107, (float)(Main.itemTexture[item.type].Height / 2)); - if (drawPlayer.direction == -1) - origin4 = new Vector2((float)(Main.itemTexture[item.type].Width + num107), (float)(Main.itemTexture[item.type].Height / 2)); - - DrawData data = new DrawData(texture, - new Vector2((float)(int)(vector.X - Main.screenPosition.X + vector13.X), (float)(int)(vector.Y - Main.screenPosition.Y + vector13.Y)), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - origin4, - item.scale, - effect, - 0); - - Main.playerDrawData.Add(data); - } - - // Sword - else if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || - item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || (item.type == ModContent.ItemType() && item.useStyle == 1)) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); - if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); - else if (item.type == ModContent.ItemType()) - texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); - - float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[item.type].Height; - - DrawData data = new DrawData(texture, - new Vector2((float)(int)(vector.X - Main.screenPosition.X), (float)(int)(vector.Y - Main.screenPosition.Y)), - new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), - Color.White, - drawPlayer.itemRotation, - new Vector2((float)Main.itemTexture[item.type].Width * 0.5f - (float)Main.itemTexture[item.type].Width * 0.5f * (float)drawPlayer.direction, yOffset) + Vector2.Zero, - item.scale, - effect, - 0); - - Main.playerDrawData.Add(data); - } - } - } - }); - - public static readonly PlayerLayer DyeInvisibilityFix = new PlayerLayer("CalamityMod", "DyeInvisibilityFix", PlayerLayer.Arms, (PlayerDrawInfo drawInfo) => - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (!drawPlayer.invis || - drawPlayer.itemAnimation > 0) - { - return; - } - for (int i = 0; i < Main.playerDrawData.Count; i++) - { - var copy = Main.playerDrawData[i]; - copy.shader = 0; // There's no other easy solution here to my knowledge since DrawData is a value type. - Main.playerDrawData[i] = copy; - } - }); - - public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) - { - if (drawInfo.shadow != 0f) - return; - - Player drawPlayer = drawInfo.drawPlayer; - Item item = drawPlayer.ActiveItem(); - - if (!drawPlayer.frozen && - (item.IsAir || item.type > ItemID.None) && - !drawPlayer.dead && - (!drawPlayer.wet || !item.noWet)) - { - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - { - Color color89 = drawInfo.middleArmorColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawPlayer.position.X + drawPlayer.width * 0.5) / 16, (int)(drawPlayer.position.Y + drawPlayer.height * 0.5) / 16, Color.White), drawInfo.shadow); - SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - Texture2D thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_FlurrystormCannon"); - if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BlightSpewer"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BrimstoneFlameblaster"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HavocsBreath"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_BloodBoiler"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_SparkSpreader"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_HalleysInferno"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_CleansingBlaze"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_ElementalEruption"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TheEmpyrean"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Meowthrower"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_OverloadedBlaster"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_TerraFlameburster"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Photoviscerator"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_Shadethrower"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_PristineFury"); - else if (item.type == ModContent.ItemType()) - thingToDraw = ModContent.GetTexture("CalamityMod/ExtraTextures/Tanks/Backpack_AuroraBlazer"); - - float num25 = -4f; - float num24 = -8f; - DrawData howDoIDrawThings = new DrawData(thingToDraw, - new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)), - new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), - color89, - drawPlayer.bodyRotation, - new Vector2(thingToDraw.Width / 2, thingToDraw.Height / 2), - 1f, - spriteEffects, - 0); - howDoIDrawThings.shader = 0; - Main.playerDrawData.Add(howDoIDrawThings); - } - else if (drawPlayer.Calamity().plaguebringerCarapace) - { - Color color89 = drawInfo.middleArmorColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawPlayer.position.X + drawPlayer.width * 0.5) / 16, (int)(drawPlayer.position.Y + drawPlayer.height * 0.5) / 16, Color.White), drawInfo.shadow); - SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - Texture2D thingToDraw = ModContent.GetTexture("CalamityMod/Items/Armor/PlaguebringerCarapace_Back"); - float num25 = -4f; - float num24 = -8f; - DrawData howDoIDrawThings = new DrawData(thingToDraw, - new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)), - new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), - color89, - drawPlayer.bodyRotation, - new Vector2(thingToDraw.Width / 2, thingToDraw.Height / 2), - 1f, - spriteEffects, - 0); - howDoIDrawThings.shader = 0; - Main.playerDrawData.Add(howDoIDrawThings); - } - } - } - public static readonly List MoonlightDyeDayColors = new List() - { - new Color(255, 163, 56), - new Color(235, 30, 19), - new Color(242, 48, 187), - }; - public static readonly List MoonlightDyeNightColors = new List() - { - new Color(24, 134, 198), - new Color(130, 40, 150), - new Color(40, 64, 150), - }; - - public static void DetermineMoonlightDyeColors(out Color drawColor, Color dayColor, Color nightColor) - { - int totalTime = Main.dayTime ? 54000 : 32400; - float transitionTime = 5400; - //Color dayColor = new Color(255, 163, 56); - //Color nightColor = new Color(24, 134, 198); - float interval = Utils.InverseLerp(0f, transitionTime, (float)Main.time, true) + Utils.InverseLerp(totalTime - transitionTime, totalTime, (float)Main.time, true); - if (Main.dayTime) - { - // Dusk. - if (Main.time >= totalTime - transitionTime) - drawColor = Color.Lerp(dayColor, nightColor, Utils.InverseLerp(totalTime - transitionTime, totalTime, (float)Main.time, true)); - // Dawn. - else if (Main.time <= transitionTime) - drawColor = Color.Lerp(nightColor, dayColor, interval); - else - drawColor = dayColor; - } - else - { - drawColor = nightColor; - } - } - public static Color GetCurrentMoonlightDyeColor(float angleOffset = 0f) - { - float interval = (float)Math.Cos(Main.GlobalTime * 0.6f + angleOffset) * 0.5f + 0.5f; - interval = MathHelper.Clamp(interval, 0f, 0.995f); - Color dayColorToUse = CalamityUtils.MulticolorLerp(interval, MoonlightDyeDayColors.ToArray()); - Color nightColorToUse = CalamityUtils.MulticolorLerp(interval, MoonlightDyeNightColors.ToArray()); - DetermineMoonlightDyeColors(out Color drawColor, dayColorToUse, nightColorToUse); - return drawColor; - } - - public override void PreUpdate() - { - tailFrameUp++; - if (tailFrameUp == 8) - { - tailFrame++; - if (tailFrame >= 4) - { - tailFrame = 0; - } - tailFrameUp = 0; - } - - int frameAmt = 11; - if (roverFrameCounter >= 7) - { - roverFrameCounter = -1; - roverFrame = roverFrame == frameAmt - 1 ? 0 : roverFrame + 1; - } - roverFrameCounter++; - - for (int i = 0; i < player.dye.Length; i++) - { - if (player.dye[i].type == ModContent.ItemType()) - { - GameShaders.Armor.GetSecondaryShader(player.dye[i].dye, player)?.UseColor(GetCurrentMoonlightDyeColor()); - } - } - } - - public static readonly PlayerLayer Tail = new PlayerLayer("CalamityMod", "Tail", PlayerLayer.BackAcc, delegate (PlayerDrawInfo drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (drawInfo.shadow != 0f || drawPlayer.dead) - { - return; - } - Rectangle? frame = new Rectangle(0, (int)(modPlayer.tailFrame * 56), 46, 56); - if (modPlayer.fathomSwarmerTail) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Armor/FathomSwarmerArmor_Tail"); - - int frameSize = texture.Height / 4; - int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X - (3 * drawPlayer.direction)); - int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), frame, - Lighting.GetColor((int)((drawInfo.position.X + drawPlayer.width / 2f) / 16f), - (int)((drawInfo.position.Y + drawPlayer.height / 2f) / 16f)), - 0f, new Vector2(texture.Width / 2f, frameSize / 2f), 1f, - drawInfo.spriteEffects, 0); - Main.playerDrawData.Add(data); - } - }); - - public static readonly PlayerLayer ForbiddenCircletSign = new PlayerLayer("CalamityMod", "ForbiddenSigil", PlayerLayer.BackAcc, delegate (PlayerDrawInfo drawInfo) - { - DrawData drawData = new DrawData(); - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (drawInfo.shadow != 0f || drawPlayer.dead || !modPlayer.forbiddenCirclet) - { - return; - } - SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; - if (drawPlayer.gravDir == 1f) - { - if (drawPlayer.direction == 1) - { - spriteEffects = SpriteEffects.None; - } - else - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - } - else - { - if (drawPlayer.direction == 1) - { - spriteEffects = SpriteEffects.FlipVertically; - } - else - { - spriteEffects = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; - } - } - int dyeShader = 0; - if (drawPlayer.dye[1] != null) - dyeShader = (int)drawPlayer.dye[1].dye; - Microsoft.Xna.Framework.Color color12 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)drawInfo.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawInfo.position.Y + (double)drawPlayer.height * 0.5) / 16, Microsoft.Xna.Framework.Color.White), drawInfo.shadow); - Microsoft.Xna.Framework.Color color19 = Microsoft.Xna.Framework.Color.Lerp(color12, Microsoft.Xna.Framework.Color.White, 0.7f); - Texture2D texture = Main.extraTexture[ExtrasID.ForbiddenSign]; - Texture2D glowmask = Main.glowMaskTexture[GlowMaskID.ForbiddenSign]; - int num24 = (int)(((float)((double)drawPlayer.miscCounter / 300 * MathHelper.TwoPi)).ToRotationVector2().Y * 6f); - float num25 = ((float)((double) drawPlayer.miscCounter / 75.0 * MathHelper.TwoPi)).ToRotationVector2().X * 4f; - Microsoft.Xna.Framework.Color color20 = new Microsoft.Xna.Framework.Color(80, 70, 40, 0) * (float) ((double) num25 / 8.0 + 0.5) * 0.8f; - Vector2 position = new Vector2((float)((double)drawInfo.position.X - (double)Main.screenPosition.X - (double)(drawPlayer.bodyFrame.Width / 2) + (double)(drawPlayer.width / 2)), (float)((double)drawInfo.position.Y - (double)Main.screenPosition.Y + (double)drawPlayer.height - (double)drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)) + new Vector2((float)(-drawPlayer.direction * 10), (float)(num24 - 20)); - drawData = new DrawData(texture, position, new Microsoft.Xna.Framework.Rectangle?(), color19, drawPlayer.bodyRotation, texture.Size() / 2f, 1f, spriteEffects, 0); - drawData.shader = dyeShader; - Main.playerDrawData.Add(drawData); - for (float num26 = 0.0f; num26 < 4f; ++num26) - { - drawData = new DrawData(glowmask, position + (num26 * MathHelper.PiOver2).ToRotationVector2() * num25, new Microsoft.Xna.Framework.Rectangle?(), color20, drawPlayer.bodyRotation, texture.Size() / 2f, 1f, spriteEffects, 0); - Main.playerDrawData.Add(drawData); - } - }); - - public static readonly PlayerLayer Skin = new PlayerLayer("CalamityMod", "Skin", PlayerLayer.Skin, delegate (PlayerDrawInfo drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (drawInfo.shadow != 0f || drawPlayer.dead) - { - return; - } - }); - - public static readonly PlayerLayer ColdDivinityOverlay = new PlayerLayer("CalamityMod", "ColdDivinity", PlayerLayer.Skin, (drawInfo) => - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (modPlayer.coldDivinity) - { - Texture2D texture = ModContent.GetTexture("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); //4 - DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, new Color(53, Main.DiscoG, 255) * 0.5f, 0f, new Vector2(texture.Width / 2f, texture.Height / 2f), 1.15f, drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - Main.playerDrawData.Add(data); - } - }); - - public static readonly PlayerLayer RoverDriveShield = new PlayerLayer("CalamityMod", "RoverDrive", PlayerLayer.Skin, (drawInfo) => - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (modPlayer.roverDriveTimer < 616 && modPlayer.roverDrive && !drawPlayer.dead) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/RoverAccShield"); - int frameAmt = 11; - int height = texture.Height / frameAmt; - int frameHeight = height * modPlayer.roverFrame; - Vector2 drawPos = drawPlayer.Center - Main.screenPosition + new Vector2(0f, drawPlayer.gfxOffY); - Rectangle frame = new Rectangle(0, frameHeight, texture.Width, height); - Color color = Color.White * 0.625f; - Vector2 origin = new Vector2(texture.Width / 2f, height / 2f); - float scale = 1f + (float)Math.Cos(Main.GlobalTime) * 0.1f; - SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - DrawData data = new DrawData(texture, drawPos, frame, color, 0f, origin, scale, spriteEffects, 0); - Main.playerDrawData.Add(data); - } - }); - - public static readonly PlayerLayer StratusSphereDrawing = new PlayerLayer("CalamityMod", "StratusSphereDrawing", PlayerLayer.HeldProjFront, (drawInfo) => - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawPlayer.inventory[drawPlayer.selectedItem].type == ModContent.ItemType()) - { - SpriteEffects effect = SpriteEffects.FlipHorizontally; - if (drawPlayer.gravDir == 1f) - { - if (drawPlayer.direction == 1) - { - effect = SpriteEffects.None; - } - else - { - effect = SpriteEffects.FlipHorizontally; - } - } - else - { - if (drawPlayer.direction == 1) - { - effect = SpriteEffects.FlipVertically; - } - else - { - effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; - } - } - Vector2 itemDrawPosition = drawPlayer.Center; - Texture2D drawTexture = ModContent.GetTexture("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; - Main.playerDrawData.Add(new DrawData(drawTexture, - (itemDrawPosition - Main.screenPosition + drawOffset).Floor(), - new Rectangle?(rectangle), - Color.White, - drawPlayer.itemRotation, - origin, - drawPlayer.inventory[drawPlayer.selectedItem].scale, - effect, - 0)); - drawTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/StratusSphereHoldGlow"); - Main.playerDrawData.Add(new DrawData(drawTexture, - (itemDrawPosition - Main.screenPosition + drawOffset).Floor(), - new Rectangle?(rectangle), - Color.White, - drawPlayer.itemRotation, - origin, - drawPlayer.inventory[drawPlayer.selectedItem].scale, - effect, - 0)); - } - }); - - public static readonly PlayerLayer IbanDevRobot = new PlayerLayer("CalamityMod", "IbanDevRobot", PlayerLayer.Body, (drawInfo) => - { - Player drawPlayer = drawInfo.drawPlayer; - if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.Inactive) - return; - Main.playerDrawData.Clear(); - int robot = -1; - for (int i = 0; i < Main.projectile.Length; i++) - { - if (Main.projectile[i].active && - Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == drawPlayer.whoAmI) - { - robot = i; - break; - } - } - if (robot == -1) - { - drawPlayer.Calamity().andromedaState = AndromedaPlayerState.Inactive; - return; - } - - GiantIbanRobotOfDoom robotEntityInstance = (GiantIbanRobotOfDoom)Main.projectile[robot].modProjectile; - if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) - { - Texture2D dashTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AndromedaBolt"); - Rectangle frame = dashTexture.Frame(1, 4, 0, robotEntityInstance.RightIconCooldown / 4 % 4); - - DrawData drawData = new DrawData(dashTexture, - drawPlayer.Center + new Vector2(0f, -8f) - Main.screenPosition, - frame, - Color.White, - Main.projectile[robot].rotation, - drawPlayer.Size / 2, - 1f, - Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, - 1); - drawData.shader = drawPlayer.cBody; - - Main.playerDrawData.Add(drawData); - } - else if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) - { - Texture2D robotTexture = ModContent.GetTexture(robotEntityInstance.Texture); - Rectangle frame = new Rectangle(robotEntityInstance.FrameX * robotTexture.Width / 3, robotEntityInstance.FrameY * robotTexture.Height / 7, - robotTexture.Width / 3, robotTexture.Height / 7); - - DrawData drawData = new DrawData(ModContent.GetTexture(Main.projectile[robot].modProjectile.Texture), - Main.projectile[robot].Center + Vector2.UnitY * 6f - Main.screenPosition, - frame, - Color.White, - Main.projectile[robot].rotation, - Main.projectile[robot].Size / 2, - 1f, - Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, - 1); - drawData.shader = drawPlayer.cBody; - - Main.playerDrawData.Add(drawData); - } - else - { - Texture2D robotTexture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/AndromedaSmall"); - Rectangle frame = new Rectangle(0, robotEntityInstance.CurrentFrame * 54, robotTexture.Width, robotTexture.Height / 21); - DrawData drawData = new DrawData(robotTexture, - drawPlayer.Center + new Vector2(drawPlayer.direction == 1 ? -24 : -10, -8f) - Main.screenPosition, - frame, - Color.White, - 0f, - drawPlayer.Size / 2, - 1f, - Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, - 1); - drawData.shader = drawPlayer.cBody; - - Main.playerDrawData.Add(drawData); - } - }); - - public static readonly PlayerLayer ProfanedMoonlightDyeEffects = new PlayerLayer("CalamityMod", "ProfanedMoonlight", PlayerLayer.Body, (drawInfo) => - { - Player drawPlayer = drawInfo.drawPlayer; - int totalMoonlightDyes = drawPlayer.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); - if (totalMoonlightDyes <= 0) - return; - float auroraCount = 12 + (int)MathHelper.Clamp(totalMoonlightDyes, 0f, 4f) * 2; - float opacity = MathHelper.Clamp(totalMoonlightDyes / 3f, 0f, 1f); - - if (Main.dayTime) - opacity *= 0.4f; - else - opacity *= 0.25f; - - float time01 = Main.GlobalTime % 3f / 3f; - Texture2D auroraTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AuroraTexture"); - for (int i = 0; i < auroraCount; i++) - { - float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; - float timeOffset = (float)Math.Sin(time01 * MathHelper.TwoPi + incrementOffsetAngle * 2f); - float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; - float yOffset = (float)Math.Sin(time01 * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; - Color color = GetCurrentMoonlightDyeColor(incrementOffsetAngle); - Vector2 offset = new Vector2(20f * timeOffset, yOffset - 14f); - DrawData drawData = new DrawData(auroraTexture, - drawPlayer.Top + offset - Main.screenPosition, - null, - color * opacity, - rotation + MathHelper.PiOver2, - auroraTexture.Size() * 0.5f, - 0.135f, - SpriteEffects.None, - 1); - - Main.playerDrawData.Add(drawData); - } - }); - - public override void ModifyDrawLayers(List list) - { - MiscEffectsBack.visible = true; - list.Insert(0, MiscEffectsBack); - Skin.visible = true; - list.Insert(list.IndexOf(PlayerLayer.Skin) + 1, Skin); - MiscEffects.visible = true; - list.Add(MiscEffects); - - if (CalamityMod.legOverrideList.Contains(player.legs)) - list[list.IndexOf(PlayerLayer.ShoeAcc)].visible = false; - if (fab || crysthamyr || onyxExcavator) - { - AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); - } - - if (fathomSwarmerTail) - { - int legsIndex = list.IndexOf(PlayerLayer.Skin); - list.Insert(legsIndex - 1, Tail); - } - if (forbiddenCirclet) - { - int drawTheStupidSign = list.IndexOf(PlayerLayer.Skin); - list.Insert(drawTheStupidSign, ForbiddenCircletSign); - } - list.Add(ColdDivinityOverlay); - list.Add(RoverDriveShield); - list.Add(StratusSphereDrawing); - list.Add(ProfanedMoonlightDyeEffects); - list.Add(IbanDevRobot); - list.Add(DyeInvisibilityFix); - } - - public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo drawInfo) - { - Player drawPlayer = drawInfo.drawPlayer; - CalamityPlayer modPlayer = drawPlayer.Calamity(); - if (drawPlayer.mount != null && (modPlayer.fab || modPlayer.crysthamyr || - modPlayer.onyxExcavator)) - { - drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, drawInfo.position, drawInfo.mountColor, drawInfo.spriteEffects, drawInfo.shadow); - } - }); - - public static void AddPlayerLayer(List list, PlayerLayer layer, PlayerLayer parent, bool first) - { - int insertAt = -1; - for (int m = 0; m < list.Count; m++) - { - PlayerLayer dl = list[m]; - if (dl.Name.Equals(parent.Name)) - { insertAt = m; break; } - } - if (insertAt == -1) - list.Add(layer); - else - list.Insert(first ? insertAt : insertAt + 1, layer); - } - - public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) - { - // Dust modifications while high - if (trippy) - { - if (Main.myPlayer == player.whoAmI) - { - Rectangle rectangle = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); - int dustDrawn = 0; - float maxShroomDust = Main.maxDustToDraw / 2; - for (int i = 0; i < Main.maxDustToDraw; i++) - { - Dust dust = Main.dust[i]; - if (dust.active) - { - if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(rectangle)) - { - dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - for (int num213 = 0; num213 < 4; num213++) - { - Vector2 position9 = dust.position; - Vector2 dustCenter = new Vector2(position9.X + 4f, position9.Y + 4f); - float num214 = Math.Abs(dustCenter.X - player.Center.X); - float num215 = Math.Abs(dustCenter.Y - player.Center.Y); - if (num213 == 0 || num213 == 2) - { - position9.X = player.Center.X + num214; - } - else - { - position9.X = player.Center.X - num214; - } - position9.X -= 4f; - if (num213 == 0 || num213 == 1) - { - position9.Y = player.Center.Y + num215; - } - else - { - position9.Y = player.Center.Y - num215; - } - position9.Y -= 4f; - Main.spriteBatch.Draw(Main.dustTexture, position9 - Main.screenPosition, new Rectangle?(dust.frame), dust.color, dust.rotation, new Vector2(4f, 4f), dust.scale, SpriteEffects.None, 0f); - dustDrawn++; - } - - // Break if too many dust clones have been drawn - if (dustDrawn > maxShroomDust) - break; - } - } - } - } - } - - bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f || !CalamityConfig.Instance.StealthInvisbility; - if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f && CalamityConfig.Instance.StealthInvisbility) - { - //A translucent orchid color, the rogue class color - float colorValue = rogueStealth / rogueStealthMax * 0.9f; //0 to 0.9 - r *= 1f - (colorValue * 0.89f); //255 to 50 - 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; - } - - if (CalamityWorld.ironHeart && !Main.gameMenu) - { - Texture2D ironHeart = ModContent.GetTexture("CalamityMod/ExtraTextures/IronHeart"); - Main.heartTexture = Main.heart2Texture = ironHeart; - } - else - { - 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 - - int totalFruit = - (mFruit ? 1 : 0) + - (bOrange ? 1 : 0) + - (eBerry ? 1 : 0) + - (dFruit ? 1 : 0); - - switch (totalFruit) - { - default: - Main.heart2Texture = heartOriginal; - break; - case 4: - Main.heart2Texture = heart6; - break; - case 3: - Main.heart2Texture = heart5; - break; - case 2: - Main.heart2Texture = heart4; - break; - case 1: - Main.heart2Texture = heart3; - break; - } - - Main.heartTexture = heartOriginal2; - } - if (revivify) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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); - } - } - if (tRegen) - { - if (Main.rand.NextBool(10) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.025f; - g *= 0.15f; - b *= 0.035f; - fullBright = true; - } - } - if (IBoots) - { - if (!player.StandingStill() && !player.mount.Active) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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); - } - if (noRogueStealth) - { - r *= 0.05f; - g *= 0.05f; - b *= 0.05f; - fullBright = true; - } - } - } - if (elysianFire) - { - if (!player.StandingStill() && !player.mount.Active) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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); - } - if (noRogueStealth) - { - r *= 0.75f; - g *= 0.55f; - b *= 0f; - fullBright = true; - } - } - } - if (dsSetBonus) - { - if (!player.StandingStill() && !player.mount.Active) - { - if (Main.rand.NextBool(2) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.025f; - b *= 0.1f; - fullBright = true; - } - } - } - if (auricSet) - { - if (!player.StandingStill() && !player.mount.Active) - { - if (drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.025f; - b *= 0.1f; - fullBright = true; - } - } - } - if (bFlames || aFlames || rageModeActive) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (shadowflame) - { - if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; - if (Main.rand.NextBool(4)) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - } - if (sulphurPoison) - { - if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; - if (Main.rand.NextBool(4)) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - if (noRogueStealth) - { - r *= 0.65f; - b *= 0.75f; - fullBright = true; - } - } - if (adrenalineModeActive) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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); - } - if (noRogueStealth) - { - r *= 0.01f; - g *= 0.15f; - b *= 0.1f; - fullBright = true; - } - } - if (gsInferno) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (astralInfection) - { - 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, 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; - Main.dust[dust].color = new Color(255, 255, 255, 0); - Main.playerDrawDust.Add(dust); - } - } - if (hFlames || hInferno) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.25f; - b *= 0.1f; - fullBright = true; - } - } - else if (eGravity) - { - if (Main.rand.NextBool(12) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 2f), player.width + 4, player.height + 4, 244, 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; - Main.playerDrawDust.Add(dust); - } - } - if (pFlames) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.07f; - g *= 0.15f; - b *= 0.01f; - fullBright = true; - } - } - if (nightwither) - { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.25f; - b *= 0.1f; - fullBright = true; - } - } - if (vaporfied) - { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 246, - 242, - 229, - 226, - 247, - 187, - 234 - }); - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - if (Main.rand.NextBool(4)) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.25f; - b *= 0.1f; - fullBright = true; - } - } - if (eFreeze || silvaStun || gState || cDepth || eutrophication) - { - if (noRogueStealth) - { - r *= 0f; - g *= 0.05f; - b *= 0.3f; - fullBright = true; - } - } - if (draedonsHeart && !shadeRegen && !cFreeze && player.StandingStill() && player.itemAnimation == 0) - { - if (noRogueStealth) - { - r *= 0f; - g *= 0.5f; - b *= 0f; - fullBright = true; - } - } - if (bBlood) - { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (mushy || (etherealExtorter && player.ZoneGlowshroom)) - { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.15f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; - } - } - if (bloodfinBoost) - { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.position - new Vector2(2f, 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; - Main.playerDrawDust.Add(dust); - } - if (noRogueStealth) - { - r *= 0.5f; - g *= 0f; - b *= 0f; - fullBright = true; - } - } - if ((cadence || ladHearts > 0) && !player.loveStruck) - { - if (Main.rand.NextBool(5) && drawInfo.shadow == 0f) - { - Vector2 vector2_2 = new Vector2((float)Main.rand.Next(-10, 11), (float)Main.rand.Next(-10, 11)); - vector2_2.Normalize(); - vector2_2.X *= 0.66f; - int heart = Gore.NewGore(drawInfo.position + new Vector2((float)Main.rand.Next(player.width + 1), (float)Main.rand.Next(player.height + 1)), vector2_2 * (float)Main.rand.Next(3, 6) * 0.33f, 331, (float)Main.rand.Next(40, 121) * 0.01f); - Main.gore[heart].sticky = false; - Main.gore[heart].velocity *= 0.4f; - Main.gore[heart].velocity.Y -= 0.6f; - Main.playerDrawGore.Add(heart); - } - } - } - #endregion - #region Nurse Modifications public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText) { - if (CalamityWorld.death && areThereAnyDamnBosses) + if ((CalamityWorld.death || CalamityWorld.malice) && areThereAnyDamnBosses) { chatText = "Now is not the time!"; return false; @@ -10807,7 +9374,7 @@ namespace CalamityMod.CalPlayer public override void ModifyNursePrice(NPC nurse, int health, bool removeDebuffs, ref int price) { - // In Rev+, nurse costs scale as the game progresses. + // Nurse costs scale as the game progresses. // Base: 300 3 silver // EoC: 900 9 silver // Skeletron: 1200 12 silver @@ -10821,7 +9388,7 @@ namespace CalamityMod.CalPlayer // DoG: 60000 6 gold // Yharon: 90000 9 gold - if (CalamityWorld.revenge && price > 0) + if (price > 0) { // start with a vanilla cost of zero instead of 3 silver price -= Item.buyPrice(0, 0, 3, 0); @@ -10875,11 +9442,13 @@ namespace CalamityMod.CalPlayer // rogueStealth doesn't reset every frame because it's a continuously building resource // these other parameters are rebuilt every frame based on the items you have equipped + stealthDamage = 0f; rogueStealthMax = 0f; stealthGenStandstill = 1f; stealthGenMoving = 1f; stealthStrikeThisFrame = false; stealthStrikeHalfCost = false; + stealthStrike75Cost = false; stealthStrikeAlwaysCrits = false; // stealthAcceleration only resets if you don't have either of the accelerator accessories equipped @@ -10909,18 +9478,15 @@ namespace CalamityMod.CalPlayer playRogueStealthSound = true; // Calculate stealth generation and gain stealth accordingly - if (wearingRogueArmor) - { - // 1f is normal speed, anything higher is faster. Default stealth generation is 3 seconds while standing still. - float currentStealthGen = UpdateStealthGenStats(); - rogueStealth += rogueStealthMax * (currentStealthGen / 180f); // 180 frames = 3 seconds - if (rogueStealth > rogueStealthMax) - rogueStealth = rogueStealthMax; - } + // 1f is normal speed, anything higher is faster. Default stealth generation is 3 seconds while standing still. + float currentStealthGen = UpdateStealthGenStats(); + rogueStealth += rogueStealthMax * (currentStealthGen / 180f); // 180 frames = 3 seconds + if (rogueStealth > rogueStealthMax) + rogueStealth = rogueStealthMax; ProvideStealthStatBonuses(); - // If the player is using an item that deals damage and is on their first frame of doing so, + // If the player is using an item that deals damage and is on their first frame of a use of that item, // consume stealth if a stealth strike wasn't triggered manually by item code. // This doesn't trigger stealth strike effects (ConsumeStealthStrike instead of StealthStrike) @@ -10936,39 +9502,76 @@ namespace CalamityMod.CalPlayer bool isChannelable = it.channel; bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; - if (!stealthStrikeThisFrame && player.itemAnimation == player.itemAnimationMax - 1 && playerUsingWeapon) - ConsumeStealthByAttacking(); + + // 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) + + if (!stealthStrikeThisFrame && animationCheck && playerUsingWeapon) + { + bool canStealthStrike = StealthStrikeAvailable(); + + // If you can stealth strike, you do. + if (canStealthStrike) + ConsumeStealthByAttacking(); + // Otherwise you get a "partial stealth strike" (stealth damage is still added to the weapon) and return to normally attacking. + else + rogueStealth = 0f; + } } private void ProvideStealthStatBonuses() { - // At full stealth, you get a higher damage bonus than at any partial level of stealth. - if (rogueStealth >= rogueStealthMax) - throwingDamage += rogueStealth * 0.6666666f; - else - throwingDamage += rogueStealth * 0.5f; + if (!wearingRogueArmor || rogueStealthMax <= 0) + return; - // Crit increases based on your stealth value. With certain gear, it's locked at 100% for stealth strikes. + // 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(); + + // 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. + // Lower stealth generation rate (especially while moving) enables higher maximum stealth damage. + // This enables stealth to be conditionally useful -- even powerful -- even without a dedicated stealth build. + double averagedStealthGen = 0.8 * stealthGenMoving + 0.2 * stealthGenStandstill; + double fakeStealthTime = 9D / averagedStealthGen; + + // Use time 3 = 162% damage ratio + // Use time 8 = 200% damage ratio + // Use time 13 = 221% damage ratio + // Use time 17 = 234% damage ratio + // Use time 20 = 242% damage ratio + // Use time 30 = 263% damage ratio + // Use time 59 = 297% damage ratio + int realUseTime = Math.Max(it.useTime, it.useAnimation); + double useTimeFactor = 0.75 + 0.75 * Math.Log(realUseTime + 2D, 4D); + + // 9.00 second stealth charge = 433% damage ratio + // 6.00 second stealth charge = 330% damage ratio + // 4.00 second stealth charge = 252% damage ratio + // 2.50 second stealth charge = 184% damage ratio + double stealthGenFactor = Math.Max(Math.Pow(fakeStealthTime, 2D / 3D), 1.5); + + double stealthAddedDamage = rogueStealth * StealthDamageConstant * useTimeFactor * stealthGenFactor; + stealthDamage += (float)stealthAddedDamage; + + // Show 100% crit chance if your stealth strikes always crit. + // In practice, this is only for visuals because Terraria determines crit status on hit. if (stealthStrikeAlwaysCrits && StealthStrikeAvailable()) throwingCrit = 100; - else - throwingCrit += (int)(rogueStealth * 20f); - // Stealth slightly increases movement speed and decreases aggro. - if (wearingRogueArmor && rogueStealthMax > 0) - { - player.moveSpeed += rogueStealth * 0.05f; - player.aggro -= (int)(rogueStealth * 400f); - } + // Stealth slightly decreases aggro. + 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) @@ -10991,23 +9594,20 @@ namespace CalamityMod.CalPlayer stealthGenMoving += 0.15f; } - if (CalamityMod.daggerList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.daggerList.Contains(player.ActiveItem().type) && player.invis) { stealthGenStandstill += 0.08f; stealthGenMoving += 0.08f; } - if (shadow) + if (shadow) { stealthGenStandstill += 0.1f; stealthGenMoving += 0.1f; } - if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent - stealthGenStandstill += 0.15f; - - //Accessory modifiers can boost these stats - stealthGenStandstill += accStealthGenBoost; - stealthGenMoving += accStealthGenBoost; + //Accessory modifiers can boost these stats + stealthGenStandstill += accStealthGenBoost; + stealthGenMoving += accStealthGenBoost; // // Other code which affects stealth generation goes here. @@ -11050,7 +9650,12 @@ namespace CalamityMod.CalPlayer { if (rogueStealthMax <= 0f) return false; - return rogueStealth >= rogueStealthMax * (stealthStrikeHalfCost ? 0.5f : 1f); + float consumptionMult = 1f; + if (stealthStrikeHalfCost) + consumptionMult = 0.5f; + else if (stealthStrike75Cost) + consumptionMult = 0.75f; + return rogueStealth >= rogueStealthMax * consumptionMult; } internal void ConsumeStealthByAttacking() @@ -11058,268 +9663,87 @@ namespace CalamityMod.CalPlayer stealthStrikeThisFrame = true; stealthAcceleration = 1f; // Reset acceleration when you attack + float lossReductionRatio = flatStealthLossReduction / (rogueStealthMax * 100f); if (stealthStrikeHalfCost) { - rogueStealth -= 0.5f * rogueStealthMax; + rogueStealth -= 0.5f * rogueStealthMax - lossReductionRatio; if (rogueStealth <= 0f) rogueStealth = 0f; } - else - rogueStealth = 0f; - } - #endregion - - #region Packet Stuff - private void ExactLevelPacket(bool server, int levelType) - { - ModPacket packet = mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactMeleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactRangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactMagicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactSummonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); - packet.Write(player.whoAmI); - packet.Write(exactRogueLevel); - break; - } - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - private void LevelPacket(bool server, int levelType) - { - ModPacket packet = mod.GetPacket(256); - switch (levelType) - { - case 0: - packet.Write((byte)CalamityModMessageType.MeleeLevelSync); - packet.Write(player.whoAmI); - packet.Write(meleeLevel); - break; - case 1: - packet.Write((byte)CalamityModMessageType.RangedLevelSync); - packet.Write(player.whoAmI); - packet.Write(rangedLevel); - break; - case 2: - packet.Write((byte)CalamityModMessageType.MagicLevelSync); - packet.Write(player.whoAmI); - packet.Write(magicLevel); - break; - case 3: - packet.Write((byte)CalamityModMessageType.SummonLevelSync); - packet.Write(player.whoAmI); - packet.Write(summonLevel); - break; - case 4: - packet.Write((byte)CalamityModMessageType.RogueLevelSync); - packet.Write(player.whoAmI); - packet.Write(rogueLevel); - break; - } - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - public void StressPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.StressSync); - packet.Write(player.whoAmI); - packet.Write(rage); - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - public void AdrenalinePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.AdrenalineSync); - packet.Write(player.whoAmI); - packet.Write(adrenaline); - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - private void DeathPacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DeathCountSync); - packet.Write(player.whoAmI); - packet.Write(deathCount); - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - public void DeathModeUnderworldTimePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DeathModeUnderworldTimeSync); - packet.Write(player.whoAmI); - packet.Write(deathModeUnderworldTime); - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - public void DeathModeBlizzardTimePacket(bool server) - { - ModPacket packet = mod.GetPacket(256); - packet.Write((byte)CalamityModMessageType.DeathModeBlizzardTimeSync); - packet.Write(player.whoAmI); - packet.Write(deathModeBlizzardTime); - - if (!server) - packet.Send(); - else - packet.Send(-1, player.whoAmI); - } - - internal void HandleExactLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - exactMeleeLevel = reader.ReadInt32(); - break; - case 1: - exactRangedLevel = reader.ReadInt32(); - break; - case 2: - exactMagicLevel = reader.ReadInt32(); - break; - case 3: - exactSummonLevel = reader.ReadInt32(); - break; - case 4: - exactRogueLevel = reader.ReadInt32(); - break; - } - - if (Main.netMode == NetmodeID.Server) - ExactLevelPacket(true, levelType); - } - - internal void HandleLevels(BinaryReader reader, int levelType) - { - switch (levelType) - { - case 0: - meleeLevel = reader.ReadInt32(); - break; - case 1: - rangedLevel = reader.ReadInt32(); - break; - case 2: - magicLevel = reader.ReadInt32(); - break; - case 3: - summonLevel = reader.ReadInt32(); - break; - case 4: - rogueLevel = reader.ReadInt32(); - break; - } - - if (Main.netMode == NetmodeID.Server) - LevelPacket(true, levelType); - } - - internal void HandleStress(BinaryReader reader) - { - rage = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - StressPacket(true); - } - - internal void HandleAdrenaline(BinaryReader reader) - { - adrenaline = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - AdrenalinePacket(true); - } - - internal void HandleDeathCount(BinaryReader reader) - { - deathCount = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - DeathPacket(true); - } - - internal void HandleDeathModeUnderworldTime(BinaryReader reader) - { - deathModeUnderworldTime = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - DeathModeUnderworldTimePacket(true); - } - - internal void HandleDeathModeBlizzardTime(BinaryReader reader) - { - deathModeBlizzardTime = reader.ReadInt32(); - if (Main.netMode == NetmodeID.Server) - DeathModeBlizzardTimePacket(true); - } - - public override void OnEnterWorld(Player player) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - ExactLevelPacket(false, 0); - ExactLevelPacket(false, 1); - ExactLevelPacket(false, 2); - ExactLevelPacket(false, 3); - ExactLevelPacket(false, 4); - LevelPacket(false, 0); - LevelPacket(false, 1); - LevelPacket(false, 2); - LevelPacket(false, 3); - LevelPacket(false, 4); - StressPacket(false); - AdrenalinePacket(false); - DeathPacket(false); - DeathModeUnderworldTimePacket(false); - DeathModeBlizzardTimePacket(false); + else if (stealthStrike75Cost) + { + rogueStealth -= 0.75f * rogueStealthMax - lossReductionRatio; + if (rogueStealth <= 0f) + rogueStealth = 0f; } + else + rogueStealth = lossReductionRatio; } #endregion #region Proficiency Stuff + private bool ReduceCooldown(int classType) + { + switch (classType) + { + case (int)ClassType.Melee: + + if (meleeLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (meleeLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (meleeLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Ranged: + + if (rangedLevel < levelTier3 && (meleeLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (rangedLevel < levelTier2 && (meleeLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (rangedLevel < levelTier1 && (meleeLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Magic: + + if (magicLevel < levelTier3 && (rangedLevel >= levelTier3 || meleeLevel >= levelTier3 || summonLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (magicLevel < levelTier2 && (rangedLevel >= levelTier2 || meleeLevel >= levelTier2 || summonLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (magicLevel < levelTier1 && (rangedLevel >= levelTier1 || meleeLevel >= levelTier1 || summonLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Summon: + + if (summonLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || meleeLevel >= levelTier3 || rogueLevel >= levelTier3)) + return true; + if (summonLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || meleeLevel >= levelTier2 || rogueLevel >= levelTier2)) + return true; + if (summonLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || meleeLevel >= levelTier1 || rogueLevel >= levelTier1)) + return true; + + break; + + case (int)ClassType.Rogue: + + if (rogueLevel < levelTier3 && (rangedLevel >= levelTier3 || magicLevel >= levelTier3 || summonLevel >= levelTier3 || meleeLevel >= levelTier3)) + return true; + if (rogueLevel < levelTier2 && (rangedLevel >= levelTier2 || magicLevel >= levelTier2 || summonLevel >= levelTier2 || meleeLevel >= levelTier2)) + return true; + if (rogueLevel < levelTier1 && (rangedLevel >= levelTier1 || magicLevel >= levelTier1 || summonLevel >= levelTier1 || meleeLevel >= levelTier1)) + return true; + + break; + } + return false; + } + public void GetExactLevelUp() { if (gainLevelCooldown > 0) @@ -11329,49 +9753,49 @@ namespace CalamityMod.CalPlayer switch (meleeLevel) { case 100: - this.ExactLevelUp(0, 1, false); + ExactLevelUp(0, 1, false); break; case 300: - this.ExactLevelUp(0, 2, false); + ExactLevelUp(0, 2, false); break; case 600: - this.ExactLevelUp(0, 3, false); + ExactLevelUp(0, 3, false); break; case 1000: - this.ExactLevelUp(0, 4, false); + ExactLevelUp(0, 4, false); break; case 1500: - this.ExactLevelUp(0, 5, false); + ExactLevelUp(0, 5, false); break; case 2100: - this.ExactLevelUp(0, 6, false); + ExactLevelUp(0, 6, false); break; case 2800: - this.ExactLevelUp(0, 7, false); + ExactLevelUp(0, 7, false); break; case 3600: - this.ExactLevelUp(0, 8, false); + ExactLevelUp(0, 8, false); break; case 4500: - this.ExactLevelUp(0, 9, false); + ExactLevelUp(0, 9, false); break; case 5500: - this.ExactLevelUp(0, 10, false); + ExactLevelUp(0, 10, false); break; case 6600: - this.ExactLevelUp(0, 11, false); + ExactLevelUp(0, 11, false); break; case 7800: - this.ExactLevelUp(0, 12, false); + ExactLevelUp(0, 12, false); break; case 9100: - this.ExactLevelUp(0, 13, false); + ExactLevelUp(0, 13, false); break; case 10500: - this.ExactLevelUp(0, 14, false); + ExactLevelUp(0, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(0, 15, true); + ExactLevelUp(0, 15, true); break; default: break; @@ -11382,49 +9806,49 @@ namespace CalamityMod.CalPlayer switch (rangedLevel) { case 100: - this.ExactLevelUp(1, 1, false); + ExactLevelUp(1, 1, false); break; case 300: - this.ExactLevelUp(1, 2, false); + ExactLevelUp(1, 2, false); break; case 600: - this.ExactLevelUp(1, 3, false); + ExactLevelUp(1, 3, false); break; case 1000: - this.ExactLevelUp(1, 4, false); + ExactLevelUp(1, 4, false); break; case 1500: - this.ExactLevelUp(1, 5, false); + ExactLevelUp(1, 5, false); break; case 2100: - this.ExactLevelUp(1, 6, false); + ExactLevelUp(1, 6, false); break; case 2800: - this.ExactLevelUp(1, 7, false); + ExactLevelUp(1, 7, false); break; case 3600: - this.ExactLevelUp(1, 8, false); + ExactLevelUp(1, 8, false); break; case 4500: - this.ExactLevelUp(1, 9, false); + ExactLevelUp(1, 9, false); break; case 5500: - this.ExactLevelUp(1, 10, false); + ExactLevelUp(1, 10, false); break; case 6600: - this.ExactLevelUp(1, 11, false); + ExactLevelUp(1, 11, false); break; case 7800: - this.ExactLevelUp(1, 12, false); + ExactLevelUp(1, 12, false); break; case 9100: - this.ExactLevelUp(1, 13, false); + ExactLevelUp(1, 13, false); break; case 10500: - this.ExactLevelUp(1, 14, false); + ExactLevelUp(1, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(1, 15, true); + ExactLevelUp(1, 15, true); break; default: break; @@ -11435,49 +9859,49 @@ namespace CalamityMod.CalPlayer switch (magicLevel) { case 100: - this.ExactLevelUp(2, 1, false); + ExactLevelUp(2, 1, false); break; case 300: - this.ExactLevelUp(2, 2, false); + ExactLevelUp(2, 2, false); break; case 600: - this.ExactLevelUp(2, 3, false); + ExactLevelUp(2, 3, false); break; case 1000: - this.ExactLevelUp(2, 4, false); + ExactLevelUp(2, 4, false); break; case 1500: - this.ExactLevelUp(2, 5, false); + ExactLevelUp(2, 5, false); break; case 2100: - this.ExactLevelUp(2, 6, false); + ExactLevelUp(2, 6, false); break; case 2800: - this.ExactLevelUp(2, 7, false); + ExactLevelUp(2, 7, false); break; case 3600: - this.ExactLevelUp(2, 8, false); + ExactLevelUp(2, 8, false); break; case 4500: - this.ExactLevelUp(2, 9, false); + ExactLevelUp(2, 9, false); break; case 5500: - this.ExactLevelUp(2, 10, false); + ExactLevelUp(2, 10, false); break; case 6600: - this.ExactLevelUp(2, 11, false); + ExactLevelUp(2, 11, false); break; case 7800: - this.ExactLevelUp(2, 12, false); + ExactLevelUp(2, 12, false); break; case 9100: - this.ExactLevelUp(2, 13, false); + ExactLevelUp(2, 13, false); break; case 10500: - this.ExactLevelUp(2, 14, false); + ExactLevelUp(2, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(2, 15, true); + ExactLevelUp(2, 15, true); break; default: break; @@ -11488,49 +9912,49 @@ namespace CalamityMod.CalPlayer switch (summonLevel) { case 100: - this.ExactLevelUp(3, 1, false); + ExactLevelUp(3, 1, false); break; case 300: - this.ExactLevelUp(3, 2, false); + ExactLevelUp(3, 2, false); break; case 600: - this.ExactLevelUp(3, 3, false); + ExactLevelUp(3, 3, false); break; case 1000: - this.ExactLevelUp(3, 4, false); + ExactLevelUp(3, 4, false); break; case 1500: - this.ExactLevelUp(3, 5, false); + ExactLevelUp(3, 5, false); break; case 2100: - this.ExactLevelUp(3, 6, false); + ExactLevelUp(3, 6, false); break; case 2800: - this.ExactLevelUp(3, 7, false); + ExactLevelUp(3, 7, false); break; case 3600: - this.ExactLevelUp(3, 8, false); + ExactLevelUp(3, 8, false); break; case 4500: - this.ExactLevelUp(3, 9, false); + ExactLevelUp(3, 9, false); break; case 5500: - this.ExactLevelUp(3, 10, false); + ExactLevelUp(3, 10, false); break; case 6600: - this.ExactLevelUp(3, 11, false); + ExactLevelUp(3, 11, false); break; case 7800: - this.ExactLevelUp(3, 12, false); + ExactLevelUp(3, 12, false); break; case 9100: - this.ExactLevelUp(3, 13, false); + ExactLevelUp(3, 13, false); break; case 10500: - this.ExactLevelUp(3, 14, false); + ExactLevelUp(3, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(3, 15, true); + ExactLevelUp(3, 15, true); break; default: break; @@ -11541,49 +9965,49 @@ namespace CalamityMod.CalPlayer switch (rogueLevel) { case 100: - this.ExactLevelUp(4, 1, false); + ExactLevelUp(4, 1, false); break; case 300: - this.ExactLevelUp(4, 2, false); + ExactLevelUp(4, 2, false); break; case 600: - this.ExactLevelUp(4, 3, false); + ExactLevelUp(4, 3, false); break; case 1000: - this.ExactLevelUp(4, 4, false); + ExactLevelUp(4, 4, false); break; case 1500: - this.ExactLevelUp(4, 5, false); + ExactLevelUp(4, 5, false); break; case 2100: - this.ExactLevelUp(4, 6, false); + ExactLevelUp(4, 6, false); break; case 2800: - this.ExactLevelUp(4, 7, false); + ExactLevelUp(4, 7, false); break; case 3600: - this.ExactLevelUp(4, 8, false); + ExactLevelUp(4, 8, false); break; case 4500: - this.ExactLevelUp(4, 9, false); + ExactLevelUp(4, 9, false); break; case 5500: - this.ExactLevelUp(4, 10, false); + ExactLevelUp(4, 10, false); break; case 6600: - this.ExactLevelUp(4, 11, false); + ExactLevelUp(4, 11, false); break; case 7800: - this.ExactLevelUp(4, 12, false); + ExactLevelUp(4, 12, false); break; case 9100: - this.ExactLevelUp(4, 13, false); + ExactLevelUp(4, 13, false); break; case 10500: - this.ExactLevelUp(4, 14, false); + ExactLevelUp(4, 14, false); break; case 12500: //celebration or some shit for final level, yay - this.ExactLevelUp(4, 15, true); + ExactLevelUp(4, 15, true); break; default: break; @@ -11723,7 +10147,7 @@ namespace CalamityMod.CalPlayer } if (Main.netMode == NetmodeID.MultiplayerClient) { - ExactLevelPacket(false, levelUpType); + SyncExactLevel(false, levelUpType); } } @@ -11732,48 +10156,48 @@ namespace CalamityMod.CalPlayer #region MeleeLevelBoosts if (meleeLevel >= 12500) { - player.meleeDamage += 0.12f; - player.meleeCrit += 6; + player.meleeDamage += 0.06f; + player.meleeCrit += 3; } else if (meleeLevel >= 10500) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - } - else if (meleeLevel >= 9100) - { - player.meleeDamage += 0.09f; - player.meleeCrit += 5; - } - else if (meleeLevel >= 7800) - { - player.meleeDamage += 0.08f; - player.meleeCrit += 4; - } - else if (meleeLevel >= 6600) - { - player.meleeDamage += 0.07f; - player.meleeCrit += 4; - } - else if (meleeLevel >= 5500) //hm limit { player.meleeDamage += 0.06f; player.meleeCrit += 3; } - else if (meleeLevel >= 4500) + else if (meleeLevel >= 9100) + { + player.meleeDamage += 0.06f; + player.meleeCrit += 3; + } + else if (meleeLevel >= 7800) { player.meleeDamage += 0.05f; player.meleeCrit += 3; } - else if (meleeLevel >= 3600) + else if (meleeLevel >= 6600) { player.meleeDamage += 0.05f; + player.meleeCrit += 3; + } + else if (meleeLevel >= 5500) //hm limit + { + player.meleeDamage += 0.05f; + player.meleeCrit += 2; + } + else if (meleeLevel >= 4500) + { + player.meleeDamage += 0.05f; + player.meleeCrit += 2; + } + else if (meleeLevel >= 3600) + { + player.meleeDamage += 0.04f; player.meleeCrit += 2; } else if (meleeLevel >= 2800) { player.meleeDamage += 0.04f; - player.meleeCrit += 2; + player.meleeCrit += 1; } else if (meleeLevel >= 2100) { @@ -11787,7 +10211,7 @@ namespace CalamityMod.CalPlayer } else if (meleeLevel >= 1000) { - player.meleeDamage += 0.03f; + player.meleeDamage += 0.02f; player.meleeCrit += 1; } else if (meleeLevel >= 600) @@ -11802,74 +10226,74 @@ namespace CalamityMod.CalPlayer #region RangedLevelBoosts if (rangedLevel >= 12500) - { - player.rangedDamage += 0.12f; - player.moveSpeed += 0.12f; - player.rangedCrit += 6; - } - else if (rangedLevel >= 10500) - { - player.rangedDamage += 0.1f; - player.moveSpeed += 0.1f; - player.rangedCrit += 5; - } - else if (rangedLevel >= 9100) - { - player.rangedDamage += 0.09f; - player.moveSpeed += 0.09f; - player.rangedCrit += 5; - } - else if (rangedLevel >= 7800) - { - player.rangedDamage += 0.08f; - player.moveSpeed += 0.08f; - player.rangedCrit += 4; - } - else if (rangedLevel >= 6600) - { - player.rangedDamage += 0.07f; - player.moveSpeed += 0.07f; - player.rangedCrit += 4; - } - else if (rangedLevel >= 5500) { player.rangedDamage += 0.06f; player.moveSpeed += 0.06f; player.rangedCrit += 3; } - else if (rangedLevel >= 4500) + else if (rangedLevel >= 10500) + { + player.rangedDamage += 0.05f; + player.moveSpeed += 0.06f; + player.rangedCrit += 3; + } + else if (rangedLevel >= 9100) { player.rangedDamage += 0.05f; player.moveSpeed += 0.05f; player.rangedCrit += 3; } - else if (rangedLevel >= 3600) + else if (rangedLevel >= 7800) { - player.rangedDamage += 0.05f; + player.rangedDamage += 0.04f; player.moveSpeed += 0.05f; - player.rangedCrit += 2; + player.rangedCrit += 3; } - else if (rangedLevel >= 2800) + else if (rangedLevel >= 6600) + { + player.rangedDamage += 0.04f; + player.moveSpeed += 0.04f; + player.rangedCrit += 3; + } + else if (rangedLevel >= 5500) { player.rangedDamage += 0.04f; player.moveSpeed += 0.04f; player.rangedCrit += 2; } + else if (rangedLevel >= 4500) + { + player.rangedDamage += 0.03f; + player.moveSpeed += 0.04f; + player.rangedCrit += 2; + } + else if (rangedLevel >= 3600) + { + player.rangedDamage += 0.03f; + player.moveSpeed += 0.03f; + player.rangedCrit += 2; + } + else if (rangedLevel >= 2800) + { + player.rangedDamage += 0.02f; + player.moveSpeed += 0.03f; + player.rangedCrit += 2; + } else if (rangedLevel >= 2100) { - player.rangedDamage += 0.04f; + player.rangedDamage += 0.02f; player.moveSpeed += 0.03f; player.rangedCrit += 1; } else if (rangedLevel >= 1500) { - player.rangedDamage += 0.03f; + player.rangedDamage += 0.02f; player.moveSpeed += 0.02f; player.rangedCrit += 1; } else if (rangedLevel >= 1000) { - player.rangedDamage += 0.03f; + player.rangedDamage += 0.02f; player.moveSpeed += 0.01f; player.rangedCrit += 1; } @@ -11886,74 +10310,74 @@ namespace CalamityMod.CalPlayer #region MagicLevelBoosts if (magicLevel >= 12500) - { - player.magicDamage += 0.12f; - player.manaCost *= 0.88f; - player.magicCrit += 6; - } - else if (magicLevel >= 10500) - { - player.magicDamage += 0.1f; - player.manaCost *= 0.9f; - player.magicCrit += 5; - } - else if (magicLevel >= 9100) - { - player.magicDamage += 0.09f; - player.manaCost *= 0.91f; - player.magicCrit += 5; - } - else if (magicLevel >= 7800) - { - player.magicDamage += 0.08f; - player.manaCost *= 0.92f; - player.magicCrit += 4; - } - else if (magicLevel >= 6600) - { - player.magicDamage += 0.07f; - player.manaCost *= 0.93f; - player.magicCrit += 4; - } - else if (magicLevel >= 5500) { player.magicDamage += 0.06f; player.manaCost *= 0.94f; player.magicCrit += 3; } - else if (magicLevel >= 4500) + else if (magicLevel >= 10500) + { + player.magicDamage += 0.05f; + player.manaCost *= 0.94f; + player.magicCrit += 3; + } + else if (magicLevel >= 9100) { player.magicDamage += 0.05f; player.manaCost *= 0.95f; player.magicCrit += 3; } - else if (magicLevel >= 3600) + else if (magicLevel >= 7800) { - player.magicDamage += 0.05f; + player.magicDamage += 0.04f; player.manaCost *= 0.95f; - player.magicCrit += 2; + player.magicCrit += 3; } - else if (magicLevel >= 2800) + else if (magicLevel >= 6600) + { + player.magicDamage += 0.04f; + player.manaCost *= 0.96f; + player.magicCrit += 3; + } + else if (magicLevel >= 5500) { player.magicDamage += 0.04f; player.manaCost *= 0.96f; player.magicCrit += 2; } - else if (magicLevel >= 2100) + else if (magicLevel >= 4500) { player.magicDamage += 0.04f; player.manaCost *= 0.97f; - player.magicCrit += 1; + player.magicCrit += 2; } - else if (magicLevel >= 1500) + else if (magicLevel >= 3600) + { + player.magicDamage += 0.03f; + player.manaCost *= 0.97f; + player.magicCrit += 2; + } + else if (magicLevel >= 2800) + { + player.magicDamage += 0.03f; + player.manaCost *= 0.98f; + player.magicCrit += 2; + } + else if (magicLevel >= 2100) { player.magicDamage += 0.03f; player.manaCost *= 0.98f; player.magicCrit += 1; } + else if (magicLevel >= 1500) + { + player.magicDamage += 0.02f; + player.manaCost *= 0.98f; + player.magicCrit += 1; + } else if (magicLevel >= 1000) { - player.magicDamage += 0.03f; + player.magicDamage += 0.02f; player.manaCost *= 0.99f; player.magicCrit += 1; } @@ -11973,61 +10397,51 @@ namespace CalamityMod.CalPlayer { player.minionDamage += 0.12f; player.minionKB += 3.0f; - player.maxMinions += 3; } else if (summonLevel >= 10500) { player.minionDamage += 0.1f; player.minionKB += 3.0f; - player.maxMinions += 2; } else if (summonLevel >= 9100) { player.minionDamage += 0.09f; player.minionKB += 2.7f; - player.maxMinions += 2; } else if (summonLevel >= 7800) { player.minionDamage += 0.08f; player.minionKB += 2.4f; - player.maxMinions += 2; } else if (summonLevel >= 6600) { player.minionDamage += 0.07f; player.minionKB += 2.1f; - player.maxMinions += 2; } else if (summonLevel >= 5500) { - player.minionDamage += 0.06f; + player.minionDamage += 0.07f; player.minionKB += 1.8f; - player.maxMinions += 2; } else if (summonLevel >= 4500) { player.minionDamage += 0.06f; player.minionKB += 1.8f; - player.maxMinions++; } else if (summonLevel >= 3600) { player.minionDamage += 0.05f; player.minionKB += 1.5f; - player.maxMinions++; } else if (summonLevel >= 2800) { player.minionDamage += 0.04f; player.minionKB += 1.2f; - player.maxMinions++; } else if (summonLevel >= 2100) { player.minionDamage += 0.04f; player.minionKB += 0.9f; - player.maxMinions++; } else if (summonLevel >= 1500) { @@ -12052,74 +10466,74 @@ namespace CalamityMod.CalPlayer #region RogueLevelBoosts if (rogueLevel >= 12500) - { - throwingDamage += 0.12f; - throwingVelocity += 0.12f; - throwingCrit += 6; - } - else if (rogueLevel >= 10500) - { - throwingDamage += 0.1f; - throwingVelocity += 0.1f; - throwingCrit += 5; - } - else if (rogueLevel >= 9100) - { - throwingDamage += 0.09f; - throwingVelocity += 0.09f; - throwingCrit += 5; - } - else if (rogueLevel >= 7800) - { - throwingDamage += 0.08f; - throwingVelocity += 0.08f; - throwingCrit += 4; - } - else if (rogueLevel >= 6600) - { - throwingDamage += 0.07f; - throwingVelocity += 0.07f; - throwingCrit += 4; - } - else if (rogueLevel >= 5500) { throwingDamage += 0.06f; throwingVelocity += 0.06f; throwingCrit += 3; } - else if (rogueLevel >= 4500) + else if (rogueLevel >= 10500) + { + throwingDamage += 0.05f; + throwingVelocity += 0.06f; + throwingCrit += 3; + } + else if (rogueLevel >= 9100) { throwingDamage += 0.05f; throwingVelocity += 0.05f; throwingCrit += 3; } - else if (rogueLevel >= 3600) + else if (rogueLevel >= 7800) { - throwingDamage += 0.05f; + throwingDamage += 0.04f; throwingVelocity += 0.05f; - throwingCrit += 2; + throwingCrit += 3; } - else if (rogueLevel >= 2800) + else if (rogueLevel >= 6600) + { + throwingDamage += 0.04f; + throwingVelocity += 0.04f; + throwingCrit += 3; + } + else if (rogueLevel >= 5500) { throwingDamage += 0.04f; throwingVelocity += 0.04f; throwingCrit += 2; } + else if (rogueLevel >= 4500) + { + throwingDamage += 0.03f; + throwingVelocity += 0.04f; + throwingCrit += 2; + } + else if (rogueLevel >= 3600) + { + throwingDamage += 0.03f; + throwingVelocity += 0.03f; + throwingCrit += 2; + } + else if (rogueLevel >= 2800) + { + throwingDamage += 0.03f; + throwingVelocity += 0.03f; + throwingCrit += 1; + } else if (rogueLevel >= 2100) { - throwingDamage += 0.04f; + throwingDamage += 0.02f; throwingVelocity += 0.03f; throwingCrit += 1; } else if (rogueLevel >= 1500) { - throwingDamage += 0.03f; + throwingDamage += 0.02f; throwingVelocity += 0.02f; throwingCrit += 1; } else if (rogueLevel >= 1000) { - throwingDamage += 0.03f; + throwingDamage += 0.02f; throwingVelocity += 0.01f; throwingCrit += 1; } @@ -12140,47 +10554,47 @@ namespace CalamityMod.CalPlayer float meleeSpeedBonus = 0f; if (meleeLevel >= 12500) { - meleeSpeedBonus += 0.12f; + meleeSpeedBonus += 0.06f; } else if (meleeLevel >= 10500) { - meleeSpeedBonus += 0.1f; + meleeSpeedBonus += 0.05f; } else if (meleeLevel >= 9100) { - meleeSpeedBonus += 0.09f; + meleeSpeedBonus += 0.04f; } else if (meleeLevel >= 7800) { - meleeSpeedBonus += 0.08f; + meleeSpeedBonus += 0.04f; } else if (meleeLevel >= 6600) { - meleeSpeedBonus += 0.07f; + meleeSpeedBonus += 0.03f; } else if (meleeLevel >= 5500) //hm limit { - meleeSpeedBonus += 0.06f; + meleeSpeedBonus += 0.03f; } else if (meleeLevel >= 4500) { - meleeSpeedBonus += 0.05f; + meleeSpeedBonus += 0.02f; } else if (meleeLevel >= 3600) { - meleeSpeedBonus += 0.05f; + meleeSpeedBonus += 0.02f; } else if (meleeLevel >= 2800) { - meleeSpeedBonus += 0.04f; + meleeSpeedBonus += 0.02f; } else if (meleeLevel >= 2100) { - meleeSpeedBonus += 0.03f; + meleeSpeedBonus += 0.01f; } else if (meleeLevel >= 1500) //prehm limit { - meleeSpeedBonus += 0.02f; + meleeSpeedBonus += 0.01f; } else if (meleeLevel >= 1000) { @@ -12289,6 +10703,13 @@ namespace CalamityMod.CalPlayer #region Misc Stuff + // Triggers effects that must occur when the player enters the world. This sends a bunch of packets in multiplayer. + public override void OnEnterWorld(Player player) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + EnterWorldSync(); + } + /// /// Returns the range at which an abyss enemy can detect the player /// @@ -12306,6 +10727,7 @@ namespace CalamityMod.CalPlayer range *= fishAlert ? 3f : 1f; range *= abyssalMirror ? 0.65f : 1f; range *= eclipseMirror ? 0.3f : 1f; + range *= reaverExplore ? 0.9f : 1f; return range; } @@ -12379,5 +10801,32 @@ namespace CalamityMod.CalPlayer } #endregion + + #region Mana Consumption Effects + public override void OnConsumeMana(Item item, int manaConsumed) + { + CalamityPlayer modPlayer = player.Calamity(); + if (Main.rand.NextBool(4) && modPlayer.lifeManaEnchant) + { + 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); + } + + for (int i = 0; i < 8; i++) + { + 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); + life.fadeIn = 0.7f; + life.noGravity = true; + } + } + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs new file mode 100644 index 0000000000..21e8f60e60 --- /dev/null +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -0,0 +1,1290 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Dyes; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs; +using CalamityMod.Projectiles.Summon; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; + +namespace CalamityMod.CalPlayer +{ + public class CalamityPlayerDrawEffects : ModPlayer + { + #region Profaned Moonlight Colors + public static readonly List MoonlightDyeDayColors = new List() + { + new Color(255, 163, 56), + new Color(235, 30, 19), + new Color(242, 48, 187), + }; + public static readonly List MoonlightDyeNightColors = new List() + { + new Color(24, 134, 198), + new Color(130, 40, 150), + new Color(40, 64, 150), + }; + + public static void DetermineMoonlightDyeColors(out Color drawColor, Color dayColor, Color nightColor) + { + int totalTime = Main.dayTime ? 54000 : 32400; + float transitionTime = 5400; + float interval = Utils.InverseLerp(0f, transitionTime, (float)Main.time, true) + Utils.InverseLerp(totalTime - transitionTime, totalTime, (float)Main.time, true); + if (Main.dayTime) + { + // Dusk. + if (Main.time >= totalTime - transitionTime) + drawColor = Color.Lerp(dayColor, nightColor, Utils.InverseLerp(totalTime - transitionTime, totalTime, (float)Main.time, true)); + // Dawn. + else if (Main.time <= transitionTime) + drawColor = Color.Lerp(nightColor, dayColor, interval); + else + drawColor = dayColor; + } + else drawColor = nightColor; + } + + public static Color GetCurrentMoonlightDyeColor(float angleOffset = 0f) + { + float interval = (float)Math.Cos(Main.GlobalTime * 0.6f + angleOffset) * 0.5f + 0.5f; + interval = MathHelper.Clamp(interval, 0f, 0.995f); + Color dayColorToUse = CalamityUtils.MulticolorLerp(interval, MoonlightDyeDayColors.ToArray()); + Color nightColorToUse = CalamityUtils.MulticolorLerp(interval, MoonlightDyeNightColors.ToArray()); + DetermineMoonlightDyeColors(out Color drawColor, dayColorToUse, nightColorToUse); + return drawColor; + } + #endregion + + #region Draw Layers + + public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, drawInfo => + { + if (drawInfo.shadow != 0f) + return; + + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + + modPlayer.ProvidenceBurnEffectDrawer.DrawSet(drawPlayer.Bottom - Vector2.UnitY * 10f); + modPlayer.ProvidenceBurnEffectDrawer.SpawnAreaCompactness = 18f; + modPlayer.ProvidenceBurnEffectDrawer.RelativePower = 0.4f; + + if (modPlayer.sirenIce) + { + Texture2D texture = ModContent.GetTexture("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.Cyan, 0f, texture.Size() * 0.5f, 1f, SpriteEffects.None, 0); + Main.playerDrawData.Add(data); + } + if (modPlayer.amidiasBlessing) + { + Texture2D texture = ModContent.GetTexture("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); + Main.playerDrawData.Add(data); + } + }); + + public static readonly PlayerLayer Skin = new PlayerLayer("CalamityMod", "Skin", PlayerLayer.Skin, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (drawInfo.shadow != 0f || drawPlayer.dead) + { + return; + } + }); + + public static readonly PlayerLayer MiscEffects = new PlayerLayer("CalamityMod", "MiscEffects", PlayerLayer.MiscEffectsFront, drawInfo => + { + if (drawInfo.shadow != 0f) + return; + Player drawPlayer = drawInfo.drawPlayer; + Item currentlyHeldItem = drawPlayer.ActiveItem(); + + // Kamei trail/afterimage effect. + if (drawPlayer.Calamity().kamiBoost) + { + for (int i = drawPlayer.Calamity().KameiOldPositions.Length - 1; i > 0; i--) + { + if (drawPlayer.Calamity().KameiOldPositions[i - 1] == Vector2.Zero) + drawPlayer.Calamity().KameiOldPositions[i - 1] = drawPlayer.position; + drawPlayer.Calamity().KameiOldPositions[i] = drawPlayer.Calamity().KameiOldPositions[i - 1]; + } + drawPlayer.Calamity().KameiOldPositions[0] = drawPlayer.position; + + List existingDrawData = Main.playerDrawData; + for (int i = 0; i < drawPlayer.Calamity().KameiOldPositions.Length; i++) + { + float completionRatio = i / (float)drawPlayer.Calamity().KameiOldPositions.Length; + float scale = MathHelper.Lerp(1f, 0.5f, completionRatio); + float opacity = MathHelper.Lerp(0.25f, 0.08f, completionRatio); + List afterimages = new List(); + for (int j = 0; j < existingDrawData.Count; j++) + { + var drawData = existingDrawData[j]; + drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; + drawData.color = Color.Cyan * opacity; + drawData.color.G = (byte)(drawData.color.G * 1.6); + drawData.color.B = (byte)(drawData.color.B * 1.2); + drawData.scale = new Vector2(scale); + afterimages.Add(drawData); + } + Main.playerDrawData.InsertRange(0, afterimages); + } + } + + if (!drawPlayer.frozen && + currentlyHeldItem.type > ItemID.None && + !drawPlayer.dead && + !currentlyHeldItem.noUseGraphic && + (!drawPlayer.wet || !currentlyHeldItem.noWet)) + { + SpriteEffects drawEffects; + + if (drawPlayer.direction == 1) + drawEffects = SpriteEffects.None; + else drawEffects = SpriteEffects.FlipHorizontally; + + if (drawPlayer.gravDir != 1f) + drawEffects |= SpriteEffects.FlipVertically; + + if ((drawPlayer.itemAnimation > 0 && currentlyHeldItem.useStyle != 0) || (currentlyHeldItem.holdStyle > 0 && !drawPlayer.pulley)) + { + // Staffs. + if (currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + (currentlyHeldItem.type == ModContent.ItemType() && currentlyHeldItem.useStyle == ItemUseStyleID.HoldingOut)) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"); + if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/VesuviusGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); + + float rotation = drawPlayer.itemRotation + MathHelper.PiOver4 * (float)drawPlayer.direction; + int xOffset = 0; + Vector2 origin = new Vector2(0f, Main.itemTexture[currentlyHeldItem.type].Height); + + if (drawPlayer.gravDir == -1f) + { + if (drawPlayer.direction == -1) + { + rotation += MathHelper.PiOver2; + origin = new Vector2(Main.itemTexture[currentlyHeldItem.type].Width, 0f); + xOffset -= Main.itemTexture[currentlyHeldItem.type].Width; + } + else + { + rotation -= MathHelper.PiOver2; + origin = Vector2.Zero; + } + } + else if (drawPlayer.direction == -1) + { + origin = new Vector2(Main.itemTexture[currentlyHeldItem.type].Width, (float)Main.itemTexture[currentlyHeldItem.type].Height); + xOffset -= Main.itemTexture[currentlyHeldItem.type].Width; + } + + DrawData data = new DrawData(texture, + new Vector2((int)(drawPlayer.itemLocation.X - Main.screenPosition.X + origin.X + xOffset), (int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y)), + Main.itemTexture[currentlyHeldItem.type].Bounds, + Color.White, + rotation, + origin, + currentlyHeldItem.scale, + drawEffects, + 0); + + Main.playerDrawData.Add(data); + } + + // Bow and Book. + else if (currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType()) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"); + int offsetX = 10; + if (currentlyHeldItem.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"); + offsetX = 6; + } + else if (currentlyHeldItem.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"); + offsetX = 37; + } + else if (currentlyHeldItem.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"); + offsetX = 9; + } + else if (currentlyHeldItem.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); + offsetX = 44; + } + else if (currentlyHeldItem.type == ModContent.ItemType()) + { + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuralisGlow"); + offsetX = 62; + } + + Vector2 center = Main.itemTexture[currentlyHeldItem.type].Size() * 0.5f; + int originOffsetX = (int)center.X - offsetX; + + Vector2 origin = new Vector2(-originOffsetX, (float)(Main.itemTexture[currentlyHeldItem.type].Height / 2)); + if (drawPlayer.direction == -1) + origin = new Vector2((float)(Main.itemTexture[currentlyHeldItem.type].Width + originOffsetX), (float)(Main.itemTexture[currentlyHeldItem.type].Height / 2)); + + DrawData data = new DrawData(texture, + new Vector2((int)(drawPlayer.itemLocation.X - Main.screenPosition.X + center.X), (int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y + center.Y)), + Main.itemTexture[currentlyHeldItem.type].Bounds, + Color.White, + drawPlayer.itemRotation, + origin, + currentlyHeldItem.scale, + drawEffects, + 0); + + Main.playerDrawData.Add(data); + } + + // Sword. + else if (currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + currentlyHeldItem.type == ModContent.ItemType() || + (currentlyHeldItem.type == ModContent.ItemType() && currentlyHeldItem.useStyle == ItemUseStyleID.SwingThrow)) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"); + if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"); + else if (currentlyHeldItem.type == ModContent.ItemType()) + texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"); + + float yOffset = drawPlayer.gravDir == -1f ? 0f : (float)Main.itemTexture[currentlyHeldItem.type].Height; + + DrawData data = new DrawData(texture, + new Vector2((int)(drawPlayer.itemLocation.X - Main.screenPosition.X), (int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y)), + Main.itemTexture[currentlyHeldItem.type].Bounds, + Color.White, + drawPlayer.itemRotation, + new Vector2((float)Main.itemTexture[currentlyHeldItem.type].Width * 0.5f - (float)Main.itemTexture[currentlyHeldItem.type].Width * 0.5f * drawPlayer.direction, yOffset) + Vector2.Zero, + currentlyHeldItem.scale, + drawEffects, + 0); + + Main.playerDrawData.Add(data); + } + } + } + }); + + public static readonly PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (drawPlayer.mount != null && (modPlayer.fab || modPlayer.crysthamyr || modPlayer.onyxExcavator)) + { + drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, drawInfo.position, drawInfo.mountColor, drawInfo.spriteEffects, drawInfo.shadow); + } + }); + + public static readonly PlayerLayer Tail = new PlayerLayer("CalamityMod", "Tail", PlayerLayer.BackAcc, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (drawInfo.shadow != 0f || drawPlayer.dead) + return; + + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Armor/FathomSwarmerArmor_Tail"); + + Rectangle frame = texture.Frame(1, 4, 0, modPlayer.tailFrame); + if (modPlayer.fathomSwarmerTail) + { + int frameSizeY = texture.Height / 4; + int centerX = (int)(drawInfo.position.X + drawPlayer.width / 2f); + int centerY = (int)(drawInfo.position.Y + drawPlayer.height / 2f); + int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X - (3 * drawPlayer.direction)); + int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y); + Color color = Lighting.GetColor(centerX, centerY); + DrawData tailDrawData = new DrawData(texture, new Vector2(drawX, drawY), frame, color, 0f, new Vector2(texture.Width / 2f, frameSizeY / 2f), 1f, drawInfo.spriteEffects, 0); + Main.playerDrawData.Add(tailDrawData); + } + }); + + public static readonly PlayerLayer ForbiddenCircletSign = new PlayerLayer("CalamityMod", "ForbiddenSigil", PlayerLayer.BackAcc, drawInfo => + { + DrawData drawData = new DrawData(); + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (drawInfo.shadow != 0f || drawPlayer.dead || !modPlayer.forbiddenCirclet) + return; + + SpriteEffects spriteEffects; + if (drawPlayer.direction == 1) + spriteEffects = SpriteEffects.None; + else spriteEffects = SpriteEffects.FlipHorizontally; + + if (drawPlayer.gravDir != 1f) + spriteEffects |= SpriteEffects.FlipVertically; + + int dyeShader = 0; + if (drawPlayer.dye[1] != null) + dyeShader = drawPlayer.dye[1].dye; + + Color baseColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)(drawInfo.position.X + drawPlayer.width * 0.5f) / 16, (int)(drawInfo.position.Y + drawPlayer.height * 0.5f) / 16, Color.White), drawInfo.shadow); + Color color = Color.Lerp(baseColor, Color.White, 0.7f); + Texture2D texture = Main.extraTexture[ExtrasID.ForbiddenSign]; + Texture2D glowmask = Main.glowMaskTexture[GlowMaskID.ForbiddenSign]; + float offsetY = (float)Math.Sin(drawPlayer.miscCounter / 300f * MathHelper.TwoPi) * 6f; + float sinusoidalTime = (float)Math.Cos(drawPlayer.miscCounter / 75f * MathHelper.TwoPi); + Color afterimageColor = new Color(80, 70, 40, 0) * (sinusoidalTime * 0.5f + 0.5f) * 0.8f; + float gravCheckOffset = drawPlayer.gravDir != 1f ? -20f : 20f; + + Vector2 position = new Vector2(drawInfo.position.X - drawPlayer.bodyFrame.Width / 2 + drawPlayer.width / 2, drawInfo.position.Y + drawPlayer.height - drawPlayer.bodyFrame.Height + 4f) + drawPlayer.bodyPosition; + position += new Vector2(drawPlayer.bodyFrame.Width / 2, drawPlayer.bodyFrame.Height / 2) + new Vector2(-drawPlayer.direction * 10, offsetY - gravCheckOffset); + position -= Main.screenPosition; + + // Draw the original sign- + drawData = new DrawData(texture, position, null, color, drawPlayer.bodyRotation, texture.Size() * 0.5f, 1f, spriteEffects, 0) + { + shader = dyeShader + }; + Main.playerDrawData.Add(drawData); + + // And 4 semi-transparent copies. + for (float i = 0f; i < 4f; i++) + { + float angle = MathHelper.TwoPi / 4f * i; + drawData = new DrawData(glowmask, position + angle.ToRotationVector2() * sinusoidalTime * 4f, null, afterimageColor, drawPlayer.bodyRotation, texture.Size() * 0.5f, 1f, spriteEffects, 0); + Main.playerDrawData.Add(drawData); + } + }); + + public static readonly PlayerLayer ColdDivinityOverlay = new PlayerLayer("CalamityMod", "ColdDivinity", PlayerLayer.Skin, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.coldDivinity) + { + Texture2D texture = ModContent.GetTexture("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; + DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, new Color(53, Main.DiscoG, 255) * 0.5f, 0f, texture.Size() * 0.5f, 1.15f, spriteEffects, 0); + Main.playerDrawData.Add(data); + } + }); + + public static readonly PlayerLayer ConcentratedVoidAura = new PlayerLayer("CalamityMod", "VoidAura", PlayerLayer.Skin, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.voidAura || modPlayer.voidAuraDamage) + { + Texture2D tex = ModContent.GetTexture("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 + Rectangle frame = tex.Frame(1, 4, 0, modPlayer.voidFrame); + Vector2 origin = new Vector2(tex.Width / 2f, tex.Height / 2f / 4f); + float scale = 1.75f; + + DrawData data = new DrawData(tex, drawPos, frame, Color.White * 0.4f, 0f, origin, scale, spriteEffects, 0); + Main.playerDrawData.Add(data); + } + }); + + public static readonly PlayerLayer RoverDriveShield = new PlayerLayer("CalamityMod", "RoverDrive", PlayerLayer.Skin, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.roverDriveTimer < 616 && modPlayer.roverDrive && !drawPlayer.dead) + { + Texture2D texture = ModContent.GetTexture("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; + Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f / 11f); + float scale = 1f + (float)Math.Cos(Main.GlobalTime) * 0.1f; + SpriteEffects spriteEffects = drawPlayer.direction != -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + + DrawData data = new DrawData(texture, drawPos, frame, color, 0f, origin, scale, spriteEffects, 0); + Main.playerDrawData.Add(data); + } + }); + + public static readonly PlayerLayer StratusSphereDrawing = new PlayerLayer("CalamityMod", "StratusSphereDrawing", PlayerLayer.HeldProjFront, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + if (drawPlayer.inventory[drawPlayer.selectedItem].type == ModContent.ItemType()) + { + SpriteEffects effect; + if (drawPlayer.direction == 1) + { + effect = SpriteEffects.None; + } + else + { + effect = SpriteEffects.FlipHorizontally; + } + if (drawPlayer.gravDir != 1f) + effect |= SpriteEffects.FlipVertically; + Vector2 itemDrawPosition = drawPlayer.Center; + Texture2D drawTexture = ModContent.GetTexture("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; + Main.playerDrawData.Add(new DrawData(drawTexture, + (itemDrawPosition - Main.screenPosition + drawOffset).Floor(), + new Rectangle?(rectangle), + Color.White, + drawPlayer.itemRotation, + origin, + drawPlayer.inventory[drawPlayer.selectedItem].scale, + effect, + 0)); + drawTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/StratusSphereHoldGlow"); + Main.playerDrawData.Add(new DrawData(drawTexture, + (itemDrawPosition - Main.screenPosition + drawOffset).Floor(), + new Rectangle?(rectangle), + Color.White, + drawPlayer.itemRotation, + origin, + drawPlayer.inventory[drawPlayer.selectedItem].scale, + effect, + 0)); + } + }); + + public static readonly PlayerLayer ProfanedMoonlightDyeEffects = new PlayerLayer("CalamityMod", "ProfanedMoonlight", PlayerLayer.Body, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + int totalMoonlightDyes = drawPlayer.dye.Count(dyeItem => dyeItem.type == ModContent.ItemType()); + if (totalMoonlightDyes <= 0) + return; + CalamityUtils.DrawAuroras(drawPlayer, 5 + (int)MathHelper.Clamp(totalMoonlightDyes, 0f, 4f) * 2, MathHelper.Clamp(totalMoonlightDyes / 3f, 0f, 1f), GetCurrentMoonlightDyeColor()); + }); + + public static readonly PlayerLayer AuralisAuroraEffects = new PlayerLayer("CalamityMod", "AuralisAurora", PlayerLayer.Body, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (modPlayer.auralisAuroraCounter < 300 || modPlayer.auralisAuroraCooldown > 0) + return; + CalamityUtils.DrawAuroras(drawPlayer, 7, 0.4f, CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 3f)); + }); + + public static readonly PlayerLayer AngelicAllianceAurora = new PlayerLayer("CalamityMod", "AngelicAllianceAurora", PlayerLayer.Body, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (!modPlayer.divineBless) + return; + CalamityUtils.DrawAuroras(drawPlayer, 7, 0.4f, CalamityUtils.ColorSwap(new Color(255, 163, 56), new Color(242, 48, 187), 3f)); + }); + + public static readonly PlayerLayer IbanDevRobot = new PlayerLayer("CalamityMod", "IbanDevRobot", PlayerLayer.Body, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + if (drawPlayer.Calamity().andromedaState == AndromedaPlayerState.Inactive) + return; + Main.playerDrawData.Clear(); + int robot = -1; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == drawPlayer.whoAmI) + { + robot = i; + break; + } + } + if (robot == -1) + { + drawPlayer.Calamity().andromedaState = AndromedaPlayerState.Inactive; + return; + } + + GiantIbanRobotOfDoom robotEntityInstance = (GiantIbanRobotOfDoom)Main.projectile[robot].modProjectile; + switch (drawPlayer.Calamity().andromedaState) + { + case AndromedaPlayerState.SpecialAttack: + Texture2D dashTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/AndromedaBolt"); + Rectangle frame = dashTexture.Frame(1, 4, 0, robotEntityInstance.RightIconCooldown / 4 % 4); + + DrawData drawData = new DrawData(dashTexture, + drawPlayer.Center + new Vector2(0f, -8f) - Main.screenPosition, + frame, + Color.White, + Main.projectile[robot].rotation, + drawPlayer.Size / 2, + 1f, + Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 1); + drawData.shader = drawPlayer.cBody; + + Main.playerDrawData.Add(drawData); + break; + case AndromedaPlayerState.LargeRobot: + Texture2D robotTexture = ModContent.GetTexture(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), + Main.projectile[robot].Center + Vector2.UnitY * 6f - Main.screenPosition, + frame, + Color.White, + Main.projectile[robot].rotation, + Main.projectile[robot].Size / 2, + 1f, + Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 1); + drawData.shader = drawPlayer.cBody; + + Main.playerDrawData.Add(drawData); + break; + case AndromedaPlayerState.SmallRobot: + robotTexture = ModContent.GetTexture("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, + frame, + Color.White, + 0f, + drawPlayer.Size / 2, + 1f, + Main.projectile[robot].spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + 1); + drawData.shader = drawPlayer.cBody; + + Main.playerDrawData.Add(drawData); + break; + } + }); + + public static readonly PlayerLayer DyeInvisibilityFix = new PlayerLayer("CalamityMod", "DyeInvisibilityFix", PlayerLayer.Arms, drawInfo => + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + if (!drawPlayer.invis || + drawPlayer.itemAnimation > 0) + { + return; + } + for (int i = 0; i < Main.playerDrawData.Count; i++) + { + var copy = Main.playerDrawData[i]; + copy.shader = 0; // There's no other easy solution here to my knowledge since DrawData is a value type. + Main.playerDrawData[i] = copy; + } + }); + + #endregion + + #region Static Methods + public static void AddPlayerLayer(List list, PlayerLayer layer, PlayerLayer parent, bool first) + { + int insertAt = -1; + for (int m = 0; m < list.Count; m++) + { + PlayerLayer currentLayer = list[m]; + if (currentLayer.Name.Equals(parent.Name)) + { + insertAt = m; + break; + } + } + if (insertAt == -1) + list.Add(layer); + else list.Insert(first ? insertAt : insertAt + 1, layer); + } + #endregion + + #region Draw Hooks + + public override void ModifyDrawLayers(List list) + { + MiscEffectsBack.visible = true; + list.Insert(0, MiscEffectsBack); + + Skin.visible = true; + list.Insert(list.IndexOf(PlayerLayer.Skin) + 1, Skin); + + MiscEffects.visible = true; + list.Add(MiscEffects); + + // Remove shoe drawing effects if special legs are meant to be drawn. + if (CalamityLists.legOverrideList.Contains(player.legs)) + list[list.IndexOf(PlayerLayer.ShoeAcc)].visible = false; + + if (player.Calamity().fab || player.Calamity().crysthamyr || player.Calamity().onyxExcavator) + { + AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); + } + + if (player.Calamity().fathomSwarmerTail) + { + int skinIndex = list.IndexOf(PlayerLayer.Skin); + list.Insert(skinIndex - 1, Tail); + } + if (player.Calamity().forbiddenCirclet) + { + int drawTheStupidSign = list.IndexOf(PlayerLayer.Skin); + list.Insert(drawTheStupidSign, ForbiddenCircletSign); + } + list.Add(ColdDivinityOverlay); + list.Add(ConcentratedVoidAura); + list.Add(RoverDriveShield); + list.Add(StratusSphereDrawing); + list.Add(ProfanedMoonlightDyeEffects); + list.Add(AuralisAuroraEffects); + list.Add(AngelicAllianceAurora); + list.Add(IbanDevRobot); + list.Add(DyeInvisibilityFix); + } + + 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(); + + // Dust modifications while high. + if (calamityPlayer.trippy) + { + 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; + float maxShroomDust = Main.maxDustToDraw / 2; + for (int i = 0; i < Main.maxDustToDraw; i++) + { + Dust dust = Main.dust[i]; + if (dust.active) + { + // Only draw dust near the screen, for performance reasons. + if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(screenArea)) + { + dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + for (int j = 0; j < 4; j++) + { + 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); + if (j == 0 || j == 2) + 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; + + 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); + dustDrawn++; + } + + // Break if too many dust clones have been drawn + if (dustDrawn > maxShroomDust) + break; + } + } + } + } + } + + 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 + r *= 1f - (colorValue * 0.89f); //255 to 50 + 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; + } + + if (CalamityWorld.ironHeart && !Main.gameMenu) + { + Texture2D ironHeart = ModContent.GetTexture("CalamityMod/ExtraTextures/IronHeart"); + Main.heartTexture = Main.heart2Texture = ironHeart; + } + else + { + 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 + + int totalFruit = + (calamityPlayer.mFruit ? 1 : 0) + + (calamityPlayer.bOrange ? 1 : 0) + + (calamityPlayer.eBerry ? 1 : 0) + + (calamityPlayer.dFruit ? 1 : 0); + + switch (totalFruit) + { + default: + Main.heart2Texture = heartOriginal; + break; + case 4: + Main.heart2Texture = heart6; + break; + case 3: + Main.heart2Texture = heart5; + break; + case 2: + Main.heart2Texture = heart4; + break; + case 1: + Main.heart2Texture = heart3; + break; + } + + Main.heartTexture = heartOriginal2; + } + if (calamityPlayer.revivify) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + } + if (calamityPlayer.tRegen) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.Y -= 0.35f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.025f; + g *= 0.15f; + b *= 0.035f; + fullBright = true; + } + } + if (calamityPlayer.IBoots) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.05f; + g *= 0.05f; + b *= 0.05f; + fullBright = true; + } + } + } + if (calamityPlayer.elysianFire) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.75f; + g *= 0.55f; + b *= 0f; + fullBright = true; + } + } + } + if (calamityPlayer.dsSetBonus) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.025f; + b *= 0.1f; + fullBright = true; + } + } + } + if (calamityPlayer.auricSet) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.025f; + b *= 0.1f; + fullBright = true; + } + } + } + if (calamityPlayer.bFlames || calamityPlayer.aFlames || calamityPlayer.rageModeActive) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (calamityPlayer.shadowflame) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; + Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + if (Main.rand.NextBool(4)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } + if (calamityPlayer.sulphurPoison) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; + Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + if (Main.rand.NextBool(4)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + if (noRogueStealth) + { + r *= 0.65f; + b *= 0.75f; + fullBright = true; + } + } + if (calamityPlayer.adrenalineModeActive) + { + 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); + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.01f; + g *= 0.15f; + b *= 0.1f; + fullBright = true; + } + } + if (calamityPlayer.gsInferno) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (calamityPlayer.astralInfection) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.dust[dust].color = new Color(255, 255, 255, 0); + Main.playerDrawDust.Add(dust); + } + } + if (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.25f; + b *= 0.1f; + fullBright = true; + } + } + else if (calamityPlayer.eGravity) + { + if (Main.rand.NextBool(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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + } + if (calamityPlayer.pFlames) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.07f; + g *= 0.15f; + b *= 0.01f; + fullBright = true; + } + } + if (calamityPlayer.nightwither) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.25f; + b *= 0.1f; + fullBright = true; + } + } + if (calamityPlayer.vaporfied) + { + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 246, + 242, + 229, + 226, + 247, + 187, + 234 + }); + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + if (Main.rand.NextBool(4)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.25f; + b *= 0.1f; + fullBright = true; + } + } + if (calamityPlayer.eFreeze || calamityPlayer.silvaStun || calamityPlayer.gState || calamityPlayer.cDepth || calamityPlayer.eutrophication) + { + if (noRogueStealth) + { + r *= 0f; + g *= 0.05f; + b *= 0.3f; + fullBright = true; + } + } + if (calamityPlayer.draedonsHeart && !calamityPlayer.shadeRegen && !calamityPlayer.cFreeze && player.StandingStill() && player.itemAnimation == 0) + { + if (noRogueStealth) + { + r *= 0f; + g *= 0.5f; + b *= 0f; + fullBright = true; + } + } + if (calamityPlayer.bBlood) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (calamityPlayer.mushy) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + Main.dust[dust].velocity.Y -= 0.1f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.15f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } + } + if (calamityPlayer.bloodfinBoost) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + Main.playerDrawDust.Add(dust); + } + if (noRogueStealth) + { + r *= 0.5f; + g *= 0f; + b *= 0f; + fullBright = true; + } + } + if ((calamityPlayer.cadence || calamityPlayer.ladHearts > 0) && !player.loveStruck) + { + if (Main.rand.NextBool(5) && drawInfo.shadow == 0f) + { + Vector2 velocity = Main.rand.NextVector2Unit(); + 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)); + Main.gore[heart].sticky = false; + Main.gore[heart].velocity *= 0.4f; + Main.gore[heart].velocity.Y -= 0.6f; + Main.playerDrawGore.Add(heart); + } + } + } + #endregion + + #region Tanks/Backpacks + public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) + { + if (drawInfo.shadow != 0f) + return; + + Player drawPlayer = drawInfo.drawPlayer; + Item item = drawPlayer.ActiveItem(); + + if (!drawPlayer.frozen && + (item.IsAir || item.type > ItemID.None) && + !drawPlayer.dead && + (!drawPlayer.wet || !item.noWet) && + (drawPlayer.wings == 0 || drawPlayer.velocity.Y == 0f)) + { + //Make sure the lists are in the same order + List tankItems = new List() + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; + 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") + }; + if (tankItems.Contains(item.type) || drawPlayer.Calamity().plaguebringerCarapace) + { + Texture2D thingToDraw = null; + if (tankItems.Contains(item.type)) + { + for (int i = 0; i < tankItems.Count; i++) + { + if (item.type == tankItems[i]) + { + thingToDraw = tankTextures[i]; + break; + } + } + } + else if (drawPlayer.Calamity().plaguebringerCarapace) + thingToDraw = ModContent.GetTexture("CalamityMod/Items/Armor/PlaguebringerCarapace_Back"); + + if (thingToDraw is null) + return; + + SpriteEffects spriteEffects = player.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float num25 = -4f; + float num24 = -8f; + DrawData howDoIDrawThings = new DrawData(thingToDraw, + new Vector2((int)(drawPlayer.position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (9 * drawPlayer.direction)) + num25 * drawPlayer.direction, (int)(drawPlayer.position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num24 * drawPlayer.gravDir)), + new Rectangle(0, 0, thingToDraw.Width, thingToDraw.Height), + drawInfo.middleArmorColor, + drawPlayer.bodyRotation, + new Vector2(thingToDraw.Width / 2, thingToDraw.Height / 2), + 1f, + spriteEffects, + 0); + howDoIDrawThings.shader = 0; + Main.playerDrawData.Add(howDoIDrawThings); + } + } + } + #endregion + } +} diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index d803b09b2d..384e497e88 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Accessories; +using CalamityMod.Events; using CalamityMod.Items.Fishing; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; @@ -49,7 +50,7 @@ namespace CalamityMod.CalPlayer canSulphurFish = true; // Old Duke spawn - if (canSulphurFish && bait.type == ModContent.ItemType() && water) + if (canSulphurFish && bait.type == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) { CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, ModContent.NPCType(), bait.type); } @@ -94,11 +95,11 @@ namespace CalamityMod.CalPlayer if (lava) { - CalamityUtils.AddWithCondition(fishList, ItemID.FlarefinKoi, !modPlayer.ZoneCalamity); - CalamityUtils.AddWithCondition(fishList, ItemID.Obsidifish, !modPlayer.ZoneCalamity); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneCalamity); + fishList.AddWithCondition(ItemID.FlarefinKoi, !modPlayer.ZoneCalamity); + fishList.AddWithCondition(ItemID.Obsidifish, !modPlayer.ZoneCalamity); + fishList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneCalamity); + fishList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneCalamity); + fishList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneCalamity); } else if (water) { @@ -107,24 +108,24 @@ namespace CalamityMod.CalPlayer fishList.Add(ItemID.ArmoredCavefish); fishList.Add(ItemID.Stinkfish); fishList.Add(ItemID.SpecularFish); - CalamityUtils.AddWithCondition(fishList, ItemID.ChaosFish, player.ZoneHoly); - CalamityUtils.AddWithCondition(fishList, ItemID.VariegatedLardfish, player.ZoneJungle); + fishList.AddWithCondition(ItemID.ChaosFish, player.ZoneHoly); + fishList.AddWithCondition(ItemID.VariegatedLardfish, player.ZoneJungle); } if (player.ZoneOverworldHeight || player.ZoneSkyHeight) { - CalamityUtils.AddWithCondition(fishList, ItemID.DoubleCod, player.ZoneJungle); + fishList.AddWithCondition(ItemID.DoubleCod, player.ZoneJungle); } - CalamityUtils.AddWithCondition(fishList, ItemID.FrostMinnow, player.ZoneSnow); - CalamityUtils.AddWithCondition(fishList, ItemID.Ebonkoi, player.ZoneCorrupt); - CalamityUtils.AddWithCondition(fishList, ItemID.CrimsonTigerfish, player.ZoneCrimson); - CalamityUtils.AddWithCondition(fishList, ItemID.Hemopiranha, player.ZoneCrimson); - CalamityUtils.AddWithCondition(fishList, ItemID.PrincessFish, player.ZoneHoly); - CalamityUtils.AddWithCondition(fishList, ItemID.Prismite, player.ZoneHoly); - CalamityUtils.AddWithCondition(fishList, ItemID.Damselfish, player.ZoneSkyHeight); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneAstral); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneSunkenSea); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneSunkenSea); - CalamityUtils.AddWithCondition(fishList, ModContent.ItemType(), modPlayer.ZoneSunkenSea); + 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(), modPlayer.ZoneAstral); + fishList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneSunkenSea); + fishList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneSunkenSea); + fishList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneSunkenSea); } if (fishList.Any()) @@ -132,6 +133,7 @@ namespace CalamityMod.CalPlayer int fishAmt = fishList.Count; int caughtFish = fishList[Main.rand.Next(fishAmt)]; caughtType = caughtFish; + return; } } } @@ -227,9 +229,9 @@ namespace CalamityMod.CalPlayer { rareItemList.Add(ItemID.ScalyTruffle); } - CalamityUtils.AddWithCondition(rareItemList, ItemID.Toxikarp, player.ZoneCorrupt); - CalamityUtils.AddWithCondition(rareItemList, ItemID.Bladetongue, player.ZoneCrimson); - CalamityUtils.AddWithCondition(rareItemList, 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()) { @@ -246,15 +248,15 @@ namespace CalamityMod.CalPlayer { List biomeCrateList = new List(); - CalamityUtils.AddWithCondition(biomeCrateList, ModContent.ItemType(), modPlayer.ZoneAstral); - CalamityUtils.AddWithCondition(biomeCrateList, ModContent.ItemType(), modPlayer.ZoneSunkenSea); - CalamityUtils.AddWithCondition(biomeCrateList, ModContent.ItemType(), canSulphurFish); - CalamityUtils.AddWithCondition(biomeCrateList, ItemID.CorruptFishingCrate, player.ZoneCorrupt); - CalamityUtils.AddWithCondition(biomeCrateList, ItemID.CrimsonFishingCrate, player.ZoneCrimson); - CalamityUtils.AddWithCondition(biomeCrateList, ItemID.HallowedFishingCrate, player.ZoneHoly); - CalamityUtils.AddWithCondition(biomeCrateList, ItemID.DungeonFishingCrate, player.ZoneDungeon); - CalamityUtils.AddWithCondition(biomeCrateList, ItemID.JungleFishingCrate, player.ZoneJungle); - CalamityUtils.AddWithCondition(biomeCrateList, ItemID.FloatingIslandFishingCrate, player.ZoneSkyHeight); + biomeCrateList.AddWithCondition(ModContent.ItemType(), modPlayer.ZoneAstral); + biomeCrateList.AddWithCondition(ModContent.ItemType(), modPlayer.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); if (biomeCrateList.Any()) { @@ -284,7 +286,7 @@ namespace CalamityMod.CalPlayer } if ((player.ZoneCrimson || player.ZoneCorrupt) && player.ZoneRockLayerHeight && Main.hardMode) { - if (Main.rand.NextBool(15)) + if (Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } @@ -292,7 +294,7 @@ namespace CalamityMod.CalPlayer if (player.ZoneHoly && player.ZoneRockLayerHeight && Main.hardMode) { - if (Main.rand.NextBool(15)) + if (Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } @@ -300,13 +302,9 @@ namespace CalamityMod.CalPlayer if (player.ZoneSkyHeight && Main.hardMode) { - if (Main.rand.NextBool(15)) + if (Main.rand.NextBool(25)) { - caughtType = ModContent.ItemType(); - } - else if (Main.rand.NextBool(14)) - { - caughtType = ModContent.ItemType(); + caughtType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); } } @@ -320,7 +318,7 @@ namespace CalamityMod.CalPlayer if (player.ZoneOverworldHeight && Main.dayTime) { - if (Main.rand.NextBool(15)) + if (Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } @@ -328,7 +326,7 @@ namespace CalamityMod.CalPlayer if (player.ZoneRockLayerHeight) { - if (Main.rand.NextBool(15)) + if (Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } @@ -336,7 +334,7 @@ namespace CalamityMod.CalPlayer if (player.ZoneSnow) { - if (Main.rand.NextBool(15) && Main.hardMode) + if (Main.rand.NextBool(25) && Main.hardMode) { caughtType = ModContent.ItemType(); } @@ -365,11 +363,11 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (player.cratePotion && astralFish <= 28 && astralFish >= 9) // 20% + else if (player.cratePotion && astralFish <= 18 && astralFish >= 9) // 10% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && astralFish <= 18 && astralFish >= 9) // 10% + else if (!player.cratePotion && astralFish <= 13 && astralFish >= 9) // 5% { caughtType = ModContent.ItemType(); } @@ -385,7 +383,7 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else // 31% w/o crate pot, 21% w/ crate pot + else // 36% w/o crate pot, 31% w/ crate pot { caughtType = ModContent.ItemType(); return; @@ -407,11 +405,11 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (player.cratePotion && sunkenFish <= 28 && sunkenFish >= 9) // 20% + else if (player.cratePotion && sunkenFish <= 18 && sunkenFish >= 9) // 10% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && sunkenFish <= 18 && sunkenFish >= 9) // 10% + else if (!player.cratePotion && sunkenFish <= 13 && sunkenFish >= 9) // 5% { caughtType = ModContent.ItemType(); } @@ -431,7 +429,7 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else // 33% w/o crate pot, 23% w/ crate pot + 18% if prehardmode + else // 38% w/o crate pot, 33% w/ crate pot + 18% if prehardmode { caughtType = ModContent.ItemType(); return; @@ -498,7 +496,7 @@ namespace CalamityMod.CalPlayer if (player.ZoneOverworldHeight && Main.bloodMoon) { - if (Main.rand.NextBool(15)) + if (Main.rand.NextBool(25)) { caughtType = ModContent.ItemType(); } @@ -526,11 +524,11 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (player.cratePotion && cragFish <= 40 && cragFish >= 21) // 20% + else if (player.cratePotion && cragFish <= 30 && cragFish >= 21) // 10% { caughtType = ModContent.ItemType(); } - else if (!player.cratePotion && cragFish <= 30 && cragFish >= 21) // 10% + else if (!player.cratePotion && cragFish <= 25 && cragFish >= 21) // 5% { caughtType = ModContent.ItemType(); } @@ -538,7 +536,7 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else if (cragFish <= 10 && cragFish >= 5) // 5% + else if (cragFish <= 10 && cragFish >= (Main.hardMode ? 8 : 6)) // 5% (3% hardmode) { caughtType = ModContent.ItemType(); } @@ -546,7 +544,7 @@ namespace CalamityMod.CalPlayer { caughtType = ModContent.ItemType(); } - else // 27% w/o crate pot, 17% w/ crate pot, add 10% pre-Prov, add another 14% prehardmode + else // 32% w/o crate pot, 27% w/ crate pot, add 10% pre-Prov, add another 12% prehardmode { caughtType = ModContent.ItemType(); } @@ -562,9 +560,9 @@ namespace CalamityMod.CalPlayer if ((modPlayer.ZoneAstral || modPlayer.ZoneAbyss || modPlayer.ZoneSulphur) && bait.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); - if (Main.player[Main.myPlayer].ZoneSnow && fishingRod.type == ModContent.ItemType()) + if (player.ZoneSnow && fishingRod.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); - if (Main.player[Main.myPlayer].ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) + if (player.ZoneSkyHeight && fishingRod.type == ModContent.ItemType()) fishingLevel = (int)(fishingLevel * 1.1f); if (bait.type == ModContent.ItemType()) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index e680e9c1b6..9ff187cf56 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Projectiles.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -17,12 +19,20 @@ namespace CalamityMod.CalPlayer Point point = player.Center.ToTileCoordinates(); CalamityPlayer modPlayer = player.Calamity(); - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - int lifeRegenMult = death ? 2 : 1; + if (CalamityWorld.ironHeart || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + modPlayer.noLifeRegen = true; + + bool death = CalamityWorld.death || CalamityWorld.malice || BossRushEvent.BossRushActive; + double lifeRegenMult = death ? 1.5 : 1D; + if (modPlayer.reaverDefense) + lifeRegenMult *= 0.8; int lifeRegenLost = 0; // Initial Debuffs - + + // Get fucked, Nebula Armor + player.nebulaLevelLife = 0; + // Vanilla if (death) { @@ -85,6 +95,15 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 16; } + if (modPlayer.weakBrimstoneFlames) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + lifeRegenLost += 5; + } + if (modPlayer.bFlames) { if (player.lifeRegen > 0) @@ -139,7 +158,7 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 20; } - if (modPlayer.ZoneSulphur && player.IsUnderwater() && !modPlayer.aquaticScourgeLore && !modPlayer.decayEffigy) + if (modPlayer.ZoneSulphur && player.IsUnderwater() && !modPlayer.decayEffigy && !player.lavaWet && !player.honeyWet) { player.AddBuff(ModContent.BuffType(), 2, true); modPlayer.pissWaterBoost++; @@ -199,7 +218,29 @@ namespace CalamityMod.CalPlayer lifeRegenLost += 16; } - if (modPlayer.pFlames) + if (modPlayer.banishingFire) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + lifeRegenLost += 60; + } + + if (modPlayer.waterLeechBleeding) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + lifeRegenLost += 6; + if (CalamityWorld.downedAquaticScourge) + lifeRegenLost += 6; + if (CalamityWorld.downedPolterghast) + lifeRegenLost += 12; + } + + if (modPlayer.pFlames) { if (player.lifeRegen > 0) player.lifeRegen = 0; @@ -343,6 +384,8 @@ namespace CalamityMod.CalPlayer } if (modPlayer.alcoholPoisonLevel > 3) { + player.nebulaLevelLife = 0; + if (player.whoAmI == Main.myPlayer) player.AddBuff(ModContent.BuffType(), 2, false); @@ -366,12 +409,38 @@ namespace CalamityMod.CalPlayer if (player.lifeRegen > 0) player.lifeRegen = 0; lifeRegenLost += 42; //the meaning of death - } + } - player.lifeRegen -= lifeRegenLost * lifeRegenMult; + if (modPlayer.witheredDebuff) + { + modPlayer.witheredWeaponHoldTime += modPlayer.witheringWeaponEnchant.ToDirectionInt(); + if (modPlayer.witheredWeaponHoldTime < 0) + { + modPlayer.witheredWeaponHoldTime = 0; + } + else + { + lifeRegenLost += (int)(5D * Math.Pow(1.5D, modPlayer.witheredWeaponHoldTime / 87D)); + if (player.lifeRegen > 0) + player.lifeRegen = 0; + } + } + else + modPlayer.witheredWeaponHoldTime = 0; + + player.lifeRegen -= (int)(lifeRegenLost * lifeRegenMult); // Buffs + if (modPlayer.divineBless) + { + if (player.whoAmI == Main.myPlayer && player.miscCounter % 15 == 0) // Flat 4 health per second + { + if (!modPlayer.noLifeRegen) + player.statLife += 1; + } + } + if (modPlayer.bloodfinBoost) { if (player.lifeRegen < 0) @@ -386,12 +455,15 @@ namespace CalamityMod.CalPlayer player.lifeRegen += 5; player.lifeRegenTime += 10; } + if (modPlayer.bloodfinTimer > 0) - { modPlayer.bloodfinTimer--; } - if (player.whoAmI == Main.myPlayer && modPlayer.bloodfinTimer <= 0) + modPlayer.bloodfinTimer--; + + if (player.whoAmI == Main.myPlayer && modPlayer.bloodfinTimer <= 0) { modPlayer.bloodfinTimer = 30; - if (player.statLife <= (int)(player.statLifeMax2 * 0.75) && !CalamityWorld.ironHeart) + + if (player.statLife < (int)(player.statLifeMax2 * 0.75) && !modPlayer.noLifeRegen) player.statLife += 1; } } @@ -402,13 +474,14 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; - lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); + lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); } + int defenseBoost = modPlayer.astralArcanum ? 20 : 15; if (lesserEffect) { - player.lifeRegen += 1; - player.statDefense += 20; + player.lifeRegen += modPlayer.astralArcanum ? 2 : 1; + player.statDefense += defenseBoost; } else { @@ -417,11 +490,11 @@ namespace CalamityMod.CalPlayer if (player.lifeRegenTime < 1800) player.lifeRegenTime = 1800; - player.lifeRegen += 4; - player.statDefense += 20; + player.lifeRegen += modPlayer.astralArcanum ? 6 : 4; + player.statDefense += defenseBoost; } else - player.lifeRegen += 2; + player.lifeRegen += modPlayer.astralArcanum ? 3 : 2; } } else if (modPlayer.crownJewel) @@ -430,7 +503,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; - lesserEffect = CalamityMod.alcoholList.Contains(hasBuff); + lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); } if (lesserEffect) @@ -442,17 +515,17 @@ namespace CalamityMod.CalPlayer if (player.lifeRegenTime < 1800) player.lifeRegenTime = 1800; - player.lifeRegen += 2; + player.lifeRegen += 4; player.statDefense += 10; } else - player.lifeRegen += 1; + player.lifeRegen += 2; } } // Last Debuffs - if (CalamityWorld.ironHeart || modPlayer.omegaBlueChestplate || modPlayer.godSlayerCooldown || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (modPlayer.noLifeRegen) { if (player.lifeRegen > 0) player.lifeRegen = 0; @@ -492,20 +565,22 @@ namespace CalamityMod.CalPlayer if (player.lavaRose) lifeRegenDown = 3; - player.lifeRegen -= lifeRegenDown * lifeRegenMult; + player.lifeRegen -= (int)(lifeRegenDown * lifeRegenMult); } if (modPlayer.hInferno) { + player.nebulaLevelLife = 0; + modPlayer.hInfernoBoost++; if (player.lifeRegen > 0) player.lifeRegen = 0; player.lifeRegenTime = 0; - player.lifeRegen -= modPlayer.hInfernoBoost * lifeRegenMult; + player.lifeRegen -= (int)(modPlayer.hInfernoBoost * lifeRegenMult); - if (player.lifeRegen < -200) + if (player.lifeRegen < -200) player.lifeRegen = -200; } else @@ -517,11 +592,13 @@ namespace CalamityMod.CalPlayer { if (player.statLife > 100) { + player.nebulaLevelLife = 0; + if (player.lifeRegen > 0) player.lifeRegen = 0; player.lifeRegenTime = 0; - player.lifeRegen -= 160 * lifeRegenMult; + player.lifeRegen -= (int)(160D * lifeRegenMult); } } } @@ -532,7 +609,7 @@ namespace CalamityMod.CalPlayer player.mount.Dismount(player); } - if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) + if (modPlayer.lol || (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) || (modPlayer.dashMod == 9 && player.dashDelay < 0)) { if (player.lifeRegen < 0) player.lifeRegen = 0; @@ -588,7 +665,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.absorber) { if (player.StandingStill() && player.itemAnimation == 0) - player.lifeRegen += 2; + player.lifeRegen += 4; } if (modPlayer.aAmpoule) @@ -602,6 +679,11 @@ namespace CalamityMod.CalPlayer player.lifeRegenTime += 1; player.lifeRegen += 2; } + else if (modPlayer.rOoze) + { + if (!Main.dayTime) + player.lifeRegen += 4; + } if (modPlayer.ursaSergeant) { @@ -640,31 +722,47 @@ namespace CalamityMod.CalPlayer player.lifeRegen += 3; } + if (modPlayer.phantomicHeartRegen <= 720 && modPlayer.phantomicHeartRegen >= 600) + { + 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); + 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; + } + } + if (modPlayer.community) { - float floatTypeBoost = 0.01f + + float floatTypeBoost = 0.05f + (NPC.downedSlimeKing ? 0.01f : 0f) + (NPC.downedBoss1 ? 0.01f : 0f) + (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + + (NPC.downedBoss3 ? 0.01f : 0f) + // 0.1 (Main.hardMode ? 0.01f : 0f) + (NPC.downedMechBossAny ? 0.01f : 0f) + (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + + (NPC.downedFishron ? 0.01f : 0f) + // 0.15 (NPC.downedAncientCultist ? 0.01f : 0f) + (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 + (CalamityWorld.downedProvidence ? 0.01f : 0f) + + (CalamityWorld.downedDoG ? 0.01f : 0f) + + (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 int integerTypeBoost = (int)(floatTypeBoost * 50f); int regenBoost = 1 + (integerTypeBoost / 5); bool lesserEffect = false; for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; - bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); + bool shouldAffect = CalamityLists.alcoholList.Contains(hasBuff); if (shouldAffect) lesserEffect = true; } @@ -674,13 +772,9 @@ namespace CalamityMod.CalPlayer if (modPlayer.regenator) { - player.lifeRegenTime += 8; - player.lifeRegen += 16; + player.lifeRegenTime += 6; + player.lifeRegen += 12; } - if (modPlayer.camper) - { - player.lifeRegen += 2; - } if (modPlayer.handWarmer && modPlayer.eskimoSet) { player.lifeRegen += 2; @@ -689,6 +783,10 @@ namespace CalamityMod.CalPlayer { player.lifeRegen += 2; } + if (modPlayer.avertorBonus) + { + player.lifeRegen += 4; + } if (modPlayer.bloodflareSummon) { @@ -698,14 +796,37 @@ namespace CalamityMod.CalPlayer if (modPlayer.fearmongerSet && modPlayer.fearmongerRegenFrames > 0) { - player.lifeRegen += 14; - player.lifeRegenTime += 7; + player.lifeRegen += 7; + if (player.lifeRegenTime < 1800) player.lifeRegenTime = 1800; + + player.lifeRegenTime += 4; } - if (modPlayer.etherealExtorter && player.ZoneGlowshroom) - player.lifeRegen += 1; + if (modPlayer.pinkCandle && !modPlayer.noLifeRegen) + { + // Every frame, add up 1/60th of the healing value (0.4% max HP per second) + modPlayer.pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60; + + if (modPlayer.pinkCandleHealFraction >= 1D) + { + modPlayer.pinkCandleHealFraction = 0D; + + if (player.statLife < player.statLifeMax2) + player.statLife++; + } + } + else + modPlayer.pinkCandleHealFraction = 0D; + + if (modPlayer.reaverRegen && modPlayer.reaverRegenCooldown >= 60) + { + modPlayer.reaverRegenCooldown = 0; + + if (player.statLife != player.statLifeMax2 && !modPlayer.noLifeRegen) + player.statLife += 1; + } // Standing still healing bonuses (all exclusive with vanilla Shiny Stone) if (!player.shinyStone) @@ -824,11 +945,10 @@ namespace CalamityMod.CalPlayer // The Camper regen boost activates while moving so it can stack with Shiny Stone like effects if (modPlayer.camper && player.statLife < modPlayer.actualMaxLife && !player.StandingStill()) { - float camperRegenMult = CalamityPlayer.areThereAnyDamnBosses ? 1.3f : 1.75f; - int camperCap = CalamityPlayer.areThereAnyDamnBosses ? 20 : 30; - player.lifeRegen = (int)((player.lifeRegen * 2) * camperRegenMult); - player.lifeRegenCount = player.lifeRegenCount > camperCap ? player.lifeRegenCount : camperCap; - player.lifeRegenCount++; + float camperRegenMult = CalamityPlayer.areThereAnyDamnBosses ? 1.25f : 2f; + int camperRegenCount = CalamityPlayer.areThereAnyDamnBosses ? 1 : 4; + 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); @@ -842,40 +962,28 @@ namespace CalamityMod.CalPlayer } } - if (CalamityWorld.revenge) + if (player.statLife < modPlayer.actualMaxLife) { - if (player.statLife < modPlayer.actualMaxLife) - { - bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis || modPlayer.camper) && - player.StandingStill() && player.itemAnimation == 0; + bool noLifeRegenCap = (player.shinyStone || modPlayer.draedonsHeart || modPlayer.cFreeze || modPlayer.shadeRegen || modPlayer.photosynthesis || modPlayer.camper) && + player.StandingStill() && player.itemAnimation == 0; - if (!noLifeRegenCap) + if (!noLifeRegenCap) + { + // Max HP = 400 + // 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 / modPlayer.actualMaxLife)) * 10f); // 9 to 0 (1% HP to 100%) + if (player.lifeRegen > lifeRegenScale) { - // Max HP = 400 - // 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 / modPlayer.actualMaxLife)) * 10f); // 9 to 0 (1% HP to 100%) - if (player.lifeRegen > lifeRegenScale) - { - float lifeRegenScalar = 1f + (player.statLife / modPlayer.actualMaxLife); // 1 to 2 (1% HP to 100%) - int defLifeRegen = (int)(player.lifeRegen / lifeRegenScalar); - player.lifeRegen = defLifeRegen; - } + float lifeRegenScalar = 1f + (player.statLife / modPlayer.actualMaxLife); // 1 to 2 (1% HP to 100%) + int defLifeRegen = (int)(player.lifeRegen / lifeRegenScalar); + player.lifeRegen = defLifeRegen; } } } - if (player.lifeRegen > 0) - { - if (modPlayer.plaguebringerGoliathLore) - player.lifeRegen /= 2; - - if (modPlayer.eaterOfWorldsLore) - player.lifeRegen /= 2; - } - - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { if (CalamityConfig.Instance.BossRushHealthCurse) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 0c9f1bbcac..75fa58af1d 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; @@ -5,6 +6,9 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Items; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Fishing.BrimstoneCragCatches; @@ -13,16 +17,19 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Other; +using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Environment; -using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -38,6 +45,7 @@ using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; namespace CalamityMod.CalPlayer { @@ -50,6 +58,14 @@ namespace CalamityMod.CalPlayer // No category + // Give the player some jump speed boost at base while wings or balloons are equipped + if (player.wingsLogic > 0 || player.jumpBoost) + player.jumpSpeedBoost += 1.2f; + + // Reduce balloon jump boosts because they'd be too powerful when stacked with wings + if (player.jumpBoost) + player.jumpSpeedBoost -= 0.75f; + // Decrease the counter on Fearmonger set turbo regeneration if (modPlayer.fearmongerRegenFrames > 0) modPlayer.fearmongerRegenFrames--; @@ -59,17 +75,14 @@ namespace CalamityMod.CalPlayer Main.expertDebuffTime = 1f; // Bool for any existing bosses, true if any boss NPC is active - CalamityPlayer.areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); + CalamityPlayer.areThereAnyDamnBosses = CalamityUtils.AnyBossNPCS(); // Bool for any existing events, true if any event is active CalamityPlayer.areThereAnyDamnEvents = CalamityGlobalNPC.AnyEvents(player); - // If any boss NPC is active, apply Zen to the player to reduce spawn rate - if (CalamityPlayer.areThereAnyDamnBosses) - { - if (player.whoAmI == Main.myPlayer) - player.AddBuff(ModContent.BuffType(), 2, false); - } + // Hurt the nearest NPC to the mouse if using the burning mouse. + if (modPlayer.blazingMouseDamageEffects) + HandleBlazingMouseEffects(player, modPlayer); // Revengeance effects RevengeanceModeMiscEffects(player, modPlayer, mod); @@ -95,9 +108,6 @@ namespace CalamityMod.CalPlayer // Limits Limits(player, modPlayer); - // Endurance reductions - EnduranceReductions(player, modPlayer); - // Stat Meter UpdateStatMeter(player, modPlayer); @@ -109,13 +119,29 @@ namespace CalamityMod.CalPlayer // Potions (Quick Buff && Potion Sickness) HandlePotions(player, modPlayer); + + // Update all particle sets for items. + // This must be done here instead of in the item logic because these sets are not properly instanced + // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. + CalamityGlobalItem.UpdateAllParticleSets(); + + // Regularly sync player stats during multiplayer + if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + { + modPlayer.packetTimer++; + if (modPlayer.packetTimer == CalamityPlayer.GlobalSyncPacketTimer) + { + modPlayer.packetTimer = 0; + modPlayer.StandardSync(); + } + } } #endregion #region Revengeance Effects private static void RevengeanceModeMiscEffects(Player player, CalamityPlayer modPlayer, Mod mod) { - if (CalamityWorld.revenge) + if (CalamityWorld.revenge || CalamityWorld.malice) { // This effect is way too annoying during the fight so I disabled it - Fab // Signus headcrab effect @@ -169,7 +195,7 @@ namespace CalamityMod.CalPlayer }*/ // Adjusts the life steal cap in rev/death - float lifeStealCap = CalamityWorld.death ? 50f : 60f; + float lifeStealCap = CalamityWorld.malice ? 30f : CalamityWorld.death ? 50f : 60f; /*if (Main.masterMode) lifeStealCap *= 0.75f;*/ if (player.lifeSteal > lifeStealCap) @@ -189,112 +215,19 @@ namespace CalamityMod.CalPlayer } // Immunity Frames nerf - if (player.immuneTime > 120) - player.immuneTime = 120; + int immuneTimeLimit = 150; + if (player.immuneTime > immuneTimeLimit) + player.immuneTime = immuneTimeLimit; + + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + if (player.hurtCooldowns[k] > immuneTimeLimit) + player.hurtCooldowns[k] = immuneTimeLimit; + } // Adrenaline and Rage - if (CalamityConfig.Instance.Rippers) - { - // This is how much Rage will be changed by this frame. - float rageDiff = 0; - - // If Rage Mode is currently active, you smoothly lose all rage over the duration. - if (modPlayer.rageModeActive) - rageDiff = -modPlayer.rageMax / CalamityPlayer.RageDuration; - - // Draedon's Heart gives 1 rage per frame. Heart of Darkness gives 0.5 rage per frame. - else if (modPlayer.draedonsHeart) - rageDiff += 1f; - else if (modPlayer.heartOfDarkness) - rageDiff += 0.5f; - - // Apply the rage change and cap rage in both directions. - modPlayer.rage += rageDiff; - if (modPlayer.rage < 0) - modPlayer.rage = 0; - - if (modPlayer.rage >= modPlayer.rageMax) - { - modPlayer.rage = modPlayer.rageMax; - - // Play a sound when the Rage Meter is full - if (modPlayer.playFullRageSound) - { - modPlayer.playFullRageSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); - } - } - else - modPlayer.playFullRageSound = true; - - // Randomly-granted Absolute Rage buff when Rage is nearly full - if (modPlayer.rage / modPlayer.rageMax >= CalamityPlayer.AbsoluteRageThreshold && !modPlayer.absoluteRage) - { - int absoluteRageChance = (modPlayer.draedonsHeart || modPlayer.heartOfDarkness) ? 2000 : 10000; - if (Main.rand.NextBool(absoluteRageChance)) - player.AddBuff(ModContent.BuffType(), 18000); - } - - // 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); - - // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. - if (modPlayer.adrenalineModeActive) - adrenalineDiff = -modPlayer.adrenalineMax / CalamityPlayer.AdrenalineDuration; - - else - { - // If any boss is alive (or you are between DoG phases), you gain adrenaline smoothly. - // EXCEPTION: Wall of Flesh is alive and you are not in hell. Then you don't get anything. - if ((CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0) && !wofAndNotHell) - { - int numAdrenBoosts = - (modPlayer.adrenalineBoostOne ? 1 : 0) + - (modPlayer.adrenalineBoostTwo ? 1 : 0) + - (modPlayer.adrenalineBoostThree ? 1 : 0); - - int adrenFillSeconds = 3600; - switch (numAdrenBoosts) - { - default: adrenFillSeconds = 45; break; // Early game: 45 seconds - case 1: adrenFillSeconds = 35; break; // Slime God: 35 seconds - case 2: adrenFillSeconds = 25; break; // Astrum Deus: 25 sceonds - case 3: adrenFillSeconds = 20; break; // Polterghast: 20 seconds - } - adrenalineDiff += modPlayer.adrenalineMax / (60f * adrenFillSeconds); - } - - // If you aren't actively in a boss fight, adrenaline rapidly fades away over 2 seconds. - else - adrenalineDiff = -modPlayer.adrenalineMax / 120f; - } - - // All positive adrenaline gains are multiplied by 44.44444% during the SCal fight. - // This is likely to be changed so that SCal cancels the items directly. - if (SCalAlive && adrenalineDiff > 0f) - adrenalineDiff *= 4f / 9f; - - // Apply the adrenaline change and cap adrenaline in both directions. - modPlayer.adrenaline += adrenalineDiff; - if (modPlayer.adrenaline < 0) - modPlayer.adrenaline = 0; - - if (modPlayer.adrenaline >= modPlayer.adrenalineMax) - { - modPlayer.adrenaline = modPlayer.adrenalineMax; - - // Play a sound when the Adrenaline Meter is full - if (modPlayer.playFullAdrenalineSound) - { - modPlayer.playFullAdrenalineSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); - } - } - else - modPlayer.playFullAdrenalineSound = true; - } + if (CalamityConfig.Instance.Rippers && CalamityWorld.revenge) + UpdateRippers(mod, player, modPlayer); } } @@ -304,26 +237,269 @@ namespace CalamityMod.CalPlayer modPlayer.rage = 0; modPlayer.adrenaline = 0; } + } - // Send Rage and Adrenaline info packets during multiplayer - if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) + private static void UpdateRippers(Mod mod, Player player, CalamityPlayer modPlayer) + { + // Figure out Rage's current duration based on boosts. + if (modPlayer.rageBoostOne) + modPlayer.RageDuration += CalamityPlayer.RageDurationPerBooster; + if (modPlayer.rageBoostTwo) + modPlayer.RageDuration += CalamityPlayer.RageDurationPerBooster; + if (modPlayer.rageBoostThree) + modPlayer.RageDuration += CalamityPlayer.RageDurationPerBooster; + + // Tick down "Rage Combat Frames". When they reach zero, Rage begins fading away. + if (modPlayer.rageCombatFrames > 0) + --modPlayer.rageCombatFrames; + + // Tick down the Rage gain cooldown. + if (modPlayer.rageGainCooldown > 0) + --modPlayer.rageGainCooldown; + + // This is how much Rage will be changed by this frame. + float rageDiff = 0; + + // If the player equips multiple rage generation accessories they get the max possible effect without stacking any of them. { - modPlayer.packetTimer++; - if (modPlayer.packetTimer == 60) + float rageGen = 0f; + + // Draedon's Heart provides constant rage generation that scales with missing health. + if (modPlayer.draedonsHeart) { - modPlayer.packetTimer = 0; - modPlayer.StressPacket(false); - modPlayer.AdrenalinePacket(false); - modPlayer.DeathModeUnderworldTimePacket(false); - modPlayer.DeathModeBlizzardTimePacket(false); + float percentMissingHealth = 1f - player.statLife / player.statLifeMax2; + float rageGainLerp = MathHelper.Lerp(DraedonsHeart.MinRagePerSecond, DraedonsHeart.MaxRagePerSecond, percentMissingHealth); + float dhRageGen = modPlayer.rageMax * rageGainLerp / 60f; + if (rageGen < dhRageGen) + rageGen = dhRageGen; + } + // Shattered Community provides constant rage generation (stronger than Heart of Darkness). + if (modPlayer.shatteredCommunity) + { + float scRageGen = modPlayer.rageMax * ShatteredCommunity.RagePerSecond / 60f; + if (rageGen < scRageGen) + rageGen = scRageGen; + } + // Heart of Darkness grants constant rage generation. + else if (modPlayer.heartOfDarkness) + { + float hodRageGen = modPlayer.rageMax * HeartofDarkness.RagePerSecond / 60f; + if (rageGen < hodRageGen) + rageGen = hodRageGen; + } + + rageDiff += rageGen; + } + + // Holding Gael's Greatsword grants constant rage generation. + if (modPlayer.heldGaelsLastFrame) + rageDiff += modPlayer.rageMax * GaelsGreatsword.RagePerSecond / 60f; + + // Calculate and grant proximity rage. + // Regular enemies can give up to 1x proximity rage. Bosses can give up to 3x. Multiple regular enemies don't stack. + // Proximity rage is maxed out when within 10 blocks (160 pixels) of the enemy's hitbox. + // Its max range is 50 blocks (800 pixels), at which you get zero proximity rage. + // Proximity rage does not generate while Rage Mode is active. + if (!modPlayer.rageModeActive) + { + float bossProxRageMultiplier = 3f; + float minProxRageDistance = 160f; + float maxProxRageDistance = 800f; + float enemyDistance = maxProxRageDistance + 1f; + float bossDistance = maxProxRageDistance + 1f; + + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (npc is null || !npc.IsAnEnemy() || npc.Calamity().DoesNotGenerateRage) + continue; + + // 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; + + // If this enemy is closer than the previous, reduce the current minimum proximity distance. + if (enemyDistance > hitboxEdgeDist) + { + enemyDistance = hitboxEdgeDist; + + // If they're a boss, reduce the boss distance. + // Boss distance will always be >= enemy distance, so there's no need to do another check. + // Worm boss body and tail segments are not counted as bosses for this calculation. + if (npc.IsABoss() && !CalamityLists.noRageWormSegmentList.Contains(npc.type)) + bossDistance = hitboxEdgeDist; + } + } + + // Helper function to implement proximity rage formula + float ProxRageFromDistance(float dist) + { + // Adjusted distance with the 160 grace pixels added in. If you're closer than that it counts as zero. + float d = Math.Max(dist - minProxRageDistance, 0f); + + // The first term is exponential decay which reduces rage gain significantly over distance. + // The second term is a linear component which allows a baseline but weak rage generation even at far distances. + // This function takes inputs from 0.0 to 640.0 and returns a value from 1.0 to 0.0. + float r = 1f / (0.034f * d + 2f) + (590.5f - d) / 1181f; + return MathHelper.Clamp(r, 0f, 1f); + } + + // If anything is close enough then provide proximity rage. + // You can only get proximity rage from one target at a time. You gain rage from whatever target would give you the most rage. + if (enemyDistance <= maxProxRageDistance) + { + // If the player is close enough to get proximity rage they are also considered to have rage combat frames. + // This prevents proximity rage from fading away unless you run away without attacking for some reason. + modPlayer.rageCombatFrames = Math.Max(modPlayer.rageCombatFrames, 3); + + float proxRageFromEnemy = ProxRageFromDistance(enemyDistance); + float proxRageFromBoss = 0f; + if (bossDistance <= maxProxRageDistance) + proxRageFromBoss = bossProxRageMultiplier * ProxRageFromDistance(bossDistance); + + float finalProxRage = Math.Max(proxRageFromEnemy, proxRageFromBoss); + + // 300% proximity rage (max possible from a boss) will fill the Rage meter in 15 seconds. + // 100% proximity rage (max possible from an enemy) will fill the Rage meter in 45 seconds. + rageDiff += finalProxRage * modPlayer.rageMax / CalamityUtils.SecondsToFrames(45f); } } + + bool rageFading = modPlayer.rageCombatFrames <= 0 && !modPlayer.heartOfDarkness && !modPlayer.shatteredCommunity; + + // If Rage Mode is currently active, you smoothly lose all rage over the duration. + if (modPlayer.rageModeActive) + rageDiff -= modPlayer.rageMax / modPlayer.RageDuration; + + // If out of combat and NOT using Heart of Darkness or Shattered Community, Rage fades away. + else if (!modPlayer.rageModeActive && rageFading) + rageDiff -= modPlayer.rageMax / CalamityPlayer.RageFadeTime; + + // Apply the rage change and cap rage in both directions. + modPlayer.rage += rageDiff; + if (modPlayer.rage < 0) + modPlayer.rage = 0; + + if (modPlayer.rage >= modPlayer.rageMax) + { + // If Rage is not active, it is capped at 100%. + if (!modPlayer.rageModeActive) + modPlayer.rage = modPlayer.rageMax; + + // If using the Shattered Community, Rage is capped at 200% while it's active. + // This prevents infinitely stacking rage before a fight by standing on spikes/lava with a regen build or the Nurse handy. + else if (modPlayer.shatteredCommunity && modPlayer.rage >= 2f * modPlayer.rageMax) + modPlayer.rage = 2f * modPlayer.rageMax; + + // Play a sound when the Rage Meter is full + if (modPlayer.playFullRageSound) + { + modPlayer.playFullRageSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); + } + } + else + modPlayer.playFullRageSound = true; + + // 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); + + // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. + if (modPlayer.adrenalineModeActive) + adrenalineDiff = -modPlayer.adrenalineMax / modPlayer.AdrenalineDuration; + else + { + // If any boss is alive (or you are between DoG phases or Boss Rush is active), you gain adrenaline smoothly. + // EXCEPTION: Wall of Flesh is alive and you are not in hell. Then you don't get anything. + if ((CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) && + !wofAndNotHell) + { + adrenalineDiff += modPlayer.adrenalineMax / modPlayer.AdrenalineChargeTime; + } + + // If you aren't actively in a boss fight, adrenaline rapidly fades away. + else + adrenalineDiff = -modPlayer.adrenalineMax / modPlayer.AdrenalineFadeTime; + } + + // In the SCal fight, adrenaline charges 33% slower (meaning it takes 50% longer to fully charge it). + if (SCalAlive && adrenalineDiff > 0f) + adrenalineDiff *= 0.67f; + + // Apply the adrenaline change and cap adrenaline in both directions. + modPlayer.adrenaline += adrenalineDiff; + if (modPlayer.adrenaline < 0) + modPlayer.adrenaline = 0; + + if (modPlayer.adrenaline >= modPlayer.adrenalineMax) + { + modPlayer.adrenaline = modPlayer.adrenalineMax; + + // Play a sound when the Adrenaline Meter is full + if (modPlayer.playFullAdrenalineSound) + { + modPlayer.playFullAdrenalineSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullAdrenaline"), (int)player.position.X, (int)player.position.Y); + } + } + else + modPlayer.playFullAdrenalineSound = true; } #endregion #region Misc Effects + + private static void HandleBlazingMouseEffects(Player player, CalamityPlayer modPlayer) + { + Rectangle auraRectangle = Utils.CenteredRectangle(Main.MouseWorld, new Vector2(35f, 62f)); + modPlayer.blazingMouseAuraFade = MathHelper.Clamp(modPlayer.blazingMouseAuraFade - 0.025f, 0.25f, 1f); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (!Main.npc[i].CanBeChasedBy() || !Main.npc[i].Hitbox.Intersects(auraRectangle) || !Main.rand.NextBool(2)) + continue; + + harmNPC(Main.npc[i]); + modPlayer.blazingMouseAuraFade = MathHelper.Clamp(modPlayer.blazingMouseAuraFade + 0.15f, 0.25f, 1f); + } + + void harmNPC(NPC npc) + { + int damage = (int)(player.AverageDamage() * Main.rand.Next(1950, 2050)); + npc.StrikeNPC(damage, 0f, 0); + + player.addDPS(damage); + npc.AddBuff(ModContent.BuffType(), 900); + + for (int i = 0; i < 4; i++) + { + Dust fire = Dust.NewDustDirect(npc.position, npc.width, npc.height, 267); + fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.45f); + fire.scale = 1f + fire.velocity.Length() / 6f; + fire.color = Color.Lerp(Color.Orange, Color.Red, Main.rand.NextFloat(0.85f)); + fire.noGravity = true; + } + } + } + private static void MiscEffects(Player player, CalamityPlayer modPlayer, Mod mod) { + // 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 blazingMouseItem = ModContent.ItemType(); + for (int i = 13; i < 18 + player.extraAccessorySlots; i++) + { + if (player.armor[i].type == blazingMouseItem) + { + modPlayer.ableToDrawBlazingMouse = true; + break; + } + } + + // Dust on hand when holding the phosphorescent gauntlet. + if (player.ActiveItem().type == ModContent.ItemType()) + PhosphorescentGauntletPunches.GenerateDustOnOwnerHand(player); + if (modPlayer.stealthUIAlpha > 0f && (modPlayer.rogueStealth <= 0f || modPlayer.rogueStealthMax <= 0f)) { modPlayer.stealthUIAlpha -= 0.035f; @@ -348,27 +524,30 @@ namespace CalamityMod.CalPlayer } if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && - player.Calamity().andromedaState != AndromedaPlayerState.Inactive) + modPlayer.andromedaState != AndromedaPlayerState.Inactive) { - player.Calamity().andromedaState = AndromedaPlayerState.Inactive; + modPlayer.andromedaState = AndromedaPlayerState.Inactive; } - - if(player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + + if (modPlayer.andromedaState == AndromedaPlayerState.LargeRobot) { player.width = 80; player.height = 212; player.position.Y -= 170; + modPlayer.resetHeightandWidth = true; } - else if (player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + else if (modPlayer.andromedaState == AndromedaPlayerState.SpecialAttack) { player.width = 24; player.height = 98; player.position.Y -= 56; + modPlayer.resetHeightandWidth = true; } - else if (!player.mount.Active) + else if (!player.mount.Active && modPlayer.resetHeightandWidth) { player.width = 20; player.height = 42; + modPlayer.resetHeightandWidth = false; } // Proficiency level ups @@ -383,12 +562,17 @@ namespace CalamityMod.CalPlayer (modPlayer.cShard ? 50 : 0) + (modPlayer.starBeamRye ? 50 : 0); + // Shield of Cthulhu immunity frame nerf, nerfed from 10 to 6 + if (player.eocDash > 6 && player.dashDelay > 0) + player.eocDash = 6; + // Life Steal nerf - // Reduces normal mode life steal recovery rate from 0.6/s to 0.5/s - // Reduces expert mode life steal recovery rate from 0.5/s to 0.35/s - // Revengeance mode recovery rate is 0.3/s - // Death mode recovery rate is 0.25/s - float lifeStealCooldown = CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; + // Reduces Normal Mode life steal recovery rate from 0.6/s to 0.5/s + // Reduces Expert Mode life steal recovery rate from 0.5/s to 0.35/s + // Revengeance Mode recovery rate is 0.3/s + // Death Mode recovery rate is 0.25/s + // Malice Mode recovery rate is 0.2/s + float lifeStealCooldown = CalamityWorld.malice ? 0.3f : CalamityWorld.death ? 0.25f : CalamityWorld.revenge ? 0.2f : Main.expertMode ? 0.15f : 0.1f; /*if (Main.masterMode) lifeStealCooldown *= 1.25f;*/ player.lifeSteal -= lifeStealCooldown; @@ -411,7 +595,7 @@ namespace CalamityMod.CalPlayer // Bool for drawing boss health bar small text or not if (Main.myPlayer == player.whoAmI) - BossHealthBarManager.SHOULD_DRAW_SMALLTEXT_HEALTH = modPlayer.shouldDrawSmallText; + BossHealthBarManager.CanDrawExtraSmallText = modPlayer.shouldDrawSmallText; // Margarita halved debuff duration if (modPlayer.margarita) @@ -421,7 +605,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityMod.debuffList.Contains(hasBuff)) + if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) { player.buffTime[l]--; } @@ -429,10 +613,39 @@ namespace CalamityMod.CalPlayer } } + // Update the Providence Burn effect drawer if applicable. + float providenceBurnIntensity = 0f; + if (Main.npc.IndexInRange(CalamityGlobalNPC.holyBoss) && Main.npc[CalamityGlobalNPC.holyBoss].active) + providenceBurnIntensity = (Main.npc[CalamityGlobalNPC.holyBoss].modNPC as ProvidenceBoss).CalculateBurnIntensity(); + modPlayer.ProvidenceBurnEffectDrawer.ParticleSpawnRate = int.MaxValue; + + // If the burn intensity is great enough, cause the player to ignite into flames. + if (providenceBurnIntensity > 0.45f) + modPlayer.ProvidenceBurnEffectDrawer.ParticleSpawnRate = 1; + + // Otherwise, if the intensity is too weak, but still presernt, cause the player to release holy cinders. + else if (providenceBurnIntensity > 0f) + { + int cinderCount = (int)MathHelper.Lerp(1f, 4f, Utils.InverseLerp(0f, 0.45f, providenceBurnIntensity, true)); + for (int i = 0; i < cinderCount; i++) + { + if (!Main.rand.NextBool(3)) + continue; + + 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); + holyCinder.noGravity = true; + } + } + + modPlayer.ProvidenceBurnEffectDrawer.Update(); + // Immunity to most debuffs if (modPlayer.invincible) { - foreach (int debuff in CalamityMod.debuffList) + foreach (int debuff in CalamityLists.debuffList) player.buffImmune[debuff] = true; } @@ -466,31 +679,40 @@ namespace CalamityMod.CalPlayer } } - //extra DoT in the lava of the crags - if (modPlayer.ZoneCalamity && player.lavaWet) + // Extra DoT in the lava of the crags. Negated by Abaddon. + if (player.lavaWet) { - player.AddBuff(ModContent.BuffType(), 2, false); - } + if (modPlayer.ZoneCalamity && !modPlayer.abaddon) + player.AddBuff(ModContent.BuffType(), 2, false); + } + else + { + if (player.lavaImmune) + { + if (player.lavaTime < player.lavaMax) + player.lavaTime++; + } + } - // Acid rain droplets - if (player.whoAmI == Main.myPlayer) - { - if (CalamityWorld.rainingAcid && modPlayer.ZoneSulphur && !CalamityPlayer.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)); + // Acid rain droplets + if (player.whoAmI == Main.myPlayer) + { + if (CalamityWorld.rainingAcid && modPlayer.ZoneSulphur && !CalamityPlayer.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)); - if (player.miscCounter % slimeRainRate == 0f) - { + if (player.miscCounter % slimeRainRate == 0f) + { if (CalamityWorld.downedAquaticScourge && !CalamityWorld.downedPolterghast && Main.rand.NextBool(12)) { NPC.NewNPC((int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); } - } - } - } + } + } + } - //Hydrothermal blue smoke effects but it doesn't work epicccccc + // Hydrothermal blue smoke effects but it doesn't work epicccccc if (player.whoAmI == Main.myPlayer) { if (modPlayer.hydrothermalSmoke) @@ -500,72 +722,19 @@ namespace CalamityMod.CalPlayer 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 + // Trying to find a workaround because apparently putting the bool in ResetEffects prevents it from working if (!player.armorEffectDrawOutlines) { modPlayer.hydrothermalSmoke = false; } } - // Death Mode effects - modPlayer.caveDarkness = 0f; + // Death Mode effects + modPlayer.caveDarkness = 0f; if (CalamityWorld.death) { if (player.whoAmI == Main.myPlayer) { - // Calculate underground darkness here. The effect is applied in CalamityMod.ModifyLightingBrightness. - Point point = player.Center.ToTileCoordinates(); - if (point.Y > Main.worldSurface && !modPlayer.ZoneAbyss && !player.ZoneUnderworldHeight) - { - // Darkness strength scales smoothly with how deep you are. - double totalUndergroundDepth = Main.maxTilesY - 200D - Main.worldSurface; - double playerUndergroundDepth = point.Y - Main.worldSurface; - double depthRatio = playerUndergroundDepth / totalUndergroundDepth; - int lightStrength = modPlayer.GetTotalLightStrength(); - - // In the last 50 blocks before hell, the darkness smoothly fades away. - float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); - float darknessStrength = (float)(depthRatio / FadeAwayStart); - if (depthRatio > FadeAwayStart) - { - // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. - darknessStrength = MathHelper.Lerp(0f, 0.75f, (1f - (float)depthRatio) / (1f - FadeAwayStart)); - } - - // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. - switch (lightStrength) - { - case 0: - break; - case 1: - darknessStrength *= 0.75f; - break; - case 2: - darknessStrength *= 0.55f; - break; - case 3: - darknessStrength *= 0.35f; - break; - case 4: - darknessStrength *= 0.15f; - break; - default: - darknessStrength = 0f; - break; - } - modPlayer.caveDarkness = darknessStrength; - } - - // Immunity bools - bool hasMoltenSet = player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves; - - bool immunityToHotAndCold = hasMoltenSet || player.magmaStone || player.frostArmor || modPlayer.fBulwark || modPlayer.fBarrier || - modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction || modPlayer.profanedCrystalBuffs || modPlayer.coldDivinity || modPlayer.eGauntlet; - - bool immunityToCold = player.HasBuff(BuffID.Campfire) || Main.campfire || player.resistCold || modPlayer.eskimoSet || player.buffImmune[BuffID.Frozen] || modPlayer.aAmpoule || player.HasBuff(BuffID.Inferno) || immunityToHotAndCold || modPlayer.externalColdImmunity; - - bool immunityToHot = player.lavaImmune || player.lavaRose || player.lavaMax > 0 || immunityToHotAndCold || modPlayer.externalHeatImmunity; - // Thorn and spike effects // 10 = crimson/corruption thorns, 17 = jungle thorns, 40 = dungeon spikes, 60 = temple spikes Vector2 tileType; @@ -592,27 +761,6 @@ namespace CalamityMod.CalPlayer break; } - // Astral effects - if (modPlayer.ZoneAstral) - { - player.gravity *= 0.75f; - } - - // Space effects - if (player.InSpace()) - { - if (Main.dayTime) - { - if (!immunityToHot) - player.AddBuff(BuffID.Burning, 2, false); - } - else - { - if (!immunityToCold) - player.AddBuff(BuffID.Frostburn, 2, false); - } - } - // Leech bleed if (player.ZoneJungle && player.wet && !player.lavaWet && !player.honeyWet) { @@ -620,197 +768,239 @@ namespace CalamityMod.CalPlayer player.AddBuff(BuffID.Bleeding, 300, false); } - // Ice shards, lightning and sharknadoes - bool nearPillar = player.PillarZone(); - if (player.ZoneOverworldHeight && !CalamityWorld.bossRushActive && !CalamityPlayer.areThereAnyDamnBosses && !CalamityPlayer.areThereAnyDamnEvents && NPC.MoonLordCountdown == 0 && !player.InSpace()) + if (!BossRushEvent.BossRushActive && !CalamityPlayer.areThereAnyDamnBosses && !CalamityPlayer.areThereAnyDamnEvents) { - Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - Main.rand.Next(300, 701), player.Center.Y - Main.rand.Next(700, 801)); - if (point.X > Main.maxTilesX / 2) - sharknadoSpawnPoint.X = player.Center.X + Main.rand.Next(300, 701); + // Astral effects + if (modPlayer.ZoneAstral) + player.gravity *= 0.75f; - if (Main.raining) + // Calculate underground darkness here. The effect is applied in CalamityMod.ModifyLightingBrightness. + Point point = player.Center.ToTileCoordinates(); + if (point.Y > Main.worldSurface && !modPlayer.ZoneAbyss && !player.ZoneUnderworldHeight) { - float frequencyMult = (1f - Main.cloudAlpha) * CalamityConfig.Instance.DeathWeatherMultiplier; // 3 to 0.055 + // Darkness strength scales smoothly with how deep you are. + double totalUndergroundDepth = Main.maxTilesY - 200D - Main.worldSurface; + double playerUndergroundDepth = point.Y - Main.worldSurface; + double depthRatio = playerUndergroundDepth / totalUndergroundDepth; + int lightStrength = modPlayer.GetTotalLightStrength(); - Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); - Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f)); - - if (player.ZoneSnow) + // In the last 50 blocks before hell, the darkness smoothly fades away. + float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); + float darknessStrength = (float)(depthRatio / FadeAwayStart); + if (depthRatio > FadeAwayStart) { - if (!tileSafely.active()) - { - int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult); - float windVelocity = (float)Math.Sqrt(Math.Abs(Main.windSpeed)) * Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f; - Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat()); - - if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3)) - Projectile.NewProjectile(spawnPoint, velocity, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); - } + // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. + darknessStrength = MathHelper.Lerp(0f, 1f, (1f - (float)depthRatio) / (1f - FadeAwayStart)); } - else + + // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. + switch (lightStrength) { - if (player.ZoneBeach && !modPlayer.ZoneSulphur) - { - int randomFrequency = (int)(50f * frequencyMult); - if (player.miscCounter == 280 && Main.rand.NextBool(randomFrequency) && player.ownedProjectileCounts[ProjectileID.Cthulunado] < 1) - { - Main.PlaySound(SoundID.NPCDeath19, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y); - int y = (int)(sharknadoSpawnPoint.Y / 16f); - int x = (int)(sharknadoSpawnPoint.X / 16f); - int yAdjust = 100; - if (x < 10) - x = 10; - if (x > Main.maxTilesX - 10) - x = Main.maxTilesX - 10; - if (y < 10) - y = 10; - if (y > Main.maxTilesY - yAdjust - 10) - y = Main.maxTilesY - yAdjust - 10; + case 0: + darknessStrength *= 0.75f; + break; + case 1: + darknessStrength *= 0.5f; + break; + case 2: + darknessStrength *= 0.25f; + break; + case 3: + darknessStrength *= 0.15f; + break; + case 4: + darknessStrength *= 0.05f; + break; + default: + darknessStrength = 0f; + break; + } + modPlayer.caveDarkness = darknessStrength; + } - int spawnAreaY = Main.maxTilesY - y; - for (int j = y; j < y + spawnAreaY; j++) - { - Tile tile = Main.tile[x, j]; - if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) - { - y = j; - break; - } - } + // Ice shards, lightning and sharknadoes + bool nearPillar = player.PillarZone(); + if (player.ZoneOverworldHeight && NPC.MoonLordCountdown == 0 && !player.InSpace()) + { + Vector2 sharknadoSpawnPoint = new Vector2(player.Center.X - Main.rand.Next(300, 701), player.Center.Y - Main.rand.Next(700, 801)); + if (point.X > Main.maxTilesX / 2) + sharknadoSpawnPoint.X = player.Center.X + Main.rand.Next(300, 701); - int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f); - Main.projectile[tornado].netUpdate = true; - } - } + if (Main.raining) + { + float frequencyMult = (1f - Main.cloudAlpha) * CalamityConfig.Instance.DeathWeatherMultiplier; // 3 to 0.055 - int randomFrequency2 = (int)(20f * frequencyMult); - if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur) - randomFrequency2 = (int)(randomFrequency2 * 3.75); - if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2)) + Vector2 spawnPoint = new Vector2(player.Center.X + Main.rand.Next(-1000, 1001), player.Center.Y - Main.rand.Next(700, 801)); + Tile tileSafely = Framing.GetTileSafely((int)(spawnPoint.X / 16f), (int)(spawnPoint.Y / 16f)); + + if (player.ZoneSnow) { if (!tileSafely.active()) { - float randomVelocity = Main.rand.NextFloat() - 0.5f; - Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f); - Vector2 direction = fireTo - spawnPoint; - Vector2 velocity = Vector2.Normalize(direction) * 12f; - Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + int divisor = (int)((Main.hardMode ? 50f : 60f) * frequencyMult); + float windVelocity = (float)Math.Sqrt(Math.Abs(Main.windSpeed)) * Math.Sign(Main.windSpeed) * (Main.cloudAlpha + 0.5f) * 25f + Main.rand.NextFloat() * 0.2f - 0.1f; + Vector2 velocity = new Vector2(windVelocity * 0.2f, 3f * Main.rand.NextFloat()); + + if (player.miscCounter % divisor == 0 && Main.rand.NextBool(3)) + Projectile.NewProjectile(spawnPoint, velocity, ModContent.ProjectileType(), 20, 0f, player.whoAmI, 2f, 0f); } } - } - } - else - { - if (player.ZoneBeach && !modPlayer.ZoneSulphur) - { - if (player.miscCounter == 280 && Main.rand.NextBool(10) && player.ownedProjectileCounts[ProjectileID.Sharknado] < 1) + else { - Main.PlaySound(SoundID.NPCDeath19, sharknadoSpawnPoint); - int y = (int)(sharknadoSpawnPoint.Y / 16f); - int x = (int)(sharknadoSpawnPoint.X / 16f); - int num333 = 100; - if (x < 10) - x = 10; - if (x > Main.maxTilesX - 10) - x = Main.maxTilesX - 10; - if (y < 10) - y = 10; - if (y > Main.maxTilesY - num333 - 10) - y = Main.maxTilesY - num333 - 10; - - int spawnAreaY = Main.maxTilesY - y; - for (int j = y; j < y + spawnAreaY; j++) + if (player.ZoneBeach && !modPlayer.ZoneSulphur) { - Tile tile = Main.tile[x, j]; - if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) + int randomFrequency = (int)(50f * frequencyMult); + if (player.miscCounter == 280 && Main.rand.NextBool(randomFrequency) && player.ownedProjectileCounts[ProjectileID.Cthulunado] < 1) { - y = j; - break; + Main.PlaySound(SoundID.NPCDeath19, (int)sharknadoSpawnPoint.X, (int)sharknadoSpawnPoint.Y); + int y = (int)(sharknadoSpawnPoint.Y / 16f); + int x = (int)(sharknadoSpawnPoint.X / 16f); + int yAdjust = 100; + if (x < 10) + x = 10; + if (x > Main.maxTilesX - 10) + x = Main.maxTilesX - 10; + if (y < 10) + y = 10; + if (y > Main.maxTilesY - yAdjust - 10) + y = Main.maxTilesY - yAdjust - 10; + + int spawnAreaY = Main.maxTilesY - y; + for (int j = y; j < y + spawnAreaY; j++) + { + Tile tile = Main.tile[x, j]; + if ((tile.active() && Main.tileSolid[tile.type]) || tile.liquid >= 200) + { + y = j; + break; + } + } + + int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0f, 0f, ProjectileID.Cthulunado, 50, 4f, player.whoAmI, 16f, 24f); + Main.projectile[tornado].netUpdate = true; } } - int tornado = Projectile.NewProjectile(x * 16 + 8, y * 16 - 24, 0.01f, 0f, ProjectileID.Sharknado, 25, 4f, player.whoAmI, 16f, 15f); - Main.projectile[tornado].netUpdate = true; + // Death Mode random lightning strikes + int randomFrequency2 = (int)(20f * frequencyMult); + if (CalamityWorld.rainingAcid && player.Calamity().ZoneSulphur) + randomFrequency2 = (int)(randomFrequency2 * 3.75); + if (player.miscCounter % (Main.hardMode ? 90 : 120) == 0 && Main.rand.NextBool(randomFrequency2)) + { + if (!tileSafely.active()) + { + float randomVelocity = Main.rand.NextFloat() - 0.5f; + Vector2 fireTo = new Vector2(spawnPoint.X + 100f * randomVelocity, spawnPoint.Y + 900f); + Vector2 direction = fireTo - spawnPoint; + Vector2 velocity = Vector2.Normalize(direction) * 12f; + Projectile.NewProjectile(spawnPoint.X, spawnPoint.Y, 0f, velocity.Y, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } } } } - } - // Cold timer - if (!player.behindBackWall && Main.raining && player.ZoneSnow && !immunityToCold && player.ZoneOverworldHeight) - { - bool affectedByColdWater = player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear; + // Immunity bools + bool hasMoltenSet = player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves; - player.AddBuff(ModContent.BuffType(), 2, false); + bool immunityToHotAndCold = hasMoltenSet || player.magmaStone || player.frostArmor || modPlayer.fBulwark || modPlayer.fBarrier || + modPlayer.frostFlare || modPlayer.rampartOfDeities || modPlayer.cryogenSoul || modPlayer.snowman || modPlayer.blazingCore || modPlayer.permafrostsConcoction || modPlayer.profanedCrystalBuffs || modPlayer.coldDivinity || modPlayer.eGauntlet; - modPlayer.deathModeBlizzardTime++; - if (affectedByColdWater) - modPlayer.deathModeBlizzardTime++; + bool immunityToCold = player.HasBuff(BuffID.Campfire) || Main.campfire || player.resistCold || modPlayer.eskimoSet || player.buffImmune[BuffID.Frozen] || modPlayer.aAmpoule || player.HasBuff(BuffID.Inferno) || immunityToHotAndCold || modPlayer.externalColdImmunity; - if (modPlayer.deathModeUnderworldTime > 0) + bool immunityToHot = player.lavaImmune || player.lavaRose || player.lavaMax > 0 || immunityToHotAndCold || modPlayer.externalHeatImmunity; + + // Space effects + if (!player.behindBackWall && player.InSpace()) { - modPlayer.deathModeUnderworldTime--; - if (affectedByColdWater) - modPlayer.deathModeUnderworldTime--; - if (modPlayer.deathModeUnderworldTime < 0) - modPlayer.deathModeUnderworldTime = 0; + if (Main.dayTime) + { + if (!immunityToHot) + player.AddBuff(BuffID.Burning, 2, false); + } + else + { + if (!immunityToCold) + player.AddBuff(BuffID.Frostburn, 2, false); + } } - } - else if (modPlayer.deathModeBlizzardTime > 0) - { - modPlayer.deathModeBlizzardTime--; - if (immunityToCold) - modPlayer.deathModeBlizzardTime--; - if (modPlayer.deathModeBlizzardTime < 0) - modPlayer.deathModeBlizzardTime = 0; - } - // Hot timer - if (player.ZoneUnderworldHeight && !immunityToHot) - { - bool affectedByHotLava = player.lavaWet; + // Cold timer + if (!player.behindBackWall && Main.raining && player.ZoneSnow && !immunityToCold && player.ZoneOverworldHeight) + { + bool affectedByColdWater = player.wet && !player.lavaWet && !player.honeyWet && !player.arcticDivingGear; - player.AddBuff(ModContent.BuffType(), 2, false); + player.AddBuff(ModContent.BuffType(), 2, false); - modPlayer.deathModeUnderworldTime++; - if (affectedByHotLava) - modPlayer.deathModeUnderworldTime++; + modPlayer.deathModeBlizzardTime++; + if (affectedByColdWater) + modPlayer.deathModeBlizzardTime++; - if (modPlayer.deathModeBlizzardTime > 0) + if (modPlayer.deathModeUnderworldTime > 0) + { + modPlayer.deathModeUnderworldTime--; + if (affectedByColdWater) + modPlayer.deathModeUnderworldTime--; + if (modPlayer.deathModeUnderworldTime < 0) + modPlayer.deathModeUnderworldTime = 0; + } + } + else if (modPlayer.deathModeBlizzardTime > 0) { modPlayer.deathModeBlizzardTime--; - if (affectedByHotLava) + if (immunityToCold) modPlayer.deathModeBlizzardTime--; if (modPlayer.deathModeBlizzardTime < 0) modPlayer.deathModeBlizzardTime = 0; } - } - else if (modPlayer.deathModeUnderworldTime > 0) - { - modPlayer.deathModeUnderworldTime--; - if (immunityToHot) + + // Hot timer + if (!player.behindBackWall && player.ZoneUnderworldHeight && !immunityToHot) + { + bool affectedByHotLava = player.lavaWet; + + player.AddBuff(ModContent.BuffType(), 2, false); + + modPlayer.deathModeUnderworldTime++; + if (affectedByHotLava) + modPlayer.deathModeUnderworldTime++; + + if (modPlayer.deathModeBlizzardTime > 0) + { + modPlayer.deathModeBlizzardTime--; + if (affectedByHotLava) + modPlayer.deathModeBlizzardTime--; + if (modPlayer.deathModeBlizzardTime < 0) + modPlayer.deathModeBlizzardTime = 0; + } + } + else if (modPlayer.deathModeUnderworldTime > 0) + { modPlayer.deathModeUnderworldTime--; - if (modPlayer.deathModeUnderworldTime < 0) - modPlayer.deathModeUnderworldTime = 0; + if (immunityToHot) + modPlayer.deathModeUnderworldTime--; + if (modPlayer.deathModeUnderworldTime < 0) + modPlayer.deathModeUnderworldTime = 0; + } + + // Cold effects + if (modPlayer.deathModeBlizzardTime > 1800) + player.AddBuff(BuffID.Frozen, 2, false); + if (modPlayer.deathModeBlizzardTime > 1980) + modPlayer.KillPlayer(); + + // Hot effects + if (modPlayer.deathModeUnderworldTime > 360) + player.AddBuff(BuffID.Weak, 2, false); + if (modPlayer.deathModeUnderworldTime > 720) + player.AddBuff(BuffID.Slow, 2, false); + if (modPlayer.deathModeUnderworldTime > 1080) + player.AddBuff(BuffID.OnFire, 2, false); + if (modPlayer.deathModeUnderworldTime > 1440) + player.AddBuff(BuffID.Confused, 2, false); + if (modPlayer.deathModeUnderworldTime > 1800) + player.AddBuff(BuffID.Burning, 2, false); } - - // Cold effects - if (modPlayer.deathModeBlizzardTime > 1800) - player.AddBuff(BuffID.Frozen, 2, false); - if (modPlayer.deathModeBlizzardTime > 1980) - modPlayer.KillPlayer(); - - // Hot effects - if (modPlayer.deathModeUnderworldTime > 360) - player.AddBuff(BuffID.Weak, 2, false); - if (modPlayer.deathModeUnderworldTime > 720) - player.AddBuff(BuffID.Slow, 2, false); - if (modPlayer.deathModeUnderworldTime > 1080) - player.AddBuff(BuffID.OnFire, 2, false); - if (modPlayer.deathModeUnderworldTime > 1440) - player.AddBuff(BuffID.Confused, 2, false); - if (modPlayer.deathModeUnderworldTime > 1800) - player.AddBuff(BuffID.Burning, 2, false); } } @@ -819,19 +1009,15 @@ namespace CalamityMod.CalPlayer { if (player.IsUnderwater() && modPlayer.ironBoots) player.maxFallSpeed = 9f; - if (modPlayer.aeroSet && !player.wet) - player.maxFallSpeed = 15f; - if (modPlayer.gSabatonFall > 0 && !player.wet) - player.maxFallSpeed = 20f; - if (modPlayer.normalityRelocator) - player.maxFallSpeed *= 1.1f; - if (modPlayer.etherealExtorter && player.ZoneSkyHeight) - player.maxFallSpeed *= 1.25f; - } - // Normality Relocator bonus - if (modPlayer.normalityRelocator) - player.moveSpeed += 0.1f; + if (!player.wet) + { + if (modPlayer.aeroSet) + player.maxFallSpeed = 15f; + if (modPlayer.gSabatonFall > 0 || player.PortalPhysicsEnabled) + player.maxFallSpeed = 20f; + } + } // Omega Blue Armor bonus if (modPlayer.omegaBlueSet) @@ -851,7 +1037,7 @@ namespace CalamityMod.CalPlayer { if (!tentaclesPresent[i]) { - int damage = (int)(666 * 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); } @@ -868,6 +1054,7 @@ namespace CalamityMod.CalPlayer player.allDamage += damageUp; modPlayer.AllCritBoost(critUp); } + bool canProvideBuffs = modPlayer.profanedCrystalBuffs || (!modPlayer.profanedCrystal && modPlayer.pArtifact) || (modPlayer.profanedCrystal && CalamityWorld.downedSCal); bool attack = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; // Guardian bonuses if not burnt out @@ -882,8 +1069,10 @@ namespace CalamityMod.CalPlayer if (modPlayer.healCounter <= 0) { - bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); + bool enrage = player.statLife < (int)(player.statLifeMax2 * 0.5); + modPlayer.healCounter = (!enrage && modPlayer.profanedCrystalBuffs) ? 360 : 300; + if (player.whoAmI == Main.myPlayer) { int healAmount = 5 + @@ -898,8 +1087,8 @@ namespace CalamityMod.CalPlayer if (defend) { - player.moveSpeed += 0.1f + - (attack ? 0.1f : 0f); + player.moveSpeed += 0.05f + + (attack ? 0.05f : 0f); player.endurance += 0.025f + (attack ? 0.025f : 0f); } @@ -915,9 +1104,39 @@ namespace CalamityMod.CalPlayer if (attack && canProvideBuffs) player.maxMinions++; + if (modPlayer.nucleogenesis) + { + player.maxMinions += 4; + } + else + { + if (modPlayer.shadowMinions) + player.maxMinions += 3; + else if (modPlayer.holyMinions) + player.maxMinions += 2; + + if (modPlayer.starTaintedGenerator) + player.maxMinions += 2; + else + { + if (modPlayer.starbusterCore) + player.maxMinions++; + + if (modPlayer.voltaicJelly) + player.maxMinions++; + + if (modPlayer.nuclearRod) + player.maxMinions++; + } + } + // Cooldowns and timers - if (modPlayer.gainRageCooldown > 0) - modPlayer.gainRageCooldown--; + if (modPlayer.phantomicHeartRegen > 0 && modPlayer.phantomicHeartRegen < 1000) + modPlayer.phantomicHeartRegen--; + if (modPlayer.phantomicBulwarkCooldown > 0) + modPlayer.phantomicBulwarkCooldown--; + if (modPlayer.dodgeCooldownTimer > 0) + modPlayer.dodgeCooldownTimer--; if (modPlayer.KameiBladeUseDelay > 0) modPlayer.KameiBladeUseDelay--; if (modPlayer.galileoCooldown > 0) @@ -934,8 +1153,12 @@ namespace CalamityMod.CalPlayer modPlayer.gSabatonFall--; if (modPlayer.astralStarRainCooldown > 0) modPlayer.astralStarRainCooldown--; + if (modPlayer.tarraRangedCooldown > 0) + modPlayer.tarraRangedCooldown--; if (modPlayer.bloodflareMageCooldown > 0) modPlayer.bloodflareMageCooldown--; + if (modPlayer.silvaMageCooldown > 0) + modPlayer.silvaMageCooldown--; if (modPlayer.tarraMageHealCooldown > 0) modPlayer.tarraMageHealCooldown--; if (modPlayer.featherCrownCooldown > 0) @@ -948,10 +1171,8 @@ namespace CalamityMod.CalPlayer modPlayer.spectralVeilImmunity--; if (modPlayer.jetPackCooldown > 0) modPlayer.jetPackCooldown--; - if (modPlayer.plaguedFuelPackDash > 0) - modPlayer.plaguedFuelPackDash--; - if (modPlayer.blunderBoosterDash > 0) - modPlayer.blunderBoosterDash--; + if (modPlayer.jetPackDash > 0) + modPlayer.jetPackDash--; if (modPlayer.theBeeCooldown > 0) modPlayer.theBeeCooldown--; if (modPlayer.jellyDmg > 0f) @@ -964,16 +1185,12 @@ namespace CalamityMod.CalPlayer modPlayer.xerocDmg -= 2f; if (modPlayer.xerocDmg < 0f) modPlayer.xerocDmg = 0f; - if (modPlayer.godSlayerDmg > 0f) - modPlayer.godSlayerDmg -= 2.5f; - if (modPlayer.godSlayerDmg < 0f) - modPlayer.godSlayerDmg = 0f; if (modPlayer.aBulwarkRareMeleeBoostTimer > 0) modPlayer.aBulwarkRareMeleeBoostTimer--; if (modPlayer.bossRushImmunityFrameCurseTimer > 0) modPlayer.bossRushImmunityFrameCurseTimer--; - if (modPlayer.gaelRageCooldown > 0) - modPlayer.gaelRageCooldown--; + if (modPlayer.gaelRageAttackCooldown > 0) + modPlayer.gaelRageAttackCooldown--; if (modPlayer.projRefRareLifeRegenCounter > 0) modPlayer.projRefRareLifeRegenCounter--; if (modPlayer.hurtSoundTimer > 0) @@ -1004,6 +1221,41 @@ namespace CalamityMod.CalPlayer modPlayer.omegaBlueCooldown--; if (modPlayer.plagueReaperCooldown > 0) modPlayer.plagueReaperCooldown--; + if (modPlayer.brimflameFrenzyTimer > 0) + modPlayer.brimflameFrenzyTimer--; + if (modPlayer.bloodflareSoulTimer > 0) + modPlayer.bloodflareSoulTimer--; + if (modPlayer.fungalSymbioteTimer > 0) + modPlayer.fungalSymbioteTimer--; + if (modPlayer.aBulwarkRareTimer > 0) + modPlayer.aBulwarkRareTimer--; + if (modPlayer.hellbornBoost > 0) + modPlayer.hellbornBoost--; + if (modPlayer.persecutedEnchantSummonTimer < 1800) + modPlayer.persecutedEnchantSummonTimer++; + else + { + modPlayer.persecutedEnchantSummonTimer = 0; + if (Main.myPlayer == player.whoAmI && player.Calamity().persecutedEnchant && NPC.CountNPCS(ModContent.NPCType()) < 2) + { + Vector2 spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(270f, 420f); + CalamityNetcode.NewNPC_ClientSide(spawnPosition, ModContent.NPCType(), player); + } + } + if (player.miscCounter % 20 == 0) + modPlayer.canFireAtaxiaRangedProjectile = true; + if (player.miscCounter % 100 == 0) + modPlayer.canFireBloodflareMageProjectile = true; + if (player.miscCounter % 150 == 0) + { + modPlayer.canFireGodSlayerRangedProjectile = true; + modPlayer.canFireBloodflareRangedProjectile = true; + modPlayer.canFireAtaxiaRogueProjectile = true; + } + if (modPlayer.reaverRegenCooldown < 60 && modPlayer.reaverRegen) + modPlayer.reaverRegenCooldown++; + else + modPlayer.reaverRegenCooldown = 0; if (modPlayer.roverDrive) { if (modPlayer.roverDriveTimer < CalamityUtils.SecondsToFrames(30f)) @@ -1012,16 +1264,26 @@ namespace CalamityMod.CalPlayer modPlayer.roverDriveTimer = 0; } else - modPlayer.roverDriveTimer = 616; //Doesn't reset to zero to prevent exploits + modPlayer.roverDriveTimer = 616; // Doesn't reset to zero to prevent exploits + if (modPlayer.auralisAurora > 0) + modPlayer.auralisAurora--; + if (modPlayer.auralisAuroraCooldown > 0) + modPlayer.auralisAuroraCooldown--; + + // God Slayer Armor dash debuff immunity + if (modPlayer.dashMod == 9 && player.dashDelay < 0) + { + foreach (int debuff in CalamityLists.debuffList) + player.buffImmune[debuff] = true; + } // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) { - foreach (int debuff in CalamityMod.debuffList) + foreach (int debuff in CalamityLists.debuffList) player.buffImmune[debuff] = true; - player.buffImmune[ModContent.BuffType()] = true; - modPlayer.silvaCountdown -= modPlayer.auricSet ? 2 : 1; + modPlayer.silvaCountdown -= 1; if (modPlayer.silvaCountdown <= 0) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), player.Center); @@ -1072,13 +1334,16 @@ namespace CalamityMod.CalPlayer { player.immune = true; player.immuneTime = 2; + + for (int k = 0; k < player.hurtCooldowns.Length; k++) + player.hurtCooldowns[k] = player.immuneTime; } if (modPlayer.tarraThrowingCrits >= 25) { modPlayer.tarraThrowingCrits = 0; if (player.whoAmI == Main.myPlayer) - player.AddBuff(ModContent.BuffType(), 300, false); + player.AddBuff(ModContent.BuffType(), 180, false); } for (int l = 0; l < Player.MaxBuffs; l++) @@ -1090,7 +1355,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 1500, false); } - bool shouldAffect = CalamityMod.debuffList.Contains(hasBuff); + bool shouldAffect = CalamityLists.debuffList.Contains(hasBuff); if (shouldAffect) modPlayer.throwingDamage += 0.1f; } @@ -1101,8 +1366,6 @@ namespace CalamityMod.CalPlayer { if (modPlayer.bloodflareHeartTimer > 0) modPlayer.bloodflareHeartTimer--; - if (modPlayer.bloodflareManaTimer > 0) - modPlayer.bloodflareManaTimer--; } // Bloodflare frenzy effects @@ -1149,33 +1412,17 @@ namespace CalamityMod.CalPlayer // Raider Talisman bonus if (modPlayer.raiderTalisman) { - float damageMult = modPlayer.nanotech ? 0.1f : 0.15f; - modPlayer.throwingDamage += (float)modPlayer.raiderStack / 150f * damageMult; + // Nanotech use to have an exclusive nerf here, but since they are currently equal, there + // is no check to indicate such. + float damageMult = 0.15f; + modPlayer.throwingDamage += modPlayer.raiderStack / 150f * damageMult; } - // Silva minion bonus - if (modPlayer.silvaCountdown <= 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSummon) - player.maxMinions += 2; - - // Spirit Glyph defense buff - if (modPlayer.sDefense) - { - player.statDefense += 5; - player.endurance += 0.05f; - } - - // Hallowed Rune defense buff - if (modPlayer.hallowedDefense) - { - player.statDefense += 7; - player.endurance += 0.07f; - } - if (modPlayer.kamiBoost) - { - player.allDamage += 0.3f; - player.statDefense += 20; - } + player.allDamage += 0.15f; + + if (modPlayer.avertorBonus) + player.allDamage += 0.1f; if (modPlayer.roverDriveTimer < 616) { @@ -1187,10 +1434,10 @@ namespace CalamityMod.CalPlayer // Absorber bonus if (modPlayer.absorber) { - player.moveSpeed += 0.12f; - player.jumpSpeedBoost += 1.2f; + player.moveSpeed += 0.05f; + player.jumpSpeedBoost += 0.25f; player.thorns += 0.5f; - player.endurance += 0.05f; + player.endurance += modPlayer.sponge ? 0.15f : 0.1f; if (player.StandingStill() && player.itemAnimation == 0) player.manaRegenBonus += 2; @@ -1201,75 +1448,31 @@ namespace CalamityMod.CalPlayer { if (player.IsUnderwater()) { - player.statDefense += modPlayer.absorber ? 5 : 3; + player.statDefense += 3; player.endurance += 0.05f; - player.moveSpeed += modPlayer.absorber ? 0.2f : 0.15f; + player.moveSpeed += 0.1f; player.ignoreWater = true; } } - // Laudanum bonus - if (modPlayer.laudanum) - { - if (Main.myPlayer == player.whoAmI) - { - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - if (!modPlayer.doubledHorror && hasBuff == ModContent.BuffType()) - { - player.buffTime[l] *= 2; - modPlayer.doubledHorror = true; - break; - } - } - } - if (modPlayer.horror) - { - player.statDefense += 15; - player.allDamage += 0.1f; - player.moveSpeed += 0.15f; - player.nightVision = true; - } - } - if (!modPlayer.horror) - modPlayer.doubledHorror = false; - - // Draedon's Heart bonus - if (modPlayer.draedonsHeart) - { - player.allDamage += 0.05f; - if (player.StandingStill() && player.itemAnimation == 0) - player.statDefense += 25; - } - - // Remove Absolute Rage buff if Rage isn't high enough - bool rageHighEnough = modPlayer.rage / modPlayer.rageMax >= CalamityPlayer.AbsoluteRageThreshold; - if (!rageHighEnough && player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); - - // Absolute Rage bonus - if (modPlayer.absoluteRage) - { - if (modPlayer.heartOfDarkness || modPlayer.draedonsHeart) - player.allDamage += 0.1f; - } - // Affliction bonus if (modPlayer.affliction || modPlayer.afflicted) { player.endurance += 0.07f; - player.statDefense += 20; - player.allDamage += 0.12f; + player.statDefense += 10; + player.allDamage += 0.1f; } // Ambrosial Ampoule bonus and other light-granting bonuses float[] light = new float[3]; - if (modPlayer.aAmpoule) + if ((modPlayer.rOoze && !Main.dayTime) || modPlayer.aAmpoule) { light[0] += 1f; light[1] += 1f; light[2] += 0.6f; + } + if (modPlayer.aAmpoule) + { player.endurance += 0.05f; player.pickSpeed -= 0.25f; player.buffImmune[BuffID.Venom] = true; @@ -1302,15 +1505,6 @@ namespace CalamityMod.CalPlayer light[1] += 3f; light[2] += 0f; } - if (modPlayer.dAmulet) - { - if (player.IsUnderwater()) - { - light[0] += 1.35f; - light[1] += 0.3f; - light[2] += 0.9f; - } - } if (modPlayer.forbiddenCirclet) { light[0] += 0.8f; @@ -1360,7 +1554,7 @@ namespace CalamityMod.CalPlayer if (!npc.buffImmune[buffType] && Vector2.Distance(player.Center, npc.Center) <= freezeDist) { if (npc.FindBuffIndex(buffType) == -1) - npc.AddBuff(buffType, 120, false); + npc.AddBuff(buffType, 60, false); } } } @@ -1405,242 +1599,6 @@ namespace CalamityMod.CalPlayer else if (modPlayer.polarisBoostCounter >= 10) modPlayer.polarisBoostTwo = true; - // Lore bonuses - if (modPlayer.kingSlimeLore) - { - player.moveSpeed += 0.05f; - player.jumpSpeedBoost += player.autoJump ? 0f : 0.1f; - player.statDefense -= 3; - } - if (modPlayer.desertScourgeLore) - { - if (player.ZoneDesert || player.Calamity().ZoneSunkenSea) - { - player.statDefense += 5; - player.allDamage -= 0.025f; - } - } - if (modPlayer.crabulonLore) - { - if (player.ZoneGlowshroom || player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) - { - if (Main.myPlayer == player.whoAmI) - player.AddBuff(ModContent.BuffType(), 2); - - player.moveSpeed -= 0.1f; - } - } - if (modPlayer.eaterOfWorldsLore) - { - int damage = (int)(15 * player.AverageDamage()); - float knockBack = 1f; - if (Main.rand.NextBool(15)) - { - int projCount = 0; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == ModContent.ProjectileType()) - projCount++; - } - - if (Main.rand.Next(15) >= projCount && projCount < 6) - { - int loopAmt = 50; - int num3 = 24; - int num4 = 90; - - for (int j = 0; j < loopAmt; j++) - { - int sourceVariance = Main.rand.Next(200 - j * 2, 400 + j * 2); - Vector2 center = player.Center; - center.X += (float)Main.rand.Next(-sourceVariance, sourceVariance + 1); - center.Y += (float)Main.rand.Next(-sourceVariance, sourceVariance + 1); - - if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) - { - center.X += (float)(num3 / 2); - center.Y += (float)(num3 / 2); - - if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) - { - int xSpawn = (int)center.X / 16; - int ySpawn = (int)center.Y / 16; - bool shouldSpawn = false; - - if (Main.rand.NextBool(3) && Main.tile[xSpawn, ySpawn] != null && Main.tile[xSpawn, ySpawn].wall > 0) - shouldSpawn = true; - else - { - center.X -= (float)(num4 / 2); - center.Y -= (float)(num4 / 2); - - if (Collision.SolidCollision(center, num4, num4)) - { - center.X += (float)(num4 / 2); - center.Y += (float)(num4 / 2); - shouldSpawn = true; - } - } - - if (shouldSpawn) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) - { - shouldSpawn = false; - break; - } - } - - if (shouldSpawn && Main.myPlayer == player.whoAmI) - Projectile.NewProjectile(center, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } - } - } - } - } - } - } - if (modPlayer.skeletronLore) - { - player.allDamage += 0.1f; - modPlayer.AllCritBoost(5); - } - if (modPlayer.destroyerLore) - { - player.pickSpeed -= 0.05f; - } - if (modPlayer.dashMod == 6) // Cryogen lore - { - player.statDefense -= 10; - } - if (modPlayer.aquaticScourgeLore) - { - if (player.wellFed) - { - player.statDefense += 1; - player.allDamage += 0.025f; - modPlayer.AllCritBoost(1); - player.minionKB += 0.25f; - player.moveSpeed += 0.1f; - } - else - { - player.statDefense -= 1; - player.allDamage -= 0.025f; - modPlayer.AllCritBoost(-1); - player.minionKB -= 0.25f; - player.moveSpeed -= 0.1f; - } - } - if (modPlayer.skeletronPrimeLore) - { - player.armorPenetration += 5; - } - if (modPlayer.leviathanAndSirenLore) - { - if (!player.IsUnderwater()) - { - player.statDefense -= 8; - player.endurance -= 0.05f; - } - if (modPlayer.sirenPet) - { - player.spelunkerTimer += 1; - if (player.spelunkerTimer >= 10) - { - player.spelunkerTimer = 0; - int distance = 30; - int i = (int)player.Center.X / 16; - int j = (int)player.Center.Y / 16; - - for (int x = i - distance; x <= i + distance; x++) - { - for (int y = j - distance; y <= j + distance; y++) - { - Tile tile = Main.tile[x, y]; - if (Main.rand.NextBool(4)) - { - Vector2 vector = new Vector2((float)(i - x), (float)(j - y)); - if (vector.Length() < (float)distance && x > 0 && x < Main.maxTilesX - 1 && y > 0 && y < Main.maxTilesY - 1 && tile != null && tile.active()) - { - bool shouldSpawnDust = false; - //These checks are for money piles. They share a sheet with other background objects so it checks for frames. - if (tile.type == TileID.SmallPiles && tile.frameY == 18) - { - if (tile.frameX >= 576 && tile.frameX <= 882) - shouldSpawnDust = true; - } - else if (tile.type == TileID.LargePiles && tile.frameX >= 864 && tile.frameX <= 1170) - shouldSpawnDust = true; - - if (shouldSpawnDust || Main.tileSpelunker[tile.type] || (Main.tileAlch[tile.type] && tile.type != TileID.ImmatureHerbs)) - { - int sparkle = Dust.NewDust(new Vector2((x * 16f), (y * 16f)), 16, 16, 204, 0f, 0f, 150, default, 0.3f); - Main.dust[sparkle].fadeIn = 0.75f; - Main.dust[sparkle].velocity *= 0.1f; - Main.dust[sparkle].noLight = true; - } - } - } - } - } - } - } - } - if (player.ZoneSkyHeight) - { - if (modPlayer.astrumDeusLore) - player.moveSpeed += 0.2f; - if (modPlayer.astrumAureusLore) - player.jumpSpeedBoost += 0.5f; - } - if (modPlayer.golemLore) - { - if (player.StandingStill() && player.itemAnimation == 0) - player.statDefense += 10; - } - if (modPlayer.dukeFishronLore) - { - if (player.IsUnderwater()) - { - player.allDamage += 0.05f; - modPlayer.AllCritBoost(5); - player.moveSpeed += 0.1f; - } - else - { - player.allDamage -= 0.02f; - modPlayer.AllCritBoost(-2); - player.moveSpeed -= 0.04f; - } - } - if (modPlayer.lunaticCultistLore) - { - player.blind = true; - player.endurance += 0.04f; - player.statDefense += 4; - player.allDamage += 0.04f; - modPlayer.AllCritBoost(4); - player.minionKB += 0.5f; - player.moveSpeed += 0.1f; - } - if (modPlayer.moonLordLore) - { - if (player.gravDir == -1f && player.gravControl2) - { - player.endurance += 0.05f; - player.statDefense += 10; - player.allDamage += 0.1f; - modPlayer.AllCritBoost(10); - player.minionKB += 1.5f; - player.moveSpeed += 0.15f; - } - else - player.slowFall = true; - } - // Calcium Potion buff if (modPlayer.calcium) player.noFallDmg = true; @@ -1786,53 +1744,56 @@ namespace CalamityMod.CalPlayer } } - // Plagued Fuel Pack effects - if (modPlayer.plaguedFuelPackDash > 0 && player.whoAmI == Main.myPlayer) + // Plagued Fuel Pack and Blunder Booster effects + if (modPlayer.jetPackDash > 0 && player.whoAmI == Main.myPlayer) { - int velocityMult = modPlayer.plaguedFuelPackDash > 1 ? 25 : 5; - player.velocity = new Vector2(modPlayer.plaguedFuelPackDirection, -1) * velocityMult; + int velocityAmt = modPlayer.blunderBooster ? 35 : 25; + int velocityMult = modPlayer.jetPackDash > 1 ? velocityAmt : 5; + player.velocity = new Vector2(modPlayer.jetPackDirection, -1) * velocityMult; - int numClouds = Main.rand.Next(2, 10); - for (int i = 0; i < numClouds; i++) + if (modPlayer.blunderBooster) { - 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); - Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + int lightningCount = Main.rand.Next(2, 7); + for (int i = 0; i < lightningCount; i++) + { + 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); + Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + } } - - for (int i = 0; i < 3; i++) + else if (modPlayer.plaguedFuelPack) { - 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; - } - } + int numClouds = Main.rand.Next(2, 10); + for (int i = 0; i < numClouds; i++) + { + 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); + Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } - // Blunder Booster effects - if (modPlayer.blunderBoosterDash > 0 && player.whoAmI == Main.myPlayer) - { - int velocityMult = modPlayer.blunderBoosterDash > 1 ? 35 : 5; - player.velocity = new Vector2(modPlayer.blunderBoosterDirection, -1) * velocityMult; - - int lightningCount = Main.rand.Next(2, 7); - for (int i = 0; i < lightningCount; i++) - { - 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); - Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); - } - - 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); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y -= 0.15f; + } } } @@ -1866,7 +1827,8 @@ namespace CalamityMod.CalPlayer { modPlayer.brimflameFrenzy = false; player.ClearBuff(ModContent.BuffType()); - player.AddBuff(ModContent.BuffType(), 30 * 60, true); + player.AddBuff(ModContent.BuffType(), BrimflameScowl.CooldownLength, true); + modPlayer.brimflameFrenzyTimer = BrimflameScowl.CooldownLength; } if (!modPlayer.bloodflareMelee && modPlayer.bloodflareFrenzy) { @@ -1902,6 +1864,13 @@ namespace CalamityMod.CalPlayer modPlayer.prismaticLasers = 1800; player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(30f), true); } + if (!modPlayer.angelicAlliance && modPlayer.divineBless) + { + modPlayer.divineBless = false; + player.ClearBuff(ModContent.BuffType()); + int seconds = CalamityUtils.SecondsToFrames(60f); + player.AddBuff(ModContent.BuffType(), seconds, false); + } } #endregion @@ -1917,10 +1886,14 @@ namespace CalamityMod.CalPlayer { // Abyss depth variables Point point = player.Center.ToTileCoordinates(); - double abyssSurface = Main.rockLayer - (double)Main.maxTilesY * 0.05; + double abyssSurface = Main.rockLayer - Main.maxTilesY * 0.05; + double abyssLevel1 = Main.rockLayer + Main.maxTilesY * 0.03; double totalAbyssDepth = Main.maxTilesY - 250D - abyssSurface; + double totalAbyssDepthFromLayer1 = Main.maxTilesY - 250D - abyssLevel1; double playerAbyssDepth = point.Y - abyssSurface; + double playerAbyssDepthFromLayer1 = point.Y - abyssLevel1; double depthRatio = playerAbyssDepth / totalAbyssDepth; + double depthRatioFromAbyssLayer1 = playerAbyssDepthFromLayer1 / totalAbyssDepthFromLayer1; // Darkness strength scales smoothly with how deep you are. float darknessStrength = (float)depthRatio; @@ -1973,7 +1946,7 @@ namespace CalamityMod.CalPlayer } // Breath lost while at zero breath - double breathLoss = 50D * depthRatio; + double breathLoss = point.Y > abyssLevel1 ? 50D * depthRatioFromAbyssLayer1 : 0D; // Breath Loss Multiplier, depending on gear double breathLossMult = 1D - @@ -2120,27 +2093,46 @@ namespace CalamityMod.CalPlayer } #endregion + #region Calamitas Enchantment Held Item Effects + public static void EnchantHeldItemEffects(Player player, CalamityPlayer modPlayer, Item heldItem) + { + if (heldItem.IsAir) + return; + + // Exhaustion recharge effects. + foreach (Item item in player.inventory) + { + if (item.IsAir) + continue; + + if (item.Calamity().AppliedEnchantment.HasValue && item.Calamity().AppliedEnchantment.Value.ID == 600) + { + // Initialize the exhaustion if it is currently not defined. + if (item.Calamity().DischargeEnchantExhaustion <= 0f) + item.Calamity().DischargeEnchantExhaustion = CalamityGlobalItem.DischargeEnchantExhaustionCap; + + // Slowly recharge the weapon over time. This is depleted when the item is actaully used. + else if (item.Calamity().DischargeEnchantExhaustion < CalamityGlobalItem.DischargeEnchantExhaustionCap) + item.Calamity().DischargeEnchantExhaustion++; + } + else + item.Calamity().DischargeEnchantExhaustion = 0f; + } + + if (!heldItem.Calamity().AppliedEnchantment.HasValue || heldItem.Calamity().AppliedEnchantment.Value.HoldEffect is null) + return; + + heldItem.Calamity().AppliedEnchantment.Value.HoldEffect(player); + + // Weak brimstone flame hold curse effect. + if (modPlayer.flamingItemEnchant) + player.AddBuff(ModContent.BuffType(), 10); + } + #endregion + #region Max Life And Mana Effects private static void MaxLifeAndManaEffects(Player player, CalamityPlayer modPlayer, Mod mod) { - // Silva invincibility effects - if (modPlayer.silvaHitCounter > 0) - { - player.statLifeMax2 -= modPlayer.silvaHitCounter * 100; - if (player.statLifeMax2 <= 400) - { - player.statLifeMax2 = 400; - if (modPlayer.silvaCountdown > 0) - { - if (player.FindBuffIndex(ModContent.BuffType()) > -1) - player.ClearBuff(ModContent.BuffType()); - - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); - } - modPlayer.silvaCountdown = 0; - } - } - // New textures if (Main.netMode != NetmodeID.Server && player.whoAmI == Main.myPlayer) { @@ -2206,7 +2198,7 @@ namespace CalamityMod.CalPlayer if (player.StandingStill(0.1f) && !player.mount.Active) { - if (modPlayer.chiBuffTimer < 120) + if (modPlayer.chiBuffTimer < 60) modPlayer.chiBuffTimer++; else player.AddBuff(ModContent.BuffType(), 6); @@ -2225,7 +2217,7 @@ namespace CalamityMod.CalPlayer { if (modPlayer.aquaticBoost > 0f) { - modPlayer.aquaticBoost -= 0.0002f; // 0.015 + modPlayer.aquaticBoost -= 2f; if (modPlayer.aquaticBoost <= 0f) { modPlayer.aquaticBoost = 0f; @@ -2236,18 +2228,18 @@ namespace CalamityMod.CalPlayer } else { - modPlayer.aquaticBoost += 0.0002f; - if (modPlayer.aquaticBoost > 1f) - modPlayer.aquaticBoost = 1f; + modPlayer.aquaticBoost += 2f; + if (modPlayer.aquaticBoost > modPlayer.aquaticBoostMax) + modPlayer.aquaticBoost = modPlayer.aquaticBoostMax; if (player.mount.Active) - modPlayer.aquaticBoost = 1f; + modPlayer.aquaticBoost = modPlayer.aquaticBoostMax; } - player.statDefense += (int)((1f - modPlayer.aquaticBoost) * 30f); - player.moveSpeed -= (1f - modPlayer.aquaticBoost) * 0.1f; + player.statDefense += (int)((1f - modPlayer.aquaticBoost * 0.0001f) * 50f); + player.moveSpeed -= (1f - modPlayer.aquaticBoost * 0.0001f) * 0.1f; } else - modPlayer.aquaticBoost = 1f; + modPlayer.aquaticBoost = modPlayer.aquaticBoostMax; // Auric bonus if (modPlayer.auricBoost) @@ -2325,6 +2317,80 @@ namespace CalamityMod.CalPlayer } else modPlayer.modStealth = 1f; + + if (player.ActiveItem().type == ModContent.ItemType() && player.StandingStill(0.1f)) + { + if (modPlayer.auralisStealthCounter < 300f) + modPlayer.auralisStealthCounter++; + + bool usingScope = false; + if (!Main.gameMenu && Main.netMode != NetmodeID.Server) + { + if (player.noThrow <= 0 && !player.lastMouseInterface || (Main.zoomX != 0f || Main.zoomY != 0f)) + { + if (PlayerInput.UsingGamepad) + { + if (PlayerInput.GamepadThumbstickRight.Length() != 0f || !Main.SmartCursorEnabled) + { + usingScope = true; + } + } + else if (Main.mouseRight) + usingScope = true; + } + } + + int chargeDuration = CalamityUtils.SecondsToFrames(5f); + int auroraDuration = CalamityUtils.SecondsToFrames(20f); + + if (usingScope && modPlayer.auralisAuroraCounter < chargeDuration + auroraDuration) + modPlayer.auralisAuroraCounter++; + + if (modPlayer.auralisAuroraCounter > chargeDuration + auroraDuration) + { + modPlayer.auralisAuroraCounter = 0; + modPlayer.auralisAuroraCooldown = CalamityUtils.SecondsToFrames(30f); + } + + if (modPlayer.auralisAuroraCounter > 0 && modPlayer.auralisAuroraCounter < chargeDuration && !usingScope) + modPlayer.auralisAuroraCounter--; + + if (modPlayer.auralisAuroraCounter > chargeDuration && modPlayer.auralisAuroraCounter < chargeDuration + auroraDuration && !usingScope) + modPlayer.auralisAuroraCounter = 0; + } + else + { + modPlayer.auralisStealthCounter = 0f; + modPlayer.auralisAuroraCounter = 0; + } + if (modPlayer.auralisAuroraCooldown > 0) + { + if (modPlayer.auralisAuroraCooldown == 1) + { + 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; + 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; + Main.dust[blue].velocity = dustVel; + } + 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; + 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; + Main.dust[green].velocity = dustVel; + } + } + modPlayer.auralisAuroraCounter = 0; + } } #endregion @@ -2358,7 +2424,7 @@ namespace CalamityMod.CalPlayer modPlayer.AllCritBoost(critBoost); player.aggro += (int)((5f - modPlayer.shieldInvinc) * 220f); - player.statDefense += (int)((5f - modPlayer.shieldInvinc) * 4f); + player.statDefense += (int)((5f - modPlayer.shieldInvinc) * 8f); player.moveSpeed *= 0.85f; if (player.mount.Active) @@ -2489,23 +2555,16 @@ namespace CalamityMod.CalPlayer if (modPlayer.irradiated) { - if (modPlayer.boomerDukeLore) - { - player.statDefense += 10; - } - else - { - player.statDefense -= 10; - } + player.statDefense -= 10; + player.moveSpeed -= 0.1f; player.allDamage += 0.05f; player.minionKB += 0.5f; - player.moveSpeed += 0.05f; } if (modPlayer.rRage) { - player.allDamage += 0.05f; - player.moveSpeed += 0.05f; + player.allDamage += 0.3f; + player.statDefense += 5; } if (modPlayer.xRage) @@ -2521,17 +2580,6 @@ namespace CalamityMod.CalPlayer player.meleeDamage += 0.2f; } - if (modPlayer.eScarfBoost) - { - player.allDamage += 0.1f; - modPlayer.AllCritBoost(10); - } - if (modPlayer.sMeleeBoost) - { - player.allDamage += 0.1f; - modPlayer.AllCritBoost(5); - } - if (modPlayer.tFury) { player.meleeDamage += 0.3f; @@ -2540,12 +2588,13 @@ namespace CalamityMod.CalPlayer if (modPlayer.yPower) { - player.endurance += 0.05f; - player.statDefense += 5; + player.endurance += 0.06f; + player.statDefense += 8; + player.pickSpeed -= 0.05f; player.allDamage += 0.06f; modPlayer.AllCritBoost(2); player.minionKB += 1f; - player.moveSpeed += 0.15f; + player.moveSpeed += 0.06f; } if (modPlayer.tScale) @@ -2555,8 +2604,8 @@ namespace CalamityMod.CalPlayer player.kbBuff = true; if (modPlayer.titanBoost > 0) { - player.statDefense += 25; - player.endurance += 0.1f; + player.statDefense += 25; + player.endurance += 0.1f; } } else @@ -2569,12 +2618,11 @@ namespace CalamityMod.CalPlayer player.minionKB += 1.2f; player.pickSpeed -= 0.15f; if (Main.eclipse || !Main.dayTime) - player.statDefense += 30; + player.statDefense += 15; } if (modPlayer.eGauntlet) { - player.longInvince = true; player.kbGlove = true; player.magmaStone = true; player.meleeDamage += 0.15f; @@ -2582,11 +2630,6 @@ namespace CalamityMod.CalPlayer player.lavaMax += 240; } - if (modPlayer.eQuiver) - { - player.magicQuiver = true; - } - if (modPlayer.bloodPactBoost) { player.allDamage += 0.05f; @@ -2597,23 +2640,16 @@ namespace CalamityMod.CalPlayer } if (modPlayer.fabsolVodka) - { player.allDamage += 0.08f; - player.statDefense -= 20; - } if (modPlayer.vodka) { - player.statDefense -= 4; player.allDamage += 0.06f; modPlayer.AllCritBoost(2); } if (modPlayer.grapeBeer) - { - player.statDefense -= 2; player.moveSpeed -= 0.05f; - } if (modPlayer.moonshine) { @@ -2622,32 +2658,24 @@ namespace CalamityMod.CalPlayer } if (modPlayer.rum) - { player.moveSpeed += 0.1f; - player.statDefense -= 8; - } if (modPlayer.whiskey) { - player.statDefense -= 8; player.allDamage += 0.04f; modPlayer.AllCritBoost(2); } if (modPlayer.everclear) - { - player.statDefense -= 40; player.allDamage += 0.25f; - } if (modPlayer.bloodyMary) { if (Main.bloodMoon) { - player.statDefense -= 6; player.allDamage += 0.15f; modPlayer.AllCritBoost(7); - player.moveSpeed += 0.15f; + player.moveSpeed += 0.1f; } } @@ -2666,7 +2694,7 @@ namespace CalamityMod.CalPlayer { if (Main.dayTime) { - player.statDefense += 15; + player.statDefense += 10; player.allDamage += 0.07f; modPlayer.AllCritBoost(3); player.endurance += 0.07f; @@ -2674,24 +2702,16 @@ namespace CalamityMod.CalPlayer } if (modPlayer.caribbeanRum) - { - player.moveSpeed += 0.2f; - player.statDefense -= 12; - } + player.moveSpeed += 0.1f; if (modPlayer.cinnamonRoll) { - player.statDefense -= 12; player.manaRegenDelay--; player.manaRegenBonus += 10; } - if (modPlayer.margarita) - player.statDefense -= 6; - if (modPlayer.starBeamRye) { - player.statDefense -= 6; player.magicDamage += 0.08f; player.manaCost *= 0.9f; } @@ -2703,10 +2723,7 @@ namespace CalamityMod.CalPlayer } if (modPlayer.whiteWine) - { - player.statDefense -= 6; player.magicDamage += 0.1f; - } if (modPlayer.evergreenGin) player.endurance += 0.05f; @@ -2727,22 +2744,22 @@ namespace CalamityMod.CalPlayer } } - if (CalamityMod.scopedWeaponList.Contains(player.ActiveItem().type)) + if (CalamityLists.scopedWeaponList.Contains(player.ActiveItem().type)) player.scope = true; - if (CalamityMod.highTestFishList.Contains(player.ActiveItem().type)) + if (CalamityLists.highTestFishList.Contains(player.ActiveItem().type)) player.accFishingLine = true; - if (CalamityMod.boomerangList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.boomerangList.Contains(player.ActiveItem().type) && player.invis) modPlayer.throwingDamage += 0.1f; - if (CalamityMod.javelinList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.javelinList.Contains(player.ActiveItem().type) && player.invis) player.armorPenetration += 5; - if (CalamityMod.flaskBombList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.flaskBombList.Contains(player.ActiveItem().type) && player.invis) modPlayer.throwingVelocity += 0.1f; - if (CalamityMod.spikyBallList.Contains(player.ActiveItem().type) && player.invis) + if (CalamityLists.spikyBallList.Contains(player.ActiveItem().type) && player.invis) modPlayer.throwingCrit += 10; if (modPlayer.planarSpeedBoost != 0) @@ -2762,136 +2779,112 @@ namespace CalamityMod.CalPlayer modPlayer.animusBoost = 1f; } - if (modPlayer.etherealExtorter) - { - bool ZoneForest = !modPlayer.ZoneAbyss && !modPlayer.ZoneSulphur && !modPlayer.ZoneAstral && !modPlayer.ZoneCalamity && - !modPlayer.ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && - !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; - - if (player.ZoneUnderworldHeight && !modPlayer.ZoneCalamity && CalamityMod.fireWeaponList.Contains(player.ActiveItem().type)) - player.endurance += 0.03f; - - if ((player.ZoneDesert || player.ZoneUndergroundDesert) && CalamityMod.daggerList.Contains(player.ActiveItem().type)) - player.scope = true; - - if (modPlayer.ZoneSunkenSea) - { - player.gills = true; - player.ignoreWater = true; - } - - if (player.ZoneSnow && CalamityMod.iceWeaponList.Contains(player.ActiveItem().type)) - player.statDefense += 5; - - if (modPlayer.ZoneAstral) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.05); - } - - if (player.ZoneJungle && CalamityMod.natureWeaponList.Contains(player.ActiveItem().type)) - player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing - - if (modPlayer.ZoneAbyss) - { - player.blind = true; - player.headcovered = true; - player.blackout = true; - if (player.FindBuffIndex(BuffID.Shine) > -1) - player.ClearBuff(BuffID.Shine); - if (player.FindBuffIndex(BuffID.NightOwl) > -1) - player.ClearBuff(BuffID.NightOwl); - player.nightVision = false; - modPlayer.shine = false; - player.allDamage += 0.2f; - modPlayer.AllCritBoost(5); - player.statDefense += 8; - player.endurance += 0.05f; - } - - if (player.ZoneRockLayerHeight && ZoneForest && CalamityMod.flaskBombList.Contains(player.ActiveItem().type)) - player.blackBelt = true; - - if (player.ZoneHoly) - { - player.maxMinions += 1; - player.manaCost *= 0.9f; - player.ammoCost75 = true; // 25% chance to not use ranged ammo - modPlayer.throwingAmmoCost *= 0.75f; // 25% chance to not consume rogue consumables - } - - if (player.ZoneBeach) - player.moveSpeed += 0.05f; - - if (player.ZoneGlowshroom) - player.statDefense += 3; - - if (player.ZoneMeteor) - { - modPlayer.gravityNormalizer = true; - player.slowFall = true; - } - - if (Main.moonPhase == 0) // Full moon - player.fishingSkill += 30; - - if (Main.moonPhase == 6) // First quarter - player.discount = true; - } + // Flight time boosts + double flightTimeMult = 1D + + (modPlayer.ZoneAstral ? 0.05 : 0D) + + (modPlayer.harpyRing ? 0.2 : 0D) + + (modPlayer.aeroStone ? 0.1 : 0D) + + (modPlayer.angelTreads ? 0.1 : 0D) + + (modPlayer.blueCandle ? 0.1 : 0D) + + (modPlayer.soaring ? 0.1 : 0D) + + (modPlayer.prismaticGreaves ? 0.1 : 0D) + + (modPlayer.plagueReaper ? 0.05 : 0D) + + (modPlayer.draconicSurge ? 0.2 : 0D); if (modPlayer.harpyRing) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.25); - player.moveSpeed += 0.2f; - } + player.moveSpeed += 0.1f; if (modPlayer.blueCandle) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.1); - player.moveSpeed += 0.15f; - } + player.moveSpeed += 0.1f; - if (modPlayer.plaguebringerGoliathLore) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.25); - } - - if (modPlayer.soaring) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.1); - } - - if (modPlayer.prismaticGreaves) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.1); - } - - if (modPlayer.plagueReaper) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.05); - } - - if (modPlayer.draconicSurge) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.35); - } - if (modPlayer.draconicSurgeCooldown) //weird mod conflicts with like Luiafk + if (modPlayer.draconicSurgeCooldown) // Weird mod conflicts with like Luiafk { modPlayer.draconicSurge = false; if (player.FindBuffIndex(ModContent.BuffType()) > -1) player.ClearBuff(ModContent.BuffType()); } + if (modPlayer.community) + { + float floatTypeBoost = 0.05f + + (NPC.downedSlimeKing ? 0.01f : 0f) + + (NPC.downedBoss1 ? 0.01f : 0f) + + (NPC.downedBoss2 ? 0.01f : 0f) + + (NPC.downedQueenBee ? 0.01f : 0f) + + (NPC.downedBoss3 ? 0.01f : 0f) + // 0.1 + (Main.hardMode ? 0.01f : 0f) + + (NPC.downedMechBossAny ? 0.01f : 0f) + + (NPC.downedPlantBoss ? 0.01f : 0f) + + (NPC.downedGolemBoss ? 0.01f : 0f) + + (NPC.downedFishron ? 0.01f : 0f) + // 0.15 + (NPC.downedAncientCultist ? 0.01f : 0f) + + (NPC.downedMoonlord ? 0.01f : 0f) + + (CalamityWorld.downedProvidence ? 0.01f : 0f) + + (CalamityWorld.downedDoG ? 0.01f : 0f) + + (CalamityWorld.downedYharon ? 0.01f : 0f); // 0.2 + 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; + modPlayer.AllCritBoost(critBoost); + player.minionKB += floatTypeBoost; + player.moveSpeed += floatTypeBoost; + flightTimeMult += floatTypeBoost; + } + // Shattered Community gives the same wing time boost as normal Community + if (modPlayer.shatteredCommunity) + flightTimeMult += 0.15f; + + if (modPlayer.profanedCrystalBuffs && modPlayer.gOffense && modPlayer.gDefense) + { + 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 (modPlayer.vHex) + { + player.blind = true; + player.statDefense -= 10; + player.moveSpeed -= 0.1f; + + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + player.wingTimeMax = (int)(player.wingTimeMax * 0.75); + } + + if (modPlayer.eGravity) + { + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + if (player.wingTimeMax > 400) + player.wingTimeMax = 400; + + player.wingTimeMax = (int)(player.wingTimeMax * 0.66); + } + + if (modPlayer.eGrav) + { + if (player.wingTimeMax < 0) + player.wingTimeMax = 0; + + if (player.wingTimeMax > 400) + player.wingTimeMax = 400; + + player.wingTimeMax = (int)(player.wingTimeMax * 0.75); + } + if (modPlayer.bounding) { - player.jumpSpeedBoost += 0.5f; + player.jumpSpeedBoost += 0.25f; Player.jumpHeight += 10; player.extraFall += 25; } @@ -2907,26 +2900,21 @@ namespace CalamityMod.CalPlayer } if (modPlayer.aWeapon) - player.moveSpeed += 0.15f; + player.moveSpeed += 0.1f; if (modPlayer.molten) player.resistCold = true; if (modPlayer.shellBoost) - player.moveSpeed += 0.9f; + player.moveSpeed += 0.4f; if (modPlayer.tarraSet) { - player.calmed = modPlayer.tarraMelee ? false : true; + if (!modPlayer.tarraMelee) + player.calmed = true; player.lifeMagnet = true; } - if (modPlayer.aChicken) - { - player.statDefense += 5; - player.moveSpeed += 0.1f; - } - if (modPlayer.cadence) { if (player.FindBuffIndex(BuffID.Regeneration) > -1) @@ -2937,50 +2925,28 @@ namespace CalamityMod.CalPlayer player.calmed = true; } - if (modPlayer.community) - { - float floatTypeBoost = 0.01f + - (NPC.downedSlimeKing ? 0.01f : 0f) + - (NPC.downedBoss1 ? 0.01f : 0f) + - (NPC.downedBoss2 ? 0.01f : 0f) + - (NPC.downedQueenBee ? 0.01f : 0f) + //0.05 - (NPC.downedBoss3 ? 0.01f : 0f) + - (Main.hardMode ? 0.01f : 0f) + - (NPC.downedMechBossAny ? 0.01f : 0f) + - (NPC.downedPlantBoss ? 0.01f : 0f) + - (NPC.downedGolemBoss ? 0.01f : 0f) + //0.1 - (NPC.downedFishron ? 0.01f : 0f) + - (NPC.downedAncientCultist ? 0.01f : 0f) + - (NPC.downedMoonlord ? 0.01f : 0f) + - (CalamityWorld.downedProvidence ? 0.02f : 0f) + //0.15 - (CalamityWorld.downedDoG ? 0.02f : 0f) + //0.17 - (CalamityWorld.downedYharon ? 0.03f : 0f); //0.2 - 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; - modPlayer.AllCritBoost(critBoost); - player.minionKB += floatTypeBoost; - player.moveSpeed += floatTypeBoost; - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 1.15); - } + if (player.wellFed) + player.moveSpeed -= 0.1f; - if (modPlayer.ravagerLore) - { - if (player.wingTimeMax > 0) - player.wingTimeMax = (int)(player.wingTimeMax * 0.5); - player.allDamage += 0.1f; - } + if (player.poisoned) + player.moveSpeed -= 0.1f; + + if (player.venom) + player.moveSpeed -= 0.15f; if (modPlayer.wDeath) { player.statDefense -= WhisperingDeath.DefenseReduction; player.allDamage -= 0.1f; + player.moveSpeed -= 0.1f; } + if (modPlayer.lethalLavaBurn) + player.moveSpeed -= 0.15f; + + if (modPlayer.hInferno) + player.moveSpeed -= 0.25f; + if (modPlayer.aFlames) player.statDefense -= AbyssalFlames.DefenseReduction; @@ -2988,14 +2954,18 @@ namespace CalamityMod.CalPlayer { player.blackout = true; player.statDefense -= GodSlayerInferno.DefenseReduction; + player.moveSpeed -= 0.15f; } if (modPlayer.astralInfection) + { player.statDefense -= AstralInfectionDebuff.DefenseReduction; + player.moveSpeed -= 0.15f; + } if (modPlayer.pFlames) { - player.blind = true; + player.blind = !modPlayer.alchFlask; player.statDefense -= Plague.DefenseReduction; player.moveSpeed -= 0.15f; } @@ -3004,93 +2974,60 @@ namespace CalamityMod.CalPlayer { player.blind = true; player.statDefense -= 3; - player.moveSpeed += 0.2f; + player.moveSpeed += 0.1f; player.meleeDamage += 0.05f; player.rangedDamage -= 0.1f; player.magicDamage -= 0.1f; } - if (modPlayer.horror && !modPlayer.laudanum) - { - player.blind = true; - player.statDefense -= 15; - player.moveSpeed -= 0.15f; - } - - if (modPlayer.aCrunch) + if (modPlayer.aCrunch && !modPlayer.laudanum) { player.statDefense -= ArmorCrunch.DefenseReduction; player.endurance *= 0.33f; } - if (modPlayer.wCleave) + if (modPlayer.wCleave && !modPlayer.laudanum) { player.statDefense -= WarCleave.DefenseReduction; player.endurance *= 0.75f; } - if (modPlayer.vHex) - { - player.blind = true; - player.statDefense -= 30; - player.moveSpeed -= 0.1f; - - if (player.wingTimeMax <= 0) - player.wingTimeMax = 0; - - player.wingTimeMax /= 2; - } - if (modPlayer.gState) { player.statDefense -= GlacialState.DefenseReduction; - player.velocity.Y = 0f; - player.velocity.X = 0f; + player.velocity.X *= 0.5f; + player.velocity.Y += 0.05f; + if (player.velocity.Y > 15f) + player.velocity.Y = 15f; + } + + if (modPlayer.eFreeze) + { + player.statDefense -= GlacialState.DefenseReduction; + player.velocity.X *= 0.5f; + player.velocity.Y += 0.1f; + if (player.velocity.Y > 15f) + player.velocity.Y = 15f; } if (modPlayer.eFreeze || modPlayer.silvaStun || modPlayer.eutrophication) - { - player.velocity.Y = 0f; - player.velocity.X = 0f; - } + player.velocity = Vector2.Zero; if (modPlayer.vaporfied || modPlayer.teslaFreeze) - { - player.velocity.Y *= 0.98f; - player.velocity.X *= 0.98f; - } - - if (modPlayer.eGravity) - { - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; - - if (player.wingTimeMax > 400) - player.wingTimeMax = 400; - - player.wingTimeMax /= 4; - } - - if (modPlayer.eGrav) - { - if (player.wingTimeMax < 0) - player.wingTimeMax = 0; - - if (player.wingTimeMax > 400) - player.wingTimeMax = 400; - - player.wingTimeMax /= 2; - } + player.velocity *= 0.98f; if (modPlayer.molluskSet) player.velocity.X *= 0.985f; if ((modPlayer.warped || modPlayer.caribbeanRum) && !player.slowFall && !player.mount.Active) + { player.velocity.Y *= 1.01f; + player.moveSpeed -= 0.1f; + } if (modPlayer.corrEffigy) { - player.moveSpeed += 0.15f; + player.moveSpeed += 0.1f; modPlayer.AllCritBoost(10); } @@ -3101,48 +3038,19 @@ namespace CalamityMod.CalPlayer } if (modPlayer.badgeOfBraveryRare) - player.meleeDamage += 0.2f; - - if (modPlayer.calamitasLore) - player.maxMinions += 2; + player.meleeDamage += modPlayer.warBannerBonus; // The player's true max life value with Calamity adjustments modPlayer.actualMaxLife = player.statLifeMax2; if (modPlayer.thirdSageH && !player.dead && modPlayer.healToFull) - player.statLife = player.statLifeMax2; - - if (modPlayer.pinkCandle && !CalamityWorld.ironHeart) { - // Every frame, add up 1/60th of the healing value (0.4% max HP per second) - modPlayer.pinkCandleHealFraction += player.statLifeMax2 * 0.004 / 60; - if (modPlayer.pinkCandleHealFraction >= 1D) - { - modPlayer.pinkCandleHealFraction = 0D; - if (player.statLife < player.statLifeMax2) - player.statLife++; - } + modPlayer.thirdSageH = false; + player.statLife = modPlayer.actualMaxLife; } - else - modPlayer.pinkCandleHealFraction = 0D; if (modPlayer.manaOverloader) - { player.magicDamage += 0.06f; - } - - if (modPlayer.twinsLore) - { - if (!Main.dayTime) - { - player.invis = true; - modPlayer.throwingCrit += 5; - modPlayer.throwingDamage += 0.05f; - } - - if (player.statLife >= (int)(player.statLifeMax2 * 0.5)) - player.statDefense -= 10; - } if (modPlayer.rBrain) { @@ -3167,11 +3075,7 @@ namespace CalamityMod.CalPlayer } if (modPlayer.dAmulet) - { - player.panic = true; player.pStone = true; - player.armorPenetration += modPlayer.rampartOfDeities ? 20 : 10; - } if (modPlayer.fBulwark) { @@ -3249,57 +3153,45 @@ namespace CalamityMod.CalPlayer for (int I = 0; I < 3; I++) { float ai1 = I * 120; - 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)((modPlayer.auricSet ? 15000 : 5000) * 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; } } } if (modPlayer.yInsignia) { - player.longInvince = true; - player.meleeDamage += 0.05f; + player.meleeDamage += 0.1f; player.lavaMax += 240; if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) player.allDamage += 0.1f; } - if (modPlayer.reaperToothNecklace) - { - player.allDamage += 0.25f; - if (player.statDefense > 0) - player.statDefense /= 2; - } - - if (modPlayer.deepDiver) + if (modPlayer.deepDiver && player.IsUnderwater()) { player.allDamage += 0.15f; - player.statDefense += (int)(player.statDefense * 0.15); + player.statDefense += 15; player.moveSpeed += 0.15f; } + if (modPlayer.abyssalDivingSuit && !player.IsUnderwater()) + { + float moveSpeedLoss = (3 - modPlayer.abyssalDivingSuitPlateHits) * 0.2f; + player.moveSpeed -= moveSpeedLoss; + } + + if (modPlayer.ursaSergeant) + player.moveSpeed -= 0.35f; + + if (modPlayer.elysianGuard) + player.moveSpeed -= 0.5f; + if (modPlayer.coreOfTheBloodGod) { - player.endurance += 0.05f; - player.allDamage += 0.07f; - if (player.statDefense < 100) - player.allDamage += 0.15f; - } - else if (modPlayer.bloodflareCore) - { - if (player.statDefense < 100) - player.allDamage += 0.15f; - - if (player.statLife <= (int)(player.statLifeMax2 * 0.15)) - { - player.endurance += 0.1f; - player.allDamage += 0.2f; - } - else if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - { - player.endurance += 0.05f; - player.allDamage += 0.1f; - } + player.endurance += 0.08f; + player.allDamage += 0.08f; } if (modPlayer.godSlayerThrowing) @@ -3324,7 +3216,7 @@ namespace CalamityMod.CalPlayer // If the timer rolls over, it's time to deal damage. Only run this code for the client which is wearing the armor. if (modPlayer.tarraLifeAuraTimer == 0 && player.whoAmI == Main.myPlayer) { - const int BaseDamage = 150; + const int BaseDamage = 120; int damage = (int)(BaseDamage * player.MinionDamage()); float range = 300f; @@ -3368,17 +3260,20 @@ namespace CalamityMod.CalPlayer 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, 0f, 0f); - Main.projectile[spark].Calamity().forceTypeless = true; - Main.projectile[spark].localNPCHitCooldown = -2; - Main.projectile[spark].penetrate = 5; + 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; + Main.projectile[spark].localNPCHitCooldown = -2; + Main.projectile[spark].penetrate = 5; + } } } } } - // Brimstone Elemental lore inferno potion boost - if ((modPlayer.brimstoneElementalLore || modPlayer.ataxiaBlaze) && player.inferno) + // Inferno potion boost + if (modPlayer.ataxiaBlaze && player.inferno) { const int FramesPerHit = 30; @@ -3428,36 +3323,30 @@ namespace CalamityMod.CalPlayer } if (modPlayer.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.allDamage += 0.06f; + if (player.statLife <= (int)(player.statLifeMax2 * 0.75)) + { + player.allDamage += 0.06f; modPlayer.AllCritBoost(3); - } - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) - { - player.allDamage += 0.06f; + } + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) + { + player.allDamage += 0.06f; modPlayer.AllCritBoost(3); - } - if (player.statLife <= (int)(player.statLifeMax2 * 0.25)) - { - player.allDamage += 0.06f; + } + if (player.statLife <= (int)(player.statLifeMax2 * 0.25)) + { + player.allDamage += 0.06f; modPlayer.AllCritBoost(3); - } + } if (player.lifeRegen < 0) - { - player.allDamage += 0.1f; + { + player.allDamage += 0.1f; modPlayer.AllCritBoost(5); - } - } - - if (modPlayer.auricSet && modPlayer.silvaMelee) - { - double multiplier = player.statLife / (double)player.statLifeMax2; - player.meleeDamage += (float)(multiplier * 0.2); //ranges from 1.2 times to 1 times + } } if (modPlayer.dArtifact) @@ -3482,7 +3371,7 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 3600, true); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) - Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(232f * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(AngryChickenStaff.Damage * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); } } @@ -3494,16 +3383,17 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 3600, true); bool crystal = modPlayer.profanedCrystal && !modPlayer.profanedCrystalForce; - bool summonSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; + bool summonSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; + int guardianAmt = 1; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 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 (crystal || player.Calamity().minionSlotStat >= 10) { player.Calamity().gDefense = true; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -3f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } @@ -3511,7 +3401,7 @@ namespace CalamityMod.CalPlayer { player.Calamity().gOffense = true; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < guardianAmt) Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), 1, 1f, Main.myPlayer, 0f, 0f); } } @@ -3536,15 +3426,13 @@ namespace CalamityMod.CalPlayer { player.minionDamage += 0.15f; player.minionKB += 0.15f; - player.moveSpeed += 0.25f; + player.moveSpeed += 0.1f; player.statDefense -= 15; - if (!player.Calamity().yharonLore) - player.wingTimeMax = (int)(player.wingTimeMax * 1.1f); player.ignoreWater = true; } else { - player.moveSpeed -= 0.15f; + player.moveSpeed -= 0.1f; player.endurance += 0.05f; player.statDefense += 15; player.lifeRegen += 5; @@ -3552,7 +3440,7 @@ namespace CalamityMod.CalPlayer bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); bool notRetro = Lighting.NotRetro; if (!modPlayer.ZoneAbyss) //No abyss memes. - Lighting.AddLight(player.Center, enrage ? 60 : offenseBuffs ? 50 : 10, enrage ? 12 : offenseBuffs ? 10 : 2, 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. @@ -3589,6 +3477,8 @@ namespace CalamityMod.CalPlayer Main.projectile[bee].usesLocalNPCImmunity = true; Main.projectile[bee].localNPCHitCooldown = 10; Main.projectile[bee].penetrate = 2; + if (bee.WithinBounds(Main.maxProjectiles)) + Main.projectile[bee].Calamity().forceTypeless = true; } } } @@ -3604,11 +3494,15 @@ namespace CalamityMod.CalPlayer ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() }; + int projAmt = 1; for (int i = 0; i < summonDeleteList.Count; i++) { - if (player.ownedProjectileCounts[summonDeleteList[i]] > 1) + if (player.ownedProjectileCounts[summonDeleteList[i]] > projAmt) { for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { @@ -3683,7 +3577,7 @@ namespace CalamityMod.CalPlayer if (modPlayer.prismaticLasers > 1800 && player.whoAmI == Main.myPlayer) { float shootSpeed = 18f; - int dmg = (int)(50 * player.MagicDamage()); + int dmg = (int)(30 * player.MagicDamage()); Vector2 startPos = player.RotatedRelativePoint(player.MountedCenter, true); Vector2 velocity = Main.MouseWorld - startPos; if (player.gravDir == -1f) @@ -3726,6 +3620,8 @@ namespace CalamityMod.CalPlayer velocity.Y += Main.rand.Next(-50, 51) * 0.02f; 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); } @@ -3737,9 +3633,9 @@ namespace CalamityMod.CalPlayer if (modPlayer.prismaticLasers == 1) { //Spawn some dust since you can use it again - int dustAmt = 36; - for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) - { + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) + { Color color = Utils.SelectRandom(Main.rand, new Color[] { new Color(255, 0, 0, 50), //Red @@ -3755,14 +3651,38 @@ 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; - 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; - Main.dust[dusty].velocity = dustVel; - } + 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; + Main.dust[dusty].velocity = dustVel; + } + } + + if (modPlayer.angelicAlliance && Main.myPlayer == player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (hasBuff == ModContent.BuffType()) + { + modPlayer.angelicActivate = player.buffTime[l]; + } + if (hasBuff == ModContent.BuffType()) + { + if (player.buffTime[l] == 1) + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + if (modPlayer.angelicActivate == 1) + { + int seconds = CalamityUtils.SecondsToFrames(60f); + player.AddBuff(ModContent.BuffType(), seconds, false); + } + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + modPlayer.angelicActivate = -1; } if (modPlayer.theBee) @@ -3776,31 +3696,329 @@ namespace CalamityMod.CalPlayer if (modPlayer.badgeOfBravery) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) - { - player.meleeDamage += 0.1f; - player.meleeCrit += 5; - } + player.meleeDamage += 0.05f; + player.meleeCrit += 5; } if (CalamityConfig.Instance.Proficiency) modPlayer.GetStatBonuses(); // True melee damage bonuses - double damageAdd = (modPlayer.dodgeScarf ? 0.15 : 0) + - (modPlayer.evasionScarf ? 0.1 : 0) + + double damageAdd = (modPlayer.dodgeScarf ? 0.1 : 0) + + (modPlayer.evasionScarf ? 0.05 : 0) + ((modPlayer.aBulwarkRare && modPlayer.aBulwarkRareMeleeBoostTimer > 0) ? 0.5 : 0) + - (modPlayer.DoGLore ? 0.25 : 0) + (modPlayer.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) + (modPlayer.eGauntlet ? 0.1 : 0) + (modPlayer.yInsignia ? 0.1 : 0) + - (modPlayer.badgeOfBraveryRare ? 0.2 : 0); + (modPlayer.badgeOfBraveryRare ? modPlayer.warBannerBonus : 0); modPlayer.trueMeleeDamage += damageAdd; + + // Amalgam boosts + if (Main.myPlayer == player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; 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 || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || hasBuff == ModContent.BuffType() || + hasBuff == ModContent.BuffType()) + { + if (modPlayer.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; + + // Buffs will not go away when you die, to prevent wasting potions. + if (!Main.persistentBuff[hasBuff]) + Main.persistentBuff[hasBuff] = true; + } + else + { + // Reset buff persistence if Amalgam is removed. + if (Main.persistentBuff[hasBuff]) + Main.persistentBuff[hasBuff] = false; + } + } + } + } + + // Laudanum boosts + if (modPlayer.laudanum) + { + if (Main.myPlayer == player.whoAmI) + { + for (int l = 0; l < Player.MaxBuffs; 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; + } + + // See later as Laud cancels out the normal effects + if (hasBuff == ModContent.BuffType()) + { + // +15 defense + player.statDefense += ArmorCrunch.DefenseReduction; + } + if (hasBuff == ModContent.BuffType()) + { + // +10% damage reduction + player.endurance += 0.1f; + } + + switch (hasBuff) + { + case BuffID.Obstructed: + player.headcovered = false; + player.statDefense += 50; + player.allDamage += 0.5f; + modPlayer.AllCritBoost(25); + break; + case BuffID.Ichor: + player.statDefense += 40; + break; + case BuffID.Chilled: + player.chilled = false; + player.moveSpeed *= 1.3f; + break; + case BuffID.BrokenArmor: + 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; + break; + case BuffID.Slow: + player.slow = false; + player.moveSpeed *= 1.5f; + break; + case BuffID.Confused: + player.confused = false; + player.statDefense += 30; + player.allDamage += 0.25f; + modPlayer.AllCritBoost(10); + break; + case BuffID.Blackout: + player.blackout = false; + player.statDefense += 30; + player.allDamage += 0.25f; + modPlayer.AllCritBoost(10); + break; + case BuffID.Darkness: + player.blind = false; + player.statDefense += 15; + player.allDamage += 0.1f; + modPlayer.AllCritBoost(5); + break; + } + } + } + } + + // Draedon's Heart bonus + if (modPlayer.draedonsHeart) + { + player.allDamage += 0.05f; + if (player.StandingStill() && player.itemAnimation == 0) + player.statDefense += (int)(player.statDefense * 0.75); + } + + // Endurance reductions + EnduranceReductions(player, modPlayer); + + // Defense stat damage calcs + // This was not done to prevent facetanking, but to push players to not just stand completely fucking still taking 1 or 2 damage the entire time + if (modPlayer.defenseDamage > 0) + { + // Set recovery rate before everything else happens. + // This scales with current max player defense, so that it smoothly scales with smaller and larger defense values. + // This way, you won't be waiting a year to get defense back in early game, where it matters the most. + // This also avoids another issue, where late game players with high defense would regen their defense stat damage way too quickly. + int defenseDamageRecoveryRate = (int)MathHelper.Clamp(player.statDefense / modPlayer.defenseDamage, 1, 30); + + // Set current max player defense stat as the cap + if (modPlayer.defenseDamage > player.statDefense) + modPlayer.defenseDamage = player.statDefense; + + // Reduce player DR based on defense stat damage accumulated, this is done before defense is reduced + if (player.statDefense > 0 && player.endurance > 0f) + player.endurance -= player.endurance * (modPlayer.defenseDamage / (float)player.statDefense); + + // Reduce player defense based on defense stat damage accumulated + player.statDefense -= modPlayer.defenseDamage; + + // Checks all immunity frame timers + bool isImmune = false; + for (int i = 0; i < player.hurtCooldowns.Length; i++) + { + if (player.hurtCooldowns[i] > 0) + isImmune = true; + } + + // Reduce defense stat damage over time, but only if the player doesn't have any active immunity frames and if the recovery timer is 0 + if (!isImmune) + { + if (player.miscCounter % defenseDamageRecoveryRate == 0 && modPlayer.timeBeforeDefenseDamageRecovery == 0) + modPlayer.defenseDamage--; + + if (modPlayer.timeBeforeDefenseDamageRecovery > 0) + modPlayer.timeBeforeDefenseDamageRecovery--; + } + } + + // Prevent negative defense values + if (player.statDefense < 0) + player.statDefense = 0; + + // Multiplicative defense reductions + if (modPlayer.fabsolVodka) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.1); + } + + if (modPlayer.vodka) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.05); + } + + if (modPlayer.grapeBeer) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.03); + } + + if (modPlayer.rum) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.05); + } + + if (modPlayer.whiskey) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.05); + } + + if (modPlayer.everclear) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.3); + } + + if (modPlayer.bloodyMary) + { + if (Main.bloodMoon) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.04); + } + } + + if (modPlayer.caribbeanRum) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.1); + } + + if (modPlayer.cinnamonRoll) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.1); + } + + if (modPlayer.margarita) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.06); + } + + if (modPlayer.starBeamRye) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.06); + } + + if (modPlayer.whiteWine) + { + if (player.statDefense > 0) + player.statDefense -= (int)(player.statDefense * 0.06); + } + + // Intentionally at the end: Bloodflare Core's defense reduction (after all other boosting effects and whatnot) + // This defense still comes back over time if you take off Bloodflare Core while you're missing defense. + // However, removing the item means you won't get healed as the defense comes back. + ref int lostDef = ref modPlayer.bloodflareCoreLostDefense; + if (lostDef > 0) + { + // Defense regeneration occurs every four frames while defense is missing + if (player.miscCounter % 4 == 0) + { + --lostDef; + if (modPlayer.bloodflareCore) + { + 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 dustVel = offset * -0.08f; + Dust d = Dust.NewDustDirect(dustPos, 0, 0, 90, 0.08f, 0.08f); + d.velocity = dustVel; + d.noGravity = true; + } + } + } + + // Actually apply the defense reduction + player.statDefense -= lostDef; + } + + if (modPlayer.spectralVeilImmunity > 0) + { + int numDust = 2; + for (int i = 0; i < numDust; i++) + { + 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); + dust.velocity *= 0.2f; + dust.noGravity = true; + dust.noLight = true; + } + } } #endregion @@ -3825,17 +4043,7 @@ namespace CalamityMod.CalPlayer // 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)); - - // Very similar scaling to damage reduction. Ex. Frog Leg goes from 48% jump speed to 38% - //if (player.jumpSpeedBoost > 0f) - // player.jumpSpeedBoost = (1f - 1f / (1f + (player.jumpSpeedBoost / 10f))) * 10f - - if (modPlayer.yharonLore && !CalamityWorld.defiled) - { - if (player.wingTimeMax < 50000) - player.wingTimeMax = 50000; - } - + // Do not apply reduced aggro if there are any bosses alive and it's singleplayer if (CalamityPlayer.areThereAnyDamnBosses && Main.netMode == NetmodeID.SinglePlayer) { @@ -3849,25 +4057,13 @@ namespace CalamityMod.CalPlayer private static void EnduranceReductions(Player player, CalamityPlayer modPlayer) { if (modPlayer.vHex) - player.endurance -= 0.3f; + player.endurance -= 0.1f; + if (modPlayer.irradiated) - { - if (modPlayer.boomerDukeLore) - { - player.endurance += 0.05f; - } - else - { player.endurance -= 0.1f; - } - } + if (modPlayer.corrEffigy) - player.endurance -= 0.2f; - if (modPlayer.marked || modPlayer.reaperToothNecklace) - { - if (player.endurance > 0f) - player.endurance *= 0.5f; - } + player.endurance -= 0.05f; } #endregion @@ -3875,7 +4071,6 @@ namespace CalamityMod.CalPlayer private static void UpdateStatMeter(Player player, CalamityPlayer modPlayer) { float allDamageStat = player.allDamage - 1f; - modPlayer.actualMeleeDamageStat = player.meleeDamage + allDamageStat; modPlayer.damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f); modPlayer.damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f); @@ -3890,9 +4085,10 @@ namespace CalamityMod.CalPlayer (player.ammoBox ? 0.8f : 1f) * (player.ammoPotion ? 0.8f : 1f) * (player.ammoCost80 ? 0.8f : 1f) * - (player.ammoCost75 ? 0.75f : 1f)); + (player.ammoCost75 ? 0.75f : 1f) * + modPlayer.rangedAmmoCost); modPlayer.ammoReductionRogue = (int)(modPlayer.throwingAmmoCost * 100); - modPlayer.defenseStat = player.statDefense; + modPlayer.defenseStat = player.statDefense + modPlayer.defenseDamage; modPlayer.DRStat = (int)(player.endurance * 100f); modPlayer.meleeSpeedStat = (int)((1f - player.meleeSpeed) * (100f / player.meleeSpeed)); modPlayer.manaCostStat = (int)(player.manaCost * 100f); @@ -3913,18 +4109,15 @@ namespace CalamityMod.CalPlayer modPlayer.wingFlightTimeStat = player.wingTimeMax / 60f; float trueJumpSpeedBoost = player.jumpSpeedBoost + (player.wereWolf ? 0.2f : 0f) + - (player.jumpBoost ? 1.5f : 0f); + (player.jumpBoost ? 0.75f : 0f); modPlayer.jumpSpeedStat = trueJumpSpeedBoost * 20f; - modPlayer.adrenalineChargeStat = 45 - - (modPlayer.adrenalineBoostOne ? 10 : 0) - - (modPlayer.adrenalineBoostTwo ? 10 : 0) - + modPlayer.rageDamageStat = (int)(100D * modPlayer.RageDamageBoost); + modPlayer.adrenalineDamageStat = (int)(100D * modPlayer.GetAdrenalineDamage()); + int extraAdrenalineDR = 0 + + (modPlayer.adrenalineBoostOne ? 5 : 0) + + (modPlayer.adrenalineBoostTwo ? 5 : 0) + (modPlayer.adrenalineBoostThree ? 5 : 0); - bool DHorHoD = modPlayer.draedonsHeart || modPlayer.heartOfDarkness; - int rageDamageBoost = 0 + - (modPlayer.rageBoostOne ? 15 : 0) + - (modPlayer.rageBoostTwo ? 15 : 0) + - (modPlayer.rageBoostThree ? 15 : 0); - modPlayer.rageDamageStat = (DHorHoD ? 65 : 50) + rageDamageBoost; + modPlayer.adrenalineDRStat = 50 + extraAdrenalineDR; } #endregion @@ -3940,7 +4133,14 @@ namespace CalamityMod.CalPlayer Rectangle rect = npc.getRect(); if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { - if (Main.rand.NextBool(10) && player.immuneTime <= 0) + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + + if (Main.rand.NextBool(10) && !isImmune) { modPlayer.AbyssMirrorEvade(); modPlayer.EclipseMirrorEvade(); @@ -4018,8 +4218,8 @@ namespace CalamityMod.CalPlayer { Item item = player.inventory[i]; - if (player.potionDelay > 0 && modPlayer.potionTimer > 0) - continue; + if (player.potionDelay > 0 || modPlayer.potionTimer > 0) + break; if (item is null || item.stack <= 0) continue; diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs new file mode 100644 index 0000000000..add54032ae --- /dev/null +++ b/CalPlayer/CalamityPlayerNetcode.cs @@ -0,0 +1,322 @@ +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer +{ + public partial class CalamityPlayer : ModPlayer + { + #region Standard Syncs + internal const int GlobalSyncPacketTimer = 15; + + internal void StandardSync() + { + SyncRage(false); + SyncAdrenaline(false); + SyncDeathModeUnderworldTime(false); + SyncDeathModeBlizzardTime(false); + SyncMoveSpeed(false); + SyncDefenseDamage(false); + SyncDodgeCooldown(false); + } + + private void EnterWorldSync() + { + StandardSync(); + SyncExactLevel(false, 0); + SyncExactLevel(false, 1); + SyncExactLevel(false, 2); + SyncExactLevel(false, 3); + SyncExactLevel(false, 4); + SyncLevel(false, 0); + SyncLevel(false, 1); + SyncLevel(false, 2); + SyncLevel(false, 3); + SyncLevel(false, 4); + } + #endregion + + #region Creating and Sending Packets + private void SyncExactLevel(bool server, int levelType) + { + ModPacket packet = mod.GetPacket(); + switch (levelType) + { + case 0: + packet.Write((byte)CalamityModMessageType.ExactMeleeLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactMeleeLevel); + break; + case 1: + packet.Write((byte)CalamityModMessageType.ExactRangedLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactRangedLevel); + break; + case 2: + packet.Write((byte)CalamityModMessageType.ExactMagicLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactMagicLevel); + break; + case 3: + packet.Write((byte)CalamityModMessageType.ExactSummonLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactSummonLevel); + break; + case 4: + packet.Write((byte)CalamityModMessageType.ExactRogueLevelSync); + packet.Write(player.whoAmI); + packet.Write(exactRogueLevel); + break; + } + player.SendPacket(packet, server); + } + + private void SyncLevel(bool server, int levelType) + { + ModPacket packet = mod.GetPacket(256); + switch (levelType) + { + case 0: + packet.Write((byte)CalamityModMessageType.MeleeLevelSync); + packet.Write(player.whoAmI); + packet.Write(meleeLevel); + break; + case 1: + packet.Write((byte)CalamityModMessageType.RangedLevelSync); + packet.Write(player.whoAmI); + packet.Write(rangedLevel); + break; + case 2: + packet.Write((byte)CalamityModMessageType.MagicLevelSync); + packet.Write(player.whoAmI); + packet.Write(magicLevel); + break; + case 3: + packet.Write((byte)CalamityModMessageType.SummonLevelSync); + packet.Write(player.whoAmI); + packet.Write(summonLevel); + break; + case 4: + packet.Write((byte)CalamityModMessageType.RogueLevelSync); + packet.Write(player.whoAmI); + packet.Write(rogueLevel); + break; + } + player.SendPacket(packet, server); + } + + public void SyncMoveSpeed(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.MoveSpeedStatSync); + packet.Write(player.whoAmI); + packet.Write(moveSpeedStat); + player.SendPacket(packet, server); + } + + public void SyncDefenseDamage(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DefenseDamageSync); + packet.Write(player.whoAmI); + packet.Write(defenseDamage); + player.SendPacket(packet, server); + } + + public void SyncRage(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.RageSync); + packet.Write(player.whoAmI); + packet.Write(rage); + player.SendPacket(packet, server); + } + + public void SyncAdrenaline(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.AdrenalineSync); + packet.Write(player.whoAmI); + packet.Write(adrenaline); + player.SendPacket(packet, server); + } + + internal void SyncDodgeCooldown(bool server) + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.DodgeCooldown); + packet.Write(player.whoAmI); + packet.Write(dodgeCooldownTimer); + player.SendPacket(packet, server); + } + + private void SyncDeathCount(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathCountSync); + packet.Write(player.whoAmI); + packet.Write(deathCount); + player.SendPacket(packet, server); + } + + public void SyncDeathModeUnderworldTime(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathModeUnderworldTimeSync); + packet.Write(player.whoAmI); + packet.Write(deathModeUnderworldTime); + player.SendPacket(packet, server); + } + + public void SyncDeathModeBlizzardTime(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathModeBlizzardTimeSync); + packet.Write(player.whoAmI); + packet.Write(deathModeBlizzardTime); + player.SendPacket(packet, server); + } + + public void SyncItemTypeLastReforged(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.ItemTypeLastReforgedSync); + packet.Write(player.whoAmI); + packet.Write(itemTypeLastReforged); + player.SendPacket(packet, server); + } + + public void SyncReforgeTierSafety(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.ReforgeTierSafetySync); + packet.Write(player.whoAmI); + packet.Write(reforgeTierSafety); + player.SendPacket(packet, server); + } + #endregion + + #region Reading and Handling Packets + internal void HandleExactLevels(BinaryReader reader, int levelType) + { + switch (levelType) + { + case 0: + exactMeleeLevel = reader.ReadInt32(); + break; + case 1: + exactRangedLevel = reader.ReadInt32(); + break; + case 2: + exactMagicLevel = reader.ReadInt32(); + break; + case 3: + exactSummonLevel = reader.ReadInt32(); + break; + case 4: + exactRogueLevel = reader.ReadInt32(); + break; + } + + if (Main.netMode == NetmodeID.Server) + SyncExactLevel(true, levelType); + } + + internal void HandleLevels(BinaryReader reader, int levelType) + { + switch (levelType) + { + case 0: + meleeLevel = reader.ReadInt32(); + break; + case 1: + rangedLevel = reader.ReadInt32(); + break; + case 2: + magicLevel = reader.ReadInt32(); + break; + case 3: + summonLevel = reader.ReadInt32(); + break; + case 4: + rogueLevel = reader.ReadInt32(); + break; + } + + if (Main.netMode == NetmodeID.Server) + SyncLevel(true, levelType); + } + + internal void HandleRage(BinaryReader reader) + { + rage = reader.ReadSingle(); + if (Main.netMode == NetmodeID.Server) + SyncRage(true); + } + + internal void HandleAdrenaline(BinaryReader reader) + { + adrenaline = reader.ReadSingle(); + if (Main.netMode == NetmodeID.Server) + SyncAdrenaline(true); + } + + internal void HandleDeathCount(BinaryReader reader) + { + deathCount = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncDeathCount(true); + } + + internal void HandleDeathModeUnderworldTime(BinaryReader reader) + { + deathModeUnderworldTime = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncDeathModeUnderworldTime(true); + } + + internal void HandleDeathModeBlizzardTime(BinaryReader reader) + { + deathModeBlizzardTime = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncDeathModeBlizzardTime(true); + } + + internal void HandleItemTypeLastReforged(BinaryReader reader) + { + itemTypeLastReforged = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncItemTypeLastReforged(true); + } + + internal void HandleReforgeTierSafety(BinaryReader reader) + { + reforgeTierSafety = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncReforgeTierSafety(true); + } + + internal void HandleMoveSpeedStat(BinaryReader reader) + { + moveSpeedStat = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncMoveSpeed(true); + } + + internal void HandleDefenseDamage(BinaryReader reader) + { + defenseDamage = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncDefenseDamage(true); + } + + internal void HandleDodgeCooldown(BinaryReader reader) + { + dodgeCooldownTimer = reader.ReadInt32(); + if (Main.netMode == NetmodeID.Server) + SyncDodgeCooldown(true); + } + #endregion + } +} diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs new file mode 100644 index 0000000000..2862148680 --- /dev/null +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -0,0 +1,1378 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Armor; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Healing; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Items.Accessories; + +namespace CalamityMod.CalPlayer +{ + public class CalamityPlayerOnHit + { + #region Item + public static void ItemOnHit(Player player, Mod mod, Item item, int damage, Vector2 position, bool crit, bool npcCheck) + { + CalamityPlayer modPlayer = player.Calamity(); + + if (!item.melee && player.meleeEnchant == 7) + Projectile.NewProjectile(position, player.velocity, ProjectileID.ConfettiMelee, 0, 0f, player.whoAmI); + + if (modPlayer.reaverDefense) + player.lifeRegenTime += 1; + + if (modPlayer.desertProwler && crit && item.ranged) + { + if (player.ownedProjectileCounts[ProjectileType()] < 1 && player.ownedProjectileCounts[ProjectileType()] < 1) + { + if (Main.rand.NextBool(15)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(damage * player.RangedDamage(), 50), item.knockBack, player.whoAmI); + } + } + } + } + + if (npcCheck) + { + if (item.melee && modPlayer.aBulwarkRare && modPlayer.aBulwarkRareTimer == 0) + { + modPlayer.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); + } + if (modPlayer.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); + } + } + if (modPlayer.astralStarRain && crit && modPlayer.astralStarRainCooldown <= 0) + { + modPlayer.astralStarRainCooldown = 60; + for (int n = 0; n < 3; n++) + { + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ProjectileType(), + ProjectileID.HallowStar, + ProjectileType() + }); + 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; + } + } + } + + if (item.melee) + { + modPlayer.titanBoost = 600; + if (npcCheck) + { + if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) + { + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(damage * 0.15, 45), 2f, player.whoAmI, 0f, 0f); + } + if (modPlayer.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)); + + if (player.wingTime < player.wingTimeMax) + player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); + + if (player.wingTime > player.wingTimeMax) + player.wingTime = player.wingTimeMax; + } + if (modPlayer.bloodflareMelee && item.melee) + { + if (modPlayer.bloodflareMeleeHits < 15 && !modPlayer.bloodflareFrenzy && !modPlayer.bloodFrenzyCooldown) + { + modPlayer.bloodflareMeleeHits++; + } + } + } + } + } + #endregion + + #region Proj On Hit + public static void ProjOnHit(Player player, Mod mod, Projectile proj, Vector2 position, bool crit, bool npcCheck) + { + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = proj.Calamity(); + 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) + Projectile.NewProjectile(position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); + + if (modPlayer.alchFlask && player.ownedProjectileCounts[ProjectileType()] < 3 && hasClass) + { + 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 (modPlayer.theBee && player.statLife >= player.statLifeMax2) + Main.PlaySound(SoundID.Item110, proj.Center); + + if (modPlayer.reaverDefense) + player.lifeRegenTime += 1; + + if (npcCheck) + { + if (modPlayer.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); + } + } + + if (modPlayer.astralStarRain && crit && modPlayer.astralStarRainCooldown <= 0) + { + modPlayer.astralStarRainCooldown = 60; + for (int n = 0; n < 3; n++) + { + int projectileType = Utils.SelectRandom(Main.rand, new int[] + { + ProjectileType(), + ProjectileID.HallowStar, + ProjectileType() + }); + 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; + } + } + } + + if (proj.melee) + MeleeOnHit(player, modPlayer, mod, proj, modProj, position, crit, npcCheck); + if (proj.ranged) + RangedOnHit(player, modPlayer, mod, proj, modProj, position, crit, npcCheck); + if (proj.magic) + MagicOnHit(player, modPlayer, mod, proj, modProj, position, crit, npcCheck); + if (proj.IsSummon()) + SummonOnHit(player, modPlayer, mod, proj, modProj, position, crit, npcCheck); + if (modProj.rogue) + RogueOnHit(player, modPlayer, mod, proj, modProj, position, crit, npcCheck); + } + + #region Melee + private static void MeleeOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + { + Item heldItem = player.ActiveItem(); + + if (modProj.trueMelee) + { + modPlayer.titanBoost = 600; + if (modPlayer.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); + + if (player.wingTime < player.wingTimeMax) + player.wingTime += (int)(useTimeMultiplier * (wingTimeFraction + meleeStatMultiplier)); + + if (player.wingTime > player.wingTimeMax) + player.wingTime = player.wingTimeMax; + } + if (modPlayer.aBulwarkRare && modPlayer.aBulwarkRareTimer == 0) + { + modPlayer.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); + } + } + + if (npcCheck) + { + if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) + { + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.15, 35), 0f, player.whoAmI, 0f, 0f); + } + if (modPlayer.bloodflareMelee && modProj.trueMelee) + { + if (modPlayer.bloodflareMeleeHits < 15 && !modPlayer.bloodflareFrenzy && !modPlayer.bloodFrenzyCooldown) + { + modPlayer.bloodflareMeleeHits++; + } + } + } + } + #endregion + + #region Ranged + private static void RangedOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + { + if (modPlayer.desertProwler && crit) + { + if (player.ownedProjectileCounts[ProjectileType()] < 1 && player.ownedProjectileCounts[ProjectileType()] < 1) + { + if (Main.rand.NextBool(15)) + { + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * player.RangedDamage(), 50), proj.knockBack, player.whoAmI); + } + } + } + } + if (npcCheck) + { + if (modPlayer.tarraRanged && proj.ranged && modPlayer.tarraRangedCooldown <= 0) + { + modPlayer.tarraRangedCooldown = 60; + for (int l = 0; l < 2; l++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int FUCKYOU = Projectile.NewProjectile(position, velocity, ProjectileID.Leaf, CalamityUtils.DamageSoftCap(proj.damage * 0.25, 60), 0f, player.whoAmI); + if (FUCKYOU.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[FUCKYOU].Calamity().forceTypeless = true; + Main.projectile[FUCKYOU].netUpdate = true; + } + } + if (player.ownedProjectileCounts[ProjectileType()] < 2) + { + for (int projCount = 0; projCount < 2; projCount++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Projectile.NewProjectile(proj.Center, velocity, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.33, 65), 0f, proj.owner); + } + } + } + if (proj.type == ProjectileType()) + { + modPlayer.polarisBoostCounter += 1; + } + } + } + #endregion + + #region Magic + private static void MagicOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + { + if (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) + { + int projDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.625, 100); + CalamityGlobalProjectile.SpawnOrb(proj, projDamage, ProjectileType(), 800f, 20f); + int cooldown = (int)(projDamage * 0.5); + modPlayer.ataxiaDmg += cooldown; + } + if (modPlayer.tarraMage && crit) + { + modPlayer.tarraCrits++; + } + if (npcCheck) + { + if (modPlayer.bloodflareMage && modPlayer.bloodflareMageCooldown <= 0 && crit) + { + modPlayer.bloodflareMageCooldown = 120; + for (int i = 0; i < 3; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int fire = Projectile.NewProjectile(position, velocity, ProjectileID.BallofFire, CalamityUtils.DamageSoftCap(proj.damage * 0.5, 120), 0f, player.whoAmI); + if (fire.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[fire].Calamity().forceTypeless = true; + Main.projectile[fire].netUpdate = true; + } + } + } + } + if (modPlayer.silvaMage && modPlayer.silvaMageCooldown <= 0 && (proj.penetrate == 1 || proj.timeLeft <= 5)) + { + modPlayer.silvaMageCooldown = 300; + Main.PlaySound(SoundID.Zombie, (int)proj.position.X, (int)proj.position.Y, 103); + CalamityGlobalProjectile.ExpandHitboxBy(proj, 96); + for (int d = 0; d < 3; d++) + { + Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + } + for (int d = 0; d < 30; d++) + { + int explode = Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 2.5f); + Main.dust[explode].noGravity = true; + Main.dust[explode].velocity *= 3f; + explode = Dust.NewDust(proj.position, proj.width, proj.height, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); + Main.dust[explode].velocity *= 2f; + Main.dust[explode].noGravity = true; + } + proj.damage += CalamityUtils.DamageSoftCap(proj.damage * 2, 720); + proj.localNPCHitCooldown = 10; + proj.usesLocalNPCImmunity = true; + proj.Damage(); + proj.Kill(); + } + } + #endregion + + #region Summon + private static void SummonOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + { + if (npcCheck) + { + if (modPlayer.phantomicArtifact) + { + int restoreBuff = BuffType(); + int empowerBuff = BuffType(); + int shieldBuff = BuffType(); + int buffType = Utils.SelectRandom(Main.rand, new int[] + { + restoreBuff, + empowerBuff, + shieldBuff + }); + player.AddBuff(buffType, 60); + if (buffType == restoreBuff) + { + if (modPlayer.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); + } + } + else if (buffType == empowerBuff) + { + 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); + if (dagger.WithinBounds(Main.maxProjectiles)) + Main.projectile[dagger].Calamity().forceTypeless = true; + } + } + else + { + if (player.ownedProjectileCounts[ProjectileType()] == 0 && modPlayer.phantomicBulwarkCooldown == 0) + Projectile.NewProjectile(player.position, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 0f); + } + } + else if (modPlayer.hallowedRune) + { + int buffType = Utils.SelectRandom(Main.rand, new int[] + { + BuffType(), + BuffType(), + BuffType() + }); + player.AddBuff(buffType, 60); + } + else if (modPlayer.sGenerator) + { + int buffType = Utils.SelectRandom(Main.rand, new int[] + { + BuffType(), + BuffType(), + BuffType() + }); + player.AddBuff(buffType, 60); + } + } + + // Fearmonger set's colossal life regeneration + if (modPlayer.fearmongerSet) + { + modPlayer.fearmongerRegenFrames += 10; + if (modPlayer.fearmongerRegenFrames > 90) + modPlayer.fearmongerRegenFrames = 90; + } + + //Priorities: Nucleogenesis => Starbuster Core => Nuclear Rod => Jelly-Charged Battery + List summonExceptionList = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + if (summonExceptionList.TrueForAll(x => proj.type != x)) + { + if (modPlayer.jellyDmg <= 0) + { + if (modPlayer.nucleogenesis) + { + 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; + modPlayer.jellyDmg = 100f; + } + else if (modPlayer.starbusterCore) + { + 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; + modPlayer.jellyDmg = 60f; + } + else if (modPlayer.nuclearRod) + { + 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; + modPlayer.jellyDmg = 60f; + } + else if (modPlayer.jellyChargedBattery) + { + CalamityGlobalProjectile.SpawnOrb(proj, (int)(15 * player.MinionDamage()), ProjectileType(), 800f, 15f); + modPlayer.jellyDmg = 60f; + } + } + + if (modPlayer.hallowedPower) + { + if (modPlayer.hallowedRuneCooldown <= 0) + { + modPlayer.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); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + } + } + } + #endregion + + #region Rogue + private static void RogueOnHit(Player player, CalamityPlayer modPlayer, Mod mod, Projectile proj, CalamityGlobalProjectile modProj, Vector2 position, bool crit, bool npcCheck) + { + if (modProj.stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 1) + { + int projTileX = (int)(proj.Center.X / 16f); + int projTileY = (int)(proj.Center.Y / 16f); + int distance = 100; + if (projTileX < 10) + { + projTileX = 10; + } + if (projTileX > Main.maxTilesX - 10) + { + projTileX = Main.maxTilesX - 10; + } + if (projTileY < 10) + { + projTileY = 10; + } + if (projTileY > Main.maxTilesY - distance - 10) + { + projTileY = Main.maxTilesY - distance - 10; + } + for (int x = projTileX; x < projTileX + distance; x++) + { + Tile tile = Main.tile[projTileX, projTileY]; + if (tile.active() && (Main.tileSolid[tile.type] || tile.liquid != 0)) + { + projTileX = x; + break; + } + } + int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), (int)(400 * player.RogueDamage()), 15f, Main.myPlayer, 16f, 16f); + if (projectileIndex.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[projectileIndex].Calamity().forceTypeless = true; + Main.projectile[projectileIndex].netUpdate = true; + Main.projectile[projectileIndex].localNPCHitCooldown = 10; + } + } + if (modPlayer.tarraThrowing && !modPlayer.tarragonImmunity && !modPlayer.tarragonImmunityCooldown && modPlayer.tarraThrowingCrits < 25 && crit) + { + modPlayer.tarraThrowingCrits++; + } + if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) + { + switch (Main.rand.Next(5)) + { + case 0: + int projDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.8, 120); + CalamityGlobalProjectile.SpawnOrb(proj, projDamage, ProjectileType(), 800f, Main.rand.Next(15, 30)); + modPlayer.xerocDmg += (int)(projDamage * 0.5); + break; + + case 1: + int projDamage2 = CalamityUtils.DamageSoftCap(proj.damage * 0.625, 100); + CalamityGlobalProjectile.SpawnOrb(proj, projDamage2, ProjectileType(), 800f, 30f); + modPlayer.xerocDmg += (int)(projDamage2 * 0.5); + break; + + case 2: + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.15, 30), 0f, proj.owner, 0f, 0f); + break; + + case 3: + Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.2, 40), 0f, proj.owner, 0f, 0f); + break; + + case 4: + int projDamage3 = CalamityUtils.DamageSoftCap(proj.damage * 0.6, 90); + CalamityGlobalProjectile.SpawnOrb(proj, projDamage3, ProjectileType(), 800f, 15f); + modPlayer.xerocDmg += (int)(projDamage3 * 0.5); + break; + + default: + break; + } + } + + if (modPlayer.featherCrown && modProj.stealthStrike && modPlayer.featherCrownCooldown <= 0 && modProj.stealthStrikeHitCount < 5) + { + for (int i = 0; i < 3; i++) + { + Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + float speedX = (position.X - source.X) / 30f; + float speedY = (position.Y - source.Y) * 8; + Vector2 velocity = new Vector2(speedX, speedY); + int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), (int)(15 * player.RogueDamage()), 3f, proj.owner); + if (feather.WithinBounds(Main.maxProjectiles)) + Main.projectile[feather].Calamity().forceTypeless = true; + modPlayer.featherCrownCooldown = 15; + } + } + + if (modPlayer.moonCrown && modProj.stealthStrike && modPlayer.moonCrownCooldown <= 0 && modProj.stealthStrikeHitCount < 5) + { + int lunarFlareDamage = (int)(MoonstoneCrown.BaseDamage * player.RogueDamage()); + float lunarFlareKB = 3f; + for (int i = 0; i < 3; i++) + { + Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (position - source) / 10f; + int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, lunarFlareDamage, lunarFlareKB, proj.owner); + if (flare.WithinBounds(Main.maxProjectiles)) + Main.projectile[flare].Calamity().forceTypeless = true; + } + + modPlayer.moonCrownCooldown = 60; + } + + if (modPlayer.nanotech && modProj.stealthStrike && modPlayer.nanoFlareCooldown <= 0 && modProj.stealthStrikeHitCount < 5) + { + for (int i = 0; i < 3; i++) + { + 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); + modPlayer.nanoFlareCooldown = 60; + } + } + + if (modPlayer.forbiddenCirclet && modProj.stealthStrike && modPlayer.forbiddenCooldown <= 0 && modProj.stealthStrikeHitCount < 5) + { + for (int index2 = 0; index2 < 6; index2++) + { + float xVector = Main.rand.Next(-35, 36) * 0.02f; + 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); + if (eater.WithinBounds(Main.maxProjectiles)) + Main.projectile[eater].Calamity().forceTypeless = true; + modPlayer.forbiddenCooldown = 15; + } + } + + if (modPlayer.titanHeartSet && modProj.stealthStrike && modPlayer.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); + for (int dustexplode = 0; dustexplode < 360; dustexplode++) + { + Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); + int d = Dust.NewDust(proj.Center, proj.width, proj.height, Main.rand.NextBool(2) ? DustType() : DustType(), dustd.X, dustd.Y, 100, default, 1f); + Main.dust[d].noGravity = true; + Main.dust[d].position = proj.Center; + Main.dust[d].velocity *= 0.1f; + } + modPlayer.titanCooldown = 15; + } + + if (modPlayer.corrosiveSpine && modProj.stealthStrikeHitCount < 5) + { + for (int i = 0; i < 3; i++) + { + if (Main.rand.NextBool(2)) + { + int type = -1; + switch (Main.rand.Next(15)) + { + case 0: + type = ProjectileType(); + break; + case 1: + type = ProjectileType(); + break; + case 2: + type = ProjectileType(); + break; + } + // Should never happen, but just in case- + if (type != -1) + { + float speed = Main.rand.NextFloat(5f, 11f); + int cloud = Projectile.NewProjectile(position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, (int)(35 * player.RogueDamage()), proj.knockBack, player.whoAmI); + if (cloud.WithinBounds(Main.maxProjectiles)) + Main.projectile[cloud].Calamity().forceTypeless = true; + } + } + } + } + + if (modPlayer.shadow && modPlayer.shadowPotCooldown <= 0 && modProj.stealthStrikeHitCount < 5) + { + if (CalamityLists.javelinProjList.Contains(proj.type)) + { + int randrot = Main.rand.Next(-30, 391); + Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); + int soul = Projectile.NewProjectile(proj.Center, SoulSpeed, ProjectileType(), (int)(proj.damage * 0.1), 3f, proj.owner, 0f, 0f); + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].Calamity().forceTypeless = true; + modPlayer.shadowPotCooldown = 30; + } + if (CalamityLists.spikyBallProjList.Contains(proj.type)) + { + int scythe = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.05), 3f, proj.owner, 1f, 0f); + if (scythe.WithinBounds(Main.maxProjectiles)) + Main.projectile[scythe].Calamity().forceTypeless = true; + Main.projectile[scythe].usesLocalNPCImmunity = true; + Main.projectile[scythe].localNPCHitCooldown = 10; + Main.projectile[scythe].penetrate = 2; + modPlayer.shadowPotCooldown = 30; + } + if (CalamityLists.daggerProjList.Contains(proj.type)) + { + Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + shardVelocity.Normalize(); + shardVelocity *= 5f; + int shard = Projectile.NewProjectile(proj.Center, shardVelocity, ProjectileType(), (int)(proj.damage * 0.15), 0f, proj.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceTypeless = true; + Main.projectile[shard].timeLeft = 150; + modPlayer.shadowPotCooldown = 30; + } + if (CalamityLists.boomerangProjList.Contains(proj.type)) + { + int spiritDamage = (int)(proj.damage * 0.2); + Projectile ghost = CalamityGlobalProjectile.SpawnOrb(proj, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); + if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) + { + ghost.Calamity().forceTypeless = true; + ghost.penetrate = 1; + } + modPlayer.shadowPotCooldown = 30; + } + if (CalamityLists.flaskBombProjList.Contains(proj.type)) + { + int blackhole = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), (int)(proj.damage * 0.05), 3f, proj.owner, 0f, 0f); + if (blackhole.WithinBounds(Main.maxProjectiles)) + Main.projectile[blackhole].Calamity().forceTypeless = true; + Main.projectile[blackhole].Center = proj.Center; + modPlayer.shadowPotCooldown = 30; + } + } + + if (npcCheck) + { + if (modPlayer.umbraphileSet && (Main.rand.NextBool(4) || (modProj.stealthStrike && modProj.stealthStrikeHitCount < 5)) && proj.type != ProjectileType()) + { + int boom = Projectile.NewProjectile(proj.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(proj.damage * 0.25, 50), 0f, player.whoAmI); + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].Calamity().forceTypeless = true; + } + if (modPlayer.raiderTalisman && modPlayer.raiderStack < 150 && crit && modPlayer.raiderCooldown <= 0) + { + modPlayer.raiderStack++; + modPlayer.raiderCooldown = 30; + } + if (modPlayer.electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 5) + { + 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); + if (spark.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark].Calamity().forceTypeless = true; + Main.projectile[spark].localNPCHitCooldown = -1; + } + } + } + } + modProj.stealthStrikeHitCount++; + } + #endregion + #endregion + + #region Debuffs + public static void NPCDebuffs(Player player, Mod mod, NPC target, bool melee, bool ranged, bool magic, bool summon, bool rogue, bool proj) + { + CalamityPlayer modPlayer = player.Calamity(); + + if (melee) //prevents Deep Sea Dumbell from snagging true melee debuff memes + { + if (modPlayer.eGauntlet) + { + int duration = 90; + target.AddBuff(BuffID.CursedInferno, duration / 2, false); + target.AddBuff(BuffID.Frostburn, duration, false); + target.AddBuff(BuffID.Ichor, duration, false); + target.AddBuff(BuffID.Venom, duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + } + if (modPlayer.cryogenSoul || modPlayer.frostFlare) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn); + } + if (modPlayer.yInsignia) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + if (modPlayer.ataxiaFire) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire, 4f); + } + if (modPlayer.aWeapon) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + } + if (modPlayer.armorCrumbling || modPlayer.armorShattering) + { + if (melee || rogue) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + } + if (rogue) + { + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + case 4: + target.AddBuff(BuffID.Midas, 120, false); + break; + } + if (modPlayer.titanHeartMask) + { + target.AddBuff(BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds + } + if (modPlayer.corrosiveSpine) + { + target.AddBuff(BuffID.Venom, 240); + } + } + if (summon) + { + if (modPlayer.pArtifact && !modPlayer.profanedCrystal) + { + target.AddBuff(BuffType(), 300); + } + if (modPlayer.profanedCrystalBuffs) + { + target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 600); + } + if (modPlayer.divineBless) + { + target.AddBuff(BuffType(), 60); + } + + if (modPlayer.holyMinions) + { + target.AddBuff(BuffType(), 300); + } + + if (modPlayer.shadowMinions) + { + target.AddBuff(BuffID.ShadowFlame, 300); + } + + if (modPlayer.voltaicJelly) + { + //100% chance for Star Tainted Generator or Nucleogenesis + //20% chance for Voltaic Jelly + if (Main.rand.NextBool(modPlayer.starTaintedGenerator ? 1 : 5)) + { + target.AddBuff(BuffID.Electrified, 60); + } + } + + if (modPlayer.starTaintedGenerator) + { + target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 180); + } + } + if (modPlayer.omegaBlueChestplate) + target.AddBuff(BuffType(), 240); + if (modPlayer.sulfurSet) + target.AddBuff(BuffID.Poisoned, 120); + if (modPlayer.abyssalAmulet) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + if (modPlayer.dsSetBonus) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + if (modPlayer.alchFlask) + { + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); + } + if (modPlayer.holyWrath) + { + target.AddBuff(BuffType(), 600, false); + } + if (modPlayer.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()) + { + target.AddBuff(BuffID.CursedInferno, 90, false); + target.AddBuff(BuffID.Venom, 120, false); + } + } + } + + public static void PvpDebuffs(Player player, Mod mod, Player target, bool melee, bool ranged, bool magic, bool summon, bool rogue, bool proj) + { + CalamityPlayer modPlayer = player.Calamity(); + if (melee) + { + if (modPlayer.eGauntlet) + { + int duration = 90; + target.AddBuff(BuffID.CursedInferno, duration / 2, false); + target.AddBuff(BuffID.Frostburn, duration, false); + target.AddBuff(BuffID.Ichor, duration, false); + target.AddBuff(BuffID.Venom, duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + target.AddBuff(BuffType(), duration, false); + } + if (modPlayer.aWeapon) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + } + if (modPlayer.cryogenSoul || modPlayer.frostFlare) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffID.Frostburn); + } + if (modPlayer.yInsignia) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + } + if (modPlayer.ataxiaFire) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffID.OnFire, 4f); + } + } + if (modPlayer.armorCrumbling || modPlayer.armorShattering) + { + if (melee || rogue) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + } + } + if (rogue) + { + switch (player.meleeEnchant) + { + case 1: + target.AddBuff(BuffID.Venom, 60 * Main.rand.Next(5, 10), false); + break; + case 2: + target.AddBuff(BuffID.CursedInferno, 60 * Main.rand.Next(3, 7), false); + break; + case 3: + target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(3, 7), false); + break; + case 5: + target.AddBuff(BuffID.Ichor, 60 * Main.rand.Next(10, 20), false); + break; + case 6: + target.AddBuff(BuffID.Confused, 60 * Main.rand.Next(1, 4), false); + break; + case 8: + target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 10), false); + break; + } + if (modPlayer.titanHeartMask) + { + target.AddBuff(BuffType(), 60 * Main.rand.Next(1,6), false); // 1 to 5 seconds + } + if (modPlayer.corrosiveSpine) + { + target.AddBuff(BuffID.Venom, 240); + } + } + if (summon) + { + if (modPlayer.pArtifact && !modPlayer.profanedCrystal) + { + target.AddBuff(BuffType(), 300); + } + if (modPlayer.profanedCrystalBuffs) + { + target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 600); + } + + if (modPlayer.holyMinions) + { + target.AddBuff(BuffType(), 300); + } + + if (modPlayer.shadowMinions) + { + target.AddBuff(BuffID.ShadowFlame, 300); + } + + if (modPlayer.voltaicJelly) + { + //100% chance for Star Tainted Generator or Nucleogenesis + //20% chance for Voltaic Jelly + if (Main.rand.NextBool(modPlayer.starTaintedGenerator ? 1 : 5)) + { + target.AddBuff(BuffID.Electrified, 60); + } + } + + if (modPlayer.starTaintedGenerator) + { + target.AddBuff(BuffType(), 180); + target.AddBuff(BuffType(), 180); + } + } + if (modPlayer.omegaBlueChestplate) + target.AddBuff(BuffType(), 240); + if (modPlayer.sulfurSet) + target.AddBuff(BuffID.Poisoned, 120); + if (modPlayer.alchFlask) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + } + if (modPlayer.abyssalAmulet) + { + CalamityUtils.Inflict246DebuffsPvp(target, BuffType()); + } + if (modPlayer.holyWrath) + { + target.AddBuff(BuffType(), 600, false); + } + if (modPlayer.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()) + { + target.AddBuff(BuffID.CursedInferno, 90, false); + target.AddBuff(BuffID.Venom, 120, false); + } + } + } + #endregion + + #region Lifesteal + public static void ProjLifesteal(Player player, Mod mod, NPC target, Projectile proj, int damage, bool crit) + { + CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalProjectile modProj = proj.Calamity(); + + // Spectre Damage set and Nebula set work on enemies which are "immune to lifesteal" + if (!target.canGhostHeal) + { + if (player.ghostHurt) + { + proj.ghostHurt(damage, target.Center); + } + + if (player.setNebula && player.nebulaCD == 0 && Main.rand.NextBool(3)) + { + player.nebulaCD = 30; + int boosterType = Utils.SelectRandom(Main.rand, new int[] + { + ItemID.NebulaPickup1, + ItemID.NebulaPickup2, + ItemID.NebulaPickup3 + }); + int nebulaBooster = Item.NewItem(target.Center, target.Size, boosterType, 1, false, 0, false, false); + Main.item[nebulaBooster].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; + Main.item[nebulaBooster].velocity.X = Main.rand.Next(10, 31) * 0.2f * proj.direction; + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, nebulaBooster, 0f, 0f, 0f, 0, 0, 0); + } + } + } + + if (modPlayer.bloodflareSet && !target.SpawnedFromStatue && (target.damage > 0 || target.boss) && !player.moonLeech) + { + if ((target.life < target.lifeMax * 0.5) && modPlayer.bloodflareHeartTimer <= 0) + { + modPlayer.bloodflareHeartTimer = 300; + DropHelper.DropItem(target, ItemID.Heart); + } + } + + 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) + { + float cooldownMult = 0.2f; + cooldownMult -= proj.numHits * 0.05f; + if (cooldownMult < 0f) + cooldownMult = 0f; + + float cooldown = damage * cooldownMult; + Main.player[Main.myPlayer].lifeSteal -= cooldown; + } + + // Increases the degree to which Vampire Knives contribute to the lifesteal cap + if (proj.type == ProjectileID.VampireKnife) + { + float cooldown = damage * 0.075f; + if (cooldown < 0f) + cooldown = 0f; + + Main.player[Main.myPlayer].lifeSteal -= cooldown; + } + + if (modPlayer.vampiricTalisman && modProj.rogue && crit) + { + float heal = MathHelper.Clamp(damage * 0.015f, 0f, 6f); + if ((int)heal > 0) + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileID.VampireHeal, 1200f, 3f); + } + + if ((modPlayer.bloodyGlove || modPlayer.electricianGlove) && modProj.rogue && modProj.stealthStrike) + { + player.statLife += 1; + player.HealEffect(1); + } + + if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue) + { + if (modPlayer.bloodflareThrowing && modProj.rogue && crit && Main.rand.NextBool(2)) + { + float projHitMult = 0.03f; + projHitMult -= proj.numHits * 0.015f; + if (projHitMult < 0f) + projHitMult = 0f; + + float cooldownMult = damage * projHitMult; + if (cooldownMult < 0f) + cooldownMult = 0f; + + if (player.lifeSteal > 0f) + { + player.statLife += 1; + player.HealEffect(1); + player.lifeSteal -= cooldownMult * 2f; + } + } + + if (modPlayer.bloodflareMelee && modProj.trueMelee) + { + int healAmount = Main.rand.Next(2) + 1; + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + + bool otherHealTypes = modPlayer.auricSet || modPlayer.silvaSet || modPlayer.tarraMage || modPlayer.ataxiaMage; + + if (proj.magic && player.ActiveItem().magic) + { + if (modPlayer.manaOverloader && otherHealTypes) + { + if (Main.rand.NextBool(2)) + { + float healMult = 0.2f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult * (player.statMana / (float)player.statManaMax2); + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + } + } + + if (modPlayer.auricSet) + { + float healMult = 0.05f; + healMult -= proj.numHits * 0.025f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + else if (modPlayer.silvaSet) + { + float healMult = 0.03f; + healMult -= proj.numHits * 0.015f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + else if (proj.magic && player.ActiveItem().magic) + { + if (modPlayer.manaOverloader) + { + float healMult = 0.2f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult * (player.statMana / (float)player.statManaMax2); + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + + if (modPlayer.tarraMage) + { + if (modPlayer.tarraMageHealCooldown <= 0) + { + modPlayer.tarraMageHealCooldown = 90; + + float healMult = 0.1f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + Main.player[Main.myPlayer].lifeSteal -= heal * 6f; + + int healAmount = (int)heal; + player.statLife += healAmount; + player.HealEffect(healAmount); + + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + } + } + else if (modPlayer.ataxiaMage) + { + float healMult = 0.1f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + } + + if (modPlayer.reaverDefense) + { + float healMult = 0.2f; + healMult -= proj.numHits * 0.05f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + if (Main.rand.Next(10) > 0) + heal = 0; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + + if (modProj.rogue) + { + if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) + { + float healMult = 0.06f; + healMult -= proj.numHits * 0.015f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + if (!CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) + return; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, player, heal, ProjectileType(), 1200f, 3f); + } + } + } + } + + public static void ItemLifesteal(Player player, Mod mod, NPC target, Item item, int damage) + { + CalamityPlayer modPlayer = player.Calamity(); + + if (modPlayer.bloodflareSet && !target.SpawnedFromStatue && (target.damage > 0 || target.boss)) + { + if ((target.life < target.lifeMax * 0.5) && modPlayer.bloodflareHeartTimer <= 0) + { + modPlayer.bloodflareHeartTimer = 300; + DropHelper.DropItem(target, ItemID.Heart); + } + } + + if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue && target.canGhostHeal && !player.moonLeech) + { + if (modPlayer.bloodflareMelee && item.melee) + { + int healAmount = Main.rand.Next(2) + 1; + player.statLife += healAmount; + player.HealEffect(healAmount); + } + } + + if (modPlayer.reaverDefense) + { + if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && !player.moonLeech) + { + float healMult = 0.2f; + float heal = damage * healMult; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + if (Main.rand.Next(10) > 0) + heal = 0; + + if ((int)heal > 0 && !Main.player[Main.myPlayer].moonLeech) + { + Main.player[Main.myPlayer].lifeSteal -= heal * 3f; + + float lowestHealthCheck = 0f; + 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)) + { + float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); + if (playerDist < 1200f && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + { + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + healTarget = i; + } + } + } + + Projectile.NewProjectile(target.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, healTarget, heal); + } + } + } + } + #endregion + + #region The Horseman's Blade + public static void HorsemansBladeOnHit(Player player, int targetIdx, int damage, float knockback, int extraUpdateAmt = 0, int type = ProjectileID.FlamingJack) + { + int logicCheckScreenHeight = Main.LogicCheckScreenHeight; + int logicCheckScreenWidth = Main.LogicCheckScreenWidth; + int x = Main.rand.Next(100, 300); + int y = Main.rand.Next(100, 300); + switch (Main.rand.Next(4)) + { + case 0: + x -= logicCheckScreenWidth / 2 + x; + break; + case 1: + x += logicCheckScreenWidth / 2 - x; + break; + case 2: + y -= logicCheckScreenHeight / 2 + y; + break; + case 3: + y += logicCheckScreenHeight / 2 - y; + break; + default: + break; + } + x += (int)player.position.X; + y += (int)player.position.Y; + float speed = 8f; + Vector2 spawnPos = new Vector2(x, y); + Vector2 velocity = Main.npc[targetIdx].DirectionFrom(spawnPos); + velocity *= speed; + int projectile = Projectile.NewProjectile(spawnPos, velocity, type, damage, knockback, player.whoAmI, targetIdx, 0f); + Main.projectile[projectile].extraUpdates += extraUpdateAmt; + } + #endregion + } +} diff --git a/CalamityConfig.cs b/CalamityConfig.cs index ba3be07e85..b640141930 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -30,6 +30,12 @@ namespace CalamityMod [Tooltip("Enables rendering afterimages for Calamity NPCs, projectiles, etc.\nDisable to improve performance.")] public bool Afterimages { get; set; } + [Label("Disable Screenshakes")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + [Tooltip("Disables all screen-shaking effects.")] + public bool DisableScreenShakes { get; set; } + [Label("Stealth Invisibility")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -65,7 +71,7 @@ namespace CalamityMod [BackgroundColor(192, 54, 64, 192)] [Label("Lock Meter Positions")] [DefaultValue(true)] - [Tooltip("Prevents clicking on the Stealth, Rage and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.")] + [Tooltip("Prevents clicking on the Stealth, Charge, Rage, and Adrenaline Meters.\nThis stops them from being dragged around with the mouse.")] public bool MeterPosLock { get; set; } [Label("Stealth Meter")] @@ -90,8 +96,40 @@ namespace CalamityMod [Tooltip("The Y position of the Stealth Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")] public float StealthMeterPosY { get; set; } + [Label("Charge Meter")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("Enables the Charge Meter UI, which shows the charge level of the player's currently held Arsenal item.\nThe Charge Meter is always hidden if not holding a chargable arsenal item.")] + public bool ChargeMeter { get; set; } + + [Label("Charge Meter X Position")] + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 3840f)] + [DefaultValue(950f)] + [Tooltip("The X position of the Charge Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")] + public float ChargeMeterPosX { get; set; } + + [Label("Charge Meter Y Position")] + [BackgroundColor(192, 54, 64, 192)] + [SliderColor(224, 165, 56, 128)] + [Range(0f, 2160f)] + [DefaultValue(43f)] + [Tooltip("The Y position of the Charge Meter.\nThe meter can be dragged with the mouse if Lock Meter Positions is disabled.")] + public float ChargeMeterPosY { get; set; } + [Header("General Gameplay Changes")] + [Label("Early Hardmode Progression Rework")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + [Tooltip("Demon Altars no longer spawn ores and crimson/corruption blocks when broken.\n" + + "Wall of Flesh spawns Cobalt and Palladium ore on first kill.\n" + + "The first mech boss you fight has 20% less HP and damage and spawns Mythril and Orichalcum ore on first kill.\n" + + "The second mech boss you fight has 10% less HP and damage and spawns Adamantite and Titanium ore on first kill.\n" + + "The third mech boss spawns Hallowed Ore on first kill")] + public bool EarlyHardmodeProgressionRework { get; set; } + [Label("Lethal Lava")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -119,7 +157,7 @@ namespace CalamityMod [Label("Boss Zen")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] - [Tooltip("While a boss is alive, all players receive the Boss Zen buff which drastically reduces enemy spawn rates.")] + [Tooltip("While a boss is alive, all players near a boss receive the Boss Effects buff, which drastically reduces enemy spawn rates.")] public bool BossZen { get; set; } [Label("Never Weaken Reactive Boss DR")] @@ -128,6 +166,24 @@ namespace CalamityMod [Tooltip("Sets Reactive Boss DR to always be full strength, even if the boss has already been defeated.\nIf disabled, the effect is only 66% as powerful after the boss has been defeated.\n\nReactive Boss DR makes bosses smoothly take less damage if they are being killed very quickly.\nIn most cases, the system has no noticeable effect.")] public bool FullPowerReactiveBossDR { get; set; } + [Label("Let Town NPCs spawn at night.")] + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + [Tooltip("Allows you to determine if town NPCs (including the Old Man) can spawn at night.")] + public bool CanTownNPCsSpawnAtNight { get; set; } + + private const int MinTownNPCSpawnMultiplier = 1; + private const int MaxTownNPCSpawnMultiplier = 10; + + [Label("Town NPC Spawn Rate Multiplier")] + [BackgroundColor(192, 54, 64, 192)] + [Range(MinTownNPCSpawnMultiplier, MaxTownNPCSpawnMultiplier)] + [Increment(1)] + [DrawTicks] + [DefaultValue(MinTownNPCSpawnMultiplier)] + [Tooltip("Makes town NPCs spawn more quickly, the higher this value is.")] + public int TownNPCSpawnRateMultiplier { get; set; } + private const float MinBossHealthBoost = 0f; private const float MaxBossHealthBoost = 900f; @@ -169,12 +225,6 @@ namespace CalamityMod [Header("Revengeance Mode Changes")] - [Label("Buff Thorium Bosses")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("Buffs Thorium bosses if Revengeance Mode or Death Mode is active.\nThe buff gives them extra health and DR, but has no other changes.")] - public bool BuffThoriumBosses { get; set; } - [Label("Rage and Adrenaline")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -264,15 +314,9 @@ namespace CalamityMod [Label("Immunity Frame Curse")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] - [Tooltip("During the Boss Rush, being hit twice within five seconds will cause instant death.\nThis effect ignores revives.")] + [Tooltip("During the Boss Rush, being hit twice within three seconds will cause instant death.\nThis effect ignores revives.")] public bool BossRushImmunityFrameCurse { get; set; } - [Label("Xeroc Curse")] - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(false)] - [Tooltip("Permanently enrages every boss in the Boss Rush.\nThis enrage is equivalent to that provided by Demonshade armor.")] - public bool BossRushXerocCurse { get; set; } - public override bool AcceptClientChanges(ModConfig pendingConfig, int whoAmI, ref string message) => true; } } \ No newline at end of file diff --git a/CalamityLists.cs b/CalamityLists.cs new file mode 100644 index 0000000000..ead6599b37 --- /dev/null +++ b/CalamityLists.cs @@ -0,0 +1,2788 @@ +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Wings; +using CalamityMod.Items.Ammo.FiniteUse; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Fishing.AstralCatches; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Tools; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.LivingFire; +using System.Collections.Generic; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public class CalamityLists + { + public static IList donatorList; + public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D + public static List rangedProjectileExceptionList; + public static List projectileDestroyExceptionList; + public static List projectileMinionList; + public static List enemyImmunityList; + public static List confusionEnemyList; + public static List dungeonEnemyBuffList; + public static List dungeonProjectileBuffList; + public static List bossHPScaleList; + public static List beeEnemyList; + public static List beeProjectileList; + public static List friendlyBeeList; + public static List hardModeNerfList; + public static List debuffList; + public static List fireWeaponList; + public static List iceWeaponList; + public static List natureWeaponList; + public static List alcoholList; + public static List useTurnList; + public static List twentyUseTimeBuffList; //20% use time buff + public static List fiftySizeBuffList; //50% size buff + public static List quadrupleDamageBuffList; //300% buff + public static List tripleDamageBuffList; //200% buff + public static List doubleDamageBuffList; //100% buff + public static List sixtySixDamageBuffList; //66% buff + public static List fiftyDamageBuffList; //50% buff + public static List thirtyThreeDamageBuffList; //33% buff + public static List twentyFiveDamageBuffList; //25% buff + public static List twentyDamageBuffList; //20% buff + public static List tenDamageBuffList; //10% buff + public static List weaponAutoreuseList; + public static List spearAutoreuseList; + public static List tenDamageNerfList; //10% nerf + public static List quarterDamageNerfList; //25% nerf + public static List pumpkinMoonBuffList; + public static List frostMoonBuffList; + public static List eclipseBuffList; + public static List eventProjectileBuffList; + public static List revengeanceEnemyBuffList25Percent; + public static List revengeanceEnemyBuffList20Percent; + public static List revengeanceEnemyBuffList15Percent; + public static List revengeanceEnemyBuffList10Percent; + public static List revengeanceProjectileBuffList25Percent; + public static List revengeanceProjectileBuffList20Percent; + public static List revengeanceProjectileBuffList15Percent; + public static List revengeanceLifeStealExceptionList; + public static List noRageWormSegmentList; + public static List needsDebuffIconDisplayList; + public static List trapProjectileList; + public static List scopedWeaponList; + public static List boomerangList; + public static List javelinList; + public static List daggerList; + public static List flaskBombList; + public static List spikyBallList; + public static List boomerangProjList; + public static List javelinProjList; + public static List daggerProjList; + public static List flaskBombProjList; + public static List spikyBallProjList; + public static List noGravityList; + public static List lavaFishList; + public static List highTestFishList; + public static List flamethrowerList; + public static List forceItemList; + public static List livingFireBlockList; + + public static List zombieList; + public static List demonEyeList; + public static List skeletonList; + public static List angryBonesList; + public static List hornetList; + public static List mossHornetList; + public static List bossMinionList; + public static List minibossList; + public static List heartDropBlockList; + public static List pierceResistList; + + public static List legOverrideList; + + public static List kamiDebuffColorImmuneList; + + public static List MinionsToNotResurrectList; + public static List ZeroMinionSlotExceptionList; + public static List DontCopyOriginalMinionAIList; + + public static void LoadLists() + { + donatorList = new List() + { + "Vorbis", + "SoloMael", + "Chaotic Reks", + "The Buildmonger", + "Yuh", + "Littlepiggy", + "LompL", + "Lilith Saintclaire", + "Ben Shapiro", + "Frederik Henschel", + "Faye", + "Gibb50", + "Braden Hajer", + "Hannes Holmlund", + "profoundmango69", + "Jack M Sargent", + "Hans Volter", + "Krankwagon", + "MishiroUsui", + "pixlgray", + "Arkhine", + "Lodude", + "DevAesthetic", + "Mister Winchester", + "Zacky", + "Veine", + "Javyz", + "Shifter", + "Crysthamyr", + "Elfinlocks", + "Ein", + "2Larry2", + "Jenonen", + "Dodu", + "Arti", + "Tervastator", + "Luis Arguello", + "Alexander Davis", + "BakaQing", + "Laura Coonrod", + "Xaphlactus", + "MajinBagel", + "Bendy", + "Rando Calrissian", + "Tails the Fox 92", + "Bread", + "Minty Candy", + "Preston Card", + "MovingTarget_086", + "Shiro", + "Chip", + "Taylor Riverpaw", + "ShotgunAngel", + "Sandblast", + "ThomasThePencil", + "Aero (Aero#4599)", + "GlitchOut", + "Daawnz", + "CrabBar", + "Yatagarasu", + "Jarod Isaac Gordon", + "Zombieh", + "MingWhy", + "Random Weeb", + "Ahmed Fahad Zamel Al Sharif", + "Eragon3942", + "TheBlackHand", + "william", + "Samuel Foreman", + "Christopher Pham", + "DemoN K!ng", + "Malik Ciaramella", + "Ryan Baker-Ortiz", + "Aleksanders Denisovs", + "TheSilverGhost", + "Lucazii", + "Shay", + "Prism", + "BobIsNotMyRealName", + "Guwahavel", + "Azura", + "Joshua Miranda", + "Doveda", + "William Chang", + "Arche", + "DevilSunrise", + "Yanmei", + "Chaos", + "Ryan Tucker", + "Fish Repairs", + "Melvin Brouwers", + "Vroomy Has -3,000 IQ", + "The Goliath", + "DaPyRo", + "Takeru", + "Circuit-Jay", + "Commmander Frostbite", + "cytokat", + "Cameron Fowlks", + "Orudeon", + "BumbleDoge", + "John Ballard", + "Naglfar", + "Helixas", + "Vetus Dea", + "High Charity", + "Devonte Plati", + "Cerberus", + "Brendan Kendall", + "Victor Pittman", + "KAT-G307", + "Tombarry Expresserino", + "Drip Veezy", + "Glaid", + "Apotheosis", + "Bladesaber", + "Devon Leigh", + "Ruthoranium", + "cocodezi_", + "Mendzey", + "GameRDheAsianSandwich", + "Tobias", + "Streakist .", + "Eisaya A Cook", + "Xenocrona", + "RKMoon" + }; + + trueMeleeProjectileList = new List() + { + // Vanilla shit + ProjectileID.Spear, + ProjectileID.Trident, + ProjectileID.TheRottedFork, + ProjectileID.Swordfish, + ProjectileID.Arkhalis, + ProjectileID.DarkLance, + ProjectileID.CobaltNaginata, + ProjectileID.PalladiumPike, + ProjectileID.MythrilHalberd, + ProjectileID.OrichalcumHalberd, + ProjectileID.AdamantiteGlaive, + ProjectileID.TitaniumTrident, + ProjectileID.MushroomSpear, + ProjectileID.Gungnir, + ProjectileID.ObsidianSwordfish, + ProjectileID.MonkStaffT1, + ProjectileID.MonkStaffT2, + + // Tools + ProjectileID.CobaltDrill, + ProjectileID.MythrilDrill, + ProjectileID.AdamantiteDrill, + ProjectileID.PalladiumDrill, + ProjectileID.OrichalcumDrill, + ProjectileID.TitaniumDrill, + ProjectileID.ChlorophyteDrill, + ProjectileID.CobaltChainsaw, + ProjectileID.MythrilChainsaw, + ProjectileID.AdamantiteChainsaw, + ProjectileID.PalladiumChainsaw, + ProjectileID.OrichalcumChainsaw, + ProjectileID.TitaniumChainsaw, + ProjectileID.ChlorophyteChainsaw, + ProjectileID.VortexDrill, + ProjectileID.VortexChainsaw, + ProjectileID.NebulaDrill, + ProjectileID.NebulaChainsaw, + ProjectileID.SolarFlareDrill, + ProjectileID.SolarFlareChainsaw, + ProjectileID.StardustDrill, + ProjectileID.StardustChainsaw, + ProjectileID.Hamdrax, + ProjectileID.ChlorophyteJackhammer, + ProjectileID.SawtoothShark, + ProjectileID.ButchersChainsaw, + + // Calamity shit + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + rangedProjectileExceptionList = new List() + { + ProjectileID.Phantasm, + ProjectileID.VortexBeater, + ProjectileID.DD2PhoenixBow, + ProjectileID.IchorDart, + ProjectileID.PhantasmArrow, + ProjectileID.RainbowBack, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), // Because of potential dust lag. + ProjectileType() + }; + + projectileDestroyExceptionList = new List() + { + //holdout projectiles + ProjectileID.Phantasm, + ProjectileID.VortexBeater, + ProjectileID.DD2PhoenixBow, + ProjectileID.LastPrism, + ProjectileID.LastPrismLaser, + ProjectileID.LaserMachinegun, + ProjectileID.ChargedBlasterCannon, + ProjectileID.MedusaHead, + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + //Some hostile boss projectiles + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + projectileMinionList = new List() + { + ProjectileID.PygmySpear, + ProjectileID.UFOMinion, + ProjectileID.UFOLaser, + ProjectileID.StardustCellMinionShot, + ProjectileID.MiniSharkron, + ProjectileID.MiniRetinaLaser, + ProjectileID.ImpFireball, + ProjectileID.HornetStinger, + ProjectileID.DD2FlameBurstTowerT1Shot, + ProjectileID.DD2FlameBurstTowerT2Shot, + ProjectileID.DD2FlameBurstTowerT3Shot, + ProjectileID.DD2BallistraProj, + ProjectileID.DD2ExplosiveTrapT1Explosion, + ProjectileID.DD2ExplosiveTrapT2Explosion, + ProjectileID.DD2ExplosiveTrapT3Explosion, + ProjectileID.SpiderEgg, + ProjectileID.BabySpider, + ProjectileID.FrostBlastFriendly, + ProjectileID.MoonlordTurretLaser, + ProjectileID.RainbowCrystalExplosion + }; + + enemyImmunityList = new List() + { + NPCID.KingSlime, + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, + NPCID.Creeper, + NPCID.EyeofCthulhu, + NPCID.QueenBee, + NPCID.SkeletronHead, + NPCID.SkeletronHand, + NPCID.WallofFlesh, + NPCID.WallofFleshEye, + NPCID.PirateShipCannon, + NPCID.Probe, + NPCID.Retinazer, + NPCID.Spazmatism, + NPCID.SkeletronPrime, + NPCID.PrimeCannon, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.Plantera, + NPCID.PlanterasTentacle, + NPCID.Everscream, + NPCID.SantaNK1, + NPCID.IceQueen, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.Mothron, + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerTurret, + NPCID.DukeFishron, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.CultistBoss, + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCID.MoonLordCore, + NPCID.MoonLordFreeEye, + NPCID.DD2WyvernT1, + NPCID.DD2WyvernT2, + NPCID.DD2WyvernT3, + NPCID.DD2DarkMageT1, + NPCID.DD2DarkMageT3, + NPCID.DD2SkeletonT1, + NPCID.DD2SkeletonT3, + NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, + NPCID.DD2DrakinT2, + NPCID.DD2DrakinT3, + NPCID.DD2KoboldWalkerT2, + NPCID.DD2KoboldWalkerT3, + NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, + NPCID.DD2OgreT2, + NPCID.DD2OgreT3, + NPCID.DD2Betsy, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + confusionEnemyList = new List() + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + dungeonEnemyBuffList = new List() + { + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.SkeletonCommando, + NPCID.Paladin, + NPCID.GiantCursedSkull, + NPCID.BoneLee, + NPCID.DiabolistWhite, + NPCID.DiabolistRed, + NPCID.NecromancerArmored, + NPCID.Necromancer, + NPCID.RaggedCasterOpenCoat, + NPCID.RaggedCaster, + NPCID.HellArmoredBonesSword, + NPCID.HellArmoredBonesMace, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBones, + NPCID.BlueArmoredBonesSword, + NPCID.BlueArmoredBonesNoPants, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBones, + NPCID.RustyArmoredBonesSwordNoArmor, + NPCID.RustyArmoredBonesSword, + NPCID.RustyArmoredBonesFlail, + NPCID.RustyArmoredBonesAxe + }; + + dungeonProjectileBuffList = new List() + { + ProjectileID.PaladinsHammerHostile, + ProjectileID.ShadowBeamHostile, + ProjectileID.InfernoHostileBolt, + ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, + ProjectileID.SniperBullet, + ProjectileID.RocketSkeleton, + ProjectileID.BulletDeadeye, + ProjectileID.Shadowflames + }; + + bossHPScaleList = new List() + { + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.SkeletronHand, + NPCID.WallofFleshEye, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.MoonLordHead, + NPCID.MoonLordHand + }; + + beeEnemyList = new List() + { + NPCID.GiantMossHornet, + NPCID.BigMossHornet, + NPCID.LittleMossHornet, + NPCID.TinyMossHornet, + NPCID.MossHornet, + NPCID.VortexHornetQueen, + NPCID.VortexHornet, + NPCID.Bee, + NPCID.BeeSmall, + NPCID.QueenBee, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + beeProjectileList = new List() + { + ProjectileID.Stinger, + ProjectileID.HornetStinger, + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + friendlyBeeList = new List() + { + ProjectileID.GiantBee, + ProjectileID.Bee, + ProjectileID.Wasp, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + hardModeNerfList = new List() + { + ProjectileID.PinkLaser, + ProjectileID.FrostBlastHostile, + ProjectileID.GoldenShowerHostile, + ProjectileID.RainNimbus, + ProjectileID.FlamingArrow, + ProjectileID.BulletDeadeye, + ProjectileID.CannonballHostile, + ProjectileID.UnholyTridentHostile, + ProjectileID.FrostBeam, + ProjectileID.CursedFlameHostile, + ProjectileID.Stinger + }; + + debuffList = new List() + { + BuffID.Poisoned, + BuffID.Darkness, + BuffID.Cursed, + BuffID.OnFire, + BuffID.Bleeding, + BuffID.Confused, + BuffID.Slow, + BuffID.Weak, + BuffID.Silenced, + BuffID.BrokenArmor, + BuffID.CursedInferno, + BuffID.Frostburn, + BuffID.Chilled, + BuffID.Frozen, + BuffID.Burning, + BuffID.Suffocation, + BuffID.Ichor, + BuffID.Venom, + BuffID.Blackout, + BuffID.Electrified, + BuffID.Rabies, + BuffID.Webbed, + BuffID.Stoned, + BuffID.Dazed, + BuffID.VortexDebuff, + BuffID.WitheredArmor, + BuffID.WitheredWeapon, + BuffID.OgreSpit, + BuffID.BetsysCurse, + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + }; + + fireWeaponList = new List() + { + ItemID.FieryGreatsword, + ItemID.DD2SquireDemonSword, + ItemID.TheHorsemansBlade, + ItemID.Cascade, + ItemID.HelFire, + ItemID.Flamarang, + ItemID.MoltenFury, + ItemID.Sunfury, + ItemID.PhoenixBlaster, + ItemID.Flamelash, + ItemID.SolarEruption, + ItemID.DayBreak, + ItemID.HellwingBow, + ItemID.DD2PhoenixBow, + ItemID.DD2BetsyBow, + ItemID.FlareGun, + ItemID.Flamethrower, + ItemID.EldMelter, + ItemID.FlowerofFire, + ItemID.MeteorStaff, + ItemID.ApprenticeStaffT3, + ItemID.InfernoFork, + ItemID.HeatRay, + ItemID.BookofSkulls, + ItemID.ImpStaff, + ItemID.DD2FlameburstTowerT1Popper, + ItemID.DD2FlameburstTowerT2Popper, + ItemID.DD2FlameburstTowerT3Popper, + ItemID.MolotovCocktail, + ItemID.WandofSparking, + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + iceWeaponList = new List() + { + ItemID.IceBlade, + ItemID.IceSickle, + ItemID.Frostbrand, + ItemID.Amarok, + ItemID.NorthPole, + ItemID.IceBoomerang, + ItemID.IceBow, + ItemID.SnowmanCannon, + ItemID.SnowballCannon, + ItemID.IceRod, + ItemID.FlowerofFrost, + ItemID.FrostStaff, + ItemID.BlizzardStaff, + ItemID.StaffoftheFrostHydra, + ItemID.Snowball, + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + //Cryonic Bar set stuff, could potentially be removed + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + natureWeaponList = new List() + { + ItemID.BladeofGrass, + ItemID.ChlorophyteClaymore, + ItemID.ChlorophyteSaber, + ItemID.ChlorophytePartisan, + ItemID.ChlorophyteShotbow, + ItemID.Seedler, + ItemID.ChristmasTreeSword, + ItemID.TerraBlade, + ItemID.JungleYoyo, + ItemID.Yelets, + ItemID.MushroomSpear, + ItemID.ThornChakram, + ItemID.Bananarang, + ItemID.FlowerPow, + ItemID.BeesKnees, + ItemID.Toxikarp, + ItemID.Bladetongue, + ItemID.PoisonStaff, + ItemID.VenomStaff, + ItemID.StaffofEarth, + ItemID.BeeGun, + ItemID.LeafBlower, + ItemID.WaspGun, + ItemID.CrystalSerpent, + ItemID.Razorpine, + ItemID.HornetStaff, + ItemID.QueenSpiderStaff, + ItemID.SlimeStaff, + ItemID.PygmyStaff, + ItemID.RavenStaff, + ItemID.BatScepter, + ItemID.SpiderStaff, + ItemID.Beenade, + ItemID.FrostDaggerfish, + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + alcoholList = new List() + { + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + }; + + useTurnList = new List() + { + ItemID.WoodenSword, + ItemID.RichMahoganySword, + ItemID.BorealWoodSword, + ItemID.EbonwoodSword, + ItemID.ShadewoodSword, + ItemID.CopperBroadsword, + ItemID.IronBroadsword, + ItemID.LeadBroadsword, + ItemID.SilverBroadsword, + ItemID.TungstenBroadsword, + ItemID.PlatinumBroadsword, + ItemID.GoldBroadsword, + ItemID.CactusSword, + ItemID.ZombieArm, + ItemID.StylistKilLaKillScissorsIWish, + ItemID.DyeTradersScimitar, + ItemID.PurpleClubberfish, + ItemID.LightsBane, + ItemID.BloodButcherer, + ItemID.BluePhaseblade, + ItemID.RedPhaseblade, + ItemID.GreenPhaseblade, + ItemID.WhitePhaseblade, + ItemID.YellowPhaseblade, + ItemID.PurplePhaseblade, + ItemID.BladeofGrass, + ItemID.FieryGreatsword, + ItemID.NightsEdge, + ItemID.FalconBlade, + ItemID.BreakerBlade, + ItemID.SlapHand, + ItemID.TaxCollectorsStickOfDoom, + ItemID.Bladetongue, + ItemID.CobaltSword, + ItemID.PalladiumSword, + ItemID.MythrilSword, + ItemID.OrichalcumSword, + ItemID.AdamantiteSword, + ItemID.TitaniumSword, + ItemID.Excalibur, + ItemID.TrueExcalibur, + ItemID.TrueNightsEdge, + ItemID.TheHorsemansBlade, + ItemID.Keybrand, + ItemID.PsychoKnife, + ItemID.BeeKeeper, + ItemID.ChristmasTreeSword, + ItemID.BoneSword + }; + + twentyUseTimeBuffList = new List() + { + ItemID.CobaltSword, + ItemID.PalladiumSword, + ItemID.OrichalcumSword, + ItemID.AdamantiteSword, + ItemID.TitaniumSword, + ItemID.Excalibur, + ItemID.Bladetongue, + ItemID.Cutlass, + ItemID.TheHorsemansBlade, + ItemID.AdamantiteGlaive, + ItemID.ChlorophytePartisan, + ItemID.CobaltNaginata, + ItemID.Gungnir, + ItemID.MythrilHalberd, + ItemID.OrichalcumHalberd, + ItemID.PalladiumPike, + ItemID.TitaniumTrident, + ItemID.MushroomSpear, + ItemID.TaxCollectorsStickOfDoom + }; + + fiftySizeBuffList = new List() + { + ItemID.BreakerBlade, + ItemID.StylistKilLaKillScissorsIWish, + ItemID.NightsEdge, + ItemID.CobaltSword, + ItemID.MythrilSword, + ItemID.AdamantiteSword, + ItemID.PalladiumSword, + ItemID.OrichalcumSword, + ItemID.TitaniumSword, + ItemID.Excalibur, + ItemID.TheHorsemansBlade, + ItemID.Keybrand, + ItemID.SlapHand, + ItemID.PlatinumBroadsword, + ItemID.GoldBroadsword, + ItemID.LightsBane, + ItemID.FalconBlade, + ItemID.BeeKeeper, + ItemID.ZombieArm, + ItemID.BladeofGrass, + ItemID.Muramasa, + ItemID.FieryGreatsword, + ItemID.BluePhasesaber, + ItemID.RedPhasesaber, + ItemID.GreenPhasesaber, + ItemID.WhitePhasesaber, + ItemID.YellowPhasesaber, + ItemID.PurplePhasesaber, + ItemID.BluePhaseblade, + ItemID.RedPhaseblade, + ItemID.GreenPhaseblade, + ItemID.WhitePhaseblade, + ItemID.YellowPhaseblade, + ItemID.PurplePhaseblade, + ItemID.AntlionClaw, + ItemID.DyeTradersScimitar, + ItemID.BoneSword, + ItemID.TaxCollectorsStickOfDoom, + ItemID.PurpleClubberfish + }; + + quadrupleDamageBuffList = new List() + { + ItemID.PsychoKnife + }; + + tripleDamageBuffList = new List() + { + ItemID.SpectreStaff, + ItemID.KOCannon, + ItemID.NightsEdge, + ItemID.PalladiumPike + }; + + doubleDamageBuffList = new List() + { + ItemID.BallOHurt, + ItemID.TheMeatball, + ItemID.BlueMoon, + ItemID.Sunfury, + ItemID.FlowerPow, + ItemID.MonkStaffT2, + ItemID.ProximityMineLauncher, + ItemID.FireworksLauncher, + ItemID.ShadowbeamStaff, + ItemID.PlatinumShortsword, + ItemID.PlatinumBroadsword, + ItemID.GoldShortsword, + ItemID.GoldBroadsword, + ItemID.LightsBane, + ItemID.BeeKeeper, + ItemID.ZombieArm, + ItemID.Muramasa, + ItemID.Spear, + ItemID.Trident, + ItemID.WoodenBoomerang, + ItemID.EnchantedBoomerang, + ItemID.IceBoomerang, + ItemID.FruitcakeChakram, + ItemID.ThornChakram, + ItemID.Flamarang, + ItemID.Cutlass, + ItemID.BluePhaseblade, + ItemID.RedPhaseblade, + ItemID.GreenPhaseblade, + ItemID.WhitePhaseblade, + ItemID.YellowPhaseblade, + ItemID.PurplePhaseblade, + ItemID.RocketLauncher, + ItemID.GrenadeLauncher + }; + + sixtySixDamageBuffList = new List() + { + ItemID.PulseBow, + ItemID.TrueNightsEdge, + ItemID.MedusaHead, + ItemID.StaffofEarth, + ItemID.InfernoFork, + ItemID.Frostbrand, + ItemID.BloodButcherer + }; + + fiftyDamageBuffList = new List() + { + ItemID.IceBow, + ItemID.Marrow, + ItemID.EldMelter, + ItemID.Flamethrower, + ItemID.MoonlordTurretStaff, + ItemID.WaspGun, + ItemID.SolarEruption, + ItemID.DayBreak, + ItemID.LunarFlareBook, + ItemID.SilverShortsword, + ItemID.SilverBroadsword, + ItemID.TungstenShortsword, + ItemID.TungstenBroadsword, + ItemID.AntlionClaw, + ItemID.Katana, + ItemID.Seedler + }; + + thirtyThreeDamageBuffList = new List() + { + ItemID.WandofSparking, + ItemID.CrystalVileShard, + ItemID.SoulDrain, + ItemID.ClingerStaff, + ItemID.ChargedBlasterCannon, + ItemID.NettleBurst, + ItemID.VenomStaff, + ItemID.AmberStaff, + ItemID.VampireKnives, + ItemID.Cascade, + ItemID.TrueExcalibur, + ItemID.Meowmere, + ItemID.DyeTradersScimitar + }; + + twentyFiveDamageBuffList = new List() + { + ItemID.StakeLauncher, + ItemID.BookStaff, + ItemID.IronShortsword, + ItemID.IronBroadsword, + ItemID.LeadShortsword, + ItemID.LeadBroadsword, + ItemID.CandyCaneSword, + ItemID.BoneSword + }; + + twentyDamageBuffList = new List() + { + ItemID.ChainGuillotines, + ItemID.FlowerofFrost, + ItemID.PoisonStaff, + ItemID.TacticalShotgun + }; + + tenDamageBuffList = new List() + { + ItemID.WoodenArrow, + ItemID.FlamingArrow, + ItemID.UnholyArrow, + ItemID.JestersArrow, + ItemID.HellfireArrow, + ItemID.HolyArrow, + ItemID.CursedArrow, + ItemID.FrostburnArrow, + ItemID.ChlorophyteArrow, + ItemID.IchorArrow, + ItemID.VenomArrow, + ItemID.BoneArrow, + ItemID.EndlessQuiver, + ItemID.MoonlordArrow, + ItemID.DD2BetsyBow, + ItemID.BorealWoodBow, + ItemID.CopperBow, + ItemID.DemonBow, + ItemID.EbonwoodBow, + ItemID.GoldBow, + ItemID.HellwingBow, + ItemID.IronBow, + ItemID.LeadBow, + ItemID.MoltenFury, + ItemID.PalmWoodBow, + ItemID.PearlwoodBow, + ItemID.DD2PhoenixBow, + ItemID.PlatinumBow, + ItemID.RichMahoganyBow, + ItemID.ShadewoodBow, + ItemID.ShadowFlameBow, + ItemID.SilverBow, + ItemID.TendonBow, + ItemID.BeesKnees, + ItemID.TinBow, + ItemID.Tsunami, + ItemID.TungstenBow, + ItemID.WoodenBow, + ItemID.AdamantiteRepeater, + ItemID.ChlorophyteShotbow, + ItemID.CobaltRepeater, + ItemID.HallowedRepeater, + ItemID.MythrilRepeater, + ItemID.OrichalcumRepeater, + ItemID.PalladiumRepeater, + ItemID.TitaniumRepeater, + ItemID.MagnetSphere, + ItemID.BatScepter, + ItemID.ElectrosphereLauncher + }; + + weaponAutoreuseList = new List() + { + ItemID.WoodenSword, + ItemID.RichMahoganySword, + ItemID.BorealWoodSword, + ItemID.EbonwoodSword, + ItemID.ShadewoodSword, + ItemID.CopperShortsword, + ItemID.CopperBroadsword, + ItemID.IronShortsword, + ItemID.IronBroadsword, + ItemID.LeadShortsword, + ItemID.LeadBroadsword, + ItemID.SilverShortsword, + ItemID.SilverBroadsword, + ItemID.TungstenShortsword, + ItemID.TungstenBroadsword, + ItemID.PlatinumShortsword, + ItemID.PlatinumBroadsword, + ItemID.GoldShortsword, + ItemID.GoldBroadsword, + ItemID.CactusSword, + ItemID.ZombieArm, + ItemID.CandyCaneSword, + ItemID.BoneSword, + ItemID.LightsBane, + ItemID.BloodButcherer, + ItemID.DyeTradersScimitar, + ItemID.FieryGreatsword, + ItemID.NightsEdge, + ItemID.TrueNightsEdge, + ItemID.TrueExcalibur, + ItemID.BreakerBlade, + ItemID.PhoenixBlaster, + ItemID.VenusMagnum, + ItemID.MagicDagger, + ItemID.BeamSword, + ItemID.PaladinsHammer, + ItemID.PearlwoodSword, + ItemID.PearlwoodBow, + ItemID.TaxCollectorsStickOfDoom, + ItemID.StylistKilLaKillScissorsIWish, + ItemID.AdamantiteGlaive, + ItemID.ChlorophytePartisan, + ItemID.CobaltNaginata, + ItemID.DarkLance, + ItemID.MonkStaffT2, + ItemID.Gungnir, + ItemID.MushroomSpear, + ItemID.MythrilHalberd, + ItemID.NorthPole, + ItemID.ObsidianSwordfish, + ItemID.OrichalcumHalberd, + ItemID.PalladiumPike, + ItemID.Spear, + ItemID.Swordfish, + ItemID.TheRottedFork, + ItemID.TitaniumTrident, + ItemID.Trident, + ItemID.BluePhaseblade, + ItemID.RedPhaseblade, + ItemID.GreenPhaseblade, + ItemID.WhitePhaseblade, + ItemID.YellowPhaseblade, + ItemID.PurplePhaseblade, + ItemID.BladeofGrass, + ItemID.ChristmasTreeSword, + ItemID.ChainKnife + //ItemID.StormSpear + }; + + spearAutoreuseList = new List() + { + ItemID.AdamantiteGlaive, + ItemID.ChlorophytePartisan, + ItemID.CobaltNaginata, + ItemID.DarkLance, + ItemID.MonkStaffT2, + ItemID.Gungnir, + ItemID.MushroomSpear, + ItemID.MythrilHalberd, + ItemID.NorthPole, + ItemID.ObsidianSwordfish, + ItemID.OrichalcumHalberd, + ItemID.PalladiumPike, + ItemID.Spear, + ItemID.Swordfish, + ItemID.TheRottedFork, + ItemID.TitaniumTrident, + ItemID.Trident + //ItemID.StormSpear + }; + + tenDamageNerfList = new List() + { + ItemID.DaedalusStormbow, + ItemID.StarWrath + }; + + quarterDamageNerfList = new List() + { + ItemID.LastPrism, + ItemID.DemonScythe, + ItemID.Razorpine, + ItemID.PhoenixBlaster, + ItemID.InfluxWaver, + ItemID.Xenopopper, + ItemID.OpticStaff, //Note: got local i frames so it should be better + ItemID.RocketIII, + ItemID.RocketIV + }; + + pumpkinMoonBuffList = new List() + { + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.HeadlessHorseman, + NPCID.MourningWood, + NPCID.Splinterling, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.Hellhound, + NPCID.Poltergeist + }; + + frostMoonBuffList = new List() + { + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.PresentMimic, + NPCID.GingerbreadMan, + NPCID.Yeti, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.ElfCopter, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.ElfArcher, + NPCID.Krampus, + NPCID.Flocko + }; + + eclipseBuffList = new List() + { + NPCID.Eyezor, + NPCID.Reaper, + NPCID.Frankenstein, + NPCID.SwampThing, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.Fritz, + NPCID.Nailhead, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.DrManFly, + NPCID.ThePossessed, + NPCID.Mothron, + NPCID.MothronEgg, + NPCID.MothronSpawn + }; + + eventProjectileBuffList = new List() + { + ProjectileID.FlamingWood, + ProjectileID.GreekFire1, + ProjectileID.GreekFire2, + ProjectileID.GreekFire3, + ProjectileID.FlamingScythe, + ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, + ProjectileID.OrnamentHostile, + ProjectileID.OrnamentHostileShrapnel, + ProjectileID.FrostWave, + ProjectileID.FrostShard, + ProjectileID.Missile, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.BulletDeadeye, + ProjectileID.EyeLaser, + ProjectileID.Nail, + ProjectileID.DrManFlyFlask + }; + + // Enemies that inflict an average of 1 to 50 damage in Expert Mode + revengeanceEnemyBuffList25Percent = new List() + { + NPCID.GiantWormHead, + NPCID.BlazingWheel, + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + // Enemies that inflict an average of 51 to 100 damage in Expert Mode + revengeanceEnemyBuffList20Percent = new List() + { + NPCID.DevourerHead, + NPCID.MeteorHead, + NPCID.BoneSerpentHead, + NPCID.ManEater, + NPCID.Snatcher, + NPCID.Piranha, + NPCID.Shark, + NPCID.SpikeBall, + NPCID.DiggerHead, + NPCID.WallCreeper, + NPCID.WallCreeperWall, + NPCID.Lihzahrd, + NPCID.Pumpking, + NPCID.SlimeSpiked, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + // Enemies that inflict an average of 101 to 200 damage in Expert Mode + revengeanceEnemyBuffList15Percent = new List() + { + NPCID.DD2Betsy, + NPCID.Mimic, + NPCID.WyvernHead, + NPCID.SeekerHead, + NPCID.AnglerFish, + NPCID.Werewolf, + NPCID.Wraith, + NPCID.Arapaima, + NPCID.BlackRecluse, + NPCID.BlackRecluseWall, + NPCID.AngryTrapper, + NPCID.LihzahrdCrawler, + NPCID.PirateCaptain, + NPCID.FlyingSnake, + NPCID.Reaper, + NPCID.Paladin, + NPCID.BoneLee, + NPCID.MourningWood, + NPCID.PumpkingBlade, + NPCID.PresentMimic, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.StardustWormHead, + NPCID.Butcher, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.BigMimicCorruption, + NPCID.BigMimicCrimson, + NPCID.BigMimicHallow, + NPCID.Mothron, + NPCID.DuneSplicerHead, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + // Enemies that inflict an average of 201 to 400 damage in Expert Mode + revengeanceEnemyBuffList10Percent = new List() + { + NPCID.SolarCrawltipedeHead, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + revengeanceProjectileBuffList25Percent = new List() + { + ProjectileID.SandBallFalling, + ProjectileID.AshBallFalling, + ProjectileID.EbonsandBallFalling, + ProjectileID.PearlSandBallFalling, + ProjectileID.CrimsandBallFalling, + ProjectileID.GeyserTrap + }; + + revengeanceProjectileBuffList20Percent = new List() + { + ProjectileID.PoisonDartTrap, + ProjectileID.DemonSickle, + ProjectileID.SandnadoHostile, + ProjectileID.DD2BetsyFireball, + ProjectileID.DD2BetsyFlameBreath + }; + + revengeanceProjectileBuffList15Percent = new List() + { + ProjectileID.SpikyBallTrap, + ProjectileID.SpearTrap, + ProjectileID.FlamethrowerTrap, + ProjectileID.FlamesTrap, + ProjectileID.PaladinsHammerHostile, + ProjectileID.FlamingWood, + ProjectileID.FlamingScythe, + ProjectileID.FrostWave, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.SaucerDeathray, + ProjectileID.NebulaBolt, + ProjectileID.NebulaSphere, + ProjectileID.NebulaLaser, + ProjectileID.StardustSoldierLaser, + ProjectileID.VortexLaser, + ProjectileID.VortexVortexLightning, + ProjectileID.VortexLightning, + ProjectileID.VortexAcid, + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + revengeanceLifeStealExceptionList = new List() + { + NPCID.Probe, + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.AncientLight, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.PlanterasTentacle, + NPCID.Spore, + NPCID.TheHungryII, + NPCID.LeechHead, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.MoonLordCore + }; + + noRageWormSegmentList = new List() + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + needsDebuffIconDisplayList = new List() + { + NPCID.WallofFleshEye + }; + + trapProjectileList = new List() + { + ProjectileID.PoisonDartTrap, + ProjectileID.SpikyBallTrap, + ProjectileID.SpearTrap, + ProjectileID.FlamethrowerTrap, + ProjectileID.FlamesTrap, + ProjectileID.PoisonDart, + ProjectileID.GeyserTrap + }; + + scopedWeaponList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + boomerangList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + boomerangProjList = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + javelinList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + javelinProjList = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + daggerList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + daggerProjList = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + flaskBombList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + flaskBombProjList = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + spikyBallList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + }; + + spikyBallProjList = new List() + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + noGravityList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + }; + + lavaFishList = new List() + { + ItemType(), + ItemType(), + ItemType() + }; + + highTestFishList = new List() + { + ItemID.GoldenFishingRod, + ItemType(), + ItemType() + }; + + flamethrowerList = new List() + { + ItemType(), + ItemType() + }; + + forceItemList = new List() + { + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemID.HotlineFishingHook, + ItemID.BottomlessBucket, + ItemID.SuperAbsorbantSponge, + ItemID.FishingPotion, + ItemID.SonarPotion, + ItemID.CratePotion, + ItemID.AnglerTackleBag, + ItemID.HighTestFishingLine, + ItemID.TackleBox, + ItemID.AnglerEarring, + ItemID.FishermansGuide, + ItemID.WeatherRadio, + ItemID.Sextant, + ItemID.AnglerHat, + ItemID.AnglerVest, + ItemID.AnglerPants, + ItemID.GoldenBugNet, + ItemID.FishronWings, + ItemID.Flairon, + ItemID.Tsunami, + ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, + ItemID.FishronBossBag, + ItemID.Coral, + ItemID.Seashell, + ItemID.Starfish, + ItemID.SoulofSight, + ItemID.GreaterHealingPotion, + ItemID.SuperHealingPotion + }; + + livingFireBlockList = new List() + { + TileType(), + TileType(), + TileType(), + TileID.LivingFire, + TileID.LivingCursedFire, + TileID.LivingDemonFire, + TileID.LivingFrostFire, + TileID.LivingIchor, + TileID.LivingUltrabrightFire + }; + + zombieList = new List() + { + NPCID.Zombie, + NPCID.ArmedZombie, + NPCID.BaldZombie, + NPCID.PincushionZombie, + NPCID.ArmedZombiePincussion, // what is this spelling + NPCID.SlimedZombie, + NPCID.ArmedZombieSlimed, + NPCID.SwampZombie, + NPCID.ArmedZombieSwamp, + NPCID.TwiggyZombie, + NPCID.ArmedZombieTwiggy, + NPCID.FemaleZombie, + NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, + NPCID.ZombieEskimo, + NPCID.ArmedZombieEskimo, + NPCID.BigRainZombie, + NPCID.SmallRainZombie, + NPCID.BigFemaleZombie, + NPCID.SmallFemaleZombie, + NPCID.BigTwiggyZombie, + NPCID.SmallTwiggyZombie, + NPCID.BigSwampZombie, + NPCID.SmallSwampZombie, + NPCID.BigSlimedZombie, + NPCID.SmallSlimedZombie, + NPCID.BigPincushionZombie, + NPCID.SmallPincushionZombie, + NPCID.BigBaldZombie, + NPCID.SmallBaldZombie, + NPCID.BigZombie, + NPCID.SmallZombie + // halloween zombies not included because they don't drop shackles or zombie arms + }; + + demonEyeList = new List() + { + NPCID.DemonEye, + NPCID.CataractEye, + NPCID.SleepyEye, + NPCID.DialatedEye, // it is spelled "dilated" + NPCID.GreenEye, + NPCID.PurpleEye, + NPCID.DemonEyeOwl, + NPCID.DemonEyeSpaceship, + NPCID.DemonEye2, + NPCID.PurpleEye2, + NPCID.GreenEye2, + NPCID.DialatedEye2, + NPCID.SleepyEye2, + NPCID.CataractEye2 + }; + + skeletonList = new List() + { + NPCID.Skeleton, + NPCID.HeadacheSkeleton, + NPCID.MisassembledSkeleton, + NPCID.PantlessSkeleton, + NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, + NPCID.BoneThrowingSkeleton4, + NPCID.BigPantlessSkeleton, + NPCID.SmallPantlessSkeleton, + NPCID.BigMisassembledSkeleton, + NPCID.SmallMisassembledSkeleton, + NPCID.BigHeadacheSkeleton, + NPCID.SmallHeadacheSkeleton, + NPCID.BigSkeleton, + NPCID.SmallSkeleton, + + //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason + NPCID.SkeletonTopHat, + NPCID.SkeletonAstonaut, + NPCID.SkeletonAlien, + + //Other skeleton types + NPCID.ArmoredSkeleton, + NPCID.HeavySkeleton, + NPCID.SkeletonArcher, + NPCID.GreekSkeleton + }; + + angryBonesList = new List() + { + NPCID.AngryBones, + NPCID.AngryBonesBig, + NPCID.AngryBonesBigMuscle, + NPCID.AngryBonesBigHelmet, + NPCID.BigBoned, + NPCID.ShortBones + }; + + hornetList = new List() + { + NPCID.BigHornetStingy, + NPCID.LittleHornetStingy, + NPCID.BigHornetSpikey, + NPCID.LittleHornetSpikey, + NPCID.BigHornetLeafy, + NPCID.LittleHornetLeafy, + NPCID.BigHornetHoney, + NPCID.LittleHornetHoney, + NPCID.BigHornetFatty, + NPCID.LittleHornetFatty, + NPCID.BigStinger, + NPCID.LittleStinger, + NPCID.Hornet, + NPCID.HornetFatty, + NPCID.HornetHoney, + NPCID.HornetLeafy, + NPCID.HornetSpikey, + NPCID.HornetStingy + }; + + mossHornetList = new List() + { + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.LittleMossHornet, + NPCID.BigMossHornet, + NPCID.GiantMossHornet + }; + + minibossList = new List() + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.Pumpking, + NPCID.MourningWood, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.Everscream, + NPCID.DD2Betsy, + NPCID.Mothron + }; + + heartDropBlockList = new List() + { + NPCID.BlueSlime, + NPCID.YellowSlime, + NPCID.RedSlime, + NPCID.PurpleSlime, + NPCID.GreenSlime, + NPCID.IceSlime, + NPCID.SlimeSpiked, + NPCID.UmbrellaSlime, + NPCID.RainbowSlime, + NPCID.Pinky, + NPCID.ServantofCthulhu, + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCID.TheHungryII, + NPCID.LeechHead, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.Probe, + NPCID.Bee, + NPCID.BeeSmall, + NPCID.PlanterasTentacle, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.DevourerHead, + NPCID.EaterofSouls, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + pierceResistList = new List() + { + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + bossMinionList = new List() + { + NPCType(), + NPCType(), + NPCType(), + NPCID.SlimeSpiked, + NPCID.ServantofCthulhu, + NPCType(), + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.SkeletronHand, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.LeechHead, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.WallofFleshEye, + NPCID.TheHungry, + NPCID.TheHungryII, + NPCType(), + NPCType(), + NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice, + NPCType(), + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.PlanterasTentacle, + NPCType(), + NPCID.Spore, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordFreeEye, + NPCID.MoonLordHand, + NPCID.MoonLordHead, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + legOverrideList = new List() + { + CalamityMod.Instance.GetEquipSlot("ProviLegs", EquipType.Legs), + CalamityMod.Instance.GetEquipSlot("SirenLegAlt", EquipType.Legs), + CalamityMod.Instance.GetEquipSlot("SirenLeg", EquipType.Legs), + CalamityMod.Instance.GetEquipSlot("PopoLeg", EquipType.Legs) + }; + + // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. + // This is a list so that other NPCs can be added as necessary. + // IT DOES NOT make them immune to the debuff, just stops them from being recolored. + kamiDebuffColorImmuneList = new List() + { + NPCID.DukeFishron, + NPCType() + }; + + MinionsToNotResurrectList = new List() + { + ProjectileID.StardustDragon1, + ProjectileID.StardustDragon2, + ProjectileID.StardustDragon3, + ProjectileID.StardustDragon4, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + ZeroMinionSlotExceptionList = new List() + { + ProjectileID.StardustDragon1, + ProjectileType(), + ProjectileType() + }; + + DontCopyOriginalMinionAIList = new List() + { + ProjectileType() + }; + } + + public static void UnloadLists() + { + donatorList = null; + trueMeleeProjectileList = null; + rangedProjectileExceptionList = null; + projectileDestroyExceptionList = null; + projectileMinionList = null; + enemyImmunityList = null; + confusionEnemyList = null; + dungeonEnemyBuffList = null; + dungeonProjectileBuffList = null; + bossHPScaleList = null; + beeEnemyList = null; + friendlyBeeList = null; + beeProjectileList = null; + hardModeNerfList = null; + debuffList = null; + fireWeaponList = null; + iceWeaponList = null; + natureWeaponList = null; + alcoholList = null; + useTurnList = null; + twentyUseTimeBuffList = null; + fiftySizeBuffList = null; + quadrupleDamageBuffList = null; + tripleDamageBuffList = null; + doubleDamageBuffList = null; + sixtySixDamageBuffList = null; + fiftyDamageBuffList = null; + thirtyThreeDamageBuffList = null; + twentyFiveDamageBuffList = null; + twentyDamageBuffList = null; + tenDamageBuffList = null; + weaponAutoreuseList = null; + spearAutoreuseList = null; + tenDamageNerfList = null; + quarterDamageNerfList = null; + pumpkinMoonBuffList = null; + frostMoonBuffList = null; + eclipseBuffList = null; + eventProjectileBuffList = null; + revengeanceEnemyBuffList25Percent = null; + revengeanceEnemyBuffList20Percent = null; + revengeanceEnemyBuffList15Percent = null; + revengeanceEnemyBuffList10Percent = null; + revengeanceProjectileBuffList25Percent = null; + revengeanceProjectileBuffList20Percent = null; + revengeanceProjectileBuffList15Percent = null; + revengeanceLifeStealExceptionList = null; + noRageWormSegmentList = null; + needsDebuffIconDisplayList = null; + trapProjectileList = null; + scopedWeaponList = null; + boomerangList = null; + javelinList = null; + daggerList = null; + flaskBombList = null; + spikyBallList = null; + boomerangProjList = null; + javelinProjList = null; + daggerProjList = null; + flaskBombProjList = null; + spikyBallProjList = null; + noGravityList = null; + lavaFishList = null; + highTestFishList = null; + flamethrowerList = null; + forceItemList = null; + livingFireBlockList = null; + + zombieList = null; + demonEyeList = null; + skeletonList = null; + angryBonesList = null; + hornetList = null; + mossHornetList = null; + bossMinionList = null; + minibossList = null; + heartDropBlockList = null; + pierceResistList = null; + + legOverrideList = null; + + kamiDebuffColorImmuneList = null; + + MinionsToNotResurrectList = null; + ZeroMinionSlotExceptionList = null; + DontCopyOriginalMinionAIList = null; + } + } +} diff --git a/CalamityMod.cs b/CalamityMod.cs index 727c8611cd..0dfdf1acb0 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1,36 +1,17 @@ -using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.Effects; +using CalamityMod.Events; using CalamityMod.ILEditing; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; -using CalamityMod.Items.Accessories.Wings; -using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Armor; -using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Dyes.HairDye; -using CalamityMod.Items.Fishing.AstralCatches; -using CalamityMod.Items.Fishing.BrimstoneCragCatches; -using CalamityMod.Items.Fishing.FishingRods; -using CalamityMod.Items.Fishing.SunkenSeaCatches; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Tools; -using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Localization; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; @@ -41,10 +22,12 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; @@ -55,27 +38,14 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.Spears; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Schematics; using CalamityMod.Skies; using CalamityMod.TileEntities; -using CalamityMod.Tiles; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Tiles.LivingFire; using CalamityMod.UI; +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -86,7 +56,6 @@ using System.Reflection; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Dyes; -using Terraria.GameInput; using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -99,6 +68,7 @@ namespace CalamityMod public class CalamityMod : Mod { // CONSIDER -- I have been advised by Jopo that Mods should never contain static variables + // TODO -- 1.4 fixes the crit reforge price calculation bug, so GetWeaponCrit everywhere can go. // Hotkeys public static ModHotKey NormalityRelocatorHotKey; @@ -112,127 +82,92 @@ namespace CalamityMod public static ModHotKey SandCloakHotkey; public static ModHotKey SpectralVeilHotKey; public static ModHotKey PlaguePackHotKey; + public static ModHotKey AngelicAllianceHotKey; + public static ModHotKey GodSlayerDashHotKey; // Boss Spawners public static int ghostKillCount = 0; public static int sharkKillCount = 0; - // Textures & Shaders + // Textures public static Texture2D heartOriginal2; - public static Texture2D heartOriginal; - public static Texture2D rainOriginal; - public static Texture2D manaOriginal; - public static Texture2D carpetOriginal; - public static Texture2D AstralCactusTexture; + public static Texture2D heartOriginal; + public static Texture2D rainOriginal; + public static Texture2D manaOriginal; + public static Texture2D carpetOriginal; + public static Texture2D AstralCactusTexture; public static Texture2D AstralCactusGlowTexture; public static Texture2D AstralSky; - public static Effect CustomShader; - public static Effect LightShader; - public static Effect TentacleShader; - public static Effect LightDistortionShader; // DR data structure public static SortedDictionary DRValues; - // Boss Kill Time data structure - public static SortedDictionary bossKillTimes; + // Boss Kill Time data structure + public static SortedDictionary bossKillTimes; - // Boss velocity scaling data structure - public static SortedDictionary bossVelocityDamageScaleValues; - public const float velocityScaleMin = 0.5f; - public const float bitingEnemeyVelocityScale = 0.8f; + // Boss velocity scaling data structure + public static SortedDictionary bossVelocityDamageScaleValues; + public const float velocityScaleMin = 0.5f; + public const float bitingEnemeyVelocityScale = 0.8f; - // Lists - public static IList donatorList; - public static List trueMeleeProjectileList; // DO NOT, EVER, DELETE THIS LIST, OR I WILL COME FOR YOU :D - public static List rangedProjectileExceptionList; - public static List projectileDestroyExceptionList; - public static List projectileMinionList; - public static List enemyImmunityList; - public static List dungeonEnemyBuffList; - public static List dungeonProjectileBuffList; - public static List bossScaleList; - public static List bossHPScaleList; - public static List beeEnemyList; - public static List beeProjectileList; - public static List friendlyBeeList; - public static List hardModeNerfList; - public static List debuffList; - public static List fireWeaponList; - public static List iceWeaponList; - public static List natureWeaponList; - public static List alcoholList; - public static List doubleDamageBuffList; //100% buff - public static List sixtySixDamageBuffList; //66% buff - public static List fiftyDamageBuffList; //50% buff - public static List thirtyThreeDamageBuffList; //33% buff - public static List twentyFiveDamageBuffList; //25% buff - public static List twentyDamageBuffList; //20% buff - public static List tenDamageBuffList; //10% buff - public static List weaponAutoreuseList; - public static List tenDamageNerfList; //10% nerf - public static List quarterDamageNerfList; //25% nerf - public static List pumpkinMoonBuffList; - public static List frostMoonBuffList; - public static List eclipseBuffList; - public static List eventProjectileBuffList; - public static List revengeanceEnemyBuffList25Percent; - public static List revengeanceEnemyBuffList20Percent; - public static List revengeanceEnemyBuffList15Percent; - public static List revengeanceEnemyBuffList10Percent; - public static List revengeanceEnemyBuffList5Percent; - public static List revengeanceProjectileBuffList25Percent; - public static List revengeanceProjectileBuffList20Percent; - public static List revengeanceProjectileBuffList15Percent; - public static List revengeanceProjectileBuffList10Percent; - public static List revengeanceProjectileBuffList5Percent; - public static List revengeanceLifeStealExceptionList; - public static List movementImpairImmuneList; - public static List needsDebuffIconDisplayList; - public static List trapProjectileList; - public static List scopedWeaponList; - public static List boomerangList; - public static List javelinList; - public static List daggerList; - public static List flaskBombList; - public static List spikyBallList; - public static List boomerangProjList; - public static List javelinProjList; - public static List daggerProjList; - public static List flaskBombProjList; - public static List spikyBallProjList; - public static List noGravityList; - public static List lavaFishList; - public static List highTestFishList; - public static List flamethrowerList; - public static List forceItemList; - public static List livingFireBlockList; + // Life steal cap + public const int lifeStealCap = 10; - public static List zombieList; - public static List demonEyeList; - public static List skeletonList; - public static List angryBonesList; - public static List hornetList; - public static List mossHornetList; - public static List bossMinionList; - - public static List legOverrideList; - - // TODO -- Calamity should check for other mods existing in exactly one place - internal Mod thorium = null; - public bool fargosMutant = false; + // Debuff immunities, these are used in the NPCDebuffs file + public static int[] slimeEnemyImmunities = new int[1] { BuffID.Poisoned }; + public static int[] iceEnemyImmunities = new int[3] { BuffID.Frostburn, ModContent.BuffType(), ModContent.BuffType() }; + public static int[] sulphurEnemyImmunities = new int[4] { BuffID.Poisoned, BuffID.Venom, ModContent.BuffType(), ModContent.BuffType() }; + public static int[] sunkenSeaEnemyImmunities = new int[2] { ModContent.BuffType(), ModContent.BuffType() }; + public static int[] abyssEnemyImmunities = new int[1] { ModContent.BuffType() }; + public static int[] cragEnemyImmunities = new int[3] { BuffID.OnFire, ModContent.BuffType(), ModContent.BuffType() }; + public static int[] astralEnemyImmunities = new int[2] { BuffID.Poisoned, ModContent.BuffType() }; + public static int[] plagueEnemyImmunities = new int[3] { BuffID.Poisoned, BuffID.Venom, ModContent.BuffType() }; + public static int[] holyEnemyImmunities = new int[3] { BuffID.OnFire, ModContent.BuffType(), ModContent.BuffType() }; internal static CalamityMod Instance; + internal Mod musicMod = null; // This is Calamity's official music mod, CalamityModMusic + internal bool MusicAvailable => !(musicMod is null); + internal Mod ancientsAwakened = null; + internal Mod bossChecklist = null; + internal Mod census = null; + internal Mod crouchMod = null; + internal Mod fargos = null; + internal Mod redemption = null; + internal Mod soa = null; + internal Mod summonersAssociation = null; + internal Mod thorium = null; + internal Mod varia = null; #region Load public override void Load() { - Instance = this; - heartOriginal2 = Main.heartTexture; - heartOriginal = Main.heart2Texture; - rainOriginal = Main.rainTexture; - manaOriginal = Main.manaTexture; - carpetOriginal = Main.flyingCarpetTexture; + Instance = this; + + // If any of these mods aren't loaded, it will simply keep them as null. + musicMod = ModLoader.GetMod("CalamityModMusic"); + ancientsAwakened = ModLoader.GetMod("AAMod"); + bossChecklist = ModLoader.GetMod("BossChecklist"); + census = ModLoader.GetMod("Census"); + crouchMod = ModLoader.GetMod("CrouchMod"); + fargos = ModLoader.GetMod("Fargowiltas"); + redemption = ModLoader.GetMod("Redemption"); + soa = ModLoader.GetMod("SacredTools"); + summonersAssociation = ModLoader.GetMod("SummonersAssociation"); + thorium = ModLoader.GetMod("ThoriumMod"); + varia = ModLoader.GetMod("Varia"); + + // Initialize the EnemyStats struct as early as it is safe to do so + NPCStats.Load(); + + heartOriginal2 = Main.heartTexture; + heartOriginal = Main.heart2Texture; + rainOriginal = Main.rainTexture; + manaOriginal = Main.manaTexture; + carpetOriginal = Main.flyingCarpetTexture; + Mount.mounts[Mount.Unicorn].dashSpeed *= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[Mount.Unicorn].runSpeed *= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].dashSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].runSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower; NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z"); RageHotKey = RegisterHotKey("Rage Mode", "V"); @@ -241,85 +176,30 @@ namespace CalamityMod TarraHotKey = RegisterHotKey("Armor Set Bonus", "Y"); AstralTeleportHotKey = RegisterHotKey("Astral Teleport", "P"); AstralArcanumUIHotkey = RegisterHotKey("Astral Arcanum UI Toggle", "O"); - MomentumCapacitatorHotkey = RegisterHotKey("Momentom Capacitater Effect", "U"); + MomentumCapacitatorHotkey = RegisterHotKey("Momentum Capacitor Effect", "U"); SandCloakHotkey = RegisterHotKey("Sand Cloak Effect", "C"); SpectralVeilHotKey = RegisterHotKey("Spectral Veil Teleport", "Z"); PlaguePackHotKey = RegisterHotKey("Booster Dash", "Q"); + AngelicAllianceHotKey = RegisterHotKey("Angelic Alliance Blessing", "G"); + GodSlayerDashHotKey = RegisterHotKey("God Slayer Dash", "H"); - if (!Main.dedServ) - { + if (!Main.dedServ) LoadClient(); - } - - ILChanges.Initialize(); - thorium = ModLoader.GetMod("ThoriumMod"); + ILChanges.Load(); + BossRushEvent.Load(); BossHealthBarManager.Load(this); - - SetupLists(); + DraedonStructures.Load(); + CalamityLists.LoadLists(); + EnchantmentManager.LoadAllEnchantments(); SetupVanillaDR(); - SetupBossKillTimes(); - SetupBossVelocityScalingValues(); - SetupThoriumBossDR(thorium); + SetupBossKillTimes(); + SetupBossVelocityScalingValues(); CalamityLocalization.AddLocalizations(); - - On.Terraria.Player.TileInteractionsUse += Player_TileInteractionsUse; + SchematicManager.Load(); } - private static void Player_TileInteractionsUse(On.Terraria.Player.orig_TileInteractionsUse orig, Player player, int i, int j) - { - Tile tile = Main.tile[i, j]; - if (tile.type == ModContent.TileType()) - { - DoorSwap(ModContent.TileType(), ModContent.TileType(), i, j); - } - else if (tile.type == ModContent.TileType()) - { - DoorSwap(ModContent.TileType(), ModContent.TileType(), i, j); - } - else if (tile.type == ModContent.TileType()) - { - DoorSwap(ModContent.TileType(), ModContent.TileType(), i, j); - } - else if (tile.type == ModContent.TileType()) - { - DoorSwap(ModContent.TileType(), ModContent.TileType(), i, j); - } - else - { - orig(player, i, j); - } - } - - private static void DoorSwap(int type1, int type2, int i, int j) - { - if (PlayerInput.Triggers.JustPressed.MouseRight) - { - ushort type = (ushort)type1; - short frameY = 0; - for (int dy = -4; dy < 4; dy++) - { - if (Main.tile[i, j + dy].frameY > 0 && frameY == 0) - continue; - if (Main.tile[i, j + dy].type == type2) - { - if (Main.tile[i, j + dy] is null) - { - Main.tile[i, j + dy] = new Tile(); - } - Main.tile[i, j + dy].type = type; - Main.tile[i, j + dy].frameY = frameY; - frameY += 16; - if ((int)frameY / 16 >= 4) - break; - } - } - - Main.PlaySound(SoundID.DoorClosed, i * 16, j * 16, 1, 1f, 0f); - } - } - private void LoadClient() { AddEquipTexture(new AbyssalDivingSuitHead(), null, EquipType.Head, "AbyssalDivingSuitHead", "CalamityMod/Items/Accessories/AbyssalDivingSuit_Head"); @@ -355,10 +235,6 @@ namespace CalamityMod AstralCactusTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactus"); AstralCactusGlowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); - CustomShader = GetEffect("Effects/CustomShader"); - LightShader = GetEffect("Effects/LightBurstShader"); - TentacleShader = GetEffect("Effects/TentacleShader"); - LightDistortionShader = GetEffect("Effects/DistortionShader"); 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(); @@ -384,37 +260,48 @@ namespace CalamityMod Filters.Scene["CalamityMod:SupremeCalamitas"] = new Filter(new SCalScreenShaderData("FilterMiniTower").UseColor(1.1f, 0.3f, 0.3f).UseOpacity(0.65f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:SupremeCalamitas"] = new SCalSky(); + Filters.Scene["CalamityMod:AdultEidolonWyrm"] = new Filter(new AEWScreenShaderData("FilterMiniTower").UseColor(0f, 0f, 0.25f).UseOpacity(0.35f), EffectPriority.VeryHigh); + SkyManager.Instance["CalamityMod:AdultEidolonWyrm"] = new AEWSky(); + Filters.Scene["CalamityMod:Signus"] = new Filter(new SignusScreenShaderData("FilterMiniTower").UseColor(0.35f, 0.1f, 0.55f).UseOpacity(0.35f), EffectPriority.VeryHigh); - SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); + SkyManager.Instance["CalamityMod:Signus"] = new SignusSky(); - Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(CustomShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:Astral"] = new AstralSky(); - - Filters.Scene["CalamityMod:LightBurst"] = new Filter(new ScreenShaderData(new Ref(LightShader), "BurstPass"), EffectPriority.VeryHigh); - Filters.Scene["CalamityMod:LightBurst"].Load(); - - GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); - GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref(LightDistortionShader), "DistortionPass"); - SkyManager.Instance["CalamityMod:Cryogen"] = new CryogenSky(); + SkyManager.Instance["CalamityMod:StormWeaverFlash"] = new StormWeaverFlashSky(); - RipperUI.Reset(); + CalamityShaders.LoadShaders(); + + RipperUI.Load(); AstralArcanumUI.Load(this); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax)))); - GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(186, 85, 211), (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax)))); + SupremeCalamitas.LoadHeadIcons(); - SchematicLoader.LoadEverything(); + GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); + GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); + GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax)))); + GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(186, 85, 211), (player.Calamity().rogueStealth / player.Calamity().rogueStealthMax)))); PopupGUIManager.LoadGUIs(); + InvasionProgressUIManager.LoadGUIs(); } #endregion #region Unload public override void Unload() { + musicMod = null; + ancientsAwakened = null; + bossChecklist = null; + census = null; + crouchMod = null; + fargos = null; + redemption = null; + soa = null; + summonersAssociation = null; + thorium = null; + varia = null; + NormalityRelocatorHotKey = null; RageHotKey = null; AdrenalineHotKey = null; @@ -426,6 +313,8 @@ namespace CalamityMod SandCloakHotkey = null; SpectralVeilHotKey = null; PlaguePackHotKey = null; + AngelicAllianceHotKey = null; + GodSlayerDashHotKey = null; AstralCactusTexture = null; AstralCactusGlowTexture = null; @@ -433,115 +322,49 @@ namespace CalamityMod DRValues?.Clear(); DRValues = null; - bossKillTimes?.Clear(); - bossKillTimes = null; - bossVelocityDamageScaleValues?.Clear(); - bossVelocityDamageScaleValues = null; + bossKillTimes?.Clear(); + bossKillTimes = null; + bossVelocityDamageScaleValues?.Clear(); + bossVelocityDamageScaleValues = null; - donatorList = null; - trueMeleeProjectileList = null; - rangedProjectileExceptionList = null; - projectileDestroyExceptionList = null; - projectileMinionList = null; - enemyImmunityList = null; - dungeonEnemyBuffList = null; - dungeonProjectileBuffList = null; - bossScaleList = null; - bossHPScaleList = null; - beeEnemyList = null; - friendlyBeeList = null; - beeProjectileList = null; - hardModeNerfList = null; - debuffList = null; - fireWeaponList = null; - iceWeaponList = null; - natureWeaponList = null; - alcoholList = null; - doubleDamageBuffList = null; - sixtySixDamageBuffList = null; - fiftyDamageBuffList = null; - thirtyThreeDamageBuffList = null; - twentyFiveDamageBuffList = null; - tenDamageBuffList = null; - weaponAutoreuseList = null; - tenDamageNerfList = null; - quarterDamageNerfList = null; - pumpkinMoonBuffList = null; - frostMoonBuffList = null; - eclipseBuffList = null; - eventProjectileBuffList = null; - revengeanceEnemyBuffList25Percent = null; - revengeanceEnemyBuffList20Percent = null; - revengeanceEnemyBuffList15Percent = null; - revengeanceEnemyBuffList10Percent = null; - revengeanceEnemyBuffList5Percent = null; - revengeanceProjectileBuffList25Percent = null; - revengeanceProjectileBuffList20Percent = null; - revengeanceProjectileBuffList15Percent = null; - revengeanceProjectileBuffList10Percent = null; - revengeanceProjectileBuffList5Percent = null; - revengeanceLifeStealExceptionList = null; - movementImpairImmuneList = null; - needsDebuffIconDisplayList = null; - trapProjectileList = null; - scopedWeaponList = null; - boomerangList = null; - javelinList = null; - daggerList = null; - flaskBombList = null; - spikyBallList = null; - boomerangProjList = null; - javelinProjList = null; - daggerProjList = null; - flaskBombProjList = null; - spikyBallProjList = null; - noGravityList = null; - lavaFishList = null; - highTestFishList = null; - flamethrowerList = null; - forceItemList = null; - livingFireBlockList = null; - - zombieList = null; - demonEyeList = null; - skeletonList = null; - angryBonesList = null; - hornetList = null; - mossHornetList = null; - bossMinionList = null; - - legOverrideList = null; - - thorium = null; - fargosMutant = false; - - Instance = null; + EnchantmentManager.UnloadAllEnchantments(); + CalamityLists.UnloadLists(); + NPCStats.Unload(); PopupGUIManager.UnloadGUIs(); - SchematicLoader.UnloadEverything(); + InvasionProgressUIManager.UnloadGUIs(); + BossRushEvent.Unload(); + SchematicManager.Unload(); BossHealthBarManager.Unload(); - base.Unload(); + DraedonStructures.Unload(); TileFraming.Unload(); - RipperUI.Reset(); + RipperUI.Unload(); AstralArcanumUI.Unload(); - base.Unload(); - if (!Main.dedServ) - { - Main.heartTexture = heartOriginal2; - Main.heart2Texture = heartOriginal; - Main.rainTexture = rainOriginal; - Main.manaTexture = manaOriginal; - Main.flyingCarpetTexture = carpetOriginal; - } + if (!Main.dedServ) + { + Main.heartTexture = heartOriginal2; + Main.heart2Texture = heartOriginal; + Main.rainTexture = rainOriginal; + Main.manaTexture = manaOriginal; + Main.flyingCarpetTexture = carpetOriginal; + } + Mount.mounts[Mount.Unicorn].dashSpeed /= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[Mount.Unicorn].runSpeed /= CalamityPlayer.UnicornSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].dashSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; + Mount.mounts[Mount.MinecartMech].runSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower; heartOriginal2 = null; - heartOriginal = null; - rainOriginal = null; - manaOriginal = null; - carpetOriginal = null; + heartOriginal = null; + rainOriginal = null; + manaOriginal = null; + carpetOriginal = null; + + ILChanges.Unload(); + Instance = null; + base.Unload(); } #endregion @@ -555,2382 +378,14 @@ namespace CalamityMod #region ConfigCrap internal static void SaveConfig(CalamityConfig cfg) - { - // in-game ModConfig saving from mod code is not supported yet in tmodloader, and subject to change, so we need to be extra careful. - // This code only supports client configs, and doesn't call onchanged. It also doesn't support ReloadRequired or anything else. - MethodInfo saveMethodInfo = typeof(ConfigManager).GetMethod("Save", BindingFlags.Static | BindingFlags.NonPublic); - if (saveMethodInfo != null) - saveMethodInfo.Invoke(null, new object[] { cfg }); - else - Instance.Logger.Warn("In-game SaveConfig failed, code update required"); - } - #endregion - - #region SetupLists - public static void SetupLists() { - donatorList = new List() - { - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "Yuh", - "Littlepiggy", - "LompL", - "Lilith Saintclaire", - "Ben Shapiro", - "Frederik Henschel", - "Faye", - "Gibb50", - "Braden Hajer", - "Hannes Holmlund", - "profoundmango69", - "Jack M Sargent", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "Tervastator", - "Luis Arguello", - "Alexander Davis", - "BakaQing", - "Laura Coonrod", - "Xaphlactus", - "MajinBagel", - "Bendy", - "Rando Calrissian", - "Tails the Fox 92", - "Bread", - "Minty Candy", - "Preston Card", - "MovingTarget_086", - "Shiro", - "Chip", - "Taylor Riverpaw", - "ShotgunAngel", - "Sandblast", - "ThomasThePencil", - "Aero (Aero#4599)", - "GlitchOut", - "Daawnz", - "CrabBar", - "Yatagarasu", - "Jarod Isaac Gordon", - "Zombieh", - "MingWhy", - "Random Weeb", - "Ahmed Fahad Zamel Al Sharif", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel Foreman", - "Christopher Pham", - "DemoN K!ng", - "Malik Ciaramella", - "Ryan Baker-Ortiz", - "Aleksanders Denisovs", - "TheSilverGhost", - "Lucazii", - "Shay", - "Prism", - "BobIsNotMyRealName", - "Guwahavel", - "Azura", - "Joshua Miranda", - "Doveda", - "William Chang", - "Arche", - "DevilSunrise", - "Yanmei", - "Chaos", - "Ryan Tucker", - "Fish Repairs", - "Melvin Brouwers", - "Vroomy Has -3,000 IQ", - "The Goliath", - "DaPyRo", - "Termi", - "Circuit-Jay", - "Commmander Frostbite", - "cytokat", - "Cameron Fowlks", - "Orudeon", - "BumbleDoge", - "John Ballard", - "Naglfar", - "Helixas", - "Vetus Dea", - "High Charity", - "Devonte Plati", - "Cerberus", - "Brendan Kendall", - "Victor Pittman", - "KAT-G307", - "Tombarry Expresserino", - "Drip Veezy", - "Glaid", - "Apotheosis", - "Bladesaber", - "Devon Leigh", - "Ruthoranium", - "cocodezi_", - "Mendzey", - "GameRDheAsianSandwich", - "Tobias", - "Streakist .", - "Eisaya A Cook", - "Xenocrona", - "RKMoon" - }; - - trueMeleeProjectileList = new List() - { - // Vanilla shit - ProjectileID.Spear, - ProjectileID.Trident, - ProjectileID.TheRottedFork, - ProjectileID.Swordfish, - ProjectileID.Arkhalis, - ProjectileID.DarkLance, - ProjectileID.CobaltNaginata, - ProjectileID.PalladiumPike, - ProjectileID.MythrilHalberd, - ProjectileID.OrichalcumHalberd, - ProjectileID.AdamantiteGlaive, - ProjectileID.TitaniumTrident, - ProjectileID.MushroomSpear, - ProjectileID.Gungnir, - ProjectileID.ObsidianSwordfish, - ProjectileID.ChlorophytePartisan, - ProjectileID.MonkStaffT1, - ProjectileID.MonkStaffT2, - ProjectileID.MonkStaffT3, - ProjectileID.NorthPoleWeapon, - - // Tools - ProjectileID.CobaltDrill, - ProjectileID.MythrilDrill, - ProjectileID.AdamantiteDrill, - ProjectileID.PalladiumDrill, - ProjectileID.OrichalcumDrill, - ProjectileID.TitaniumDrill, - ProjectileID.ChlorophyteDrill, - ProjectileID.CobaltChainsaw, - ProjectileID.MythrilChainsaw, - ProjectileID.AdamantiteChainsaw, - ProjectileID.PalladiumChainsaw, - ProjectileID.OrichalcumChainsaw, - ProjectileID.TitaniumChainsaw, - ProjectileID.ChlorophyteChainsaw, - ProjectileID.VortexDrill, - ProjectileID.VortexChainsaw, - ProjectileID.NebulaDrill, - ProjectileID.NebulaChainsaw, - ProjectileID.SolarFlareDrill, - ProjectileID.SolarFlareChainsaw, - ProjectileID.StardustDrill, - ProjectileID.StardustChainsaw, - ProjectileID.Hamdrax, - ProjectileID.ChlorophyteJackhammer, - ProjectileID.SawtoothShark, - ProjectileID.ButchersChainsaw, - - // Calamity shit - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - rangedProjectileExceptionList = new List() - { - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.IchorDart, - ProjectileID.PhantasmArrow, - ProjectileID.RainbowBack, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), // Because of potential dust lag. - ModContent.ProjectileType() - }; - - projectileDestroyExceptionList = new List() - { - //holdout projectiles - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.LastPrism, - ProjectileID.LaserMachinegun, - ProjectileID.ChargedBlasterCannon, - ProjectileID.MedusaHead, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - - //Some hostile boss projectiles - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - projectileMinionList = new List() - { - ProjectileID.PygmySpear, - ProjectileID.UFOMinion, - ProjectileID.UFOLaser, - ProjectileID.StardustCellMinionShot, - ProjectileID.MiniSharkron, - ProjectileID.MiniRetinaLaser, - ProjectileID.ImpFireball, - ProjectileID.HornetStinger, - ProjectileID.DD2FlameBurstTowerT1Shot, - ProjectileID.DD2FlameBurstTowerT2Shot, - ProjectileID.DD2FlameBurstTowerT3Shot, - ProjectileID.DD2BallistraProj, - ProjectileID.DD2ExplosiveTrapT1Explosion, - ProjectileID.DD2ExplosiveTrapT2Explosion, - ProjectileID.DD2ExplosiveTrapT3Explosion, - ProjectileID.SpiderEgg, - ProjectileID.BabySpider, - ProjectileID.FrostBlastFriendly, - ProjectileID.MoonlordTurretLaser, - ProjectileID.RainbowCrystalExplosion - }; - - enemyImmunityList = new List() - { - NPCID.KingSlime, - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.BrainofCthulhu, - NPCID.Creeper, - NPCID.EyeofCthulhu, - NPCID.QueenBee, - NPCID.SkeletronHead, - NPCID.SkeletronHand, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.Retinazer, - NPCID.Spazmatism, - NPCID.SkeletronPrime, - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.Plantera, - NPCID.IceQueen, - NPCID.Pumpking, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.GolemHeadFree, - NPCID.DukeFishron, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.CultistBoss, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, - NPCID.DD2WyvernT1, - NPCID.DD2WyvernT2, - NPCID.DD2WyvernT3, - NPCID.DD2DarkMageT1, - NPCID.DD2DarkMageT3, - NPCID.DD2SkeletonT1, - NPCID.DD2SkeletonT3, - NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, - NPCID.DD2DrakinT2, - NPCID.DD2DrakinT3, - NPCID.DD2KoboldWalkerT2, - NPCID.DD2KoboldWalkerT3, - NPCID.DD2KoboldFlyerT2, - NPCID.DD2KoboldFlyerT3, - NPCID.DD2OgreT2, - NPCID.DD2OgreT3, - NPCID.DD2Betsy, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() //brothers - }; - - dungeonEnemyBuffList = new List() - { - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.SkeletonCommando, - NPCID.Paladin, - NPCID.GiantCursedSkull, - NPCID.BoneLee, - NPCID.DiabolistWhite, - NPCID.DiabolistRed, - NPCID.NecromancerArmored, - NPCID.Necromancer, - NPCID.RaggedCasterOpenCoat, - NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBones, - NPCID.BlueArmoredBonesSword, - NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBones, - NPCID.RustyArmoredBonesSwordNoArmor, - NPCID.RustyArmoredBonesSword, - NPCID.RustyArmoredBonesFlail, - NPCID.RustyArmoredBonesAxe - }; - - dungeonProjectileBuffList = new List() - { - ProjectileID.PaladinsHammerHostile, - ProjectileID.ShadowBeamHostile, - ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, - ProjectileID.LostSoulHostile, - ProjectileID.SniperBullet, - ProjectileID.RocketSkeleton, - ProjectileID.BulletDeadeye, - ProjectileID.Shadowflames - }; - - bossScaleList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PlanterasTentacle, - NPCID.Pumpking, - NPCID.IceQueen, - NPCID.Mothron, - NPCID.GolemHead - }; - - bossHPScaleList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.MoonLordHead, - NPCID.MoonLordHand - }; - - beeEnemyList = new List() - { - NPCID.GiantMossHornet, - NPCID.BigMossHornet, - NPCID.LittleMossHornet, - NPCID.TinyMossHornet, - NPCID.MossHornet, - NPCID.VortexHornetQueen, - NPCID.VortexHornet, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.QueenBee, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - beeProjectileList = new List() - { - ProjectileID.Stinger, - ProjectileID.HornetStinger, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - friendlyBeeList = new List() - { - ProjectileID.GiantBee, - ProjectileID.Bee, - ProjectileID.Wasp, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - hardModeNerfList = new List() - { - ProjectileID.WebSpit, - ProjectileID.PinkLaser, - ProjectileID.FrostBlastHostile, - ProjectileID.RuneBlast, - ProjectileID.GoldenShowerHostile, - ProjectileID.RainNimbus, - ProjectileID.Stinger, - ProjectileID.FlamingArrow, - ProjectileID.BulletDeadeye, - ProjectileID.CannonballHostile - }; - - debuffList = new List() - { - BuffID.Poisoned, - BuffID.Darkness, - BuffID.Cursed, - BuffID.OnFire, - BuffID.Bleeding, - BuffID.Confused, - BuffID.Slow, - BuffID.Weak, - BuffID.Silenced, - BuffID.BrokenArmor, - BuffID.CursedInferno, - BuffID.Frostburn, - BuffID.Chilled, - BuffID.Frozen, - BuffID.Burning, - BuffID.Suffocation, - BuffID.Ichor, - BuffID.Venom, - BuffID.Blackout, - BuffID.Electrified, - BuffID.Rabies, - BuffID.Webbed, - BuffID.Stoned, - BuffID.Dazed, - BuffID.VortexDebuff, - BuffID.WitheredArmor, - BuffID.WitheredWeapon, - BuffID.OgreSpit, - BuffID.BetsysCurse, - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType() - }; - - fireWeaponList = new List() - { - ItemID.FieryGreatsword, - ItemID.DD2SquireDemonSword, - ItemID.TheHorsemansBlade, - ItemID.Cascade, - ItemID.HelFire, - ItemID.Flamarang, - ItemID.MoltenFury, - ItemID.Sunfury, - ItemID.PhoenixBlaster, - ItemID.Flamelash, - ItemID.SolarEruption, - ItemID.DayBreak, - ItemID.HellwingBow, - ItemID.DD2PhoenixBow, - ItemID.DD2BetsyBow, - ItemID.FlareGun, - ItemID.Flamethrower, - ItemID.EldMelter, - ItemID.FlowerofFire, - ItemID.MeteorStaff, - ItemID.ApprenticeStaffT3, - ItemID.InfernoFork, - ItemID.HeatRay, - ItemID.BookofSkulls, - ItemID.ImpStaff, - ItemID.DD2FlameburstTowerT1Popper, - ItemID.DD2FlameburstTowerT2Popper, - ItemID.DD2FlameburstTowerT3Popper, - ItemID.MolotovCocktail, - ItemID.WandofSparking, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - iceWeaponList = new List() - { - ItemID.IceBlade, - ItemID.IceSickle, - ItemID.Frostbrand, - ItemID.Amarok, - ItemID.NorthPole, - ItemID.IceBoomerang, - ItemID.IceBow, - ItemID.SnowmanCannon, - ItemID.SnowballCannon, - ItemID.IceRod, - ItemID.FlowerofFrost, - ItemID.FrostStaff, - ItemID.BlizzardStaff, - ItemID.StaffoftheFrostHydra, - ItemID.Snowball, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - //Cryonic Bar set stuff, could potentially be removed - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - natureWeaponList = new List() - { - ItemID.BladeofGrass, - ItemID.ChlorophyteClaymore, - ItemID.ChlorophyteSaber, - ItemID.ChlorophytePartisan, - ItemID.ChlorophyteShotbow, - ItemID.Seedler, - ItemID.ChristmasTreeSword, - ItemID.TerraBlade, - ItemID.JungleYoyo, - ItemID.Yelets, - ItemID.MushroomSpear, - ItemID.ThornChakram, - ItemID.Bananarang, - ItemID.FlowerPow, - ItemID.BeesKnees, - ItemID.Toxikarp, - ItemID.Bladetongue, - ItemID.PoisonStaff, - ItemID.VenomStaff, - ItemID.StaffofEarth, - ItemID.BeeGun, - ItemID.LeafBlower, - ItemID.WaspGun, - ItemID.CrystalSerpent, - ItemID.Razorpine, - ItemID.HornetStaff, - ItemID.QueenSpiderStaff, - ItemID.SlimeStaff, - ItemID.PygmyStaff, - ItemID.RavenStaff, - ItemID.BatScepter, - ItemID.SpiderStaff, - ItemID.Beenade, - ItemID.FrostDaggerfish, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - alcoholList = new List() - { - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType(), - ModContent.BuffType() - }; - - doubleDamageBuffList = new List() - { - ItemID.BallOHurt, - ItemID.TheMeatball, - ItemID.BlueMoon, - ItemID.Sunfury, - ItemID.DaoofPow, - ItemID.FlowerPow, - ItemID.Anchor, - ItemID.KOCannon, - ItemID.GolemFist, - ItemID.BreakerBlade, - ItemID.MonkStaffT2, - ItemID.ProximityMineLauncher, - ItemID.FireworksLauncher, - ItemID.ShadowbeamStaff - }; - - sixtySixDamageBuffList = new List() - { - ItemID.TrueNightsEdge, - ItemID.MedusaHead, - ItemID.StaffofEarth, - ItemID.ChristmasTreeSword, - ItemID.MonkStaffT1, - ItemID.InfernoFork, - ItemID.VenomStaff, - ItemID.Frostbrand - }; - - fiftyDamageBuffList = new List() - { - ItemID.NightsEdge, - ItemID.EldMelter, - ItemID.Flamethrower, - ItemID.MoonlordTurretStaff, - ItemID.WaspGun, - ItemID.Keybrand, - ItemID.PulseBow, - ItemID.PaladinsHammer, - ItemID.SolarEruption, - ItemID.DayBreak - }; - - thirtyThreeDamageBuffList = new List() - { - ItemID.WandofSparking, - ItemID.IceBow, - ItemID.Marrow, - ItemID.CrystalVileShard, - ItemID.SoulDrain, - ItemID.ClingerStaff, - ItemID.ChargedBlasterCannon, - ItemID.NettleBurst, - ItemID.Excalibur, - ItemID.AmberStaff, - ItemID.BluePhasesaber, - ItemID.RedPhasesaber, - ItemID.GreenPhasesaber, - ItemID.WhitePhasesaber, - ItemID.YellowPhasesaber, - ItemID.PurplePhasesaber, - ItemID.TheRottedFork, - ItemID.VampireKnives, - ItemID.Cascade, - ItemID.TrueExcalibur - }; - - twentyFiveDamageBuffList = new List() - { - ItemID.Muramasa, - ItemID.StakeLauncher, - ItemID.BookStaff - }; - - twentyDamageBuffList = new List() - { - ItemID.ChainGuillotines, - ItemID.FlowerofFrost, - ItemID.PoisonStaff, - ItemID.Gungnir, - ItemID.TacticalShotgun - }; - - tenDamageBuffList = new List() - { - ItemID.MagnetSphere, - ItemID.BatScepter - }; - - weaponAutoreuseList = new List() - { - ItemID.NightsEdge, - ItemID.TrueNightsEdge, - ItemID.TrueExcalibur, - ItemID.PhoenixBlaster, - ItemID.VenusMagnum, - ItemID.MagicDagger, - ItemID.BeamSword, - ItemID.MonkStaffT2, - ItemID.PaladinsHammer, - ItemID.PearlwoodSword, - ItemID.PearlwoodBow, - ItemID.TaxCollectorsStickOfDoom, - ItemID.StylistKilLaKillScissorsIWish - }; - - tenDamageNerfList = new List() - { - ItemID.Phantasm - }; - - quarterDamageNerfList = new List() - { - ItemID.Razorpine, - ItemID.DaedalusStormbow, - ItemID.PhoenixBlaster, - ItemID.DD2BetsyBow, - ItemID.InfluxWaver, - ItemID.Xenopopper, - ItemID.ElectrosphereLauncher, - ItemID.OpticStaff //Note: got local i frames so it should be better - }; - - pumpkinMoonBuffList = new List() - { - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.HeadlessHorseman, - NPCID.MourningWood, - NPCID.Splinterling, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.Hellhound, - NPCID.Poltergeist - }; - - frostMoonBuffList = new List() - { - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.PresentMimic, - NPCID.GingerbreadMan, - NPCID.Yeti, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.ElfCopter, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.ElfArcher, - NPCID.Krampus, - NPCID.Flocko - }; - - eclipseBuffList = new List() - { - NPCID.Eyezor, - NPCID.Reaper, - NPCID.Frankenstein, - NPCID.SwampThing, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.Fritz, - NPCID.Nailhead, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.DrManFly, - NPCID.ThePossessed, - NPCID.Mothron, - NPCID.MothronEgg, - NPCID.MothronSpawn - }; - - eventProjectileBuffList = new List() - { - ProjectileID.FlamingWood, - ProjectileID.GreekFire1, - ProjectileID.GreekFire2, - ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, - ProjectileID.FlamingArrow, - ProjectileID.PineNeedleHostile, - ProjectileID.OrnamentHostile, - ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, - ProjectileID.FrostShard, - ProjectileID.Missile, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.BulletDeadeye, - ProjectileID.EyeLaser, - ProjectileID.Nail, - ProjectileID.DrManFlyFlask - }; - - // Enemies that inflict an average of 1 to 50 damage in Expert Mode - revengeanceEnemyBuffList25Percent = new List() - { - NPCID.ServantofCthulhu, - NPCID.EyeofCthulhu, - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.Bee, - NPCID.BeeSmall, - NPCID.SkeletronHand, - NPCID.GiantWormHead, - NPCID.BlazingWheel, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - // Enemies that inflict an average of 51 to 100 damage in Expert Mode - revengeanceEnemyBuffList20Percent = new List() - { - NPCID.KingSlime, - NPCID.BrainofCthulhu, - NPCID.QueenBee, - NPCID.SkeletronHead, - NPCID.TheHungryII, - NPCID.LeechHead, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.Probe, - NPCID.PrimeSaw, - NPCID.PrimeVice, - NPCID.PrimeLaser, - NPCID.PrimeCannon, - NPCID.DevourerHead, - NPCID.MeteorHead, - NPCID.BoneSerpentHead, - NPCID.ManEater, - NPCID.Snatcher, - NPCID.Piranha, - NPCID.Shark, - NPCID.SpikeBall, - NPCID.DiggerHead, - NPCID.WallCreeper, - NPCID.WallCreeperWall, - NPCID.Lihzahrd, - NPCID.Pumpking, - NPCID.SlimeSpiked, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - // Enemies that inflict an average of 101 to 200 damage in Expert Mode - revengeanceEnemyBuffList15Percent = new List() - { - NPCID.WallofFlesh, - NPCID.Spazmatism, - NPCID.Retinazer, - NPCID.SkeletronPrime, - NPCID.Plantera, - NPCID.PlanterasTentacle, - NPCID.Spore, - NPCID.DetonatingBubble, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - NPCID.DukeFishron, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.CultistDragonHead, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - NPCID.DD2Betsy, - NPCID.Mimic, - NPCID.WyvernHead, - NPCID.SeekerHead, - NPCID.AnglerFish, - NPCID.Werewolf, - NPCID.Wraith, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.BlackRecluseWall, - NPCID.AngryTrapper, - NPCID.LihzahrdCrawler, - NPCID.PirateCaptain, - NPCID.FlyingSnake, - NPCID.Reaper, - NPCID.Paladin, - NPCID.BoneLee, - NPCID.MourningWood, - NPCID.PumpkingBlade, - NPCID.PresentMimic, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.StardustWormHead, - NPCID.Butcher, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.BigMimicCorruption, - NPCID.BigMimicCrimson, - NPCID.BigMimicHallow, - NPCID.Mothron, - NPCID.DuneSplicerHead, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - // Enemies that inflict an average of 201 to 400 damage in Expert Mode - revengeanceEnemyBuffList10Percent = new List() - { - NPCID.TheDestroyer, - NPCID.SolarCrawltipedeHead, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - // Enemies that inflict an average of 401+ damage in Expert Mode - revengeanceEnemyBuffList5Percent = new List() - { - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - revengeanceProjectileBuffList25Percent = new List() - { - ProjectileID.SandBallFalling, - ProjectileID.AshBallFalling, - ProjectileID.EbonsandBallFalling, - ProjectileID.PearlSandBallFalling, - ProjectileID.CrimsandBallFalling, - ProjectileID.GeyserTrap, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - revengeanceProjectileBuffList20Percent = new List() - { - ProjectileID.PoisonDartTrap, - ProjectileID.DemonSickle, - ProjectileID.SandnadoHostile, - ProjectileID.DD2BetsyFireball, - ProjectileID.DD2BetsyFlameBreath, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - revengeanceProjectileBuffList15Percent = new List() - { - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.Fireball, - ProjectileID.PaladinsHammerHostile, - ProjectileID.FlamingWood, - ProjectileID.FlamingScythe, - ProjectileID.FrostWave, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.SaucerDeathray, - ProjectileID.NebulaBolt, - ProjectileID.NebulaSphere, - ProjectileID.NebulaLaser, - ProjectileID.StardustSoldierLaser, - ProjectileID.VortexLaser, - ProjectileID.VortexVortexLightning, - ProjectileID.VortexLightning, - ProjectileID.VortexAcid, - ProjectileID.Sharknado, - ProjectileID.Cthulunado, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - revengeanceProjectileBuffList10Percent = new List() - { - ProjectileID.Boulder, - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - revengeanceProjectileBuffList5Percent = new List() - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - revengeanceLifeStealExceptionList = new List() - { - NPCID.Probe, - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.PlanterasTentacle, - NPCID.Spore, - NPCID.TheHungryII, - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.MoonLordCore - }; - - movementImpairImmuneList = new List() - { - NPCID.QueenBee, - }; - - needsDebuffIconDisplayList = new List() - { - NPCID.WallofFleshEye - }; - - trapProjectileList = new List() - { - ProjectileID.PoisonDartTrap, - ProjectileID.SpikyBallTrap, - ProjectileID.SpearTrap, - ProjectileID.FlamethrowerTrap, - ProjectileID.FlamesTrap, - ProjectileID.PoisonDart, - ProjectileID.GeyserTrap - }; - - scopedWeaponList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - boomerangList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - boomerangProjList = new List() - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - javelinList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - javelinProjList = new List() - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - daggerList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - daggerProjList = new List() - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - flaskBombList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - flaskBombProjList = new List() - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - spikyBallList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - spikyBallProjList = new List() - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }; - - noGravityList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - }; - - lavaFishList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - - highTestFishList = new List() - { - ItemID.GoldenFishingRod, - ModContent.ItemType(), - ModContent.ItemType() - }; - - flamethrowerList = new List() - { - ModContent.ItemType(), - ModContent.ItemType() - }; - - forceItemList = new List() - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ItemID.HotlineFishingHook, - ItemID.BottomlessBucket, - ItemID.SuperAbsorbantSponge, - ItemID.FishingPotion, - ItemID.SonarPotion, - ItemID.CratePotion, - ItemID.AnglerTackleBag, - ItemID.HighTestFishingLine, - ItemID.TackleBox, - ItemID.AnglerEarring, - ItemID.FishermansGuide, - ItemID.WeatherRadio, - ItemID.Sextant, - ItemID.AnglerHat, - ItemID.AnglerVest, - ItemID.AnglerPants, - ItemID.GoldenBugNet, - ItemID.FishronWings, - ItemID.Flairon, - ItemID.Tsunami, - ItemID.BubbleGun, - ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, - ItemID.FishronBossBag, - ItemID.Coral, - ItemID.Seashell, - ItemID.Starfish, - ItemID.SoulofSight, - ItemID.GreaterHealingPotion, - ItemID.SuperHealingPotion - }; - - livingFireBlockList = new List() - { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - TileID.LivingFire, - TileID.LivingCursedFire, - TileID.LivingDemonFire, - TileID.LivingFrostFire, - TileID.LivingIchor, - TileID.LivingUltrabrightFire - }; - - zombieList = new List() - { - NPCID.Zombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.PincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling - NPCID.SlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo, - NPCID.BigRainZombie, - NPCID.SmallRainZombie, - NPCID.BigFemaleZombie, - NPCID.SmallFemaleZombie, - NPCID.BigTwiggyZombie, - NPCID.SmallTwiggyZombie, - NPCID.BigSwampZombie, - NPCID.SmallSwampZombie, - NPCID.BigSlimedZombie, - NPCID.SmallSlimedZombie, - NPCID.BigPincushionZombie, - NPCID.SmallPincushionZombie, - NPCID.BigBaldZombie, - NPCID.SmallBaldZombie, - NPCID.BigZombie, - NPCID.SmallZombie - // halloween zombies not included because they don't drop shackles or zombie arms - }; - - demonEyeList = new List() - { - NPCID.DemonEye, - NPCID.CataractEye, - NPCID.SleepyEye, - NPCID.DialatedEye, // it is spelled "dilated" - NPCID.GreenEye, - NPCID.PurpleEye, - NPCID.DemonEyeOwl, - NPCID.DemonEyeSpaceship, - NPCID.DemonEye2, - NPCID.PurpleEye2, - NPCID.GreenEye2, - NPCID.DialatedEye2, - NPCID.SleepyEye2, - NPCID.CataractEye2 - }; - - skeletonList = new List() - { - NPCID.Skeleton, - NPCID.HeadacheSkeleton, - NPCID.MisassembledSkeleton, - NPCID.PantlessSkeleton, - NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, - NPCID.BoneThrowingSkeleton3, - NPCID.BoneThrowingSkeleton4, - NPCID.BigPantlessSkeleton, - NPCID.SmallPantlessSkeleton, - NPCID.BigMisassembledSkeleton, - NPCID.SmallMisassembledSkeleton, - NPCID.BigHeadacheSkeleton, - NPCID.SmallHeadacheSkeleton, - NPCID.BigSkeleton, - NPCID.SmallSkeleton, - - //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason - NPCID.SkeletonTopHat, - NPCID.SkeletonAstonaut, - NPCID.SkeletonAlien, - - //Other skeleton types - NPCID.ArmoredSkeleton, - NPCID.HeavySkeleton, - NPCID.SkeletonArcher, - NPCID.GreekSkeleton - }; - - angryBonesList = new List() - { - NPCID.AngryBones, - NPCID.AngryBonesBig, - NPCID.AngryBonesBigMuscle, - NPCID.AngryBonesBigHelmet, - NPCID.BigBoned, - NPCID.ShortBones - }; - - hornetList = new List() - { - NPCID.BigHornetStingy, - NPCID.LittleHornetStingy, - NPCID.BigHornetSpikey, - NPCID.LittleHornetSpikey, - NPCID.BigHornetLeafy, - NPCID.LittleHornetLeafy, - NPCID.BigHornetHoney, - NPCID.LittleHornetHoney, - NPCID.BigHornetFatty, - NPCID.LittleHornetFatty, - NPCID.BigStinger, - NPCID.LittleStinger, - NPCID.Hornet, - NPCID.HornetFatty, - NPCID.HornetHoney, - NPCID.HornetLeafy, - NPCID.HornetSpikey, - NPCID.HornetStingy - }; - - mossHornetList = new List() - { - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.LittleMossHornet, - NPCID.BigMossHornet, - NPCID.GiantMossHornet - }; - - bossMinionList = new List() - { - NPCID.SlimeSpiked, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.ServantofCthulhu, - ModContent.NPCType(), - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.SkeletronHand, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.LeechHead, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.WallofFleshEye, - NPCID.TheHungry, - NPCID.TheHungryII, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeSaw, - NPCID.PrimeVice, - ModContent.NPCType(), - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.Probe, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.PlanterasTentacle, - NPCID.Spore, - ModContent.NPCType(), - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.DetonatingBubble, - NPCID.Sharkron, - NPCID.Sharkron2, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.CultistBossClone, - NPCID.AncientCultistSquidhead, - NPCID.AncientLight, - NPCID.AncientDoom, - NPCID.MoonLordFreeEye, - NPCID.MoonLordLeechBlob, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() - }; - - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (CalamityConfig.Instance.BuffThoriumBosses && thorium != null) - { - enemyImmunityList.Add(thorium.NPCType("TheGrandThunderBirdv2")); - enemyImmunityList.Add(thorium.NPCType("QueenJelly")); - enemyImmunityList.Add(thorium.NPCType("Viscount")); - enemyImmunityList.Add(thorium.NPCType("GraniteEnergyStorm")); - enemyImmunityList.Add(thorium.NPCType("TheBuriedWarrior")); - enemyImmunityList.Add(thorium.NPCType("ThePrimeScouter")); - enemyImmunityList.Add(thorium.NPCType("BoreanStrider")); - enemyImmunityList.Add(thorium.NPCType("BoreanStriderPopped")); - enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder")); - enemyImmunityList.Add(thorium.NPCType("FallenDeathBeholder2")); - enemyImmunityList.Add(thorium.NPCType("Lich")); - enemyImmunityList.Add(thorium.NPCType("LichHeadless")); - enemyImmunityList.Add(thorium.NPCType("Abyssion")); - enemyImmunityList.Add(thorium.NPCType("AbyssionCracked")); - enemyImmunityList.Add(thorium.NPCType("AbyssionReleased")); - enemyImmunityList.Add(thorium.NPCType("SlagFury")); - enemyImmunityList.Add(thorium.NPCType("Omnicide")); - enemyImmunityList.Add(thorium.NPCType("RealityBreaker")); - enemyImmunityList.Add(thorium.NPCType("Aquaius")); - enemyImmunityList.Add(thorium.NPCType("Aquaius2")); - - revengeanceEnemyBuffList25Percent.Add(thorium.NPCType("TheGrandThunderBirdv2")); - revengeanceEnemyBuffList25Percent.Add(thorium.NPCType("QueenJelly")); - revengeanceEnemyBuffList20Percent.Add(thorium.NPCType("Viscount")); - revengeanceEnemyBuffList20Percent.Add(thorium.NPCType("GraniteEnergyStorm")); - revengeanceEnemyBuffList20Percent.Add(thorium.NPCType("TheBuriedWarrior")); - revengeanceEnemyBuffList20Percent.Add(thorium.NPCType("ThePrimeScouter")); - revengeanceEnemyBuffList20Percent.Add(thorium.NPCType("BoreanStrider")); - revengeanceEnemyBuffList20Percent.Add(thorium.NPCType("BoreanStriderPopped")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("FallenDeathBeholder")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("FallenDeathBeholder2")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("Lich")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("LichHeadless")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("Abyssion")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("AbyssionCracked")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("AbyssionReleased")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("SlagFury")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("Omnicide")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("RealityBreaker")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("Aquaius")); - revengeanceEnemyBuffList15Percent.Add(thorium.NPCType("Aquaius2")); - - revengeanceProjectileBuffList25Percent.Add(thorium.ProjectileType("GrandThunderBirdZap")); - revengeanceProjectileBuffList25Percent.Add(thorium.ProjectileType("ThunderGust")); - revengeanceProjectileBuffList25Percent.Add(thorium.ProjectileType("BubbleBomb")); - revengeanceProjectileBuffList25Percent.Add(thorium.ProjectileType("QueenJellyArm")); - revengeanceProjectileBuffList25Percent.Add(thorium.ProjectileType("QueenTorrent")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("ViscountRipple")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("ViscountRipple2")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("ViscountBlood")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("ViscountStomp")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("ViscountStomp2")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("ViscountRockFall")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("GraniteCharge")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedShock")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedDagger")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedArrow")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedArrow2")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedArrowF")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedArrowP")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedArrowC")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedMagic")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("BuriedMagicPop")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("MainBeamOuter")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("MainBeam")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("MainBeamCheese")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("VaporizeBlast")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("GravitonSurge")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("Vaporize")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("GravitonCharge")); - revengeanceProjectileBuffList20Percent.Add(thorium.ProjectileType("GravitySpark")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("DoomBeholderBeam")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("VoidLaserPro")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("BeholderBeam")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("BlizzardBarrage")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FrostSurge")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FrostSurgeR")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("BlizzardCascade")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("BlizzardBoom")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("BlizzardFang")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FrostMytePro")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("IceAnomaly")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichGaze")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichGazeB")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichFlareSpawn")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichFlare")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichPulse")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichMatter")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("SoulRenderLich")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichFlareDeathD")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("LichFlareDeathU")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("Whirlpool")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("AbyssionSpit")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("AbyssionSpit2")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("AquaRipple")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("AbyssalStrike2")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("OldGodSpit")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("OldGodSpit2")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("WaterPulse")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("TyphoonBlastHostile")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("TyphoonBlastHostileSmaller")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("AquaBarrage")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("DeathRaySpawnR")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("DeathRaySpawnL")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("DeathRaySpawn")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("OmniDeath")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("OmniSphereOrb")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FlameLash")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FlamePulse")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FlamePulseTorn")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("FlameNova")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("MoltenFury")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("RealityFury")); - revengeanceProjectileBuffList15Percent.Add(thorium.ProjectileType("UFOBlast")); - } - - legOverrideList = new List() - { - Instance.GetEquipSlot("ProviLegs", EquipType.Legs), - Instance.GetEquipSlot("SirenLegAlt", EquipType.Legs), - Instance.GetEquipSlot("SirenLeg", EquipType.Legs), - Instance.GetEquipSlot("PopoLeg", EquipType.Legs) - }; + // in-game ModConfig saving from mod code is not supported yet in tmodloader, and subject to change, so we need to be extra careful. + // This code only supports client configs, and doesn't call onchanged. It also doesn't support ReloadRequired or anything else. + MethodInfo saveMethodInfo = typeof(ConfigManager).GetMethod("Save", BindingFlags.Static | BindingFlags.NonPublic); + if (saveMethodInfo != null) + saveMethodInfo.Invoke(null, new object[] { cfg }); + else + Instance.Logger.Warn("In-game SaveConfig failed, code update required"); } #endregion @@ -2958,14 +413,14 @@ namespace CalamityMod { NPCID.Crab, 0.05f }, { NPCID.Crawdad, 0.2f }, { NPCID.Crawdad2, 0.2f }, - { NPCID.CultistBoss, 0.1f }, + { NPCID.CultistBoss, 0.15f }, { NPCID.DD2Betsy, 0.1f }, { NPCID.DD2OgreT2, 0.1f }, { NPCID.DD2OgreT3, 0.15f }, { NPCID.DeadlySphere, 0.4f }, { NPCID.DiabolistRed, 0.2f }, { NPCID.DiabolistWhite, 0.2f }, - { NPCID.DukeFishron, 0.1f }, + { NPCID.DukeFishron, 0.15f }, { NPCID.DungeonGuardian, 0.999999f }, { NPCID.DungeonSpirit, 0.2f }, { NPCID.ElfCopter, 0.15f }, @@ -2999,9 +454,9 @@ namespace CalamityMod { NPCID.MartianTurret, 0.2f }, { NPCID.MartianWalker, 0.35f }, { NPCID.Mimic, 0.3f }, - { NPCID.MoonLordCore, 0.05f }, - { NPCID.MoonLordHand, 0.05f }, - { NPCID.MoonLordHead, 0.05f }, + { NPCID.MoonLordCore, 0.15f }, + { NPCID.MoonLordHand, 0.15f }, + { NPCID.MoonLordHead, 0.15f }, { NPCID.Mothron, 0.2f }, { NPCID.MothronEgg, 0.5f }, { NPCID.MourningWood, 0.1f }, @@ -3010,9 +465,9 @@ namespace CalamityMod { NPCID.Paladin, 0.45f }, { NPCID.PirateCaptain, 0.05f }, { NPCID.PirateShipCannon, 0.15f }, - { NPCID.Plantera, 0.15f }, - { NPCID.PlanterasTentacle, 0.1f }, - { NPCID.PossessedArmor, 0.25f }, + { NPCID.Plantera, 0.15f }, + { NPCID.PlanterasTentacle, 0.1f }, + { NPCID.PossessedArmor, 0.25f }, { NPCID.PresentMimic, 0.3f }, { NPCID.PrimeCannon, 0.2f }, { NPCID.PrimeLaser, 0.2f }, @@ -3050,258 +505,235 @@ namespace CalamityMod } #endregion - #region Thorium Boss DR - private void SetupThoriumBossDR(Mod thorium) + #region Boss Kill Times + private void SetupBossKillTimes() { - if (thorium is null || !CalamityConfig.Instance.BuffThoriumBosses) - return; + // 3600 = 1 minute - void ThoriumDR(string npcName, float dr) { - int type = thorium.NPCType(npcName); - if (DRValues.ContainsKey(type)) - DRValues[type] = dr; - else - DRValues.Add(type, dr); - }; - - ThoriumDR("Viscount", 0.05f); - ThoriumDR("BoreanStrider", 0.05f); - ThoriumDR("FallenDeathBeholder", 0.05f); - ThoriumDR("Lich", 0.05f); - ThoriumDR("AbyssionReleased", 0.05f); - ThoriumDR("CryoCore", 0.1f); - ThoriumDR("BioCore", 0.1f); - ThoriumDR("PyroCore", 0.1f); - ThoriumDR("Aquaius", 0.1f); - ThoriumDR("ThePrimeScouter", 0.2f); - ThoriumDR("FallenDeathBeholder2", 0.2f); - ThoriumDR("SlagFury", 0.2f); - ThoriumDR("Aquaius2", 0.2f); - ThoriumDR("GraniteEnergyStorm", 0.2f); - ThoriumDR("TheBuriedWarrior", 0.25f); - ThoriumDR("TheBuriedWarrior1", 0.25f); - ThoriumDR("TheBuriedWarrior2", 0.25f); - ThoriumDR("LichHeadless", 0.25f); - ThoriumDR("AbyssionCracked", 0.25f); - ThoriumDR("Omnicide", 0.3f); - ThoriumDR("Abyssion", 0.35f); - } - #endregion - - #region Boss Kill Times - private void SetupBossKillTimes() - { - // 3600 = 1 minute - - bossKillTimes = new SortedDictionary { - { NPCID.KingSlime, 3600 }, - { NPCID.EyeofCthulhu, 5400 }, - { NPCID.EaterofWorldsHead, 7200 }, - { NPCID.EaterofWorldsBody, 7200 }, - { NPCID.EaterofWorldsTail, 7200 }, - { NPCID.BrainofCthulhu, 5400 }, - { NPCID.Creeper, 1800 }, - { NPCID.QueenBee, 7200 }, - { NPCID.SkeletronHead, 9000 }, - { NPCID.WallofFlesh, 7200 }, - { NPCID.WallofFleshEye, 7200 }, - { NPCID.Spazmatism, 10800 }, - { NPCID.Retinazer, 10800 }, - { NPCID.TheDestroyer, 10800 }, + bossKillTimes = new SortedDictionary { + { NPCID.KingSlime, 3600 }, + { NPCID.EyeofCthulhu, 5400 }, + { NPCID.EaterofWorldsHead, 7200 }, + { NPCID.EaterofWorldsBody, 7200 }, + { NPCID.EaterofWorldsTail, 7200 }, + { NPCID.BrainofCthulhu, 5400 }, + { NPCID.Creeper, 1800 }, + { NPCID.QueenBee, 7200 }, + { NPCID.SkeletronHead, 9000 }, + { NPCID.WallofFlesh, 7200 }, + { NPCID.WallofFleshEye, 7200 }, + { NPCID.Spazmatism, 10800 }, + { NPCID.Retinazer, 10800 }, + { NPCID.TheDestroyer, 10800 }, { NPCID.TheDestroyerBody, 10800 }, - { NPCID.TheDestroyerTail, 10800 }, - { NPCID.SkeletronPrime, 10800 }, - { NPCID.Plantera, 10800 }, - { NPCID.Golem, 9000 }, - { NPCID.GolemHead, 3600 }, - { NPCID.DukeFishron, 9000 }, - { NPCID.CultistBoss, 9000 }, - { NPCID.MoonLordCore, 14400 }, - { NPCID.MoonLordHand, 7200 }, - { NPCID.MoonLordHead, 7200 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 1800 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 3600 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 1200 }, - { ModContent.NPCType(), 11400 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 14400 }, + { NPCID.TheDestroyerTail, 10800 }, + { NPCID.SkeletronPrime, 10800 }, + { NPCID.Plantera, 10800 }, + { NPCID.Golem, 9000 }, + { NPCID.GolemHead, 3600 }, + { NPCID.DukeFishron, 9000 }, + { NPCID.CultistBoss, 9000 }, + { NPCID.MoonLordCore, 14400 }, + { NPCID.MoonLordHand, 7200 }, + { NPCID.MoonLordHead, 7200 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 1800 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 3600 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 14400 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 14400 }, + { ModContent.NPCType(), 10800 }, { ModContent.NPCType(), 1200 }, - { ModContent.NPCType(), 1200 }, - { ModContent.NPCType(), 1200 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 7200 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 5400 }, - { ModContent.NPCType(), 9000 }, - { ModContent.NPCType(), 9000 }, - { ModContent.NPCType(), 9000 }, - { ModContent.NPCType(), 10800 }, - { ModContent.NPCType(), 18000 } + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 7200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 5400 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 9000 }, + { ModContent.NPCType(), 15300 }, + { ModContent.NPCType(), 18000 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 21600 }, + { ModContent.NPCType(), 18000 } }; - } - #endregion + } + #endregion - #region Boss Velocity Contact Damage Scale Values - private void SetupBossVelocityScalingValues() - { - bossVelocityDamageScaleValues = new SortedDictionary { - { NPCID.KingSlime, velocityScaleMin }, - { NPCID.EyeofCthulhu, velocityScaleMin }, // Increases in phase 2 - { NPCID.EaterofWorldsHead, bitingEnemeyVelocityScale }, - { NPCID.EaterofWorldsBody, velocityScaleMin }, - { NPCID.EaterofWorldsTail, velocityScaleMin }, - { NPCID.Creeper, velocityScaleMin }, - { NPCID.BrainofCthulhu, velocityScaleMin }, - { NPCID.QueenBee, velocityScaleMin }, - { NPCID.SkeletronHead, velocityScaleMin }, - { NPCID.SkeletronHand, velocityScaleMin }, - { NPCID.TheHungry, bitingEnemeyVelocityScale }, - { NPCID.TheHungryII, bitingEnemeyVelocityScale }, - { NPCID.LeechHead, bitingEnemeyVelocityScale }, - { NPCID.LeechBody, velocityScaleMin }, - { NPCID.LeechTail, velocityScaleMin }, - { NPCID.Spazmatism, velocityScaleMin }, // Increases in phase 2 - { NPCID.Retinazer, velocityScaleMin }, - { NPCID.TheDestroyer, bitingEnemeyVelocityScale }, - { NPCID.TheDestroyerBody, velocityScaleMin }, - { NPCID.TheDestroyerTail, velocityScaleMin }, - { NPCID.Probe, velocityScaleMin }, - { NPCID.SkeletronPrime, velocityScaleMin }, - { NPCID.PrimeCannon, velocityScaleMin }, - { NPCID.PrimeLaser, velocityScaleMin }, - { NPCID.PrimeSaw, velocityScaleMin }, - { NPCID.PrimeVice, velocityScaleMin }, - { NPCID.Plantera, velocityScaleMin }, // Increases in phase 2 - { NPCID.PlanterasTentacle, bitingEnemeyVelocityScale }, - { NPCID.Golem, velocityScaleMin }, - { NPCID.GolemFistLeft, velocityScaleMin }, - { NPCID.GolemFistRight, velocityScaleMin }, - { NPCID.GolemHead, velocityScaleMin }, - { NPCID.DukeFishron, velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), bitingEnemeyVelocityScale }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin }, - { ModContent.NPCType(), velocityScaleMin } + #region Boss Velocity Contact Damage Scale Values + private void SetupBossVelocityScalingValues() + { + bossVelocityDamageScaleValues = new SortedDictionary { + { NPCID.KingSlime, velocityScaleMin }, + { NPCID.EyeofCthulhu, velocityScaleMin }, // Increases in phase 2 + { NPCID.EaterofWorldsHead, bitingEnemeyVelocityScale }, + { NPCID.EaterofWorldsBody, velocityScaleMin }, + { NPCID.EaterofWorldsTail, velocityScaleMin }, + { NPCID.Creeper, velocityScaleMin }, + { NPCID.BrainofCthulhu, velocityScaleMin }, + { NPCID.QueenBee, velocityScaleMin }, + { NPCID.SkeletronHead, velocityScaleMin }, + { NPCID.SkeletronHand, velocityScaleMin }, + { NPCID.TheHungry, bitingEnemeyVelocityScale }, + { NPCID.TheHungryII, bitingEnemeyVelocityScale }, + { NPCID.LeechHead, bitingEnemeyVelocityScale }, + { NPCID.LeechBody, velocityScaleMin }, + { NPCID.LeechTail, velocityScaleMin }, + { NPCID.Spazmatism, velocityScaleMin }, // Increases in phase 2 + { NPCID.Retinazer, velocityScaleMin }, + { NPCID.TheDestroyer, bitingEnemeyVelocityScale }, + { NPCID.TheDestroyerBody, velocityScaleMin }, + { NPCID.TheDestroyerTail, velocityScaleMin }, + { NPCID.Probe, velocityScaleMin }, + { NPCID.SkeletronPrime, velocityScaleMin }, + { NPCID.PrimeCannon, velocityScaleMin }, + { NPCID.PrimeLaser, velocityScaleMin }, + { NPCID.PrimeSaw, velocityScaleMin }, + { NPCID.PrimeVice, velocityScaleMin }, + { NPCID.Plantera, velocityScaleMin }, // Increases in phase 2 + { NPCID.PlanterasTentacle, bitingEnemeyVelocityScale }, + { NPCID.Golem, velocityScaleMin }, + { NPCID.GolemFistLeft, velocityScaleMin }, + { NPCID.GolemFistRight, velocityScaleMin }, + { NPCID.GolemHead, velocityScaleMin }, + { NPCID.DukeFishron, velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, // Increases in phase 2 + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), velocityScaleMin }, + { ModContent.NPCType(), bitingEnemeyVelocityScale } }; - } - #endregion + } + #endregion - #region Music - public override void UpdateMusic(ref int music, ref MusicPriority priority) + #region Music + + // This function returns an available Calamity Music Mod track, or null if the Calamity Music Mod is not available. + public int? GetMusicFromMusicMod(string songFilename) => MusicAvailable ? (int?)musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/" + songFilename) : null; + + public override void UpdateMusic(ref int music, ref MusicPriority priority) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (Main.musicVolume != 0) { if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) @@ -3311,10 +743,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag"); - else - music = MusicID.Eerie; + music = GetMusicFromMusicMod("Crag") ?? MusicID.Eerie; priority = MusicPriority.Environment; } } @@ -3322,10 +751,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea"); - else - music = MusicID.Temple; + music = GetMusicFromMusicMod("SunkenSea") ?? MusicID.Temple; priority = MusicPriority.Environment; } } @@ -3333,12 +759,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - { - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral"); - } - else - music = MusicID.Space; + music = GetMusicFromMusicMod("Astral") ?? MusicID.Space; priority = MusicPriority.Environment; } } @@ -3346,12 +767,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - { - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstralUnderground"); - } - else - music = MusicID.Space; + music = GetMusicFromMusicMod("AstralUnderground") ?? MusicID.Space; priority = MusicPriority.Environment; } } @@ -3359,10 +775,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss"); - else - music = MusicID.Hell; + music = GetMusicFromMusicMod("TheAbyss") ?? MusicID.Hell; priority = MusicPriority.BiomeHigh; } } @@ -3370,10 +783,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss"); - else - music = MusicID.Hell; + music = GetMusicFromMusicMod("TheDeepAbyss") ?? MusicID.Hell; priority = MusicPriority.BiomeHigh; } } @@ -3381,10 +791,7 @@ namespace CalamityMod { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid"); - else - music = MusicID.Hell; + music = GetMusicFromMusicMod("TheVoid") ?? MusicID.Hell; priority = MusicPriority.BiomeHigh; } } @@ -3393,26 +800,24 @@ namespace CalamityMod if (!CalamityPlayer.areThereAnyDamnBosses) { bool acidRain = CalamityWorld.rainingAcid; - if (calamityModMusic != null) - { - string rainMusic = "Sounds/Music/AcidRain"; - string musicChoice = acidRain ? rainMusic + (CalamityWorld.downedPolterghast ? "2" : "1") : "Sounds/Music/Sulphur"; //replace first acidrain1 once second theme is added. - music = calamityModMusic.GetSoundSlot(SoundType.Music, musicChoice); - - } - else - music = acidRain ? CalamityWorld.downedPolterghast ? MusicID.Eclipse : MusicID.OldOnesArmy : MusicID.Desert; //if you have a better choice of music, feel free to change, it was pretty random choosing ngl priority = acidRain ? MusicPriority.Event : MusicPriority.BiomeHigh; + + // Acid Rain themes + if (acidRain) + music = CalamityWorld.downedPolterghast + ? GetMusicFromMusicMod("AcidRain2") ?? MusicID.Eclipse // Acid Rain Tier 3 + : GetMusicFromMusicMod("AcidRain1") ?? MusicID.OldOnesArmy; // Acid Rain Tier 1 + 2 + + // Regular Sulphur Sea theme, when Acid Rain is not occurring + else + music = GetMusicFromMusicMod("Sulphur") ?? MusicID.Desert; } } - if (CalamityWorld.DoGSecondStageCountdown <= 540 && CalamityWorld.DoGSecondStageCountdown > 60) //8 seconds before DoG spawns + if (CalamityWorld.DoGSecondStageCountdown <= 530 && CalamityWorld.DoGSecondStageCountdown > 50) // 8 seconds before DoG spawns { if (!CalamityPlayer.areThereAnyDamnBosses) { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; + music = GetMusicFromMusicMod("UniversalCollapse") ?? MusicID.LunarBoss; priority = MusicPriority.BossMedium; } } @@ -3421,7 +826,7 @@ namespace CalamityMod } #endregion - #region ModSupport + #region Mod Support public override void PostSetupContent() => WeakReferenceSupport.Setup(); public override object Call(params object[] args) => ModCalls.Call(args); @@ -3445,16 +850,24 @@ namespace CalamityMod layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Hologram", () => { - DraedonHologramChatUI.Draw(Main.spriteBatch); + LabHologramProjectorUI.Draw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); - layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Draedon Factory Tiles", () => + // For these layers, InterfaceScaleType.Game tells the game that this UI should take zoom into account. + // These must be separate layers or they will malfunction when hovering one at non-100% zoom. + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charging Station UI", () => { - DraedonsFactoryUI.Draw(Main.spriteBatch); - DraedonsItemChargerUI.Draw(Main.spriteBatch); + ChargingStationUI.Draw(Main.spriteBatch); return true; - }, InterfaceScaleType.Game)); // InterfaceScaleType.Game tells the game that this UI should take zoom into account. + }, InterfaceScaleType.Game)); + + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Power Cell Factory UI", () => + { + PowerCellFactoryUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.Game)); layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Boss HP Bars", delegate () { @@ -3466,6 +879,13 @@ namespace CalamityMod return true; }, InterfaceScaleType.None)); + // Mode Indicator UI. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Mode Indicator UI", delegate () + { + ModeIndicatorUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.UI)); + // Astral Arcanum overlay (if open) layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Astral Arcanum UI", delegate () { @@ -3487,6 +907,20 @@ namespace CalamityMod return true; }, InterfaceScaleType.None)); + // Charge meter + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Charge UI", () => + { + ChargeMeterUI.Draw(Main.spriteBatch, Main.LocalPlayer); + return true; + }, InterfaceScaleType.None)); + + // Calamitas Enchantment UI + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Calamitas Enchantment", () => + { + CalamitasEnchantUI.Draw(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); + // Popup GUIs. layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Popup GUIs", () => { @@ -3495,16 +929,13 @@ namespace CalamityMod }, InterfaceScaleType.None)); } - // Invasion UI (used for Acid Rain) + // Invasion UIs. int invasionIndex = layers.FindIndex(layer => layer.Name == "Vanilla: Diagnose Net"); if (invasionIndex != -1) { - layers.Insert(invasionIndex, new LegacyGameInterfaceLayer("Acid Rain Invasion UI", () => + layers.Insert(invasionIndex, new LegacyGameInterfaceLayer("Calamity Invasion UIs", () => { - if (CalamityWorld.rainingAcid) - { - AcidRainUI.Draw(Main.spriteBatch); - } + InvasionProgressUIManager.UpdateAndDraw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); } @@ -3975,257 +1406,64 @@ namespace CalamityMod #region Lighting const float MaxCaveDarkness = -0.3f; - const float MaxSignusDarkness = -0.4f; - const float MaxAbyssDarkness = -0.7f; + const float MaxSignusDarkness = -0.4f; + const float MaxAbyssDarkness = -0.7f; public override void ModifyLightingBrightness(ref float scale) { - // Apply the calculated darkness value for the local player. - CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); - float darkRatio = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 1f); + // Apply the calculated darkness value for the local player. + CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + float darkRatio = MathHelper.Clamp(modPlayer.caveDarkness, 0f, 1f); - if (modPlayer.ZoneAbyss) - scale += MaxAbyssDarkness * darkRatio; - else if (CalamityWorld.death) - scale += MaxCaveDarkness * darkRatio; + if (modPlayer.ZoneAbyss) + scale += MaxAbyssDarkness * darkRatio; + else if (CalamityWorld.death) + scale += MaxCaveDarkness * darkRatio; - if (CalamityWorld.revenge) - { - if (CalamityGlobalNPC.signus != -1) - { - if (Main.npc[CalamityGlobalNPC.signus].active) - { - if (Vector2.Distance(Main.LocalPlayer.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) - { - float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); - - // Reduce the power of Signus darkness based on your light level. - float multiplier = 1f; - switch (modPlayer.GetTotalLightStrength()) - { - case 0: - break; - case 1: - case 2: - multiplier = 0.75f; - break; - case 3: - case 4: - multiplier = 0.5f; - break; - case 5: - case 6: - multiplier = 0.25f; - break; - default: - multiplier = 0f; - break; - } - - // Increased darkness in Death Mode - if (CalamityWorld.death) - multiplier += (1f - multiplier) * 0.1f; - - // Total darkness - float signusDarkness = signusLifeRatio * multiplier; - darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); - scale += MaxSignusDarkness * darkRatio; - } - } - } - } - } - #endregion - - #region Packets - public override void HandlePacket(BinaryReader reader, int whoAmI) - { - try + if (CalamityWorld.revenge || CalamityWorld.malice) { - CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); - switch (msgType) + if (CalamityGlobalNPC.signus != -1) { - case CalamityModMessageType.MeleeLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0); - break; - case CalamityModMessageType.RangedLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1); - break; - case CalamityModMessageType.MagicLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2); - break; - case CalamityModMessageType.SummonLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3); - break; - case CalamityModMessageType.RogueLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4); - break; - case CalamityModMessageType.ExactMeleeLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0); - break; - case CalamityModMessageType.ExactRangedLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1); - break; - case CalamityModMessageType.ExactMagicLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2); - break; - case CalamityModMessageType.ExactSummonLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3); - break; - case CalamityModMessageType.ExactRogueLevelSync: - Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4); - break; - case CalamityModMessageType.StressSync: - Main.player[reader.ReadInt32()].Calamity().HandleStress(reader); - break; - case CalamityModMessageType.BossRushStage: - int stage = reader.ReadInt32(); - CalamityWorld.bossRushStage = stage; - break; - case CalamityModMessageType.AdrenalineSync: - Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader); - break; - case CalamityModMessageType.TeleportPlayer: - Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); - break; - case CalamityModMessageType.DoGCountdownSync: - int countdown = reader.ReadInt32(); - CalamityWorld.DoGSecondStageCountdown = countdown; - break; - case CalamityModMessageType.BossSpawnCountdownSync: - int countdown2 = reader.ReadInt32(); - CalamityWorld.bossSpawnCountdown = countdown2; - break; - case CalamityModMessageType.BRHostileProjKillSync: - int countdown3 = reader.ReadInt32(); - CalamityWorld.bossRushHostileProjKillCounter = countdown3; - break; - case CalamityModMessageType.DeathBossSpawnCountdownSync: - int countdown4 = reader.ReadInt32(); - CalamityWorld.deathBossSpawnCooldown = countdown4; - break; - case CalamityModMessageType.ArmoredDiggerCountdownSync: - int countdown5 = reader.ReadInt32(); - CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5; - break; - case CalamityModMessageType.BossTypeSync: - int type = reader.ReadInt32(); - CalamityWorld.bossType = type; - break; - case CalamityModMessageType.DeathCountSync: - Main.player[reader.ReadInt32()].Calamity().HandleDeathCount(reader); - break; - case CalamityModMessageType.DeathModeUnderworldTimeSync: - Main.player[reader.ReadInt32()].Calamity().HandleDeathModeUnderworldTime(reader); - break; - case CalamityModMessageType.DeathModeBlizzardTimeSync: - Main.player[reader.ReadInt32()].Calamity().HandleDeathModeBlizzardTime(reader); - break; - case CalamityModMessageType.RevengeanceBoolSync: - bool revActive = reader.ReadBoolean(); - CalamityWorld.revenge = revActive; - break; - case CalamityModMessageType.DeathBoolSync: - bool deathActive = reader.ReadBoolean(); - CalamityWorld.death = deathActive; - break; - case CalamityModMessageType.DefiledBoolSync: - bool defiledActive = reader.ReadBoolean(); - CalamityWorld.defiled = defiledActive; - break; - case CalamityModMessageType.IronHeartBoolSync: - bool ironHeartActive = reader.ReadBoolean(); - CalamityWorld.ironHeart = ironHeartActive; - break; - case CalamityModMessageType.ArmageddonBoolSync: - bool armaActive = reader.ReadBoolean(); - CalamityWorld.armageddon = armaActive; - break; - case CalamityModMessageType.DemonTrophyBoolSync: - bool demonModeBoost = reader.ReadBoolean(); - CalamityWorld.demonMode = demonModeBoost; - break; - case CalamityModMessageType.NPCRegenerationSync: - byte npcIndex = reader.ReadByte(); - Main.npc[npcIndex].lifeRegen = reader.ReadInt32(); - break; - case CalamityModMessageType.AcidRainSync: - CalamityWorld.rainingAcid = reader.ReadBoolean(); - CalamityWorld.acidRainPoints = reader.ReadInt32(); - CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32(); - break; - case CalamityModMessageType.AcidRainUIDrawFadeSync: - CalamityWorld.acidRainExtraDrawTime = reader.ReadInt32(); - break; - case CalamityModMessageType.AcidRainOldDukeSummonSync: - CalamityWorld.triedToSummonOldDuke = reader.ReadBoolean(); - break; - case CalamityModMessageType.GaelsGreatswordSwingSync: - byte playerIndex = reader.ReadByte(); - Main.player[playerIndex].Calamity().gaelSwipes = reader.ReadInt32(); - break; - case CalamityModMessageType.SpawnSuperDummy: - int x = reader.ReadInt32(); - int y = reader.ReadInt32(); - // Not strictly necessary, but helps prevent unnecessary packetstorm in MP - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(x, y, ModContent.NPCType()); - break; - case CalamityModMessageType.DraedonGeneratorStackSync: - int entityID = reader.ReadInt32(); - (TileEntity.ByID[entityID] as TEDraedonFuelFactory).HeldItem.type = reader.ReadInt32(); - (TileEntity.ByID[entityID] as TEDraedonFuelFactory).HeldItem.stack = reader.ReadInt32(); - break; - case CalamityModMessageType.DraedonChargerSync: - int entityID2 = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).FuelItem.type = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).FuelItem.stack = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).FuelItem.position = reader.ReadVector2(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).ItemBeingCharged.type = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).ItemBeingCharged.stack = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).ItemBeingCharged.prefix = reader.ReadByte(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).ItemBeingCharged.position = reader.ReadVector2(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).Charge = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).ChargeMax = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).ActiveTimer = reader.ReadInt32(); - (TileEntity.ByID[entityID2] as TEDraedonItemCharger).DepositWithdrawCooldown = reader.ReadInt32(); - break; - case CalamityModMessageType.DraedonFieldGeneratorSync: - int entityID3 = reader.ReadInt32(); - (TileEntity.ByID[entityID3] as TEDraedonFieldGenerator).Time = reader.ReadInt32(); - (TileEntity.ByID[entityID3] as TEDraedonFieldGenerator).ActiveTimer = reader.ReadInt32(); - break; - case CalamityModMessageType.SyncCalamityNPCAIArray: - byte npcIndex2 = reader.ReadByte(); - Main.npc[npcIndex2].Calamity().newAI[0] = reader.ReadSingle(); - Main.npc[npcIndex2].Calamity().newAI[1] = reader.ReadSingle(); - Main.npc[npcIndex2].Calamity().newAI[2] = reader.ReadSingle(); - Main.npc[npcIndex2].Calamity().newAI[3] = reader.ReadSingle(); - break; - case CalamityModMessageType.ProvidenceDyeConditionSync: - byte npcIndex3 = reader.ReadByte(); - (Main.npc[npcIndex3].modNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean(); - break; - case CalamityModMessageType.PSCChallengeSync: - byte npcIndex4 = reader.ReadByte(); - (Main.npc[npcIndex4].modNPC as Providence).challenge = reader.ReadBoolean(); - break; + if (Main.npc[CalamityGlobalNPC.signus].active) + { + if (Vector2.Distance(Main.LocalPlayer.Center, Main.npc[CalamityGlobalNPC.signus].Center) <= 5200f) + { + float signusLifeRatio = 1f - (Main.npc[CalamityGlobalNPC.signus].life / Main.npc[CalamityGlobalNPC.signus].lifeMax); - default: - Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); - break; + // Reduce the power of Signus darkness based on your light level. + float multiplier = 1f; + switch (modPlayer.GetTotalLightStrength()) + { + case 0: + break; + case 1: + case 2: + multiplier = 0.75f; + break; + case 3: + case 4: + multiplier = 0.5f; + break; + case 5: + case 6: + multiplier = 0.25f; + break; + default: + multiplier = 0f; + break; + } + + // Increased darkness in Death Mode + if (CalamityWorld.death || CalamityWorld.malice) + multiplier += (1f - multiplier) * 0.1f; + + // Total darkness + float signusDarkness = signusLifeRatio * multiplier; + darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); + scale += MaxSignusDarkness * darkRatio; + } + } } } - catch(Exception e) - { - if (e is EndOfStreamException eose) - Logger.Error("Failed to parse Calamity packet: Packet was too short, missing data, or otherwise corrupt.", eose); - else if (e is ObjectDisposedException ode) - Logger.Error("Failed to parse Calamity packet: Packet reader disposed or destroyed.", ode); - else if (e is IOException ioe) - Logger.Error("Failed to parse Calamity packet: An unknown I/O error occurred.", ioe); - else - throw e; // this either will crash the game or be caught by TML's packet policing - } } #endregion @@ -4235,71 +1473,16 @@ namespace CalamityMod if (!Main.raining) return; Main.raining = false; - UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } #endregion - #region Update Server Boolean - public static void UpdateServerBoolean() - { - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.WorldData, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - #endregion - } + #region Netcode + public override void HandlePacket(BinaryReader reader, int whoAmI) => CalamityNetcode.HandlePacket(this, reader, whoAmI); + #endregion - public enum Season : byte - { - Winter, - Spring, - Summer, - Fall - } - - enum CalamityModMessageType : byte - { - MeleeLevelSync, - RangedLevelSync, - MagicLevelSync, - SummonLevelSync, - RogueLevelSync, - ExactMeleeLevelSync, - ExactRangedLevelSync, - ExactMagicLevelSync, - ExactSummonLevelSync, - ExactRogueLevelSync, - StressSync, - AdrenalineSync, - TeleportPlayer, - BossRushStage, - DoGCountdownSync, - BossSpawnCountdownSync, - BRHostileProjKillSync, - ArmoredDiggerCountdownSync, - BossTypeSync, - DeathCountSync, - RevengeanceBoolSync, - DeathBoolSync, - DefiledBoolSync, - IronHeartBoolSync, - ArmageddonBoolSync, - DemonTrophyBoolSync, - NPCRegenerationSync, - DeathModeUnderworldTimeSync, - DeathModeBlizzardTimeSync, - DeathBossSpawnCountdownSync, - AcidRainSync, - AcidRainUIDrawFadeSync, - AcidRainOldDukeSummonSync, - GaelsGreatswordSwingSync, - SpawnSuperDummy, - SyncCalamityNPCAIArray, - ProvidenceDyeConditionSync, // We shouldn't fucking need this. Die in a hole, Multiplayer. - PSCChallengeSync, // See above - DraedonGeneratorStackSync, - DraedonChargerSync, - DraedonFieldGeneratorSync + #region Tile Entity Time Handler + public override void MidUpdateTimeWorld() => TileEntityTimeHandler.Update(); + #endregion } } diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs new file mode 100644 index 0000000000..bfcc9a9013 --- /dev/null +++ b/CalamityNetcode.cs @@ -0,0 +1,365 @@ +using CalamityMod.Events; +using CalamityMod.Items; +using CalamityMod.NPCs; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Providence; +using CalamityMod.TileEntities; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public class CalamityNetcode + { + public static void HandlePacket(Mod mod, BinaryReader reader, int whoAmI) + { + try + { + CalamityModMessageType msgType = (CalamityModMessageType)reader.ReadByte(); + switch (msgType) + { + // + // Proficiency levels + // + + case CalamityModMessageType.MeleeLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 0); + break; + case CalamityModMessageType.RangedLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 1); + break; + case CalamityModMessageType.MagicLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 2); + break; + case CalamityModMessageType.SummonLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 3); + break; + case CalamityModMessageType.RogueLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleLevels(reader, 4); + break; + case CalamityModMessageType.ExactMeleeLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 0); + break; + case CalamityModMessageType.ExactRangedLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 1); + break; + case CalamityModMessageType.ExactMagicLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 2); + break; + case CalamityModMessageType.ExactSummonLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 3); + break; + case CalamityModMessageType.ExactRogueLevelSync: + Main.player[reader.ReadInt32()].Calamity().HandleExactLevels(reader, 4); + break; + + // + // Core stat syncs + // + + case CalamityModMessageType.MoveSpeedStatSync: + Main.player[reader.ReadInt32()].Calamity().HandleMoveSpeedStat(reader); + break; + case CalamityModMessageType.DefenseDamageSync: + Main.player[reader.ReadInt32()].Calamity().HandleDefenseDamage(reader); + break; + case CalamityModMessageType.RageSync: + Main.player[reader.ReadInt32()].Calamity().HandleRage(reader); + break; + case CalamityModMessageType.AdrenalineSync: + Main.player[reader.ReadInt32()].Calamity().HandleAdrenaline(reader); + break; + case CalamityModMessageType.DodgeCooldown: + Main.player[reader.ReadInt32()].Calamity().HandleDodgeCooldown(reader); + break; + case CalamityModMessageType.DeathCountSync: + Main.player[reader.ReadInt32()].Calamity().HandleDeathCount(reader); + break; + + // + // Syncs for specific bosses or entities + // + + // This code has been edited to fail gracefully when trying to provide data for an invalid NPC. + case CalamityModMessageType.SyncCalamityNPCAIArray: + // Read the entire packet regardless of anything + byte npcIdx = reader.ReadByte(); + float ai0 = reader.ReadSingle(); + float ai1 = reader.ReadSingle(); + float ai2 = reader.ReadSingle(); + float ai3 = reader.ReadSingle(); + + // If the NPC in question isn't valid, don't do anything. + NPC npc = Main.npc[npcIdx]; + if (!npc.active) + break; + + CalamityGlobalNPC cgn = npc.Calamity(); + cgn.newAI[0] = ai0; + cgn.newAI[1] = ai1; + cgn.newAI[2] = ai2; + cgn.newAI[3] = ai3; + break; + case CalamityModMessageType.SpawnSuperDummy: + int x = reader.ReadInt32(); + int y = reader.ReadInt32(); + // Not strictly necessary, but helps prevent unnecessary packetstorm in MP + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC(x, y, ModContent.NPCType()); + break; + case CalamityModMessageType.DeleteAllSuperDummies: + if (Main.netMode != NetmodeID.MultiplayerClient) + SuperDummy.DeleteDummies(); + break; + case CalamityModMessageType.ServersideSpawnOldDuke: + byte playerIndex2 = reader.ReadByte(); + CalamityUtils.SpawnOldDuke(playerIndex2); + break; + case CalamityModMessageType.DoGCountdownSync: + int countdown = reader.ReadInt32(); + CalamityWorld.DoGSecondStageCountdown = countdown; + break; + case CalamityModMessageType.ArmoredDiggerCountdownSync: + int countdown5 = reader.ReadInt32(); + CalamityWorld.ArmoredDiggerSpawnCooldown = countdown5; + break; + case CalamityModMessageType.ProvidenceDyeConditionSync: + byte npcIndex3 = reader.ReadByte(); + (Main.npc[npcIndex3].modNPC as Providence).hasTakenDaytimeDamage = reader.ReadBoolean(); + break; + case CalamityModMessageType.PSCChallengeSync: + byte npcIndex4 = reader.ReadByte(); + (Main.npc[npcIndex4].modNPC as Providence).challenge = reader.ReadBoolean(); + break; + + // + // General syncs for entities + // + + case CalamityModMessageType.SpawnNPCOnPlayer: + x = reader.ReadInt32(); + y = reader.ReadInt32(); + int npcType = reader.ReadInt32(); + int player = reader.ReadInt32(); + Vector2 spawnPosition = reader.ReadVector2(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spawnedNPC = NPC.NewNPC(x, y, npcType, Target: player); + NetMessage.SendData(MessageID.SyncNPC, -1, player, null, spawnedNPC); + } + break; + case CalamityModMessageType.SyncNPCMotionDataToServer: + int npcIndex = reader.ReadInt32(); + Vector2 center = reader.ReadVector2(); + Vector2 velocity = reader.ReadVector2(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.npc[npcIndex].Center = center; + Main.npc[npcIndex].velocity = velocity; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcIndex); + } + break; + + // + // Tile Entities + // + + case CalamityModMessageType.PowerCellFactory: + TEPowerCellFactory.ReadSyncPacket(mod, reader); + break; + case CalamityModMessageType.ChargingStationStandard: + TEChargingStation.ReadSyncPacket(mod, reader); + break; + case CalamityModMessageType.ChargingStationItemChange: + TEChargingStation.ReadItemSyncPacket(mod, reader); + break; + case CalamityModMessageType.Turret: + TEBaseTurret.ReadSyncPacket(mod, reader); + break; + case CalamityModMessageType.LabHologramProjector: + TELabHologramProjector.ReadSyncPacket(mod, reader); + break; + + // + // Boss Rush + // + + case CalamityModMessageType.BossRushStage: + int stage = reader.ReadInt32(); + BossRushEvent.BossRushStage = stage; + break; + case CalamityModMessageType.BossSpawnCountdownSync: + int countdown2 = reader.ReadInt32(); + CalamityWorld.bossSpawnCountdown = countdown2; + break; + case CalamityModMessageType.BossTypeSync: + int type = reader.ReadInt32(); + CalamityWorld.bossType = type; + break; + case CalamityModMessageType.BRHostileProjKillSync: + int countdown3 = reader.ReadInt32(); + CalamityWorld.bossRushHostileProjKillCounter = countdown3; + break; + case CalamityModMessageType.TeleportPlayer: + Main.player[reader.ReadInt32()].Calamity().HandleTeleport(reader.ReadInt32(), true, whoAmI); + break; + + // + // Acid Rain + // + + case CalamityModMessageType.AcidRainSync: + CalamityWorld.rainingAcid = reader.ReadBoolean(); + CalamityWorld.acidRainPoints = reader.ReadInt32(); + CalamityWorld.timeSinceAcidRainKill = reader.ReadInt32(); + break; + case CalamityModMessageType.AcidRainOldDukeSummonSync: + CalamityWorld.triedToSummonOldDuke = reader.ReadBoolean(); + break; + case CalamityModMessageType.EncounteredOldDukeSync: + CalamityWorld.encounteredOldDuke = reader.ReadBoolean(); + break; + + // + // Death Mode environmental syncs + // + + case CalamityModMessageType.DeathModeUnderworldTimeSync: + Main.player[reader.ReadInt32()].Calamity().HandleDeathModeUnderworldTime(reader); + break; + case CalamityModMessageType.DeathModeBlizzardTimeSync: + Main.player[reader.ReadInt32()].Calamity().HandleDeathModeBlizzardTime(reader); + break; + case CalamityModMessageType.DeathBossSpawnCountdownSync: + int countdown4 = reader.ReadInt32(); + CalamityWorld.deathBossSpawnCooldown = countdown4; + break; + + // + // Reforge syncs + // + + case CalamityModMessageType.ItemTypeLastReforgedSync: + Main.player[reader.ReadInt32()].Calamity().HandleItemTypeLastReforged(reader); + break; + case CalamityModMessageType.ReforgeTierSafetySync: + Main.player[reader.ReadInt32()].Calamity().HandleReforgeTierSafety(reader); + break; + + // + // Default case: with no idea how long the packet is, we can't safely read data. + // Throw an exception now instead of allowing the network stream to corrupt. + // + default: + CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); + throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID."); + } + } + catch (Exception e) + { + if (e is EndOfStreamException eose) + CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: Packet was too short, missing data, or otherwise corrupt.", eose); + else if (e is ObjectDisposedException ode) + CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: Packet reader disposed or destroyed.", ode); + else if (e is IOException ioe) + CalamityMod.Instance.Logger.Error("Failed to parse Calamity packet: An unknown I/O error occurred.", ioe); + else + throw e; // this either will crash the game or be caught by TML's packet policing + } + } + + public static void SyncWorld() + { + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.WorldData); + } + + public static void NewNPC_ClientSide(Vector2 spawnPosition, int npcType, Player player) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, npcType, Target: player.whoAmI); + return; + } + + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SpawnNPCOnPlayer); + netMessage.Write((int)spawnPosition.X); + netMessage.Write((int)spawnPosition.Y); + netMessage.Write(npcType); + netMessage.Write(player.whoAmI); + netMessage.Send(); + } + } + + public enum CalamityModMessageType : byte + { + // Proficiency levels + // TODO -- simplify proficiency netcode, there do not need to be this many separate packet types + MeleeLevelSync, + RangedLevelSync, + MagicLevelSync, + SummonLevelSync, + RogueLevelSync, + ExactMeleeLevelSync, + ExactRangedLevelSync, + ExactMagicLevelSync, + ExactSummonLevelSync, + ExactRogueLevelSync, + + // Core stat syncs + MoveSpeedStatSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is + DefenseDamageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced when the player gets hit, or every time it heals up + RageSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is + AdrenalineSync, // TODO -- this can't be synced every 60 frames, it needs to be synced every time the player is + DodgeCooldown, + DeathCountSync, // TODO -- this is synced in numerous incorrect places, Armageddon deaths count twice, and it supposedly counts every time you log in + + // Syncs for specific bosses or entities + SyncCalamityNPCAIArray, + SpawnSuperDummy, + DeleteAllSuperDummies, + ServersideSpawnOldDuke, + DoGCountdownSync, // TODO -- this gets written in about six thousand places which all need to be individually evaluated + ArmoredDiggerCountdownSync, // TODO -- remove this mechanic entirely + ProvidenceDyeConditionSync, // TODO -- this packetstorms if you hit Provi with spam weapons. It should ONLY send a packet if the status changes. + PSCChallengeSync, // TODO -- once you've failed the PSC challenge this packetstorms + + // General things for entities + SpawnNPCOnPlayer, + SyncNPCMotionDataToServer, + + // Tile Entities + PowerCellFactory, + ChargingStationStandard, + ChargingStationItemChange, + Turret, + LabHologramProjector, + + // Boss Rush + BossRushStage, + BossSpawnCountdownSync, + BossTypeSync, + BRHostileProjKillSync, // TODO -- Simplify this. Only one packet needs be sent: "kill all hostile projectiles for N frames". + TeleportPlayer, // also used by Astral Arcanum. + + // Acid Rain + AcidRainSync, + AcidRainOldDukeSummonSync, + EncounteredOldDukeSync, + + // Death Mode environmental syncs + DeathModeUnderworldTimeSync, // TODO -- Rename to heat time. This should be synced every 15 frames. + DeathModeBlizzardTimeSync, // TODO -- Rename to cold time. This should be synced every 15 frames. + DeathBossSpawnCountdownSync, // TODO -- This currently syncs every frame and shouldn't. It only needs to sync once, when the countdown starts. + + // Reforge syncs + ItemTypeLastReforgedSync, // TODO -- there has to be a better way to do this, but I don't know what it is + ReforgeTierSafetySync, + } +} diff --git a/DataStructures/BaseBossSpawnContext.cs b/DataStructures/BaseBossSpawnContext.cs new file mode 100644 index 0000000000..6fcbce1d88 --- /dev/null +++ b/DataStructures/BaseBossSpawnContext.cs @@ -0,0 +1,9 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.DataStructures +{ + public abstract class BaseBossSpawnContext + { + public abstract Vector2 DetermineSpawnPosition(Vector2 relativePosition); + } +} diff --git a/Utilities/BezierCurve.cs b/DataStructures/BezierCurve.cs similarity index 61% rename from Utilities/BezierCurve.cs rename to DataStructures/BezierCurve.cs index 0076f82598..5bc5fb5efc 100644 --- a/Utilities/BezierCurve.cs +++ b/DataStructures/BezierCurve.cs @@ -1,37 +1,24 @@ using Microsoft.Xna.Framework; using System.Collections.Generic; -namespace CalamityMod +namespace CalamityMod.DataStructures { public class BezierCurve { public Vector2[] ControlPoints; - public BezierCurve(params Vector2[] controls) - { - ControlPoints = controls; - } + public BezierCurve(params Vector2[] controls) => ControlPoints = controls; - public Vector2 Evaluate(float T) - { - if (T < 0f) - T = 0f; - if (T > 1f) - T = 1f; + public Vector2 Evaluate(float interpolant) => PrivateEvaluate(ControlPoints, MathHelper.Clamp(interpolant, 0f, 1f)); - return PrivateEvaluate(ControlPoints, T); - } - - public List GetPoints(int amount) + public List GetPoints(int totalPoints) { - float perStep = 1f / amount; + float perStep = 1f / totalPoints; List points = new List(); for (float step = 0f; step <= 1f; step += perStep) - { points.Add(Evaluate(step)); - } return points; } @@ -42,15 +29,12 @@ namespace CalamityMod { Vector2[] nextPoints = new Vector2[points.Length - 1]; for (int k = 0; k < points.Length - 1; k++) - { nextPoints[k] = Vector2.Lerp(points[k], points[k + 1], T); - } + return PrivateEvaluate(nextPoints, T); } else - { return Vector2.Lerp(points[0], points[1], T); - } } } } diff --git a/DataStructures/Circle.cs b/DataStructures/Circle.cs new file mode 100644 index 0000000000..778fd6c1a6 --- /dev/null +++ b/DataStructures/Circle.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; + +namespace CalamityMod.DataStructures +{ + public struct Circle + { + public float Radius; + public Vector2 Center; + + public Circle(Vector2 center, float radius) + { + Center = center; + Radius = radius; + } + + private Vector2 RandomPointUnitCircle() => Main.rand.NextVector2Unit() * (float)Math.Sqrt(Main.rand.NextDouble()); + + public Vector2 RandomPointInCircle() => Center + RandomPointUnitCircle() * Radius; + + public Vector2 RandomPointOnCircleEdge() + { + Vector2 v = RandomPointUnitCircle(); + // Normalise so point is on edge of unit circle. + v.Normalize(); + return Center + v * Radius; + } + } +} diff --git a/DataStructures/DeadMinionProperties.cs b/DataStructures/DeadMinionProperties.cs new file mode 100644 index 0000000000..b455114663 --- /dev/null +++ b/DataStructures/DeadMinionProperties.cs @@ -0,0 +1,101 @@ +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.DataStructures +{ + public class DeadMinionProperties + { + public int Type; + public int OriginalDamage; + public float RequiredMinionSlots; + public float OriginalKnockback; + public float[] AIValues; + public virtual bool DisallowMultipleEntries => false; + public DeadMinionProperties(int type, float requiredMinionSlots, int originalDamage, float originalKnockback, float[] aiValues) + { + Type = type; + RequiredMinionSlots = requiredMinionSlots; + OriginalDamage = originalDamage; + AIValues = aiValues; + OriginalKnockback = originalKnockback; + } + + public virtual void SummonCopy(int ownerIndex) + { + if (Main.myPlayer != ownerIndex) + return; + + Player owner = Main.player[ownerIndex]; + int copy = Projectile.NewProjectile(owner.Center, Vector2.Zero, Type, OriginalDamage, OriginalKnockback, ownerIndex, AIValues[0], AIValues[1]); + + if (Main.projectile.IndexInRange(copy)) + { + Main.projectile[copy].Calamity().RequiresManualResurrection = true; + + // Set the amount of slots as needed for the minion. + // This is specifically done for logarithmic minions and should have no negative affect on anything else. + Main.projectile[copy].minionSlots = RequiredMinionSlots; + } + } + } + + public class DeadEndoHydraProperties : DeadMinionProperties + { + public int HeadCount; + public override bool DisallowMultipleEntries => true; + public DeadEndoHydraProperties(int headCount, int originalDamage, float originalKnockback) + : base(ModContent.ProjectileType(), 0f, originalDamage, originalKnockback, null) + { + HeadCount = headCount; + + // The minion slot decalaration is explicitly layed out in this child constructor instead of in the parent + // parameter for extra clarity. + RequiredMinionSlots = HeadCount; + } + + public override void SummonCopy(int ownerIndex) + { + if (Main.myPlayer != ownerIndex || HeadCount <= 0) + return; + + Player owner = Main.player[ownerIndex]; + int body = Projectile.NewProjectile(owner.Center, Vector2.Zero, ModContent.ProjectileType(), OriginalDamage, OriginalKnockback, owner.whoAmI); + + // If there was not enough space for even the body to be created, don't both trying to create even more projectiles needlessly. + if (!Main.projectile.IndexInRange(body)) + return; + + while (HeadCount > 0) + { + Projectile.NewProjectile(owner.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), OriginalDamage, OriginalKnockback, owner.whoAmI, body); + HeadCount--; + } + } + } + + public class DeadEndoCooperProperties : DeadMinionProperties + { + public int AttackMode; + public override bool DisallowMultipleEntries => true; + public DeadEndoCooperProperties(int attackMode, float requiredMinionSlots, int originalDamage, float originalKnockback) + : base(ModContent.ProjectileType(), requiredMinionSlots, originalDamage, originalKnockback, null) + { + AttackMode = attackMode; + } + + public override void SummonCopy(int ownerIndex) + { + if (Main.myPlayer != ownerIndex) + return; + + Player owner = Main.player[ownerIndex]; + Endogenesis.SummonEndoCooper(AttackMode, Main.MouseWorld, OriginalDamage, OriginalKnockback, owner, out int bodyIndex, out int limbsIndex); + Main.projectile[bodyIndex].Calamity().RequiresManualResurrection = true; + Main.projectile[limbsIndex].Calamity().RequiresManualResurrection = true; + } + } +} diff --git a/DataStructures/ExactPositionBossSpawnContext.cs b/DataStructures/ExactPositionBossSpawnContext.cs new file mode 100644 index 0000000000..f5c81f9b5b --- /dev/null +++ b/DataStructures/ExactPositionBossSpawnContext.cs @@ -0,0 +1,9 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.DataStructures +{ + public class ExactPositionBossSpawnContext : BaseBossSpawnContext + { + public override Vector2 DetermineSpawnPosition(Vector2 relativePosition) => relativePosition; + } +} diff --git a/DataStructures/OffscreenBossSpawnContext.cs b/DataStructures/OffscreenBossSpawnContext.cs new file mode 100644 index 0000000000..005ebeb21c --- /dev/null +++ b/DataStructures/OffscreenBossSpawnContext.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; + +namespace CalamityMod.DataStructures +{ + public class OffscreenBossSpawnContext : BaseBossSpawnContext + { + public override Vector2 DetermineSpawnPosition(Vector2 relativePosition) + { + Vector2 exactPosition = relativePosition; + + // Determine the position based on a circlular offset that is always 10% away from the screen points. + exactPosition += Main.rand.NextVector2CircularEdge(Main.screenWidth, Main.screenHeight) * (float)Math.Sqrt(2f) * 1.1f * 0.5f; + return exactPosition; + } + } +} diff --git a/Dusts/AstralBasic.cs b/Dusts/AstralBasic.cs index f771e84cdb..d9abf93c5b 100644 --- a/Dusts/AstralBasic.cs +++ b/Dusts/AstralBasic.cs @@ -13,14 +13,12 @@ namespace CalamityMod.Dusts public override bool Update(Dust dust) { - //update position + // Update position dust.position += dust.velocity; dust.scale -= 0.02f; if (dust.scale < 0.1f) - { dust.active = false; - } return false; } diff --git a/Dusts/AuricBarDust.cs b/Dusts/AuricBarDust.cs new file mode 100644 index 0000000000..fa19c6edfe --- /dev/null +++ b/Dusts/AuricBarDust.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class AuricBarDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; + dust.noGravity = false; + dust.scale = 1.2f; + dust.alpha = 100; + } + + public override bool Update(Dust dust) + { + dust.velocity.Y += 0.05f; + dust.position += dust.velocity; + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } +} diff --git a/Dusts/AuricBarDust.png b/Dusts/AuricBarDust.png new file mode 100644 index 0000000000..2481844ade Binary files /dev/null and b/Dusts/AuricBarDust.png differ diff --git a/Dusts/CeaselessDust.cs b/Dusts/CeaselessDust.cs new file mode 100644 index 0000000000..c569eee0f8 --- /dev/null +++ b/Dusts/CeaselessDust.cs @@ -0,0 +1,35 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class CeaselessDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.noGravity = true; + } + + public override bool Update(Dust dust) + { + float scale = dust.scale; + Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), scale * 0.4f, scale * 0.1f, scale); + + dust.position += dust.velocity; + dust.velocity *= 0.95f; + dust.scale -= 0.05f; + + if (dust.scale <= 0.05f) + dust.active = false; + + return false; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + int newColor = (int)(250f * dust.scale); + return new Color(newColor, newColor, newColor, 0); + } + } +} diff --git a/Dusts/CeaselessDust.png b/Dusts/CeaselessDust.png new file mode 100644 index 0000000000..de9e295d65 Binary files /dev/null and b/Dusts/CeaselessDust.png differ diff --git a/Dusts/CosmiliteBarDust.cs b/Dusts/CosmiliteBarDust.cs new file mode 100644 index 0000000000..cc6e05f481 --- /dev/null +++ b/Dusts/CosmiliteBarDust.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class CosmiliteBarDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; + dust.noGravity = false; + dust.scale = 1.2f; + dust.alpha = 100; + } + + public override bool Update(Dust dust) + { + dust.velocity.Y += 0.05f; + dust.position += dust.velocity; + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } +} diff --git a/Dusts/CosmiliteBarDust.png b/Dusts/CosmiliteBarDust.png new file mode 100644 index 0000000000..96f4666b1e Binary files /dev/null and b/Dusts/CosmiliteBarDust.png differ diff --git a/Dusts/ShadowspecBarDust.cs b/Dusts/ShadowspecBarDust.cs new file mode 100644 index 0000000000..31c0122bf0 --- /dev/null +++ b/Dusts/ShadowspecBarDust.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class ShadowspecBarDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.noLight = true; + dust.noGravity = false; + dust.scale = 1.2f; + dust.alpha = 100; + } + + public override bool Update(Dust dust) + { + dust.velocity.Y += 0.05f; + dust.position += dust.velocity; + dust.rotation += dust.velocity.X; + dust.scale -= 0.03f; + if (dust.scale < 0.5f) + { + dust.active = false; + } + return false; + } + } +} diff --git a/Dusts/ShadowspecBarDust.png b/Dusts/ShadowspecBarDust.png new file mode 100644 index 0000000000..411a76f5fe Binary files /dev/null and b/Dusts/ShadowspecBarDust.png differ diff --git a/Effects/BordernadoFire.fx b/Effects/BordernadoFire.fx new file mode 100644 index 0000000000..f21b52ac0d --- /dev/null +++ b/Effects/BordernadoFire.fx @@ -0,0 +1,71 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, float2(frac(coords.y + cos(uTime) * 0.01), frac(coords.x - uTime * 1.4 * uSaturation))); + fadeMapColor.r *= pow(coords.x, 0.2); + + float opacity = lerp(1.45, 1.95, fadeMapColor.r) * color.a; + opacity *= pow(sin(coords.y * 3.141), lerp(1, 4, pow(coords.x, 2))); + opacity *= fadeMapColor.r * 1.5 + 1; + opacity *= lerp(0.4, 0.9, fadeMapColor.r); + + float3 transformColor = lerp(float3(1, 205 / 255.0, 119 / 255.0), float3(1, 76 / 255.0, 79 / 255.0), fadeMapColor.r); + color.rgb = lerp(color.rgb, transformColor, fadeMapColor.r); + return color * opacity * 1.6; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/BordernadoFire.xnb b/Effects/BordernadoFire.xnb new file mode 100644 index 0000000000..7dff3c4fba Binary files /dev/null and b/Effects/BordernadoFire.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs new file mode 100644 index 0000000000..7993b3bcd4 --- /dev/null +++ b/Effects/CalamityShaders.cs @@ -0,0 +1,58 @@ +using CalamityMod.Skies; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.Graphics.Shaders; + +namespace CalamityMod.Effects +{ + public class CalamityShaders + { + public static Effect AstralFogShader; + public static Effect LightShader; + public static Effect SCalMouseShader; + public static Effect TentacleShader; + public static Effect LightDistortionShader; + public static Effect PhaseslayerRipShader; + public static Effect FadedUVMapStreakShader; + public static Effect FadingSolidTrailShader; + public static Effect ScarletDevilShader; + public static Effect BordernadoFireShader; + public static Effect PrismCrystalShader; + public static Effect SCalShieldShader; + + public static void LoadShaders() + { + if (Main.dedServ) + return; + AstralFogShader = CalamityMod.Instance.GetEffect("Effects/CustomShader"); + LightShader = CalamityMod.Instance.GetEffect("Effects/LightBurstShader"); + TentacleShader = CalamityMod.Instance.GetEffect("Effects/TentacleShader"); + 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"); + FadingSolidTrailShader = CalamityMod.Instance.GetEffect("Effects/FadingSolidTrail"); + SCalShieldShader = CalamityMod.Instance.GetEffect("Effects/SupremeShieldShader"); + + Filters.Scene["CalamityMod:Astral"] = new Filter(new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f), EffectPriority.VeryHigh); + + Filters.Scene["CalamityMod:LightBurst"] = new Filter(new ScreenShaderData(new Ref(LightShader), "BurstPass"), EffectPriority.VeryHigh); + Filters.Scene["CalamityMod:LightBurst"].Load(); + + GameShaders.Misc["CalamityMod:FireMouse"] = new MiscShaderData(new Ref(SCalMouseShader), "DyePass"); + GameShaders.Misc["CalamityMod:SubsumingTentacle"] = new MiscShaderData(new Ref(TentacleShader), "BurstPass"); + GameShaders.Misc["CalamityMod:LightDistortion"] = new MiscShaderData(new Ref(LightDistortionShader), "DistortionPass"); + GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"] = new MiscShaderData(new Ref(PhaseslayerRipShader), "TrailPass"); + GameShaders.Misc["CalamityMod:TrailStreak"] = new MiscShaderData(new Ref(FadedUVMapStreakShader), "TrailPass"); + GameShaders.Misc["CalamityMod:FadingSolidTrail"] = new MiscShaderData(new Ref(FadingSolidTrailShader), "TrailPass"); + GameShaders.Misc["CalamityMod:OverpoweredTouhouSpearShader"] = new MiscShaderData(new Ref(ScarletDevilShader), "TrailPass"); + GameShaders.Misc["CalamityMod:Bordernado"] = new MiscShaderData(new Ref(BordernadoFireShader), "TrailPass"); + GameShaders.Misc["CalamityMod:PrismaticStreak"] = new MiscShaderData(new Ref(PrismCrystalShader), "TrailPass"); + GameShaders.Misc["CalamityMod:SupremeShield"] = new MiscShaderData(new Ref(SCalShieldShader), "ShieldPass"); + } + } +} diff --git a/Effects/Dyes/AstralBlueDyeShader.fx b/Effects/Dyes/AstralBlueDyeShader.fx new file mode 100644 index 0000000000..3373d2db78 --- /dev/null +++ b/Effects/Dyes/AstralBlueDyeShader.fx @@ -0,0 +1,29 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float interval = cos(uTime * 7 + coords.x * 4) / 2 + 0.5; + float4 returnColor = float4(lerp(uColor, uSecondaryColor, interval), 1); // Fade between two colors depending on the time and x position on the texture in a 0-1 cosine linear interpolation. The color can vary. + return returnColor * color; // And multiply by the original color to give it a blend effect. +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/AstralOrangeDyeShader.fx b/Effects/Dyes/AstralOrangeDyeShader.fx new file mode 100644 index 0000000000..d818ed01a9 --- /dev/null +++ b/Effects/Dyes/AstralOrangeDyeShader.fx @@ -0,0 +1,31 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float interval = (cos((uTime - 0.5) * 17 + frameY * 8) / 2 + 0.5); + float4 returnColor = float4(lerp(uColor, uSecondaryColor, interval), 1); // One again, use a cosine lerp based on position and time, but this time, with the Y position. + + return returnColor * color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/AstralSwirlDyeShader.fx b/Effects/Dyes/AstralSwirlDyeShader.fx new file mode 100644 index 0000000000..47674dfa44 --- /dev/null +++ b/Effects/Dyes/AstralSwirlDyeShader.fx @@ -0,0 +1,55 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float2 RotatedBy(float2 xy, float theta) +{ + return float2(xy.x * cos(theta) + xy.y * sin(theta), xy.x * sin(theta) - xy.y * cos(theta)); +} + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float interval = (cos(uTime * 2.2 + frameY * coords.x * 1.55) * 0.5 + 0.5) * 0.6 + 0.2; // A complex function that works based on the X and Y coords with a 0.2-0.8 range. + float brightness = 1.35; + float3 returnColor = uColor; + // Rotate the colors around and adjust the brightness. + for (int i = 0; i < 4; i++) + { + float2 positionAt = float2(interval, 1 - interval); + positionAt = (RotatedBy(float2(cos(uTime * 1.7 + i / 4 * 6.283), cos(uTime * 1.9 + i / 4 * 6.283)), uTime + i / 4 * 6.283) * 0.5 + 0.5) - positionAt; + float dist = distance(coords, positionAt); + if (dist < 0.35) + { + float inverseDistanceRatio = 1 - dist / 0.35; + returnColor = lerp(uColor, uSecondaryColor, inverseDistanceRatio); + brightness = lerp(1.35, 1.7, inverseDistanceRatio); + } + } + + if (frameY > 0.5) + { + returnColor = lerp(returnColor, uSecondaryColor, (frameY - 0.5) * 3); + } + + return float4(returnColor, 1) * color * brightness; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/BloodflareDyeShader.fx b/Effects/Dyes/BloodflareDyeShader.fx new file mode 100644 index 0000000000..8feb36ca88 --- /dev/null +++ b/Effects/Dyes/BloodflareDyeShader.fx @@ -0,0 +1,44 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float4 pixelBelow = tex2D(uImage0, coords); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(frameY - uTime * 0.67)) * 0.5) * 1.5; + float verticalFlowMovement = (sin(coords.x * 14.71 + frameY * 13.5 - uTime * 5.6) * 0.5 + 0.5) * noiseColor.r; + if (pixelBelow.a == 0 && frameY < 0.96) + coords.y = saturate(coords.y + verticalFlowMovement / uSourceRect.w / 17); + float4 color = tex2D(uImage0, coords); + + // Prepare the dark outlines. + float outlineFade = pow(1 - (color.r + color.g + color.b) / 3, 2); + color = lerp(color, float4(uColor, 1), outlineFade) * color.a; + + // Prepare the bright in-lines. + color = lerp(color, float4(uSecondaryColor, 1), saturate(1 - outlineFade) * 0.8) * color.a; + + // Handle red fades based on noise. + color = lerp(color, float4(1, 0, 0, 1), pow(noiseColor.r, 3) * 0.3 + verticalFlowMovement * 0.3 + 0.16) * color.a; + + return color * (1 + (1 - outlineFade) * 0.25); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/BloodflareDyeShader.xnb b/Effects/Dyes/BloodflareDyeShader.xnb new file mode 100644 index 0000000000..534222798e Binary files /dev/null and b/Effects/Dyes/BloodflareDyeShader.xnb differ diff --git a/Effects/Dyes/CalamitousDyeShader.fx b/Effects/Dyes/CalamitousDyeShader.fx new file mode 100644 index 0000000000..8b1c719929 --- /dev/null +++ b/Effects/Dyes/CalamitousDyeShader.fx @@ -0,0 +1,43 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float4 noiseColor = tex2D(uImage1, float2(coords.x, frameY)); + float4 color = tex2D(uImage0, coords); + float3 blendColor = lerp(uColor, uSecondaryColor, sqrt(frameY)); + float blendFactor = (cos(uTime * 9 + coords.x * 18) * 0.5 + 0.5) * 0.5; + + // Allow the fade to pulse upward based on how far up the pixel is. + blendFactor += (cos(uTime * -13 - frameY * 7.1)) * 0.5; + float brightness = blendFactor * 0.35 + noiseColor.r * 0.35; + + // Cause the effects to taper off at the bottom of the sprite. + if (frameY < 0.2) + { + brightness *= frameY / 0.2; + blendFactor *= frameY / 0.2; + } + float4 colorBlendMultiplier = lerp(float4(blendColor, 1), float4(1, 1, 1, 1), saturate(pow(blendFactor * 1.5, 2))); + return (lerp(color, float4(blendColor, 1), blendFactor * 0.5 + 0.2) * color.a) * colorBlendMultiplier * (1 + brightness); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/CalamitousDyeShader.xnb b/Effects/Dyes/CalamitousDyeShader.xnb new file mode 100644 index 0000000000..4287b463b7 Binary files /dev/null and b/Effects/Dyes/CalamitousDyeShader.xnb differ diff --git a/Effects/Dyes/CeaselessDyeShader.fx b/Effects/Dyes/CeaselessDyeShader.fx new file mode 100644 index 0000000000..c0041ee41d --- /dev/null +++ b/Effects/Dyes/CeaselessDyeShader.fx @@ -0,0 +1,37 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float randomness(float2 uv) +{ + float noise = (frac(sin(dot(uv, float2(12.9898, 78.233) * 2.0)) * 43758.5453)); + return noise; +} + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + coords.x += randomness(uTime + frameY).x * 0.09 * (1 - frameY); // Add an X offset based on a noise function, giving a moon lord void-esque shader effect. + float4 color = tex2D(uImage0, coords); + float4 returnColor = color * 0.1; + returnColor.a = color.a; + return returnColor; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/CosmicFlameShader.fx b/Effects/Dyes/CosmicFlameShader.fx new file mode 100644 index 0000000000..c1dee78a4f --- /dev/null +++ b/Effects/Dyes/CosmicFlameShader.fx @@ -0,0 +1,49 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float2 swirlOffset = float2(sin(uTime * 0.96 + 1.754) * 0.31, sin(uTime * 0.96) * 0.16) * uSaturation; + float4 color = tex2D(uImage0, coords); + float4 noiseColor = tex2D(uImage1, frac(float2(coords.x, frameY + uTime * 0.36) + swirlOffset - uWorldPosition * 0.0006) * 0.26); + float4 flameColor = tex2D(uImage1, frac(float2(coords.x, frameY + uTime * 0.44)) * 0.1); + float brightnessFactor = noiseColor.r * 2; + + float normalizedDistanceFromCenter = distance(float2(coords.x, frameY), float2(0.5, 0.5)) * 2; + + // Cause "ring" fades based on distance. + float fadeToNormal = 1 - saturate((normalizedDistanceFromCenter - 0.67) / 0.3); + + // Cause noise-based stars to appear all across the sprite. + float3 starColor = lerp(uColor * 1.1, uSecondaryColor, sin(brightnessFactor * 6.283) * 0.5 + 0.5); + + // Prepare a dull, bluish-greyish background across the sprite for contrast. + color = lerp(color, float4(43 / 255.0, 58 / 255.0, 92 / 255.0, 1) * color.a, fadeToNormal * 0.45); + + // Fade to the secondary color based on the flame color map. This helps the overall result more vibrant. + color = lerp(color, float4(uSecondaryColor, 1) * color.a, flameColor.r * 0.5); + + // And create stars based on a noise texture that rise upward. + color = lerp(color, float4(starColor, 1) * color.a, fadeToNormal * pow(brightnessFactor, 6) * 0.15); + return color * (1 + brightnessFactor); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/CosmicFlameShader.xnb b/Effects/Dyes/CosmicFlameShader.xnb new file mode 100644 index 0000000000..a526ff1430 Binary files /dev/null and b/Effects/Dyes/CosmicFlameShader.xnb differ diff --git a/Effects/Dyes/CryonicDyeShader.fx b/Effects/Dyes/CryonicDyeShader.fx new file mode 100644 index 0000000000..3a108d42f8 --- /dev/null +++ b/Effects/Dyes/CryonicDyeShader.fx @@ -0,0 +1,42 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float4 noiseColor = tex2D(uImage1, float2(frac(coords.x + uTime * 0.1), frameY)); + float4 color = tex2D(uImage0, coords); + + // Cause sharp brightness increases based on a perlin noise map. + // This causes icy, crystaline structures to appear. + float brightness = pow((noiseColor.r + noiseColor.g + noiseColor.b) / 3, 3) * 3; + float normalizedDistanceFromCenter = distance(float2(coords.x, frameY), float2(0.5, 0.5)) * 2; + + // Cause "ring" fades based on distance. + float fadeToSecondaryColor = pow(sin(uTime * -1.56 + normalizedDistanceFromCenter * 3.141), 6); + + // This fades out at the ends of the sprite. + if (normalizedDistanceFromCenter > 0.7) + fadeToSecondaryColor *= saturate(1 - (normalizedDistanceFromCenter - 0.7) / 0.2); + float4 endFadeColor = lerp(float4(uColor, 1), float4(uSecondaryColor, 1), 0.5); + return (lerp(color, endFadeColor, 0.3 + fadeToSecondaryColor * 0.6) * color.a) * (1 + brightness); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/CryonicDyeShader.xnb b/Effects/Dyes/CryonicDyeShader.xnb new file mode 100644 index 0000000000..93b9009e6a Binary files /dev/null and b/Effects/Dyes/CryonicDyeShader.xnb differ diff --git a/Effects/Dyes/DefiledFlameDyeShader.fx b/Effects/Dyes/DefiledFlameDyeShader.fx new file mode 100644 index 0000000000..8d7f5639b6 --- /dev/null +++ b/Effects/Dyes/DefiledFlameDyeShader.fx @@ -0,0 +1,44 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +static float Variance = 0.4f; +static float MinBrightness = 1.5f; +static float MaxBrightness = 2.5f; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + + float4 noiseColor = tex2D(uImage1, coords); + + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float interval = cos(uTime * 7 + frameY * 6) * 0.5 + 0.5; + + float brightness = pow((interval + sin(uTime + coords.x * uTime * frameY * cos(uTime)) * 0.5 + 0.5) * 0.5, 2); // Force the brightness to rise to 1 more quickly + brightness = brightness * (MaxBrightness - MinBrightness) + MinBrightness; // And bring it to a specified range + + float4 colorMap = float4(lerp(uColor, uSecondaryColor, interval) + noiseColor.rgb * 0.4, 1); + colorMap.rgb *= brightness; + colorMap.rgb = colorMap.rgb - colorMap.rgb % Variance; // Slice the return color map to make pixels appear less varied and more extreme + + return colorMap * color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/DragonSoulDyeShader.fx b/Effects/Dyes/DragonSoulDyeShader.fx new file mode 100644 index 0000000000..80cb2729fd --- /dev/null +++ b/Effects/Dyes/DragonSoulDyeShader.fx @@ -0,0 +1,41 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +static float3 colors[4] = +{ + float3(195, 50, 37) / 255.0, + float3(252, 155, 0) / 255.0, + float3(255, 235, 195) / 255.0, + float3(252, 155, 0) / 255.0 +}; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float interval = (cos(coords.x * 6.283 + uTime * 3.141) * 2 + sin(uTime * 7 + frameY * 6)) * 0.125 + 0.5; + interval *= 2; // Exaggerate the interval. + float4 returnColor = float4(lerp(colors[floor(interval) % 4], colors[floor(interval + 1) % 4], interval % 1), 1); // But clamp it to a 0-1 range. + + return returnColor * color * 1.95; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ElementalDyeShader.fx b/Effects/Dyes/ElementalDyeShader.fx new file mode 100644 index 0000000000..0303576ddb --- /dev/null +++ b/Effects/Dyes/ElementalDyeShader.fx @@ -0,0 +1,44 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; + + float time = (sin(uTime + coords.x * cos(uTime + 3.141 * coords.x) + 1.5707 * frameY) * 0.5 + 0.5) * 6; + float timeFloored = floor(time); + + float3 colors[6] = + { + float3(241, 149, 49), // Solar + float3(88, 201, 169), // Vortex + float3(102, 200, 249), // Stardust + float3(226, 76, 239) * 0.7, // Nebula + float3(102, 200, 249), // Stardust + float3(88, 201, 169) // Vortex + }; + + // Use a multi-lerp to fade between colors and then base them on a trig-based time step. + color.rgb *= lerp(colors[timeFloored] / 255.0, colors[(timeFloored + 1) % 6] / 255.0, time / 6) * 1.6; + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/EndothermicDyeShader.fx b/Effects/Dyes/EndothermicDyeShader.fx new file mode 100644 index 0000000000..75de6d38ef --- /dev/null +++ b/Effects/Dyes/EndothermicDyeShader.fx @@ -0,0 +1,33 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + + // Saturate basically clamps to a 0-1 range. Basically, the further away from the center the closer the color becomes to the secondary color. + float3 idealColor = lerp(uColor, uSecondaryColor, saturate(distance(float2(coords.x, frameY), (0.5, 0.5)))); + float4 color = tex2D(uImage0, coords); + float luminosity = (color.r + color.g + color.b) / 3; + color.rgb = luminosity * idealColor * 1.3; // Average out the colors. + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/NightmareDyeShader.fx b/Effects/Dyes/NightmareDyeShader.fx new file mode 100644 index 0000000000..8d14568a57 --- /dev/null +++ b/Effects/Dyes/NightmareDyeShader.fx @@ -0,0 +1,36 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float3 idealColor = uColor; + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float depth = sin(uTime * 3 + coords.x * 2) * 0.05; + if (frameY < 0.425 + depth) + { + idealColor = lerp(uColor, uSecondaryColor, 1 - frameY / (0.425 + depth)); + } + float4 color = tex2D(uImage0, coords); + float luminosity = (color.r + color.g + color.b) / 3; + color.rgb = luminosity * idealColor * 1.6; // Average out the colors. + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/PhantoplasmDyeShader.fx b/Effects/Dyes/PhantoplasmDyeShader.fx new file mode 100644 index 0000000000..02a09722ae --- /dev/null +++ b/Effects/Dyes/PhantoplasmDyeShader.fx @@ -0,0 +1,42 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(frameY + uTime * 0.7))); + float4 color = tex2D(uImage0, coords); + float normalizedDistanceFromCenter = distance(float2(coords.x, frameY), float2(0.5, 0.5)) * 2; + + // Cause "ring" pulses based on distance. + float fadeToSecondaryColor = pow(sin(uTime * -2.56 + normalizedDistanceFromCenter * 2), 4); + + // This fades out at the ends of the sprite. + if (normalizedDistanceFromCenter > 0.7) + fadeToSecondaryColor *= saturate(1 - (normalizedDistanceFromCenter - 0.7) / 0.37 + sin(coords.x * coords.y * 12) * 0.1); + float4 endFadeColor = float4(lerp(uColor, uSecondaryColor, fadeToSecondaryColor * 0.74 + noiseColor.g * 0.13), 1); + + float4 blendedColor = (color + endFadeColor) * 0.5 - 0.05; + blendedColor *= 1.4; + blendedColor.a = 1; + return blendedColor * color.a * (1 + lerp(0.07, 0.3, fadeToSecondaryColor) + noiseColor.g * 0.1); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/PhantoplasmDyeShader.xnb b/Effects/Dyes/PhantoplasmDyeShader.xnb new file mode 100644 index 0000000000..d1d075c350 Binary files /dev/null and b/Effects/Dyes/PhantoplasmDyeShader.xnb differ diff --git a/Effects/Dyes/ProfanedFlameDyeShader.fx b/Effects/Dyes/ProfanedFlameDyeShader.fx new file mode 100644 index 0000000000..f1964bc244 --- /dev/null +++ b/Effects/Dyes/ProfanedFlameDyeShader.fx @@ -0,0 +1,44 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + float4 color = tex2D(uImage0, coords); + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, float2(frac(coords.x * 0.18 + cos(uTime * 0.9) * 0.021), frac(frameY * 0.32 + uTime * 0.2))); + fadeMapColor.r *= pow(coords.x, 0.2); + + float opacity = lerp(1.05, 1.95, fadeMapColor.r); + opacity *= fadeMapColor.r + 1; + opacity *= lerp(0.4, 1.1, fadeMapColor.r); + + float3 transformColor = lerp(uColor, uSecondaryColor, fadeMapColor.r); + float orangeFade = 1 - saturate((frameY - 0.08) / 0.74); + opacity += (1 - orangeFade) * 0.6; + + transformColor = lerp(transformColor, float3(206 / 255, 116 / 255, 59 / 255), orangeFade); + color.rgb = lerp(color.rgb, transformColor, fadeMapColor.r); + opacity *= color.a; + return color * opacity; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ProfanedFlameDyeShader.xnb b/Effects/Dyes/ProfanedFlameDyeShader.xnb new file mode 100644 index 0000000000..8121fa4bfa Binary files /dev/null and b/Effects/Dyes/ProfanedFlameDyeShader.xnb differ diff --git a/Effects/Dyes/ProfanedMoonlightDye.fx b/Effects/Dyes/ProfanedMoonlightDye.fx new file mode 100644 index 0000000000..70dc4c8cb9 --- /dev/null +++ b/Effects/Dyes/ProfanedMoonlightDye.fx @@ -0,0 +1,28 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 returnColor = tex2D(uImage0, coords); + returnColor.rgb *= uColor * ((cos(uTime) * 0.5 + 0.5) * 0.3 + 1.3); + return returnColor; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ReaverDyeShader.fx b/Effects/Dyes/ReaverDyeShader.fx new file mode 100644 index 0000000000..283a3267b2 --- /dev/null +++ b/Effects/Dyes/ReaverDyeShader.fx @@ -0,0 +1,34 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float luminosity = (color.r + color.g + color.b) / 3; + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + + float yMultiplier = sqrt(frameY) * (sin(frameY * 2 + uTime * 1.4) + 1) * 0.5; + + color.rgb *= ((coords.x * uColor * (1 - yMultiplier) * 1.4) + ((1 - coords.x) * uSecondaryColor * yMultiplier * 1.7)) * luminosity * 2.1; + color.rgb *= clamp(1.6 * saturate(distance((0.5, 0.5), coords)), 0.8, 1.6); // Intensify the colors based on how far they are from the center of the sprite. + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/ShadowspecDyeShader.fx b/Effects/Dyes/ShadowspecDyeShader.fx new file mode 100644 index 0000000000..dfa0d8c88b --- /dev/null +++ b/Effects/Dyes/ShadowspecDyeShader.fx @@ -0,0 +1,47 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float2 RotatedBy(float theta, float x, float y) +{ + return float2(x * cos(theta) + y * sin(theta), x * sin(theta) - y * cos(theta)); +} +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float sineTime = sin(uTime); // Saved so that I don't have the compute this multiple times. Shaders have a limited number of mathematical instructions you can use - 64. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + + float2 modifiedCoords = coords; + float4 color = tex2D(uImage0, coords); + + modifiedCoords = RotatedBy(uTime + 0.4 * sineTime, modifiedCoords.y, modifiedCoords.x); + float4 noiseColor = tex2D(uImage1, modifiedCoords); + + float xMultiplier = cos(coords.x * 2.3 + uTime) + 1; + float yMultiplier = sin(frameY * 2 + uTime * 1.4) + 1; + + float interpolationValue = saturate(xMultiplier * yMultiplier) * 0.7 + 0.3; // Range of 0-1. Depends on the current coordinates and the time. + + color.rgb *= 0.2 + pow(noiseColor.rgb, 3); // Squash the color to the upper and lower bounds and add a bit of lightness to it. + color.rgb *= lerp(uColor, uSecondaryColor, interpolationValue); // Blend with the secondary color. + color.rgb *= 1.7 + (sineTime * 0.5 + 1.5) * interpolationValue; // Range of 1.7 to 3.7, can cause certain spots to become very bright. + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/StratusDyeShader.fx b/Effects/Dyes/StratusDyeShader.fx new file mode 100644 index 0000000000..db0b8f5dfe --- /dev/null +++ b/Effects/Dyes/StratusDyeShader.fx @@ -0,0 +1,45 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +static float xAdditiveMax = 0.035; +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + float sineTime = sin(uTime); // Saved so that I don't have the compute this multiple times. Shaders have a limited number of mathematical instructions you can use - 64. + float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom. + + float2 modifiedCoords = coords; + modifiedCoords.x += cos(uTime + frameY) * 0.5 + 0.5; // Cause the effect to sway around a bit with time. + + float4 noiseColor = tex2D(uImage1, frac(modifiedCoords)); + + float xMultiplier = cos(coords.x * 2.3 + uTime * 1.15) + 0.5; + float yMultiplier = (sin(frameY * 2 + uTime * 1.4) + 1) * 0.5; + + color.rgb *= lerp(uColor, uSecondaryColor, saturate(xMultiplier * yMultiplier * 1.6)); + if (noiseColor.r > 0.55 + sineTime * 0.025) + { + color.rgb *= 1.6; // Sometimes give light "patches" depending on the swaying noise image. + } + color.rgb *= 1.6 + (sineTime * 0.5 + 1.5) * ((frameY + coords.x) - 1) * 2; // Brighten the shader over time. + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/FabstaffStreak.fx b/Effects/FabstaffStreak.fx new file mode 100644 index 0000000000..497063c9da --- /dev/null +++ b/Effects/FabstaffStreak.fx @@ -0,0 +1,72 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, float2(frac(coords.x - uTime * 2.5), coords.y)); + float opacity = fadeMapColor.r; + + // Fade out at the edges of the trail to give a blur effect. + // This is very important. + float power = lerp(3, 10, coords.x); + opacity = lerp(pow(sin(coords.y * 3.141), power), opacity, coords.x); + + // Fade out at the end of the streak. + if (coords.x > 0.7) + opacity *= pow(1 - (coords.x - 0.7) / 0.3, 6); + return color * opacity * 1.5; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/FabstaffStreak.xnb b/Effects/FabstaffStreak.xnb new file mode 100644 index 0000000000..9bf2e57eaa Binary files /dev/null and b/Effects/FabstaffStreak.xnb differ diff --git a/Effects/FadedUVMapStreak.fx b/Effects/FadedUVMapStreak.fx new file mode 100644 index 0000000000..497063c9da --- /dev/null +++ b/Effects/FadedUVMapStreak.fx @@ -0,0 +1,72 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, float2(frac(coords.x - uTime * 2.5), coords.y)); + float opacity = fadeMapColor.r; + + // Fade out at the edges of the trail to give a blur effect. + // This is very important. + float power = lerp(3, 10, coords.x); + opacity = lerp(pow(sin(coords.y * 3.141), power), opacity, coords.x); + + // Fade out at the end of the streak. + if (coords.x > 0.7) + opacity *= pow(1 - (coords.x - 0.7) / 0.3, 6); + return color * opacity * 1.5; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/FadedUVMapStreak.xnb b/Effects/FadedUVMapStreak.xnb new file mode 100644 index 0000000000..0ccc66632f Binary files /dev/null and b/Effects/FadedUVMapStreak.xnb differ diff --git a/Effects/FadingSolidTrail.fx b/Effects/FadingSolidTrail.fx new file mode 100644 index 0000000000..5b8427dcff --- /dev/null +++ b/Effects/FadingSolidTrail.fx @@ -0,0 +1,66 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float shouldFlip; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + if (shouldFlip == 1) + coords.y = 1 - coords.y; + + // Read the fade map as a streak. + float4 fadeMapColor = tex2D(uImage1, coords); + float opacity = fadeMapColor.r; + return color * opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/FadingSolidTrail.xnb b/Effects/FadingSolidTrail.xnb new file mode 100644 index 0000000000..1f44e50a54 Binary files /dev/null and b/Effects/FadingSolidTrail.xnb differ diff --git a/Effects/PhaseslayerRipShader.fx b/Effects/PhaseslayerRipShader.fx new file mode 100644 index 0000000000..5f2870b13b --- /dev/null +++ b/Effects/PhaseslayerRipShader.fx @@ -0,0 +1,61 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + float slashMapColor = tex2D(uImage1, coords); + float opacity = 1 - slashMapColor.r; + return color * pow(opacity, 3); +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/PhaseslayerRipShader.xnb b/Effects/PhaseslayerRipShader.xnb new file mode 100644 index 0000000000..e51ba52a94 Binary files /dev/null and b/Effects/PhaseslayerRipShader.xnb differ diff --git a/Effects/PrismCrystalStreak.fx b/Effects/PrismCrystalStreak.fx new file mode 100644 index 0000000000..8ec86f9cd3 --- /dev/null +++ b/Effects/PrismCrystalStreak.fx @@ -0,0 +1,70 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +// Inputted images go into uImage1 sampler, in case you have a noise map or something similar. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + float areaFadeGlow = lerp(1.2, 17, coords.x); + if (coords.x < 0.25) + areaFadeGlow = lerp(areaFadeGlow, 1.2, 1 - coords.x / 0.25); + float2 mapColor = tex2D(uImage1, float2(frac(coords.x - uTime * 4.2), coords.y)); + float opacity = pow(sin(coords.y * 3.141), areaFadeGlow) + 0.6 * lerp(1.1, 0.3, coords.x) * mapColor.r; + + if (coords.x > 0.66) + opacity = lerp(opacity, 0, (coords.x - 0.66) / 0.3); + + return color * opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/PrismCrystalStreak.xnb b/Effects/PrismCrystalStreak.xnb new file mode 100644 index 0000000000..b0aed6e0a2 Binary files /dev/null and b/Effects/PrismCrystalStreak.xnb differ diff --git a/Effects/SCalMouseShader.fx b/Effects/SCalMouseShader.fx new file mode 100644 index 0000000000..07151bc3b6 --- /dev/null +++ b/Effects/SCalMouseShader.fx @@ -0,0 +1,31 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0 +{ + float fadeInterpolant = cos(coords.y * coords.x * 6.283 - uTime * 13.1) * 0.5 + 0.5; + + float4 fadeColor = float4(lerp(uColor, uSecondaryColor, fadeInterpolant), 1); + float4 color = tex2D(uImage0, coords) * fadeColor; + color *= 1 + fadeInterpolant * 0.5; + return color; +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/SCalMouseShader.xnb b/Effects/SCalMouseShader.xnb new file mode 100644 index 0000000000..4c8990de6b Binary files /dev/null and b/Effects/SCalMouseShader.xnb differ diff --git a/Effects/ScarletDevilStreak.fx b/Effects/ScarletDevilStreak.fx new file mode 100644 index 0000000000..b79f4db97e --- /dev/null +++ b/Effects/ScarletDevilStreak.fx @@ -0,0 +1,70 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float2 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput)0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +// The X coordinate is the trail completion, the Y coordinate is the same as any other. +// This is simply how the primitive TextCoord is layed out in the C# code. +// Inputted images go into uImage1 sampler, in case you have a noise map or something similar. +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + float areaFadeGlow = lerp(1.2, 17, coords.x); + if (coords.x < 0.25) + areaFadeGlow = lerp(areaFadeGlow, 1.2, 1 - coords.x / 0.25); + float2 mapColor = tex2D(uImage1, float2(frac(coords.x - uTime * 2.5), coords.y)); + float opacity = pow(sin(coords.y * 3.141), areaFadeGlow) + 0.6 * lerp(1.1, 0.3, coords.x) * mapColor.r; + + if (coords.x > 0.66) + opacity = lerp(opacity, 0, (coords.x - 0.66) / 0.3); + + return color * opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/ScarletDevilStreak.xnb b/Effects/ScarletDevilStreak.xnb new file mode 100644 index 0000000000..20fda783a8 Binary files /dev/null and b/Effects/ScarletDevilStreak.xnb differ diff --git a/Effects/SupremeShieldShader.fx b/Effects/SupremeShieldShader.fx new file mode 100644 index 0000000000..b91aff9481 --- /dev/null +++ b/Effects/SupremeShieldShader.fx @@ -0,0 +1,46 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity : register(C0); +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + +float inverseLerp(float x, float min, float max) +{ + return saturate((x - min) / (max - min)); +} +float4 PixelFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float4 baseColor = tex2D(uImage0, coords); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(coords.y + uTime * 0.7))); + float start = 0.45 + sin(uTime * 3) * 0.04; + float ringRadus = 0.1; + float distanceRatio = distance(coords, float2(0.5, 0.5)) * 1.414; + float3 colorToUse = lerp(uColor, uSecondaryColor, pow(distanceRatio, 0.6)); + float originalAlpha = pow(inverseLerp(distanceRatio, 0, start), 2.6); + float ringAlpha = sin(3.141 * inverseLerp(distanceRatio, start, start + ringRadus)) * 1.96; + if (distanceRatio < start) + originalAlpha *= lerp(1, 2.6, noiseColor.r); + else + originalAlpha = lerp(originalAlpha, ringAlpha, inverseLerp(distanceRatio, start, start + ringRadus * 0.5)); + + originalAlpha *= lerp(1, 0.56, distanceRatio) * lerp(1, 2.45, min(1, pow(sin(uTime * 3.1), 10) * 0.7 + uSaturation)); + baseColor = float4(lerp(baseColor.rgb, colorToUse, 0.5), 1.0); + return baseColor * originalAlpha * uOpacity; +} + +technique Technique1 +{ + pass ShieldPass + { + PixelShader = compile ps_2_0 PixelFunction(); + } +} \ No newline at end of file diff --git a/Effects/SupremeShieldShader.xnb b/Effects/SupremeShieldShader.xnb new file mode 100644 index 0000000000..5a46acbb23 Binary files /dev/null and b/Effects/SupremeShieldShader.xnb differ diff --git a/Enums/AndromedaPlayerState.cs b/Enums/AndromedaPlayerState.cs new file mode 100644 index 0000000000..6fd05f6445 --- /dev/null +++ b/Enums/AndromedaPlayerState.cs @@ -0,0 +1,10 @@ +namespace CalamityMod +{ + public enum AndromedaPlayerState + { + Inactive, + SmallRobot, + LargeRobot, + SpecialAttack + } +} \ No newline at end of file diff --git a/Enums/AnimationType.cs b/Enums/AnimationType.cs new file mode 100644 index 0000000000..7cca596920 --- /dev/null +++ b/Enums/AnimationType.cs @@ -0,0 +1,9 @@ +namespace CalamityMod +{ + public enum AnimationType + { + Idle, + Jump, + Walk + } +} \ No newline at end of file diff --git a/Enums/CalamityRarity.cs b/Enums/CalamityRarity.cs new file mode 100644 index 0000000000..6c28e8ed3a --- /dev/null +++ b/Enums/CalamityRarity.cs @@ -0,0 +1,14 @@ +namespace CalamityMod +{ + public enum CalamityRarity + { + NoEffect = 0, + Turquoise = CalamityUtils.TurquoiseRarityValue, + PureGreen = CalamityUtils.PureGreenRarityValue, + DarkBlue = CalamityUtils.DarkBlueRarityValue, + Violet = CalamityUtils.VioletRarityValue, + HotPink = CalamityUtils.HotPinkRarityValue, + Rainbow = CalamityUtils.RainbowRarityValue, + DraedonRust = CalamityUtils.DraedonRustRarityValue, + } +} \ No newline at end of file diff --git a/Enums/ClassType.cs b/Enums/ClassType.cs new file mode 100644 index 0000000000..a2d67b6a38 --- /dev/null +++ b/Enums/ClassType.cs @@ -0,0 +1,11 @@ +namespace CalamityMod +{ + public enum ClassType + { + Melee = 0, + Ranged = 1, + Magic = 2, + Summon = 3, + Rogue = 4 + } +} \ No newline at end of file diff --git a/Enums/ConvertType.cs b/Enums/ConvertType.cs new file mode 100644 index 0000000000..07d62230d1 --- /dev/null +++ b/Enums/ConvertType.cs @@ -0,0 +1,10 @@ +namespace CalamityMod +{ + public enum ConvertType + { + Pure, + Corrupt, + Crimson, + Hallow + } +} \ No newline at end of file diff --git a/Enums/Season.cs b/Enums/Season.cs new file mode 100644 index 0000000000..a765d915c9 --- /dev/null +++ b/Enums/Season.cs @@ -0,0 +1,10 @@ +namespace CalamityMod +{ + public enum Season : byte + { + Winter, + Spring, + Summer, + Fall + } +} \ No newline at end of file diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 80c62c783d..89c80067e8 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -1,17 +1,18 @@ using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using System; -using System.Linq; using System.Collections.Generic; +using System.Linq; using Terraria; -using Terraria.ModLoader; using Terraria.ID; -using Terraria.Localization; +using Terraria.ModLoader; namespace CalamityMod.Events { - public enum AcidRainSpawnRequirement + public enum AcidRainSpawnRequirement { Water, Land, @@ -31,11 +32,12 @@ namespace CalamityMod.Events } public class AcidRainEvent { - // A partially bright pale-ish cyan with a hint of yellow. - public static readonly Color TextColor = new Color(115, 194, 147); - public static int MaxNuclearToadCount = 5; // To prevent the things from spamming. This happens frequently in pre-HM. + // A partially bright pale-ish cyan with a hint of yellow. + + public static readonly Color TextColor = new Color(115, 194, 147); + public const int InvasionNoKillPersistTime = 14400; // How long the invasion persists, in frames, if nothing is killed. public const float BloodwormSpawnRate = 0.1f; @@ -111,17 +113,7 @@ namespace CalamityMod.Events /// Broadcasts some text from a given localization key. /// /// The key to write - public static void BroadcastEventText(string localizationKey) - { - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(localizationKey), TextColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(localizationKey), TextColor); - } - } + public static void BroadcastEventText(string localizationKey) => CalamityUtils.DisplayLocalizedText(localizationKey, TextColor); public static int NeededEnemyKills { get @@ -147,7 +139,7 @@ namespace CalamityMod.Events /// public static void TryStartEvent(bool forceRain = false) { - if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode && !CalamityWorld.downedAquaticScourge) || CalamityWorld.bossRushActive) + if (CalamityWorld.rainingAcid || (!NPC.downedBoss1 && !Main.hardMode && !CalamityWorld.downedAquaticScourge) || BossRushEvent.BossRushActive) return; int playerCount = 0; for (int i = 0; i < Main.player.Length; i++) @@ -175,7 +167,7 @@ namespace CalamityMod.Events Main.rainTime = Main.weatherCounter; Main.maxRaining = 0.89f; CalamityWorld.forcedDownpourWithTear = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } CalamityWorld.triedToSummonOldDuke = false; CalamityWorld.timeSinceAcidRainKill = 0; // Reset the kill cooldown, just in case. @@ -184,6 +176,101 @@ namespace CalamityMod.Events UpdateInvasion(); BroadcastEventText("Mods.CalamityMod.AcidRainStart"); // A toxic downpour falls over the wasteland seas! } + + /// + /// Handles updating the entire invasion, including more misc operations, such as summoning OD's tornado. + /// + public static void Update() + { + CalamityWorld.timeSinceAcidRainKill++; + CalamityWorld.timeSinceAcidStarted++; + + // If enough time has passed, and no enemy has been killed, end the invasion early. + // The player almost certainly does not want to deal with it. + if (CalamityWorld.timeSinceAcidRainKill >= AcidRainEvent.InvasionNoKillPersistTime) + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + if (!CalamityWorld.startAcidicDownpour) + { + int sulphSeaWidth = SulphurousSea.BiomeWidth; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + // A variable named "player" already exists above, which retrieves the player who is closest to the map center. + Player player2 = Main.player[playerIndex]; + if (player2.active) + { + // An artificial biome can be made, and therefore, the event could be started by an artificial biome. + // While fighting the event in an artificial biome is not bad, having it be started by a patch of Sulphurous Sand + // would definitely be strange. + // Because of this, this code is executed based on if the player is in the sea (based on tile count) AND position relative to the naturally generated sea. + bool inNaturalSeaPosition = (player2.Center.X <= (sulphSeaWidth + 60f) * 16f && CalamityWorld.abyssSide) || (player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !CalamityWorld.abyssSide); + if (inNaturalSeaPosition && player2.Calamity().ZoneSulphur) + { + // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) + // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! + CalamityWorld.startAcidicDownpour = true; + CalamityNetcode.SyncWorld(); + break; + } + } + } + } + + // Stop the rain if the Old Duke is present for visibility during the fight. + if (Main.raining && NPC.AnyNPCs(ModContent.NPCType())) + { + Main.raining = false; + CalamityNetcode.SyncWorld(); + } + + // If the rain stops for whatever reason, end the invasion. + // This is primarily done for compatibility, so that if another mod wants to manipulate the weather, + // they can without having to deal with endless rain. + if (!Main.raining && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.timeSinceAcidStarted > 20) + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + UpdateInvasion(false); + } + else if (CalamityWorld.timeSinceAcidStarted < 20) + { + Main.raining = true; + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = 0.72f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. + Main.rainTime = Main.weatherCounter; + Main.maxRaining = 0.89f; + } + + // Summon Old Duke tornado post-Polter as needed + if (CalamityWorld.downedPolterghast && CalamityWorld.acidRainPoints == 1) + { + if (!NPC.AnyNPCs(ModContent.NPCType()) && + CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) + { + if (CalamityWorld.triedToSummonOldDuke) + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + UpdateInvasion(false); + } + else + { + int playerClosestToAbyss = Player.FindClosest(new Vector2(CalamityWorld.abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0); + Player closestToAbyss = Main.player[playerClosestToAbyss]; + if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (CalamityWorld.abyssSide ? 0 : Main.maxTilesX * 16)) <= 12000f) + Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, ModContent.ProjectileType(), 120, 8f, Main.myPlayer); + } + } + } + } + /// /// Updates the invasion, checking to see if it has ended. /// @@ -197,7 +284,6 @@ namespace CalamityMod.Events { CalamityWorld.rainingAcid = false; BroadcastEventText("Mods.CalamityMod.AcidRainEnd"); // The sulphuric skies begin to clear... - CalamityWorld.acidRainExtraDrawTime = 40; // Turn off the rain from the event Main.numCloudsTemp = Main.rand.Next(5, 20 + 1); @@ -213,7 +299,7 @@ namespace CalamityMod.Events CalamityWorld.triedToSummonOldDuke = false; CalamityMod.StopRain(); } - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); // You will be tempted to turn this into a single if conditional. // Don't do this. Doing so has caused so much misery, with various things being read instead @@ -231,18 +317,116 @@ namespace CalamityMod.Events if (Main.netMode == NetmodeID.Server) { var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.AcidRainUIDrawFadeSync); - netMessage.Write(CalamityWorld.acidRainExtraDrawTime); + netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync); + netMessage.Write(CalamityWorld.triedToSummonOldDuke); netMessage.Send(); } if (Main.netMode == NetmodeID.Server) { var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.AcidRainOldDukeSummonSync); - netMessage.Write(CalamityWorld.triedToSummonOldDuke); + netMessage.Write((byte)CalamityModMessageType.EncounteredOldDukeSync); + netMessage.Write(CalamityWorld.encounteredOldDuke); netMessage.Send(); } } } + + public static void TryToStartEventNaturally() + { + // Attempt to start the acid rain at the 4:29AM. + // This does not happen if a player has the Broken Water Filter in use. + bool increasedEventChance = !CalamityWorld.downedEoCAcidRain || (!CalamityWorld.downedAquaticScourgeAcidRain && CalamityWorld.downedAquaticScourge) || (!CalamityWorld.downedBoomerDuke && CalamityWorld.downedPolterghast); + if (Main.time == 32399 && !Main.dayTime && Main.rand.NextBool(increasedEventChance ? 3 : 300)) + { + bool shouldNotStartEvent = false; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + if (!Main.player[playerIndex].active) + continue; + if (Main.player[playerIndex].Calamity().noStupidNaturalARSpawns) + { + shouldNotStartEvent = true; + break; + } + } + if (!shouldNotStartEvent) + { + TryStartEvent(); + CalamityNetcode.SyncWorld(); + } + } + + // Attempt to force an Acid Rain immediately after the EoC is dead when someone wanders to the sea. + if (NPC.downedBoss1 && !CalamityWorld.downedEoCAcidRain && !CalamityWorld.forcedRainAlready) + { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + if (Main.player[playerIndex].active && Main.player[playerIndex].Calamity().ZoneSulphur) + { + CalamityWorld.forcedRainAlready = true; + TryStartEvent(); + CalamityNetcode.SyncWorld(); + } + } + } + + if (CalamityWorld.forceRainTimer == 1) + { + TryStartEvent(); + CalamityNetcode.SyncWorld(); + } + + if (CalamityWorld.forceRainTimer > 0) + CalamityWorld.forceRainTimer--; + } + + public static void OnEnemyKill(NPC npc) + { + Dictionary possibleEnemies = PossibleEnemiesPreHM; + + if (CalamityWorld.downedAquaticScourge) + possibleEnemies = PossibleEnemiesAS; + if (CalamityWorld.downedPolterghast) + possibleEnemies = PossibleEnemiesPolter; + + if (CalamityWorld.rainingAcid) + { + if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type)) + { + CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints; + if (CalamityWorld.downedPolterghast) + { + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. + } + + // UpdateInvasion incorporates a world sync, so this is indeed synced as a result. + Main.rainTime += Main.rand.Next(240, 300 + 1); // Add some time to the rain, so that it doesn't end mid-way. + } + Dictionary possibleMinibosses = CalamityWorld.downedPolterghast ? PossibleMinibossesPolter : PossibleMinibossesAS; + if (possibleMinibosses.Select(miniboss => miniboss.Key).Contains(npc.type)) + { + CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints; + if (CalamityWorld.downedPolterghast) + { + CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. + } + + // UpdateInvasion incorporates a world sync, so this is indeed synced as a result. + Main.rainTime += Main.rand.Next(1800, 2100 + 1); // Add some time to the rain, so that it doesn't end mid-way. + } + } + + CalamityWorld.acidRainPoints = (int)MathHelper.Max(0, CalamityWorld.acidRainPoints); // To prevent negative completion ratios + + if (CalamityWorld.rainingAcid && CalamityWorld.downedPolterghast && + npc.type == ModContent.NPCType() && + CalamityWorld.acidRainPoints <= 2f) + { + CalamityWorld.triedToSummonOldDuke = false; + CalamityWorld.acidRainPoints = 0; + } + CalamityWorld.timeSinceAcidRainKill = 0; + UpdateInvasion(); + } } } diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs new file mode 100644 index 0000000000..025cc0ac45 --- /dev/null +++ b/Events/BossRushEvent.cs @@ -0,0 +1,524 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using CalamityMod.Items; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Events +{ + public class BossRushEvent + { + public enum TimeChangeContext + { + None = 0, + Day = 1, + Night = -1 + } + public struct Boss + { + public int EntityID; + public int SpecialSpawnCountdown; + public bool UsesSpecialSound; + public TimeChangeContext ToChangeTimeTo; + public OnSpawnContext SpawnContext; + public List HostileNPCsToNotDelete; + + public delegate void OnSpawnContext(int type); + + public Boss(int id, TimeChangeContext toChangeTimeTo = TimeChangeContext.None, OnSpawnContext spawnContext = null, int specialSpawnCountdown = -1, bool usesSpecialSound = false, params int[] permittedNPCs) + { + // Default to a typical SpawnOnPlayer call for boss summoning if nothing else is inputted. + if (spawnContext is null) + spawnContext = (type) => NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); + + EntityID = id; + SpecialSpawnCountdown = specialSpawnCountdown; + UsesSpecialSound = usesSpecialSound; + ToChangeTimeTo = toChangeTimeTo; + SpawnContext = spawnContext; + HostileNPCsToNotDelete = permittedNPCs.ToList(); + + // Add the NPC type to delete blacklist list by default. + if (!HostileNPCsToNotDelete.Contains(id)) + HostileNPCsToNotDelete.Add(id); + if (BossIDsAfterDeath.TryGetValue(id, out int[] deathThings)) + HostileNPCsToNotDelete.AddRange(deathThings); + } + } + public static bool BossRushActive = false; // Whether Boss Rush is active or not. + public static bool DeactivateStupidFuckingBullshit = false; // Force Boss Rush to inactive. + public static int BossRushStage = 0; // Boss Rush Stage. + public static int BossRushSpawnCountdown = 180; // Delay before another Boss Rush boss can spawn. + public static List Bosses = new List(); + public static Dictionary BossIDsAfterDeath = new Dictionary(); + public static Dictionary> BossDeathEffects = new Dictionary>(); + public static readonly Color XerocTextColor = Color.LightCoral; + public static int ClosestPlayerToWorldCenter => Player.FindClosest(new Vector2(Main.maxTilesX, Main.maxTilesY) * 16f * 0.5f, 1, 1); + public static int CurrentlyFoughtBoss => Bosses[BossRushStage].EntityID; + public static int NextBossToFight => Bosses[BossRushStage + 1].EntityID; + + #region Loading and Unloading + public static void Load() + { + BossIDsAfterDeath = new Dictionary() + { + [ModContent.NPCType()] = new int[] { ModContent.NPCType() }, + [ModContent.NPCType()] = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, + }; + + Bosses = new List() + { + new Boss(NPCID.QueenBee), + + new Boss(NPCID.BrainofCthulhu, permittedNPCs: NPCID.Creeper), + + new Boss(NPCID.KingSlime, permittedNPCs: new int[] { NPCID.BlueSlime, NPCID.YellowSlime, NPCID.PurpleSlime, NPCID.RedSlime, NPCID.GreenSlime, NPCID.RedSlime, + NPCID.IceSlime, NPCID.UmbrellaSlime, NPCID.Pinky, NPCID.SlimeSpiked, NPCID.RainbowSlime, ModContent.NPCType() }), + + new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: NPCID.ServantofCthulhu), + + new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser, NPCID.Probe }), + + new Boss(NPCID.Golem, TimeChangeContext.Day, type => + { + int shittyStatueBoss = NPC.NewNPC((int)(Main.player[ClosestPlayerToWorldCenter].position.X + Main.rand.Next(-100, 101)), (int)(Main.player[ClosestPlayerToWorldCenter].position.Y - 400f), type, 1); + Main.npc[shittyStatueBoss].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(shittyStatueBoss); + }, permittedNPCs: new int[] { NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead, NPCID.GolemHeadFree }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(NPCID.EaterofWorldsHead, permittedNPCs: new int[] { NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.VileSpit }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Night, permittedNPCs: ModContent.NPCType()), + + new Boss(NPCID.TheDestroyer, TimeChangeContext.Night, specialSpawnCountdown: 300, permittedNPCs: new int[] { NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, NPCID.Probe }), + + new Boss(NPCID.Spazmatism, TimeChangeContext.Night, type => + { + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Spazmatism); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Retinazer); + }, permittedNPCs: NPCID.Retinazer), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), NPCID.Spazmatism, NPCID.Retinazer }), + + new Boss(NPCID.WallofFlesh, spawnContext: type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + NPC.SpawnWOF(player.position); + }, permittedNPCs: new int[] { NPCID.WallofFleshEye, NPCID.LeechHead, NPCID.LeechBody, NPCID.LeechTail, NPCID.TheHungry, NPCID.TheHungryII }), + + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(NPCID.SkeletronHead, TimeChangeContext.Night, type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + int sans = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); + Main.npc[sans].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(sans); + }, permittedNPCs: NPCID.SkeletronHand), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), }), + + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), spawnContext: type => + { + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); + }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType() }), + + new Boss(NPCID.CultistBoss, spawnContext: type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + int doctorLooneyTunes = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y - 400, type, 1); + Main.npc[doctorLooneyTunes].direction = Main.npc[doctorLooneyTunes].spriteDirection = Math.Sign(player.Center.X - player.Center.X - 90f); + Main.npc[doctorLooneyTunes].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(doctorLooneyTunes); + }, permittedNPCs: new int[] { NPCID.CultistBossClone, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, NPCID.CultistDragonBody2, NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, NPCID.AncientCultistSquidhead, NPCID.AncientLight, NPCID.AncientDoom }), + + new Boss(ModContent.NPCType(), spawnContext: type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + + // Delete the pillars spawned by the cultist. + for (int doom = 0; doom < Main.maxNPCs; doom++) + { + bool isPillar = Main.npc[doom].type == NPCID.LunarTowerStardust || Main.npc[doom].type == NPCID.LunarTowerVortex || Main.npc[doom].type == NPCID.LunarTowerNebula || Main.npc[doom].type == NPCID.LunarTowerSolar; + if (Main.npc[doom].active && isPillar) + { + Main.npc[doom].active = false; + Main.npc[doom].netUpdate = true; + } + } + int thePefectOne = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); + Main.npc[thePefectOne].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(thePefectOne); + }, specialSpawnCountdown: 300, permittedNPCs: ModContent.NPCType()), + + new Boss(NPCID.Plantera, permittedNPCs: new int[] { NPCID.PlanterasTentacle, NPCID.PlanterasHook, NPCID.Spore }), + + new Boss(ModContent.NPCType(), permittedNPCs: ModContent.NPCType()), + + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType() ,ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), permittedNPCs: ModContent.NPCType()), + + new Boss(ModContent.NPCType(), specialSpawnCountdown: 360, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), spawnContext: type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + + Main.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); + }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(NPCID.DukeFishron, spawnContext: type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + int dukeFishron = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); + Main.npc[dukeFishron].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(dukeFishron); + }, permittedNPCs: new int[] { NPCID.DetonatingBubble, NPCID.Sharkron, NPCID.Sharkron2 }), + + new Boss(NPCID.MoonLordCore, spawnContext: type => + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierThreeEndText2", XerocTextColor); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); + }, permittedNPCs: new int[] { NPCID.MoonLordLeechBlob, NPCID.MoonLordHand, NPCID.MoonLordHead, NPCID.MoonLordFreeEye }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Night, type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + + Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), player.Center); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); + }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Night, specialSpawnCountdown: 420, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), NPCID.DetonatingBubble}), + + new Boss(ModContent.NPCType(), spawnContext: type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + int boomerDuke = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), type, 1); + Main.npc[boomerDuke].timeLeft *= 20; + CalamityUtils.BossAwakenMessage(boomerDuke); + }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + + Main.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); + }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), spawnContext: type => + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFourEndText2", XerocTextColor); + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + if (Main.player[playerIndex].active) + { + Player player = Main.player[playerIndex]; + if (player.FindBuffIndex(ModContent.BuffType()) > -1) + player.ClearBuff(ModContent.BuffType()); + } + } + Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), Main.player[ClosestPlayerToWorldCenter].Center); + CalamityUtils.SpawnBossBetter(Main.player[ClosestPlayerToWorldCenter].Top - new Vector2(42f, 84f), type); + }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), + ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }), + + new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => + { + Player player = Main.player[ClosestPlayerToWorldCenter]; + + Main.PlaySound(CalamityMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), player.Center); + NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); + }, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType() }) + }; + + BossDeathEffects = new Dictionary>() + { + [NPCID.TheDestroyer] = npc => + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierOneEndText", XerocTextColor); + }, + [NPCID.CultistBoss] = npc => + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierTwoEndText", XerocTextColor); + }, + [NPCID.DukeFishron] = npc => + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierThreeEndText", XerocTextColor); + }, + [ModContent.NPCType()] = npc => + { + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFourEndText", XerocTextColor); + }, + [ModContent.NPCType()] = npc => + { + DropHelper.DropItem(npc, ModContent.ItemType(), true); + BossRushStage = 0; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + BossRushActive = false; + + CalamityNetcode.SyncWorld(); + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(BossRushStage); + netMessage.Send(); + } + + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.BossRushTierFiveEndText", XerocTextColor); + } + }; + } + + public static void Unload() + { + Bosses = null; + BossIDsAfterDeath = null; + BossDeathEffects = null; + } + #endregion + + #region Updates + internal static void MiscUpdateEffects() + { + if (!BossRushActive) + return; + + // Prevent Moon Lord from spawning naturally + if (NPC.MoonLordCountdown > 0) + NPC.MoonLordCountdown = 0; + + // Handle projectile clearing. + if (CalamityWorld.bossRushHostileProjKillCounter > 0) + { + CalamityWorld.bossRushHostileProjKillCounter--; + if (CalamityWorld.bossRushHostileProjKillCounter == 1) + CalamityUtils.KillAllHostileProjectiles(); + + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BRHostileProjKillSync); + netMessage.Write(CalamityWorld.bossRushHostileProjKillCounter); + netMessage.Send(); + } + } + } + + internal static void Update() + { + if (!BossRushActive) + { + BossRushSpawnCountdown = 180; + if (BossRushStage != 0) + { + BossRushStage = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(BossRushStage); + netMessage.Send(); + } + } + return; + } + + MiscUpdateEffects(); + + // Do boss rush countdown and shit if no boss is alive. + if (!CalamityPlayer.areThereAnyDamnBosses) + { + if (BossRushSpawnCountdown > 0) + BossRushSpawnCountdown--; + + // Cooldown and boss spawn + if (BossRushSpawnCountdown <= 0) + { + // Cooldown before next boss spawns. + BossRushSpawnCountdown = 60; + + // Increase cooldown post-Fishron. + if (BossRushStage >= Bosses.FindIndex(boss => boss.EntityID == NPCID.DukeFishron)) + BossRushSpawnCountdown += 300; + + // Override the spawn countdown if specified. + if (BossRushStage < Bosses.Count - 1 && Bosses[BossRushStage + 1].SpecialSpawnCountdown != -1) + BossRushSpawnCountdown = Bosses[BossRushStage + 1].SpecialSpawnCountdown; + + // Change time as necessary. + if (Bosses[BossRushStage].ToChangeTimeTo != TimeChangeContext.None) + CalamityUtils.ChangeTime(Bosses[BossRushStage].ToChangeTimeTo == TimeChangeContext.Day); + + // Play the typical boss roar sound. + if (!Bosses[BossRushStage].UsesSpecialSound) + Main.PlaySound(SoundID.Roar, Main.player[ClosestPlayerToWorldCenter].position, 0); + + // And spawn the boss. + Bosses[BossRushStage].SpawnContext.Invoke(CurrentlyFoughtBoss); + } + } + } + + #endregion + + #region On Boss Kill + internal static void OnBossKill(NPC npc, Mod mod) + { + // Eater of Worlds splits in Boss Rush now, so you have to kill every single segment to progress. + // Vanilla sets npc.boss to true for the last Eater of Worlds segment to die in NPC.checkDead. + // This means we do not need to manually check for other segments ourselves. + if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.boss) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + } + + // Anahita and Leviathan manually check for each other (this probably isn't necessary). + else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + { + int bossType = (npc.type == ModContent.NPCType()) ? ModContent.NPCType() : ModContent.NPCType(); + if (!NPC.AnyNPCs(bossType)) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + } + + // Killing any split Deus head ends the fight instantly. You don't need to kill both. + else if (npc.type == ModContent.NPCType() && npc.Calamity().newAI[0] != 0f) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + + // All Slime God entities must be killed to progress to the next stage. + else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) + { + if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && + !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && + NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && + NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + } + } + + // This is the generic form of "Are there any remaining NPCs on the boss list for this boss rush stage?" check. + else if ((Bosses.Any(boss => boss.EntityID == npc.type) && !BossIDsAfterDeath.ContainsKey(npc.type)) || + BossIDsAfterDeath.Values.Any(killList => killList.Contains(npc.type))) + { + BossRushStage++; + CalamityUtils.KillAllHostileProjectiles(); + CalamityWorld.bossRushHostileProjKillCounter = 3; + if (BossDeathEffects.ContainsKey(npc.type)) + BossDeathEffects[npc.type].Invoke(npc); + } + + // Sync the stage and progress of Boss Rush whenever a relevant boss dies. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(BossRushStage); + netMessage.Send(); + var netMessage2 = mod.GetPacket(); + netMessage2.Write((byte)CalamityModMessageType.BRHostileProjKillSync); + netMessage2.Write(CalamityWorld.bossRushHostileProjKillCounter); + netMessage2.Send(); + } + } + #endregion + } +} diff --git a/ExtraTextures/BladeTrailUVMap.png b/ExtraTextures/BladeTrailUVMap.png new file mode 100644 index 0000000000..29e4cdac42 Binary files /dev/null and b/ExtraTextures/BladeTrailUVMap.png differ diff --git a/ExtraTextures/CalamitasCinder.png b/ExtraTextures/CalamitasCinder.png new file mode 100644 index 0000000000..191dd23b73 Binary files /dev/null and b/ExtraTextures/CalamitasCinder.png differ diff --git a/ExtraTextures/CalamitasShield.png b/ExtraTextures/CalamitasShield.png new file mode 100644 index 0000000000..6adeaa39a5 Binary files /dev/null and b/ExtraTextures/CalamitasShield.png differ diff --git a/ExtraTextures/CalamityAura.png b/ExtraTextures/CalamityAura.png new file mode 100644 index 0000000000..fddcf00e77 Binary files /dev/null and b/ExtraTextures/CalamityAura.png differ diff --git a/ExtraTextures/EternityStreak.png b/ExtraTextures/EternityStreak.png new file mode 100644 index 0000000000..8b7fcd0246 Binary files /dev/null and b/ExtraTextures/EternityStreak.png differ diff --git a/ExtraTextures/FabstaffStreak.png b/ExtraTextures/FabstaffStreak.png new file mode 100644 index 0000000000..3a05118936 Binary files /dev/null and b/ExtraTextures/FabstaffStreak.png differ diff --git a/ExtraTextures/Heart3.png b/ExtraTextures/Heart3.png index f61d962f3f..b156f587f3 100644 Binary files a/ExtraTextures/Heart3.png and b/ExtraTextures/Heart3.png differ diff --git a/ExtraTextures/Lasers/AresDeathBeamEnd.png b/ExtraTextures/Lasers/AresDeathBeamEnd.png new file mode 100644 index 0000000000..9cbcb08262 Binary files /dev/null and b/ExtraTextures/Lasers/AresDeathBeamEnd.png differ diff --git a/ExtraTextures/Lasers/AresDeathBeamMiddle.png b/ExtraTextures/Lasers/AresDeathBeamMiddle.png new file mode 100644 index 0000000000..89d3b3e7f6 Binary files /dev/null and b/ExtraTextures/Lasers/AresDeathBeamMiddle.png differ diff --git a/ExtraTextures/Lasers/AresLaserBeamEnd.png b/ExtraTextures/Lasers/AresLaserBeamEnd.png new file mode 100644 index 0000000000..ced00be385 Binary files /dev/null and b/ExtraTextures/Lasers/AresLaserBeamEnd.png differ diff --git a/ExtraTextures/Lasers/AresLaserBeamMiddle.png b/ExtraTextures/Lasers/AresLaserBeamMiddle.png new file mode 100644 index 0000000000..f00c5f0c33 Binary files /dev/null and b/ExtraTextures/Lasers/AresLaserBeamMiddle.png differ diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png b/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png new file mode 100644 index 0000000000..8facdfbb48 Binary files /dev/null and b/ExtraTextures/Lasers/ExoDestroyerBeamEnd.png differ diff --git a/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png b/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png new file mode 100644 index 0000000000..fe2d7fe372 Binary files /dev/null and b/ExtraTextures/Lasers/ExoDestroyerBeamMiddle.png differ diff --git a/ExtraTextures/Lasers/FadeLaserEnd.png b/ExtraTextures/Lasers/FadeLaserEnd.png new file mode 100644 index 0000000000..899fa12378 Binary files /dev/null and b/ExtraTextures/Lasers/FadeLaserEnd.png differ diff --git a/ExtraTextures/Lasers/FadeLaserMid.png b/ExtraTextures/Lasers/FadeLaserMid.png new file mode 100644 index 0000000000..67af476cc0 Binary files /dev/null and b/ExtraTextures/Lasers/FadeLaserMid.png differ diff --git a/ExtraTextures/Lasers/FadeLaserStart.png b/ExtraTextures/Lasers/FadeLaserStart.png new file mode 100644 index 0000000000..0e661a1658 Binary files /dev/null and b/ExtraTextures/Lasers/FadeLaserStart.png differ diff --git a/ExtraTextures/Lasers/PrismLaserEnd.png b/ExtraTextures/Lasers/PrismLaserEnd.png new file mode 100644 index 0000000000..a8079f3418 Binary files /dev/null and b/ExtraTextures/Lasers/PrismLaserEnd.png differ diff --git a/ExtraTextures/Lasers/PrismLaserMid.png b/ExtraTextures/Lasers/PrismLaserMid.png new file mode 100644 index 0000000000..9f45394bd2 Binary files /dev/null and b/ExtraTextures/Lasers/PrismLaserMid.png differ diff --git a/ExtraTextures/Lasers/PrismLaserStart.png b/ExtraTextures/Lasers/PrismLaserStart.png new file mode 100644 index 0000000000..e8c3590839 Binary files /dev/null and b/ExtraTextures/Lasers/PrismLaserStart.png differ diff --git a/ExtraTextures/Lasers/UniverseSplitterHugeBeamEnd.png b/ExtraTextures/Lasers/UniverseSplitterHugeBeamEnd.png new file mode 100644 index 0000000000..4f303c2da1 Binary files /dev/null and b/ExtraTextures/Lasers/UniverseSplitterHugeBeamEnd.png differ diff --git a/ExtraTextures/Lasers/UniverseSplitterHugeBeamMid.png b/ExtraTextures/Lasers/UniverseSplitterHugeBeamMid.png new file mode 100644 index 0000000000..3fea77c900 Binary files /dev/null and b/ExtraTextures/Lasers/UniverseSplitterHugeBeamMid.png differ diff --git a/ExtraTextures/Lasers/UniverseSplitterSmallBeamBegin.png b/ExtraTextures/Lasers/UniverseSplitterSmallBeamBegin.png new file mode 100644 index 0000000000..1f385eb929 Binary files /dev/null and b/ExtraTextures/Lasers/UniverseSplitterSmallBeamBegin.png differ diff --git a/ExtraTextures/Lasers/UniverseSplitterSmallBeamEnd.png b/ExtraTextures/Lasers/UniverseSplitterSmallBeamEnd.png new file mode 100644 index 0000000000..2704d556d4 Binary files /dev/null and b/ExtraTextures/Lasers/UniverseSplitterSmallBeamEnd.png differ diff --git a/ExtraTextures/Lasers/UniverseSplitterSmallBeamMid.png b/ExtraTextures/Lasers/UniverseSplitterSmallBeamMid.png new file mode 100644 index 0000000000..ceb754745d Binary files /dev/null and b/ExtraTextures/Lasers/UniverseSplitterSmallBeamMid.png differ diff --git a/ExtraTextures/Particles/Fire.png b/ExtraTextures/Particles/Fire.png new file mode 100644 index 0000000000..cc76a599b3 Binary files /dev/null and b/ExtraTextures/Particles/Fire.png differ diff --git a/ExtraTextures/Particles/Light.png b/ExtraTextures/Particles/Light.png new file mode 100644 index 0000000000..8e2d2a871c Binary files /dev/null and b/ExtraTextures/Particles/Light.png differ diff --git a/ExtraTextures/ScarletDevilStreak.png b/ExtraTextures/ScarletDevilStreak.png new file mode 100644 index 0000000000..389379b370 Binary files /dev/null and b/ExtraTextures/ScarletDevilStreak.png differ diff --git a/ExtraTextures/SwordSlashTexture.png b/ExtraTextures/SwordSlashTexture.png new file mode 100644 index 0000000000..4bb428f196 Binary files /dev/null and b/ExtraTextures/SwordSlashTexture.png differ diff --git a/ExtraTextures/TaintedArm.png b/ExtraTextures/TaintedArm.png new file mode 100644 index 0000000000..f8796f05e7 Binary files /dev/null and b/ExtraTextures/TaintedArm.png differ diff --git a/ExtraTextures/TaintedForearm.png b/ExtraTextures/TaintedForearm.png new file mode 100644 index 0000000000..09355c363c Binary files /dev/null and b/ExtraTextures/TaintedForearm.png differ diff --git a/ExtraTextures/TaintedHand.png b/ExtraTextures/TaintedHand.png new file mode 100644 index 0000000000..89e494b14c Binary files /dev/null and b/ExtraTextures/TaintedHand.png differ diff --git a/ExtraTextures/TaintedHand2.png b/ExtraTextures/TaintedHand2.png new file mode 100644 index 0000000000..7050006ac8 Binary files /dev/null and b/ExtraTextures/TaintedHand2.png differ diff --git a/ExtraTextures/Tanks/Backpack_FlurrystormCannon.png b/ExtraTextures/Tanks/Backpack_FlurrystormCannon.png index 596a1e863e..9f3ed77630 100644 Binary files a/ExtraTextures/Tanks/Backpack_FlurrystormCannon.png and b/ExtraTextures/Tanks/Backpack_FlurrystormCannon.png differ diff --git a/ExtraTextures/TelluricGlareStreak.png b/ExtraTextures/TelluricGlareStreak.png new file mode 100644 index 0000000000..7793d1e456 Binary files /dev/null and b/ExtraTextures/TelluricGlareStreak.png differ diff --git a/ExtraTextures/ThanatosVentParticle.png b/ExtraTextures/ThanatosVentParticle.png new file mode 100644 index 0000000000..a66a5aa743 Binary files /dev/null and b/ExtraTextures/ThanatosVentParticle.png differ diff --git a/ExtraTextures/UI/AdrenalineDisplay_Ectoheart.png b/ExtraTextures/UI/AdrenalineDisplay_Ectoheart.png new file mode 100644 index 0000000000..332b6a9802 Binary files /dev/null and b/ExtraTextures/UI/AdrenalineDisplay_Ectoheart.png differ diff --git a/ExtraTextures/UI/AdrenalineDisplay_ElectrolyteGelPack.png b/ExtraTextures/UI/AdrenalineDisplay_ElectrolyteGelPack.png new file mode 100644 index 0000000000..c65cd11dd4 Binary files /dev/null and b/ExtraTextures/UI/AdrenalineDisplay_ElectrolyteGelPack.png differ diff --git a/ExtraTextures/UI/AdrenalineDisplay_StarlightFuelCell.png b/ExtraTextures/UI/AdrenalineDisplay_StarlightFuelCell.png new file mode 100644 index 0000000000..5ed02ad764 Binary files /dev/null and b/ExtraTextures/UI/AdrenalineDisplay_StarlightFuelCell.png differ diff --git a/ExtraTextures/UI/AstralArcanumCircles.png b/ExtraTextures/UI/AstralArcanumCircles.png index badfdb493a..2368842261 100644 Binary files a/ExtraTextures/UI/AstralArcanumCircles.png and b/ExtraTextures/UI/AstralArcanumCircles.png differ diff --git a/ExtraTextures/UI/BossRushIcon.png b/ExtraTextures/UI/BossRushIcon.png new file mode 100644 index 0000000000..ee56fb7957 Binary files /dev/null and b/ExtraTextures/UI/BossRushIcon.png differ diff --git a/ExtraTextures/UI/CalamitasCurseBackground.png b/ExtraTextures/UI/CalamitasCurseBackground.png new file mode 100644 index 0000000000..29555271c1 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseBackground.png differ diff --git a/ExtraTextures/UI/CalamitasCurseItemSlot.png b/ExtraTextures/UI/CalamitasCurseItemSlot.png new file mode 100644 index 0000000000..59e813980f Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseItemSlot.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowDown.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowDown.png new file mode 100644 index 0000000000..055426f728 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ArrowDown.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked.png new file mode 100644 index 0000000000..21aa985d34 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ArrowDownClicked.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered.png new file mode 100644 index 0000000000..56352fe81f Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowUp.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowUp.png new file mode 100644 index 0000000000..7b06ca7dda Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ArrowUp.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked.png new file mode 100644 index 0000000000..fc8bc6b539 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered.png b/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered.png new file mode 100644 index 0000000000..6894e585fc Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ArrowUpHovered.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_Button.png b/ExtraTextures/UI/CalamitasCurseUI_Button.png new file mode 100644 index 0000000000..42694b1b18 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_Button.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ButtonClicked.png b/ExtraTextures/UI/CalamitasCurseUI_ButtonClicked.png new file mode 100644 index 0000000000..c817343035 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ButtonClicked.png differ diff --git a/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered.png b/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered.png new file mode 100644 index 0000000000..3b9ad755f1 Binary files /dev/null and b/ExtraTextures/UI/CalamitasCurseUI_ButtonHovered.png differ diff --git a/ExtraTextures/UI/ChargeMeter.png b/ExtraTextures/UI/ChargeMeter.png new file mode 100644 index 0000000000..899126a050 Binary files /dev/null and b/ExtraTextures/UI/ChargeMeter.png differ diff --git a/ExtraTextures/UI/ChargeMeterBorder.png b/ExtraTextures/UI/ChargeMeterBorder.png new file mode 100644 index 0000000000..3d40d53372 Binary files /dev/null and b/ExtraTextures/UI/ChargeMeterBorder.png differ diff --git a/ExtraTextures/UI/DraedonWeaponUISlot.png b/ExtraTextures/UI/ChargerWeaponSlot.png similarity index 100% rename from ExtraTextures/UI/DraedonWeaponUISlot.png rename to ExtraTextures/UI/ChargerWeaponSlot.png diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame.png new file mode 100644 index 0000000000..8d8c0b27ec Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty.png new file mode 100644 index 0000000000..583179b633 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Capricious.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Capricious.png new file mode 100644 index 0000000000..9c75e5ba01 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Capricious.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral.png new file mode 100644 index 0000000000..5d8f8666be Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Erratic.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Erratic.png new file mode 100644 index 0000000000..9d114ac4af Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Erratic.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evasive.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evasive.png new file mode 100644 index 0000000000..3969952ddc Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evasive.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evocative.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evocative.png new file mode 100644 index 0000000000..588a10e3b0 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Evocative.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed.png new file mode 100644 index 0000000000..584bd62881 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound.png new file mode 100644 index 0000000000..96b2a87a02 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Incisive.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Incisive.png new file mode 100644 index 0000000000..fe9459ec61 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Incisive.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant.png new file mode 100644 index 0000000000..526223131e Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Lecherous.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Lecherous.png new file mode 100644 index 0000000000..fcbbe480bb Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Lecherous.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Oblatory.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Oblatory.png new file mode 100644 index 0000000000..f4d86bb62f Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Oblatory.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Obstinate.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Obstinate.png new file mode 100644 index 0000000000..41a740b387 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Obstinate.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted.png new file mode 100644 index 0000000000..d4999cd4ad Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Polluted.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Polluted.png new file mode 100644 index 0000000000..4edccb5b2b Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Polluted.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Relentless.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Relentless.png new file mode 100644 index 0000000000..df19b8d4c1 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Relentless.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful.png new file mode 100644 index 0000000000..6259357bb1 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Splintered.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Splintered.png new file mode 100644 index 0000000000..0f75aff9d7 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Splintered.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Tainted.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Tainted.png new file mode 100644 index 0000000000..c3b9d97ec5 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Tainted.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous.png new file mode 100644 index 0000000000..9a7f8c7cec Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Vindictive.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Vindictive.png new file mode 100644 index 0000000000..3a768a4e8e Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Vindictive.png differ diff --git a/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered.png b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered.png new file mode 100644 index 0000000000..fd20048613 Binary files /dev/null and b/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered.png differ diff --git a/ExtraTextures/UI/ModeIndicatorArea.png b/ExtraTextures/UI/ModeIndicatorArea.png new file mode 100644 index 0000000000..508fe00039 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorArea.png differ diff --git a/ExtraTextures/UI/ModeIndicatorArma.png b/ExtraTextures/UI/ModeIndicatorArma.png new file mode 100644 index 0000000000..619f29b4a2 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorArma.png differ diff --git a/ExtraTextures/UI/ModeIndicatorDeath.png b/ExtraTextures/UI/ModeIndicatorDeath.png new file mode 100644 index 0000000000..cdf63aea54 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorDeath.png differ diff --git a/ExtraTextures/UI/ModeIndicatorMalice.png b/ExtraTextures/UI/ModeIndicatorMalice.png new file mode 100644 index 0000000000..c19e5c029e Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorMalice.png differ diff --git a/ExtraTextures/UI/ModeIndicatorRev.png b/ExtraTextures/UI/ModeIndicatorRev.png new file mode 100644 index 0000000000..6086ff88b7 Binary files /dev/null and b/ExtraTextures/UI/ModeIndicatorRev.png differ diff --git a/ExtraTextures/UI/DraedonFuelCellUISlot.png b/ExtraTextures/UI/PowerCellSlot_Empty.png similarity index 100% rename from ExtraTextures/UI/DraedonFuelCellUISlot.png rename to ExtraTextures/UI/PowerCellSlot_Empty.png diff --git a/ExtraTextures/UI/DraedonFuelCellUISlotFilled.png b/ExtraTextures/UI/PowerCellSlot_Filled.png similarity index 100% rename from ExtraTextures/UI/DraedonFuelCellUISlotFilled.png rename to ExtraTextures/UI/PowerCellSlot_Filled.png diff --git a/ExtraTextures/UI/RageDisplay_InfernalBlood.png b/ExtraTextures/UI/RageDisplay_InfernalBlood.png new file mode 100644 index 0000000000..3c845d0dac Binary files /dev/null and b/ExtraTextures/UI/RageDisplay_InfernalBlood.png differ diff --git a/ExtraTextures/UI/RageDisplay_MushroomPlasmaRoot.png b/ExtraTextures/UI/RageDisplay_MushroomPlasmaRoot.png new file mode 100644 index 0000000000..9c548f1796 Binary files /dev/null and b/ExtraTextures/UI/RageDisplay_MushroomPlasmaRoot.png differ diff --git a/ExtraTextures/UI/RageDisplay_RedLightningContainer.png b/ExtraTextures/UI/RageDisplay_RedLightningContainer.png new file mode 100644 index 0000000000..320e7313eb Binary files /dev/null and b/ExtraTextures/UI/RageDisplay_RedLightningContainer.png differ diff --git a/ExtraTextures/VoidConcentrationAura.png b/ExtraTextures/VoidConcentrationAura.png new file mode 100644 index 0000000000..2b5d2fb66c Binary files /dev/null and b/ExtraTextures/VoidConcentrationAura.png differ diff --git a/Gores/Apollo/ApolloTransitionGore.png b/Gores/Apollo/ApolloTransitionGore.png new file mode 100644 index 0000000000..0f1b028620 Binary files /dev/null and b/Gores/Apollo/ApolloTransitionGore.png differ diff --git a/Gores/Ares/AresArm_Gore1.png b/Gores/Ares/AresArm_Gore1.png new file mode 100644 index 0000000000..7aa6065a49 Binary files /dev/null and b/Gores/Ares/AresArm_Gore1.png differ diff --git a/Gores/Ares/AresArm_Gore2.png b/Gores/Ares/AresArm_Gore2.png new file mode 100644 index 0000000000..60a6c919de Binary files /dev/null and b/Gores/Ares/AresArm_Gore2.png differ diff --git a/Gores/Ares/AresArm_Gore3.png b/Gores/Ares/AresArm_Gore3.png new file mode 100644 index 0000000000..2fbe603cdc Binary files /dev/null and b/Gores/Ares/AresArm_Gore3.png differ diff --git a/Gores/Ares/AresBody1.png b/Gores/Ares/AresBody1.png new file mode 100644 index 0000000000..35c229b25e Binary files /dev/null and b/Gores/Ares/AresBody1.png differ diff --git a/Gores/Ares/AresBody2.png b/Gores/Ares/AresBody2.png new file mode 100644 index 0000000000..391c777385 Binary files /dev/null and b/Gores/Ares/AresBody2.png differ diff --git a/Gores/Ares/AresBody3.png b/Gores/Ares/AresBody3.png new file mode 100644 index 0000000000..03788a2d76 Binary files /dev/null and b/Gores/Ares/AresBody3.png differ diff --git a/Gores/Ares/AresBody4.png b/Gores/Ares/AresBody4.png new file mode 100644 index 0000000000..42f09bf434 Binary files /dev/null and b/Gores/Ares/AresBody4.png differ diff --git a/Gores/Ares/AresBody5.png b/Gores/Ares/AresBody5.png new file mode 100644 index 0000000000..e18eb5a29a Binary files /dev/null and b/Gores/Ares/AresBody5.png differ diff --git a/Gores/Ares/AresBody6.png b/Gores/Ares/AresBody6.png new file mode 100644 index 0000000000..f699679217 Binary files /dev/null and b/Gores/Ares/AresBody6.png differ diff --git a/Gores/Ares/AresBody7.png b/Gores/Ares/AresBody7.png new file mode 100644 index 0000000000..e9a8d20201 Binary files /dev/null and b/Gores/Ares/AresBody7.png differ diff --git a/Gores/Ares/AresGaussNuke1.png b/Gores/Ares/AresGaussNuke1.png new file mode 100644 index 0000000000..0a1bbb2327 Binary files /dev/null and b/Gores/Ares/AresGaussNuke1.png differ diff --git a/Gores/Ares/AresGaussNuke2.png b/Gores/Ares/AresGaussNuke2.png new file mode 100644 index 0000000000..9e45c93b48 Binary files /dev/null and b/Gores/Ares/AresGaussNuke2.png differ diff --git a/Gores/Ares/AresGaussNuke3.png b/Gores/Ares/AresGaussNuke3.png new file mode 100644 index 0000000000..7b2207d68e Binary files /dev/null and b/Gores/Ares/AresGaussNuke3.png differ diff --git a/Gores/Ares/AresHandBase1.png b/Gores/Ares/AresHandBase1.png new file mode 100644 index 0000000000..4000a1234c Binary files /dev/null and b/Gores/Ares/AresHandBase1.png differ diff --git a/Gores/Ares/AresHandBase2.png b/Gores/Ares/AresHandBase2.png new file mode 100644 index 0000000000..d1dcda125e Binary files /dev/null and b/Gores/Ares/AresHandBase2.png differ diff --git a/Gores/Ares/AresHandBase3.png b/Gores/Ares/AresHandBase3.png new file mode 100644 index 0000000000..4f111bc03e Binary files /dev/null and b/Gores/Ares/AresHandBase3.png differ diff --git a/Gores/Ares/AresLaserCannon1.png b/Gores/Ares/AresLaserCannon1.png new file mode 100644 index 0000000000..075c4fed61 Binary files /dev/null and b/Gores/Ares/AresLaserCannon1.png differ diff --git a/Gores/Ares/AresLaserCannon2.png b/Gores/Ares/AresLaserCannon2.png new file mode 100644 index 0000000000..e94d2e3bf0 Binary files /dev/null and b/Gores/Ares/AresLaserCannon2.png differ diff --git a/Gores/Ares/AresPlasmaFlamethrower1.png b/Gores/Ares/AresPlasmaFlamethrower1.png new file mode 100644 index 0000000000..ae954eedbb Binary files /dev/null and b/Gores/Ares/AresPlasmaFlamethrower1.png differ diff --git a/Gores/Ares/AresPlasmaFlamethrower2.png b/Gores/Ares/AresPlasmaFlamethrower2.png new file mode 100644 index 0000000000..1a4228a1d3 Binary files /dev/null and b/Gores/Ares/AresPlasmaFlamethrower2.png differ diff --git a/Gores/Ares/AresTeslaCannon1.png b/Gores/Ares/AresTeslaCannon1.png new file mode 100644 index 0000000000..e6b92d27da Binary files /dev/null and b/Gores/Ares/AresTeslaCannon1.png differ diff --git a/Gores/Ares/AresTeslaCannon2.png b/Gores/Ares/AresTeslaCannon2.png new file mode 100644 index 0000000000..9b54ff4391 Binary files /dev/null and b/Gores/Ares/AresTeslaCannon2.png differ diff --git a/Gores/Artemis/ArtemisTransitionGore.png b/Gores/Artemis/ArtemisTransitionGore.png new file mode 100644 index 0000000000..91ded581a5 Binary files /dev/null and b/Gores/Artemis/ArtemisTransitionGore.png differ diff --git a/Gores/CalamitasGores/SoulSeeker.png b/Gores/CalamitasGores/SoulSeeker.png new file mode 100644 index 0000000000..027fba8147 Binary files /dev/null and b/Gores/CalamitasGores/SoulSeeker.png differ diff --git a/Gores/CalamitasGores/SoulSeeker2.png b/Gores/CalamitasGores/SoulSeeker2.png new file mode 100644 index 0000000000..c139bc37be Binary files /dev/null and b/Gores/CalamitasGores/SoulSeeker2.png differ diff --git a/Gores/CalamitasGores/SoulSeeker3.png b/Gores/CalamitasGores/SoulSeeker3.png new file mode 100644 index 0000000000..de8ae55143 Binary files /dev/null and b/Gores/CalamitasGores/SoulSeeker3.png differ diff --git a/Gores/CultistAssassinGores/CultistAssassin.png b/Gores/CultistAssassinGores/CultistAssassin.png new file mode 100644 index 0000000000..80ef0bd5a5 Binary files /dev/null and b/Gores/CultistAssassinGores/CultistAssassin.png differ diff --git a/Gores/CultistAssassinGores/CultistAssassin2.png b/Gores/CultistAssassinGores/CultistAssassin2.png new file mode 100644 index 0000000000..b4d740b250 Binary files /dev/null and b/Gores/CultistAssassinGores/CultistAssassin2.png differ diff --git a/Gores/CultistAssassinGores/CultistAssassin3.png b/Gores/CultistAssassinGores/CultistAssassin3.png new file mode 100644 index 0000000000..5350c9bc37 Binary files /dev/null and b/Gores/CultistAssassinGores/CultistAssassin3.png differ diff --git a/Gores/DespairStoneGores/DespairStone.png b/Gores/DespairStoneGores/DespairStone.png new file mode 100644 index 0000000000..2a59f561f1 Binary files /dev/null and b/Gores/DespairStoneGores/DespairStone.png differ diff --git a/Gores/DespairStoneGores/DespairStone2.png b/Gores/DespairStoneGores/DespairStone2.png new file mode 100644 index 0000000000..1745408b2a Binary files /dev/null and b/Gores/DespairStoneGores/DespairStone2.png differ diff --git a/Gores/EidiolistGores/Eidolist.png b/Gores/EidiolistGores/Eidolist.png new file mode 100644 index 0000000000..61029bc5ea Binary files /dev/null and b/Gores/EidiolistGores/Eidolist.png differ diff --git a/Gores/EidiolistGores/Eidolist2.png b/Gores/EidiolistGores/Eidolist2.png new file mode 100644 index 0000000000..698aa4bf1d Binary files /dev/null and b/Gores/EidiolistGores/Eidolist2.png differ diff --git a/Gores/EidiolistGores/Eidolist3.png b/Gores/EidiolistGores/Eidolist3.png new file mode 100644 index 0000000000..7d62499166 Binary files /dev/null and b/Gores/EidiolistGores/Eidolist3.png differ diff --git a/Gores/EidiolistGores/Eidolist4.png b/Gores/EidiolistGores/Eidolist4.png new file mode 100644 index 0000000000..f7b1a1c325 Binary files /dev/null and b/Gores/EidiolistGores/Eidolist4.png differ diff --git a/Gores/PrismShurikenBlade.png b/Gores/PrismShurikenBlade.png new file mode 100644 index 0000000000..650f27e8c1 Binary files /dev/null and b/Gores/PrismShurikenBlade.png differ diff --git a/Gores/ScavengerGores/RockPillar.png b/Gores/ScavengerGores/RockPillar.png new file mode 100644 index 0000000000..bbf0da6e64 Binary files /dev/null and b/Gores/ScavengerGores/RockPillar.png differ diff --git a/Gores/ScavengerGores/RockPillar2.png b/Gores/ScavengerGores/RockPillar2.png new file mode 100644 index 0000000000..905c0ac945 Binary files /dev/null and b/Gores/ScavengerGores/RockPillar2.png differ diff --git a/Gores/ScavengerGores/RockPillar3.png b/Gores/ScavengerGores/RockPillar3.png new file mode 100644 index 0000000000..ebe0818179 Binary files /dev/null and b/Gores/ScavengerGores/RockPillar3.png differ diff --git a/Gores/ScavengerGores/RockPillar4.png b/Gores/ScavengerGores/RockPillar4.png new file mode 100644 index 0000000000..57225e9625 Binary files /dev/null and b/Gores/ScavengerGores/RockPillar4.png differ diff --git a/Gores/ScavengerGores/RockPillar5.png b/Gores/ScavengerGores/RockPillar5.png new file mode 100644 index 0000000000..e494388c5c Binary files /dev/null and b/Gores/ScavengerGores/RockPillar5.png differ diff --git a/Gores/ScavengerGores/RockPillar6.png b/Gores/ScavengerGores/RockPillar6.png new file mode 100644 index 0000000000..afba339990 Binary files /dev/null and b/Gores/ScavengerGores/RockPillar6.png differ diff --git a/Gores/ScryllarGores/Scryllar.png b/Gores/ScryllarGores/Scryllar.png new file mode 100644 index 0000000000..e0b97e744b Binary files /dev/null and b/Gores/ScryllarGores/Scryllar.png differ diff --git a/Gores/ScryllarGores/ScryllarRage.png b/Gores/ScryllarGores/ScryllarRage.png new file mode 100644 index 0000000000..1ca48810b3 Binary files /dev/null and b/Gores/ScryllarGores/ScryllarRage.png differ diff --git a/Gores/ScryllarGores/ScryllarRage2.png b/Gores/ScryllarGores/ScryllarRage2.png new file mode 100644 index 0000000000..156c22870f Binary files /dev/null and b/Gores/ScryllarGores/ScryllarRage2.png differ diff --git a/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore1.png b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore1.png new file mode 100644 index 0000000000..4009972a78 Binary files /dev/null and b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore1.png differ diff --git a/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore2.png b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore2.png new file mode 100644 index 0000000000..52719a2fe3 Binary files /dev/null and b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore2.png differ diff --git a/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore3.png b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore3.png new file mode 100644 index 0000000000..60e920cd32 Binary files /dev/null and b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore3.png differ diff --git a/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore4.png b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore4.png new file mode 100644 index 0000000000..3e9bf7b6b2 Binary files /dev/null and b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore4.png differ diff --git a/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore5.png b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore5.png new file mode 100644 index 0000000000..e7d3579972 Binary files /dev/null and b/Gores/SoulSeekerSupremeGores/SupremeSoulSeeker_Gore5.png differ diff --git a/Gores/SoulSlurperGores/SoulSlurper.png b/Gores/SoulSlurperGores/SoulSlurper.png new file mode 100644 index 0000000000..a51261bf13 Binary files /dev/null and b/Gores/SoulSlurperGores/SoulSlurper.png differ diff --git a/Gores/SoulSlurperGores/SoulSlurper2.png b/Gores/SoulSlurperGores/SoulSlurper2.png new file mode 100644 index 0000000000..10ef2f8ce5 Binary files /dev/null and b/Gores/SoulSlurperGores/SoulSlurper2.png differ diff --git a/Gores/SoulSlurperGores/SoulSlurper3.png b/Gores/SoulSlurperGores/SoulSlurper3.png new file mode 100644 index 0000000000..8cea7d54e7 Binary files /dev/null and b/Gores/SoulSlurperGores/SoulSlurper3.png differ diff --git a/Gores/StormlionGores/Stormlion.png b/Gores/StormlionGores/Stormlion.png new file mode 100644 index 0000000000..4e41a896d4 Binary files /dev/null and b/Gores/StormlionGores/Stormlion.png differ diff --git a/Gores/StormlionGores/Stormlion2.png b/Gores/StormlionGores/Stormlion2.png new file mode 100644 index 0000000000..dc06b3ae7f Binary files /dev/null and b/Gores/StormlionGores/Stormlion2.png differ diff --git a/Gores/StormlionGores/Stormlion3.png b/Gores/StormlionGores/Stormlion3.png new file mode 100644 index 0000000000..e6b0edf903 Binary files /dev/null and b/Gores/StormlionGores/Stormlion3.png differ diff --git a/Gores/StormlionGores/Stormlion4.png b/Gores/StormlionGores/Stormlion4.png new file mode 100644 index 0000000000..77b6ce0855 Binary files /dev/null and b/Gores/StormlionGores/Stormlion4.png differ diff --git a/Gores/SulphSeaGen/AbyssPotGore1.png b/Gores/SulphSeaGen/AbyssPotGore1.png new file mode 100644 index 0000000000..cd19852002 Binary files /dev/null and b/Gores/SulphSeaGen/AbyssPotGore1.png differ diff --git a/Gores/SulphSeaGen/AbyssPotGore2.png b/Gores/SulphSeaGen/AbyssPotGore2.png new file mode 100644 index 0000000000..9554ae7280 Binary files /dev/null and b/Gores/SulphSeaGen/AbyssPotGore2.png differ diff --git a/Gores/SulphSeaGen/SulphPotGore1.png b/Gores/SulphSeaGen/SulphPotGore1.png new file mode 100644 index 0000000000..1658793e55 Binary files /dev/null and b/Gores/SulphSeaGen/SulphPotGore1.png differ diff --git a/Gores/SulphSeaGen/SulphPotGore2.png b/Gores/SulphSeaGen/SulphPotGore2.png new file mode 100644 index 0000000000..917322ebf9 Binary files /dev/null and b/Gores/SulphSeaGen/SulphPotGore2.png differ diff --git a/Gores/SupremeCalamitas/BrimstoneHeart_Gore1.png b/Gores/SupremeCalamitas/BrimstoneHeart_Gore1.png new file mode 100644 index 0000000000..491063f204 Binary files /dev/null and b/Gores/SupremeCalamitas/BrimstoneHeart_Gore1.png differ diff --git a/Gores/SupremeCalamitas/BrimstoneHeart_Gore2.png b/Gores/SupremeCalamitas/BrimstoneHeart_Gore2.png new file mode 100644 index 0000000000..cb35235480 Binary files /dev/null and b/Gores/SupremeCalamitas/BrimstoneHeart_Gore2.png differ diff --git a/Gores/SupremeCalamitas/SepulcherArm_Gore.png b/Gores/SupremeCalamitas/SepulcherArm_Gore.png new file mode 100644 index 0000000000..fb7678cb5e Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherArm_Gore.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore1.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore1.png new file mode 100644 index 0000000000..cc91d0b99b Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore1.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore2.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore2.png new file mode 100644 index 0000000000..8d735724fc Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore2.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore3.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore3.png new file mode 100644 index 0000000000..3f01d98028 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore3.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore4.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore4.png new file mode 100644 index 0000000000..75e2bb2043 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore4.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore5.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore5.png new file mode 100644 index 0000000000..206ff5884f Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore5.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore6.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore6.png new file mode 100644 index 0000000000..1503860b0e Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore6.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore7.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore7.png new file mode 100644 index 0000000000..7f91f058e8 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore7.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore8.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore8.png new file mode 100644 index 0000000000..08f213b100 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore8.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody1_Gore9.png b/Gores/SupremeCalamitas/SepulcherBody1_Gore9.png new file mode 100644 index 0000000000..5909b57a8f Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody1_Gore9.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore1.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore1.png new file mode 100644 index 0000000000..66ad61c1c4 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore1.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore2.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore2.png new file mode 100644 index 0000000000..a0afe9c2c6 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore2.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore3.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore3.png new file mode 100644 index 0000000000..c51e0c6e39 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore3.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore4.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore4.png new file mode 100644 index 0000000000..27c13b1f12 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore4.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore5.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore5.png new file mode 100644 index 0000000000..56369887b4 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore5.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore6.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore6.png new file mode 100644 index 0000000000..a558507804 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore6.png differ diff --git a/Gores/SupremeCalamitas/SepulcherBody2_Gore7.png b/Gores/SupremeCalamitas/SepulcherBody2_Gore7.png new file mode 100644 index 0000000000..840e976c65 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherBody2_Gore7.png differ diff --git a/Gores/SupremeCalamitas/SepulcherForearm_Gore1.png b/Gores/SupremeCalamitas/SepulcherForearm_Gore1.png new file mode 100644 index 0000000000..8aebfc14ea Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherForearm_Gore1.png differ diff --git a/Gores/SupremeCalamitas/SepulcherForearm_Gore2.png b/Gores/SupremeCalamitas/SepulcherForearm_Gore2.png new file mode 100644 index 0000000000..6272a4257c Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherForearm_Gore2.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHand_Gore1.png b/Gores/SupremeCalamitas/SepulcherHand_Gore1.png new file mode 100644 index 0000000000..1481801d09 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHand_Gore1.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHand_Gore2.png b/Gores/SupremeCalamitas/SepulcherHand_Gore2.png new file mode 100644 index 0000000000..e0534c6502 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHand_Gore2.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHead_Gore1.png b/Gores/SupremeCalamitas/SepulcherHead_Gore1.png new file mode 100644 index 0000000000..955bb07c3e Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHead_Gore1.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHead_Gore2.png b/Gores/SupremeCalamitas/SepulcherHead_Gore2.png new file mode 100644 index 0000000000..9615453c81 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHead_Gore2.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHead_Gore3.png b/Gores/SupremeCalamitas/SepulcherHead_Gore3.png new file mode 100644 index 0000000000..52ada3c123 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHead_Gore3.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHead_Gore4.png b/Gores/SupremeCalamitas/SepulcherHead_Gore4.png new file mode 100644 index 0000000000..7b37e0a607 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHead_Gore4.png differ diff --git a/Gores/SupremeCalamitas/SepulcherHead_Gore5.png b/Gores/SupremeCalamitas/SepulcherHead_Gore5.png new file mode 100644 index 0000000000..d8f20446d2 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherHead_Gore5.png differ diff --git a/Gores/SupremeCalamitas/SepulcherTail_Gore1.png b/Gores/SupremeCalamitas/SepulcherTail_Gore1.png new file mode 100644 index 0000000000..40ca1472d8 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherTail_Gore1.png differ diff --git a/Gores/SupremeCalamitas/SepulcherTail_Gore2.png b/Gores/SupremeCalamitas/SepulcherTail_Gore2.png new file mode 100644 index 0000000000..81a900a180 Binary files /dev/null and b/Gores/SupremeCalamitas/SepulcherTail_Gore2.png differ diff --git a/Gores/Thanatos/ThanatosBody1.png b/Gores/Thanatos/ThanatosBody1.png new file mode 100644 index 0000000000..846ec8a27e Binary files /dev/null and b/Gores/Thanatos/ThanatosBody1.png differ diff --git a/Gores/Thanatos/ThanatosBody1_2.png b/Gores/Thanatos/ThanatosBody1_2.png new file mode 100644 index 0000000000..b5aa29046b Binary files /dev/null and b/Gores/Thanatos/ThanatosBody1_2.png differ diff --git a/Gores/Thanatos/ThanatosBody1_3.png b/Gores/Thanatos/ThanatosBody1_3.png new file mode 100644 index 0000000000..d22ecb673b Binary files /dev/null and b/Gores/Thanatos/ThanatosBody1_3.png differ diff --git a/Gores/Thanatos/ThanatosBody2.png b/Gores/Thanatos/ThanatosBody2.png new file mode 100644 index 0000000000..88b0bd01e5 Binary files /dev/null and b/Gores/Thanatos/ThanatosBody2.png differ diff --git a/Gores/Thanatos/ThanatosBody2_2.png b/Gores/Thanatos/ThanatosBody2_2.png new file mode 100644 index 0000000000..cb7ae15507 Binary files /dev/null and b/Gores/Thanatos/ThanatosBody2_2.png differ diff --git a/Gores/Thanatos/ThanatosBody2_3.png b/Gores/Thanatos/ThanatosBody2_3.png new file mode 100644 index 0000000000..97eb4cc715 Binary files /dev/null and b/Gores/Thanatos/ThanatosBody2_3.png differ diff --git a/Gores/Thanatos/ThanatosHead.png b/Gores/Thanatos/ThanatosHead.png new file mode 100644 index 0000000000..dfb3f287c6 Binary files /dev/null and b/Gores/Thanatos/ThanatosHead.png differ diff --git a/Gores/Thanatos/ThanatosHead2.png b/Gores/Thanatos/ThanatosHead2.png new file mode 100644 index 0000000000..7df1a911da Binary files /dev/null and b/Gores/Thanatos/ThanatosHead2.png differ diff --git a/Gores/Thanatos/ThanatosHead3.png b/Gores/Thanatos/ThanatosHead3.png new file mode 100644 index 0000000000..ecc13b3891 Binary files /dev/null and b/Gores/Thanatos/ThanatosHead3.png differ diff --git a/Gores/Thanatos/ThanatosTail.png b/Gores/Thanatos/ThanatosTail.png new file mode 100644 index 0000000000..38ec9513fb Binary files /dev/null and b/Gores/Thanatos/ThanatosTail.png differ diff --git a/Gores/Thanatos/ThanatosTail2.png b/Gores/Thanatos/ThanatosTail2.png new file mode 100644 index 0000000000..ec5cf41bdb Binary files /dev/null and b/Gores/Thanatos/ThanatosTail2.png differ diff --git a/Gores/Thanatos/ThanatosTail3.png b/Gores/Thanatos/ThanatosTail3.png new file mode 100644 index 0000000000..22acef22dc Binary files /dev/null and b/Gores/Thanatos/ThanatosTail3.png differ diff --git a/Gores/Thanatos/ThanatosTail4.png b/Gores/Thanatos/ThanatosTail4.png new file mode 100644 index 0000000000..09c638cebf Binary files /dev/null and b/Gores/Thanatos/ThanatosTail4.png differ diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 67e56ecc37..4da556c7f3 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -1,35 +1,1001 @@ +using CalamityMod.CalPlayer; +using CalamityMod.NPCs; +using CalamityMod.Projectiles; +using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil.Cil; using MonoMod.Cil; using System; +using System.Collections.Generic; +using System.Reflection; using Terraria; +using Terraria.GameInput; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI.Gamepad; +using Terraria.Utilities; +using Terraria.World.Generation; namespace CalamityMod.ILEditing { public class ILChanges { + // This list should contain all vanilla NPCs present in Boss Rush which ARE NOT bosses and whose health is boosted over 32,768. + private static readonly List NeedsFourLifeBytes = new List() + { + // King Slime + NPCID.BlueSlime, + NPCID.SlimeSpiked, + NPCID.RedSlime, + NPCID.PurpleSlime, + NPCID.YellowSlime, + NPCID.IceSlime, + NPCID.UmbrellaSlime, + NPCID.RainbowSlime, + NPCID.Pinky, + + // Eye of Cthulhu + NPCID.ServantofCthulhu, + + // Eater of Worlds + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + + // Brain of Cthulhu + NPCID.Creeper, + + // Skeletron + NPCID.SkeletronHand, + + // Wall of Flesh + NPCID.WallofFleshEye, + + // The Destroyer + NPCID.Probe, + + // Skeletron Prime + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PrimeCannon, + + // Plantera + NPCID.PlanterasTentacle, + + // Golem + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + + // Cultist + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + }; + + // Holds the vanilla game function which spawns town NPCs, wrapped in a delegate for reflection purposes. + // This function is (optionally) invoked manually in an IL edit to enable NPCs to spawn at night. + private static Action VanillaSpawnTownNPCs; + + private static int labDoorOpen = -1; + private static int labDoorClosed = -1; + private static int aLabDoorOpen = -1; + private static int aLabDoorClosed = -1; + + #region Load / Unload /// /// Loads all IL Editing changes in the mod. /// - public static void Initialize() + internal static void Load() { - IL.Terraria.WorldGen.MakeDungeon += (il) => + // Wrap the vanilla town NPC spawning function in a delegate so that it can be tossed around and called at will. + var updateTime = typeof(Main).GetMethod("UpdateTime_SpawnTownNPCs", BindingFlags.Static | BindingFlags.NonPublic); + VanillaSpawnTownNPCs = Delegate.CreateDelegate(typeof(Action), updateTime) as Action; + + // Cache the four lab door tile types for efficiency. + labDoorOpen = ModContent.TileType(); + labDoorClosed = ModContent.TileType(); + aLabDoorOpen = ModContent.TileType(); + aLabDoorClosed = ModContent.TileType(); + + // Mechanics / features + IL.Terraria.Main.UpdateTime += PermitNighttimeTownNPCSpawning; + On.Terraria.Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate; + IL.Terraria.Player.Hurt += RemoveRNGFromBlackBelt; + On.Terraria.WorldGen.OpenDoor += OpenDoor_LabDoorOverride; + On.Terraria.WorldGen.CloseDoor += CloseDoor_LabDoorOverride; + On.Terraria.Wiring.Teleport += DisableTeleporters; // only applies in boss rush + IL.Terraria.Main.DrawInterface_40_InteractItemIcon += MakeMouseHoverItemsSupportAnimations; + On.Terraria.Item.AffixName += IncorporateEnchantmentInAffix; + On.Terraria.Projectile.NewProjectile_float_float_float_float_int_int_float_int_float_float += IncorporateMinionExplodingCountdown; + On.Terraria.Main.DrawCursor += UseCoolFireCursorEffect; + + // Damage and health balance + IL.Terraria.Main.DamageVar += AdjustDamageVariance; + IL.Terraria.NPC.scaleStats += RemoveExpertHardmodeScaling; + IL.Terraria.Projectile.Damage += RemoveAerialBaneDamageBoost; + IL.Terraria.Projectile.AI_001 += AdjustChlorophyteBullets; + + // Movement speed balance + IL.Terraria.Player.Update += RunSpeedAdjustments; + IL.Terraria.Player.Update += ReduceWingHoverVelocities; + + // World generation + IL.Terraria.WorldGen.MakeDungeon += PreventDungeonHorizontalCollisions; + IL.Terraria.WorldGen.DungeonHalls += PreventDungeonHallCollisions; + IL.Terraria.WorldGen.GrowLivingTree += BlockLivingTreesNearOcean; + On.Terraria.WorldGen.SmashAltar += PreventSmashAltarCode; + IL.Terraria.WorldGen.hardUpdateWorld += AdjustChlorophyteSpawnRate; + IL.Terraria.WorldGen.Chlorophyte += AdjustChlorophyteSpawnLimits; + + // Removal of vanilla stupidity + IL.Terraria.Item.Prefix += RelaxPrefixRequirements; + On.Terraria.NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; + + // Fix vanilla bugs exposed by Calamity mechanics + On.Terraria.Main.InitLifeBytes += BossRushLifeBytes; + IL.Terraria.NPC.NPCLoot += FixSplittingWormBannerDrops; + } + + /// + /// Unloads all IL Editing changes in the mod. + /// + internal static void Unload() + { + VanillaSpawnTownNPCs = null; + labDoorOpen = labDoorClosed = aLabDoorOpen = aLabDoorClosed = -1; + + // Mechanics / features + IL.Terraria.Main.UpdateTime -= PermitNighttimeTownNPCSpawning; + On.Terraria.Main.UpdateTime_SpawnTownNPCs -= AlterTownNPCSpawnRate; + IL.Terraria.Player.Hurt -= RemoveRNGFromBlackBelt; + On.Terraria.WorldGen.OpenDoor -= OpenDoor_LabDoorOverride; + On.Terraria.WorldGen.CloseDoor -= CloseDoor_LabDoorOverride; + On.Terraria.Wiring.Teleport -= DisableTeleporters; + IL.Terraria.Main.DrawInterface_40_InteractItemIcon -= MakeMouseHoverItemsSupportAnimations; + On.Terraria.Item.AffixName -= IncorporateEnchantmentInAffix; + On.Terraria.Projectile.NewProjectile_float_float_float_float_int_int_float_int_float_float -= IncorporateMinionExplodingCountdown; + On.Terraria.Main.DrawCursor -= UseCoolFireCursorEffect; + + // Damage and health balance + IL.Terraria.Main.DamageVar -= AdjustDamageVariance; + IL.Terraria.NPC.scaleStats -= RemoveExpertHardmodeScaling; + IL.Terraria.Projectile.Damage -= RemoveAerialBaneDamageBoost; + IL.Terraria.Projectile.AI_001 -= AdjustChlorophyteBullets; + + // Movement speed balance + IL.Terraria.Player.Update -= RunSpeedAdjustments; + IL.Terraria.Player.Update -= ReduceWingHoverVelocities; + + // World generation + IL.Terraria.WorldGen.MakeDungeon -= PreventDungeonHorizontalCollisions; + IL.Terraria.WorldGen.DungeonHalls -= PreventDungeonHallCollisions; + IL.Terraria.WorldGen.GrowLivingTree -= BlockLivingTreesNearOcean; + On.Terraria.WorldGen.SmashAltar -= PreventSmashAltarCode; + IL.Terraria.WorldGen.hardUpdateWorld -= AdjustChlorophyteSpawnRate; + IL.Terraria.WorldGen.Chlorophyte -= AdjustChlorophyteSpawnLimits; + + // Removal of vanilla stupidity + IL.Terraria.Item.Prefix -= RelaxPrefixRequirements; + On.Terraria.NPC.SlimeRainSpawns -= PreventBossSlimeRainSpawns; + + // Fix vanilla bugs exposed by Calamity mechanics + On.Terraria.Main.InitLifeBytes -= BossRushLifeBytes; + IL.Terraria.NPC.NPCLoot -= FixSplittingWormBannerDrops; + } + #endregion + + #region IL Editing Routines and Injections + + #region Mechanics / features + private static void PermitNighttimeTownNPCSpawning(ILContext il) + { + // Don't do town NPC spawning at the end (which lies after a !Main.dayTime return). + // Do it at the beginning, without the arbitrary time restriction. + var cursor = new ILCursor(il); + cursor.EmitDelegate(() => { - var cursor = new ILCursor(il); - if (!cursor.TryGotoNext(i => i.MatchStsfld("Terraria.WorldGen", "dMaxY"))) + // A cached delegate is used here instead of direct reflection for performance reasons + // since UpdateTime is called every frame. + if (Main.dayTime || CalamityConfig.Instance.CanTownNPCsSpawnAtNight) + VanillaSpawnTownNPCs(); + }); + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCallOrCallvirt
("UpdateTime_SpawnTownNPCs"))) + { + CalamityMod.Instance.Logger.Warn("Town NPC spawn editing code failed."); + return; + } + + cursor.Emit(OpCodes.Ret); + } + + private static void AlterTownNPCSpawnRate(On.Terraria.Main.orig_UpdateTime_SpawnTownNPCs orig) + { + int oldWorldRate = Main.worldRate; + Main.worldRate *= CalamityConfig.Instance.TownNPCSpawnRateMultiplier; + orig(); + Main.worldRate = oldWorldRate; + } + + private static void RemoveRNGFromBlackBelt(ILContext il) + { + // Change the random chance of the Black Belt to 100%, but don't let it work if Calamity's cooldown is active. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(10))) // 1 in 10 Main.rand call for Black Belt activation. + { + LogFailure("No RNG Black Belt", "Could not locate the dodge chance."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4_1); // Replace with Main.rand.Next(1), aka 100% chance. + + // Move forwards past the Main.rand.Next call now that it has been edited. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCallvirt("Next"))) + { + LogFailure("No RNG Black Belt", "Could not locate the Random.Next call."); + return; + } + + // Load the player itself onto the stack so that it becomes an argument for the following delegate. + cursor.Emit(OpCodes.Ldarg_0); + + // Emit a delegate which places the player's Calamity dodge cooldown onto the stack. + cursor.EmitDelegate>((Player p) => p.Calamity().dodgeCooldownTimer); + + // Bitwise OR the "RNG result" (always zero) with the dodge cooldown. This will only return zero if both values were zero. + // The code path which calls NinjaDodge can ONLY occur if the result of this operation is zero, + // because it is now the value checked by the immediately following branch-if-true. + cursor.Emit(OpCodes.Or); + + // Move forwards past the NinjaDodge call. We need to set the dodge cooldown here. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("NinjaDodge"))) + { + LogFailure("No RNG Black Belt", "Could not locate the Player.NinjaDodge call."); + return; + } + + // Load the player itself onto the stack so that it becomes an argument for the following delegate. + cursor.Emit(OpCodes.Ldarg_0); + + // Emit a delegate which sets the player's Calamity dodge cooldown and sends a sync packet appropriately. + cursor.EmitDelegate>((Player p) => + { + CalamityPlayer calPlayer = p.Calamity(); + calPlayer.dodgeCooldownTimer = CalamityPlayer.BeltDodgeCooldown; + if (Main.netMode == NetmodeID.MultiplayerClient) + calPlayer.SyncDodgeCooldown(false); + }); + } + + private static bool OpenDoor_LabDoorOverride(On.Terraria.WorldGen.orig_OpenDoor orig, int i, int j, int direction) + { + Tile tile = Main.tile[i, j]; + // If the tile is somehow null, that's vanilla's problem, we're outta here + if (tile is null) + 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) + return OpenLabDoor(tile, i, j, labDoorOpen); + else if (tile.type == aLabDoorClosed) + return OpenLabDoor(tile, i, j, aLabDoorOpen); + + // If it's anything else, let vanilla and/or TML handle it. + return orig(i, j, direction); + } + + private static bool CloseDoor_LabDoorOverride(On.Terraria.WorldGen.orig_CloseDoor orig, int i, int j, bool forced) + { + Tile tile = Main.tile[i, j]; + // If the tile is somehow null, that's vanilla's problem, we're outta here + if (tile is null) + 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) + return CloseLabDoor(tile, i, j, labDoorClosed); + else if (tile.type == aLabDoorOpen) + return CloseLabDoor(tile, i, j, aLabDoorClosed); + + // If it's anything else, let vanilla and/or TML handle it. + return orig(i, j, forced); + } + + private static void DisableTeleporters(On.Terraria.Wiring.orig_Teleport orig) + { + if (CalamityPlayer.areThereAnyDamnBosses) + return; + + orig(); + } + + private static void MakeMouseHoverItemsSupportAnimations(ILContext il) + { + var cursor = new ILCursor(il); + + // Locate the location where the frame rectangle is created. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchNewobj())) + return; + + int endIndex = cursor.Index; + + // And then go back to where it began, right after the draw position vector. + if (!cursor.TryGotoPrev(MoveType.After, i => i.MatchNewobj())) + { + LogFailure("HoverItem Animation Support", "Could not locate the creation of the draw position vector."); + return; + } + + // And delete the range that creates the rectangle with intent to replace it. + cursor.RemoveRange(Math.Abs(endIndex - cursor.Index)); + + cursor.Emit(OpCodes.Ldloc_0); + cursor.EmitDelegate>(itemType => + { + return Main.itemAnimations[itemType]?.GetFrame(Main.itemTexture[itemType]) ?? null; + }); + } + + private static string IncorporateEnchantmentInAffix(On.Terraria.Item.orig_AffixName orig, Item self) + { + string result = orig(self); + if (!self.IsAir && self.Calamity().AppliedEnchantment.HasValue) + result = $"{self.Calamity().AppliedEnchantment.Value.Name} {result}"; + return result; + } + + private static int IncorporateMinionExplodingCountdown(On.Terraria.Projectile.orig_NewProjectile_float_float_float_float_int_int_float_int_float_float orig, float x, float y, float xSpeed, float ySpeed, int type, int damage, float knockback, int owner, float ai0, float ai1) + { + // This is unfortunately not something that can be done via SetDefaults since owner is set + // after that method is called. Doing it directly when the projectile is spawned appears to be the only reasonable way. + int proj = orig(x, y, xSpeed, ySpeed, type, damage, knockback, owner, ai0, ai1); + Projectile projectile = Main.projectile[proj]; + if (projectile.minion) + { + Player player = Main.player[projectile.owner]; + CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); + if (player.Calamity().explosiveMinionsEnchant) + projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime; + } + return proj; + } + + #region Fire Cursor + private static void UseCoolFireCursorEffect(On.Terraria.Main.orig_DrawCursor orig, Vector2 bonus, bool smart) + { + // Do nothing special if the player has a regular mouse or is on the menu. + if (Main.gameMenu || !Main.LocalPlayer.Calamity().ableToDrawBlazingMouse) + { + orig(bonus, smart); + return; + } + + if (Main.LocalPlayer.dead) + { + Main.SmartInteractShowingGenuine = false; + Main.SmartInteractShowingFake = false; + Main.SmartInteractNPC = -1; + Main.SmartInteractNPCsNearby.Clear(); + Main.SmartInteractTileCoords.Clear(); + Main.SmartInteractTileCoordsSelected.Clear(); + Main.TileInteractionLX = (Main.TileInteractionHX = (Main.TileInteractionLY = (Main.TileInteractionHY = -1))); + } + + Color flameColor = Color.Lerp(Color.DarkRed, Color.OrangeRed, (float)Math.Cos(Main.GlobalTime * 7.4f) * 0.5f + 0.5f); + Color cursorColor = flameColor * 1.9f; + Vector2 baseDrawPosition = Main.MouseScreen + bonus; + + // Draw the mouse as usual if the player isn't using the gamepad. + if (!PlayerInput.UsingGamepad) + { + int cursorIndex = smart.ToInt(); + + Color desaturatedCursorColor = cursorColor; + desaturatedCursorColor.R /= 5; + desaturatedCursorColor.G /= 5; + desaturatedCursorColor.B /= 5; + desaturatedCursorColor.A /= 2; + + Vector2 drawPosition = baseDrawPosition; + Vector2 desaturatedDrawPosition = drawPosition + Vector2.One; + + // If the blazing mouse is actually going to do damage, draw an indicator aura. + if (Main.LocalPlayer.Calamity().blazingMouseDamageEffects && !Main.mapFullscreen) { - CalamityMod.Instance.Logger.Warn("Dungeon movement editing code failed."); + Texture2D auraTexture = ModContent.GetTexture("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); + + for (int i = 0; i < 12; i++) + { + Color auraColor = Color.Orange * Main.LocalPlayer.Calamity().blazingMouseAuraFade * 0.125f; + auraColor.A = 0; + Vector2 offsetDrawPosition = baseDrawPosition + (MathHelper.TwoPi * i / 12f + Main.GlobalTime * 5f).ToRotationVector2() * 2.5f; + offsetDrawPosition.Y -= 18f; + + Main.spriteBatch.Draw(auraTexture, offsetDrawPosition, auraFrame, auraColor, 0f, auraFrame.Size() * 0.5f, Main.cursorScale * auraScale, SpriteEffects.None, 0f); + } + } + + Main.spriteBatch.Draw(Main.cursorTextures[cursorIndex], drawPosition, null, desaturatedCursorColor, 0f, Vector2.Zero, Main.cursorScale, SpriteEffects.None, 0f); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.UIScaleMatrix); + GameShaders.Misc["CalamityMod:FireMouse"].UseColor(Color.Red); + GameShaders.Misc["CalamityMod:FireMouse"].UseSecondaryColor(Color.Lerp(Color.Red, Color.Orange, 0.75f)); + GameShaders.Misc["CalamityMod:FireMouse"].Apply(); + + Main.spriteBatch.Draw(Main.cursorTextures[cursorIndex], desaturatedDrawPosition, null, cursorColor, 0f, Vector2.Zero, Main.cursorScale * 1.075f, SpriteEffects.None, 0f); + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix); + return; + } + + // Don't bother doing any more drawing if the player is dead. + if (Main.LocalPlayer.dead && !Main.LocalPlayer.ghost && !Main.gameMenu) + return; + + if (PlayerInput.InvisibleGamepadInMenus) + return; + + // Draw a white circle instead if using the smart cursor. + if (smart && !(UILinkPointNavigator.Available && !PlayerInput.InBuildingMode)) + { + cursorColor = Color.White * Main.GamepadCursorAlpha; + int frameX = 0; + Texture2D smartCursorTexture = Main.cursorTextures[13]; + Rectangle frame = smartCursorTexture.Frame(2, 1, frameX, 0); + Main.spriteBatch.Draw(smartCursorTexture, baseDrawPosition, frame, cursorColor, 0f, frame.Size() * 0.5f, Main.cursorScale, SpriteEffects.None, 0f); + return; + } + + // Otherwise draw an ordinary crosshair at the mouse position. + cursorColor = Color.White; + Texture2D crosshairTexture = Main.cursorTextures[15]; + Main.spriteBatch.Draw(crosshairTexture, baseDrawPosition, null, cursorColor, 0f, crosshairTexture.Size() * 0.5f, Main.cursorScale, SpriteEffects.None, 0f); + } + #endregion + #endregion + + #region Damage and health balance + private static void AdjustDamageVariance(ILContext il) + { + // Change the damage variance from +-15% to +-5%. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(-15))) // The -15% lower bound of the variance. + { + LogFailure("+/-5% Damage Variance", "Could not locate the lower bound."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, -5); // Increase to -5%. + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(16))) // The 15% upper bound of the variance. + { + LogFailure("+/-5% Damage Variance", "Could not locate the upper bound."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4_6); // Decrease to +5%. + } + + private static void RemoveExpertHardmodeScaling(ILContext il) + { + // Completely disable the weak enemy scaling that occurs when Hardmode is active in Expert Mode. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(1000))) // The less than 1000 HP check in order for the scaling to take place. + { + LogFailure("Expert Hardmode Scaling Removal", "Could not locate the HP check."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4_M1); // Replace the 1000 with -1, no NPC can have less than -1 HP on spawn, so it fails to run. + } + + private static void RemoveAerialBaneDamageBoost(ILContext il) + { + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(ProjectileID.DD2BetsyArrow))) // The ID of Aerial Bane projectiles. + { + LogFailure("Aerial Bane Nerf", "Could not locate the arrow ID."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.5f))) // The damage multiplier. + { + LogFailure("Aerial Bane Nerf", "Could not locate the damage multiplier."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 1f); // Multiplying by 1 means no damage bonus. + } + + private static void AdjustChlorophyteBullets(ILContext il) + { + // Reduce dust from 10 to 5 and homing range. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(ProjectileID.ChlorophyteBullet))) + { + LogFailure("Chlorophyte Bullet AI", "Could not locate the bullet ID."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(10))) // The number of dust spawned by the bullet. + { + LogFailure("Chlorophyte Bullet AI", "Could not locate the dust quantity."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4_5); // Decrease dust to 5. + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(300f))) // The 300 unit distance required to home in. + { + LogFailure("Chlorophyte Bullet AI", "Could not locate the homing range."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 150f); // Reduce homing range by 50%. + } + #endregion + + #region Movement speed balance + private static void RunSpeedAdjustments(ILContext il) + { + var cursor = new ILCursor(il); + float horizontalSpeedCap = 3f; // +200%, aka triple speed. Vanilla caps at +60% + float asphaltTopSpeedMultiplier = 1.75f; // +75%. Vanilla is +250% + float asphaltSlowdown = 1f; // Vanilla is 2f. This should actually make asphalt faster. + + // Multiplied by 0.6 on frozen slime, for +26% acceleration + // Multiplied by 0.7 on ice, for +47% acceleration + float iceSkateAcceleration = 2.1f; + float iceSkateTopSpeed = 1f; // no boost at all + + // + // HORIZONTAL MOVEMENT SPEED CAP + // + { + // Find the +60% horizontal movement speed cap. This is loaded as a double. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR8(1.6D))) + { + LogFailure("Run Speed Adjustments", "Could not locate the horizontal movement speed cap."); return; } - cursor.Index++; - cursor.EmitDelegate(() => - { - WorldGen.dungeonX += (WorldGen.dungeonX < Main.maxTilesX / 2).ToDirectionInt() * 450; - if (WorldGen.dungeonX < 200) - WorldGen.dungeonX = 200; - if (WorldGen.dungeonX > Main.maxTilesX - 200) - WorldGen.dungeonX = Main.maxTilesX - 200; - }); + // Replace it with the new, much higher cap. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R8, (double)horizontalSpeedCap); + + // Find the "replace your speed bonus with this if you're over the cap". This is loaded as a float. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.6f))) + { + LogFailure("Run Speed Adjustments", "Could not locate the horizontal movement speed cap replacement."); + return; + } + + // Replace it with the new, much higher, cap. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, horizontalSpeedCap); + } + + // + // ASPHALT + // + { + // Find the top speed multiplier of Asphalt. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(3.5f))) + { + LogFailure("Run Speed Adjustments", "Could not locate Asphalt's top speed multiplier."); + return; + } + + // Massively reduce the increased speed cap of Asphalt. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, asphaltTopSpeedMultiplier); + + // Find the run slowdown multiplier of Asphalt. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(2f))) + { + LogFailure("Run Speed Adjustments", "Could not locate Asphalt's run slowdown multiplier."); + return; + } + + // Reducing the slowdown actually makes the (slower) Asphalt more able to reach its top speed. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, asphaltSlowdown); + } + + // + // ICE SKATES + FROZEN SLIME BLOCKS + // + { + // Find the acceleration multiplier of Ice Skates on Frozen Slime Blocks. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(3.5f))) + { + LogFailure("Run Speed Adjustments", "Could not locate Ice Skates + Frozen Slime Block acceleration multiplier."); + return; + } + + // Massively reduce the acceleration bonus of Ice Skates on Frozen Slime Blocks. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, iceSkateAcceleration); + + // Find the top speed multiplier of Ice Skates on Frozen Slime Blocks. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f))) + { + LogFailure("Run Speed Adjustments", "Could not locate Ice Skates + Frozen Slime Block top speed multiplier."); + return; + } + + // Make Ice Skates give no top speed boost whatsoever on Frozen Slime Blocks. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, iceSkateTopSpeed); + } + + // + // ICE SKATES + ICE BLOCKS + // + { + // Find the acceleration multiplier of Ice Skates on Ice Blocks. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(3.5f))) + { + LogFailure("Run Speed Adjustments", "Could not locate Ice Skates + Ice Block acceleration multiplier."); + return; + } + + // Massively reduce the acceleration bonus of Ice Skates on Ice Blocks. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, iceSkateAcceleration); + + // Find the top speed multiplier of Ice Skates on Ice Blocks. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f))) + { + LogFailure("Run Speed Adjustments", "Could not locate Ice Skates + Ice Block top speed multiplier."); + return; + } + + // Make Ice Skates give no top speed boost whatsoever on Ice Blocks. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, iceSkateTopSpeed); + } + } + + private static void ReduceWingHoverVelocities(ILContext il) + { + // Reduce wing hover horizontal velocities. Hoverboard is fine because both stats are at 10. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(6.25f))) // The accRunSpeed variable is set to this specific value before hover adjustments occur. + { + LogFailure("Wing Hover Nerfs", "Could not locate the base speed variable."); + return; + } + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(12f))) // The accRunSpeed for Vortex Booster and Nebula Mantle. + { + LogFailure("Wing Hover Nerfs", "Could not locate the vortex booster/nebula mantle speed variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 10.8f); // Reduce by 10%. + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(12f))) // The runAcceleration for Vortex Booster and Nebula Mantle. + { + LogFailure("Wing Hover Nerfs", "Could not locate the vortex booster/nebula mantle speed variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 10.8f); // Reduce by 10%. + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(12f))) // The accRunSpeed for Betsy Wings. + { + LogFailure("Wing Hover Nerfs", "Could not locate the betsy's wings speed variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 10.8f); // Reduce by 10%. + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(12f))) // The runAcceleration for Betsy Wings. + { + LogFailure("Wing Hover Nerfs", "Could not locate the betsy's wings speed variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 10.8f); // Reduce by 10%. + } + #endregion + + #region World generation + private static void PreventDungeonHorizontalCollisions(ILContext il) + { + // Prevent the Dungeon from appearing near the Sulph sea. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStsfld("dungeonY"))) + { + LogFailure("Dungeon/Abyss Collision Avoidance (Starting Position)", "Could not locate the dungeon's vertical position."); + return; + } + + cursor.EmitDelegate(() => + { + WorldGen.dungeonX = Utils.Clamp(WorldGen.dungeonX, SulphurousSea.BiomeWidth + 100, Main.maxTilesX - SulphurousSea.BiomeWidth - 100); + + // Adjust the Y position of the dungeon to accomodate for the X shift. + WorldUtils.Find(new Point(WorldGen.dungeonX, WorldGen.dungeonY), Searches.Chain(new Searches.Down(9001), new Conditions.IsSolid()), out Point result); + WorldGen.dungeonY = result.Y - 10; + }); + } + + private static void PreventDungeonHallCollisions(ILContext il) + { + // Prevent the Dungeon's halls from getting anywhere near the Abyss. + var cursor = new ILCursor(il); + + // Forcefully clamp the X position of the new hall end. + // This prevents a hall, and as a result, the dungeon, from ever impeding on the Abyss/Sulph Sea. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStloc(6))) + { + LogFailure("Dungeon/Abyss Collision Avoidance (Halls)", "Could not locate the hall horizontal position."); + return; + } + + cursor.Emit(OpCodes.Ldloc, 6); + cursor.EmitDelegate>(unclampedValue => + { + unclampedValue.X = MathHelper.Clamp(unclampedValue.X, SulphurousSea.BiomeWidth + 25, Main.maxTilesX - SulphurousSea.BiomeWidth - 25); + return unclampedValue; + }); + cursor.Emit(OpCodes.Stloc, 6); + } + + private static void BlockLivingTreesNearOcean(ILContext il) + { + var cursor = new ILCursor(il); + cursor.Emit(OpCodes.Ldarg_0); + cursor.EmitDelegate>(x => Utils.Clamp(x, 560, Main.maxTilesX - 560)); + cursor.Emit(OpCodes.Starg, 0); + } + + private static void PreventSmashAltarCode(On.Terraria.WorldGen.orig_SmashAltar orig, int i, int j) + { + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + return; + + orig(i, j); + } + + private static void AdjustChlorophyteSpawnRate(ILContext il) + { + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(300))) // 1 in 300 genRand call used to generate Chlorophyte in mud tiles near jungle grass. + { + LogFailure("Chlorophyte Spread Rate", "Could not locate the update chance."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, 150); // Increase the chance to 1 in 150. + } + + private static void AdjustChlorophyteSpawnLimits(ILContext il) + { + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(40))) // Find the 40 Chlorophyte tile limit. This limit is checked within a 71x71-tile square, with the reference tile as the center. + { + LogFailure("Chlorophyte Spread Limit", "Could not locate the lower limit."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, 60); // Increase the limit to 60. + + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(130))) // Find the 130 Chlorophyte tile limit. This limit is checked within a 171x171-tile square, with the reference tile as the center. + { + LogFailure("Chlorophyte Spread Limit", "Could not locate the upper limit."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, 200); // Increase the limit to 200. + } + #endregion + + #region Removal of vanilla stupidity + private static void RelaxPrefixRequirements(ILContext il) + { + var cursor = new ILCursor(il); + + // Search for the first instance of Math.Round, which is used to round damage. + // This one isn't edited, but hitting the Round function is the easiest way to get to the relevant part of the method. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("System.Math", "Round"))) + { + LogFailure("Prefix Requirements", "Could not locate the damage Math.Round call."); + return; + } + + // Search for the second instance of Math.Round, which is used to round use time. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("System.Math", "Round"))) + { + LogFailure("Prefix Requirements", "Could not locate the use time Math.Round call."); + return; + } + + // Search for the branch-if-not-equal which checks whether the use time change rounds to nothing. + // If the change rounds to nothing, then it's equal, so the branch is NOT taken. + // The branch skips over the "fail this prefix" code. + ILLabel passesUseTimeCheck = null; + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchBneUn(out passesUseTimeCheck))) + { + LogFailure("Prefix Requirements", "Could not locate use time rounding equality branch."); + return; + } + + // To allow use-time affecting prefixes even on super fast weapons where they would round to nothing, + // add another branch which skips over the "fail this prefix" code, given a custom condition. + + // Load the item itself onto the stack so that it becomes an argument for the following delegate. + cursor.Emit(OpCodes.Ldarg_0); + + // Emit a delegate which returns whether the item's use time is 2, 3, 4 or 5. + cursor.EmitDelegate>((Item i) => i.useAnimation >= 2 && i.useAnimation <= 5); + + cursor.Emit(OpCodes.Brtrue_S, passesUseTimeCheck); + + // Search for the branch-if-not-equal which checks whether the mana change rounds to nothing. + ILLabel passesManaCheck = null; + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchBneUn(out passesManaCheck))) + { + LogFailure("Prefix Requirements", "Could not locate mana prefix failure branch."); + return; + } + + // Emit an unconditional branch which skips the mana check failure. + cursor.Emit(OpCodes.Br_S, passesManaCheck); + + // Search for the instance field load which retrieves the item's knockback. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdfld("knockBack"))) + { + LogFailure("Prefix Requirements", "Could not locate knockback load instruction."); + return; + } + + // Search for the immediately-following constant load which pulls in 0.0. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0f))) + { + LogFailure("Prefix Requirements", "Could not locate zero knockback comparison constant."); + return; + } + + // Completely nullify the knockback computation by replacing the check against 0 with a check against negative one million. + // If you absolutely need to block knockback reforges for some reason, you can set your knockback to this value. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, -1000000f); + } + + private static void PreventBossSlimeRainSpawns(On.Terraria.NPC.orig_SlimeRainSpawns orig, int plr) + { + if (!Main.player[plr].Calamity().bossZen) + orig(plr); + } + #endregion + + #region Vanilla bugs exposed by Calamity mechanics + private static void BossRushLifeBytes(On.Terraria.Main.orig_InitLifeBytes orig) + { + orig(); + foreach (int npcType in NeedsFourLifeBytes) + Main.npcLifeBytes[npcType] = 4; + } + + private static void FixSplittingWormBannerDrops(ILContext il) + { + var cursor = new ILCursor(il); + + // Locate the area after all the banner logic by using a nearby constant type. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(23))) + { + LogFailure("splitting worm banner spam fix", "Could not locate the first hooking constant."); + return; + } + if (!cursor.TryGotoPrev(MoveType.Before, i => i.MatchLdarg(0))) + { + LogFailure("splitting worm banner spam fix", "Could not locate the second hooking constant."); + return; + } + + ILLabel afterBannerLogic = cursor.DefineLabel(); + + // Set this area after as a place to return to later. + cursor.MarkLabel(afterBannerLogic); + + // Go to the beginning of the banner drop logic. + cursor.Goto(0); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld("killCount"))) + { + LogFailure("splitting worm banner spam fix", "Could not locate the NPC kill count."); + return; + } + + // Load the NPC caller onto the stack. + cursor.Emit(OpCodes.Ldarg_0); + cursor.EmitDelegate>(npc => CalamityGlobalNPCLoot.SplittingWormLootBlockWrapper(npc, CalamityMod.Instance)); + + // If the block is false (indicating the drop logic should stop), skip all the ahead banner drop logic. + cursor.Emit(OpCodes.Brfalse, afterBannerLogic); + } + #endregion + + // UNUSED -- This IL edit doesn't edit the right function, the Pharaoh Mask is definitely not in NPC.scaleStats + private static void ReplacePharaohSetInPyramids() + { + // Replace the Pharaoh's Set in Pyramid gen with something actually useful. + IL.Terraria.NPC.scaleStats += (il) => + { + var cursor = new ILCursor(il); + cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(848)); // The ID of the Pharaoh's Mask. + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, 1240); // Replace the Mask with a Ruby Hook, in 1.4 I will replace this with an Amber Hook so it makes more sense. + // Note: There is no need to replace the other Pharaoh piece, due to how the vanilla code works. }; } + #endregion + + #region Helper Functions + private static int FindTopOfDoor(int i, int j, Tile rootTile) + { + Tile t = Main.tile[i, j]; + int topY = j; + while(t != null && t.active() && t.type == rootTile.type) + { + // Immediately stop at the top of the world, if you got there somehow. + if (topY == 0) + return topY; + // Go up one space and re-assign the current tile. + --topY; + t = Main.tile[i, topY]; + } + + // The above loop will have gone 1 past the top of the door. Correct for this. + return ++topY; + } + + private static bool OpenLabDoor(Tile tile, int i, int j, int openID) + { + int topY = FindTopOfDoor(i, j, tile); + return DirectlyTransformLabDoor(i, topY, openID); + } + + private static bool CloseLabDoor(Tile tile, int i, int j, int closedID) + { + int topY = FindTopOfDoor(i, j, tile); + return DirectlyTransformLabDoor(i, topY, closedID); + } + + private static bool DirectlyTransformLabDoor(int doorX, int doorY, int newDoorID, int wireHitY = -1) + { + // Transform the door one tile at a time. + // 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; + if (Main.netMode != NetmodeID.MultiplayerClient && Wiring.running && y != wireHitY) + Wiring.SkipWire(doorX, y); + } + + // Second pass: TileFrame all those positions, which will sync in multiplayer if applicable + for (int y = doorY; y < doorY + 4; ++y) + 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); + return true; + } + + public static void DumpToLog(ILContext il) => CalamityMod.Instance.Logger.Debug(il.ToString()); + public static void LogFailure(string name, string reason) => CalamityMod.Instance.Logger.Warn($"IL edit \"{name}\" failed! {reason}"); + #endregion } } diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index 9e74cb74b4..a5c896c7df 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -1,7 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Face)] @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Abaddon"); - Tooltip.SetDefault("Reduces the damage caused by the Brimstone Flames debuff"); + Tooltip.SetDefault("Reduces the damage caused by the Brimstone Flames debuff and provides immunity to Searing Lava"); } public override void SetDefaults() @@ -18,13 +18,10 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) - { - player.Calamity().abaddon = 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 80bd11538a..90c3a62cff 100644 --- a/Items/Accessories/AbyssalAmulet.cs +++ b/Items/Accessories/AbyssalAmulet.cs @@ -1,6 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -11,6 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Abyssal Amulet"); Tooltip.SetDefault("Attacks inflict the Crush Depth debuff\n" + + "Grants immunity to the Crush Depth debuff\n" + "While in the abyss you gain 10% increased max life"); } @@ -19,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } @@ -27,6 +30,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.abyssalAmulet = true; - } + player.buffImmune[ModContent.BuffType()] = true; + } } } diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index 202b02f1b9..31c89921ec 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 2f1554e808..44f9daa713 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Abyssal Diving Suit"); Tooltip.SetDefault("Transforms the holder into an armored diver\n" + - "Increases movement speed while underwater and moves slowly outside of water\n" + + "Increases max movement speed and acceleration while underwater but you move slowly outside of water\n" + "The suits' armored plates reduce damage taken by 15%\n" + "The plates will only take damage if the damage taken is over 50\n" + "After the suit has taken too much damage its armored plates will take 3 minutes to regenerate\n" + @@ -33,9 +33,8 @@ namespace CalamityMod.Items.Accessories item.width = 18; item.height = 18; item.accessory = true; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 31b4576249..fe7aaf6e83 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -14,9 +14,9 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Light does not reach the depths of the ocean\n" + "Significantly reduces enemy aggression, even in the abyss\n" + "Stealth generates 30% faster when standing still and 20% faster while moving\n" + - "Grants a slight chance to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies\n" + - "Evading an attack grants a lot of stealth\n" + - "This evade has a 20s cooldown before it can occur again"); + "Grants the ability to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies\n" + + "Evading an attack grants a lot of stealth but has a 75 second cooldown\n" + + "This cooldown is shared with all other dodges and reflects"); } public override void SetDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories item.width = 30; item.height = 38; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 67c5d1d5ca..3bea87a7fc 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Aero Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Increases movement speed by 10%, jump speed by 20%, and all damage by 3%"); + "Increases flight time, movement speed and jump speed by 10%"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 8)); } @@ -20,29 +21,15 @@ namespace CalamityMod.Items.Accessories item.width = 40; item.height = 50; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } - public override void ModifyTooltips(List list) - { - bool autoJump = Main.player[Main.myPlayer].autoJump; - string jumpAmt = autoJump ? "5" : "20"; - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Increases movement speed by 10%, jump speed by " + jumpAmt + "%, and all damage by 3%"; - } - } - } - public override void UpdateAccessory(Player player, bool hideVisual) { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.425f, 0.425f); + player.Calamity().aeroStone = true; player.moveSpeed += 0.1f; - player.jumpSpeedBoost += player.autoJump ? 0.25f : 1.0f; - player.allDamage += 0.03f; + player.jumpSpeedBoost += 0.5f; } } } diff --git a/Items/Accessories/Affliction.cs b/Items/Accessories/Affliction.cs index ea18e115c8..0d48ebb28f 100644 --- a/Items/Accessories/Affliction.cs +++ b/Items/Accessories/Affliction.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -13,7 +14,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Affliction"); Tooltip.SetDefault("Gives you and all other players on your team +1 life regen,\n" + - "+10% max life, 7% damage reduction, 20 defense, and 12% increased damage"); + "+10% max life, 7% damage reduction, 10 defense, and 10% increased damage"); } public override void SetDefaults() @@ -23,13 +24,12 @@ namespace CalamityMod.Items.Accessories item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; item.expert = true; - item.rare = 10; + item.rare = ItemRarityID.Red; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(19f, 20f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Accessories/Affliction"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Accessories/Affliction")); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -38,10 +38,9 @@ namespace CalamityMod.Items.Accessories modPlayer.affliction = true; if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) + if (Main.LocalPlayer.team == player.team && player.team != 0) { - Main.player[myPlayer].AddBuff(ModContent.BuffType(), 20, true); + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 20, true); } } } diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index 465e3709fa..2623c01dc2 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; @@ -14,6 +13,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Alchemical Flask"); Tooltip.SetDefault("All attacks inflict the plague\n" + "Reduces the damage caused to you by the plague\n" + + "Removes the blindness effect caused by the plague\n" + "Projectiles spawn plague seekers on enemy hits"); } @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } diff --git a/Items/Accessories/AlchemicalFlask.png b/Items/Accessories/AlchemicalFlask.png index 5842c55cd9..c4bf41e7e0 100644 Binary files a/Items/Accessories/AlchemicalFlask.png and b/Items/Accessories/AlchemicalFlask.png differ diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index f352fd3042..50b1526f0a 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index 031d0cea48..ac256496a7 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Amalgamated Brain"); - Tooltip.SetDefault("12% increased damage\n" + + Tooltip.SetDefault("10% increased damage\n" + "Shade rains down when you are hit\n" + "You will confuse nearby enemies when you are struck"); } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories item.height = 34; item.value = CalamityGlobalItem.Rarity4BuyPrice; item.expert = true; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } @@ -34,16 +34,21 @@ namespace CalamityMod.Items.Accessories modPlayer.aBrain = true; if (player.immune) { - if (Main.rand.NextBool(8)) + if (player.miscCounter % 6 == 0) { if (player.whoAmI == Main.myPlayer) { - Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 2f, player.whoAmI, 6, 1); - rain.tileCollide = false; + Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(60 * player.AverageDamage()), 2f, player.whoAmI); + if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) + { + rain.Calamity().forceTypeless = true; + rain.tileCollide = false; + rain.penetrate = 1; + } } } } - player.allDamage += 0.12f; + player.allDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 21235fc272..ac477ff3f0 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } @@ -51,6 +51,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.beeResist = true; modPlayer.aAmpoule = true; + modPlayer.rOoze = true; } public override void AddRecipes() @@ -61,7 +62,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); 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(); @@ -71,7 +72,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); 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(); diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs index 9324523fb7..44477a3b3f 100644 --- a/Items/Accessories/AmidiasPendant.cs +++ b/Items/Accessories/AmidiasPendant.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 46; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index d001a5fafa..f0de8b5500 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 7b89e95d3f..0c05c19989 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } diff --git a/Items/Accessories/AnechoicPlating.cs b/Items/Accessories/AnechoicPlating.cs index a0541a997d..605668a1e5 100644 --- a/Items/Accessories/AnechoicPlating.cs +++ b/Items/Accessories/AnechoicPlating.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index 26391d7720..c0c74887dc 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories item.width = 36; item.height = 32; item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.accessory = true; } @@ -49,10 +49,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.harpyRing = true; - player.accRunSpeed = 8f; + modPlayer.angelTreads = true; + player.accRunSpeed = 7.5f; player.rocketBoots = 3; - player.moveSpeed += 0.16f; + player.moveSpeed += 0.12f; player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs new file mode 100644 index 0000000000..40d80fe731 --- /dev/null +++ b/Items/Accessories/AngelicAlliance.cs @@ -0,0 +1,79 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.Furniture.CraftingStations; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + //Developer item, dedicatee: Nincity + public class AngelicAlliance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Angelic Alliance"); + Tooltip.SetDefault("Call upon the force of heaven to empower your attacks and minions\n" + + "Courage, Enlightenment, Bliss. United in Judgement\n" + + "+2 max minions, 15% increased summon damage, and 8% increased damage to all other classes\n" + + "Life regeneration is boosted while jumping\n" + + "This line is modified in the code below. If you can read this, someone probably did something wrong (It was Ben)\n" + + "While under the effects of Divine Bless, for every minion you have, an archangel shall be summoned to aid you in combat\n" + + "Each spawned angel will instantly heal you for two health\n" + + "All minion attacks inflict Banishing Fire and you are granted a flat health boost of four health per second\n" + + "This effect has a cooldown of 1 minute"); + } + + 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; + } + + public override void ModifyTooltips(List list) + { + string hotkey = CalamityMod.AngelicAllianceHotKey.TooltipHotkeyString(); + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "Press " + hotkey + " to grace yourself in divinity for 15 seconds"; + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.angelicAlliance = true; + player.allDamage += 0.08f; + player.minionDamage += 0.07f; //7% + 8% = 15% + player.maxMinions += 2; + if (player.controlJump) + player.lifeRegen += 4; + } + + 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(); + } + } +} diff --git a/Items/Accessories/AngelicAlliance.png b/Items/Accessories/AngelicAlliance.png new file mode 100644 index 0000000000..ced2c42de5 Binary files /dev/null and b/Items/Accessories/AngelicAlliance.png differ diff --git a/Items/Accessories/AquaticEmblem.cs b/Items/Accessories/AquaticEmblem.cs index 1500b41cb3..4b64313146 100644 --- a/Items/Accessories/AquaticEmblem.cs +++ b/Items/Accessories/AquaticEmblem.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Most ocean enemies become friendly and provides waterbreathing\n" + "Being underwater slowly boosts your defense over time but also slows movement speed\n" + "The defense boost and movement speed reduction slowly vanish while outside of water\n" + - "Maximum defense boost is 30, maximum movement speed reduction is 5%\n" + + "Maximum defense boost is 50, maximum movement speed reduction is 10%\n" + "Provides a small amount of light in the abyss\n" + "Moderately reduces breath loss in the abyss"); } @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.width = 18; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; item.expert = true; } diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 911fcae376..3935938937 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,17 +10,19 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Arcanum of the Void"); - Tooltip.SetDefault("You have a 5% chance to reflect projectiles when they hit you\n" + - "If this effect triggers you get healed for the projectile's damage"); + Tooltip.SetDefault("You reflect projectiles when they hit you\n" + + "Reflected projectiles deal 5 times damage to enemies and no damage to you\n" + + "This reflect has a 90 second cooldown which is shared with all other dodges and reflects\n"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.PureGreen; + 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/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index b47b4db5f8..25a8571ba9 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 564c8b094f..dd4bb6d019 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -16,13 +16,12 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Asgardian Aegis"); Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + "Immune to most debuffs\n" + - "+40 max life\n" + + "+40 max life and increased life regeneration\n" + "Grants a supreme holy flame dash\n" + "Can be used to ram enemies\n" + "TOOLTIP LINE HERE\n" + "Activating this buff will reduce your movement speed and increase enemy aggro\n" + - "10% damage reduction while submerged in liquid\n" + - "Toggle visibility of this accessory to enable/disable the dash"); + "+20 defense while submerged in liquid"); } public override void SetDefaults() @@ -50,12 +49,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - if (!hideVisual) - { modPlayer.dashMod = 4; } + modPlayer.dashMod = 4; modPlayer.elysianAegis = true; + modPlayer.abaddon = true; player.noKnockback = true; player.fireWalk = true; player.statLifeMax2 += 40; + player.lifeRegen++; player.buffImmune[BuffID.Chilled] = true; player.buffImmune[BuffID.Frostburn] = true; player.buffImmune[BuffID.Weak] = true; @@ -67,12 +67,13 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Silenced] = true; player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; + player.buffImmune[BuffID.WindPushed] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[ModContent.BuffType()] = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { player.endurance += 0.1f; } + { player.statDefense += 20; } } public override void AddRecipes() diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 4d2eeadc6c..a0e1bd0fd4 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Asgard's Valor"); Tooltip.SetDefault("Grants immunity to fire blocks and knockback\n" + "Immune to most debuffs and reduces the damage caused by the Brimstone Flames debuff\n" + - "10% damage reduction while submerged in liquid\n" + + "+16 defense while submerged in liquid\n" + "+20 max life\n" + - "Grants a holy dash which can be used to ram enemies\n" + - "Toggle visibility of this accessory to enable/disable the dash"); + "Grants a holy dash which can be used to ram enemies"); } public override void SetDefaults() @@ -27,7 +26,7 @@ namespace CalamityMod.Items.Accessories item.width = 38; item.height = 44; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 8; item.accessory = true; } @@ -35,8 +34,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - if (!hideVisual) - { modPlayer.dashMod = 2; } + modPlayer.dashMod = 2; player.noKnockback = true; player.fireWalk = true; modPlayer.abaddon = true; @@ -51,9 +49,10 @@ namespace CalamityMod.Items.Accessories player.buffImmune[BuffID.Silenced] = true; player.buffImmune[BuffID.Cursed] = true; player.buffImmune[BuffID.Darkness] = true; + player.buffImmune[BuffID.WindPushed] = true; player.statLifeMax2 += 20; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { player.endurance += 0.1f; } + { player.statDefense += 16; } } public override void AddRecipes() diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index 31f0944cec..ffbd94d85c 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -13,21 +13,22 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Astral Arcanum"); Tooltip.SetDefault("Taking damage drops astral stars from the sky\n" + - "Provides immunity to the astral infection debuff\n" + - "You have a 5% chance to reflect projectiles when they hit you\n" + - "If this effect triggers you get healed for the projectile's damage\n" + - "Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 20 defense\n" + - "TOOLTIP LINE HERE"); + "Provides immunity to the astral infection debuff\n" + + "You reflect projectiles when they hit you\n" + + "Reflected projectiles deal 5 times damage to enemies and no damage to you\n" + + "This reflect has a 90 second cooldown which is shared with all other dodges and reflects\n" + + "Boosts life regen even while under the effects of a damaging debuff\n" + + "While under the effects of a damaging debuff you will gain 20 defense\n" + + "TOOLTIP LINE HERE"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void ModifyTooltips(List list) @@ -35,9 +36,9 @@ namespace CalamityMod.Items.Accessories string hotkey = CalamityMod.AstralArcanumUIHotkey.TooltipHotkeyString(); foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip6") + if (line2.mod == "Terraria" && line2.Name == "Tooltip7") { - line2.text = "Press " + hotkey + " to toggle teleportation UI"; + line2.text = "Press " + hotkey + " to toggle teleportation UI while no bosses are alive"; } } } diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index 70617569d4..6d74e72ce3 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.cs @@ -2,6 +2,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class AstralBulwark : ModItem @@ -19,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = CalamityGlobalItem.Rarity9BuyPrice; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.accessory = true; } diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index c74096e0a6..2dde4c73fd 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -12,13 +12,15 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Badge of Bravery"); Tooltip.SetDefault("15% increased melee speed\n" + - "Wearing Tarragon armor increases melee damage, crit, and armor penetration"); + "Increases melee damage and melee crit by 5%\n" + + "+5 armor penetration"); } 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; diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index eb25eb462c..4358680b98 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.World; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -13,7 +14,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Blazing Core"); Tooltip.SetDefault("The searing core of the profaned goddess\n" + - "10% damage reduction \n" + + "10% damage reduction\n" + "Being hit creates a miniature sun that lingers, dealing damage to nearby enemies\n" + "The sun will slowly drag enemies into it\n" + "Only one sun can be active at once\n" + @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Accessories item.height = 46; item.accessory = true; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Purple; item.value = CalamityGlobalItem.Rarity12BuyPrice; } diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index 034f361058..6669b36f23 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -12,14 +13,14 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Doubles your max HP\n" + "Allows you to be critically hit 25% of the time\n" + "After a critical hit, you gain various buffs for ten seconds\n" + - "Any healing potions consumed during this time period heal 50 percent more health"); + "Any healing potions consumed during this time period heal 50% more health"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.value = CalamityGlobalItem.Rarity8BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/BloodPact.png b/Items/Accessories/BloodPact.png index de1b2f0dec..f34c36e115 100644 Binary files a/Items/Accessories/BloodPact.png and b/Items/Accessories/BloodPact.png differ diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index f7418a508c..ce0995e20b 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -10,9 +10,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodflare Core"); - Tooltip.SetDefault("When below 50% life you gain 5% increased damage reduction and 10% increased damage\n" + - "When below 15% life you gain 10% increased damage reduction and 20% increased damage\n" + - "When below 100 defense you gain 15% increased damage"); + Tooltip.SetDefault("You lose up to half your defense after taking damage\n" + "Lost defense regenerates over time\n" + "You gain 1 health for every 1 defense gained as it regenerates"); } public override void SetDefaults() diff --git a/Items/Accessories/BloodstainedGlove.cs b/Items/Accessories/BloodstainedGlove.cs index 765976917e..64514e6380 100644 --- a/Items/Accessories/BloodstainedGlove.cs +++ b/Items/Accessories/BloodstainedGlove.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.height = 36; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.accessory = true; - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 81a112b206..84542b3065 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.height = 42; item.value = CalamityGlobalItem.Rarity4BuyPrice; item.expert = true; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index ec12c5aeb4..bdeba77c3d 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.height = 15; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.expert = true; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/BloodyWormTooth.png b/Items/Accessories/BloodyWormTooth.png index e00b3f5896..bdc187fd4b 100644 Binary files a/Items/Accessories/BloodyWormTooth.png and b/Items/Accessories/BloodyWormTooth.png differ diff --git a/Items/Accessories/BloomStone.cs b/Items/Accessories/BloomStone.cs index c2881e60f7..bcc9f448a3 100644 --- a/Items/Accessories/BloomStone.cs +++ b/Items/Accessories/BloomStone.cs @@ -14,56 +14,22 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Bloom Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Enemies that get near you take damage and all damage is increased by 3%\n" + + "I don't know what else this should do, pls help\n" + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 7)); } public override void SetDefaults() { - item.width = 20; - item.height = 20; + item.width = 38; + item.height = 54; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.25f, 0.4f, 0.2f); - player.allDamage += 0.03f; - int bloomCounter = 0; - int num = 186; - float num2 = 150f; - bool flag = bloomCounter % 60 == 0; - int num3 = (int)(10 * player.AverageDamage()); - int random = Main.rand.Next(10); - if (player.whoAmI == Main.myPlayer) - { - if (random == 0) - { - 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[num] && Vector2.Distance(player.Center, nPC.Center) <= num2) - { - if (nPC.FindBuffIndex(num) == -1) - { - nPC.AddBuff(num, 120, false); - } - if (flag) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile p = Projectile.NewProjectileDirect(nPC.Center, Vector2.Zero, ModContent.ProjectileType(), num3, 0f, player.whoAmI, l); - } - } - } - } - } - } - bloomCounter++; //Flower Boots code if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) diff --git a/Items/Accessories/BloomStone.png b/Items/Accessories/BloomStone.png index 78d99275d2..acf9fdf04c 100644 Binary files a/Items/Accessories/BloomStone.png and b/Items/Accessories/BloomStone.png differ diff --git a/Items/Accessories/BlunderBooster.cs b/Items/Accessories/BlunderBooster.cs index 3f9ec276eb..d421471fdc 100644 --- a/Items/Accessories/BlunderBooster.cs +++ b/Items/Accessories/BlunderBooster.cs @@ -12,18 +12,18 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Blunder Booster"); Tooltip.SetDefault("12% increased rogue damage and 15% increased rogue projectile velocity\n" + + "Stealth generates 10% faster\n" + "Summons a red lightning aura to surround the player and electrify nearby enemies\n" + "TOOLTIP LINE HERE" + - "This effect has a 3 second cooldown before it can be used again"); + "This effect has a 1 second cooldown before it can be used again"); } public override void SetDefaults() { item.width = 30; item.height = 38; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; - item.Calamity().postMoonLordRarity = 12; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.accessory = true; } @@ -35,6 +35,8 @@ namespace CalamityMod.Items.Accessories player.Calamity().throwingDamage += 0.12f; player.Calamity().throwingVelocity += 0.15f; player.Calamity().blunderBooster = true; + player.Calamity().stealthGenStandstill += 0.1f; + player.Calamity().stealthGenMoving += 0.1f; } public override void ModifyTooltips(List list) @@ -42,7 +44,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 == "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"; } diff --git a/Items/Accessories/BurdenBreaker.cs b/Items/Accessories/BurdenBreaker.cs index 3fce200977..3dd01ac826 100644 --- a/Items/Accessories/BurdenBreaker.cs +++ b/Items/Accessories/BurdenBreaker.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 28; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs new file mode 100644 index 0000000000..e96f8d759d --- /dev/null +++ b/Items/Accessories/Calamity.cs @@ -0,0 +1,39 @@ +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class Calamity : ModItem + { + public const float MaxNPCSpeed = 5f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamity"); + Tooltip.SetDefault("Lights your mouse ablaze with a brimstone fire and causes a flaming aura to appear around it\n" + + "Enemies near the aura take immense damage and are inflicted with Vulnerability Hex\n" + + "The mouse fire effect can be shown without the aura and damage effects by putting this item in a vanity slot"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); + } + + public override void SetDefaults() + { + item.width = 44; + item.height = 108; + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.expert = true; + item.vanity = true; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().blazingMouseDamageEffects = true; + player.Calamity().ableToDrawBlazingMouse = true; + } + + public override void UpdateEquip(Player player) => player.Calamity().ableToDrawBlazingMouse = true; + } +} diff --git a/Items/Accessories/Calamity.png b/Items/Accessories/Calamity.png new file mode 100644 index 0000000000..16df4d3f9b Binary files /dev/null and b/Items/Accessories/Calamity.png differ diff --git a/Items/Accessories/CalamityRing.cs b/Items/Accessories/CalamityRing.cs index e96d9921a1..e6c0c802e5 100644 --- a/Items/Accessories/CalamityRing.cs +++ b/Items/Accessories/CalamityRing.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Void of Calamity"); - Tooltip.SetDefault("Cursed?\n" + + Tooltip.SetDefault("Cursed? Reduces damage reduction by 10%\n" + "15% increase to all damage\n" + "Brimstone fire rains down while invincibility is active"); } @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 22; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; item.expert = true; } @@ -34,12 +35,12 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.calamityRing = true; player.allDamage += 0.15f; - player.endurance -= 0.15f; + player.endurance -= 0.1f; if (player.whoAmI == Main.myPlayer) { if (player.immune) { - if (Main.rand.NextBool(10)) + if (player.miscCounter % 10 == 0) { CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(30 * player.AverageDamage()), 5f, player.whoAmI); } diff --git a/Items/Accessories/CalamityRing.png b/Items/Accessories/CalamityRing.png index 1c272155d5..6054ac9273 100644 Binary files a/Items/Accessories/CalamityRing.png and b/Items/Accessories/CalamityRing.png differ diff --git a/Items/Accessories/CelestialJewel.cs b/Items/Accessories/CelestialJewel.cs index cf89883c6b..4e593c59b4 100644 --- a/Items/Accessories/CelestialJewel.cs +++ b/Items/Accessories/CelestialJewel.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Celestial Jewel"); Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 20 defense\n" + + "While under the effects of a damaging debuff you will gain 15 defense\n" + "TOOLTIP LINE HERE"); } @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories { if (line2.mod == "Terraria" && line2.Name == "Tooltip2") { - line2.text = "Press " + hotkey + " to teleport to a random location"; + line2.text = "Press " + hotkey + " to teleport to a random location while no bosses are alive"; } } } @@ -47,8 +47,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddRecipeGroup("AnyLargeGem"); + recipe.AddIngredient(ItemID.TeleportationPotion, 3); + recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/ChaosAmulet.cs b/Items/Accessories/ChaosAmulet.cs index 71642a8565..d75f94faa5 100644 --- a/Items/Accessories/ChaosAmulet.cs +++ b/Items/Accessories/ChaosAmulet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.height = 24; item.lifeRegen = 2; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } diff --git a/Items/Accessories/ChaosStone.cs b/Items/Accessories/ChaosStone.cs index 018ba06e30..454bf36d2b 100644 --- a/Items/Accessories/ChaosStone.cs +++ b/Items/Accessories/ChaosStone.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Chaos Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Increases max mana by 50, all damage by 3%, and reduces mana usage by 5%"); + "I don't know what this should do, pls help"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 7)); } @@ -19,16 +20,13 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) + /*public override void UpdateAccessory(Player player, bool hideVisual) { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.85f, 0f, 0f); - player.statManaMax2 += 50; - player.manaCost *= 0.95f; - player.allDamage += 0.03f; - } + + }*/ } } diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index a6ca44adaf..76ee4ebc61 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -16,15 +16,15 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = CalamityGlobalItem.Rarity16BuyPrice; - item.Calamity().postMoonLordRarity = 16; + item.value = 0; // lul intentionally has zero value + item.Calamity().customRarity = CalamityRarity.HotPink; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - bool canUse = (player.name == "Fabsol" || player.name == "Totalbiscuit" || player.name == "TotalBiscuit" || player.name == "Total Biscuit" || player.name == "Total biscuit") && player.townNPCs <= 1; + bool canUse = player.name == "Fabsol" || player.name == "Totalbiscuit" || player.name == "TotalBiscuit" || player.name == "Total Biscuit" || player.name == "Total biscuit"; if (canUse) { modPlayer.lol = true; diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 05bf985301..5b2c245624 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Coin of Deceit"); - Tooltip.SetDefault("6% increased rogue crit chance"); + Tooltip.SetDefault("Stealth strikes only expend 75% of your max stealth\n" + + "6% increased rogue crit chance"); } public override void SetDefaults() @@ -18,12 +20,13 @@ namespace CalamityMod.Items.Accessories item.height = 22; item.value = CalamityGlobalItem.Rarity1BuyPrice; item.accessory = true; - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().throwingCrit += 6; + player.Calamity().stealthStrike75Cost = true; } public override void AddRecipes() @@ -31,6 +34,8 @@ namespace CalamityMod.Items.Accessories 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(); diff --git a/Items/Accessories/CoreOfTheBloodGod.cs b/Items/Accessories/CoreOfTheBloodGod.cs index 8a0b65fa37..bc1bfda6b2 100644 --- a/Items/Accessories/CoreOfTheBloodGod.cs +++ b/Items/Accessories/CoreOfTheBloodGod.cs @@ -2,6 +2,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,21 +13,20 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Core of the Blood God"); - Tooltip.SetDefault("5% increased damage reduction\n" + - "7% increased damage\n" + - "When below 100 defense you gain 15% increased damage\n" + + Tooltip.SetDefault("8% increased damage and damage reduction\n" + + "Boosts your max HP by 10%\n" + + "Healing Potions are 15% more effective\n" + "Halves enemy contact damage\n" + - "When you take contact damage this effect has a 20 second cooldown\n" + - "Boosts your max HP by 10%"); + "When you take contact damage this effect has a 20 second cooldown"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 4)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; + item.width = item.height = 48; item.value = CalamityGlobalItem.Rarity14BuyPrice; item.expert = true; - item.rare = 10; + item.rare = ItemRarityID.Red; item.accessory = true; } @@ -42,7 +43,6 @@ namespace CalamityMod.Items.Accessories 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(ModContent.TileType()); diff --git a/Items/Accessories/CoreOfTheBloodGod.png b/Items/Accessories/CoreOfTheBloodGod.png index b3e2dfb3f3..10d98d7cb2 100644 Binary files a/Items/Accessories/CoreOfTheBloodGod.png and b/Items/Accessories/CoreOfTheBloodGod.png differ diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index 42159dadd8..081316f503 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 18; item.height = 46; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 4; item.accessory = true; } @@ -33,28 +34,18 @@ namespace CalamityMod.Items.Accessories { if (Main.rand.NextBool(15)) { - for (int i = 0; i < Main.rand.Next(3,7); i++) + int cloudCount = Main.rand.Next(2,5); + for (int i = 0; i < cloudCount; i++) { - int type = -1; - switch (Main.rand.Next(3)) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - } - // Should never happen, but just in case- - if (type != -1) - { - float speed = Main.rand.NextFloat(3f, 11f); - Projectile.NewProjectile(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, - type, (int)(100 * player.RogueDamage()), 0f, player.whoAmI); - } + int type = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); + float speed = Main.rand.NextFloat(3f, 11f); + Projectile.NewProjectile(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, + type, (int)(100 * player.RogueDamage()), 0f, player.whoAmI); } } } diff --git a/Items/Accessories/CorruptFlask.cs b/Items/Accessories/CorruptFlask.cs index cfcc07129e..ea7cdb387c 100644 --- a/Items/Accessories/CorruptFlask.cs +++ b/Items/Accessories/CorruptFlask.cs @@ -1,4 +1,3 @@ -using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } @@ -34,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ItemID.VilePowder, 15); recipe.AddIngredient(ItemID.RottenChunk, 10); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index cc2a7e8674..8130cd6267 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -10,13 +11,11 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Counter Scarf"); - Tooltip.SetDefault("True melee strikes deal 15% more damage\n" + + Tooltip.SetDefault("True melee strikes deal 10% more damage\n" + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + - "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + "After a successful dodge you must wait 15 seconds before you can dodge again\n" + "This cooldown will be twice as long if you have Chaos State\n" + - "While on cooldown, Chaos State will last twice as long\n" + - "Revengeance drop"); + "While on cooldown, Chaos State will last twice as long"); } public override void SetDefaults() @@ -24,9 +23,10 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; - } + item.Calamity().challengeDrop = 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 d333e95580..4009821d34 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 28; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } diff --git a/Items/Accessories/CrimsonFlask.cs b/Items/Accessories/CrimsonFlask.cs index 9a2fa895ac..a04233a86d 100644 --- a/Items/Accessories/CrimsonFlask.cs +++ b/Items/Accessories/CrimsonFlask.cs @@ -1,4 +1,3 @@ -using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } @@ -34,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ItemID.ViciousPowder, 15); recipe.AddIngredient(ItemID.Vertebrae, 10); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 6dfb3ccd68..e83faf93cd 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -10,8 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Crown Jewel"); Tooltip.SetDefault("Boosts life regen even while under the effects of a damaging debuff\n" + - "While under the effects of a damaging debuff you will gain 10 defense\n" + - "Revengeance drop"); + "While under the effects of a damaging debuff you will gain 10 defense"); } public override void SetDefaults() @@ -19,9 +19,10 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index 3c8f3dbb03..ad18876f66 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -10,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Cryo Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Increases damage reduction by 5% and all damage by 3%"); + "Creates a rotating ice shield around you that damages enemies on contact"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 4)); } @@ -19,16 +20,13 @@ namespace CalamityMod.Items.Accessories item.width = 40; item.height = 40; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; - item.defense = 6; + item.rare = ItemRarityID.Pink; item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) + /*public override void UpdateAccessory(Player player, bool hideVisual) { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0f, 0.25f, 0.6f); - player.endurance += 0.05f; - player.allDamage += 0.03f; - } + + }*/ } } diff --git a/Items/Accessories/DaedalusEmblem.cs b/Items/Accessories/DaedalusEmblem.cs index d21286cf49..9745a487e5 100644 --- a/Items/Accessories/DaedalusEmblem.cs +++ b/Items/Accessories/DaedalusEmblem.cs @@ -19,13 +19,13 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.ammoCost80 = true; + player.Calamity().rangedAmmoCost *= 0.8f; player.lifeRegen += 2; player.statDefense += 5; player.rangedDamage += 0.1f; diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 4b81fed3d4..7ea49b14a5 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.width = 48; item.height = 62; item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.accessory = true; } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 5250242bb1..104901d01b 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -1,9 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; -using CalamityMod.Tiles.Furniture.CraftingStations; namespace CalamityMod.Items.Accessories { @@ -14,23 +14,24 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Dark Sun Ring"); Tooltip.SetDefault("Contains the power of the dark sun\n" + "12% increase to damage and melee speed\n" + - "+1 life regen, 15% increased pick speed, and +2 max minions\n" + + "+1 life regen, 15% increased pick speed and +2 max minions\n" + "Increased minion knockback\n" + "During the day the player has +3 life regen\n" + - "During the night the player has +30 defense\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, 6)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 7)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.width = 54; + item.height = 58; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; item.defense = 10; item.lifeRegen = 1; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -43,8 +44,8 @@ namespace CalamityMod.Items.Accessories { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 100); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/DarkSunRing.png b/Items/Accessories/DarkSunRing.png index deef093bf1..52de47bd09 100644 Binary files a/Items/Accessories/DarkSunRing.png and b/Items/Accessories/DarkSunRing.png differ diff --git a/Items/Accessories/DeepDiver.cs b/Items/Accessories/DeepDiver.cs index 811af76c8f..d44744634a 100644 --- a/Items/Accessories/DeepDiver.cs +++ b/Items/Accessories/DeepDiver.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,7 +10,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Diver"); - Tooltip.SetDefault("15% increased damage, defense, and movement speed when underwater\n" + + Tooltip.SetDefault("15% increased damage, movement speed and +15 defense while underwater\n" + "While underwater you gain the ability to dash great distances"); } @@ -17,16 +18,16 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 28; - item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; - item.defense = 2; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.defense = 8; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + if (player.IsUnderwater()) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.deepDiver = true; diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index 2bc5df7ad4..f2fafc4da0 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,5 +1,5 @@ using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,17 +11,15 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Deific Amulet"); - Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + - "Causes stars to fall and gives increased immune time when damaged\n" + - "Increases armor penetration by 10 and reduces the cooldown of healing potions\n" + - "Provides light underwater and provides a small amount of light in the abyss"); + Tooltip.SetDefault("Causes stars to fall and grants increased immune time when damaged\n" + + "Reduces the cooldown of healing potions\n"); } public override void SetDefaults() { item.width = 26; item.height = 26; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.value = CalamityGlobalItem.Rarity5BuyPrice; item.accessory = true; } @@ -30,20 +28,17 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.dAmulet = true; - modPlayer.jellyfishNecklace = true; + player.longInvince = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CharmofMyths); - recipe.AddIngredient(ItemID.JellyfishNecklace); - recipe.AddIngredient(ItemID.PanicNecklace); - recipe.AddIngredient(ItemID.SharkToothNecklace); recipe.AddIngredient(ItemID.StarVeil); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ItemID.MeteoriteBar, 25); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/DepthCharm.cs b/Items/Accessories/DepthCharm.cs index c4240032a6..3daf718845 100644 --- a/Items/Accessories/DepthCharm.cs +++ b/Items/Accessories/DepthCharm.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index a810f2c73b..9da87af51c 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Dimensional Soul Artifact"); Tooltip.SetDefault("Power\n" + - "Boosts all damage by 25%\n" + - "But at what cost?"); + "Boosts all damage by 25%, but at what cost?\n" + + "Increases all damage taken by 15%"); } public override void SetDefaults() diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index eb06f3a9ad..6bbbbc8cbf 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -10,18 +10,23 @@ namespace CalamityMod.Items.Accessories { public class DraedonsHeart : ModItem { + // The percentage of a full Rage bar that is gained every second with Draedon's Heart equipped. + public const float MinRagePerSecond = 0.015f; + public const float MaxRagePerSecond = 0.045f; // 3x rage generation at 0% health, aka +200% rage generation + public override void SetStaticDefaults() { DisplayName.SetDefault("Draedon's Heart"); - Tooltip.SetDefault("Gives 10% increased damage while you have the absolute rage buff\n" + - "Increases your chance of getting the absolute rage buff\n" + - "Boosts your damage by 5% and max movement speed and acceleration by 5%\n" + - "Rage mode does more damage\n" + - "You gain rage over time\n" + - "The Horror debuff lasts twice as long,\n" + - "but it instead grants various buffs to the player\n" + + Tooltip.SetDefault("Boosts your damage by 5% and max movement speed and acceleration by 5%\n" + + "You generate rage over time and rage does not fade away out of combat\n" + + "Passive rage generation increases drastically as health decreases\n" + + "Converts certain debuffs into buffs and extends their durations\n" + + "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, Broken Armor,\n" + + "Armor Crunch, War Cleave, Chilled, Ichor and Obstructed\n" + "Receiving a hit causes you to only lose half of your max adrenaline rather than all of it\n" + - "Standing still regenerates your life quickly and boosts your defense by 25"); + "Reduces the amount of defense stat 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, 7)); } @@ -39,6 +44,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.laudanum = true; modPlayer.stressPills = true; + modPlayer.heartOfDarkness = true; modPlayer.draedonsHeart = true; } diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 7fa2875f7d..c5c588e212 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Only a living dragon holds true treasure\n" + "Rogue projectiles create slow fireballs as they travel\n" + "Stealth strikes create infernados on death\n" + - "After Yharon is dead, you gain 10% movement speed and acceleration"); + "+10% max run speed and acceleration"); } public override void SetDefaults() @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 32; item.height = 34; item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Violet; item.accessory = true; } diff --git a/Items/Accessories/DukeScales.cs b/Items/Accessories/DukeScales.cs index 36b9e857cf..e1aebb7ce8 100644 --- a/Items/Accessories/DukeScales.cs +++ b/Items/Accessories/DukeScales.cs @@ -10,19 +10,18 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Old Duke's Scales"); Tooltip.SetDefault("While under the effects of a damaging debuff, you gain 10% increased damage and 5% crit\n" + - "For every 25% of lost life, you gain 6% increased damage and 3% crit\n" + - "This will max out at 18% increased damage and 9% crit when under 25% life\n" + - "Provides immunity to poisoned, venom, and sulphuric poisoning"); + "For every 25% of lost life, you gain 6% increased damage and 3% crit\n" + + "This will max out at 18% increased damage and 9% crit when under 25% life\n" + + "Provides immunity to poisoned, venom, and sulphuric poisoning"); } public override void SetDefaults() { item.width = 28; item.height = 26; - item.value = CalamityGlobalItem.Rarity13BuyPrice; item.accessory = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 13; + 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 4a090f28ca..5abcd03247 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Dynamo Stem Cells"); - Tooltip.SetDefault(@"15% increased movement speed + Tooltip.SetDefault(@"10% increased movement speed Ranged weapons have a chance to fire mini swarmers"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); } @@ -18,16 +19,16 @@ Ranged weapons have a chance to fire mini swarmers"); { item.width = 20; item.height = 20; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.accessory = true; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.accessory = true; item.expert = true; - item.rare = 10; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().dynamoStemCells = true; - player.moveSpeed += 0.15f; + player.moveSpeed += 0.1f; } } } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 6a0a2c60be..046765cd02 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -19,17 +19,18 @@ namespace CalamityMod.Items.Accessories "Mobile stealth generation exponentially accelerates while not attacking\n" + "Stealth strikes have a 100% critical hit chance\n" + "Stealth strikes only expend 50% of your max stealth\n" + - "Grants a small chance to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" + - "Evading an attack grants full stealth\n" + - "This evade has a 20s cooldown before it can occur again"); + "Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" + + "Evading an attack grants full stealth but has a 75 second cooldown\n" + + "This cooldown is shared with all other dodges and reflects"); } public override void SetDefaults() { item.width = 38; item.height = 38; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().customRarity = CalamityRarity.Violet; + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; item.accessory = true; } @@ -52,8 +53,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/EldritchSoulArtifact.cs b/Items/Accessories/EldritchSoulArtifact.cs index 52bc9e97d0..23e67b95ab 100644 --- a/Items/Accessories/EldritchSoulArtifact.cs +++ b/Items/Accessories/EldritchSoulArtifact.cs @@ -14,18 +14,17 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Eldritch Soul Artifact"); Tooltip.SetDefault("Knowledge\n" + - "Boosts melee speed by 10%, shoot speed by 25%, rogue damage by 15%, max minions by 2, and reduces mana cost by 15%"); + "Boosts melee speed by 10%, ranged velocity by 25%, rogue damage by 15%, max minions by 2, and reduces mana cost by 15%"); } public override void SetDefaults() { - item.width = 28; - item.height = 28; + item.width = 64; + item.height = 58; item.accessory = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - } + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/EldritchSoulArtifact.png b/Items/Accessories/EldritchSoulArtifact.png index 0fc8022c9d..c872eb32d5 100644 Binary files a/Items/Accessories/EldritchSoulArtifact.png and b/Items/Accessories/EldritchSoulArtifact.png differ diff --git a/Items/Accessories/ElectriciansGlove.cs b/Items/Accessories/ElectriciansGlove.cs index e383c32a24..d9d0f4dc16 100644 --- a/Items/Accessories/ElectriciansGlove.cs +++ b/Items/Accessories/ElectriciansGlove.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Electrician's Glove"); Tooltip.SetDefault(@"Stealth strikes summon sparks on enemy hits -Stealth strikes also have +30 armor penetration, deal 10% more damage, and heal for 1 HP"); +Stealth strikes also have +20 armor penetration, deal 10% more damage, and heal for 1 HP"); } public override void SetDefaults() @@ -20,7 +20,7 @@ Stealth strikes also have +30 armor penetration, deal 10% more damage, and heal item.height = 40; item.value = CalamityGlobalItem.Rarity5BuyPrice; item.accessory = true; - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index 28450f8d14..fde102b84c 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -17,10 +17,8 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Melee attacks and projectiles inflict most debuffs\n" + "15% increased melee speed, damage, and 5% increased melee critical strike chance\n" + "20% increased true melee damage\n" + - "Increased invincibility after taking damage\n" + "Temporary immunity to lava\n" + - "Increased melee knockback\n" + - "Melee attacks have a chance to instantly kill normal enemies"); + "Increased melee knockback"); } public override void SetDefaults() diff --git a/Items/Accessories/ElementalQuiver.cs b/Items/Accessories/ElementalQuiver.cs index 3cb03c3104..9d28759915 100644 --- a/Items/Accessories/ElementalQuiver.cs +++ b/Items/Accessories/ElementalQuiver.cs @@ -12,11 +12,9 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Quiver"); - Tooltip.SetDefault("Ranged projectiles have a chance to split\n" + - "Ranged weapons have a chance to instantly kill normal enemies\n" + - "10% increased ranged damage, 5% increased ranged critical strike chance, and 20% reduced ammo usage\n" + + Tooltip.SetDefault("15% increased ranged damage, 5% increased ranged critical strike chance, and 20% reduced ammo usage\n" + "5 increased defense, 2 increased life regen, and 15% increased pick speed\n" + - "Greatly increases arrow speed and grants a 20% chance to not consume arrows"); + "Greatly increases arrow speed and grants a 20% chance to not consume arrows"); } public override void SetDefaults() @@ -30,14 +28,15 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eQuiver = true; - player.rangedDamage += 0.1f; + player.rangedDamage += 0.15f; player.rangedCrit += 5; - player.ammoCost80 = true; player.lifeRegen += 2; player.statDefense += 5; player.pickSpeed -= 0.15f; + player.magicQuiver = true; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.eQuiver = true; // Since splitting was removed, this has no effect. + modPlayer.rangedAmmoCost *= 0.8f; } public override void AddRecipes() diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 6cbd4e0927..dc40cf60a5 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Buffs.DamageOverTime; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -14,12 +15,11 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Elysian Aegis"); Tooltip.SetDefault("Blessed by the Profaned Flame\n" + "Grants immunity to fire blocks, knockback, and Holy Flames\n" + - "+40 max life and increased life regen\n" + + "+30 max life\n" + "Grants a supreme holy flame dash\n" + "Can be used to ram enemies\n" + "TOOLTIP LINE HERE\n" + - "Activating this buff will reduce your movement speed and increase enemy aggro\n" + - "Toggle visibility of this accessory to enable/disable the dash"); + "Activating this buff will reduce your movement speed and increase enemy aggro"); } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories item.width = 48; item.height = 42; item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; item.defense = 8; item.accessory = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Accessories { if (line2.mod == "Terraria" && line2.Name == "Tooltip5") { - line2.text = "Press " + hotkey + " to activate buffs to all damage, crit chance, and defense"; + line2.text = "Press " + hotkey + " to activate buffs to all damage, crit chance and defense"; } } } @@ -48,14 +48,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - if (!hideVisual) - { modPlayer.dashMod = 3; } + modPlayer.dashMod = 3; modPlayer.elysianAegis = true; player.buffImmune[ModContent.BuffType()] = true; player.noKnockback = true; player.fireWalk = true; - player.lifeRegen += 2; - player.statLifeMax2 += 40; + player.statLifeMax2 += 30; } } } diff --git a/Items/Accessories/EnchantedPearl.cs b/Items/Accessories/EnchantedPearl.cs index 29815e0cce..37cc502e21 100644 --- a/Items/Accessories/EnchantedPearl.cs +++ b/Items/Accessories/EnchantedPearl.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index 97b80debc1..bc208d5ea0 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,9 +10,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Ethereal Extorter"); - Tooltip.SetDefault(@"Infuses souls into your weapons and body generating different boosts that vary with the environment -Rogue projectiles rarely explode into homing souls -10% increased rogue damage but reduced life regen"); + Tooltip.SetDefault(@"Rogue projectiles explode into homing souls on death +10% increased rogue damage and +10 maximum stealth, however, life regen is reduced by 1"); } public override void SetDefaults() @@ -20,7 +20,7 @@ Rogue projectiles rarely explode into homing souls item.height = 32; item.accessory = true; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,8 +29,7 @@ Rogue projectiles rarely explode into homing souls modPlayer.etherealExtorter = true; modPlayer.throwingDamage += 0.1f; player.lifeRegen -= 1; - if (Main.moonPhase == 4) // 4 = New Moon - modPlayer.rogueStealthMax += 0.1f; + modPlayer.rogueStealthMax += 0.1f; } } } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index c900c77a18..267623c639 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -12,11 +12,10 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Ethereal Talisman"); - Tooltip.SetDefault("15% increased magic damage, 5% increased magic critical strike chance, and 10% decreased mana usage\n" + - "+150 max mana and reveals treasure locations if visibility is on\n" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "You automatically use mana potions when needed if visibility is on\n" + - "Magic attacks have a chance to instantly kill normal enemies"); + Tooltip.SetDefault("15% increased magic damage, 5% increased magic critical strike chance and 10% decreased mana usage\n" + + "+150 max mana\n" + + "Reveals treasure locations if visibility is on\n" + + "You automatically use mana potions when needed if visibility is on"); } public override void SetDefaults() @@ -32,13 +31,13 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; + if (!hideVisual) { player.findTreasure = true; player.manaFlower = true; } - player.magicCuffs = true; - player.manaMagnet = true; + player.statManaMax2 += 150; player.magicDamage += 0.15f; player.manaCost *= 0.9f; diff --git a/Items/Accessories/EvasionScarf.cs b/Items/Accessories/EvasionScarf.cs index 9907cb2e8c..c6a06dc16d 100644 --- a/Items/Accessories/EvasionScarf.cs +++ b/Items/Accessories/EvasionScarf.cs @@ -11,9 +11,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Evasion Scarf"); - Tooltip.SetDefault("True melee strikes deal 25% more damage\n" + + Tooltip.SetDefault("True melee strikes deal 15% more damage\n" + "Grants the ability to dash; dashing into an attack will cause you to dodge it\n" + - "After a dodge you will be granted a buff to all damage, melee speed, and all crit chance for a short time\n" + "After a successful dodge you must wait 13 seconds before you can dodge again\n" + "This cooldown will be 50 percent longer if you have Chaos State\n" + "While on cooldown, Chaos State will be 50 percent longer"); @@ -25,8 +24,8 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.accessory = true; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.rare = ItemRarityID.Pink; + item.Calamity().donorItem = true; } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().dodgeScarf; @@ -42,7 +41,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.RedandBlackDye); recipe.AddIngredient(ItemID.SoulofNight, 5); recipe.AddIngredient(ItemID.SoulofLight, 5); recipe.AddIngredient(ItemID.Silk, 15); diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 504321cdfd..df8f5f3892 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -3,6 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class EyeoftheStorm : ModItem @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/FabledTortoiseShell.cs b/Items/Accessories/FabledTortoiseShell.cs index 3e4fe0f5f2..5ce5954da5 100644 --- a/Items/Accessories/FabledTortoiseShell.cs +++ b/Items/Accessories/FabledTortoiseShell.cs @@ -1,6 +1,9 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -8,29 +11,49 @@ namespace CalamityMod.Items.Accessories { public override void SetStaticDefaults() { - DisplayName.SetDefault("Fabled Tortoise Shell"); + DisplayName.SetDefault("Flame-Licked Shell"); Tooltip.SetDefault("50% reduced movement speed\n" + "Enemies take damage when they hit you\n" + - "You move quickly for a short time if you take damage"); + "You move faster and lose 18 defense for 3 seconds if you take damage\n" + + "Temporary immunity to lava"); } public override void SetDefaults() { - item.defense = 35; - item.width = 20; - item.height = 24; + item.defense = 36; + item.width = 36; + item.height = 42; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip3") + { + line2.text = "Temporary immunity to lava\n" + + "Provides heat protection in Death Mode"; + } + } + } + } + + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.fabledTortoise = true; - player.moveSpeed -= 0.5f; + player.lavaMax += 240; + float moveSpeedDecrease = modPlayer.shellBoost ? 0.2f : 0.5f; + player.moveSpeed -= moveSpeedDecrease; player.thorns += 0.25f; + if (modPlayer.shellBoost) + player.statDefense -= 18; } } } diff --git a/Items/Accessories/FabledTortoiseShell.png b/Items/Accessories/FabledTortoiseShell.png index 8ee762ad47..d9cb245978 100644 Binary files a/Items/Accessories/FabledTortoiseShell.png and b/Items/Accessories/FabledTortoiseShell.png differ diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index a4b606de33..e5ef3c7058 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 44; item.height = 38; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/FilthyGlove.cs b/Items/Accessories/FilthyGlove.cs index e3d57f7170..0f3917f169 100644 --- a/Items/Accessories/FilthyGlove.cs +++ b/Items/Accessories/FilthyGlove.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.height = 38; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.accessory = true; - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FleshTotem.cs b/Items/Accessories/FleshTotem.cs index b3d392cc8c..282edcd22d 100644 --- a/Items/Accessories/FleshTotem.cs +++ b/Items/Accessories/FleshTotem.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.value = CalamityGlobalItem.Rarity8BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/FrigidBulwark.cs b/Items/Accessories/FrigidBulwark.cs index 781cffd5c5..5fb817fe84 100644 --- a/Items/Accessories/FrigidBulwark.cs +++ b/Items/Accessories/FrigidBulwark.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 44; + item.width = 34; + item.height = 40; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 8; item.accessory = true; } diff --git a/Items/Accessories/FrigidBulwark.png b/Items/Accessories/FrigidBulwark.png index 63f44d9187..a4c3edc11b 100644 Binary files a/Items/Accessories/FrigidBulwark.png and b/Items/Accessories/FrigidBulwark.png differ diff --git a/Items/Accessories/FrostBarrier.cs b/Items/Accessories/FrostBarrier.cs index 95b82045cb..390ebb122a 100644 --- a/Items/Accessories/FrostBarrier.cs +++ b/Items/Accessories/FrostBarrier.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } diff --git a/Items/Accessories/FrostBarrier.png b/Items/Accessories/FrostBarrier.png index 34c900609d..223d27f6da 100644 Binary files a/Items/Accessories/FrostBarrier.png and b/Items/Accessories/FrostBarrier.png differ diff --git a/Items/Accessories/FrostFlare.cs b/Items/Accessories/FrostFlare.cs index 17507e218b..c7dcfc94df 100644 --- a/Items/Accessories/FrostFlare.cs +++ b/Items/Accessories/FrostFlare.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -13,11 +14,10 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Frost Flare"); Tooltip.SetDefault("All melee attacks and projectiles inflict frostburn\n" + - "Immunity to frostburn, chilled, and frozen\n" + - "Resistant to cold attacks and +1 life regen\n" + - "Being above 75% life grants the player 10% increased damage\n" + - "Being below 25% life grants the player 10 defense and 15% increased max movement speed and acceleration\n" + - "Revengeance drop"); + "Immunity to frostburn, chilled and frozen\n" + + "Being above 75% life grants 10% increased damage\n" + + "Being below 25% life grants 10 defense and 15% increased max movement speed and acceleration\n" + + "Grants resistance against cold attacks"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); } @@ -25,9 +25,8 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 24; - item.lifeRegen = 1; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } @@ -37,10 +36,10 @@ namespace CalamityMod.Items.Accessories { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip5") + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") { line2.text = "Provides heat and cold protection in Death Mode\n" + - "Revengeance drop"; + "Grants resistance against cold attacks"; } } } diff --git a/Items/Accessories/FungalCarapace.cs b/Items/Accessories/FungalCarapace.cs index 9585986dde..b51615db5d 100644 --- a/Items/Accessories/FungalCarapace.cs +++ b/Items/Accessories/FungalCarapace.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,16 +10,16 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Carapace"); - Tooltip.SetDefault("You emit a mushroom spore explosion when you are hit"); + Tooltip.SetDefault("You emit a cloud of mushroom spores when you are hit"); } public override void SetDefaults() { - item.defense = 2; + item.defense = 6; item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } diff --git a/Items/Accessories/FungalCarapace.png b/Items/Accessories/FungalCarapace.png index 8a6a96a438..6d4633b776 100644 Binary files a/Items/Accessories/FungalCarapace.png and b/Items/Accessories/FungalCarapace.png differ diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index 4b69a53c36..471db96160 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -3,6 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class FungalClump : ModItem @@ -22,7 +24,7 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = CalamityGlobalItem.Rarity2BuyPrice; item.expert = true; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/FungalSymbiote.cs b/Items/Accessories/FungalSymbiote.cs index c49ea8fb6d..c077c0f784 100644 --- a/Items/Accessories/FungalSymbiote.cs +++ b/Items/Accessories/FungalSymbiote.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 38; item.height = 36; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/Gehenna.cs b/Items/Accessories/Gehenna.cs index 48d6d40aca..c6cb8c73cf 100644 --- a/Items/Accessories/Gehenna.cs +++ b/Items/Accessories/Gehenna.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; item.expert = true; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index c2e119ac94..2dec3aacbb 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 42; item.height = 32; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index c569253fea..6fa7e98690 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -16,10 +17,10 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { item.defense = 6; - item.width = 20; - item.height = 24; + item.width = 30; + item.height = 28; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } diff --git a/Items/Accessories/GiantShell.png b/Items/Accessories/GiantShell.png index b5efb638cd..1e3e44ac38 100644 Binary files a/Items/Accessories/GiantShell.png and b/Items/Accessories/GiantShell.png differ diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index c1fd1e6daa..deb5aceca4 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -14,11 +15,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.defense = 8; + item.defense = 12; item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index 98e567de6d..b49d0cf936 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -1,9 +1,11 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; -using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class GladiatorsLocket : ModItem @@ -19,18 +21,16 @@ namespace CalamityMod.Items.Accessories item.width = 42; item.height = 36; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 5; item.accessory = true; } public override bool CanEquipAccessory(Player player, int slot) { - CalamityPlayer modPlayer = player.Calamity(); //there might be an upgrade sometime later? - if (modPlayer.gladiatorSword) - { + if (player.Calamity().gladiatorSword) return false; - } + return true; } @@ -41,16 +41,14 @@ namespace CalamityMod.Items.Accessories if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { player.AddBuff(ModContent.BuffType(), 3600, true); - } - int damage = NPC.downedPlantBoss ? 100 : Main.hardMode ? 50 : 20; - float damageMult = CalamityWorld.downedDoG ? 3f : NPC.downedMoonlord ? 2f : 1f; - int swordDmg = (int)(damage * damageMult * player.AverageDamage()); + + int damage = 30; + int swordDmg = (int)(damage * player.AverageDamage()); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), swordDmg, 6f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), swordDmg, 6f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); } } } diff --git a/Items/Accessories/GladiatorsLocket.png b/Items/Accessories/GladiatorsLocket.png index 83eb7dbf0a..d2e1c67d65 100644 Binary files a/Items/Accessories/GladiatorsLocket.png and b/Items/Accessories/GladiatorsLocket.png differ diff --git a/Items/Accessories/GloveOfRecklessness.cs b/Items/Accessories/GloveOfRecklessness.cs index f907f1d508..1670c5fe62 100644 --- a/Items/Accessories/GloveOfRecklessness.cs +++ b/Items/Accessories/GloveOfRecklessness.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,7 +10,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Glove Of Recklessness"); - Tooltip.SetDefault("Increases rogue attack speed by 20% but decreases damage by 10%\n" + + Tooltip.SetDefault("Increases rogue attack speed by 12% but decreases damage by 10%\n" + "Adds inaccuracy to rogue weapons"); } @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.height = 40; item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; - item.rare = 7; + 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 1233028f28..daa509a3a4 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.height = 40; item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/GoldBurdenBreaker.cs b/Items/Accessories/GoldBurdenBreaker.cs index 1c76b66fe3..cfc32f50c1 100644 --- a/Items/Accessories/GoldBurdenBreaker.cs +++ b/Items/Accessories/GoldBurdenBreaker.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -13,18 +14,19 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("The good time\n" + "Go fast\n" + "WARNING: May have disastrous results\n" + - "Increases horizontal movement speed beyond comprehension"); + "Increases horizontal movement speed beyond comprehension\n" + + "Does not work while a boss is alive"); } public override void SetDefaults() { item.width = 28; item.height = 28; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index e28518e65d..5b0db0fd29 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Grand Gelatin"); - Tooltip.SetDefault("10% increased movement speed\n" + - "40% increased jump speed\n" + + Tooltip.SetDefault("10% increased movement and jump speed\n" + "+20 max life and mana\n" + "Standing still boosts life and mana regen"); } @@ -22,33 +21,20 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } - public override void ModifyTooltips(List list) - { - bool autoJump = Main.player[Main.myPlayer].autoJump; - string jumpAmt = autoJump ? "10" : "40"; - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = jumpAmt + "% increased jump speed"; - } - } - } - public override void UpdateAccessory(Player player, bool hideVisual) { player.moveSpeed += 0.1f; - player.jumpSpeedBoost += player.autoJump ? 0.5f : 2f; - player.statLifeMax2 += 20; + player.jumpSpeedBoost += 0.5f; + player.statLifeMax2 += 20; player.statManaMax2 += 20; if (Math.Abs(player.velocity.X) < 0.05f && Math.Abs(player.velocity.Y) < 0.05f && player.itemAnimation == 0) { - player.lifeRegen += 2; - player.manaRegenBonus += 2; + player.lifeRegen += 4; + player.manaRegenBonus += 4; } } diff --git a/Items/Accessories/GravistarSabaton.cs b/Items/Accessories/GravistarSabaton.cs index e000d073fc..5d72a08f37 100644 --- a/Items/Accessories/GravistarSabaton.cs +++ b/Items/Accessories/GravistarSabaton.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,7 +10,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Gravistar Sabaton"); Tooltip.SetDefault("Tap the DOWN key to increase your fall speed for 5 seconds\n" + - "This has a 8 second cooldown\n" + + "This has an 8 second cooldown\n" + "Striking the ground with increased fall speed will cause an astral explosion"); } @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; item.expert = true; - item.rare = 7; + 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 34732b8707..04be50fda8 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Hallowed Rune"); - Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff\n" + + Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random buff, does not stack with downgrades\n" + "These buffs will either boost your defense, summon damage, or life regen for a while\n" + "If you have the offensive boost, enemies hit by minions will sometimes be hit by stars"); } @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } @@ -36,6 +36,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ItemID.SoulofFright, 5); recipe.AddIngredient(ItemID.SoulofMight, 5); recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/HarpyRing.cs b/Items/Accessories/HarpyRing.cs index 44321bfe6e..e38d26d396 100644 --- a/Items/Accessories/HarpyRing.cs +++ b/Items/Accessories/HarpyRing.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Harpy Ring"); - Tooltip.SetDefault("20% increased movement speed\n" + + Tooltip.SetDefault("10% increased movement speed\n" + "Boosts your maximum flight time by 25%"); } @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 22; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/HeartofDarkness.cs b/Items/Accessories/HeartofDarkness.cs index 478ba78681..bb0ffb733d 100644 --- a/Items/Accessories/HeartofDarkness.cs +++ b/Items/Accessories/HeartofDarkness.cs @@ -1,19 +1,21 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class HeartofDarkness : ModItem { + // The percentage of a full Rage bar that is gained every second with Heart of Darkness equipped. + public const float RagePerSecond = 0.01f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heart of Darkness"); - Tooltip.SetDefault("Gives 10% increased damage while you have the absolute rage buff\n" + - "Increases your chance of getting the absolute rage buff\n" + - "Rage mode does more damage\n" + - "You gain rage over time\n" + + 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)); } @@ -23,7 +25,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 3cf01f76dd..3dfd836b32 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; +using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,14 +18,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Heart of the Elements"); Tooltip.SetDefault("The heart of the world\n" + - "Increases max life by 20, life regen by 1, and all damage by 8%\n" + - "Increases movement speed by 10% and jump speed by 20%\n" + - "Increases damage reduction by 5%\n" + - "Increases max mana by 50 and reduces mana usage by 5%\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + - "Summons all elementals to protect you\n" + - "Toggling the visibility of this accessory also toggles the elementals on and off\n" + - "Stat increases are slightly higher if the elementals are turned off"); + "Summons all elementals to protect you"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); } @@ -33,13 +27,13 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 9; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Rainbow; } - public override bool CanEquipAccessory(Player player, int slot) + public override bool CanEquipAccessory(Player player, int slot) { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.brimstoneWaifu || modPlayer.sandWaifu || modPlayer.sandBoobWaifu || modPlayer.cloudWaifu || modPlayer.sirenWaifu) @@ -49,24 +43,14 @@ namespace CalamityMod.Items.Accessories return true; } - public override void UpdateAccessory(Player player, bool hideVisual) - { + public override void UpdateAccessory(Player player, bool hideVisual) + { if (player != null && !player.dead) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); - } - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.allWaifus = !hideVisual; - modPlayer.elementalHeart = true; + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, Main.DiscoR / 255f, Main.DiscoG / 255f, Main.DiscoB / 255f); - player.lifeRegen += hideVisual ? 2 : 1; - player.statLifeMax2 += hideVisual ? 25 : 20; - player.moveSpeed += hideVisual ? 0.12f : 0.1f; - player.jumpSpeedBoost += hideVisual ? 1.1f : 1f; - player.endurance += hideVisual ? 0.06f : 0.05f; - player.statManaMax2 += hideVisual ? 60 : 50; - player.manaCost *= hideVisual ? 0.93f : 0.95f; - player.allDamage += hideVisual ? 0.1f : 0.08f; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.allWaifus = true; + modPlayer.elementalHeart = true; int brimmy = ProjectileType(); int siren = ProjectileType(); @@ -74,161 +58,44 @@ namespace CalamityMod.Items.Accessories int sandy = ProjectileType(); int cloudy = ProjectileType(); - if (!hideVisual) - { - Vector2 velocity = new Vector2(0f, -1f); - int damage = NPC.downedMoonlord ? 150 : 90; - float damageMult = CalamityWorld.downedDoG ? 2f : 1f; - int elementalDmg = (int)(damage * damageMult * player.MinionDamage()); - float kBack = 2f + player.minionKB; + Vector2 velocity = new Vector2(0f, -1f); + int elementalDmg = (int)(90 * player.MinionDamage()); + float kBack = 2f + player.minionKB; - if (player.ownedProjectileCounts[brimmy] > 1 || player.ownedProjectileCounts[siren] > 1 || - player.ownedProjectileCounts[healer] > 1 || player.ownedProjectileCounts[sandy] > 1 || - player.ownedProjectileCounts[cloudy] > 1) + if (player.ownedProjectileCounts[brimmy] > 1 || player.ownedProjectileCounts[siren] > 1 || + player.ownedProjectileCounts[healer] > 1 || player.ownedProjectileCounts[sandy] > 1 || + player.ownedProjectileCounts[cloudy] > 1) + { + player.ClearBuff(BuffType()); + } + if (player != null && player.whoAmI == Main.myPlayer && !player.dead) + { + if (player.FindBuffIndex(BuffType()) == -1) { - player.ClearBuff(BuffType()); + player.AddBuff(BuffType(), 3600, true); } - if (player != null && player.whoAmI == Main.myPlayer && !player.dead) + if (player.ownedProjectileCounts[brimmy] < 1) { - if (player.FindBuffIndex(BuffType()) == -1) - { - player.AddBuff(BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[brimmy] < 1) - { - Projectile.NewProjectile(player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); - } - if (player.ownedProjectileCounts[siren] < 1) - { - Projectile.NewProjectile(player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); - } - if (player.ownedProjectileCounts[healer] < 1) - { - Projectile.NewProjectile(player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); - } - if (player.ownedProjectileCounts[sandy] < 1) - { - Projectile.NewProjectile(player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); - } - if (player.ownedProjectileCounts[cloudy] < 1) - { - Projectile.NewProjectile(player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); - } + Projectile.NewProjectile(player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); } - } - else - { - if (player.ownedProjectileCounts[brimmy] > 0 || player.ownedProjectileCounts[siren] > 0 || - player.ownedProjectileCounts[healer] > 0 || player.ownedProjectileCounts[sandy] > 0 || - player.ownedProjectileCounts[cloudy] > 0) - { - player.ClearBuff(BuffType()); - } - } - - //Flower Boots code - if (player != null && !player.dead && player.velocity.Y == 0f && player.grappling[0] == -1) - { - int x = (int)player.Center.X / 16; - int y = (int)(player.position.Y + (float)player.height - 1f) / 16; - Tile tile = Main.tile[x, y]; - if (tile is null) - { - tile = new Tile(); - } - if (!tile.active() && tile.liquid == 0 && Main.tile[x, y + 1] != null && WorldGen.SolidTile(x, y + 1)) - { - tile.frameY = 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.rand.NextBool(1000)) - { - tile.active(true); - tile.type = TileID.DyePlants; - tile.frameX = (short)(34 * Main.rand.Next(1, 13)); - while (tile.frameX == 144) - { - tile.frameX = (short)(34 * Main.rand.Next(1, 13)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - } - //On grass, grow flowers - if (Main.tile[x, y + 1].type == 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.frameX = (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.frameX = (short)(18 * Main.rand.Next(6, 21)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - } - //On hallowed grass, grow hallowed flowers - else if (Main.tile[x, y + 1].type == 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.frameX = (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.frameX = (short)(18 * Main.rand.Next(2, 8)); - } - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - } - //On jungle grass, grow jungle flowers - else if (Main.tile[x, y + 1].type == TileID.JungleGrass) - { - tile.active(true); - tile.type = TileID.JunglePlants2; - tile.frameX = (short)(18 * Main.rand.Next(9, 17)); - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - } - } - } - } + if (player.ownedProjectileCounts[siren] < 1) + { + Projectile.NewProjectile(player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[healer] < 1) + { + Projectile.NewProjectile(player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[sandy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); + } + if (player.ownedProjectileCounts[cloudy] < 1) + { + Projectile.NewProjectile(player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); + } + } + } public override void AddRecipes() { @@ -238,10 +105,6 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ItemType()); recipe.AddIngredient(ItemType()); recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); - recipe.AddIngredient(ItemType()); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index 496099c033..6df15b59ab 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Hide of Astrum Deus"); - Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 50% for a time\n" + + Tooltip.SetDefault("Taking damage, or inflicting a true melee strike, drops an immense amount of astral stars from the sky\n" + + "Taking damage boosts true melee damage by 50%\n" + "Boost duration is based on the amount of damage you took, the higher the damage the longer the boost\n" + "Provides immunity to the astral infection, cursed inferno, on fire, and frostburn debuffs\n" + "Enemies take damage when they hit you and are inflicted with the astral infection debuff"); @@ -22,10 +23,10 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index e9d1fade78..ebbcbd12c2 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.BottledHoney, 10); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.ButterflyDust); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index ef5c92d3de..168760f710 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -3,57 +3,59 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { - public class HowlsHeart : ModItem - { - public const int HowlDamage = 45; + public class HowlsHeart : ModItem + { + public const int HowlDamage = 45; - public override void SetStaticDefaults() - { - 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"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); - } + public override void SetStaticDefaults() + { + 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"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 26; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 26; + item.accessory = true; + + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().donorItem = true; + } public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().howlsHeart; - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.howlsHeart = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(BuffType()) == -1) - { - player.AddBuff(BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 1f); - } - if (player.ownedProjectileCounts[ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); - } - if (player.ownedProjectileCounts[ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); - } - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.howlsHeart = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(BuffType()) == -1) + { + player.AddBuff(BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(HowlDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 1f); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } + } } diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index a9b42a24b3..1cec68dfc8 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 22; item.height = 50; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/IronBoots.cs b/Items/Accessories/IronBoots.cs index 905159b88d..a076e4a12f 100644 --- a/Items/Accessories/IronBoots.cs +++ b/Items/Accessories/IronBoots.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/JellyChargedBattery.cs b/Items/Accessories/JellyChargedBattery.cs index 2da23872fb..8c07ea7643 100644 --- a/Items/Accessories/JellyChargedBattery.cs +++ b/Items/Accessories/JellyChargedBattery.cs @@ -20,14 +20,13 @@ namespace CalamityMod.Items.Accessories item.height = 22; item.value = CalamityGlobalItem.Rarity4BuyPrice; item.accessory = true; - item.rare = 4; + item.rare = ItemRarityID.LightRed; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().voltaicJelly = true; player.Calamity().jellyChargedBattery = true; - player.maxMinions ++; player.minionDamage += 0.07f; } diff --git a/Items/Accessories/Laudanum.cs b/Items/Accessories/Laudanum.cs index 7be348eff8..c4c1269288 100644 --- a/Items/Accessories/Laudanum.cs +++ b/Items/Accessories/Laudanum.cs @@ -1,15 +1,18 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Accessories { - public class Laudanum : ModItem + public class Laudanum : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Laudanum"); - Tooltip.SetDefault("The Horror debuff lasts twice as long,\n" + - "but it instead grants various buffs to the player\n" + + Tooltip.SetDefault("Converts certain debuffs into buffs and extends their durations\n" + + "Debuffs affected: Darkness, Blackout, Confused, Slow, Weak, Broken Armor,\n" + + "Armor Crunch, War Cleave, Chilled, Ichor and Obstructed\n" + "Revengeance drop"); } @@ -18,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs index 96002b3fcf..7408e2de37 100644 --- a/Items/Accessories/LeadCore.cs +++ b/Items/Accessories/LeadCore.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.StatDebuffs; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class LeadCore : ModItem @@ -15,7 +17,7 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.value = CalamityGlobalItem.Rarity5BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index ab037f4cf8..f73a69f8be 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Leviathan Ambergris"); Tooltip.SetDefault("You leave behind poisonous seawater as you move\n" + - "75% increased movement speed, 10% increase to all damage, and plus 20 defense while submerged in liquid\n" + + "30% increased movement speed, 10% increase to all damage, and plus 20 defense while submerged in liquid\n" + "If you are damaged while submerged in liquid you will gain a damaging aura for a short time\n" + "Being outside of liquid increases all damage by 5% and increases damage reduction by 5%"); } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories item.value = CalamityGlobalItem.Rarity7BuyPrice; item.accessory = true; item.expert = true; - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories { player.allDamage += 0.1f; player.statDefense += 20; - player.moveSpeed += 0.75f; + player.moveSpeed += 0.3f; } } if ((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1) diff --git a/Items/Accessories/LifeJelly.cs b/Items/Accessories/LifeJelly.cs index bfe74550a5..93bb76dda1 100644 --- a/Items/Accessories/LifeJelly.cs +++ b/Items/Accessories/LifeJelly.cs @@ -1,6 +1,7 @@ using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Accessories player.statLifeMax2 += 20; if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) { - player.lifeRegen += 2; + player.lifeRegen += 4; } } } diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index 43eb694e8c..650d8d6225 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } @@ -37,9 +37,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ItemID.Vine, 2); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.BeeWax, 10); recipe.AddIngredient(ItemID.Bezoar); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); diff --git a/Items/Accessories/LumenousAmulet.cs b/Items/Accessories/LumenousAmulet.cs index 6e49778897..99ab153d64 100644 --- a/Items/Accessories/LumenousAmulet.cs +++ b/Items/Accessories/LumenousAmulet.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Lumenous Amulet"); Tooltip.SetDefault("Attacks inflict the Crush Depth debuff\n" + + "Grants immunity to the Crush Depth debuff\n" + "While in the abyss you gain 25% increased max life\n" + "Provides a moderate amount of light in the abyss"); } @@ -23,7 +25,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } @@ -32,7 +34,8 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.abyssalAmulet = true; modPlayer.lumenousAmulet = true; - } + player.buffImmune[ModContent.BuffType()] = true; + } public override void AddRecipes() { diff --git a/Items/Accessories/LureofEnthrallment.cs b/Items/Accessories/LureofEnthrallment.cs index 354a971050..cb7e167e3b 100644 --- a/Items/Accessories/LureofEnthrallment.cs +++ b/Items/Accessories/LureofEnthrallment.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 56; item.height = 56; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index e2748a26da..83a142ad29 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 58; item.height = 48; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/LuxorsGift.png b/Items/Accessories/LuxorsGift.png index cecdcac2f8..f47ea32f11 100644 Binary files a/Items/Accessories/LuxorsGift.png and b/Items/Accessories/LuxorsGift.png differ diff --git a/Items/Accessories/MagicLevelMeter.cs b/Items/Accessories/MagicLevelMeter.cs index ffe71460e0..cd7f579dae 100644 --- a/Items/Accessories/MagicLevelMeter.cs +++ b/Items/Accessories/MagicLevelMeter.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -44,64 +45,64 @@ namespace CalamityMod.Items.Accessories manaUsage = 1; break; case 4: - damageGain = 3; + damageGain = 2; manaUsage = 1; critGain = 1; break; case 5: - damageGain = 3; + damageGain = 2; manaUsage = 2; critGain = 1; break; case 6: - damageGain = 4; - manaUsage = 3; + damageGain = 3; + manaUsage = 2; critGain = 1; break; case 7: + damageGain = 3; + manaUsage = 2; + critGain = 2; + break; + case 8: + damageGain = 3; + manaUsage = 3; + critGain = 2; + break; + case 9: + damageGain = 4; + manaUsage = 3; + critGain = 2; + break; + case 10: damageGain = 4; manaUsage = 4; critGain = 2; break; - case 8: - damageGain = 5; - manaUsage = 5; - critGain = 2; + case 11: + damageGain = 4; + manaUsage = 4; + critGain = 3; break; - case 9: + case 12: + damageGain = 4; + manaUsage = 5; + critGain = 3; + break; + case 13: damageGain = 5; manaUsage = 5; critGain = 3; break; - case 10: - damageGain = 6; + case 14: + damageGain = 5; manaUsage = 6; critGain = 3; break; - case 11: - damageGain = 7; - manaUsage = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - manaUsage = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - manaUsage = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - manaUsage = 10; - critGain = 5; - break; case 15: - damageGain = 12; - manaUsage = 12; - critGain = 6; + damageGain = 6; + manaUsage = 6; + critGain = 3; break; } foreach (TooltipLine line2 in list) diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/ManaJelly.cs index e44bfa8874..445a991e43 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/ManaJelly.cs @@ -1,6 +1,7 @@ using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Accessories player.statManaMax2 += 20; if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) { - player.manaRegenBonus += 2; + player.manaRegenBonus += 4; } } } diff --git a/Items/Accessories/ManaOverloader.cs b/Items/Accessories/ManaOverloader.cs index 48550050ea..ececdc1c4b 100644 --- a/Items/Accessories/ManaOverloader.cs +++ b/Items/Accessories/ManaOverloader.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 30; item.height = 30; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; item.expert = true; } diff --git a/Items/Accessories/MeleeLevelMeter.cs b/Items/Accessories/MeleeLevelMeter.cs index 2ce168d7ee..4e93b1a7dc 100644 --- a/Items/Accessories/MeleeLevelMeter.cs +++ b/Items/Accessories/MeleeLevelMeter.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -44,65 +45,65 @@ namespace CalamityMod.Items.Accessories meleeSpeed = 1; break; case 4: - damageGain = 3; + damageGain = 2; meleeSpeed = 1; critGain = 1; break; case 5: damageGain = 3; - meleeSpeed = 2; + meleeSpeed = 1; critGain = 1; break; case 6: damageGain = 4; - meleeSpeed = 3; + meleeSpeed = 1; critGain = 1; break; case 7: damageGain = 4; - meleeSpeed = 4; - critGain = 2; + meleeSpeed = 2; + critGain = 1; break; case 8: - damageGain = 5; - meleeSpeed = 5; + damageGain = 4; + meleeSpeed = 2; critGain = 2; break; case 9: damageGain = 5; + meleeSpeed = 2; + critGain = 2; + break; + case 10: + damageGain = 5; + meleeSpeed = 3; + critGain = 2; + break; + case 11: + damageGain = 5; + meleeSpeed = 3; + critGain = 3; + break; + case 12: + damageGain = 5; + meleeSpeed = 4; + critGain = 3; + break; + case 13: + damageGain = 6; + meleeSpeed = 4; + critGain = 3; + break; + case 14: + damageGain = 6; meleeSpeed = 5; critGain = 3; break; - case 10: + case 15: damageGain = 6; meleeSpeed = 6; critGain = 3; break; - case 11: - damageGain = 7; - meleeSpeed = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - meleeSpeed = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - meleeSpeed = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - meleeSpeed = 10; - critGain = 5; - break; - case 15: - damageGain = 12; - meleeSpeed = 12; - critGain = 6; - break; } foreach (TooltipLine line2 in list) { diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs index a77f7ed2aa..b269690673 100644 --- a/Items/Accessories/MirageMirror.cs +++ b/Items/Accessories/MirageMirror.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 30; item.height = 30; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/MomentumCapacitor.cs b/Items/Accessories/MomentumCapacitor.cs index 0d14790fb1..b941544320 100644 --- a/Items/Accessories/MomentumCapacitor.cs +++ b/Items/Accessories/MomentumCapacitor.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 36, 0, 0); item.accessory = true; - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index d913dd1257..eb509e1d5b 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Items.Accessories { public class MoonstoneCrown : ModItem { + // Base damage of lunar flares on stealth strikes. Increased by rogue damage stats, but not stealth damage. + internal const int BaseDamage = 85; + public override void SetStaticDefaults() { DisplayName.SetDefault("Moonstone Crown"); @@ -20,9 +23,8 @@ namespace CalamityMod.Items.Accessories { item.width = 46; item.height = 40; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.accessory = true; } diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index 14263c6d8a..7a04a112ec 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -4,6 +4,8 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class MutatedTruffle : ModItem @@ -20,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 24; item.height = 26; item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Red; item.expert = true; item.accessory = true; } @@ -35,7 +37,7 @@ namespace CalamityMod.Items.Accessories { player.AddBuff(ModContent.BuffType(), 3600, true); } - const int damage = 2000; + const int damage = 1200; if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { Projectile.NewProjectile(player.Center, Vector2.Zero, diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 4281b349d7..f9025cbe22 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -15,11 +15,10 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("Rogue projectiles create nanoblades as they travel\n" + "Stealth strikes summon nanobeams and sparks on enemy hits\n" + "Stealth strikes have +20 armor penetration, deal 5% more damage, and heal for 1 HP\n" + - "Rogue weapons have a chance to instantly kill normal enemies\n" + - "12% increased rogue damage and 15% increased rogue velocity\n" + + "15% increased rogue damage and 15% increased rogue velocity\n" + "Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + "This effect can stack up to 150 times\n" + - "Max rogue damage boost is 10%\n" + + "Max rogue damage boost is 15%\n" + "This line is modified below"); } @@ -37,7 +36,7 @@ namespace CalamityMod.Items.Accessories int critLevel = Main.player[Main.myPlayer].Calamity().raiderStack; foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip8") + if (line2.mod == "Terraria" && line2.Name == "Tooltip7") { line2.text = "Rogue Crit Level: " + critLevel; } @@ -50,7 +49,7 @@ namespace CalamityMod.Items.Accessories modPlayer.nanotech = true; modPlayer.raiderTalisman = true; modPlayer.electricianGlove = true; - player.Calamity().throwingDamage += 0.12f; + player.Calamity().throwingDamage += 0.15f; player.Calamity().throwingVelocity += 0.15f; } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 36e10f9c87..cfb8b3aba2 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -21,10 +22,10 @@ namespace CalamityMod.Items.Accessories { item.width = 16; item.height = 14; - item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; item.expert = true; - item.rare = 10; + item.rare = ItemRarityID.Red; } public override void Update(ref float gravity, ref float maxFallSpeed) @@ -39,7 +40,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; player.allDamage += 0.12f; - int damage = (int)(1500 * player.AverageDamage()); + int damage = (int)(750 * player.AverageDamage()); float knockBack = 3f; if (Main.rand.NextBool(15)) { diff --git a/Items/Accessories/NecklaceofVexation.cs b/Items/Accessories/NecklaceofVexation.cs index 6002f0375b..f52df007a7 100644 --- a/Items/Accessories/NecklaceofVexation.cs +++ b/Items/Accessories/NecklaceofVexation.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 34; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } diff --git a/Items/Accessories/NuclearRod.cs b/Items/Accessories/NuclearRod.cs index bb51bbeb83..bb54a5075d 100644 --- a/Items/Accessories/NuclearRod.cs +++ b/Items/Accessories/NuclearRod.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -17,13 +18,12 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.maxMinions++; player.Calamity().nuclearRod = true; } } diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 3b2a51d1fe..91161a160a 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -11,12 +11,12 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Nucleogenesis"); - Tooltip.SetDefault("Increased max minions by 4 and 15% increased minion damage\n" + + Tooltip.SetDefault("Increases max minions by 4, does not stack with downgrades\n" + + "15% increased minion damage\n" + "Increased minion knockback\n" + "Minions inflict a variety of debuffs\n" + - "Minions spawn damaging sparks on enemy hits\n" + //subject to change to be "cooler" - "Minion attacks have a chance to instantly kill normal enemies"); - } + "Minions spawn damaging sparks on enemy hits"); //subject to change to be "cooler" + } public override void SetDefaults() { @@ -32,12 +32,11 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.nucleogenesis = true; modPlayer.shadowMinions = true; //shadowflame - modPlayer.tearMinions = true; //temporal sadness + modPlayer.holyMinions = true; //holy flames modPlayer.voltaicJelly = true; //electrified modPlayer.starTaintedGenerator = true; //astral infection and irradiated player.minionKB += 3f; player.minionDamage += 0.15f; - player.maxMinions += 4; } public override void AddRecipes() diff --git a/Items/Accessories/OceanCrest.cs b/Items/Accessories/OceanCrest.cs index e983282be5..bf28466789 100644 --- a/Items/Accessories/OceanCrest.cs +++ b/Items/Accessories/OceanCrest.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.width = 18; item.height = 26; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; item.expert = true; } diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 48844d0b20..778f88c9a6 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 24; item.height = 26; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index e4b36c2695..980f4913d6 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Ornate Shield"); - Tooltip.SetDefault("Boosted damage reduction and health while wearing the Daedalus armor"); + Tooltip.SetDefault("Boosted damage reduction and health while wearing the Daedalus armor\n" + + "Grants a frost dash that freezes enemies"); } public override void SetDefaults() @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 36; item.height = 32; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 8; item.accessory = true; } @@ -35,7 +36,8 @@ namespace CalamityMod.Items.Accessories player.endurance += 0.08f; player.statLifeMax2 += 20; } - } + player.Calamity().dashMod = 6; + } public override void AddRecipes() { diff --git a/Items/Accessories/PermafrostsConcoction.cs b/Items/Accessories/PermafrostsConcoction.cs index fa2c7d887e..8fec8f18f6 100644 --- a/Items/Accessories/PermafrostsConcoction.cs +++ b/Items/Accessories/PermafrostsConcoction.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -23,7 +24,7 @@ You are encased in an ice barrier for 3 seconds when revived"); item.width = 36; item.height = 34; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/PermafrostsConcoction.png b/Items/Accessories/PermafrostsConcoction.png index a6bc883ce5..01947ec607 100644 Binary files a/Items/Accessories/PermafrostsConcoction.png and b/Items/Accessories/PermafrostsConcoction.png differ diff --git a/Items/Accessories/PhantomicArtifact.cs b/Items/Accessories/PhantomicArtifact.cs new file mode 100644 index 0000000000..e3956c6c56 --- /dev/null +++ b/Items/Accessories/PhantomicArtifact.cs @@ -0,0 +1,48 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; + +namespace CalamityMod.Items.Accessories +{ + class PhantomicArtifact : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantomic Artifact"); + Tooltip.SetDefault("Whenever your minions hit an enemy you will gain a random phantomic buff, does not stack with downgrades\n" + + "These buffs will either boost your defense, summon damage, or life regen for a while\n" + + "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"); + } + + public override void SetDefaults() + { + item.width = 48; + item.height = 62; + item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().phantomicArtifact = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/PhantomicArtifact.png b/Items/Accessories/PhantomicArtifact.png new file mode 100644 index 0000000000..50bc4f200b Binary files /dev/null and b/Items/Accessories/PhantomicArtifact.png differ diff --git a/Items/Accessories/PlagueHive.cs b/Items/Accessories/PlagueHive.cs index 5509810c03..2d750bbf8b 100644 --- a/Items/Accessories/PlagueHive.cs +++ b/Items/Accessories/PlagueHive.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("The power of your bees and wasps will rival the Moon Lord himself\n" + "Summons a damaging plague aura around the player to destroy nearby enemies\n" + "Releases bees when damaged\n" + - "Friendly bees inflict the plague\n" + "All of your attacks inflict the plague\n" + "Reduces the damage caused to you by the plague\n" + "Projectiles spawn plague seekers on enemy hits"); @@ -24,11 +23,11 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 30; - item.height = 38; + item.width = 42; + item.height = 48; item.value = CalamityGlobalItem.Rarity9BuyPrice; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.accessory = true; } diff --git a/Items/Accessories/PlagueHive.png b/Items/Accessories/PlagueHive.png index 48e3845b9a..1cd4a7baaa 100644 Binary files a/Items/Accessories/PlagueHive.png and b/Items/Accessories/PlagueHive.png differ diff --git a/Items/Accessories/PlaguedFuelPack.cs b/Items/Accessories/PlaguedFuelPack.cs index 56fd678474..8a6d2d0bc4 100644 --- a/Items/Accessories/PlaguedFuelPack.cs +++ b/Items/Accessories/PlaguedFuelPack.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,10 +10,10 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Plagued Fuel Pack"); - Tooltip.SetDefault("5% increased rogue damage\n" + - "15% increased rogue projectile velocity\n" + + Tooltip.SetDefault("5% increased rogue damage and 15% increased rogue projectile velocity\n" + + "Stealth generates 10% faster\n" + "TOOLTIP LINE HERE" + - "This effect has a 3 second cooldown before it can be used again"); + "This effect has a 1 second cooldown before it can be used again"); } public override void SetDefaults() @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 36; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } @@ -32,6 +33,8 @@ namespace CalamityMod.Items.Accessories player.Calamity().throwingDamage += 0.05f; player.Calamity().throwingVelocity += 0.15f; player.Calamity().plaguedFuelPack = true; + player.Calamity().stealthGenStandstill += 0.1f; + player.Calamity().stealthGenMoving += 0.1f; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/ProfanedSoulArtifact.cs b/Items/Accessories/ProfanedSoulArtifact.cs index c7418c0ab9..84a80167ad 100644 --- a/Items/Accessories/ProfanedSoulArtifact.cs +++ b/Items/Accessories/ProfanedSoulArtifact.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Accessories { item.width = 32; item.height = 40; - item.accessory = true; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - } + item.accessory = true; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; + } public override bool CanEquipAccessory(Player player, int slot) { @@ -46,10 +46,10 @@ 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.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.DemonAltar); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 296495236a..898cea7fce 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -1,7 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.World; +using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; using Terraria.DataStructures; @@ -13,7 +15,6 @@ namespace CalamityMod.Items.Accessories //Developer item, dedicatee: Mishiro Usui/Amber Sienna public class ProfanedSoulCrystal : ModItem { - /** * Notes: Drops from providence if the only damage source during the fight is from typeless damage or the profaned soul and the owners of those babs do not have profaned crystal. * All projectiles are in ProfanedSoulCrystalProjectiles.cs in the summon projectile directory @@ -40,8 +41,8 @@ namespace CalamityMod.Items.Accessories "You are no longer affected by burn out when hit\n" + "Provides buffs depending on the time of day\n" + "Provides heat and cold protection in Death Mode\n" + - "Thinking back, it was a boring life\n" + - "[c/FFBF49:And so we burn it all in the name of purity]"); + "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)); } @@ -49,10 +50,10 @@ namespace CalamityMod.Items.Accessories { item.width = 50; item.height = 50; - item.value = Item.buyPrice(5, 0, 0, 0); item.accessory = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override bool CanEquipAccessory(Player player, int slot) @@ -97,19 +98,19 @@ namespace CalamityMod.Items.Accessories line.text = "[c/3a83e4:Transforms Magic attacks into a powerful splitting fireball for " + manaCost + " mana per cast]"; } } - } - if (CalamityWorld.downedSCal) - { - if (!CalamityWorld.death) - { - foreach (TooltipLine line in tooltips) - { - if (line.mod == "Terraria" && line.Name == "Tooltip11") - { - line.text = ""; - } - } - } + } + if (CalamityWorld.downedSCal) + { + if (!CalamityWorld.death) + { + foreach (TooltipLine line in tooltips) + { + if (line.mod == "Terraria" && line.Name == "Tooltip11") + { + line.text = ""; + } + } + } } } @@ -124,6 +125,152 @@ namespace CalamityMod.Items.Accessories modPlayer.profanedCrystalHide = true; } + // Moved from CalamityGlobalItem since it's just a function called in one place. + internal static bool TransformItemUsage(Item item, Player player) + { + if (player.whoAmI != Main.myPlayer) + return false; + int weaponType = item.melee ? 1 : item.ranged ? 2 : item.magic ? 3 : item.Calamity().rogue ? 4 : -1; + if (weaponType > 0) + { + if (player.Calamity().profanedSoulWeaponType != weaponType || player.Calamity().profanedSoulWeaponUsage >= 300) + { + player.Calamity().profanedSoulWeaponType = weaponType; + player.Calamity().profanedSoulWeaponUsage = 0; + } + Vector2 correctedVelocity = Main.MouseWorld - player.Center; + correctedVelocity.Normalize(); + bool shouldNerf = player.Calamity().endoCooper || player.Calamity().magicHat; //No bonkers damage memes thank you very much. + bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); + if (item.melee) + { + if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 4 : 6) == 0) + { + if (player.Calamity().profanedSoulWeaponUsage > 0 && player.Calamity().profanedSoulWeaponUsage % (enrage ? 20 : 30) == 0) //every 5 shots is a shotgun spread + { + int numProj = 5; + + correctedVelocity *= 12f; + int spread = 3; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); + + 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); + } + 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); + } + + } + player.Calamity().profanedSoulWeaponUsage++; + + } + else if (item.ranged) + { + if (enrage || Main.rand.NextBool(2)) //100% chance if 50% or lower, else 1 in 2 chance + { + correctedVelocity *= 20f; + Vector2 perturbedspeed = new Vector2(correctedVelocity.X + Main.rand.Next(-3, 4), correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(3)); + bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. + bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% + int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; + int dam = (int)((shouldNerf ? 100 : 200) * player.MinionDamage()); + switch (projType) + { + case 1: //big boomer + case 2: //boomer + int proj = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, projType == 1 ? 1f : 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; + break; + case 3: //bab boomer + int proj2 = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f); + if (proj2.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj2].Calamity().forceMinion = true; + break; + } + if (projType > 1) + { + Main.PlaySound(SoundID.Item20, player.Center); + } + } + } + else if (item.magic) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + player.Calamity().profanedSoulWeaponUsage = 0; + } + int manaCost = (int)(100 * player.manaCost); + if (player.statMana < manaCost && player.Calamity().profanedSoulWeaponUsage == 0) + { + if (player.manaFlower) + { + player.QuickMana(); + } + } + if (player.statMana >= manaCost && player.Calamity().profanedSoulWeaponUsage == 0 && !player.silence) + { + player.manaRegenDelay = (int)player.maxRegenDelay; + player.statMana -= manaCost; + correctedVelocity *= 25f; + Main.PlaySound(SoundID.Item20, player.Center); + int dam = (int)((shouldNerf ? 450 : 900) * player.MinionDamage()); + if (player.HasBuff(BuffID.ManaSickness)) + { + int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); + dam -= sickPenalty; + } + int proj = Projectile.NewProjectile(player.position, correctedVelocity, ModContent.ProjectileType(), dam, 1f, player.whoAmI, enrage ? 1f : 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; + player.Calamity().profanedSoulWeaponUsage = enrage ? 20 : 25; + } + if (player.Calamity().profanedSoulWeaponUsage > 0) + player.Calamity().profanedSoulWeaponUsage--; + } + else if (item.Calamity().rogue) + { + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + player.Calamity().profanedSoulWeaponUsage = 0; + } + if (player.Calamity().profanedSoulWeaponUsage >= (enrage ? 69 : 180)) + { + float crystalCount = 36f; + for (float i = 0; i < crystalCount; i++) + { + float angle = MathHelper.TwoPi / crystalCount * i; + 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); + } + player.Calamity().profanedSoulWeaponUsage = 0; + } + else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) + { + float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); + 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); + } + player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2; + if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0) + player.Calamity().profanedSoulWeaponUsage--; + } + } + return false; + } + public override void AddRecipes() { PSCRecipe recipe = new PSCRecipe(mod); @@ -143,7 +290,6 @@ namespace CalamityMod.Items.Accessories public class PSCRecipe : ModRecipe { - public PSCRecipe(Mod mod) : base(mod) { } public override int ConsumeItem(int type, int numRequired) diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index 86cfea1da1..abdff8c8b1 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 370c62d21d..4828b840ba 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -18,18 +18,13 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().rOoze = true; - if (!Main.dayTime) - { - Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f); - player.lifeRegen += 1; - } } public override void AddRecipes() diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 4109867459..472f19d149 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 27f92cbd10..f2fbb00a57 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -8,15 +8,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [AutoloadEquip(EquipType.Shield)] public class RampartofDeities : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Rampart of Deities"); - Tooltip.SetDefault("Taking damage grants boosted movement speed for a short time\n" + - "Causes stars to fall and gives increased immune time when damaged\n" + - "Increases armor penetration by 20 and reduces the cooldown of healing potions\n" + - "Provides light underwater and provides a small amount of light in the abyss\n" + + Tooltip.SetDefault("Causes stars to fall and gives increased immune time when damaged\n" + + "Reduces the cooldown of healing potions\n" + "Absorbs 25% of damage done to players on your team\n" + "This effect is only active above 25% life\n" + "Grants immunity to knockback\n" + @@ -27,8 +26,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 38; - item.height = 44; + item.width = 64; + item.height = 62; item.value = CalamityGlobalItem.Rarity14BuyPrice; item.defense = 12; item.accessory = true; @@ -41,7 +40,7 @@ namespace CalamityMod.Items.Accessories { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip9") + if (line2.mod == "Terraria" && line2.Name == "Tooltip7") { line2.text = ""; } @@ -55,8 +54,8 @@ namespace CalamityMod.Items.Accessories modPlayer.dAmulet = true; modPlayer.rampartOfDeities = true; modPlayer.fBulwark = true; - modPlayer.jellyfishNecklace = true; - } + player.longInvince = true; + } public override void AddRecipes() { diff --git a/Items/Accessories/RampartofDeities.png b/Items/Accessories/RampartofDeities.png index 115623e6c8..a9edc4ae64 100644 Binary files a/Items/Accessories/RampartofDeities.png and b/Items/Accessories/RampartofDeities.png differ diff --git a/Items/Accessories/RampartofDeities_Shield.png b/Items/Accessories/RampartofDeities_Shield.png new file mode 100644 index 0000000000..9c9359a5e7 Binary files /dev/null and b/Items/Accessories/RampartofDeities_Shield.png differ diff --git a/Items/Accessories/RangedLevelMeter.cs b/Items/Accessories/RangedLevelMeter.cs index c3cfcf53bc..2f77a86eb4 100644 --- a/Items/Accessories/RangedLevelMeter.cs +++ b/Items/Accessories/RangedLevelMeter.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -44,64 +45,64 @@ namespace CalamityMod.Items.Accessories critGain = 1; break; case 4: - damageGain = 3; - critGain = 1; - moveSpeed = 1; + damageGain = 2; + moveSpeed = 1; + critGain = 1; break; case 5: - damageGain = 3; + damageGain = 2; moveSpeed = 2; critGain = 1; break; case 6: - damageGain = 4; + damageGain = 2; moveSpeed = 3; critGain = 1; break; case 7: + damageGain = 2; + moveSpeed = 3; + critGain = 2; + break; + case 8: + damageGain = 3; + moveSpeed = 3; + critGain = 2; + break; + case 9: + damageGain = 3; + moveSpeed = 4; + critGain = 2; + break; + case 10: damageGain = 4; moveSpeed = 4; critGain = 2; break; - case 8: - damageGain = 5; - moveSpeed = 5; - critGain = 2; + case 11: + damageGain = 4; + moveSpeed = 4; + critGain = 3; break; - case 9: + case 12: + damageGain = 4; + moveSpeed = 5; + critGain = 3; + break; + case 13: damageGain = 5; moveSpeed = 5; critGain = 3; break; - case 10: - damageGain = 6; + case 14: + damageGain = 5; moveSpeed = 6; critGain = 3; break; - case 11: - damageGain = 7; - moveSpeed = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - moveSpeed = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - moveSpeed = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - moveSpeed = 10; - critGain = 5; - break; case 15: - damageGain = 12; - moveSpeed = 12; - critGain = 6; + damageGain = 6; + moveSpeed = 6; + critGain = 3; break; } foreach (TooltipLine line2 in list) diff --git a/Items/Accessories/ReaperToothNecklace.cs b/Items/Accessories/ReaperToothNecklace.cs index 8a7950d10e..df1cfcf6cc 100644 --- a/Items/Accessories/ReaperToothNecklace.cs +++ b/Items/Accessories/ReaperToothNecklace.cs @@ -12,36 +12,34 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Reaper Tooth Necklace"); - Tooltip.SetDefault("Increases armor penetration by 100\n" + - "Increases all damage by 25%\n" + - "Cuts your defense and damage reduction in half"); + Tooltip.SetDefault("A grisly trophy from the ultimate predator\n" + "10% increased damage\n" + "Increases armor penetration by 15"); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = 10; + 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) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.reaperToothNecklace = true; - player.armorPenetration += 100; + player.allDamage += 0.1f; + player.armorPenetration += 15; } 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.MythrilAnvil); + recipe.AddTile(TileID.TinkerersWorkbench); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenator.cs index aba20fbf1c..dc858ea4c7 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenator.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -14,14 +15,14 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - item.width = 36; - item.height = 32; - item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.width = 34; + item.height = 56; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; item.defense = 6; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/Regenator.png b/Items/Accessories/Regenator.png index a7a00808f1..4c7c7ee7f8 100644 Binary files a/Items/Accessories/Regenator.png and b/Items/Accessories/Regenator.png differ diff --git a/Items/Accessories/RogueEmblem.cs b/Items/Accessories/RogueEmblem.cs index 27d08654c5..599afdf469 100644 --- a/Items/Accessories/RogueEmblem.cs +++ b/Items/Accessories/RogueEmblem.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Accessories item.width = 24; item.height = 24; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.accessory = true; } diff --git a/Items/Accessories/RogueLevelMeter.cs b/Items/Accessories/RogueLevelMeter.cs index 21e7acd1b5..824d973d79 100644 --- a/Items/Accessories/RogueLevelMeter.cs +++ b/Items/Accessories/RogueLevelMeter.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -44,64 +45,64 @@ namespace CalamityMod.Items.Accessories velocityGain = 1; break; case 4: - damageGain = 3; - critGain = 1; - velocityGain = 1; + damageGain = 2; + velocityGain = 1; + critGain = 1; break; case 5: - damageGain = 3; + damageGain = 2; velocityGain = 2; critGain = 1; break; case 6: - damageGain = 4; + damageGain = 2; velocityGain = 3; critGain = 1; break; case 7: + damageGain = 3; + velocityGain = 3; + critGain = 1; + break; + case 8: + damageGain = 3; + velocityGain = 3; + critGain = 2; + break; + case 9: + damageGain = 3; + velocityGain = 4; + critGain = 2; + break; + case 10: damageGain = 4; velocityGain = 4; critGain = 2; break; - case 8: - damageGain = 5; - velocityGain = 5; - critGain = 2; + case 11: + damageGain = 4; + velocityGain = 4; + critGain = 3; break; - case 9: + case 12: + damageGain = 4; + velocityGain = 5; + critGain = 3; + break; + case 13: damageGain = 5; velocityGain = 5; critGain = 3; break; - case 10: - damageGain = 6; + case 14: + damageGain = 5; velocityGain = 6; critGain = 3; break; - case 11: - damageGain = 7; - velocityGain = 7; - critGain = 4; - break; - case 12: - damageGain = 8; - velocityGain = 8; - critGain = 4; - break; - case 13: - damageGain = 9; - velocityGain = 9; - critGain = 5; - break; - case 14: - damageGain = 10; - velocityGain = 10; - critGain = 5; - break; case 15: - damageGain = 12; - velocityGain = 12; - critGain = 6; + damageGain = 6; + velocityGain = 6; + critGain = 3; break; } foreach (TooltipLine line2 in list) diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index ff29ececd6..18e1bc8318 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -3,6 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class RoseStone : ModItem @@ -11,7 +13,6 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Rose Stone"); Tooltip.SetDefault("One of the ancient relics\n" + - "Increases max life by 20, life regen by 1, and all damage by 3%\n" + "Summons a brimstone elemental to fight for you"); } @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } @@ -36,10 +37,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.6f, 0f, 0.25f); - player.lifeRegen += 1; - player.statLifeMax2 += 20; - player.allDamage += 0.03f; CalamityPlayer modPlayer = player.Calamity(); modPlayer.brimstoneWaifu = true; if (player.whoAmI == Main.myPlayer) @@ -50,7 +47,7 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(45 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(60 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); } } } diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 6ada62f8f1..7bfd7f5e34 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.height = 34; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.expert = true; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } @@ -29,12 +30,17 @@ namespace CalamityMod.Items.Accessories { if (player.immune) { - if (Main.rand.NextBool(8)) + if (player.miscCounter % 6 == 0) { if (player.whoAmI == Main.myPlayer) { - Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(18 * player.AverageDamage()), 2f, player.whoAmI, 6, 1); - rain.tileCollide = false; + Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(18 * player.AverageDamage()), 2f, player.whoAmI); + if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) + { + rain.Calamity().forceTypeless = true; + rain.tileCollide = false; + rain.penetrate = 1; + } } } } diff --git a/Items/Accessories/RottenDogtooth.cs b/Items/Accessories/RottenDogtooth.cs new file mode 100644 index 0000000000..fb51bb1b1f --- /dev/null +++ b/Items/Accessories/RottenDogtooth.cs @@ -0,0 +1,34 @@ +using CalamityMod.CalPlayer; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class RottenDogtooth : ModItem + { + internal const int ArmorCrunchDebuffTime = 180; + internal const float StealthStrikeDamageMultiplier = 0.1f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rotten Dogtooth"); + Tooltip.SetDefault($"Makes Stealth strikes inflict Armor Crunch, deal {(int)(StealthStrikeDamageMultiplier * 100)}% more damage and cost 1 less unit of stealth."); + } + + public override void SetDefaults() + { + 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) + { + player.Calamity().rottenDogTooth = true; + player.Calamity().flatStealthLossReduction++; + } + } +} diff --git a/Items/Accessories/RottenDogtooth.png b/Items/Accessories/RottenDogtooth.png new file mode 100644 index 0000000000..8a542b03b6 Binary files /dev/null and b/Items/Accessories/RottenDogtooth.png differ diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index eb6db78b0b..08b1e36aa9 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 38; item.height = 26; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs index 3e70d33bf4..e0f6e3260d 100644 --- a/Items/Accessories/RuinMedallion.cs +++ b/Items/Accessories/RuinMedallion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 28; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index e77b0415f5..458d4d62d6 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories { item.width = 18; item.height = 32; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.value = CalamityGlobalItem.Rarity1BuyPrice; item.accessory = true; } diff --git a/Items/Accessories/SamuraiBadge.cs b/Items/Accessories/SamuraiBadge.cs index 6835e18af3..2fa867eade 100644 --- a/Items/Accessories/SamuraiBadge.cs +++ b/Items/Accessories/SamuraiBadge.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -8,19 +10,22 @@ namespace CalamityMod.Items.Accessories { public override void SetStaticDefaults() { - DisplayName.SetDefault("Samurai Badge"); - Tooltip.SetDefault("20% increased melee and true melee damage and speed\n" + - "Reduces max life by 25%"); + 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)); } public override void SetDefaults() { - item.width = 30; - item.height = 30; - item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.width = 32; + item.height = 78; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/SamuraiBadge.png b/Items/Accessories/SamuraiBadge.png index e123f117e3..88c1edae78 100644 Binary files a/Items/Accessories/SamuraiBadge.png and b/Items/Accessories/SamuraiBadge.png differ diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index f3dea286ed..11141aef3a 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 30; item.height = 44; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/SandSharkToothNecklace.cs b/Items/Accessories/SandSharkToothNecklace.cs new file mode 100644 index 0000000000..c75050eadb --- /dev/null +++ b/Items/Accessories/SandSharkToothNecklace.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class SandSharkToothNecklace : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Shark Tooth Necklace"); + Tooltip.SetDefault("Increases armor penetration by 10\n" + "6% increased damage"); + } + + public override void SetDefaults() + { + 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) + { + player.allDamage += 0.06f; + player.armorPenetration += 10; + } + + 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(); + } + } +} diff --git a/Items/Accessories/SandSharkToothNecklace.png b/Items/Accessories/SandSharkToothNecklace.png new file mode 100644 index 0000000000..704902033a Binary files /dev/null and b/Items/Accessories/SandSharkToothNecklace.png differ diff --git a/Items/Accessories/ScuttlersJewel.cs b/Items/Accessories/ScuttlersJewel.cs index a297c7f94e..d858cfea92 100644 --- a/Items/Accessories/ScuttlersJewel.cs +++ b/Items/Accessories/ScuttlersJewel.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } diff --git a/Items/Accessories/SeaShell.cs b/Items/Accessories/SeaShell.cs index a9de56b345..4d8e935399 100644 --- a/Items/Accessories/SeaShell.cs +++ b/Items/Accessories/SeaShell.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs new file mode 100644 index 0000000000..9276cd363e --- /dev/null +++ b/Items/Accessories/ShatteredCommunity.cs @@ -0,0 +1,222 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Items.Accessories +{ + public class ShatteredCommunity : ModItem + { + // The percentage of a full Rage bar that is gained every second with the Shattered Community equipped. + public const float RagePerSecond = 0.02f; + private static readonly Color rarityColorOne = new Color(128, 62, 128); + private static readonly Color rarityColorTwo = new Color(245, 105, 245); + + // Base level cost is 400,000 damage dealt while Rage is active. + // Each successive level costs (400,000 * level) MORE damage, so the total required goes up quadratically. + // Total required to reach level 60 is 732,000,000 damage dealt. + // This is within one order of magnitude of the integer limit, so relevant values are stored as longs. + private const long BaseLevelCost = 400000L; + private static long LevelCost(int level) => BaseLevelCost * level; + private static long CumulativeLevelCost(int level) => (BaseLevelCost / 2L) * level * (level + 1); + private const int MaxLevel = 60; + + internal int level = 0; + internal long totalRageDamage = 0L; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattered Community"); + Tooltip.SetDefault("Ruined by unknowable hatred, it still contains (most of) the power of The Community...\n" + + "Legendary Accessory\n" + + "You generate rage over time and rage does not fade away out of combat\n" + + "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)); + } + + 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; + } + + // Not overriding these Clones makes tooltips fail to function correctly due to HoverItem spaghetti. + public override ModItem Clone() + { + var clone = (ShatteredCommunity)base.Clone(); + clone.level = level; + clone.totalRageDamage = totalRageDamage; + return clone; + } + public override ModItem Clone(Item item) + { + var clone = (ShatteredCommunity)base.Clone(); + clone.level = level; + clone.totalRageDamage = totalRageDamage; + return clone; + } + + internal static Color GetRarityColor() => CalamityUtils.ColorSwap(rarityColorOne, rarityColorTwo, 3f); + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.shatteredCommunity = true; + + // Shattered Community gives (mostly) the same boosts as normal Community + // It does not give melee speed or minion knockback, but always gives life regen (instead of only conditionally) + player.allDamage += 0.1f; + modPlayer.AllCritBoost(5); + player.statDefense += 10; + player.endurance += 0.05f; + player.lifeRegen += 2; + player.moveSpeed += 0.2f; + + // Shattered Community provides a stacking +1% Rage Mode damage per level. + modPlayer.RageDamageBoost += level * 0.01; + } + + // Community and Shattered Community are mutually exclusive + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().community; + public override bool CanUseItem(Player player) => false; + + // Produces purple light while in the world. + public override void PostUpdate() + { + float brightness = Main.essScale; + Lighting.AddLight(item.Center, 0.92f * brightness, 0.42f * brightness, 0.92f * brightness); + } + + internal static void AccumulateRageDamage(Player player, CalamityPlayer mp, long damage) + { + if (!mp.shatteredCommunity) + return; + // Static context, so the item ID has to be retrieved from TML. + int thisItemID = ModContent.ItemType(); + ShatteredCommunity sc = null; + + // First, find the Shattered Community in the player's inventory. + // slots 3, 4, 5, 6, 7, 8, 9 are valid non-vanity accessories + for (int i = 3; i <= 9; ++i) + { + Item acc = player.armor[i]; + if (acc.type == thisItemID) + sc = acc.modItem as ShatteredCommunity; + } + + // Safety check in case for some reason the equipped Shattered Community isn't found. + if (sc is null) + return; + + // Actually accumulate the damage. + sc.totalRageDamage += damage; + + // Level up if applicable. + if (sc.level < MaxLevel && sc.totalRageDamage > CumulativeLevelCost(sc.level + 1)) + { + ++sc.level; + sc.LevelUpEffects(player); + } + } + + private void LevelUpEffects(Player player) + { + // Spawn the purple laser beam from failing the Dungeon Defenders event. + int projID = ProjectileID.DD2ElderWins; + Vector2 offset = new Vector2(0f, 800f); // The effect is extremely tall, so start it very low down + Projectile fx = Projectile.NewProjectileDirect(player.Center + offset, Vector2.Zero, projID, 0, 0f, player.whoAmI); + fx.friendly = false; + fx.hostile = false; + // On the 108th update, crystal debris is spawned, so we avoid that. + fx.timeLeft = 107; + fx.MaxUpdates = 2; // Make the animation play at double speed. + + // Play a weird dimensional lightning sound simultaneously. + var extraSound = SoundID.DD2_EtherianPortalDryadTouch.WithVolume(1.4f); + Main.PlaySound(extraSound, player.Center); + + // Display a level up text notification. + Rectangle textArea = new Rectangle((int)player.Center.X, (int)player.Center.Y, 1, 1); + Color textColor = new Color(236, 209, 236); + CombatText.NewText(textArea, textColor, "The Community cracks...", false, false); + } + + public override void ModifyTooltips(List tooltips) + { + // Stat tooltips are added dynamically. + StringBuilder sb = new StringBuilder(256); + + // Line 6: Current level + sb.Append("Current level: "); + sb.Append(level); + sb.Append(" (+"); + sb.Append(level); + sb.Append("% Rage Mode damage)"); + tooltips.Add(new TooltipLine(mod, "Tooltip6", sb.ToString())); + sb.Clear(); + + if (level < MaxLevel) + { + long progressToNextLevel = totalRageDamage - CumulativeLevelCost(level); + long totalToNextLevel = LevelCost(level + 1); + double ratio = (double)progressToNextLevel / totalToNextLevel; + string percent = (100D * ratio).ToString("0.00"); + + // Line 7: Progress to next level + sb.Append("Progress to next level: "); + sb.Append(percent); + sb.Append('%'); + 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())); + } + + public override TagCompound Save() + { + TagCompound tag = new TagCompound + { + { "level", level }, + { "totalDamage", totalRageDamage } + }; + return tag; + } + + public override void Load(TagCompound tag) + { + level = tag.GetInt("level"); + totalRageDamage = tag.GetLong("totalDamage"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(level); + writer.Write(totalRageDamage); + } + + public override void NetRecieve(BinaryReader reader) + { + level = reader.ReadInt32(); + totalRageDamage = reader.ReadInt64(); + } + } +} diff --git a/Items/Accessories/ShatteredCommunity.png b/Items/Accessories/ShatteredCommunity.png new file mode 100644 index 0000000000..3d24764cc2 Binary files /dev/null and b/Items/Accessories/ShatteredCommunity.png differ diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 166cce3ea0..8435061285 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 24; item.height = 28; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 2; item.accessory = true; } diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index 18459b597d..f73d7cfe01 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Sigil of Calamitas"); Tooltip.SetDefault("10% increased magic damage and 10% decreased mana usage\n" + - "Increases pickup range for mana stars and you restore mana when damaged\n" + - "+100 max mana and reveals treasure locations if visibility is on"); + "+100 max mana\n" + + "Reveals treasure locations if visibility is on"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); } @@ -22,16 +22,15 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.magicCuffs = true; - player.manaMagnet = true; if (!hideVisual) player.findTreasure = true; + player.statManaMax2 += 100; player.magicDamage += 0.1f; player.manaCost *= 0.9f; @@ -40,13 +39,11 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SorcererEmblem); - recipe.AddIngredient(ItemID.CelestialCuffs); - recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.SorcererEmblem); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddRecipeGroup("AnyEvilWater", 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs index 6e83f81a2e..cbd1c0b824 100644 --- a/Items/Accessories/SilencingSheath.cs +++ b/Items/Accessories/SilencingSheath.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 32; item.height = 34; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/SirensHeart.cs b/Items/Accessories/SirensHeart.cs index 84930c300f..224722b784 100644 --- a/Items/Accessories/SirensHeart.cs +++ b/Items/Accessories/SirensHeart.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -16,8 +17,7 @@ namespace CalamityMod.Items.Accessories "You have a layer of ice around you that absorbs 20% damage but breaks after one hit\n" + "After 30 seconds the ice shield will regenerate\n" + "Wow, you can swim now!\n" + - "Most of these effects are only active after Skeletron has been defeated\n" + - "Revengeance drop"); + "Most of these effects are only active after Skeletron has been defeated"); } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories item.height = 18; item.accessory = true; item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + 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 df38695fce..94a543b078 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,17 +13,18 @@ namespace CalamityMod.Items.Accessories Tooltip.SetDefault("The inside of the cloak is full of teeth...\n" + "TOOLTIP LINE HERE\n" + "Teleportation is disabled while Chaos State is active\n" + - "If you dodge something while invulnerable, you instantly gain full stealth\n" + - "Revengeance drop"); + "If you dodge something while invulnerable, you instantly gain full stealth"); } public override void SetDefaults() { item.width = 30; item.height = 38; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.accessory = true; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.expert = true; + item.accessory = true; } public override void ModifyTooltips(List list) diff --git a/Items/Accessories/SpiritGenerator.cs b/Items/Accessories/SpiritGenerator.cs index a549597cf5..3062604e38 100644 --- a/Items/Accessories/SpiritGenerator.cs +++ b/Items/Accessories/SpiritGenerator.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity2BuyPrice; - item.rare = 2; + item.rare = ItemRarityID.Green; item.accessory = true; } diff --git a/Items/Accessories/Sponge.cs b/Items/Accessories/Sponge.cs index 4d30d096e2..6288b2673b 100644 --- a/Items/Accessories/Sponge.cs +++ b/Items/Accessories/Sponge.cs @@ -14,31 +14,26 @@ namespace CalamityMod.Items.Accessories { public class Sponge : ModItem { - public override string Texture => (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) ? "CalamityMod/Items/Accessories/SpongeReal" : "CalamityMod/Items/Accessories/Sponge"; public override void SetStaticDefaults() { DisplayName.SetDefault("The Sponge"); - Tooltip.SetDefault("50% increased mining speed and you emit light\n" + - "10% increased damage reduction and increased life regen\n" + - "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + - "Honey-like life regen with no speed penalty, +20 max life and mana\n" + - "Most bee/hornet enemies and projectiles do 75% damage to you\n" + - "24% increased jump speed and 12% increased movement speed\n" + + Tooltip.SetDefault("15% increased damage reduction\n" + + "+30 max life and mana\n" + + "5% increased movement and jump speed\n" + "Standing still boosts life and mana regen\n" + - "Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid\n" + - "Enemies take damage when they hit you\n" + + "Increased defense, movement speed and damage reduction while submerged in liquid\n" + + "Enemies take damage when they hit you\n" + "Taking a hit will make you move very fast for a short time\n" + - "You emit a mushroom spore and spark explosion when you are hit\n" + + "You emit a cloud of mushroom spores when you are hit\n" + "Enemy attacks will have part of their damage absorbed and used to heal you"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 30)); } public override void SetDefaults() { - item.defense = 10; + item.defense = 20; item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity14BuyPrice; @@ -52,7 +47,7 @@ namespace CalamityMod.Items.Accessories { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip12") + if (line2.mod == "Terraria" && line2.Name == "Tooltip8") { line2.text = "Enemy attacks will have part of their damage absorbed and used to heal you\n" + "Provides cold protection in Death Mode"; @@ -64,14 +59,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.beeResist = true; - modPlayer.aSpark = true; modPlayer.gShell = true; modPlayer.fCarapace = true; modPlayer.seaShell = true; modPlayer.absorber = true; - modPlayer.aAmpoule = true; - player.statManaMax2 += 20; + modPlayer.sponge = true; + player.statManaMax2 += 30; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) @@ -96,7 +89,6 @@ namespace CalamityMod.Items.Accessories { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); diff --git a/Items/Accessories/StarTaintedGenerator.cs b/Items/Accessories/StarTaintedGenerator.cs index 24151976e7..776d6a590e 100644 --- a/Items/Accessories/StarTaintedGenerator.cs +++ b/Items/Accessories/StarTaintedGenerator.cs @@ -10,8 +10,9 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Star-Tainted Generator"); - Tooltip.SetDefault("+2 max minions and 7% minion damage\n" + - "Minion attacks spawn astral explosions and inflict several debuffs"); + Tooltip.SetDefault("+2 max minions, does not stack with downgrades\n" + + "7% increased minion damage\n" + + "Minion attacks spawn astral explosions and inflict several debuffs"); } public override void SetDefaults() @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.height = 22; item.accessory = true; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Accessories player.Calamity().voltaicJelly = true; player.Calamity().starbusterCore = true; player.Calamity().starTaintedGenerator = true; - player.maxMinions += 2; player.minionDamage += 0.07f; } diff --git a/Items/Accessories/StarbusterCore.cs b/Items/Accessories/StarbusterCore.cs index 8c515b9b35..21c5430194 100644 --- a/Items/Accessories/StarbusterCore.cs +++ b/Items/Accessories/StarbusterCore.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -17,13 +18,12 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.maxMinions++; player.Calamity().starbusterCore = true; } } diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 72bf551374..9a35e37599 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Text; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void ModifyTooltips(List list) @@ -47,7 +48,7 @@ namespace CalamityMod.Items.Accessories private string CreateStatMeterTooltip(Player player, CalamityPlayer modPlayer, Item heldItem) { - int defense = modPlayer.defenseStat; + int defense = modPlayer.defenseStat - modPlayer.defenseDamage; int DR = modPlayer.DRStat; int meleeSpeed = modPlayer.meleeSpeedStat; int manaCost = modPlayer.manaCostStat; @@ -77,8 +78,9 @@ namespace CalamityMod.Items.Accessories // Only append rippers stats in Rev+, if rippers are enabled. if (CalamityWorld.revenge && CalamityConfig.Instance.Rippers) { - sb.Append("Adrenaline Charge Time: ").Append(modPlayer.adrenalineChargeStat) - .Append(" seconds | Rage Damage Boost: ").Append(modPlayer.rageDamageStat) + sb.Append("Rage Damage Boost: ").Append(modPlayer.rageDamageStat).Append("%\n"); + sb.Append("Adrenaline Damage Boost: ").Append(modPlayer.adrenalineDamageStat) + .Append("% | Adrenaline DR Boost: ").Append(modPlayer.adrenalineDRStat) .Append("%\n\n"); } @@ -143,7 +145,7 @@ namespace CalamityMod.Items.Accessories sb.Append("Defense Lost: ").Append(defenseLoss); } else - sb.Append("Abyss stats only displayed while in the Abyss"); + sb.Append("Other Abyss stats are only displayed while in the Abyss"); return sb.ToString(); } diff --git a/Items/Accessories/StatisBeltOfCurses.cs b/Items/Accessories/StatisBeltOfCurses.cs index 4fa75465a5..766d3c4197 100644 --- a/Items/Accessories/StatisBeltOfCurses.cs +++ b/Items/Accessories/StatisBeltOfCurses.cs @@ -7,16 +7,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class StatisBeltOfCurses : ModItem + public class StatisBeltOfCurses : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Void Sash"); - Tooltip.SetDefault("24% increased jump speed and allows constant jumping\n" + - "Increases fall damage resistance by 50 blocks\n" + + Tooltip.SetDefault("12% increased jump speed and allows constant jumping\n" + + "Grants immunity to fall damage\n" + "Can climb walls, dash, and dodge attacks\n" + - "Dashes leave homing scythes in your wake\n" + - "Toggle visibility of this accessory to enable/disable the dash"); + "The dodge has a 60 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)); } @@ -24,20 +25,19 @@ namespace CalamityMod.Items.Accessories { item.width = 28; item.height = 32; - item.value = CalamityGlobalItem.Rarity14BuyPrice; item.accessory = true; - item.Calamity().postMoonLordRarity = 14; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.autoJump = true; - player.jumpSpeedBoost += 1.2f; - player.extraFall += 50; + player.jumpSpeedBoost += 0.6f; + player.noFallDmg = true; player.blackBelt = true; - if (!hideVisual) - modPlayer.dashMod = 7; + modPlayer.dashMod = 7; player.spikedBoots = 2; } @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Accessories ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - //This is not a mistake. Only Nightmare Fuel is intentional for thematics. + //This is not a mistake. Only Nightmare Fuel is intentional for thematics. recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Accessories/StatisBlessing.cs b/Items/Accessories/StatisBlessing.cs index 0253039d1b..a2476b5cd2 100644 --- a/Items/Accessories/StatisBlessing.cs +++ b/Items/Accessories/StatisBlessing.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Statis' Blessing"); Tooltip.SetDefault("Increased max minions by 2 and 10% increased minion damage\n" + "Increased minion knockback\n" + - "Minions cause enemies to cry on hit"); + "Minions inflict holy flames on hit"); } public override void SetDefaults() @@ -22,17 +22,16 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.tearMinions = true; + modPlayer.holyMinions = true; player.minionKB += 2.5f; player.minionDamage += 0.1f; - player.maxMinions += 2; } public override void AddRecipes() diff --git a/Items/Accessories/StatisCurse.cs b/Items/Accessories/StatisCurse.cs index 88e91b8c22..cb76aae66c 100644 --- a/Items/Accessories/StatisCurse.cs +++ b/Items/Accessories/StatisCurse.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Curse"); - Tooltip.SetDefault("Increased max minions by 3 and 10% increased minion damage\n" + + Tooltip.SetDefault("Increases max minions by 3, does not stack with downgrades\n" + + "10% increased minion damage\n" + "Increased minion knockback\n" + - "Grants shadowflame powers to all minions\n" + - "Minions make enemies cry on hit"); + "Minions inflict holy flames and shadowflames on hit"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 4)); } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Red; item.accessory = true; } @@ -32,10 +32,9 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadowMinions = true; - modPlayer.tearMinions = true; + modPlayer.holyMinions = true; player.minionKB += 2.75f; player.minionDamage += 0.1f; - player.maxMinions += 3; } public override void AddRecipes() diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index dd713bf077..714d8d8e73 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,4 +1,3 @@ -using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -11,10 +10,11 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Statis' Ninja Belt"); - Tooltip.SetDefault("8% increased jump speed and allows constant jumping\n" + - "Increased fall damage resistance by 35 blocks\n" + + Tooltip.SetDefault("6% increased jump speed and allows constant jumping\n" + + "Increased fall damage resistance by 35 blocks\n" + "Can climb walls, dash, and dodge attacks\n" + - "Toggle visibility of this accessory to enable/disable the dash"); + "The dodge has a 60 second cooldown\n" + + "This cooldown is shared with all other dodges and reflects"); } public override void SetDefaults() @@ -22,19 +22,17 @@ namespace CalamityMod.Items.Accessories item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - CalamityPlayer modPlayer = player.Calamity(); player.autoJump = true; - player.jumpSpeedBoost += 0.4f; + player.jumpSpeedBoost += 0.3f; player.extraFall += 35; player.blackBelt = true; - if (!hideVisual) - player.dash = 1; + player.dash = 1; player.spikedBoots = 2; } diff --git a/Items/Accessories/StressPills.cs b/Items/Accessories/StressPills.cs index cb10a8ce8c..9e9011d3f5 100644 --- a/Items/Accessories/StressPills.cs +++ b/Items/Accessories/StressPills.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Stress Pills"); Tooltip.SetDefault("Boosts your defense by 4 and max movement speed and acceleration by 5%\n" + "Receiving a hit causes you to only lose half of your max adrenaline rather than all of it\n" + - "Revengeance drop"); + "Revengeance drop"); } public override void SetDefaults() @@ -19,13 +20,13 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.statDefense += 4; + player.statDefense += 4; CalamityPlayer modPlayer = player.Calamity(); modPlayer.stressPills = true; } diff --git a/Items/Accessories/StressPills.png b/Items/Accessories/StressPills.png index b22a404a3c..96ba2868c7 100644 Binary files a/Items/Accessories/StressPills.png and b/Items/Accessories/StressPills.png differ diff --git a/Items/Accessories/SummonLevelMeter.cs b/Items/Accessories/SummonLevelMeter.cs index 7cfc2ce16e..bfca6a8561 100644 --- a/Items/Accessories/SummonLevelMeter.cs +++ b/Items/Accessories/SummonLevelMeter.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 6, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.accessory = true; } @@ -28,7 +29,6 @@ namespace CalamityMod.Items.Accessories int exactLevel = Main.player[Main.myPlayer].Calamity().exactSummonLevel; int damageGain = 0; int minionKB = 0; - int minionSlots = 0; switch (exactLevel) { case 0: @@ -54,52 +54,42 @@ namespace CalamityMod.Items.Accessories case 6: damageGain = 4; minionKB = 90; - minionSlots = 1; break; case 7: damageGain = 4; minionKB = 120; - minionSlots = 1; break; case 8: damageGain = 5; minionKB = 150; - minionSlots = 1; break; case 9: damageGain = 6; minionKB = 180; - minionSlots = 1; break; case 10: - damageGain = 6; + damageGain = 7; minionKB = 180; - minionSlots = 2; break; case 11: damageGain = 7; minionKB = 210; - minionSlots = 2; break; case 12: damageGain = 8; minionKB = 240; - minionSlots = 2; break; case 13: damageGain = 9; minionKB = 270; - minionSlots = 2; break; case 14: damageGain = 10; minionKB = 300; - minionSlots = 2; break; case 15: damageGain = 12; minionKB = 300; - minionSlots = 3; break; } foreach (TooltipLine line2 in list) @@ -108,12 +98,11 @@ namespace CalamityMod.Items.Accessories { line2.text = "Tells you how high your summon proficiency is\n" + "While equipped you will gain summon proficiency faster\n" + - "The higher your summon level the higher your minion damage, knockback, and slots\n" + + "The higher your summon level the higher your minion damage and knockback\n" + "Summon proficiency (max of 12500): " + (level - (level > 12500 ? 1 : 0)) + "\n" + "Summon level (max of 15): " + exactLevel + "\n" + "Minion damage increase: " + damageGain + "%\n" + - "Minion knockback increase: " + minionKB + "%\n" + - "Minion slot increase: " + minionSlots; + "Minion knockback increase: " + minionKB; } } } diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index 3fabdf713a..31223eb92b 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 75215db544..878e7c266c 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -12,33 +12,30 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("The Absorber"); - Tooltip.SetDefault("12% increased movement speed\n" + - "24% increased jump speed\n" + + Tooltip.SetDefault("5% increased movement and jump speed\n" + "+20 max life and mana\n" + "Standing still boosts life and mana regen\n" + - "Increased defense and damage reduction when submerged in liquid\n" + - "Increased movement speed when submerged in liquid\n" + + "Increased defense, movement speed and damage reduction while submerged in liquid\n" + "Enemies take damage when they hit you\n" + "Taking a hit will make you move very fast for a short time\n" + - "You emit a mushroom spore and spark explosion when you are hit\n" + - "5% increased damage reduction\n" + + "You emit a cloud of mushroom spores when you are hit\n" + + "10% increased damage reduction\n" + "Enemy attacks will have part of their damage absorbed and used to heal you"); } public override void SetDefaults() { - item.defense = 6; + item.defense = 10; item.width = 20; item.height = 24; item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Red; item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aSpark = true; modPlayer.gShell = true; modPlayer.fCarapace = true; modPlayer.seaShell = true; @@ -54,7 +51,6 @@ namespace CalamityMod.Items.Accessories 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); @@ -68,7 +64,6 @@ namespace CalamityMod.Items.Accessories 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); diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 33bee4327e..a9bc87e42d 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -1,13 +1,7 @@ -using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Projectiles.Typeless; using CalamityMod.Tiles.Furniture.CraftingStations; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,186 +11,61 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Accessories { public class TheAmalgam : ModItem - { - public const int FireProjectiles = 2; - public const float FireAngleSpread = 120; - public int counter = 0; - public const int ProjectileDamage = 2000; - public const int FungalClumpDamage = 1000; - public const int AuraDamage = 300; - public bool WaterBonuses = false; + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Amalgam"); + Tooltip.SetDefault("Extends the duration of potion buffs by 100% and potion buffs remain active even after you die\n" + + "15% increased damage\n" + + "Shade rains down when you are hit\n" + + "Nearby enemies receive a variety of debuffs when you are hit\n" + + "You will confuse nearby enemies when you are struck"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 6)); + } - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Amalgam"); - Tooltip.SetDefault("15% increased damage\n" + - "Shade and brimstone fire rain down when you are hit\n" + - "Nearby enemies receive a variety of debuffs when you are hit\n" + - "Brimstone fireballs drop from the sky occasionally\n" + - "Summons a fungal clump to fight for you that leaves behind poisonous seawater\n" + - "75% increased movement speed, 10% increase to all damage, and plus 40 defense while submerged in any liquid\n" + - "The above bonuses also apply when passing through the clump's poisonous seawater\n" + - "Temporary immunity to lava, greatly reduces lava burn damage, and 15% increased damage while in lava\n" + - "You have a damaging aura that envenoms nearby enemies and increased movement in liquids"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(9, 6)); - } + public override void SetDefaults() + { + item.width = 34; + item.height = 34; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.expert = true; + item.rare = ItemRarityID.Cyan; + item.accessory = true; + } - public override void SetDefaults() - { - item.width = 34; - item.height = 34; - item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.expert = true; - item.rare = 9; - item.accessory = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.amalgam = true; + player.allDamage += 0.15f; - public override void ModifyTooltips(List list) - { - if (CalamityWorld.death) + if (player.immune) { - foreach (TooltipLine line2 in list) + if (player.miscCounter % 6 == 0) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip8") + if (player.whoAmI == Main.myPlayer) { - line2.text = "You have a damaging aura that envenoms nearby enemies and increased movement in liquids\n" + - "Provides heat protection in Death Mode"; - } - } - } - } - - public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().fungalClump; - - public override void UpdateAccessory(Player player, bool hideVisual) - { - //Counter used for aura and Gehenna effects - counter++; - - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.amalgam = true; - modPlayer.fungalClump = true; - player.ignoreWater = true; - player.lavaRose = true; - player.allDamage += 0.15f; - player.lavaMax += 240; - if (player.lavaWet) - { - player.allDamage += 0.15f; - } - - //emit light - Lighting.AddLight((int)(player.Center.X / 16f), (int)(player.Center.Y / 16f), 0f, 0.5f, 1.25f); - - //Summon the Fungal Clump, ai[0] is 1f to indicate this is from the Amalgam, not the Fungal Clump - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(BuffType()) == -1) - { - player.AddBuff(BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ProjectileType(), (int)(FungalClumpDamage * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); - } - } - - 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.maxProjectiles; i++) - { - Projectile proj = Main.projectile[i]; - if (proj.active && proj.friendly && proj.type == ProjectileType() && proj.ai[0] == 1f && proj.damage > 0) - { - Rectangle rect = proj.getRect(); - if (rectangle.Intersects(rect)) - { - WaterBonuses = true; - } - else if (!player.IsUnderwater()) - { - WaterBonuses = false; - } - } - } - if (WaterBonuses || player.IsUnderwater()) - { - player.allDamage += 0.1f; - player.statDefense += 40; - player.moveSpeed += 0.75f; - } - - if (player.immune) - { - if (Main.rand.NextBool(20)) - { - if (player.whoAmI == Main.myPlayer) - { - int type = Main.rand.NextBool(2) ? ProjectileType() : ProjectileType(); - Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, type, (int)(ProjectileDamage * player.AverageDamage()), 5f, player.whoAmI, 6, 1); - if (type == ProjectileType()) + Projectile rain = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileType(), (int)(300 * player.AverageDamage()), 2f, player.whoAmI); + if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) + { + rain.Calamity().forceTypeless = true; rain.tileCollide = false; - } - } - } - int buffType = BuffID.Venom; - float auraRange = 300f; - int auraDmg = (int)(AuraDamage * player.AverageDamage()); - if (player.whoAmI == 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 && Vector2.Distance(player.Center, npc.Center) <= auraRange) - { - if (npc.FindBuffIndex(buffType) == -1 && !npc.buffImmune[buffType]) - { - npc.AddBuff(buffType, 300, false); + rain.penetrate = 1; } - if (counter % 30 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile p = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ProjectileType(), auraDmg, 0f, player.whoAmI, l); - } - } - } - } - } - if (counter % 480 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int speed = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed; - for (int i = 0; i < FireProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X += i * 30 - (FireProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-FireAngleSpread / 2 + (FireAngleSpread * i / (float)FireProjectiles))); - velocity.X += 3 * Main.rand.NextFloat() - 1.5f; - Projectile.NewProjectile(spawn, velocity, ProjectileType(), (int)(ProjectileDamage * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); } } } - } + } - 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(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemType()); + recipe.AddIngredient(ItemType(), 5); + recipe.AddIngredient(ItemType()); + recipe.AddTile(TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Accessories/TheBee.cs b/Items/Accessories/TheBee.cs index eef5e34a74..3137c65a59 100644 --- a/Items/Accessories/TheBee.cs +++ b/Items/Accessories/TheBee.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -10,20 +11,20 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Bee"); Tooltip.SetDefault("Causes stars to fall and releases bees when injured\n" + - "When at full HP, your damage is increased based on your damage reduction\n" + - "Damage taken at full HP is halved\n" + - "This has a 10 second cooldown"); + "When at full HP, your damage is increased based on your damage reduction\n" + + "Damage taken at full HP is halved\n" + + "This has a 10 second cooldown"); } public override void SetDefaults() { item.width = 24; item.height = 28; - item.value = CalamityGlobalItem.Rarity4BuyPrice; - item.rare = 4; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 99e15777e7..e7f04bfd4e 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Camper"); Tooltip.SetDefault("In rest may we find victory.\n" + - "You deal no damage unless stationary\n" + + "You deal 90% less damage unless stationary\n" + "Standing still grants buff(s) dependent on what weapon you're holding\n" + "Standing still provides a damaging aura around you\n" + "While moving, you regenerate health as if standing still\n" + @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; item.accessory = true; item.defense = 10; } @@ -59,7 +59,6 @@ namespace CalamityMod.Items.Accessories player.AddBuff(BuffID.HeartLamp, 60, true); player.AddBuff(BuffID.Campfire, 60, true); player.AddBuff(BuffID.WellFed, 60, true); - player.lifeRegen += 2; Lighting.AddLight(player.Center, 0.825f, 0.66f, 0f); if (Main.myPlayer == player.whoAmI) { @@ -93,16 +92,16 @@ namespace CalamityMod.Items.Accessories bool magic = player.ActiveItem().magic; if (summon) { - player.minionKB += 0.10f; + player.minionKB += 0.1f; player.AddBuff(BuffID.Bewitched, 60, true); } else if (rogue) { - modPlayer.throwingVelocity += 0.10f; + modPlayer.throwingVelocity += 0.1f; } else if (melee) { - player.meleeSpeed += 0.10f; + player.meleeSpeed += 0.1f; player.AddBuff(BuffID.Sharpened, 60, true); } else if (ranged) diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index aaf8fde348..a8f7186d5d 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,13 +12,11 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("The Community"); Tooltip.SetDefault("The heart of (most of) the Terraria community\n" + - "Legendary Accessory\n" + "Starts off with weak buffs to all of your stats\n" + "The stat buffs become more powerful as you progress\n" + "Reduces the DoT effects of harmful debuffs inflicted on you\n" + "Boosts your maximum flight time by 15%\n" + - "Thank you to all of my supporters that made this mod a reality\n" + - "Revengeance drop"); + "Thank you to all of my supporters who made this mod a reality"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 10)); } @@ -26,15 +25,19 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Rainbow; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.community = true; } - } + + // Community and Shattered Community are mutually exclusive + public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().shatteredCommunity; + } } diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index 94eee504f0..c3b338d1a8 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -1,5 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; +using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,19 +11,24 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("The Evolution"); - Tooltip.SetDefault("You have a 50% chance to reflect projectiles when they hit you back at the enemy for 1000% their original damage\n" + - "If this effect triggers you get a health regeneration boost for a short time\n" + + Tooltip.SetDefault("You reflect projectiles when they hit you\n" + + "Reflected projectiles deal 10 times damage to enemies and no damage to you\n" + + "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)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.width = 58; + item.height = 44; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.rare = ItemRarityID.Purple; + item.accessory = true; + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/TheEvolution.png b/Items/Accessories/TheEvolution.png index 79760a5054..67db30fcf8 100644 Binary files a/Items/Accessories/TheEvolution.png and b/Items/Accessories/TheEvolution.png differ diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index b82344ab0b..c8c86a82a7 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 544645bccf..3725386c1b 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; +using Terraria.DataStructures; namespace CalamityMod.Items.Accessories { @@ -13,17 +15,18 @@ namespace CalamityMod.Items.Accessories "Sparks do extra damage in Hardmode\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)); } public override void SetDefaults() { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.width = 42; + item.height = 56; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = ItemRarityID.Green; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override void UpdateAccessory(Player player, bool hideVisual) { diff --git a/Items/Accessories/TheTransformer.png b/Items/Accessories/TheTransformer.png index 32095d8354..584ad4d5a1 100644 Binary files a/Items/Accessories/TheTransformer.png and b/Items/Accessories/TheTransformer.png differ diff --git a/Items/Accessories/ThiefsDime.cs b/Items/Accessories/ThiefsDime.cs index 543b54d9f9..e8cd7a35b9 100644 --- a/Items/Accessories/ThiefsDime.cs +++ b/Items/Accessories/ThiefsDime.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Rogue; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 20; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 2fee888283..97f11834ab 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = CalamityGlobalItem.Rarity8BuyPrice; item.expert = true; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } diff --git a/Items/Accessories/ToxicHeart.png b/Items/Accessories/ToxicHeart.png index b5e66f1e0f..d5259a044c 100644 Binary files a/Items/Accessories/ToxicHeart.png and b/Items/Accessories/ToxicHeart.png differ diff --git a/Items/Accessories/TrinketofChi.cs b/Items/Accessories/TrinketofChi.cs index 59bc2014ac..1f72e3efc4 100644 --- a/Items/Accessories/TrinketofChi.cs +++ b/Items/Accessories/TrinketofChi.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,7 +10,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Trinket of Chi"); - Tooltip.SetDefault("After 2 seconds of standing still and not attacking you gain a buff\n" + + Tooltip.SetDefault("After 1 second of standing still and not attacking you gain a buff\n" + "This buff boosts your damage by 50% and decreases damage taken by 15%\n" + "The buff deactivates after you move or attack once"); } @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 34; item.height = 32; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/UnstablePrism.cs b/Items/Accessories/UnstablePrism.cs index 321655c51d..9b250daf51 100644 --- a/Items/Accessories/UnstablePrism.cs +++ b/Items/Accessories/UnstablePrism.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ModLoader; +using Terraria.ID; +using Terraria.DataStructures; namespace CalamityMod.Items.Accessories { @@ -10,14 +12,15 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Unstable Prism"); Tooltip.SetDefault("Three sparks are released on critical hits"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 5)); } public override void SetDefaults() { - item.width = 22; - item.height = 38; + item.width = 40; + item.height = 44; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } diff --git a/Items/Accessories/UnstablePrism.png b/Items/Accessories/UnstablePrism.png index dabdd4e99a..309d3cfa45 100644 Binary files a/Items/Accessories/UnstablePrism.png and b/Items/Accessories/UnstablePrism.png differ diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index 99cd052d96..3bcb7758a5 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = CalamityGlobalItem.Rarity6BuyPrice; item.accessory = true; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index d07d44f54d..1ae4aff5b9 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.World; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity @@ -12,7 +13,7 @@ namespace CalamityMod.Items.Accessories.Vanity { DisplayName.SetDefault("Magic Scarf and Hat"); Tooltip.SetDefault("Don't let the demons steal your nose\n" + - "Transforms the holder into a snowman"); + "Transforms the holder into a snowman"); } public override void SetDefaults() @@ -21,22 +22,23 @@ namespace CalamityMod.Items.Accessories.Vanity item.height = 30; item.accessory = true; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; + item.Calamity().devItem = true; } public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Transforms the holder into a snowman\n" + - "Provides heat and cold protection in Death Mode"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + { + line2.text = "Transforms the holder into a snowman\n" + + "Provides heat and cold protection in Death Mode"; + } + } + } } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index f1352a1f4d..c86c7a52a4 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 34; item.height = 36; item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.accessory = true; } diff --git a/Items/Accessories/VitalJelly.cs b/Items/Accessories/VitalJelly.cs index 785dd687f1..aef622e13a 100644 --- a/Items/Accessories/VitalJelly.cs +++ b/Items/Accessories/VitalJelly.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -9,36 +10,22 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Vital Jelly"); - Tooltip.SetDefault("20% increased movement speed\n" + - "24% increased jump speed"); + Tooltip.SetDefault("10% increased movement and jump speed"); } public override void SetDefaults() { item.width = 20; item.height = 24; - item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; - item.accessory = true; - } - - public override void ModifyTooltips(List list) - { - bool autoJump = Main.player[Main.myPlayer].autoJump; - string jumpAmt = autoJump ? "6" : "24"; - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = jumpAmt + "% increased jump speed"; - } - } + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.moveSpeed += 0.2f; - player.jumpSpeedBoost += player.autoJump ? 0.3f : 1.2f; + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 0.5f; } } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index 04e20bbf6c..6d6390dab0 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -3,7 +3,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using System.Collections.Generic; using Terraria; using Terraria.ID; @@ -33,7 +32,7 @@ namespace CalamityMod.Items.Accessories item.height = 26; item.value = CalamityGlobalItem.Rarity8BuyPrice; item.expert = true; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } @@ -81,11 +80,16 @@ namespace CalamityMod.Items.Accessories } if (player.immune) { - if (Main.rand.NextBool(10)) + if (player.miscCounter % 10 == 0) { if (player.whoAmI == Main.myPlayer) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(30 * player.AverageDamage()), 5f, player.whoAmI, 0, 1, 60); + Projectile fire = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(30 * player.AverageDamage()), 5f, player.whoAmI); + if (fire.whoAmI.WithinBounds(Main.maxProjectiles)) + { + fire.usesLocalNPCImmunity = true; + fire.localNPCHitCooldown = 60; + } } } } diff --git a/Items/Accessories/VoltaicJelly.cs b/Items/Accessories/VoltaicJelly.cs index 1143fe5b52..ce6bfcc74d 100644 --- a/Items/Accessories/VoltaicJelly.cs +++ b/Items/Accessories/VoltaicJelly.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -18,13 +19,12 @@ namespace CalamityMod.Items.Accessories item.height = 22; item.value = Item.buyPrice(0, 2, 0, 0); item.accessory = true; - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().voltaicJelly = true; - player.maxMinions ++; } } } diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/WifeinaBottle.cs index b9675a1466..3a4570156e 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/WifeinaBottle.cs @@ -3,6 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class WifeinaBottle : ModItem @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/WifeinaBottlewithBoobs.cs index 6eef6a546e..4869715a10 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/WifeinaBottlewithBoobs.cs @@ -3,6 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Accessories { public class WifeinaBottlewithBoobs : ModItem @@ -19,8 +21,7 @@ namespace CalamityMod.Items.Accessories item.width = 20; item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.expert = true; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index 89245c193c..f4f0dfe0e7 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1.5\n" + "Good vertical speed\n" + "Flight time: 80\n" + - "15% increased movement speed while wearing the Reaver Armor"); + "10% increased movement speed while wearing the Reaver Armor"); } public override void SetDefaults() @@ -27,18 +27,17 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 54; item.height = 26; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && - player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || + player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && + player.armor[2].type == ModContent.ItemType()) { - player.moveSpeed += 0.15f; + player.moveSpeed += 0.1f; } if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index c45d509d0b..efe1c41c87 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 12\n" + "Acceleration multiplier: 3\n" + "Excellent vertical speed\n" + - "Flight time: 280\n" + + "Flight time: 250\n" + "50% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + @@ -72,14 +72,13 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } CalamityPlayer modPlayer = player.Calamity(); - player.accRunSpeed = 12f; - player.rocketBoots = 3; - player.moveSpeed += 0.5f; + player.accRunSpeed = 10f; + player.moveSpeed += 0.24f; player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; player.lavaMax += 240; - player.wingTimeMax = 280; + player.wingTimeMax = 250; player.noFallDmg = true; modPlayer.IBoots = !hideVisual; modPlayer.elysianFire = !hideVisual; diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index 7d5f86056d..d192f90ef6 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 22; item.height = 20; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.accessory = true; } diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index ba76c78811..d815858dde 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 10.5\n" + "Acceleration multiplier: 2.75\n" + "Great vertical speed\n" + - "Flight time: 160\n" + + "Flight time: 180\n" + "36% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + @@ -71,14 +71,13 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } CalamityPlayer modPlayer = player.Calamity(); - player.accRunSpeed = 10.5f; - player.rocketBoots = 3; - player.moveSpeed += 0.36f; + player.accRunSpeed = 9.25f; + player.moveSpeed += 0.2f; player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; player.lavaMax += 240; - player.wingTimeMax = 160; + player.wingTimeMax = 180; player.noFallDmg = true; modPlayer.IBoots = !hideVisual; modPlayer.elysianFire = !hideVisual; diff --git a/Items/Accessories/Wings/ElysianWings.cs b/Items/Accessories/Wings/ElysianWings.cs index 8730a980a7..587f28a7a9 100644 --- a/Items/Accessories/Wings/ElysianWings.cs +++ b/Items/Accessories/Wings/ElysianWings.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.World; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Wings @@ -16,8 +17,8 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 9.75\n" + "Acceleration multiplier: 2.7\n" + "Great vertical speed\n" + - "Flight time: 200\n" + - "Temporary immunity to lava and 40% increased movement speed"); + "Flight time: 240\n" + + "Temporary immunity to lava and 10% increased movement speed"); } public override void SetDefaults() @@ -25,7 +26,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 36; item.height = 32; item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; item.accessory = true; } @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Accessories.Wings { if (line2.mod == "Terraria" && line2.Name == "Tooltip5") { - line2.text = "Temporary immunity to lava and 40% increased movement speed\n" + + line2.text = "Temporary immunity to lava and 15% increased movement speed\n" + "Provides heat protection in Death Mode"; } } @@ -48,9 +49,9 @@ namespace CalamityMod.Items.Accessories.Wings public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - player.moveSpeed += 0.4f; + player.moveSpeed += 0.1f; player.lavaMax += 240; - player.wingTimeMax = 200; + player.wingTimeMax = 240; player.noFallDmg = true; modPlayer.elysianFire = true; if (hideVisual) diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 7ee4b9e037..e173d5aebb 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1.75\n" + "Good vertical speed\n" + "Flight time: 120\n" + - "20% increased movement speed and 8% increased jump speed while wearing the Astral Armor"); + "10% increased movement and jump speed while wearing the Astral Armor"); } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 24; item.height = 36; item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.accessory = true; } @@ -38,8 +38,8 @@ namespace CalamityMod.Items.Accessories.Wings { if (player.armor[0].type == ModContent.ItemType() && player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) { - player.moveSpeed += 0.2f; - player.jumpSpeedBoost += 0.4f; + player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 0.5f; } if (player.controlJump && player.wingTime > 0f && !player.jumpAgainCloud && player.jump == 0) @@ -93,7 +93,7 @@ namespace CalamityMod.Items.Accessories.Wings { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.SoulofFlight, 20); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index df7f25a3cd..a05c5872e9 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 9\n" + "Acceleration multiplier: 2.5\n" + "Good vertical speed\n" + - "Flight time: 120\n" + + "Flight time: 140\n" + "24% increased running acceleration\n" + "Greater mobility on ice\n" + "Water and lava walking\n" + @@ -32,9 +32,9 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 36; item.height = 32; - item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.accessory = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void ModifyTooltips(List list) @@ -71,14 +71,13 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } CalamityPlayer modPlayer = player.Calamity(); - player.accRunSpeed = 9.25f; - player.rocketBoots = 3; - player.moveSpeed += 0.24f; + player.accRunSpeed = 8.5f; + player.moveSpeed += 0.16f; player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; player.lavaMax += 240; - player.wingTimeMax = 120; + player.wingTimeMax = 140; player.noFallDmg = true; modPlayer.IBoots = !hideVisual; modPlayer.sTracers = true; diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index 67ff14258b..67a5dd34f3 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories.Wings "Acceleration multiplier: 1\n" + "Good vertical speed\n" + "Flight time: 75\n" + - "16% increased jump speed and allows auto-jump\n" + + "10% increased jump speed and allows constant jumping\n" + "Grants the player cloud, blizzard, and sandstorm mid-air jumps"); } @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 28; item.height = 32; item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.accessory = true; } @@ -92,7 +92,7 @@ namespace CalamityMod.Items.Accessories.Wings player.jumpBoost = true; player.autoJump = true; player.noFallDmg = true; - player.jumpSpeedBoost += 0.8f; + player.jumpSpeedBoost += 0.5f; player.wingTimeMax = 75; } diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index 60ec0d7b05..368f287a46 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -1,11 +1,11 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.Graphics.Shaders; using Terraria.ModLoader; using CalamityMod.Items.Armor; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; namespace CalamityMod.Items.Accessories.Wings { @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 11\n" + "Acceleration multiplier: 2.8\n" + "Excellent vertical speed\n" + - "Flight time: 220\n" + + "Flight time: 270\n" + "The Silva revive heals you to half health while wearing the Silva armor"); } @@ -27,16 +27,15 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 22; item.height = 20; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.Calamity().postMoonLordRarity = 15; + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType() || - player.armor[0].type == ModContent.ItemType()) && + if ((player.armor[0].type == ModContent.ItemType() || player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) { player.Calamity().silvaWings = true; @@ -58,7 +57,7 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.wingTimeMax = 220; + player.wingTimeMax = 270; player.noFallDmg = true; } @@ -80,12 +79,11 @@ namespace CalamityMod.Items.Accessories.Wings public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddRecipeGroup("AnyGoldBar", 3); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 1df024f0af..7217dc7229 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Items.Accessories.Wings Tooltip.SetDefault("Horizontal speed: 6.25\n" + "Acceleration multiplier: 1\n" + "Average vertical speed\n" + - "Flight time: 60\n" + - "5% increased jump speed while wearing the Aerospec armor"); + "Flight time: 80\n" + + "10% increased jump speed while wearing the Aerospec armor"); } public override void SetDefaults() @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 22; item.height = 20; item.value = CalamityGlobalItem.Rarity3BuyPrice; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.accessory = true; } @@ -35,9 +35,9 @@ namespace CalamityMod.Items.Accessories.Wings player.armor[0].type == ModContent.ItemType()) && player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType()) { - player.jumpSpeedBoost += 0.25f; + player.jumpSpeedBoost += 0.5f; } - player.wingTimeMax = 60; + player.wingTimeMax = 80; player.noFallDmg = true; } diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 4edba47e34..1635b711df 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using Terraria; using Terraria.DataStructures; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories.Wings { @@ -32,7 +33,7 @@ namespace CalamityMod.Items.Accessories.Wings item.height = 26; item.value = CalamityGlobalItem.Rarity5BuyPrice; item.expert = true; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } @@ -84,8 +85,11 @@ namespace CalamityMod.Items.Accessories.Wings if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) { int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ModContent.ProjectileType(), (int)(25 * player.AverageDamage()), 3f, player.whoAmI, 1f); - Main.projectile[p].Calamity().forceTypeless = true; - Main.projectile[p].frame = Main.rand.Next(5); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].Calamity().forceTypeless = true; + Main.projectile[p].frame = Main.rand.Next(5); + } modPlayer.icicleCooldown = 10; } } diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index a38acf3375..812641bbcb 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 22; item.height = 20; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 6c1a04a708..4b287ce2ae 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Wings "Horizontal speed: 9.5\n" + "Acceleration multiplier: 2.5\n" + "Great vertical speed\n" + - "Flight time: 210\n" + + "Flight time: 250\n" + "+15 defense and +2 life regen while wearing the Tarragon Armor"); } @@ -28,8 +28,9 @@ namespace CalamityMod.Items.Accessories.Wings { item.width = 22; item.height = 20; - item.value = CalamityGlobalItem.Rarity12BuyPrice; - item.Calamity().postMoonLordRarity = 12; + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; item.accessory = true; } @@ -60,7 +61,7 @@ namespace CalamityMod.Items.Accessories.Wings } Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } - player.wingTimeMax = 210; + player.wingTimeMax = 250; player.noFallDmg = true; } diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index 70e9f5a6a7..c1e2231571 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories.Wings item.width = 22; item.height = 20; item.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.accessory = true; } diff --git a/Items/Accessories/WulfrumBattery.cs b/Items/Accessories/WulfrumBattery.cs index 7f14697916..64e0ab82a0 100644 --- a/Items/Accessories/WulfrumBattery.cs +++ b/Items/Accessories/WulfrumBattery.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Accessories item.height = 22; item.value = Item.buyPrice(0, 1, 0, 0); item.accessory = true; - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index b832b69edf..5ab3973fe5 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Accessories { @@ -23,24 +24,24 @@ namespace CalamityMod.Items.Accessories { item.width = 20; item.height = 22; - item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.value = CalamityGlobalItem.Rarity15BuyPrice; item.accessory = true; item.expert = true; - item.rare = 10; + item.rare = ItemRarityID.Red; } public override void UpdateAccessory(Player player, bool hideVisual) { player.allDamage += 0.15f; player.statDefense += 30; - if ((double)player.velocity.X > 0 || (double)player.velocity.Y > 0 || (double)player.velocity.X < -0.1 || (double)player.velocity.Y < -0.1) + if (!player.StandingStill()) { dragonTimer--; if (dragonTimer <= 0) { if (player.whoAmI == Main.myPlayer) { - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(350 * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); + int projectile1 = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(175 * player.AverageDamage()), 5f, player.whoAmI, 0f, 0f); Main.projectile[projectile1].timeLeft = 60; } dragonTimer = 60; @@ -52,28 +53,11 @@ namespace CalamityMod.Items.Accessories } if (player.immune) { - if (Main.rand.NextBool(8)) - { + if (player.miscCounter % 8 == 0) + { if (player.whoAmI == Main.myPlayer) { - for (int l = 0; l < 1; l++) - { - float x = player.position.X + (float)Main.rand.Next(-400, 400); - float y = player.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num15 = player.position.X + (float)(player.width / 2) - vector.X; - float num16 = player.position.Y + (float)(player.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); - int num17 = 22; - float num18 = (float)Math.Sqrt((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; - num15 *= num18; - num16 *= num18; - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), (int)(750 * player.AverageDamage()), 9f, player.whoAmI, 0f, 0f); - Main.projectile[num19].ai[1] = player.position.Y; - Main.projectile[num19].hostile = false; - Main.projectile[num19].friendly = true; - } + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(375 * player.AverageDamage()), 9f, player.whoAmI); } } } diff --git a/Items/Accessories/YharimsInsignia.cs b/Items/Accessories/YharimsInsignia.cs index 54df009ba7..52b090ca64 100644 --- a/Items/Accessories/YharimsInsignia.cs +++ b/Items/Accessories/YharimsInsignia.cs @@ -15,9 +15,8 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Yharim's Insignia"); Tooltip.SetDefault("10% increased damage when under 50% life\n" + "10% increased melee speed\n" + - "5% increased melee damage and 10% increased true melee damage\n" + + "10% increased melee and true melee damage\n" + "Melee attacks and melee projectiles inflict holy fire\n" + - "Increased invincibility after taking damage\n" + "Temporary immunity to lava\n" + "Increased melee knockback"); } @@ -26,7 +25,8 @@ namespace CalamityMod.Items.Accessories { item.width = 22; item.height = 38; - item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.accessory = true; item.Calamity().customRarity = CalamityRarity.Turquoise; } @@ -58,8 +58,7 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ItemID.WarriorEmblem); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ItemID.CrossNecklace); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Ammo/AccelerationBullet.cs b/Items/Ammo/AccelerationBullet.cs index 5d096e116e..81952aa7ae 100644 --- a/Items/Ammo/AccelerationBullet.cs +++ b/Items/Ammo/AccelerationBullet.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.25f; item.value = 250; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; item.ammo = AmmoID.Bullet; diff --git a/Items/Ammo/AcidBullet.cs b/Items/Ammo/AcidBullet.cs index 903ebd3682..736ed38998 100644 --- a/Items/Ammo/AcidBullet.cs +++ b/Items/Ammo/AcidBullet.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.5f; item.value = 1250; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/ArcticArrow.cs b/Items/Ammo/ArcticArrow.cs index ed4ba11792..04a923661c 100644 --- a/Items/Ammo/ArcticArrow.cs +++ b/Items/Ammo/ArcticArrow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 16; + item.damage = 18; item.ranged = true; item.width = 22; item.height = 36; @@ -24,16 +24,16 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.5f; item.value = Item.sellPrice(0, 0, 0, 24); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - item.ammo = 40; + item.ammo = AmmoID.Arrow; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.IceMachine); recipe.SetResult(this, 250); recipe.AddRecipe(); diff --git a/Items/Ammo/AstralSolution.cs b/Items/Ammo/AstralSolution.cs index 449e3c27d3..14d90056a7 100644 --- a/Items/Ammo/AstralSolution.cs +++ b/Items/Ammo/AstralSolution.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Ammo item.width = 10; item.height = 12; item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.maxStack = 999; item.consumable = true; return; diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index 2d90865bd1..95908c8ee1 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Ammo { DisplayName.SetDefault("Blood Rune"); Tooltip.SetDefault("Used with the Ice Barrage \n" + - "Found in some sort of runic landscape"); + "Found in some sort of runic landscape"); } public override void SetDefaults() @@ -21,11 +21,14 @@ namespace CalamityMod.Items.Ammo item.maxStack = 999; item.consumable = true; item.knockBack = 10f; - item.value = Item.buyPrice(0, 1, 0, 0); - item.Calamity().customRarity = CalamityRarity.Dedicated; + + 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; // CONSIDER -- Would item.type work here instead of a self reference? + item.ammo = item.type; } } } diff --git a/Items/Ammo/BloodfireArrow.cs b/Items/Ammo/BloodfireArrow.cs index 0b3b0dff61..303fb49dda 100644 --- a/Items/Ammo/BloodfireArrow.cs +++ b/Items/Ammo/BloodfireArrow.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; +using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Ammo { public class BloodfireArrow : ModItem @@ -14,18 +16,19 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 40; + item.damage = 29; item.ranged = true; item.width = 14; item.height = 36; item.maxStack = 999; item.consumable = true; item.knockBack = 3.5f; - item.value = 2000; - item.shoot = ModContent.ProjectileType(); + item.value = Item.sellPrice(copper: 80); + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.ammo = 40; - item.Calamity().customRarity = CalamityRarity.PureGreen; + item.ammo = AmmoID.Arrow; } public override void AddRecipes() @@ -33,7 +36,7 @@ namespace CalamityMod.Items.Ammo ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 250); + recipe.SetResult(this, 333); recipe.AddRecipe(); } } diff --git a/Items/Ammo/BloodfireBullet.cs b/Items/Ammo/BloodfireBullet.cs new file mode 100644 index 0000000000..333fe96972 --- /dev/null +++ b/Items/Ammo/BloodfireBullet.cs @@ -0,0 +1,43 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Ammo +{ + public class BloodfireBullet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Bullet"); + Tooltip.SetDefault("Accelerates your life regeneration on hit\n" + "Deals bonus damage based on your current life regeneration"); + } + + 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: 80); + 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(); + } + } +} diff --git a/Items/Ammo/BloodfireBullet.png b/Items/Ammo/BloodfireBullet.png new file mode 100644 index 0000000000..cd0ab1fd79 Binary files /dev/null and b/Items/Ammo/BloodfireBullet.png differ diff --git a/Items/Ammo/ElysianArrow.cs b/Items/Ammo/ElysianArrow.cs index 79a77c2df2..cf2930ecdb 100644 --- a/Items/Ammo/ElysianArrow.cs +++ b/Items/Ammo/ElysianArrow.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 3f; item.value = 2000; - item.shoot = ModContent.ProjectileType(); + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.ammo = 40; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.ammo = AmmoID.Arrow; } public override void AddRecipes() diff --git a/Items/Ammo/EnhancedNanoRound.cs b/Items/Ammo/EnhancedNanoRound.cs index b42bc2244f..96a1380bf0 100644 --- a/Items/Ammo/EnhancedNanoRound.cs +++ b/Items/Ammo/EnhancedNanoRound.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 5.5f; item.value = 500; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/FiniteUse/ExplosiveShells.cs b/Items/Ammo/FiniteUse/ExplosiveShells.cs index 46393b7ecd..87b8195cf1 100644 --- a/Items/Ammo/FiniteUse/ExplosiveShells.cs +++ b/Items/Ammo/FiniteUse/ExplosiveShells.cs @@ -1,5 +1,7 @@ using CalamityMod.Projectiles.Typeless.FiniteUse; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Ammo.FiniteUse { public class ExplosiveShells : ModItem @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Ammo.FiniteUse item.consumable = true; item.knockBack = 10f; item.value = 15000; - item.rare = 8; + 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 f8921b4f9b..f62c2e2bce 100644 --- a/Items/Ammo/FiniteUse/GrenadeRounds.cs +++ b/Items/Ammo/FiniteUse/GrenadeRounds.cs @@ -1,5 +1,7 @@ using CalamityMod.Projectiles.Typeless.FiniteUse; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Ammo.FiniteUse { public class GrenadeRounds : ModItem @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Ammo.FiniteUse item.consumable = true; item.knockBack = 10f; item.value = 15000; - item.rare = 8; + 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 95cb8a4c6e..1c2ed01649 100644 --- a/Items/Ammo/FiniteUse/MagnumRounds.cs +++ b/Items/Ammo/FiniteUse/MagnumRounds.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Typeless.FiniteUse; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Ammo.FiniteUse { @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Ammo.FiniteUse item.consumable = true; item.knockBack = 8f; item.value = 10000; - item.rare = 8; + 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 9e1f1b4403..74bd7ce6db 100644 --- a/Items/Ammo/FlashBullet.cs +++ b/Items/Ammo/FlashBullet.cs @@ -21,10 +21,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.15f; item.value = 250; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/FrostsparkBullet.cs b/Items/Ammo/FrostsparkBullet.cs index 461a0a2268..5c18d18d28 100644 --- a/Items/Ammo/FrostsparkBullet.cs +++ b/Items/Ammo/FrostsparkBullet.cs @@ -23,17 +23,17 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.25f; item.value = 600; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.MusketBall, 150); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.IceMachine); recipe.SetResult(this, 150); recipe.AddRecipe(); diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs new file mode 100644 index 0000000000..a7a3b9bb59 --- /dev/null +++ b/Items/Ammo/GodSlayerSlug.cs @@ -0,0 +1,47 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Ammo +{ + public class GodSlayerSlug : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Slug"); + Tooltip.SetDefault("Pierces through unlimited targets\n" + + "After striking at least one enemy,\n" + + "if the bullet hits a wall or runs out of targets,\n" + + "it will warp backwards through space and explode on impact"); + } + + public override void SetDefaults() + { + item.damage = 42; + item.ranged = true; + item.width = 22; + item.height = 22; + item.maxStack = 999; + item.consumable = true; + item.knockBack = 3f; + item.value = Item.buyPrice(silver: 4); + 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(ModContent.ItemType()); + recipe.AddIngredient(ItemID.EmptyBullet, 999); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 999); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Ammo/GodSlayerSlug.png b/Items/Ammo/GodSlayerSlug.png new file mode 100644 index 0000000000..33d7e8e641 Binary files /dev/null and b/Items/Ammo/GodSlayerSlug.png differ diff --git a/Items/Ammo/HolyFireBullet.cs b/Items/Ammo/HolyFireBullet.cs index 9c6b0b13a7..f2fd12c1fa 100644 --- a/Items/Ammo/HolyFireBullet.cs +++ b/Items/Ammo/HolyFireBullet.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 27; + item.damage = 22; item.ranged = true; item.width = 22; item.height = 22; @@ -22,11 +22,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 2f; item.value = 2000; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/HyperiusBullet.cs b/Items/Ammo/HyperiusBullet.cs index 3f03ad0909..e10abae8ca 100644 --- a/Items/Ammo/HyperiusBullet.cs +++ b/Items/Ammo/HyperiusBullet.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.5f; item.value = 2000; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/IcicleArrow.cs b/Items/Ammo/IcicleArrow.cs index 983b2d6cfb..ac17b39ed5 100644 --- a/Items/Ammo/IcicleArrow.cs +++ b/Items/Ammo/IcicleArrow.cs @@ -15,14 +15,14 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 14; + item.damage = 15; item.ranged = true; item.consumable = true; - item.width = 14; + item.width = 18; item.height = 50; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 0, 0, 80); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1.0f; item.ammo = AmmoID.Arrow; diff --git a/Items/Ammo/IcicleArrow.png b/Items/Ammo/IcicleArrow.png index 6be666a75d..6364060cdd 100644 Binary files a/Items/Ammo/IcicleArrow.png and b/Items/Ammo/IcicleArrow.png differ diff --git a/Items/Ammo/IcyBullet.cs b/Items/Ammo/IcyBullet.cs index bb8d7843a4..4c728c826c 100644 --- a/Items/Ammo/IcyBullet.cs +++ b/Items/Ammo/IcyBullet.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Ammo item.damage = 10; item.ranged = true; item.consumable = true; - item.width = 18; - item.height = 16; + item.width = 14; + item.height = 20; item.knockBack = 2f; item.value = Item.buyPrice(0, 0, 0, 80); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; item.ammo = AmmoID.Bullet; diff --git a/Items/Ammo/IcyBullet.png b/Items/Ammo/IcyBullet.png index baccf98031..4adc099d07 100644 Binary files a/Items/Ammo/IcyBullet.png and b/Items/Ammo/IcyBullet.png differ diff --git a/Items/Ammo/MortarRound.cs b/Items/Ammo/MortarRound.cs index 6aa91c2133..1b200e3627 100644 --- a/Items/Ammo/MortarRound.cs +++ b/Items/Ammo/MortarRound.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 7.5f; item.value = 500; - item.rare = 3; - item.ammo = 97; + item.rare = ItemRarityID.Orange; + item.ammo = AmmoID.Bullet; item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Ammo/NapalmArrow.cs b/Items/Ammo/NapalmArrow.cs index b1a3445e62..e9645d97c0 100644 --- a/Items/Ammo/NapalmArrow.cs +++ b/Items/Ammo/NapalmArrow.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 13; + item.damage = 14; item.ranged = true; item.width = 22; item.height = 36; @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.5f; item.value = 1000; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - item.ammo = 40; + item.ammo = AmmoID.Arrow; } public override void AddRecipes() @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Ammo recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.Torch); recipe.AddIngredient(ItemID.WoodenArrow, 250); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this, 250); recipe.AddRecipe(); } diff --git a/Items/Ammo/RubberMortarRound.cs b/Items/Ammo/RubberMortarRound.cs index 75453c4c79..8c4937042f 100644 --- a/Items/Ammo/RubberMortarRound.cs +++ b/Items/Ammo/RubberMortarRound.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 7.5f; item.value = 1000; - item.rare = 5; - item.ammo = 97; + item.rare = ItemRarityID.Pink; + item.ammo = AmmoID.Bullet; item.shoot = ModContent.ProjectileType(); } diff --git a/Items/Ammo/RubberMortarRound.png b/Items/Ammo/RubberMortarRound.png index b8057deb9e..60f816dbe2 100644 Binary files a/Items/Ammo/RubberMortarRound.png and b/Items/Ammo/RubberMortarRound.png differ diff --git a/Items/Ammo/SuperballBullet.cs b/Items/Ammo/SuperballBullet.cs index a15502e29d..a035eef5af 100644 --- a/Items/Ammo/SuperballBullet.cs +++ b/Items/Ammo/SuperballBullet.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.5f; item.value = 250; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/TerraArrow.cs b/Items/Ammo/TerraArrow.cs index 29fb54c99d..12da4f9279 100644 --- a/Items/Ammo/TerraArrow.cs +++ b/Items/Ammo/TerraArrow.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 9; + item.damage = 15; item.ranged = true; item.width = 22; item.height = 36; @@ -24,10 +24,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.5f; item.value = Item.sellPrice(0, 0, 0, 40); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.ammo = 40; + item.ammo = AmmoID.Arrow; } public override void AddRecipes() diff --git a/Items/Ammo/TerraBullet.cs b/Items/Ammo/TerraBullet.cs index cd8b90393d..fa84ac08ff 100644 --- a/Items/Ammo/TerraBullet.cs +++ b/Items/Ammo/TerraBullet.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.25f; item.value = 2000; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.ammo = 97; + item.ammo = AmmoID.Bullet; } public override void AddRecipes() diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index 9545a10e2c..c3a3efd966 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +18,7 @@ namespace CalamityMod.Items.Ammo public override void SetDefaults() { - item.damage = 33; + item.damage = 24; item.ranged = true; item.width = 22; item.height = 46; @@ -29,23 +28,21 @@ namespace CalamityMod.Items.Ammo item.value = 2250; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.ammo = 40; + 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) { - Vector2 origin = new Vector2(11f, 21f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddRecipeGroup("NForEE"); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 333); + recipe.SetResult(this, 999); recipe.AddRecipe(); } } diff --git a/Items/Ammo/VeriumBullet.cs b/Items/Ammo/VeriumBullet.cs index a3d7e56632..211dae9fe0 100644 --- a/Items/Ammo/VeriumBullet.cs +++ b/Items/Ammo/VeriumBullet.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Ammo item.consumable = true; item.knockBack = 1.25f; item.value = 500; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.ammo = AmmoID.Bullet; diff --git a/Items/AntiCystOintment.cs b/Items/AntiCystOintment.cs new file mode 100644 index 0000000000..82c90024f5 --- /dev/null +++ b/Items/AntiCystOintment.cs @@ -0,0 +1,38 @@ +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class AntiCystOintment : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anti-Cyst Ointment"); + Tooltip.SetDefault("Favorite this item to prevent perforator cysts from spawning near you"); + } + public override void SetDefaults() + { + item.width = 44; + item.height = 34; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + } + + public override void UpdateInventory(Player player) + { + 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(); + } + } +} diff --git a/Items/AntiCystOintment.png b/Items/AntiCystOintment.png new file mode 100644 index 0000000000..59f42b5da3 Binary files /dev/null and b/Items/AntiCystOintment.png differ diff --git a/Items/AntiTumorOintment.cs b/Items/AntiTumorOintment.cs new file mode 100644 index 0000000000..d0a76378da --- /dev/null +++ b/Items/AntiTumorOintment.cs @@ -0,0 +1,38 @@ +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class AntiTumorOintment : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anti-Tumor Ointment"); + Tooltip.SetDefault("Favorite this item to prevent hive cysts from spawning near you"); + } + public override void SetDefaults() + { + item.width = 44; + item.height = 34; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + } + + public override void UpdateInventory(Player player) + { + 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(); + } + } +} diff --git a/Items/AntiTumorOintment.png b/Items/AntiTumorOintment.png new file mode 100644 index 0000000000..406f01c527 Binary files /dev/null and b/Items/AntiTumorOintment.png differ diff --git a/Items/Armor/AerospecBreastplate.cs b/Items/Armor/AerospecBreastplate.cs index ce0533b5c2..ca48156401 100644 --- a/Items/Armor/AerospecBreastplate.cs +++ b/Items/Armor/AerospecBreastplate.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 7; } diff --git a/Items/Armor/AerospecHat.cs b/Items/Armor/AerospecHat.cs index 281540bc79..9b7ec3a73f 100644 --- a/Items/Armor/AerospecHat.cs +++ b/Items/Armor/AerospecHat.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 3; //15 } diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index f1ff8dfeb5..8f4f657456 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 4; //17 } diff --git a/Items/Armor/AerospecHelm.cs b/Items/Armor/AerospecHelm.cs index f150ad2d28..24031bf422 100644 --- a/Items/Armor/AerospecHelm.cs +++ b/Items/Armor/AerospecHelm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 7; //20 } @@ -37,6 +37,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased movement speed and melee critical strike chance\n" + + "Enemies are more likely to target you\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; CalamityPlayer modPlayer = player.Calamity(); @@ -44,6 +45,7 @@ namespace CalamityMod.Items.Armor player.noFallDmg = true; player.moveSpeed += 0.05f; player.meleeCrit += 5; + player.aggro += 300; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index 60b5e75c02..3d3103a546 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Aerospec Helmet"); - Tooltip.SetDefault("5% increased movement speed and +1 max minion"); + Tooltip.SetDefault("5% increased movement speed"); } public override void SetDefaults() @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 2; //13 } @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "16% increased minion damage\n" + + player.setBonus = "16% increased minion damage and +1 max minion\n" + "Summons a valkyrie to protect you\n" + "Taking over 25 damage in one hit will cause a spread of homing feathers to fall\n" + "Allows you to fall more quickly and disables fall damage"; @@ -58,12 +58,12 @@ namespace CalamityMod.Items.Armor } } player.minionDamage += 0.16f; - } + player.maxMinions++; + } - public override void UpdateEquip(Player player) + public override void UpdateEquip(Player player) { player.moveSpeed += 0.05f; - player.maxMinions++; } public override void AddRecipes() diff --git a/Items/Armor/AerospecHood.cs b/Items/Armor/AerospecHood.cs index 1bf782278c..a2028c781a 100644 --- a/Items/Armor/AerospecHood.cs +++ b/Items/Armor/AerospecHood.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 5; //18 } diff --git a/Items/Armor/AerospecLeggings.cs b/Items/Armor/AerospecLeggings.cs index 6f76639062..5bf1f5a93b 100644 --- a/Items/Armor/AerospecLeggings.cs +++ b/Items/Armor/AerospecLeggings.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.defense = 6; } diff --git a/Items/Armor/AstralBreastplate.cs b/Items/Armor/AstralBreastplate.cs index 8c1ee94320..0d100aada4 100644 --- a/Items/Armor/AstralBreastplate.cs +++ b/Items/Armor/AstralBreastplate.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Astral Breastplate"); Tooltip.SetDefault("+80 max mana and +20 max life\n" + - "+3 max minions\n" + "Creature detection"); } @@ -21,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.defense = 25; } @@ -29,7 +28,6 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 20; player.statManaMax2 += 80; - player.maxMinions += 3; player.detectCreature = true; } diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index 01855583cd..2714d33307 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.defense = 17; //63 } @@ -36,15 +36,16 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "25% increased movement speed\n" + + player.setBonus = "15% increased movement speed and +3 max minions\n" + "28% increased damage and 21% increased critical strike chance\n" + "Whenever you crit an enemy fallen, hallowed, and astral stars will rain down\n" + "This effect has a 1 second cooldown before it can trigger again"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.astralStarRain = true; - player.moveSpeed += 0.25f; + player.moveSpeed += 0.15f; player.allDamage += 0.28f; - modPlayer.AllCritBoost(21); + player.maxMinions += 3; + modPlayer.AllCritBoost(21); player.Calamity().wearingRogueArmor = true; } diff --git a/Items/Armor/AstralLeggings.cs b/Items/Armor/AstralLeggings.cs index e73d0d934a..206d331338 100644 --- a/Items/Armor/AstralLeggings.cs +++ b/Items/Armor/AstralLeggings.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Leggings"); - Tooltip.SetDefault("10% increased movement speed\n" + + Tooltip.SetDefault("15% increased movement speed\n" + "Treasure and ore detection"); } @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.defense = 21; } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.1f; + player.moveSpeed += 0.15f; player.findTreasure = true; } diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index cbdbe7177a..db59cf8eef 100644 --- a/Items/Armor/AtaxiaArmor.cs +++ b/Items/Armor/AtaxiaArmor.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 20; } diff --git a/Items/Armor/AtaxiaHeadgear.cs b/Items/Armor/AtaxiaHeadgear.cs index fefda8b5b4..6224eb6baa 100644 --- a/Items/Armor/AtaxiaHeadgear.cs +++ b/Items/Armor/AtaxiaHeadgear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 15; //53 } @@ -57,8 +57,8 @@ namespace CalamityMod.Items.Armor { player.setBonus = "5% increased ranged damage\n" + "Inferno effect when below 50% life\n" + - "You have a 50% chance to fire a homing chaos flare when using ranged weapons\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; + "You fire a homing chaos flare when using ranged weapons every 0.33 seconds\n" + + "You emit a blazing explosion when you are hit"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaBolt = true; diff --git a/Items/Armor/AtaxiaHelm.cs b/Items/Armor/AtaxiaHelm.cs index 2187c89c4d..0f0dfd5c06 100644 --- a/Items/Armor/AtaxiaHelm.cs +++ b/Items/Armor/AtaxiaHelm.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; - item.defense = 25; //67 + item.rare = ItemRarityID.Yellow; + item.defense = 33; //67 } public override void ModifyTooltips(List list) @@ -58,13 +58,15 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased melee damage\n" + + "Enemies are more likely to target you\n" + "Inferno effect when below 50% life\n" + "Melee attacks and projectiles cause chaos flames to erupt on enemy hits\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; + "You emit a blazing explosion when you are hit"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaGeyser = true; player.meleeDamage += 0.05f; + player.aggro += 700; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index 165ca43cc5..86be4da6af 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Hydrothermic Helmet"); Tooltip.SetDefault("5% increased minion damage and increased minion knockback\n" + - "+2 max minions\n" + "Temporary immunity to lava and immunity to fire damage"); } @@ -26,7 +25,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 6; //40 } @@ -58,10 +57,10 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "40% increased minion damage\n" + + player.setBonus = "40% increased minion damage and +2 max minions\n" + "Inferno effect when below 50% life\n" + "Summons a hydrothermic vent to protect you\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; + "You emit a blazing explosion when you are hit"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.chaosSpirit = true; @@ -77,13 +76,13 @@ namespace CalamityMod.Items.Armor } } player.minionDamage += 0.4f; - } + player.maxMinions += 2; + } - public override void UpdateEquip(Player player) + public override void UpdateEquip(Player player) { player.minionDamage += 0.05f; player.minionKB += 1.5f; - player.maxMinions += 2; player.lavaMax += 240; player.buffImmune[BuffID.OnFire] = true; } diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index dfddc54d8e..45b161efd8 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 12; //49 } @@ -58,8 +58,8 @@ namespace CalamityMod.Items.Armor { player.setBonus = "5% increased rogue damage\n" + "Inferno effect when below 50% life\n" + - "Rogue weapons have a 10% chance to unleash a volley of chaos flames around the player that chase enemies when used\n" + - "You have a 20% chance to emit a blazing explosion when you are hit\n" + + "Rogue weapons unleash a volley of homing chaos flames around the player every 2.5 seconds\n" + + "You emit a blazing explosion when you are hit\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index 339ae4ff52..7d52185eda 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Hydrothermic Mask"); - Tooltip.SetDefault("12% increased magic damage, reduces mana usage by 15%, and 10% increased magic critical strike chance\n" + - "+100 max mana, temporary immunity to lava, and immunity to fire damage"); + Tooltip.SetDefault("12% increased magic damage, +100 max mana, and 10% increased magic critical strike chance\n" + + "Temporary immunity to lava, and immunity to fire damage"); } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 9; //45 } @@ -55,19 +55,19 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "5% increased magic damage\n" + + player.setBonus = "5% increased magic damage and 15% reduced mana usage\n" + "Inferno effect when below 50% life\n" + "Magic attacks summon damaging and healing flare orbs on hit\n" + - "You have a 20% chance to emit a blazing explosion when you are hit"; + "You emit a blazing explosion when you are hit"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaMage = true; player.magicDamage += 0.05f; + player.manaCost *= 0.85f; } public override void UpdateEquip(Player player) { - player.manaCost *= 0.85f; player.statManaMax2 += 100; player.magicDamage += 0.12f; player.magicCrit += 10; diff --git a/Items/Armor/AtaxiaSubligar.cs b/Items/Armor/AtaxiaSubligar.cs index 182ce86fee..73d6688bf1 100644 --- a/Items/Armor/AtaxiaSubligar.cs +++ b/Items/Armor/AtaxiaSubligar.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 14; } diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index a64c4cc0ef..91321ffd37 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; @@ -16,8 +17,6 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Auric Tesla Body Armor"); Tooltip.SetDefault("+100 max life\n" + - "25% increased movement speed\n" + - "Attacks have a 2% chance to do no damage to you\n" + "8% increased damage and 5% increased critical strike chance\n" + "You will freeze enemies near you when you are struck"); } @@ -50,9 +49,8 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.fBarrier = true; - modPlayer.godSlayerReflect = true; + player.buffImmune[ModContent.BuffType()] = true; player.statLifeMax2 += 100; - player.moveSpeed += 0.25f; player.allDamage += 0.08f; modPlayer.AllCritBoost(5); } diff --git a/Items/Armor/AuricTeslaCuisses.cs b/Items/Armor/AuricTeslaCuisses.cs index 990fbb1733..76d71bb386 100644 --- a/Items/Armor/AuricTeslaCuisses.cs +++ b/Items/Armor/AuricTeslaCuisses.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Cuisses"); - Tooltip.SetDefault("50% increased movement speed\n" + + Tooltip.SetDefault("20% increased movement speed\n" + "12% increased damage and 5% increased critical strike chance\n" + "Magic carpet effect"); } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.moveSpeed += 0.5f; + player.moveSpeed += 0.2f; player.carpet = true; player.allDamage += 0.12f; player.Calamity().AllCritBoost(5); diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 891f53bdca..de05c1cd72 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -38,10 +38,10 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Melee Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + player.setBonus = "Melee Tarragon, Bloodflare and God Slayer effects\n" + + "Enemies are more likely to target you\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 10%\n" + - "Your melee damage is multiplied based on how high your HP is; at full HP this effect is at max"; + "Max run speed and acceleration boosted by 10%"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMelee = true; @@ -49,8 +49,6 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareMelee = true; modPlayer.godSlayer = true; modPlayer.godSlayerDamage = true; - modPlayer.silvaSet = true; - modPlayer.silvaMelee = true; modPlayer.auricSet = true; player.thorns += 3f; player.lavaMax += 240; @@ -62,7 +60,10 @@ namespace CalamityMod.Items.Armor player.statDefense += 30; player.lifeRegen += 10; } - } + + if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -75,7 +76,6 @@ 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()); diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index 062117a186..03e52fe7b2 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Ranged Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + player.setBonus = "Ranged Tarragon, Bloodflare and God Slayer armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%"; CalamityPlayer modPlayer = player.Calamity(); @@ -48,8 +48,6 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareRanged = true; modPlayer.godSlayer = true; modPlayer.godSlayerRanged = true; - modPlayer.silvaSet = true; - modPlayer.silvaRanged = true; modPlayer.auricSet = true; player.thorns += 3f; player.lavaMax += 240; @@ -60,7 +58,10 @@ namespace CalamityMod.Items.Armor player.statDefense += 30; player.lifeRegen += 10; } - } + + if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -73,7 +74,6 @@ 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()); diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 0d49bb4349..0975186372 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Plumed Helm"); - Tooltip.SetDefault("20% increased rogue damage and critical strike chance, 25% increased movement speed\n" + + Tooltip.SetDefault("20% increased rogue damage, critical strike chance and movement speed\n" + "Not moving boosts all damage and critical strike chance"); } @@ -38,10 +38,9 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Rogue Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + player.setBonus = "Rogue Tarragon, Bloodflare and God Slayer armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + - "Rogue weapon critical strikes will do 1.25 times damage while you are above 50% HP\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 130\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + @@ -53,8 +52,6 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareThrowing = true; modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; - modPlayer.silvaSet = true; - modPlayer.silvaThrowing = true; modPlayer.auricSet = true; modPlayer.rogueStealthMax += 1.3f; modPlayer.wearingRogueArmor = true; @@ -67,7 +64,10 @@ namespace CalamityMod.Items.Armor player.statDefense += 30; player.lifeRegen += 10; } - } + + if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -75,13 +75,12 @@ namespace CalamityMod.Items.Armor modPlayer.auricBoost = true; player.Calamity().throwingDamage += 0.2f; player.Calamity().throwingCrit += 20; - player.moveSpeed += 0.25f; + player.moveSpeed += 0.2f; } 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()); diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 879440e7b5..cc89ef06c3 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -17,8 +18,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Space Helmet"); - Tooltip.SetDefault("+7 max minions\n" + - "Not moving boosts all damage and critical strike chance"); + Tooltip.SetDefault("Not moving boosts all damage and critical strike chance"); } public override void SetDefaults() @@ -42,17 +42,15 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Summoner Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + player.setBonus = "Summoner Tarragon, Bloodflare and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + - "+1 max minion and 120% increased minion damage"; + "+6 max minions and 90% increased minion damage"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraSummon = true; modPlayer.bloodflareSet = true; modPlayer.bloodflareSummon = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerSummon = true; modPlayer.silvaSet = true; modPlayer.silvaSummon = true; modPlayer.auricSet = true; @@ -60,8 +58,8 @@ namespace CalamityMod.Items.Armor player.lavaMax += 240; player.ignoreWater = true; player.crimsonRegen = true; - player.minionDamage += 1.2f; - player.maxMinions++; + player.minionDamage += 0.9f; + player.maxMinions += 6; if (player.lavaWet) { player.statDefense += 30; @@ -75,127 +73,7 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(3000f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); - } - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - int owner = player.whoAmI; - int typeHead = ModContent.ProjectileType(); - int typeBody = ModContent.ProjectileType(); - int typeBody2 = ModContent.ProjectileType(); - int typeTail = ModContent.ProjectileType(); - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (Main.projectile[i].type == typeHead || Main.projectile[i].type == typeTail || Main.projectile[i].type == typeBody || - Main.projectile[i].type == typeBody2) - { - Main.projectile[i].Kill(); - } - } - } - int maxMinionScale = player.maxMinions; - if (maxMinionScale > 10) - { - maxMinionScale = 10; - } - int damage = (int)(35 * ((player.MinionDamage() * 5 / 3) + (player.MinionDamage() * 0.46f * (maxMinionScale - 1)))); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = 10f; - } - else - { - dist = 10f / dist; - } - velX *= dist; - velY *= dist; - int head = -1; - int tail = -1; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (head == -1 && Main.projectile[i].type == typeHead) - { - head = i; - } - else if (tail == -1 && Main.projectile[i].type == typeTail) - { - tail = i; - } - if (head != -1 && tail != -1) - { - break; - } - } - } - if (head == -1 && tail == -1) - { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner); - - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - } - else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, Main.projectile[tail].ai[0]); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)body); - - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; - Main.projectile[body].minionSlots = 0f; - Main.projectile[body].netUpdate = true; - - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].minionSlots = 0f; - Main.projectile[back].ai[1] = 1f; - - Main.projectile[tail].ai[0] = (float)back; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1200f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); } } } @@ -204,14 +82,12 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); modPlayer.auricBoost = true; - player.maxMinions += 7; } 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(), 10); diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 2219f9c286..6a04f63679 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Magic Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + + player.setBonus = "Magic Tarragon, Bloodflare and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%"; CalamityPlayer modPlayer = player.Calamity(); @@ -46,8 +46,6 @@ namespace CalamityMod.Items.Armor modPlayer.tarraMage = true; modPlayer.bloodflareSet = true; modPlayer.bloodflareMage = true; - modPlayer.godSlayer = true; - modPlayer.godSlayerMage = true; modPlayer.silvaSet = true; modPlayer.silvaMage = true; modPlayer.auricSet = true; @@ -76,7 +74,6 @@ namespace CalamityMod.Items.Armor { 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(), 10); diff --git a/Items/Armor/BloodflareCuisses.cs b/Items/Armor/BloodflareCuisses.cs index 423382683e..df9f39173c 100644 --- a/Items/Armor/BloodflareCuisses.cs +++ b/Items/Armor/BloodflareCuisses.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodflare Cuisses"); - Tooltip.SetDefault("30% increased movement speed, 10% increased damage and 7% increased critical strike chance"); + Tooltip.SetDefault("17% increased movement speed, 10% increased damage and 7% increased critical strike chance"); } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.moveSpeed += 0.3f; + player.moveSpeed += 0.17f; player.allDamage += 0.1f; player.Calamity().AllCritBoost(7); } diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index b606d8a68a..274e6728d4 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Items.Armor modPlayer.rogueStealthMax += 1.2f; modPlayer.wearingRogueArmor = true; player.setBonus = "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Enemies below 50% life drop a heart when struck\n" + + "This effect has a 5 second cooldown\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Being over 80% life boosts your defense by 30 and rogue crit by 5%\n" + "Being below 80% life boosts your rogue damage by 10%\n" + "Rogue critical strikes have a 50% chance to heal you\n" + diff --git a/Items/Armor/BloodflareHelmet.cs b/Items/Armor/BloodflareHelmet.cs index b3bb0eee2c..39b84823cb 100644 --- a/Items/Armor/BloodflareHelmet.cs +++ b/Items/Armor/BloodflareHelmet.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodflare Wyvern Helm"); - Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "+3 max minions"); + Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava"); } public override void SetDefaults() @@ -33,9 +32,9 @@ namespace CalamityMod.Items.Armor { foreach (TooltipLine line2 in list) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") { - line2.text = "+3 max minions\n" + + line2.text = "You can move freely through liquids and have temporary immunity to lava\n" + "Provides heat protection in Death Mode"; } } @@ -57,23 +56,23 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareSummon = true; - player.setBonus = "55% increased minion damage\n" + + player.setBonus = "55% increased minion damage and +3 max minions\n" + "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Enemies below 50% life drop a heart when struck\n" + + "This effect has a 5 second cooldown\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Summons polterghast mines to circle you\n" + "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.55f; - } + player.maxMinions += 3; + } - public override void UpdateEquip(Player player) + public override void UpdateEquip(Player player) { player.lavaMax += 240; player.ignoreWater = true; - player.maxMinions += 3; } public override void AddRecipes() diff --git a/Items/Armor/BloodflareHornedHelm.cs b/Items/Armor/BloodflareHornedHelm.cs index 44987146ec..17f6d11404 100644 --- a/Items/Armor/BloodflareHornedHelm.cs +++ b/Items/Armor/BloodflareHornedHelm.cs @@ -59,13 +59,18 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareRanged = true; string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); player.setBonus = "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + + "Enemies below 50% life drop a heart when struck\n" + + "This effect has a 5 second cooldown\n" + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "Press " + hotkey + " to unleash the lost souls of polterghast to destroy your enemies\n" + "This effect has a 30 second cooldown\n" + - "Ranged weapons have a chance to fire bloodsplosion orbs"; + "Ranged weapons fire bloodsplosion orbs every 2.5 seconds"; player.crimsonRegen = true; + + if (modPlayer.bloodflareSoulTimer == 1) //sound when ready to use again + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BloodflareRangerRecharge"), player.Center); + } } public override void UpdateEquip(Player player) diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index 1e2cf84381..248aa660ec 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -58,10 +58,10 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareSet = true; modPlayer.bloodflareMage = true; player.setBonus = "Greatly increases life regen\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + - "Magic weapons will sometimes fire ghostly bolts\n" + + "Enemies below 50% life drop a heart when struck\n" + + "This effect has a 5 second cooldown\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Magic weapons fire ghostly bolts every 1.67 seconds\n" + "Magic critical strikes cause flame explosions every 2 seconds"; player.crimsonRegen = true; } diff --git a/Items/Armor/BloodflareMask.cs b/Items/Armor/BloodflareMask.cs index 563e01663c..d5c8feb9a9 100644 --- a/Items/Armor/BloodflareMask.cs +++ b/Items/Armor/BloodflareMask.cs @@ -59,9 +59,9 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareMelee = true; player.setBonus = "Greatly increases life regen\n" + "Enemies are more likely to target you\n" + - "Enemies below 50% life have a chance to drop hearts when struck\n" + - "Enemies above 50% life have a chance to drop mana stars when struck\n" + - "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + + "Enemies below 50% life drop a heart when struck\n" + + "This effect has a 5 second cooldown\n" + + "Enemies killed during a Blood Moon have a much higher chance to drop Blood Orbs\n" + "True melee strikes will heal you\n" + "After striking an enemy 15 times with true melee you will enter a blood frenzy for 5 seconds\n" + "During this you will gain 25% increased melee damage, critical strike chance, and contact damage is halved\n" + diff --git a/Items/Armor/BrimflameBoots.cs b/Items/Armor/BrimflameBoots.cs index 505b4f5002..a055676f8a 100644 --- a/Items/Armor/BrimflameBoots.cs +++ b/Items/Armor/BrimflameBoots.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.defense = 10; //41 + item.rare = ItemRarityID.Lime; + item.defense = 15; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/BrimflameRobes.cs b/Items/Armor/BrimflameRobes.cs index 7019f705a3..7aa72aa912 100644 --- a/Items/Armor/BrimflameRobes.cs +++ b/Items/Armor/BrimflameRobes.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.defense = 10; //41 + item.rare = ItemRarityID.Lime; + item.defense = 15; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/BrimflameScowl.cs b/Items/Armor/BrimflameScowl.cs index 416347c154..7aa7ad8cef 100644 --- a/Items/Armor/BrimflameScowl.cs +++ b/Items/Armor/BrimflameScowl.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Armor public class BrimflameScowl : ModItem { private bool frenzy = false; + public static int CooldownLength = 1800; public override void SetStaticDefaults() { @@ -26,11 +27,11 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.defense = 7; //41 + item.rare = ItemRarityID.Lime; + item.defense = 11; } - private void updateFrenzy(Player player) + private void UpdateFrenzy(Player player) { CalamityPlayer modPlayer = player.Calamity(); if (!frenzy) @@ -43,9 +44,14 @@ namespace CalamityMod.Items.Armor if (!modPlayer.brimflameFrenzy) { frenzy = false; - player.AddBuff(ModContent.BuffType(), 30 * 60, true); + player.AddBuff(ModContent.BuffType(), CooldownLength, true); + modPlayer.brimflameFrenzyTimer = CooldownLength; } } + if (modPlayer.brimflameFrenzyTimer == 1) //sound when ready to use again + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimflameRecharge"), player.Center); + } } public override void UpdateEquip(Player player) @@ -57,7 +63,7 @@ namespace CalamityMod.Items.Armor player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.OnFire] = true; player.buffImmune[BuffID.Frostburn] = true; - updateFrenzy(player); + UpdateFrenzy(player); } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -77,17 +83,11 @@ namespace CalamityMod.Items.Armor player.magicDamage += 0.15f; player.magicCrit += 15; string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); - player.setBonus = "Grants an additional 15% increased damage and magic crit\n" + + player.setBonus = "Grants an additional 15% increased magic damage and crit\n" + "Press " + hotkey + " to trigger a brimflame frenzy effect\n" + "While under this effect, your damage is significantly boosted\n" + "However, this comes at the cost of rapid life loss and no mana regeneration\n" + "This can be toggled off, however, a brimstone frenzy has a 30 second cooldown"; - - if (player.HasBuff(ModContent.BuffType())) //sound when ready to use again - { - if (player.buffTime[player.FindBuffIndex(ModContent.BuffType())] == 1); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimflameRecharge"), player.Center); - } } public override void AddRecipes() diff --git a/Items/Armor/DaedalusBreastplate.cs b/Items/Armor/DaedalusBreastplate.cs index a9ab945f1a..d67e7dd65a 100644 --- a/Items/Armor/DaedalusBreastplate.cs +++ b/Items/Armor/DaedalusBreastplate.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 19; //41 } diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index 38a890005f..3926fc4d55 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 5; //35 } diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 7de730e8fd..e6aeacb2c8 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Mask"); - Tooltip.SetDefault("5% increased minion damage and +2 max minions"); + Tooltip.SetDefault("5% increased minion damage"); } public override void SetDefaults() @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 3; //33 } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "20% increased minion damage\n" + + player.setBonus = "20% increased minion damage and +2 max minions\n" + "A daedalus crystal floats above you to protect you"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusCrystal = true; @@ -55,12 +55,12 @@ namespace CalamityMod.Items.Armor } } player.minionDamage += 0.2f; - } + player.maxMinions += 2; + } - public override void UpdateEquip(Player player) + public override void UpdateEquip(Player player) { player.minionDamage += 0.05f; - player.maxMinions += 2; } public override void AddRecipes() diff --git a/Items/Armor/DaedalusHelm.cs b/Items/Armor/DaedalusHelm.cs index 466ef8b65d..e912674001 100644 --- a/Items/Armor/DaedalusHelm.cs +++ b/Items/Armor/DaedalusHelm.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 21; //51 } @@ -39,11 +39,15 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "5% increased melee damage\n" + - "You have a 33% chance to reflect projectiles back at enemies\n" + + "Enemies are more likely to target you\n" + + "You reflect projectiles back at enemies\n" + + "Reflected projectiles deal 50% less damage to you\n" + + "This reflect has a 60 second cooldown which is shared with all other dodges and reflects\n" + "If you reflect a projectile you are also healed for 1/5 of that projectile's damage"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusReflect = true; player.meleeDamage += 0.05f; + player.aggro += 500; } public override void UpdateEquip(Player player) @@ -58,9 +62,9 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.CrystalShard, 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ItemID.CrystalShard, 6); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/DaedalusHelmet.cs b/Items/Armor/DaedalusHelmet.cs index e4d25a333b..9b93ce9254 100644 --- a/Items/Armor/DaedalusHelmet.cs +++ b/Items/Armor/DaedalusHelmet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 9; //39 } diff --git a/Items/Armor/DaedalusLeggings.cs b/Items/Armor/DaedalusLeggings.cs index e29ed2603a..cb590f5eb6 100644 --- a/Items/Armor/DaedalusLeggings.cs +++ b/Items/Armor/DaedalusLeggings.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 15; //41 } diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index a61a43b5b4..be2a064568 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 7; //37 } diff --git a/Items/Armor/DemonshadeBreastplate.cs b/Items/Armor/DemonshadeBreastplate.cs index 1614e94852..9dcf859e53 100644 --- a/Items/Armor/DemonshadeBreastplate.cs +++ b/Items/Armor/DemonshadeBreastplate.cs @@ -13,18 +13,19 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Demonshade Breastplate"); Tooltip.SetDefault("20% increased melee speed, 15% increased damage and critical strike chance\n" + - "Enemies take ungodly damage when they touch you\n" + - "Increased max life and mana by 200\n" + - "Standing still lets you absorb the shadows and boost your life regen"); + "Enemies take ungodly damage when they touch you\n" + + "Increased max life and mana by 200\n" + + "Standing still lets you absorb the shadows and boost your life regen"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(4, 0, 0, 0); item.defense = 50; - item.Calamity().customRarity = CalamityRarity.Developer; + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/DemonshadeGreaves.cs b/Items/Armor/DemonshadeGreaves.cs index 246b10d6b0..8efdb8ca97 100644 --- a/Items/Armor/DemonshadeGreaves.cs +++ b/Items/Armor/DemonshadeGreaves.cs @@ -19,16 +19,18 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.value = Item.buyPrice(3, 0, 0, 0); - item.defense = 50; //15 - item.Calamity().customRarity = CalamityRarity.Developer; + item.defense = 50; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override void UpdateEquip(Player player) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.shadowSpeed = true; - player.moveSpeed += 1f; + player.moveSpeed += 0.3f; } public override void AddRecipes() diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index 3b0de642b0..31be8d750b 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -14,16 +14,17 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Demonshade Helm"); - Tooltip.SetDefault("30% increased damage and 15% increased critical strike chance, +10 max minions"); + Tooltip.SetDefault("30% increased damage and 15% increased critical strike chance"); } public override void SetDefaults() { item.width = 18; item.height = 18; - item.value = Item.buyPrice(5, 0, 0, 0); - item.defense = 50; //15 - item.Calamity().customRarity = CalamityRarity.Developer; + 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) @@ -40,7 +41,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); - player.setBonus = "100% increased minion damage\n" + + player.setBonus = "100% increased minion damage and +10 max minions\n" + "All attacks inflict the demon flame debuff\n" + "Shadowbeams and demon scythes will fire down when you are hit\n" + "A friendly red devil follows you around\n" + @@ -58,16 +59,16 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - int damage = (int)(10000 * player.AverageDamage()); + int damage = (int)(10000 * player.AverageDamage()); Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } } player.minionDamage += 1f; + player.maxMinions += 10; } public override void UpdateEquip(Player player) { - player.maxMinions += 10; player.allDamage += 0.3f; player.Calamity().AllCritBoost(15); } diff --git a/Items/Armor/DesertProwlerHat.cs b/Items/Armor/DesertProwlerHat.cs index ac416c74c4..35d09369a4 100644 --- a/Items/Armor/DesertProwlerHat.cs +++ b/Items/Armor/DesertProwlerHat.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 1; //6 } diff --git a/Items/Armor/DesertProwlerPants.cs b/Items/Armor/DesertProwlerPants.cs index a57e60178e..983d3ff276 100644 --- a/Items/Armor/DesertProwlerPants.cs +++ b/Items/Armor/DesertProwlerPants.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 2; } diff --git a/Items/Armor/DesertProwlerShirt.cs b/Items/Armor/DesertProwlerShirt.cs index a4cb8035d4..04c011f3da 100644 --- a/Items/Armor/DesertProwlerShirt.cs +++ b/Items/Armor/DesertProwlerShirt.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 3; } diff --git a/Items/Armor/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmerBoots.cs index 778d2237aa..528835e72a 100644 --- a/Items/Armor/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmerBoots.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Fathom Swarmer Greaves"); Tooltip.SetDefault("4% increased minion damage\n" + "Grants the ability to swim\n" + - "Speed greatly increased while submerged in liquid"); + "Movement speed increased by 40% while submerged in liquid"); } public override void SetDefaults() @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 15; } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor player.minionDamage += 0.04f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.moveSpeed += 0.5f; + player.moveSpeed += 0.4f; } player.ignoreWater = true; if (player.wingTime <= 0) //ignore flippers while the player can fly diff --git a/Items/Armor/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmerBreastplate.cs index 7543f0d3e1..1a4777a29a 100644 --- a/Items/Armor/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmerBreastplate.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Fathom Swarmer Breastplate"); - Tooltip.SetDefault("12% increased damage reduction\n" + - "6% increased minion damage and +1 max minion\n" + + Tooltip.SetDefault("6% increased damage reduction\n" + + "6% increased minion damage\n" + "Boosted defense and regen increased while submerged in liquid\n" + "Reduces defense loss within the Abyss"); } @@ -23,15 +23,14 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 22; } public override void UpdateEquip(Player player) { player.minionDamage += 0.06f; - player.endurance += 0.12f; - player.maxMinions++; + player.endurance += 0.06f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.statDefense += 10; diff --git a/Items/Armor/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmerVisage.cs index 252bd66efa..a705ebff7c 100644 --- a/Items/Armor/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmerVisage.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 10; //47 +10 underwater } @@ -33,15 +33,15 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "10% increased minion damage and +1 max minion\n" + + player.setBonus = "10% increased minion damage and +2 max minions\n" + "Grants the ability to climb walls\n" + "30% increased minion damage while submerged in liquid\n" + "Provides a moderate amount of light and moderately reduces breath loss in the abyss"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.fathomSwarmer = true; player.spikedBoots = 2; - player.maxMinions++; - player.minionDamage += 0.05f; + player.maxMinions += 2; + player.minionDamage += 0.1f; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { player.minionDamage += 0.3f; @@ -51,7 +51,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { CalamityPlayer modPlayer = player.Calamity(); - player.minionDamage += 0.1f; + player.minionDamage += 0.05f; if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss) { player.breath = player.breathMax + 3; diff --git a/Items/Armor/FearmongerGreathelm.cs b/Items/Armor/FearmongerGreathelm.cs index 61b29ba4db..e598777c6d 100644 --- a/Items/Armor/FearmongerGreathelm.cs +++ b/Items/Armor/FearmongerGreathelm.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Fearmonger Greathelm"); Tooltip.SetDefault("Pure terror radiates from your eyes\n" + "+60 max mana and 10% decreased mana usage\n" + - "10% increased minion damage and +2 max minions"); + "10% increased minion damage"); } public override void SetDefaults() @@ -32,7 +32,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.statManaMax2 += 60; - player.maxMinions += 2; player.minionDamage += 0.1f; player.manaCost *= 0.9f; } @@ -51,7 +50,7 @@ namespace CalamityMod.Items.Armor { if (CalamityWorld.death) { - player.setBonus = @"30% increased minion damage + player.setBonus = @"20% increased minion damage and +2 max minions The minion damage nerf while wielding weaponry is reduced Immunity to all forms of frost and flame All minion attacks grant colossal life regeneration @@ -61,7 +60,7 @@ Provides cold protection in Death Mode"; } else { - player.setBonus = @"30% increased minion damage + player.setBonus = @"20% increased minion damage and +2 max minions The minion damage nerf while wielding weaponry is reduced Immunity to all forms of frost and flame All minion attacks grant colossal life regeneration @@ -74,9 +73,10 @@ This extra damage reduction ignores the soft cap"; // All-class armors count as rogue sets, but don't grant stealth bonuses player.Calamity().wearingRogueArmor = true; - player.minionDamage += 0.3f; + player.minionDamage += 0.2f; + player.maxMinions += 2; - int[] immuneDebuffs = { + int[] immuneDebuffs = { BuffID.OnFire, BuffID.Frostburn, BuffID.CursedInferno, diff --git a/Items/Armor/FearmongerGreaves.cs b/Items/Armor/FearmongerGreaves.cs index af881d591a..ffc8114b17 100644 --- a/Items/Armor/FearmongerGreaves.cs +++ b/Items/Armor/FearmongerGreaves.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Fearmonger Greaves"); - Tooltip.SetDefault("+2 max minions and 6% increased damage\n" + + Tooltip.SetDefault("6% increased damage\n" + "50% increased minion knockback\n" + - "15% increased movement speed\n" + + "10% increased movement speed\n" + "Taking damage makes you move very fast for a short time"); } @@ -29,10 +29,9 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.maxMinions += 2; player.allDamage += 0.06f; player.minionKB += 0.5f; - player.moveSpeed += 0.15f; + player.moveSpeed += 0.1f; player.panic = true; } diff --git a/Items/Armor/FearmongerPlateMail.cs b/Items/Armor/FearmongerPlateMail.cs index b1a37db3f3..79fbe1938c 100644 --- a/Items/Armor/FearmongerPlateMail.cs +++ b/Items/Armor/FearmongerPlateMail.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Fearmonger Plate Mail"); Tooltip.SetDefault("+100 max life and 8% increased damage reduction\n" + - "+2 max minions\n" + "5% increased damage and critical strike chance"); } @@ -30,7 +29,6 @@ namespace CalamityMod.Items.Armor { player.statLifeMax2 += 100; player.endurance += 0.08f; - player.maxMinions += 2; player.allDamage += 0.05f; player.Calamity().AllCritBoost(5); } diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index eeba99f711..96746a47d9 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -8,9 +8,9 @@ namespace CalamityMod.Items.Armor [AutoloadEquip(EquipType.Head)] public class ForbiddenCirclet : ModItem { - public const int manaCost = 60; - public const int tornadoBaseDmg = 80; - public const float tornadoBaseKB = 1f; + public const int manaCost = 60; + public const int tornadoBaseDmg = 80; + public const float tornadoBaseKB = 1f; public override void SetStaticDefaults() { @@ -22,12 +22,11 @@ namespace CalamityMod.Items.Armor { item.width = 18; item.height = 18; - item.defense = 1; //21 - //same rarity and sell price as Forbidden Mask - item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; - //I lied, it's patron dark red - item.Calamity().customRarity = CalamityRarity.Dedicated; + 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; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -37,7 +36,7 @@ namespace CalamityMod.Items.Armor public override void ArmorSetShadows(Player player) { - player.armorEffectDrawShadowLokis = true; + player.armorEffectDrawShadowLokis = true; player.armorEffectDrawOutlinesForbidden = true; } @@ -49,10 +48,10 @@ namespace CalamityMod.Items.Armor "The ancient storm costs " + stormMana + " mana and benefits from both summon and rogue bonuses\n" + "Rogue stealth strikes spawn homing eaters on enemy hits\n" + "Rogue and summon attacks will scale off of the stat with a higher boost\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 40\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + "Rogue stealth builds while not attacking and slower while moving, up to a max of 40\n" + + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.forbiddenCirclet = true; modPlayer.rogueStealthMax += 0.4f; @@ -62,12 +61,12 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.minionDamage += 0.1f; - player.Calamity().throwingVelocity += 0.15f; + player.Calamity().throwingVelocity += 0.15f; } public override void AddRecipes() { - //Same recipe as Forbidden Mask + //Same recipe as Forbidden Mask ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); recipe.AddRecipeGroup("AnyAdamantiteBar", 10); diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index 1e8e197a8b..af49a5c1e8 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -13,9 +13,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("God Slayer Chestplate"); Tooltip.SetDefault("+60 max life\n" + - "15% increased movement speed\n" + "Enemies take damage when they hit you\n" + - "Attacks have a 2% chance to do no damage to you\n" + "11% increased damage and 6% increased critical strike chance"); } @@ -31,10 +29,8 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.godSlayerReflect = true; player.thorns += 0.5f; player.statLifeMax2 += 60; - player.moveSpeed += 0.15f; player.allDamage += 0.11f; modPlayer.AllCritBoost(6); } @@ -43,8 +39,9 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 23); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerHelm.cs b/Items/Armor/GodSlayerHelm.cs index 2a172b4563..b269d4e2a7 100644 --- a/Items/Armor/GodSlayerHelm.cs +++ b/Items/Armor/GodSlayerHelm.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -39,14 +39,22 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerDamage = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active all life regen is disabled\n" + + string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); + player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 15 second cooldown\n" + + "Enemies are more likely to target you\n" + "Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts\n" + "Enemies take a lot of damage when they hit you\n" + "An attack that would deal 80 damage or less will have its damage reduced to 1"; player.thorns += 2.5f; - } + player.aggro += 1000; + + if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { @@ -58,8 +66,9 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerHelmet.cs b/Items/Armor/GodSlayerHelmet.cs index 9aee8ac841..62b8c32f92 100644 --- a/Items/Armor/GodSlayerHelmet.cs +++ b/Items/Armor/GodSlayerHelmet.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -39,11 +39,16 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerRanged = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active all life regen is disabled\n" + - "Your ranged critical hits have a chance to critically hit, causing 4 times the damage\n" + - "You have a chance to fire a god killer shrapnel round while firing ranged weapons"; + string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); + player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 15 second cooldown\n" + + "You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds"; + + if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; } public override void UpdateEquip(Player player) @@ -56,8 +61,9 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerHornedHelm.cs b/Items/Armor/GodSlayerHornedHelm.cs deleted file mode 100644 index c9435b23d1..0000000000 --- a/Items/Armor/GodSlayerHornedHelm.cs +++ /dev/null @@ -1,193 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Horned Helm"); - Tooltip.SetDefault("+3 max minions"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 12; //96 - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.godSlayer = true; - modPlayer.godSlayerSummon = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - int owner = player.whoAmI; - int typeHead = ModContent.ProjectileType(); - int typeBody = ModContent.ProjectileType(); - int typeBody2 = ModContent.ProjectileType(); - int typeTail = ModContent.ProjectileType(); - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (Main.projectile[i].type == typeHead || Main.projectile[i].type == typeTail || Main.projectile[i].type == typeBody || - Main.projectile[i].type == typeBody2) - { - Main.projectile[i].Kill(); - } - } - } - int maxMinionScale = player.maxMinions; - if (maxMinionScale > 10) - { - maxMinionScale = 10; - } - int damage = (int)(35 * (((player.allDamage + player.minionDamage - 1f) * 5 / 3) + ((player.allDamage + player.minionDamage - 1f) * 0.46f * (maxMinionScale - 1)))); - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float velX = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float velY = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - velY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); - if ((float.IsNaN(velX) && float.IsNaN(velY)) || (velX == 0f && velY == 0f)) - { - velX = (float)player.direction; - velY = 0f; - dist = 10f; - } - else - { - dist = 10f / dist; - } - velX *= dist; - velY *= dist; - int head = -1; - int tail = -1; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].owner == owner) - { - if (head == -1 && Main.projectile[i].type == typeHead) - { - head = i; - } - else if (tail == -1 && Main.projectile[i].type == typeTail) - { - tail = i; - } - if (head != -1 && tail != -1) - { - break; - } - } - } - if (head == -1 && tail == -1) - { - float num77 = Vector2.Dot(value, vector3); - if (num77 > 0f) - { - player.ChangeDir(1); - } - else - { - player.ChangeDir(-1); - } - velX = 0f; - velY = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner); - - int prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)prev); - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - - prev = curr; - curr = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)prev); - Main.projectile[prev].localAI[1] = (float)curr; - Main.projectile[prev].netUpdate = true; - } - else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, Main.projectile[tail].ai[0]); - int back = Projectile.NewProjectile(vector2.X, vector2.Y, velX, velY, ModContent.ProjectileType(), damage, 1f, owner, (float)body); - - Main.projectile[body].localAI[1] = (float)back; - Main.projectile[body].ai[1] = 1f; - Main.projectile[body].minionSlots = 0f; - Main.projectile[body].netUpdate = true; - - Main.projectile[back].localAI[1] = (float)tail; - Main.projectile[back].netUpdate = true; - Main.projectile[back].minionSlots = 0f; - Main.projectile[back].ai[1] = 1f; - - Main.projectile[tail].ai[0] = (float)back; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } - } - } - player.setBonus = "65% increased minion damage\n" + - "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active all life regen is disabled\n" + - "Hitting enemies will summon god slayer phantoms\n" + - "Summons a god-eating mechworm to fight for you"; - player.minionDamage += 0.65f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 3; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Armor/GodSlayerLeggings.cs b/Items/Armor/GodSlayerLeggings.cs index a25beef6b4..cf56407976 100644 --- a/Items/Armor/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayerLeggings.cs @@ -1,6 +1,6 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Leggings"); - Tooltip.SetDefault("35% increased movement speed\n" + + Tooltip.SetDefault("18% increased movement speed\n" + "10% increased damage and 6% increased critical strike chance"); } @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.moveSpeed += 0.35f; + player.moveSpeed += 0.18f; player.allDamage += 0.1f; player.Calamity().AllCritBoost(6); } @@ -35,8 +35,9 @@ namespace CalamityMod.Items.Armor { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 14); + recipe.AddIngredient(ModContent.ItemType(), 14); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index 95ae4c8ceb..4a2c915cdd 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -1,7 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -41,30 +41,37 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerThrowing = true; modPlayer.rogueStealthMax += 1.2f; modPlayer.wearingRogueArmor = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active all life regen is disabled\n" + + string hotkey = CalamityMod.GodSlayerDashHotKey.TooltipHotkeyString(); + player.setBonus = "Allows you to dash for an immense distance in 8 directions\n" + + "Press " + hotkey + " while holding down the movement keys in the direction you want to dash\n" + + "Enemies you dash through take massive damage\n" + + "During the dash you are immune to most debuffs\n" + + "The dash has a 15 second cooldown\n" + "While at full HP all of your rogue stats are boosted by 10%\n" + "If you take over 80 damage in one hit you will be given extra immunity frames\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 120\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } + + if (!modPlayer.godSlayerCooldown && modPlayer.godSlayerDashHotKeyPressed) + modPlayer.dashMod = 9; + } public override void UpdateEquip(Player player) { player.Calamity().throwingDamage += 0.14f; player.Calamity().throwingCrit += 14; - player.moveSpeed += 0.18f; + player.moveSpeed += 0.1f; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs deleted file mode 100644 index 4204437445..0000000000 --- a/Items/Armor/GodSlayerVisage.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class GodSlayerVisage : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("God Slayer Visage"); - Tooltip.SetDefault("14% increased magic damage and critical strike chance\n" + - "+100 max mana and 17% reduced mana usage"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 18; - item.value = Item.buyPrice(0, 75, 0, 0); - item.defense = 21; //96 - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.godSlayer = true; - modPlayer.godSlayerMage = true; - player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + - "This effect can only occur once every 45 seconds\n" + - "While the cooldown for this effect is active all life regen is disabled\n" + - "Enemies will release god slayer flames and healing flames when hit with magic attacks\n" + - "Taking damage will cause you to release a magical god slayer explosion"; - } - - public override void UpdateEquip(Player player) - { - player.manaCost *= 0.83f; - player.magicDamage += 0.14f; - player.magicCrit += 14; - player.statManaMax2 += 100; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Armor/MolluskShelleggings.cs b/Items/Armor/MolluskShelleggings.cs index 78e30613df..450ae2e120 100644 --- a/Items/Armor/MolluskShelleggings.cs +++ b/Items/Armor/MolluskShelleggings.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 22; item.height = 18; item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 15; } diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index ff09f23829..ea5018f36b 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.width = 22; item.height = 22; item.value = Item.buyPrice(0, 25, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 18; } diff --git a/Items/Armor/MolluskShellplate.cs b/Items/Armor/MolluskShellplate.cs index 4c7cb9908a..b6acbac2cc 100644 --- a/Items/Armor/MolluskShellplate.cs +++ b/Items/Armor/MolluskShellplate.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 30; item.height = 22; item.value = Item.buyPrice(0, 20, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 22; } diff --git a/Items/Armor/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlueChestplate.cs index 8bfaa408c1..8b3e5f59a8 100644 --- a/Items/Armor/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlueChestplate.cs @@ -23,7 +23,7 @@ No positive life regen"); item.width = 18; item.height = 18; item.value = Item.sellPrice(0, 38, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 28; item.Calamity().customRarity = CalamityRarity.PureGreen; } @@ -34,12 +34,13 @@ No positive life regen"); player.allDamage += 0.12f; modPlayer.AllCritBoost(8); modPlayer.omegaBlueChestplate = true; + modPlayer.noLifeRegen = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 16); + recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index ecd83ea469..ac04adc501 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Omega Blue Helmet"); Tooltip.SetDefault(@"You can move freely through liquids -12% increased damage and 8% increased critical strike chance -+2 max minions"); +12% increased damage and 8% increased critical strike chance"); } public override void SetDefaults() @@ -24,7 +23,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.sellPrice(0, 35, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 19; item.Calamity().customRarity = CalamityRarity.PureGreen; } @@ -35,8 +34,6 @@ namespace CalamityMod.Items.Armor player.allDamage += 0.12f; player.Calamity().AllCritBoost(8); - - player.maxMinions += 2; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -54,18 +51,20 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); - player.setBonus = "Increases armor penetration by 50\n" + - "10% increased damage and critical strike chance\n" + + player.setBonus = "Increases armor penetration by 15\n" + + "10% increased damage and critical strike chance and +2 max minions\n" + "Short-ranged tentacles heal you by sucking enemy life\n" + "Press " + hotkey + " to activate abyssal madness for 5 seconds\n" + "Abyssal madness increases damage, critical strike chance, and tentacle aggression/range\n" + "This effect has a 25 second cooldown"; - player.armorPenetration += 50; + player.armorPenetration += 15; player.Calamity().wearingRogueArmor = true; - //raise rev caps - player.Calamity().omegaBlueSet = true; + player.maxMinions += 2; + + //raise rev caps + player.Calamity().omegaBlueSet = true; if (player.Calamity().omegaBlueCooldown == 1) //dust when ready to use again { @@ -97,7 +96,7 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 11); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 2); diff --git a/Items/Armor/OmegaBlueLeggings.cs b/Items/Armor/OmegaBlueLeggings.cs index ec3557a2f3..f033d3669b 100644 --- a/Items/Armor/OmegaBlueLeggings.cs +++ b/Items/Armor/OmegaBlueLeggings.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Omega Blue Tentacles"); - Tooltip.SetDefault(@"30% increased movement speed + Tooltip.SetDefault(@"20% increased movement speed 12% increased damage and 8% increased critical strike chance"); } @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.sellPrice(0, 35, 25, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 22; item.Calamity().customRarity = CalamityRarity.PureGreen; } @@ -30,14 +30,13 @@ namespace CalamityMod.Items.Armor { player.allDamage += 0.12f; player.Calamity().AllCritBoost(8); - - player.moveSpeed += 0.3f; + player.moveSpeed += 0.2f; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 13); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ModContent.ItemType(), 3); diff --git a/Items/Armor/PlagueReaperMask.cs b/Items/Armor/PlagueReaperMask.cs index 5201e98c4a..b14af54182 100644 --- a/Items/Armor/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaperMask.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 9; //35 } @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Armor string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); player.setBonus = "25% reduced ammo usage and 5% increased flight time\n" + "Enemies receive 10% more damage from ranged projectiles when afflicted by the Plague\n" + - "Getting hit causes the plague cinders to rain from above\n" + + "Getting hit causes plague cinders to rain from above\n" + "Press " + hotkey + " to blind yourself for 5 seconds but massively boost your ranged damage\n" + "This has a 25 second cooldown."; CalamityPlayer modPlayer = player.Calamity(); @@ -55,8 +55,8 @@ namespace CalamityMod.Items.Armor player.blind = true; player.headcovered = true; player.blackout = true; - player.rangedDamage += 1f; //100% ranged dmg and 30% crit - player.rangedCrit += 30; + player.rangedDamage += 0.6f; //60% ranged dmg and 20% crit + player.rangedCrit += 20; } if (modPlayer.plagueReaperCooldown == 1) //dust when ready to use again { @@ -77,9 +77,11 @@ namespace CalamityMod.Items.Armor { if (player.immune) { - if (Main.rand.NextBool(10)) + if (player.miscCounter % 10 == 0) { - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(40 * player.RangedDamage()), 4f, player.whoAmI, 6); + Projectile cinder = CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), (int)(40 * player.RangedDamage()), 4f, player.whoAmI); + if (cinder.whoAmI.WithinBounds(Main.maxProjectiles)) + cinder.Calamity().forceTypeless = true; } } } diff --git a/Items/Armor/PlagueReaperStriders.cs b/Items/Armor/PlagueReaperStriders.cs index 286c290dc4..3b7d61ce40 100644 --- a/Items/Armor/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaperStriders.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Reaper Striders"); - Tooltip.SetDefault("3% increased critical strike chance\n" + - "20% increased movement speed"); + Tooltip.SetDefault("3% increased ranged critical strike chance\n" + + "15% increased movement speed"); } public override void SetDefaults() @@ -20,14 +20,14 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 11; } public override void UpdateEquip(Player player) { player.rangedCrit += 3; - player.moveSpeed += 0.2f; + player.moveSpeed += 0.15f; } public override void AddRecipes() diff --git a/Items/Armor/PlagueReaperVest.cs b/Items/Armor/PlagueReaperVest.cs index 32ec1ac593..fff0b8bbac 100644 --- a/Items/Armor/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaperVest.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 14; } diff --git a/Items/Armor/PlaguebringerCarapace.cs b/Items/Armor/PlaguebringerCarapace.cs index 561868dc95..6c26edd8f2 100644 --- a/Items/Armor/PlaguebringerCarapace.cs +++ b/Items/Armor/PlaguebringerCarapace.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Terraria; @@ -7,15 +6,15 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Body)] + [AutoloadEquip(EquipType.Body)] public class PlaguebringerCarapace : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Carapace"); Tooltip.SetDefault("Reduces the damage caused to you by the plague\n" + - "12% increased minion damage and +1 max minions\n" + - "Friendly bees inflict the plague"); + "12% increased minion damage\n" + + "Friendly bees inflict the plague"); } public override void SetDefaults() @@ -24,27 +23,27 @@ namespace CalamityMod.Items.Armor item.height = 18; item.defense = 17; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { player.Calamity().plaguebringerCarapace = true; - player.maxMinions += 1; player.minionDamage += 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(); - } + 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(); + } } } \ No newline at end of file diff --git a/Items/Armor/PlaguebringerPistons.cs b/Items/Armor/PlaguebringerPistons.cs index 45241d0e3b..d954ee5252 100644 --- a/Items/Armor/PlaguebringerPistons.cs +++ b/Items/Armor/PlaguebringerPistons.cs @@ -1,13 +1,11 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Legs)] + [AutoloadEquip(EquipType.Legs)] public class PlaguebringerPistons : ModItem { public int counter = 0; @@ -15,8 +13,8 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Plaguebringer Pistons"); Tooltip.SetDefault("13% increased minion damage and 15% increased movement speed\n" + - "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + - "You spawn bees while sprinting or dashing"); + "You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt\n" + + "You spawn bees while sprinting or dashing"); } public override void SetDefaults() @@ -25,21 +23,22 @@ namespace CalamityMod.Items.Armor item.height = 18; item.defense = 8; item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { player.minionDamage += 0.13f; player.moveSpeed += 0.15f; - player.Calamity().plaguebringerPistons = true; + player.Calamity().plaguebringerPistons = true; - //Flower Boots code + //Flower Boots code if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) { int x = (int)player.Center.X / 16; int y = (int)(player.position.Y + (float)player.height - 1f) / 16; - Tile tile = Main.tile[x, y]; + Tile tile = Main.tile[x, y]; if (tile == null) { tile = new Tile(); @@ -49,7 +48,7 @@ namespace CalamityMod.Items.Armor tile.frameY = 0; tile.slope(0); tile.halfBrick(false); - //On dirt blocks, there's a small chance to grow a dye plant + //On dirt blocks, there's a small chance to grow a dye plant if (Main.tile[x, y + 1].type == TileID.Dirt) { if (Main.rand.NextBool(1000)) @@ -67,7 +66,7 @@ namespace CalamityMod.Items.Armor NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - //On grass, grow flowers + //On grass, grow flowers if (Main.tile[x, y + 1].type == TileID.Grass) { if (Main.rand.NextBool(2)) @@ -95,7 +94,7 @@ namespace CalamityMod.Items.Armor NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - //On hallowed grass, grow hallowed flowers + //On hallowed grass, grow hallowed flowers else if (Main.tile[x, y + 1].type == TileID.HallowedGrass) { if (Main.rand.NextBool(2)) @@ -123,7 +122,7 @@ namespace CalamityMod.Items.Armor NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } - //On jungle grass, grow jungle flowers + //On jungle grass, grow jungle flowers else if (Main.tile[x, y + 1].type == TileID.JungleGrass) { tile.active(true); @@ -138,16 +137,16 @@ 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(); - } + 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(); + } } } \ No newline at end of file diff --git a/Items/Armor/PlaguebringerVisor.cs b/Items/Armor/PlaguebringerVisor.cs index e69ae4cde6..032f500a21 100644 --- a/Items/Armor/PlaguebringerVisor.cs +++ b/Items/Armor/PlaguebringerVisor.cs @@ -7,14 +7,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Head)] + [AutoloadEquip(EquipType.Head)] public class PlaguebringerVisor : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguebringer Visor"); - Tooltip.SetDefault("15% increased minion damage and +2 max minions\n" + - "+20 max life"); + Tooltip.SetDefault("15% increased minion damage\n" + + "+20 max life"); } public override void SetDefaults() @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Armor item.height = 18; item.defense = 7; // 32 total item.value = CalamityGlobalItem.Rarity8BuyPrice; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) { - player.maxMinions += 2; player.minionDamage += 0.15f; player.statLifeMax2 += 20; } @@ -46,10 +46,12 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Grants a plague dash to ram enemies and afflict them with the plague\n" + - "Summons a lil' plaguebringer to protect you and empower nearby minions"; + "Summons a lil' plaguebringer to protect you and empower nearby minions\n" + + "+3 max minions"; player.Calamity().plaguebringerPatronSet = true; - player.Calamity().dashMod = 8; + player.Calamity().dashMod = 8; + player.maxMinions += 3; if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) @@ -66,15 +68,15 @@ namespace CalamityMod.Items.Armor Lighting.AddLight(player.Center, 0f, 0.39f, 0.24f); } - 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(); - } + 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(); + } } } \ No newline at end of file diff --git a/Items/Armor/PrismaticGreaves.cs b/Items/Armor/PrismaticGreaves.cs index 29b5d83c97..8b9ddf6e89 100644 --- a/Items/Armor/PrismaticGreaves.cs +++ b/Items/Armor/PrismaticGreaves.cs @@ -22,8 +22,10 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.defense = 21; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/PrismaticHelmet.cs b/Items/Armor/PrismaticHelmet.cs index 1d37f3b3a7..4dcae5b085 100644 --- a/Items/Armor/PrismaticHelmet.cs +++ b/Items/Armor/PrismaticHelmet.cs @@ -23,8 +23,10 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.defense = 18; //71 - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/PrismaticRegalia.cs b/Items/Armor/PrismaticRegalia.cs index da8b0ef885..0ef0bf9a4e 100644 --- a/Items/Armor/PrismaticRegalia.cs +++ b/Items/Armor/PrismaticRegalia.cs @@ -23,8 +23,10 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.defense = 33; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs deleted file mode 100644 index a090524d3c..0000000000 --- a/Items/Armor/ReaverCap.cs +++ /dev/null @@ -1,74 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverCap : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Headgear"); - Tooltip.SetDefault("15% increased rogue damage, 5% increased rogue velocity and critical strike chance\n" + - "20% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 10; //43 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.reaverSpore = true; - modPlayer.rogueStealthMax += 1.1f; - player.setBonus = "5% increased rogue damage\n" + - "You emit a cloud of spores when you are hit\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 110\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - player.Calamity().throwingDamage += 0.05f; - player.Calamity().wearingRogueArmor = true; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.Calamity().throwingDamage += 0.15f; - player.Calamity().throwingCrit += 5; - player.Calamity().throwingVelocity += 0.05f; - player.moveSpeed += 0.2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.JungleSpores, 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Armor/ReaverCuisses.cs b/Items/Armor/ReaverCuisses.cs index d9d5a2e317..62efcdd14c 100644 --- a/Items/Armor/ReaverCuisses.cs +++ b/Items/Armor/ReaverCuisses.cs @@ -20,16 +20,13 @@ namespace CalamityMod.Items.Armor item.width = 22; item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 14; } public override void UpdateEquip(Player player) { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.Calamity().throwingCrit += 5; + player.Calamity().AllCritBoost(5); player.moveSpeed += 0.12f; } diff --git a/Items/Armor/ReaverHeadgear.cs b/Items/Armor/ReaverHeadgear.cs new file mode 100644 index 0000000000..82fa1fac1c --- /dev/null +++ b/Items/Armor/ReaverHeadgear.cs @@ -0,0 +1,141 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class ReaverHeadgear : ModItem + { + //Exploration and Mining Helm + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Headgear"); + Tooltip.SetDefault("10% increased pick speed and 20% increased block/wall placement speed\n" + + "Temporary immunity to lava and can move freely through liquids\n" + + "Provides heat protection in Death Mode"); + } + + 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 + } + + public override void ModifyTooltips(List list) + { + if (!CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip2") + { + line2.text = ""; + } + } + } + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadowSubtle = true; + player.armorEffectDrawOutlines = true; + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Causes nearby treasure to sparkle\n" + + "Increased item grab range and block placement range\n" + + "Mining tiles restores breath while underwater\n" + + "Summons a reaver orb to light up the area around you\n" + + "Reduces enemy aggression, even in the abyss\n" + + "Provides a small amount of light in the abyss"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.reaverExplore = true; + modPlayer.wearingRogueArmor = true; + player.blockRange += 2; + player.aggro -= 200; + + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + if (player.miscCounter % 10 == 0) + { + int searchDist = 17; + int x = (int)player.Center.X / 16; + int y = (int)player.Center.Y / 16; + for (int i = x - searchDist; i <= x + searchDist; ++i) + { + for (int j = y - searchDist; j <= y + searchDist; ++j) + { + if (Main.rand.NextBool(4) && (new Vector2((float)(x - i), (float)(y - j)).Length() < (float)searchDist && i > 0 && (i < Main.maxTilesX - 1 && j > 0) && (j < Main.maxTilesY - 1 && Main.tile[i, j] != null && Main.tile[i, j].active()))) + { + 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].frameX >= 576 && Main.tile[i, j].frameX <= 882) + shouldSparkle = true; + } + else if (Main.tile[i, j].type == TileID.LargePiles && Main.tile[i, j].frameX >= 864 && Main.tile[i, j].frameX <= 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) + { + 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]; + dust.fadeIn = 0.75f; + dust.velocity = dust.velocity * 0.1f; + dust.noLight = true; + } + } + } + } + } + } + + public override void UpdateEquip(Player player) + { + player.ignoreWater = true; + player.pickSpeed -= 0.1f; + player.tileSpeed += 0.2f; + player.wallSpeed += 0.2f; + player.lavaMax += 420; + } + + 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(); + } + } +} diff --git a/Items/Armor/ReaverCap.png b/Items/Armor/ReaverHeadgear.png similarity index 100% rename from Items/Armor/ReaverCap.png rename to Items/Armor/ReaverHeadgear.png diff --git a/Items/Armor/ReaverCap_Head.png b/Items/Armor/ReaverHeadgear_Head.png similarity index 100% rename from Items/Armor/ReaverCap_Head.png rename to Items/Armor/ReaverHeadgear_Head.png diff --git a/Items/Armor/ReaverHelm.cs b/Items/Armor/ReaverHelm.cs index 2cfc20f457..abb613e544 100644 --- a/Items/Armor/ReaverHelm.cs +++ b/Items/Armor/ReaverHelm.cs @@ -9,11 +9,13 @@ namespace CalamityMod.Items.Armor [AutoloadEquip(EquipType.Head)] public class ReaverHelm : ModItem { + //Defense and DR Helm public override void SetStaticDefaults() { DisplayName.SetDefault("Reaver Helm"); - Tooltip.SetDefault("15% increased melee damage, 10% increased melee speed, and 5% increased melee critical strike chance\n" + - "10% increased movement speed and can move freely through liquids"); + Tooltip.SetDefault("15% increased damage reduction but 30% decreased damage\n" + + "+50 max life\n" + + "Passively regenerates one health point every second"); } public override void SetDefaults() @@ -21,8 +23,8 @@ namespace CalamityMod.Items.Armor item.width = 28; item.height = 30; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 25; //58 + 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) @@ -40,28 +42,35 @@ namespace CalamityMod.Items.Armor { CalamityPlayer modPlayer = player.Calamity(); player.thorns += 0.33f; - modPlayer.reaverBlast = true; - player.setBonus = "5% increased melee damage\n" + - "Melee projectiles explode on hit\n" + - "Reaver thorns\n" + - "Rage activates when you are damaged"; - player.meleeDamage += 0.05f; + player.moveSpeed -= 0.2f; + player.statDefense += 10; + player.lifeRegen += 3; + player.aggro += 600; + modPlayer.reaverDefense = true; + modPlayer.wearingRogueArmor = true; + player.setBonus = "+10 defense and +3 life regen\n" + + "Enemies are more likely to target you\n" + + "Reduces the life regen lost from damage over time debuffs by 20%\n" + + "All attacks have a small chance to steal life and speed up the rate of life regen\n" + + "20% decreased movement speed and flight time\n" + + "Enemy damage is reflected and summons a thorn spike\n" + + "Reaver Rage has a 25% chance to activate when you are damaged"; + //Reaver Rage provides 30% damage to offset the helm "bonus", 5 def, and 5% melee speed. } public override void UpdateEquip(Player player) { - player.ignoreWater = true; - player.meleeDamage += 0.15f; - player.meleeCrit += 5; - player.meleeSpeed += 0.1f; - player.moveSpeed += 0.1f; + player.allDamage -= 0.3f; + player.endurance += 0.15f; + player.Calamity().reaverRegen = true; + player.statLifeMax2 += 50; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.JungleSpores, 6); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ItemID.JungleSpores, 4); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/ReaverHelmet.cs b/Items/Armor/ReaverHelmet.cs deleted file mode 100644 index b85b0044f8..0000000000 --- a/Items/Armor/ReaverHelmet.cs +++ /dev/null @@ -1,81 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverHelmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Helmet"); - Tooltip.SetDefault("5% increased minion damage, +2 max minions, and increased minion knockback\n" + - "10% increased movement speed and can move freely through liquids"); - } - - public override void SetDefaults() - { - item.width = 22; - item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 3; //36 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = "16% increased minion damage\n" + - "Summons a reaver orb that emits spore gas when enemies are near"; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.reaverOrb = true; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(80f * player.MinionDamage()), 0f, Main.myPlayer, 50f, 0f); - } - } - player.minionDamage += 0.16f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.minionDamage += 0.05f; - player.minionKB += 1f; - player.maxMinions += 2; - player.moveSpeed += 0.1f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.JungleSpores, 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Armor/ReaverHelmet.png b/Items/Armor/ReaverHelmet.png deleted file mode 100644 index 0eaafd5137..0000000000 Binary files a/Items/Armor/ReaverHelmet.png and /dev/null differ diff --git a/Items/Armor/ReaverHelmet_Head.png b/Items/Armor/ReaverHelmet_Head.png deleted file mode 100644 index 2009533b6d..0000000000 Binary files a/Items/Armor/ReaverHelmet_Head.png and /dev/null differ diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs deleted file mode 100644 index 2c17859d9b..0000000000 --- a/Items/Armor/ReaverMask.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class ReaverMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Mask"); - Tooltip.SetDefault("15% increased magic damage, 12% reduced mana cost, and 5% increased magic critical strike chance\n" + - "10% increased movement speed, can move freely through liquids, and +80 max mana"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 22; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; - item.defense = 7; //40 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - player.armorEffectDrawOutlines = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.reaverBurst = true; - player.setBonus = "5% increased magic damage\n" + - "Your magic projectiles emit a burst of spore gas on enemy hits"; - player.magicDamage += 0.05f; - } - - public override void UpdateEquip(Player player) - { - player.ignoreWater = true; - player.magicDamage += 0.15f; - player.magicCrit += 5; - player.manaCost *= 0.88f; - player.moveSpeed += 0.1f; - player.statManaMax2 += 80; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.JungleSpores, 6); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Armor/ReaverMask.png b/Items/Armor/ReaverMask.png deleted file mode 100644 index 380d576d81..0000000000 Binary files a/Items/Armor/ReaverMask.png and /dev/null differ diff --git a/Items/Armor/ReaverMask_Head.png b/Items/Armor/ReaverMask_Head.png deleted file mode 100644 index c85d14eecc..0000000000 Binary files a/Items/Armor/ReaverMask_Head.png and /dev/null differ diff --git a/Items/Armor/ReaverScaleMail.cs b/Items/Armor/ReaverScaleMail.cs index 58a6026beb..53aec1fb00 100644 --- a/Items/Armor/ReaverScaleMail.cs +++ b/Items/Armor/ReaverScaleMail.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 34; item.height = 22; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 19; } diff --git a/Items/Armor/ReaverVisage.cs b/Items/Armor/ReaverVisage.cs index e9beadc749..2e1bce4ce8 100644 --- a/Items/Armor/ReaverVisage.cs +++ b/Items/Armor/ReaverVisage.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,11 +10,11 @@ namespace CalamityMod.Items.Armor [AutoloadEquip(EquipType.Head)] public class ReaverVisage : ModItem { + //Jump/Flight Boosts and Movement Speed Helm public override void SetStaticDefaults() { DisplayName.SetDefault("Reaver Visage"); - Tooltip.SetDefault("15% increased ranged damage, 20% decreased ammo usage, and 5% increased ranged critical strike chance\n" + - "10% increased movement speed and can move freely through liquids"); + Tooltip.SetDefault("10% increased jump speed and 25% increased movement speed"); } public override void SetDefaults() @@ -21,11 +22,11 @@ namespace CalamityMod.Items.Armor item.width = 24; item.height = 28; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 13; //46 } - public override bool IsArmorSet(Item head, Item body, Item legs) + public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); } @@ -39,26 +40,29 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.reaverDoubleTap = true; - player.setBonus = "5% increased ranged damage\n" + - "While using a ranged weapon you have a 10% chance to fire a powerful rocket"; - player.rangedDamage += 0.05f; + modPlayer.reaverSpeed = true; + modPlayer.wearingRogueArmor = true; + player.setBonus = "Grants immunity to fall damage and allows constant jumping\n" + + "10% increased flight time and horizontal wing speed\n" + + "Hooks fly out and retract 10% faster\n" + + "Reduces the cooldown of dashes"; + player.noFallDmg = true; + player.autoJump = true; + if (player.miscCounter % 3 == 2 && player.dashDelay > 0) + player.dashDelay--; } public override void UpdateEquip(Player player) { - player.ignoreWater = true; - player.rangedDamage += 0.15f; - player.rangedCrit += 5; - player.ammoCost80 = true; - player.moveSpeed += 0.1f; + player.jumpSpeedBoost += 0.5f; + player.moveSpeed += 0.25f; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); - recipe.AddIngredient(ItemID.JungleSpores, 6); + recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ItemID.JungleSpores, 4); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Armor/ShroomiteVisage.cs b/Items/Armor/ShroomiteVisage.cs index acda527210..38615b2a56 100644 --- a/Items/Armor/ShroomiteVisage.cs +++ b/Items/Armor/ShroomiteVisage.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 24; item.height = 20; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.defense = 11; //62 } diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index 7a9f9187d2..46369f5acc 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -1,8 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -14,8 +15,8 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Silva Armor"); Tooltip.SetDefault("+80 max life\n" + - "20% increased movement speed\n" + - "12% increased damage and 8% increased critical strike chance"); + "12% increased damage and 8% increased critical strike chance\n" + + "Grants immunity to the irradiated debuff"); } public override void SetDefaults() @@ -24,27 +25,27 @@ namespace CalamityMod.Items.Armor item.height = 24; item.value = Item.buyPrice(0, 72, 0, 0); item.defense = 44; - item.Calamity().customRarity = CalamityRarity.Violet; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void UpdateEquip(Player player) { player.statLifeMax2 += 80; - player.moveSpeed += 0.2f; player.allDamage += 0.12f; player.Calamity().AllCritBoost(8); + player.buffImmune[ModContent.BuffType()] = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddRecipeGroup("AnyGoldBar", 10); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs deleted file mode 100644 index 2f65515307..0000000000 --- a/Items/Armor/SilvaHelm.cs +++ /dev/null @@ -1,73 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Helm"); - Tooltip.SetDefault("13% increased melee damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 20; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 52; //110 - item.Calamity().customRarity = CalamityRarity.Violet; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.silvaSet = true; - modPlayer.silvaMelee = true; - player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + - "Your max life will return to normal if you die\n" + - "True melee strikes have a 25% chance to do five times damage\n" + - "After the silva invincibility is over you will take 20% less contact damage\n" + - "Melee projectiles have a 25% chance to stun enemies for a very brief moment"; - } - - public override void UpdateEquip(Player player) - { - player.meleeDamage += 0.13f; - player.meleeCrit += 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - 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(); - } - } -} diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index f689a35f47..9f318c27bc 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -3,8 +3,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Horned Hood"); - Tooltip.SetDefault("+5 max minions"); } public override void SetDefaults() @@ -24,8 +23,9 @@ namespace CalamityMod.Items.Armor item.height = 24; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 13; //110 - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -42,15 +42,12 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaSummon = true; - player.setBonus = "75% increased minion damage\n" + + player.setBonus = "75% increased minion damage and +5 max minions\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + - "Your max life will return to normal if you die\n" + - "Summons an ancient leaf prism to blast your enemies with life energy\n" + - "After the silva invulnerability time your minions will deal 10% more damage and you will gain +2 max minions"; + "If you are reduced to 1 HP you will not die from any further damage for 8 seconds\n" + + "This effect only triggers once per life\n" + + "Summons an ancient leaf prism to blast your enemies with life energy"; if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) @@ -59,26 +56,21 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1500f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(600f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); } } player.minionDamage += 0.75f; - } - - public override void UpdateEquip(Player player) - { - player.maxMinions += 5; - } + player.maxMinions += 5; + } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddRecipeGroup("AnyGoldBar", 5); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs deleted file mode 100644 index b0ef249985..0000000000 --- a/Items/Armor/SilvaHornedHelm.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaHornedHelm : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Horned Helm"); - Tooltip.SetDefault("13% increased ranged damage and critical strike chance"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 24; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 36; //110 - item.Calamity().customRarity = CalamityRarity.Violet; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.silvaSet = true; - modPlayer.silvaRanged = true; - player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + - "Your max life will return to normal if you die\n" + - "Increases your rate of fire with all ranged weapons\n" + - "During the silva invulnerability time your ranged weapons will do 40% more damage"; - } - - public override void UpdateEquip(Player player) - { - player.rangedDamage += 0.13f; - player.rangedCrit += 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - 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(); - } - } -} diff --git a/Items/Armor/SilvaLeggings.cs b/Items/Armor/SilvaLeggings.cs index df73cdd510..3c1d235802 100644 --- a/Items/Armor/SilvaLeggings.cs +++ b/Items/Armor/SilvaLeggings.cs @@ -1,7 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Leggings"); - Tooltip.SetDefault("45% increased movement speed\n" + + Tooltip.SetDefault("19% increased movement speed\n" + "12% increased damage and 7% increased critical strike chance"); } @@ -22,12 +22,13 @@ namespace CalamityMod.Items.Armor item.height = 18; item.value = Item.buyPrice(0, 54, 0, 0); item.defense = 39; - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.45f; + player.moveSpeed += 0.19f; player.allDamage += 0.12f; player.Calamity().AllCritBoost(7); } @@ -35,12 +36,11 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddIngredient(ModContent.ItemType(), 7); recipe.AddRecipeGroup("AnyGoldBar", 7); recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs deleted file mode 100644 index 5bc71a10c8..0000000000 --- a/Items/Armor/SilvaMask.cs +++ /dev/null @@ -1,79 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Head)] - public class SilvaMask : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Silva Mask"); - Tooltip.SetDefault("13% increased rogue damage and critical strike chance, 20% increased movement speed"); - } - - public override void SetDefaults() - { - item.width = 24; - item.height = 26; - item.value = Item.buyPrice(0, 90, 0, 0); - item.defense = 30; //110 - item.Calamity().customRarity = CalamityRarity.Violet; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.silvaSet = true; - modPlayer.silvaThrowing = true; - modPlayer.rogueStealthMax += 1.25f; - modPlayer.wearingRogueArmor = true; - player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + - "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + - "Your max life will return to normal if you die\n" + - "Rogue weapons have a faster throwing rate while you are above 50% life\n" + - "After the silva invulnerability time your rogue weapons will do 10% more damage\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 125\n" + - "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - } - - public override void UpdateEquip(Player player) - { - player.Calamity().throwingDamage += 0.13f; - player.Calamity().throwingCrit += 13; - player.moveSpeed += 0.2f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - 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(); - } - } -} diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index c0e1a07e73..536bc0e960 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -1,8 +1,8 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; -using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -23,8 +23,9 @@ namespace CalamityMod.Items.Armor item.height = 22; item.value = Item.buyPrice(0, 90, 0, 0); item.defense = 21; //110 - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override bool IsArmorSet(Item head, Item body, Item legs) { @@ -43,12 +44,9 @@ namespace CalamityMod.Items.Armor modPlayer.silvaMage = true; player.setBonus = "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + - "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + - "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + - "Your max life will return to normal if you die\n" + - "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits\n" + - "After the silva invulnerability time your magic weapons will do 10% more damage"; + "If you are reduced to 1 HP you will not die from any further damage for 8 seconds\n" + + "This effect only triggers once per life\n" + + "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits"; } public override void UpdateEquip(Player player) @@ -62,12 +60,11 @@ namespace CalamityMod.Items.Armor public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddRecipeGroup("AnyGoldBar", 5); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Armor/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffianChestplate.cs index 4cd2ad961f..1de589f072 100644 --- a/Items/Armor/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffianChestplate.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 2; //4 } diff --git a/Items/Armor/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffianGreaves.cs index ce365b7f4e..b3729850f3 100644 --- a/Items/Armor/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffianGreaves.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 1; //4 } diff --git a/Items/Armor/SnowRuffianMask.cs b/Items/Armor/SnowRuffianMask.cs index f13475ab7e..9081e2e052 100644 --- a/Items/Armor/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffianMask.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 1; //4 } diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index 42fbd4e999..688660f033 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 10; } diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index 9dc3c1101b..fb5894c4eb 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 5; //22 } @@ -35,12 +35,12 @@ namespace CalamityMod.Items.Armor { player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + - "30% increased jump speed"; + "12% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.statigelJump = true; Player.jumpHeight += 5; - player.jumpSpeedBoost += 1.5f; + player.jumpSpeedBoost += 0.6f; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/StatigelGreaves.cs b/Items/Armor/StatigelGreaves.cs index 5c579abd68..7b6f83532a 100644 --- a/Items/Armor/StatigelGreaves.cs +++ b/Items/Armor/StatigelGreaves.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 8; } diff --git a/Items/Armor/StatigelHeadgear.cs b/Items/Armor/StatigelHeadgear.cs index 7a03113433..ef25bf8d36 100644 --- a/Items/Armor/StatigelHeadgear.cs +++ b/Items/Armor/StatigelHeadgear.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 7; //25 } @@ -33,15 +33,15 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height\n" + - "30% increased jump speed"; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.statigelSet = true; + player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height\n" + + "12% increased jump speed"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.statigelSet = true; modPlayer.statigelJump = true; Player.jumpHeight += 5; - player.jumpSpeedBoost += 1.5f; - } + player.jumpSpeedBoost += 0.6f; + } public override void UpdateEquip(Player player) { diff --git a/Items/Armor/StatigelHelm.cs b/Items/Armor/StatigelHelm.cs index ae3d6fd38d..a0c8ffd036 100644 --- a/Items/Armor/StatigelHelm.cs +++ b/Items/Armor/StatigelHelm.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 9; //27 } @@ -33,15 +33,17 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + - "Grants an extra jump and increased jump height\n" + - "30% increased jump speed"; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.statigelSet = true; + player.setBonus = "Enemies are more likely to target you\n" + + "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + "Grants an extra jump and increased jump height\n" + + "12% increased jump speed"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.statigelSet = true; modPlayer.statigelJump = true; Player.jumpHeight += 5; - player.jumpSpeedBoost += 1.5f; - } + player.jumpSpeedBoost += 0.6f; + player.aggro += 400; + } public override void UpdateEquip(Player player) { diff --git a/Items/Armor/StatigelHood.cs b/Items/Armor/StatigelHood.cs index 089c3540e9..d71e1bdab0 100644 --- a/Items/Armor/StatigelHood.cs +++ b/Items/Armor/StatigelHood.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Statigel Hood"); - Tooltip.SetDefault("Increased minion knockback and +1 max minion"); + Tooltip.SetDefault("Increased minion knockback"); } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 4; //20 } @@ -34,19 +34,20 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "18% increased minion damage\n" + + player.setBonus = "18% increased minion damage and +1 max minion\n" + "Summons a mini slime god to fight for you, the type depends on what world evil you have\n" + "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + - "30% increased jump speed"; + "12% increased jump speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.slimeGod = true; modPlayer.statigelJump = true; Player.jumpHeight += 5; - player.jumpSpeedBoost += 1.5f; - player.minionDamage += 0.18f; - if (player.whoAmI == Main.myPlayer) + player.jumpSpeedBoost += 0.6f; + player.minionDamage += 0.18f; + player.maxMinions++; + if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) { @@ -66,7 +67,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.minionKB += 1.5f; - player.maxMinions++; } public override void AddRecipes() diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index bac001ee47..67e915bf64 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.defense = 6; //23 } @@ -33,9 +33,9 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + + player.setBonus = "When you take over 100 damage in one hit you become immune to damage for an extended period of time\n" + "Grants an extra jump and increased jump height\n" + - "30% increased jump speed\n" + + "12% increased jump speed\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + @@ -46,8 +46,8 @@ namespace CalamityMod.Items.Armor modPlayer.rogueStealthMax += 1f; modPlayer.wearingRogueArmor = true; Player.jumpHeight += 5; - player.jumpSpeedBoost += 1.5f; - } + player.jumpSpeedBoost += 0.6f; + } public override void UpdateEquip(Player player) { diff --git a/Items/Armor/SulfurBreastplate.cs b/Items/Armor/SulfurBreastplate.cs index 05e63bca52..058462dd0c 100644 --- a/Items/Armor/SulfurBreastplate.cs +++ b/Items/Armor/SulfurBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Breastplate"); - Tooltip.SetDefault("10% rogue damage and 5% critical strike chance"); + Tooltip.SetDefault("8% increased rogue damage and 5% increased rogue critical strike chance"); } public override void SetDefaults() @@ -21,13 +21,13 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 15, 0); - item.defense = 7; - item.rare = 2; + item.defense = 6; + item.rare = ItemRarityID.Green; } public override void UpdateEquip(Player player) { - player.Calamity().throwingDamage += 0.1f; + player.Calamity().throwingDamage += 0.08f; player.Calamity().throwingCrit += 5; } diff --git a/Items/Armor/SulfurHelmet.cs b/Items/Armor/SulfurHelmet.cs index 6e78679c6e..f7909dfde0 100644 --- a/Items/Armor/SulfurHelmet.cs +++ b/Items/Armor/SulfurHelmet.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Helmet"); - Tooltip.SetDefault("8% increased rogue damage\n" + + Tooltip.SetDefault("4% increased rogue damage\n" + "2% increased rogue critical strike chance\n" + "Grants underwater breathing"); } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 5; } @@ -37,23 +37,22 @@ namespace CalamityMod.Items.Armor { player.setBonus = "Attacking and being attacked by enemies inflicts poison\n" + "Grants an additional jump that summons a sulphurous bubble\n" + - "Reduces the severity of the sulphuric waters\n" + - "Slightly reduces breath loss in the abyss\n" + - "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + + "Provides increased underwater mobility and reduces the severity of the sulphuric waters\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 95\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.sulfurSet = true; modPlayer.sulfurJump = true; - modPlayer.rogueStealthMax += 1f; + modPlayer.rogueStealthMax += 0.95f; modPlayer.wearingRogueArmor = true; player.ignoreWater = true; } public override void UpdateEquip(Player player) { - player.Calamity().throwingDamage += 0.08f; + player.Calamity().throwingDamage += 0.04f; player.Calamity().throwingCrit += 2; player.gills = true; } diff --git a/Items/Armor/SulfurLeggings.cs b/Items/Armor/SulfurLeggings.cs index e67f26394c..94ec0b2f38 100644 --- a/Items/Armor/SulfurLeggings.cs +++ b/Items/Armor/SulfurLeggings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Sulphurous Leggings"); Tooltip.SetDefault("Movement speed increased by 10%\n" + - "Speed greatly increased while submerged in liquid"); + "Movement speed increased by 35% while submerged in liquid"); } public override void SetDefaults() @@ -22,17 +22,13 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 0, 0); - item.defense = 6; - item.rare = 2; + item.defense = 5; + item.rare = ItemRarityID.Green; } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.10f; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.moveSpeed += 0.6f; - } + player.moveSpeed += Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 0.35f : 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/TarragonHelm.cs b/Items/Armor/TarragonHelm.cs index 92116f98ca..d124b99c40 100644 --- a/Items/Armor/TarragonHelm.cs +++ b/Items/Armor/TarragonHelm.cs @@ -61,9 +61,11 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMelee = true; + player.aggro += 800; string hotkey = CalamityMod.TarraHotKey.TooltipHotkeyString(); player.setBonus = "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + + "Enemies are more likely to target you\n" + "You have a 25% chance to gain a life regen buff when you take damage\n" + "Press " + hotkey + " to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds\n" + "This has a 30 second cooldown"; diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index ce0d17de40..fba0ddf305 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Reduces enemy spawn rates\n" + "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + - "After every 25 rogue critical hits you will gain 5 seconds of damage immunity\n" + + "After every 25 rogue critical hits you will gain 3 seconds of damage immunity\n" + "This effect can only occur once every 30 seconds\n" + "While under the effects of a debuff you gain 10% increased rogue damage\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 115\n" + diff --git a/Items/Armor/TarragonHornedHelm.cs b/Items/Armor/TarragonHornedHelm.cs index 0b2bf601cc..4417928680 100644 --- a/Items/Armor/TarragonHornedHelm.cs +++ b/Items/Armor/TarragonHornedHelm.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Tarragon Horned Helm"); Tooltip.SetDefault("Temporary immunity to lava\n" + "Can move freely through liquids\n" + - "5% increased damage reduction and +3 max minions"); + "5% increased damage reduction and minion damage"); } public override void SetDefaults() @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Armor { if (line2.mod == "Terraria" && line2.Name == "Tooltip2") { - line2.text = "5% increased damage reduction and +3 max minions\n" + + line2.text = "5% increased damage reduction\n" + "Provides heat protection in Death Mode"; } } @@ -59,19 +59,20 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraSummon = true; - player.setBonus = "55% increased minion damage\n" + + player.setBonus = "50% increased minion damage and +3 max minions\n" + "Reduces enemy spawn rates\n" + "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.55f; - } + player.minionDamage += 0.5f; + player.maxMinions += 3; + } public override void UpdateEquip(Player player) { - player.maxMinions += 3; player.endurance += 0.05f; - player.lavaMax += 240; + player.minionDamage += 0.05f; + player.lavaMax += 240; player.ignoreWater = true; } diff --git a/Items/Armor/TarragonLeggings.cs b/Items/Armor/TarragonLeggings.cs index 486fdeee85..82ccae4175 100644 --- a/Items/Armor/TarragonLeggings.cs +++ b/Items/Armor/TarragonLeggings.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Tarragon Leggings"); Tooltip.SetDefault("Leggings of a fabled explorer\n" + - "20% increased movement speed; 35% increase when below half health\n" + + "15% increased movement speed\n" + "6% increased damage and critical strike chance"); } @@ -27,11 +27,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.moveSpeed += 0.20f; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { - player.moveSpeed += 0.15f; - } + player.moveSpeed += 0.15f; player.allDamage += 0.06f; player.Calamity().AllCritBoost(6); } diff --git a/Items/Armor/TarragonVisage.cs b/Items/Armor/TarragonVisage.cs index acf2a59ff7..f236ffe489 100644 --- a/Items/Armor/TarragonVisage.cs +++ b/Items/Armor/TarragonVisage.cs @@ -63,8 +63,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Reduces enemy spawn rates\n" + "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + - "Ranged critical strikes will cause an explosion of leaves\n" + - "Ranged projectiles have a chance to split into life energy on death by hitting an enemy"; + "Ranged projectiles split into homing life energy and leaves on death"; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/TitanHeartBoots.cs b/Items/Armor/TitanHeartBoots.cs index 6f5db48111..6608ce6518 100644 --- a/Items/Armor/TitanHeartBoots.cs +++ b/Items/Armor/TitanHeartBoots.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 14; } diff --git a/Items/Armor/TitanHeartMantle.cs b/Items/Armor/TitanHeartMantle.cs index f90199d1db..81e65adc99 100644 --- a/Items/Armor/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeartMantle.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 17; } diff --git a/Items/Armor/TitanHeartMask.cs b/Items/Armor/TitanHeartMask.cs index c427c49faf..707522216e 100644 --- a/Items/Armor/TitanHeartMask.cs +++ b/Items/Armor/TitanHeartMask.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.defense = 12; //43 } @@ -33,17 +33,19 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "20% increased rogue damage and knockback\n" + + player.setBonus = "15% increased rogue damage and knockback\n" + "Stealth strikes deal double knockback and cause an astral explosion\n" + + "Grants immunity to knockback\n" + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.titanHeartSet = true; - modPlayer.throwingDamage += 0.2f; + modPlayer.throwingDamage += 0.15f; modPlayer.rogueStealthMax += 1f; modPlayer.wearingRogueArmor = true; + player.noKnockback = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/UmbraphileBoots.cs b/Items/Armor/UmbraphileBoots.cs index 85b691ee5d..2c13d42710 100644 --- a/Items/Armor/UmbraphileBoots.cs +++ b/Items/Armor/UmbraphileBoots.cs @@ -20,15 +20,14 @@ namespace CalamityMod.Items.Armor item.width = 22; item.height = 18; item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 12; } public override void UpdateEquip(Player player) { player.moveSpeed += 0.3f; - player.Calamity().throwingDamage += 0.12f; - player.Calamity().throwingVelocity += 0.12f; + player.Calamity().throwingDamage += 0.09f; player.Calamity().throwingCrit += 6; } diff --git a/Items/Armor/UmbraphileHood.cs b/Items/Armor/UmbraphileHood.cs index c63be0bc80..d4edd7eb06 100644 --- a/Items/Armor/UmbraphileHood.cs +++ b/Items/Armor/UmbraphileHood.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 22; item.height = 20; item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 8; //36 } diff --git a/Items/Armor/UmbraphileRegalia.cs b/Items/Armor/UmbraphileRegalia.cs index c8545e1b95..e501bfcb7e 100644 --- a/Items/Armor/UmbraphileRegalia.cs +++ b/Items/Armor/UmbraphileRegalia.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 38; item.height = 26; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.defense = 16; } diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs index dbb1c899ec..edc4569ad4 100644 --- a/Items/Armor/Vanity/AnahitaMask.cs +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs index a88e439438..c2991de7a5 100644 --- a/Items/Armor/Vanity/AncientGodSlayerHelm.cs +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] diff --git a/Items/Armor/Vanity/ApronOfAffection.cs b/Items/Armor/Vanity/ApronOfAffection.cs index ae2fb745c8..618659cf46 100644 --- a/Items/Armor/Vanity/ApronOfAffection.cs +++ b/Items/Armor/Vanity/ApronOfAffection.cs @@ -17,9 +17,11 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 18; item.height = 18; - item.rare = 5; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(0, 15, 0, 0); + + item.value = Item.sellPrice(gold: 2); + item.rare = ItemRarityID.Blue; + item.Calamity().donorItem = true; + item.vanity = true; } diff --git a/Items/Armor/Vanity/AquaticScourgeMask.cs b/Items/Armor/Vanity/AquaticScourgeMask.cs index 507e794e0c..c7b6839d0b 100644 --- a/Items/Armor/Vanity/AquaticScourgeMask.cs +++ b/Items/Armor/Vanity/AquaticScourgeMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/AshenHorns.cs b/Items/Armor/Vanity/AshenHorns.cs new file mode 100644 index 0000000000..ef4b0359fe --- /dev/null +++ b/Items/Armor/Vanity/AshenHorns.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class AshenHorns : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Ashen Horns"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = true; + } + } +} diff --git a/Items/Armor/Vanity/AshenHorns.png b/Items/Armor/Vanity/AshenHorns.png new file mode 100644 index 0000000000..0085c11cf3 Binary files /dev/null and b/Items/Armor/Vanity/AshenHorns.png differ diff --git a/Items/Armor/Vanity/AshenHorns_Head.png b/Items/Armor/Vanity/AshenHorns_Head.png new file mode 100644 index 0000000000..12cc0083ee Binary files /dev/null and b/Items/Armor/Vanity/AshenHorns_Head.png differ diff --git a/Items/Armor/Vanity/AstrumDeusMask.cs b/Items/Armor/Vanity/AstrumDeusMask.cs index e369703ce3..e0d8a13632 100644 --- a/Items/Armor/Vanity/AstrumDeusMask.cs +++ b/Items/Armor/Vanity/AstrumDeusMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/AureusMask.cs b/Items/Armor/Vanity/AureusMask.cs index 138ad7c2d8..47b8e9e753 100644 --- a/Items/Armor/Vanity/AureusMask.cs +++ b/Items/Armor/Vanity/AureusMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 30; item.height = 28; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.cs b/Items/Armor/Vanity/BrimstoneWaifuMask.cs index 3dbfed96c5..dd0ddbb7af 100644 --- a/Items/Armor/Vanity/BrimstoneWaifuMask.cs +++ b/Items/Armor/Vanity/BrimstoneWaifuMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 30; item.height = 28; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/BumblefuckMask.cs b/Items/Armor/Vanity/BumblefuckMask.cs index 729a5a9ad9..a970d4a275 100644 --- a/Items/Armor/Vanity/BumblefuckMask.cs +++ b/Items/Armor/Vanity/BumblefuckMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/CalamitasMask.cs b/Items/Armor/Vanity/CalamitasMask.cs index fc21c32110..36e0471e94 100644 --- a/Items/Armor/Vanity/CalamitasMask.cs +++ b/Items/Armor/Vanity/CalamitasMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/CeaselessVoidMask.cs b/Items/Armor/Vanity/CeaselessVoidMask.cs index 6dbd98e9c5..a1264918db 100644 --- a/Items/Armor/Vanity/CeaselessVoidMask.cs +++ b/Items/Armor/Vanity/CeaselessVoidMask.cs @@ -1,4 +1,5 @@ using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Armor.Vanity { @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/CrabulonMask.cs b/Items/Armor/Vanity/CrabulonMask.cs index 2ef20c0217..ea5c626239 100644 --- a/Items/Armor/Vanity/CrabulonMask.cs +++ b/Items/Armor/Vanity/CrabulonMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/CryogenMask.cs b/Items/Armor/Vanity/CryogenMask.cs index 104917bac2..9ecae4a9e6 100644 --- a/Items/Armor/Vanity/CryogenMask.cs +++ b/Items/Armor/Vanity/CryogenMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/DesertScourgeMask.cs b/Items/Armor/Vanity/DesertScourgeMask.cs index 0431c9882c..7edd4ed383 100644 --- a/Items/Armor/Vanity/DesertScourgeMask.cs +++ b/Items/Armor/Vanity/DesertScourgeMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/DevourerofGodsMask.cs b/Items/Armor/Vanity/DevourerofGodsMask.cs index 08dc872707..f453926bb1 100644 --- a/Items/Armor/Vanity/DevourerofGodsMask.cs +++ b/Items/Armor/Vanity/DevourerofGodsMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/GodSlayerHornedHelm.cs b/Items/Armor/Vanity/GodSlayerHornedHelm.cs new file mode 100644 index 0000000000..df2f4463cf --- /dev/null +++ b/Items/Armor/Vanity/GodSlayerHornedHelm.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerHornedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Horned Helm"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.vanity = true; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/GodSlayerHornedHelm.png b/Items/Armor/Vanity/GodSlayerHornedHelm.png similarity index 100% rename from Items/Armor/GodSlayerHornedHelm.png rename to Items/Armor/Vanity/GodSlayerHornedHelm.png diff --git a/Items/Armor/GodSlayerHornedHelm_Head.png b/Items/Armor/Vanity/GodSlayerHornedHelm_Head.png similarity index 100% rename from Items/Armor/GodSlayerHornedHelm_Head.png rename to Items/Armor/Vanity/GodSlayerHornedHelm_Head.png diff --git a/Items/Armor/GodSlayerHornedHelm_HeadGlow.png b/Items/Armor/Vanity/GodSlayerHornedHelm_HeadGlow.png similarity index 100% rename from Items/Armor/GodSlayerHornedHelm_HeadGlow.png rename to Items/Armor/Vanity/GodSlayerHornedHelm_HeadGlow.png diff --git a/Items/Armor/Vanity/GodSlayerVisage.cs b/Items/Armor/Vanity/GodSlayerVisage.cs new file mode 100644 index 0000000000..5a4c5440ac --- /dev/null +++ b/Items/Armor/Vanity/GodSlayerVisage.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class GodSlayerVisage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("God Slayer Visage"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 75, 0, 0); + item.vanity = true; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/GodSlayerVisage.png b/Items/Armor/Vanity/GodSlayerVisage.png similarity index 100% rename from Items/Armor/GodSlayerVisage.png rename to Items/Armor/Vanity/GodSlayerVisage.png diff --git a/Items/Armor/GodSlayerVisage_Head.png b/Items/Armor/Vanity/GodSlayerVisage_Head.png similarity index 100% rename from Items/Armor/GodSlayerVisage_Head.png rename to Items/Armor/Vanity/GodSlayerVisage_Head.png diff --git a/Items/Armor/GodSlayerVisage_HeadGlow.png b/Items/Armor/Vanity/GodSlayerVisage_HeadGlow.png similarity index 100% rename from Items/Armor/GodSlayerVisage_HeadGlow.png rename to Items/Armor/Vanity/GodSlayerVisage_HeadGlow.png diff --git a/Items/Armor/Vanity/HiveMindMask.cs b/Items/Armor/Vanity/HiveMindMask.cs index 3ad5b3e36d..cb228538d6 100644 --- a/Items/Armor/Vanity/HiveMindMask.cs +++ b/Items/Armor/Vanity/HiveMindMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/LeviathanMask.cs b/Items/Armor/Vanity/LeviathanMask.cs index 533820e7fb..91f478362e 100644 --- a/Items/Armor/Vanity/LeviathanMask.cs +++ b/Items/Armor/Vanity/LeviathanMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/OldDukeMask.cs b/Items/Armor/Vanity/OldDukeMask.cs index 691fb1a2aa..c28b303826 100644 --- a/Items/Armor/Vanity/OldDukeMask.cs +++ b/Items/Armor/Vanity/OldDukeMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/PerforatorMask.cs b/Items/Armor/Vanity/PerforatorMask.cs index b8bd1646e2..c8fbc3da6c 100644 --- a/Items/Armor/Vanity/PerforatorMask.cs +++ b/Items/Armor/Vanity/PerforatorMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs index 37fc7de0a0..eae2440ad2 100644 --- a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs +++ b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/PolterghastMask.cs b/Items/Armor/Vanity/PolterghastMask.cs index e1aab7801d..b09662d202 100644 --- a/Items/Armor/Vanity/PolterghastMask.cs +++ b/Items/Armor/Vanity/PolterghastMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/ProfanedGuardianMask.cs b/Items/Armor/Vanity/ProfanedGuardianMask.cs index ccab43ca41..9c6a2f2d00 100644 --- a/Items/Armor/Vanity/ProfanedGuardianMask.cs +++ b/Items/Armor/Vanity/ProfanedGuardianMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/ProvidenceMask.cs b/Items/Armor/Vanity/ProvidenceMask.cs index f4eaba955e..ba1350ea7a 100644 --- a/Items/Armor/Vanity/ProvidenceMask.cs +++ b/Items/Armor/Vanity/ProvidenceMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/RavagerMask.cs b/Items/Armor/Vanity/RavagerMask.cs index 9d007ff5c8..02f0e71a0b 100644 --- a/Items/Armor/Vanity/RavagerMask.cs +++ b/Items/Armor/Vanity/RavagerMask.cs @@ -1,4 +1,5 @@ using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Armor.Vanity { @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/SCalBoots.cs b/Items/Armor/Vanity/SCalBoots.cs new file mode 100644 index 0000000000..5557bb0bdc --- /dev/null +++ b/Items/Armor/Vanity/SCalBoots.cs @@ -0,0 +1,19 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class SCalBoots : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Boots"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + } +} diff --git a/Items/Armor/Vanity/SCalBoots.png b/Items/Armor/Vanity/SCalBoots.png new file mode 100644 index 0000000000..2c4283bcd3 Binary files /dev/null and b/Items/Armor/Vanity/SCalBoots.png differ diff --git a/Items/Armor/Vanity/SCalBoots_Legs.png b/Items/Armor/Vanity/SCalBoots_Legs.png new file mode 100644 index 0000000000..867d3c73ea Binary files /dev/null and b/Items/Armor/Vanity/SCalBoots_Legs.png differ diff --git a/Items/Armor/Vanity/SCalMask.cs b/Items/Armor/Vanity/SCalMask.cs new file mode 100644 index 0000000000..b5776465da --- /dev/null +++ b/Items/Armor/Vanity/SCalMask.cs @@ -0,0 +1,21 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class SCalMask : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Hood"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/SCalMask.png b/Items/Armor/Vanity/SCalMask.png new file mode 100644 index 0000000000..bdb80ee25a Binary files /dev/null and b/Items/Armor/Vanity/SCalMask.png differ diff --git a/Items/Armor/Vanity/SCalMask_Head.png b/Items/Armor/Vanity/SCalMask_Head.png new file mode 100644 index 0000000000..818608cb43 Binary files /dev/null and b/Items/Armor/Vanity/SCalMask_Head.png differ diff --git a/Items/Armor/Vanity/SCalRobes.cs b/Items/Armor/Vanity/SCalRobes.cs new file mode 100644 index 0000000000..912ca647e9 --- /dev/null +++ b/Items/Armor/Vanity/SCalRobes.cs @@ -0,0 +1,19 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class SCalRobes : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Robes"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + } +} diff --git a/Items/Armor/Vanity/SCalRobes.png b/Items/Armor/Vanity/SCalRobes.png new file mode 100644 index 0000000000..3ddf36518f Binary files /dev/null and b/Items/Armor/Vanity/SCalRobes.png differ diff --git a/Items/Armor/Vanity/SCalRobes_Arms.png b/Items/Armor/Vanity/SCalRobes_Arms.png new file mode 100644 index 0000000000..9e678c9974 Binary files /dev/null and b/Items/Armor/Vanity/SCalRobes_Arms.png differ diff --git a/Items/Armor/Vanity/SCalRobes_Body.png b/Items/Armor/Vanity/SCalRobes_Body.png new file mode 100644 index 0000000000..facccaeb4b Binary files /dev/null and b/Items/Armor/Vanity/SCalRobes_Body.png differ diff --git a/Items/Armor/Vanity/SignusMask.cs b/Items/Armor/Vanity/SignusMask.cs index 7705bfa90e..e7c7ceca71 100644 --- a/Items/Armor/Vanity/SignusMask.cs +++ b/Items/Armor/Vanity/SignusMask.cs @@ -1,4 +1,5 @@ using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Armor.Vanity { @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/SilvaHelm.cs b/Items/Armor/Vanity/SilvaHelm.cs new file mode 100644 index 0000000000..8b6b553444 --- /dev/null +++ b/Items/Armor/Vanity/SilvaHelm.cs @@ -0,0 +1,35 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Helm"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 20; + item.value = Item.buyPrice(0, 90, 0, 0); + item.vanity = true; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/SilvaHelm.png b/Items/Armor/Vanity/SilvaHelm.png similarity index 100% rename from Items/Armor/SilvaHelm.png rename to Items/Armor/Vanity/SilvaHelm.png diff --git a/Items/Armor/SilvaHelm_Head.png b/Items/Armor/Vanity/SilvaHelm_Head.png similarity index 100% rename from Items/Armor/SilvaHelm_Head.png rename to Items/Armor/Vanity/SilvaHelm_Head.png diff --git a/Items/Armor/Vanity/SilvaHornedHelm.cs b/Items/Armor/Vanity/SilvaHornedHelm.cs new file mode 100644 index 0000000000..f6bcf19be1 --- /dev/null +++ b/Items/Armor/Vanity/SilvaHornedHelm.cs @@ -0,0 +1,35 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaHornedHelm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Horned Helm"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 24; + item.value = Item.buyPrice(0, 90, 0, 0); + item.vanity = true; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/SilvaHornedHelm.png b/Items/Armor/Vanity/SilvaHornedHelm.png similarity index 100% rename from Items/Armor/SilvaHornedHelm.png rename to Items/Armor/Vanity/SilvaHornedHelm.png diff --git a/Items/Armor/SilvaHornedHelm_Head.png b/Items/Armor/Vanity/SilvaHornedHelm_Head.png similarity index 100% rename from Items/Armor/SilvaHornedHelm_Head.png rename to Items/Armor/Vanity/SilvaHornedHelm_Head.png diff --git a/Items/Armor/Vanity/SilvaMask.cs b/Items/Armor/Vanity/SilvaMask.cs new file mode 100644 index 0000000000..7c990f5ef6 --- /dev/null +++ b/Items/Armor/Vanity/SilvaMask.cs @@ -0,0 +1,35 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class SilvaMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silva Mask"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.value = Item.buyPrice(0, 90, 0, 0); + item.vanity = true; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void ArmorSetShadows(Player player) + { + player.armorEffectDrawShadow = true; + } + } +} diff --git a/Items/Armor/SilvaMask.png b/Items/Armor/Vanity/SilvaMask.png similarity index 100% rename from Items/Armor/SilvaMask.png rename to Items/Armor/Vanity/SilvaMask.png diff --git a/Items/Armor/SilvaMask_Head.png b/Items/Armor/Vanity/SilvaMask_Head.png similarity index 100% rename from Items/Armor/SilvaMask_Head.png rename to Items/Armor/Vanity/SilvaMask_Head.png diff --git a/Items/Armor/Vanity/SlimeGodMask.cs b/Items/Armor/Vanity/SlimeGodMask.cs index e23f0fbb9b..f61e00dc66 100644 --- a/Items/Armor/Vanity/SlimeGodMask.cs +++ b/Items/Armor/Vanity/SlimeGodMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/SlimeGodMask2.cs b/Items/Armor/Vanity/SlimeGodMask2.cs index cdb90af889..a9479de988 100644 --- a/Items/Armor/Vanity/SlimeGodMask2.cs +++ b/Items/Armor/Vanity/SlimeGodMask2.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/StormWeaverMask.cs b/Items/Armor/Vanity/StormWeaverMask.cs index 229a902909..d0480e7bdc 100644 --- a/Items/Armor/Vanity/StormWeaverMask.cs +++ b/Items/Armor/Vanity/StormWeaverMask.cs @@ -1,4 +1,5 @@ using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Armor.Vanity { @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/Vanity/YharonMask.cs b/Items/Armor/Vanity/YharonMask.cs index 1bff6602cd..03b3d8e90a 100644 --- a/Items/Armor/Vanity/YharonMask.cs +++ b/Items/Armor/Vanity/YharonMask.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] @@ -13,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity { item.width = 28; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.vanity = true; } diff --git a/Items/Armor/VictideBreastplate.cs b/Items/Armor/VictideBreastplate.cs index 00312c7750..ac416cfe2e 100644 --- a/Items/Armor/VictideBreastplate.cs +++ b/Items/Armor/VictideBreastplate.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Victide Breastplate"); Tooltip.SetDefault("5% increased damage reduction and critical strike chance\n" + - "Defense increased while submerged in liquid"); + "+5 defense and 10% increased damage reduction while submerged in liquid"); } public override void SetDefaults() @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 5; //9 } diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index 6cf8618ca4..a0ec7969ce 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 3; //10 } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Increased life regen and rogue damage while submerged in liquid\n" + + player.setBonus = "+3 life regen and 10% increased rogue damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + diff --git a/Items/Armor/VictideHelm.cs b/Items/Armor/VictideHelm.cs index 786d277b0b..2b5f34be26 100644 --- a/Items/Armor/VictideHelm.cs +++ b/Items/Armor/VictideHelm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 4; //11 } @@ -31,7 +31,8 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Increased life regen and melee damage while submerged in liquid\n" + + player.setBonus = "Enemies are more likely to target you\n" + + "+3 life regen and 10% increased melee damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; @@ -43,6 +44,7 @@ namespace CalamityMod.Items.Armor player.meleeDamage += 0.1f; player.lifeRegen += 3; } + player.aggro += 200; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 55b19a5e9c..757c5ba1f1 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Victide Helmet"); - Tooltip.SetDefault("9% increased minion damage\n" + - "+1 max minion"); + Tooltip.SetDefault("10% increased minion damage"); } public override void SetDefaults() @@ -23,7 +22,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 1; //8 } @@ -34,15 +33,17 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Increased life regen and minion damage while submerged in liquid\n" + + player.setBonus = "+3 life regen and 10% increased minion damage while submerged in liquid\n" + "Summons a sea urchin to protect you\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + - "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; + "Provides increased underwater mobility and slightly reduces breath loss in the abyss\n" + + "+1 max minion"; CalamityPlayer modPlayer = player.Calamity(); modPlayer.victideSet = true; modPlayer.urchin = true; - if (player.whoAmI == Main.myPlayer) + player.maxMinions++; + if (player.whoAmI == Main.myPlayer) { if (player.FindBuffIndex(ModContent.BuffType()) == -1) { @@ -63,8 +64,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.minionDamage += 0.09f; - player.maxMinions++; + player.minionDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/VictideLeggings.cs b/Items/Armor/VictideLeggings.cs index 6a9b2fc296..f52959f53a 100644 --- a/Items/Armor/VictideLeggings.cs +++ b/Items/Armor/VictideLeggings.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Victide Leggings"); Tooltip.SetDefault("Movement speed increased by 8%\n" + - "Speed greatly increased while submerged in liquid"); + "Movement speed increased by 30% while submerged in liquid"); } public override void SetDefaults() @@ -20,17 +20,13 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 4; //9 } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.08f; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.moveSpeed += 0.5f; - } + player.moveSpeed += Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 0.3f : 0.08f; } public override void AddRecipes() diff --git a/Items/Armor/VictideMask.cs b/Items/Armor/VictideMask.cs index e1852913c2..67003100a3 100644 --- a/Items/Armor/VictideMask.cs +++ b/Items/Armor/VictideMask.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 2; //9 } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Increased life regen and magic damage while submerged in liquid\n" + + player.setBonus = "+3 life regen and 10% increased magic damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; diff --git a/Items/Armor/VictideVisage.cs b/Items/Armor/VictideVisage.cs index 98dc42a033..10b87070a8 100644 --- a/Items/Armor/VictideVisage.cs +++ b/Items/Armor/VictideVisage.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 1, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.defense = 3; //10 } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "Increased life regen and ranged damage while submerged in liquid\n" + + player.setBonus = "+3 life regen and 10% increased ranged damage while submerged in liquid\n" + "When using any weapon you have a 10% chance to throw a returning seashell projectile\n" + "This seashell does true damage and does not benefit from any damage class\n" + "Provides increased underwater mobility and slightly reduces breath loss in the abyss"; diff --git a/Items/Armor/WulfrumArmor.cs b/Items/Armor/WulfrumArmor.cs index a310356c7a..89be15b7d2 100644 --- a/Items/Armor/WulfrumArmor.cs +++ b/Items/Armor/WulfrumArmor.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 2; } diff --git a/Items/Armor/WulfrumHeadgear.cs b/Items/Armor/WulfrumHeadgear.cs index 9d4dabb104..d68bad61d0 100644 --- a/Items/Armor/WulfrumHeadgear.cs +++ b/Items/Armor/WulfrumHeadgear.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Headgear"); - Tooltip.SetDefault("3% increased ranged damage"); + Tooltip.SetDefault("10% increased ranged damage"); } public override void SetDefaults() @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 2; //7 } @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.rangedDamage += 0.03f; + player.rangedDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/WulfrumHelm.cs b/Items/Armor/WulfrumHelm.cs index 8aa0a192c9..ab3d00f6c9 100644 --- a/Items/Armor/WulfrumHelm.cs +++ b/Items/Armor/WulfrumHelm.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Helm"); - Tooltip.SetDefault("3% increased melee damage"); + Tooltip.SetDefault("10% increased melee damage"); } public override void SetDefaults() @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 3; //8 } @@ -30,18 +30,20 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "+3 defense\n" + + player.setBonus = "Enemies are more likely to target you\n" + + "+3 defense\n" + "+5 defense when below 50% life"; player.statDefense += 3; //11 - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.statDefense += 5; //16 } + player.aggro += 100; } public override void UpdateEquip(Player player) { - player.meleeDamage += 0.03f; + player.meleeDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/WulfrumHelmet.cs b/Items/Armor/WulfrumHelmet.cs index 39e6910971..a67ed7e7ea 100644 --- a/Items/Armor/WulfrumHelmet.cs +++ b/Items/Armor/WulfrumHelmet.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Helmet"); - Tooltip.SetDefault("6% increased minion damage\n" + - "+1 max minion"); + Tooltip.SetDefault("10% increased minion damage"); } public override void SetDefaults() @@ -20,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override bool IsArmorSet(Item head, Item body, Item legs) @@ -30,10 +29,11 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - player.setBonus = "+3 defense\n" + + player.setBonus = "+3 defense and +1 max minion\n" + "+5 defense when below 50% life"; player.statDefense += 3; //8 - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + player.maxMinions++; + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.statDefense += 5; //13 } @@ -41,8 +41,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.minionDamage += 0.06f; - player.maxMinions++; + player.minionDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/WulfrumHood.cs b/Items/Armor/WulfrumHood.cs index d4545c7960..8cabc9225c 100644 --- a/Items/Armor/WulfrumHood.cs +++ b/Items/Armor/WulfrumHood.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Visage"); - Tooltip.SetDefault("3% increased magic damage"); + Tooltip.SetDefault("10% increased magic damage"); } public override void SetDefaults() @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 1; //6 } @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.magicDamage += 0.03f; + player.magicDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/WulfrumLeggings.cs b/Items/Armor/WulfrumLeggings.cs index bf591c7ff6..1b8b6b7e25 100644 --- a/Items/Armor/WulfrumLeggings.cs +++ b/Items/Armor/WulfrumLeggings.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 25, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 1; } diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index 518a9ec763..7390127864 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Mask"); - Tooltip.SetDefault("3% increased rogue damage"); + Tooltip.SetDefault("10% increased rogue damage"); } public override void SetDefaults() @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 0, 75, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.defense = 1; //6 } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.Calamity().throwingDamage += 0.03f; + player.Calamity().throwingDamage += 0.1f; } public override void AddRecipes() diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index 6a568d2d42..9c5288e566 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 24; } diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 15e13c5c86..8e2db93ce2 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Empyrean Mask"); Tooltip.SetDefault("Wrath of the cosmos\n" + - "11% increased rogue damage and critical strike chance, 22% increased movement speed\n" + + "11% increased rogue damage and critical strike chance, 20% increased movement speed\n" + "Temporary immunity to lava"); } @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 20; //71 } @@ -82,7 +82,7 @@ namespace CalamityMod.Items.Armor { player.Calamity().throwingDamage += 0.11f; player.Calamity().throwingCrit += 11; - player.moveSpeed += 0.22f; + player.moveSpeed += 0.2f; player.lavaMax += 240; } diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index 93da93177a..e0fa88129c 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Empyrean Cloak"); Tooltip.SetDefault("Armor of the cosmos\n" + "+20 max life\n" + - "6% increased movement speed\n" + "7% increased rogue damage and critical strike chance"); } @@ -22,14 +21,13 @@ namespace CalamityMod.Items.Armor item.width = 18; item.height = 18; item.value = Item.buyPrice(0, 32, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.defense = 27; } public override void UpdateEquip(Player player) { player.statLifeMax2 += 20; - player.moveSpeed += 0.06f; player.Calamity().throwingCrit += 7; player.Calamity().throwingDamage += 0.07f; } diff --git a/Items/BleachBall.cs b/Items/BleachBall.cs new file mode 100644 index 0000000000..a0765d209a --- /dev/null +++ b/Items/BleachBall.cs @@ -0,0 +1,39 @@ +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Materials; + +namespace CalamityMod.Items +{ + public class BleachBall : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bleach Ball"); + Tooltip.SetDefault("Favorite this item to prevent the Aquatic Scourge from naturally spawning near you"); + } + public override void SetDefaults() + { + item.width = 38; + item.height = 46; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + } + + public override void UpdateInventory(Player player) + { + 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(); + } + } +} diff --git a/Items/BleachBall.png b/Items/BleachBall.png new file mode 100644 index 0000000000..cc52ffbee6 Binary files /dev/null and b/Items/BleachBall.png differ diff --git a/Items/BrimstoneKey.cs b/Items/BrimstoneKey.cs index d1a712f54a..0211a6e129 100644 --- a/Items/BrimstoneKey.cs +++ b/Items/BrimstoneKey.cs @@ -1,4 +1,6 @@ using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Items { public class BrimstoneKey : ModItem @@ -14,7 +16,7 @@ namespace CalamityMod.Items item.height = 20; item.maxStack = 1; item.value = 100; - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs new file mode 100644 index 0000000000..d30495e93c --- /dev/null +++ b/Items/BrimstoneLocus.cs @@ -0,0 +1,35 @@ +using CalamityMod.Items.Materials; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class BrimstoneLocus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Locus"); + Tooltip.SetDefault("Not only can I enhance your equipment with potent magic, I can also draw out the true strength and ascend\n" + + "some of your weaponry to entirely new forms\n" + + "Such items are revealed while this item is in your inventory"); + } + + public override void SetDefaults() + { + 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(); + } + } +} diff --git a/Items/BrimstoneLocus.png b/Items/BrimstoneLocus.png new file mode 100644 index 0000000000..4f08d4e2d2 Binary files /dev/null and b/Items/BrimstoneLocus.png differ diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index a064cef093..26622ee4df 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -10,19 +10,19 @@ namespace CalamityMod.Items public override void SetStaticDefaults() { DisplayName.SetDefault("Broken Water Filter"); - Tooltip.SetDefault("Disables natural Acid Rain spawns"); + Tooltip.SetDefault("Favorite this item to disable natural Acid Rain spawns"); } public override void SetDefaults() { item.width = 32; item.height = 34; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void UpdateInventory(Player player) { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.noStupidNaturalARSpawns = true; + if (item.favorited) + player.Calamity().noStupidNaturalARSpawns = true; } public override void AddRecipes() { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index f43e2fbb45..60996feb83 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1,20 +1,15 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items.Accessories; -using CalamityMod.Items.DifficultyItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.PermanentBoosters; -using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Potions; -using CalamityMod.Items.Tools; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Other; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -22,12 +17,12 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,49 +30,72 @@ using Terraria.ModLoader.IO; namespace CalamityMod.Items { - public class CalamityGlobalItem : GlobalItem + public partial class CalamityGlobalItem : GlobalItem { - #region Instances - public override bool InstancePerEntity - { - get - { - return true; - } - } - - public override bool CloneNewInstances - { - get - { - return true; - } - } - #endregion + public override bool InstancePerEntity => true; + public override bool CloneNewInstances => true; public bool rogue = false; public float StealthGenBonus; - public int timesUsed = 0; - - // The damage modifications for the item are handled in player files. - public int CurrentCharge; - public bool Chargeable = false; - public int ChargeMax; - public const float ChargeDamageMinMultiplier = 0.75f; - public const float ChargeDamageReductionThreshold = 0.75f; - - // Rarity is provided both as the classic int and the new enum. - public CalamityRarity customRarity = CalamityRarity.NoEffect; - public int postMoonLordRarity + #region Chargeable Item Variables + public bool UsesCharge = false; + public float Charge = 0f; + public float MaxCharge = 1f; + public float ChargePerUse = 0f; + // If left at the default value of -1, ChargePerUse is automatically used for alt fire. + // If you want a different amount of charge used for alt fire, then set a different value here. + public float ChargePerAltUse = -1f; + public float ChargeRatio { - get => (int)customRarity; - set => customRarity = (CalamityRarity)value; + get + { + float ratio = Charge / MaxCharge; + return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f); + } } + #endregion - ///See RogueWeapon.cs for rogue modifier shit - #region Modifiers - public CalamityGlobalItem() + #region Enchantment Variables + public Enchantment? AppliedEnchantment = null; + public float DischargeEnchantExhaustion = 0; + public float DischargeExhaustionRatio + { + get + { + float ratio = DischargeEnchantExhaustion / DischargeEnchantExhaustionCap; + return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f); + } + } + public const float DischargeEnchantExhaustionCap = 1600f; + public const float DischargeEnchantMinDamageFactor = 0.77f; + public const float DischargeEnchantMaxDamageFactor = 1.26f; + #endregion + + // Miscellaneous stuff + public CalamityRarity customRarity = CalamityRarity.NoEffect; + public int timesUsed = 0; + public int reforgeTier = 0; + public bool donorItem = false; + public bool devItem = false; + public bool challengeDrop = false; + public bool canFirePointBlankShots = false; + + public static readonly Color[] ExoPalette = new Color[] + { + new Color(250, 255, 112), + new Color(211, 235, 108), + new Color(166, 240, 105), + new Color(105, 240, 220), + new Color(64, 130, 145), + new Color(145, 96, 145), + new Color(242, 112, 73), + new Color(199, 62, 62), + }; + + // See RogueWeapon.cs for rogue modifier shit + #region Modifiers + public CalamityGlobalItem() { StealthGenBonus = 1f; } @@ -86,6 +104,8 @@ namespace CalamityMod.Items { CalamityGlobalItem myClone = (CalamityGlobalItem)base.Clone(item, itemClone); myClone.StealthGenBonus = StealthGenBonus; + myClone.DischargeEnchantExhaustion = DischargeEnchantExhaustion; + myClone.Charge = Charge; return myClone; } @@ -99,193 +119,553 @@ namespace CalamityMod.Items #region SetDefaults public override void SetDefaults(Item item) { - item.Calamity().ChargeMax = ChargeMax; - if (customRarity.IsPostML() && item.rare != 10) - item.rare = 10; + // TODO -- Remove this in 1.4 with ModRarity. + // TODO -- Remove all instances of manually setting the rarity of postML items to Red. + if (customRarity.IsPostML() && item.rare != ItemRarityID.Purple) + item.rare = ItemRarityID.Purple; - if (item.maxStack == 99 || item.type == ItemID.Dynamite || item.type == ItemID.StickyDynamite || - item.type == ItemID.BouncyDynamite || item.type == ItemID.StickyBomb || item.type == ItemID.BouncyBomb) + if (item.maxStack == 99) item.maxStack = 999; - if (item.type == ItemID.PirateMap || item.type == ItemID.SnowGlobe) - item.maxStack = 20; + if (CalamityLists.useTurnList?.Contains(item.type) ?? false) + item.useTurn = true; - if (item.type >= ItemID.GreenSolution && item.type <= ItemID.RedSolution) - item.value = Item.buyPrice(0, 0, 5, 0); - - if (CalamityMod.weaponAutoreuseList?.Contains(item.type) ?? false) + if (CalamityLists.weaponAutoreuseList?.Contains(item.type) ?? false) item.autoReuse = true; - if (item.type == ItemID.PsychoKnife || item.type == ItemID.TaxCollectorsStickOfDoom) - item.damage *= 4; - else if (item.type == ItemID.SpectreStaff) - item.damage *= 3; - else if (CalamityMod.doubleDamageBuffList?.Contains(item.type) ?? false) - item.damage *= 2; - else if (item.type == ItemID.RainbowRod) - item.damage = (int)(item.damage * 1.75); - else if (CalamityMod.sixtySixDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 1.66); - else if (CalamityMod.fiftyDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 1.5); - else if (CalamityMod.thirtyThreeDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 1.33); - else if (CalamityMod.twentyFiveDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 1.25); - else if (CalamityMod.twentyDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 1.2); - else if (CalamityMod.tenDamageBuffList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 1.1); - else if (CalamityMod.tenDamageNerfList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 0.9); - else if (CalamityMod.quarterDamageNerfList?.Contains(item.type) ?? false) - item.damage = (int)(item.damage * 0.75); - else if (item.type == ItemID.BlizzardStaff) - item.damage = (int)(item.damage * 0.7); - else if (item.type == ItemID.LaserMachinegun) - item.damage = (int)(item.damage * 0.65); - else if (item.type == ItemID.StardustDragonStaff) - item.damage = (int)(item.damage * 0.5); + if (CalamityLists.fiftySizeBuffList?.Contains(item.type) ?? false) + item.scale = 1.5f; - if (item.type == ItemID.BookStaff) - item.mana = 10; - else if (item.type == ItemID.UnholyTrident) - item.mana = 14; - else if (item.type == ItemID.FrostStaff) - item.mana = 9; - else if (item.type == ItemID.BookofSkulls) - item.mana = 12; - else if (item.type == ItemID.BlizzardStaff) - item.mana = 7; - else if (item.type == ItemID.SolarFlareHelmet) //total defense pre-buff = 78 post-buff = 94 - item.defense = 29; //5 more defense - else if (item.type == ItemID.SolarFlareBreastplate) - item.defense = 41; //7 more defense - else if (item.type == ItemID.SolarFlareLeggings) - item.defense = 24; //4 more defense - else if (item.type == ItemID.GladiatorHelmet) //total defense pre-buff = 7 post-buff = 15 - item.defense = 3; //1 more defense - else if (item.type == ItemID.GladiatorBreastplate) - item.defense = 5; //2 more defense - else if (item.type == ItemID.GladiatorLeggings) - item.defense = 4; //2 more defense - else if (item.type == ItemID.HallowedPlateMail) //total defense pre-buff = 31, 50, 35 post-buff = 36, 55, 40 - item.defense = 18; //3 more defense - else if (item.type == ItemID.HallowedGreaves) - item.defense = 13; //2 more defense + if (CalamityLists.twentyUseTimeBuffList?.Contains(item.type) ?? false) + { + item.useTime = (int)(item.useTime * 0.8); + item.useAnimation = (int)(item.useAnimation * 0.8); + } - if (CalamityMod.noGravityList.Contains(item.type)) + switch (item.type) + { + // Point-blank shot weapons + case ItemID.WoodenBow: + case ItemID.BorealWoodBow: + case ItemID.PalmWoodBow: + case ItemID.RichMahoganyBow: + case ItemID.CopperBow: + case ItemID.TinBow: + case ItemID.ShadewoodBow: + case ItemID.EbonwoodBow: + case ItemID.IronBow: + case ItemID.LeadBow: + case ItemID.SilverBow: + case ItemID.TungstenBow: + case ItemID.GoldBow: + case ItemID.PlatinumBow: + case ItemID.DemonBow: + case ItemID.TendonBow: + case ItemID.MoltenFury: + case ItemID.BeesKnees: + case ItemID.HellwingBow: + case ItemID.FlareGun: + case ItemID.Minishark: + case ItemID.Blowpipe: + case ItemID.FlintlockPistol: + case ItemID.SnowballCannon: + case ItemID.Boomstick: + case ItemID.Revolver: + case ItemID.RedRyder: + case ItemID.Sandgun: + case ItemID.Musket: + case ItemID.TheUndertaker: + case ItemID.Blowgun: + //case ItemID.QuadBarrelShotgun: + case ItemID.Handgun: + case ItemID.PhoenixBlaster: + case ItemID.PainterPaintballGun: + case ItemID.Harpoon: + case ItemID.IceBow: + case ItemID.ShadowFlameBow: + case ItemID.Marrow: + case ItemID.PulseBow: + case ItemID.DD2PhoenixBow: + case ItemID.Tsunami: + //case ItemID.Eventide: + case ItemID.Phantasm: + case ItemID.CobaltRepeater: + case ItemID.PalladiumRepeater: + case ItemID.MythrilRepeater: + case ItemID.OrichalcumRepeater: + case ItemID.AdamantiteRepeater: + case ItemID.TitaniumRepeater: + case ItemID.HallowedRepeater: + case ItemID.ChlorophyteShotbow: + case ItemID.StakeLauncher: + case ItemID.ClockworkAssaultRifle: + case ItemID.Gatligator: + case ItemID.Shotgun: + case ItemID.OnyxBlaster: + case ItemID.Uzi: + case ItemID.DartRifle: + case ItemID.DartPistol: + case ItemID.Megashark: + case ItemID.VenusMagnum: + case ItemID.TacticalShotgun: + case ItemID.SniperRifle: + case ItemID.CandyCornRifle: + case ItemID.ChainGun: + case ItemID.VortexBeater: + case ItemID.SDMG: + canFirePointBlankShots = true; + break; + + case ItemID.Dynamite: + case ItemID.StickyDynamite: + case ItemID.BouncyDynamite: + case ItemID.StickyBomb: + case ItemID.BouncyBomb: + item.maxStack = 999; + break; + + case ItemID.BlueSolution: + case ItemID.DarkBlueSolution: + case ItemID.GreenSolution: + case ItemID.PurpleSolution: + case ItemID.RedSolution: + item.value = Item.buyPrice(0, 0, 5, 0); + break; + + // Increase Pirate Map and Snow Globe stacks to 20 + case ItemID.PirateMap: + case ItemID.SnowGlobe: + item.maxStack = 20; + break; + + // Set Celestial Sigil stack to 1 because it's not consumable anymore + case ItemID.CelestialSigil: + item.maxStack = 1; + item.consumable = false; + break; + + // True melee weapon adjustments + case ItemID.SlapHand: + item.damage = 120; + break; + + case ItemID.TaxCollectorsStickOfDoom: + item.damage = 70; + break; + + case ItemID.Anchor: + item.damage = 107; + break; + + case ItemID.GolemFist: + item.damage = 150; + break; + + case ItemID.BreakerBlade: + item.damage = 97; + break; + + case ItemID.StylistKilLaKillScissorsIWish: + item.damage = 33; + break; + + case ItemID.BladeofGrass: + item.damage = 65; + break; + + case ItemID.FieryGreatsword: + item.damage = 98; + item.useTime = 45; + item.useAnimation = 45; + break; + + case ItemID.CobaltSword: + item.damage = 80; + break; + + case ItemID.MythrilSword: + item.damage = 100; + item.useTime = 25; + item.useAnimation = 25; + break; + + case ItemID.AdamantiteSword: + item.damage = 77; + break; + + case ItemID.PalladiumSword: + item.damage = 100; + break; + + case ItemID.OrichalcumSword: + item.damage = 82; + break; + + case ItemID.TitaniumSword: + item.damage = 77; + break; + + case ItemID.Excalibur: + item.damage = 125; + break; + + case ItemID.Bladetongue: + item.damage = 120; + item.scale = 1.75f; + break; + + case ItemID.TheHorsemansBlade: + item.damage = 95; + break; + + case ItemID.Keybrand: + item.damage = 184; + item.useTime = 18; + item.useAnimation = 18; + break; + + case ItemID.AdamantiteGlaive: + item.damage = 65; + item.shootSpeed *= 1.25f; + break; + + case ItemID.ChlorophytePartisan: + item.damage = 100; + break; + + case ItemID.CobaltNaginata: + item.damage = 90; + break; + + case ItemID.Gungnir: + item.damage = 92; + item.shootSpeed *= 1.25f; + break; + + case ItemID.MythrilHalberd: + item.damage = 95; + item.shootSpeed *= 1.25f; + break; + + case ItemID.OrichalcumHalberd: + item.damage = 98; + item.shootSpeed *= 1.25f; + break; + + case ItemID.TitaniumTrident: + item.damage = 72; + item.shootSpeed *= 1.25f; + break; + + case ItemID.DaoofPow: + item.damage = 160; + break; + + case ItemID.TheRottedFork: + item.damage = 20; + break; + + case ItemID.Swordfish: + item.damage = 38; + break; + + case ItemID.DarkLance: + item.damage = 68; + break; + + case ItemID.MushroomSpear: + item.damage = 100; + break; + + case ItemID.BluePhasesaber: + case ItemID.RedPhasesaber: + case ItemID.GreenPhasesaber: + case ItemID.WhitePhasesaber: + case ItemID.YellowPhasesaber: + case ItemID.PurplePhasesaber: + item.damage = 72; + item.useTime = 20; + item.useAnimation = 20; + break; + + case ItemID.PaladinsHammer: + item.damage = 100; + break; + + case ItemID.Katana: + item.useTime = 15; + item.useAnimation = 15; + break; + + case ItemID.FalconBlade: + item.damage = 40; + break; + + case ItemID.ChainKnife: + item.damage = 14; + break; + + case ItemID.DD2SquireDemonSword: + item.damage = 110; + break; + + case ItemID.PurpleClubberfish: + item.damage = 45; + item.knockBack = 10f; + break; + + case ItemID.ChristmasTreeSword: + item.damage = 155; + break; + + case ItemID.MonkStaffT1: + item.damage = 110; + break; + + case ItemID.Terrarian: + item.damage = 352; + break; + + case ItemID.RainbowRod: + item.damage = 130; + break; + + case ItemID.BlizzardStaff: + item.damage = 41; + item.mana = 7; + break; + + case ItemID.LaserMachinegun: + item.damage = 39; + break; + + case ItemID.StardustDragonStaff: + item.damage = 20; + break; + + case ItemID.MonkStaffT3: + item.damage = 225; + break; + + case ItemID.BookStaff: + item.mana = 10; + break; + + case ItemID.UnholyTrident: + item.mana = 14; + break; + + case ItemID.FrostStaff: + item.mana = 9; + break; + + case ItemID.BookofSkulls: + item.mana = 12; + break; + + // Total defense pre-buff = 78, Total defense post-buff = 94 + case ItemID.SolarFlareHelmet: + item.defense = 29; // 5 more defense + break; + + case ItemID.SolarFlareBreastplate: + item.defense = 41; // 7 more defense + break; + + case ItemID.SolarFlareLeggings: + item.defense = 24; // 4 more defense + break; + + // Total defense pre-buff = 7, Total defense post-buff = 15 + case ItemID.GladiatorHelmet: + item.defense = 3; // 1 more defense + break; + + case ItemID.GladiatorBreastplate: + item.defense = 5; // 2 more defense + break; + + case ItemID.GladiatorLeggings: + item.defense = 4; // 2 more defense + break; + + // Total defense pre-buff = 31, 50, 35, Total defense post-buff = 36, 55, 40 + case ItemID.HallowedPlateMail: + item.defense = 18; // 3 more defense + break; + + case ItemID.HallowedGreaves: + item.defense = 13; // 2 more defense + break; + + // Not Expert because ML drops it in Normal so that it can be used with the lore item + case ItemID.GravityGlobe: + item.expert = false; + item.rare = ItemRarityID.Red; + break; + + case ItemID.SuspiciousLookingTentacle: + item.expert = true; + break; + + case ItemID.PearlwoodHammer: + item.hammer += 35; // 80% hammer power + item.useAnimation = 20; + item.useTime = 15; + item.damage *= 4; + item.tileBoost += 1; + item.rare = ItemRarityID.LightRed; + break; + + case ItemID.PearlwoodBow: + item.useAnimation += 8; // 35 + item.useTime += 8; // 35 + item.shootSpeed += 3.4f; // 10f + item.knockBack += 1f; // 1f + item.rare = ItemRarityID.LightRed; + item.damage = (int)(item.damage * 2.1); + canFirePointBlankShots = true; + break; + + case ItemID.PearlwoodSword: + item.damage *= 4; + item.rare = ItemRarityID.LightRed; + break; + + case ItemID.StarCannon: + item.UseSound = null; + break; + } + + if (CalamityLists.quadrupleDamageBuffList?.Contains(item.type) ?? false) + item.damage *= 4; + else if (CalamityLists.tripleDamageBuffList?.Contains(item.type) ?? false) + item.damage *= 3; + else if (CalamityLists.doubleDamageBuffList?.Contains(item.type) ?? false) + item.damage *= 2; + else if (CalamityLists.sixtySixDamageBuffList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 1.66); + else if (CalamityLists.fiftyDamageBuffList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 1.5); + else if (CalamityLists.thirtyThreeDamageBuffList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 1.33); + else if (CalamityLists.twentyFiveDamageBuffList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 1.25); + else if (CalamityLists.twentyDamageBuffList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 1.2); + else if (CalamityLists.tenDamageBuffList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 1.1); + else if (CalamityLists.tenDamageNerfList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 0.9); + else if (CalamityLists.quarterDamageNerfList?.Contains(item.type) ?? false) + item.damage = (int)(item.damage * 0.75); + + if (CalamityLists.noGravityList.Contains(item.type)) ItemID.Sets.ItemNoGravity[item.type] = true; - if (CalamityMod.lavaFishList.Contains(item.type)) + + if (CalamityLists.lavaFishList.Contains(item.type)) ItemID.Sets.CanFishInLava[item.type] = true; - - // not expert because ML drops it in normal so that it can be used with the lore item - if (item.type == ItemID.GravityGlobe) - { - item.expert = false; - item.rare = 10; - } - - if (item.type == ItemID.SuspiciousLookingTentacle) - item.expert = true; - - if (item.type == ItemID.PearlwoodHammer) - { - item.hammer += 35; //80% hammer power - item.useAnimation = 20; - item.useTime = 15; - item.damage *= 4; - item.tileBoost += 1; - item.rare = 4; - } - if (item.type == ItemID.PearlwoodBow) - { - item.useAnimation += 8; //35 - item.useTime += 8; //35 - item.shootSpeed += 3.4f; //10f - item.knockBack += 1f; //1f - item.rare = 4; - item.damage = (int)(item.damage * 2.1); - } - if (item.type == ItemID.PearlwoodSword) - { - item.damage *= 4; - item.rare = 4; - } - if (item.type == ItemID.StarCannon) - item.UseSound = null; } #endregion #region Shoot public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (item.type >= ItemID.Count && item.Calamity().Chargeable && item.Calamity().CurrentCharge > 0 && Main.rand.NextBool(120 / (int)MathHelper.Max(1, item.useAnimation))) - { - CurrentCharge--; - } CalamityPlayer modPlayer = player.Calamity(); - if (rogue) + 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); + } + + bool belowHalfMana = player.statMana < player.statManaMax2 * 0.5f; + if (Main.myPlayer == player.whoAmI && player.Calamity().manaMonsterEnchant && Main.rand.NextBool(12) && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && belowHalfMana) + { + int monsterDamage = (int)(165000 * player.MagicDamage()); + Vector2 shootVelocity = player.SafeDirectionTo(Main.MouseWorld, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); + Projectile.NewProjectile(player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), monsterDamage, 0f, player.whoAmI); + } + + if (rogue) { speedX *= modPlayer.throwingVelocity; speedY *= modPlayer.throwingVelocity; if (modPlayer.gloveOfRecklessness) { Vector2 rotated = new Vector2(speedX, speedY); - rotated = rotated.RotatedByRandom(MathHelper.ToRadians(10f)); + rotated = rotated.RotatedByRandom(MathHelper.ToRadians(6f)); speedX = rotated.X; speedY = rotated.Y; } } - if (modPlayer.luxorsGift) - { - // useTime 9 = 0.9 useTime 2 = 0.2 - double damageMult = 1.0; - if (item.useTime < 10) - damageMult -= (double)(10 - item.useTime) / 10.0; - - double newDamage = damage * damageMult; - - if (player.whoAmI == Main.myPlayer) - { - if (item.melee) - Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, ModContent.ProjectileType(), (int)(newDamage * 0.6), 0f, player.whoAmI, 0f, 0f); - - else if (rogue) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(newDamage * 0.5), 0f, player.whoAmI, 0f, 0f); - - else if (item.ranged) - Projectile.NewProjectile(position.X, position.Y, speedX * 1.5f, speedY * 1.5f, ModContent.ProjectileType(), (int)(newDamage * 0.4), 0f, player.whoAmI, 0f, 0f); - - else if (item.magic) - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(newDamage * 0.8), 0f, player.whoAmI, 0f, 0f); - - else if (item.summon && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); - } - } if (modPlayer.eArtifact && item.ranged) { speedX *= 1.25f; speedY *= 1.25f; } - if (modPlayer.bloodflareMage) //0 - 99 + Vector2 velocity = new Vector2(speedX, speedY); + if (modPlayer.luxorsGift) { - if (item.magic && Main.rand.Next(0, 100) >= 95) + // useTime 9 = 0.9 useTime 2 = 0.2 + double damageMult = 1.0; + if (item.useTime < 10) + damageMult -= (10 - item.useTime) / 10.0; + + double newDamage = damage * damageMult; + + if (player.whoAmI == Main.myPlayer) { - if (player.whoAmI == Main.myPlayer) + if (item.melee) + { + int projectile = Projectile.NewProjectile(position, velocity * 0.5f, ModContent.ProjectileType(), (int)(newDamage * 0.25), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (rogue) + { + int projectile = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), (int)(newDamage * 0.2), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (item.ranged) + { + int projectile = Projectile.NewProjectile(position, velocity * 1.5f, ModContent.ProjectileType(), (int)(newDamage * 0.15), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (item.magic) + { + int projectile = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), (int)(newDamage * 0.3), 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + else if (item.summon && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + int projectile = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + } + } + if (modPlayer.bloodflareMage && modPlayer.canFireBloodflareMageProjectile) + { + if (item.magic) + { + modPlayer.canFireBloodflareMageProjectile = false; + if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 4.2 : 2.6)), 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 1.3, 190), 1f, player.whoAmI); } } } - if (modPlayer.bloodflareRanged) //0 - 99 + if (modPlayer.bloodflareRanged && modPlayer.canFireBloodflareRangedProjectile) { - if (item.ranged && Main.rand.Next(0, 100) >= 98) + if (item.ranged) { - if (player.whoAmI == Main.myPlayer) + modPlayer.canFireBloodflareRangedProjectile = false; + if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 2.2 : 1.6)), 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 0.8, 115), 2f, player.whoAmI); } } } @@ -294,85 +674,78 @@ namespace CalamityMod.Items if (modPlayer.tarraCrits >= 5 && player.whoAmI == Main.myPlayer) { modPlayer.tarraCrits = 0; - int num106 = 9 + Main.rand.Next(3); - for (int num107 = 0; num107 < num106; num107++) + int leafAmt = 9 + Main.rand.Next(3); + for (int l = 0; l < leafAmt; l++) { - float num110 = 0.025f * (float)num107; - float hardar = speedX + (float)Main.rand.Next(-25, 26) * num110; - float hordor = speedY + (float)Main.rand.Next(-25, 26) * num110; - float num84 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); + float spreadMult = 0.025f * l; + float hardar = speedX + Main.rand.Next(-25, 26) * spreadMult; + float hordor = speedY + Main.rand.Next(-25, 26) * spreadMult; + float num84 = (float)Math.Sqrt(speedX * speedX + speedY * speedY); num84 = item.shootSpeed / num84; hardar *= num84; hordor *= num84; - Projectile.NewProjectile(position.X, position.Y, hardar, hordor, ProjectileID.Leaf, (int)(damage * 0.2), knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position, new Vector2(hardar, hordor), ProjectileID.Leaf, CalamityUtils.DamageSoftCap(damage * 0.2, 40), knockBack, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } + } + } + if (modPlayer.ataxiaBolt && modPlayer.canFireAtaxiaRangedProjectile) + { + if (item.ranged) + { + modPlayer.canFireAtaxiaRangedProjectile = false; + if (player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 0.25, 50), 2f, player.whoAmI); } } } - if (modPlayer.ataxiaBolt) + if (modPlayer.godSlayerRanged && modPlayer.canFireGodSlayerRangedProjectile) { - if (item.ranged && Main.rand.NextBool(2)) + if (item.ranged) { - if (player.whoAmI == Main.myPlayer) + modPlayer.canFireGodSlayerRangedProjectile = false; + if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage, 150), 2f, player.whoAmI); } } } - if (modPlayer.godSlayerRanged) //0 - 99 + if (modPlayer.ataxiaVolley && modPlayer.canFireAtaxiaRogueProjectile) { - if (item.ranged && Main.rand.Next(0, 100) >= 95) + if (rogue) { - if (player.whoAmI == Main.myPlayer) + modPlayer.canFireAtaxiaRogueProjectile = false; + if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, ModContent.ProjectileType(), (int)(damage * (modPlayer.auricSet ? 3.2 : 2.1)), 2f, player.whoAmI, 0f, 0f); - } - } - } - if (modPlayer.ataxiaVolley) - { - if (rogue && Main.rand.NextBool(10)) - { - if (player.whoAmI == Main.myPlayer) - { - Main.PlaySound(SoundID.Item20, (int)player.position.X, (int)player.position.Y); + Main.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; double offsetAngle; - int i; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { - Vector2 vector2 = new Vector2(player.Center.X, player.Center.Y); offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(damage * 0.5), 1.25f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 0.5, 100), 1f, player.whoAmI); + Projectile.NewProjectile(player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 0.5, 100), 1f, player.whoAmI); } } } } - if (modPlayer.reaverDoubleTap) //0 - 99 - { - if (item.ranged && Main.rand.Next(0, 100) >= 90) - { - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, ModContent.ProjectileType(), (int)(damage * 1.3), 2f, player.whoAmI, 0f, 0f); - } - } - } if (modPlayer.victideSet) { if ((item.ranged || item.melee || item.magic || item.thrown || rogue || item.summon) && item.rare < ItemRarityID.Yellow && Main.rand.NextBool(10)) { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, ModContent.ProjectileType(), damage * 2, 1f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(damage * 2, 60), 1f, player.whoAmI); } } } if (modPlayer.dynamoStemCells) { - if (item.ranged && Main.rand.Next(0, 100) >= 80) + if (item.ranged && Main.rand.NextBool(20)) { double damageMult = item.useTime / 30D; if (damageMult < 0.35) @@ -382,13 +755,15 @@ namespace CalamityMod.Items if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(position.X, position.Y, speedX * 1.25f, speedY * 1.25f, ModContent.ProjectileType(), newDamage, 2f, player.whoAmI, 0f, 0f); - } + int projectile = Projectile.NewProjectile(position, velocity * 1.25f, ModContent.ProjectileType(), newDamage, 2f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceTypeless = true; + } } } - if (modPlayer.prismaticRegalia) //0 - 99 + if (modPlayer.prismaticRegalia) { - if (item.magic && Main.rand.Next(0, 100) >= 95) + if (item.magic && Main.rand.NextBool(20)) { if (player.whoAmI == Main.myPlayer) { @@ -396,9 +771,10 @@ namespace CalamityMod.Items { if (i != 0) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int rocket = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(damage * 0.8), 2f, player.whoAmI, 0f, 0f); - Main.projectile[rocket].Calamity().forceTypeless = true; + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + int rocket = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI); + if (rocket.WithinBounds(Main.maxProjectiles)) + Main.projectile[rocket].Calamity().forceTypeless = true; } } } @@ -406,16 +782,19 @@ namespace CalamityMod.Items } if (modPlayer.harpyWingBoost && modPlayer.harpyRing) { - if (Main.rand.NextBool(5)) - { + if (Main.rand.NextBool(5)) + { if (player.whoAmI == Main.myPlayer) { - float spreadX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float spreadY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - int feather = Projectile.NewProjectile(position.X, position.Y, spreadX * 1.25f, spreadY * 1.25f, ModContent.ProjectileType(), damage / 2, 2f, player.whoAmI, 0f, 0f); - Main.projectile[feather].usesLocalNPCImmunity = true; - Main.projectile[feather].localNPCHitCooldown = 10; - Main.projectile[feather].Calamity().forceTypeless = true; + float spreadX = speedX + Main.rand.NextFloat(-0.75f, 0.75f); + float spreadY = speedY + Main.rand.NextFloat(-0.75f, 0.75f); + int feather = Projectile.NewProjectile(position, new Vector2(spreadX, spreadY) * 1.25f, ModContent.ProjectileType(), (int)(damage * 0.3), 2f, player.whoAmI); + if (feather.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[feather].usesLocalNPCImmunity = true; + Main.projectile[feather].localNPCHitCooldown = 10; + Main.projectile[feather].Calamity().forceTypeless = true; + } } } } @@ -426,7 +805,7 @@ namespace CalamityMod.Items { position += muzzleOffset; } - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); Main.PlaySound(SoundID.Item11.WithPitchVariance(0.05f), position); return false; } @@ -441,18 +820,18 @@ namespace CalamityMod.Items } for (int i = -8; i <= 8; i += 8) { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, 0f, player.whoAmI); } } return true; } - #endregion + #endregion - #region SavingAndLoading - public override bool NeedsSaving(Item item) + #region SavingAndLoading + public override bool NeedsSaving(Item item) { - return true; + return rogue || canFirePointBlankShots || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; } public override TagCompound Save(Item item) @@ -462,30 +841,52 @@ namespace CalamityMod.Items ["rogue"] = rogue, ["timesUsed"] = timesUsed, ["rarity"] = (int)customRarity, - ["Charge"] = CurrentCharge - }; + ["charge"] = Charge, + ["reforgeTier"] = reforgeTier, + ["enchantmentID"] = AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0, + ["DischargeEnchantExhaustion"] = DischargeEnchantExhaustion, + ["canFirePointBlankShots"] = canFirePointBlankShots + }; } public override void Load(Item item, TagCompound tag) { rogue = tag.GetBool("rogue"); - timesUsed = tag.GetInt("timesUsed"); + canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); + timesUsed = tag.GetInt("timesUsed"); customRarity = (CalamityRarity)tag.GetInt("rarity"); - CurrentCharge = tag.GetInt("Charge"); - } + + // Changed charge from int to float. If an old charge int is present, load that instead. + if (tag.ContainsKey("Charge")) + Charge = tag.GetInt("Charge"); + else + Charge = tag.GetFloat("charge"); + + DischargeEnchantExhaustion = tag.GetFloat("DischargeEnchantExhaustion"); + reforgeTier = tag.GetInt("reforgeTimer"); + Enchantment? savedEnchantment = EnchantmentManager.FindByID(tag.GetInt("enchantmentID")); + if (savedEnchantment.HasValue) + { + AppliedEnchantment = savedEnchantment.Value; + bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null; + item.Calamity().AppliedEnchantment.Value.CreationEffect?.Invoke(item); + } + } public override void LoadLegacy(Item item, BinaryReader reader) { int loadVersion = reader.ReadInt32(); customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); - CurrentCharge = reader.ReadInt32(); + Charge = reader.ReadSingle(); + reforgeTier = reader.ReadInt32(); if (loadVersion == 0) { BitsByte flags = reader.ReadByte(); rogue = flags[0]; - } + canFirePointBlankShots = flags[1]; + } else { ModContent.GetInstance().Logger.Error("Unknown loadVersion: " + loadVersion); @@ -496,22 +897,38 @@ namespace CalamityMod.Items { BitsByte flags = new BitsByte(); flags[0] = rogue; + flags[1] = canFirePointBlankShots; - writer.Write(flags); + writer.Write(flags); writer.Write((int)customRarity); writer.Write(timesUsed); - writer.Write(CurrentCharge); - } + writer.Write(Charge); + writer.Write(reforgeTier); + writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); + writer.Write(DischargeEnchantExhaustion); + } public override void NetReceive(Item item, BinaryReader reader) { BitsByte flags = reader.ReadByte(); rogue = flags[0]; + canFirePointBlankShots = flags[1]; - customRarity = (CalamityRarity)reader.ReadInt32(); + customRarity = (CalamityRarity)reader.ReadInt32(); timesUsed = reader.ReadInt32(); - CurrentCharge = reader.ReadInt32(); - } + Charge = reader.ReadSingle(); + reforgeTier = reader.ReadInt32(); + + Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32()); + if (savedEnchantment.HasValue) + { + AppliedEnchantment = savedEnchantment.Value; + bool hasCreationEffect = AppliedEnchantment.Value.CreationEffect != null; + if (hasCreationEffect) + item.Calamity().AppliedEnchantment.Value.CreationEffect(item); + } + DischargeEnchantExhaustion = reader.ReadSingle(); + } #endregion #region Pickup Item Changes @@ -524,273 +941,49 @@ namespace CalamityMod.Items { player.statLife -= boostedHeart ? 5 : 10; if (Main.myPlayer == player.whoAmI) - { player.HealEffect(boostedHeart ? -5 : -10, true); - } } else if (boostedHeart) { player.statLife += 5; if (Main.myPlayer == player.whoAmI) - { player.HealEffect(5, true); - } } } return true; } #endregion - #region Profaned Soul Crystal Attacks - - private bool HandleAttackTransforms(Item item, Player player) - { - if (player.whoAmI != Main.myPlayer) - return false; - int weaponType = item.melee ? 1 : item.ranged ? 2 : item.magic ? 3 : item.Calamity().rogue ? 4 : -1; - if (weaponType > 0) - { - if (player.Calamity().profanedSoulWeaponType != weaponType || player.Calamity().profanedSoulWeaponUsage >= 300) - { - player.Calamity().profanedSoulWeaponType = weaponType; - player.Calamity().profanedSoulWeaponUsage = 0; - } - Vector2 correctedVelocity = Main.MouseWorld - player.Center; - correctedVelocity.Normalize(); - bool shouldNerf = player.Calamity().endoCooper || player.Calamity().magicHat; //No bonkers damage memes thank you very much. - bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5); - if (item.melee) - { - if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 4 : 6) == 0) - { - if (player.Calamity().profanedSoulWeaponUsage > 0 && player.Calamity().profanedSoulWeaponUsage % (enrage ? 20 : 30) == 0) //every 5 shots is a shotgun spread - { - int numProj = 5; - - correctedVelocity *= 12f; - int spread = 3; - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - - Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((shouldNerf ? 1000 : 1750) * 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); - } - player.Calamity().profanedSoulWeaponUsage = 0; - } - else - { - Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType(), (int)((shouldNerf ? 500 : 1250) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f); - Main.PlaySound(SoundID.Item20, player.Center); - } - - } - player.Calamity().profanedSoulWeaponUsage++; - - } - else if (item.ranged) - { - if (enrage || Main.rand.NextBool(2)) //100% chance if 50% or lower, else 1 in 2 chance - { - correctedVelocity *= 20f; - Vector2 perturbedspeed = new Vector2(correctedVelocity.X + Main.rand.Next(-3, 4), correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(3)); - bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired. - bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5% - int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3; - int dam = (int)((shouldNerf ? 500 : 1000) * player.MinionDamage()); - switch (projType) - { - case 1: //big boomer - case 2: //boomer - int proj = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, projType == 1 ? 1f : 0f); - Main.projectile[proj].Calamity().forceMinion = true; - break; - case 3: //bab boomer - int proj2 = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType(), dam, 0f, player.whoAmI, 0f); - Main.projectile[proj2].Calamity().forceMinion = true; - break; - } - if (projType > 1) - { - Main.PlaySound(SoundID.Item20, player.Center); - } - } - } - else if (item.magic) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - { - player.Calamity().profanedSoulWeaponUsage = 0; - } - int manaCost = (int)(100 * player.manaCost); - if (player.statMana < manaCost && player.Calamity().profanedSoulWeaponUsage == 0) - { - if (player.manaFlower) - { - player.QuickMana(); - } - } - if (player.statMana >= manaCost && player.Calamity().profanedSoulWeaponUsage == 0 && !player.silence) - { - player.manaRegenDelay = (int)player.maxRegenDelay; - player.statMana -= manaCost; - correctedVelocity *= 25f; - Main.PlaySound(SoundID.Item20, player.Center); - int dam = (int)((shouldNerf ? 1800 : 4500) * player.MinionDamage()); - if (player.HasBuff(BuffID.ManaSickness)) - { - int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60))); - dam -= sickPenalty; - } - int proj = Projectile.NewProjectile(player.position, correctedVelocity, ModContent.ProjectileType(), dam, 1f, player.whoAmI, enrage ? 1f : 0f); - Main.projectile[proj].Calamity().forceMinion = true; - player.Calamity().profanedSoulWeaponUsage = enrage ? 20 : 25; - } - if (player.Calamity().profanedSoulWeaponUsage > 0) - player.Calamity().profanedSoulWeaponUsage--; - } - else if (item.Calamity().rogue) - { - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - { - player.Calamity().profanedSoulWeaponUsage = 0; - } - if (player.Calamity().profanedSoulWeaponUsage >= (enrage ? 69 : 180)) - { - float crystalCount = 36f; - for (float i = 0; i < crystalCount; i++) - { - float angle = MathHelper.TwoPi / crystalCount * i; - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 300 : 880) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceMinion = true; - Main.PlaySound(SoundID.Item20, player.Center); - } - player.Calamity().profanedSoulWeaponUsage = 0; - } - else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0) - { - float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10)); - int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)((shouldNerf ? 400 : 1100) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f); - Main.projectile[proj].Calamity().forceMinion = true; - Main.PlaySound(SoundID.Item20, player.Center); - } - player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2; - if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0) - player.Calamity().profanedSoulWeaponUsage--; - } - } - return false; - } - - #endregion - - #region Andromeda Dev Item Attacks - private bool PerformAndromedaAttacks(Item item, Player player) - { - if (player.whoAmI != Main.myPlayer) - return false; - - int robotIndex = -1; - - for (int i = 0; i < Main.projectile.Length; i++) - { - if (Main.projectile[i].active && - Main.projectile[i].type == ModContent.ProjectileType() && - Main.projectile[i].owner == player.whoAmI) - { - robotIndex = i; - break; - } - } - if (robotIndex != -1) - { - Projectile robot = Main.projectile[robotIndex]; - GiantIbanRobotOfDoom robotModProjectile = ((GiantIbanRobotOfDoom)robot.modProjectile); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && - robotModProjectile.TopIconActive && - (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || - !robotModProjectile.RightIconActive)) // "Melee" attack - { - int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge; - if (item.Calamity().rogue) - { - damage = (int)(damage * player.RogueDamage()); - } - if (item.melee) - { - damage = (int)(damage * player.MeleeDamage()); - } - if (item.ranged) - { - damage = (int)(damage * player.RangedDamage()); - } - if (item.magic) - { - damage = (int)(damage * player.MagicDamage()); - } - if (item.summon) - { - damage = (int)(damage * player.MinionDamage()); - } - Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, - Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); - - if (item.Calamity().rogue) - { - blade.Calamity().forceRogue = true; - } - if (item.melee) - { - blade.Calamity().forceMelee = true; - } - if (item.ranged) - { - blade.Calamity().forceRanged = true; - } - if (item.magic) - { - blade.Calamity().forceMagic = true; - } - if (item.summon) - { - blade.Calamity().forceMinion = true; - } - } - - if (!robotModProjectile.TopIconActive && - (robotModProjectile.LeftBracketActive || robotModProjectile.RightBracketActive) && - !robotModProjectile.BottomBracketActive && - robotModProjectile.LaserCooldown <= 0 && - (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || - !robotModProjectile.RightIconActive)) // "Ranged" attack - { - robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft * 2; - if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) - { - robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft + 1; - } - } - } - return false; - } - #endregion - #region Use Item Changes - public override bool UseItem(Item item, Player player) { - // Use charge on swing instead of on shoot if the item doesn't shoot anything. - if (item.type >= ItemID.Count && item.Calamity().Chargeable && item.Calamity().CurrentCharge > 0 && Main.rand.NextBool(120 / (int)MathHelper.Max(1, item.useAnimation)) && item.shoot == ProjectileID.None) - { - if (player.itemAnimation == 1) - CurrentCharge--; - } - if (item.type == ItemID.BottledHoney) + if (player.Calamity().evilSmasherBoost > 0) { - player.AddBuff(BuffID.Honey, 7200); + if (item.type != ModContent.ItemType()) + player.Calamity().evilSmasherBoost = 0; } - return base.UseItem(item, player); + + if (player.HasBuff(BuffID.ParryDamageBuff)) + { + if (item.type != ItemID.DD2SquireDemonSword) + { + player.parryDamageBuff = false; + player.ClearBuff(BuffID.ParryDamageBuff); + } + } + + // Give 2 minutes of Honey buff when drinking Bottled Honey. + if (item.type == ItemID.BottledHoney) + player.AddBuff(BuffID.Honey, 7200); + + // Moon Lord instantly spawns when Celestial Sigil is used. + if (item.type == ItemID.CelestialSigil) + { + NPC.MoonLordCountdown = 1; + NetMessage.SendData(MessageID.MoonlordCountdown, -1, -1, null, NPC.MoonLordCountdown); + } + + return base.UseItem(item, player); } public override bool AltFunctionUse(Item item, Player player) @@ -828,7 +1021,7 @@ namespace CalamityMod.Items if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].localAI[1] == 0f) { Main.projectile[i].rotation = MathHelper.PiOver2 + MathHelper.PiOver4; - Main.projectile[i].velocity = Main.projectile[i].DirectionTo(Main.MouseWorld) * 22f; + Main.projectile[i].velocity = Main.projectile[i].SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f; Main.projectile[i].rotation += Main.projectile[i].velocity.ToRotation(); Main.projectile[i].ai[0] = 180f; (Main.projectile[i].modProjectile as IgneousBlade).Firing = true; @@ -839,6 +1032,21 @@ namespace CalamityMod.Items } return false; } + if (player.ActiveItem().type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + { + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].modProjectile is VoidConcentrationAura) + { + if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI) + { + (Main.projectile[i].modProjectile as VoidConcentrationAura).HandleRightClick(); + break; + } + } + } + return false; + } if (player.ActiveItem().type == ModContent.ItemType()) { bool canContinue = true; @@ -893,47 +1101,70 @@ namespace CalamityMod.Items public override bool CanUseItem(Item item, Player player) { CalamityPlayer modPlayer = player.Calamity(); + CalamityGlobalItem modItem = item.Calamity(); // Restrict behavior when reading Dreadon's Log. if (PopupGUIManager.AnyGUIsActive) return false; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && + if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { return false; // Don't use weapons if you're charging with a spear } + // Conversion for Andromeda if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { if (item.type == ItemID.WireKite) return false; if (item.pick > 0 || item.axe > 0 || item.hammer > 0 || item.fishingPole > 0) return false; + // compiler optimization: && short-circuits, so if altFunctionUse != 0, Andromeda code is never called. if (item.Calamity().rogue || item.magic || item.ranged || item.melee) - { - if (player.altFunctionUse == 0) - return PerformAndromedaAttacks(item, player); - else return false; + return player.altFunctionUse == 0 && PrototypeAndromechaRing.TransformItemUsage(item, player); + } + + // Conversion for Profaned Soul Crystal + if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (modItem.rogue || item.magic || item.ranged || item.melee)) + return player.altFunctionUse == 0 ? ProfanedSoulCrystal.TransformItemUsage(item, player) : AltFunctionUse(item, player); + + if (!item.IsAir) + { + // Exhaust the weapon if it has the necessary enchant. + if (modPlayer.dischargingItemEnchant) + { + float exhaustionCost = item.useTime * 2.25f; + if (exhaustionCost < 10f) + exhaustionCost = 10f; + DischargeEnchantExhaustion = MathHelper.Clamp(DischargeEnchantExhaustion - exhaustionCost, 0.001f, DischargeEnchantExhaustionCap); + } + + // Otherwise, if it doesn't, clear exhaustion. + else + DischargeEnchantExhaustion = 0; + } + + // Check for sufficient charge if this item uses charge. + if (item.type >= ItemID.Count && modItem.UsesCharge) + { + // If attempting to use alt fire, and alt fire charge is defined, require that charge. Otherwise require normal charge per use. + float chargeNeeded = (player.altFunctionUse == 2 && modItem.ChargePerAltUse != -1f) ? modItem.ChargePerAltUse : modItem.ChargePerUse; + + // If the amount of charge needed is zero or less, ignore the charge requirement entirely (e.g. summon staff right click). + if (chargeNeeded > 0f) + { + if (modItem.Charge < chargeNeeded) + return false; + + // If you have enough charge, decrement charge on the spot because this hook runs exactly once every time you use an item. + // Mana has to be checked separately or you'll fail to use the weapon on a mana check later and still have consumed charge. + if (player.CheckMana(item)) + Charge -= chargeNeeded; } } - if (modPlayer.profanedCrystalBuffs && item.pick == 0 && item.axe == 0 && item.hammer == 0 && item.autoReuse && (item.Calamity().rogue || item.magic || item.ranged || item.melee)) - { - if (player.altFunctionUse == 0) - { - return HandleAttackTransforms(item, player); - } - else - { - return AltFunctionUse(item, player); - } - } - else if (modPlayer.profanedCrystalBuffs && item.summon) - { - - } - if (item.type == ItemID.MonkStaffT1) + if (item.type == ItemID.MonkStaffT1 || CalamityLists.spearAutoreuseList.Contains(item.type)) { return player.ownedProjectileCounts[item.shoot] <= 0; } @@ -957,17 +1188,13 @@ namespace CalamityMod.Items { return false; } - if ((item.type == ItemID.ShinePotion || item.type == ItemID.NightOwlPotion) && (modPlayer.etherealExtorter && modPlayer.ZoneAbyss)) - { - return false; - } if ((item.type == ItemID.SuperAbsorbantSponge || item.type == ItemID.EmptyBucket) && modPlayer.ZoneAbyss) { return false; } if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion) { - return !NPC.AnyNPCs(ModContent.NPCType()); + return !CalamityPlayer.areThereAnyDamnBosses; } if (item.type == ItemID.RodofDiscord) { @@ -1003,6 +1230,10 @@ namespace CalamityMod.Items } } } + if (item.type == ItemID.SuspiciousLookingEye || item.type == ItemID.WormFood || item.type == ItemID.BloodySpine || item.type == ItemID.SlimeCrown || item.type == ItemID.Abeemination || item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalWorm || item.type == ItemID.MechanicalSkull || item.type == ItemID.CelestialSigil) + { + return !BossRushEvent.BossRushActive; + } return true; } #endregion @@ -1010,1969 +1241,51 @@ namespace CalamityMod.Items #region Modify Weapon Damage public override void ModifyWeaponDamage(Item item, Player player, ref float add, ref float mult, ref float flat) { - if (item.Calamity().Chargeable) - { - float chargeDamageMultiplier = 1f; - float chargeRatio = item.Calamity().CurrentCharge / (float)ChargeMax; - if (chargeRatio < ChargeDamageReductionThreshold) - chargeDamageMultiplier = MathHelper.Lerp(ChargeDamageMinMultiplier, 1f, chargeRatio * ChargeDamageReductionThreshold); - mult *= chargeDamageMultiplier; - } - } - #endregion + // Nerf yoyo glove and bag because it's bad and stupid and dumb and bad. + if (player.yoyoGlove && ItemID.Sets.Yoyo[item.type]) + mult *= 0.66f; - #region Modify Tooltips - public override void ModifyTooltips(Item item, List tooltips) - { - #region Custom Rarities# - TooltipLine tt2 = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria"); - if (tt2 != null) + // Nerf archery potion damage buff from 1.2x to 1.05x. + if (item.useAmmo == AmmoID.Arrow && player.archery) + mult *= 0.875f; + + if (item.type < ItemID.Count) + return; + + // Summon weapons specifically do not have their damage affected by charge. They still require charge to function however. + CalamityGlobalItem modItem = item.Calamity(); + + if (!item.summon && modItem.DischargeEnchantExhaustion > 0f) + mult *= DischargeEnchantmentDamageFormula(); + + if (!item.summon && (modItem?.UsesCharge ?? false)) { - // The special color in the tooltip were overlapping. Placing everything in here, above other things, was the only solution I could find that worked. - if (item.type == ModContent.ItemType()) - { - List colorSet = new List() - { - new Color(188, 192, 193), // white - new Color(157, 100, 183), // purple - new Color(249, 166, 77), // honey-ish orange - new Color(255, 105, 234), // pink - new Color(67, 204, 219), // sky blue - new Color(249, 245, 99), // bright yellow - new Color(236, 168, 247), // purplish pink - }; - if (tt2 != null) - { - int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); - Color currentColor = colorSet[colorIndex]; - Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; - tt2.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); - } + // At exactly zero charge, do not perform any multiplication. + // This makes charge-using weapons show up at full damage when previewed in crafting, Recipe Browser, etc. + if (Charge == 0f) return; - } - switch (customRarity) - { - default: - break; - case CalamityRarity.Turquoise: - tt2.overrideColor = new Color(0, 255, 200); - break; - case CalamityRarity.PureGreen: - tt2.overrideColor = new Color(0, 255, 0); - break; - case CalamityRarity.DarkBlue: - tt2.overrideColor = new Color(43, 96, 222); - break; - case CalamityRarity.Violet: - tt2.overrideColor = new Color(108, 45, 199); - break; - case CalamityRarity.Developer: - tt2.overrideColor = new Color(255, 0, 255); - break; - - case CalamityRarity.Rainbow: - tt2.overrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - break; - case CalamityRarity.DraedonRust: - tt2.overrideColor = new Color(204, 71, 35); - break; - case CalamityRarity.RareVariant: - tt2.overrideColor = new Color(255, 140, 0); - break; - case CalamityRarity.Dedicated: - tt2.overrideColor = new Color(139, 0, 0); - break; - - case CalamityRarity.ItemSpecific: - // Uniquely colored developer weapons - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(Main.DiscoR, 100, 255); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(0, 0, 255); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = Judgement.GetSyncedLightColor(); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 4f); //alternates between emerald green and amber (BanditHueh) - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 2f); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 2f); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 2f); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 2f); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(146, 0, 0); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(129, 29, 149); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(220, 20, 60); - if (item.type == ModContent.ItemType()) - { - if (Main.GlobalTime % 1f < 0.6f) - { - tt2.overrideColor = new Color(89, 229, 255); - } - else if (Main.GlobalTime % 1f < 0.8f) - { - tt2.overrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTime % 1f - 0.6f) / 0.2f); - } - else - { - tt2.overrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTime % 1f - 0.8f) / 0.2f); - } - } - - // Uniquely colored legendary weapons and Yharim's Crystal - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(255, Main.DiscoG, 53); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(Main.DiscoR, 203, 103); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(53, Main.DiscoG, 255); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(150, Main.DiscoG, 255); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(Main.DiscoR, 203, 103); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(60, Main.DiscoG, 190); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(255, Main.DiscoG, 155); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = new Color(255, Main.DiscoG, 0); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); - if (item.type == ModContent.ItemType()) - tt2.overrideColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); - break; - } - } - #endregion - - #region Accessory Modifier Display - if (item.accessory) - { - if (!item.social && item.prefix > 0) - { - float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; - if (stealthGenBoost > 0) - { - TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") - { - isModifier = true - }; - tooltips.Add(StealthGen); - } - } - } - #endregion - - /*if (item.ammo == 97) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria") - { - if (line2.Name == "Damage") - line2.text = ""; - } - } - }*/ - - if (item.type == ItemID.BottledHoney) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "HealLife") - { - line2.text += "\nGrants the Honey buff for 2 minutes"; - } - } - } - if (item.type == ItemID.RodofDiscord) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nTeleportation is disabled while Chaos State is active"; - } - } - } - if (item.type == ItemID.SuperAbsorbantSponge) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nCannot be used in the Abyss"; - } - } - } - if (item.type == ItemID.EmptyBucket) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text += "\nCannot be used in the Abyss"; - } - } - } - if (item.type == ItemID.CrimsonHeart) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShadowOrb) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.MagicLantern) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ArcticDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a small amount of light in the abyss\n" + - "Moderately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishNecklace) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.JellyfishDivingGear) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a small amount of light in the abyss"; - } - } - } - if (item.type == ItemID.FairyBell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.DD2PetGhost) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.ShinePotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text += "\nProvides a moderate amount of light in the abyss"; - } - } - } - if (item.type == ItemID.WispinaBottle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.SuspiciousLookingTentacle) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides a large amount of light in the abyss"; - } - } - } - if (item.type == ItemID.GillsPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "BuffTime") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.DivingHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nModerately reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.CelestialShell) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nGreatly reduces breath loss in the abyss"; - } - } - } - if (item.type == ItemID.WarmthPotion) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs\n" + - "Provides cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; - } - } - } - } - if (item.type == ItemID.FlaskofVenom) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks inflict Venom on enemies"; - } - } - } - if (item.type == ItemID.FlaskofCursedFlames) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks inflict enemies with cursed flames"; - } - } - } - if (item.type == ItemID.FlaskofFire) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks set enemies on fire"; - } - } - } - if (item.type == ItemID.FlaskofGold) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks make enemies drop more gold"; - } - } - } - if (item.type == ItemID.FlaskofIchor) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks decrease enemy defense"; - } - } - } - if (item.type == ItemID.FlaskofNanites) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks confuse enemies"; - } - } - } - if (item.type == ItemID.FlaskofParty) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "All attacks cause confetti to appear"; - } - } - } - if (item.type == ItemID.FlaskofPoison) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Melee and rogue attacks poison enemies"; - } - } - } - if (item.type == ItemID.WormScarf) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduces damage taken by 10%"; - } - } - } - if (item.type == ItemID.TitanGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.PowerGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.MechanicalGlove) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\n10% increased true melee damage"; - } - } - } - if (item.type == ItemID.FireGauntlet) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "10% increased true melee damage\n" + - "Provides heat and cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "14% increased melee damage and speed\n" + - "10% increased true melee damage"; - } - } - } - } - if (item.type == ItemID.SpectreHood) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "20% decreased magic damage"; - } - } - } - if (item.type == ItemID.ObsidianSkinPotion) - { - string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to direct damage from touching lava\n" + - "Provides temporary immunity to lava burn damage\n" + - "Reduces lava burn damage" + heatImmunity; - } - } - } - if (item.type == ItemID.ObsidianRose) - { - string heatImmunity = CalamityWorld.death ? "\nProvides heat protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Reduced direct damage from touching lava\n" + - "Greatly reduces lava burn damage" + heatImmunity; - } - } - } - if (item.type == ItemID.MagmaStone && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides heat and cold protection in Death Mode"; - } - } - } - if (item.type == ItemID.LavaCharm && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nProvides heat protection in Death Mode"; - } - } - } - if (item.type == ItemID.LavaWaders && CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text += "\nProvides heat protection in Death Mode"; - } - } - } - if (item.type == ItemID.InvisibilityPotion) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text += "\nBoosts certain stats when holding certain types of rogue weapons"; - } - } - } - if (item.type == ItemID.GoldenFishingRod) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "NeedsBait") - { - line2.text = "Requires bait to catch fish\n" + - "The line will never break"; - } - } - } - if (item.type == ItemID.Picksaw) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - // I'm leaving this intentionally ambiguous so that people have to search for Scoria Ore - line2.text = "Capable of mining Lihzahrd Bricks and Scoria Ore"; - } - } - } - if (item.type == ItemID.SolarFlarePickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.VortexPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.NebulaPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - if (item.type == ItemID.StardustPickaxe) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Material") - { - line2.text = "Material\n" + - "Can mine Uelibloom Ore"; - } - } - } - - if (Main.player[Main.myPlayer].Calamity().trueMeleeDamage > 0D) - { - if (item.melee && item.damage > 0) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Damage") - { - line2.text += " : " + string.Concat((int)(Main.player[Main.myPlayer].Calamity().actualMeleeDamageStat * item.damage * - (1D + Main.player[Main.myPlayer].Calamity().trueMeleeDamage) + 5E-06f)) + " true melee damage"; - } - } - } - } - - if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: Reduces the mana cost of the Space Gun by 50%"; - } - } - } - if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 15% increased mining speed"; - } - } - } - if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 10% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +2 defense and 25% increased mining speed"; - } - } - } - if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 20% increased mining speed"; - } - } - } - if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 35% increased mining speed"; - } - } - } - if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 30% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientGoldHelmet || item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +3 defense and 45% increased mining speed"; - } - } - } - if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = "Set Bonus: +4 defense and 40% increased mining speed"; - } - } - } - if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) - { - if (!Main.player[Main.myPlayer].Calamity().forbiddenCirclet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nThe minion damage nerf is reduced while wielding magic weapons"; - } - } - } - } - if (item.type == ItemID.GladiatorHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "3 defense\n" + - "3% increased rogue damage"; - } - } - } - if (item.type == ItemID.GladiatorBreastplate) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "3% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.GladiatorLeggings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue velocity"; - } - } - } - if (item.type == ItemID.ObsidianHelm) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue damage"; - } - } - } - if (item.type == ItemID.ObsidianShirt) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "5 defense\n" + - "3% increased rogue critical strike chance"; - } - } - } - if (item.type == ItemID.ObsidianPants) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Defense") - { - line2.text = "4 defense\n" + - "3% increased rogue velocity"; - } - } - } - if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage -20% extra true melee damage -Grants immunity to fire blocks, and temporary immunity to lava -Provides heat and cold protection in Death Mode"; - } - } - } - else - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text = @"Set Bonus: 17% extra melee damage -20% extra true melee damage -Grants immunity to fire blocks, and temporary immunity to lava"; - } - } - } - } - if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) - { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "SetBonus") - { - line2.text += "\nProvides heat and cold protection in Death Mode"; - } - } - } - } - if (item.type == ItemID.MagicQuiver) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Increases arrow damage by 10% and greatly increases arrow speed"; - } - } - } - if (item.type == ItemID.MiningHelmet) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides light when worn\n" + - "Provides a small amount of light in the Abyss"; - } - } - } - if (item.type == ItemID.HandWarmer) - { - string coldImmunity = CalamityWorld.death ? "\nProvides cold protection in Death Mode" : ""; - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Provides immunity to chilling and freezing effects\n" + - "Provides a regeneration boost while wearing the Eskimo armor" + coldImmunity; - } - } - } - if (item.type == ItemID.AngelWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "+20 max life, +15 defense and +3 life regen"; - } - } - } - if (item.type == ItemID.DemonWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "10% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.Jetpack) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 115"; - } - } - } - if (item.type == ItemID.ButterflyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+50 max mana, 5% decreased mana usage,\n" + - "10% increased magic damage and 5% increased magic critical strike chance"; - } - } - } - if (item.type == ItemID.FairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "+80 max life"; - } - } - } - if (item.type == ItemID.BeeWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 130\n" + - "Honey buff at all times"; - } - } - } - if (item.type == ItemID.HarpyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "30% increased movement speed\n" + - "Most attacks have a chance to fire a feather on swing if Harpy Ring or Angel Treads are equipped"; - } - } - } - if (item.type == ItemID.BoneWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "15% increased movement speed, 12% increased ranged damage,\n" + - "16% increased ranged critical strike chance\n" + - "and +30 defense while wearing the Necro Armor"; - } - } - } - if (item.type == ItemID.FlameWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "10% increased melee damage\n" + - "and 5% increased melee critical strike chance"; - } - } - } - if (item.type == ItemID.FrozenWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "2% increased melee and ranged damage\n" + - "and 1% increased melee and ranged critical strike chance\n" + - "while wearing the Frost Armor"; - } - } - } - if (item.type == ItemID.GhostWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense and 5% increased damage reduction while wearing the Spectre Armor and Hood\n" + - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Spectre Armor and Mask"; - } - } - } - if (item.type == ItemID.BeetleWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+15 defense and 10% increased damage reduction while wearing the Beetle Armor and Shell\n" + - "10% increased melee damage and critical strike chance while wearing the Beetle Armor and Scale Mail"; - } - } - } - if (item.type == ItemID.FinWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 100\n" + - "Gills effect and you can move freely through liquids\n" + - "You fall faster while submerged in liquid\n" + - "20% increased movement speed and 36% increased jump speed"; - } - } - } - if (item.type == ItemID.FishronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 8\n" + - "Acceleration multiplier: 2\n" + - "Good vertical speed\n" + - "Flight time: 180"; - } - } - } - if (item.type == ItemID.SteampunkWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "+8 defense, 10% increased movement speed,\n" + - "4% increased damage, and 2% increased critical strike chance"; - } - } - } - if (item.type == ItemID.LeafWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 6.75\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+10 defense, 10% increased damage reduction,\n" + - "and the Dryad's permanent blessing while wearing the Tiki Armor"; - } - } - } - if (item.type == ItemID.BatWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 140\n" + - "At night or during an eclipse, you will gain the following boosts:\n" + - "10% increased movement speed, 20% increased jump speed,\n" + - "+15 defense, 10% increased damage, and 5% increased critical strike chance"; - } - } - } - if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || - item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || - item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || - item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "'Great for impersonating devs!'\n" + - "Horizontal speed: 7\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.type == ItemID.TatteredFairyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "5% increased damage and critical strike chance"; - } - } - } - if (item.type == ItemID.SpookyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 180\n" + - "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"; - } - } - } - if (item.type == ItemID.Hoverboard) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip1") - { - line2.text = "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.25\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "10% increased damage to bows, guns, rocket launchers, and flamethrowers while wearing the Shroomite Armor\n" + - "Boosted weapon type depends on the Shroomite Helmet worn"; - } - } - } - if (item.type == ItemID.FestiveWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 7.5\n" + - "Acceleration multiplier: 1\n" + - "Average vertical speed\n" + - "Flight time: 170\n" + - "+50 max life\n" + - "Ornaments rain down as you fly"; - } - } - } - if (item.type == ItemID.MothronWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 0\n" + - "Acceleration multiplier: 0\n" + - "Average vertical speed\n" + - "Flight time: 160\n" + - "+5 defense, 5% increased damage,\n" + - "10% increased movement speed and 24% increased jump speed"; - } - } - } - if (item.type == ItemID.WingsSolar) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "7% increased melee damage and 3% increased melee critical strike chance\n" + - "while wearing the Solar Flare Armor"; - } - } - } - if (item.type == ItemID.WingsStardust) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Horizontal speed: 9\n" + - "Acceleration multiplier: 2.5\n" + - "Great vertical speed\n" + - "Flight time: 180\n" + - "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"; - } - } - } - if (item.type == ItemID.WingsVortex) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "3% increased ranged damage and 7% increased ranged critical strike chance\n" + - "while wearing the Vortex Armor"; - } - } - } - if (item.type == ItemID.WingsNebula) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip0") - { - line2.text = "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6.5\n" + - "Acceleration multiplier: 1.5\n" + - "Good vertical speed\n" + - "Flight time: 160\n" + - "+20 max mana, 5% increased magic damage and critical strike chance,\n" + - "and 5% decreased mana usage while wearing the Nebula Armor"; - } - } - } - if (item.type == ItemID.BetsyWings) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Allows flight and slow fall\n" + - "Hold DOWN and JUMP to hover\n" + - "Horizontal speed: 6\n" + - "Acceleration multiplier: 2.5\n" + - "Good vertical speed\n" + - "Flight time: 150"; - } - } - } - if (item.type == ItemID.GrapplingHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.AmethystHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 10\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.TopazHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 20.625\n" + - "Launch Velocity: 10.5\n" + - "Pull Velocity: 11.75"; - } - } - } - if (item.type == ItemID.SapphireHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 22.5\n" + - "Launch Velocity: 11\n" + - "Pull Velocity: 12.5"; - } - } - } - if (item.type == ItemID.EmeraldHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 24.375\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 13.25"; - } - } - } - if (item.type == ItemID.RubyHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 26.25\n" + - "Launch Velocity: 12\n" + - "Pull Velocity: 14"; - } - } - } - if (item.type == ItemID.DiamondHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 28.125\n" + - "Launch Velocity: 12.5\n" + - "Pull Velocity: 14.75"; - } - } - } - if (item.type == ItemID.WebSlinger) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 15.625\n" + - "Launch Velocity: 10\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.SkeletronHand) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 21.875\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.SlimeHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 18.75\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.FishHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.IvyWhip) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 13\n" + - "Pull Velocity: 15"; - } - } - } - if (item.type == ItemID.BatHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 31.25\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 20"; - } - } - } - if (item.type == ItemID.CandyCaneHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 25\n" + - "Launch Velocity: 11.5\n" + - "Pull Velocity: 11"; - } - } - } - if (item.type == ItemID.DualHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 27.5\n" + - "Launch Velocity: 14\n" + - "Pull Velocity: 17"; - } - } - } - if (item.type == ItemID.ThornHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.WormHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.TendonHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.IlluminantHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 30\n" + - "Launch Velocity: 15\n" + - "Pull Velocity: 18"; - } - } - } - if (item.type == ItemID.AntiGravityHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 31.25\n" + - "Launch Velocity: 14\n" + - "Pull Velocity: 20"; - } - } - } - if (item.type == ItemID.SpookyHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 22"; - } - } - } - if (item.type == ItemID.ChristmasHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 15.5\n" + - "Pull Velocity: 17"; - } - } - } - if (item.type == ItemID.LunarHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 34.375\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } - if (item.type == ItemID.StaticHook) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "Equipable") - { - line2.text = "Equipable\n" + - "Reach: 37.5\n" + - "Launch Velocity: 16\n" + - "Pull Velocity: 24"; - } - } - } - if (item.accessory) - { - if (item.prefix == PrefixID.Precise) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - { - line2.text = "+1% critical strike chance"; - } - } - } - if (item.prefix == PrefixID.Lucky) - { - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccCritChance") - { - line2.text = "+3% critical strike chance"; - } - } - } - if (item.prefix == PrefixID.Hard) - { - string defenseBoost = "+1 defense\n"; - if (NPC.downedMoonlord) - { - defenseBoost = "+3 defense\n"; - } - else if (Main.hardMode) - { - defenseBoost = "+2 defense\n"; - } - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = defenseBoost + "+0.25% damage reduction"; - } - } - } - if (item.prefix == PrefixID.Guarding) - { - string defenseBoost = "+2 defense\n"; - if (NPC.downedMoonlord) - { - defenseBoost = "+4 defense\n"; - } - else if (Main.hardMode) - { - defenseBoost = "+3 defense\n"; - } - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = defenseBoost + "+0.5% damage reduction"; - } - } - } - if (item.prefix == PrefixID.Armored) - { - string defenseBoost = "+3 defense\n"; - if (NPC.downedMoonlord) - { - defenseBoost = "+6 defense\n"; - } - else if (Main.hardMode) - { - defenseBoost = "+4 defense\n"; - } - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = defenseBoost + "+0.75% damage reduction"; - } - } - } - if (item.prefix == PrefixID.Warding) - { - string defenseBoost = "+4 defense\n"; - if (NPC.downedMoonlord) - { - defenseBoost = "+8 defense\n"; - } - else if (Main.hardMode) - { - defenseBoost = "+6 defense\n"; - } - foreach (TooltipLine line2 in tooltips) - { - if (line2.mod == "Terraria" && line2.Name == "PrefixAccDefense") - { - line2.text = defenseBoost + "+1% damage reduction"; - } - } - } - } - - Mod fargos = ModLoader.GetMod("Fargowiltas"); - if (fargos != null) - { - //Fargo's fountain effects - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Sunken Sea upon activation"); - tooltips.Add(line); - } - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Sulphurous Sea upon activation"); - tooltips.Add(line); - } - if (item.type == ModContent.ItemType()) - { - TooltipLine line = new TooltipLine(mod, "Tooltip0", "Forces surrounding biome state to Astral upon activation"); - tooltips.Add(line); - } - } - - if (item.type > ItemID.Count && item.Calamity().Chargeable) - { - float chargeRatio = item.Calamity().CurrentCharge / (float)ChargeMax; - chargeRatio *= 100f; // Turn the 0-1 ratio to a 0-100 percentage. - TooltipLine line = new TooltipLine(mod, "Tooltip0", $"Current Charge: {chargeRatio:N1}%"); - tooltips.Add(line); + mult *= ChargeDamageFormula(); } } - #endregion - // NOTE: this function applies to all treasure bags, even modded ones (despite the name). - #region Boss Bag Changes - public override void OpenVanillaBag(string context, Player player, int arg) + internal float DischargeEnchantmentDamageFormula() + { + // This exponential has the properties of beginning at 0 and ending at 1, yet also has their signature rising curve. + // It is therefore perfect for a potential interpolant. + float interpolant = (float)Math.Pow(2D, DischargeExhaustionRatio) - 1f; + + // No further smoothening is required in the form of a Smoothstep remap. + // A linear interpolation works fine; the exponential already has the desired curve shape. + return MathHelper.Lerp(DischargeEnchantMinDamageFactor, DischargeEnchantMaxDamageFactor, interpolant); + } + + // This formula gives a slightly higher value than 1.0 above 85% charge, and a slightly lower value than 0.0 at 0% charge. + // Specifically, it gives 0.0 or less at 0.36% charge or lower. This is fine because the result is immediately clamped. + internal float ChargeDamageFormula() { - if (context == "crate") - { - switch (arg) - { - case ItemID.WoodenCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 3, 5); - break; - - case ItemID.IronCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - break; - - case ItemID.CorruptFishingCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - break; - - case ItemID.CrimsonFishingCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 5, 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - break; - - case ItemID.HallowedFishingCrate: - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.2f, 5, 10); - DropHelper.DropItemCondition(player, (WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType()), CalamityWorld.downedProvidence, 0.2f, 1, 3); - break; - - case ItemID.DungeonFishingCrate: - DropHelper.DropItemCondition(player, ItemID.Ectoplasm, NPC.downedPlantBoss, 0.3f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.2f, 5, 10); - break; - - case ItemID.JungleFishingCrate: - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 5, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); - DropHelper.DropItemCondition(player, ItemID.ChlorophyteBar, (CalamityWorld.downedCalamitas || NPC.downedPlantBoss), 0.25f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedPlantBoss, 0.25f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 3, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.25f, 5, 10); - break; - - case ItemID.FloatingIslandFishingCrate: - DropHelper.DropItemCondition(player, ModContent.ItemType(), (CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator), 0.25f, 5, 10); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 5, 15); - DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.1f, 1, 3); - break; - } - } - - if (context == "bossBag") - { - // Give a chance for Laudanum, Stress Pills and Heart of Darkness from every boss bag - DropHelper.DropRevBagAccessories(player); - - switch (arg) - { - // King Slime - case ItemID.KingSlimeBossBag: - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge); - break; - - // Eye of Cthulhu - case ItemID.EyeOfCthulhuBossBag: - DropHelper.DropItem(player, ModContent.ItemType(), 3, 5); - DropHelper.DropItemChance(player, ModContent.ItemType(), 3); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge); - break; - - // Queen Bee - case ItemID.QueenBeeBossBag: - DropHelper.DropItem(player, ItemID.Stinger, 8, 12); - DropHelper.DropItem(player, ModContent.ItemType(), 50, 75); - break; - - // Skeletron - case ItemID.SkeletronBossBag: - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - break; - - // Wall of Flesh - case ItemID.WallOfFleshBossBag: - DropHelper.DropItemChance(player, ModContent.ItemType(), 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4); - DropHelper.DropItemFromSetChance(player, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); - DropHelper.DropItemCondition(player, ModContent.ItemType(), !CalamityWorld.demonMode); // Demon Trophy - break; - - // Destroyer - case ItemID.DestroyerBossBag: - float shpcChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, shpcChance); - break; - - // Plantera - case ItemID.PlanteraBossBag: - DropHelper.DropItem(player, ModContent.ItemType(), 16, 22); - float bFluxChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, bFluxChance); - DropHelper.DropItemChance(player, ItemID.JungleKey, 5); - break; - - // Golem - case ItemID.GolemBossBag: - float aegisChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, aegisChance); - DropHelper.DropItem(player, ModContent.ItemType(), 8, 13); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - break; - - // Duke Fishron - case ItemID.FishronBossBag: - float baronChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, baronChance); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4); - break; - - // Betsy - case ItemID.BossBagBetsy: - float vesuviusChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, vesuviusChance); - break; - - // Moon Lord - case ItemID.MoonLordBossBag: - DropHelper.DropItem(player, ItemID.LunarOre, 50, 50); - DropHelper.DropItem(player, ModContent.ItemType()); // Celestial Onion - DropHelper.DropItemChance(player, ModContent.ItemType(), 8); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - break; - } - } + float x = MathHelper.Clamp(ChargeRatio, 0f, 1f); + float y = 1.087f - 0.08f / (x + 0.07f); + return MathHelper.Clamp(y, 0f, 1f); } #endregion @@ -3082,29 +1395,180 @@ Grants immunity to fire blocks, and temporary immunity to lava"; player.spaceGun = false; modPlayer.meteorSet = true; } + else if (set == "MonkTier2") + { + player.minionDamage += 0.15f; + player.meleeDamage += 0.1f; + player.meleeSpeed += 0.1f; + player.meleeCrit += 10; + player.setBonus = "Increases your max number of sentries\n" + + "Lightning Aura can now crit and strikes faster\n" + + "10% increased melee speed, minion and melee damage"; + } + else if (set == "SquireTier2") + { + player.lifeRegen += 3; + player.minionDamage += 0.15f; + player.meleeCrit += 15; + player.setBonus = "Increases your max number of sentries\n" + + "Ballista pierces more targets and panics when you take damage\n" + + "Increases 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.setBonus = "Increases your max number of sentries\n" + + "Explosive Traps recharge faster and oil enemies\n" + + "Set oiled enemies on fire for extra damage\n" + + "10% increased minion and ranged damage"; + } + else if (set == "ApprenticeTier2") + { + player.minionDamage += 0.05f; + player.magicCrit += 15; + player.setBonus = "Increases your max number of sentries\n" + + "Flameburst field of view and range are dramatically increased\n" + + "5% increased minion damage and 15% increased magic critical strike chance"; + } + else if (set == "MonkTier3") + { + player.minionDamage += 0.3f; + player.meleeSpeed += 0.1f; + player.meleeDamage += 0.1f; + player.meleeCrit += 10; + player.setBonus = "Increases your max number of sentries\n" + + "Greatly enhances Lightning Aura effectiveness\n" + + "10% 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.setBonus = "Increases your max number of sentries\n" + + "Greatly enhances Ballista effectiveness\n" + + "Massively 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.setBonus = "Increases your max number of sentries\n" + + "Greatly enhances Explosive Traps effectiveness\n" + + "10% increased minion and ranged damage"; + } + else if (set == "ApprenticeTier3") + { + player.minionDamage += 0.1f; + player.magicCrit += 15; + player.setBonus = "Increases your max number of sentries\n" + + "Greatly enhances Flameburst effectiveness\n" + + "10% increased minion damage and 15% increased magic critical strike chance"; + } + else if (set == "Stardust") + { + player.maxMinions += 2; + } } #endregion #region Equip Changes public override void UpdateEquip(Item item, Player player) { - #region Head - if (item.type == ItemID.SpectreHood) - player.magicDamage += 0.2f; - else if (item.type == ItemID.GladiatorHelmet || item.type == ItemID.ObsidianHelm) - player.Calamity().throwingDamage += 0.03f; - #endregion + switch (item.type) + { + case ItemID.GladiatorHelmet: + case ItemID.ObsidianHelm: + player.Calamity().throwingDamage += 0.03f; + break; + case ItemID.GladiatorBreastplate: + case ItemID.ObsidianShirt: + player.Calamity().throwingCrit += 3; + break; + case ItemID.GladiatorLeggings: + case ItemID.ObsidianPants: + player.Calamity().throwingVelocity += 0.03f; + break; - #region Body - if (item.type == ItemID.GladiatorBreastplate || item.type == ItemID.ObsidianShirt) - player.Calamity().throwingCrit += 3; - #endregion + case ItemID.SpectreHood: + player.magicDamage += 0.2f; + break; - #region Legs - if (item.type == ItemID.GladiatorLeggings || item.type == ItemID.ObsidianPants) - player.Calamity().throwingVelocity += 0.03f; - #endregion - } + case ItemID.SquireGreatHelm: + player.lifeRegen -= 7; + break; + case ItemID.SquirePlating: + player.minionDamage -= 0.05f; + player.meleeDamage -= 0.05f; + break; + case ItemID.SquireGreaves: + player.minionDamage -= 0.1f; + player.meleeCrit -= 10; + break; + + case ItemID.MonkBrows: + player.meleeSpeed -= 0.1f; + break; + case ItemID.MonkShirt: + player.minionDamage -= 0.1f; + player.meleeDamage -= 0.1f; + break; + case ItemID.MonkPants: + player.minionDamage -= 0.05f; + player.meleeCrit -= 10; + break; + + case ItemID.HuntressJerkin: + player.minionDamage -= 0.1f; + player.rangedDamage -= 0.1f; + break; + + case ItemID.ApprenticeTrousers: + player.minionDamage -= 0.05f; + player.magicCrit -= 15; + break; + + case ItemID.SquireAltShirt: + player.lifeRegen -= 14; + break; + case ItemID.SquireAltPants: + player.minionDamage -= 0.1f; + player.meleeCrit -= 10; + break; + + case ItemID.MonkAltHead: + player.minionDamage -= 0.1f; + player.meleeDamage -= 0.1f; + break; + case ItemID.MonkAltShirt: + player.minionDamage -= 0.1f; + player.meleeSpeed -= 0.1f; + break; + case ItemID.MonkAltPants: + player.minionDamage -= 0.1f; + player.meleeCrit -= 10; + break; + + case ItemID.HuntressAltShirt: + player.minionDamage -= 0.1f; + player.rangedDamage -= 0.1f; + break; + + case ItemID.ApprenticeAltPants: + player.minionDamage -= 0.1f; + player.magicCrit -= 15; + break; + + case ItemID.StardustBreastplate: + case ItemID.StardustLeggings: + player.maxMinions--; + break; + } + } #endregion #region Accessory Changes @@ -3121,6 +1585,9 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } } + if (item.type == ItemID.FrogLeg) + player.jumpSpeedBoost -= 1.2f; + if (item.type == ItemID.FireGauntlet) { player.meleeDamage += 0.04f; @@ -3130,20 +1597,20 @@ Grants immunity to fire blocks, and temporary immunity to lava"; if (item.type == ItemID.AngelWings) // Boost to max life, defense, and life regen { player.statLifeMax2 += 20; - player.statDefense += 15; - player.lifeRegen += 3; + player.statDefense += 10; + player.lifeRegen += 2; player.noFallDmg = true; } else if (item.type == ItemID.DemonWings) // Boost to all damage and crit { - player.allDamage += 0.1f; - modPlayer.AllCritBoost(10); + player.allDamage += 0.05f; + modPlayer.AllCritBoost(5); player.noFallDmg = true; } else if (item.type == ItemID.FinWings) // Boosted water abilities, faster fall in water { - player.moveSpeed += 0.2f; - player.jumpSpeedBoost += 1.8f; + player.moveSpeed += 0.15f; + player.jumpSpeedBoost += 0.9f; player.gills = true; player.ignoreWater = true; player.noFallDmg = true; @@ -3160,15 +1627,15 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } else if (item.type == ItemID.ButterflyWings) // Boost to magic stats { - player.statManaMax2 += 50; - player.magicDamage += 0.1f; + player.statManaMax2 += 20; + player.magicDamage += 0.05f; player.manaCost *= 0.95f; player.magicCrit += 5; player.noFallDmg = true; } else if (item.type == ItemID.FairyWings) // Boost to max life { - player.statLifeMax2 += 80; + player.statLifeMax2 += 60; player.noFallDmg = true; } else if (item.type == ItemID.BatWings) // Stronger at night @@ -3176,17 +1643,16 @@ Grants immunity to fire blocks, and temporary immunity to lava"; player.noFallDmg = true; if (!Main.dayTime || Main.eclipse) { - player.jumpSpeedBoost += 1.0f; - player.statDefense += 15; - player.allDamage += 0.1f; - modPlayer.AllCritBoost(5); + player.jumpSpeedBoost += 0.5f; + player.allDamage += 0.07f; + modPlayer.AllCritBoost(3); player.moveSpeed += 0.1f; } } else if (item.type == ItemID.HarpyWings) { modPlayer.harpyWingBoost = true; - player.moveSpeed += 0.3f; + player.moveSpeed += 0.2f; player.noFallDmg = true; } else if (item.type == ItemID.BoneWings) // Bonus to ranged and defense stats while wearing necro armor @@ -3195,9 +1661,9 @@ Grants immunity to fire blocks, and temporary immunity to lava"; if ((player.head == ArmorIDs.Head.NecroHelmet || player.head == ArmorIDs.Head.AncientNecroHelmet) && player.body == ArmorIDs.Body.NecroBreastplate && player.legs == ArmorIDs.Legs.NecroGreaves) { - player.moveSpeed += 0.15f; - player.rangedDamage += 0.12f; - player.rangedCrit += 16; + player.moveSpeed += 0.1f; + player.rangedDamage += 0.1f; + player.rangedCrit += 10; player.statDefense += 30; } } @@ -3206,7 +1672,7 @@ Grants immunity to fire blocks, and temporary immunity to lava"; player.statDefense += 5; player.allDamage += 0.05f; player.moveSpeed += 0.1f; - player.jumpSpeedBoost += 1.2f; + player.jumpSpeedBoost += 0.6f; player.noFallDmg = true; } else if (item.type == ItemID.FrozenWings) // Bonus to melee and ranged stats while wearing frost armor @@ -3222,7 +1688,7 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } else if (item.type == ItemID.FlameWings) // Bonus to melee stats { - player.meleeDamage += 0.1f; + player.meleeDamage += 0.05f; player.meleeCrit += 5; player.noFallDmg = true; } @@ -3238,9 +1704,7 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } else if (player.head == ArmorIDs.Head.SpectreMask) { - player.statManaMax2 += 20; player.magicDamage += 0.05f; - player.manaCost *= 0.95f; player.magicCrit += 5; } } @@ -3252,13 +1716,13 @@ Grants immunity to fire blocks, and temporary immunity to lava"; { if (player.body == ArmorIDs.Body.BeetleShell) { - player.statDefense += 15; - player.endurance += 0.1f; + player.statDefense += 10; + player.endurance += 0.05f; } else if (player.body == ArmorIDs.Body.BeetleScaleMail) { - player.meleeDamage += 0.1f; - player.meleeCrit += 10; + player.meleeDamage += 0.05f; + player.meleeCrit += 5; } } } @@ -3290,23 +1754,26 @@ Grants immunity to fire blocks, and temporary immunity to lava"; player.noFallDmg = true; if (player.head == ArmorIDs.Head.TikiMask && player.body == ArmorIDs.Body.TikiShirt && player.legs == ArmorIDs.Legs.TikiPants) { - player.statDefense += 10; - player.endurance += 0.1f; + player.statDefense += 5; + player.endurance += 0.05f; player.AddBuff(BuffID.DryadsWard, 5, true); // Dryad's Blessing } } else if (item.type == ItemID.FestiveWings) // Drop powerful homing christmas tree bulbs while in flight { player.noFallDmg = true; - player.statLifeMax2 += 50; + player.statLifeMax2 += 40; if (modPlayer.icicleCooldown <= 0) { if (player.controlJump && !player.jumpAgainCloud && player.jump == 0 && player.velocity.Y != 0f && !player.mount.Active && !player.mount.Cart) { - int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, player.velocity.X * 0f, 2f, ProjectileID.OrnamentFriendly, (int)(100 * player.AverageDamage()), 5f, player.whoAmI); - Main.projectile[p].Calamity().forceTypeless = true; - Main.projectile[p].Calamity().lineColor = 1; - modPlayer.icicleCooldown = 10; + int p = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 2f, ProjectileID.OrnamentFriendly, (int)(100 * player.AverageDamage()), 5f, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].Calamity().forceTypeless = true; + Main.projectile[p].Calamity().lineColor = 1; + modPlayer.icicleCooldown = 10; + } } } } @@ -3395,16 +1862,26 @@ Grants immunity to fire blocks, and temporary immunity to lava"; // Hard / Guarding / Armored / Warding give 0.25% / 0.5% / 0.75% / 1% DR if (item.prefix == PrefixID.Hard) { - if (NPC.downedMoonlord) + if (CalamityWorld.downedDoG) + player.statDefense += 3; + else if (CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast) player.statDefense += 2; - else if (Main.hardMode) + else if (NPC.downedGolemBoss || NPC.downedMoonlord) player.statDefense += 1; player.endurance += 0.0025f; } if (item.prefix == PrefixID.Guarding) { - if (NPC.downedMoonlord) + if (CalamityWorld.downedDoG) + player.statDefense += 6; + else if (CalamityWorld.downedPolterghast) + player.statDefense += 5; + else if (CalamityWorld.downedProvidence) + player.statDefense += 4; + else if (NPC.downedMoonlord) + player.statDefense += 3; + else if (NPC.downedGolemBoss) player.statDefense += 2; else if (Main.hardMode) player.statDefense += 1; @@ -3413,7 +1890,15 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } if (item.prefix == PrefixID.Armored) { - if (NPC.downedMoonlord) + if (CalamityWorld.downedDoG) + player.statDefense += 9; + else if (CalamityWorld.downedPolterghast) + player.statDefense += 7; + else if (CalamityWorld.downedProvidence) + player.statDefense += 6; + else if (NPC.downedMoonlord) + player.statDefense += 4; + else if (NPC.downedGolemBoss) player.statDefense += 3; else if (Main.hardMode) player.statDefense += 1; @@ -3422,7 +1907,15 @@ Grants immunity to fire blocks, and temporary immunity to lava"; } if (item.prefix == PrefixID.Warding) { - if (NPC.downedMoonlord) + if (CalamityWorld.downedDoG) + player.statDefense += 12; + else if (CalamityWorld.downedPolterghast) + player.statDefense += 10; + else if (CalamityWorld.downedProvidence) + player.statDefense += 8; + else if (NPC.downedMoonlord) + player.statDefense += 6; + else if (NPC.downedGolemBoss) player.statDefense += 4; else if (Main.hardMode) player.statDefense += 2; @@ -3430,38 +1923,46 @@ Grants immunity to fire blocks, and temporary immunity to lava"; player.endurance += 0.01f; } - // Precise only gives 1% crit and Lucky only gives 3% crit - if ((item.prefix == PrefixID.Precise) || (item.prefix == PrefixID.Lucky)) - { - player.meleeCrit -= 1; - player.rangedCrit -= 1; - player.magicCrit -= 1; - player.thrownCrit -= 1; - } - } + // TODO -- make all prefixes relevant. Details in Ozz's todo. + /* + if (item.prefix == PrefixID.Precise || item.prefix == PrefixID.Lucky) + player.armorPenetration += 1; + */ + + if (item.prefix == PrefixID.Brisk) + player.moveSpeed += 0.01f; + if (item.prefix == PrefixID.Fleeting) + player.moveSpeed += 0.02f; + if (item.prefix == PrefixID.Hasty2) + player.moveSpeed += 0.03f; + if (item.prefix == PrefixID.Quick2) + player.moveSpeed += 0.04f; + } #endregion #region WingChanges public override void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) { CalamityPlayer modPlayer = player.Calamity(); - float flightSpeedMult = 1f + + float moveSpeedBoost = modPlayer.moveSpeedStat * 0.001f; + + float flightSpeedMult = 1f + (modPlayer.soaring ? 0.1f : 0f) + (modPlayer.holyWrath ? 0.05f : 0f) + (modPlayer.profanedRage ? 0.05f : 0f) + - (modPlayer.draconicSurge ? 0.15f : 0f) + - (modPlayer.etherealExtorter && modPlayer.ZoneAstral ? 0.05f : 0f); - if (flightSpeedMult > 1.2f) - flightSpeedMult = 1.2f; + (modPlayer.draconicSurge ? 0.1f : 0f) + + (modPlayer.reaverSpeed ? 0.1f : 0f) + + moveSpeedBoost; + float flightAccMult = 1f + + (modPlayer.draconicSurge ? 0.1f : 0f) + + moveSpeedBoost; + + flightSpeedMult = MathHelper.Clamp(flightSpeedMult, 0.5f, 1.5f); speed *= flightSpeedMult; - float flightAccMult = 1f + - (modPlayer.draconicSurge ? 0.15f : 0f); - if (flightAccMult > 1.2f) - flightAccMult = 1.2f; - - acceleration *= flightAccMult; + flightAccMult = MathHelper.Clamp(flightAccMult, 0.5f, 1.5f); + acceleration *= flightAccMult; } #endregion @@ -3470,50 +1971,16 @@ Grants immunity to fire blocks, and temporary immunity to lava"; { CalamityPlayer modPlayer = player.Calamity(); int itemGrabRangeBoost = 0 + - (modPlayer.wallOfFleshLore ? 10 : 0) + - (modPlayer.planteraLore ? 20 : 0) + - (modPlayer.polterghastLore ? 30 : 0); + (modPlayer.reaverExplore ? 20 : 0); grabRange += itemGrabRangeBoost; } #endregion - #region The Horseman's Blade - public static void HorsemansBladeOnHit(Player player, int targetIdx, int damage, float knockback, bool hasExtraUpdates) - { - int x = Main.rand.Next(100, 300); - int y = Main.rand.Next(100, 300); + #region Ammo + public override bool ConsumeAmmo(Item item, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost; - // Pick a random side: left or right - if (Main.rand.NextBool(2)) - x -= Main.LogicCheckScreenWidth / 2 + x; - else - x += Main.LogicCheckScreenWidth / 2 - x; - - // Pick a random side: top or bottom - if (Main.rand.NextBool(2)) - y -= Main.LogicCheckScreenHeight / 2 + y; - else - y += Main.LogicCheckScreenHeight / 2 - y; - - x += (int)player.position.X; - y += (int)player.position.Y; - float speed = 8f; - Vector2 vector = new Vector2((float)x, (float)y); - float dx = Main.npc[targetIdx].position.X - vector.X; - float dy = Main.npc[targetIdx].position.Y - vector.Y; - float dist = (float)Math.Sqrt(dx * dx + dy * dy); - dist = speed / dist; - dx *= dist; - dy *= dist; - int projectile = Projectile.NewProjectile(x, y, dx, dy, ProjectileID.FlamingJack, damage, knockback, player.whoAmI, targetIdx, 0f); - if (hasExtraUpdates) - Main.projectile[projectile].extraUpdates += 1; - } - #endregion - - #region Consume Additional Ammo - public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) + public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) { bool flag = false; bool canShoot = false; @@ -3578,8 +2045,10 @@ Grants immunity to fire blocks, and temporary immunity to lava"; dontConsumeAmmo = true; if (player.ammoCost75 && Main.rand.NextBool(4)) dontConsumeAmmo = true; + if (Main.rand.NextFloat() > player.Calamity().rangedAmmoCost) + dontConsumeAmmo = true; - if (!dontConsumeAmmo && itemAmmo.consumable) + if (!dontConsumeAmmo && itemAmmo.consumable) { itemAmmo.stack -= ammoConsumed; if (itemAmmo.stack <= 0) @@ -3594,28 +2063,781 @@ Grants immunity to fire blocks, and temporary immunity to lava"; #region PostUpdate public override void PostUpdate(Item item) { - if (CalamityMod.forceItemList?.Contains(item.type) ?? false) - { + if (CalamityLists.forceItemList?.Contains(item.type) ?? false) CalamityUtils.ForceItemIntoWorld(item); + } + #endregion + + #region Inventory Drawing + internal static ChargingEnergyParticleSet EnchantmentEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.DarkViolet, Color.White, 0.04f, 24f); + + internal static void UpdateAllParticleSets() + { + EnchantmentEnergyParticles.Update(); + } + + public override bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + void drawItemManually(Color color, float generalScale) + { + Texture2D itemTexture = Main.itemTexture[item.type]; + Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture); + Vector2 itemOrigin = itemFrame.Size() * 0.5f; + spriteBatch.Draw(itemTexture, position, itemFrame, color, 0f, itemOrigin, scale * generalScale, SpriteEffects.None, 0f); + } + + if (!EnchantmentManager.ItemUpgradeRelationship.ContainsKey(item.type) || !Main.LocalPlayer.InventoryHas(ModContent.ItemType())) + return true; + + // Draw all particles. + float currentPower = 0f; + int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); + if (calamitasNPCIndex != -1) + currentPower = Utils.InverseLerp(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); + + position += frame.Size() * 0.25f; + EnchantmentEnergyParticles.InterpolationSpeed = MathHelper.Lerp(0.035f, 0.1f, currentPower); + EnchantmentEnergyParticles.DrawSet(position + Main.screenPosition); + + float pulse = Main.GlobalTime * 0.79f % 1f; + float pulseFade = Utils.InverseLerp(0.87f, 0.27f, pulse, true); + float pulseScale = scale * MathHelper.Lerp(1.6f, 1f, pulseFade) / scale; + Color pulseColor = Color.Lerp(drawColor, Color.BlueViolet, pulseFade) * pulseFade; + drawItemManually(pulseColor, pulseScale); + drawItemManually(drawColor, 1f); + + return false; + } + #endregion + + #region Reforging + private int NewPrefixType(Item item) + { + int prefix = -2; + if (item.accessory) + { + if (Main.player[Main.myPlayer].Calamity().finalTierAccessoryReforge) + { + // Warding = 18, Menacing = 19, Quick = 20, Violent = 21, Lucky = 22, Silent = 23 + prefix = Main.rand.Next(18, 24); + } + else + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Hard = 1, Jagged = 2, Brisk = 3, Wild = 4, Quiet = 5 + prefix = Main.rand.Next(1, 6); + break; + case 2: + // Guarding = 6, Spiked = 7, Fleeting = 8, Rash = 9, Cloaked = 10 + prefix = Main.rand.Next(6, 11); + break; + case 3: + // Precise = 11, Arcane = 12 + prefix = Main.rand.Next(11, 13); + break; + case 4: + // Armored = 13, Angry = 14, Hasty = 15, Intrepid = 16, Camouflaged = 17 + prefix = Main.rand.Next(13, 18); + break; + case 5: + case 6: + // Warding = 18, Menacing = 19, Quick = 20, Violent = 21, Lucky = 22, Silent = 23 + prefix = Main.rand.Next(18, 24); + break; + } + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Hard; + break; + case 2: + prefix = PrefixID.Jagged; + break; + case 3: + prefix = PrefixID.Brisk; + break; + case 4: + prefix = PrefixID.Wild; + break; + case 5: + prefix = mod.PrefixType("Quiet"); + break; + case 6: + prefix = PrefixID.Guarding; + break; + case 7: + prefix = PrefixID.Spiked; + break; + case 8: + prefix = PrefixID.Fleeting; + break; + case 9: + prefix = PrefixID.Rash; + break; + case 10: + prefix = mod.PrefixType("Cloaked"); + break; + case 11: + prefix = PrefixID.Precise; + break; + case 12: + prefix = PrefixID.Arcane; + break; + case 13: + prefix = PrefixID.Armored; + break; + case 14: + prefix = PrefixID.Angry; + break; + case 15: + prefix = PrefixID.Hasty2; + break; + case 16: + prefix = PrefixID.Intrepid; + break; + case 17: + prefix = mod.PrefixType("Camouflaged"); + break; + case 18: + prefix = PrefixID.Warding; + break; + case 19: + prefix = PrefixID.Menacing; + break; + case 20: + prefix = PrefixID.Quick2; + break; + case 21: + prefix = PrefixID.Violent; + break; + case 22: + prefix = PrefixID.Lucky; + break; + case 23: + prefix = mod.PrefixType("Silent"); + break; + } + } + else if (item.melee) + { + // Yoyos, Flails, Spears, etc. + if (item.channel || item.noMelee) + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Keen = 1, Ruthless = 2 + prefix = Main.rand.Next(1, 3); + break; + case 2: + // Hurtful = 3, Zealous = 4 + prefix = Main.rand.Next(3, 5); + break; + case 3: + // Forceful = 5, Strong = 6 + prefix = Main.rand.Next(5, 7); + break; + case 4: + // Demonic = 7 + prefix = 7; + break; + case 5: + // Superior = 8 + prefix = 8; + break; + case 6: + // Godly = 9 + prefix = 9; + break; + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Keen; + break; + case 2: + prefix = PrefixID.Ruthless; + break; + case 3: + prefix = PrefixID.Hurtful; + break; + case 4: + prefix = PrefixID.Zealous; + break; + case 5: + prefix = PrefixID.Forceful; + break; + case 6: + prefix = PrefixID.Strong; + break; + case 7: + prefix = PrefixID.Demonic; + break; + case 8: + prefix = PrefixID.Superior; + break; + case 9: + prefix = PrefixID.Godly; + break; + } + } + // All other melee weapons + else + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Keen = 1, Ruthless = 2, Nimble = 3, Nasty = 4, Heavy = 5, Light = 6 + prefix = Main.rand.Next(1, 7); + break; + case 2: + // Hurtful = 7, Zealous = 8, Quick = 9, Pointy = 10, Bulky = 11 + prefix = Main.rand.Next(7, 12); + break; + case 3: + // Forceful = 12, Strong = 13, Agile = 14, Large = 15, Dangerous = 16, Sharp = 17 + prefix = Main.rand.Next(12, 18); + break; + case 4: + // Murderous = 18, Massive = 19, Unpleasant = 20, Deadly = 21 + prefix = Main.rand.Next(18, 22); + break; + case 5: + // Superior = 22, Demonic = 23, Savage = 24 + prefix = Main.rand.Next(22, 25); + break; + case 6: + // Legendary = 25, Light = 6 ~We are tool friendly (= + if (item.pick > 0 || item.axe > 0 || item.hammer > 0) + prefix = Main.rand.NextBool() ? 25 : 6; + else + prefix = 25; + break; + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Keen; + break; + case 2: + prefix = PrefixID.Ruthless; + break; + case 3: + prefix = PrefixID.Nimble; + break; + case 4: + prefix = PrefixID.Nasty; + break; + case 5: + prefix = PrefixID.Heavy; + break; + case 6: + prefix = PrefixID.Light; + break; + case 7: + prefix = PrefixID.Hurtful; + break; + case 8: + prefix = PrefixID.Zealous; + break; + case 9: + prefix = PrefixID.Quick; + break; + case 10: + prefix = PrefixID.Pointy; + break; + case 11: + prefix = PrefixID.Bulky; + break; + case 12: + prefix = PrefixID.Forceful; + break; + case 13: + prefix = PrefixID.Strong; + break; + case 14: + prefix = PrefixID.Agile; + break; + case 15: + prefix = PrefixID.Large; + break; + case 16: + prefix = PrefixID.Dangerous; + break; + case 17: + prefix = PrefixID.Sharp; + break; + case 18: + prefix = PrefixID.Murderous; + break; + case 19: + prefix = PrefixID.Massive; + break; + case 20: + prefix = PrefixID.Unpleasant; + break; + case 21: + prefix = PrefixID.Deadly; + break; + case 22: + prefix = PrefixID.Superior; + break; + case 23: + prefix = PrefixID.Demonic; + break; + case 24: + prefix = PrefixID.Savage; + break; + case 25: + prefix = PrefixID.Legendary; + break; + } + } + } + else if (item.ranged) + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Keen = 1, Ruthless = 2, Nimble = 3, Nasty = 4, Powerful = 5 + prefix = Main.rand.Next(1, 6); + break; + case 2: + // Hurtful = 6, Zealous = 7, Quick = 8 + prefix = Main.rand.Next(6, 9); + break; + case 3: + // Forceful = 9, Strong = 10, Agile = 11, Sighted = 12, Murderous = 13 + prefix = Main.rand.Next(9, 14); + break; + case 4: + // Superior = 14, Demonic = 15, Deadly = 16, Intimidating = 17, Unpleasant = 18 + prefix = Main.rand.Next(14, 19); + break; + case 5: + // Godly = 19, Rapid = 20, Hasty = 21, Deadly2 = 22, Staunch = 23 + prefix = Main.rand.Next(19, 24); + break; + case 6: + // Unreal = 24 + prefix = 24; + break; + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Keen; + break; + case 2: + prefix = PrefixID.Ruthless; + break; + case 3: + prefix = PrefixID.Nimble; + break; + case 4: + prefix = PrefixID.Nasty; + break; + case 5: + prefix = PrefixID.Powerful; + break; + case 6: + prefix = PrefixID.Hurtful; + break; + case 7: + prefix = PrefixID.Zealous; + break; + case 8: + prefix = PrefixID.Quick; + break; + case 9: + prefix = PrefixID.Forceful; + break; + case 10: + prefix = PrefixID.Strong; + break; + case 11: + prefix = PrefixID.Agile; + break; + case 12: + prefix = PrefixID.Sighted; + break; + case 13: + prefix = PrefixID.Murderous; + break; + case 14: + prefix = PrefixID.Superior; + break; + case 15: + prefix = PrefixID.Demonic; + break; + case 16: + prefix = PrefixID.Deadly; + break; + case 17: + prefix = PrefixID.Intimidating; + break; + case 18: + prefix = PrefixID.Unpleasant; + break; + case 19: + prefix = PrefixID.Godly; + break; + case 20: + prefix = PrefixID.Rapid; + break; + case 21: + prefix = PrefixID.Hasty; + break; + case 22: + prefix = PrefixID.Deadly2; + break; + case 23: + prefix = PrefixID.Staunch; + break; + case 24: + prefix = PrefixID.Unreal; + break; + } + } + else if (item.magic) + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Keen = 1, Ruthless = 2, Nimble = 3, Nasty = 4, Furious = 5 + prefix = Main.rand.Next(1, 6); + break; + case 2: + // Hurtful = 6, Zealous = 7, Quick = 8, Taboo = 9, Manic = 10 + prefix = Main.rand.Next(6, 11); + break; + case 3: + // Forceful = 11, Strong = 12, Agile = 13, Murderous = 14, Adept = 15, Celestial = 16 + prefix = Main.rand.Next(11, 17); + break; + case 4: + // Superior = 17, Demonic = 18, Deadly = 19, Mystic = 20 + prefix = Main.rand.Next(17, 21); + break; + case 5: + // Godly = 21, Masterful = 22 + prefix = Main.rand.Next(21, 23); + break; + case 6: + // Mythical = 23 + prefix = 23; + break; + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Keen; + break; + case 2: + prefix = PrefixID.Ruthless; + break; + case 3: + prefix = PrefixID.Nimble; + break; + case 4: + prefix = PrefixID.Nasty; + break; + case 5: + prefix = PrefixID.Furious; + break; + case 6: + prefix = PrefixID.Hurtful; + break; + case 7: + prefix = PrefixID.Zealous; + break; + case 8: + prefix = PrefixID.Quick; + break; + case 9: + prefix = PrefixID.Taboo; + break; + case 10: + prefix = PrefixID.Manic; + break; + case 11: + prefix = PrefixID.Forceful; + break; + case 12: + prefix = PrefixID.Strong; + break; + case 13: + prefix = PrefixID.Agile; + break; + case 14: + prefix = PrefixID.Murderous; + break; + case 15: + prefix = PrefixID.Adept; + break; + case 16: + prefix = PrefixID.Celestial; + break; + case 17: + prefix = PrefixID.Superior; + break; + case 18: + prefix = PrefixID.Demonic; + break; + case 19: + prefix = PrefixID.Deadly; + break; + case 20: + prefix = PrefixID.Mystic; + break; + case 21: + prefix = PrefixID.Godly; + break; + case 22: + prefix = PrefixID.Masterful; + break; + case 23: + prefix = PrefixID.Mythical; + break; + } + } + else if (item.summon) + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Nimble = 1, Furious = 2 + prefix = Main.rand.Next(1, 3); + break; + case 2: + // Hurtful = 3, Quick = 4, Taboo = 5, Manic = 6 + prefix = Main.rand.Next(3, 7); + break; + case 3: + // Forceful = 7, Strong = 8, Adept = 9, Celestial = 10 + prefix = Main.rand.Next(7, 11); + break; + case 4: + // Deadly = 11, Mystic = 12, Superior = 13, Demonic = 14 + prefix = Main.rand.Next(11, 15); + break; + case 5: + // Masterful = 15, Mythical = 16, Godly = 17 + prefix = Main.rand.Next(15, 18); + break; + case 6: + // Ruthless = 18 + prefix = 18; + break; + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = PrefixID.Nimble; + break; + case 2: + prefix = PrefixID.Furious; + break; + case 3: + prefix = PrefixID.Hurtful; + break; + case 4: + prefix = PrefixID.Quick; + break; + case 5: + prefix = PrefixID.Taboo; + break; + case 6: + prefix = PrefixID.Manic; + break; + case 7: + prefix = PrefixID.Forceful; + break; + case 8: + prefix = PrefixID.Strong; + break; + case 9: + prefix = PrefixID.Adept; + break; + case 10: + prefix = PrefixID.Celestial; + break; + case 11: + prefix = PrefixID.Deadly; + break; + case 12: + prefix = PrefixID.Mystic; + break; + case 13: + prefix = PrefixID.Superior; + break; + case 14: + prefix = PrefixID.Demonic; + break; + case 15: + prefix = PrefixID.Masterful; + break; + case 16: + prefix = PrefixID.Mythical; + break; + case 17: + prefix = PrefixID.Godly; + break; + case 18: + prefix = PrefixID.Ruthless; + break; + } + } + else if (item.Calamity().rogue) + { + switch (reforgeTier) + { + case 0: + break; + case 1: + // Radical = 1, Pointy = 2 + prefix = Main.rand.Next(1, 3); + break; + case 2: + // Sharp = 3, Glorious = 4 + prefix = Main.rand.Next(3, 5); + break; + case 3: + // Feathered = 5, Sleek = 6, Hefty = 7 + prefix = Main.rand.Next(5, 8); + break; + case 4: + // Mighty = 8, Serrated = 9 + prefix = Main.rand.Next(8, 10); + break; + case 5: + // Vicious = 10, Lethal = 11 + prefix = Main.rand.Next(10, 12); + break; + case 6: + // Flawless = 12 + prefix = 12; + break; + } + switch (prefix) + { + case -2: + break; + case 1: + prefix = mod.PrefixType("Radical"); + break; + case 2: + prefix = mod.PrefixType("Pointy"); + break; + case 3: + prefix = mod.PrefixType("Sharp"); + break; + case 4: + prefix = mod.PrefixType("Glorious"); + break; + case 5: + prefix = mod.PrefixType("Feathered"); + break; + case 6: + prefix = mod.PrefixType("Sleek"); + break; + case 7: + prefix = mod.PrefixType("Hefty"); + break; + case 8: + prefix = mod.PrefixType("Mighty"); + break; + case 9: + prefix = mod.PrefixType("Serrated"); + break; + case 10: + prefix = mod.PrefixType("Vicious"); + break; + case 11: + prefix = mod.PrefixType("Lethal"); + break; + case 12: + prefix = mod.PrefixType("Flawless"); + break; + } + } + return prefix; + } + + // Cut price in half because fuck the goblin + public override bool ReforgePrice(Item item, ref int reforgePrice, ref bool canApplyDiscount) + { + reforgePrice /= 2; + return true; + } + + // Get cash from dickhead goblin fuck + public override void PostReforge(Item item) + { + CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); + if (modPlayer.itemTypeLastReforged != item.type) + { + modPlayer.reforgeTierSafety = 0; + modPlayer.finalTierAccessoryReforge = false; + } + + modPlayer.itemTypeLastReforged = item.type; + + if (modPlayer.reforgeTierSafety > 6) + { + modPlayer.reforgeTierSafety = 0; + modPlayer.finalTierAccessoryReforge = true; + } + + modPlayer.reforgeTierSafety++; + reforgeTier = modPlayer.reforgeTierSafety; + + bool favorited = item.favorited; + item.netDefaults(item.netID); + item.Prefix(NewPrefixType(item)); + + item.Center = Main.player[Main.myPlayer].Center; + item.favorited = favorited; + + if (NPC.AnyNPCs(ModContent.NPCType())) + { + int value = item.value; + ItemLoader.ReforgePrice(item, ref value, ref Main.LocalPlayer.discount); + CalamityWorld.MoneyStolenByBandit += value / 5; + CalamityWorld.Reforges++; } } #endregion - #region Goblin Money Theft (PostReforge) - public override void PostReforge(Item item) - { - if (NPC.AnyNPCs(ModContent.NPCType())) - { - int value = item.value; - ItemLoader.ReforgePrice(item, ref value, ref Main.LocalPlayer.discount); - CalamityWorld.MoneyStolenByBandit += value / 5; - CalamityWorld.Reforges++; - } - } - #endregion - - #region Money From Rarity - public static readonly int Rarity0BuyPrice = Item.buyPrice(0, 0, 50, 0); + #region Money From Rarity + public static readonly int Rarity0BuyPrice = Item.buyPrice(0, 0, 50, 0); public static readonly int Rarity1BuyPrice = Item.buyPrice(0, 1, 0, 0); public static readonly int Rarity2BuyPrice = Item.buyPrice(0, 2, 0, 0); public static readonly int Rarity3BuyPrice = Item.buyPrice(0, 4, 0, 0); @@ -3626,7 +2848,8 @@ Grants immunity to fire blocks, and temporary immunity to lava"; public static readonly int Rarity8BuyPrice = Item.buyPrice(0, 80, 0, 0); public static readonly int Rarity9BuyPrice = Item.buyPrice(0, 95, 0, 0); public static readonly int Rarity10BuyPrice = Item.buyPrice(1, 0, 0, 0); - public static readonly int RarityTurquoiseBuyPrice = Item.buyPrice(1, 20, 0, 0); + public static readonly int Rarity11BuyPrice = Item.buyPrice(1, 10, 0, 0); + public static readonly int RarityTurquoiseBuyPrice = Item.buyPrice(1, 20, 0, 0); public static readonly int RarityPureGreenBuyPrice = Item.buyPrice(1, 40, 0, 0); public static readonly int RarityDarkBlueBuyPrice = Item.buyPrice(1, 80, 0, 0); public static readonly int RarityVioletBuyPrice = Item.buyPrice(2, 50, 0, 0); @@ -3665,6 +2888,8 @@ Grants immunity to fire blocks, and temporary immunity to lava"; return Rarity9BuyPrice; case 10: return Rarity10BuyPrice; + case 11: + return Rarity11BuyPrice; case (int)CalamityRarity.Turquoise: return RarityTurquoiseBuyPrice; case (int)CalamityRarity.PureGreen: @@ -3673,7 +2898,7 @@ Grants immunity to fire blocks, and temporary immunity to lava"; return RarityDarkBlueBuyPrice; case (int)CalamityRarity.Violet: return RarityVioletBuyPrice; - case (int)CalamityRarity.Developer: + case (int)CalamityRarity.HotPink: return RarityHotPinkBuyPrice; } return 0; @@ -3682,40 +2907,6 @@ Grants immunity to fire blocks, and temporary immunity to lava"; { return GetBuyPrice(item.rare); } - #endregion - - /// - /// Dust helper to spawn dust for an item. Allows you to specify where on the item to spawn the dust, essentially. (ONLY WORKS FOR SWINGING WEAPONS?) - /// - /// The player using the item. - /// The type of dust to use. - /// The chance per frame to spawn the dust (0f-1f) - /// The minimum distance between the player and the dust - /// The maximum distance between the player and the dust - /// The minimum random rotation offset for the dust - /// The maximum random rotation offset for the dust - /// The minimum speed that the dust should travel - /// The maximum speed that the dust should travel - public static Dust MeleeDustHelper(Player player, int dustType, float chancePerFrame, float minDistance, float maxDistance, float minRandRot = -0.2f, float maxRandRot = 0.2f, float minSpeed = 0.9f, float maxSpeed = 1.1f) - { - if (Main.rand.NextFloat(1f) < chancePerFrame) - { - //Calculate values - //distance from player, - //the vector offset from the player center - //the vector between the pos and the player - float distance = Main.rand.NextFloat(minDistance, maxDistance); - Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction; - Vector2 pos = player.Center + offset; - Vector2 vec = pos - player.Center; - //spawn the dust - Dust d = Dust.NewDustPerfect(pos, dustType); - //normalise vector and multiply by velocity magnitude - vec.Normalize(); - d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed); - return d; - } - return null; - } + #endregion } } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs new file mode 100644 index 0000000000..194fbee780 --- /dev/null +++ b/Items/CalamityGlobalItemLoot.cs @@ -0,0 +1,323 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.DifficultyItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.PermanentBoosters; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class CalamityGlobalItemLoot : GlobalItem + { + public override bool InstancePerEntity => false; + public override bool CloneNewInstances => false; + + // NOTE: this function applies to all right-click-to-open items, even modded ones (despite the name). + // This means it applies to boss bags, crates, lockboxes, herb bags, goodie bags, and presents. + // The internal names of these cases are as follows (TML 0.11 API): + // bossBag, crate, lockBox, herbBag, goodieBag, present + public override void OpenVanillaBag(string context, Player player, int itemID) + { + if (context == "crate") + CrateLoot(player, itemID); + + else if (context == "bossBag") + BossBagLoot(player, itemID); + + // Bat Hook is now acquired from Vampires. + else if (context == "goodieBag") + DropHelper.BlockDrops(ItemID.BatHook); + } + + #region Boss Bags + private static void BossBagLoot(Player player, int itemID) + { + // Give a chance for Laudanum, Stress Pills and Heart of Darkness from every boss bag + DropHelper.DropRevBagAccessories(player); + + switch (itemID) + { + case ItemID.QueenBeeBossBag: + // Drop weapons Calamity style instead of mutually exclusive. + int[] queenBeeWeapons = new int[] + { + ItemID.BeeKeeper, + ItemID.BeesKnees, + ItemID.BeeGun, + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, queenBeeWeapons); + DropHelper.BlockDrops(queenBeeWeapons); + + DropHelper.DropItem(player, ItemID.Stinger, 8, 12); // Extra stingers + DropHelper.DropItem(player, ModContent.ItemType(), 50, 75); + break; + + case ItemID.WallOfFleshBossBag: + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + int[] wofWeapons = new int[] + { + ItemID.BreakerBlade, + ItemID.ClockworkAssaultRifle, + ModContent.ItemType(), + ItemID.LaserRifle, + ModContent.ItemType(), + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, wofWeapons); + DropHelper.BlockDrops(wofWeapons); + + // Drop emblems Calamity style instead of mutually exclusive -- this includes the Rogue Emblem. + int[] emblems = new int[] + { + ItemID.WarriorEmblem, + ItemID.RangerEmblem, + ItemID.SorcererEmblem, + ItemID.SummonerEmblem, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(player, 0.25f, emblems); + DropHelper.BlockDrops(emblems); + + DropHelper.DropItemFromSetChance(player, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); + DropHelper.DropItemCondition(player, ModContent.ItemType(), !CalamityWorld.demonMode); // Demon Trophy + break; + + case ItemID.DestroyerBossBag: + case ItemID.TwinsBossBag: + case ItemID.SkeletronPrimeBossBag: + // Only drop hallowed bars after all mechs are down. + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + DropHelper.BlockDrops(ItemID.HallowedBar); + break; + + case ItemID.PlanteraBossBag: + // Drop weapons Calamity style instead of mutually exclusive. + int[] planteraWeapons = new int[] + { + ItemID.FlowerPow, + ItemID.Seedler, + ItemID.GrenadeLauncher, + ItemID.VenusMagnum, + ItemID.LeafBlower, + ItemID.NettleBurst, + ItemID.WaspGun, + ItemID.PygmyStaff + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, planteraWeapons); + DropHelper.BlockDrops(planteraWeapons); + + DropHelper.DropItem(player, ModContent.ItemType(), 16, 22); + DropHelper.DropItemChance(player, ItemID.JungleKey, 5); + break; + + case ItemID.GolemBossBag: + // Drop loot Calamity style instead of mutually exclusive. + int[] golemItems = new int[] + { + ItemID.GolemFist, + ItemID.PossessedHatchet, + ItemID.Stynger, + ItemID.HeatRay, + ItemID.StaffofEarth, + ItemID.EyeoftheGolem, + ItemID.SunStone, + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, golemItems); + DropHelper.BlockDrops(golemItems); + + // The Picksaw always drops if the player doesn't have one in their inventory. Otherwise it has a 25% chance. + bool playerHasPicksaw = player.InventoryHas(ItemID.Picksaw); + DropHelper.DropItemChance(player, ItemID.Picksaw, playerHasPicksaw ? 1.0f : 0.25f); + + DropHelper.DropItem(player, ModContent.ItemType(), 8, 13); + break; + + case ItemID.BossBagBetsy: + // Drop weapons Calamity style instead of mutually exclusive. + int[] betsyWeapons = new int[] + { + ItemID.DD2SquireBetsySword, // Flying Dragon + ItemID.MonkStaffT3, // Sky Dragon's Fury + ItemID.DD2BetsyBow, // Aerial Bane + ItemID.ApprenticeStaffT3, // Betsy's Wrath + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, betsyWeapons); + DropHelper.BlockDrops(betsyWeapons); + break; + + case ItemID.FishronBossBag: + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + int[] dukeWeapons = new int[] + { + ItemID.Flairon, + ItemID.Tsunami, + ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, dukeWeapons); + DropHelper.BlockDrops(dukeWeapons); + break; + + case ItemID.MoonLordBossBag: + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + int[] moonLordWeapons = new int[] + { + ItemID.Meowmere, + ItemID.StarWrath, + ItemID.Terrarian, + ItemID.FireworksLauncher, // Celebration + // ItemID.CelebrationMK2, + ItemID.SDMG, + ItemID.LastPrism, + ItemID.LunarFlareBook, + ItemID.MoonlordTurretStaff, // Lunar Portal Staff + ItemID.RainbowCrystalStaff, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(player, DropHelper.BagWeaponDropRateFloat, moonLordWeapons); + DropHelper.BlockDrops(moonLordWeapons); + + // The Celestial Onion only drops if the player hasn't used one and doesn't have one in their inventory. + int celestialOnion = ModContent.ItemType(); + DropHelper.DropItemCondition(player, celestialOnion, !player.Calamity().extraAccessoryML && !player.InventoryHas(celestialOnion)); + break; + } + } + #endregion + + #region Fishing Crates + private static void CrateLoot(Player player, int itemID) + { + bool twoMechsDowned = + (NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3) || + (NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1) || + (NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2) || + (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); + + switch (itemID) + { + case ItemID.WoodenCrate: + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + int[] preMechBlockedDrops_WoodenCrate = new int[] + { + ItemID.MythrilOre, + ItemID.OrichalcumOre, + ItemID.AdamantiteOre, + ItemID.TitaniumOre, + ItemID.MythrilBar, + ItemID.OrichalcumBar, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + int[] postOneMechBlockedDrops_WoodenCrate = new int[] + { + ItemID.AdamantiteOre, + ItemID.TitaniumOre, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + + if (!NPC.downedMechBossAny) + DropHelper.BlockDrops(preMechBlockedDrops_WoodenCrate); + else if (!twoMechsDowned) + DropHelper.BlockDrops(postOneMechBlockedDrops_WoodenCrate); + } + + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 3, 5); + break; + + case ItemID.IronCrate: + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + int[] preMechBlockedDrops_IronCrate = new int[] + { + ItemID.MythrilBar, + ItemID.OrichalcumBar, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + int[] postOneMechBlockedDrops_IronCrate = new int[] + { + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + + if (!NPC.downedMechBossAny) + DropHelper.BlockDrops(preMechBlockedDrops_IronCrate); + else if (!twoMechsDowned) + DropHelper.BlockDrops(postOneMechBlockedDrops_IronCrate); + } + + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 8); + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 8); + break; + + case ItemID.GoldenCrate: + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + int[] preMechBlockedDrops_GoldenCrate = new int[] + { + ItemID.MythrilBar, + ItemID.OrichalcumBar, + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + int[] postOneMechBlockedDrops_GoldenCrate = new int[] + { + ItemID.AdamantiteBar, + ItemID.TitaniumBar, + }; + + if (!NPC.downedMechBossAny) + DropHelper.BlockDrops(preMechBlockedDrops_GoldenCrate); + else if (!twoMechsDowned) + DropHelper.BlockDrops(postOneMechBlockedDrops_GoldenCrate); + } + break; + + case ItemID.CorruptFishingCrate: + case ItemID.CrimsonFishingCrate: + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.15f, 5, 8); + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.15f, 1, 3); + break; + + case ItemID.HallowedFishingCrate: + int potion = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.15f, 5, 10); + DropHelper.DropItemCondition(player, potion, CalamityWorld.downedProvidence, 0.1f, 1, 2); + break; + + case ItemID.DungeonFishingCrate: + DropHelper.DropItemCondition(player, ItemID.Ectoplasm, NPC.downedPlantBoss, 0.1f, 1, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedPolterghast, 0.1f, 1, 5); + break; + + case ItemID.JungleFishingCrate: + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.2f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 1, 3); + DropHelper.DropItemCondition(player, ItemID.ChlorophyteBar, CalamityWorld.downedCalamitas || NPC.downedPlantBoss, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedPlantBoss, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.2f, 3, 6); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.1f, 1, 3); + break; + + case ItemID.FloatingIslandFishingCrate: + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedHiveMind || CalamityWorld.downedPerforator, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedMoonlord, 0.1f, 1, 3); + break; + } + } + #endregion + } +} diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs new file mode 100644 index 0000000000..ab56295a26 --- /dev/null +++ b/Items/CalamityGlobalItemTooltip.cs @@ -0,0 +1,1083 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; +using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI.Chat; + +namespace CalamityMod.Items +{ + public partial class CalamityGlobalItem : GlobalItem + { + #region Main ModifyTooltips Function + 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"); + if (nameLine != null) + ApplyRarityColor(item, nameLine); + + // If the item is melee, add a true melee damage number adjacent to the standard damage number. + if (item.melee && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D) + TrueMeleeDamageTooltip(item, tooltips); + + // Modify all vanilla tooltips before appending mod mechanics (if any). + ModifyVanillaTooltips(item, tooltips); + + // If the item has a stealth generation prefix, show that on the tooltip. + // This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items. + StealthGenAccessoryTooltip(item, tooltips); + + // If an item has special tags (specifically Ice, Fire, and Nature), show that in the tooltip. + ElementTooltip(item, tooltips); + + // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the + // tooltip list. + EnchantmentTooltips(item, tooltips); + + // 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"); + tooltips.Add(line); + } + + // Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency. + if (item.type < ItemID.Count) + return; + + // Adds tooltips to Calamity fountains which match Fargo's fountain tooltips. + FargoFountainTooltip(item, tooltips); + + // Adds a Current Charge tooltip to all items which use charge. + CalamityGlobalItem modItem = item.Calamity(); + if (modItem?.UsesCharge ?? false) + { + // Convert current charge ratio into a percentage. + float displayedPercent = ChargeRatio * 100f; + 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)); + tooltips.Add(line); + } + if (devItem) + { + TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.HotPinkRarityColor)); + tooltips.Add(line); + } + + // Adds "Challenge Drop" or "Legendary Challenge Drop" to Malice Mode drops. + // For Legendary Challenge Drops, this tooltip matches their unique rarity color. + if (challengeDrop) + ChallengeDropTooltip(item, tooltips); + } + #endregion + + #region Rarity Coloration + private void ApplyRarityColor(Item item, TooltipLine nameLine) + { + // Apply standard post-ML rarities to the item's color first. + Color? standardRarityColor = CalamityUtils.GetRarityColor(customRarity); + if (!item.expert && standardRarityColor.HasValue) + nameLine.overrideColor = standardRarityColor.Value; + + #region Uniquely Colored Developer Items + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(Main.DiscoR, 100, 255); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(0, 0, 255); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = Judgement.GetSyncedLightColor(); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = ShatteredCommunity.GetRarityColor(); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 4f); //alternates between emerald green and amber (BanditHueh) + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(146, 0, 0); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(129, 29, 149); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(220, 20, 60); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(254, 253, 235); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(207, 17, 117); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = new Color(227, 226, 180); + if (item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f); + if (item.type == ModContent.ItemType()) + { + nameLine.overrideColor = CalamityUtils.MulticolorLerp(Main.GlobalTime / 2f % 1f, new Color[] + { + new Color(255, 196, 55), + new Color(255, 231, 107), + new Color(255, 254, 243) + }); + } + + // TODO -- for cleanliness, ALL color math should either be a one-line color swap or inside the item's own file + // The items that currently violate this are all below: + // Eternity, Flamsteed Ring, Earth + if (item.type == ModContent.ItemType()) + { + List colorSet = new List() + { + new Color(188, 192, 193), // white + new Color(157, 100, 183), // purple + new Color(249, 166, 77), // honey-ish orange + new Color(255, 105, 234), // pink + new Color(67, 204, 219), // sky blue + new Color(249, 245, 99), // bright yellow + new Color(236, 168, 247), // purplish pink + }; + if (nameLine != null) + { + int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count); + Color currentColor = colorSet[colorIndex]; + Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count]; + nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); + } + } + if (item.type == ModContent.ItemType()) + { + if (Main.GlobalTime % 1f < 0.6f) + { + nameLine.overrideColor = new Color(89, 229, 255); + } + else if (Main.GlobalTime % 1f < 0.8f) + { + nameLine.overrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTime % 1f - 0.6f) / 0.2f); + } + else + { + nameLine.overrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTime % 1f - 0.8f) / 0.2f); + } + } + if (item.type == ModContent.ItemType()) + { + List earthColors = new List() + { + new Color(255, 99, 146), + new Color(255, 228, 94), + new Color(127, 200, 248) + }; + if (nameLine != null) + { + int colorIndex = (int)(Main.GlobalTime / 2 % earthColors.Count); + Color currentColor = earthColors[colorIndex]; + Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count]; + nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f); + } + } + #endregion + } + #endregion + + #region Challenge Drop Tooltip + private void ChallengeDropTooltip(Item item, IList tooltips) + { + Color? legendaryColor = null; + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(255, Main.DiscoG, 53); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(Main.DiscoR, 203, 103); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(53, Main.DiscoG, 255); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(150, Main.DiscoG, 255); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(60, Main.DiscoG, 190); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(255, Main.DiscoG, 155); + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + legendaryColor = new Color(255, Main.DiscoG, 0); + if (item.type == ModContent.ItemType()) + legendaryColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f); + if (item.type == ModContent.ItemType()) + legendaryColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f); + if (item.type == ModContent.ItemType()) + legendaryColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + + Color lineColor = legendaryColor.GetValueOrDefault(CalamityUtils.ChallengeDropColor); + string text = legendaryColor.HasValue ? "- Legendary Challenge Drop -" : "- Challenge Drop -"; + TooltipLine line = new TooltipLine(mod, "CalamityChallengeDrop", text) + { + overrideColor = lineColor + }; + tooltips.Add(line); + } + #endregion + + #region Enchantment Tooltips + private void EnchantmentTooltips(Item item, IList tooltips) + { + if (!item.IsAir && AppliedEnchantment.HasValue) + { + TooltipLine descriptionLine = new TooltipLine(mod, "Enchantment", CalamityUtils.ColorMessage(AppliedEnchantment.Value.Description, Color.DarkRed)); + tooltips.Add(descriptionLine); + } + } + #endregion + + #region Vanilla Item Tooltip Modification + private void ModifyVanillaTooltips(Item item, IList tooltips) + { + #region Modular Tooltip Editing Code + // This is a modular tooltip editor which loops over all tooltip lines of an item, + // selects all those which match an arbitrary function you provide, + // then edits them using another arbitrary function you provide. + void ApplyTooltipEdits(IList lines, Func predicate, Action action) + { + foreach (TooltipLine line in lines) + if (predicate.Invoke(item, line)) + action.Invoke(line); + } + + // 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}"; + // 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; + + // These functions are shorthand to invoke ApplyTooltipEdits using the above predicates. + void EditTooltipByNum(int lineNum, Action action) => ApplyTooltipEdits(tooltips, LineNum(lineNum), action); + void EditTooltipByName(string lineName, Action action) => ApplyTooltipEdits(tooltips, LineName(lineName), action); + #endregion + + // Numerous random tooltip edits which don't fit into another category + #region Various Tooltip Edits + + // 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"), + (line) => line.text += "\nCannot be used while a boss is alive"); + + // Rod of Discord cannot be used multiple times to hurt yourself + if (item.type == ItemID.RodofDiscord) + EditTooltipByNum(0, (line) => line.text += "\nTeleportation is disabled while Chaos State is active"); + + // Indicate that the Ankh Shield provides sandstorm wind push immunity + if (item.type == ItemID.AnkhShield) + EditTooltipByNum(1, (line) => line.text += ", including Mighty Wind"); + + // Water removing items cannot be used in the Abyss + string noAbyssLine = "\nCannot be used in the Abyss"; + if (item.type == ItemID.SuperAbsorbantSponge) + EditTooltipByNum(0, (line) => line.text += noAbyssLine); + if (item.type == ItemID.EmptyBucket) + EditTooltipByName("Defense", (line) => line.text += noAbyssLine); + + // If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed. + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) + EditTooltipByNum(0, (line) => line.text += "\nDemon Altars no longer spawn ores when destroyed"); + + // Bottled Honey gives the Honey buff + if (item.type == ItemID.BottledHoney) + EditTooltipByName("HealLife", (line) => line.text += "\nGrants the Honey buff for 2 minutes"); + + // Warmth Potion provides debuff immunities and Death Mode cold protection + if (item.type == ItemID.WarmthPotion) + { + string immunityLine = "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs"; + if (CalamityWorld.death) + immunityLine += "\nProvides cold protection in Death Mode"; + EditTooltipByNum(0, (line) => line.text += immunityLine); + } + + // Nerfed Archery Potion tooltip + if (item.type == ItemID.ArcheryPotion) + EditTooltipByNum(0, (line) => line.text = "20% increased arrow speed and 1.05x arrow damage"); + + // Nerfed Swiftness Potion tooltip + if (item.type == ItemID.SwiftnessPotion) + EditTooltipByNum(0, (line) => line.text = "15% increased movement speed"); + + // Hand Warmer provides Death Mode cold protection and has a side bonus with Eskimo armor + if (item.type == ItemID.HandWarmer) + { + string extraLine = "\nProvides a regeneration boost while wearing the Eskimo armor"; + if (CalamityWorld.death) + extraLine += "\nProvides cold protection in Death Mode"; + EditTooltipByNum(0, (line) => line.text += extraLine); + } + + // Invisibility Potion provides various rogue boosts + if (item.type == ItemID.InvisibilityPotion) + EditTooltipByNum(0, (line) => line.text += "\nBoosts various rogue stats depending on held weapon"); + + // Golden Fishing Rod inherently contains High Test Fishing Line + if (item.type == ItemID.GoldenFishingRod) + EditTooltipByName("NeedsBait", (line) => line.text += "\nIts fishing line will never break"); + + // Eternity Crystal notifies the player that they can accelerate the invasion + if (item.type == ItemID.DD2ElderCrystal) + EditTooltipByNum(0, (line) => line.text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders"); + + // Fix a vanilla mistake in Magic Quiver's tooltip + // TODO -- in 1.4 this mistake is already corrected + if (item.type == ItemID.MagicQuiver) + EditTooltipByNum(0, (line) => line.text = line.text.Replace(" damage", " arrow damage")); + #endregion + + // Black Belt and Master Ninja Gear have guaranteed dodges on a 60 second cooldown. + #region Dodging Belt Tooltips + string beltDodgeLine = "Grants the ability to dodge attacks\n" + + $"The dodge has a {CalamityPlayer.BeltDodgeCooldown / 60} second cooldown which is shared with all other dodges and reflects"; + if (item.type == ItemID.BlackBelt) + EditTooltipByNum(0, (line) => line.text = beltDodgeLine); + if (item.type == ItemID.MasterNinjaGear) + EditTooltipByNum(1, (line) => line.text = beltDodgeLine); + #endregion + + // Early Hardmode ore melee weapons have new on-hit effects. + #region Early Hardmode Melee Tooltips + + // Cobalt + if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata) + EditTooltipByName("Knockback", (line) => line.text += "\nDecreases enemy defense by 25% on hit"); + + // Palladium + if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike) + EditTooltipByName("Knockback", (line) => line.text += "\nIncreases life regen on hit"); + + // Mythril + if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd) + EditTooltipByName("Knockback", (line) => line.text += "\nDecreases enemy contact damage by 10% on hit"); + + // Orichalcum + if (item.type == ItemID.OrichalcumSword || item.type == ItemID.OrichalcumHalberd) + EditTooltipByName("Knockback", (line) => line.text += "\nIncreases how frequently the Orichalcum set bonus triggers on hit"); + + // Adamantite + if (item.type == ItemID.AdamantiteSword || item.type == ItemID.AdamantiteGlaive) + EditTooltipByName("Knockback", (line) => line.text += "\nSlows enemies on hit"); + + // Titanium + if (item.type == ItemID.TitaniumSword || item.type == ItemID.TitaniumTrident) + EditTooltipByName("Knockback", (line) => line.text += "\nDeals increased damage to enemies with high knockback resistance"); + + // Hallowed (and True Excalibur) + if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur) + EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Holy Flames\nDeals double damage to enemies above 75% life"); + #endregion + + // Other melee weapon tooltips + #region Other Melee Tooltips + + if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram) + EditTooltipByName("Knockback", (line) => line.text += "\nHeals you on hit"); + + // Stylish Scissors, all Phaseblades, and all Phasesabers + if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber)) + EditTooltipByName("Knockback", (line) => line.text += "\nIgnores 100% of enemy defense"); + + if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade) + EditTooltipByName("Knockback", (line) => line.text += "\nIgnores 50% of enemy defense"); + + if (item.type == ItemID.LightsBane || item.type == ItemID.NightsEdge || item.type == ItemID.TrueNightsEdge || item.type == ItemID.BallOHurt) + EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Shadowflame on hit"); + + if (item.type == ItemID.BloodButcherer || item.type == ItemID.TheRottedFork || item.type == ItemID.TheMeatball) + EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Burning Blood on hit"); + #endregion + + // Light pets, accessories, and other items which boost the player's Abyss light stat + #region Abyss Light Tooltips + + // +1 to Abyss light level + string abyssSmallLightLine = "\nProvides a small amount of light in the abyss"; + + if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace || item.type == ItemID.MiningHelmet) + EditTooltipByNum(0, (line) => line.text += abyssSmallLightLine); + if (item.type == ItemID.JellyfishDivingGear) + EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine); + + // +2 to Abyss light level + string abyssMediumLightLine = "\nProvides a moderate amount of light in the abyss"; + + if (item.type == ItemID.ShinePotion) + EditTooltipByName("BuffTime", (line) => line.text += abyssMediumLightLine); + + if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost) + EditTooltipByNum(0, (line) => line.text += abyssMediumLightLine); + + // +3 to Abyss light level + string abyssLargeLightLine = "\nProvides a large amount of light in the abyss"; + + if (item.type == ItemID.WispinaBottle) + EditTooltipByNum(0, (line) => line.text += abyssLargeLightLine); + if (item.type == ItemID.SuspiciousLookingTentacle) + EditTooltipByNum(1, (line) => line.text += abyssLargeLightLine); + #endregion + + // Accessories and other items which boost the player's ability to breathe in the Abyss + #region Abyss Breath Tooltips + + // Moderate breath boost + string abyssModerateBreathLine = "\nModerately reduces breath loss in the abyss"; + + if (item.type == ItemID.DivingHelmet) + EditTooltipByNum(0, (line) => line.text += abyssModerateBreathLine); + if (item.type == ItemID.ArcticDivingGear) + EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine + abyssModerateBreathLine); + + // Great breath boost + string abyssGreatBreathLine = "\nGreatly reduces breath loss in the abyss"; + + if (item.type == ItemID.GillsPotion) + EditTooltipByName("BuffTime", (line) => line.text += abyssGreatBreathLine); + + if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell) + EditTooltipByNum(0, (line) => line.text += abyssGreatBreathLine); + if (item.type == ItemID.CelestialShell) + EditTooltipByNum(1, (line) => line.text += abyssModerateBreathLine); + #endregion + + // Flasks apply to Rogue weapons + #region Rogue Flask Tooltips + if (item.type == ItemID.FlaskofCursedFlames) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks inflict enemies with cursed flames"); + if (item.type == ItemID.FlaskofFire) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks set enemies on fire"); + if (item.type == ItemID.FlaskofGold) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks make enemies drop more gold"); + if (item.type == ItemID.FlaskofIchor) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks decrease enemy defense"); + if (item.type == ItemID.FlaskofNanites) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks confuse enemies"); + // party flask is unique because it affects ALL projectiles in Calamity, not just "also rogue ones" + if (item.type == ItemID.FlaskofParty) + EditTooltipByNum(0, (line) => line.text = "All attacks cause confetti to appear"); + if (item.type == ItemID.FlaskofPoison) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks poison enemies"); + if (item.type == ItemID.FlaskofVenom) + EditTooltipByNum(0, (line) => line.text += "\nRogue attacks inflict Venom on enemies"); + #endregion + + // Rebalances to vanilla item stats + #region Vanilla Item Rebalance Tooltips + + // Reduce DD2 armor piece bonuses because they're overpowered + // Squire armor + if (item.type == ItemID.SquirePlating) + EditTooltipByNum(0, (line) => line.text = "10% increased minion and melee damage"); + if (item.type == ItemID.SquireGreaves) + EditTooltipByNum(0, (line) => line.text = "5% increased minion damage and melee critical strike chance\n" + + "15% increased movement speed"); + + // Monk armor + if (item.type == ItemID.MonkBrows) + EditTooltipByNum(0, (line) => line.text = "Increases your max number of sentries by 1 and increases melee attack speed by 10%"); + if (item.type == ItemID.MonkShirt) + EditTooltipByNum(0, (line) => line.text = "10% increased minion and melee damage"); + if (item.type == ItemID.MonkPants) + EditTooltipByNum(0, (line) => line.text = "5% increased minion damage and melee critical strike chance\n" + + "20% increased movement speed"); + + // Huntress armor + if (item.type == ItemID.HuntressJerkin) + EditTooltipByNum(0, (line) => line.text = "10% increased minion and ranged damage\n" + + "10% chance to not consume ammo"); + + // Apprentice armor + if (item.type == ItemID.ApprenticeTrousers) + EditTooltipByNum(0, (line) => line.text = "5% increased minion damage and magic critical strike chance\n" + + "20% increased movement speed"); + + // Valhalla Knight armor + if (item.type == ItemID.SquireAltShirt) + EditTooltipByNum(0, (line) => line.text = "30% increased minion damage and increased life regeneration"); + if (item.type == ItemID.SquireAltPants) + EditTooltipByNum(0, (line) => line.text = "10% increased minion damage and melee critical strike chance\n" + + "20% increased movement speed"); + + // Shinobi Infiltrator armor + if (item.type == ItemID.MonkAltHead) + EditTooltipByNum(0, (line) => line.text = "Increases your max number of sentries by 2\n" + + "10% increased melee and minion damage"); + if (item.type == ItemID.MonkAltShirt) + EditTooltipByNum(0, (line) => line.text = "10% increased minion damage and melee speed\n" + + "5% increased melee critical strike chance"); + if (item.type == ItemID.MonkAltPants) + EditTooltipByNum(0, (line) => line.text = "10% increased minion damage and melee critical strike chance\n" + + "30% increased movement speed"); + + // Red Riding armor + if (item.type == ItemID.HuntressAltShirt) + EditTooltipByNum(0, (line) => line.text = "15% increased minion and ranged damage and 20% chance to not consume ammo"); + + // Dark Artist armor + if (item.type == ItemID.ApprenticeAltPants) + EditTooltipByNum(0, (line) => line.text = "10% increased minion damage and magic critical strike chance\n" + + "20% increased movement speed"); + + // Worm Scarf only gives 10% DR instead of 17% + if (item.type == ItemID.WormScarf) + EditTooltipByNum(0, (line) => line.text = line.text.Replace("17%", "10%")); + + if (item.type == ItemID.TitanGlove) + EditTooltipByNum(0, (line) => line.text += "\n10% increased true melee damage"); + if (item.type == ItemID.PowerGlove || item.type == ItemID.MechanicalGlove) + EditTooltipByNum(1, (line) => line.text += "\n10% increased true melee damage"); + if (item.type == ItemID.FireGauntlet) + { + string extraLine = "\n10% increased true melee damage"; + if (CalamityWorld.death) + extraLine += "\nProvides heat and cold protection in Death Mode"; + EditTooltipByNum(1, (line) => line.text = line.text.Replace("12%", "14%") + extraLine); + } + + // Spectre Hood's lifesteal is heavily nerfed, so it only reduces magic damage by 20% instead of 40% + if (item.type == ItemID.SpectreHood) + EditTooltipByNum(0, (line) => line.text = line.text.Replace("40%", "20%")); + #endregion + + // Items which provide immunity to either heat or cold in Death Mode, or interact with Lethal Lava + #region Lava and Death Mode Environmental Immunity Tooltips + string heatProtectionLine = "\nProvides heat protection in Death Mode"; + string bothProtectionLine = "\nProvides heat and cold protection in Death Mode"; + + if (item.type == ItemID.ObsidianSkinPotion) + { + // If Lethal Lava is enabled, Obsidian Skin Potions work very differently. + if (CalamityConfig.Instance.LethalLava) + { + string lethalLavaReplacement = "Provides immunity to direct damage from touching lava\n" + + "Provides temporary immunity to lava burn damage\n" + + "Greatly increases the speed at which lava immunity recharges\n" + + "Reduces lava burn damage"; + if (CalamityWorld.death) + lethalLavaReplacement += heatProtectionLine; + EditTooltipByNum(0, (line) => line.text = lethalLavaReplacement); + } + + // Otherwise, changes are only made on Death Mode, where heat immunity is mentioned. + else if (CalamityWorld.death) + EditTooltipByNum(0, (line) => line.text += heatProtectionLine); + } + + if (item.type == ItemID.ObsidianRose) + { + StringBuilder sb = new StringBuilder(128); + // If Lethal Lava is enabled, Obsidian Rose reduces the damage from the debuff. + if (CalamityConfig.Instance.LethalLava) + sb.Append("\nGreatly reduces lava burn damage"); + if (CalamityWorld.death) + sb.Append(heatProtectionLine); + EditTooltipByNum(0, (line) => line.text += sb.ToString()); + } + + if (CalamityWorld.death) + { + if (item.type == ItemID.MagmaStone) + EditTooltipByNum(0, (line) => line.text += bothProtectionLine); + if (item.type == ItemID.LavaCharm) + EditTooltipByNum(0, (line) => line.text += heatProtectionLine); + if (item.type == ItemID.LavaWaders) + EditTooltipByNum(1, (line) => line.text += heatProtectionLine); + if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings) + EditTooltipByName("SetBonus", (line) => line.text += bothProtectionLine); + } + #endregion + + // Add mentions of what Calamity ores vanilla pickaxes can mine + #region Pickaxe New Ore Tooltips + if (item.type == ItemID.Picksaw) + EditTooltipByNum(0, (line) => line.text += "\nCan mine Scoria Ore"); + + if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe) + EditTooltipByName("Material", (line) => line.text += "\nCan mine Uelibloom Ore"); + #endregion + + // Rebalances and information about vanilla set bonuses + #region Vanilla Set Bonus Tooltips + + // Turns a number into a string of increased mining speed. + string MiningSpeedString(int percent) => $"\n{percent}% increased mining speed"; + + // Copper + if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(15)); + + // Tin + if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(10)); + + // Iron + if (item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(25)); + + // Lead + if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(20)); + + // Silver + if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(35)); + + // Tungsten + if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(30)); + + // Gold + if (item.type == ItemID.AncientGoldHelmet || item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(45)); + + // Platinum + if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves) + EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(40)); + + // Gladiator + if (item.type == ItemID.GladiatorHelmet) + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue damage"); + if (item.type == ItemID.GladiatorBreastplate) + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue critical strike chance"); + if (item.type == ItemID.GladiatorLeggings) + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue velocity"); + + // Obsidian + if (item.type == ItemID.ObsidianHelm) + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue damage"); + if (item.type == ItemID.ObsidianShirt) + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue critical strike chance"); + if (item.type == ItemID.ObsidianPants) + EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue velocity"); + + // Meteor Armor only makes space gun cost 50% instead of zero mana + if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings) + EditTooltipByName("SetBonus", (line) => line.text = line.text.Replace("0", "50%")); + + // Molten + if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves) + { + string extraLine = "\n20% extra true melee damage\nGrants immunity to fire blocks and temporary immunity to lava"; + if (CalamityWorld.death) + extraLine += bothProtectionLine; + EditTooltipByName("SetBonus", (line) => line.text += extraLine); + } + + // Forbidden (UNLESS you are wearing the Circlet, which is Summon/Rogue and does not get this line) + if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants + && !Main.LocalPlayer.Calamity().forbiddenCirclet) + EditTooltipByName("SetBonus", (line) => line.text += "\nThe minion damage nerf is reduced while wielding magic weapons"); + + // Stardust + // 1) Chest and Legs only give 1 minion slot each instead of 2 each. + if (item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) + EditTooltipByNum(0, (line) => line.text = line.text.Replace('2', '1')); + // 2) Set bonus gives 2 minions instead of 0. + if (item.type == ItemID.StardustHelmet || item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings) + EditTooltipByName("SetBonus", (line) => line.text += "\nIncreases your max number of minions by 2"); + #endregion + + // Provide the full stats of every vanilla set of wings + #region Wing Stat Tooltips + + // This function produces a "stat sheet" for a pair of wings from the raw stats. + // For "vertical speed", 0 = Average, 1 = Good, 2 = Great. + string[] vertSpeedStrings = new string[] { "Average vertical speed", "Good vertical speed", "Great vertical speed" }; + string WingStatsTooltip(float hSpeed, float accelMult, int vertSpeed, int flightTime, string extraTooltip = null) + { + StringBuilder sb = new StringBuilder(512); + sb.Append('\n'); + sb.Append($"Horizontal speed: {hSpeed:N2}\n"); + sb.Append($"Acceleration multiplier: {accelMult:N1}\n"); + sb.Append(vertSpeedStrings[vertSpeed]); + sb.Append('\n'); + sb.Append($"Flight time: {flightTime}"); + if (extraTooltip != null) + { + sb.Append('\n'); + sb.Append(extraTooltip); + } + return sb.ToString(); + } + + // This function is shorthand for appending a stat sheet to a pair of wings. + void AddWingStats(float h, float a, int v, int f, string s = null) => EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(h, a, v, f, s)); + + if (item.type == ItemID.AngelWings) + AddWingStats(6.25f, 1f, 0, 100, "+20 max life, +10 defense and +2 life regen"); + + if (item.type == ItemID.DemonWings) + AddWingStats(6.25f, 1f, 0, 100, "5% increased damage and critical strike chance"); + + if (item.type == ItemID.Jetpack) + AddWingStats(6.5f, 1f, 0, 115); + + if (item.type == ItemID.ButterflyWings) + AddWingStats(6.75f, 1f, 0, 130, "+20 max mana, 5% decreased mana usage,\n" + + "5% increased magic damage and magic critical strike chance"); + + if (item.type == ItemID.FairyWings) + AddWingStats(6.75f, 1f, 0, 130, "+60 max life"); + + if (item.type == ItemID.BeeWings) + AddWingStats(6.75f, 1f, 0, 130, "Permanently gives the Honey buff"); + + if (item.type == ItemID.HarpyWings) + AddWingStats(7f, 1f, 0, 140, "20% increased movement speed\n" + + "With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers"); + + if (item.type == ItemID.BoneWings) + AddWingStats(7f, 1f, 0, 140, "10% increased movement speed, ranged damage and critical strike chance\n" + + "and +30 defense while wearing the Necro Armor"); + + if (item.type == ItemID.FlameWings) + AddWingStats(7.5f, 1f, 0, 160, "5% increased melee damage and critical strike chance"); + + if (item.type == ItemID.FrozenWings) + AddWingStats(7.5f, 1f, 0, 160, "2% increased melee and ranged damage\n" + + "and 1% increased melee and ranged critical strike chance\n" + + "while wearing the Frost Armor"); + + if (item.type == ItemID.GhostWings) + AddWingStats(7.5f, 1f, 0, 160, "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" + + "5% increased magic damage and critical strike chance while wearing the Spectre Mask set"); + + if (item.type == ItemID.BeetleWings) + AddWingStats(7.5f, 1f, 0, 160, "+10 defense and 5% increased damage reduction while wearing the Beetle Shell set\n" + + "5% increased melee damage and critical strike chance while wearing the Beetle Scale Mail set"); + + if (item.type == ItemID.FinWings) + AddWingStats(0f, 0f, 0, 100, "Gills effect and you can move freely through liquids\n" + + "You fall faster while submerged in liquid\n" + + "15% increased movement speed and 18% increased jump speed"); + + if (item.type == ItemID.FishronWings) + AddWingStats(8f, 2f, 1, 180); + + if (item.type == ItemID.SteampunkWings) + AddWingStats(7.75f, 1f, 0, 180, "+8 defense, 10% increased movement speed,\n" + "4% increased damage, and 2% increased critical strike chance"); + + if (item.type == ItemID.LeafWings) + AddWingStats(6.75f, 1f, 0, 160, "+5 defense, 5% increased damage reduction,\n" + "and permanent Dryad's Blessing while wearing the Tiki Armor"); + + if (item.type == ItemID.BatWings) + AddWingStats(0f, 0f, 0, 140, "At night or during an eclipse, you will gain the following boosts:\n" + + "10% increased movement speed, 10% increased jump speed,\n" + + "7% increased damage and 3% increased critical strike chance"); + + // All developer wings have identical stats and no special effects + if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings || + item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings || + item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings || + item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings) + { + AddWingStats(7f, 1f, 0, 150); + } + + if (item.type == ItemID.TatteredFairyWings) + AddWingStats(7.5f, 1f, 0, 180, "5% increased damage and critical strike chance"); + + if (item.type == ItemID.SpookyWings) + AddWingStats(7.5f, 1f, 0, 180, "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor"); + + if (item.type == ItemID.Hoverboard) + AddWingStats(6.25f, 1f, 0, 170, "10% increased weapon-type damage while wearing the Shroomite Armor\n" + + "The weapon type boosted matches which Shroomite helmet is worn"); + + if (item.type == ItemID.FestiveWings) + AddWingStats(7.5f, 1f, 0, 170, "+40 max life\nOrnaments rain down as you fly"); + + if (item.type == ItemID.MothronWings) + AddWingStats(0f, 0f, 0, 160, "+5 defense, 5% increased damage,\n" + + "10% increased movement speed and 12% increased jump speed"); + + if (item.type == ItemID.WingsSolar) + AddWingStats(9f, 2.5f, 2, 180, "7% increased melee damage and 3% increased melee critical strike chance\n" + + "while wearing the Solar Flare Armor"); + + if (item.type == ItemID.WingsStardust) + AddWingStats(9f, 2.5f, 2, 180, "+1 max minion and 5% increased minion damage while wearing the Stardust Armor"); + + if (item.type == ItemID.WingsVortex) + AddWingStats(6.5f, 1.5f, 1, 160, "3% increased ranged damage and 7% increased ranged critical strike chance\n" + + "while wearing the Vortex Armor"); + + if (item.type == ItemID.WingsNebula) + AddWingStats(6.5f, 1.5f, 1, 160, "+20 max mana, 5% increased magic damage and critical strike chance,\n" + + "and 5% decreased mana usage while wearing the Nebula Armor"); + + if (item.type == ItemID.BetsyWings) + AddWingStats(6f, 2.5f, 1, 150); + #endregion + + // Provide the full stats of every vanilla grappling hook + #region Grappling Hook Stat Tooltips + + // This function produces a "stat sheet" for a grappling hook from the raw stats. + string HookStatsTooltip(float reach, float launch, float reel, float pull) + { + StringBuilder sb = new StringBuilder(128); + sb.Append('\n'); + sb.Append($"Reach: {reach:N3} tiles\n"); + sb.Append($"Launch Velocity: {launch:N2}\n"); + sb.Append($"Reelback Velocity: {reel:N2}\n"); + sb.Append($"Pull Velocity: {pull:N2}"); + return sb.ToString(); + } + + // This function is shorthand for appending a stat sheet to a grappling hook. + void AddGrappleStats(float r, float l, float e, float p) => EditTooltipByName("Equipable", (line) => line.text += HookStatsTooltip(r, l, e, p)); + + if (item.type == ItemID.GrapplingHook) + AddGrappleStats(18.75f, 11.5f, 11f, 11f); + if (item.type == ItemID.AmethystHook) + AddGrappleStats(18.75f, 10f, 11f, 11f); + if (item.type == ItemID.TopazHook) + AddGrappleStats(20.625f, 10.5f, 11.75f, 11f); + if (item.type == ItemID.SapphireHook) + AddGrappleStats(22.5f, 11f, 12.5f, 11f); + if (item.type == ItemID.EmeraldHook) + AddGrappleStats(24.375f, 11.5f, 13.25f, 11f); + if (item.type == ItemID.RubyHook) + AddGrappleStats(26.25f, 12f, 14f, 11f); + if (item.type == ItemID.DiamondHook) + AddGrappleStats(28.125f, 12.5f, 14.75f, 11f); + if (item.type == ItemID.WebSlinger) + AddGrappleStats(15.625f, 10f, 11f, 11f); + if (item.type == ItemID.SkeletronHand) + AddGrappleStats(21.875f, 15f, 11f, 11f); + if (item.type == ItemID.SlimeHook) + AddGrappleStats(18.75f, 13f, 11f, 11f); + if (item.type == ItemID.FishHook) + AddGrappleStats(25f, 13f, 11f, 11f); + if (item.type == ItemID.IvyWhip) + AddGrappleStats(25f, 13f, 15f, 11f); + if (item.type == ItemID.BatHook) // TODO -- This item should be dropped by Vampires in the Eclipse. It is very overpowered. + AddGrappleStats(31.25f, 15.5f, 20f, 16f); + if (item.type == ItemID.CandyCaneHook) + AddGrappleStats(25f, 11.5f, 11f, 11f); + if (item.type == ItemID.DualHook) + AddGrappleStats(27.5f, 14f, 17f, 11f); + // these four grapple hooks are all functionally identical + if (item.type == ItemID.ThornHook || item.type == ItemID.WormHook || item.type == ItemID.TendonHook || item.type == ItemID.IlluminantHook) + AddGrappleStats(30f, 15f, 18f, 11f); + if (item.type == ItemID.AntiGravityHook) + AddGrappleStats(31.25f, 14f, 20f, 11f); + if (item.type == ItemID.SpookyHook) + AddGrappleStats(34.375f, 15.5f, 22f, 11f); + if (item.type == ItemID.ChristmasHook) + AddGrappleStats(34.375f, 15.5f, 17f, 11f); + if (item.type == ItemID.LunarHook) + AddGrappleStats(34.375f, 16f, 24f, 13f); + if (item.type == ItemID.StaticHook) + AddGrappleStats(37.5f, 16f, 24f, 0f); + #endregion + + // Beyond this point all code only applies to accessories. Skip it all if the item is not an accessory. + if (!item.accessory) + return; + + // Display the stat changes to vanilla prefixes + #region Accessory Prefix Rebalance Tooltips + + // Turns a number into a string of increased DR. + string DRString(float percent) => $"\n+{percent:N2}% damage reduction"; + + switch (item.prefix) + { + case PrefixID.Brisk: + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("1%", "2%")); + return; + case PrefixID.Fleeting: + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("2%", "4%")); + return; + case PrefixID.Hasty2: // Hasty2 is the "Hasty" for accessories + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("3%", "6%")); + return; + case PrefixID.Quick2: // Quick2 is the "Quick" for accessories + EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("4%", "8%")); + return; + case PrefixID.Hard: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("1", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.25f)); + return; + case PrefixID.Guarding: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("2", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.5f)); + return; + case PrefixID.Armored: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("3", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.75f)); + return; + case PrefixID.Warding: + EditTooltipByName("PrefixAccDefense", + (line) => line.text = line.text.Replace("4", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(1f)); + return; + } + #endregion + } + #endregion + + #region True Melee Damage Tooltip + private void TrueMeleeDamageTooltip(Item item, IList tooltips) + { + 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) + return; + + // Start with the existing line of melee damage. + StringBuilder sb = new StringBuilder(64); + sb.Append(line.text).Append(" : "); + + Player p = Main.LocalPlayer; + float itemCurrentDamage = item.damage * p.MeleeDamage(); + double trueMeleeBoost = 1D + p.Calamity().trueMeleeDamage; + double imprecisionRoundingCorrection = 5E-06D; + int damageToDisplay = (int)(itemCurrentDamage * trueMeleeBoost + imprecisionRoundingCorrection); + sb.Append(damageToDisplay); + + // These two pieces are split apart for ease of translation + sb.Append(' '); + sb.Append("true melee damage"); + line.text = sb.ToString(); + } + #endregion + + #region Stealth Generation Prefix Accessory Tooltip + private void StealthGenAccessoryTooltip(Item item, IList tooltips) + { + if (!item.accessory || item.social || item.prefix <= 0) + return; + + float stealthGenBoost = item.Calamity().StealthGenBonus - 1f; + if (stealthGenBoost > 0) + { + TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") + { + isModifier = true + }; + tooltips.Add(StealthGen); + } + } + #endregion + + #region Element Tooltip + private void ElementTooltip(Item item, IList tooltips) + { + if (CalamityLists.fireWeaponList.Contains(item.type)) + { + TooltipLine fireTooltip = new TooltipLine(mod, "FireWeapon", "- Fire Weapon -") + { + overrideColor = new Color(255, 165, 0) + }; + tooltips.Add(fireTooltip); + } + + if (CalamityLists.iceWeaponList.Contains(item.type)) + { + TooltipLine iceTooltip = new TooltipLine(mod, "IceWeapon", "- Ice Weapon -") + { + overrideColor = new Color(94, 230, 255) + }; + tooltips.Add(iceTooltip); + } + + if (CalamityLists.natureWeaponList.Contains(item.type)) + { + TooltipLine natureTooltip = new TooltipLine(mod, "NatureWeapon", "- Nature Weapon -") + { + overrideColor = new Color(46, 165, 0) + }; + tooltips.Add(natureTooltip); + } + } + #endregion + + #region Enchanted Rarity Text Drawing + public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) + { + // Special enchantment line color. + if (line.Name == "ItemName" && line.mod == "Terraria" && item.IsEnchanted()) + { + Color rarityColor = line.overrideColor ?? line.color; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float backInterpolant = (float)Math.Pow(Main.GlobalTime * 0.81f % 1f, 1.5f); + Vector2 backScale = line.baseScale * MathHelper.Lerp(1f, 1.2f, backInterpolant); + Color backColor = Color.Lerp(rarityColor, Color.DarkRed, backInterpolant) * (float)Math.Pow(1f - backInterpolant, 0.46f); + Vector2 backPosition = basePosition - new Vector2(1f, 0.1f) * backInterpolant * 10f; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive); + + // Draw the back text as an ominous pulse. + for (int i = 0; i < 2; i++) + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.font, line.text, backPosition, backColor, line.rotation, line.origin, backScale, line.maxWidth, line.spread); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.font, line.text, basePosition, rarityColor, line.rotation, line.origin, line.baseScale, line.maxWidth, line.spread); + + return false; + } + return true; + } + #endregion + + #region Fargo Biome Fountain Tooltip + private void FargoFountainTooltip(Item item, IList tooltips) + { + if (CalamityMod.Instance.fargos is null) + return; + + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sunken Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sulphurous Sea upon activation"); + tooltips.Add(line); + } + if (item.type == ModContent.ItemType()) + { + TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Astral upon activation"); + tooltips.Add(line); + } + } + #endregion + } +} diff --git a/Items/Critters/BabyFlakHermit.cs b/Items/Critters/BabyFlakHermit.cs index fd00124e2a..088b1ee608 100644 --- a/Items/Critters/BabyFlakHermit.cs +++ b/Items/Critters/BabyFlakHermit.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Critters item.width = 26; item.height = 24; item.makeNPC = (short)ModContent.NPCType(); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Critters/BabyGhostBellItem.cs b/Items/Critters/BabyGhostBellItem.cs index f55443fb8c..2bb9ba1bd7 100644 --- a/Items/Critters/BabyGhostBellItem.cs +++ b/Items/Critters/BabyGhostBellItem.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Critters item.width = 26; item.height = 24; item.makeNPC = (short)ModContent.NPCType(); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Critters/PiggyItem.cs b/Items/Critters/PiggyItem.cs index a323645466..d7983ede97 100644 --- a/Items/Critters/PiggyItem.cs +++ b/Items/Critters/PiggyItem.cs @@ -22,13 +22,13 @@ namespace CalamityMod.Items.Critters item.maxStack = 999; item.consumable = true; item.noUseGraphic = true; - item.value = Item.buyPrice(0, 50, 0, 0); - //item.CloneDefaults(2004); //Lightning Bug item item.width = 26; item.height = 24; item.makeNPC = (short)ModContent.NPCType(); - item.rare = 1; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + 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 8ac32c7b8c..1f86ffd2c6 100644 --- a/Items/Critters/SeaMinnowItem.cs +++ b/Items/Critters/SeaMinnowItem.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Critters item.height = 24; item.bait = 20; item.makeNPC = (short)ModContent.NPCType(); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Critters/TwinklerItem.cs b/Items/Critters/TwinklerItem.cs index 8539221ec8..cb36e188db 100644 --- a/Items/Critters/TwinklerItem.cs +++ b/Items/Critters/TwinklerItem.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Critters item.height = 24; item.bait = 40; item.makeNPC = (short)ModContent.NPCType(); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/DifficultyItems/Armageddon.cs b/Items/DifficultyItems/Armageddon.cs index c452c64f25..faf4f3c1e4 100644 --- a/Items/DifficultyItems/Armageddon.cs +++ b/Items/DifficultyItems/Armageddon.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.SlimeGod; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -15,13 +16,13 @@ namespace CalamityMod.Items.DifficultyItems DisplayName.SetDefault("Armageddon"); Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" + "Effect can be toggled on and off\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss\n" + - "If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode"); + "If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode\n" + + "These extra bags will only drop if it's your first time killing the boss"); } public override void SetDefaults() { - item.rare = 11; + item.rare = ItemRarityID.Purple; item.width = 28; item.height = 28; item.useAnimation = 45; @@ -31,57 +32,29 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) - { - if (CalamityWorld.bossRushActive) - { - return false; - } - return true; - } - public override bool UseItem(Player player) { - for (int doom = 0; doom < Main.npc.Length; doom++) - { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.armageddon) - { - CalamityWorld.armageddon = true; - } - else - { - CalamityWorld.armageddon = false; - } + // This world syncing code should only be run by one entity- the server, to prevent a race condition + // with the packets. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.ChangingTheRules"; + Color messageColor = Color.Fuchsia; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return true; + } + CalamityWorld.armageddon = !CalamityWorld.armageddon; CalamityWorld.DoGSecondStageCountdown = 0; - string key = CalamityWorld.armageddon ? "Mods.CalamityMod.ArmageddonText" : "Mods.CalamityMod.ArmageddonText2"; - Color messageColor = Color.Fuchsia; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + string key2 = CalamityWorld.armageddon ? "Mods.CalamityMod.ArmageddonText" : "Mods.CalamityMod.ArmageddonText2"; + Color messageColor2 = Color.Fuchsia; + CalamityUtils.DisplayLocalizedText(key2, messageColor2); - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ArmageddonBoolSync); - netMessage.Write(CalamityWorld.armageddon); - netMessage.Send(); - } return true; } diff --git a/Items/DifficultyItems/BallAndChain.cs b/Items/DifficultyItems/BallAndChain.cs new file mode 100644 index 0000000000..a0d9ea4fee --- /dev/null +++ b/Items/DifficultyItems/BallAndChain.cs @@ -0,0 +1,42 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DifficultyItems +{ + public class BallAndChain : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball and Chain"); + Tooltip.SetDefault("So heavy...\n" + + "Favorite this item to disable any dashes granted by equipment."); + } + + public override void SetDefaults() + { + 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) + 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(); + } + } +} diff --git a/Items/DifficultyItems/BallAndChain.png b/Items/DifficultyItems/BallAndChain.png new file mode 100644 index 0000000000..7ca87bdef9 Binary files /dev/null and b/Items/DifficultyItems/BallAndChain.png differ diff --git a/Items/DifficultyItems/Death.cs b/Items/DifficultyItems/Death.cs index 406156cfad..96787d1ae2 100644 --- a/Items/DifficultyItems/Death.cs +++ b/Items/DifficultyItems/Death.cs @@ -1,11 +1,11 @@ -using CalamityMod.NPCs.SlimeGod; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Items.DifficultyItems { public class Death : ModItem @@ -15,22 +15,21 @@ namespace CalamityMod.Items.DifficultyItems DisplayName.SetDefault("Death"); Tooltip.SetDefault("Makes bosses even more EXTREME.\n" + "Allows certain bosses to spawn naturally.\n" + - "Certain biomes and events have additional weather effects.\n" + - "Lethal lava effects are always enabled.\n" + - "Increases enemy damage by 15%.\n" + + "Certain biomes and events have additional weather effects.\n" + + "Lethal lava effects are always enabled.\n" + + "Enemies and bosses buffed by Revengeance Mode are even stronger in this mode.\n" + "Greatly boosts enemy spawn rates during the blood moon.\n" + "Nerfs the effectiveness of life steal.\n" + - "Makes the abyss more treachorous to navigate.\n" + + "Makes the abyss more treacherous to navigate.\n" + "Nurse no longer heals while a boss is alive.\n" + - "Increases damage done by several debuffs.\n" + + "Increases damage done by 50% for several debuffs and all alcohols that reduce life regen.\n" + "Effect can be toggled on and off.\n" + - "Effect will only work if Revengeance Mode is active.\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss."); + "Effect will only work if Revengeance Mode is active."); } public override void SetDefaults() { - item.rare = 11; + item.rare = ItemRarityID.Purple; item.width = 28; item.height = 28; item.useAnimation = 45; @@ -40,80 +39,39 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) - { - if (!CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => CalamityWorld.revenge; public override bool UseItem(Player player) { - for (int doom = 0; doom < Main.npc.Length; doom++) + // This world syncing code should only be run by one entity- the server, to prevent a race condition + // with the packets. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } + string key = "Mods.CalamityMod.ChangingTheRules"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return true; } if (!CalamityWorld.death) { CalamityWorld.death = true; string key = "Mods.CalamityMod.DeathText"; Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } else { CalamityWorld.death = false; string key = "Mods.CalamityMod.DeathText2"; Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } CalamityWorld.DoGSecondStageCountdown = 0; + CalamityNetcode.SyncWorld(); - CalamityMod.UpdateServerBoolean(); - - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); - netMessage.Write(CalamityWorld.revenge); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DeathBoolSync); - netMessage.Write(CalamityWorld.death); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } return true; } diff --git a/Items/DifficultyItems/DefiledRune.cs b/Items/DifficultyItems/DefiledRune.cs index da9bc37a5c..8f84cde8fb 100644 --- a/Items/DifficultyItems/DefiledRune.cs +++ b/Items/DifficultyItems/DefiledRune.cs @@ -1,120 +1,42 @@ -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.World; -using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Items.DifficultyItems { - public class DefiledRune : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Defiled Rune"); - Tooltip.SetDefault("Wing flight is disabled and enemies can critically hit you\n" + - "Increases most rare item drop chances and enemies drop 50% more cash\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss\n" + - "Can only be used in revengeance and death mode\n" + - "Can be toggled on and off"); - } + public class DefiledRune : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Defiled Feather"); + Tooltip.SetDefault("It's a long way down from a mountain...\n" + + "Favorite this item to disable wings."); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 8)); + } - public override void SetDefaults() - { - item.rare = 11; - item.width = 28; - item.height = 28; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item100; - item.consumable = false; - } + public override void SetDefaults() + { + item.width = 40; + item.height = 50; + item.rare = ItemRarityID.Green; + } - public override bool CanUseItem(Player player) - { - if (CalamityWorld.bossRushActive || !CalamityWorld.revenge) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => false; - public override bool UseItem(Player player) - { - for (int doom = 0; doom < Main.npc.Length; doom++) - { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.defiled) - { - CalamityWorld.defiled = true; - string key = "Mods.CalamityMod.DefiledText"; - Color messageColor = Color.DarkSeaGreen; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else - { - CalamityWorld.defiled = false; - string key = "Mods.CalamityMod.DefiledText2"; - Color messageColor = Color.DarkSeaGreen; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - CalamityWorld.DoGSecondStageCountdown = 0; + public override void UpdateInventory(Player player) + { + if (item.favorited) + player.Calamity().noWings = true; + } - CalamityMod.UpdateServerBoolean(); - - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DefiledBoolSync); - netMessage.Write(CalamityWorld.defiled); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); - netMessage.Write(CalamityWorld.revenge); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Feather); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/DifficultyItems/DefiledRune.png b/Items/DifficultyItems/DefiledRune.png index b4128633bd..3bf6af0e79 100644 Binary files a/Items/DifficultyItems/DefiledRune.png and b/Items/DifficultyItems/DefiledRune.png differ diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index 10704165c4..399dd5d86a 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.SlimeGod; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -16,8 +17,7 @@ namespace CalamityMod.Items.DifficultyItems DisplayName.SetDefault("Iron Heart"); Tooltip.SetDefault("Healing with potions and all positive life regen is disabled.\n" + "Enemy damage scales with your max health.\n" + - "Can be toggled on and off.\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss."); + "Can be toggled on and off."); } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.DifficultyItems item.width = 28; item.height = 28; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -35,62 +35,35 @@ namespace CalamityMod.Items.DifficultyItems public override bool UseItem(Player player) { - for (int doom = 0; doom < Main.npc.Length; doom++) + // This world syncing code should only be run by one entity- the server, to prevent a race condition + // with the packets. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } + string key = "Mods.CalamityMod.ChangingTheRules"; + Color messageColor = Color.LightSkyBlue; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return true; } if (!CalamityWorld.ironHeart) { CalamityWorld.ironHeart = true; string key = "Mods.CalamityMod.IronHeartText"; Color messageColor = Color.LightSkyBlue; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } else { CalamityWorld.ironHeart = false; string key = "Mods.CalamityMod.IronHeartText2"; Color messageColor = Color.LightSkyBlue; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } CalamityWorld.DoGSecondStageCountdown = 0; + CalamityNetcode.SyncWorld(); - CalamityMod.UpdateServerBoolean(); - - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.IronHeartBoolSync); - netMessage.Write(CalamityWorld.ironHeart); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } return true; } } diff --git a/Items/DifficultyItems/MLGRune.cs b/Items/DifficultyItems/MLGRune.cs index 2903b8fa98..51518c4897 100644 --- a/Items/DifficultyItems/MLGRune.cs +++ b/Items/DifficultyItems/MLGRune.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.DifficultyItems public override void SetDefaults() { - item.width = 28; - item.height = 28; + item.width = item.height = 54; item.maxStack = 99; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -34,15 +33,13 @@ namespace CalamityMod.Items.DifficultyItems 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. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + CalamityWorld.demonMode = true; - CalamityMod.UpdateServerBoolean(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DemonTrophyBoolSync); - netMessage.Write(CalamityWorld.demonMode); - netMessage.Send(); - } + CalamityNetcode.SyncWorld(); return true; } } diff --git a/Items/DifficultyItems/MLGRune.png b/Items/DifficultyItems/MLGRune.png index e1cf416b98..511794c4e7 100644 Binary files a/Items/DifficultyItems/MLGRune.png and b/Items/DifficultyItems/MLGRune.png differ diff --git a/Items/DifficultyItems/Malice.cs b/Items/DifficultyItems/Malice.cs new file mode 100644 index 0000000000..2b31dd30db --- /dev/null +++ b/Items/DifficultyItems/Malice.cs @@ -0,0 +1,102 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.DifficultyItems +{ + public class Malice : ModItem + { + public int frameCounter = 0; + public int frame = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Malice"); + Tooltip.SetDefault("Enrages every boss and allows them to drop special items.\n" + + "Nurse no longer heals while a boss is alive.\n" + + "Effect can be toggled on and off."); + } + + public override void SetDefaults() + { + 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; + } + + public override void UseStyle(Player player) + { + player.itemLocation += new Vector2(-32f * player.direction, player.gravDir).RotatedBy(player.itemRotation); + } + + 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); + 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); + return false; + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + // This world syncing code should only be run by one entity- the server, to prevent a race condition + // with the packets. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.ChangingTheRules"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return true; + } + if (!CalamityWorld.malice) + { + CalamityWorld.malice = true; + string key = "Mods.CalamityMod.MaliceText"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + else + { + CalamityWorld.malice = false; + string key = "Mods.CalamityMod.MaliceText2"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + CalamityWorld.DoGSecondStageCountdown = 0; + CalamityNetcode.SyncWorld(); + + return true; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddTile(TileID.DemonAltar); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/DifficultyItems/Malice.png b/Items/DifficultyItems/Malice.png new file mode 100644 index 0000000000..12938e44f5 Binary files /dev/null and b/Items/DifficultyItems/Malice.png differ diff --git a/Items/DifficultyItems/Malice_Animated.png b/Items/DifficultyItems/Malice_Animated.png new file mode 100644 index 0000000000..fa448647be Binary files /dev/null and b/Items/DifficultyItems/Malice_Animated.png differ diff --git a/Items/DifficultyItems/Revenge.cs b/Items/DifficultyItems/Revenge.cs index 2736aca44a..c345697fd0 100644 --- a/Items/DifficultyItems/Revenge.cs +++ b/Items/DifficultyItems/Revenge.cs @@ -1,12 +1,12 @@ -using CalamityMod.NPCs.SlimeGod; +using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; -using Terraria.DataStructures; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.Items.DifficultyItems { public class Revenge : ModItem @@ -16,19 +16,14 @@ namespace CalamityMod.Items.DifficultyItems DisplayName.SetDefault("Revengeance"); Tooltip.SetDefault("Enables/disables Revengeance Mode, can only be used in expert mode.\n" + "RAGE TOOLTIP LINE HERE\n" + - "You gain rage whenever you take damage or hit an enemy with a true melee weapon.\n" + + "You gain Rage when in proximity of enemies or by using special items.\n" + "ADRENALINE TOOLTIP LINE HERE\n" + - "You gain adrenaline whenever a boss is alive. Getting hit drops adrenaline back to 0.\n" + - "All enemies drop 50% more cash and spawn 15% more frequently\n" + + "You gain Adrenaline whenever a boss is alive. Getting hit drops Adrenaline back to 0.\n" + + "All enemies drop 50% more coins and spawn 15% more frequently\n" + "Certain enemies and projectiles deal between 5% and 25% more damage.\n" + - "Makes certain enemies immune to life steal and nerfs the effectiveness of life steal.\n" + + "Makes certain enemies block life steal and nerfs the effectiveness of life steal.\n" + "Nerfs the effectiveness of the Titanium Armor set bonus.\n" + - "Makes life regen scale with your current HP, the higher your HP the lower your life regen (this is not based on max HP).\n" + - "Asphalt run speed is reduced by 33%, and the Nurse's healing cost is increased\n" + - "Allows certain enemies to inflict the Horror and Marked debuffs.\n" + - "Before you have killed your first boss you take 20% less damage from everything.\n" + - "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod.\n" + - "Using this while a boss is alive will instantly kill you and despawn the boss."); + "Changes ALL boss AIs and some enemy AIs in vanilla and the Calamity Mod."); } public override void SetDefaults() @@ -38,7 +33,7 @@ namespace CalamityMod.Items.DifficultyItems item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = 11; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item119; item.consumable = false; } @@ -51,104 +46,56 @@ namespace CalamityMod.Items.DifficultyItems { if (line2.mod == "Terraria" && line2.Name == "Tooltip1") { - line2.text = "Activates rage. When rage is maxed press " + rageKey + " to activate rage mode."; + line2.text = "Enables the Rage mechanic. When Rage is maxed press " + rageKey + " to activate Rage Mode."; } if (line2.mod == "Terraria" && line2.Name == "Tooltip3") { - line2.text = "Activates adrenaline. When adrenaline is maxed press " + adrenKey + " to activate adrenaline mode."; + line2.text = "Enables the Adrenaline mechanic. When Adrenaline is maxed press " + adrenKey + " to activate Adrenaline Mode."; } } } - public override bool CanUseItem(Player player) => Main.expertMode && !CalamityWorld.bossRushActive; + public override bool CanUseItem(Player player) => Main.expertMode; public override bool UseItem(Player player) { - for (int doom = 0; doom < Main.npc.Length; doom++) + // This world syncing code should only be run by one entity- the server, to prevent a race condition + // with the packets. + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + + if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive) { - NPC npc = Main.npc[doom]; - if ((npc.active && (npc.boss || npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); - npc.active = npc.friendly; - npc.netUpdate = true; - } + string key = "Mods.CalamityMod.ChangingTheRules"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + return true; } if (!CalamityWorld.revenge) { CalamityWorld.revenge = true; string key = "Mods.CalamityMod.RevengeText"; Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } else { CalamityWorld.revenge = false; string key = "Mods.CalamityMod.RevengeText2"; Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); if (CalamityWorld.death) { CalamityWorld.death = false; key = "Mods.CalamityMod.DeathText2"; messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (CalamityWorld.defiled) - { - CalamityWorld.defiled = false; - key = "Mods.CalamityMod.DefiledText2"; - messageColor = Color.DarkSeaGreen; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } CalamityWorld.DoGSecondStageCountdown = 0; - - CalamityMod.UpdateServerBoolean(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.RevengeanceBoolSync); - netMessage.Write(CalamityWorld.revenge); - netMessage.Send(); - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } + CalamityNetcode.SyncWorld(); } return true; } diff --git a/Items/DraedonMisc/ChargerTestItem.cs b/Items/DraedonMisc/ChargerTestItem.cs deleted file mode 100644 index bfb0f8eb91..0000000000 --- a/Items/DraedonMisc/ChargerTestItem.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.DraedonMisc -{ - public class ChargerTestItem : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Charger Test Item"); - Tooltip.SetDefault("Testing/Cheat Item\n" + - "Charges all Draedon's Arsenal weapons in your inventory"); - } - - public override void SetDefaults() - { - item.width = 42; - item.height = 42; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; - - item.consumable = false; - item.useStyle = ItemUseStyleID.HoldingUp; - item.useTime = 29; - item.useAnimation = 29; - item.autoReuse = false; - item.useTurn = true; - } - - public override bool UseItem(Player player) - { - for (int i = 0; i < player.inventory.Length; i++) - { - if (player.inventory[i].type > ItemID.Count && player.inventory[i].Calamity().Chargeable) - player.inventory[i].Calamity().CurrentCharge = player.inventory[i].Calamity().ChargeMax; - } - return true; - } - - } -} diff --git a/Items/DraedonMisc/ChargerTestItem.png b/Items/DraedonMisc/ChargerTestItem.png deleted file mode 100644 index 6cd561cb05..0000000000 Binary files a/Items/DraedonMisc/ChargerTestItem.png and /dev/null differ diff --git a/Items/DraedonMisc/PowerCell.cs b/Items/DraedonMisc/PowerCell.cs index bbd946dab7..7b24c2c58b 100644 --- a/Items/DraedonMisc/PowerCell.cs +++ b/Items/DraedonMisc/PowerCell.cs @@ -7,10 +7,13 @@ namespace CalamityMod.Items.DraedonMisc { public class PowerCell : ModItem { + // This is how much Charge each Power Cell is worth when charging. Leave this at 1. + public const float ChargeValue = 1f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Draedon Power Cell"); - Tooltip.SetDefault("Used to charge Draedon's weaponry at a charger\n" + + 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; } @@ -26,7 +29,7 @@ namespace CalamityMod.Items.DraedonMisc item.consumable = true; item.useStyle = ItemUseStyleID.SwingThrow; item.useAnimation = 10; - item.useTime = 5; + item.useTime = 2; item.autoReuse = true; item.useTurn = true; item.value = Item.sellPrice(0, 0, 0, 20); diff --git a/Items/Dyes/AstralBlueDye.cs b/Items/Dyes/AstralBlueDye.cs index 602f7341f4..869a47b3ef 100644 --- a/Items/Dyes/AstralBlueDye.cs +++ b/Items/Dyes/AstralBlueDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.value = Item.sellPrice(0, 2, 0, 0); } diff --git a/Items/Dyes/AstralOrangeDye.cs b/Items/Dyes/AstralOrangeDye.cs index 4945847a5e..02bbb26691 100644 --- a/Items/Dyes/AstralOrangeDye.cs +++ b/Items/Dyes/AstralOrangeDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.value = Item.sellPrice(0, 2, 0, 0); } diff --git a/Items/Dyes/AstralSwirlDye.cs b/Items/Dyes/AstralSwirlDye.cs index d82a951e4d..fb756ba046 100644 --- a/Items/Dyes/AstralSwirlDye.cs +++ b/Items/Dyes/AstralSwirlDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.value = Item.sellPrice(0, 3, 0, 0); } diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs new file mode 100644 index 0000000000..c48e0567da --- /dev/null +++ b/Items/Dyes/BloodflareDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class BloodflareDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/BloodflareDyeShader")), "DyePass"). + UseColor(new Color(122, 10, 60)).UseSecondaryColor(new Color(219, 102, 106)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/BloodflareDye.png b/Items/Dyes/BloodflareDye.png new file mode 100644 index 0000000000..aa7383fe1d Binary files /dev/null and b/Items/Dyes/BloodflareDye.png differ diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs new file mode 100644 index 0000000000..be095f9472 --- /dev/null +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class BlueCosmicFlameDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmicFlameShader")), "DyePass"). + UseColor(new Color(52, 212, 229)).UseSecondaryColor(new Color(52, 212, 229)).UseImage("Images/Misc/Noise").UseSaturation(0f); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Blue Cosmic Flame Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/BlueCosmicFlameDye.png b/Items/Dyes/BlueCosmicFlameDye.png new file mode 100644 index 0000000000..103049ae10 Binary files /dev/null and b/Items/Dyes/BlueCosmicFlameDye.png differ diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs new file mode 100644 index 0000000000..ce329f8051 --- /dev/null +++ b/Items/Dyes/CalamitousDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class CalamitousDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CalamitousDyeShader")), "DyePass"). + UseColor(new Color(227, 79, 79)).UseSecondaryColor(new Color(145, 27, 135)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Calamitous Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/CalamitousDye.png b/Items/Dyes/CalamitousDye.png new file mode 100644 index 0000000000..587ec7e601 Binary files /dev/null and b/Items/Dyes/CalamitousDye.png differ diff --git a/Items/Dyes/CeaselessDye.cs b/Items/Dyes/CeaselessDye.cs index 74ec09aeda..20e3a9dd5e 100644 --- a/Items/Dyes/CeaselessDye.cs +++ b/Items/Dyes/CeaselessDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; item.value = Item.sellPrice(0, 4, 0, 0); } diff --git a/Items/Dyes/CryonicDye.cs b/Items/Dyes/CryonicDye.cs new file mode 100644 index 0000000000..86fd0e89bc --- /dev/null +++ b/Items/Dyes/CryonicDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class CryonicDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CryonicDyeShader")), "DyePass"). + UseColor(new Color(138, 225, 255)).UseSecondaryColor(new Color(90, 90, 204)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Cryonic Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/CryonicDye.png b/Items/Dyes/CryonicDye.png new file mode 100644 index 0000000000..7aa240fd98 Binary files /dev/null and b/Items/Dyes/CryonicDye.png differ diff --git a/Items/Dyes/DefiledFlameDye.cs b/Items/Dyes/DefiledFlameDye.cs index 96706e639b..5b29481bf8 100644 --- a/Items/Dyes/DefiledFlameDye.cs +++ b/Items/Dyes/DefiledFlameDye.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework; +using Terraria.ID; namespace CalamityMod.Items.Dyes { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.value = CalamityGlobalItem.Rarity4BuyPrice; } } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 93a6009f42..7e79c1fcf2 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Violet; item.value = Item.sellPrice(0, 8, 0, 0); } diff --git a/Items/Dyes/ElementalDye.cs b/Items/Dyes/ElementalDye.cs index b9ffc2506e..b85f7e2c51 100644 --- a/Items/Dyes/ElementalDye.cs +++ b/Items/Dyes/ElementalDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Turquoise; item.value = Item.sellPrice(0, 2, 50, 0); } diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 5812406c34..3b18dce169 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/HairDye/AdrenalineHairDye.cs b/Items/Dyes/HairDye/AdrenalineHairDye.cs index da4103197d..3616b4909b 100644 --- a/Items/Dyes/HairDye/AdrenalineHairDye.cs +++ b/Items/Dyes/HairDye/AdrenalineHairDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes.HairDye item.height = 26; item.maxStack = 99; item.value = Item.buyPrice(gold: 7, silver: 50); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item3; item.useStyle = ItemUseStyleID.EatingUsing; item.useTurn = true; diff --git a/Items/Dyes/HairDye/RageHairDye.cs b/Items/Dyes/HairDye/RageHairDye.cs index d9da0f6f72..f7f543d0d3 100644 --- a/Items/Dyes/HairDye/RageHairDye.cs +++ b/Items/Dyes/HairDye/RageHairDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes.HairDye item.height = 26; item.maxStack = 99; item.value = Item.buyPrice(gold: 7, silver: 50); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item3; item.useStyle = ItemUseStyleID.EatingUsing; item.useTurn = true; diff --git a/Items/Dyes/HairDye/StealthHairDye.cs b/Items/Dyes/HairDye/StealthHairDye.cs index bd0da7a33c..2dfe7b5bfb 100644 --- a/Items/Dyes/HairDye/StealthHairDye.cs +++ b/Items/Dyes/HairDye/StealthHairDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes.HairDye item.height = 26; item.maxStack = 99; item.value = Item.buyPrice(gold: 5); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item3; item.useStyle = ItemUseStyleID.EatingUsing; item.useTurn = true; diff --git a/Items/Dyes/HairDye/WingTimeHairDye.cs b/Items/Dyes/HairDye/WingTimeHairDye.cs index 74baadd340..7ebf91ff02 100644 --- a/Items/Dyes/HairDye/WingTimeHairDye.cs +++ b/Items/Dyes/HairDye/WingTimeHairDye.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Dyes.HairDye item.height = 26; item.maxStack = 99; item.value = Item.buyPrice(gold: 7, silver: 50); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item3; item.useStyle = ItemUseStyleID.EatingUsing; item.useTurn = true; diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 3f5b89ac10..5d8a0c30c8 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.value = Item.sellPrice(0, 5, 0, 0); } diff --git a/Items/Dyes/PhantoplasmDye.cs b/Items/Dyes/PhantoplasmDye.cs new file mode 100644 index 0000000000..993f77f826 --- /dev/null +++ b/Items/Dyes/PhantoplasmDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class PhantoplasmDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/PhantoplasmDyeShader")), "DyePass"). + UseColor(new Color(245, 143, 182)).UseSecondaryColor(new Color(119, 238, 255)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Phantoplasm Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/PhantoplasmDye.png b/Items/Dyes/PhantoplasmDye.png new file mode 100644 index 0000000000..792d4bd633 Binary files /dev/null and b/Items/Dyes/PhantoplasmDye.png differ diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs new file mode 100644 index 0000000000..9c953cf4bd --- /dev/null +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class PinkCosmicFlameDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmicFlameShader")), "DyePass"). + UseColor(new Color(255, 115, 221)).UseSecondaryColor(new Color(255, 115, 221)).UseImage("Images/Misc/Noise").UseSaturation(0f); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Pink Cosmic Flame Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/PinkCosmicFlameDye.png b/Items/Dyes/PinkCosmicFlameDye.png new file mode 100644 index 0000000000..65c1fd39ad Binary files /dev/null and b/Items/Dyes/PinkCosmicFlameDye.png differ diff --git a/Items/Dyes/ProfanedFlameDye.cs b/Items/Dyes/ProfanedFlameDye.cs new file mode 100644 index 0000000000..e777cce2b1 --- /dev/null +++ b/Items/Dyes/ProfanedFlameDye.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class ProfanedFlameDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/ProfanedFlameDyeShader")), "DyePass"). + UseColor(new Color(255, 191, 73)).UseSecondaryColor(new Color(255, 255, 186)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Profaned Flame Dye"); + } + + public override void SafeSetDefaults() + { + 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(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/ProfanedFlameDye.png b/Items/Dyes/ProfanedFlameDye.png new file mode 100644 index 0000000000..fefa274ca2 Binary files /dev/null and b/Items/Dyes/ProfanedFlameDye.png differ diff --git a/Items/Dyes/ProfanedMoonlightDye.cs b/Items/Dyes/ProfanedMoonlightDye.cs index dc10aab350..73d6fd094f 100644 --- a/Items/Dyes/ProfanedMoonlightDye.cs +++ b/Items/Dyes/ProfanedMoonlightDye.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Graphics.Shaders; +using Terraria.ID; namespace CalamityMod.Items.Dyes { @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + 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 3a01787ddc..1806ecf205 100644 --- a/Items/Dyes/ReaverDye.cs +++ b/Items/Dyes/ReaverDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 7; + item.rare = ItemRarityID.Lime; item.value = Item.sellPrice(0, 1, 0, 0); } diff --git a/Items/Dyes/ShadowspecDye.cs b/Items/Dyes/ShadowspecDye.cs index 9b6c88844c..dd405cc505 100644 --- a/Items/Dyes/ShadowspecDye.cs +++ b/Items/Dyes/ShadowspecDye.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Developer; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.HotPink; item.value = Item.sellPrice(0, 10, 0, 0); } diff --git a/Items/Dyes/StratusDye.cs b/Items/Dyes/StratusDye.cs index 47f384cfa5..edf443a7e0 100644 --- a/Items/Dyes/StratusDye.cs +++ b/Items/Dyes/StratusDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; item.value = Item.sellPrice(0, 4, 50, 0); } diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs new file mode 100644 index 0000000000..f227541687 --- /dev/null +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class SwirlingCosmicFlameDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/CosmicFlameShader")), "DyePass"). + UseColor(new Color(52, 212, 229)).UseSecondaryColor(new Color(255, 115, 221)).UseImage("Images/Misc/Noise").UseSaturation(1f); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Swirling Cosmic Flame Dye"); + } + + public override void SafeSetDefaults() + { + 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); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/SwirlingCosmicFlameDye.png b/Items/Dyes/SwirlingCosmicFlameDye.png new file mode 100644 index 0000000000..bc524d1cc6 Binary files /dev/null and b/Items/Dyes/SwirlingCosmicFlameDye.png differ diff --git a/Items/Fishing/AstralCatches/AldebaranAlewife.cs b/Items/Fishing/AstralCatches/AldebaranAlewife.cs index 3d3828dc51..bd8907b518 100644 --- a/Items/Fishing/AstralCatches/AldebaranAlewife.cs +++ b/Items/Fishing/AstralCatches/AldebaranAlewife.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.height = 36; item.maxStack = 999; item.value = Item.sellPrice(silver: 8); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs index 9e7788d542..bcf8eea95f 100644 --- a/Items/Fishing/AstralCatches/ArcturusAstroidean.cs +++ b/Items/Fishing/AstralCatches/ArcturusAstroidean.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.bait = 40; } } diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 1011abd771..953a98e3c9 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.consumable = true; item.width = 32; item.height = 32; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.sellPrice(gold: 1); item.createTile = ModContent.TileType(); item.useTurn = true; @@ -46,23 +46,17 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void RightClick(Player player) { //Modded materials - DropHelper.DropItem(player, ModContent.ItemType(), 10, 20); - DropHelper.DropItem(player, ItemID.FallenStar, 10, 20); - DropHelper.DropItemChance(player, ItemID.Meteorite, 0.5f, 10, 20); - DropHelper.DropItemChance(player, ItemID.MeteoriteBar, 0.25f, 5, 10); - if (CalamityWorld.downedAstrageldon) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - } - if (CalamityWorld.downedStarGod) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 10, 20); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); - } + DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); + DropHelper.DropItem(player, ItemID.FallenStar, 5, 10); + DropHelper.DropItemChance(player, ItemID.Meteorite, 0.2f, 10, 20); + DropHelper.DropItemChance(player, ItemID.MeteoriteBar, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedStarGod, 0.2f, 10, 20); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedStarGod, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedStarGod, 0.25f, 5, 10); // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAstrageldon, 0.1f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -89,19 +83,26 @@ namespace CalamityMod.Items.Fishing.AstralCatches DropHelper.DropItemChance(player, ItemID.MiningPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - if (CalamityWorld.downedStarGod) - { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.SuperHealingPotion : ItemID.SuperManaPotion, 5, 10); - } - else - { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.GreaterHealingPotion : ItemID.GreaterManaPotion, 5, 10); - } - if (CalamityWorld.downedAstrageldon) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 1, 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 4, 1, 3); - } + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.1f, 1, 3); + int healingPotID = ItemID.HealingPotion; + int manaPotID = ItemID.ManaPotion; + if (CalamityWorld.downedDoG) + { + healingPotID = ModContent.ItemType(); + manaPotID = ModContent.ItemType(); + } + else if (CalamityWorld.downedProvidence) + { + healingPotID = ItemID.SuperHealingPotion; + manaPotID = ItemID.SuperManaPotion; + } + else if (NPC.downedMechBossAny) + { + healingPotID = ItemID.GreaterHealingPotion; + manaPotID = ItemID.GreaterManaPotion; + } + DropHelper.DropItemChance(player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); //Money DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); diff --git a/Items/Fishing/AstralCatches/AstrophageItem.cs b/Items/Fishing/AstralCatches/AstrophageItem.cs index 94f73dbf15..4c461a17bc 100644 --- a/Items/Fishing/AstralCatches/AstrophageItem.cs +++ b/Items/Fishing/AstralCatches/AstrophageItem.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void UseStyle(Player player) diff --git a/Items/Fishing/AstralCatches/GacruxianMollusk.cs b/Items/Fishing/AstralCatches/GacruxianMollusk.cs index f8d29162a1..eeab8429db 100644 --- a/Items/Fishing/AstralCatches/GacruxianMollusk.cs +++ b/Items/Fishing/AstralCatches/GacruxianMollusk.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SafeSetDefaults() { item.damage = BaseDamage; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.knockBack = Knockback; item.autoReuse = true; item.useTime = 26; @@ -47,7 +47,8 @@ namespace CalamityMod.Items.Fishing.AstralCatches if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Fishing/AstralCatches/PolarisParrotfish.cs b/Items/Fishing/AstralCatches/PolarisParrotfish.cs index 47c23f02f7..a3ca622ace 100644 --- a/Items/Fishing/AstralCatches/PolarisParrotfish.cs +++ b/Items/Fishing/AstralCatches/PolarisParrotfish.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); //pew pew item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs index 077c7882fe..bffd15e4c8 100644 --- a/Items/Fishing/AstralCatches/ProcyonidPrawn.cs +++ b/Items/Fishing/AstralCatches/ProcyonidPrawn.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 5); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/AstralCatches/TwinklingPollox.cs b/Items/Fishing/AstralCatches/TwinklingPollox.cs index f8148de3dd..bfd9113241 100644 --- a/Items/Fishing/AstralCatches/TwinklingPollox.cs +++ b/Items/Fishing/AstralCatches/TwinklingPollox.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.AstralCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.AstralCatches item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 5); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index 77e40e67ed..872454c074 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Fishing.AstralCatches { item.width = 36; item.height = 26; - item.value = Item.buyPrice(0, 24, 0, 0); - item.rare = 8; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; item.accessory = true; } diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index c0b11922bd..a2d34352c4 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -29,9 +29,9 @@ The life regen boost is stronger if below 75% health item.maxStack = 999; item.useTurn = true; item.value = Item.sellPrice(gold: 5); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.useAnimation = 17; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAnimation = 17; item.useTime = 17; item.useStyle = ItemUseStyleID.EatingUsing; item.UseSound = SoundID.Item3; diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index bb644037cb..a2cc321282 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions; using CalamityMod.Tiles.Crags; using CalamityMod.World; using Terraria; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.consumable = true; item.width = 32; item.height = 32; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.sellPrice(gold: 1); item.createTile = ModContent.TileType(); item.useTurn = true; @@ -35,12 +36,17 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void RightClick(Player player) { + //Vanilla materials + DropHelper.DropItem(player, ItemID.Obsidian, 2, 5); + DropHelper.DropItemChance(player, ItemID.Hellstone, 0.25f, 2, 5); + DropHelper.DropItemChance(player, ItemID.HellstoneBar, 0.1f, 1, 3); + //Modded materials - DropHelper.DropItem(player, ModContent.ItemType(), 3, 5); - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.5f, 5, 15); + DropHelper.DropItem(player, ModContent.ItemType(), 1, 4); + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.2f, 2, 4); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.hardMode, 0.15f, 2, 6); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedBrimstoneElemental, 0.5f, 5, 15); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence, 0.25f, 8, 10); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedBrimstoneElemental, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedProvidence && CalamityWorld.downedPolterghast, 0.1f, 1, 3); // Weapons (none) @@ -59,14 +65,29 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion DropHelper.DropItemChance(player, ItemID.InfernoPotion, 10, 1, 3); - if (Main.hardMode) - { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.GreaterHealingPotion: ItemID.GreaterManaPotion, 5, 10); - } - else - { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.HealingPotion : ItemID.ManaPotion, 5, 10); - } + int healingPotID = ItemID.LesserHealingPotion; + int manaPotID = ItemID.LesserManaPotion; + if (CalamityWorld.downedDoG) + { + healingPotID = ModContent.ItemType(); + manaPotID = ModContent.ItemType(); + } + else if (CalamityWorld.downedProvidence) + { + healingPotID = ItemID.SuperHealingPotion; + manaPotID = ItemID.SuperManaPotion; + } + else if (NPC.downedMechBossAny) + { + healingPotID = ItemID.GreaterHealingPotion; + manaPotID = ItemID.GreaterManaPotion; + } + else if (NPC.downedBoss3) + { + healingPotID = ItemID.HealingPotion; + manaPotID = ItemID.ManaPotion; + } + DropHelper.DropItemChance(player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); //Money DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs index 92012fdaa8..27ff2c1a98 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneFish.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.height = 30; item.maxStack = 999; item.value = Item.sellPrice(silver: 8); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs b/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs index bffcd8a890..d758811eb5 100644 --- a/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs +++ b/Items/Fishing/BrimstoneCragCatches/ChaoticFish.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.Items.Materials; +using Terraria.ID; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs index 0badaf672c..243c70c394 100644 --- a/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs +++ b/Items/Fishing/BrimstoneCragCatches/CharredLasher.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.height = 36; item.maxStack = 999; item.value = Item.sellPrice(gold: 10); - item.rare = 3; + item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs index e7d86fd428..b73a630489 100644 --- a/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/CoastalDemonfish.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 8); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs index 0e498a8e0e..a1c7a71013 100644 --- a/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs +++ b/Items/Fishing/BrimstoneCragCatches/CragBullhead.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.height = 36; item.maxStack = 999; item.value = Item.sellPrice(silver: 5); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs index f46acb0f1b..55e015aece 100644 --- a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs +++ b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs @@ -29,7 +29,7 @@ Revenge is a dish best served flaming hot"); item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs index 7419ef33d1..5d225b7aac 100644 --- a/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs +++ b/Items/Fishing/BrimstoneCragCatches/Shadowfish.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { @@ -7,7 +8,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { public override void SetStaticDefaults() { - DisplayName.SetDefault("Shadowfish"); //Future potion ingredient + DisplayName.SetDefault("Shadowfish"); Tooltip.SetDefault("Darkness spreads"); } @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 8); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/EnchantedStarfish.cs b/Items/Fishing/EnchantedStarfish.cs index a03b216588..e5ebe9223c 100644 --- a/Items/Fishing/EnchantedStarfish.cs +++ b/Items/Fishing/EnchantedStarfish.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Fishing public override void SetDefaults() { - item.rare = 2; + item.rare = ItemRarityID.Green; item.width = 30; item.height = 26; item.useAnimation = 30; diff --git a/Items/Fishing/FishingRods/ChaoticSpreadRod.cs b/Items/Fishing/FishingRods/ChaoticSpreadRod.cs index 03e7544814..71222fa069 100644 --- a/Items/Fishing/FishingRods/ChaoticSpreadRod.cs +++ b/Items/Fishing/FishingRods/ChaoticSpreadRod.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -29,19 +28,16 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 17f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) { for (int index = 0; index < Main.rand.Next(3,6); ++index) //3 to 5 bobbers { - float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; - int line = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI, 0.0f, 0.0f); - // Protection against projectile cap - if (Main.rand.NextBool() && line < Main.maxProjectiles) // randomizing line color - Main.projectile[line].Calamity().lineColor = 1; + float SpeedX = speedX + Main.rand.NextFloat(-3.75f, 3.75f); + float SpeedY = speedY + Main.rand.NextFloat(-3.75f, 3.75f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); } return false; } diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index a7078b63f2..f608ff5fdc 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 18f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Turquoise; } @@ -36,9 +35,9 @@ namespace CalamityMod.Items.Fishing.FishingRods { for (int index = 0; index < 6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; - int linecolor = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + Main.rand.NextFloat(-3.75f, 3.75f); + float SpeedY = speedY + Main.rand.NextFloat(-3.75f, 3.75f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); } return false; } diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index b9bdacfe92..6bf4d37bc4 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -28,16 +27,16 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 16f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + 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) { for (int index = 0; index < 2; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + Main.rand.NextFloat(-3.75f, 3.75f); + float SpeedY = speedY + Main.rand.NextFloat(-3.75f, 3.75f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); } return false; } diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index ae62ac9f15..d185626e8b 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 14.5f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 7537f507ae..3c8e6c5962 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 13f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void AddRecipes() diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index 006e401ef5..8bf2926cab 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -26,7 +25,7 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 14f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index c10b6d1942..ace98ba9ab 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; } @@ -36,12 +35,9 @@ namespace CalamityMod.Items.Fishing.FishingRods { for (int index = 0; index < 10; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; - int line = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI, 0.0f, 0.0f); - // Protection against projectile cap - if (Main.rand.NextBool() && line < Main.maxProjectiles) // randomizing line color - Main.projectile[line].Calamity().lineColor = 1; + float SpeedX = speedX + Main.rand.NextFloat(-3.75f, 3.75f); + float SpeedY = speedY + Main.rand.NextFloat(-3.75f, 3.75f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, 0, 0f, player.whoAmI); } return false; } @@ -50,7 +46,6 @@ namespace CalamityMod.Items.Fishing.FishingRods { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddRecipeGroup("NForEE", 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 68ecff6c5e..a41a274fca 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; @@ -27,7 +26,7 @@ namespace CalamityMod.Items.Fishing.FishingRods item.shootSpeed = 15f; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void AddRecipes() diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index 1558f8f1ac..b8feceae21 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -15,14 +15,13 @@ namespace CalamityMod.Items.Fishing.FishingRods public override void SetDefaults() { - //item.CloneDefaults(2289); //Wooden Fishing Pole item.width = 24; item.height = 28; item.useAnimation = 8; item.useTime = 8; item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.fishingPole = 10; item.shootSpeed = 10f; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Fishing/FishofEleum.cs b/Items/Fishing/FishofEleum.cs index 5df58dc89b..30f762f0c6 100644 --- a/Items/Fishing/FishofEleum.cs +++ b/Items/Fishing/FishofEleum.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.Items.Materials; +using Terraria.ID; namespace CalamityMod.Items.Fishing { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Fishing item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/Fishing/FishofFlight.cs b/Items/Fishing/FishofFlight.cs index a0a2f31fe6..c646954ae7 100644 --- a/Items/Fishing/FishofFlight.cs +++ b/Items/Fishing/FishofFlight.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Fishing item.consumable = true; item.width = 30; item.height = 30; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.sellPrice(gold: 1); } diff --git a/Items/Fishing/FishofLight.cs b/Items/Fishing/FishofLight.cs index 01cb724372..197fe09605 100644 --- a/Items/Fishing/FishofLight.cs +++ b/Items/Fishing/FishofLight.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Fishing item.consumable = true; item.width = 34; item.height = 34; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.sellPrice(gold: 1); } diff --git a/Items/Fishing/FishofNight.cs b/Items/Fishing/FishofNight.cs index 202efed2fa..1125debafe 100644 --- a/Items/Fishing/FishofNight.cs +++ b/Items/Fishing/FishofNight.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Fishing item.consumable = true; item.width = 34; item.height = 34; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.sellPrice(gold: 1); } diff --git a/Items/Fishing/GlimmeringGemfish.cs b/Items/Fishing/GlimmeringGemfish.cs index eea4e83334..bc5867add3 100644 --- a/Items/Fishing/GlimmeringGemfish.cs +++ b/Items/Fishing/GlimmeringGemfish.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Fishing item.consumable = true; item.width = 34; item.height = 30; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.sellPrice(silver: 50); } @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Fishing DropHelper.DropItemChance(player, ItemID.Ruby, 0.15f, gemMin, gemMax); DropHelper.DropItemChance(player, ItemID.Diamond, 0.1f, gemMin, gemMax); DropHelper.DropItemChance(player, ItemID.Amber, 0.25f, gemMin, gemMax); - Mod thorium = ModLoader.GetMod("ThoriumMod"); + Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) { DropHelper.DropItemChance(player, thorium.ItemType("Pearl"), 0.25f, gemMin, gemMax); diff --git a/Items/Fishing/Spadefish.cs b/Items/Fishing/Spadefish.cs index 08233aa541..5f003cd7a0 100644 --- a/Items/Fishing/Spadefish.cs +++ b/Items/Fishing/Spadefish.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Fishing item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index cdb189cb7f..503018b1ac 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Fishing item.consumable = true; item.width = 34; item.height = 30; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.sellPrice(silver: 50); } @@ -54,20 +54,22 @@ namespace CalamityMod.Items.Fishing DropHelper.DropItemCondition(player, ItemID.CorruptSeeds, !WorldGen.crimson, 0.05f, seedMin, seedMax); DropHelper.DropItemCondition(player, ItemID.CrimsonSeeds, WorldGen.crimson, 0.05f, seedMin, seedMax); DropHelper.DropItemCondition(player, ItemID.HallowedSeeds, Main.hardMode, 0.05f, seedMin, seedMax); - Mod thorium = ModLoader.GetMod("ThoriumMod"); + 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); } - Mod shadowsOfAbaddon = ModLoader.GetMod("SacredTools"); - if (shadowsOfAbaddon != null) + Mod soa = CalamityMod.Instance.soa; + if (soa != null) { - DropHelper.DropItemChance(player, shadowsOfAbaddon.ItemType("Welkinbell"), 0.25f, herbMin, herbMax); - DropHelper.DropItemChance(player, shadowsOfAbaddon.ItemType("WelkinbellSeeds"), 0.1f, seedMin, seedMax); - DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("Illumifern"), Main.hardMode, 0.25f, herbMin, herbMax); - DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("IllumifernSeeds"), Main.hardMode, 0.1f, seedMin, seedMax); - //There's no mod call for Abaddon being dead + 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); + + // 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. //DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("Enduflora"), SacredTools.ModdedWorld.downedAbaddon, 0.25f, herbMin, herbMax); //DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("EndufloraSeeds"), SacredTools.ModdedWorld.downedAbaddon, 0.1f, seedMin, seedMax); } diff --git a/Items/Fishing/SulphurCatches/AbyssalCrate.cs b/Items/Fishing/SulphurCatches/AbyssalCrate.cs index feee04676e..c6745cf562 100644 --- a/Items/Fishing/SulphurCatches/AbyssalCrate.cs +++ b/Items/Fishing/SulphurCatches/AbyssalCrate.cs @@ -2,17 +2,20 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Accessories; using CalamityMod.Items.Pets; using CalamityMod.Items.Potions; +using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Tiles.Abyss; using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CrateTile = CalamityMod.Tiles.Abyss.AbyssalCrateTile; +using CalamityMod.Items.Placeables; + namespace CalamityMod.Items.Fishing.SulphurCatches { public class AbyssalCrate : ModItem @@ -29,9 +32,9 @@ namespace CalamityMod.Items.Fishing.SulphurCatches item.consumable = true; item.width = 32; item.height = 32; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.sellPrice(gold: 1); - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); item.useTurn = true; item.autoReuse = true; item.useAnimation = 15; @@ -44,47 +47,28 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void RightClick(Player player) { //Modded materials - DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); - DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); + DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); + DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); + DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); - DropHelper.DropItemChance(player, ItemID.Starfish, 0.5f, 2, 3); - DropHelper.DropItemChance(player, ItemID.Seashell, 0.5f, 2, 3); - DropHelper.DropItemChance(player, ItemID.Coral, 0.5f, 2, 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 2, 3); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 2, 3); - if (CalamityWorld.downedEoCAcidRain) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - } - if (CalamityWorld.downedAquaticScourgeAcidRain) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - } - if (CalamityWorld.downedCalamitas) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 10); - } - if (NPC.downedGolemBoss) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); - } - if (CalamityWorld.downedPolterghast) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.25f, 5, 10); - } + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedEoCAcidRain, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedAquaticScourgeAcidRain, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), NPC.downedGolemBoss, 0.1f, 1, 3); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedPolterghast && CalamityWorld.downedBoomerDuke, 0.1f, 1, 5); // Weapons - DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedSlimeGod || Main.hardMode, 0.1f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedAquaticScourgeAcidRain, 0.1f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -94,11 +78,12 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType()); // Equipment - DropHelper.DropItemFromSetCondition(player, NPC.downedBoss3, 0.4f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedSlimeGod || Main.hardMode, 0.25f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType()); + ModContent.ItemType(), + ModContent.ItemType()); //Bait DropHelper.DropItemChance(player, ItemID.MasterBait, 10, 1, 2); @@ -115,14 +100,29 @@ namespace CalamityMod.Items.Fishing.SulphurCatches DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion DropHelper.DropItemChance(player, ModContent.ItemType(), 10, 1, 3); - if (Main.hardMode) + int healingPotID = ItemID.LesserHealingPotion; + int manaPotID = ItemID.LesserManaPotion; + if (CalamityWorld.downedDoG) { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.GreaterHealingPotion : ItemID.GreaterManaPotion, 5, 10); + healingPotID = ModContent.ItemType(); + manaPotID = ModContent.ItemType(); } - else + else if (CalamityWorld.downedProvidence) { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.HealingPotion : ItemID.ManaPotion, 5, 10); + healingPotID = ItemID.SuperHealingPotion; + manaPotID = ItemID.SuperManaPotion; } + else if (NPC.downedMechBossAny) + { + healingPotID = ItemID.GreaterHealingPotion; + manaPotID = ItemID.GreaterManaPotion; + } + else if (NPC.downedBoss3) + { + healingPotID = ItemID.HealingPotion; + manaPotID = ItemID.ManaPotion; + } + DropHelper.DropItemChance(player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); //Money DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); diff --git a/Items/Fishing/SunbeamFish.cs b/Items/Fishing/SunbeamFish.cs index 79b8b5dd6a..04064781ac 100644 --- a/Items/Fishing/SunbeamFish.cs +++ b/Items/Fishing/SunbeamFish.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.Items.Materials; +using Terraria.ID; namespace CalamityMod.Items.Fishing { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Fishing item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs b/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs index dc3459d78e..c95196ac98 100644 --- a/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs +++ b/Items/Fishing/SunkenSeaCatches/CoralskinFoolfish.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 7); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs index 966e14f0ba..f2e151f9ba 100644 --- a/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs +++ b/Items/Fishing/SunkenSeaCatches/GreenwaveLoach.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.height = 38; item.maxStack = 999; item.value = Item.sellPrice(gold: 10); - item.rare = 3; + item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs index dbe3a60ff4..04c2f65019 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismaticGuppy.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 5); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs b/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs index e72a8f5682..88ff6c0c70 100644 --- a/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs +++ b/Items/Fishing/SunkenSeaCatches/RustedJingleBell.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); item.value = Item.sellPrice(gold: 5); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void UseStyle(Player player) diff --git a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs b/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs index f741dd1ef0..70ca7d845d 100644 --- a/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs +++ b/Items/Fishing/SunkenSeaCatches/ScarredAngelfish.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 7); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs index f22ab9ecdb..ce3dd58e59 100644 --- a/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs +++ b/Items/Fishing/SunkenSeaCatches/SerpentsBite.cs @@ -11,19 +11,20 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetStaticDefaults() { DisplayName.SetDefault("Serpent's Bite"); - Tooltip.SetDefault(@"Reach: 28.125 -Launch Velocity: 18 -Pull Velocity: 14"); + Tooltip.SetDefault($@"Reach: {SerpentsBiteHook.GrappleRangInTiles} +Launch Velocity: {SerpentsBiteHook.LaunchSpeed} +Reelback Velocity: {SerpentsBiteHook.ReelbackSpeed} +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 = 18f; // how quickly the hook is shot. + item.shootSpeed = SerpentsBiteHook.LaunchSpeed; // how quickly the hook is shot. item.shoot = ProjectileType(); item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.width = 30; item.height = 32; } diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index dcd99fb03c..4e4c1c1e5a 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { public class SparklingEmpress : ModItem { - public static int BaseDamage = 21; + public static int BaseDamage = 10; public override void SetStaticDefaults() { @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.noMelee = true; item.magic = true; item.channel = true; //Channel so that you can hold the weapon [Important] - item.rare = 2; - item.mana = 8; + item.rare = ItemRarityID.Green; + item.mana = 5; item.width = 42; item.height = 34; item.useTime = 20; diff --git a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs index f085d1a405..2f7f2b0008 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenCrate.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.consumable = true; item.width = 32; item.height = 32; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.sellPrice(gold: 1); item.createTile = ModContent.TileType(); item.useTurn = true; @@ -44,18 +45,12 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches //Modded materials DropHelper.DropItem(player, ModContent.ItemType(), 10, 30); DropHelper.DropItem(player, ModContent.ItemType(), 10, 30); - if (CalamityWorld.downedDesertScourge) - { - DropHelper.DropItem(player, ModContent.ItemType(), 10, 20); - DropHelper.DropItem(player, ModContent.ItemType(), 5, 10); - } - if (Main.hardMode) - { - DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f, 5, 15); - } + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 5, 10); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 0.2f, 2, 5); + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.downedCLAMHardMode, 0.12f, 2, 5); // Weapons - DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAMHardMode, 0.2f, + DropHelper.DropItemFromSetCondition(player, CalamityWorld.downedCLAMHardMode, 0.07f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -76,14 +71,29 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches DropHelper.DropItemChance(player, ItemID.MiningPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.HeartreachPotion, 10, 1, 3); DropHelper.DropItemChance(player, ItemID.TrapsightPotion, 10, 1, 3); //Dangersense Potion - if (Main.hardMode) - { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.GreaterHealingPotion: ItemID.GreaterManaPotion, 5, 10); - } - else - { - DropHelper.DropItem(player, Main.rand.Next(100) >= 49 ? ItemID.HealingPotion : ItemID.ManaPotion, 5, 10); - } + int healingPotID = ItemID.LesserHealingPotion; + int manaPotID = ItemID.LesserManaPotion; + if (CalamityWorld.downedDoG) + { + healingPotID = ModContent.ItemType(); + manaPotID = ModContent.ItemType(); + } + else if (CalamityWorld.downedProvidence) + { + healingPotID = ItemID.SuperHealingPotion; + manaPotID = ItemID.SuperManaPotion; + } + else if (NPC.downedMechBossAny) + { + healingPotID = ItemID.GreaterHealingPotion; + manaPotID = ItemID.GreaterManaPotion; + } + else if (NPC.downedBoss3) + { + healingPotID = ItemID.HealingPotion; + manaPotID = ItemID.ManaPotion; + } + DropHelper.DropItemChance(player, Main.rand.NextBool(2) ? healingPotID : manaPotID, 0.25f, 2, 5); //Money DropHelper.DropItem(player, ItemID.SilverCoin, 10, 90); diff --git a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs index c6080e730a..60b6f72f49 100644 --- a/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs +++ b/Items/Fishing/SunkenSeaCatches/SunkenSailfish.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Fishing.SunkenSeaCatches { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches item.height = 52; item.maxStack = 999; item.value = Item.sellPrice(silver: 7); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Fishing/Xerocodile.cs b/Items/Fishing/Xerocodile.cs index 7744739e0b..e010266ee3 100644 --- a/Items/Fishing/Xerocodile.cs +++ b/Items/Fishing/Xerocodile.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.Items.Materials; +using Terraria.ID; namespace CalamityMod.Items.Fishing { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Fishing item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override bool CanRightClick() diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index 58d2e763bf..0a855d1cdf 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Aquatic Scourge"); Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + - "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + - "Favorite this item to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + - "However, without the Well Fed buff your stats will decrease due to your insatiable hunger."); + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -31,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.aquaticScourgeLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeAstralInfection.cs b/Items/LoreItems/KnowledgeAstralInfection.cs index f9658bb9d2..4aa8c66429 100644 --- a/Items/LoreItems/KnowledgeAstralInfection.cs +++ b/Items/LoreItems/KnowledgeAstralInfection.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.consumable = false; } diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index c651b54717..c86af96747 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Astrum Aureus"); Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + - "The destruction of this creature will not prevent the spread of the disease.\n" + - "Favorite this item to gain 10% increased jump speed in space."); + "The destruction of this creature will not prevent the spread of the disease."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.astrumAureusLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index 9a369f5a92..0d7b72810b 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Astrum Deus"); Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + - "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + - "Favorite this item to gain increased movement speed in space."); + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.astrumDeusLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeBloodMoon.cs b/Items/LoreItems/KnowledgeBloodMoon.cs index cca166340f..f17a603c66 100644 --- a/Items/LoreItems/KnowledgeBloodMoon.cs +++ b/Items/LoreItems/KnowledgeBloodMoon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.consumable = false; } diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index e5f11cc641..067d74d229 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -12,18 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Brain of Cthulhu"); Tooltip.SetDefault("An eye and now a brain.\n" + - "Most likely another abomination spawned from this inchoate mass of flesh.\n" + - "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it.\n" + - "Teleportation is disabled while Chaos State is active.\n" + - "However, you become confused for a few seconds after you use it due to your overwhelming brain power.\n" + - "Teleportation only occurs if the item is favorited."); + "Most likely another abomination spawned from this inchoate mass of flesh."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.autoReuse = false; item.useStyle = ItemUseStyleID.SwingThrow; item.useAnimation = 20; @@ -32,47 +28,12 @@ namespace CalamityMod.Items.LoreItems item.consumable = false; } - public override bool CanUseItem(Player player) - { - return player.ZoneCrimson && item.favorited; - } + public override bool CanUseItem(Player player) + { + return false; + } - public override bool UseItem(Player player) - { - if (Main.myPlayer == player.whoAmI && player.itemAnimation > 0 && player.itemTime == 0) - { - if (!player.chaosState) - { - player.itemTime = item.useTime; - Vector2 vector31; - vector31.X = (float)Main.mouseX + Main.screenPosition.X; - if (player.gravDir == 1f) - { - vector31.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; - } - else - { - vector31.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; - } - vector31.X -= (float)(player.width / 2); - if (vector31.X > 50f && vector31.X < (float)(Main.maxTilesX * 16 - 50) && vector31.Y > 50f && vector31.Y < (float)(Main.maxTilesY * 16 - 50)) - { - int num275 = (int)(vector31.X / 16f); - int num276 = (int)(vector31.Y / 16f); - if ((Main.tile[num275, num276].wall != 87 || (double)num276 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector31, player.width, player.height)) - { - player.Teleport(vector31, 1, 0); - NetMessage.SendData(MessageID.Teleport, -1, -1, null, 0, (float)player.whoAmI, vector31.X, vector31.Y, 1, 0, 0); - player.AddBuff(BuffID.ChaosState, 480, true); - player.AddBuff(BuffID.Confused, 150, true); - } - } - } - } - return true; - } - - public override void AddRecipes() + public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); r.SetResult(this); diff --git a/Items/LoreItems/KnowledgeBrimstoneCrag.cs b/Items/LoreItems/KnowledgeBrimstoneCrag.cs index 63cd439712..be6cdbfdae 100644 --- a/Items/LoreItems/KnowledgeBrimstoneCrag.cs +++ b/Items/LoreItems/KnowledgeBrimstoneCrag.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index 1cc9c218e6..c8fdfa47ca 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Brimstone Elemental"); Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + - "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + - "Favorite this item to improve the inferno potion effect."); + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.brimstoneElementalLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeBumblebirb.cs b/Items/LoreItems/KnowledgeBumblebirb.cs index 248f5dcd0d..6102586dc7 100644 --- a/Items/LoreItems/KnowledgeBumblebirb.cs +++ b/Items/LoreItems/KnowledgeBumblebirb.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index 09f6cd25a4..5b141d4394 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -14,15 +14,14 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Calamitas"); Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + "Now that you have defeated her your destiny is clear.\n" + - "Come now, face me.\n" + - "Favorite this item to die instantly from every hit."); + "Come now, face me."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -32,13 +31,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.SCalLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeCalamitasClone.cs b/Items/LoreItems/KnowledgeCalamitasClone.cs index cd8a243315..0bf2a660de 100644 --- a/Items/LoreItems/KnowledgeCalamitasClone.cs +++ b/Items/LoreItems/KnowledgeCalamitasClone.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Calamitas Clone"); Tooltip.SetDefault("You are indeed stronger than I thought.\n" + - "Though the bloody inferno still lingers, observing your progress.\n" + - "Favorite this item to gain a boost to your minion slots but at the cost of reduced max health."); + "Though the bloody inferno still lingers, observing your progress."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.calamitasLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeCorruption.cs b/Items/LoreItems/KnowledgeCorruption.cs index 7841002d85..eb3d1da609 100644 --- a/Items/LoreItems/KnowledgeCorruption.cs +++ b/Items/LoreItems/KnowledgeCorruption.cs @@ -12,15 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Corruption"); Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + - "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians.\n" + - "Favorite this item to prevent hive cysts from spawning."); + "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.consumable = false; } @@ -29,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.corruptionLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 55583c83f1..c13045d032 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Crabulon"); Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + - "It's interesting how creatures can adapt given certain circumstances.\n" + - "Favorite this item to gain the Mushy buff while underground or in the mushroom biome.\n" + - "However, your movement speed will be decreased while in these areas due to you being covered in fungi."); + "It's interesting how creatures can adapt given certain circumstances."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.consumable = false; } @@ -30,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.crabulonLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeCrimson.cs b/Items/LoreItems/KnowledgeCrimson.cs index 08905ab61a..602339c5a3 100644 --- a/Items/LoreItems/KnowledgeCrimson.cs +++ b/Items/LoreItems/KnowledgeCrimson.cs @@ -12,15 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Crimson"); Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + - "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within.\n" + - "Favorite this item to prevent perforator cysts from spawning."); + "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.consumable = false; } @@ -29,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.crimsonLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index e3e40b1f1c..d667e22dcc 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Cryogen"); Tooltip.SetDefault("The archmage's prison.\n" + - "I am unsure if it has grown weaker over the decades of imprisonment.\n" + - "Favorite this item to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body."); + "I am unsure if it has grown weaker over the decades of imprisonment."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.dashMod = 6; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index b97efbacf6..8e286bb374 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Desert Scourge"); Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + - "gluttonous husk, constantly on a voracious search for its next meal.\n" + - "Favorite this item for an increase to defense while in the desert or sunken sea.\n" + - "However, you will deal decreased damage while in these areas due to being a husk of your former self."); + "gluttonous husk, constantly on a voracious search for its next meal."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.consumable = false; } @@ -31,12 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - if (item.favorited) - player.Calamity().desertScourgeLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index cea12b9e5e..3f23c64c72 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Destroyer"); Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + - "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + - "Favorite this item to gain a boost to your pick speed.\n" + - "However, your max acceleration is decreased slightly due to you feeling heavier."); + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -30,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.destroyerLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index f34573d0fd..39c49522f4 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems { 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" + - "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + - "Favorite this item to boost the power of your true melee strikes by 25%.\n" + - "However, due to your reckless nature you will take increased damage."); + "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 = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.PureGreen; } @@ -32,13 +30,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.DoGLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index e82c8dc7a7..7fdfccb2f8 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Duke Fishron"); Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + - "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + - "Favorite this item for an increase to all damage, crit and movement speed while submerged in liquid.\n" + - "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out."); + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.consumable = false; } @@ -30,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.dukeFishronLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 9c69fba845..45b95d4620 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Eater of Worlds"); Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + - "Seems likely, given the origins of this place.\n" + - "Deadly microbes spawn around you while this item is favorited.\n" + - "However, you will have decreased life regen due to your skin rotting off."); + "Seems likely, given the origins of this place."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.consumable = false; } @@ -30,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.eaterOfWorldsLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index 34854f3d4b..a3de3da84b 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -11,16 +11,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Eye of Cthulhu"); Tooltip.SetDefault("That eye...how peculiar.\n" + - "I sensed it watching you more intensely as you grew stronger.\n" + - "Favorite this item for night vision at night.\n" + - "However, your vision is reduced during the day."); + "I sensed it watching you more intensely as you grew stronger."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.consumable = false; } @@ -29,17 +27,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - if (item.favorited) - { - if (!Main.dayTime) - player.nightVision = true; - else - player.blind = true; - } - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index d2a7451b6c..a3f1b41775 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -12,15 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Golem"); Tooltip.SetDefault("A primitive construct.\n" + - "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + - "Favorite this item to gain increased defense while standing still."); + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.consumable = false; } @@ -29,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.golemLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index e2d694dd1c..5d924bf9e3 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Hive Mind"); Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + - "I do not believe killing it will lessen the corruption here.\n" + - "Favorite this item for all of your projectiles to inflict cursed flames when in the corruption.\n" + - "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor."); + "I do not believe killing it will lessen the corruption here."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = false; } @@ -31,15 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - if (player.ZoneCorrupt && item.favorited) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.hiveMindLore = true; - } - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index 7642199665..3d50a1c856 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -12,44 +12,22 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("King Slime"); Tooltip.SetDefault("Only a fool could be caught by this pitiful excuse for a hunter.\n" + - "Unfortunately, our world has no shortage of those.\n" + - "Favorite this item to gain 5% increased movement speed and 2% increased jump speed.\n" + - "However, your defense is reduced by 3 due to your gelatinous body."); + "Unfortunately, our world has no shortage of those."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.consumable = false; } - public override void ModifyTooltips(List list) - { - bool autoJump = Main.player[Main.myPlayer].autoJump; - string hasJumpBoost = "Favorite this item to gain 5% increased movement speed and 2% increased jump speed."; - string noJumpBoost = "Favorite this item to gain 5% increased movement speed."; - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip2") - { - line2.text = autoJump ? noJumpBoost : hasJumpBoost; - } - } - } - public override bool CanUseItem(Player player) { return false; } - public override void UpdateInventory(Player player) - { - if (item.favorited) - player.Calamity().kingSlimeLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index 2e4bc424c7..7a92b516ae 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -13,17 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Leviathan and Anahita"); Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + - "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + - "Favorite this item to gain increased max health while wearing the aquatic heart and treasure detect while wearing the strange orb.\n" + - "Allows the young Ocean Spirit light pet to move normally while outside of liquids.\n" + - "However, if you're not submerged in liquid you will have decreased defense and damage reduction."); + "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.consumable = false; } @@ -32,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.leviathanAndSirenLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index a701aee0f5..7163808564 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Lunatic Cultist"); Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + - "Your impending doom approaches...\n" + - "Favorite this item for an increase to all stats during the lunar event.\n" + - "However, your vision is decreased due to eldritch knowledge damaging your mind."); + "Your impending doom approaches..."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.consumable = false; } @@ -31,15 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - if (NPC.LunarApocalypseIsUp && item.favorited) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.lunaticCultistLore = true; - } - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeMechs.cs b/Items/LoreItems/KnowledgeMechs.cs index 2e81bc04d7..f51348538d 100644 --- a/Items/LoreItems/KnowledgeMechs.cs +++ b/Items/LoreItems/KnowledgeMechs.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index 113e46931d..c21be9d910 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Moon Lord"); Tooltip.SetDefault("What a waste.\n" + "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + - "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + - "Favorite this item to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + - "However, while not upside down you have permanent featherfall."); + "However, that doesn't diminish the immense potential locked within it, released upon its death."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; } @@ -31,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.moonLordLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeOcean.cs b/Items/LoreItems/KnowledgeOcean.cs index 468b8ecf2c..bb9e8357ae 100644 --- a/Items/LoreItems/KnowledgeOcean.cs +++ b/Items/LoreItems/KnowledgeOcean.cs @@ -13,29 +13,18 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Ocean"); Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + - "You may awaken something more terrifying than death itself.\n" + - "Favorite this item to prevent the mysterious water elemental from spawning."); + "You may awaken something more terrifying than death itself."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.consumable = false; } - public override bool CanUseItem(Player player) - { - return false; - } - - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.oceanLore = true; - } + public override bool CanUseItem(Player player) => false; public override void AddRecipes() { diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 0747a4d8d1..367946eac9 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Old Duke"); Tooltip.SetDefault("Strange, to find out that the mutant terror of the seas was not alone in its unique biology.\n" + - "Perhaps I was mistaken to classify the creature from its relation to pigrons alone.\n" + - "Favorite this item to convert negative effects from the Acid Rain debuff to positive effects."); + "Perhaps I was mistaken to classify the creature from its relation to pigrons alone."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 10; - item.Calamity().postMoonLordRarity = 13; + item.Calamity().customRarity = CalamityRarity.PureGreen; item.consumable = false; } @@ -31,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.boomerDukeLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index b3a903fa69..cd7a654f61 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("The Perforators and their Hive"); - Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + - "Favorite this item for all of your projectiles to inflict ichor when in the crimson.\n" + - "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus."); + Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = false; } @@ -30,15 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - if (player.ZoneCrimson && item.favorited) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.perforatorLore = true; - } - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 6e781bb644..6b967a51da 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Plaguebringer Goliath"); Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + - "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + - "Favorite this item to gain increased wing flight time, but at the cost of reduced life regen."); + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.plaguebringerGoliathLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index 4ad06181b9..8df23c8a7f 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Plantera"); Tooltip.SetDefault("Well done, you killed a plant.\n" + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + - "I wish you luck in dealing with the fallout.\n" + - "Favorite this item to gain increased item grab range."); + "I wish you luck in dealing with the fallout."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.planteraLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index 4cb59d9af4..a4288a435c 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Polterghast"); Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + - "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + - "Favorite this item to gain increased item grab range."); + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.PureGreen; } @@ -31,13 +30,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.polterghastLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeProfanedGuardians.cs b/Items/LoreItems/KnowledgeProfanedGuardians.cs index ac15107a97..2e8bdb8fec 100644 --- a/Items/LoreItems/KnowledgeProfanedGuardians.cs +++ b/Items/LoreItems/KnowledgeProfanedGuardians.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 73be8e36d1..0e906030a3 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Providence, the Profaned Goddess"); Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + - "What would have become of us had she not been defeated is a frightening concept to consider.\n" + - "Favorite this item to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + - "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames."); + "What would have become of us had she not been defeated is a frightening concept to consider."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.Turquoise; } @@ -32,13 +30,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.providenceLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index 6981252208..8334c5f3f3 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -11,15 +11,14 @@ namespace CalamityMod.Items.LoreItems public override void SetStaticDefaults() { DisplayName.SetDefault("Queen Bee"); - Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + - "Favorite this item to make small bees and weak hornets friendly."); + Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = false; } @@ -28,13 +27,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.queenBeeLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 736ed52ef6..1c060c9a4a 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Ravager"); Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + - "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + - "Favorite this item to gain an increase to all damage, but at the cost of reduced wing flight time."); + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.ravagerLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeSentinels.cs b/Items/LoreItems/KnowledgeSentinels.cs index 6c36253e5f..ed245cf42d 100644 --- a/Items/LoreItems/KnowledgeSentinels.cs +++ b/Items/LoreItems/KnowledgeSentinels.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.PureGreen; } diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index ece05bc9b5..61b8f65192 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Skeletron"); Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + - "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + - "Favorite this item to gain increased damage while in the dungeon.\n" + - "However, your max health is decreased due to Skeletron's curse."); + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = false; } @@ -30,15 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - if (player.ZoneDungeon && item.favorited) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.skeletronLore = true; - } - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index 9e89adf1f1..b825d2084b 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -12,16 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Skeletron Prime"); Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + - "Draedon obviously took several liberties with its design...I am not impressed.\n" + - "Favorite this item to gain a boost to your armor penetration.\n" + - "However, your max acceleration is decreased due to you feeling heavier."); + "Draedon obviously took several liberties with its design...I am not impressed."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -30,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.skeletronPrimeLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index 0d60631de9..798129f821 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -13,16 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Slime God"); Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + - "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + - "Favorite this item to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + - "This effect makes dashing more difficult and does not work with mounts."); + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.consumable = false; } @@ -31,25 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.mount.Active || !item.favorited || modPlayer.slimeGodLoreProcessed) - return; - - modPlayer.slimeGodLoreProcessed = true; - - if (player.dashDelay < 0 || (player.velocity.Length() >= 11f && CalamityPlayer.areThereAnyDamnBosses)) //If you go over 52.8 mph - player.velocity.X *= 0.9f; - - player.slippy2 = true; - - if (Main.myPlayer == player.whoAmI) - player.AddBuff(BuffID.Slimed, 2); - - player.statDefense -= 10; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeSulphurSea.cs b/Items/LoreItems/KnowledgeSulphurSea.cs index 22aad07afc..656b7742cf 100644 --- a/Items/LoreItems/KnowledgeSulphurSea.cs +++ b/Items/LoreItems/KnowledgeSulphurSea.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; using Terraria; @@ -19,14 +20,11 @@ namespace CalamityMod.Items.LoreItems { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } - public override bool CanUseItem(Player player) - { - return false; - } + public override bool CanUseItem(Player player) => false; public override void AddRecipes() { diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index c4a4cc77bf..6dd0be4836 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -12,17 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Twins"); Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + - "These creatures did not belong in this world, it's best to be rid of them.\n" + - "Favorite this item to gain invisibility and rogue bonuses at night.\n" + - "However, your defense is reduced while above 50% life due to you feeling softer.\n" + - "Your max acceleration is reduced while below 50% life due to you feeling heavier."); + "These creatures did not belong in this world, it's best to be rid of them."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.consumable = false; } @@ -31,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.twinsLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeUnderworld.cs b/Items/LoreItems/KnowledgeUnderworld.cs index e4c3123334..06f48386f9 100644 --- a/Items/LoreItems/KnowledgeUnderworld.cs +++ b/Items/LoreItems/KnowledgeUnderworld.cs @@ -12,15 +12,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("The Underworld"); Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + - "Unfortunately for them, they were twisted by their inner demons until they were beyond saving.\n" + - "Favorite this item to prevent voodoo demons from dropping voodoo dolls."); + "Unfortunately for them, they were twisted by their inner demons until they were beyond saving."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.consumable = false; } @@ -29,13 +28,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.underworldLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index cff5e2c5b6..3b30d6957d 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Wall of Flesh"); Tooltip.SetDefault("I see the deed is done.\n" + "The unholy amalgamation of flesh and hatred has been defeated.\n" + - "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + - "Favorite this item to gain increased item grab range."); + "Prepare to face the terrors that lurk in the light and dark parts of this world."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.consumable = false; } @@ -30,13 +29,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.wallOfFleshLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 586afec642..05d0509695 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -13,15 +13,14 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Jungle Dragon, Yharon"); Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + - "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + - "Favorite this item to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage."); + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.consumable = false; item.Calamity().customRarity = CalamityRarity.DarkBlue; } @@ -31,13 +30,6 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (item.favorited) - modPlayer.yharonLore = true; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/Materials/AerialiteBar.cs b/Items/Materials/AerialiteBar.cs index 8e24453e9c..15cca7ba3d 100644 --- a/Items/Materials/AerialiteBar.cs +++ b/Items/Materials/AerialiteBar.cs @@ -1,4 +1,7 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,11 +17,18 @@ 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 = 3; + item.rare = ItemRarityID.Orange; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; } public override void AddRecipes() diff --git a/Items/Materials/AncientBoneDust.cs b/Items/Materials/AncientBoneDust.cs index f290079594..421b595bd5 100644 --- a/Items/Materials/AncientBoneDust.cs +++ b/Items/Materials/AncientBoneDust.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 1); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/ArmoredShell.cs b/Items/Materials/ArmoredShell.cs index 16f06d7064..2de86fba10 100644 --- a/Items/Materials/ArmoredShell.cs +++ b/Items/Materials/ArmoredShell.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -16,7 +17,8 @@ namespace CalamityMod.Items.Materials item.height = 34; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } } } diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index 96cb62b426..c56c54e6f5 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -1,13 +1,17 @@ -using Terraria; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; using Terraria.DataStructures; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ID; namespace CalamityMod.Items.Materials { public class AscendantSpiritEssence : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Ascendant Spirit Essence"); @@ -15,12 +19,6 @@ namespace CalamityMod.Items.Materials Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); } - 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); - } - public override void SetDefaults() { item.width = 32; @@ -30,13 +28,34 @@ namespace CalamityMod.Items.Materials item.Calamity().customRarity = CalamityRarity.DarkBlue; item.value = Item.sellPrice(gold: 25); } + + 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); + 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); + } + + 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); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Materials/AscendantSpiritEssenceGlow.png b/Items/Materials/AscendantSpiritEssenceGlow.png new file mode 100644 index 0000000000..72302cd70c Binary files /dev/null and b/Items/Materials/AscendantSpiritEssenceGlow.png differ diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index d2b5ab8403..d223c55911 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -1,53 +1,80 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class AuricBar : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Bar"); Tooltip.SetDefault("It radiates godly energy"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 16)); } 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; } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - CalamityUtils.DrawItemGlowmask(item, spriteBatch, 16, rotation, ModContent.GetTexture("CalamityMod/Items/Materials/AuricBarGlow")); - } + public override void UseStyle(Player player) + { + player.itemLocation += new Vector2(-10f * player.direction, 10f * player.gravDir).RotatedBy(player.itemRotation); + } + + 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); + 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); + 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); + } 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.7f * num, 0f); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.5f * brightness, 0.7f * brightness, 0f); } 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(), 2); 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, 2); diff --git a/Items/Materials/AuricBar.png b/Items/Materials/AuricBar.png index dfc1e70809..2d3c447a88 100644 Binary files a/Items/Materials/AuricBar.png and b/Items/Materials/AuricBar.png differ diff --git a/Items/Materials/AuricBarGlow.png b/Items/Materials/AuricBarGlow.png index 43b50fde97..837248c74e 100644 Binary files a/Items/Materials/AuricBarGlow.png and b/Items/Materials/AuricBarGlow.png differ diff --git a/Items/Materials/AuricBar_Animated.png b/Items/Materials/AuricBar_Animated.png new file mode 100644 index 0000000000..38a8c159a1 Binary files /dev/null and b/Items/Materials/AuricBar_Animated.png differ diff --git a/Items/Materials/BarofLife.cs b/Items/Materials/BarofLife.cs index 828fd7e2d5..8b5de850f4 100644 --- a/Items/Materials/BarofLife.cs +++ b/Items/Materials/BarofLife.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(gold: 3); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } public override void AddRecipes() diff --git a/Items/Materials/BeetleJuice.cs b/Items/Materials/BeetleJuice.cs index a111baca3e..460cf41c33 100644 --- a/Items/Materials/BeetleJuice.cs +++ b/Items/Materials/BeetleJuice.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 16); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/BeetleJuice.png b/Items/Materials/BeetleJuice.png index b7e16e4f54..57ca3e1d8a 100644 Binary files a/Items/Materials/BeetleJuice.png and b/Items/Materials/BeetleJuice.png differ diff --git a/Items/Materials/BlightedLens.cs b/Items/Materials/BlightedLens.cs index 1443b4805d..3389fc76f6 100644 --- a/Items/Materials/BlightedLens.cs +++ b/Items/Materials/BlightedLens.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 22; item.maxStack = 999; item.value = Item.sellPrice(silver: 56); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 22c6e82464..2e58842720 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 1, copper: 20); - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs index b94604d9a6..b8e413188f 100644 --- a/Items/Materials/BloodSample.cs +++ b/Items/Materials/BloodSample.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -12,11 +13,11 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 22; + item.width = 26; + item.height = 34; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Materials/BloodSample.png b/Items/Materials/BloodSample.png index 52a28ee266..421a652516 100644 Binary files a/Items/Materials/BloodSample.png and b/Items/Materials/BloodSample.png differ diff --git a/Items/Materials/BloodlettingEssence.cs b/Items/Materials/BloodlettingEssence.cs deleted file mode 100644 index f7baa533cd..0000000000 --- a/Items/Materials/BloodlettingEssence.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class BloodlettingEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bloodletting Essence"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 8)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 1); - item.rare = 1; - } - } -} diff --git a/Items/Materials/BloodlettingEssence.png b/Items/Materials/BloodlettingEssence.png deleted file mode 100644 index 1cfb76aa4e..0000000000 Binary files a/Items/Materials/BloodlettingEssence.png and /dev/null differ diff --git a/Items/Materials/Bloodstone.cs b/Items/Materials/Bloodstone.cs index b0e9c62e69..056620a328 100644 --- a/Items/Materials/Bloodstone.cs +++ b/Items/Materials/Bloodstone.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -16,8 +17,8 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 60); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } } } diff --git a/Items/Materials/BloodstoneCore.cs b/Items/Materials/BloodstoneCore.cs index 227e00b6b4..6ecd83f661 100644 --- a/Items/Materials/BloodstoneCore.cs +++ b/Items/Materials/BloodstoneCore.cs @@ -16,16 +16,16 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; item.value = Item.sellPrice(gold: 4); - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + 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(), 2); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.AdamantiteForge); recipe.SetResult(this, 2); diff --git a/Items/Materials/CalamitousEssence.cs b/Items/Materials/CalamitousEssence.cs index 81fe2b5fc1..80c39e2ecc 100644 --- a/Items/Materials/CalamitousEssence.cs +++ b/Items/Materials/CalamitousEssence.cs @@ -1,4 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -8,24 +12,52 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - DisplayName.SetDefault("Calamitous Essence"); + DisplayName.SetDefault("Ashes of Annihilation"); + Tooltip.SetDefault("It burns with untold power"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(7, 6)); } public override void SetDefaults() { - item.width = 10; - item.height = 14; + item.width = 54; + item.height = 56; item.maxStack = 999; - item.rare = ItemRarityID.Red; + item.rare = ItemRarityID.Purple; item.value = Item.sellPrice(gold: 24); item.Calamity().customRarity = CalamityRarity.Violet; } + public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) + { + float pulse = Main.GlobalTime * 0.68f % 1f; + float outwardness = pulse * baseScale * 8f; + Color drawColor = Color.BlueViolet * (float)Math.Sqrt(1f - pulse) * 0.7f; + drawColor.A = 0; + for (int i = 0; i < 4; i++) + { + 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); + } + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + DrawPulsingAfterimage(spriteBatch, position + frame.Size() * 0.25f, frame, scale); + return true; + } + + 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); + return 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), 0.1f * num, 0.1f * num, 0.1f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.34f * brightness, 0.08f * brightness, 0.155f * brightness); } } } diff --git a/Items/Materials/CalamitousEssence.png b/Items/Materials/CalamitousEssence.png index ea43c8bf7e..23495a4f6e 100644 Binary files a/Items/Materials/CalamitousEssence.png and b/Items/Materials/CalamitousEssence.png differ diff --git a/Items/Materials/CalamityDust.cs b/Items/Materials/CalamityDust.cs index 3d17ae3735..451514ac6a 100644 --- a/Items/Materials/CalamityDust.cs +++ b/Items/Materials/CalamityDust.cs @@ -1,5 +1,7 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; +using Terraria.DataStructures; namespace CalamityMod.Items.Materials { @@ -8,6 +10,7 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Ashes of Calamity"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); } public override void SetDefaults() @@ -16,7 +19,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/CalamityDust.png b/Items/Materials/CalamityDust.png index 5565101405..c932a55dab 100644 Binary files a/Items/Materials/CalamityDust.png and b/Items/Materials/CalamityDust.png differ diff --git a/Items/Materials/CloakingGland.cs b/Items/Materials/CloakingGland.cs deleted file mode 100644 index 35db052a0c..0000000000 --- a/Items/Materials/CloakingGland.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class CloakingGland : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cloaking Gland"); - } - - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.maxStack = 999; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 3; - } - } -} diff --git a/Items/Materials/CloakingGland.png b/Items/Materials/CloakingGland.png deleted file mode 100644 index f1fdb89f2b..0000000000 Binary files a/Items/Materials/CloakingGland.png and /dev/null differ diff --git a/Items/Materials/CoreofCalamity.cs b/Items/Materials/CoreofCalamity.cs index 4f5ed57674..e6066a60a9 100644 --- a/Items/Materials/CoreofCalamity.cs +++ b/Items/Materials/CoreofCalamity.cs @@ -1,3 +1,5 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,13 +15,18 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 40; - item.height = 40; + item.width = 36; + item.height = 36; item.maxStack = 99; item.value = Item.sellPrice(gold: 4); - item.rare = 8; + 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")); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Materials/CoreofCalamityGlow.png b/Items/Materials/CoreofCalamityGlow.png new file mode 100644 index 0000000000..9fa22c3303 Binary files /dev/null and b/Items/Materials/CoreofCalamityGlow.png differ diff --git a/Items/Materials/CoreofChaos.cs b/Items/Materials/CoreofChaos.cs index 4d6b7d5d24..40848f27c2 100644 --- a/Items/Materials/CoreofChaos.cs +++ b/Items/Materials/CoreofChaos.cs @@ -1,3 +1,5 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,18 +15,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 16; + item.width = 36; + item.height = 36; item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 8; + 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")); + } + 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.3f * num, 0.05f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.5f * brightness, 0.3f * brightness, 0.05f * brightness); } public override void AddRecipes() diff --git a/Items/Materials/CoreofChaosGlow.png b/Items/Materials/CoreofChaosGlow.png new file mode 100644 index 0000000000..ef6ae9a4b4 Binary files /dev/null and b/Items/Materials/CoreofChaosGlow.png differ diff --git a/Items/Materials/CoreofCinder.cs b/Items/Materials/CoreofCinder.cs index e8457a9fd1..f07ea70713 100644 --- a/Items/Materials/CoreofCinder.cs +++ b/Items/Materials/CoreofCinder.cs @@ -1,3 +1,5 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,18 +15,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 16; + item.width = 34; + item.height = 34; item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 8; + 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")); + } + 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.3f * num, 0.3f * num, 0.05f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.3f * brightness, 0.3f * brightness, 0.05f * brightness); } public override void AddRecipes() diff --git a/Items/Materials/CoreofCinderGlow.png b/Items/Materials/CoreofCinderGlow.png new file mode 100644 index 0000000000..2aeab60cd2 Binary files /dev/null and b/Items/Materials/CoreofCinderGlow.png differ diff --git a/Items/Materials/CoreofEleum.cs b/Items/Materials/CoreofEleum.cs index a88bb59529..7a817c49e9 100644 --- a/Items/Materials/CoreofEleum.cs +++ b/Items/Materials/CoreofEleum.cs @@ -1,3 +1,5 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,18 +15,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 16; - item.height = 16; + item.width = 34; + item.height = 34; item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 8; + 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")); + } + 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.15f * num, 0.05f * num, 0.5f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); } public override void AddRecipes() diff --git a/Items/Materials/CoreofEleumGlow.png b/Items/Materials/CoreofEleumGlow.png new file mode 100644 index 0000000000..029bcd9505 Binary files /dev/null and b/Items/Materials/CoreofEleumGlow.png differ diff --git a/Items/Materials/CorrodedFossil.cs b/Items/Materials/CorrodedFossil.cs index 6b49e7e0e6..08343ebfe1 100644 --- a/Items/Materials/CorrodedFossil.cs +++ b/Items/Materials/CorrodedFossil.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 28; item.maxStack = 999; item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index e955418d61..f9cc4a27d8 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -1,32 +1,57 @@ +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials { public class CosmiliteBar : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmilite Bar"); Tooltip.SetDefault("A chunk of highly-resistant cosmic steel"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { + item.createTile = ModContent.TileType(); item.width = 30; item.height = 24; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().customRarity = CalamityRarity.PureGreen; + 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; } + 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); + 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); + return false; + } + 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, 0f * num, 0.5f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.5f * brightness, 0f, 0.5f * brightness); } } } diff --git a/Items/Materials/CosmiliteBar.png b/Items/Materials/CosmiliteBar.png index e010cb878a..8094a536be 100644 Binary files a/Items/Materials/CosmiliteBar.png and b/Items/Materials/CosmiliteBar.png differ diff --git a/Items/Materials/CosmiliteBar_Animated.png b/Items/Materials/CosmiliteBar_Animated.png new file mode 100644 index 0000000000..e010cb878a Binary files /dev/null and b/Items/Materials/CosmiliteBar_Animated.png differ diff --git a/Items/Materials/CruptixBar.cs b/Items/Materials/CruptixBar.cs index a9d7be51db..1affd84a15 100644 --- a/Items/Materials/CruptixBar.cs +++ b/Items/Materials/CruptixBar.cs @@ -3,7 +3,6 @@ using CalamityMod.Tiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +10,8 @@ namespace CalamityMod.Items.Materials { public class CruptixBar : ModItem { - private int frameCounter = 0; - private int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Scoria Bar"); @@ -32,32 +31,20 @@ namespace CalamityMod.Items.Materials item.height = 52; item.maxStack = 999; item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } - internal Rectangle GetCurrentFrame() - { - int frameAmt = 6; - if (frameCounter >= 6) - { - frameCounter = -1; - frame = frame == frameAmt - 1 ? 0 : frame + 1; - } - frameCounter++; - return new Rectangle(0, item.height * frame, item.width, item.height); - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + 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, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + 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, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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; } diff --git a/Items/Materials/CryoBar.cs b/Items/Materials/CryoBar.cs deleted file mode 100644 index 9a10253222..0000000000 --- a/Items/Materials/CryoBar.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class CryoBar : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frigid Bar"); - Tooltip.SetDefault("Cold to the touch"); - } - - public override void SetDefaults() - { - item.width = 30; - item.height = 24; - item.maxStack = 999; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; - } - } -} diff --git a/Items/Materials/CryoBar.png b/Items/Materials/CryoBar.png deleted file mode 100644 index a26ccbab74..0000000000 Binary files a/Items/Materials/CryoBar.png and /dev/null differ diff --git a/Items/Materials/DarkPlasma.cs b/Items/Materials/DarkPlasma.cs index 3290acf117..f1363323b2 100644 --- a/Items/Materials/DarkPlasma.cs +++ b/Items/Materials/DarkPlasma.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -18,8 +19,9 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index dae75292f2..4f3ebb9e58 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -1,4 +1,7 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -6,6 +9,8 @@ namespace CalamityMod.Items.Materials { public class DarksunFragment : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Darksun Fragment"); @@ -15,19 +20,31 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 20; - item.height = 19; + item.width = 28; + item.height = 32; item.maxStack = 999; - item.rare = 10; + item.rare = ItemRarityID.Purple; item.value = Item.sellPrice(gold: 12); - item.Calamity().customRarity = CalamityRarity.Violet; + 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); + 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); + } + 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.5f * num, 0.5f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.5f * brightness, 0.5f * brightness, 0.5f * brightness); } } } diff --git a/Items/Materials/DarksunFragmentGlow.png b/Items/Materials/DarksunFragmentGlow.png new file mode 100644 index 0000000000..9794ca8476 Binary files /dev/null and b/Items/Materials/DarksunFragmentGlow.png differ diff --git a/Items/Materials/DemonicBoneAsh.cs b/Items/Materials/DemonicBoneAsh.cs index c7b19fd16c..acbf20e35c 100644 --- a/Items/Materials/DemonicBoneAsh.cs +++ b/Items/Materials/DemonicBoneAsh.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 3; + item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Materials/DepthCells.cs b/Items/Materials/DepthCells.cs index e32d21e80a..887a932a4f 100644 --- a/Items/Materials/DepthCells.cs +++ b/Items/Materials/DepthCells.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Materials/DesertFeather.cs b/Items/Materials/DesertFeather.cs index 6033673acf..12746ef145 100644 --- a/Items/Materials/DesertFeather.cs +++ b/Items/Materials/DesertFeather.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(copper: 20); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/DesertFeather.png b/Items/Materials/DesertFeather.png index e2495cde51..df02cc3ea1 100644 Binary files a/Items/Materials/DesertFeather.png and b/Items/Materials/DesertFeather.png differ diff --git a/Items/Materials/DivineGeode.cs b/Items/Materials/DivineGeode.cs index 872606f369..8f691926c3 100644 --- a/Items/Materials/DivineGeode.cs +++ b/Items/Materials/DivineGeode.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; + item.rare = ItemRarityID.Purple; item.value = Item.buyPrice(0, 6, 50, 0); item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/Materials/DivineGeode.png b/Items/Materials/DivineGeode.png index b8d8fa8f07..368775bce8 100644 Binary files a/Items/Materials/DivineGeode.png and b/Items/Materials/DivineGeode.png differ diff --git a/Items/Materials/DraedonBar.cs b/Items/Materials/DraedonBar.cs index b77c2df485..065a989158 100644 --- a/Items/Materials/DraedonBar.cs +++ b/Items/Materials/DraedonBar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(gold: 1); - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void AddRecipes() diff --git a/Items/Materials/EbonianGel.cs b/Items/Materials/EbonianGel.cs index 758d825253..6e7acb8983 100644 --- a/Items/Materials/EbonianGel.cs +++ b/Items/Materials/EbonianGel.cs @@ -1,5 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -13,10 +16,30 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { item.width = 16; - item.height = 14; + item.height = 18; item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 1; + 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) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Materials/EbonianGelRed"); + spriteBatch.Draw(texture, position, frame, Color.White, 0f, origin, scale, SpriteEffects.None, 0); + } + return !item.notAmmo; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + 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); + } + return !item.notAmmo; + } } } diff --git a/Items/Materials/EbonianGelRed.png b/Items/Materials/EbonianGelRed.png new file mode 100644 index 0000000000..77ce83cbe3 Binary files /dev/null and b/Items/Materials/EbonianGelRed.png differ diff --git a/Items/Materials/Ectoblood.cs b/Items/Materials/Ectoblood.cs index f0933316ba..16179739b2 100644 --- a/Items/Materials/Ectoblood.cs +++ b/Items/Materials/Ectoblood.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 32; item.maxStack = 999; item.value = Item.sellPrice(silver: 16); - item.rare = 7; + item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/EffulgentFeather.cs b/Items/Materials/EffulgentFeather.cs index d8c23f3386..acd0765fa9 100644 --- a/Items/Materials/EffulgentFeather.cs +++ b/Items/Materials/EffulgentFeather.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -19,8 +20,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.buyPrice(0, 6, 50, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.rare = ItemRarityID.Purple; + } } } diff --git a/Items/Materials/EnchantedMetal.cs b/Items/Materials/EnchantedMetal.cs deleted file mode 100644 index 6bc9efede1..0000000000 --- a/Items/Materials/EnchantedMetal.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class EnchantedMetal : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Enchanted Metal"); - } - public override void SetDefaults() - { - item.width = 26; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 5; - item.maxStack = 99; - } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalEye); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalSkull); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalWorm); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Materials/EnchantedMetal.png b/Items/Materials/EnchantedMetal.png deleted file mode 100644 index bd175ca8e9..0000000000 Binary files a/Items/Materials/EnchantedMetal.png and /dev/null differ diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 79448e3055..3c3124302e 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -1,11 +1,16 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.ID; namespace CalamityMod.Items.Materials { public class EndothermicEnergy : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Endothermic Energy"); @@ -13,20 +18,33 @@ namespace CalamityMod.Items.Materials 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; + } + + 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); + 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); + } + 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); } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.rare = 10; - item.value = Item.sellPrice(gold: 2); - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } } } diff --git a/Items/Materials/EndothermicEnergyGlow.png b/Items/Materials/EndothermicEnergyGlow.png new file mode 100644 index 0000000000..f4208203cd Binary files /dev/null and b/Items/Materials/EndothermicEnergyGlow.png differ diff --git a/Items/Materials/EnergyCore.cs b/Items/Materials/EnergyCore.cs index 8a2a3343fa..bff9160689 100644 --- a/Items/Materials/EnergyCore.cs +++ b/Items/Materials/EnergyCore.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.width = item.height = 22; item.maxStack = 999; item.value = Item.sellPrice(copper: 80); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/EssenceofChaos.cs b/Items/Materials/EssenceofChaos.cs index 2678e468b5..14ac2a0687 100644 --- a/Items/Materials/EssenceofChaos.cs +++ b/Items/Materials/EssenceofChaos.cs @@ -1,5 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -13,18 +16,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 8; - item.height = 10; + item.width = 34; + item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 5; + item.rare = ItemRarityID.Pink; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + } + 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.3f * num, 0.05f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + 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 f878f49954..b129797cac 100644 --- a/Items/Materials/EssenceofCinder.cs +++ b/Items/Materials/EssenceofCinder.cs @@ -1,5 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -13,18 +16,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 8; - item.height = 22; + item.width = 30; + item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 5; + item.rare = ItemRarityID.Pink; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + } + 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.3f * num, 0.3f * num, 0.05f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + 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 c4f0618a79..fa6c26c8b6 100644 --- a/Items/Materials/EssenceofEleum.cs +++ b/Items/Materials/EssenceofEleum.cs @@ -1,5 +1,8 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -13,18 +16,22 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { - item.width = 8; - item.height = 20; + item.width = 34; + item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 40); - item.rare = 5; + item.rare = ItemRarityID.Pink; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); + } + 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.15f * num, 0.05f * num, 0.5f * num); + float brightness = Main.essScale * Main.rand.NextFloat(0.9f, 1.1f); + Lighting.AddLight(item.Center, 0.15f * brightness, 0.05f * brightness, 0.5f * brightness); } } } diff --git a/Items/Materials/FetidEssence.cs b/Items/Materials/FetidEssence.cs deleted file mode 100644 index 29e9eecf55..0000000000 --- a/Items/Materials/FetidEssence.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class FetidEssence : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fetid Essence"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 1); - item.rare = 1; - } - } -} diff --git a/Items/Materials/FetidEssence.png b/Items/Materials/FetidEssence.png deleted file mode 100644 index ab71c66d60..0000000000 Binary files a/Items/Materials/FetidEssence.png and /dev/null differ diff --git a/Items/Materials/GalacticaSingularity.cs b/Items/Materials/GalacticaSingularity.cs index 705513e4c4..262f5e358d 100644 --- a/Items/Materials/GalacticaSingularity.cs +++ b/Items/Materials/GalacticaSingularity.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Galactica Singularity"); Tooltip.SetDefault("A shard of the cosmos"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(3, 24)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(4, 24)); } public override void SetDefaults() @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Materials item.height = 28; item.maxStack = 999; item.value = Item.sellPrice(silver: 96); - item.rare = 10; + item.rare = ItemRarityID.Red; } public override void AddRecipes() diff --git a/Items/Materials/GrandScale.cs b/Items/Materials/GrandScale.cs index 99407eee49..dcac0f2a15 100644 --- a/Items/Materials/GrandScale.cs +++ b/Items/Materials/GrandScale.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.buyPrice(0, 4, 50, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/GypsyPowder.cs b/Items/Materials/GypsyPowder.cs deleted file mode 100644 index fbaa547206..0000000000 --- a/Items/Materials/GypsyPowder.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class GypsyPowder : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gypsy Powder"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 30); - item.rare = 5; - } - } -} diff --git a/Items/Materials/GypsyPowder.png b/Items/Materials/GypsyPowder.png deleted file mode 100644 index e9d0951c3c..0000000000 Binary files a/Items/Materials/GypsyPowder.png and /dev/null differ diff --git a/Items/Materials/HadarianMembrane.cs b/Items/Materials/HadarianMembrane.cs index afaa6c671a..c2d6f3f495 100644 --- a/Items/Materials/HadarianMembrane.cs +++ b/Items/Materials/HadarianMembrane.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 22; item.maxStack = 999; item.value = Item.sellPrice(silver: 50); - item.rare = 7; + item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/InfectedArmorPlating.cs b/Items/Materials/InfectedArmorPlating.cs index b9a00f7674..415b8fa2b9 100644 --- a/Items/Materials/InfectedArmorPlating.cs +++ b/Items/Materials/InfectedArmorPlating.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Materials/LivingShard.cs b/Items/Materials/LivingShard.cs index b4a27a5290..39bb070d74 100644 --- a/Items/Materials/LivingShard.cs +++ b/Items/Materials/LivingShard.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 14; item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 7; + item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Materials/Lumenite.cs b/Items/Materials/Lumenite.cs index 6ae7ab931f..d2337a5306 100644 --- a/Items/Materials/Lumenite.cs +++ b/Items/Materials/Lumenite.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Materials/ManeaterBulb.cs b/Items/Materials/ManeaterBulb.cs deleted file mode 100644 index b00136df6a..0000000000 --- a/Items/Materials/ManeaterBulb.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class ManeaterBulb : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Maneater Bulb"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.value = Item.sellPrice(silver: 2); - item.rare = 1; - } - } -} diff --git a/Items/Materials/ManeaterBulb.png b/Items/Materials/ManeaterBulb.png deleted file mode 100644 index a99ea2e507..0000000000 Binary files a/Items/Materials/ManeaterBulb.png and /dev/null differ diff --git a/Items/Materials/MeldBlob.cs b/Items/Materials/MeldBlob.cs index 547cf9992e..0a65e0e636 100644 --- a/Items/Materials/MeldBlob.cs +++ b/Items/Materials/MeldBlob.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 14; item.maxStack = 999; item.value = Item.sellPrice(silver: 20); - item.rare = 9; + item.rare = ItemRarityID.Cyan; } } } diff --git a/Items/Materials/MeldiateBar.cs b/Items/Materials/MeldiateBar.cs index e9d66056da..8f20d01c4c 100644 --- a/Items/Materials/MeldiateBar.cs +++ b/Items/Materials/MeldiateBar.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.sellPrice(gold: 1, silver: 20); - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override void AddRecipes() diff --git a/Items/Materials/MolluskHusk.cs b/Items/Materials/MolluskHusk.cs index d4a9a46b00..0223347bb8 100644 --- a/Items/Materials/MolluskHusk.cs +++ b/Items/Materials/MolluskHusk.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 28; item.maxStack = 999; item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/MurkyPaste.cs b/Items/Materials/MurkyPaste.cs index 7fff83c8a9..5d70cca14b 100644 --- a/Items/Materials/MurkyPaste.cs +++ b/Items/Materials/MurkyPaste.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 2); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/MurkySludge.cs b/Items/Materials/MurkySludge.cs index 7e12344641..7eb724e71c 100644 --- a/Items/Materials/MurkySludge.cs +++ b/Items/Materials/MurkySludge.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 1); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 489f05df82..a5d4424624 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -1,11 +1,16 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.ID; namespace CalamityMod.Items.Materials { public class NightmareFuel : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Nightmare Fuel"); @@ -13,20 +18,33 @@ namespace CalamityMod.Items.Materials 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; + } + + 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); + 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); + } + 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); } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 999; - item.rare = 10; - item.value = Item.sellPrice(gold: 2); - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } } } diff --git a/Items/Materials/NightmareFuelGlow.png b/Items/Materials/NightmareFuelGlow.png new file mode 100644 index 0000000000..06e2d2db10 Binary files /dev/null and b/Items/Materials/NightmareFuelGlow.png differ diff --git a/Items/Materials/Phantoplasm.cs b/Items/Materials/Phantoplasm.cs index 9acab4a131..823014cd4f 100644 --- a/Items/Materials/Phantoplasm.cs +++ b/Items/Materials/Phantoplasm.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -18,14 +19,10 @@ namespace CalamityMod.Items.Materials item.width = 12; item.height = 12; item.maxStack = 999; - item.rare = 10; item.value = Item.sellPrice(gold: 1); - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 0); - } + 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 39bbc8188b..12cc309e10 100644 --- a/Items/Materials/PlagueCellCluster.cs +++ b/Items/Materials/PlagueCellCluster.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Materials/PurifiedGel.cs b/Items/Materials/PurifiedGel.cs index 7b7879b9f2..5af8fa8234 100644 --- a/Items/Materials/PurifiedGel.cs +++ b/Items/Materials/PurifiedGel.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 14; item.maxStack = 999; item.value = Item.buyPrice(0, 2, 50, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; } } } diff --git a/Items/Materials/ReaperTooth.cs b/Items/Materials/ReaperTooth.cs index 44eae426a9..62e367c9ee 100644 --- a/Items/Materials/ReaperTooth.cs +++ b/Items/Materials/ReaperTooth.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 26; item.maxStack = 999; item.value = Item.buyPrice(0, 7, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; } } diff --git a/Items/Materials/RuinousSoul.cs b/Items/Materials/RuinousSoul.cs index 2f7606bafe..e5c7030d4a 100644 --- a/Items/Materials/RuinousSoul.cs +++ b/Items/Materials/RuinousSoul.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.DataStructures; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -9,12 +10,13 @@ namespace CalamityMod.Items.Materials { DisplayName.SetDefault("Ruinous Soul"); Tooltip.SetDefault("A shard of the distant past"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); } public override void SetDefaults() { - item.width = 20; - item.height = 20; + 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/RuinousSoul.png b/Items/Materials/RuinousSoul.png index 04dec2f3de..2f4f6d2463 100644 Binary files a/Items/Materials/RuinousSoul.png and b/Items/Materials/RuinousSoul.png differ diff --git a/Items/Materials/ShadowspecBar.cs b/Items/Materials/ShadowspecBar.cs index 7e4217e175..93ab549fcb 100644 --- a/Items/Materials/ShadowspecBar.cs +++ b/Items/Materials/ShadowspecBar.cs @@ -1,6 +1,8 @@ +using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -8,20 +10,43 @@ namespace CalamityMod.Items.Materials { public class ShadowspecBar : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowspec Bar"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(8, 8)); } public override void SetDefaults() { - item.width = 15; - item.height = 12; + item.createTile = ModContent.TileType(); + item.width = 38; + item.height = 40; item.maxStack = 999; - item.rare = ItemRarityID.Red; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.autoReuse = true; + item.consumable = true; + item.value = Item.sellPrice(gold: 85); - item.Calamity().customRarity = CalamityRarity.Violet; + 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); + 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); + return false; } public override void AddRecipes() diff --git a/Items/Materials/ShadowspecBar.png b/Items/Materials/ShadowspecBar.png index 3edf7a49f9..e72285c779 100644 Binary files a/Items/Materials/ShadowspecBar.png and b/Items/Materials/ShadowspecBar.png differ diff --git a/Items/Materials/ShadowspecBar_Animated.png b/Items/Materials/ShadowspecBar_Animated.png new file mode 100644 index 0000000000..3edf7a49f9 Binary files /dev/null and b/Items/Materials/ShadowspecBar_Animated.png differ diff --git a/Items/Materials/SolarVeil.cs b/Items/Materials/SolarVeil.cs index 73c0f18375..469e845716 100644 --- a/Items/Materials/SolarVeil.cs +++ b/Items/Materials/SolarVeil.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Materials/Stardust.cs b/Items/Materials/Stardust.cs index e46065e5e3..27b72a2886 100644 --- a/Items/Materials/Stardust.cs +++ b/Items/Materials/Stardust.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 18; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/StormlionMandible.cs b/Items/Materials/StormlionMandible.cs index 8cad617f47..45f3b367fd 100644 --- a/Items/Materials/StormlionMandible.cs +++ b/Items/Materials/StormlionMandible.cs @@ -1,5 +1,7 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; +using Terraria.DataStructures; namespace CalamityMod.Items.Materials { @@ -8,15 +10,16 @@ namespace CalamityMod.Items.Materials public override void SetStaticDefaults() { DisplayName.SetDefault("Stormlion Mandible"); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 8)); } public override void SetDefaults() { - item.width = 12; - item.height = 24; + item.width = 36; + item.height = 38; item.maxStack = 999; item.value = Item.sellPrice(silver: 1, copper: 40); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/StormlionMandible.png b/Items/Materials/StormlionMandible.png index 5d6d9bdb3d..4a248d6291 100644 Binary files a/Items/Materials/StormlionMandible.png and b/Items/Materials/StormlionMandible.png differ diff --git a/Items/Materials/SulfuricScale.cs b/Items/Materials/SulfuricScale.cs index 230dc60d55..9a0d2eaf5a 100644 --- a/Items/Materials/SulfuricScale.cs +++ b/Items/Materials/SulfuricScale.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs index 80eafd1844..122ab082cc 100644 --- a/Items/Materials/TitanHeart.cs +++ b/Items/Materials/TitanHeart.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(gold: 1); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/TrapperBulb.cs b/Items/Materials/TrapperBulb.cs index 584b24e164..df36b833b7 100644 --- a/Items/Materials/TrapperBulb.cs +++ b/Items/Materials/TrapperBulb.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 16); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Materials/TrueShadowScale.cs b/Items/Materials/TrueShadowScale.cs index 4d4deac5eb..4ffcce8d04 100644 --- a/Items/Materials/TrueShadowScale.cs +++ b/Items/Materials/TrueShadowScale.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 22; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Materials/TwistingNether.cs b/Items/Materials/TwistingNether.cs index bde14c1f38..41111e0007 100644 --- a/Items/Materials/TwistingNether.cs +++ b/Items/Materials/TwistingNether.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Materials @@ -15,10 +16,10 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } public override void Update(ref float gravity, ref float maxFallSpeed) { diff --git a/Items/Materials/UeliaceBar.cs b/Items/Materials/UeliaceBar.cs index 81d8871dd6..df46873398 100644 --- a/Items/Materials/UeliaceBar.cs +++ b/Items/Materials/UeliaceBar.cs @@ -1,4 +1,7 @@ using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,12 +17,19 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { + item.createTile = ModContent.TileType(); item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; + 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; } public override void AddRecipes() diff --git a/Items/Materials/UnholyCore.cs b/Items/Materials/UnholyCore.cs index 2da4e4d103..7f0528de2a 100644 --- a/Items/Materials/UnholyCore.cs +++ b/Items/Materials/UnholyCore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Materials item.height = 12; item.maxStack = 999; item.value = Item.sellPrice(silver: 80); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } public override void AddRecipes() diff --git a/Items/Materials/UnholyEssence.cs b/Items/Materials/UnholyEssence.cs index 021cb43364..0a5784f6a5 100644 --- a/Items/Materials/UnholyEssence.cs +++ b/Items/Materials/UnholyEssence.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.DataStructures; using Terraria.ModLoader; @@ -18,9 +19,8 @@ namespace CalamityMod.Items.Materials item.width = 15; item.height = 12; item.maxStack = 999; - item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.rare = ItemRarityID.Purple; + item.value = Item.buyPrice(0, 6, 50, 0); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/VerstaltiteBar.cs b/Items/Materials/VerstaltiteBar.cs index a9d30a0443..48db8ca087 100644 --- a/Items/Materials/VerstaltiteBar.cs +++ b/Items/Materials/VerstaltiteBar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(silver: 60); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void AddRecipes() diff --git a/Items/Materials/VictideBar.cs b/Items/Materials/VictideBar.cs index c14e5ff250..6881cf5a47 100644 --- a/Items/Materials/VictideBar.cs +++ b/Items/Materials/VictideBar.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 24; item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void AddRecipes() diff --git a/Items/Materials/VictoryShard.cs b/Items/Materials/VictoryShard.cs index b75ea9b02f..5fa72bab52 100644 --- a/Items/Materials/VictoryShard.cs +++ b/Items/Materials/VictoryShard.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 14; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Materials/WulfrumShard.cs b/Items/Materials/WulfrumShard.cs index bcdec89051..99fc03dca7 100644 --- a/Items/Materials/WulfrumShard.cs +++ b/Items/Materials/WulfrumShard.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.Materials { @@ -16,7 +17,7 @@ namespace CalamityMod.Items.Materials item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(copper: 80); - item.rare = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 5669c11af0..4c1d175d7c 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.Mounts; using CalamityMod.CalPlayer; +using CalamityMod.NPCs.TownNPCs; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,31 +15,28 @@ namespace CalamityMod.Items.Mounts mountData.spawnDust = 234; mountData.spawnDustNoGravity = true; mountData.buff = ModContent.BuffType(); - mountData.heightBoost = 34; - mountData.fallDamage = 0f; //0.5 - mountData.runSpeed = 7f; //12 - mountData.dashSpeed = 21f; //8 + mountData.heightBoost = 35; + mountData.fallDamage = 0f; + mountData.runSpeed = 5.6f; + mountData.dashSpeed = 16.8f; mountData.flightTimeMax = 500; mountData.fatigueMax = 0; mountData.jumpHeight = 12; - mountData.acceleration = 0.45f; - mountData.jumpSpeed = 8f; //10 + mountData.acceleration = 0.4f; + mountData.jumpSpeed = 8.01f; mountData.swimSpeed = 4f; mountData.blockExtraJumps = false; mountData.totalFrames = 15; mountData.constantJump = false; + int baseYOffset = 24; int[] array = new int[mountData.totalFrames]; for (int l = 0; l < array.Length; l++) { - array[l] = 30; + array[l] = baseYOffset; } - array[1] = 28; - array[3] = 28; - array[5] = 28; - array[7] = 28; - array[12] = 28; + array[1] = array[3] = array[5] = array[7] = array[12] = baseYOffset - 2; mountData.playerYOffsets = array; - mountData.xOffset = 0; + mountData.xOffset = -4; mountData.bodyFrame = 3; mountData.yOffset = 7; //-8 mountData.playerHeadOffset = 36; //30 @@ -47,7 +44,7 @@ namespace CalamityMod.Items.Mounts mountData.standingFrameDelay = 12; mountData.standingFrameStart = 0; mountData.runningFrameCount = 8; //7 - mountData.runningFrameDelay = 36; //36 + mountData.runningFrameDelay = 42; //36 mountData.runningFrameStart = 1; //9 mountData.flyingFrameCount = 6; //0 mountData.flyingFrameDelay = 4; //0 @@ -55,9 +52,9 @@ namespace CalamityMod.Items.Mounts mountData.inAirFrameCount = 1; //1 mountData.inAirFrameDelay = 12; //12 mountData.inAirFrameStart = 10; //10 - mountData.idleFrameCount = 5; //4 + mountData.idleFrameCount = 1; //4 mountData.idleFrameDelay = 12; //12 - mountData.idleFrameStart = 0; + mountData.idleFrameStart = 5; mountData.idleFrameLoop = true; mountData.swimFrameCount = mountData.inAirFrameCount; mountData.swimFrameDelay = mountData.inAirFrameDelay; @@ -70,16 +67,37 @@ namespace CalamityMod.Items.Mounts } } - public override void UpdateEffects(Player player) + public override void SetMount(Player player, ref bool skipDust) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type == ModContent.NPCType()) + { + Main.npc[i].active = false; + Main.npc[i].netUpdate = true; + break; + } + } + } + + public override void Dismount(Player player, ref bool skipDust) + { + if (!NPC.AnyNPCs(ModContent.NPCType())) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); + } + } + + public override void UpdateEffects(Player player) { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.fabsolVodka) + player.allDamage += 0.1f; + + if (player.velocity.Length() > 9f) { - player.allDamage += 0.1f; - } - if (Math.Abs(player.velocity.X) > 12f || Math.Abs(player.velocity.Y) > 12f) - { - int rand = Main.rand.Next(2); + int rand = Main.rand.Next(2); bool momo = false; if (rand == 1) { @@ -98,6 +116,7 @@ namespace CalamityMod.Items.Mounts int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); Main.dust[dust].noGravity = true; } + if (player.velocity.Y != 0f) { if (player.mount.PlayerOffset == 28) diff --git a/Items/Mounts/AlicornMountExtra.png b/Items/Mounts/AlicornMountExtra.png index 9e18cea9aa..49bad1ec68 100644 Binary files a/Items/Mounts/AlicornMountExtra.png and b/Items/Mounts/AlicornMountExtra.png differ diff --git a/Items/Mounts/AlicornMount_Back.png b/Items/Mounts/AlicornMount_Back.png index 3d2a6e7302..ea6c2f5de6 100644 Binary files a/Items/Mounts/AlicornMount_Back.png and b/Items/Mounts/AlicornMount_Back.png differ diff --git a/Items/Mounts/AlicornMount_Front.png b/Items/Mounts/AlicornMount_Front.png index 045054997d..1c35307537 100644 Binary files a/Items/Mounts/AlicornMount_Front.png and b/Items/Mounts/AlicornMount_Front.png differ diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 78285bdfda..8e61ba969f 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -1,29 +1,37 @@ using CalamityMod.Buffs.Mounts; using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { - public class BUMBLEDOGE : ModMountData + public class BUMBLEDOGE : ModMountData { public override void SetDefaults() { mountData.spawnDust = 60; mountData.spawnDustNoGravity = true; mountData.buff = ModContent.BuffType(); - mountData.flightTimeMax = 600; + + // previous stats commented for balance. + // for run and dash speed, each 1 unit is 5.08mph in-game. + mountData.runSpeed = 10f; // 12f + mountData.dashSpeed = 14.15f; // 18.5f + mountData.acceleration = 0.13f; // 0.2f + mountData.fatigueMax = 0; + mountData.flightTimeMax = 600; mountData.fallDamage = 0f; - mountData.runSpeed = 12f; - mountData.heightBoost = 44; - mountData.acceleration = 0.2f; + mountData.jumpHeight = 10; mountData.jumpSpeed = 4f; mountData.blockExtraJumps = false; - mountData.totalFrames = 12; mountData.constantJump = false; + + mountData.totalFrames = 12; + mountData.heightBoost = 44; int[] array = new int[mountData.totalFrames]; for (int i = 0; i < array.Length; i++) { @@ -53,8 +61,6 @@ namespace CalamityMod.Items.Mounts mountData.swimFrameCount = mountData.inAirFrameCount; mountData.swimFrameDelay = mountData.inAirFrameDelay; mountData.swimFrameStart = mountData.inAirFrameStart; - - mountData.dashSpeed = 18.5f; mountData.dashingFrameCount = mountData.flyingFrameCount; mountData.dashingFrameDelay = 5; mountData.dashingFrameStart = mountData.flyingFrameStart; @@ -66,14 +72,15 @@ namespace CalamityMod.Items.Mounts } public override void UpdateEffects(Player player) { - if (Main.rand.NextBool(260) && Main.myPlayer == player.whoAmI) + if (Main.myPlayer == player.whoAmI && Main.rand.NextBool(260)) { - Projectile.NewProjectileDirect(player.Center + Main.rand.NextVector2Circular(45f, 45f), - Main.rand.NextVector2Circular(15f, 15f), - ModContent.ProjectileType(), - (int)(180 * player.AverageDamage()), - 1f, - player.whoAmI).Calamity().forceTypeless = true; + Vector2 pos = player.Center + Main.rand.NextVector2Circular(45f, 45f); + Vector2 vel = Main.rand.NextVector2Circular(15f, 15f); + int damage = (int)(180 * player.AverageDamage()); + float kb = 1f; + Projectile birb = Projectile.NewProjectileDirect(pos, vel, ModContent.ProjectileType(), damage, kb, player.whoAmI); + if (birb.whoAmI.WithinBounds(Main.maxProjectiles)) + birb.Calamity().forceTypeless = true; } } } diff --git a/Items/Mounts/BirdSeed.cs b/Items/Mounts/BirdSeed.cs index 190403f60f..a5fadc3cab 100644 --- a/Items/Mounts/BirdSeed.cs +++ b/Items/Mounts/BirdSeed.cs @@ -18,10 +18,12 @@ namespace CalamityMod.Items.Mounts item.height = 36; item.useTime = 20; item.useAnimation = 20; - item.useStyle = 1; - item.value = Item.sellPrice(0, 20, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.useStyle = ItemUseStyleID.SwingThrow; + + 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(); diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index e01b505126..654f4b5f95 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -19,12 +19,14 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(1, 50, 0, 0); - item.rare = 9; item.expert = true; 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; } } } diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index 9a930dde93..f7f6bf2363 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Mounts mountData.flightTimeMax = 750; mountData.fatigueMax = 0; mountData.jumpHeight = 12; - mountData.acceleration = 0.6f; + mountData.acceleration = 0.35f; mountData.jumpSpeed = 9f; mountData.swimSpeed = 6f; mountData.blockExtraJumps = true; diff --git a/Items/Mounts/Fabsol.cs b/Items/Mounts/Fabsol.cs index 17a060ce44..b580f6025b 100644 --- a/Items/Mounts/Fabsol.cs +++ b/Items/Mounts/Fabsol.cs @@ -8,10 +8,10 @@ namespace CalamityMod.Items.Mounts { public override void SetStaticDefaults() { - DisplayName.SetDefault("Fabsol"); - Tooltip.SetDefault("Summons an alicorn\n" + - "Revengeance drop"); - } + DisplayName.SetDefault("Princess Spirit in a Bottle"); + Tooltip.SetDefault("Summons the spirit of Cirrus, the Drunk Princess, in her alicorn form\n" + + "Mounting will transform Cirrus, dismounting transforms her back"); + } public override void SetDefaults() { @@ -20,12 +20,14 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 9; - item.value = Item.buyPrice(3, 0, 0, 0); item.expert = true; 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; } } } diff --git a/Items/Mounts/GazeOfCrysthamyr.cs b/Items/Mounts/GazeOfCrysthamyr.cs index 236e8c6d3c..a6ce67377b 100644 --- a/Items/Mounts/GazeOfCrysthamyr.cs +++ b/Items/Mounts/GazeOfCrysthamyr.cs @@ -1,7 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,12 +20,14 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = 10; - item.value = Item.buyPrice(3, 0, 0, 0); + + 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.Calamity().customRarity = CalamityRarity.Dedicated; } public override void AddRecipes() @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Mounts recipe.AddIngredient(ItemID.SoulofNight, 100); recipe.AddIngredient(ModContent.ItemType(), 50); recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Mounts/OnyxExcavatorKey.cs b/Items/Mounts/OnyxExcavatorKey.cs index 133894d86a..5484ed0ff3 100644 --- a/Items/Mounts/OnyxExcavatorKey.cs +++ b/Items/Mounts/OnyxExcavatorKey.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.buyPrice(0, 9, 0, 0); item.UseSound = SoundID.Item23; item.noMelee = true; diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index 42816aa49f..d3c864354b 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -14,14 +14,11 @@ namespace CalamityMod.Items.Mounts mountData.fallDamage = -1; mountData.runSpeed = 5f; mountData.dashSpeed = 8f; - mountData.fatigueMax = 0; mountData.jumpHeight = 20; mountData.acceleration = 0.1f; - mountData.jumpSpeed = 40f; //20 - mountData.blockExtraJumps = true; + mountData.jumpSpeed = 20f; mountData.totalFrames = 4; - mountData.constantJump = true; - mountData.usesHover = false; + mountData.blockExtraJumps = true; int[] array = new int[mountData.totalFrames]; for (int l = 0; l < array.Length; l++) { @@ -77,11 +74,13 @@ namespace CalamityMod.Items.Mounts public override void UpdateEffects(Player player) { - player.statDefense += 60; - player.gravity = 2f; - player.maxFallSpeed = 25f; + if (player.velocity.Y > 0f || player.controlDown) + { + player.gravity = 1f; + player.maxFallSpeed = 20f; + } player.noFallDmg = true; } - } + } } diff --git a/Items/Mounts/SquishyBeanMount.cs b/Items/Mounts/SquishyBeanMount.cs index 99d173db2e..052afbdfa7 100644 --- a/Items/Mounts/SquishyBeanMount.cs +++ b/Items/Mounts/SquishyBeanMount.cs @@ -19,12 +19,14 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 9; - item.value = Item.buyPrice(1, 0, 0, 0); item.expert = true; 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; } } } diff --git a/Items/Mounts/TundraLeash.cs b/Items/Mounts/TundraLeash.cs index 12d0b80ef8..b67278b246 100644 --- a/Items/Mounts/TundraLeash.cs +++ b/Items/Mounts/TundraLeash.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.buyPrice(0, 9, 0, 0); item.UseSound = SoundID.NPCHit56; item.noMelee = true; diff --git a/Items/NormalityRelocator.cs b/Items/NormalityRelocator.cs index e83c8d9212..19b5ef79f0 100644 --- a/Items/NormalityRelocator.cs +++ b/Items/NormalityRelocator.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items DisplayName.SetDefault("Normality Relocator"); Tooltip.SetDefault("I'll be there in the blink of an eye\n" + "This line is modified below\n" + - "Teleportation is disabled while Chaos State is active\n" + - "Boosts movement and fall speed by 10%\n" + + "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)); } @@ -26,9 +26,9 @@ namespace CalamityMod.Items { item.width = 38; item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().donorItem = true; } public override void ModifyTooltips(List list) @@ -43,7 +43,6 @@ namespace CalamityMod.Items } } - public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/PermanentBoosters/BloodOrange.png b/Items/PermanentBoosters/BloodOrange.png index f59f5fac56..399874ec4c 100644 Binary files a/Items/PermanentBoosters/BloodOrange.png and b/Items/PermanentBoosters/BloodOrange.png differ diff --git a/Items/PermanentBoosters/CometShard.cs b/Items/PermanentBoosters/CometShard.cs index 14dfa0ac12..65288746ec 100644 --- a/Items/PermanentBoosters/CometShard.cs +++ b/Items/PermanentBoosters/CometShard.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item29; diff --git a/Items/PermanentBoosters/Dragonfruit.cs b/Items/PermanentBoosters/Dragonfruit.cs index 947b83285c..2c626e61f3 100644 --- a/Items/PermanentBoosters/Dragonfruit.cs +++ b/Items/PermanentBoosters/Dragonfruit.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.PermanentBoosters recipe.AddIngredient(ItemID.LifeFruit, 5); recipe.AddIngredient(ItemID.SkyBlueFlower); recipe.AddIngredient(ItemID.FragmentSolar, 15); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/PermanentBoosters/Ectoheart.cs b/Items/PermanentBoosters/Ectoheart.cs index 20f868f541..dc88420955 100644 --- a/Items/PermanentBoosters/Ectoheart.cs +++ b/Items/PermanentBoosters/Ectoheart.cs @@ -2,7 +2,6 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +9,12 @@ namespace CalamityMod.Items.PermanentBoosters { public class Ectoheart : ModItem { - private int frameCounter = 0; - private int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Ectoheart"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + + Tooltip.SetDefault("Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5%\n" + "Revengeance drop"); } @@ -28,43 +27,30 @@ namespace CalamityMod.Items.PermanentBoosters item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item122; item.consumable = true; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) => !player.Calamity().adrenalineBoostThree; - internal Rectangle GetCurrentFrame(bool frameCounterUp = true) - { - int frameAmt = 3; - if (frameCounter >= 8) - { - frameCounter = -1; - frame = frame == frameAmt - 1 ? 0 : frame + 1; - } - if (frameCounterUp) - frameCounter++; - return new Rectangle(0, item.height * frame, item.width, item.height); - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + 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, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + 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, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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) diff --git a/Items/PermanentBoosters/ElectrolyteGelPack.cs b/Items/PermanentBoosters/ElectrolyteGelPack.cs index 3a93a85afa..0c912b71ec 100644 --- a/Items/PermanentBoosters/ElectrolyteGelPack.cs +++ b/Items/PermanentBoosters/ElectrolyteGelPack.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Electrolyte Gel Pack"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + Tooltip.SetDefault("Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5%\n" + "Revengeance drop"); } @@ -19,7 +19,7 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item122; diff --git a/Items/PermanentBoosters/EtherealCore.cs b/Items/PermanentBoosters/EtherealCore.cs index f44559cfcf..0cd174d8e0 100644 --- a/Items/PermanentBoosters/EtherealCore.cs +++ b/Items/PermanentBoosters/EtherealCore.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 10; + item.rare = ItemRarityID.Red; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item29; diff --git a/Items/PermanentBoosters/InfernalBlood.cs b/Items/PermanentBoosters/InfernalBlood.cs index 46ef2a7e5f..9a47a6ab2f 100644 --- a/Items/PermanentBoosters/InfernalBlood.cs +++ b/Items/PermanentBoosters/InfernalBlood.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Infernal Blood"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + + Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 1 second\n" + "Revengeance drop"); } @@ -19,22 +19,14 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item122; item.consumable = true; } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostTwo) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().rageBoostTwo; public override bool UseItem(Player player) { diff --git a/Items/PermanentBoosters/MLGRune2.cs b/Items/PermanentBoosters/MLGRune2.cs index 683a1faa92..f6e2ef5e19 100644 --- a/Items/PermanentBoosters/MLGRune2.cs +++ b/Items/PermanentBoosters/MLGRune2.cs @@ -19,7 +19,7 @@ Consuming it does something that cannot be reversed"); { item.width = 28; item.height = 28; - item.rare = 10; + item.rare = ItemRarityID.Red; item.maxStack = 99; item.useAnimation = 30; item.useTime = 30; diff --git a/Items/PermanentBoosters/MushroomPlasmaRoot.cs b/Items/PermanentBoosters/MushroomPlasmaRoot.cs index 93517d7e0c..4dd9b8c833 100644 --- a/Items/PermanentBoosters/MushroomPlasmaRoot.cs +++ b/Items/PermanentBoosters/MushroomPlasmaRoot.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Mushroom Plasma Root"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + + Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 1 second\n" + "Revengeance drop"); } @@ -19,22 +19,14 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 2; + item.rare = ItemRarityID.Green; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item122; item.consumable = true; } - public override bool CanUseItem(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.rageBoostOne) - { - return false; - } - return true; - } + public override bool CanUseItem(Player player) => !player.Calamity().rageBoostOne; public override bool UseItem(Player player) { diff --git a/Items/PermanentBoosters/PhantomHeart.cs b/Items/PermanentBoosters/PhantomHeart.cs index 62de96f9f1..e50e1074d0 100644 --- a/Items/PermanentBoosters/PhantomHeart.cs +++ b/Items/PermanentBoosters/PhantomHeart.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.PermanentBoosters item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item29; item.consumable = true; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; } diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index 99a9c38cd4..51fedc6db7 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -2,7 +2,6 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +9,12 @@ namespace CalamityMod.Items.PermanentBoosters { public class RedLightningContainer : ModItem { - private int frameCounter = 0; - private int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Red Lightning Container"); - Tooltip.SetDefault("Permanently makes Rage Mode do 15% more damage\n" + + Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 1 second\n" + "Revengeance drop"); } @@ -28,43 +27,29 @@ namespace CalamityMod.Items.PermanentBoosters item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item122; item.consumable = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.rare = ItemRarityID.Purple; } public override bool CanUseItem(Player player) => !player.Calamity().rageBoostThree; - internal Rectangle GetCurrentFrame(bool frameCounterUp = true) - { - int frameAmt = 6; - if (frameCounter >= 5) - { - frameCounter = -1; - frame = frame == frameAmt - 1 ? 0 : frame + 1; - } - if (frameCounterUp) - frameCounter++; - return new Rectangle(0, item.height * frame, item.width, item.height); - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + 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, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + 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, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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) diff --git a/Items/PermanentBoosters/StarlightFuelCell.cs b/Items/PermanentBoosters/StarlightFuelCell.cs index 9032b6f0ad..5b0c0722e7 100644 --- a/Items/PermanentBoosters/StarlightFuelCell.cs +++ b/Items/PermanentBoosters/StarlightFuelCell.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Starlight Fuel Cell"); - Tooltip.SetDefault("Permanently makes Adrenaline Mode take 10 less seconds to charge\n" + + Tooltip.SetDefault("Permanently increases Adrenaline Mode damage by 15% and damage reduction by 5%\n" + "Revengeance drop"); } @@ -19,7 +19,7 @@ namespace CalamityMod.Items.PermanentBoosters item.width = 20; item.height = 20; item.useAnimation = 30; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.useTime = 30; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item122; diff --git a/Items/Pets/BearEye.cs b/Items/Pets/BearEye.cs index a6a42af5ed..e73c35e5a2 100644 --- a/Items/Pets/BearEye.cs +++ b/Items/Pets/BearEye.cs @@ -22,10 +22,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 30; item.height = 30; - item.value = Item.sellPrice(1, 0, 0, 0); + + item.value = Item.sellPrice(platinum: 1); + item.rare = ItemRarityID.Pink; + item.Calamity().devItem = true; + item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 5; item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); } diff --git a/Items/Pets/BloodyVein.cs b/Items/Pets/BloodyVein.cs index 6bcc74e3ef..4457cf80dc 100644 --- a/Items/Pets/BloodyVein.cs +++ b/Items/Pets/BloodyVein.cs @@ -23,12 +23,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 24; item.height = 48; - item.value = Item.buyPrice(0, 4, 0, 0); item.UseSound = SoundID.NPCHit9; item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 3; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = Item.buyPrice(gold: 4); + item.rare = ItemRarityID.Orange; + item.Calamity().donorItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/BrimstoneJewel.cs b/Items/Pets/BrimstoneJewel.cs index 308955e9b7..3ac5cbebb7 100644 --- a/Items/Pets/BrimstoneJewel.cs +++ b/Items/Pets/BrimstoneJewel.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Pets { DisplayName.SetDefault("Brimstone Jewel"); Tooltip.SetDefault("The ultimate reward for defeating such a beast...\n" + - "Who knew she'd be so darn cute!"); + "Who knew she'd be so darn cute!"); } public override void SetDefaults() @@ -20,8 +20,10 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = Item.sellPrice(gold: 40); + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().donorItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/BrimstoneJewel.png b/Items/Pets/BrimstoneJewel.png index b3b5cd5605..decd583bf9 100644 Binary files a/Items/Pets/BrimstoneJewel.png and b/Items/Pets/BrimstoneJewel.png differ diff --git a/Items/Pets/CharredRelic.cs b/Items/Pets/CharredRelic.cs index ab83ce1fcc..69176bb256 100644 --- a/Items/Pets/CharredRelic.cs +++ b/Items/Pets/CharredRelic.cs @@ -19,7 +19,11 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 4; + + item.value = Item.sellPrice(gold: 4); + item.rare = ItemRarityID.Red; + item.Calamity().devItem = true; + item.UseSound = SoundID.NPCHit51; } diff --git a/Items/Pets/ChromaticOrb.cs b/Items/Pets/ChromaticOrb.cs index 2880f8a9a3..edc30f3fa7 100644 --- a/Items/Pets/ChromaticOrb.cs +++ b/Items/Pets/ChromaticOrb.cs @@ -21,7 +21,10 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.WispinaBottle); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = Item.sellPrice(gold: 3); + item.rare = ItemRarityID.Cyan; + item.Calamity().donorItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 9e21f52e19..7a79b899ba 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -23,12 +23,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 28; item.height = 36; - item.value = Item.sellPrice(0, 7, 0, 0); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 10; item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); + + item.value = Item.sellPrice(gold: 7); item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().devItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/ForgottenDragonEgg.cs b/Items/Pets/ForgottenDragonEgg.cs index e79a792404..37ec34c786 100644 --- a/Items/Pets/ForgottenDragonEgg.cs +++ b/Items/Pets/ForgottenDragonEgg.cs @@ -19,8 +19,10 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = Item.sellPrice(gold: 30); + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().donorItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index c2b9bdb9b3..313922cf1b 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -19,8 +19,11 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 9; item.expert = true; + + item.value = Item.sellPrice(gold: 30); + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().devItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/GeyserShell.cs b/Items/Pets/GeyserShell.cs index db0b010496..ceb47df508 100644 --- a/Items/Pets/GeyserShell.cs +++ b/Items/Pets/GeyserShell.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Pets item.value = Item.sellPrice(0, 1, 50, 0); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item2; } diff --git a/Items/Pets/IbarakiBox.cs b/Items/Pets/IbarakiBox.cs index 85889814d6..09b197927f 100644 --- a/Items/Pets/IbarakiBox.cs +++ b/Items/Pets/IbarakiBox.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Pets "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" + - "With the blessing, the player will spawn with full health rather than half."); + "With the blessing, the player will spawn with full health rather than half."); } public override void SetDefaults() @@ -31,48 +31,50 @@ namespace CalamityMod.Items.Pets item.width = 36; item.height = 30; item.UseSound = SoundID.Item3; - item.value = Item.buyPrice(0, 5, 0, 0); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 5; + + item.value = Item.buyPrice(gold: 5); + item.rare = ItemRarityID.Pink; + item.Calamity().devItem = true; } public override bool AltFunctionUse(Player player) => true; public override void UseStyle(Player player) { - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5) && Main.myPlayer == player.whoAmI) - { - if (player.altFunctionUse == 2) - { - if (!player.Calamity().healToFull) - { - player.Calamity().healToFull = true; - string key = "Mods.CalamityMod.ThirdSageBlessingText"; - Color messageColor = Color.Violet; - Main.NewText(Language.GetTextValue(key), messageColor); - } - else - { - player.Calamity().healToFull = false; - string key2 = "Mods.CalamityMod.ThirdSageBlessingText2"; - Color messageColor2 = Color.Violet; - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - } - else - { - if (player.whoAmI == Main.myPlayer && player.itemTime == 0) - { - player.AddBuff(item.buffType, 3600, true); - } - } - } - } + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5) && Main.myPlayer == player.whoAmI) + { + if (player.altFunctionUse == 2) + { + if (!player.Calamity().healToFull) + { + player.Calamity().healToFull = true; + string key = "Mods.CalamityMod.ThirdSageBlessingText"; + Color messageColor = Color.Violet; + Main.NewText(Language.GetTextValue(key), messageColor); + } + else + { + player.Calamity().healToFull = false; + string key2 = "Mods.CalamityMod.ThirdSageBlessingText2"; + Color messageColor2 = Color.Violet; + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + } + else + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, 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) { - return false; - } + return false; + } } } diff --git a/Items/Pets/JoyfulHeart.cs b/Items/Pets/JoyfulHeart.cs index ccd6138bbb..cc7dcc9c31 100644 --- a/Items/Pets/JoyfulHeart.cs +++ b/Items/Pets/JoyfulHeart.cs @@ -22,10 +22,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 30; item.height = 30; - item.value = Item.sellPrice(0, 1, 0, 0); + + item.value = Item.sellPrice(gold: 1); + item.rare = ItemRarityID.Pink; + item.Calamity().devItem = true; + item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 5; item.UseSound = SoundID.Item2; } diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index 63e254f764..a3a295afd8 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -19,7 +19,10 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 10; + + item.value = Item.sellPrice(gold: 40); + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().devItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/LittleLight.cs b/Items/Pets/LittleLight.cs new file mode 100644 index 0000000000..e2e06f7d6b --- /dev/null +++ b/Items/Pets/LittleLight.cs @@ -0,0 +1,37 @@ +using CalamityMod.Buffs.Pets; +using CalamityMod.Projectiles.Pets; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Pets +{ + public class LittleLight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Little Light"); + Tooltip.SetDefault("It's been looking for you for a long time.\n" + + "Summons a small construct that follows you and provides a great amount of light"); + } + + public override void SetDefaults() + { + 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; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + player.AddBuff(item.buffType, 3600, true); + } + } +} diff --git a/Items/Pets/LittleLight.png b/Items/Pets/LittleLight.png new file mode 100644 index 0000000000..1aa82dc885 Binary files /dev/null and b/Items/Pets/LittleLight.png differ diff --git a/Items/Pets/PlagueCaller.cs b/Items/Pets/PlagueCaller.cs index 0c7955ac0c..c98a7efd84 100644 --- a/Items/Pets/PlagueCaller.cs +++ b/Items/Pets/PlagueCaller.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.ZephyrFish); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void UseStyle(Player player) diff --git a/Items/Pets/PrimroseKeepsake.cs b/Items/Pets/PrimroseKeepsake.cs index e36f2c2df0..662fe6c040 100644 --- a/Items/Pets/PrimroseKeepsake.cs +++ b/Items/Pets/PrimroseKeepsake.cs @@ -25,11 +25,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 30; item.height = 30; - item.value = Item.sellPrice(1, 0, 0, 0); item.shoot = ProjectileID.None; // neither kendra nor bear is the direct "shoot" item.buffType = ModContent.BuffType(); - item.rare = 6; item.UseSound = SoundID.Item44; + + item.value = Item.sellPrice(platinum: 1); + item.rare = ItemRarityID.Purple; + item.Calamity().devItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/RadiatingCrystal.cs b/Items/Pets/RadiatingCrystal.cs index 760ff5c0aa..53994f4a0f 100644 --- a/Items/Pets/RadiatingCrystal.cs +++ b/Items/Pets/RadiatingCrystal.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Pets item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); item.value = Item.sellPrice(silver: 20); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void UseStyle(Player player) diff --git a/Items/Pets/RomajedaOrchid.cs b/Items/Pets/RomajedaOrchid.cs index fa161f44cc..4a9d4826cc 100644 --- a/Items/Pets/RomajedaOrchid.cs +++ b/Items/Pets/RomajedaOrchid.cs @@ -23,11 +23,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 30; item.height = 30; - item.value = Item.sellPrice(1, 0, 0, 0); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 5; item.UseSound = SoundID.Item44; + + item.value = Item.buyPrice(gold: 40); + item.rare = ItemRarityID.Pink; + item.Calamity().devItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/RotomRemote.cs b/Items/Pets/RotomRemote.cs index 6122e39750..92db953f88 100644 --- a/Items/Pets/RotomRemote.cs +++ b/Items/Pets/RotomRemote.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Pets { DisplayName.SetDefault("Triboluminescent Etomer"); Tooltip.SetDefault("Summons an electric troublemaker\n" + - "A little note is attached:\n" + - "Thank you, Aloe! Very much appreciated from Ben"); + "A little note is attached:\n" + + "Thank you, Aloe! Very much appreciated from Ben"); } public override void SetDefaults() @@ -32,8 +32,10 @@ namespace CalamityMod.Items.Pets item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.UseSound = SoundID.Item113; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + + item.value = Item.buyPrice(gold: 4); + item.rare = ItemRarityID.Orange; + item.Calamity().devItem = true; } public override void UseStyle(Player player) @@ -46,9 +48,7 @@ namespace CalamityMod.Items.Pets public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Pets/RotomRemoteGlow"); - Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f - 2f); - spriteBatch.Draw(texture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Pets/RotomRemoteGlow")); } public override void AddRecipes() diff --git a/Items/Pets/SparksSummon.cs b/Items/Pets/SparksSummon.cs index 2c3e5f9f5d..4e1758cd38 100644 --- a/Items/Pets/SparksSummon.cs +++ b/Items/Pets/SparksSummon.cs @@ -21,8 +21,10 @@ namespace CalamityMod.Items.Pets item.CloneDefaults(ItemID.WispinaBottle); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); + item.value = Item.sellPrice(gold: 1); - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.rare = ItemRarityID.Pink; + item.Calamity().donorItem = true; } public override void UseStyle(Player player) diff --git a/Items/Pets/TrashmanTrashcan.cs b/Items/Pets/TrashmanTrashcan.cs index b4c105789e..108984dc9f 100644 --- a/Items/Pets/TrashmanTrashcan.cs +++ b/Items/Pets/TrashmanTrashcan.cs @@ -22,11 +22,13 @@ namespace CalamityMod.Items.Pets item.noMelee = true; item.width = 30; item.height = 30; - item.value = Item.sellPrice(0, 1, 0, 0); item.shoot = ModContent.ProjectileType(); item.buffType = ModContent.BuffType(); - item.rare = 5; item.UseSound = SoundID.NPCDeath13; + + item.value = Item.sellPrice(gold: 1); + item.rare = ItemRarityID.Pink; + item.Calamity().devItem = true; } public override void UseStyle(Player player) diff --git a/Items/Placeables/AerialiteBrick.cs b/Items/Placeables/AerialiteBrick.cs index ef28e8ac45..a8b67efdf2 100644 --- a/Items/Placeables/AerialiteBrick.cs +++ b/Items/Placeables/AerialiteBrick.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Items.Placeables ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); + recipe.SetResult(this, 10); recipe.AddTile(TileID.Furnaces); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } diff --git a/Items/Placeables/AstralBar.cs b/Items/Placeables/AstralBar.cs index 470ea06d99..c6cbf8dd90 100644 --- a/Items/Placeables/AstralBar.cs +++ b/Items/Placeables/AstralBar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Placeables item.width = 16; item.height = 16; item.maxStack = 99; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.value = Item.sellPrice(gold: 1, silver: 20); } diff --git a/Items/Placeables/AstralBrick.cs b/Items/Placeables/AstralBrick.cs index 52a12147ec..9a25071526 100644 --- a/Items/Placeables/AstralBrick.cs +++ b/Items/Placeables/AstralBrick.cs @@ -30,12 +30,12 @@ namespace CalamityMod.Items.Placeables ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.SetResult(this, 10); recipe.AddTile(TileID.Furnaces); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } diff --git a/Items/Placeables/AstralFossil.cs b/Items/Placeables/AstralFossil.cs index 138686b704..a16bb08606 100644 --- a/Items/Placeables/AstralFossil.cs +++ b/Items/Placeables/AstralFossil.cs @@ -41,12 +41,18 @@ namespace CalamityMod.Items.Placeables public override void ExtractinatorUse(ref int resultType, ref int resultStack) { - /* + /* Celestial remains will give stardust, fallen stars, ancient bone dust, gems and HM ores always by default When Astrum Deus has been defeated, it will give Astral Ore */ - float val = Main.rand.NextFloat(100); + bool twoMechsDowned = + (NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3) || + (NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1) || + (NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2) || + (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); + + float val = Main.rand.NextFloat(100); if (val < 20f) { resultType = ItemID.CopperCoin; @@ -134,27 +140,27 @@ namespace CalamityMod.Items.Placeables } else if (val < 85.03f) { - resultType = ItemID.MythrilOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } else if (val < 87.03f) { - resultType = ItemID.OrichalcumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } else if (val < 88.78f) { - resultType = ItemID.AdamantiteOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } else if (val < 89.53f) { - resultType = ItemID.TitaniumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (CalamityWorld.downedStarGod) { - resultType = ModContent.ItemType(); + resultType = ModContent.ItemType(); resultStack = Main.rand.Next(1, 2); } } diff --git a/Items/Placeables/AstralSilt.cs b/Items/Placeables/AstralSilt.cs index a79456eaa1..b50a00e6ea 100644 --- a/Items/Placeables/AstralSilt.cs +++ b/Items/Placeables/AstralSilt.cs @@ -29,12 +29,18 @@ namespace CalamityMod.Items.Placeables } public override void ExtractinatorUse(ref int resultType, ref int resultStack) { - /* + /* Novae slag will give stardust, fallen stars, gems and HM ores always by default When Astrum Deus has been defeated, it will give Astral Ore */ - float val = Main.rand.NextFloat(100); + bool twoMechsDowned = + (NPC.downedMechBoss1 && NPC.downedMechBoss2 && !NPC.downedMechBoss3) || + (NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedMechBoss1) || + (NPC.downedMechBoss3 && NPC.downedMechBoss1 && !NPC.downedMechBoss2) || + (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3); + + float val = Main.rand.NextFloat(100); if (val < 30f) { resultType = ItemID.CopperCoin; @@ -112,27 +118,27 @@ namespace CalamityMod.Items.Placeables } else if (val < 83.03f) { - resultType = ItemID.MythrilOre; - resultStack = Main.rand.Next(1, 17); + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre; + resultStack = Main.rand.Next(1, 17); } else if (val < 85.03f) { - resultType = ItemID.OrichalcumOre; - resultStack = Main.rand.Next(1, 17); + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre; + resultStack = Main.rand.Next(1, 17); } else if (val < 86.78f) { - resultType = ItemID.AdamantiteOre; - resultStack = Main.rand.Next(1, 17); + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre; + resultStack = Main.rand.Next(1, 17); } else if (val < 88.53f) { - resultType = ItemID.TitaniumOre; + resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); } else if (CalamityWorld.downedStarGod) { - resultType = ModContent.ItemType(); + resultType = ModContent.ItemType(); resultStack = Main.rand.Next(1, 2); } } diff --git a/Items/Placeables/Banners/AcidEelBanner.cs b/Items/Placeables/Banners/AcidEelBanner.cs index 51e4615af6..85b01646c3 100644 --- a/Items/Placeables/Banners/AcidEelBanner.cs +++ b/Items/Placeables/Banners/AcidEelBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 8bb217d051..17dd23979f 100644 --- a/Items/Placeables/Banners/AeroSlimeBanner.cs +++ b/Items/Placeables/Banners/AeroSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 71eeb51efb..3ed8a5b638 100644 --- a/Items/Placeables/Banners/AmberCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmberCrawlerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 53aa13580e..564e368d50 100644 --- a/Items/Placeables/Banners/AmethystCrawlerBanner.cs +++ b/Items/Placeables/Banners/AmethystCrawlerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 e998eff04d..0769f4cb21 100644 --- a/Items/Placeables/Banners/AngryDogBanner.cs +++ b/Items/Placeables/Banners/AngryDogBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 025835ac0d..df46e4244f 100644 --- a/Items/Placeables/Banners/AnthozoanCrabBanner.cs +++ b/Items/Placeables/Banners/AnthozoanCrabBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 e469fcdc4f..ebc184a7a8 100644 --- a/Items/Placeables/Banners/AquaticAberrationBanner.cs +++ b/Items/Placeables/Banners/AquaticAberrationBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 5cc7b79bf9..66a4f9446d 100644 --- a/Items/Placeables/Banners/AquaticParasiteBanner.cs +++ b/Items/Placeables/Banners/AquaticParasiteBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 6bc5b5c221..8b20ca0322 100644 --- a/Items/Placeables/Banners/AquaticSeekerBanner.cs +++ b/Items/Placeables/Banners/AquaticSeekerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 5f15874e3f..159ac5f81e 100644 --- a/Items/Placeables/Banners/AquaticUrchinBanner.cs +++ b/Items/Placeables/Banners/AquaticUrchinBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 2196cb2731..975a53d2d4 100644 --- a/Items/Placeables/Banners/AriesBanner.cs +++ b/Items/Placeables/Banners/AriesBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 59f6590738..521096f558 100644 --- a/Items/Placeables/Banners/ArmoredDiggerBanner.cs +++ b/Items/Placeables/Banners/ArmoredDiggerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 46a941bdab..617f7ed416 100644 --- a/Items/Placeables/Banners/AstralProbeBanner.cs +++ b/Items/Placeables/Banners/AstralProbeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 3a9dfc5ae1..1fec999256 100644 --- a/Items/Placeables/Banners/AstralSlimeBanner.cs +++ b/Items/Placeables/Banners/AstralSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 8e880025e4..b5bae5b8d0 100644 --- a/Items/Placeables/Banners/AstralachneaBanner.cs +++ b/Items/Placeables/Banners/AstralachneaBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 8330eb4a9f..58e8b45d0d 100644 --- a/Items/Placeables/Banners/AtlasBanner.cs +++ b/Items/Placeables/Banners/AtlasBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 45673df81f..2e90b893a7 100644 --- a/Items/Placeables/Banners/BOHLDOHRBanner.cs +++ b/Items/Placeables/Banners/BOHLDOHRBanner.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/BOHLDOHRBanner.png b/Items/Placeables/Banners/BOHLDOHRBanner.png index a02f92a9cd..b995c34dcf 100644 Binary files a/Items/Placeables/Banners/BOHLDOHRBanner.png and b/Items/Placeables/Banners/BOHLDOHRBanner.png differ diff --git a/Items/Placeables/Banners/BelchingCoralBanner.cs b/Items/Placeables/Banners/BelchingCoralBanner.cs index 27309b958c..76502b5ea1 100644 --- a/Items/Placeables/Banners/BelchingCoralBanner.cs +++ b/Items/Placeables/Banners/BelchingCoralBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 6b1ceb6c3d..574e0ef075 100644 --- a/Items/Placeables/Banners/BigSightseerBanner.cs +++ b/Items/Placeables/Banners/BigSightseerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 48f0de0cc9..6aad4ebd60 100644 --- a/Items/Placeables/Banners/BlightedEyeBanner.cs +++ b/Items/Placeables/Banners/BlightedEyeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 bbf79bfb9f..8987bbde51 100644 --- a/Items/Placeables/Banners/BlindedAnglerBanner.cs +++ b/Items/Placeables/Banners/BlindedAnglerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 02ec821518..ec79fdd2f2 100644 --- a/Items/Placeables/Banners/BloatfishBanner.cs +++ b/Items/Placeables/Banners/BloatfishBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/BloatfishBanner.png b/Items/Placeables/Banners/BloatfishBanner.png index 4365c707e4..4d4542e55e 100644 Binary files a/Items/Placeables/Banners/BloatfishBanner.png and b/Items/Placeables/Banners/BloatfishBanner.png differ diff --git a/Items/Placeables/Banners/BloomSlimeBanner.cs b/Items/Placeables/Banners/BloomSlimeBanner.cs index 85361bdaed..8247ad96e4 100644 --- a/Items/Placeables/Banners/BloomSlimeBanner.cs +++ b/Items/Placeables/Banners/BloomSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7b8222ed25..b3b52c3afc 100644 --- a/Items/Placeables/Banners/BobbitWormBanner.cs +++ b/Items/Placeables/Banners/BobbitWormBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/BobbitWormBanner.png b/Items/Placeables/Banners/BobbitWormBanner.png index 8bffb68f49..a0bc419f84 100644 Binary files a/Items/Placeables/Banners/BobbitWormBanner.png and b/Items/Placeables/Banners/BobbitWormBanner.png differ diff --git a/Items/Placeables/Banners/BoxJellyfishBanner.cs b/Items/Placeables/Banners/BoxJellyfishBanner.cs index c40e47ede1..a1ae2ca136 100644 --- a/Items/Placeables/Banners/BoxJellyfishBanner.cs +++ b/Items/Placeables/Banners/BoxJellyfishBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 346262bae4..d96c42495e 100644 --- a/Items/Placeables/Banners/CalamityEyeBanner.cs +++ b/Items/Placeables/Banners/CalamityEyeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 5d6273c753..0bd33b7f46 100644 --- a/Items/Placeables/Banners/CatfishBanner.cs +++ b/Items/Placeables/Banners/CatfishBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 a80af3f84a..c33d998621 100644 --- a/Items/Placeables/Banners/ChaoticPufferBanner.cs +++ b/Items/Placeables/Banners/ChaoticPufferBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 0681c17b24..603e2e5def 100644 --- a/Items/Placeables/Banners/CharredSlimeBanner.cs +++ b/Items/Placeables/Banners/CharredSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 4e0418cc7e..15fd283628 100644 --- a/Items/Placeables/Banners/ClamBanner.cs +++ b/Items/Placeables/Banners/ClamBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 21962c1dea..23a25966a2 100644 --- a/Items/Placeables/Banners/CloudElementalBanner.cs +++ b/Items/Placeables/Banners/CloudElementalBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 c309e6329a..4eccbc86a2 100644 --- a/Items/Placeables/Banners/CnidrionBanner.cs +++ b/Items/Placeables/Banners/CnidrionBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 fa91f8b31b..d80979b215 100644 --- a/Items/Placeables/Banners/ColossalSquidBanner.cs +++ b/Items/Placeables/Banners/ColossalSquidBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 0ed480f326..eb065f52b3 100644 --- a/Items/Placeables/Banners/CosmicElementalBanner.cs +++ b/Items/Placeables/Banners/CosmicElementalBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 990ef90a8e..2b65271ea8 100644 --- a/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/CrimulanBlightSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 381697930a..eaf29efc47 100644 --- a/Items/Placeables/Banners/CryoSlimeBanner.cs +++ b/Items/Placeables/Banners/CryoSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 aad771be2e..ad4b9ca6c8 100644 --- a/Items/Placeables/Banners/CryonBanner.cs +++ b/Items/Placeables/Banners/CryonBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 e3a19dfd06..29af252c35 100644 --- a/Items/Placeables/Banners/CrystalCrawlerBanner.cs +++ b/Items/Placeables/Banners/CrystalCrawlerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 a185a08226..4713acf831 100644 --- a/Items/Placeables/Banners/CultistAssassinBanner.cs +++ b/Items/Placeables/Banners/CultistAssassinBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 cfecdc73e0..28b2fe07ee 100644 --- a/Items/Placeables/Banners/CuttlefishBanner.cs +++ b/Items/Placeables/Banners/CuttlefishBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 1c9ca52553..5646d0b429 100644 --- a/Items/Placeables/Banners/DespairStoneBanner.cs +++ b/Items/Placeables/Banners/DespairStoneBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 5ffddb2283..9c8b06e232 100644 --- a/Items/Placeables/Banners/DevilFishBanner.cs +++ b/Items/Placeables/Banners/DevilFishBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 c7474cf1dc..c5fc4f7998 100644 --- a/Items/Placeables/Banners/DiamondCrawlerBanner.cs +++ b/Items/Placeables/Banners/DiamondCrawlerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 8576860689..898410ed8d 100644 --- a/Items/Placeables/Banners/EarthElementalBanner.cs +++ b/Items/Placeables/Banners/EarthElementalBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7f46434e39..1342e32a00 100644 --- a/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs +++ b/Items/Placeables/Banners/EbonianBlightSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7607c1c55e..659f15e56b 100644 --- a/Items/Placeables/Banners/EidolistBanner.cs +++ b/Items/Placeables/Banners/EidolistBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 73a1614d21..2eb1108d09 100644 --- a/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs +++ b/Items/Placeables/Banners/EidolonWyrmJuvenileBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 df9dce31bd..64d84061fa 100644 --- a/Items/Placeables/Banners/EmeraldCrawlerBanner.cs +++ b/Items/Placeables/Banners/EmeraldCrawlerBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b7945b7245..3df6ca5682 100644 --- a/Items/Placeables/Banners/EutrophicRayBanner.cs +++ b/Items/Placeables/Banners/EutrophicRayBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 69e015be8c..b5d0685546 100644 --- a/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs +++ b/Items/Placeables/Banners/FearlessGoldfishWarriorBanner.cs @@ -18,9 +18,11 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(0, 0, 10, 0); + + item.value = Item.buyPrice(silver: 10); + item.rare = ItemRarityID.Blue; + item.Calamity().donorItem = true; + item.createTile = ModContent.TileType(); item.placeStyle = 109; } diff --git a/Items/Placeables/Banners/FlakBabyBanner.cs b/Items/Placeables/Banners/FlakBabyBanner.cs index dfca97b3be..d6f360a055 100644 --- a/Items/Placeables/Banners/FlakBabyBanner.cs +++ b/Items/Placeables/Banners/FlakBabyBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 d9f3f718ad..2aa8a2bafc 100644 --- a/Items/Placeables/Banners/FlakCrabBanner.cs +++ b/Items/Placeables/Banners/FlakCrabBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 6b133df1bc..3b4cc94ed8 100644 --- a/Items/Placeables/Banners/FlounderBanner.cs +++ b/Items/Placeables/Banners/FlounderBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 3317f42898..f51b1cbaf4 100644 --- a/Items/Placeables/Banners/FrogfishBanner.cs +++ b/Items/Placeables/Banners/FrogfishBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 12c8d1b076..028d70f07a 100644 --- a/Items/Placeables/Banners/FusionFeederBanner.cs +++ b/Items/Placeables/Banners/FusionFeederBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 9f30e295cb..a5f07d6c21 100644 --- a/Items/Placeables/Banners/GammaSlimeBanner.cs +++ b/Items/Placeables/Banners/GammaSlimeBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 0b9315c080..42d75a7c25 100644 --- a/Items/Placeables/Banners/GhostBellBanner.cs +++ b/Items/Placeables/Banners/GhostBellBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 537550e25c..ba4ce5ee8d 100644 --- a/Items/Placeables/Banners/GhostBellSmallBanner.cs +++ b/Items/Placeables/Banners/GhostBellSmallBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 1846e58205..9edde81031 100644 --- a/Items/Placeables/Banners/GiantClamBanner.cs +++ b/Items/Placeables/Banners/GiantClamBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 0e09f1d07d..90a357599f 100644 --- a/Items/Placeables/Banners/GiantSquidBanner.cs +++ b/Items/Placeables/Banners/GiantSquidBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/GiantSquidBanner.png b/Items/Placeables/Banners/GiantSquidBanner.png index e1cf0cf416..cb54b256db 100644 Binary files a/Items/Placeables/Banners/GiantSquidBanner.png and b/Items/Placeables/Banners/GiantSquidBanner.png differ diff --git a/Items/Placeables/Banners/GnasherBanner.cs b/Items/Placeables/Banners/GnasherBanner.cs index 6ecf709e5e..2757cf71fd 100644 --- a/Items/Placeables/Banners/GnasherBanner.cs +++ b/Items/Placeables/Banners/GnasherBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b02e134f52..f723a6ea79 100644 --- a/Items/Placeables/Banners/GreatSandSharkBanner.cs +++ b/Items/Placeables/Banners/GreatSandSharkBanner.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 ba896d6188..dfe9ba18b4 100644 --- a/Items/Placeables/Banners/GulperEelBanner.cs +++ b/Items/Placeables/Banners/GulperEelBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 32f21d7c5c..48d06d4e50 100644 --- a/Items/Placeables/Banners/HadarianBanner.cs +++ b/Items/Placeables/Banners/HadarianBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b3d837b5b4..c2fcb4f5e8 100644 --- a/Items/Placeables/Banners/HeatSpiritBanner.cs +++ b/Items/Placeables/Banners/HeatSpiritBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 63a93d2073..5dd25ba850 100644 --- a/Items/Placeables/Banners/HiveBanner.cs +++ b/Items/Placeables/Banners/HiveBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 497ce6b2b3..5a4f8c6c41 100644 --- a/Items/Placeables/Banners/IceClasperBanner.cs +++ b/Items/Placeables/Banners/IceClasperBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 0f1d1dfd39..dcd80980a7 100644 --- a/Items/Placeables/Banners/ImpiousImmolatorBanner.cs +++ b/Items/Placeables/Banners/ImpiousImmolatorBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 d7682a21e6..e00b5ad4ca 100644 --- a/Items/Placeables/Banners/IrradiatedSlimeBanner.cs +++ b/Items/Placeables/Banners/IrradiatedSlimeBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 76b9874ed6..09991316d6 100644 --- a/Items/Placeables/Banners/LaserfishBanner.cs +++ b/Items/Placeables/Banners/LaserfishBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/LaserfishBanner.png b/Items/Placeables/Banners/LaserfishBanner.png index e9891a4483..1db3a13cdd 100644 Binary files a/Items/Placeables/Banners/LaserfishBanner.png and b/Items/Placeables/Banners/LaserfishBanner.png differ diff --git a/Items/Placeables/Banners/LuminousCorvinaBanner.cs b/Items/Placeables/Banners/LuminousCorvinaBanner.cs index 8fe351a899..e709e3d74e 100644 --- a/Items/Placeables/Banners/LuminousCorvinaBanner.cs +++ b/Items/Placeables/Banners/LuminousCorvinaBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/LuminousCorvinaBanner.png b/Items/Placeables/Banners/LuminousCorvinaBanner.png index 342691b4af..bb2d938c65 100644 Binary files a/Items/Placeables/Banners/LuminousCorvinaBanner.png and b/Items/Placeables/Banners/LuminousCorvinaBanner.png differ diff --git a/Items/Placeables/Banners/MantisBanner.cs b/Items/Placeables/Banners/MantisBanner.cs index 4b1199c86e..12ddcdd60c 100644 --- a/Items/Placeables/Banners/MantisBanner.cs +++ b/Items/Placeables/Banners/MantisBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 997a6d30b3..226e66de55 100644 --- a/Items/Placeables/Banners/MantisShrimpBanner.cs +++ b/Items/Placeables/Banners/MantisShrimpBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 eb0ca8ab57..ae790d1519 100644 --- a/Items/Placeables/Banners/MaulerBanner.cs +++ b/Items/Placeables/Banners/MaulerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 0b8766b536..450ddc60a9 100644 --- a/Items/Placeables/Banners/MelterBanner.cs +++ b/Items/Placeables/Banners/MelterBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 21a417cd45..1034cabe0c 100644 --- a/Items/Placeables/Banners/MirageJellyBanner.cs +++ b/Items/Placeables/Banners/MirageJellyBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7d0d65524a..2081fd72ae 100644 --- a/Items/Placeables/Banners/MorayEelBanner.cs +++ b/Items/Placeables/Banners/MorayEelBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 9931312d93..ad1a79d68c 100644 --- a/Items/Placeables/Banners/NovaBanner.cs +++ b/Items/Placeables/Banners/NovaBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7e56b4d694..df64b09780 100644 --- a/Items/Placeables/Banners/NuclearToadBanner.cs +++ b/Items/Placeables/Banners/NuclearToadBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 16022eb63b..bd7b7ce893 100644 --- a/Items/Placeables/Banners/OarfishBanner.cs +++ b/Items/Placeables/Banners/OarfishBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/OarfishBanner.png b/Items/Placeables/Banners/OarfishBanner.png index 7dc7e0e4b3..39583d5368 100644 Binary files a/Items/Placeables/Banners/OarfishBanner.png and b/Items/Placeables/Banners/OarfishBanner.png differ diff --git a/Items/Placeables/Banners/OrthoceraBanner.cs b/Items/Placeables/Banners/OrthoceraBanner.cs index 85310742c6..4a0719a3a2 100644 --- a/Items/Placeables/Banners/OrthoceraBanner.cs +++ b/Items/Placeables/Banners/OrthoceraBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 a1766a486d..2b016b6145 100644 --- a/Items/Placeables/Banners/OverloadedSoldierBanner.cs +++ b/Items/Placeables/Banners/OverloadedSoldierBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b0f09b0d37..ea49018c00 100644 --- a/Items/Placeables/Banners/ParaseaBanner.cs +++ b/Items/Placeables/Banners/ParaseaBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/ParaseaBanner.png b/Items/Placeables/Banners/ParaseaBanner.png index e00c958787..7fad8efcf5 100644 Binary files a/Items/Placeables/Banners/ParaseaBanner.png and b/Items/Placeables/Banners/ParaseaBanner.png differ diff --git a/Items/Placeables/Banners/PerennialSlimeBanner.cs b/Items/Placeables/Banners/PerennialSlimeBanner.cs index 98ad464b70..0d2271b018 100644 --- a/Items/Placeables/Banners/PerennialSlimeBanner.cs +++ b/Items/Placeables/Banners/PerennialSlimeBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7f3a0547d8..792c9c5321 100644 --- a/Items/Placeables/Banners/PestilentSlimeBanner.cs +++ b/Items/Placeables/Banners/PestilentSlimeBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b6b5bc6e97..75c7a4a56d 100644 --- a/Items/Placeables/Banners/PhantomDebrisBanner.cs +++ b/Items/Placeables/Banners/PhantomDebrisBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7cdf7b3bc1..9c94479ce2 100644 --- a/Items/Placeables/Banners/PhantomSpiritBanner.cs +++ b/Items/Placeables/Banners/PhantomSpiritBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 5ef0b3fae4..0aa864c526 100644 --- a/Items/Placeables/Banners/PiggyBanner.cs +++ b/Items/Placeables/Banners/PiggyBanner.cs @@ -17,9 +17,11 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(0, 0, 10, 0); + + item.value = Item.buyPrice(silver: 10); + item.rare = ItemRarityID.Blue; + item.Calamity().donorItem = true; + item.createTile = ModContent.TileType(); item.placeStyle = 108; } diff --git a/Items/Placeables/Banners/PitbullBanner.cs b/Items/Placeables/Banners/PitbullBanner.cs index ab5484f0bc..671796db4e 100644 --- a/Items/Placeables/Banners/PitbullBanner.cs +++ b/Items/Placeables/Banners/PitbullBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 9e5d52ce37..d0a8ffa227 100644 --- a/Items/Placeables/Banners/PlagueChargerBanner.cs +++ b/Items/Placeables/Banners/PlagueChargerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 506f625262..02d3389948 100644 --- a/Items/Placeables/Banners/PlaguebringerBanner.cs +++ b/Items/Placeables/Banners/PlaguebringerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 3d3d9976ea..0b36af2747 100644 --- a/Items/Placeables/Banners/PlagueshellBanner.cs +++ b/Items/Placeables/Banners/PlagueshellBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 16a5070d8f..a01f641595 100644 --- a/Items/Placeables/Banners/PrismTurtleBanner.cs +++ b/Items/Placeables/Banners/PrismTurtleBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 8bbcdc7c88..c7840d3fcc 100644 --- a/Items/Placeables/Banners/ProfanedEnergyBanner.cs +++ b/Items/Placeables/Banners/ProfanedEnergyBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 74e16b83ef..feacd5cd0c 100644 --- a/Items/Placeables/Banners/RadiatorBanner.cs +++ b/Items/Placeables/Banners/RadiatorBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 930dc1d033..e7e0fa62d1 100644 --- a/Items/Placeables/Banners/ReaperSharkBanner.cs +++ b/Items/Placeables/Banners/ReaperSharkBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 cb787e3e07..9782d6527f 100644 --- a/Items/Placeables/Banners/RubyCrawlerBanner.cs +++ b/Items/Placeables/Banners/RubyCrawlerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 5eeb70405a..37633ec0f2 100644 --- a/Items/Placeables/Banners/SandTortoiseBanner.cs +++ b/Items/Placeables/Banners/SandTortoiseBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/SandTortoiseBanner.png b/Items/Placeables/Banners/SandTortoiseBanner.png index cc8188e39c..374fb4212a 100644 Binary files a/Items/Placeables/Banners/SandTortoiseBanner.png and b/Items/Placeables/Banners/SandTortoiseBanner.png differ diff --git a/Items/Placeables/Banners/SapphireCrawlerBanner.cs b/Items/Placeables/Banners/SapphireCrawlerBanner.cs index f1b163d6a5..16d3fdf1cf 100644 --- a/Items/Placeables/Banners/SapphireCrawlerBanner.cs +++ b/Items/Placeables/Banners/SapphireCrawlerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 ae78629bdb..aaf7a0d0c6 100644 --- a/Items/Placeables/Banners/ScornEaterBanner.cs +++ b/Items/Placeables/Banners/ScornEaterBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 f89f306d60..c7e6d87fa8 100644 --- a/Items/Placeables/Banners/ScryllarBanner.cs +++ b/Items/Placeables/Banners/ScryllarBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 50b090c5b3..8d4fc3d9c5 100644 --- a/Items/Placeables/Banners/SeaFloatyBanner.cs +++ b/Items/Placeables/Banners/SeaFloatyBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 9f7f15414a..004c5e3c03 100644 --- a/Items/Placeables/Banners/SeaMinnowBanner.cs +++ b/Items/Placeables/Banners/SeaMinnowBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 e8be035af1..a385cbc161 100644 --- a/Items/Placeables/Banners/SeaSerpentBanner.cs +++ b/Items/Placeables/Banners/SeaSerpentBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 87446a7eaa..572f67a74b 100644 --- a/Items/Placeables/Banners/SeaUrchinBanner.cs +++ b/Items/Placeables/Banners/SeaUrchinBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 a55f0f2073..1687c349f7 100644 --- a/Items/Placeables/Banners/ShockstormShuttleBanner.cs +++ b/Items/Placeables/Banners/ShockstormShuttleBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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/ShockstormShuttleBanner.png b/Items/Placeables/Banners/ShockstormShuttleBanner.png index bd6afae6ee..e3a0f18f5f 100644 Binary files a/Items/Placeables/Banners/ShockstormShuttleBanner.png and b/Items/Placeables/Banners/ShockstormShuttleBanner.png differ diff --git a/Items/Placeables/Banners/SkyfinBanner.cs b/Items/Placeables/Banners/SkyfinBanner.cs index 9a74793882..cd0658325e 100644 --- a/Items/Placeables/Banners/SkyfinBanner.cs +++ b/Items/Placeables/Banners/SkyfinBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 4f0cacc1a5..a3e587b077 100644 --- a/Items/Placeables/Banners/SmallSightseerBanner.cs +++ b/Items/Placeables/Banners/SmallSightseerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 559fed4cac..4c412c0cb1 100644 --- a/Items/Placeables/Banners/SoulSluperBanner.cs +++ b/Items/Placeables/Banners/SoulSluperBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 167451763e..211809e883 100644 --- a/Items/Placeables/Banners/StellarCulexBanner.cs +++ b/Items/Placeables/Banners/StellarCulexBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 607edb3c09..9d4939d79f 100644 --- a/Items/Placeables/Banners/StormlionBanner.cs +++ b/Items/Placeables/Banners/StormlionBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 78f2010fbc..105f996b5f 100644 --- a/Items/Placeables/Banners/SulfurousSkaterBanner.cs +++ b/Items/Placeables/Banners/SulfurousSkaterBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 1dd92c983e..3808dbe1a9 100644 --- a/Items/Placeables/Banners/SunBatBanner.cs +++ b/Items/Placeables/Banners/SunBatBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 7218e83b9a..1e67f48e45 100644 --- a/Items/Placeables/Banners/SunskaterBanner.cs +++ b/Items/Placeables/Banners/SunskaterBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 2f8c6408a3..abf75e18e4 100644 --- a/Items/Placeables/Banners/TopazCrawlerBanner.cs +++ b/Items/Placeables/Banners/TopazCrawlerBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 6a7b032f05..a6879f643f 100644 --- a/Items/Placeables/Banners/ToxicMinnowBanner.cs +++ b/Items/Placeables/Banners/ToxicMinnowBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 8ce4e2c091..3dd4a32d4a 100644 --- a/Items/Placeables/Banners/TrasherBanner.cs +++ b/Items/Placeables/Banners/TrasherBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 ec137ee2fa..3308a4e7ff 100644 --- a/Items/Placeables/Banners/TrilobiteBanner.cs +++ b/Items/Placeables/Banners/TrilobiteBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 f8adb6039c..6985b7c46c 100644 --- a/Items/Placeables/Banners/ViperfishBanner.cs +++ b/Items/Placeables/Banners/ViperfishBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 a752842fb5..6958748fa2 100644 --- a/Items/Placeables/Banners/VirulingBanner.cs +++ b/Items/Placeables/Banners/VirulingBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b204dbe622..039d965ff9 100644 --- a/Items/Placeables/Banners/WaterLeechBanner.cs +++ b/Items/Placeables/Banners/WaterLeechBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 ff900a9127..e922cc1898 100644 --- a/Items/Placeables/Banners/WulfrumDroneBanner.cs +++ b/Items/Placeables/Banners/WulfrumDroneBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 b2e15cf919..6cce7b1241 100644 --- a/Items/Placeables/Banners/WulfrumGyratorBanner.cs +++ b/Items/Placeables/Banners/WulfrumGyratorBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 bef6437bbb..08a292b0ef 100644 --- a/Items/Placeables/Banners/WulfrumHovercraftBanner.cs +++ b/Items/Placeables/Banners/WulfrumHovercraftBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 eff89d3773..24335eb384 100644 --- a/Items/Placeables/Banners/WulfrumPylonBanner.cs +++ b/Items/Placeables/Banners/WulfrumPylonBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 00af6ecb9c..17645b980f 100644 --- a/Items/Placeables/Banners/WulfrumRoverBanner.cs +++ b/Items/Placeables/Banners/WulfrumRoverBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + 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 f3b561b2d6..16e32e088e 100644 --- a/Items/Placeables/Banners/WulfrumSlimeBanner.cs +++ b/Items/Placeables/Banners/WulfrumSlimeBanner.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.Banners item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.value = Item.buyPrice(0, 0, 10, 0); item.createTile = ModContent.TileType(); item.placeStyle = 51; diff --git a/Items/Placeables/BrimstoneSlag.cs b/Items/Placeables/BrimstoneSlag.cs index fbaaaba216..3c67c407a4 100644 --- a/Items/Placeables/BrimstoneSlag.cs +++ b/Items/Placeables/BrimstoneSlag.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = 1000; - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Placeables/ChaoticBrick.cs b/Items/Placeables/ChaoticBrick.cs index c43f026b1e..cc5c4adfe8 100644 --- a/Items/Placeables/ChaoticBrick.cs +++ b/Items/Placeables/ChaoticBrick.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables item.height = 25; item.maxStack = 999; item.value = 0; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.useTurn = true; item.autoReuse = true; item.useAnimation = 15; @@ -28,13 +28,13 @@ namespace CalamityMod.Items.Placeables recipe.AddIngredient(ItemID.StoneBlock, 1); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddTile(TileID.Furnaces); - recipe.SetResult(this, 1); + recipe.SetResult(this, 10); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddTile(TileID.WorkBenches); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddRecipe(); } } diff --git a/Items/Placeables/CryonicBrick.cs b/Items/Placeables/CryonicBrick.cs index 502aebbd95..ca5c178dfa 100644 --- a/Items/Placeables/CryonicBrick.cs +++ b/Items/Placeables/CryonicBrick.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Items.Placeables ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); + recipe.SetResult(this, 10); recipe.AddTile(TileID.Furnaces); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs index 4ec3d667e4..15be843626 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryConsoleItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs index 566453f036..bf7de02de5 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryContainmentBoxItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs index 6608dd63dd..7a3567f5fb 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDisplayItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs index 45f8de1d62..c459f47d24 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryDoorItem.cs @@ -30,10 +30,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs index c52b954564..00060e99f8 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryElectricPanelItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs index 1db6297b0d..1cf9a75f4d 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryScreenItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs index 7f6077532d..9c91fdd271 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryServerItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs index 7a8a5f3465..59e4b2d095 100644 --- a/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/AgedLaboratoryTerminalItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs index d967ab4856..2518a54e45 100644 --- a/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/AgedReinforcedCrateItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 3); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/Furniture/AgedSecurityChest.cs b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs similarity index 75% rename from Items/Placeables/Furniture/AgedSecurityChest.cs rename to Items/Placeables/DraedonStructures/AgedSecurityChest.cs index ffd6e29272..c6a7e40eff 100644 --- a/Items/Placeables/Furniture/AgedSecurityChest.cs +++ b/Items/Placeables/DraedonStructures/AgedSecurityChest.cs @@ -1,8 +1,9 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture + +namespace CalamityMod.Items.Placeables.DraedonStructures { public class AgedSecurityChest : ModItem { @@ -20,18 +21,21 @@ namespace CalamityMod.Items.Placeables.Furniture item.autoReuse = true; item.useAnimation = 15; item.useTime = 14; - item.rare = 2; + item.rare = ItemRarityID.Green; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.useStyle = ItemUseStyleID.SwingThrow; 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(ItemID.IronBar, 4); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.IronBar, 2); recipe.anyIronBar = true; recipe.AddTile(TileID.Anvils); recipe.SetResult(this); diff --git a/Items/Placeables/Furniture/AgedSecurityChest.png b/Items/Placeables/DraedonStructures/AgedSecurityChest.png similarity index 100% rename from Items/Placeables/Furniture/AgedSecurityChest.png rename to Items/Placeables/DraedonStructures/AgedSecurityChest.png diff --git a/Items/Placeables/DraedonsChargingStation.cs b/Items/Placeables/DraedonStructures/ChargingStationItem.cs similarity index 59% rename from Items/Placeables/DraedonsChargingStation.cs rename to Items/Placeables/DraedonStructures/ChargingStationItem.cs index 3346d2aa33..5fb7b19267 100644 --- a/Items/Placeables/DraedonsChargingStation.cs +++ b/Items/Placeables/DraedonStructures/ChargingStationItem.cs @@ -1,16 +1,17 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.DraedonStructures { - public class DraedonsChargingStation : ModItem + public class ChargingStationItem : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Draedon's Charging Station"); - Tooltip.SetDefault("Charges Draedon's weaponry using Power Cells"); + DisplayName.SetDefault("Charging Station"); + Tooltip.SetDefault("Charges Draedon's Arsenal items using Power Cells\n" + + "Place both an item and Power Cells into the Charging Station to charge the item"); } public override void SetDefaults() @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Placeables item.useAnimation = item.useTime = 15; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DraedonRust; diff --git a/Items/Placeables/DraedonsChargingStation.png b/Items/Placeables/DraedonStructures/ChargingStationItem.png similarity index 100% rename from Items/Placeables/DraedonsChargingStation.png rename to Items/Placeables/DraedonStructures/ChargingStationItem.png diff --git a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs index 335d5d507e..b6b9f0fd84 100644 --- a/Items/Placeables/DraedonStructures/HazardChevronPanels.cs +++ b/Items/Placeables/DraedonStructures/HazardChevronPanels.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs new file mode 100644 index 0000000000..53b4998656 --- /dev/null +++ b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.cs @@ -0,0 +1,46 @@ +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.DraedonStructures +{ + public class LabHologramProjectorItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lab Hologram Projector"); + } + + 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(); + } + + 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(); + } + } +} diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.png b/Items/Placeables/DraedonStructures/LabHologramProjectorItem.png similarity index 100% rename from Items/Placeables/Furniture/HolographicDisplayBox.png rename to Items/Placeables/DraedonStructures/LabHologramProjectorItem.png diff --git a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs index 3b13ed430e..899b3bd591 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryConsoleItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs index 18b1fc0ad5..6fdad7ca68 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryContainmentBoxItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs index d79773dce3..44221b4bbd 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDisplayItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs index 9be10984b8..ddaaf9e678 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryDoorItem.cs @@ -30,10 +30,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs b/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs index 6b8a3d943d..37dabb0009 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryElectricPanelItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs index 5cd9552ce0..0ca2646d1a 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPanels.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPanels.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures recipe.AddIngredient(ItemID.IronBar); recipe.anyIronBar = true; recipe.AddIngredient(ItemID.StoneBlock, 3); - recipe.SetResult(this, 3); + recipe.SetResult(this, 25); recipe.AddTile(TileID.HeavyWorkBench); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs index bfb926f87b..7bd079fbdc 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryPlating.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryPlating.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures recipe.AddIngredient(ItemID.IronBar); recipe.anyIronBar = true; recipe.AddIngredient(ItemID.StoneBlock, 3); - recipe.SetResult(this, 3); + recipe.SetResult(this, 25); recipe.AddTile(TileID.HeavyWorkBench); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs index 8511d91401..94e8bd4b2b 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryScreenItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs index 71c6447599..687df979e9 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryServerItem.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs index 961b752e7c..f27005376f 100644 --- a/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs +++ b/Items/Placeables/DraedonStructures/LaboratoryTerminalItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonsFuelFactoryItem.cs b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs similarity index 69% rename from Items/Placeables/DraedonsFuelFactoryItem.cs rename to Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs index a167ceacaf..72d467535d 100644 --- a/Items/Placeables/DraedonsFuelFactoryItem.cs +++ b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.cs @@ -1,16 +1,16 @@ -using CalamityMod.Tiles; +using CalamityMod.Tiles.DraedonStructures; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.DraedonStructures { - public class DraedonsFuelFactoryItem : ModItem + public class PowerCellFactoryItem : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Draedon's Fuel Factory"); - Tooltip.SetDefault("Produces Draedon Power Cells over time"); + DisplayName.SetDefault("Power Cell Factory"); + Tooltip.SetDefault("Produces Draedon Power Cells over time\n" + "One cell is produced every 15 seconds"); } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables item.useAnimation = item.useTime = 15; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.createTile = ModContent.TileType(); + item.createTile = ModContent.TileType(); item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DraedonRust; diff --git a/Items/Placeables/DraedonsFuelFactoryItem.png b/Items/Placeables/DraedonStructures/PowerCellFactoryItem.png similarity index 100% rename from Items/Placeables/DraedonsFuelFactoryItem.png rename to Items/Placeables/DraedonStructures/PowerCellFactoryItem.png diff --git a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs index 8391de2a5a..d03d8367cf 100644 --- a/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs +++ b/Items/Placeables/DraedonStructures/ReinforcedCrateItem.cs @@ -28,10 +28,9 @@ namespace CalamityMod.Items.Placeables.DraedonStructures public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 5); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.SetResult(this, 1); + recipe.AddIngredient(ModContent.ItemType(), 7); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); } diff --git a/Items/Placeables/DraedonStructures/RustedPlating.cs b/Items/Placeables/DraedonStructures/RustedPlating.cs index a94d9924fb..bfd247d948 100644 --- a/Items/Placeables/DraedonStructures/RustedPlating.cs +++ b/Items/Placeables/DraedonStructures/RustedPlating.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.DraedonStructures recipe.AddIngredient(ItemID.IronBar); recipe.anyIronBar = true; recipe.AddIngredient(ItemID.StoneBlock, 3); - recipe.SetResult(this, 3); + recipe.SetResult(this, 25); recipe.AddTile(TileID.HeavyWorkBench); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/Placeables/Furniture/SecurityChest.cs b/Items/Placeables/DraedonStructures/SecurityChest.cs similarity index 62% rename from Items/Placeables/Furniture/SecurityChest.cs rename to Items/Placeables/DraedonStructures/SecurityChest.cs index a0ddc56b21..47dfe82ed9 100644 --- a/Items/Placeables/Furniture/SecurityChest.cs +++ b/Items/Placeables/DraedonStructures/SecurityChest.cs @@ -1,7 +1,9 @@ -using CalamityMod.Tiles; +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.DraedonStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture + +namespace CalamityMod.Items.Placeables.DraedonStructures { public class SecurityChest : ModItem { @@ -19,18 +21,22 @@ namespace CalamityMod.Items.Placeables.Furniture item.autoReuse = true; item.useAnimation = 15; item.useTime = 14; - item.rare = 3; + item.rare = ItemRarityID.Orange; + item.Calamity().customRarity = CalamityRarity.DraedonRust; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 500; item.createTile = ModContent.TileType(); } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.IronBar, 10); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.IronBar, 2); recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Placeables/Furniture/SecurityChest.png b/Items/Placeables/DraedonStructures/SecurityChest.png similarity index 100% rename from Items/Placeables/Furniture/SecurityChest.png rename to Items/Placeables/DraedonStructures/SecurityChest.png diff --git a/Items/Placeables/Furniture/AstralBeaconItem.cs b/Items/Placeables/Furniture/AstralBeaconItem.cs index 841a78c277..71ee4f157e 100644 --- a/Items/Placeables/Furniture/AstralBeaconItem.cs +++ b/Items/Placeables/Furniture/AstralBeaconItem.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.autoReuse = true; item.useAnimation = 15; item.useTime = 14; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/Furniture/AuricToilet.cs b/Items/Placeables/Furniture/AuricToilet.cs index dd31366603..1f2a57b496 100644 --- a/Items/Placeables/Furniture/AuricToilet.cs +++ b/Items/Placeables/Furniture/AuricToilet.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Placeables.FurnitureSilva; using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { @@ -24,10 +25,10 @@ namespace CalamityMod.Items.Placeables.Furniture item.autoReuse = true; item.useAnimation = 15; item.useTime = 10; - item.useStyle = 1; + item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.createTile = ModContent.TileType(); - item.Calamity().postMoonLordRarity = 15; + item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/BlueCandle.cs b/Items/Placeables/Furniture/BlueCandle.cs index b7d85d8553..e0a2a7009a 100644 --- a/Items/Placeables/Furniture/BlueCandle.cs +++ b/Items/Placeables/Furniture/BlueCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { DisplayName.SetDefault("Weightless Candle"); - Tooltip.SetDefault("When placed, nearby players gain 15% movement speed, 10% wing time, and 5% acceleration\n" + + Tooltip.SetDefault("When placed, nearby players gain 10% movement speed, 10% wing time, and 5% acceleration\n" + "'The floating flame seems to uplift your very spirit'"); } @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Placeables.Furniture item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = ItemRarityID.LightPurple; item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/CorruptionEffigy.cs b/Items/Placeables/Furniture/CorruptionEffigy.cs index 8fa2c09af0..5b65f39fc3 100644 --- a/Items/Placeables/Furniture/CorruptionEffigy.cs +++ b/Items/Placeables/Furniture/CorruptionEffigy.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetStaticDefaults() { DisplayName.SetDefault("Corruption Effigy"); - Tooltip.SetDefault("When placed down nearby players have their movement speed increased by 15% and crit chance by 10%\n" + - "Nearby players also suffer a 20% decrease to their damage reduction"); + Tooltip.SetDefault("When placed down, nearby players have their movement speed and crit chance increased by 10%\n" + + "Nearby players also suffer a 5% decrease to their damage reduction"); } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; + 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 fc6bddd353..5d2545b6e3 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index aae043ab5d..66a4c76f5c 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = 0; item.consumable = true; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvil.png b/Items/Placeables/Furniture/CraftingStations/CosmicAnvil.png new file mode 100644 index 0000000000..4f44e008d0 Binary files /dev/null and b/Items/Placeables/Furniture/CraftingStations/CosmicAnvil.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index ea2510ae06..e664e22816 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -1,14 +1,17 @@ using CalamityMod.Items.Materials; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { public class DraedonsForge : ModItem { + public override string Texture => "CalamityMod/Items/Placeables/Furniture/CraftingStations/CosmicAnvil"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Draedon's Forge"); - Tooltip.SetDefault("Used to craft uber-tier items"); + DisplayName.SetDefault("Cosmic Anvil"); + Tooltip.SetDefault("Used to craft Cosmilite tier items"); } public override void SetDefaults() @@ -22,8 +25,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.value = 5000000; - item.rare = 10; + item.value = Item.sellPrice(platinum: 1); + item.rare = ItemRarityID.Red; item.createTile = ModContent.TileType(); item.Calamity().customRarity = CalamityRarity.DarkBlue; } @@ -31,13 +34,14 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("HardmodeForge"); recipe.AddRecipeGroup("HardmodeAnvil"); + recipe.AddIngredient(ItemID.TinkerersWorkshop); recipe.AddIngredient(ItemID.LunarCraftingStation); recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 20); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.png b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.png deleted file mode 100644 index d0cad78ff5..0000000000 Binary files a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.png and /dev/null differ diff --git a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs index c4f6d12f5c..6fe2ecb430 100644 --- a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs +++ b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddRecipeGroup("AnyGoldBar", 5); recipe.SetResult(this); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.png b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.png index b2b1fc41f3..aec3989d27 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/VoidCondenser.png and b/Items/Placeables/Furniture/CraftingStations/VoidCondenser.png differ diff --git a/Items/Placeables/Furniture/CrimsonEffigy.cs b/Items/Placeables/Furniture/CrimsonEffigy.cs index 33f172db0d..657512104f 100644 --- a/Items/Placeables/Furniture/CrimsonEffigy.cs +++ b/Items/Placeables/Furniture/CrimsonEffigy.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture { DisplayName.SetDefault("Crimson Effigy"); Tooltip.SetDefault("When placed down nearby players have their damage increased by 15% and defense by 10\n" + - "Nearby players also suffer a 20% decrease to their maximum health"); + "Nearby players also suffer a 10% decrease to their maximum health"); } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index 2104794598..77cdce5811 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.createTile = ModContent.TileType(); } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs index 8fd17add27..e8f9ec88f8 100644 --- a/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AbyssFountainItem.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 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 518ca1e943..3c7cfb6ab1 100644 --- a/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/AstralFountainItem.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 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 9b76db1934..2a91aba0f6 100644 --- a/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs +++ b/Items/Placeables/Furniture/Fountains/SulphurousFountainItem.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 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 d796c97787..eeada78753 100644 --- a/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs +++ b/Items/Placeables/Furniture/Fountains/SunkenSeaFountain.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Fountains item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 0; + item.rare = ItemRarityID.White; item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/PiggyCage.cs b/Items/Placeables/Furniture/PiggyCage.cs index 93352b20b9..5c99ea73e8 100644 --- a/Items/Placeables/Furniture/PiggyCage.cs +++ b/Items/Placeables/Furniture/PiggyCage.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { - public class PiggyCage : ModItem + public class PiggyCage : ModItem { public override void SetStaticDefaults() { @@ -24,7 +24,8 @@ namespace CalamityMod.Items.Placeables.Furniture item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.createTile = ModContent.TileType(); - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.Calamity().donorItem = true; } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/PinkCandle.cs b/Items/Placeables/Furniture/PinkCandle.cs index 25300ade45..db07f9acfa 100644 --- a/Items/Placeables/Furniture/PinkCandle.cs +++ b/Items/Placeables/Furniture/PinkCandle.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Placeables.Furniture item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = ItemRarityID.LightPurple; item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/PurpleCandle.cs b/Items/Placeables/Furniture/PurpleCandle.cs index b927ded18d..b6c58da4b6 100644 --- a/Items/Placeables/Furniture/PurpleCandle.cs +++ b/Items/Placeables/Furniture/PurpleCandle.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Placeables.Furniture item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = ItemRarityID.LightPurple; item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs index c2c772e9fc..b436c27c57 100644 --- a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.createTile = ModContent.TileType(); item.placeStyle = 27; } diff --git a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs index 3b8118122e..a2a0b39a41 100644 --- a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.createTile = ModContent.TileType(); item.placeStyle = 23; } diff --git a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.png b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.png index 0f296f3bd6..30bbcf8eeb 100644 Binary files a/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.png and b/Items/Placeables/Furniture/Trophies/AquaticScourgeTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs b/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs index 0ee7ab393d..e9bee17a2e 100644 --- a/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrageldonTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 6bc3824e5e..b6e39d49e9 100644 --- a/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/AstrumDeusTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 635e64b756..1e193c7965 100644 --- a/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BrimstoneElementalTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 b54347c801..cd5f1b4d76 100644 --- a/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/BumblebirbTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 3531e9ffb9..2c6ffcd0f1 100644 --- a/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CalamitasTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 050e5e5dcd..fc3f25b7b0 100644 --- a/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CataclysmTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 83ce3dc1ee..5d7d692455 100644 --- a/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CatastropheTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 cafd13e2a6..cd774936eb 100644 --- a/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CeaselessVoidTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 4fb039f75e..3f614145e0 100644 --- a/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CrabulonTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 7f388ab42c..d0438b84bf 100644 --- a/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/CryogenTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 9becaa9747..7a5d7a2c36 100644 --- a/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DesertScourgeTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 b94f93296b..da3dd9f98c 100644 --- a/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/DevourerofGodsTrophy.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 340b2d13a1..58b49843d5 100644 --- a/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/HiveMindTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 1f21b2cf7f..6141515b35 100644 --- a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 c835466e09..a4234b71a1 100644 --- a/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/OldDukeTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 6311f7cd6a..6e6ae210a7 100644 --- a/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PerforatorTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 a14ee9ebeb..e0cb5aaa23 100644 --- a/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PlaguebringerGoliathTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 da56d6861e..56307ef9ea 100644 --- a/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/PolterghastTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 277a403418..82391b6e2d 100644 --- a/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProfanedGuardianTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 e7ffbcdf24..6603e8838e 100644 --- a/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/ProvidenceTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 1c968db2a4..2cbc00986e 100644 --- a/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/RavagerTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 2421e2707d..85eabcdd0e 100644 --- a/Items/Placeables/Furniture/Trophies/SignusTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SignusTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 799aebdaa9..f5c3d3cb90 100644 --- a/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SlimeGodTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 e99c6bcbe1..a8d0d6862f 100644 --- a/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/SupremeCalamitasTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.createTile = ModContent.TileType(); item.placeStyle = 26; } diff --git a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs index 574644403f..2b88d9e56d 100644 --- a/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/WeaverTrophy.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies { public override void SetStaticDefaults() { - DisplayName.SetDefault("Weaver Trophy"); + DisplayName.SetDefault("Storm Weaver Trophy"); } public override void SetDefaults() @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + 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 d53a9068e6..7d0f145d0f 100644 --- a/Items/Placeables/Furniture/Trophies/YharonTrophy.cs +++ b/Items/Placeables/Furniture/Trophies/YharonTrophy.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Trophies item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 50000; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.createTile = ModContent.TileType(); item.placeStyle = 10; } diff --git a/Items/Placeables/Furniture/YellowCandle.cs b/Items/Placeables/Furniture/YellowCandle.cs index 476942ce18..e34825ab46 100644 --- a/Items/Placeables/Furniture/YellowCandle.cs +++ b/Items/Placeables/Furniture/YellowCandle.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Placeables.Furniture { DisplayName.SetDefault("Spiteful Candle"); Tooltip.SetDefault("When placed, nearby enemies take 5% more damage.\n" + - "This extra damage bypasses enemy damage reduction\n" + + "This extra damage bypasses enemy damage reduction and defense\n" + "'Its hateful glow flickers with ire'"); } @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Placeables.Furniture item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; - item.value = Item.buyPrice(0, 50, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(0, 25, 0, 0); + item.rare = ItemRarityID.LightPurple; item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/FurnitureAbyss/AbyssTable.cs b/Items/Placeables/FurnitureAbyss/AbyssTable.cs index f7304e950a..c156b11358 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssTable.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssTable.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { @@ -23,6 +23,9 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss 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(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs index 0fc323094f..a6951a9822 100644 --- a/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs +++ b/Items/Placeables/FurnitureAbyss/AbyssWorkbench.cs @@ -1,6 +1,6 @@ using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAbyss { @@ -24,6 +24,9 @@ namespace CalamityMod.Items.Placeables.FurnitureAbyss 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(); } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index d914d7e460..78453a775f 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientBath.cs b/Items/Placeables/FurnitureAncient/AncientBath.cs index 4338212a38..a0ea3edd86 100644 --- a/Items/Placeables/FurnitureAncient/AncientBath.cs +++ b/Items/Placeables/FurnitureAncient/AncientBath.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index b38529aac4..1050ad718e 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index 89f36a00eb..e75298b755 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = 0; item.consumable = true; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index e8947763a8..2f43ce8666 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index 72ad41722f..2b23cb8c35 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index d20d621654..b0b4b5e04f 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index d6468e2dca..78a13f85b8 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index f01f15b2a9..4d9539a46d 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index 222c81bd81..a877fd0edb 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index 1ee3f5fc63..cc7987add8 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientPiano.cs b/Items/Placeables/FurnitureAncient/AncientPiano.cs index adfcc88daa..40eb255075 100644 --- a/Items/Placeables/FurnitureAncient/AncientPiano.cs +++ b/Items/Placeables/FurnitureAncient/AncientPiano.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index dff549f129..055eafc407 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index 2b519310cc..4ca9b1e0b8 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index 75d1c64f0c..726cc31688 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs index bac946d479..46a493b91a 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkbench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkbench.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index e5dcfc817b..5c7b3a1b53 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = 0; item.consumable = true; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenBath.cs b/Items/Placeables/FurnitureAshen/AshenBath.cs index ae79bc1306..92ba7e57ef 100644 --- a/Items/Placeables/FurnitureAshen/AshenBath.cs +++ b/Items/Placeables/FurnitureAshen/AshenBath.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = 0; item.consumable = true; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenBed.cs b/Items/Placeables/FurnitureAshen/AshenBed.cs index d9d1d667dd..e7b671274d 100644 --- a/Items/Placeables/FurnitureAshen/AshenBed.cs +++ b/Items/Placeables/FurnitureAshen/AshenBed.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenBookcase.cs b/Items/Placeables/FurnitureAshen/AshenBookcase.cs index 65b9f1beff..03c30a03ed 100644 --- a/Items/Placeables/FurnitureAshen/AshenBookcase.cs +++ b/Items/Placeables/FurnitureAshen/AshenBookcase.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs index 30bed14326..a3f05994f9 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandelabra.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandelabra.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenCandle.cs b/Items/Placeables/FurnitureAshen/AshenCandle.cs index eec0e44e53..1efe4af2f0 100644 --- a/Items/Placeables/FurnitureAshen/AshenCandle.cs +++ b/Items/Placeables/FurnitureAshen/AshenCandle.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenChair.cs b/Items/Placeables/FurnitureAshen/AshenChair.cs index 235e683615..06f48ba9c5 100644 --- a/Items/Placeables/FurnitureAshen/AshenChair.cs +++ b/Items/Placeables/FurnitureAshen/AshenChair.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.autoReuse = true; item.useAnimation = 15; item.useTime = 10; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useStyle = ItemUseStyleID.SwingThrow; item.consumable = true; item.value = 0; diff --git a/Items/Placeables/FurnitureAshen/AshenChandelier.cs b/Items/Placeables/FurnitureAshen/AshenChandelier.cs index 9a64236795..2acca65242 100644 --- a/Items/Placeables/FurnitureAshen/AshenChandelier.cs +++ b/Items/Placeables/FurnitureAshen/AshenChandelier.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenChest.cs b/Items/Placeables/FurnitureAshen/AshenChest.cs index 96d7609ba8..36d9e654a3 100644 --- a/Items/Placeables/FurnitureAshen/AshenChest.cs +++ b/Items/Placeables/FurnitureAshen/AshenChest.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenDoor.cs b/Items/Placeables/FurnitureAshen/AshenDoor.cs index bf09508d75..322bb7287e 100644 --- a/Items/Placeables/FurnitureAshen/AshenDoor.cs +++ b/Items/Placeables/FurnitureAshen/AshenDoor.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenDresser.cs b/Items/Placeables/FurnitureAshen/AshenDresser.cs index a8b453fce2..f2e93473c7 100644 --- a/Items/Placeables/FurnitureAshen/AshenDresser.cs +++ b/Items/Placeables/FurnitureAshen/AshenDresser.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenLamp.cs b/Items/Placeables/FurnitureAshen/AshenLamp.cs index 7cb84aec92..15579e6a23 100644 --- a/Items/Placeables/FurnitureAshen/AshenLamp.cs +++ b/Items/Placeables/FurnitureAshen/AshenLamp.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenLantern.cs b/Items/Placeables/FurnitureAshen/AshenLantern.cs index 16f65d9d77..139b413a48 100644 --- a/Items/Placeables/FurnitureAshen/AshenLantern.cs +++ b/Items/Placeables/FurnitureAshen/AshenLantern.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenMonolith.cs b/Items/Placeables/FurnitureAshen/AshenMonolith.cs index 7d93012023..7c1b13e34b 100644 --- a/Items/Placeables/FurnitureAshen/AshenMonolith.cs +++ b/Items/Placeables/FurnitureAshen/AshenMonolith.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenPiano.cs b/Items/Placeables/FurnitureAshen/AshenPiano.cs index 7159bff7a2..84b23e4afd 100644 --- a/Items/Placeables/FurnitureAshen/AshenPiano.cs +++ b/Items/Placeables/FurnitureAshen/AshenPiano.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenPlatform.cs b/Items/Placeables/FurnitureAshen/AshenPlatform.cs index 73f9ccaf64..7e9996df31 100644 --- a/Items/Placeables/FurnitureAshen/AshenPlatform.cs +++ b/Items/Placeables/FurnitureAshen/AshenPlatform.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.createTile = ModContent.TileType(); } diff --git a/Items/Placeables/FurnitureAshen/AshenSink.cs b/Items/Placeables/FurnitureAshen/AshenSink.cs index 835b4bdd9c..b10977c831 100644 --- a/Items/Placeables/FurnitureAshen/AshenSink.cs +++ b/Items/Placeables/FurnitureAshen/AshenSink.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenSlab.cs b/Items/Placeables/FurnitureAshen/AshenSlab.cs index 6543245d06..88a5b9ca5e 100644 --- a/Items/Placeables/FurnitureAshen/AshenSlab.cs +++ b/Items/Placeables/FurnitureAshen/AshenSlab.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.createTile = ModContent.TileType(); } diff --git a/Items/Placeables/FurnitureAshen/AshenSofa.cs b/Items/Placeables/FurnitureAshen/AshenSofa.cs index b135f8376f..f473c6b30e 100644 --- a/Items/Placeables/FurnitureAshen/AshenSofa.cs +++ b/Items/Placeables/FurnitureAshen/AshenSofa.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenTable.cs b/Items/Placeables/FurnitureAshen/AshenTable.cs index 644e5c0a81..ea83e9873d 100644 --- a/Items/Placeables/FurnitureAshen/AshenTable.cs +++ b/Items/Placeables/FurnitureAshen/AshenTable.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs index 89672ff7b9..9cd24d1e49 100644 --- a/Items/Placeables/FurnitureAshen/AshenWorkbench.cs +++ b/Items/Placeables/FurnitureAshen/AshenWorkbench.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.value = 0; item.createTile = ModContent.TileType(); diff --git a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs index 2d8b746f70..49af824d1a 100644 --- a/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Items/Placeables/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen item.useAnimation = 15; item.useTime = 10; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.createTile = ModContent.TileType(); } diff --git a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs index 817c688806..7067ed9f50 100644 --- a/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Items/Placeables/FurniturePlaguedPlate/PlaguedPlate.cs @@ -30,8 +30,7 @@ namespace CalamityMod.Items.Placeables.FurniturePlaguedPlate { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.StoneBlock, 10); - recipe.anyIronBar = true; - recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 10); recipe.AddTile(ModContent.TileType()); recipe.AddRecipe(); diff --git a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs index 52dc6f2398..0ba123cb02 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCrystal.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCrystal.cs @@ -30,11 +30,10 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CrystalBlock, 200); recipe.AddRecipeGroup("AnyGoldBar", 25); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 400); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.png b/Items/Placeables/FurnitureStratus/StratusBathtub.png index 62b3e465f3..1e2883a811 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusBathtub.png and b/Items/Placeables/FurnitureStratus/StratusBathtub.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusBed.png b/Items/Placeables/FurnitureStratus/StratusBed.png index b639e4706c..d756f3b2c9 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusBed.png and b/Items/Placeables/FurnitureStratus/StratusBed.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.png b/Items/Placeables/FurnitureStratus/StratusBookcase.png index 47689c13f9..c0f802069f 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusBookcase.png and b/Items/Placeables/FurnitureStratus/StratusBookcase.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusBricks.png b/Items/Placeables/FurnitureStratus/StratusBricks.png index afe0a1534b..633ac18e06 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusBricks.png and b/Items/Placeables/FurnitureStratus/StratusBricks.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.png b/Items/Placeables/FurnitureStratus/StratusCandelabra.png index 39f33d7f13..b9b22edf89 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusCandelabra.png and b/Items/Placeables/FurnitureStratus/StratusCandelabra.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.png b/Items/Placeables/FurnitureStratus/StratusCandle.png index a11ef5a0b5..2d0d36d06e 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusCandle.png and b/Items/Placeables/FurnitureStratus/StratusCandle.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusChair.png b/Items/Placeables/FurnitureStratus/StratusChair.png index 52a0589125..d5649a7ca1 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusChair.png and b/Items/Placeables/FurnitureStratus/StratusChair.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.png b/Items/Placeables/FurnitureStratus/StratusChandelier.png index 1e450c448e..5384acad14 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusChandelier.png and b/Items/Placeables/FurnitureStratus/StratusChandelier.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusChest.png b/Items/Placeables/FurnitureStratus/StratusChest.png index 4b1b4f7787..fa6c5afea9 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusChest.png and b/Items/Placeables/FurnitureStratus/StratusChest.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.png b/Items/Placeables/FurnitureStratus/StratusDoor.png index 04614fd6c1..e8b86aecc8 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusDoor.png and b/Items/Placeables/FurnitureStratus/StratusDoor.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.png b/Items/Placeables/FurnitureStratus/StratusDresser.png index c05d362d40..9e09dc19d8 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusDresser.png and b/Items/Placeables/FurnitureStratus/StratusDresser.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.png b/Items/Placeables/FurnitureStratus/StratusLamp.png index f943742f65..3eeefc45f8 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusLamp.png and b/Items/Placeables/FurnitureStratus/StratusLamp.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.png b/Items/Placeables/FurnitureStratus/StratusLantern.png index 10c96473ed..80a5d0f6dd 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusLantern.png and b/Items/Placeables/FurnitureStratus/StratusLantern.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.png b/Items/Placeables/FurnitureStratus/StratusPiano.png index d23c90825b..d6c7527f86 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusPiano.png and b/Items/Placeables/FurnitureStratus/StratusPiano.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusPlatform.png b/Items/Placeables/FurnitureStratus/StratusPlatform.png index dcdcf37818..27caff0c25 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusPlatform.png and b/Items/Placeables/FurnitureStratus/StratusPlatform.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusSink.png b/Items/Placeables/FurnitureStratus/StratusSink.png index afac8f629a..6607d9d26f 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusSink.png and b/Items/Placeables/FurnitureStratus/StratusSink.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.png b/Items/Placeables/FurnitureStratus/StratusSofa.png index a5ade83284..79b3947880 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusSofa.png and b/Items/Placeables/FurnitureStratus/StratusSofa.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs new file mode 100644 index 0000000000..8f538963f9 --- /dev/null +++ b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.cs @@ -0,0 +1,33 @@ +using CalamityMod.Tiles.FurnitureStratus; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureStratus +{ + public class StratusStarPlatformItem : ModItem + { + 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(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.SetResult(this, 2); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.png b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.png new file mode 100644 index 0000000000..07a163a220 Binary files /dev/null and b/Items/Placeables/FurnitureStratus/StratusStarPlatformItem.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusTable.png b/Items/Placeables/FurnitureStratus/StratusTable.png index 839a4bd297..a58f6ddeea 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusTable.png and b/Items/Placeables/FurnitureStratus/StratusTable.png differ diff --git a/Items/Placeables/FurnitureStratus/StratusWorkbench.png b/Items/Placeables/FurnitureStratus/StratusWorkbench.png index 9aec85be30..19e284c7ed 100644 Binary files a/Items/Placeables/FurnitureStratus/StratusWorkbench.png and b/Items/Placeables/FurnitureStratus/StratusWorkbench.png differ diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png index a4f87d3144..fa07bcd54f 100644 Binary files a/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png and b/Items/Placeables/FurnitureVoid/SmoothVoidstonePlatform.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidBath.png b/Items/Placeables/FurnitureVoid/VoidBath.png index 4f0ad12713..3642eba796 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidBath.png and b/Items/Placeables/FurnitureVoid/VoidBath.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidBed.png b/Items/Placeables/FurnitureVoid/VoidBed.png index 7e200bf914..12aeae1881 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidBed.png and b/Items/Placeables/FurnitureVoid/VoidBed.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidBookcase.png b/Items/Placeables/FurnitureVoid/VoidBookcase.png index 2e1321d68f..9ea1a02b46 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidBookcase.png and b/Items/Placeables/FurnitureVoid/VoidBookcase.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidCandelabra.png b/Items/Placeables/FurnitureVoid/VoidCandelabra.png index 7a04fbf90d..4b4e635767 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidCandelabra.png and b/Items/Placeables/FurnitureVoid/VoidCandelabra.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidCandle.png b/Items/Placeables/FurnitureVoid/VoidCandle.png index cab8a4f80f..67cc7d3315 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidCandle.png and b/Items/Placeables/FurnitureVoid/VoidCandle.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidChair.png b/Items/Placeables/FurnitureVoid/VoidChair.png index 693ee310f2..76e55c3107 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidChair.png and b/Items/Placeables/FurnitureVoid/VoidChair.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidChandelier.png b/Items/Placeables/FurnitureVoid/VoidChandelier.png index 0fc5b28890..125c68bdab 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidChandelier.png and b/Items/Placeables/FurnitureVoid/VoidChandelier.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidChest.png b/Items/Placeables/FurnitureVoid/VoidChest.png index c3da75e1a6..9ab3ebb151 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidChest.png and b/Items/Placeables/FurnitureVoid/VoidChest.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidClock.png b/Items/Placeables/FurnitureVoid/VoidClock.png index 33cf4cf3b6..8cff76c0e5 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidClock.png and b/Items/Placeables/FurnitureVoid/VoidClock.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidDoor.png b/Items/Placeables/FurnitureVoid/VoidDoor.png index 79a1e82ac6..a770c45939 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidDoor.png and b/Items/Placeables/FurnitureVoid/VoidDoor.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidDresser.png b/Items/Placeables/FurnitureVoid/VoidDresser.png index 0dbb8ef311..5789feb6f5 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidDresser.png and b/Items/Placeables/FurnitureVoid/VoidDresser.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidLamp.png b/Items/Placeables/FurnitureVoid/VoidLamp.png index 3e7a73bc88..e252da9d06 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidLamp.png and b/Items/Placeables/FurnitureVoid/VoidLamp.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidLantern.png b/Items/Placeables/FurnitureVoid/VoidLantern.png index 023846d83f..a0718bcefe 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidLantern.png and b/Items/Placeables/FurnitureVoid/VoidLantern.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidPiano.png b/Items/Placeables/FurnitureVoid/VoidPiano.png index d449f8d3ee..769e27bf23 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidPiano.png and b/Items/Placeables/FurnitureVoid/VoidPiano.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidSink.png b/Items/Placeables/FurnitureVoid/VoidSink.png index 64726add2c..ccf03caa6b 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidSink.png and b/Items/Placeables/FurnitureVoid/VoidSink.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidSofa.png b/Items/Placeables/FurnitureVoid/VoidSofa.png index c88fe97c5a..efaf0c7dda 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidSofa.png and b/Items/Placeables/FurnitureVoid/VoidSofa.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidTable.png b/Items/Placeables/FurnitureVoid/VoidTable.png index e28b9b00b2..54acb8053d 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidTable.png and b/Items/Placeables/FurnitureVoid/VoidTable.png differ diff --git a/Items/Placeables/FurnitureVoid/VoidWorkbench.png b/Items/Placeables/FurnitureVoid/VoidWorkbench.png index bc085a95a0..1affd97771 100644 Binary files a/Items/Placeables/FurnitureVoid/VoidWorkbench.png and b/Items/Placeables/FurnitureVoid/VoidWorkbench.png differ diff --git a/Items/Placeables/Ores/AerialiteOre.cs b/Items/Placeables/Ores/AerialiteOre.cs index 5a9a448138..6728c7cccc 100644 --- a/Items/Placeables/Ores/AerialiteOre.cs +++ b/Items/Placeables/Ores/AerialiteOre.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 3; + item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Placeables/Ores/AstralOre.cs b/Items/Placeables/Ores/AstralOre.cs index 69bc1a7864..7966323619 100644 --- a/Items/Placeables/Ores/AstralOre.cs +++ b/Items/Placeables/Ores/AstralOre.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 20; item.maxStack = 999; item.value = Item.sellPrice(silver: 36); - item.rare = 9; + item.rare = ItemRarityID.Cyan; } } } diff --git a/Items/Placeables/Ores/ChaoticOre.cs b/Items/Placeables/Ores/ChaoticOre.cs index 462f52744c..05f892f685 100644 --- a/Items/Placeables/Ores/ChaoticOre.cs +++ b/Items/Placeables/Ores/ChaoticOre.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 24); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } } } diff --git a/Items/Placeables/Ores/CharredOre.cs b/Items/Placeables/Ores/CharredOre.cs index bf4d6c81d3..b06fef6273 100644 --- a/Items/Placeables/Ores/CharredOre.cs +++ b/Items/Placeables/Ores/CharredOre.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 16; item.maxStack = 999; item.value = Item.sellPrice(silver: 15); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; } } } diff --git a/Items/Placeables/Ores/CryonicOre.cs b/Items/Placeables/Ores/CryonicOre.cs index 827a46f994..5b69580343 100644 --- a/Items/Placeables/Ores/CryonicOre.cs +++ b/Items/Placeables/Ores/CryonicOre.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 12); - item.rare = 5; + item.rare = ItemRarityID.Pink; } } } diff --git a/Items/Placeables/Ores/ExodiumClusterOre.cs b/Items/Placeables/Ores/ExodiumClusterOre.cs index 7bb3081407..e07a97465b 100644 --- a/Items/Placeables/Ores/ExodiumClusterOre.cs +++ b/Items/Placeables/Ores/ExodiumClusterOre.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(gold: 1, silver: 60); - item.rare = 10; + item.rare = ItemRarityID.Red; } public override void AddRecipes() diff --git a/Items/Placeables/Furniture/HolographicDisplayBox.cs b/Items/Placeables/Ores/HallowedOre.cs similarity index 50% rename from Items/Placeables/Furniture/HolographicDisplayBox.cs rename to Items/Placeables/Ores/HallowedOre.cs index bc54b6ff89..1178a42cf0 100644 --- a/Items/Placeables/Furniture/HolographicDisplayBox.cs +++ b/Items/Placeables/Ores/HallowedOre.cs @@ -1,31 +1,30 @@ -using CalamityMod.Tiles; using Terraria; -using Terraria.ID; using Terraria.ModLoader; +using Terraria.ID; -namespace CalamityMod.Items.Placeables.Furniture +namespace CalamityMod.Items.Placeables.Ores { - public class HolographicDisplayBox : ModItem + public class HallowedOre : ModItem { public override void SetStaticDefaults() { - DisplayName.SetDefault("Holographic Display Box"); + DisplayName.SetDefault("Hallowed Ore"); } public override void SetDefaults() { - item.width = 22; - item.height = 32; - item.maxStack = 99; + item.createTile = ModContent.TileType(); + item.useStyle = ItemUseStyleID.SwingThrow; item.useTurn = true; - item.autoReuse = true; item.useAnimation = 15; item.useTime = 10; - item.useStyle = ItemUseStyleID.SwingThrow; + item.autoReuse = true; item.consumable = true; - item.value = Item.buyPrice(0, 5, 0, 0); - item.rare = 3; - item.createTile = ModContent.TileType(); + 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 2f3981d1f7..eb630da67f 100644 --- a/Items/Placeables/Ores/PerennialOre.cs +++ b/Items/Placeables/Ores/PerennialOre.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables.Ores item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 18); - item.rare = 7; + item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Placeables/Ores/PerennialOre.png b/Items/Placeables/Ores/PerennialOre.png index 2251c05622..bad3aea6ad 100644 Binary files a/Items/Placeables/Ores/PerennialOre.png and b/Items/Placeables/Ores/PerennialOre.png differ diff --git a/Items/Placeables/Ores/UelibloomOre.cs b/Items/Placeables/Ores/UelibloomOre.cs index fe9d27737d..849d4f9c43 100644 --- a/Items/Placeables/Ores/UelibloomOre.cs +++ b/Items/Placeables/Ores/UelibloomOre.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables.Ores item.width = 10; item.height = 10; item.maxStack = 999; - item.rare = 10; + item.rare = ItemRarityID.Red; item.value = Item.sellPrice(silver: 50); } diff --git a/Items/Placeables/PerennialBrick.cs b/Items/Placeables/PerennialBrick.cs index b93e5b270d..95a98c5da8 100644 --- a/Items/Placeables/PerennialBrick.cs +++ b/Items/Placeables/PerennialBrick.cs @@ -29,12 +29,12 @@ namespace CalamityMod.Items.Placeables ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 1); recipe.AddIngredient(ItemID.StoneBlock, 1); - recipe.SetResult(this, 1); + recipe.SetResult(this, 10); recipe.AddTile(TileID.Furnaces); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } diff --git a/Items/Placeables/PerennialBrick.png b/Items/Placeables/PerennialBrick.png index 58b2949b40..b88e57b447 100644 Binary files a/Items/Placeables/PerennialBrick.png and b/Items/Placeables/PerennialBrick.png differ diff --git a/Items/Placeables/PlantyMush.cs b/Items/Placeables/PlantyMush.cs index bcb1df91d4..b9c09fdcee 100644 --- a/Items/Placeables/PlantyMush.cs +++ b/Items/Placeables/PlantyMush.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 6); - item.rare = 3; + 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 1ed58dbae8..b387b742c0 100644 --- a/Items/Placeables/Plates/Chaosplate.cs +++ b/Items/Placeables/Plates/Chaosplate.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Plates item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Placeables/Plates/Cinderplate.cs b/Items/Placeables/Plates/Cinderplate.cs index b289aac06d..ef9c105f86 100644 --- a/Items/Placeables/Plates/Cinderplate.cs +++ b/Items/Placeables/Plates/Cinderplate.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Plates item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Placeables/Plates/Elumplate.cs b/Items/Placeables/Plates/Elumplate.cs index 878d78364c..dad221c1d9 100644 --- a/Items/Placeables/Plates/Elumplate.cs +++ b/Items/Placeables/Plates/Elumplate.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Plates item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Placeables/Plates/Navyplate.cs b/Items/Placeables/Plates/Navyplate.cs index 2879b31339..d003c62577 100644 --- a/Items/Placeables/Plates/Navyplate.cs +++ b/Items/Placeables/Plates/Navyplate.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Placeables.Plates item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Placeables/Plates/PlagueContainmentCells.cs b/Items/Placeables/Plates/PlagueContainmentCells.cs index 6f59c79fc4..75339f086a 100644 --- a/Items/Placeables/Plates/PlagueContainmentCells.cs +++ b/Items/Placeables/Plates/PlagueContainmentCells.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Plates item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() diff --git a/Items/Placeables/PrismShard.cs b/Items/Placeables/PrismShard.cs index 517835f1bf..67a30ff6f3 100644 --- a/Items/Placeables/PrismShard.cs +++ b/Items/Placeables/PrismShard.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables item.height = 26; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); - item.rare = 2; + item.rare = ItemRarityID.Green; } } } diff --git a/Items/Placeables/SCalAltarItem.cs b/Items/Placeables/SCalAltarItem.cs new file mode 100644 index 0000000000..1d015749e5 --- /dev/null +++ b/Items/Placeables/SCalAltarItem.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables +{ + public class SCalAltarItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitous Altar"); + Tooltip.SetDefault("Death\n" + + "Allows you to summon Supreme Calamitas with Ashes of Calamity\n" + + "She creates a large square arena of blocks upon being summoned\n" + + "When she is summoned the arena will spawn around her with her at the center\n" + + "During the battle, heart pickups will heal half as much HP"); + } + + 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; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/SCalAltarItem.png b/Items/Placeables/SCalAltarItem.png new file mode 100644 index 0000000000..c4bb03cb8b Binary files /dev/null and b/Items/Placeables/SCalAltarItem.png differ diff --git a/Items/Placeables/SeaPrism.cs b/Items/Placeables/SeaPrism.cs index 9166f710dc..7f4298ace6 100644 --- a/Items/Placeables/SeaPrism.cs +++ b/Items/Placeables/SeaPrism.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 10); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void AddRecipes() diff --git a/Items/Placeables/Tenebris.cs b/Items/Placeables/Tenebris.cs index f320acc050..c94778d9f9 100644 --- a/Items/Placeables/Tenebris.cs +++ b/Items/Placeables/Tenebris.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Placeables item.height = 10; item.maxStack = 999; item.value = Item.sellPrice(silver: 8); - item.rare = 7; + item.rare = ItemRarityID.Lime; } } } diff --git a/Items/Placeables/UelibloomBrick.cs b/Items/Placeables/UelibloomBrick.cs index 2e8c44954e..e6aa1fd588 100644 --- a/Items/Placeables/UelibloomBrick.cs +++ b/Items/Placeables/UelibloomBrick.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Placeables ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.StoneBlock); - recipe.SetResult(this); + recipe.SetResult(this, 10); recipe.AddTile(TileID.AdamantiteForge); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/Placeables/Walls/AshenSlabWall.cs b/Items/Placeables/Walls/AshenSlabWall.cs index e507ded4b0..d4558da685 100644 --- a/Items/Placeables/Walls/AshenSlabWall.cs +++ b/Items/Placeables/Walls/AshenSlabWall.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.Walls item.useAnimation = 15; item.useTime = 7; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.createWall = ModContent.WallType(); } diff --git a/Items/Placeables/Walls/ChaoticBrickWall.png b/Items/Placeables/Walls/ChaoticBrickWall.png index 229c02d89c..ae8bf102b0 100644 Binary files a/Items/Placeables/Walls/ChaoticBrickWall.png and b/Items/Placeables/Walls/ChaoticBrickWall.png differ diff --git a/Items/Placeables/Walls/CinderplateWall.cs b/Items/Placeables/Walls/CinderplateWall.cs index 6b9f5e0c53..3956151d38 100644 --- a/Items/Placeables/Walls/CinderplateWall.cs +++ b/Items/Placeables/Walls/CinderplateWall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Placeables.Walls ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 4); - recipe.AddTile(18); + recipe.AddTile(TileID.WorkBenches); recipe.AddRecipe(); } } diff --git a/Items/Placeables/Walls/PerennialBrickWall.png b/Items/Placeables/Walls/PerennialBrickWall.png index 49e55bd1a8..e0301850f8 100644 Binary files a/Items/Placeables/Walls/PerennialBrickWall.png and b/Items/Placeables/Walls/PerennialBrickWall.png differ diff --git a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs index 1dc311d536..35ad3e2e82 100644 --- a/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs +++ b/Items/Placeables/Walls/SmoothBrimstoneSlagWall.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.Walls item.useAnimation = 15; item.useTime = 7; item.useStyle = ItemUseStyleID.SwingThrow; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.consumable = true; item.createWall = ModContent.WallType(); } diff --git a/Items/Placeables/Walls/StratusWall.png b/Items/Placeables/Walls/StratusWall.png index fe13f83c34..693079e5e6 100644 Binary files a/Items/Placeables/Walls/StratusWall.png and b/Items/Placeables/Walls/StratusWall.png differ diff --git a/Items/Placeables/Walls/SulphurousSandWall.cs b/Items/Placeables/Walls/SulphurousSandWall.cs index 0335702073..88c2d7d835 100644 --- a/Items/Placeables/Walls/SulphurousSandWall.cs +++ b/Items/Placeables/Walls/SulphurousSandWall.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Placeables.Walls { ModRecipe recipe = new ModRecipe(mod); recipe.AddTile( - 18); + TileID.WorkBenches); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 4); recipe.AddRecipe(); diff --git a/Items/Placeables/Walls/SulphurousSandstoneWall.cs b/Items/Placeables/Walls/SulphurousSandstoneWall.cs index 3c260a5e7b..1d63434216 100644 --- a/Items/Placeables/Walls/SulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/SulphurousSandstoneWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Walls public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddTile(18); + recipe.AddTile(TileID.WorkBenches); recipe.AddIngredient(ModContent.ItemType()); recipe.SetResult(this, 4); recipe.AddRecipe(); diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index 5977d1cb65..d8667a3bfd 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Bloody Mary"); Tooltip.SetDefault(@"Extra spicy and bloody! -Boosts damage, movement speed, and melee speed by 15% and crit chance by 7% during a Blood Moon -Reduces life regen by 2 and defense by 6"); +Boosts damage by 15%, movement speed by 10%, melee speed by 15% and crit chance by 7% during a Blood Moon +Reduces life regen by 2 and defense by 4%"); } public override void SetDefaults() @@ -21,15 +21,15 @@ Reduces life regen by 2 and defense by 6"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 3; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 10, 0, 0); + 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 a111e0d38f..4782aa0ece 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Caribbean Rum"); Tooltip.SetDefault(@"Why is the rum gone? -Boosts life regen by 2 and movement speed and wing flight time by 20% -Makes you floaty and reduces defense by 12"); +Boosts life regen by 2, movement speed by 10% and wing flight time by 20% +Makes you floaty and reduces defense by 10%"); } public override void SetDefaults() @@ -21,15 +21,15 @@ Makes you floaty and reduces defense by 12"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 20, 0, 0); + 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 cde44bd371..f90441a393 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -11,10 +11,10 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Cinnamon Roll"); Tooltip.SetDefault(@"A great-tasting cinnamon whiskey with a touch of cream soda -Boosts mana regeneration rate and all fire-based weapon damage by 15% +Boosts mana regeneration rate and multiplies all fire-based weapon damage by 1.1 Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit The weapon must be more fire-related than anything else -Reduces defense by 12"); +Reduces defense by 10%"); } public override void SetDefaults() @@ -23,15 +23,15 @@ Reduces defense by 12"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); + 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 872d2126c5..e753566106 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("Everclear"); Tooltip.SetDefault(@"This is the most potent booze I have, be careful with it Boosts damage by 25% -Reduces life regen by 10 and defense by 40"); +Reduces life regen by 10 and defense by 30%"); } public override void SetDefaults() @@ -21,15 +21,15 @@ Reduces life regen by 10 and defense by 40"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 900; //15 seconds - item.value = Item.buyPrice(0, 6, 60, 0); + 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 b7b3ca9307..234647eb09 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Evergreen Gin"); Tooltip.SetDefault(@"It tastes like a Christmas tree if you can imagine that -Boosts nature-based weapon damage by 15% and damage reduction by 5% +Multiplies nature-based weapon damage by 1.1 and increases damage reduction by 5% Reduces life regen by 1"); } @@ -21,15 +21,15 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); + 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 812c007e92..304812563b 100644 --- a/Items/Potions/Alcohol/FabsolsVodka.cs +++ b/Items/Potions/Alcohol/FabsolsVodka.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Fabsol's Vodka"); - Tooltip.SetDefault("Boosts all damage stats by 8% but lowers defense by 20\n" + + Tooltip.SetDefault("Boosts all damage stats by 8% but lowers defense by 10%\n" + "Increases immune time after being struck"); } @@ -21,15 +21,15 @@ namespace CalamityMod.Items.Potions.Alcohol item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 3; + 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 = 54000; - item.value = Item.buyPrice(0, 10, 0, 0); + item.buffTime = CalamityUtils.SecondsToFrames(900f); + item.value = Item.buyPrice(0, 2, 60, 0); } public override void AddRecipes() @@ -43,8 +43,9 @@ namespace CalamityMod.Items.Potions.Alcohol recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrystalShard); recipe.AddIngredient(ModContent.ItemType(), 40); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Ale); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index 4d87fd005e..749c870248 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Fireball"); Tooltip.SetDefault(@"A great-tasting cinnamon whiskey -Boosts all fire-based weapon damage by 10% +Multiplies all fire-based weapon damage by 1.05 Cursed flame, shadowflame, god slayer inferno, brimstone flame, and frostburn weapons will not receive this benefit The weapon must be more fire-related than anything else Reduces life regen by 1"); @@ -23,15 +23,15 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 6, 60, 0); + 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 b1d26d692c..85d21f4780 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Grape Beer"); Tooltip.SetDefault(@"This crap is abhorrent but you might like it -Reduces defense by 2 and movement speed by 5%"); +Reduces defense by 3% and movement speed by 5%"); } public override void SetDefaults() @@ -23,7 +23,7 @@ Reduces defense by 2 and movement speed by 5%"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.useAnimation = 17; item.useTime = 17; item.useStyle = ItemUseStyleID.EatingUsing; @@ -32,7 +32,7 @@ Reduces defense by 2 and movement speed by 5%"); item.healMana = 100; item.consumable = true; item.potion = true; - item.value = Item.buyPrice(0, 0, 65, 0); + 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 dfd90a17d6..1c6bc9181f 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("Margarita"); Tooltip.SetDefault(@"One of the best drinks ever created, enjoy it while it lasts Reduces the duration of most debuffs -Reduces defense by 6 and life regen by 1 +Reduces defense by 6% and life regen by 1 3 minute duration"); } @@ -28,7 +28,7 @@ Reduces defense by 6 and life regen by 1 item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 17; item.useTime = 17; item.useStyle = ItemUseStyleID.EatingUsing; @@ -37,7 +37,7 @@ Reduces defense by 6 and life regen by 1 item.potion = true; item.healLife = 200; item.healMana = 200; - item.value = Item.buyPrice(0, 23, 30, 0); + 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 d6b4630518..ae17bc8d3c 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -21,15 +21,15 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 3, 30, 0); + 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 e2d8c6abe0..ca584e3c85 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -21,15 +21,15 @@ Reduces life regen by 2"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); + 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 c8f34dfd96..983d631458 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -10,7 +10,9 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { DisplayName.SetDefault("Odd Mushroom"); - Tooltip.SetDefault("Trippy"); + Tooltip.SetDefault("Causes you to see many fake, vibrant copies of all nearby entities\n" + + "These visual effects may be nauseating or otherwise bad for some\n" + + "Trippy"); } public override void SetDefaults() @@ -21,13 +23,13 @@ namespace CalamityMod.Items.Potions.Alcohol item.maxStack = 30; item.useAnimation = 17; item.useTime = 17; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useStyle = ItemUseStyleID.EatingUsing; item.UseSound = SoundID.Item2; item.consumable = true; item.buffType = ModContent.BuffType(); - item.buffTime = 216000; - item.value = Item.buyPrice(1, 0, 0, 0); + 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 b49f10ed18..6f4477393e 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -21,7 +21,7 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.useAnimation = 17; item.useTime = 17; item.useStyle = ItemUseStyleID.EatingUsing; @@ -29,7 +29,7 @@ Reduces life regen by 1"); item.healLife = 200; item.consumable = true; item.potion = true; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = Item.buyPrice(0, 0, 65, 0); } public override bool CanUseItem(Player player) diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index ad5efb2135..74b052145e 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("Rum"); Tooltip.SetDefault(@"Sweet and potent, just how I like it Boosts life regen by 2 and movement speed by 10% -Reduces defense by 8"); +Reduces defense by 5%"); } public override void SetDefaults() @@ -21,15 +21,15 @@ Reduces defense by 8"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 5, 0, 0); + 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 b70b8f0eb6..2848c8dd9a 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Screwdriver"); Tooltip.SetDefault(@"Do you have a screw loose? -Boosts piercing projectile damage by 10% +Multiplies piercing projectile damage by 1.05 Reduces life regen by 1"); } @@ -21,15 +21,15 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 16, 60, 0); + 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 7d3a010bce..8d7c2654bf 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions.Alcohol Tooltip.SetDefault(@"Made from some stuff I found near the Astral Meteor crash site, don't worry it's safe, trust me Boosts max mana by 50, magic damage by 8%, and reduces mana usage by 10% -Reduces defense by 6 and life regen by 1"); +Reduces defense by 6% and life regen by 1"); } public override void SetDefaults() @@ -22,15 +22,15 @@ Reduces defense by 6 and life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 3; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 13, 30, 0); + 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 09aa8468bf..96639a20b5 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -21,15 +21,15 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 5, 0, 0); + 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 ccdeb1e250..5dec0ba446 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions.Alcohol { DisplayName.SetDefault("Tequila Sunrise"); Tooltip.SetDefault(@"The greatest daytime drink I've ever had -Boosts damage, damage reduction, and knockback by 7%, crit chance by 3%, and defense by 15 during daytime +Boosts damage, damage reduction, and knockback by 7%, crit chance by 3%, and defense by 10 during daytime Reduces life regen by 1"); } @@ -21,15 +21,15 @@ Reduces life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 20, 0, 0); + 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 1b1647d0e8..3ff69866fd 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("Vodka"); Tooltip.SetDefault(@"The number one alcohol for creating great mixed drinks Boosts damage by 6% and critical strike chance by 2% -Reduces life regen by 1 and defense by 4"); +Reduces life regen by 1 and defense by 5%"); } public override void SetDefaults() @@ -21,15 +21,15 @@ Reduces life regen by 1 and defense by 4"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 3, 30, 0); + 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 54cc55b724..1191ff0736 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("Whiskey"); Tooltip.SetDefault(@"The burning sensation makes it tastier Boosts damage and knockback by 4% and critical strike chance by 2% -Reduces defense by 8"); +Reduces defense by 5%"); } public override void SetDefaults() @@ -21,15 +21,15 @@ Reduces defense by 8"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 2; + 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 = 18000; //5 minutes - item.value = Item.buyPrice(0, 3, 30, 0); + 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 9b215662e6..c6cf4ecda6 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions.Alcohol DisplayName.SetDefault("White Wine"); Tooltip.SetDefault(@"I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day Boosts magic damage by 10% -Reduces defense by 6 and life regen by 1"); +Reduces defense by 6% and life regen by 1"); } public override void SetDefaults() @@ -22,7 +22,7 @@ Reduces defense by 6 and life regen by 1"); item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.useAnimation = 17; item.useTime = 17; item.useStyle = ItemUseStyleID.EatingUsing; @@ -30,8 +30,8 @@ Reduces defense by 6 and life regen by 1"); item.consumable = true; item.healMana = 400; item.buffType = ModContent.BuffType(); - item.buffTime = 10800; //3 minutes - item.value = Item.buyPrice(0, 16, 60, 0); + item.buffTime = CalamityUtils.SecondsToFrames(300f); + item.value = Item.buyPrice(0, 4, 0, 0); } public override bool UseItem(Player player) diff --git a/Items/Potions/AnechoicCoating.cs b/Items/Potions/AnechoicCoating.cs index 2ec329c4d4..f42af3fdc6 100644 --- a/Items/Potions/AnechoicCoating.cs +++ b/Items/Potions/AnechoicCoating.cs @@ -20,26 +20,20 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 3; + 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 = 7200; + item.buffTime = CalamityUtils.SecondsToFrames(240f); item.value = Item.buyPrice(0, 2, 0, 0); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ItemID.BottledWater); recipe.AddTile(TileID.AlchemyTable); diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs index bea213c75b..2dbb36cc2a 100644 --- a/Items/Potions/AstralInjection.cs +++ b/Items/Potions/AstralInjection.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 180; + item.buffTime = CalamityUtils.SecondsToFrames(5f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Potions recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this, 4); + recipe.SetResult(this, 8); recipe.AddRecipe(); } } diff --git a/Items/Potions/AstralJelly.cs b/Items/Potions/AstralJelly.cs index 491ff3ace1..6ecf79c388 100644 --- a/Items/Potions/AstralJelly.cs +++ b/Items/Potions/AstralJelly.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.maxStack = 30; item.useAnimation = 17; item.useTime = 17; - item.rare = 7; + 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 = 21600; + item.buffTime = CalamityUtils.SecondsToFrames(360f); } public override bool UseItem(Player player) diff --git a/Items/Potions/Baguette.cs b/Items/Potions/Baguette.cs index 8236baf7bf..87bb19c5db 100644 --- a/Items/Potions/Baguette.cs +++ b/Items/Potions/Baguette.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Potions { DisplayName.SetDefault("Baguette"); Tooltip.SetDefault("Minor improvements to all stats\n" + - "Boosts the effects of Red Wine\n" + - "[c/FCE391:je suis Monte]"); + "Boosts the effects of Red Wine\n" + + "[c/FCE391:je suis Monte]"); } public override void SetDefaults() @@ -23,19 +23,21 @@ namespace CalamityMod.Items.Potions item.maxStack = 30; item.useAnimation = 17; item.useTime = 17; - item.rare = 1; item.useStyle = ItemUseStyleID.EatingUsing; item.UseSound = SoundID.Item2; item.consumable = true; - item.value = Item.buyPrice(0, 0, 50, 0); + + item.value = Item.sellPrice(silver: 1); + item.rare = ItemRarityID.Blue; + item.Calamity().donorItem = true; + item.buffType = ModContent.BuffType(); item.buffTime = CalamityUtils.SecondsToFrames(300f); - item.Calamity().customRarity = CalamityRarity.Dedicated; } public override void OnConsumeItem(Player player) { - //5 minutes for both + //5 minutes for both player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(300f)); player.AddBuff(BuffID.WellFed, CalamityUtils.SecondsToFrames(300f)); } diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs index b5e6d45a15..e2a87ed16a 100644 --- a/Items/Potions/BoundingPotion.cs +++ b/Items/Potions/BoundingPotion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Bounding Potion"); - Tooltip.SetDefault("Grants 10% increased jump speed, 25 extra blocks of fall damage resistance, and increased jump height"); + Tooltip.SetDefault("Grants 5% increased jump speed, 25 extra blocks of fall damage resistance, and increased jump height"); } public override void SetDefaults() @@ -20,14 +20,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 10800; + item.buffTime = CalamityUtils.SecondsToFrames(300f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Potions ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); recipe.AddIngredient(ItemID.Frog); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Vine); recipe.AddTile(TileID.Bottles); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Potions/CadencePotion.cs b/Items/Potions/CadencePotion.cs index 4211e098ae..312bfe6117 100644 --- a/Items/Potions/CadencePotion.cs +++ b/Items/Potions/CadencePotion.cs @@ -20,17 +20,17 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { item.width = 28; - item.height = 18; + item.height = 38; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/CadencePotion.png b/Items/Potions/CadencePotion.png index fe7763574b..1cc6566f97 100644 Binary files a/Items/Potions/CadencePotion.png and b/Items/Potions/CadencePotion.png differ diff --git a/Items/Potions/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs index edca20e9b1..885a90793b 100644 --- a/Items/Potions/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions { DisplayName.SetDefault("Calamitas' Brew"); Tooltip.SetDefault("Adds abyssal flames to your melee projectiles and melee attacks\n" + - "Increases your movement speed by 15%"); + "Increases your movement speed by 10%"); } public override void SetDefaults() @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Potions item.height = 30; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 36000; + item.buffTime = CalamityUtils.SecondsToFrames(900f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/CalciumPotion.cs b/Items/Potions/CalciumPotion.cs index 2ae5e02014..6283bdef61 100644 --- a/Items/Potions/CalciumPotion.cs +++ b/Items/Potions/CalciumPotion.cs @@ -20,14 +20,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 36000; + item.buffTime = CalamityUtils.SecondsToFrames(900f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs index e7f0db58cc..d03ca1cb07 100644 --- a/Items/Potions/CeaselessHungerPotion.cs +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -20,14 +20,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 600; + item.buffTime = CalamityUtils.SecondsToFrames(10f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/CrumblingPotion.cs index d8d6b5b14d..bd5bccdbea 100644 --- a/Items/Potions/CrumblingPotion.cs +++ b/Items/Potions/CrumblingPotion.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Potions ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater, 5); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this, 5); @@ -45,6 +44,7 @@ namespace CalamityMod.Items.Potions 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(); diff --git a/Items/Potions/DeliciousMeat.cs b/Items/Potions/DeliciousMeat.cs index 05def0868c..3c875d4438 100644 --- a/Items/Potions/DeliciousMeat.cs +++ b/Items/Potions/DeliciousMeat.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Potions item.width = 32; item.height = 30; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.maxStack = 30; item.consumable = true; item.useAnimation = 17; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Potions item.useStyle = ItemUseStyleID.EatingUsing; item.useTurn = true; item.buffType = BuffID.WellFed; - item.buffTime = 108000; + item.buffTime = CalamityUtils.SecondsToFrames(1800f); } } } diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index 435e5f5e3c..e1bf89dabc 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -12,9 +12,8 @@ namespace CalamityMod.Items.Potions { DisplayName.SetDefault("Draconic Elixir"); Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" + - "God slayer revival heals you to half HP instead of 150 HP when triggered\n" + "Silva invincibility heals you to half HP when triggered\n" + - "If you trigger the above heals you cannot drink this potion again for 60 seconds and you gain 30 seconds of potion sickness"); + "If you trigger the above heal you cannot drink this potion again for 60 seconds and you gain 30 seconds of potion sickness"); } public override void SetDefaults() @@ -23,14 +22,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs index 7f4fe5fa42..1c85032f36 100644 --- a/Items/Potions/GravityNormalizerPotion.cs +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/HolyWrathPotion.cs index e9ce32dc5f..b477b84ca7 100644 --- a/Items/Potions/HolyWrathPotion.cs +++ b/Items/Potions/HolyWrathPotion.cs @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 10800; + item.buffTime = CalamityUtils.SecondsToFrames(300f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index d7e71db6ba..dfea163aa9 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -26,10 +26,10 @@ namespace CalamityMod.Items.Potions item.UseSound = SoundID.Item3; item.consumable = true; item.potion = true; - item.rare = 10; item.value = Item.buyPrice(0, 7, 0, 0); - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override void AddRecipes() { diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs index ef185ed897..eead413817 100644 --- a/Items/Potions/PenumbraPotion.cs +++ b/Items/Potions/PenumbraPotion.cs @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -38,8 +38,7 @@ namespace CalamityMod.Items.Potions ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ItemID.LunarTabletFragment, 2); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarTabletFragment); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs index 05c380d3b9..02475a648e 100644 --- a/Items/Potions/PhotosynthesisPotion.cs +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -36,8 +36,7 @@ namespace CalamityMod.Items.Potions { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.AlchemyTable); @@ -46,6 +45,7 @@ namespace CalamityMod.Items.Potions 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(); diff --git a/Items/Potions/PotionofOmniscience.cs b/Items/Potions/PotionofOmniscience.cs index 3a3cbf39fa..f164c8d12a 100644 --- a/Items/Potions/PotionofOmniscience.cs +++ b/Items/Potions/PotionofOmniscience.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 36000; + item.buffTime = CalamityUtils.SecondsToFrames(900f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs index d885297232..4433276eba 100644 --- a/Items/Potions/ProfanedRagePotion.cs +++ b/Items/Potions/ProfanedRagePotion.cs @@ -12,24 +12,23 @@ namespace CalamityMod.Items.Potions { DisplayName.SetDefault("Profaned Rage Potion"); Tooltip.SetDefault("Increases critical strike chance by 12% and increases movement and horizontal flight speed by 5%\n" + - "In Revengeance Mode you gain more rage when damaged\n" + "While this potion's buff is active the Rage Potion's buff is disabled"); } public override void SetDefaults() { - item.width = 28; - item.height = 18; + item.width = 34; + item.height = 42; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 10800; + item.buffTime = CalamityUtils.SecondsToFrames(300f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/ProfanedRagePotion.png b/Items/Potions/ProfanedRagePotion.png index bf88fd779d..3e9d7340d3 100644 Binary files a/Items/Potions/ProfanedRagePotion.png and b/Items/Potions/ProfanedRagePotion.png differ diff --git a/Items/Potions/PurifiedJam.cs b/Items/Potions/PurifiedJam.cs index d403e9f29c..da903bc65b 100644 --- a/Items/Potions/PurifiedJam.cs +++ b/Items/Potions/PurifiedJam.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.Potions; using CalamityMod.World; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,10 +12,9 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Purified Jam"); - Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + + Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds\n" + "Causes potion sickness when consumed\n" + - "Cannot be consumed while potion sickness is active\n" + - "Revengeance drop"); + "Cannot be consumed while potion sickness is active"); } public override void SetDefaults() @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useAnimation = 17; item.useTime = 17; item.useStyle = ItemUseStyleID.EatingUsing; @@ -32,6 +32,20 @@ namespace CalamityMod.Items.Potions item.value = Item.buyPrice(0, 2, 0, 0); } + public override void ModifyTooltips(List list) + { + if (CalamityWorld.death || CalamityWorld.malice) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Makes you immune to all damage and most debuffs for 5 seconds"; + } + } + } + } + public override bool CanUseItem(Player player) { return player.FindBuffIndex(BuffID.PotionSickness) == -1; @@ -39,7 +53,7 @@ namespace CalamityMod.Items.Potions public override bool UseItem(Player player) { - player.AddBuff(ModContent.BuffType(), CalamityWorld.death ? 300 : 600); + player.AddBuff(ModContent.BuffType(), (CalamityWorld.death || CalamityWorld.malice) ? 300 : 600); player.AddBuff(BuffID.PotionSickness, player.pStone ? 1500 : 1800); return true; } diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs index 553f85e8d1..c8adee338e 100644 --- a/Items/Potions/RevivifyPotion.cs +++ b/Items/Potions/RevivifyPotion.cs @@ -21,14 +21,14 @@ namespace CalamityMod.Items.Potions item.height = 36; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 3600; + item.buffTime = CalamityUtils.SecondsToFrames(180f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs index aec0a954a0..91b6e5e6eb 100644 --- a/Items/Potions/ShadowPotion.cs +++ b/Items/Potions/ShadowPotion.cs @@ -24,14 +24,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useAnimation = 17; item.useTime = 17; - item.useStyle = 2; + item.useStyle = ItemUseStyleID.EatingUsing; item.UseSound = SoundID.Item3; item.consumable = true; item.buffType = ModContent.BuffType(); - item.buffTime = 18000; //5 minutes + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/ShatteringPotion.cs b/Items/Potions/ShatteringPotion.cs index bde143567e..8261560f18 100644 --- a/Items/Potions/ShatteringPotion.cs +++ b/Items/Potions/ShatteringPotion.cs @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index f4c764af50..5f6712d1ea 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -23,14 +23,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 14400; + item.buffTime = CalamityUtils.SecondsToFrames(360f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Potions { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ItemID.Feather); recipe.AddIngredient(ItemID.SoulofFlight); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.AlchemyTable); @@ -47,6 +46,7 @@ namespace CalamityMod.Items.Potions 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(); diff --git a/Items/Potions/SulphurskinPotion.cs b/Items/Potions/SulphurskinPotion.cs index 27c569846c..19a43532f4 100644 --- a/Items/Potions/SulphurskinPotion.cs +++ b/Items/Potions/SulphurskinPotion.cs @@ -20,14 +20,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 30; - item.rare = 3; + 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 = 7200; //2 minutes + item.buffTime = CalamityUtils.SecondsToFrames(240f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/SunkenStew.cs b/Items/Potions/SunkenStew.cs index 25978dbcf1..f147aee335 100644 --- a/Items/Potions/SunkenStew.cs +++ b/Items/Potions/SunkenStew.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Hadal Stew"); - Tooltip.SetDefault(@"Only gives 50 (37 with Philosopher's Stone) seconds of Potion Sickness -Grants Well Fed -60 minute duration"); + Tooltip.SetDefault("Only gives 50 seconds of Potion Sickness\n" + + "Grants Well Fed\n" + + "60 minute duration"); } public override void SetDefaults() @@ -30,7 +30,7 @@ Grants Well Fed item.maxStack = 30; item.useAnimation = 17; item.useTime = 17; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useStyle = ItemUseStyleID.EatingUsing; item.UseSound = SoundID.Item3; item.consumable = true; @@ -40,6 +40,20 @@ Grants Well Fed item.value = Item.buyPrice(0, 2, 0, 0); } + public override void ModifyTooltips(List list) + { + if (Main.LocalPlayer.pStone) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip0") + { + line2.text = "Only gives 37 seconds of Potion Sickness"; + } + } + } + } + public override bool CanUseItem(Player player) { return player.potionDelay <= 0 && player.Calamity().potionTimer <= 0; diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index f2e4638c9e..043b6118e6 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -25,9 +25,8 @@ namespace CalamityMod.Items.Potions item.UseSound = SoundID.Item3; item.consumable = true; item.potion = true; - item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.rare = ItemRarityID.Purple; + item.value = Item.buyPrice(0, 6, 50, 0); } public override void AddRecipes() diff --git a/Items/Potions/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs index 9a4e07e22e..887953dd45 100644 --- a/Items/Potions/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -24,9 +24,8 @@ namespace CalamityMod.Items.Potions item.useStyle = ItemUseStyleID.EatingUsing; item.UseSound = SoundID.Item3; item.consumable = true; - item.rare = 10; - item.value = Item.buyPrice(0, 6, 50, 0); - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.rare = ItemRarityID.Purple; + item.value = Item.buyPrice(0, 6, 50, 0); } public override void AddRecipes() diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs index d920ef0e38..d99c6f92c4 100644 --- a/Items/Potions/TeslaPotion.cs +++ b/Items/Potions/TeslaPotion.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Potions { DisplayName.SetDefault("Tesla Potion"); Tooltip.SetDefault("Summons an aura of electricity that electrifies and slows enemies\n" + - "Slowdown does not work on bosses\n" + + "Aura damage is reduced on bosses\n" + "Reduces the duration of the Electrified debuff"); } @@ -23,14 +23,14 @@ namespace CalamityMod.Items.Potions item.height = 26; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs index b6361ee788..824cd57dde 100644 --- a/Items/Potions/TitanScalePotion.cs +++ b/Items/Potions/TitanScalePotion.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Titan Scale Potion"); - Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%\n" + + Tooltip.SetDefault("Increases knockback, defense by 5 and damage reduction by 5%\n" + "Increases defense by 25 and damage reduction by 10% for a few seconds after a true melee strike"); } @@ -22,14 +22,14 @@ namespace CalamityMod.Items.Potions item.height = 34; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 18000; + item.buffTime = CalamityUtils.SecondsToFrames(480f); item.value = Item.buyPrice(0, 2, 0, 0); } diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs index 6f9861933b..9888a82ed0 100644 --- a/Items/Potions/TriumphPotion.cs +++ b/Items/Potions/TriumphPotion.cs @@ -20,14 +20,14 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 7200; + item.buffTime = CalamityUtils.SecondsToFrames(240f); item.value = Item.buyPrice(0, 2, 0, 0); } @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Potions { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BottledWater); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.Bottles); recipe.SetResult(this); diff --git a/Items/Potions/YharimsStimulants.cs b/Items/Potions/YharimsStimulants.cs index 226072f55e..d80b43e8cf 100644 --- a/Items/Potions/YharimsStimulants.cs +++ b/Items/Potions/YharimsStimulants.cs @@ -20,25 +20,24 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 108000; + 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.ArcheryPotion); - recipe.AddIngredient(ItemID.MagicPowerPotion); recipe.AddIngredient(ItemID.TitanPotion); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this); diff --git a/Items/Potions/ZenPotion.cs b/Items/Potions/ZenPotion.cs index 4b92fa67b1..02d6a706b9 100644 --- a/Items/Potions/ZenPotion.cs +++ b/Items/Potions/ZenPotion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Zen Potion"); - Tooltip.SetDefault("Reduces spawn rates...a lot..."); + Tooltip.SetDefault("Vastly decreases enemy spawn rate"); } public override void SetDefaults() @@ -20,31 +20,35 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); + item.buffTime = CalamityUtils.SecondsToFrames(900f); + item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.alchemy = true; + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ItemID.PinkGel); + recipe.AddIngredient(ItemID.Daybloom); recipe.AddIngredient(ItemID.BottledWater); 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(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ItemID.BottledWater); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Potions/ZergPotion.cs b/Items/Potions/ZergPotion.cs index 0a63d0e0bf..daf5d6b0c2 100644 --- a/Items/Potions/ZergPotion.cs +++ b/Items/Potions/ZergPotion.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Zerg Potion"); - Tooltip.SetDefault("Boosts spawn rates...a lot..."); + Tooltip.SetDefault("Vastly increases enemy spawn rate"); } public override void SetDefaults() @@ -20,31 +20,35 @@ namespace CalamityMod.Items.Potions item.height = 18; item.useTurn = true; item.maxStack = 999; - item.rare = 3; + 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 = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); + item.buffTime = CalamityUtils.SecondsToFrames(900f); + item.value = Item.buyPrice(gold: 2); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.alchemy = true; + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.BottledWater); 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(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ItemID.BottledWater); recipe.AddTile(TileID.AlchemyTable); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/RelicOfConvergence.cs b/Items/RelicOfConvergence.cs index 2c00a4ac3f..c4b4556fb7 100644 --- a/Items/RelicOfConvergence.cs +++ b/Items/RelicOfConvergence.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items DisplayName.SetDefault("Relic of Convergence"); Tooltip.SetDefault("Creates a profaned crystal that charges power\n" + "Holding out the crystal slows the player down\n" + - "At the end of its life, the crystal heals the player"); + "At the end of its life, the crystal heals the player for 70 HP"); } public override void SetDefaults() @@ -26,10 +26,9 @@ namespace CalamityMod.Items item.noMelee = true; item.noUseGraphic = true; item.channel = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.shoot = ModContent.ProjectileType(); + 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; diff --git a/Items/Rock.cs b/Items/Rock.cs index 49c2aa5bf0..15d49b2633 100644 --- a/Items/Rock.cs +++ b/Items/Rock.cs @@ -1,4 +1,6 @@ +using CalamityMod.Tiles; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items @@ -16,6 +18,13 @@ namespace CalamityMod.Items 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; } } } diff --git a/Items/SirenproofEarMuffs.cs b/Items/SirenproofEarMuffs.cs new file mode 100644 index 0000000000..08d020de02 --- /dev/null +++ b/Items/SirenproofEarMuffs.cs @@ -0,0 +1,39 @@ +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Materials; + +namespace CalamityMod.Items +{ + public class SirenproofEarMuffs : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sirenproof Earmuffs"); + Tooltip.SetDefault("Favorite this item to prevent Anahita from spawning near you"); + } + public override void SetDefaults() + { + item.width = 44; + item.height = 34; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + } + + public override void UpdateInventory(Player player) + { + 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(); + } + } +} diff --git a/Items/SirenproofEarMuffs.png b/Items/SirenproofEarMuffs.png new file mode 100644 index 0000000000..d523a0b58e Binary files /dev/null and b/Items/SirenproofEarMuffs.png differ diff --git a/Items/SummonItems/Abomination.cs b/Items/SummonItems/Abomination.cs index 5a2117782e..1b8cad366c 100644 --- a/Items/SummonItems/Abomination.cs +++ b/Items/SummonItems/Abomination.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.PlaguebringerGoliath; using Terraria; @@ -12,8 +13,7 @@ namespace CalamityMod.Items.SummonItems { DisplayName.SetDefault("Abombination"); Tooltip.SetDefault("Calls in the airborne jungle abomination\n" + - "Summons the Plaguebringer Goliath\n" + - "The boss enrages in the open air of the surface"); + "Summons the Plaguebringer Goliath"); } public override void SetDefaults() @@ -21,7 +21,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/AncientMedallion.cs b/Items/SummonItems/AncientMedallion.cs index 1301cdb8df..4aa128504c 100644 --- a/Items/SummonItems/AncientMedallion.cs +++ b/Items/SummonItems/AncientMedallion.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.NPCs.Ravager; using Terraria; using Terraria.ID; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.SummonItems item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && player.ZoneOverworldHeight; + return !NPC.AnyNPCs(ModContent.NPCType()) && player.ZoneOverworldHeight && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -35,7 +36,7 @@ namespace CalamityMod.Items.SummonItems Main.PlaySound(SoundID.Roar, player.position, 2); if (Main.netMode != NetmodeID.MultiplayerClient) { - int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 350f), ModContent.NPCType(), 1); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index 0c77219aaa..09ba7ef44d 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.AstrumAureus; using Terraria; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.SummonItems item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()); + return !Main.dayTime && player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -36,7 +37,7 @@ namespace CalamityMod.Items.SummonItems Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) { - int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-50, 50)), (int)(player.position.Y - 150f), ModContent.NPCType(), 1); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } diff --git a/Items/SummonItems/BirbPheromones.cs b/Items/SummonItems/BirbPheromones.cs index 1d685c1228..f545640620 100644 --- a/Items/SummonItems/BirbPheromones.cs +++ b/Items/SummonItems/BirbPheromones.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.NPCs.Bumblebirb; using Terraria; using Terraria.ID; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/BlightedEyeball.cs b/Items/SummonItems/BlightedEyeball.cs index 90f90a7f9c..c40fa5565a 100644 --- a/Items/SummonItems/BlightedEyeball.cs +++ b/Items/SummonItems/BlightedEyeball.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Calamitas; using Terraria; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.SummonItems { item.width = 28; item.height = 18; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -29,16 +30,16 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !Main.dayTime && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + return !Main.dayTime && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) { Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else - NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); + NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); return true; } diff --git a/Items/SummonItems/BloodwormItem.cs b/Items/SummonItems/BloodwormItem.cs index 206eb27123..c516e6dc5b 100644 --- a/Items/SummonItems/BloodwormItem.cs +++ b/Items/SummonItems/BloodwormItem.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 28; item.maxStack = 20; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; item.bait = 4444; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index a3ba4ac996..116c0fb345 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Perforator; using Terraria; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneCrimson && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneCrimson && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/BossRush.cs b/Items/SummonItems/BossRush.cs index 2866a82b21..6c51ee2a83 100644 --- a/Items/SummonItems/BossRush.cs +++ b/Items/SummonItems/BossRush.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.rare = 1; + item.rare = ItemRarityID.Blue; item.width = 28; item.height = 28; item.useAnimation = 45; @@ -34,39 +35,38 @@ namespace CalamityMod.Items.SummonItems { for (int doom = 0; doom < 200; doom++) { - if (Main.npc[doom].active && Main.npc[doom].boss) + NPC n = Main.npc[doom]; + if (!n.active) + continue; + + // will also correctly despawn EoW because none of his segments are boss flagged + bool shouldDespawn = n.boss || n.type == NPCID.EaterofWorldsHead || n.type == NPCID.EaterofWorldsBody || n.type == NPCID.EaterofWorldsTail; + if (shouldDespawn) { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; + n.active = false; + n.netUpdate = true; } } - if (!CalamityWorld.bossRushActive) + if (!BossRushEvent.BossRushActive) { - CalamityWorld.bossRushStage = 0; - CalamityWorld.bossRushActive = true; + BossRushEvent.BossRushStage = 0; + BossRushEvent.BossRushActive = true; string key = "Mods.CalamityMod.BossRushStartText"; Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } else { - CalamityWorld.bossRushStage = 0; - CalamityWorld.bossRushActive = false; + BossRushEvent.BossRushStage = 0; + BossRushEvent.BossRushActive = false; } - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); if (Main.netMode == NetmodeID.Server) { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Write(BossRushEvent.BossRushStage); netMessage.Send(); } return true; diff --git a/Items/SummonItems/BulbofDoom.cs b/Items/SummonItems/BulbofDoom.cs index 6652a650e7..b37a60b3d2 100644 --- a/Items/SummonItems/BulbofDoom.cs +++ b/Items/SummonItems/BulbofDoom.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -21,13 +22,13 @@ namespace CalamityMod.Items.SummonItems item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.consumable = true; } public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera); + return player.ZoneJungle && !NPC.AnyNPCs(NPCID.Plantera) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -48,7 +49,7 @@ namespace CalamityMod.Items.SummonItems recipe.AddIngredient(ItemID.SoulofNight, 10); recipe.AddIngredient(ItemID.SoulofLight, 10); recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.Vine); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/SummonItems/BulbofDoom.png b/Items/SummonItems/BulbofDoom.png index 561f824b4f..ca54003170 100644 Binary files a/Items/SummonItems/BulbofDoom.png and b/Items/SummonItems/BulbofDoom.png differ diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 90157e7442..7b36a235e4 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.NPCs.BrimstoneElemental; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -32,7 +33,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - return modPlayer.ZoneCalamity && !NPC.AnyNPCs(ModContent.NPCType()); + return modPlayer.ZoneCalamity && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -49,9 +50,10 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 5); + recipe.AddIngredient(ItemID.SoulofNight, 3); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.AdamantiteForge); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/SummonItems/ChickenEgg.cs b/Items/SummonItems/ChickenEgg.cs index 6b69a55354..b4b9ab55e0 100644 --- a/Items/SummonItems/ChickenEgg.cs +++ b/Items/SummonItems/ChickenEgg.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Yharon; using CalamityMod.World; @@ -25,12 +26,13 @@ namespace CalamityMod.Items.SummonItems item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; item.consumable = false; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.downedBossAny; + return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/CosmicWorm.cs b/Items/SummonItems/CosmicWorm.cs index f264d3278c..e5f3a08849 100644 --- a/Items/SummonItems/CosmicWorm.cs +++ b/Items/SummonItems/CosmicWorm.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.World; @@ -28,8 +29,9 @@ namespace CalamityMod.Items.SummonItems item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; item.consumable = false; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } public override void ModifyTooltips(List list) { @@ -45,19 +47,16 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; + return !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.DoGSecondStageCountdown <= 0 && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) { string key = "Mods.CalamityMod.EdgyBossText12"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); else diff --git a/Items/SummonItems/CryoKey.cs b/Items/SummonItems/CryoKey.cs index a5912cbbdc..5a99c6849e 100644 --- a/Items/SummonItems/CryoKey.cs +++ b/Items/SummonItems/CryoKey.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Cryogen; using Terraria; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneSnow && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneSnow && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -46,7 +47,7 @@ namespace CalamityMod.Items.SummonItems public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("AnyIceBlock", 50); + recipe.AddRecipeGroup("AnyIceBlock", 25); recipe.AddIngredient(ItemID.SoulofNight, 3); recipe.AddIngredient(ItemID.SoulofLight, 3); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 44ae8f77dd..3aee02d470 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.NPCs.Crabulon; using Terraria; using Terraria.ID; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneGlowshroom && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneGlowshroom && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -34,7 +35,7 @@ namespace CalamityMod.Items.SummonItems Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) { - int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-50, 51)), (int)(player.position.Y - 50f), ModContent.NPCType(), 1); + int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-250, 251)), (int)(player.position.Y - 500f), ModContent.NPCType(), 1); Main.npc[npc].timeLeft *= 20; CalamityUtils.BossAwakenMessage(npc); } diff --git a/Items/SummonItems/DraedonsRemote.cs b/Items/SummonItems/DraedonsRemote.cs index f7a89a685d..99a004c15f 100644 --- a/Items/SummonItems/DraedonsRemote.cs +++ b/Items/SummonItems/DraedonsRemote.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.NPCs; using Terraria; using Terraria.ID; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 28; item.maxStack = 20; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -27,13 +28,13 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !Main.dayTime && !NPC.AnyNPCs(NPCID.TheDestroyer) && !NPC.AnyNPCs(NPCID.SkeletronPrime) && !NPC.AnyNPCs(NPCID.Spazmatism) && !NPC.AnyNPCs(NPCID.Retinazer); + 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) { CalamityGlobalNPC.DraedonMayhem = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); Main.PlaySound(SoundID.Roar, player.position, 0); if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/Items/SummonItems/DriedSeafood.cs b/Items/SummonItems/DriedSeafood.cs index 4651c1264a..c67656a318 100644 --- a/Items/SummonItems/DriedSeafood.cs +++ b/Items/SummonItems/DriedSeafood.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.DesertScourge; using CalamityMod.World; @@ -21,7 +22,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 28; item.maxStack = 20; - item.rare = 2; + item.rare = ItemRarityID.Green; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneDesert && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -41,7 +42,7 @@ namespace CalamityMod.Items.SummonItems else NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); - if (CalamityWorld.revenge) + if (CalamityWorld.revenge || CalamityWorld.malice) { if (Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); diff --git a/Items/SummonItems/EidolonTablet.cs b/Items/SummonItems/EidolonTablet.cs index 6bf6978418..5c9bdb15df 100644 --- a/Items/SummonItems/EidolonTablet.cs +++ b/Items/SummonItems/EidolonTablet.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using System; using Terraria; using Terraria.ID; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.SummonItems item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet); + return !NPC.AnyNPCs(NPCID.CultistBoss) && !NPC.LunarApocalypseIsUp && !NPC.AnyNPCs(NPCID.CultistTablet) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/EyeofExtinction.cs b/Items/SummonItems/EyeofExtinction.cs index c17ae2bb50..a0c7b5f962 100644 --- a/Items/SummonItems/EyeofExtinction.cs +++ b/Items/SummonItems/EyeofExtinction.cs @@ -1,10 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.Tiles; using CalamityMod.Tiles.Furniture.CraftingStations; -using CalamityMod.World; -using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.SummonItems @@ -14,69 +9,21 @@ namespace CalamityMod.Items.SummonItems public override void SetStaticDefaults() { DisplayName.SetDefault("Eye of Extinction"); - Tooltip.SetDefault("Death\n" + - "Summons Supreme Calamitas\n" + - "Creates a large square arena of blocks around your player\n" + - "Your player is the CENTER of the arena so be sure to use this item in a good location\n" + - "During the battle, heart pickups will heal half as much HP\n" + - "Not consumable"); + Tooltip.SetDefault("Summons Supreme Calamitas at the altar but is not consumed"); } public override void SetDefaults() { - item.width = 40; - item.height = 40; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = false; + item.width = 54; + item.height = 42; item.Calamity().customRarity = CalamityRarity.Violet; } - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.downedBossAny; - } - - public override bool UseItem(Player player) - { - int surface = (int)Main.worldSurface; - for (int i = 0; i < Main.maxTilesX; i++) - { - for (int j = 0; j < surface; j++) - { - if (Main.tile[i, j] != null) - { - if (Main.tile[i, j].type == ModContent.TileType()) - { - WorldGen.KillTile(i, j, false, false, false); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, j, 1, TileChangeType.None); - } - else - { - WorldGen.SquareTileFrame(i, j, true); - } - } - } - } - } - - Main.PlaySound(SoundID.Roar, player.position, 0); - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - else - NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); - - return true; - } - public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 202d462474..73a591be60 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.SummonItems.Invasion item.width = 28; item.height = 18; item.maxStack = 99; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.SummonItems.Invasion public override bool UseItem(Player player) { - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); AcidRainEvent.TryStartEvent(true); return true; } diff --git a/Items/SummonItems/Invasion/CausticTearNonConsumable.cs b/Items/SummonItems/Invasion/CausticTearNonConsumable.cs index 421bce07dc..7fb95d7a2f 100644 --- a/Items/SummonItems/Invasion/CausticTearNonConsumable.cs +++ b/Items/SummonItems/Invasion/CausticTearNonConsumable.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.SummonItems.Invasion item.width = 28; item.height = 18; item.maxStack = 1; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.cs b/Items/SummonItems/Invasion/MartianDistressBeacon.cs new file mode 100644 index 0000000000..244d951c4c --- /dev/null +++ b/Items/SummonItems/Invasion/MartianDistressBeacon.cs @@ -0,0 +1,38 @@ +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.SummonItems.Invasion +{ + public class MartianDistressBeacon : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Martian Distress Beacon"); + Tooltip.SetDefault("Summons the Martian Madness"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 60; + item.maxStack = 99; + item.rare = ItemRarityID.Yellow; + item.useAnimation = 45; + item.useTime = 45; + item.useStyle = ItemUseStyleID.HoldingUp; + item.consumable = true; + } + + public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None; + + public override bool UseItem(Player player) + { + Main.StartInvasion(InvasionID.MartianMadness); + return true; + } + } +} diff --git a/Items/SummonItems/Invasion/MartianDistressBeacon.png b/Items/SummonItems/Invasion/MartianDistressBeacon.png new file mode 100644 index 0000000000..32afb9a520 Binary files /dev/null and b/Items/SummonItems/Invasion/MartianDistressBeacon.png differ diff --git a/Items/SummonItems/NecroplasmicBeacon.cs b/Items/SummonItems/NecroplasmicBeacon.cs index aa35fff07c..e41cf684e2 100644 --- a/Items/SummonItems/NecroplasmicBeacon.cs +++ b/Items/SummonItems/NecroplasmicBeacon.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.Polterghast; using CalamityMod.World; @@ -27,18 +28,18 @@ namespace CalamityMod.Items.SummonItems item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; item.consumable = false; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + 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) { - Vector2 origin = new Vector2(21f, 27f); //21, 29 - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow")); } public override bool CanUseItem(Player player) { - return player.ZoneDungeon && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.downedBossAny; + return player.ZoneDungeon && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/OldPowerCell.cs b/Items/SummonItems/OldPowerCell.cs index d17556dbb5..2ca5cdd787 100644 --- a/Items/SummonItems/OldPowerCell.cs +++ b/Items/SummonItems/OldPowerCell.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.SummonItems canSummon = true; } } - return canSummon && !NPC.AnyNPCs(NPCID.Golem); + return canSummon && !NPC.AnyNPCs(NPCID.Golem) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/OverloadedSludge.cs b/Items/SummonItems/OverloadedSludge.cs index 62295c5ff0..9d2cb4fbae 100644 --- a/Items/SummonItems/OverloadedSludge.cs +++ b/Items/SummonItems/OverloadedSludge.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.SlimeGod; using Terraria; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.SummonItems item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { return !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs deleted file mode 100644 index bafef3f868..0000000000 --- a/Items/SummonItems/ProfanedCore.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.NPCs.Providence; -using CalamityMod.World; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.SummonItems -{ - public class ProfanedCore : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Core"); - Tooltip.SetDefault("The core of the unholy flame\n" + - "Summons Providence\n" + - "Should be used during daytime"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.maxStack = 20; - item.useAnimation = 45; - item.useTime = 45; - item.useStyle = ItemUseStyleID.HoldingUp; - item.consumable = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } - - public override bool CanUseItem(Player player) - { - return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; - } - - 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) - { - int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-500, 501)), (int)(player.position.Y - 250f), ModContent.NPCType(), 1); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - } - else - NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); - - return true; - } - } -} diff --git a/Items/SummonItems/ProfanedCore.png b/Items/SummonItems/ProfanedCore.png deleted file mode 100644 index 1496674bd6..0000000000 Binary files a/Items/SummonItems/ProfanedCore.png and /dev/null differ diff --git a/Items/SummonItems/ProfanedCoreUnlimited.cs b/Items/SummonItems/ProfanedCoreUnlimited.cs index c323f9b4f6..7641eead1c 100644 --- a/Items/SummonItems/ProfanedCoreUnlimited.cs +++ b/Items/SummonItems/ProfanedCoreUnlimited.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Events; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Terraria; @@ -26,13 +26,12 @@ namespace CalamityMod.Items.SummonItems item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; item.consumable = false; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.rare = ItemRarityID.Purple; + } public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; + return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHoly || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -49,15 +48,5 @@ namespace CalamityMod.Items.SummonItems return true; } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } } } diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index 3b8115d4a6..4fb56f2fd9 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.ProfanedGuardians; using Terraria; @@ -25,12 +26,12 @@ namespace CalamityMod.Items.SummonItems item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; item.consumable = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.rare = ItemRarityID.Purple; + } public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + return !NPC.AnyNPCs(ModContent.NPCType()) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SummonItems/RuneofCos.cs b/Items/SummonItems/RuneofCos.cs index 22e0631d31..64a37ea826 100644 --- a/Items/SummonItems/RuneofCos.cs +++ b/Items/SummonItems/RuneofCos.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Signus; @@ -27,17 +28,17 @@ namespace CalamityMod.Items.SummonItems item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; - item.rare = 9; item.UseSound = SoundID.Item44; item.consumable = false; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } public override bool CanUseItem(Player player) { return (player.ZoneSkyHeight || player.ZoneUnderworldHeight || player.ZoneDungeon) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - CalamityWorld.DoGSecondStageCountdown <= 0; + CalamityWorld.DoGSecondStageCountdown <= 0 && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -46,15 +47,7 @@ namespace CalamityMod.Items.SummonItems if (player.ZoneDungeon) { if (Main.netMode != NetmodeID.MultiplayerClient) - { NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); - for (int num662 = 0; num662 < 2; num662++) - { - NPC.NewNPC((int)player.Center.X - 200, (int)player.Center.Y - 200, ModContent.NPCType()); - NPC.NewNPC((int)player.Center.X + 200, (int)player.Center.Y - 200, ModContent.NPCType()); - NPC.NewNPC((int)player.Center.X, (int)player.Center.Y + 200, ModContent.NPCType()); - } - } else NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, player.whoAmI, ModContent.NPCType()); } diff --git a/Items/SummonItems/SandstormsCore.cs b/Items/SummonItems/SandstormsCore.cs index 54f8c4d04f..00bf9252c3 100644 --- a/Items/SummonItems/SandstormsCore.cs +++ b/Items/SummonItems/SandstormsCore.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.SummonItems item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; diff --git a/Items/SummonItems/SandstormsCore.png b/Items/SummonItems/SandstormsCore.png index 9948f068ad..4b4d7836d7 100644 Binary files a/Items/SummonItems/SandstormsCore.png and b/Items/SummonItems/SandstormsCore.png differ diff --git a/Items/SummonItems/Seafood.cs b/Items/SummonItems/Seafood.cs index 0dd0a1f437..2e33f85676 100644 --- a/Items/SummonItems/Seafood.cs +++ b/Items/SummonItems/Seafood.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items.Placeables; using CalamityMod.NPCs.AquaticScourge; using Terraria; @@ -18,10 +19,10 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { - item.width = 28; - item.height = 28; + item.width = 26; + item.height = 24; item.maxStack = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.Calamity(); - return modPlayer.ZoneSulphur && !NPC.AnyNPCs(ModContent.NPCType()); + return modPlayer.ZoneSulphur && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) @@ -50,7 +51,7 @@ namespace CalamityMod.Items.SummonItems ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ItemID.Starfish, 5); - recipe.AddIngredient(ItemID.SharkFin, 3); + recipe.AddIngredient(ItemID.SharkFin); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/SummonItems/Seafood.png b/Items/SummonItems/Seafood.png index d8b63605d4..49a953c5e8 100644 Binary files a/Items/SummonItems/Seafood.png and b/Items/SummonItems/Seafood.png differ diff --git a/Items/SummonItems/Starcore.cs b/Items/SummonItems/Starcore.cs index 5ff2b9863b..cd42e24e96 100644 --- a/Items/SummonItems/Starcore.cs +++ b/Items/SummonItems/Starcore.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.SummonItems { item.width = 34; item.height = 40; - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override void AddRecipes() diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index 6fc0084733..40dec85d52 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.HiveMind; using Terraria; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.SummonItems item.width = 28; item.height = 18; item.maxStack = 20; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useAnimation = 45; item.useTime = 45; item.useStyle = ItemUseStyleID.HoldingUp; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneCorrupt && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()); + return player.ZoneCorrupt && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool UseItem(Player player) diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index 529903f6f9..c4dcc1dbb7 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items item.useStyle = ItemUseStyleID.SwingThrow; item.useTurn = true; item.value = 0; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.autoReuse = true; } @@ -35,18 +35,41 @@ namespace CalamityMod.Items return true; } + public static void DeleteDummies() + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.type == ModContent.NPCType() && npc.active) + { + npc.life = 0; + npc.active = false; + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, i); + } + } + } + public override bool UseItem(Player player) { if (player.altFunctionUse == 2) { - for (int i = 0; i < Main.maxNPCs; i++) + if (Main.myPlayer == player.whoAmI) { - NPC npc = Main.npc[i]; - if (npc.type == ModContent.NPCType() && npc.active) + if (Main.netMode == NetmodeID.SinglePlayer) + DeleteDummies(); + + // A custom packet must be sent so that the deletion can be done on the server. This hook does not run there. + // Why? Well, netUpdate/MessageID.SyncNPC packets do not send data to the server. They only send data to other clients. What this means is that prior to this fix + // what would happen was every client EXCEPT THE SERVER would be told by this player that the dummies disappeared. + // However, since the server isn't notified, it is inevitable that the server will do a sync of its own, unaware that the + // dummies are gone, and cause them to reappear, making the deletion moot. + else { - npc.active = false; - npc.netUpdate = true; - Main.PlaySound(SoundID.NPCDeath2, npc.Center); + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DeleteAllSuperDummies); + netMessage.Send(); } } } diff --git a/Items/Tools/AbyssalWarhammer.cs b/Items/Tools/AbyssalWarhammer.cs index 8906c58260..e08bafe30d 100644 --- a/Items/Tools/AbyssalWarhammer.cs +++ b/Items/Tools/AbyssalWarhammer.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 8f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/AerialHamaxe.cs b/Items/Tools/AerialHamaxe.cs index 2c599525b9..69ff150343 100644 --- a/Items/Tools/AerialHamaxe.cs +++ b/Items/Tools/AerialHamaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/AstralHamaxe.cs b/Items/Tools/AstralHamaxe.cs index c6c9956f40..fbc7f931b2 100644 --- a/Items/Tools/AstralHamaxe.cs +++ b/Items/Tools/AstralHamaxe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 3; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Tools public override void MeleeEffects(Player player, Rectangle hitbox) { - Dust d = CalamityGlobalItem.MeleeDustHelper(player, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0.48f, 50, 78, -0.1f, 0.1f); + Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0.48f, 50, 78, -0.1f, 0.1f); if (d != null) { d.customData = 0.02f; diff --git a/Items/Tools/AstralPickaxe.cs b/Items/Tools/AstralPickaxe.cs index 8769f8337b..f6613c90c0 100644 --- a/Items/Tools/AstralPickaxe.cs +++ b/Items/Tools/AstralPickaxe.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 3; @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Tools public override void MeleeEffects(Player player, Rectangle hitbox) { - Dust d = CalamityGlobalItem.MeleeDustHelper(player, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0.56f, 40, 65, -0.13f, 0.13f); + Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0.56f, 40, 65, -0.13f, 0.13f); if (d != null) { d.customData = 0.02f; diff --git a/Items/Tools/BeastialPickaxe.cs b/Items/Tools/BeastialPickaxe.cs index 875654a311..4921a13be8 100644 --- a/Items/Tools/BeastialPickaxe.cs +++ b/Items/Tools/BeastialPickaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/BerserkerWaraxe.cs b/Items/Tools/BerserkerWaraxe.cs index 8fe6435948..51a6be37b5 100644 --- a/Items/Tools/BerserkerWaraxe.cs +++ b/Items/Tools/BerserkerWaraxe.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 8; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/BlossomPickaxe.cs b/Items/Tools/BlossomPickaxe.cs index 2a86a40a82..3f8aa12668 100644 --- a/Items/Tools/BlossomPickaxe.cs +++ b/Items/Tools/BlossomPickaxe.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 90; + item.damage = 60; item.melee = true; item.width = 50; item.height = 52; @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Tools item.pick = 275; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 6.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 6; diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index c248d3dad3..904c086a72 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -1,9 +1,10 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; using CalamityMod.Projectiles.Typeless; +using static Terraria.ModLoader.ModContent; + namespace CalamityMod.Items.Tools { public class BobbitHook : ModItem @@ -11,20 +12,21 @@ namespace CalamityMod.Items.Tools public override void SetStaticDefaults() { DisplayName.SetDefault("Bobbit Hook"); - Tooltip.SetDefault(@"Retracts upon attaching to a tile with extreme speeds -Reach: 40 -Launch Velocity: 25 -Pull Velocity: 28"); + Tooltip.SetDefault($@"Retracts upon attaching to a tile with extreme speeds +Reach: {BobbitHead.GrappleRangInTiles} +Launch Velocity: {BobbitHead.LaunchSpeed} +Reelback Velocity: {BobbitHead.ReelbackSpeed} +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 = 25f; // how quickly the hook is shot. + item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. item.shoot = ProjectileType(); item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + 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 6bef3eb8f6..05f5684415 100644 --- a/Items/Tools/ChaoswarpedSlashaxe.cs +++ b/Items/Tools/ChaoswarpedSlashaxe.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/ClimateChange/AridArtifact.cs b/Items/Tools/ClimateChange/AridArtifact.cs index 5cefe0e1af..96a5373ed6 100644 --- a/Items/Tools/ClimateChange/AridArtifact.cs +++ b/Items/Tools/ClimateChange/AridArtifact.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Tools.ClimateChange item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 20; item.useTime = 20; item.useStyle = ItemUseStyleID.HoldingUp; diff --git a/Items/Tools/ClimateChange/BloodIdol.cs b/Items/Tools/ClimateChange/BloodIdol.cs index b5b4c84743..9e096b922b 100644 --- a/Items/Tools/ClimateChange/BloodIdol.cs +++ b/Items/Tools/ClimateChange/BloodIdol.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Tools.ClimateChange item.width = 20; item.height = 20; item.maxStack = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 20; item.useTime = 20; item.useStyle = ItemUseStyleID.HoldingUp; @@ -34,14 +34,14 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool UseItem(Player player) { Main.bloodMoon = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); return true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddRecipeGroup("FetidBloodletting", 2); + recipe.AddRecipeGroup("EvilPowder", 10); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 681306c541..851dcd6593 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,14 +11,15 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmolight"); - Tooltip.SetDefault("Changes night to day and vice versa"); + Tooltip.SetDefault("Changes night to day and vice versa\n" + + "Does not work while a boss is alive"); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 20; item.useTime = 20; item.useStyle = ItemUseStyleID.HoldingUp; @@ -43,7 +45,7 @@ namespace CalamityMod.Items.Tools.ClimateChange Main.moonPhase = 0; } } - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } return true; } @@ -51,9 +53,11 @@ namespace CalamityMod.Items.Tools.ClimateChange public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddIngredient(ItemID.SoulofLight, 7); + recipe.AddIngredient(ItemID.SoulofNight, 7); + recipe.AddIngredient(ItemID.HellstoneBar, 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Tools/ClimateChange/Daylight.cs b/Items/Tools/ClimateChange/Daylight.cs deleted file mode 100644 index d9e280c78e..0000000000 --- a/Items/Tools/ClimateChange/Daylight.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools.ClimateChange -{ - public class Daylight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Daylight"); - Tooltip.SetDefault("Summons the sun"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item60; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return !Main.dayTime && !CalamityPlayer.areThereAnyDamnBosses; - } - - public override bool UseItem(Player player) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.dayTime = true; - CalamityMod.UpdateServerBoolean(); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofLight, 7); - recipe.AddIngredient(ItemID.HellstoneBar, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Tools/ClimateChange/Daylight.png b/Items/Tools/ClimateChange/Daylight.png deleted file mode 100644 index 7889c347a1..0000000000 Binary files a/Items/Tools/ClimateChange/Daylight.png and /dev/null differ diff --git a/Items/Tools/ClimateChange/Moonlight.cs b/Items/Tools/ClimateChange/Moonlight.cs deleted file mode 100644 index d5afd2cab2..0000000000 --- a/Items/Tools/ClimateChange/Moonlight.cs +++ /dev/null @@ -1,54 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Tools.ClimateChange -{ - public class Moonlight : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Moonlight"); - Tooltip.SetDefault("Summons the moon"); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.useAnimation = 20; - item.useTime = 20; - item.useStyle = ItemUseStyleID.HoldingUp; - item.UseSound = SoundID.Item60; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return Main.dayTime && !CalamityPlayer.areThereAnyDamnBosses; - } - - public override bool UseItem(Player player) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.dayTime = false; - CalamityMod.UpdateServerBoolean(); - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SoulofNight, 7); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Tools/ClimateChange/Moonlight.png b/Items/Tools/ClimateChange/Moonlight.png deleted file mode 100644 index 5490d86e60..0000000000 Binary files a/Items/Tools/ClimateChange/Moonlight.png and /dev/null differ diff --git a/Items/Tools/ClimateChange/TorrentialTear.cs b/Items/Tools/ClimateChange/TorrentialTear.cs index a23a70fef2..81f95780e6 100644 --- a/Items/Tools/ClimateChange/TorrentialTear.cs +++ b/Items/Tools/ClimateChange/TorrentialTear.cs @@ -1,4 +1,3 @@ -using CalamityMod.Events; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -14,15 +13,15 @@ namespace CalamityMod.Items.Tools.ClimateChange Tooltip.SetDefault("Summons the rain.\n" + "Rain will start some time after this item is used.\n" + "If used while it's raining, the rain will stop some time afterward.\n" + - "In Death Mode, using this item while it's raining will reduce the amount of time the rain lingers for\n" + - "to one minute; however, not any lower, and this will cause the rain to turn violent for that minute."); + "In Death Mode, using this item while it's raining will reduce the amount of time the rain lingers for to one minute.\n" + + "However, this will cause the rain to turn violent for that time."); } public override void SetDefaults() { item.width = 20; item.height = 20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 20; item.useTime = 20; item.useStyle = ItemUseStyleID.HoldingUp; @@ -39,7 +38,7 @@ namespace CalamityMod.Items.Tools.ClimateChange { if (!Main.raining) { - CalamityUtils.StartRain(true); + CalamityUtils.StartRain(true); } else if (CalamityWorld.death) { @@ -54,46 +53,46 @@ namespace CalamityMod.Items.Tools.ClimateChange Main.raining = false; } - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); return true; } - public static void AdjustRainSeverity(bool maxSeverity) - { - if (maxSeverity) - { - Main.cloudBGActive = 1f; - Main.numCloudsTemp = Main.cloudLimit; - Main.numClouds = Main.numCloudsTemp; - Main.windSpeedTemp = (float)Main.rand.Next(50, 75) * 0.01f; - Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = Main.rand.Next(3600, 18000); - Main.maxRaining = 0.89f; - } - else - { - if (Main.cloudBGActive >= 1f || (double)Main.numClouds > 150.0) - { - if (Main.rand.Next(3) == 0) - Main.maxRaining = (float)Main.rand.Next(20, 90) * 0.01f; - else - Main.maxRaining = (float)Main.rand.Next(40, 90) * 0.01f; - } - else if ((double)Main.numClouds > 100.0) - { - if (Main.rand.Next(3) == 0) - Main.maxRaining = (float)Main.rand.Next(10, 70) * 0.01f; - else - Main.maxRaining = (float)Main.rand.Next(20, 60) * 0.01f; - } - else - { - if (Main.rand.Next(3) == 0) - Main.maxRaining = (float)Main.rand.Next(5, 40) * 0.01f; - else - Main.maxRaining = (float)Main.rand.Next(5, 30) * 0.01f; - } - } - } + public static void AdjustRainSeverity(bool maxSeverity) + { + if (maxSeverity) + { + Main.cloudBGActive = 1f; + Main.numCloudsTemp = Main.cloudLimit; + Main.numClouds = Main.numCloudsTemp; + Main.windSpeedTemp = (float)Main.rand.Next(50, 75) * 0.01f; + Main.windSpeedSet = Main.windSpeedTemp; + Main.weatherCounter = Main.rand.Next(3600, 18000); + Main.maxRaining = 0.89f; + } + else + { + if (Main.cloudBGActive >= 1f || (double)Main.numClouds > 150.0) + { + if (Main.rand.Next(3) == 0) + Main.maxRaining = (float)Main.rand.Next(20, 90) * 0.01f; + else + Main.maxRaining = (float)Main.rand.Next(40, 90) * 0.01f; + } + else if ((double)Main.numClouds > 100.0) + { + if (Main.rand.Next(3) == 0) + Main.maxRaining = (float)Main.rand.Next(10, 70) * 0.01f; + else + Main.maxRaining = (float)Main.rand.Next(20, 60) * 0.01f; + } + else + { + if (Main.rand.Next(3) == 0) + Main.maxRaining = (float)Main.rand.Next(5, 40) * 0.01f; + else + Main.maxRaining = (float)Main.rand.Next(5, 30) * 0.01f; + } + } + } } } diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index e212107bcd..de2c1bb9bb 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools public override void SetDefaults() { - item.damage = 2000; + item.damage = 400; item.melee = true; item.noMelee = true; item.channel = true; @@ -35,12 +35,13 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 9f; item.shootSpeed = 14f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + item.pick = PickPower; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.pick = PickPower; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override Vector2? HoldoutOrigin() diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 06dc0f3161..507c7c98b1 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/FlamebeakHampick.cs b/Items/Tools/FlamebeakHampick.cs index 379173b172..dc892e9d83 100644 --- a/Items/Tools/FlamebeakHampick.cs +++ b/Items/Tools/FlamebeakHampick.cs @@ -32,7 +32,7 @@ Right click to use as a hammer"); item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 2; diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index 06659b65f8..911f7606a2 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5.5f; item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 6; diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index 84dfda6bfa..b8d447cd47 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item1; item.autoReuse = true; item.useTurn = true; diff --git a/Items/Tools/Grax.cs b/Items/Tools/Grax.cs index 1bfe946de1..231c660616 100644 --- a/Items/Tools/Grax.cs +++ b/Items/Tools/Grax.cs @@ -3,37 +3,59 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Tools { public class Grax : ModItem { + private static int HammerPower = 200; + private static int AxePower = 50; public override void SetStaticDefaults() { DisplayName.SetDefault("Grax"); - Tooltip.SetDefault("Hitting an enemy will greatly boost your defense and melee stats for a short time"); + Tooltip.SetDefault("Hitting an enemy will greatly boost your defense, melee damage and melee crit for a short time\n" + + "Right click to use without hammering down walls or chopping down trees"); } public override void SetDefaults() { item.width = 62; item.height = 62; - item.damage = 500; + item.scale = 1.5f; + item.damage = 472; item.melee = true; item.useAnimation = 16; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 4; item.useTurn = true; - item.axe = 50; - item.hammer = 200; + item.axe = AxePower; + item.hammer = HammerPower; item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 5; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; } + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.axe = 0; + item.hammer = 0; + } + else + { + item.axe = AxePower; + item.hammer = HammerPower; + } + return base.CanUseItem(player); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Tools/GreatbayPickaxe.cs b/Items/Tools/GreatbayPickaxe.cs index afcb7dcbc8..fcb746f060 100644 --- a/Items/Tools/GreatbayPickaxe.cs +++ b/Items/Tools/GreatbayPickaxe.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/InfernaCutter.cs b/Items/Tools/InfernaCutter.cs index 23ba9cc9b5..707160f059 100644 --- a/Items/Tools/InfernaCutter.cs +++ b/Items/Tools/InfernaCutter.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; } @@ -117,8 +117,9 @@ 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, 0f, 0f); - Main.projectile[spark].Calamity().forceMelee = true; + 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; } } if (Main.rand.NextBool(4)) @@ -131,8 +132,10 @@ namespace CalamityMod.Items.Tools { if (crit) { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; + damage /= 2; + int boom = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].Calamity().forceMelee = true; } target.AddBuff(BuffID.OnFire, 300); target.AddBuff(ModContent.BuffType(), 300); diff --git a/Items/Tools/MarniteObliterator.cs b/Items/Tools/MarniteObliterator.cs index 380cee11fc..15f438f125 100644 --- a/Items/Tools/MarniteObliterator.cs +++ b/Items/Tools/MarniteObliterator.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 3; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item23; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Tools/PurityAxe.cs b/Items/Tools/PurityAxe.cs index c5b156e2cd..5bf188a4ab 100644 --- a/Items/Tools/PurityAxe.cs +++ b/Items/Tools/PurityAxe.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Tools item.damage = 43; item.melee = true; item.width = 58; - item.height = 46; + item.height = 54; item.useTime = 19; item.useAnimation = 19; item.useTurn = true; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; } @@ -43,10 +43,7 @@ namespace CalamityMod.Items.Tools return false; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { diff --git a/Items/Tools/PurityAxe.png b/Items/Tools/PurityAxe.png index 75b68ffd8d..7a4a9bd655 100644 Binary files a/Items/Tools/PurityAxe.png and b/Items/Tools/PurityAxe.png differ diff --git a/Items/Tools/ReefclawHamaxe.cs b/Items/Tools/ReefclawHamaxe.cs index 3dbe02600d..3975338ac3 100644 --- a/Items/Tools/ReefclawHamaxe.cs +++ b/Items/Tools/ReefclawHamaxe.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 6f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/ShardlightPickaxe.cs b/Items/Tools/ShardlightPickaxe.cs index 4849d6b46d..7c646a27c3 100644 --- a/Items/Tools/ShardlightPickaxe.cs +++ b/Items/Tools/ShardlightPickaxe.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/SkyfringePickaxe.cs b/Items/Tools/SkyfringePickaxe.cs index 87d42dbf7e..e7de69f517 100644 --- a/Items/Tools/SkyfringePickaxe.cs +++ b/Items/Tools/SkyfringePickaxe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs index 0e2b0fa44c..e398b40649 100644 --- a/Items/Tools/WulfrumAxe.cs +++ b/Items/Tools/WulfrumAxe.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.5f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 1; diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs index 57a0d6a014..3df4b04003 100644 --- a/Items/Tools/WulfrumHammer.cs +++ b/Items/Tools/WulfrumHammer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 1; diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumPickaxe.cs index 0d8c6a3592..5e97591432 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumPickaxe.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Tools item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 2f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item1; item.autoReuse = true; item.tileBoost += 1; diff --git a/Items/TreasureBags/AbyssalTreasure.cs b/Items/TreasureBags/AbyssalTreasure.cs index 19bccd77f7..2e96a17958 100644 --- a/Items/TreasureBags/AbyssalTreasure.cs +++ b/Items/TreasureBags/AbyssalTreasure.cs @@ -19,123 +19,127 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 1; //Blue for thematics + item.rare = ItemRarityID.Blue; //Blue for thematics } public override bool CanRightClick() => true; public override void RightClick(Player player) { - if (Main.rand.NextBool(10)) + // Loops 4 times to compensate for dropping only one treasure now + for (int i = 0; i < 4; i++) { - int potionType = Utils.SelectRandom(WorldGen.genRand, new int[] + if (Main.rand.NextBool(10)) { - ItemID.SpelunkerPotion, - ItemID.MagicPowerPotion, - ItemID.ShinePotion, - ItemID.WaterWalkingPotion, - ItemID.ObsidianSkinPotion, - ItemID.WaterWalkingPotion, - ItemID.GravitationPotion, - ItemID.RegenerationPotion, - ModContent.ItemType(), - ModContent.ItemType(), - ItemID.GillsPotion, - ItemID.EndurancePotion, - ItemID.HeartreachPotion, - ItemID.FlipperPotion, - ItemID.LifeforcePotion, - ItemID.InfernoPotion - }); - DropHelper.DropItem(player, potionType); - } - else - { - switch (Main.rand.Next(10)) + int potionType = Utils.SelectRandom(WorldGen.genRand, new int[] + { + ItemID.SpelunkerPotion, + ItemID.MagicPowerPotion, + ItemID.ShinePotion, + ItemID.WaterWalkingPotion, + ItemID.ObsidianSkinPotion, + ItemID.WaterWalkingPotion, + ItemID.GravitationPotion, + ItemID.RegenerationPotion, + ModContent.ItemType(), + ModContent.ItemType(), + ItemID.GillsPotion, + ItemID.EndurancePotion, + ItemID.HeartreachPotion, + ItemID.FlipperPotion, + ItemID.LifeforcePotion, + ItemID.InfernoPotion + }); + DropHelper.DropItem(player, potionType); + } + else { - case 0: - int sglowstickAmt = Main.rand.Next(2, 6); - if (Main.expertMode) - { - sglowstickAmt += Main.rand.Next(1, 7); - } - DropHelper.DropItem(player, ItemID.SpelunkerGlowstick, sglowstickAmt); - break; - case 1: - DropHelper.DropItem(player, ItemID.HellfireArrow, 10, 20); - break; - case 2: - DropHelper.DropItem(player, ModContent.ItemType()); - break; - case 3: - DropHelper.DropItem(player, ItemID.StickyDynamite); - break; - default: - int coinCount = 5000 + Main.rand.Next(-100, 101); - while (coinCount > 0) - { - if (coinCount > 1000000) + switch (Main.rand.Next(10)) + { + case 0: + int sglowstickAmt = Main.rand.Next(2, 6); + if (Main.expertMode) { - int ptCoinAmt = coinCount / 1000000; - if (ptCoinAmt > 50 && Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 1000000 * ptCoinAmt; - DropHelper.DropItem(player, ItemID.PlatinumCoin, ptCoinAmt); + sglowstickAmt += Main.rand.Next(1, 7); } - else if (coinCount > 10000) + DropHelper.DropItem(player, ItemID.SpelunkerGlowstick, sglowstickAmt); + break; + case 1: + DropHelper.DropItem(player, ItemID.HellfireArrow, 10, 20); + break; + case 2: + DropHelper.DropItem(player, ModContent.ItemType()); + break; + case 3: + DropHelper.DropItem(player, ItemID.StickyDynamite); + break; + default: + int coinCount = 5000 + Main.rand.Next(-100, 101); + while (coinCount > 0) { - int auCoinAmt = coinCount / 10000; - if (auCoinAmt > 50 && Main.rand.NextBool(2)) + if (coinCount > 1000000) { - auCoinAmt /= Main.rand.Next(3) + 1; + int ptCoinAmt = coinCount / 1000000; + if (ptCoinAmt > 50 && Main.rand.NextBool(2)) + { + ptCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + ptCoinAmt /= Main.rand.Next(3) + 1; + } + coinCount -= 1000000 * ptCoinAmt; + DropHelper.DropItem(player, ItemID.PlatinumCoin, ptCoinAmt); } - if (Main.rand.NextBool(2)) + else if (coinCount > 10000) { - auCoinAmt /= Main.rand.Next(3) + 1; + int auCoinAmt = coinCount / 10000; + if (auCoinAmt > 50 && Main.rand.NextBool(2)) + { + auCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + auCoinAmt /= Main.rand.Next(3) + 1; + } + coinCount -= 10000 * auCoinAmt; + DropHelper.DropItem(player, ItemID.GoldCoin, auCoinAmt); + } + else if (coinCount > 100) + { + int agCoinAmt = coinCount / 100; + if (agCoinAmt > 50 && Main.rand.NextBool(2)) + { + agCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + agCoinAmt /= Main.rand.Next(3) + 1; + } + coinCount -= 100 * agCoinAmt; + DropHelper.DropItem(player, ItemID.SilverCoin, agCoinAmt); + } + else + { + int cuCoinAmt = coinCount; + if (cuCoinAmt > 50 && Main.rand.NextBool(2)) + { + cuCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + cuCoinAmt /= Main.rand.Next(4) + 1; + } + if (cuCoinAmt < 1) + { + cuCoinAmt = 1; + } + coinCount -= cuCoinAmt; + DropHelper.DropItem(player, ItemID.CopperCoin, cuCoinAmt); } - coinCount -= 10000 * auCoinAmt; - DropHelper.DropItem(player, ItemID.GoldCoin, auCoinAmt); } - else if (coinCount > 100) - { - int agCoinAmt = coinCount / 100; - if (agCoinAmt > 50 && Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 100 * agCoinAmt; - DropHelper.DropItem(player, ItemID.SilverCoin, agCoinAmt); - } - else - { - int cuCoinAmt = coinCount; - if (cuCoinAmt > 50 && Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(4) + 1; - } - if (cuCoinAmt < 1) - { - cuCoinAmt = 1; - } - coinCount -= cuCoinAmt; - DropHelper.DropItem(player, ItemID.CopperCoin, cuCoinAmt); - } - } - break; + break; + } } } } diff --git a/Items/TreasureBags/AquaticScourgeBag.cs b/Items/TreasureBags/AquaticScourgeBag.cs index 3370c3eefb..6d3c4aeea8 100644 --- a/Items/TreasureBags/AquaticScourgeBag.cs +++ b/Items/TreasureBags/AquaticScourgeBag.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -47,12 +47,6 @@ namespace CalamityMod.Items.TreasureBags if (Main.hardMode) player.TryGettingDevArmor(); - // Materials - DropHelper.DropItem(player, ModContent.ItemType(), 15, 25); - DropHelper.DropItem(player, ItemID.Coral, 7, 11); - DropHelper.DropItem(player, ItemID.Seashell, 7, 11); - DropHelper.DropItem(player, ItemID.Starfish, 7, 11); - // Weapons float w = DropHelper.BagWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(player, @@ -63,13 +57,9 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - float searingChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, searingChance); - // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemChance(player, ModContent.ItemType(), 8); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, 0.25f); + DropHelper.DropItemChance(player, ModContent.ItemType(), 8); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/AstrageldonBag.cs b/Items/TreasureBags/AstrageldonBag.cs index 0e520843d4..96195471c8 100644 --- a/Items/TreasureBags/AstrageldonBag.cs +++ b/Items/TreasureBags/AstrageldonBag.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.TreasureBags item.width = 24; item.height = 24; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() => true; @@ -58,9 +58,6 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - float leonidChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, leonidChance); - // Equipment DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && NPC.downedMoonlord); DropHelper.DropItem(player, ModContent.ItemType()); diff --git a/Items/TreasureBags/AstrumDeusBag.cs b/Items/TreasureBags/AstrumDeusBag.cs index 1edd487314..1992ad1554 100644 --- a/Items/TreasureBags/AstrumDeusBag.cs +++ b/Items/TreasureBags/AstrumDeusBag.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.TreasureBags item.width = 24; item.height = 24; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() => true; @@ -56,10 +56,8 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - // Equipment - DropHelper.DropItemRIV(player, ModContent.ItemType(), ModContent.ItemType(), 1f, DropHelper.RareVariantDropRateFloat); + DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity diff --git a/Items/TreasureBags/BleachedAnglingKit.cs b/Items/TreasureBags/BleachedAnglingKit.cs index fba2ff7f95..bdca64a29d 100644 --- a/Items/TreasureBags/BleachedAnglingKit.cs +++ b/Items/TreasureBags/BleachedAnglingKit.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override bool CanRightClick() => true; public override void RightClick(Player player) { - int anglerTackleBagChance = !Main.expertMode ? 15 : 18; + int anglerTackleBagChance = !Main.expertMode ? 18 : 15; int fishingAccChance = !Main.expertMode ? 12 : 10; int fishFindAccChance = !Main.expertMode ? 9 : 8; int anglerArmorChance = !Main.expertMode ? 4 : 2; diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneWaifuBag.cs index a9a4b115d0..92cd4116b1 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneWaifuBag.cs @@ -10,6 +10,7 @@ using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.World; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -30,7 +31,7 @@ namespace CalamityMod.Items.TreasureBags item.width = 24; item.height = 24; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() @@ -57,7 +58,7 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemChance(player, ModContent.ItemType(), 10); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && CalamityWorld.downedProvidence); // Vanity diff --git a/Items/TreasureBags/BumblebirbBag.cs b/Items/TreasureBags/BumblebirbBag.cs index 2c150527e8..7f539e3f61 100644 --- a/Items/TreasureBags/BumblebirbBag.cs +++ b/Items/TreasureBags/BumblebirbBag.cs @@ -10,6 +10,7 @@ using CalamityMod.World; using Terraria; using Terraria.ModLoader; using CalamityMod.Items.Armor.Vanity; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -30,7 +31,7 @@ namespace CalamityMod.Items.TreasureBags item.width = 24; item.height = 24; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() => true; @@ -50,8 +51,6 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - // Equipment DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); diff --git a/Items/TreasureBags/CalamitasBag.cs b/Items/TreasureBags/CalamitasBag.cs index 71c0cea810..a4a3a9dc54 100644 --- a/Items/TreasureBags/CalamitasBag.cs +++ b/Items/TreasureBags/CalamitasBag.cs @@ -10,6 +10,7 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -29,7 +30,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -59,7 +60,7 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemChance(player, ModContent.ItemType(), 10); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/CeaselessVoidBag.cs b/Items/TreasureBags/CeaselessVoidBag.cs new file mode 100644 index 0000000000..d9d032b363 --- /dev/null +++ b/Items/TreasureBags/CeaselessVoidBag.cs @@ -0,0 +1,57 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.CeaselessVoid; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags +{ + public class CeaselessVoidBag : ModItem + { + public override int BossBagNPC => ModContent.NPCType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + 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 OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ModContent.ItemType(), 3, 4); + + // Weapons + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + + // Equipment + DropHelper.DropItem(player, ModContent.ItemType()); + + // Vanity + DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + } + } + } +} diff --git a/Items/TreasureBags/CeaselessVoidBag.png b/Items/TreasureBags/CeaselessVoidBag.png new file mode 100644 index 0000000000..8033976f7c Binary files /dev/null and b/Items/TreasureBags/CeaselessVoidBag.png differ diff --git a/Items/TreasureBags/CrabulonBag.cs b/Items/TreasureBags/CrabulonBag.cs index 7fc48d4f0e..a7c76ff9bc 100644 --- a/Items/TreasureBags/CrabulonBag.cs +++ b/Items/TreasureBags/CrabulonBag.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } diff --git a/Items/TreasureBags/CryogenBag.cs b/Items/TreasureBags/CryogenBag.cs index a8653a8435..70b732d33e 100644 --- a/Items/TreasureBags/CryogenBag.cs +++ b/Items/TreasureBags/CryogenBag.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -46,9 +46,7 @@ namespace CalamityMod.Items.TreasureBags player.TryGettingDevArmor(); // Materials - DropHelper.DropItem(player, ModContent.ItemType(), 20, 40); DropHelper.DropItem(player, ModContent.ItemType(), 5, 9); - DropHelper.DropItem(player, ItemID.FrostCore); // Weapons float w = DropHelper.BagWeaponDropRateFloat; @@ -61,14 +59,10 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - float divinityChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, divinityChance); - // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge); - DropHelper.DropItemChance(player, ModContent.ItemType(), 10); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/DesertScourgeBag.cs b/Items/TreasureBags/DesertScourgeBag.cs index b1b4302214..f62e6c84a3 100644 --- a/Items/TreasureBags/DesertScourgeBag.cs +++ b/Items/TreasureBags/DesertScourgeBag.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -57,19 +57,12 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w), DropHelper.WeightStack(w), }; - - // If the RIV roll for Dune Hopper succeeds, REPLACE Scourge of the Desert with a guaranteed Dune Hopper. - float duneHopperChance = DropHelper.RareVariantDropRateFloat; - if (Main.rand.NextFloat() < duneHopperChance) - weapons[4] = DropHelper.WeightStack(); - DropHelper.DropEntireWeightedSet(player, weapons); // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemChance(player, ModContent.ItemType(), 9); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); DropHelper.DropItemChance(player, ModContent.ItemType(), 9); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index e6a8c1be5d..1b9f0d656a 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -15,6 +15,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -32,22 +33,18 @@ namespace CalamityMod.Items.TreasureBags { item.maxStack = 999; item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; + 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) { - Vector2 origin = new Vector2(18f, 20f); //18, 17 - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/TreasureBags/DevourerofGodsBagGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/TreasureBags/DevourerofGodsBagGlow")); } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); @@ -67,22 +64,21 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - Main.rand.NextBool() ? DropHelper.WeightStack(w) : DropHelper.WeightStack(w) + DropHelper.WeightStack(w) ); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - float dischargeChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, dischargeChance); - // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - bool vodka = player.Calamity().fabsolVodka; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge && vodka); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.death && player.difficulty == 2); + if (Main.rand.NextBool(5)) + { + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + } + DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.death && player.difficulty == 2); } } } diff --git a/Items/TreasureBags/FleshyGeodeT1.cs b/Items/TreasureBags/FleshyGeodeT1.cs index 09bf681ab3..60c4b6619a 100644 --- a/Items/TreasureBags/FleshyGeodeT1.cs +++ b/Items/TreasureBags/FleshyGeodeT1.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -18,7 +19,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 8; + item.rare = ItemRarityID.Yellow; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/FleshyGeodeT2.cs b/Items/TreasureBags/FleshyGeodeT2.cs index 78e34a3617..7c17a95cac 100644 --- a/Items/TreasureBags/FleshyGeodeT2.cs +++ b/Items/TreasureBags/FleshyGeodeT2.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 11; - item.Calamity().postMoonLordRarity = 12; + item.Calamity().customRarity = CalamityRarity.Turquoise; } public override bool CanRightClick() => true; @@ -33,8 +32,8 @@ namespace CalamityMod.Items.TreasureBags int coreMax = !Main.expertMode ? 3 : 4; int bloodstoneMin = !Main.expertMode ? 50 : 60; int bloodstoneMax = !Main.expertMode ? 60 : 70; - int lifeAlloyChance = !Main.expertMode ? 2 : 1; - int coreofCalChance = !Main.expertMode ? 3 : 2; + int lifeAlloyChance = !Main.expertMode ? 2 : 1; + int coreofCalChance = !Main.expertMode ? 3 : 2; DropHelper.DropItem(player, ModContent.ItemType(), barMin, barMax); DropHelper.DropItem(player, ModContent.ItemType(), barMin, barMax); DropHelper.DropItem(player, ModContent.ItemType(), barMin, barMax); diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index df1c0f0ff2..c854c135af 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index 4537569070..b3ae47cc8d 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -58,8 +58,6 @@ namespace CalamityMod.Items.TreasureBags // Equipment DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItemChance(player, ModContent.ItemType(), 3); - float communityChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, communityChance); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/OldDukeBag.cs b/Items/TreasureBags/OldDukeBag.cs index af3d52fa1b..7e9843b4c2 100644 --- a/Items/TreasureBags/OldDukeBag.cs +++ b/Items/TreasureBags/OldDukeBag.cs @@ -8,6 +8,7 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.OldDuke; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -28,7 +29,7 @@ namespace CalamityMod.Items.TreasureBags item.width = 24; item.height = 24; item.expert = true; - item.rare = 10; + item.rare = ItemRarityID.Red; } public override bool CanRightClick() diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index 6916377856..16e83a6c5b 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index c719bf9abb..558b709431 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -62,12 +62,9 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - float malachiteChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, malachiteChance); - // Equipment DropHelper.DropItem(player, ModContent.ItemType()); - DropHelper.DropItemChance(player, ModContent.ItemType(), 10); + DropHelper.DropItemChance(player, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); diff --git a/Items/TreasureBags/PolterghastBag.cs b/Items/TreasureBags/PolterghastBag.cs index 15ed6be9bf..e1d8bccec1 100644 --- a/Items/TreasureBags/PolterghastBag.cs +++ b/Items/TreasureBags/PolterghastBag.cs @@ -13,6 +13,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -30,22 +31,18 @@ namespace CalamityMod.Items.TreasureBags { item.maxStack = 999; item.consumable = true; - item.width = 24; - item.height = 24; - item.rare = 9; + 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) { - Vector2 origin = new Vector2(16f, 20f); //16, 17 - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/TreasureBags/PolterghastBagGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/TreasureBags/PolterghastBagGlow")); } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void OpenBossBag(Player player) { @@ -53,7 +50,7 @@ namespace CalamityMod.Items.TreasureBags // Materials DropHelper.DropItem(player, ModContent.ItemType(), 10, 20); - DropHelper.DropItem(player, ModContent.ItemType(), 20, 30); + DropHelper.DropItem(player, ModContent.ItemType(), 40, 50); // Weapons float w = DropHelper.BagWeaponDropRateFloat; diff --git a/Items/TreasureBags/ProvidenceBag.cs b/Items/TreasureBags/ProvidenceBag.cs index 750797fb5b..522112a14e 100644 --- a/Items/TreasureBags/ProvidenceBag.cs +++ b/Items/TreasureBags/ProvidenceBag.cs @@ -10,6 +10,7 @@ using CalamityMod.NPCs.Providence; using CalamityMod.World; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -29,7 +30,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -58,11 +59,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w) ); - float pristineFuryChance = DropHelper.LegendaryDropRateFloat; - DropHelper.DropItemCondition(player, ModContent.ItemType(), CalamityWorld.revenge, pristineFuryChance); - // Equipment - DropHelper.DropItemChance(player, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); DropHelper.DropItem(player, ModContent.ItemType()); // Vanity diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index 2b0ec05d65..c445e31111 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -11,6 +11,7 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.World; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Items.TreasureBags { @@ -31,7 +32,7 @@ namespace CalamityMod.Items.TreasureBags item.width = 24; item.height = 24; item.expert = true; - item.rare = 9; + item.rare = ItemRarityID.Cyan; } public override bool CanRightClick() @@ -56,8 +57,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); - - DropHelper.DropItemFromSetChance(player, 0.05f, ModContent.ItemType(), ModContent.ItemType()); + DropHelper.DropItemChance(player, ModContent.ItemType(), 0.05f); // Equipment DropHelper.DropItemChance(player, ModContent.ItemType(), 0.5f); diff --git a/Items/TreasureBags/SCalBag.cs b/Items/TreasureBags/SCalBag.cs new file mode 100644 index 0000000000..0478b55c4a --- /dev/null +++ b/Items/TreasureBags/SCalBag.cs @@ -0,0 +1,66 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; + +namespace CalamityMod.Items.TreasureBags +{ + public class SCalBag : ModItem + { + public override int BossBagNPC => ModContent.NPCType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Coffer"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = ItemRarityID.Purple; + item.expert = true; + } + + public override bool CanRightClick() => true; + + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); + + // Weapons + float w = DropHelper.BagWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(player, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + + // Equipment + DropHelper.DropItem(player, ModContent.ItemType()); + + // Vanity + if (Main.rand.NextBool(7)) + { + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + } + } + } +} diff --git a/Items/TreasureBags/SCalBag.png b/Items/TreasureBags/SCalBag.png new file mode 100644 index 0000000000..2fc6a926b0 Binary files /dev/null and b/Items/TreasureBags/SCalBag.png differ diff --git a/Items/TreasureBags/SandyAnglingKit.cs b/Items/TreasureBags/SandyAnglingKit.cs index 0adbb5a60a..f9e7e74797 100644 --- a/Items/TreasureBags/SandyAnglingKit.cs +++ b/Items/TreasureBags/SandyAnglingKit.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override bool CanRightClick() => true; diff --git a/Items/TreasureBags/SignusBag.cs b/Items/TreasureBags/SignusBag.cs new file mode 100644 index 0000000000..52b7d07205 --- /dev/null +++ b/Items/TreasureBags/SignusBag.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Signus; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags +{ + public class SignusBag : ModItem + { + public override int BossBagNPC => ModContent.NPCType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + 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 OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ModContent.ItemType(), 3, 4); + + // Weapons + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + + // Equipment + DropHelper.DropItem(player, ModContent.ItemType()); + + // Vanity + DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + } + } + } +} diff --git a/Items/TreasureBags/SignusBag.png b/Items/TreasureBags/SignusBag.png new file mode 100644 index 0000000000..5dac945ab2 Binary files /dev/null and b/Items/TreasureBags/SignusBag.png differ diff --git a/Items/TreasureBags/SlimeGodBag.cs b/Items/TreasureBags/SlimeGodBag.cs index 4ff7c12e68..533e2d577c 100644 --- a/Items/TreasureBags/SlimeGodBag.cs +++ b/Items/TreasureBags/SlimeGodBag.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -51,7 +51,8 @@ namespace CalamityMod.Items.TreasureBags DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - DropHelper.WeightStack(w) + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) ); // Equipment diff --git a/Items/TreasureBags/StarterBag.cs b/Items/TreasureBags/StarterBag.cs index aaa86fe5ac..1b9cb7fdc8 100644 --- a/Items/TreasureBags/StarterBag.cs +++ b/Items/TreasureBags/StarterBag.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override bool CanRightClick() => true; @@ -29,16 +29,16 @@ namespace CalamityMod.Items.TreasureBags public override void RightClick(Player player) { // Weapons - DropHelper.DropItem(player, ItemID.CopperBroadsword); - DropHelper.DropItem(player, ItemID.CopperBow); + DropHelper.DropItem(player, WorldGen.CopperTierOre == TileID.Copper ? ItemID.CopperBroadsword : ItemID.TinBroadsword); + DropHelper.DropItem(player, WorldGen.CopperTierOre == TileID.Copper ? ItemID.CopperBow : ItemID.TinBow); DropHelper.DropItem(player, ItemID.WoodenArrow, 100); - DropHelper.DropItem(player, ItemID.AmethystStaff); + DropHelper.DropItem(player, WorldGen.CopperTierOre == TileID.Copper ? ItemID.AmethystStaff : ItemID.TopazStaff); DropHelper.DropItem(player, ItemID.ManaCrystal); DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItem(player, ModContent.ItemType(), 150); // Tools / Utility - DropHelper.DropItem(player, ItemID.CopperHammer); + DropHelper.DropItem(player, WorldGen.CopperTierOre == TileID.Copper ? ItemID.CopperHammer : ItemID.TinHammer); DropHelper.DropItem(player, ItemID.Bomb, 10); DropHelper.DropItem(player, ItemID.MiningPotion); DropHelper.DropItem(player, ItemID.SpelunkerPotion, 2); @@ -51,8 +51,11 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItem(player, ItemID.Torch, 25); DropHelper.DropItem(player, ItemID.Chest, 3); - // Difficulty items (doesn't drop in Normal) - DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); + // Malice item + DropHelper.DropItem(player, ModContent.ItemType()); + + // Difficulty items (doesn't drop in Normal) + DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); DropHelper.DropItemCondition(player, ModContent.ItemType(), Main.expertMode); // Speedrun King Slime @@ -62,7 +65,7 @@ namespace CalamityMod.Items.TreasureBags DropHelper.DropItemCondition(player, ModContent.ItemType(), player.name == "Aleksh" || player.name == "Shark Lad"); // Music box (if music mod installed) - Mod musicMod = ModLoader.GetMod("CalamityModMusic"); + Mod musicMod = CalamityMod.Instance.musicMod; if (musicMod != null) DropHelper.DropItem(player, musicMod.ItemType("CalamityMusicbox")); } diff --git a/Items/TreasureBags/StormWeaverBag.cs b/Items/TreasureBags/StormWeaverBag.cs new file mode 100644 index 0000000000..df2d8d51a5 --- /dev/null +++ b/Items/TreasureBags/StormWeaverBag.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs.StormWeaver; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.TreasureBags +{ + public class StormWeaverBag : ModItem + { + public override int BossBagNPC => ModContent.NPCType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Bag"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + 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 OpenBossBag(Player player) + { + // Materials + DropHelper.DropItem(player, ModContent.ItemType(), 7, 10); + + // Weapons + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + DropHelper.DropItemChance(player, ModContent.ItemType(), 3); + + // Equipment (None yet boohoo) + + // Vanity + DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + if (Main.rand.NextBool(20)) + { + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + } + + // Light pet. + DropHelper.DropItemChance(player, ModContent.ItemType(), 8); + } + } +} diff --git a/Items/TreasureBags/StormWeaverBag.png b/Items/TreasureBags/StormWeaverBag.png new file mode 100644 index 0000000000..b61fd18fb8 Binary files /dev/null and b/Items/TreasureBags/StormWeaverBag.png differ diff --git a/Items/TreasureBags/SulphuricTreasure.cs b/Items/TreasureBags/SulphuricTreasure.cs index 295fa6917e..e853004cbd 100644 --- a/Items/TreasureBags/SulphuricTreasure.cs +++ b/Items/TreasureBags/SulphuricTreasure.cs @@ -19,123 +19,127 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 2; //Green for thematics + item.rare = ItemRarityID.Green; //Green for thematics } public override bool CanRightClick() => true; public override void RightClick(Player player) { - if (Main.rand.NextBool(15)) + // Loops 4 times to compensate for dropping only one treasure now + for (int i = 0; i < 4; i++) { - int potionType = Utils.SelectRandom(WorldGen.genRand, new int[] + if (Main.rand.NextBool(15)) { - ItemID.SpelunkerPotion, - ItemID.MagicPowerPotion, - ItemID.ShinePotion, - ItemID.WaterWalkingPotion, - ItemID.ObsidianSkinPotion, - ItemID.WaterWalkingPotion, - ItemID.GravitationPotion, - ItemID.RegenerationPotion, - ModContent.ItemType(), - ModContent.ItemType(), - ItemID.GillsPotion, - ItemID.EndurancePotion, - ItemID.HeartreachPotion, - ItemID.FlipperPotion, - ItemID.LifeforcePotion, - ItemID.InfernoPotion - }); - DropHelper.DropItem(player, potionType); - } - else - { - switch (Main.rand.Next(10)) + int potionType = Utils.SelectRandom(WorldGen.genRand, new int[] + { + ItemID.SpelunkerPotion, + ItemID.MagicPowerPotion, + ItemID.ShinePotion, + ItemID.WaterWalkingPotion, + ItemID.ObsidianSkinPotion, + ItemID.WaterWalkingPotion, + ItemID.GravitationPotion, + ItemID.RegenerationPotion, + ModContent.ItemType(), + ModContent.ItemType(), + ItemID.GillsPotion, + ItemID.EndurancePotion, + ItemID.HeartreachPotion, + ItemID.FlipperPotion, + ItemID.LifeforcePotion, + ItemID.InfernoPotion + }); + DropHelper.DropItem(player, potionType); + } + else { - case 0: - int glowstickAmt = Main.rand.Next(2, 6); - if (Main.expertMode) - { - glowstickAmt += Main.rand.Next(1, 7); - } - DropHelper.DropItem(player, ItemID.Glowstick, glowstickAmt); - break; - case 1: - DropHelper.DropItem(player, ItemID.JestersArrow, 10, 20); - break; - case 2: - DropHelper.DropItem(player, ItemID.HealingPotion); - break; - case 3: - DropHelper.DropItem(player, ItemID.Bomb, 5, 8); - break; - default: - int coinCount = 5000 + Main.rand.Next(-100, 101); - while (coinCount > 0) - { - if (coinCount > 1000000) + switch (Main.rand.Next(10)) + { + case 0: + int glowstickAmt = Main.rand.Next(2, 6); + if (Main.expertMode) { - int ptCoinAmt = coinCount / 1000000; - if (ptCoinAmt > 50 && Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - ptCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 1000000 * ptCoinAmt; - DropHelper.DropItem(player, ItemID.PlatinumCoin, ptCoinAmt); + glowstickAmt += Main.rand.Next(1, 7); } - else if (coinCount > 10000) + DropHelper.DropItem(player, ItemID.Glowstick, glowstickAmt); + break; + case 1: + DropHelper.DropItem(player, ItemID.JestersArrow, 10, 20); + break; + case 2: + DropHelper.DropItem(player, ItemID.HealingPotion); + break; + case 3: + DropHelper.DropItem(player, ItemID.Bomb, 5, 8); + break; + default: + int coinCount = 5000 + Main.rand.Next(-100, 101); + while (coinCount > 0) { - int auCoinAmt = coinCount / 10000; - if (auCoinAmt > 50 && Main.rand.NextBool(2)) + if (coinCount > 1000000) { - auCoinAmt /= Main.rand.Next(3) + 1; + int ptCoinAmt = coinCount / 1000000; + if (ptCoinAmt > 50 && Main.rand.NextBool(2)) + { + ptCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + ptCoinAmt /= Main.rand.Next(3) + 1; + } + coinCount -= 1000000 * ptCoinAmt; + DropHelper.DropItem(player, ItemID.PlatinumCoin, ptCoinAmt); } - if (Main.rand.NextBool(2)) + else if (coinCount > 10000) { - auCoinAmt /= Main.rand.Next(3) + 1; + int auCoinAmt = coinCount / 10000; + if (auCoinAmt > 50 && Main.rand.NextBool(2)) + { + auCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + auCoinAmt /= Main.rand.Next(3) + 1; + } + coinCount -= 10000 * auCoinAmt; + DropHelper.DropItem(player, ItemID.GoldCoin, auCoinAmt); + } + else if (coinCount > 100) + { + int agCoinAmt = coinCount / 100; + if (agCoinAmt > 50 && Main.rand.NextBool(2)) + { + agCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + agCoinAmt /= Main.rand.Next(3) + 1; + } + coinCount -= 100 * agCoinAmt; + DropHelper.DropItem(player, ItemID.SilverCoin, agCoinAmt); + } + else + { + int cuCoinAmt = coinCount; + if (cuCoinAmt > 50 && Main.rand.NextBool(2)) + { + cuCoinAmt /= Main.rand.Next(3) + 1; + } + if (Main.rand.NextBool(2)) + { + cuCoinAmt /= Main.rand.Next(4) + 1; + } + if (cuCoinAmt < 1) + { + cuCoinAmt = 1; + } + coinCount -= cuCoinAmt; + DropHelper.DropItem(player, ItemID.CopperCoin, cuCoinAmt); } - coinCount -= 10000 * auCoinAmt; - DropHelper.DropItem(player, ItemID.GoldCoin, auCoinAmt); } - else if (coinCount > 100) - { - int agCoinAmt = coinCount / 100; - if (agCoinAmt > 50 && Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - agCoinAmt /= Main.rand.Next(3) + 1; - } - coinCount -= 100 * agCoinAmt; - DropHelper.DropItem(player, ItemID.SilverCoin, agCoinAmt); - } - else - { - int cuCoinAmt = coinCount; - if (cuCoinAmt > 50 && Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(3) + 1; - } - if (Main.rand.NextBool(2)) - { - cuCoinAmt /= Main.rand.Next(4) + 1; - } - if (cuCoinAmt < 1) - { - cuCoinAmt = 1; - } - coinCount -= cuCoinAmt; - DropHelper.DropItem(player, ItemID.CopperCoin, cuCoinAmt); - } - } - break; + break; + } } } } diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index ea047a773e..7970a74788 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -10,6 +10,9 @@ using CalamityMod.NPCs.Yharon; using CalamityMod.World; using Terraria; using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Items.Accessories.Wings; +using CalamityMod.Items.Materials; namespace CalamityMod.Items.TreasureBags { @@ -29,7 +32,7 @@ namespace CalamityMod.Items.TreasureBags item.consumable = true; item.width = 24; item.height = 24; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.expert = true; } @@ -56,8 +59,13 @@ namespace CalamityMod.Items.TreasureBags ); // Equipment + DropHelper.DropItem(player, ModContent.ItemType()); DropHelper.DropItem(player, ModContent.ItemType()); + int soulFragMin = 22; + int soulFragMax = 28; + DropHelper.DropItem(player, ModContent.ItemType(), soulFragMin, soulFragMax); + // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); DropHelper.DropItemChance(player, ModContent.ItemType(), 10); diff --git a/Items/VoodooDemonVoodooDoll.cs b/Items/VoodooDemonVoodooDoll.cs new file mode 100644 index 0000000000..cf14e05b19 --- /dev/null +++ b/Items/VoodooDemonVoodooDoll.cs @@ -0,0 +1,38 @@ +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class VoodooDemonVoodooDoll : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Voodoo Demon Voodoo Doll"); + Tooltip.SetDefault("Favorite this item to prevent voodoo demons from spawning near you"); + } + public override void SetDefaults() + { + item.width = 44; + item.height = 34; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + } + + public override void UpdateInventory(Player player) + { + 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(); + } + } +} diff --git a/Items/VoodooDemonVoodooDoll.png b/Items/VoodooDemonVoodooDoll.png new file mode 100644 index 0000000000..d7febbd1c7 Binary files /dev/null and b/Items/VoodooDemonVoodooDoll.png differ diff --git a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs index a98360eb94..7c4d99b2c1 100644 --- a/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs +++ b/Items/Weapons/DraedonsArsenal/FrequencyManipulator.cs @@ -16,13 +16,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Tooltip.SetDefault("A long device, used in the tuning of some rather... original machines.\n" + "Swings a spear around and then throws it\n" + "On collision, the spear releases a burst of homing energy\n" + - "Stealth strikes releases more energy and explode on collision"); + "Stealth strikes release more energy and explode on collision"); } public override void SafeSetDefaults() { - item.damage = 67; - item.Calamity().rogue = true; + CalamityGlobalItem modItem = item.Calamity(); + + item.damage = 80; + modItem.rogue = true; item.noMelee = true; item.noUseGraphic = true; item.width = 26; @@ -35,22 +37,24 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = ItemRarityID.Red; - - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item1; item.shootSpeed = 16f; item.shoot = ModContent.ProjectileType(); - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 85; + modItem.UsesCharge = true; + modItem.MaxCharge = 85f; + modItem.ChargePerUse = 0.04f; } 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.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs index 57e6905184..a55146abb1 100644 --- a/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs +++ b/Items/Weapons/DraedonsArsenal/GalvanizingGlaive.cs @@ -7,22 +7,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class GalvanizingGlaive : ModItem + public class GalvanizingGlaive : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Galvanizing Glaive"); Tooltip.SetDefault("Its use as a tool is to quickly separate a single object into two. That is also its use as a weapon.\n" + - "Swings a spear which envelops struck foes in an energy field\n" + - "When done swinging, the spear discharges an extra pulse of energy\n" + - "Deals more damage against enemies with high defenses"); + "Swings a spear which envelops struck foes in an energy field\n" + + "When done swinging, the spear discharges an extra pulse of energy\n" + + "Deals more damage against enemies with high defenses"); } public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 56; item.height = 52; - item.damage = 84; + item.damage = 100; item.noMelee = true; item.noUseGraphic = true; item.channel = true; @@ -33,16 +35,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.knockBack = 9f; item.UseSound = SoundID.Item1; item.autoReuse = true; - + item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.value = CalamityGlobalItem.Rarity8BuyPrice; - + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 21f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 135; + modItem.UsesCharge = true; + modItem.MaxCharge = 135f; + modItem.ChargePerUse = 0.075f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -53,6 +56,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, swingOffset); return false; } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs index 34273833d8..0b1bd13c12 100644 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class GatlingLaser : ModItem { + // This is the amount of charge consumed every time the holdout projectile fires a laser. + public const float HoldoutChargeUse = 0.0075f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Gatling Laser"); @@ -18,6 +21,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 43; item.height = 24; item.magic = true; @@ -36,13 +41,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 135; + 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; diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs index 19faa95105..fb0c702115 100644 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ b/Items/Weapons/DraedonsArsenal/GaussDagger.cs @@ -9,34 +9,38 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class GaussDagger : ModItem { - public const int HitsRequiredForFlux = 3; + public const int HitsRequiredForFlux = 2; public override void SetStaticDefaults() { DisplayName.SetDefault("Gauss Dagger"); Tooltip.SetDefault("Slicing foes, it causes a flux of energy to form on the area tearing at them with turbulent forces.\n" + - "Repeat strikes envelop foes in magnetic flux"); + "Repeat strikes envelop foes in magnetic flux"); } public override void SetDefaults() { - item.damage = 30; + CalamityGlobalItem modItem = item.Calamity(); + + item.damage = 20; 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 = false; + item.useTurn = true; item.knockBack = 7f; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 50; + modItem.UsesCharge = true; + modItem.MaxCharge = 50f; + modItem.ChargePerUse = 0.05f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) @@ -47,6 +51,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal target.Calamity().GaussFluxTimer = 0; if (player.whoAmI == Main.myPlayer) { + if (crit) + damage /= 2; + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, target.whoAmI); } } diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs index 598cb296a5..ff9b51e329 100644 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ b/Items/Weapons/DraedonsArsenal/GaussPistol.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class GaussPistol : ModItem + public class GaussPistol : ModItem { public override void SetStaticDefaults() { @@ -16,11 +16,13 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 40; item.height = 22; item.magic = true; item.mana = 6; - item.damage = 130; + item.damage = 110; item.knockBack = 11f; item.useTime = item.useAnimation = 20; item.autoReuse = true; @@ -31,13 +33,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.Calamity().ChargeMax = 85; - item.Calamity().Chargeable = true; + modItem.MaxCharge = 85f; + modItem.UsesCharge = true; + modItem.ChargePerUse = 0.05f; } public override void AddRecipes() diff --git a/Items/Weapons/DraedonsArsenal/GaussRifle.cs b/Items/Weapons/DraedonsArsenal/GaussRifle.cs index 0c2525e927..9616aed0c3 100644 --- a/Items/Weapons/DraedonsArsenal/GaussRifle.cs +++ b/Items/Weapons/DraedonsArsenal/GaussRifle.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; @@ -19,12 +18,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 112; item.height = 36; item.ranged = true; - item.damage = 170; + item.damage = 150; item.knockBack = 30f; - item.useTime = item.useAnimation = 28; + item.useTime = item.useAnimation = 32; item.autoReuse = true; item.useStyle = ItemUseStyleID.HoldingOut; @@ -33,18 +34,19 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 27f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 135; + modItem.UsesCharge = true; + modItem.MaxCharge = 135f; + modItem.ChargePerUse = 0.1125f; } 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), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs index 1f2a9f2144..bce57c4285 100644 --- a/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs +++ b/Items/Weapons/DraedonsArsenal/HydraulicVoltCrasher.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,15 +8,20 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class HydraulicVoltCrasher : ModItem { + // This is the amount of charge consumed every frame the holdout projectile is summoned, i.e. the weapon is in use. + public const float HoldoutChargeUse = 0.002f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hydraulic Volt Crasher"); Tooltip.SetDefault("Good for both stamping metal plates and instantly fusing them, as well as crushing enemies.\n" + - "An electrically charged jackhammer which shocks all nearby foes on hit"); + "An electrically charged jackhammer which shocks all nearby foes on hit"); } public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.useStyle = ItemUseStyleID.HoldingOut; item.useAnimation = 16; item.useTime = 4; @@ -23,24 +29,27 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.knockBack = 12f; item.width = 56; item.height = 24; - item.damage = 70; + item.damage = 65; item.hammer = 230; item.UseSound = SoundID.Item23; item.shoot = ModContent.ProjectileType(); item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.noMelee = true; item.noUseGraphic = true; item.melee = true; item.channel = true; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 85; + modItem.UsesCharge = true; + modItem.MaxCharge = 85f; + 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 void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/DraedonsArsenal/LaserRifle.cs b/Items/Weapons/DraedonsArsenal/LaserRifle.cs index c626f3beee..8c7c871921 100644 --- a/Items/Weapons/DraedonsArsenal/LaserRifle.cs +++ b/Items/Weapons/DraedonsArsenal/LaserRifle.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class LaserRifle : ModItem + public class LaserRifle : ModItem { public override void SetStaticDefaults() { @@ -18,10 +18,12 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 84; item.height = 28; item.ranged = true; - item.damage = 270; + item.damage = 185; item.knockBack = 4f; item.useTime = 25; item.useAnimation = 25; @@ -33,13 +35,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 190; + modItem.UsesCharge = true; + modItem.MaxCharge = 190f; + modItem.ChargePerUse = 0.125f; } 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/DraedonsArsenal/MatterModulator.cs b/Items/Weapons/DraedonsArsenal/MatterModulator.cs index 19d30c57a7..3a23cd49a4 100644 --- a/Items/Weapons/DraedonsArsenal/MatterModulator.cs +++ b/Items/Weapons/DraedonsArsenal/MatterModulator.cs @@ -7,18 +7,21 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class MatterModulator : ModItem + public class MatterModulator : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Matter Modulator"); Tooltip.SetDefault("Using extra mass gained from collision with solid materials, it causes extra damage.\n" + - "Fires a burst of unstable matter that does significantly more damage after hitting a tile\n" + + "Fires a burst of unstable matter that does significant damage after striking a tile.\n" + + "Before striking a tile, the matter pierces infinitely but deals little damage.\n" + "Deals more damage against enemies with high defenses"); } public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 40; item.height = 22; item.ranged = true; @@ -33,13 +36,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; - item.Calamity().ChargeMax = 85; - item.Calamity().Chargeable = true; + modItem.UsesCharge = true; + modItem.MaxCharge = 85f; + modItem.ChargePerUse = 0.075f; } 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/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index 21f86ede3a..111768cff3 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class MountedScanner : ModItem + public class MountedScanner : ModItem { public override void SetStaticDefaults() { @@ -19,6 +19,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 26; item.height = 26; item.summon = true; @@ -34,10 +36,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity5BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; + + modItem.UsesCharge = true; + modItem.MaxCharge = 85f; + modItem.ChargePerUse = 0.85f; + modItem.ChargePerAltUse = 0f; } 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/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index c09ada5410..9ac5070780 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -10,10 +10,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { public class Phaseslayer : ModItem { - public const int Damage = 10200; + public const int Damage = 980; // When below this percentage of charge, the sword is small instead of big. - public const float SizeChargeThreshold = 0.33f; - public const float SmallDamageMultiplier = 0.66f; + public const float SizeChargeThreshold = 0.25f; + // The small sword barely affects damage on its own because damage is already dropping significantly at low charge. + public const float SmallDamageMultiplier = 0.9f; + // This is the amount of charge consumed every frame the holdout projectile is summoned, i.e. the weapon is in use. + public const float HoldoutChargeUse = 0.005f; + // This is the amount of charge consumed every time a sword beam is fired. + public const float SwordBeamChargeUse = 0.1f; public override void SetStaticDefaults() { @@ -26,6 +31,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal } public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.damage = Damage; item.melee = true; item.width = 26; @@ -38,21 +45,22 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.noUseGraphic = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 250; - 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().CurrentCharge > 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) { @@ -66,7 +74,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs index b39483b098..670409b303 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaCaster.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal // still awkward that the item called Plasma Rifle is the same class and exact same tier as this item public class PlasmaCaster : ModItem { - public const int BaseDamage = 1100; + public const int BaseDamage = 705; public override void SetStaticDefaults() { DisplayName.SetDefault("Plasma Caster"); @@ -21,6 +21,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 62; item.height = 30; item.magic = true; @@ -37,13 +39,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 190; + modItem.UsesCharge = true; + modItem.MaxCharge = 190f; + modItem.ChargePerUse = 0.32f; + modItem.ChargePerAltUse = 0.12f; // turbo mode is more energy inefficient } public override bool AltFunctionUse(Player player) => true; @@ -70,14 +74,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal velocity *= 5f; } - float SpeedX = velocity.X + (float)Main.rand.Next(-3, 4) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-3, 4) * 0.05f; + float SpeedX = velocity.X + Main.rand.Next(-3, 4) * 0.05f; + float SpeedY = velocity.Y + Main.rand.Next(-3, 4) * 0.05f; float damageMult = 1f; float kbMult = 1f; if (player.altFunctionUse == 2) { - SpeedX = velocity.X + (float)Main.rand.Next(-15, 16) * 0.05f; - SpeedY = velocity.Y + (float)Main.rand.Next(-15, 16) * 0.05f; + SpeedX = velocity.X + Main.rand.Next(-15, 16) * 0.05f; + SpeedY = velocity.Y + Main.rand.Next(-15, 16) * 0.05f; damageMult = 0.3333f; kbMult = 3f / 7f; } diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 30321274ad..01199662ac 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -15,39 +15,45 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { DisplayName.SetDefault("Plasma Grenade"); Tooltip.SetDefault("Each grenade contains a heavily condensed and heated unit of plasma. Use with care.\n" + - "Throws a grenade that explodes into plasma on collision\n" + + "Throws a grenade that explodes into plasma on collision\n" + "Stealth strikes explode violently on collision into a vaporizing blast\n" + - "Deals more damage against enemies with high defenses"); + "Deals more damage against enemies with high defenses"); } public override void SafeSetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 22; item.height = 28; - item.damage = 8572; + item.damage = 1378; item.noMelee = true; item.noUseGraphic = true; item.consumable = true; item.maxStack = 999; item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = item.useTime = 22; + item.useAnimation = item.useTime = 27; item.knockBack = 3f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.sellPrice(silver: 80); - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = Item.sellPrice(silver: 10); + item.rare = ItemRarityID.Purple; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 19f; - item.Calamity().rogue = true; + item.shootSpeed = 14f; + modItem.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) { - Projectile grenade = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - grenade.Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 1.05); + + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } @@ -56,7 +62,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 1); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this, 999); recipe.AddRecipe(); diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 2e7f7c4eb3..5155800c48 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -20,8 +19,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.shootSpeed = 10f; - item.damage = 700; + item.damage = 248; item.mana = 12; item.width = 38; item.height = 24; @@ -30,15 +31,20 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.noMelee = true; item.knockBack = 8f; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + 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; + + modItem.UsesCharge = true; + modItem.MaxCharge = 250f; + modItem.ChargePerUse = 1.25f; + modItem.ChargePerAltUse = 0f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -79,7 +85,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 25); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/DraedonsArsenal/PulseDragon.cs b/Items/Weapons/DraedonsArsenal/PulseDragon.cs index 7320effd5b..f647169ffa 100644 --- a/Items/Weapons/DraedonsArsenal/PulseDragon.cs +++ b/Items/Weapons/DraedonsArsenal/PulseDragon.cs @@ -13,13 +13,15 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { DisplayName.SetDefault("Pulse Dragon"); Tooltip.SetDefault("Heavy duty flails, each containing a powerful generator which is activated upon launch.\n" + - "Throws two dragon heads that emit electrical fields\n" + - "Especially effective against inorganic targets"); + "Throws two dragon heads that emit electrical fields\n" + + "Especially effective against inorganic targets"); } public override void SetDefaults() { - item.damage = 420; + CalamityGlobalItem modItem = item.Calamity(); + + item.damage = 300; item.melee = true; item.width = 30; item.height = 10; @@ -31,14 +33,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.knockBack = 8f; item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item1; item.autoReuse = true; item.channel = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 190; + + modItem.UsesCharge = true; + modItem.MaxCharge = 190f; + modItem.ChargePerUse = 0.32f; } 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/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index 059d128475..0659abbf32 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class PulsePistol : ModItem + public class PulsePistol : ModItem { public override void SetStaticDefaults() { @@ -18,6 +18,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 62; item.height = 22; item.magic = true; @@ -32,13 +34,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5.2f; // This may seem low but the shot has 10 extra updates. - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 50; + modItem.UsesCharge = true; + modItem.MaxCharge = 50f; + modItem.ChargePerUse = 0.05f; } 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/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 4ba2f4234f..a3284c60a7 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -8,9 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class PulseRifle : ModItem + public class PulseRifle : ModItem { - private int BaseDamage = 6560; + private int BaseDamage = 1420; public override void SetStaticDefaults() { @@ -22,6 +22,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 62; item.height = 22; item.ranged = true; @@ -35,15 +37,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PulseRifleFire"); item.noMelee = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 250; + modItem.UsesCharge = true; + modItem.MaxCharge = 250f; + modItem.ChargePerUse = 0.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) @@ -69,7 +72,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index 5e64af0270..9cc1ac8f71 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 28; item.height = 26; item.summon = true; @@ -34,36 +36,24 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = SoundID.Item15; item.noMelee = true; - item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; + + modItem.UsesCharge = true; + modItem.MaxCharge = 135f; + modItem.ChargePerUse = 1f; + modItem.ChargePerAltUse = 0f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); - if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) - { - int existingTurrets = player.ownedProjectileCounts[type]; - if (existingTurrets > 0) - { - for (int i = 0; i < Main.projectile.Length || existingTurrets > 0; i++) - { - if (Main.projectile[i].type == type && - Main.projectile[i].owner == player.whoAmI && - Main.projectile[i].active) - { - Main.projectile[i].Kill(); - existingTurrets--; - } - } - } - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); - //player.UpdateMaxTurrets(); - } + CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs index 1746d1d3ba..2051589a03 100644 --- a/Items/Weapons/DraedonsArsenal/SnakeEyes.cs +++ b/Items/Weapons/DraedonsArsenal/SnakeEyes.cs @@ -19,8 +19,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.shootSpeed = 10f; - item.damage = 40; + item.damage = 36; item.mana = 12; item.width = 38; item.height = 24; @@ -31,13 +33,18 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item15; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; + + modItem.UsesCharge = true; + modItem.MaxCharge = 190f; + modItem.ChargePerUse = 1f; + modItem.ChargePerAltUse = 0f; } 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/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs index b605333ad9..162ed1187d 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class StarSwallowerContainmentUnit : ModItem + public class StarSwallowerContainmentUnit : ModItem { public override void SetStaticDefaults() { @@ -19,6 +19,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.shootSpeed = 10f; item.damage = 24; item.mana = 10; @@ -30,12 +32,17 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.knockBack = 2.25f; item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item15; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; + + modItem.UsesCharge = true; + modItem.MaxCharge = 50f; + modItem.ChargePerUse = 0.8f; + modItem.ChargePerAltUse = 0f; } 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/DraedonsArsenal/SystemBane.cs b/Items/Weapons/DraedonsArsenal/SystemBane.cs index 0933169323..43cb0cfddf 100644 --- a/Items/Weapons/DraedonsArsenal/SystemBane.cs +++ b/Items/Weapons/DraedonsArsenal/SystemBane.cs @@ -8,21 +8,24 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class SystemBane : RogueWeapon + public class SystemBane : RogueWeapon { + public const int MaxDeployedProjectiles = 5; + public override void SetStaticDefaults() { DisplayName.SetDefault("System Bane"); Tooltip.SetDefault("Can be used to quickly send out an electromagnetic blast, strong enough to target organic nervous systems.\n" + - "Hurls an unstable device which sticks to the ground and shocks nearby enemies with lightning\n" + - "Stealth strikes make the device emit a large, damaging EMP field\n" + - "Stacks up to 5"); + "Hurls an unstable device which sticks to the ground and shocks nearby enemies with lightning\n" + + "Stealth strikes make the device emit a large, damaging EMP field"); } public override void SafeSetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.damage = 45; - item.Calamity().rogue = true; + modItem.rogue = true; item.noMelee = true; item.noUseGraphic = true; item.width = 42; @@ -34,32 +37,34 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.knockBack = 4f; item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item1; - item.maxStack = 5; item.shootSpeed = 16f; item.shoot = ModContent.ProjectileType(); - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 135; + modItem.UsesCharge = true; + modItem.MaxCharge = 135f; + modItem.ChargePerUse = 0.085f; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < item.stack; + 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) { - Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType(), 3); // Less materials are used than unusual because this projectile is stackable. - recipe.AddIngredient(ModContent.ItemType(), 1); - recipe.AddIngredient(ModContent.ItemType(), 1); + 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(); diff --git a/Items/Weapons/DraedonsArsenal/Taser.cs b/Items/Weapons/DraedonsArsenal/Taser.cs index 3d2ffcc3a4..19f7a9c04a 100644 --- a/Items/Weapons/DraedonsArsenal/Taser.cs +++ b/Items/Weapons/DraedonsArsenal/Taser.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class Taser : ModItem + public class Taser : ModItem { public override void SetStaticDefaults() { @@ -17,10 +17,12 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 50; item.height = 26; item.ranged = true; - item.damage = 28; + item.damage = 22; item.knockBack = 0f; item.useTime = item.useAnimation = 28; item.autoReuse = true; @@ -31,13 +33,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 50; + modItem.UsesCharge = true; + modItem.MaxCharge = 50f; + modItem.ChargePerUse = 0.05f; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index d9f3b175f2..30df63274a 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -8,9 +8,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class TeslaCannon : ModItem + public class TeslaCannon : ModItem { - private int BaseDamage = 10000; + private int BaseDamage = 1050; public override void SetStaticDefaults() { @@ -22,6 +22,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.width = 78; item.height = 28; item.magic = true; @@ -36,15 +38,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"); item.noMelee = true; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + modItem.customRarity = CalamityRarity.DraedonRust; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 250; + modItem.UsesCharge = true; + modItem.MaxCharge = 250f; + modItem.ChargePerUse = 0.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) @@ -70,7 +73,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 25); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index aa1c092411..08db5e5ffc 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -14,14 +14,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { DisplayName.SetDefault("Tracking Disk"); Tooltip.SetDefault("A weapon that, as it flies, processes calculations and fires lasers.\n" + - "Releases a flying disk that fires lasers at nearby enemies\n" + + "Releases a flying disk that fires lasers at nearby enemies\n" + "Stealth strikes allow the disk to fire multiple larger lasers at different targets.\n" + - "Deals less damage against enemies with high defense"); + "Deals less damage against enemies with high defense"); } public override void SafeSetDefaults() { + CalamityGlobalItem modItem = item.Calamity(); + item.damage = 25; - item.Calamity().rogue = true; + modItem.rogue = true; item.width = 30; item.height = 34; @@ -33,7 +35,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.Rarity3BuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.noUseGraphic = true; @@ -43,13 +45,16 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 50; + modItem.UsesCharge = true; + modItem.MaxCharge = 50f; + modItem.ChargePerUse = 0.08f; } 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.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/DraedonsArsenal/WavePounder.cs b/Items/Weapons/DraedonsArsenal/WavePounder.cs index e9e0cb1286..4de1908432 100644 --- a/Items/Weapons/DraedonsArsenal/WavePounder.cs +++ b/Items/Weapons/DraedonsArsenal/WavePounder.cs @@ -8,20 +8,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class WavePounder : RogueWeapon + public class WavePounder : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Wave Pounder"); Tooltip.SetDefault("It utilizes its power to send heavy shockwaves throughout the area, causing agonizing internal damage.\n" + - "Throws a bomb which explodes into a forceful shockwave\n" + + "Throws a bomb which explodes into a forceful shockwave\n" + "Stealth strikes emit absurdly powerful shockwaves"); } public override void SafeSetDefaults() { - item.damage = 34; - item.Calamity().rogue = true; + CalamityGlobalItem modItem = item.Calamity(); + + item.damage = 75; + modItem.rogue = true; item.noMelee = true; item.noUseGraphic = true; item.width = 26; @@ -35,19 +37,22 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; item.rare = ItemRarityID.Red; - item.Calamity().customRarity = CalamityRarity.DraedonRust; + modItem.customRarity = CalamityRarity.DraedonRust; item.UseSound = SoundID.Item1; item.shootSpeed = 16f; item.shoot = ModContent.ProjectileType(); - item.Calamity().Chargeable = true; - item.Calamity().ChargeMax = 190; + modItem.UsesCharge = true; + modItem.MaxCharge = 190f; + modItem.ChargePerUse = 0.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) { - Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Magic/AbyssShocker.cs b/Items/Weapons/Magic/AbyssShocker.cs index e038fa78b3..a407c83ed1 100644 --- a/Items/Weapons/Magic/AbyssShocker.cs +++ b/Items/Weapons/Magic/AbyssShocker.cs @@ -7,59 +7,42 @@ using CalamityMod.Projectiles.Magic; namespace CalamityMod.Items.Weapons.Magic { - public class AbyssShocker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyss Shocker"); - Tooltip.SetDefault("Fires an erratic lightning bolt that arcs and bounces between enemies"); - } + public class AbyssShocker : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyss Shocker"); + Tooltip.SetDefault("Fires an erratic lightning bolt that arcs and bounces between enemies"); + } - public override void SetDefaults() - { - item.damage = 28; + 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.height = 32; + item.useTime = 19; + item.useAnimation = 19; item.UseSound = SoundID.Item13; item.useStyle = ItemUseStyleID.HoldingOut; item.mana = 10; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; + item.Calamity().donorItem = true; + item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.Dedicated; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - } + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask"); - spriteBatch.Draw - ( - texture, - new Vector2 - ( - item.position.X - Main.screenPosition.X + item.width * 0.5f, - item.position.Y - Main.screenPosition.Y + item.height - texture.Height * 0.5f + 2f - ), - new Rectangle(0, 0, texture.Width, texture.Height), - Color.White, - rotation, - texture.Size() * 0.5f, - scale, - SpriteEffects.None, - 0f - ); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/AbyssShocker_mask")); } - public override Vector2? HoldoutOffset() - { - return new Vector2(-14, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-14, 0); } } \ No newline at end of file diff --git a/Items/Weapons/Magic/AbyssalTome.cs b/Items/Weapons/Magic/AbyssalTome.cs index 69d7613d45..4cd42459f2 100644 --- a/Items/Weapons/Magic/AbyssalTome.cs +++ b/Items/Weapons/Magic/AbyssalTome.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 6; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/AbyssalTome.png b/Items/Weapons/Magic/AbyssalTome.png index 3c233be4bb..30d307ced1 100644 Binary files a/Items/Weapons/Magic/AbyssalTome.png and b/Items/Weapons/Magic/AbyssalTome.png differ diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 3c739f5a43..95fc517808 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -17,17 +17,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 20; + item.damage = 15; item.magic = true; item.mana = 9; - item.width = 48; - item.height = 30; + item.width = 42; + item.height = 28; item.useTime = item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item13; item.autoReuse = true; item.shootSpeed = 14f; diff --git a/Items/Weapons/Magic/AcidGun.png b/Items/Weapons/Magic/AcidGun.png index 6c5d06e5f2..2113911825 100644 Binary files a/Items/Weapons/Magic/AcidGun.png and b/Items/Weapons/Magic/AcidGun.png differ diff --git a/Items/Weapons/Magic/AlphaRay.cs b/Items/Weapons/Magic/AlphaRay.cs index 10c235f734..d728535cfa 100644 --- a/Items/Weapons/Magic/AlphaRay.cs +++ b/Items/Weapons/Magic/AlphaRay.cs @@ -20,23 +20,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 280; + item.damage = 130; item.magic = true; item.mana = 5; item.width = 84; item.height = 74; - item.useTime = 3; - item.useAnimation = 3; + item.useTime = item.useAnimation = 4; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + 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.Violet; + item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -47,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.75), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX * 1.35f, speedY * 1.35f, ModContent.ProjectileType(), (int)(damage * 1.6625), knockBack, player.whoAmI, 0f, 0f); } else { @@ -66,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Magic { value9 -= vector7; } - Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)(damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 1.5f, speedY * 1.5f, type, (int)(damage * 0.8), knockBack, player.whoAmI, 0.0f, 0.0f); int laser = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX * 2f, speedY * 2f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.4), knockBack, player.whoAmI, 0f, 0f); Main.projectile[laser].timeLeft = 120; Main.projectile[laser].tileCollide = false; @@ -79,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 572d268e7d..dcbcecd9bb 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -24,11 +24,11 @@ namespace CalamityMod.Items.Weapons.Magic item.height = 52; item.useTime = 17; item.useAnimation = 17; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item9; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ApoctosisArray.cs b/Items/Weapons/Magic/ApoctosisArray.cs index b91cc6fbd4..12b0b3658a 100644 --- a/Items/Weapons/Magic/ApoctosisArray.cs +++ b/Items/Weapons/Magic/ApoctosisArray.cs @@ -12,14 +12,15 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Apoctosis Array"); Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + - "The higher your mana the more damage they will do\n" + - "Astral steroids can inhibit the potential of this weapon"); + "Damage scales with how full your mana is\n" + + "Using Astral Injection reduces the effectiveness of the mana boost"); } public override void SetDefaults() { + item.damage = 99; item.width = 98; - item.damage = 55; + item.height = 34; item.magic = true; item.mana = 12; item.useAnimation = 7; @@ -29,26 +30,27 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item91; item.autoReuse = true; item.noMelee = true; - item.height = 34; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-25, 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 manaAmount = (float)player.statMana * 0.01f; - float damageMult = manaAmount; - float injectionNerf = player.Calamity().astralInjection ? 0.6f : 1f; - int projectile = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * damageMult * injectionNerf), knockBack, player.whoAmI); - Main.projectile[projectile].scale = manaAmount * 0.375f; + float manaRatio = (float)player.statMana / player.statManaMax2; + bool injectionNerf = player.Calamity().astralInjection; + if (injectionNerf) + manaRatio = MathHelper.Min(manaRatio, 0.65f); + + // 20% to 160% damage. Astral Injection caps it at 111% damage. + float damageRatio = 0.2f + 1.4f * manaRatio; + int finalDamage = (int)(damage * damageRatio); + + Projectile proj = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, finalDamage, knockBack, player.whoAmI); + proj.scale = 0.75f + 0.75f * manaRatio; return false; } diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index 33b831c591..7066a7686c 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -22,41 +22,40 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 420; + item.damage = 77; item.magic = true; - item.mana = (int)42.0; + item.mana = 42; item.width = 30; item.height = 34; - item.useTime = 15; - item.useAnimation = 15; + item.useTime = item.useAnimation = 177; item.useStyle = ItemUseStyleID.HoldingOut; item.useTurn = false; item.noMelee = true; item.knockBack = 6.9f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + + 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 = 15.69f; - item.Calamity().customRarity = CalamityRarity.Developer; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 42.0f; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(15f, 15f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/ApotheosisGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.SpellTome); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddIngredient(ModContent.ItemType(), 33); + recipe.AddIngredient(ModContent.ItemType(), 11); recipe.AddIngredient(ModContent.ItemType(), 33); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); diff --git a/Items/Weapons/Magic/AquamarineStaff.cs b/Items/Weapons/Magic/AquamarineStaff.cs index 9d97e02474..3ebde0912c 100644 --- a/Items/Weapons/Magic/AquamarineStaff.cs +++ b/Items/Weapons/Magic/AquamarineStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ArchAmaryllis.cs b/Items/Weapons/Magic/ArchAmaryllis.cs index 81fc9e2cf6..7889b0db53 100644 --- a/Items/Weapons/Magic/ArchAmaryllis.cs +++ b/Items/Weapons/Magic/ArchAmaryllis.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Arch Amaryllis"); - Tooltip.SetDefault("Casts a beaming bolt that explodes into smaller homing bolts"); + Tooltip.SetDefault("Casts a beaming flower that explodes into homing petals"); Item.staff[item.type] = true; } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7.5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index 241ffa9457..17ea08ae5a 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -18,8 +18,8 @@ Fires spiritual claws that ignore walls and confuse enemies"); item.damage = 100; item.magic = true; item.mana = 18; - item.width = 34; - item.height = 22; + item.width = 28; + item.height = 24; item.useTime = 28; item.useAnimation = 28; item.useStyle = ItemUseStyleID.HoldingOut; @@ -27,7 +27,7 @@ Fires spiritual claws that ignore walls and confuse enemies"); item.noMelee = true; item.knockBack = 10f; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ArcticBearPaw.png b/Items/Weapons/Magic/ArcticBearPaw.png index 53ebc65b6a..08d3962445 100644 Binary files a/Items/Weapons/Magic/ArcticBearPaw.png and b/Items/Weapons/Magic/ArcticBearPaw.png differ diff --git a/Items/Weapons/Magic/AsteroidStaff.cs b/Items/Weapons/Magic/AsteroidStaff.cs index 4a2883c6f1..6895e322e6 100644 --- a/Items/Weapons/Magic/AsteroidStaff.cs +++ b/Items/Weapons/Magic/AsteroidStaff.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 180; + item.damage = 145; item.magic = true; - item.mana = 20; + item.mana = 18; item.width = 50; item.height = 50; item.useTime = 10; @@ -28,29 +28,16 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; item.UseSound = SoundID.Item88; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.Calamity().customRarity = CalamityRarity.Turquoise; + + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(12, 25); - } - - 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(); - } + 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) { @@ -100,5 +87,15 @@ namespace CalamityMod.Items.Weapons.Magic } return false; } + + 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(); + } } } diff --git a/Items/Weapons/Magic/AstralStaff.cs b/Items/Weapons/Magic/AstralStaff.cs index edc1c104b0..943febf838 100644 --- a/Items/Weapons/Magic/AstralStaff.cs +++ b/Items/Weapons/Magic/AstralStaff.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { item.damage = 270; - item.crit += 15; item.magic = true; item.mana = 26; item.width = 86; @@ -30,17 +29,17 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item105; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 15; + + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override void AddRecipes() { diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index 06e1de8eb6..4fd9d328e1 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 50; item.magic = true; item.mana = 19; item.width = 52; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 6f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item46; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index d4e39cb4a9..255277c242 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -6,7 +6,7 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { - public class Atlantis : ModItem + public class Atlantis : ModItem { public override void SetStaticDefaults() { @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item34; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/AuguroftheElements.cs b/Items/Weapons/Magic/AuguroftheElements.cs index 51a1db3ee7..fdd075b656 100644 --- a/Items/Weapons/Magic/AuguroftheElements.cs +++ b/Items/Weapons/Magic/AuguroftheElements.cs @@ -17,11 +17,10 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 180; + item.damage = 147; item.magic = true; - item.mana = 6; + item.mana = 11; item.width = 28; - item.crit = 3; item.height = 30; item.useTime = 2; item.reuseDelay = 5; @@ -29,26 +28,12 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item103; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } - - 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(); } 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,5 +61,18 @@ namespace CalamityMod.Items.Weapons.Magic Projectile.NewProjectile(vector2.X, vector2.Y, value2.X, value2.Y, type, damage, knockBack, player.whoAmI, num92, num91); return false; } + + 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(); + } } } diff --git a/Items/Weapons/Magic/BelchingSaxophone.cs b/Items/Weapons/Magic/BelchingSaxophone.cs index 8fc26474c8..58b90587df 100644 --- a/Items/Weapons/Magic/BelchingSaxophone.cs +++ b/Items/Weapons/Magic/BelchingSaxophone.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); //If a saxophone actually fired reeds, I'd be concerned. @@ -65,9 +65,12 @@ namespace CalamityMod.Items.Weapons.Magic ProjectileID.TiedEighthNote }); int note = Projectile.NewProjectile(position.X, position.Y, speedX * 0.75f, speedY * 0.75f, noteProj, (int)(damage * 0.75), knockBack, player.whoAmI); - Main.projectile[note].Calamity().forceMagic = true; //why are these notes also internally ranged - Main.projectile[note].usesLocalNPCImmunity = true; - Main.projectile[note].localNPCHitCooldown = 10; + if (note.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[note].Calamity().forceMagic = true; //why are these notes also internally ranged + Main.projectile[note].usesLocalNPCImmunity = true; + Main.projectile[note].localNPCHitCooldown = 10; + } } return false; } diff --git a/Items/Weapons/Magic/BittercoldStaff.cs b/Items/Weapons/Magic/BittercoldStaff.cs index 6e4f1250e8..2267481e48 100644 --- a/Items/Weapons/Magic/BittercoldStaff.cs +++ b/Items/Weapons/Magic/BittercoldStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item46; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/BlackAnurian.cs b/Items/Weapons/Magic/BlackAnurian.cs index e3fb247d6b..27c523b4bc 100644 --- a/Items/Weapons/Magic/BlackAnurian.cs +++ b/Items/Weapons/Magic/BlackAnurian.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2.75f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item111; item.autoReuse = true; item.shootSpeed = 8f; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index b332e3186a..be2257c645 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.75f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item21; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/BlushieStaff.cs b/Items/Weapons/Magic/BlushieStaff.cs index ce01ef316d..17c1f0f639 100644 --- a/Items/Weapons/Magic/BlushieStaff.cs +++ b/Items/Weapons/Magic/BlushieStaff.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,8 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 38; - item.height = 38; + item.width = item.height = 48; item.useStyle = ItemUseStyleID.HoldingUp; item.useAnimation = 30; item.useTime = 30; @@ -29,13 +27,15 @@ namespace CalamityMod.Items.Weapons.Magic item.autoReuse = false; item.useTurn = false; item.magic = true; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + + 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.Calamity().customRarity = CalamityRarity.ItemSpecific; } public override void AddRecipes() diff --git a/Items/Weapons/Magic/BlushieStaff.png b/Items/Weapons/Magic/BlushieStaff.png index 694d4e7934..95076800e4 100644 Binary files a/Items/Weapons/Magic/BlushieStaff.png and b/Items/Weapons/Magic/BlushieStaff.png differ diff --git a/Items/Weapons/Magic/BrimroseStaff.cs b/Items/Weapons/Magic/BrimroseStaff.cs index 0cca124237..beacae1302 100644 --- a/Items/Weapons/Magic/BrimroseStaff.cs +++ b/Items/Weapons/Magic/BrimroseStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/BurningSea.cs b/Items/Weapons/Magic/BurningSea.cs index 388f3cf209..1d37deee05 100644 --- a/Items/Weapons/Magic/BurningSea.cs +++ b/Items/Weapons/Magic/BurningSea.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 6.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/CalamitasInferno.cs b/Items/Weapons/Magic/CalamitasInferno.cs index d0646bf721..86f12a9afe 100644 --- a/Items/Weapons/Magic/CalamitasInferno.cs +++ b/Items/Weapons/Magic/CalamitasInferno.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; diff --git a/Items/Weapons/Magic/CalamitasInferno.png b/Items/Weapons/Magic/CalamitasInferno.png index 127f4b2dd6..a965af3c19 100644 Binary files a/Items/Weapons/Magic/CalamitasInferno.png and b/Items/Weapons/Magic/CalamitasInferno.png differ diff --git a/Items/Weapons/Magic/CarnageRay.cs b/Items/Weapons/Magic/CarnageRay.cs index 65e8197023..5799ff4e61 100644 --- a/Items/Weapons/Magic/CarnageRay.cs +++ b/Items/Weapons/Magic/CarnageRay.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Carnage Ray"); - Tooltip.SetDefault("Fires a blood ray that splits if enemies are near it"); + 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; } @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.25f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item72; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ClamorNoctus.cs b/Items/Weapons/Magic/ClamorNoctus.cs index 765734ec7c..53540a92a3 100644 --- a/Items/Weapons/Magic/ClamorNoctus.cs +++ b/Items/Weapons/Magic/ClamorNoctus.cs @@ -21,7 +21,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e public override void SetDefaults() { - item.damage = 450; + item.damage = 270; item.magic = true; item.mana = 12; item.width = 52; @@ -32,7 +32,7 @@ Fires night wyverns and stars from the sky that stick to enemies and tiles and e item.noMelee = true; item.knockBack = 5.2f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; item.UseSound = SoundID.Item105; item.autoReuse = true; diff --git a/Items/Weapons/Magic/Climax.cs b/Items/Weapons/Magic/Climax.cs index 83b316841c..15d9c50a84 100644 --- a/Items/Weapons/Magic/Climax.cs +++ b/Items/Weapons/Magic/Climax.cs @@ -20,18 +20,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 131; + item.damage = 105; item.magic = true; item.mana = 30; item.width = 78; item.height = 78; - item.useTime = 33; - item.useAnimation = 33; + item.useTime = 55; + item.useAnimation = 55; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -82,7 +82,7 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/ClothiersWrath.cs b/Items/Weapons/Magic/ClothiersWrath.cs index b34f78eb91..07a1d54859 100644 --- a/Items/Weapons/Magic/ClothiersWrath.cs +++ b/Items/Weapons/Magic/ClothiersWrath.cs @@ -10,7 +10,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Clothier's Wrath"); - } + Tooltip.SetDefault("Shoots 3 shadowflame skulls"); + } public override void SetDefaults() { @@ -24,14 +25,14 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ProjectileID.ClothiersCurse; item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = 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) { @@ -40,8 +41,9 @@ namespace CalamityMod.Items.Weapons.Magic for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceMagic = true; + int proj = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMagic = true; } return false; } diff --git a/Items/Weapons/Magic/CoralSpout.cs b/Items/Weapons/Magic/CoralSpout.cs index dfb49f3f8e..1db42eed40 100644 --- a/Items/Weapons/Magic/CoralSpout.cs +++ b/Items/Weapons/Magic/CoralSpout.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item17; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/CosmicRainbow.cs b/Items/Weapons/Magic/CosmicRainbow.cs index 5889350917..c83f21e62a 100644 --- a/Items/Weapons/Magic/CosmicRainbow.cs +++ b/Items/Weapons/Magic/CosmicRainbow.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 0f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item67; item.autoReuse = true; item.shoot = ProjectileID.RainbowFront; diff --git a/Items/Weapons/Magic/Cryophobia.cs b/Items/Weapons/Magic/Cryophobia.cs index 05d624d73b..48f8fbd671 100644 --- a/Items/Weapons/Magic/Cryophobia.cs +++ b/Items/Weapons/Magic/Cryophobia.cs @@ -1,6 +1,5 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,29 +10,30 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Cryophobia"); - Tooltip.SetDefault("Chill"); + Tooltip.SetDefault("Chill\n" + + "Fires an icy wave that splits multiple times and explodes into shards"); } public override void SetDefaults() { - item.damage = 24; + item.damage = 56; item.magic = true; item.mana = 18; item.width = 56; item.height = 34; - item.useTime = 22; - item.useAnimation = 22; + item.useTime = 28; + item.useAnimation = 28; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.5f; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.UseSound = SoundID.Item117; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.UseSound = SoundID.Item117; item.autoReuse = true; item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Magic/Cryophobia.png b/Items/Weapons/Magic/Cryophobia.png index d8111f09bb..2629ffcb8a 100644 Binary files a/Items/Weapons/Magic/Cryophobia.png and b/Items/Weapons/Magic/Cryophobia.png differ diff --git a/Items/Weapons/Magic/CrystalFlareStaff.cs b/Items/Weapons/Magic/CrystalFlareStaff.cs index 4e8c4f7daa..f40a5500db 100644 --- a/Items/Weapons/Magic/CrystalFlareStaff.cs +++ b/Items/Weapons/Magic/CrystalFlareStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.25f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/CrystalFlareStaff.png b/Items/Weapons/Magic/CrystalFlareStaff.png index 6ce9c83227..d46c91b4d0 100644 Binary files a/Items/Weapons/Magic/CrystalFlareStaff.png and b/Items/Weapons/Magic/CrystalFlareStaff.png differ diff --git a/Items/Weapons/Magic/DarkSpark.cs b/Items/Weapons/Magic/DarkSpark.cs index 46ef2d7c66..693cb510ba 100644 --- a/Items/Weapons/Magic/DarkSpark.cs +++ b/Items/Weapons/Magic/DarkSpark.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 100; + item.damage = 60; item.magic = true; item.mana = 10; item.width = 16; @@ -34,11 +34,12 @@ namespace CalamityMod.Items.Weapons.Magic item.noUseGraphic = true; item.channel = true; item.knockBack = 0f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + 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.Calamity().customRarity = CalamityRarity.Dedicated; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Magic/DeathValley.cs b/Items/Weapons/Magic/DeathValley.cs index 102be956ef..9a3560deef 100644 --- a/Items/Weapons/Magic/DeathValley.cs +++ b/Items/Weapons/Magic/DeathValley.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,15 +20,15 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 110; item.magic = true; item.mana = 9; - item.width = 28; - item.height = 32; + 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 = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/DeathValley.png b/Items/Weapons/Magic/DeathValley.png index 6f2294b75a..6b1bca9fbf 100644 Binary files a/Items/Weapons/Magic/DeathValley.png and b/Items/Weapons/Magic/DeathValley.png differ diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index f0fca04e3a..af14db8a61 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -20,23 +20,23 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 180; + item.damage = 155; item.magic = true; item.mana = 12; item.width = 80; item.height = 84; - item.useTime = 6; - item.useAnimation = 12; + item.useTime = 8; + item.useAnimation = 16; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item12; + 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.Calamity().customRarity = CalamityRarity.PureGreen; } /*public override Vector2? HoldoutOrigin() @@ -46,8 +46,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(40f, 42f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/DeathhailStaffGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) @@ -82,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Magic int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { - 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 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(91) * -(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 -= (float)(100 * num108); num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; diff --git a/Items/Weapons/Magic/DemonicPitchfork.cs b/Items/Weapons/Magic/DemonicPitchfork.cs index 6fd6aa0348..a4a7212492 100644 --- a/Items/Weapons/Magic/DemonicPitchfork.cs +++ b/Items/Weapons/Magic/DemonicPitchfork.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 6f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/DemonicPitchfork.png b/Items/Weapons/Magic/DemonicPitchfork.png index cc7864179d..6cea351c6c 100644 Binary files a/Items/Weapons/Magic/DemonicPitchfork.png and b/Items/Weapons/Magic/DemonicPitchfork.png differ diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs index 843c5dd217..c896620324 100644 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ b/Items/Weapons/Magic/DivineRetribution.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 39; item.magic = true; item.mana = 15; item.width = 66; @@ -29,19 +29,18 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + + 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.Calamity().customRarity = CalamityRarity.Dedicated; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + 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) { @@ -62,12 +61,12 @@ namespace CalamityMod.Items.Weapons.Magic { num80 = num72 / num80; } - int num107 = Main.rand.Next(5, 7); - for (int num108 = 0; num108 < num107; num108++) + int numProjectiles = 5; + for (int i = 0; i < numProjectiles; i++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 - vector2.Y += (float)(100 * num108); //-= + vector2.Y += (float)(100 * i); //-= num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; //+ - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; //+ - if (num79 < 0f) @@ -85,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Magic float speedX6 = num78 + (float)Main.rand.Next(-60, 61) * 0.02f; float speedY7 = num79 + (float)Main.rand.Next(-60, 61) * 0.02f; float ai1 = Main.rand.NextFloat() + 0.5f; - int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, ai1); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, damage, knockBack, player.whoAmI, 0.0f, ai1); } return false; } diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 03f3de9ebc..50c75edfca 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item13; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Downpour.png b/Items/Weapons/Magic/Downpour.png index db39ab03e4..9465a9ab71 100644 Binary files a/Items/Weapons/Magic/Downpour.png and b/Items/Weapons/Magic/Downpour.png differ diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index cb8d9ce1e7..cb64e6bd92 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 40; + item.damage = 49; item.magic = true; item.mana = 17; item.width = 56; @@ -26,23 +26,22 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item95; item.autoReuse = true; item.shootSpeed = 13f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() => new Vector2(-5, 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) { - for (int randomBullets = 0; randomBullets <= 4; randomBullets++) + for (int randomBullets = 0; randomBullets < 4; randomBullets++) { - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-25, 26) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-25, 26) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; diff --git a/Items/Weapons/Magic/EidolicWail.cs b/Items/Weapons/Magic/EidolicWail.cs index 619cbca78c..2bbb727c92 100644 --- a/Items/Weapons/Magic/EidolicWail.cs +++ b/Items/Weapons/Magic/EidolicWail.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 210; + item.damage = 126; item.magic = true; item.mana = 10; item.width = 60; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 1f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"); item.autoReuse = true; item.shootSpeed = 5f; diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index 00755343da..e32f7b5ec8 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Items.Weapons.Magic item.magic = true; item.mana = 7; item.width = 28; - item.crit = 5; item.height = 30; item.useTime = 7; item.useAnimation = 21; @@ -28,13 +27,16 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { int i = Main.myPlayer; diff --git a/Items/Weapons/Magic/EldritchTome.png b/Items/Weapons/Magic/EldritchTome.png index d7e49af5cc..b0afadb411 100644 Binary files a/Items/Weapons/Magic/EldritchTome.png and b/Items/Weapons/Magic/EldritchTome.png differ diff --git a/Items/Weapons/Magic/ElementalRay.cs b/Items/Weapons/Magic/ElementalRay.cs index 8bc5a8a053..aab9a458f9 100644 --- a/Items/Weapons/Magic/ElementalRay.cs +++ b/Items/Weapons/Magic/ElementalRay.cs @@ -12,37 +12,73 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Ray"); - Tooltip.SetDefault("Casts a rainbow ray that splits when enemies are near it"); + Tooltip.SetDefault("Casts four celestial beams near the player\n" + + "Solar beams explode into fire on enemy hits\n" + + "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; } public override void SetDefaults() { - item.damage = 120; + item.damage = 90; item.magic = true; item.mana = 18; item.width = 62; item.height = 62; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = 4; + item.reuseDelay = item.useAnimation = 15; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item60; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item60; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = 1; item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override Vector2? HoldoutOrigin() + public override Vector2? HoldoutOrigin() => new Vector2(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) { - return new Vector2(15, 15); - } + float offsetAngle = MathHelper.TwoPi * player.itemAnimation / player.itemAnimationMax; + offsetAngle += MathHelper.PiOver4 + Main.rand.NextFloat(0f, 1.3f); + float shootSpeed = 1f; - public override void AddRecipes() + if (player.itemAnimation == item.useAnimation - 1f) + type = ModContent.ProjectileType(); + 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) + { + type = ModContent.ProjectileType(); + shootSpeed = 2f; + } + else if (player.itemAnimation == item.useAnimation - item.useTime * 3 - 1) + type = ModContent.ProjectileType(); + else + return false; + + Vector2 spawnOffset = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).RotatedBy(offsetAngle) * -Main.rand.NextFloat(40f, 96f); + Vector2 shootDirection = (Main.MouseWorld - (position + spawnOffset)).SafeNormalize(Vector2.UnitX * player.direction); + int beam = Projectile.NewProjectile(position + spawnOffset, shootDirection * shootSpeed, type, damage, knockBack, player.whoAmI); + + // Define specific values for fired lightning. + if (type == ModContent.ProjectileType()) + { + Main.projectile[beam].ai[0] = shootDirection.ToRotation(); + Main.projectile[beam].ai[1] = Main.rand.Next(100); + } + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/Magic/Eternity.cs b/Items/Weapons/Magic/Eternity.cs index 4d5f927ffa..ff5129e621 100644 --- a/Items/Weapons/Magic/Eternity.cs +++ b/Items/Weapons/Magic/Eternity.cs @@ -12,17 +12,18 @@ namespace CalamityMod.Items.Weapons.Magic { public class Eternity : ModItem { - public const int BaseDamage = 4200; - public const int ExplosionDamage = 42000; + public const int BaseDamage = 840; + public const int ExplosionDamage = 8400; public const int MaxHomers = 40; public const int DustID = 16; public static readonly Color BlueColor = new Color(34, 34, 160); public static readonly Color PinkColor = new Color(169, 30, 184); + public override void SetStaticDefaults() { DisplayName.SetDefault("Eternity"); Tooltip.SetDefault("Hexes a possible nearby enemy, trapping them in a brilliant display of destruction\n" + - "This line is modified in ModifyTooltips"); + "This line is modified in ModifyTooltips"); } public override void SetDefaults() @@ -36,13 +37,16 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 0f; - item.value = Item.buyPrice(5, 0, 0, 0); + + 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.rare = 10; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void ModifyTooltips(List tooltips) @@ -60,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Magic 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(ModContent.ItemType(), 10); recipe.AddIngredient(ItemID.UnicornHorn, 5); diff --git a/Items/Weapons/Magic/EventHorizon.cs b/Items/Weapons/Magic/EventHorizon.cs index bb5632a978..115962a0e6 100644 --- a/Items/Weapons/Magic/EventHorizon.cs +++ b/Items/Weapons/Magic/EventHorizon.cs @@ -19,25 +19,24 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.width = 28; - item.height = 30; + item.width = 40; + item.height = 46; - item.damage = 369; + item.damage = 275; item.knockBack = 3.5f; item.noMelee = true; item.magic = true; item.mana = 12; - item.useTime = 28; - item.useAnimation = 28; + item.useTime = item.useAnimation = 32; item.useStyle = ItemUseStyleID.HoldingOut; item.autoReuse = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.UseSound = SoundID.Item84; + item.UseSound = SoundID.Item84; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; } diff --git a/Items/Weapons/Magic/EventHorizon.png b/Items/Weapons/Magic/EventHorizon.png index 64bad3c59e..87fe7e776e 100644 Binary files a/Items/Weapons/Magic/EventHorizon.png and b/Items/Weapons/Magic/EventHorizon.png differ diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index 36108ee45c..4a1ae4ba7b 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 4.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item13; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/EyeofMagnus.cs b/Items/Weapons/Magic/EyeofMagnus.cs index 5d67161a96..9d44d4f827 100644 --- a/Items/Weapons/Magic/EyeofMagnus.cs +++ b/Items/Weapons/Magic/EyeofMagnus.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { item.width = 80; - item.damage = 55; - item.rare = 5; + item.damage = 80; + item.rare = ItemRarityID.Cyan; item.useAnimation = 20; item.useTime = 20; item.useStyle = ItemUseStyleID.HoldingOut; @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Magic item.autoReuse = true; item.noMelee = true; item.height = 50; - item.value = Item.buyPrice(0, 36, 0, 0); - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index a67186ab49..f581260826 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 616; + item.damage = 125; item.magic = true; item.mana = 50; item.width = 84; @@ -29,13 +29,15 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + + 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 = 6f; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.shootSpeed = 13.5f; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 41586b9517..90c6ace174 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -14,13 +14,13 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Face Melter"); Tooltip.SetDefault("WOOO!! FAAAAAAANTASYY WORLDDDDD!\n" + - "Fires music notes\n" + - "Right click summons an amplifier that shoots towards your mouse"); + "Fires music notes\n" + + "Right click summons an amplifier that shoots towards your mouse"); } public override void SetDefaults() { - item.damage = 250; + item.damage = 140; item.magic = true; item.mana = 10; item.width = 56; @@ -30,9 +30,11 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(1, 80, 0, 0); + + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().donorItem = true; + item.shoot = ModContent.ProjectileType(); item.UseSound = SoundID.Item47; item.autoReuse = true; diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 33ae94d164..1e74e5475a 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 60; + item.damage = 120; item.magic = true; item.mana = 20; item.width = 80; @@ -29,27 +29,21 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; + + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; } - /*public override Vector2? HoldoutOrigin() + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - return new Vector2(15, 15); - }*/ + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow")); + } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(40f, 41f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/FatesRevealGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + 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 vector = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector.X; @@ -70,11 +64,12 @@ namespace CalamityMod.Items.Weapons.Magic num80 = item.shootSpeed / num80; } vector += new Vector2(num78, num79); - int num107 = 5; - for (int num108 = 0; num108 < num107; num108++) + + int numProjectiles = 5; + for (int i = 0; i < numProjectiles; i++) { vector.X += (float)Main.rand.Next(-100, 101); - vector.Y += (float)(Main.rand.Next(-25, 26) * num108); + vector.Y += (float)(Main.rand.Next(-25, 26) * i); float spawnX = vector.X; float spawnY = vector.Y; Projectile.NewProjectile(spawnX, spawnY, 0f, 0f, type, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(3)); diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index da9b0c74eb..73a6d78736 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ForbiddenSun.cs b/Items/Weapons/Magic/ForbiddenSun.cs index 87007c1587..7ea7a58824 100644 --- a/Items/Weapons/Magic/ForbiddenSun.cs +++ b/Items/Weapons/Magic/ForbiddenSun.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; diff --git a/Items/Weapons/Magic/FrigidflashBolt.cs b/Items/Weapons/Magic/FrigidflashBolt.cs index 04e0f7b5be..75b4c3ac37 100644 --- a/Items/Weapons/Magic/FrigidflashBolt.cs +++ b/Items/Weapons/Magic/FrigidflashBolt.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item21; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/FrostBolt.cs b/Items/Weapons/Magic/FrostBolt.cs index 76abfeb0b9..f3b82928d1 100644 --- a/Items/Weapons/Magic/FrostBolt.cs +++ b/Items/Weapons/Magic/FrostBolt.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/GammaFusillade.cs b/Items/Weapons/Magic/GammaFusillade.cs index a869bd3251..95cb7b463f 100644 --- a/Items/Weapons/Magic/GammaFusillade.cs +++ b/Items/Weapons/Magic/GammaFusillade.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 110; + item.damage = 80; item.magic = true; item.mana = 4; item.width = 28; @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item33; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Genisis.cs b/Items/Weapons/Magic/Genisis.cs index c0f9fed517..f492de10ed 100644 --- a/Items/Weapons/Magic/Genisis.cs +++ b/Items/Weapons/Magic/Genisis.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 55; + item.damage = 56; item.magic = true; item.mana = 4; item.width = 74; @@ -27,13 +27,12 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item33; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item33; item.autoReuse = true; item.shootSpeed = 6f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; //12 } public override Vector2? HoldoutOffset() @@ -49,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; for (int index = 0; index < num6; ++index) { - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, ProjectileID.LaserMachinegunLaser, (int)((double)damage * 0.65), knockBack * 0.6f, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.05f, SpeedY * 1.05f, ProjectileID.LaserMachinegunLaser, (int)(damage * 0.65), knockBack * 0.6f, player.whoAmI, 0f, 0f); Main.projectile[projectile].timeLeft = 120; } return false; diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index dd575e3f31..9fb0b8a40c 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 92; + item.damage = 80; item.magic = true; item.noUseGraphic = true; item.channel = true; @@ -29,35 +29,24 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); + + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) + // This weapon uses a holdout projectile. + 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) { - for (int i = 0; i < Main.projectile.Length; i++) - { - Projectile p = Main.projectile[i]; - if (p.active && p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) - { - return false; - } - } - return true; + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/GhastlyVisageGlow")); } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(16f, 16f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/GhastlyVisageGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/GleamingMagnolia.cs b/Items/Weapons/Magic/GleamingMagnolia.cs index 4a0ba906a5..b5b6f7f8c8 100644 --- a/Items/Weapons/Magic/GleamingMagnolia.cs +++ b/Items/Weapons/Magic/GleamingMagnolia.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Gleaming Magnolia"); - Tooltip.SetDefault("Casts a gleaming bolt that explodes into smaller bolts"); + Tooltip.SetDefault("Casts a gleaming flower that explodes into petals"); Item.staff[item.type] = true; } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/GleamingMagnolia.png b/Items/Weapons/Magic/GleamingMagnolia.png index 9e159acd3e..9191ec262d 100644 Binary files a/Items/Weapons/Magic/GleamingMagnolia.png and b/Items/Weapons/Magic/GleamingMagnolia.png differ diff --git a/Items/Weapons/Magic/HadopelagicEcho.cs b/Items/Weapons/Magic/HadopelagicEcho.cs index 7c918f6776..8fbdcfc37c 100644 --- a/Items/Weapons/Magic/HadopelagicEcho.cs +++ b/Items/Weapons/Magic/HadopelagicEcho.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 769; + item.damage = 230; item.magic = true; item.mana = 15; item.width = 60; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.autoReuse = true; item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Magic damageMult = 1.35f; if (counter == 4) damageMult = 1.5f; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, (float)counter, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, counter, 0f); counter++; if (counter >= 5) counter = 0; diff --git a/Items/Weapons/Magic/HarvestStaff.cs b/Items/Weapons/Magic/HarvestStaff.cs index a5c315414e..6fc1967281 100644 --- a/Items/Weapons/Magic/HarvestStaff.cs +++ b/Items/Weapons/Magic/HarvestStaff.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 15; item.magic = true; item.mana = 5; - item.width = 28; - item.height = 30; + 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 = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/HarvestStaff.png b/Items/Weapons/Magic/HarvestStaff.png index 991f230743..0425b98351 100644 Binary files a/Items/Weapons/Magic/HarvestStaff.png and b/Items/Weapons/Magic/HarvestStaff.png differ diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 2deb75603c..7dcf2abc09 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; @@ -15,7 +14,7 @@ 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"); + "Launches volatile star cores which erupt into colossal fusion blasts"); Item.staff[item.type] = true; } @@ -35,9 +34,9 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.UseSound = SoundID.Item73; - item.rare = 10; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Violet; - item.value = Item.buyPrice(2, 50, 0, 0); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; @@ -95,12 +94,11 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe r = new ModRecipe(mod); r.SetResult(this); - r.AddTile(ModContent.TileType()); + r.AddTile(TileID.LunarCraftingStation); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ModContent.ItemType(), 4); r.AddIngredient(ItemID.FragmentSolar, 80); r.AddIngredient(ItemID.FragmentNebula, 20); r.AddRecipe(); diff --git a/Items/Weapons/Magic/HellBurst.cs b/Items/Weapons/Magic/HellBurst.cs index 41f54b411d..979b5b2b30 100644 --- a/Items/Weapons/Magic/HellBurst.cs +++ b/Items/Weapons/Magic/HellBurst.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item34; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/HellBurst.png b/Items/Weapons/Magic/HellBurst.png index 26bfd79a0b..410a2fe98f 100644 Binary files a/Items/Weapons/Magic/HellBurst.png and b/Items/Weapons/Magic/HellBurst.png differ diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 630737529a..693f1d4143 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -73,19 +73,7 @@ namespace CalamityMod.Items.Weapons.Magic num80 = num72 / num80; } - int num130 = 7; - if (Main.rand.NextBool(6)) - { - num130++; - } - if (Main.rand.NextBool(7)) - { - num130++; - } - if (Main.rand.NextBool(8)) - { - num130++; - } + int num130 = 4; for (int num131 = 0; num131 < num130; num131++) { 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); diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 7f12e1787a..4d7d6b997b 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 75; item.magic = true; item.mana = 14; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.width = 48; item.height = 54; item.useTime = 22; diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs new file mode 100644 index 0000000000..6d04804a89 --- /dev/null +++ b/Items/Weapons/Magic/Heresy.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Magic; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class Heresy : ModItem + { + public override void SetStaticDefaults() + { + 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)); + } + + public override void SetDefaults() + { + item.damage = 444; + 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.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + + 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; + } +} \ No newline at end of file diff --git a/Items/Weapons/Magic/Heresy.png b/Items/Weapons/Magic/Heresy.png new file mode 100644 index 0000000000..4c8e3e4f8b Binary files /dev/null and b/Items/Weapons/Magic/Heresy.png differ diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index 45500e343c..63e08a161b 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ProjectileID.TruffleSpore; @@ -83,8 +83,11 @@ namespace CalamityMod.Items.Weapons.Magic spawnVec.X += (float)Main.rand.Next(-180, 181) * 0.02f; spawnVec.Y += (float)Main.rand.Next(-180, 181) * 0.02f; int proj = Projectile.NewProjectile(source, spawnVec, type, damage, knockBack, player.whoAmI, 0f, Main.rand.Next(3)); - Main.projectile[proj].Calamity().forceMagic = true; - Main.projectile[proj].timeLeft = CalamityUtils.SecondsToFrames(8f); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMagic = true; + Main.projectile[proj].timeLeft = CalamityUtils.SecondsToFrames(3f); + } } return false; } diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 0931211c2a..a6876d94d4 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Ammo; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,24 +14,26 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Ice Barrage"); Tooltip.SetDefault("Oh dear, you are dead!\n" + - "Casts a deadly and powerful ice spell in the location of the cursor\n" + - "This ice spell locks itself to the position of nearby enemies\n" + - "Consumes 2 Blood Runes every time its used"); + "Casts a deadly and powerful ice spell in the location of the cursor\n" + + "This ice spell locks itself to the position of nearby enemies\n" + + "Consumes 2 Blood Runes every time it's used"); } public override void SetDefaults() { item.width = 60; item.height = 60; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(1, 80, 0, 0); item.useStyle = ItemUseStyleID.HoldingUp; item.magic = true; item.mana = 180; item.noMelee = true; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/IceBarrageCast"); - item.damage = 5800; + 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; @@ -71,8 +72,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ItemID.IceRod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 23); - recipe.AddIngredient(ModContent.ItemType(), 18); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 18); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Magic/IcicleStaff.cs b/Items/Weapons/Magic/IcicleStaff.cs index dd038b4c7d..8071b50f6d 100644 --- a/Items/Weapons/Magic/IcicleStaff.cs +++ b/Items/Weapons/Magic/IcicleStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/IcicleTrident.cs b/Items/Weapons/Magic/IcicleTrident.cs index 78255e0839..d3f8dd24e2 100644 --- a/Items/Weapons/Magic/IcicleTrident.cs +++ b/Items/Weapons/Magic/IcicleTrident.cs @@ -19,8 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 69; item.magic = true; item.mana = 21; - item.width = 64; - item.height = 64; + item.width = item.height = 44; item.useTime = 25; item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingOut; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/IcicleTrident.png b/Items/Weapons/Magic/IcicleTrident.png index 5f408cc574..93cc8dc5f6 100644 Binary files a/Items/Weapons/Magic/IcicleTrident.png and b/Items/Weapons/Magic/IcicleTrident.png differ diff --git a/Items/Weapons/Magic/InfernalRift.cs b/Items/Weapons/Magic/InfernalRift.cs index b7db467ddf..58d9113b40 100644 --- a/Items/Weapons/Magic/InfernalRift.cs +++ b/Items/Weapons/Magic/InfernalRift.cs @@ -26,22 +26,21 @@ namespace CalamityMod.Items.Weapons.Magic item.useAnimation = 16; item.useTime = 4; item.reuseDelay = item.useAnimation + 6; - item.crit = 25; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item9; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override void AddRecipes() { diff --git a/Items/Weapons/Magic/InfernalRift.png b/Items/Weapons/Magic/InfernalRift.png index 4798dd7c57..a295a91644 100644 Binary files a/Items/Weapons/Magic/InfernalRift.png and b/Items/Weapons/Magic/InfernalRift.png differ diff --git a/Items/Weapons/Magic/IonBlaster.cs b/Items/Weapons/Magic/IonBlaster.cs index f85659f136..e1cf2a27fc 100644 --- a/Items/Weapons/Magic/IonBlaster.cs +++ b/Items/Weapons/Magic/IonBlaster.cs @@ -12,14 +12,15 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Ion Blaster"); Tooltip.SetDefault("Fires ion blasts that speed up and then explode\n" + - "The higher your mana the more damage they will do\n" + - "Astral steroids can inhibit the potential of this weapon"); + "Damage scales with how full your mana is\n" + + "Using Astral Injection reduces the effectiveness of the mana boost"); } public override void SetDefaults() { + item.damage = 43; item.width = 44; - item.damage = 30; + item.height = 28; item.magic = true; item.mana = 6; item.useAnimation = 10; @@ -29,25 +30,28 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item91; item.autoReuse = true; item.noMelee = true; - item.height = 28; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 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 manaAmount = (float)player.statMana * 0.01f; - float damageMult = manaAmount * 0.75f; - float injectionNerf = player.Calamity().astralInjection ? 0.6f : 1f; - int projectile = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * damageMult * injectionNerf), knockBack, player.whoAmI); - Main.projectile[projectile].scale = manaAmount; + float manaRatio = (float)player.statMana / player.statManaMax2; + bool injectionNerf = player.Calamity().astralInjection; + if (injectionNerf) + manaRatio = MathHelper.Min(manaRatio, 0.65f); + + // 20% to 160% damage. Astral Injection caps it at 111% damage. + float damageRatio = 0.2f + 1.4f * manaRatio; + int finalDamage = (int)(damage * damageRatio); + + Projectile proj = Projectile.NewProjectileDirect(position, new Vector2(speedX, speedY), type, finalDamage, knockBack, player.whoAmI); + proj.scale = 0.75f + 0.75f * manaRatio; return false; } diff --git a/Items/Weapons/Magic/Judgement.cs b/Items/Weapons/Magic/Judgement.cs index 50a9903fd5..a2285e9054 100644 --- a/Items/Weapons/Magic/Judgement.cs +++ b/Items/Weapons/Magic/Judgement.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public class Judgement : ModItem { public const int HitsPerFlash = 300; - public const int FlashBaseDamage = 80000; + public const int FlashBaseDamage = 16000; private const float SpawnAngleSpread = 0.4f * MathHelper.Pi; private const float SpeedRandomness = 0.08f; @@ -34,8 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic { item.width = 40; item.height = 42; - item.damage = 2077; - item.crit += 20; + item.damage = 415; item.knockBack = 4f; item.magic = true; item.mana = 6; @@ -51,15 +50,15 @@ namespace CalamityMod.Items.Weapons.Magic item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.value = Item.buyPrice(platinum: 5); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } - public override Vector2? HoldoutOffset() - { - return Vector2.Zero; - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + + public override Vector2? HoldoutOffset() => Vector2.Zero; 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/Keelhaul.cs b/Items/Weapons/Magic/Keelhaul.cs index 5485b3308d..5940f9615e 100644 --- a/Items/Weapons/Magic/Keelhaul.cs +++ b/Items/Weapons/Magic/Keelhaul.cs @@ -1,5 +1,4 @@ using CalamityMod.Projectiles.Magic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Keelhaul"); Tooltip.SetDefault("Summons a geyser upon hitting an enemy\n" + - "Crumple 'em like paper"); + "Crumple 'em like paper"); } public override void SetDefaults() @@ -29,9 +28,11 @@ namespace CalamityMod.Items.Weapons.Magic item.knockBack = 2f; item.UseSound = SoundID.Item102; item.autoReuse = true; - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(0, 80, 0, 0); + + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; } diff --git a/Items/Weapons/Magic/Lazhar.cs b/Items/Weapons/Magic/Lazhar.cs index e02e3b06f3..a41bec1727 100644 --- a/Items/Weapons/Magic/Lazhar.cs +++ b/Items/Weapons/Magic/Lazhar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item12; item.autoReuse = true; item.shootSpeed = 15f; diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index 2c3d052f59..bf0a6c890e 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -17,38 +17,33 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 100; + item.damage = 64; item.magic = true; item.mana = 4; item.width = 34; item.height = 36; - item.useTime = 3; - item.useAnimation = 3; + 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 = 10; + + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().donorItem = true; + item.UseSound = SoundID.Item9; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; - item.Calamity().customRarity = CalamityRarity.Dedicated; } 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 num6 = Main.rand.Next(2, 5); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(double)damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } + Vector2 beadVelocity = new Vector2(speedX, speedY) + Main.rand.NextVector2Square(-2.5f, 2.5f); + Projectile.NewProjectile(position, beadVelocity, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2.0), knockBack, player.whoAmI, 0.0f, 0.0f); - } + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage * 2, knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs index 3eea56cf0f..159170ac99 100644 --- a/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs +++ b/Items/Weapons/Magic/MadAlchemistsCocktailGlove.cs @@ -9,77 +9,70 @@ namespace CalamityMod.Items.Weapons.Magic { public class MadAlchemistsCocktailGlove : ModItem { - private int FlaskType = 0; - private int BaseDamage = 200; + private int flaskIndex = 0; + + private static int[] flaskIDs; public override void SetStaticDefaults() { DisplayName.SetDefault("Mad Alchemist's Cocktail Glove"); - Tooltip.SetDefault("Fires a variety of high-velocity flasks that have various effects\n" + - "Right click to throw a flask that inflicts a variety of debuffs"); + Tooltip.SetDefault("Fires a variety of high-velocity flasks\n" + + "Right click to throw a prismatic flask that inflicts many debuffs\n" + + "Red flasks explode violently, blue flasks contain poison gas,\n" + + "green flasks summon lunar flares and purple flasks explode into homing shrapnel"); + + flaskIDs = new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }; } + // Rest in peace Mad Cock, you will not be missed. + // Ozzatron 09FEB2021 public override void SetDefaults() { - item.damage = BaseDamage; + item.width = 26; + item.height = 36; + + item.damage = 182; item.magic = true; item.noUseGraphic = true; item.mana = 12; - item.width = 26; - item.height = 36; item.useTime = 15; item.useAnimation = 15; item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.UseSound = SoundID.Item106; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.shootSpeed = 19f; + + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().donorItem = true; } public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) => base.CanUseItem(player); - 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) { - type = ModContent.ProjectileType(); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 1.5f), knockBack, player.whoAmI, 0f, 0f); - } - else - { - switch (FlaskType) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - case 3: - type = ModContent.ProjectileType(); - break; - default: - break; - } - - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - - FlaskType++; - if (FlaskType > 3) - FlaskType = 0; + type = flaskIDs[4]; + return true; } - return false; + // Cycle through the flask types in a circle. + type = flaskIDs[flaskIndex++]; + if (flaskIndex > 3) + flaskIndex = 0; + return true; } public override void AddRecipes() @@ -89,10 +82,8 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ItemID.BottledWater, 15); recipe.AddIngredient(ItemID.Leather, 5); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + // 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(); diff --git a/Items/Weapons/Magic/MagnaCannon.cs b/Items/Weapons/Magic/MagnaCannon.cs index 2f5a987604..a3233114a6 100644 --- a/Items/Weapons/Magic/MagnaCannon.cs +++ b/Items/Weapons/Magic/MagnaCannon.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item117; item.autoReuse = true; item.shootSpeed = 12f; diff --git a/Items/Weapons/Magic/MagneticMeltdown.cs b/Items/Weapons/Magic/MagneticMeltdown.cs index 86e69eadd3..1cbfbd2074 100644 --- a/Items/Weapons/Magic/MagneticMeltdown.cs +++ b/Items/Weapons/Magic/MagneticMeltdown.cs @@ -1,9 +1,9 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { @@ -12,51 +12,50 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Magnetic Meltdown"); - Tooltip.SetDefault("Fires a spread of magnetic orbs"); + Tooltip.SetDefault("Launches a diamond cross of supercharged magnet spheres"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 90; + item.damage = 60; item.magic = true; - item.mana = 25; + item.mana = 40; item.width = 78; item.height = 78; - item.useTime = 27; - item.useAnimation = 27; + item.useTime = 49; + item.useAnimation = 49; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.knockBack = 4f; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(15, 15); - } + 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) { - for (int index = 0; index < 4; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 1f, 0f); - } + Vector2 v = new Vector2(speedX, speedY); + float offset = 3f; + + // Fire four orbs at once + Projectile.NewProjectile(position, v + offset * Vector2.UnitX, type, damage, knockBack, player.whoAmI, 1f); + Projectile.NewProjectile(position, v - offset * Vector2.UnitX, type, damage, knockBack, player.whoAmI, 1f); + Projectile.NewProjectile(position, v + offset * Vector2.UnitY, type, damage, knockBack, player.whoAmI, 1f); + Projectile.NewProjectile(position, v - offset * Vector2.UnitY, type, damage, knockBack, player.whoAmI, 1f); return false; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddIngredient(ItemID.SpectreStaff); recipe.AddIngredient(ItemID.MagnetSphere); recipe.AddTile(TileID.LunarCraftingStation); diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index 5f645699d6..cdf435b493 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Mana Rose"); - Tooltip.SetDefault("Casts a mana bolt that explodes into smaller bolts"); + Tooltip.SetDefault("Casts a mana flower that explodes into petals"); Item.staff[item.type] = true; } @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.25f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ManaRose.png b/Items/Weapons/Magic/ManaRose.png index c27713d21f..f8b5ca589e 100644 Binary files a/Items/Weapons/Magic/ManaRose.png and b/Items/Weapons/Magic/ManaRose.png differ diff --git a/Items/Weapons/Magic/Miasma.cs b/Items/Weapons/Magic/Miasma.cs index 57c768e313..74f9b0cc5a 100644 --- a/Items/Weapons/Magic/Miasma.cs +++ b/Items/Weapons/Magic/Miasma.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 35; + item.damage = 40; item.magic = true; item.mana = 16; item.width = 50; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -37,7 +37,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) { - for (int i = 0; i < Main.rand.Next(5, 8 + 1); i++) + for (int i = 0; i < Main.rand.Next(3, 5 + 1); i++) { Vector2 velocity = new Vector2(speedX, speedY) * Main.rand.NextFloat(0.9f, 1.1f); float angle = Main.rand.NextFloat(-1f, 1f) * MathHelper.ToRadians(30f); diff --git a/Items/Weapons/Magic/Mistlestorm.cs b/Items/Weapons/Magic/Mistlestorm.cs index bd39f7269f..5e1ddb257f 100644 --- a/Items/Weapons/Magic/Mistlestorm.cs +++ b/Items/Weapons/Magic/Mistlestorm.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 66; + item.damage = 45; item.magic = true; item.mana = 5; item.width = 48; @@ -28,13 +28,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item39; + 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.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/Mistlestorm.png b/Items/Weapons/Magic/Mistlestorm.png index d289a60730..9ff288dea4 100644 Binary files a/Items/Weapons/Magic/Mistlestorm.png and b/Items/Weapons/Magic/Mistlestorm.png differ diff --git a/Items/Weapons/Magic/NightsRay.cs b/Items/Weapons/Magic/NightsRay.cs index 7b4d0d00de..d30410c68c 100644 --- a/Items/Weapons/Magic/NightsRay.cs +++ b/Items/Weapons/Magic/NightsRay.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Ray"); - Tooltip.SetDefault("Fires a dark ray that splits if enemies are near it"); + 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; } @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.25f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item72; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/NuclearFury.cs b/Items/Weapons/Magic/NuclearFury.cs index 9a42be9721..635e075bc2 100644 --- a/Items/Weapons/Magic/NuclearFury.cs +++ b/Items/Weapons/Magic/NuclearFury.cs @@ -17,23 +17,22 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 95; + item.damage = 114; item.magic = true; item.mana = 13; - item.width = 28; - item.height = 30; + item.width = 38; + item.height = 40; item.useTime = 25; item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item84; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item84; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - 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/NuclearFury.png b/Items/Weapons/Magic/NuclearFury.png index 4d27ba75b8..769bea3119 100644 Binary files a/Items/Weapons/Magic/NuclearFury.png and b/Items/Weapons/Magic/NuclearFury.png differ diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index a562d2398f..3856a7edfa 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item46; item.noMelee = true; item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = CalamityGlobalItem.Rarity2BuyPrice; } diff --git a/Items/Weapons/Magic/PhantasmalFury.cs b/Items/Weapons/Magic/PhantasmalFury.cs index 5cd1e41a10..fbb1210012 100644 --- a/Items/Weapons/Magic/PhantasmalFury.cs +++ b/Items/Weapons/Magic/PhantasmalFury.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 260; + item.damage = 182; item.magic = true; item.mana = 20; item.width = 62; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7.5f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PhantasmalFury.png b/Items/Weapons/Magic/PhantasmalFury.png index a4f169f45d..771690f2d2 100644 Binary files a/Items/Weapons/Magic/PhantasmalFury.png and b/Items/Weapons/Magic/PhantasmalFury.png differ diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 74ffcbb075..95db22cf7f 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 290; + item.damage = 150; item.magic = true; item.mana = 20; item.width = 72; @@ -29,13 +29,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; + 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.Calamity().customRarity = CalamityRarity.DarkBlue; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index 5059626301..fb7f39ddff 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 8f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PlasmaRifle.cs b/Items/Weapons/Magic/PlasmaRifle.cs index c9b7130f6e..cd51c0e575 100644 --- a/Items/Weapons/Magic/PlasmaRifle.cs +++ b/Items/Weapons/Magic/PlasmaRifle.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 183; + item.damage = 160; item.mana = 40; item.magic = true; item.width = 48; @@ -27,13 +27,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + 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.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -70,12 +70,11 @@ namespace CalamityMod.Items.Weapons.Magic { if (player.altFunctionUse == 2) { + damage = (int)(damage * 1.15); Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } else - { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.8571), knockBack, player.whoAmI); - } + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.88), knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 59ed119a27..3a7b3af1ca 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PlasmaRod.png b/Items/Weapons/Magic/PlasmaRod.png index 16e0f471cb..2ca812d871 100644 Binary files a/Items/Weapons/Magic/PlasmaRod.png and b/Items/Weapons/Magic/PlasmaRod.png differ diff --git a/Items/Weapons/Magic/Poseidon.cs b/Items/Weapons/Magic/Poseidon.cs index 24642c3bad..d508d8ffb8 100644 --- a/Items/Weapons/Magic/Poseidon.cs +++ b/Items/Weapons/Magic/Poseidon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.knockBack = 6f; item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = SoundID.Item84; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 94c29f4e9d..7817b6accb 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 305; + item.damage = 170; item.magic = true; item.mana = 20; - item.width = 36; - item.height = 48; + 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 = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PrimordialAncient.png b/Items/Weapons/Magic/PrimordialAncient.png index b7ebeb7ae7..c88a407019 100644 Binary files a/Items/Weapons/Magic/PrimordialAncient.png and b/Items/Weapons/Magic/PrimordialAncient.png differ diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index 303278d42a..84e34ef27a 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -18,15 +18,15 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 60; item.magic = true; item.mana = 19; - item.width = 30; - item.height = 32; + 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 = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PrimordialEarth.png b/Items/Weapons/Magic/PrimordialEarth.png index 5d2bb137d8..b889894522 100644 Binary files a/Items/Weapons/Magic/PrimordialEarth.png and b/Items/Weapons/Magic/PrimordialEarth.png differ diff --git a/Items/Weapons/Magic/Purge.cs b/Items/Weapons/Magic/Purge.cs index 1aca1916f0..783abdb907 100644 --- a/Items/Weapons/Magic/Purge.cs +++ b/Items/Weapons/Magic/Purge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.channel = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; diff --git a/Items/Weapons/Magic/Purge.png b/Items/Weapons/Magic/Purge.png index 770f46c352..364192c1c9 100644 Binary files a/Items/Weapons/Magic/Purge.png and b/Items/Weapons/Magic/Purge.png differ diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index 8b231d57b1..e5391fbc74 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -7,43 +7,45 @@ namespace CalamityMod.Items.Weapons.Magic { public class PurgeGuzzler : ModItem { + private const float Spread = 0.025f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Purge Guzzler"); - Tooltip.SetDefault("Fires three beams of holy energy"); + Tooltip.SetDefault("Emits three beams of holy energy in a tight spread"); } public override void SetDefaults() { - item.damage = 80; - item.magic = true; - item.mana = 12; item.width = 58; item.height = 44; - item.useTime = 12; - item.useAnimation = 12; + item.damage = 211; + item.magic = true; + item.mana = 22; + item.useTime = 19; + item.useAnimation = 19; + item.autoReuse = true; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; + + 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) { - int numProj = 2; - float rotation = MathHelper.ToRadians(4); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; + Vector2 velocity = new Vector2(speedX, speedY); + + // Fire extra lasers to the left and right + Projectile.NewProjectile(position, velocity.RotatedBy(-Spread), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, velocity.RotatedBy(+Spread), type, damage, knockBack, player.whoAmI); + + // Still also fire the center laser + return true; } } } diff --git a/Items/Weapons/Magic/RainbowPartyCannon.cs b/Items/Weapons/Magic/RainbowPartyCannon.cs new file mode 100644 index 0000000000..a346414cf1 --- /dev/null +++ b/Items/Weapons/Magic/RainbowPartyCannon.cs @@ -0,0 +1,79 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + public class RainbowPartyCannon : ModItem + { + public static readonly Color[] ColorSet = new Color[] + { + new Color(188, 192, 193), // White + new Color(157, 100, 183), // Purple + new Color(249, 166, 77), // Honey-ish orange + new Color(255, 105, 234), // Pink + new Color(67, 204, 219), // Sky blue + new Color(249, 245, 99), // Bright yellow + new Color(236, 168, 247), // Purplish pink + }; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rainbow Party Cannon"); + Tooltip.SetDefault("Let the rainbow remind you that together we will always shine..."); + } + + 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; + } + + public override void ModifyTooltips(List tooltips) + { + 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(); + } + } +} diff --git a/Items/Weapons/Magic/RainbowPartyCannon.png b/Items/Weapons/Magic/RainbowPartyCannon.png new file mode 100644 index 0000000000..10b7ca96e9 Binary files /dev/null and b/Items/Weapons/Magic/RainbowPartyCannon.png differ diff --git a/Items/Weapons/Magic/RecitationoftheBeast.cs b/Items/Weapons/Magic/RecitationoftheBeast.cs index d5387412f5..70c73c1e1d 100644 --- a/Items/Weapons/Magic/RecitationoftheBeast.cs +++ b/Items/Weapons/Magic/RecitationoftheBeast.cs @@ -23,8 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 24; item.width = 38; item.height = 34; - item.damage = 300; - item.crit += 20; + item.damage = 128; item.noMelee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.HoldingOut; @@ -33,13 +32,16 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item8; item.autoReuse = true; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.magic = true; item.Calamity().customRarity = CalamityRarity.DarkBlue; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + 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 spread = 60f * 0.0174f; diff --git a/Items/Weapons/Magic/RelicofRuin.cs b/Items/Weapons/Magic/RelicofRuin.cs index 7f3204d7af..ab670ac5e8 100644 --- a/Items/Weapons/Magic/RelicofRuin.cs +++ b/Items/Weapons/Magic/RelicofRuin.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 20; item.magic = true; item.mana = 16; - item.width = 28; - item.height = 30; + 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 = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item84; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/RelicofRuin.png b/Items/Weapons/Magic/RelicofRuin.png index cc24105778..1ad77b6431 100644 Binary files a/Items/Weapons/Magic/RelicofRuin.png and b/Items/Weapons/Magic/RelicofRuin.png differ diff --git a/Items/Weapons/Magic/RougeSlash.cs b/Items/Weapons/Magic/RougeSlash.cs index 0159ae94c4..68f6878d6c 100644 --- a/Items/Weapons/Magic/RougeSlash.cs +++ b/Items/Weapons/Magic/RougeSlash.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 90; + item.damage = 61; item.magic = true; item.mana = 30; item.width = 28; @@ -27,19 +27,18 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7.5f; item.UseSound = SoundID.Item91; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, speedX * 0.6f, speedY * 0.6f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.8f, speedY * 0.8f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX * 0.6f, speedY * 0.6f, ModContent.ProjectileType(), damage / 2, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Magic/RougeSlash.png b/Items/Weapons/Magic/RougeSlash.png index 8a8812597d..ff33eb0e1b 100644 Binary files a/Items/Weapons/Magic/RougeSlash.png and b/Items/Weapons/Magic/RougeSlash.png differ diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index 6a6cdd625e..f4902b57f6 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -11,10 +11,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("SHPC"); - Tooltip.SetDefault("Legendary Drop\n" + - "Fires plasma orbs that linger and emit massive explosions\n" + - "Right click to fire powerful energy beams\n" + - "Revengeance drop"); + Tooltip.SetDefault("Fires plasma orbs that linger and emit massive explosions\n" + + "Right click to fire powerful energy beams"); } public override void SetDefaults() @@ -22,20 +20,21 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 22; item.magic = true; item.mana = 20; - item.width = 96; - item.height = 34; + item.width = 90; + item.height = 42; item.useTime = item.useAnimation = 7; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.25f; - item.rare = 5; - item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = SoundID.Item92; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Magic/SHPC.png b/Items/Weapons/Magic/SHPC.png index 5076987e82..dd59cda99a 100644 Binary files a/Items/Weapons/Magic/SHPC.png and b/Items/Weapons/Magic/SHPC.png differ diff --git a/Items/Weapons/Magic/SanguineFlare.cs b/Items/Weapons/Magic/SanguineFlare.cs index 3bee34a1cd..a4d62c4d3c 100644 --- a/Items/Weapons/Magic/SanguineFlare.cs +++ b/Items/Weapons/Magic/SanguineFlare.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 220; + item.damage = 143; item.magic = true; item.mana = 22; item.width = 56; @@ -28,13 +28,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 8f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; + 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.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index c9acd0befb..911f7f1b77 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.knockBack = 6.75f; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/FlareSound"); item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; diff --git a/Items/Weapons/Magic/Serpentine.cs b/Items/Weapons/Magic/Serpentine.cs index c9f481b19d..c8d9716c1a 100644 --- a/Items/Weapons/Magic/Serpentine.cs +++ b/Items/Weapons/Magic/Serpentine.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = SoundID.Item20; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; diff --git a/Items/Weapons/Magic/ShadecrystalTome.cs b/Items/Weapons/Magic/ShadecrystalTome.cs index 25a3624454..7486ebcab9 100644 --- a/Items/Weapons/Magic/ShadecrystalTome.cs +++ b/Items/Weapons/Magic/ShadecrystalTome.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item9; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -40,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Magic int num6 = Main.rand.Next(1, 3); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(double)damage, knockBack, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index df4e88c5c5..18621a4698 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 0f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item66; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index a62dad29a0..1734433b95 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 200; + item.damage = 250; item.magic = true; item.mana = 20; item.width = 58; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 8f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item72; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/ShadowboltStaff.png b/Items/Weapons/Magic/ShadowboltStaff.png index c950e434b2..c6f646355e 100644 Binary files a/Items/Weapons/Magic/ShadowboltStaff.png and b/Items/Weapons/Magic/ShadowboltStaff.png differ diff --git a/Items/Weapons/Magic/ShadowdropStaff.cs b/Items/Weapons/Magic/ShadowdropStaff.cs index 296c86aa69..58f355fcc2 100644 --- a/Items/Weapons/Magic/ShadowdropStaff.cs +++ b/Items/Weapons/Magic/ShadowdropStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item66; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons.Magic num80 = num72 / num80; } - int num107 = 10; + int num107 = 3; for (int num108 = 0; num108 < num107; num108++) { 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); @@ -95,8 +95,8 @@ namespace CalamityMod.Items.Weapons.Magic num80 = num72 / num80; num78 *= num80; num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(10)); } return false; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index e17a447727..49303807f9 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.UseSound = SoundID.Item20; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Magic/SirensSong.cs b/Items/Weapons/Magic/SirensSong.cs index 882f0e9e6e..eba4543f7b 100644 --- a/Items/Weapons/Magic/SirensSong.cs +++ b/Items/Weapons/Magic/SirensSong.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 6.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index 941e02af33..d22cdf230d 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item102; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/SlitheringEels.cs b/Items/Weapons/Magic/SlitheringEels.cs index eddd1e7ff8..da819d3a84 100644 --- a/Items/Weapons/Magic/SlitheringEels.cs +++ b/Items/Weapons/Magic/SlitheringEels.cs @@ -26,12 +26,13 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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) { Projectile.NewProjectile(position, new Vector2(speedX, speedY).RotatedByRandom(0.325f), type, damage, knockBack, player.whoAmI); diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 2bf94b296b..161c6a5276 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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 7fb36a4fe8..95d6f233fb 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -19,18 +19,17 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 155; + item.damage = 115; item.magic = true; item.mana = 19; item.width = 64; item.height = 64; - item.useTime = 20; - item.useAnimation = 20; + 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 = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item73; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -45,15 +44,13 @@ namespace CalamityMod.Items.Weapons.Magic public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(32f, 30f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SoulPiercerGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddRecipeGroup("NForEE", 6); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Magic/StardustStaff.cs b/Items/Weapons/Magic/StardustStaff.cs index 77264c15f6..5936bd5feb 100644 --- a/Items/Weapons/Magic/StardustStaff.cs +++ b/Items/Weapons/Magic/StardustStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Starfall.cs b/Items/Weapons/Magic/Starfall.cs index 58846ac042..ca65ff12ac 100644 --- a/Items/Weapons/Magic/Starfall.cs +++ b/Items/Weapons/Magic/Starfall.cs @@ -17,12 +17,11 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { item.damage = 50; - item.crit += 25; item.magic = true; item.mana = 15; - item.rare = 9; - item.width = 28; - item.height = 30; + item.rare = ItemRarityID.Cyan; + item.width = 38; + item.height = 40; item.useTime = 14; item.useAnimation = 14; item.useStyle = ItemUseStyleID.HoldingOut; @@ -35,6 +34,9 @@ namespace CalamityMod.Items.Weapons.Magic item.shootSpeed = 12f; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + 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; diff --git a/Items/Weapons/Magic/Starfall.png b/Items/Weapons/Magic/Starfall.png index ff885d0508..7ea9495ba0 100644 Binary files a/Items/Weapons/Magic/Starfall.png and b/Items/Weapons/Magic/Starfall.png differ diff --git a/Items/Weapons/Magic/StormSpray.cs b/Items/Weapons/Magic/StormSpray.cs index afa23b2fd0..943f2e3ff8 100644 --- a/Items/Weapons/Magic/StormSpray.cs +++ b/Items/Weapons/Magic/StormSpray.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item13; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/StratusSphere.cs b/Items/Weapons/Magic/StratusSphere.cs index 0f754b82ef..db5ed2dcbc 100644 --- a/Items/Weapons/Magic/StratusSphere.cs +++ b/Items/Weapons/Magic/StratusSphere.cs @@ -13,11 +13,11 @@ namespace CalamityMod.Items.Weapons.Magic { DisplayName.SetDefault("Stratus Sphere"); Tooltip.SetDefault("Fires an energy orb containing the essence of our stratosphere\n" + - "Up to six of these can be active at a time"); + "Up to six of these can be active at a time"); } public override void SetDefaults() { - item.damage = 419; + item.damage = 251; item.noMelee = true; item.magic = true; item.width = 22; @@ -30,29 +30,19 @@ namespace CalamityMod.Items.Weapons.Magic item.mana = 30; item.knockBack = 2; item.UseSound = SoundID.Item20; - item.rare = 4; + 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 = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[item.shoot] >= 6) - { - return false; - } - else - { - return true; - } - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 6; - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 5); diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index ce180eb264..01566b5b5f 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -11,45 +11,39 @@ namespace CalamityMod.Items.Weapons.Magic { public class SubsumingVortex : ModItem { - public const int MaxVortexCount = 4; public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); - Tooltip.SetDefault("Fires a giant slow-moving vortex\n" + - "When an enemy is nearby, the vortex releases tentacles that redirect towards the enemy.\n" + - "After some time, the vortex slows down, charges, and eventually explodes.\n" + - $"Only {MaxVortexCount} vortexes can exist at once."); + Tooltip.SetDefault("Releases a gigantic, slow-moving vortex\n" + + "The vortex releases exo tentacles that thrash at nearby enemies\n" + + "After a few seconds the vortex slows down, becomes unstable, and explodes"); } public override void SetDefaults() { - item.damage = 480; + item.damage = 175; item.magic = true; - item.mana = 20; + item.mana = 78; item.width = 38; item.height = 48; item.UseSound = SoundID.Item84; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = item.useAnimation = 60; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = Item.buyPrice(platinum: 2, gold: 50); item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; - item.Calamity().customRarity = CalamityRarity.Violet; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(19f, 22f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Magic/SubsumingVortexGlow")); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] < MaxVortexCount; - 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), type, damage, knockBack, player.whoAmI); diff --git a/Items/Weapons/Magic/T1000.cs b/Items/Weapons/Magic/T1000.cs index 3410bb3509..8ac53ca068 100644 --- a/Items/Weapons/Magic/T1000.cs +++ b/Items/Weapons/Magic/T1000.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 300; + item.damage = 250; item.magic = true; item.mana = 10; item.width = 20; @@ -30,13 +30,13 @@ namespace CalamityMod.Items.Weapons.Magic item.noUseGraphic = true; item.channel = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.autoReuse = true; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; + item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.Calamity().customRarity = CalamityRarity.Violet; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType()); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Weapons/Magic/T1000.png b/Items/Weapons/Magic/T1000.png index 019dc1c48b..dad467ea72 100644 Binary files a/Items/Weapons/Magic/T1000.png and b/Items/Weapons/Magic/T1000.png differ diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index b30c6c2aaf..1c335d7cc8 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index 578f2652bb..2eaacb9a7a 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Terra Ray"); - Tooltip.SetDefault("Casts an energy ray that splits if enemies are near it"); + 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; } @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item60; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -41,7 +42,15 @@ namespace CalamityMod.Items.Weapons.Magic return new Vector2(15, 15); } - public override void AddRecipes() + 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 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootPosition = position + shootVelocity * 8f; + Projectile.NewProjectile(shootPosition, shootVelocity, type, damage, knockBack, player.whoAmI); + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Magic/TheSwarmer.cs b/Items/Weapons/Magic/TheSwarmer.cs index 8618c2cbdc..d8eadef0d8 100644 --- a/Items/Weapons/Magic/TheSwarmer.cs +++ b/Items/Weapons/Magic/TheSwarmer.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.Wasp; @@ -54,17 +54,23 @@ namespace CalamityMod.Items.Weapons.Magic { float SpeedX = speedX + (float)Main.rand.Next(-35, 36) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; - int wasps = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, 0f, player.whoAmI, 0f, 0f); - Main.projectile[wasps].penetrate = 1; - Main.projectile[wasps].Calamity().forceMagic = true; + int wasps = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, 0f, player.whoAmI); + if (wasps.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[wasps].penetrate = 1; + Main.projectile[wasps].Calamity().forceMagic = true; + } } for (int i = 0; i <= 3; i++) { 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, 0f, 0f); - Main.projectile[bees].penetrate = 1; - Main.projectile[bees].Calamity().forceMagic = true; + 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; + Main.projectile[bees].Calamity().forceMagic = true; + } } return false; } diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index c5d2d616a3..43f34b0c29 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Magic { public class TheWand : ModItem { - public static int BaseDamage = 998; + public static int BaseDamage = 599; public override void SetStaticDefaults() { @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.autoReuse = true; item.height = 36; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.Violet; diff --git a/Items/Weapons/Magic/ThornBlossom.cs b/Items/Weapons/Magic/ThornBlossom.cs index 78ee67d598..6d386a0c23 100644 --- a/Items/Weapons/Magic/ThornBlossom.cs +++ b/Items/Weapons/Magic/ThornBlossom.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 45; + item.damage = 35; item.magic = true; item.mana = 10; item.width = 66; @@ -28,29 +28,29 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item109; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; + item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } 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) { - player.statLife -= 5; + player.statLife -= 3; if (player.statLife <= 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " was violently pricked by a flower."), 1000.0, 0, false); } for (int index = 0; index < 3; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-120, 121) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-120, 121) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.5f, SpeedY * 1.5f, ModContent.ProjectileType(), (int)(damage * 1.5), knockBack, player.whoAmI, 0f, 0f); + float SpeedX = speedX + Main.rand.Next(-120, 121) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-120, 121) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.5f, SpeedY * 1.5f, ModContent.ProjectileType(), (int)(damage * 1.5), knockBack, player.whoAmI); } Projectile.NewProjectile(position.X, position.Y, speedX * 0.66f, speedY * 0.66f, type, damage, knockBack, player.whoAmI, 1f, 0f); return false; diff --git a/Items/Weapons/Magic/Thunderstorm.cs b/Items/Weapons/Magic/Thunderstorm.cs index ded4b0bba3..2293e62cd1 100644 --- a/Items/Weapons/Magic/Thunderstorm.cs +++ b/Items/Weapons/Magic/Thunderstorm.cs @@ -1,6 +1,5 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; -using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Magic @@ -15,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 360; + item.damage = 165; item.mana = 50; item.magic = true; item.width = 48; @@ -25,14 +24,15 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.rare = ItemRarityID.Purple; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); item.autoReuse = true; item.shootSpeed = 6f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Magic/TomeofFates.cs b/Items/Weapons/Magic/TomeofFates.cs index a1147d2298..595cebf9ff 100644 --- a/Items/Weapons/Magic/TomeofFates.cs +++ b/Items/Weapons/Magic/TomeofFates.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Items.Weapons.Magic item.magic = true; item.mana = 8; item.width = 28; - item.crit = 3; item.height = 30; item.useTime = 5; item.useAnimation = 20; @@ -30,13 +29,16 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 3; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Magic/Tradewinds.cs b/Items/Weapons/Magic/Tradewinds.cs index ddcffce055..34c75fd401 100644 --- a/Items/Weapons/Magic/Tradewinds.cs +++ b/Items/Weapons/Magic/Tradewinds.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item7; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/UltraLiquidator.cs b/Items/Weapons/Magic/UltraLiquidator.cs index b0b720d2ff..659923dac7 100644 --- a/Items/Weapons/Magic/UltraLiquidator.cs +++ b/Items/Weapons/Magic/UltraLiquidator.cs @@ -13,15 +13,14 @@ 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, on fire, and frostburn"); + "The blades inflict ichor, cursed inferno, on fire and frostburn"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 145; - item.crit = 30; - item.knockBack = 7f; + item.damage = 120; + item.knockBack = 5f; item.useTime = 3; item.reuseDelay = item.useAnimation = 15; item.mana = 25; @@ -34,11 +33,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.UseSound = SoundID.Item9; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 30; + public override Vector2? HoldoutOrigin() => new Vector2(15, 15); public override void AddRecipes() @@ -58,8 +59,8 @@ namespace CalamityMod.Items.Weapons.Magic { Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); float speed = item.shootSpeed; - float xVec = (float)Main.mouseX + Main.screenPosition.X - playerPos.X; - float yVec = (float)Main.mouseY + Main.screenPosition.Y - playerPos.Y; + 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; float lowerBoundOffset = 20f; float upperBoundOffset = 60f; diff --git a/Items/Weapons/Magic/UltraLiquidator.png b/Items/Weapons/Magic/UltraLiquidator.png index 1b177e9c56..ed2a8485cf 100644 Binary files a/Items/Weapons/Magic/UltraLiquidator.png and b/Items/Weapons/Magic/UltraLiquidator.png differ diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 1b07fcdcb9..2682203906 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item66; item.autoReuse = true; item.shootSpeed = 12f; diff --git a/Items/Weapons/Magic/UndinesRetribution.png b/Items/Weapons/Magic/UndinesRetribution.png index 96f3ce9794..1be7a44f6c 100644 Binary files a/Items/Weapons/Magic/UndinesRetribution.png and b/Items/Weapons/Magic/UndinesRetribution.png differ diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 9f70cb4bb8..74c37d07bb 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.noUseGraphic = true; item.value = Item.buyPrice(gold: 36); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; } diff --git a/Items/Weapons/Magic/Vehemenc.cs b/Items/Weapons/Magic/Vehemenc.cs index 1e20d281a9..800661a0ae 100644 --- a/Items/Weapons/Magic/Vehemenc.cs +++ b/Items/Weapons/Magic/Vehemenc.cs @@ -8,47 +8,47 @@ namespace CalamityMod.Items.Weapons.Magic { public class Vehemenc : ModItem { + public const int VehemenceSkullDamage = 1250; public override void SetStaticDefaults() { DisplayName.SetDefault("Vehemence"); Tooltip.SetDefault("Casts an intense energy blast\n" + "Does far more damage the more HP an enemy has left\n" + - "Max damage is capped at 1,000,000\n" + - "If an enemy has full HP it will inflict several long-lasting debuffs\n" + - "Revengeance drop"); + "Max damage is capped at 200,000\n" + + "If an enemy has full HP it will inflict Demon Flames for an extremely long time"); Item.staff[item.type] = true; } public override void SetDefaults() { - item.damage = 7; + item.damage = 3; item.magic = true; item.mana = 590; item.width = 44; item.height = 44; - item.useTime = 50; - item.useAnimation = 50; + item.useTime = item.useAnimation = 50; + item.noUseGraphic = true; + item.channel = true; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.75f; item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item73; item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; } - public override Vector2? HoldoutOrigin() - { - return new Vector2(25, 25); - } + public override Vector2? HoldoutOrigin() => new Vector2(25, 25); 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); player.AddBuff(BuffID.ManaSickness, 600, true); return false; } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } } diff --git a/Items/Weapons/Magic/Vehemenc.png b/Items/Weapons/Magic/Vehemenc.png index 382701bacb..8bb4dd73ed 100644 Binary files a/Items/Weapons/Magic/Vehemenc.png and b/Items/Weapons/Magic/Vehemenc.png differ diff --git a/Items/Weapons/Magic/VenusianTrident.cs b/Items/Weapons/Magic/VenusianTrident.cs index af53338209..e2d8912749 100644 --- a/Items/Weapons/Magic/VenusianTrident.cs +++ b/Items/Weapons/Magic/VenusianTrident.cs @@ -9,12 +9,12 @@ namespace CalamityMod.Items.Weapons.Magic { public class VenusianTrident : ModItem { - public static int BaseDamage = 180; + public static int BaseDamage = 108; public override void SetStaticDefaults() { DisplayName.SetDefault("Venusian Trident"); - Tooltip.SetDefault("Casts an inferno bolt that erupts into a gigantic explosion of fire and magma shards"); + Tooltip.SetDefault("Casts an infernal trident that erupts into a gigantic explosion of fire and magma shards"); Item.staff[item.type] = true; } @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 9f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item45; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Vesuvius.cs b/Items/Weapons/Magic/Vesuvius.cs index e277392e5b..d94d2044b1 100644 --- a/Items/Weapons/Magic/Vesuvius.cs +++ b/Items/Weapons/Magic/Vesuvius.cs @@ -12,11 +12,9 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Vesuvius"); - Tooltip.SetDefault("Legendary drop\n" + - "Asteroids give the Molten buff on enemy hits\n" + + 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\n" + - "Revengeance drop"); + "Right click to fire a spread of molten asteroids from the staff"); Item.staff[item.type] = true; } @@ -33,17 +31,13 @@ namespace CalamityMod.Items.Weapons.Magic item.UseSound = SoundID.Item88; item.autoReuse = true; item.height = 62; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } - /*public override Vector2? HoldoutOrigin() - { - return new Vector2(30, 30); - }*/ + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; + item.Calamity().challengeDrop = true; + } public override bool AltFunctionUse(Player player) { diff --git a/Items/Weapons/Magic/Viscera.cs b/Items/Weapons/Magic/Viscera.cs index 2fe4d94d4f..d682546636 100644 --- a/Items/Weapons/Magic/Viscera.cs +++ b/Items/Weapons/Magic/Viscera.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 153; + item.damage = 100; item.magic = true; item.mana = 15; item.width = 50; @@ -29,13 +29,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; + 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.Calamity().customRarity = CalamityRarity.PureGreen; } public override Vector2? HoldoutOrigin() diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index fb8ab67ee4..332f98b66f 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 155; + item.damage = 93; item.magic = true; item.mana = 15; item.width = 60; @@ -26,13 +26,13 @@ namespace CalamityMod.Items.Weapons.Magic item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; item.UseSound = SoundID.Item46; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; + + 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 e3d625197c..a602bd5e23 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 515; + item.damage = 155; item.magic = true; item.mana = 42; item.width = 90; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 7.5f; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item60; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -84,7 +84,6 @@ namespace CalamityMod.Items.Weapons.Magic recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index bdf4c64a67..c199cf4eaf 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -18,24 +18,25 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 195; + item.damage = 82; item.magic = true; item.mana = 60; item.width = 130; item.height = 130; - item.useTime = 41; - item.useAnimation = 41; + item.useTime = 80; + item.useAnimation = 80; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 0f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + 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.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOrigin() { diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index bd7b32b3c8..a545018b7b 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item8; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Wingman.cs b/Items/Weapons/Magic/Wingman.cs index 20be7e8f2b..c987348801 100644 --- a/Items/Weapons/Magic/Wingman.cs +++ b/Items/Weapons/Magic/Wingman.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item33; item.autoReuse = true; item.shootSpeed = 25f; diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 5803b47218..a89e79c531 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons.Magic item.damage = 59; item.magic = true; item.mana = 7; - item.width = 28; - item.height = 30; + item.width = 36; + item.height = 40; item.useTime = 12; item.useAnimation = 12; item.useStyle = ItemUseStyleID.HoldingOut; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item9; item.scale = 0.9f; item.autoReuse = true; @@ -45,7 +45,8 @@ namespace CalamityMod.Items.Weapons.Magic speed *= 15f; speed.Y -= Math.Abs(speed.X) * 0.2f; int p = Projectile.NewProjectile(position, speed, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - Main.projectile[p].Calamity().forceMagic = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().forceMagic = true; } if (Main.rand.NextBool(4)) { diff --git a/Items/Weapons/Magic/WintersFury.png b/Items/Weapons/Magic/WintersFury.png index 32994417e2..48c92d0aa7 100644 Binary files a/Items/Weapons/Magic/WintersFury.png and b/Items/Weapons/Magic/WintersFury.png differ diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs index de252ca89e..085f9e76c0 100644 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ b/Items/Weapons/Magic/WrathoftheAncients.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Wrath of the Ancients"); - Tooltip.SetDefault("Casts a granite energy pulse"); + Tooltip.SetDefault("Summons an energy pulse at the cursor to periodically summon homing spirits"); } public override void SetDefaults() @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 6f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; diff --git a/Items/Weapons/Magic/WrathoftheAncients.png b/Items/Weapons/Magic/WrathoftheAncients.png index ba43cf6134..4412f19055 100644 Binary files a/Items/Weapons/Magic/WrathoftheAncients.png and b/Items/Weapons/Magic/WrathoftheAncients.png differ diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs index 8f9810e226..0f0bb4d14d 100644 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ b/Items/Weapons/Magic/WulfrumStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 3; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item43; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/WyvernsCall.cs b/Items/Weapons/Magic/WyvernsCall.cs index 06048e3dbe..55e9945816 100644 --- a/Items/Weapons/Magic/WyvernsCall.cs +++ b/Items/Weapons/Magic/WyvernsCall.cs @@ -30,7 +30,7 @@ Fires wyverns and colored feathers from the sky that stick to enemies and tiles item.noMelee = true; item.knockBack = 4.75f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item102; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index 6a0ea37e81..e69c022965 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { - item.damage = 350; + item.damage = 125; item.magic = true; item.mana = 15; item.width = 16; @@ -29,12 +29,14 @@ namespace CalamityMod.Items.Weapons.Magic item.noUseGraphic = true; item.channel = true; item.knockBack = 0f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().challengeDrop = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Items/Weapons/Magic/YharimsCrystal.png b/Items/Weapons/Magic/YharimsCrystal.png index 2063e2c29a..42a447f0a2 100644 Binary files a/Items/Weapons/Magic/YharimsCrystal.png and b/Items/Weapons/Magic/YharimsCrystal.png differ diff --git a/Items/Weapons/Magic/Zapper.cs b/Items/Weapons/Magic/Zapper.cs index 25e1ddc0d3..d4f9ae86ee 100644 --- a/Items/Weapons/Magic/Zapper.cs +++ b/Items/Weapons/Magic/Zapper.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item12; item.autoReuse = true; item.shoot = ProjectileID.PurpleLaser; diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index c19b0be69a..0914c23ccc 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = false; item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item1; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -36,18 +36,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 60); - int p = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockBack * 3f, player.whoAmI); + if (crit) + damage /= 2; + + int p = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack * 3f, player.whoAmI); Main.projectile[p].Kill(); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 600); - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 60); - int p = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 12f, player.whoAmI); + if (crit) + damage /= 2; + + int p = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 12f, player.whoAmI); Main.projectile[p].Kill(); } } diff --git a/Items/Weapons/Melee/AbsoluteZero.png b/Items/Weapons/Melee/AbsoluteZero.png index a18fab51d6..eba3273691 100644 Binary files a/Items/Weapons/Melee/AbsoluteZero.png and b/Items/Weapons/Melee/AbsoluteZero.png differ diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 895c05577b..a56b799a78 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; } diff --git a/Items/Weapons/Melee/AccretionDiskMelee.cs b/Items/Weapons/Melee/AccretionDiskMelee.cs deleted file mode 100644 index 71f32bf6b9..0000000000 --- a/Items/Weapons/Melee/AccretionDiskMelee.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class AccretionDiskMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Disk"); - Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 157; - 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.melee = true; - item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 13f; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } - - 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(); - } - } -} diff --git a/Items/Weapons/Melee/AccretionDiskMelee.png b/Items/Weapons/Melee/AccretionDiskMelee.png deleted file mode 100644 index e131c1a252..0000000000 Binary files a/Items/Weapons/Melee/AccretionDiskMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index 5419d91703..b7cf42686c 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -11,16 +11,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Aegis Blade"); - Tooltip.SetDefault("Legendary Drop\n" + - "Striking an enemy with the blade causes an earthen eruption\n" + - "Right click to fire an aegis bolt\n" + - "Revengeance drop"); + Tooltip.SetDefault("Striking an enemy with the blade causes an earthen eruption\n" + + "Right click to fire an aegis bolt"); } public override void SetDefaults() { item.width = 58; - item.damage = 68; + item.height = 58; + item.scale = 1.5f; + item.damage = 135; item.melee = true; item.useAnimation = item.useTime = 15; item.useTurn = true; @@ -28,12 +28,12 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 4.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 58; - item.rare = 7; - item.value = Item.buyPrice(0, 60, 0, 0); item.shootSpeed = 14f; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; + item.Calamity().challengeDrop = true; + } public override bool AltFunctionUse(Player player) { @@ -66,26 +66,30 @@ 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.85), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.3), knockBack, player.whoAmI); return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + if (crit) + damage /= 2; + + 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 5cbf307cdd..f028bfd87d 100644 --- a/Items/Weapons/Melee/Aftershock.cs +++ b/Items/Weapons/Melee/Aftershock.cs @@ -18,17 +18,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 60; + 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 = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; item.shootSpeed = 12f; diff --git a/Items/Weapons/Melee/AirSpinner.cs b/Items/Weapons/Melee/AirSpinner.cs index c2bb163b95..dcb9a8fe0c 100644 --- a/Items/Weapons/Melee/AirSpinner.cs +++ b/Items/Weapons/Melee/AirSpinner.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.buyPrice(gold: 4); } diff --git a/Items/Weapons/Melee/AmidiasTrident.cs b/Items/Weapons/Melee/AmidiasTrident.cs index a6c0e0b474..fae5545dd9 100644 --- a/Items/Weapons/Melee/AmidiasTrident.cs +++ b/Items/Weapons/Melee/AmidiasTrident.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 44; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; } diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index c6dbbd8650..a11e598ff8 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class AnarchyBlade : ModItem { - private static int BaseDamage = 110; + private static int BaseDamage = 150; public override void SetStaticDefaults() { @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 100; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } public override void AddRecipes() @@ -54,9 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.Brimstone); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.Brimstone); } // Gains 10% of missing health as base damage. @@ -68,7 +66,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.NextBool(5)) @@ -85,7 +86,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Items/Weapons/Melee/AncientCrusher.cs b/Items/Weapons/Melee/AncientCrusher.cs index 4aa33271fa..9f320ff101 100644 --- a/Items/Weapons/Melee/AncientCrusher.cs +++ b/Items/Weapons/Melee/AncientCrusher.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +18,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 62; - item.damage = 55; + item.height = 62; + item.scale = 2f; + item.damage = 55; item.melee = true; item.useAnimation = 30; item.useStyle = ItemUseStyleID.SwingThrow; @@ -26,9 +29,8 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 62; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void AddRecipes() @@ -44,12 +46,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/AncientShiv.cs b/Items/Weapons/Melee/AncientShiv.cs index db8df68ce8..593cb0fb7a 100644 --- a/Items/Weapons/Melee/AncientShiv.cs +++ b/Items/Weapons/Melee/AncientShiv.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Shiv"); - Tooltip.SetDefault("Enemies release a blue aura cloud on death"); + Tooltip.SetDefault("Enemies release a blue aura cloud on hit"); } public override void SetDefaults() @@ -29,31 +29,23 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 15); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 15); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - } + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 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 * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/AncientShiv.png b/Items/Weapons/Melee/AncientShiv.png index baa82de97c..d452405e46 100644 Binary files a/Items/Weapons/Melee/AncientShiv.png and b/Items/Weapons/Melee/AncientShiv.png differ diff --git a/Items/Weapons/Melee/Animus.cs b/Items/Weapons/Melee/Animus.cs index 217fda9a0d..6a087479bf 100644 --- a/Items/Weapons/Melee/Animus.cs +++ b/Items/Weapons/Melee/Animus.cs @@ -17,8 +17,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 84; - item.damage = 4000; + item.width = 82; + item.height = 84; + item.scale = 1.5f; + item.damage = 800; item.melee = true; item.useAnimation = 11; item.useStyle = ItemUseStyleID.SwingThrow; @@ -27,10 +29,9 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 20f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 90; item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Developer; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.HotPink; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Animus.png b/Items/Weapons/Melee/Animus.png index e334d84301..2a7878dda1 100644 Binary files a/Items/Weapons/Melee/Animus.png and b/Items/Weapons/Melee/Animus.png differ diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 5144e55830..483b8e163e 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Aorta"); - Tooltip.SetDefault("An exceptionally agile yoyo"); + 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; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.buyPrice(gold: 4); } diff --git a/Items/Weapons/Melee/AquaticDischarge.cs b/Items/Weapons/Melee/AquaticDischarge.cs index 39e0bc38f1..c4abf5d56f 100644 --- a/Items/Weapons/Melee/AquaticDischarge.cs +++ b/Items/Weapons/Melee/AquaticDischarge.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Aquatic Discharge"); - Tooltip.SetDefault("Enemies release electric sparks on death"); + Tooltip.SetDefault("Enemies release electric sparks on hit"); } public override void SetDefaults() @@ -29,31 +29,23 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 226); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - } + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 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 * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/AquaticDissolution.cs b/Items/Weapons/Melee/AquaticDissolution.cs index 61bbe6e53e..b7cfd38703 100644 --- a/Items/Weapons/Melee/AquaticDissolution.cs +++ b/Items/Weapons/Melee/AquaticDissolution.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 50; - item.damage = 200; + item.damage = 125; item.melee = true; item.useAnimation = 16; item.useTime = 16; @@ -29,11 +29,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item60; item.autoReuse = true; item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - 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/Melee/ArkoftheAncients.cs b/Items/Weapons/Melee/ArkoftheAncients.cs index 5b192c82d5..3cb1f3b108 100644 --- a/Items/Weapons/Melee/ArkoftheAncients.cs +++ b/Items/Weapons/Melee/ArkoftheAncients.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 50; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Weapons.Melee } Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer, 1f); float num72 = Main.rand.Next(18, 25); - damage = Main.rand.Next(40, 60); 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,8 +90,9 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.HallowStar, damage / 2, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.HallowStar, damage / 3, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index a26fa91711..aeef4ac3ea 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -24,24 +24,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 102; - item.damage = 501; + item.damage = 140; item.melee = true; item.useAnimation = 15; item.useTime = 15; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.crit += 15; item.knockBack = 9.5f; item.UseSound = SoundID.Item60; item.autoReuse = true; item.height = 102; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 28f; item.Calamity().customRarity = CalamityRarity.Violet; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { switch (Main.rand.Next(4)) diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index d7a0142c89..d7fc7a9786 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -21,24 +21,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 84; - item.damage = 116; + item.damage = 115; item.melee = true; item.useAnimation = 20; item.useTime = 20; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.crit += 10; item.knockBack = 8.5f; item.UseSound = SoundID.Item60; item.autoReuse = true; item.height = 84; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { switch (Main.rand.Next(4)) @@ -124,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -132,7 +133,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Items/Weapons/Melee/AstralBlade.cs b/Items/Weapons/Melee/AstralBlade.cs index b97cd7a446..0f929bad35 100644 --- a/Items/Weapons/Melee/AstralBlade.cs +++ b/Items/Weapons/Melee/AstralBlade.cs @@ -18,22 +18,25 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 95; - item.crit += 25; + item.damage = 85; item.melee = true; - item.width = 60; - item.height = 60; + 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 = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item1; item.autoReuse = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -57,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee { for (int i = 0; i < 3; i++) { - Dust d = CalamityGlobalItem.MeleeDustHelper(player, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0.7f, 55, 110, -0.07f, 0.07f); + Dust d = CalamityUtils.MeleeDustHelper(player, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), 0.7f, 55, 110, -0.07f, 0.07f); if (d != null) { d.customData = 0.03f; diff --git a/Items/Weapons/Melee/AstralPike.cs b/Items/Weapons/Melee/AstralPike.cs index c1af96dbe8..70de4755f0 100644 --- a/Items/Weapons/Melee/AstralPike.cs +++ b/Items/Weapons/Melee/AstralPike.cs @@ -17,8 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 44; - item.damage = 128; - item.crit += 25; + item.damage = 90; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -31,11 +30,14 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 50; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/AstralScythe.cs b/Items/Weapons/Melee/AstralScythe.cs index 2708359934..ad9044d68e 100644 --- a/Items/Weapons/Melee/AstralScythe.cs +++ b/Items/Weapons/Melee/AstralScythe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item71; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; } diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index e12da0a6f5..1a40403a52 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 94; item.height = 92; item.melee = true; - item.damage = 3651; + item.damage = 710; item.knockBack = 2.5f; item.useAnimation = 19; item.useTime = 19; @@ -32,9 +32,9 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(platinum: 2, gold: 50); + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; @@ -73,12 +73,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.ShadowFlame, 480); target.AddBuff(BuffID.Ichor, 480); - - // Does not summon extra projectiles versus dummies. - if (target.type == NPCID.TargetDummy) - return; - - OnHitEffects(player, target.Center); + OnHitEffects(player, target.Center); } // On-hit, tosses out five homing projectiles. This is not like Holy Collider. @@ -86,11 +81,11 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 480); target.AddBuff(BuffID.Ichor, 480); - OnHitEffects(player, target.Center); + OnHitEffects(player, target.Center); } - private void OnHitEffects(Player player, Vector2 targetPos) - { + private void OnHitEffects(Player player, Vector2 targetPos) + { // Individual true melee homing missiles deal 10% of the weapon's base damage. int numSplits = 5; @@ -108,7 +103,7 @@ namespace CalamityMod.Items.Weapons.Melee velocity *= 8f; Projectile.NewProjectile(targetPos + posVec, velocity, trueMeleeID, trueMeleeDamage, item.knockBack, player.whoAmI, 0.0f, 0.0f); } - } + } // Spawn some fancy dust while swinging public override void MeleeEffects(Player player, Rectangle hitbox) @@ -141,10 +136,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe r = new ModRecipe(mod); r.AddIngredient(ItemID.BrokenHeroSword); - r.AddIngredient(ModContent.ItemType(), 4); + r.AddIngredient(ModContent.ItemType(), 4); r.AddIngredient(ModContent.ItemType(), 12); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddIngredient(ModContent.ItemType(), 15); + r.AddIngredient(ModContent.ItemType(), 6); r.AddTile(ModContent.TileType()); r.SetResult(this); r.AddRecipe(); diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index c5bfe28f4c..a422b73595 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -18,18 +18,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 64; - item.damage = 60; + item.height = 64; + item.scale = 1.5f; + item.damage = 60; item.melee = true; - item.useAnimation = 30; - item.useTime = 30; + item.useAnimation = 20; + item.useTime = 20; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 64; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Azathoth.cs index 3713313821..7257e550ae 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Azathoth.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 30; - item.height = 26; + item.width = 40; + item.height = 54; item.melee = true; - item.damage = 200; + item.damage = 50; item.knockBack = 6f; item.useTime = 20; item.useAnimation = 20; @@ -40,9 +40,9 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.rare = 10; + item.rare = ItemRarityID.Red; item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.Developer; + item.Calamity().customRarity = CalamityRarity.HotPink; item.value = Item.buyPrice(platinum: 5); } diff --git a/Items/Weapons/Melee/Azathoth.png b/Items/Weapons/Melee/Azathoth.png index 0d1475fa05..b1f79da864 100644 Binary files a/Items/Weapons/Melee/Azathoth.png and b/Items/Weapons/Melee/Azathoth.png differ diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 844d57d178..7af9d268f7 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -10,15 +11,15 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Baleful Harvester"); - Tooltip.SetDefault("Shoots skulls that split into homing fire orbs on enemy hits\n" + - "Summons flaming pumpkins on enemy hits"); + Tooltip.SetDefault("Summons flaming pumpkins and skulls that split into homing fire orbs on enemy hits"); } public override void SetDefaults() { - item.damage = 160; + item.damage = 90; item.width = 66; item.height = 66; + item.scale = 1.5f; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; @@ -28,9 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + item.rare = ItemRarityID.Cyan; } public override void AddRecipes() @@ -46,13 +45,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 1.5f), knockback, false); + if (crit) + damage /= 2; + + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; + CalamityPlayerOnHit.HorsemansBladeOnHit(player, target.whoAmI, (int)(damage * 1.5f), knockback, 0, type); target.AddBuff(BuffID.OnFire, 300); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 1.5f), item.knockBack, false); + if (crit) + damage /= 2; + + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ProjectileID.FlamingJack; + CalamityPlayerOnHit.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 a3b34079b3..628410fe0a 100644 --- a/Items/Weapons/Melee/BallOFugu.cs +++ b/Items/Weapons/Melee/BallOFugu.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.noUseGraphic = true; item.knockBack = 8f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.autoReuse = true; item.channel = true; diff --git a/Items/Weapons/Melee/BansheeHook.cs b/Items/Weapons/Melee/BansheeHook.cs index 9df8a147e6..c8cb24d072 100644 --- a/Items/Weapons/Melee/BansheeHook.cs +++ b/Items/Weapons/Melee/BansheeHook.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 120; - item.damage = 155; + item.damage = 238; item.noMelee = true; item.noUseGraphic = true; item.channel = true; @@ -31,18 +31,17 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.DD2_GhastlyGlaivePierce; item.autoReuse = true; item.height = 108; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 42f; + + 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) - { - Vector2 origin = new Vector2(60f, 52f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/BansheeHookGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 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/Melee/BansheeHookGlow")); + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index 38e2634ac8..39c8dcff84 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 40; item.height = 42; - item.damage = 17; + item.damage = 30; + item.scale = 1.5f; item.melee = true; item.useAnimation = item.useTime = 26; item.useStyle = ItemUseStyleID.SwingThrow; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.useTurn = true; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void AddRecipes() @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Items/Weapons/Melee/BiomeBlade.cs b/Items/Weapons/Melee/BiomeBlade.cs index 16be34da7b..2f1a69533e 100644 --- a/Items/Weapons/Melee/BiomeBlade.cs +++ b/Items/Weapons/Melee/BiomeBlade.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 42; - item.damage = 70; + item.damage = 38; item.melee = true; - item.useAnimation = 24; - item.useTime = 24; + item.useAnimation = 30; + item.useTime = 30; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 6f; + item.knockBack = 5f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 42; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } @@ -47,9 +47,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ItemID.Granite, 20); recipe.AddIngredient(ItemID.Hellstone, 20); recipe.AddIngredient(ItemID.Coral, 20); - recipe.AddIngredient(ItemID.PearlstoneBlock, 20); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index 3e5f9c2aa0..b3b130156c 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -25,9 +25,9 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 25; item.knockBack = 4f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; } diff --git a/Items/Weapons/Melee/BladeofEnmity.cs b/Items/Weapons/Melee/BladeofEnmity.cs index c7ddba4fe2..c9ffe6ce17 100644 --- a/Items/Weapons/Melee/BladeofEnmity.cs +++ b/Items/Weapons/Melee/BladeofEnmity.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 60; item.height = 64; - item.damage = 158; + item.scale = 1.5f; + item.damage = 190; item.melee = true; item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/BloodyEdge.cs b/Items/Weapons/Melee/BloodyEdge.cs index 9585d9682a..6f058c8b8b 100644 --- a/Items/Weapons/Melee/BloodyEdge.cs +++ b/Items/Weapons/Melee/BloodyEdge.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -10,13 +11,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Edge"); - Tooltip.SetDefault("Chance to heal the player on enemy hits"); + Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + + "Inflicts Burning Blood"); } public override void SetDefaults() { item.width = 46; - item.damage = 52; + item.damage = 70; item.melee = true; item.useAnimation = 23; item.useStyle = ItemUseStyleID.SwingThrow; @@ -27,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.height = 60; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() @@ -53,29 +55,27 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + target.AddBuff(ModContent.BuffType(), 60); + + if (!target.canGhostHeal || player.moonLeech) return; - } - int healAmount = Main.rand.Next(3) + 1; - if (Main.rand.NextBool(2)) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } + + int healAmount = Main.rand.Next(2) + 2; + player.statLife += healAmount; + player.HealEffect(healAmount); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - int healAmount = Main.rand.Next(3) + 1; - if (Main.rand.NextBool(2) && !player.moonLeech) + target.AddBuff(ModContent.BuffType(), 60); + + int healAmount = Main.rand.Next(2) + 2; + if (!player.moonLeech) { player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/BloodyRupture.cs b/Items/Weapons/Melee/BloodyRupture.cs index af33b33ee1..ee45830d4d 100644 --- a/Items/Weapons/Melee/BloodyRupture.cs +++ b/Items/Weapons/Melee/BloodyRupture.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Bloody Rupture"); - Tooltip.SetDefault("Enemies release homing blood orbs on death"); + Tooltip.SetDefault("Enemies release homing blood orbs on hit"); } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() @@ -47,25 +47,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - } + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 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 * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/Bonebreaker.cs b/Items/Weapons/Melee/Bonebreaker.cs index 89d6de48af..f7a780b656 100644 --- a/Items/Weapons/Melee/Bonebreaker.cs +++ b/Items/Weapons/Melee/Bonebreaker.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.noMelee = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index b3f400c4b6..81c28ce962 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 56; - item.damage = 100; + item.damage = 58; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -26,12 +26,14 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 19; item.knockBack = 7.5f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 56; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } - } + + 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 7f1a6bcc4b..883ef9ef82 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; } diff --git a/Items/Weapons/Melee/BrimlashBuster.cs b/Items/Weapons/Melee/BrimlashBuster.cs index aa700055ef..8b09d537f3 100644 --- a/Items/Weapons/Melee/BrimlashBuster.cs +++ b/Items/Weapons/Melee/BrimlashBuster.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; } diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 579ae2ba81..78a70c5a9c 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -11,15 +11,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Briny Baron"); - Tooltip.SetDefault("Legendary Drop\n" + - "Striking an enemy with the blade causes a briny typhoon to appear\n" + - "Right click to fire a razorwind aqua blade\n" + - "Revengeance drop"); + Tooltip.SetDefault("Striking an enemy with the blade causes a briny typhoon to appear\n" + + "Right click to fire a razorwind aqua blade"); } public override void SetDefaults() { - item.damage = 75; + item.damage = 155; item.knockBack = 4f; item.useAnimation = item.useTime = 15; item.melee = true; @@ -29,12 +27,14 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 100; item.height = 102; + item.scale = 1.5f; item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); + + item.value = CalamityGlobalItem.Rarity8BuyPrice; item.rare = ItemRarityID.Yellow; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + item.Calamity().challengeDrop = true; + } public override bool AltFunctionUse(Player player) => true; @@ -66,26 +66,32 @@ 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.43), knockBack, player.whoAmI); return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 187, 0f, 0f, 100, new Color(53, Main.DiscoG, 255)); } 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.MeleeDamage() * 0.5f), knockback, player.whoAmI); + if (crit) + damage /= 2; + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), item.knockBack, player.whoAmI); + if (crit) + damage /= 2; + + if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + 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 1bdb7d76a3..114e34a82f 100644 --- a/Items/Weapons/Melee/BurntSienna.cs +++ b/Items/Weapons/Melee/BurntSienna.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 42; - item.damage = 14; + item.damage = 28; item.melee = true; item.useAnimation = item.useTime = 21; item.useTurn = true; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 54; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shootSpeed = 5f; } @@ -35,11 +35,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.life <= 0 && !player.moonLeech) { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + float randomSpeedX = Main.rand.Next(3); + float randomSpeedY = Main.rand.Next(3, 5); + 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, 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); } } @@ -47,11 +47,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.statLife <= 0 && !player.moonLeech) { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + float randomSpeedX = Main.rand.Next(3); + float randomSpeedY = Main.rand.Next(3, 5); + 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, 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); } } diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index 02c0136f32..868ce445f1 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -27,10 +27,11 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.useTurn = true; item.height = 60; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.scale = 1.25f; + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; + item.Calamity().challengeDrop = true; + } public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/Items/Weapons/Melee/CatastropheClaymore.cs b/Items/Weapons/Melee/CatastropheClaymore.cs index 0688de26a9..bfe0389fa9 100644 --- a/Items/Weapons/Melee/CatastropheClaymore.cs +++ b/Items/Weapons/Melee/CatastropheClaymore.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 56; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; } diff --git a/Items/Weapons/Melee/CausticEdge.cs b/Items/Weapons/Melee/CausticEdge.cs index b8975fef49..f83190f06a 100644 --- a/Items/Weapons/Melee/CausticEdge.cs +++ b/Items/Weapons/Melee/CausticEdge.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 46; - item.damage = 44; + item.damage = 70; + item.scale = 1.4f; item.melee = true; item.useTurn = true; item.useAnimation = 27; @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 48; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void AddRecipes() @@ -35,11 +36,12 @@ namespace CalamityMod.Items.Weapons.Melee ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.BladeofGrass); recipe.AddIngredient(ItemID.LavaBucket); - recipe.AddIngredient(ItemID.Deathweed, 5); + recipe.AddRecipeGroup("Boss2Material", 3); + recipe.AddIngredient(ItemID.Deathweed, 5); recipe.AddTile(TileID.DemonAltar); recipe.SetResult(this); recipe.AddRecipe(); - } + } public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/Items/Weapons/Melee/CausticEdge.png b/Items/Weapons/Melee/CausticEdge.png index 57ad421b37..c134ebe6ff 100644 Binary files a/Items/Weapons/Melee/CausticEdge.png and b/Items/Weapons/Melee/CausticEdge.png differ diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index cae7e0a8f2..458c0ef091 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 0.1f; } diff --git a/Items/Weapons/Melee/Chaotrix.cs b/Items/Weapons/Melee/Chaotrix.cs index df07558233..22d03cee2f 100644 --- a/Items/Weapons/Melee/Chaotrix.cs +++ b/Items/Weapons/Melee/Chaotrix.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.value = Item.buyPrice(gold: 80); } diff --git a/Items/Weapons/Melee/ClamCrusher.cs b/Items/Weapons/Melee/ClamCrusher.cs index 361197b733..be8ed819c0 100644 --- a/Items/Weapons/Melee/ClamCrusher.cs +++ b/Items/Weapons/Melee/ClamCrusher.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.noUseGraphic = true; item.knockBack = 10f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; item.channel = true; diff --git a/Items/Weapons/Melee/Cnidarian.cs b/Items/Weapons/Melee/Cnidarian.cs index 1205d112ba..e823e48340 100644 --- a/Items/Weapons/Melee/Cnidarian.cs +++ b/Items/Weapons/Melee/Cnidarian.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cnidarian"); - Tooltip.SetDefault("Fires a seashell when enemies are near"); + 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; @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 30; item.height = 26; item.melee = true; - item.damage = 13; + item.damage = 18; item.knockBack = 3f; item.useTime = 25; item.useAnimation = 25; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.buyPrice(gold: 2); } diff --git a/Items/Weapons/Melee/ColdheartIcicle.cs b/Items/Weapons/Melee/ColdheartIcicle.cs index b8edf40604..246f8f9f1b 100644 --- a/Items/Weapons/Melee/ColdheartIcicle.cs +++ b/Items/Weapons/Melee/ColdheartIcicle.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 1; item.melee = true; - item.width = 26; - item.height = 26; + item.width = item.height = 24; item.useTime = 27; item.useAnimation = 27; item.autoReuse = true; @@ -25,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) diff --git a/Items/Weapons/Melee/ColdheartIcicle.png b/Items/Weapons/Melee/ColdheartIcicle.png index aba5085616..8a398ac692 100644 Binary files a/Items/Weapons/Melee/ColdheartIcicle.png and b/Items/Weapons/Melee/ColdheartIcicle.png differ diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 902a6676c3..79259b0776 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -17,8 +17,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 54; - item.damage = 120; + item.width = 46; + item.height = 62; + item.scale = 1.5f; + item.damage = 90; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; @@ -27,18 +29,13 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 54; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shootSpeed = 9f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; @@ -59,8 +56,10 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num112 = 3; - for (int num113 = 0; num113 < num112; num113++) + if (crit) + damage /= 2; + + for (int num113 = 0; num113 < 2; num113++) { 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); @@ -81,7 +80,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)(item.damage * player.MeleeDamage() * 0.75f), 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), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); Main.projectile[proj].Calamity().lineColor = Main.rand.Next(3); } } @@ -108,8 +107,10 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num112 = 3; - for (int num113 = 0; num113 < num112; num113++) + if (crit) + damage /= 2; + + for (int num113 = 0; num113 < 2; num113++) { 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); @@ -130,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)(item.damage * player.MeleeDamage() * 0.75f), 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); } } diff --git a/Items/Weapons/Melee/CorpusAvertorMelee.cs b/Items/Weapons/Melee/CorpusAvertorMelee.cs deleted file mode 100644 index c73dbd5a7b..0000000000 --- a/Items/Weapons/Melee/CorpusAvertorMelee.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class CorpusAvertorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - Tooltip.SetDefault("Seems like it has worn down over time\n" + - "Attacks grant lifesteal based on damage dealt\n" + - "The lower your HP the more damage this weapon does and heals the player on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 18; - item.height = 32; - item.damage = 140; - 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 = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - item.melee = true; - } - - // Gains 20% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.MeleeDamage(); - } - - 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, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } -} diff --git a/Items/Weapons/Melee/CorpusAvertorMelee.png b/Items/Weapons/Melee/CorpusAvertorMelee.png deleted file mode 100644 index 1d32c48c94..0000000000 Binary files a/Items/Weapons/Melee/CorpusAvertorMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/CorruptedCrusherBlade.cs b/Items/Weapons/Melee/CorruptedCrusherBlade.cs index 202e3a532f..9563e48a2b 100644 --- a/Items/Weapons/Melee/CorruptedCrusherBlade.cs +++ b/Items/Weapons/Melee/CorruptedCrusherBlade.cs @@ -12,22 +12,23 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Corrupted Crusher Blade"); - Tooltip.SetDefault("Inflicts cursed inferno and critical hits lower enemy defense"); + Tooltip.SetDefault("Inflicts cursed inferno and critical hits reduce enemy defense by 10"); } public override void SetDefaults() { - item.damage = 39; + item.damage = 42; item.melee = true; item.width = 66; item.height = 80; - item.useTime = 26; + item.scale = 1.25f; + item.useTime = 26; item.useAnimation = 26; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 6.75f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.autoReuse = true; } @@ -35,18 +36,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(7)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 27); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.CursedInferno, 120); - if (target.defense > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) - { - target.defense = target.defDefense - 5; - } + target.AddBuff(BuffID.CursedInferno, 300); + if (crit) + target.Calamity().miscDefenseLoss = 10; } public override void OnHitPvp(Player player, Player target, int damage, bool crit) diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index 24f867a7e9..149440d644 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -11,10 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Discharge"); - Tooltip.SetDefault("Legendary Drop\n" + - "Striking an enemy with the whip causes glacial explosions and grants the player the cosmic freeze buff\n" + - "This buff gives the player increased life regen while standing still and freezes enemies near the player\n" + - "Revengeance drop"); + Tooltip.SetDefault("Striking an enemy with the whip causes glacial explosions and grants the player the cosmic freeze buff\n" + + "This buff gives the player increased life regen while standing still and freezes enemies near the player"); } public override void SetDefaults() @@ -32,12 +30,14 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 0.5f; item.UseSound = SoundID.Item122; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shootSpeed = 24f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().challengeDrop = 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/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index c438cfb462..df5fba12a9 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -5,61 +5,60 @@ using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Projectiles.Melee; namespace CalamityMod.Items.Weapons.Melee { - public class CosmicShiv : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Shiv"); - Tooltip.SetDefault("Definitely don't underestimate the power of shivs\n" + - "Fires a cosmic beam that homes in on enemies\n" + - "Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars"); - } + public class CosmicShiv : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Shiv"); + Tooltip.SetDefault("Definitely don't underestimate the power of shivs\n" + + "Fires a cosmic beam that homes in on enemies\n" + + "Upon hitting an enemy, a barrage of offscreen objects home in on the enemy as well as raining stars"); + } - public override void SetDefaults() + public override void SetDefaults() { item.useStyle = ItemUseStyleID.Stabbing; - item.useTurn = false; - item.useAnimation = 18; - item.useTime = 18; - item.width = 44; - item.height = 44; + item.useTurn = false; + item.useAnimation = 18; + item.useTime = 18; + item.width = 44; + item.height = 44; - item.damage = 666; + 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.value = Item.buyPrice(2, 50, 0, 0); //50 gold - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.melee = true; + 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; } 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); return false; } - public override void AddRecipes() + 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.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddRecipe(); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -77,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee } target.AddBuff(ModContent.BuffType(), 420); - target.AddBuff(ModContent.BuffType(), 420); + target.AddBuff(BuffID.Frostburn, 420); target.AddBuff(ModContent.BuffType(), 420); target.AddBuff(ModContent.BuffType(), 420); target.AddBuff(ModContent.BuffType(), 360); @@ -93,10 +92,10 @@ namespace CalamityMod.Items.Weapons.Melee } target.AddBuff(ModContent.BuffType(), 420); - target.AddBuff(ModContent.BuffType(), 420); + target.AddBuff(BuffID.Frostburn, 420); target.AddBuff(ModContent.BuffType(), 420); target.AddBuff(ModContent.BuffType(), 420); target.AddBuff(ModContent.BuffType(), 360); } - } + } } diff --git a/Items/Weapons/Melee/CrescentMoon.cs b/Items/Weapons/Melee/CrescentMoon.cs index c881acf21c..25df18d875 100644 --- a/Items/Weapons/Melee/CrescentMoon.cs +++ b/Items/Weapons/Melee/CrescentMoon.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 16; item.height = 16; - item.damage = 500; + item.damage = 300; item.noMelee = true; item.noUseGraphic = true; item.channel = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 4f; item.UseSound = SoundID.Item82; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; item.shootSpeed = 24f; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/CrimsonCrusherBlade.cs b/Items/Weapons/Melee/CrimsonCrusherBlade.cs index ac8381d7db..6e5dbe15e5 100644 --- a/Items/Weapons/Melee/CrimsonCrusherBlade.cs +++ b/Items/Weapons/Melee/CrimsonCrusherBlade.cs @@ -17,17 +17,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 38; + item.damage = 40; item.melee = true; item.width = 70; item.height = 80; - item.useTime = 28; + item.scale = 1.25f; + item.useTime = 28; item.useAnimation = 28; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.autoReuse = true; } @@ -42,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Ichor, 300); if (target.damage > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) { target.damage = target.defDamage - 5; diff --git a/Items/Weapons/Melee/CrystalBlade.cs b/Items/Weapons/Melee/CrystalBlade.cs index 1ab40aa0af..e44d25d89f 100644 --- a/Items/Weapons/Melee/CrystalBlade.cs +++ b/Items/Weapons/Melee/CrystalBlade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 66; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } diff --git a/Items/Weapons/Melee/DarklightGreatsword.cs b/Items/Weapons/Melee/DarklightGreatsword.cs index 3f4cc4ff24..b7021eeada 100644 --- a/Items/Weapons/Melee/DarklightGreatsword.cs +++ b/Items/Weapons/Melee/DarklightGreatsword.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 60; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; } @@ -37,7 +37,7 @@ 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) { type = Main.rand.NextBool(2) ? type : ModContent.ProjectileType(); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.8), knockBack, player.whoAmI); return false; } @@ -56,9 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 29); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 29); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/DepthBlade.cs b/Items/Weapons/Melee/DepthBlade.cs index 956da57f64..27120887cb 100644 --- a/Items/Weapons/Melee/DepthBlade.cs +++ b/Items/Weapons/Melee/DepthBlade.cs @@ -8,18 +8,20 @@ namespace CalamityMod.Items.Weapons.Melee { public class DepthBlade : ModItem { + private static int HammerPower = 50; public override void SetStaticDefaults() { DisplayName.SetDefault("Depth Crusher"); Tooltip.SetDefault("Hitting enemies will inflict the crush depth debuff\n" + - "The lower the enemies' defense, the more damage they take from this debuff"); + "The lower the enemies' defense, the more damage they take from this debuff\n" + + "Right click to use without hammering down walls"); } public override void SetDefaults() { item.width = 56; item.height = 50; - item.damage = 22; + item.damage = 36; item.melee = true; item.useAnimation = 22; item.useTime = 22; @@ -29,8 +31,23 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.hammer = 50; + item.rare = ItemRarityID.Green; + item.hammer = HammerPower; + } + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.hammer = 0; + } + else + { + item.hammer = HammerPower; + } + return base.CanUseItem(player); } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -43,12 +60,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Items/Weapons/Melee/Devastation.cs b/Items/Weapons/Melee/Devastation.cs index c41aa48ea2..ad01aea8be 100644 --- a/Items/Weapons/Melee/Devastation.cs +++ b/Items/Weapons/Melee/Devastation.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 72; - item.damage = 160; + item.damage = 132; item.melee = true; item.useAnimation = 24; item.useTime = 24; @@ -29,11 +29,10 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - 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/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 0f24b93171..96bab233f9 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 118; item.height = 118; - item.damage = 520; + item.damage = 166; item.melee = true; item.useAnimation = 20; item.useTime = 20; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 28f; item.Calamity().customRarity = CalamityRarity.DarkBlue; @@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Melee for (int j = -index; j <= index; j += index) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(j)); - Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); } //Not actually sure what this middle code does @@ -117,9 +117,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -128,9 +126,10 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.OnFire, 300); if (crit) { + damage /= 2; target.AddBuff(BuffID.ShadowFlame, 900); target.AddBuff(BuffID.OnFire, 900); - player.ApplyDamageToNPC(target, (int)(item.damage * player.MeleeDamage()) * 4, 0f, 0, false); + player.ApplyDamageToNPC(target, damage * 4, 0f, 0, false); float scalar1 = 1.7f; float scalar2 = 0.8f; float scalar3 = 2f; diff --git a/Items/Weapons/Melee/DevilsSunrise.cs b/Items/Weapons/Melee/DevilsSunrise.cs index f7c515ef93..9ddc1e4168 100644 --- a/Items/Weapons/Melee/DevilsSunrise.cs +++ b/Items/Weapons/Melee/DevilsSunrise.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class DevilsSunrise : ModItem { - public static int BaseDamage = 360; + public static int BaseDamage = 480; public override void SetStaticDefaults() { @@ -26,21 +26,23 @@ namespace CalamityMod.Items.Weapons.Melee item.noUseGraphic = true; item.channel = true; item.damage = BaseDamage; - item.crit += 10; item.knockBack = 4f; item.useAnimation = 25; item.useTime = 5; item.autoReuse = false; item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(1, 40, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Melee/DiseasedPike.cs b/Items/Weapons/Melee/DiseasedPike.cs index 2bf14a10a8..096fd9403f 100644 --- a/Items/Weapons/Melee/DiseasedPike.cs +++ b/Items/Weapons/Melee/DiseasedPike.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 62; - item.damage = 75; + item.damage = 65; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -29,21 +29,11 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 58; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } + 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 a0f6c55d17..b88d4faf92 100644 --- a/Items/Weapons/Melee/DivineHatchet.cs +++ b/Items/Weapons/Melee/DivineHatchet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 60; - item.damage = 241; + item.damage = 177; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -29,11 +29,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.melee = true; item.height = 62; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 8; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/DraconicDestruction.cs b/Items/Weapons/Melee/DraconicDestruction.cs index 81ed5fdcf8..a33aa1bbff 100644 --- a/Items/Weapons/Melee/DraconicDestruction.cs +++ b/Items/Weapons/Melee/DraconicDestruction.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 94; - item.damage = 350; + item.damage = 80; item.melee = true; item.useAnimation = 24; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,11 +30,12 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 94; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/DraedonsExoblade.cs b/Items/Weapons/Melee/DraedonsExoblade.cs index 40e701a021..3497a7d3a6 100644 --- a/Items/Weapons/Melee/DraedonsExoblade.cs +++ b/Items/Weapons/Melee/DraedonsExoblade.cs @@ -17,14 +17,13 @@ namespace CalamityMod.Items.Weapons.Melee "Fires an exo beam that homes in on the player and explodes\n" + "Striking an enemy with the blade causes several comets to fire\n" + "All attacks briefly freeze enemies hit\n" + - "Enemies hit at very low HP explode into frost energy and freeze nearby enemies\n" + - "The lower your HP the more damage this blade does and heals the player on enemy hits"); + "Enemies hit at very low HP explode into frost energy and freeze nearby enemies"); } public override void SetDefaults() { item.width = 80; - item.damage = 5000; + item.damage = 900; item.useAnimation = 14; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 14; @@ -35,33 +34,26 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 114; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 19f; item.Calamity().customRarity = CalamityRarity.Violet; } - // Gains 100% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * player.MeleeDamage(); - } - public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107, 0f, 0f, 100, new Color(0, 255, 255)); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { + if (crit) + damage /= 2; + if (target.life <= (target.lifeMax * 0.05f)) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); - } + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); + target.ExoDebuffs(); Main.PlaySound(SoundID.Item88, player.Center); float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); @@ -78,24 +70,26 @@ 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(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, ai1); } } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + + if (!target.canGhostHeal || player.moonLeech) return; - } - int healAmount = Main.rand.Next(5) + 5; + + int healAmount = Main.rand.Next(3) + 5; player.statLife += healAmount; player.HealEffect(healAmount); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + if (crit) + damage /= 2; + if (target.statLife <= (target.statLifeMax2 * 0.05f)) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), 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); float xPos = player.position.X + 800 * Main.rand.NextBool(2).ToDirectionInt(); @@ -112,12 +106,14 @@ 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(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, ai1); + Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), damage, item.knockBack, player.whoAmI, 0f, ai1); } } + if (player.moonLeech) return; - int healAmount = Main.rand.Next(5) + 5; + + int healAmount = Main.rand.Next(3) + 5; player.statLife += healAmount; player.HealEffect(healAmount); } diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 502c711040..e67e97b43a 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -29,7 +29,7 @@ Summons a barrage of petals and waterfalls on enemy hits"); item.width = 76; item.height = 82; item.melee = true; - item.damage = 4500; + item.damage = 660; item.knockBack = 9f; item.useAnimation = 20; item.useTime = 20; @@ -41,9 +41,9 @@ Summons a barrage of petals and waterfalls on enemy hits"); item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"); item.channel = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(2, 50, 0, 0); + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = Speed; @@ -61,9 +61,9 @@ Summons a barrage of petals and waterfalls on enemy hits"); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddRecipe(); + r.AddIngredient(ModContent.ItemType(), 4); + r.AddIngredient(ModContent.ItemType(), 4); + r.AddRecipe(); } } } diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index f0c4867db7..87d83b467d 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -11,51 +11,30 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Rage"); - Tooltip.SetDefault("Fires a spread of five fire waves"); + Tooltip.SetDefault("Twirls a baton that causes explosions on enemy hits\n" + + "Every ten hits will summon a ring of fireballs"); } public override void SetDefaults() { - item.width = 68; - item.damage = 800; - item.melee = true; - item.useAnimation = 25; - item.useTime = 25; - item.useTurn = true; - item.useStyle = ItemUseStyleID.SwingThrow; + item.damage = 1275; item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; + item.useAnimation = item.useTime = 25; + item.melee = true; + item.noMelee = true; + item.channel = true; item.autoReuse = true; - item.height = 82; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + 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) - { - for (int index = 0; index < 5; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 360); + 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; } } } diff --git a/Items/Weapons/Melee/DragonRage.png b/Items/Weapons/Melee/DragonRage.png index ca3c08ba59..4dada2773a 100644 Binary files a/Items/Weapons/Melee/DragonRage.png and b/Items/Weapons/Melee/DragonRage.png differ diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index d523e08913..68f6d23c3d 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -14,18 +14,20 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Earth"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 50 when striking them\n" + - "Your attacks will heal you a lot\n" + - "Rains RGB meteors that explode into more meteors after a short time on enemy hits\n" + - "Ice meteors freeze enemies\n" + - "Flame meteors explode\n" + - "Green meteors spawn healing orbs"); + Tooltip.SetDefault("Lowers enemy defense by 1 with every strike\n" + + "Your attacks will heal you a lot\n" + + "Rains RGB meteors that explode into more meteors after a short time on enemy hits\n" + + "Ice meteors freeze enemies\n" + + "Flame meteors explode\n" + + "Green meteors spawn healing orbs"); } public override void SetDefaults() { item.width = 92; - item.damage = 840; + item.height = 104; + item.scale = 1.5f; + item.damage = 170; item.melee = true; item.useAnimation = 16; item.useStyle = ItemUseStyleID.SwingThrow; @@ -34,10 +36,10 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 9.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 104; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Developer; + + 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,14 +88,13 @@ namespace CalamityMod.Items.Weapons.Melee 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)); } - if (Main.rand.NextBool(2)) - { - target.defense -= 50; - } - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + + if (target.Calamity().miscDefenseLoss < target.defense) + target.Calamity().miscDefenseLoss += 1; + + if (!target.canGhostHeal || player.moonLeech) return; - } + int heal = Main.rand.Next(1, 69); player.statLife += heal; player.HealEffect(heal); @@ -145,8 +146,10 @@ namespace CalamityMod.Items.Weapons.Melee 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)); } - if (player.moonLeech) - return; + + if (player.moonLeech) + return; + int heal = Main.rand.Next(1, 69); player.statLife += heal; player.HealEffect(heal); diff --git a/Items/Weapons/Melee/EarthenPike.cs b/Items/Weapons/Melee/EarthenPike.cs index c805164c20..f3ca4aadc3 100644 --- a/Items/Weapons/Melee/EarthenPike.cs +++ b/Items/Weapons/Melee/EarthenPike.cs @@ -27,12 +27,14 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 25; item.knockBack = 7f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 60; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 6f; + item.shootSpeed = 8f; } - } + + 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 2121d70ba1..1174c47e2b 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Weapons.Melee { public class ElementalExcalibur : ModItem { - private static int BaseDamage = 10000; + private static int BaseDamage = 2000; private int BeamType = 0; - private int alpha = 50; + private const int alpha = 50; public override void SetStaticDefaults() { @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.damage = BaseDamage; - item.crit += 10; item.useAnimation = 14; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 14; @@ -40,16 +39,18 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 92; item.height = 92; item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; item.Calamity().customRarity = CalamityRarity.Rainbow; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(46f, 44f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ElementalExcaliburGlow")); } 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,6 +78,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } + return base.CanUseItem(player); } @@ -145,38 +147,38 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(BuffID.CursedInferno, 240); target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + + if (!target.canGhostHeal || player.moonLeech) return; - } - int healAmount = Main.rand.Next(10) + 10; + + int healAmount = Main.rand.Next(3) + 10; player.statLife += healAmount; player.HealEffect(healAmount); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(ModContent.BuffType(), 240); target.AddBuff(BuffID.CursedInferno, 240); target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Ichor, 240); + if (player.moonLeech) return; - int healAmount = Main.rand.Next(10) + 10; + + int healAmount = Main.rand.Next(3) + 10; player.statLife += healAmount; player.HealEffect(healAmount); } diff --git a/Items/Weapons/Melee/ElementalShortsword.cs b/Items/Weapons/Melee/ElementalShortsword.cs index 229c8de2e5..816c701ad3 100644 --- a/Items/Weapons/Melee/ElementalShortsword.cs +++ b/Items/Weapons/Melee/ElementalShortsword.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 10; item.width = 44; item.height = 44; - item.damage = 160; + item.damage = 168; item.melee = true; item.knockBack = 8.5f; item.UseSound = SoundID.Item1; @@ -34,10 +34,9 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + 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) { @@ -69,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -77,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index 5e65ceb85b..a7da8b946f 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,7 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using System; using Terraria; @@ -21,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 600; + item.damage = 230; item.melee = true; item.noMelee = true; item.noUseGraphic = true; @@ -32,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item39; item.autoReuse = true; item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - 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) @@ -103,10 +101,9 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.VampireKnives); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 999); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/EradicatorMelee.cs b/Items/Weapons/Melee/EradicatorMelee.cs deleted file mode 100644 index 2a6563425c..0000000000 --- a/Items/Weapons/Melee/EradicatorMelee.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class EradicatorMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); - } - - public override void SetDefaults() - { - item.width = 38; - item.damage = 300; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 19; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; - item.knockBack = 7f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 54; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EradicatorMeleeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - } -} diff --git a/Items/Weapons/Melee/EradicatorMelee.png b/Items/Weapons/Melee/EradicatorMelee.png deleted file mode 100644 index e028ca0e83..0000000000 Binary files a/Items/Weapons/Melee/EradicatorMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/EradicatorMeleeGlow.png b/Items/Weapons/Melee/EradicatorMeleeGlow.png deleted file mode 100644 index 152b9ce5ae..0000000000 Binary files a/Items/Weapons/Melee/EradicatorMeleeGlow.png and /dev/null differ diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 03438002ab..084a423fb9 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 100; - item.damage = 450; + item.damage = 180; item.melee = true; item.useAnimation = 19; item.useStyle = ItemUseStyleID.SwingThrow; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 78; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 21f; item.Calamity().customRarity = CalamityRarity.DarkBlue; @@ -39,15 +39,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(50f, 37f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/EssenceFlayerGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddRecipeGroup("NForEE", 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/EutrophicScimitar.cs b/Items/Weapons/Melee/EutrophicScimitar.cs index 6ee823c34f..8b987fd74b 100644 --- a/Items/Weapons/Melee/EutrophicScimitar.cs +++ b/Items/Weapons/Melee/EutrophicScimitar.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 17; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; item.useTurn = true; diff --git a/Items/Weapons/Melee/EutrophicShank.cs b/Items/Weapons/Melee/EutrophicShank.cs index 1bba054bde..403da8918f 100644 --- a/Items/Weapons/Melee/EutrophicShank.cs +++ b/Items/Weapons/Melee/EutrophicShank.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index bb41ea3578..5e83b123f6 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -11,63 +11,42 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Evil Smasher"); - Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!"); + Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!\n" + + "For every enemy you kill this hammer gains stat bonuses\n" + + "These bonuses stack until a cap is reached\n" + + "The bonus stacks will reset if you select a different item\n" + + "The bonus stacks will be reduced by 1 every time you get hit\n" + + "Summons fossil spikes on enemy hits"); } public override void SetDefaults() { - item.width = 62; - item.damage = 55; + item.width = 64; + item.height = 66; + item.scale = 2f; + item.damage = 125; item.melee = true; - item.useAnimation = item.useTime = 30; + item.useAnimation = item.useTime = 38; item.useStyle = ItemUseStyleID.SwingThrow; item.useTurn = true; - item.knockBack = 8f; + item.knockBack = 6f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 62; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } - - public override float UseTimeMultiplier (Player player) - { - if (player.Calamity().brimlashBusterBoost) - return 2f; - return 1f; + item.value = CalamityGlobalItem.Rarity4BuyPrice; + item.rare = ItemRarityID.LightRed; + item.Calamity().challengeDrop = true; } - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - float damageMult = 0f; - if (player.Calamity().brimlashBusterBoost) - damageMult = 0.5f; - mult += damageMult; - } + public override float UseTimeMultiplier (Player player) => 1f + (player.Calamity().evilSmasherBoost * 0.1f); - public override void GetWeaponKnockback(Player player, ref float knockback) + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) => mult += player.Calamity().evilSmasherBoost * 0.1f; + + public override void GetWeaponKnockback(Player player, ref float knockback) => knockback *= 1f + (player.Calamity().evilSmasherBoost * 0.1f); + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (player.Calamity().brimlashBusterBoost) - { - knockback *= 1.75f; - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - OnHitEffect(target.Center, player, knockback); - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - OnHitEffect(target.Center, player, item.knockBack); - } - - private void OnHitEffect(Vector2 targetPos, Player player, float knockback) - { - Projectile.NewProjectile(targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); - player.Calamity().brimlashBusterBoost = Main.rand.NextBool(3); + if (target.life <= 0 && player.Calamity().evilSmasherBoost < 10) + player.Calamity().evilSmasherBoost += 1; } } } diff --git a/Items/Weapons/Melee/EvilSmasher.png b/Items/Weapons/Melee/EvilSmasher.png index c8a8ea9c8e..e37f1d881b 100644 Binary files a/Items/Weapons/Melee/EvilSmasher.png and b/Items/Weapons/Melee/EvilSmasher.png differ diff --git a/Items/Weapons/Melee/ExcaliburShortsword.cs b/Items/Weapons/Melee/ExcaliburShortsword.cs index 801a4024ad..53108a6924 100644 --- a/Items/Weapons/Melee/ExcaliburShortsword.cs +++ b/Items/Weapons/Melee/ExcaliburShortsword.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 45191fba72..c401366564 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 78; - item.damage = 340; + item.damage = 279; item.melee = true; item.useAnimation = 15; item.useStyle = ItemUseStyleID.SwingThrow; @@ -29,25 +29,24 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 94; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.PureGreen; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(39f, 47f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/ExcelsusGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) { for (int index = 0; index < 3; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = speedX + Main.rand.NextFloat(-1.5f, 1.5f); + float SpeedY = speedY + Main.rand.NextFloat(-1.5f, 1.5f); switch (index) { case 0: @@ -67,12 +66,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, player.whoAmI); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, player.whoAmI); } } } diff --git a/Items/Weapons/Melee/ExoGladius.cs b/Items/Weapons/Melee/ExoGladius.cs index faa1fc4a1c..38ce59ea03 100644 --- a/Items/Weapons/Melee/ExoGladius.cs +++ b/Items/Weapons/Melee/ExoGladius.cs @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 12; item.width = 56; item.height = 56; - item.damage = 2700; + item.damage = 690; item.melee = true; item.knockBack = 9.9f; item.UseSound = SoundID.Item1; item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 19f; item.Calamity().customRarity = CalamityRarity.Violet; @@ -42,7 +42,7 @@ 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) { - 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); return false; } @@ -61,9 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) @@ -80,15 +78,21 @@ namespace CalamityMod.Items.Weapons.Melee private void OnHitEffects(Player player) { - if (!player.immune) + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) { player.immune = true; - if (player.immuneTime < 10) - player.immuneTime = 10; - if (player.hurtCooldowns[0] < 10) - player.hurtCooldowns[0] = 10; - if (player.hurtCooldowns[1] < 10) - player.hurtCooldowns[1] = 10; + if (player.immuneTime < item.useTime) + player.immuneTime = item.useTime; + if (player.hurtCooldowns[0] < item.useTime) + player.hurtCooldowns[0] = item.useTime; + if (player.hurtCooldowns[1] < item.useTime) + player.hurtCooldowns[1] = item.useTime; } if (player.whoAmI == Main.myPlayer) diff --git a/Items/Weapons/Melee/ExsanguinationLance.cs b/Items/Weapons/Melee/ExsanguinationLance.cs index e0bd75f771..e142c93180 100644 --- a/Items/Weapons/Melee/ExsanguinationLance.cs +++ b/Items/Weapons/Melee/ExsanguinationLance.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 44; - item.damage = 77; + item.damage = 90; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -30,24 +30,14 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 44; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; + item.shootSpeed = 10f; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index 9d24a0b22f..3fef252d59 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 68; - item.damage = 63; + item.damage = 80; item.melee = true; item.useAnimation = 13; item.useStyle = ItemUseStyleID.SwingThrow; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 66; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void AddRecipes() @@ -44,35 +44,29 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 44); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Venom, 300); - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } + + if (crit) + damage /= 2; + + Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(damage * 0.25), 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(damage * 0.25), 0f, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 300); - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X + 40f + (float)Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile(player.position.X - 40f + (float)Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.2), 0f, Main.myPlayer, 0f, 0f); - } + + if (crit) + damage /= 2; + + Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(damage * 0.25), 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(damage * 0.25), 0f, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/FlameScytheMelee.cs b/Items/Weapons/Melee/FlameScytheMelee.cs deleted file mode 100644 index 7d8d78e68c..0000000000 --- a/Items/Weapons/Melee/FlameScytheMelee.cs +++ /dev/null @@ -1,46 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class FlameScytheMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Subduction Slicer"); - Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 50; - item.damage = 90; - item.noMelee = true; - item.noUseGraphic = true; - item.autoReuse = true; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; - item.knockBack = 8.5f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 48; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 9); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/FlameScytheMelee.png b/Items/Weapons/Melee/FlameScytheMelee.png deleted file mode 100644 index 2fb615a053..0000000000 Binary files a/Items/Weapons/Melee/FlameScytheMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/FlameburstShortsword.cs b/Items/Weapons/Melee/FlameburstShortsword.cs index d22f20615d..9318d9fabe 100644 --- a/Items/Weapons/Melee/FlameburstShortsword.cs +++ b/Items/Weapons/Melee/FlameburstShortsword.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Flameburst Shortsword"); - Tooltip.SetDefault("Enemies explode on hit when below half life"); + Tooltip.SetDefault("Enemies explode on hit"); } public override void SetDefaults() @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() @@ -44,27 +44,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= (target.lifeMax * 0.5f)) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - } - } + 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); + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].Calamity().forceMelee = true; + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (target.statLife <= (target.statLifeMax2 * 0.5f)) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - 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); + 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 cfa73f7874..ce6fe1e356 100644 --- a/Items/Weapons/Melee/FlarefrostBlade.cs +++ b/Items/Weapons/Melee/FlarefrostBlade.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 66; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; } @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.HellstoneBar, 8); recipe.AddIngredient(ItemID.HallowedBar, 4); recipe.AddTile(TileID.MythrilAnvil); diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index c7b129b64f..bef122e9ab 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -27,10 +28,10 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 6f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.shoot = ProjectileID.MiniSharkron; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; } @@ -41,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Melee float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 0a0e834e27..b85d582269 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } @@ -48,9 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/ForsakenSaber.cs b/Items/Weapons/Melee/ForsakenSaber.cs index 788a1d6090..695b49c306 100644 --- a/Items/Weapons/Melee/ForsakenSaber.cs +++ b/Items/Weapons/Melee/ForsakenSaber.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 56; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; } diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index aebd5dc697..2fd527bd97 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Galaxia"); - Tooltip.SetDefault("Fires homing projectiles that inflict different debuffs depending on what biome you're in\n" + + Tooltip.SetDefault("Fires a spread of homing projectiles that inflict different debuffs depending on what biome you're in\n" + "Upon hitting an enemy you are granted a buff based on what biome you're in\n" + "Projectiles also change based on moon events"); } @@ -23,24 +23,35 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 70; - item.damage = 385; + item.damage = 66; item.melee = true; - item.useAnimation = 17; - item.useTime = 17; + item.useAnimation = 18; + item.useTime = 18; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 9; + item.knockBack = 9f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 70; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.DarkBlue; } - public override void AddRecipes() + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + for (int projectiles = 0; projectiles < 3; projectiles++) + { + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Melee/FulgurationHalberd.cs b/Items/Weapons/Melee/FulgurationHalberd.cs index dec29f09b8..be3b231ab3 100644 --- a/Items/Weapons/Melee/FulgurationHalberd.cs +++ b/Items/Weapons/Melee/FulgurationHalberd.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 60; item.height = 64; - item.damage = 53; + item.scale = 1.5f; + item.damage = 70; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,8 +31,8 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shootSpeed = 6f; + item.rare = ItemRarityID.Pink; + item.shootSpeed = 8f; } public override bool AltFunctionUse(Player player) @@ -46,21 +47,20 @@ namespace CalamityMod.Items.Weapons.Melee item.noMelee = true; item.noUseGraphic = true; item.useStyle = ItemUseStyleID.HoldingOut; - item.autoReuse = false; item.shoot = ModContent.ProjectileType(); - } + return player.ownedProjectileCounts[item.shoot] <= 0; + } else { item.noMelee = false; item.noUseGraphic = false; item.useStyle = ItemUseStyleID.SwingThrow; - item.autoReuse = true; item.shoot = ProjectileID.None; - } - return base.CanUseItem(player); + return base.CanUseItem(player); + } } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; @@ -80,15 +80,13 @@ namespace CalamityMod.Items.Weapons.Melee { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(ItemID.OrichalcumHalberd); - recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddIngredient(ItemID.AdamantiteBar, 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.CrystalShard, 20); - recipe.AddIngredient(ItemID.MythrilHalberd); - recipe.AddIngredient(ItemID.HellstoneBar, 10); + recipe.AddIngredient(ItemID.TitaniumBar, 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 245e107d74..0539848f88 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -8,41 +8,37 @@ using Terraria.World.Generation; namespace CalamityMod.Items.Weapons.Melee { - public class GaelsGreatsword : ModItem + public class GaelsGreatsword : ModItem { //Help, they're forcing me to slave away at Calamity until I die! - Dominic - //Weapon attribute constants - + // Weapon attribute constants public static readonly int BaseDamage = 3900; - public static readonly float TrueMeleeBoost = 2.5f; - public static readonly float GiantSkullDamageMultiplier = 1.5f; - //Weapon projectile attribute constants - + // Weapon projectile attribute constants public static readonly int SearchDistance = 1450; - - public static readonly int ImmunityFrames = 2; - + public static readonly int ImmunityFrames = 10; public static readonly int SkullsplosionCooldownSeconds = 30; - //Skull ring attribute constants + // Skull ring attribute constants + public static readonly float SkullsplosionDamageMultiplier = 1.5f; - public static readonly float MaxRageBoost = 1.5f; + // Rage gain attribute constant + public static readonly float RagePerSecond = 0.03f; // 3% rage per second, consistent with what it was prior to rage rework public override void SetStaticDefaults() { DisplayName.SetDefault("Gael's Greatsword"); Tooltip.SetDefault("Hand it over, that thing. Your dark soul.\n" + - "First swing fires homing skulls\n" + - "Second swing fires a giant, powerful skull\n" + - "Third swing deals massive damage\n" + - "Constantly generates rage when in use\n" + - "Swings leave behind exploding blood trails when below 50% health\n" + - "Right click to swipe the sword, reflecting projectiles at a 50% chance\n" + - "Activating Rage Mode releases an enormous barrage of skulls"); + "First swing fires homing skulls\n" + + "Second swing fires a giant, powerful skull\n" + + "Third swing deals massive damage\n" + + "Constantly generates rage when in use\n" + + "Swings leave behind exploding blood trails when below 50% health\n" + + "Right click to swipe the sword, reflecting projectiles at a 50% chance\n" + + "Replaces Rage Mode with an enormous barrage of skulls"); } //NOTE: GetWeaponDamage is in the CalamityPlayer file public override void SetDefaults() @@ -56,40 +52,39 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 9; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(platinum: 2, gold: 50); - item.rare = 10; + + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().devItem = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; item.useStyle = ItemUseStyleID.SwingThrow; } - public override void HoldItem(Player player) - { - player.endurance += 0.1f; //10% DR boost - } + public override bool AltFunctionUse(Player player) => true; public override Vector2? HoldoutOffset() => new Vector2(12, 12); - public override float UseTimeMultiplier (Player player) - { - if (player.altFunctionUse == 2) - return (12f/46f); - return 1f; - } + public override float UseTimeMultiplier (Player player) + { + if (player.altFunctionUse == 2) + return (12f/46f); + return 1f; + } public override void MeleeEffects(Player player, Rectangle hitbox) { if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) < 3 && - player.statLife <= player.statLifeMax2 * 0.5f) + player.statLife <= player.statLifeMax2 * 0.5f && + Main.myPlayer == player.whoAmI) { Point origin = (player.Center + Main.rand.Next(-300, 301) * Vector2.UnitX).ToTileCoordinates(); - Point p; if (WorldUtils.Find(origin, Searches.Chain(new Searches.Down(400), new GenCondition[] { new Conditions.IsSolid() - }), out p)) + }), out Point spawnPosition)) { - Projectile.NewProjectile(p.ToWorldCoordinates(8f, 0f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(spawnPosition.ToWorldCoordinates(8f, 0f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) @@ -123,14 +118,6 @@ namespace CalamityMod.Items.Weapons.Melee } } } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.GaelsGreatswordSwingSync); - netMessage.Write((byte)player.whoAmI); - netMessage.Write(player.Calamity().gaelSwipes); - netMessage.Send(); - } } } public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) @@ -170,7 +157,7 @@ namespace CalamityMod.Items.Weapons.Melee break; //Giant, slow, fading skull case 1: - int largeSkullDmg = (int)(damage * 1.5f); + int largeSkullDmg = (int)(damage * 1.5f); int projectileIndex = Projectile.NewProjectile(position, new Vector2(speedX,speedY) * 0.5f, type, largeSkullDmg, knockBack, player.whoAmI, ai1:1f); Main.projectile[projectileIndex].scale = 1.75f; break; diff --git a/Items/Weapons/Melee/GalacticaBlade.cs b/Items/Weapons/Melee/GalacticaBlade.cs index cfc875183d..e4e6b9fa24 100644 --- a/Items/Weapons/Melee/GalacticaBlade.cs +++ b/Items/Weapons/Melee/GalacticaBlade.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 60; - item.damage = 110; + item.damage = 84; item.melee = true; item.useAnimation = 17; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item105; item.autoReuse = true; item.height = 58; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 23f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/GalaxySmasherMelee.cs b/Items/Weapons/Melee/GalaxySmasherMelee.cs index 14085cc3b8..f79fef9d42 100644 --- a/Items/Weapons/Melee/GalaxySmasherMelee.cs +++ b/Items/Weapons/Melee/GalaxySmasherMelee.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,9 +7,9 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GalaxySmasherMelee : ModItem + public class GalaxySmasherMelee : ModItem { - public static int BaseDamage = 480; + public static int BaseDamage = 264; public static float Speed = 18f; public override void SetStaticDefaults() @@ -35,9 +34,9 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.buyPrice(1, 80, 0, 0); + item.value = Item.buyPrice(platinum: 1, gold: 80); item.shoot = ModContent.ProjectileType(); item.shootSpeed = Speed; @@ -45,8 +44,7 @@ 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) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); return false; } @@ -56,8 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee r.SetResult(this); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(ModContent.TileType()); + r.AddTile(TileID.LunarCraftingStation); r.AddRecipe(); } } diff --git a/Items/Weapons/Melee/GalileoGladius.cs b/Items/Weapons/Melee/GalileoGladius.cs index 910ce6c587..92558412f7 100644 --- a/Items/Weapons/Melee/GalileoGladius.cs +++ b/Items/Weapons/Melee/GalileoGladius.cs @@ -3,7 +3,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 10; item.width = 44; item.height = 44; - item.damage = 200; + item.damage = 110; item.melee = true; item.knockBack = 10f; item.UseSound = SoundID.Item1; @@ -36,14 +35,15 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + + 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) { - Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); + int moonDamage = (int)(damage * 0.3333f); + Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, moonDamage, knockBack, player.whoAmI, 0f, 0f); return false; } @@ -81,14 +81,14 @@ namespace CalamityMod.Items.Weapons.Melee } private void SpawnMeteor(Player player) - { + { if (player.whoAmI == Main.myPlayer) { if (player.Calamity().galileoCooldown <= 0) - { - int damage = player.GetWeaponDamage(player.ActiveItem()) * 2; - CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); - player.Calamity().galileoCooldown = 15; + { + int damage = player.GetWeaponDamage(player.ActiveItem()) * 2; + CalamityUtils.ProjectileRain(player.Center, 400f, 100f, 500f, 800f, 25f, ModContent.ProjectileType(), damage, 15f, player.whoAmI); + player.Calamity().galileoCooldown = 15; } } } diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index e6d3c7b60b..c80695d124 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 62; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; } diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index 4e275e09ff..e3892577bc 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -10,14 +10,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Gilded Proboscis"); - Tooltip.SetDefault("Ignores immunity frames\n" + - "Heals the player on hit"); + Tooltip.SetDefault("Heals the player on hit"); } public override void SetDefaults() { item.width = 66; - item.damage = 160; + item.damage = 315; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -29,23 +28,12 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 66; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.maxProjectiles; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } - } + 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 d93d32f2a5..1e9344c060 100644 --- a/Items/Weapons/Melee/GlacialCrusher.cs +++ b/Items/Weapons/Melee/GlacialCrusher.cs @@ -14,14 +14,13 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Glacial Crusher"); Tooltip.SetDefault("Fires very slow frost projectiles that gain strength as they travel and freeze enemies\n" + "Enemies are frozen for longer the further the projectile travels\n" + - "True melee strikes cause tremendous damage to frozen enemies\n" + - "Enemies that cannot be frozen take increased damage"); + "True melee strikes cause tremendous damage to frozen enemies"); } public override void SetDefaults() { item.width = 60; - item.damage = 59; + item.damage = 120; item.melee = true; item.useAnimation = 27; item.useTime = 27; @@ -32,27 +31,20 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 58; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 3f; + item.shootSpeed = 5f; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 67); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 67); } public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { - if (target.buffImmune[ModContent.BuffType()]) - { - damage *= 2; - knockBack *= 2f; - } - else if (target.Calamity().gState > 0) + if (target.Calamity().gState > 0) { damage *= 3; knockBack *= 3f; diff --git a/Items/Weapons/Melee/GoldplumeSpear.cs b/Items/Weapons/Melee/GoldplumeSpear.cs index 9a521df477..db98a9b165 100644 --- a/Items/Weapons/Melee/GoldplumeSpear.cs +++ b/Items/Weapons/Melee/GoldplumeSpear.cs @@ -27,15 +27,17 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 23; item.knockBack = 5.75f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 54; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; } - public override void AddRecipes() + 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); diff --git a/Items/Weapons/Melee/GoldplumeSpear.png b/Items/Weapons/Melee/GoldplumeSpear.png index c3e0a15891..a20c085e4f 100644 Binary files a/Items/Weapons/Melee/GoldplumeSpear.png and b/Items/Weapons/Melee/GoldplumeSpear.png differ diff --git a/Items/Weapons/Melee/GrandDad.cs b/Items/Weapons/Melee/GrandDad.cs index de8dd329ad..afd17b61e0 100644 --- a/Items/Weapons/Melee/GrandDad.cs +++ b/Items/Weapons/Melee/GrandDad.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 124; + item.height = 124; item.damage = 777; item.melee = true; item.useAnimation = 25; @@ -27,11 +29,15 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 77f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 124; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.value = CalamityGlobalItem.Rarity10BuyPrice; + item.rare = ItemRarityID.Red; + item.Calamity().challengeDrop = true; + } + + public override void UseStyle(Player player) + { + player.itemLocation += new Vector2(-12f * player.direction, 12f * player.gravDir).RotatedBy(player.itemRotation); + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { diff --git a/Items/Weapons/Melee/GrandGuardian.cs b/Items/Weapons/Melee/GrandGuardian.cs index f2a640c604..1e2a5da568 100644 --- a/Items/Weapons/Melee/GrandGuardian.cs +++ b/Items/Weapons/Melee/GrandGuardian.cs @@ -13,16 +13,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Grand Guardian"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 15 when striking them\n" + + Tooltip.SetDefault("Lowers enemy defense by 1 with every strike\n" + "If enemy defense is 0 or below your attacks will heal you\n" + "Striking enemies causes a large explosion\n" + - "Striking enemies that have under half life will make you release rainbow bolts\n" + + "Striking enemies that are under half life will cause them to release rainbow bolts\n" + "Enemies spawn healing orbs on death"); } public override void SetDefaults() { - item.width = 124; + item.width = 130; + item.height = 130; item.damage = 150; item.melee = true; item.useAnimation = 22; @@ -32,63 +33,59 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 124; item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shootSpeed = 12f; } + public override void UseStyle(Player player) + { + player.itemLocation += new Vector2(-32f * player.direction, 12f * player.gravDir).RotatedBy(player.itemRotation); + } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (Main.rand.NextBool(5)) - { - target.defense -= 15; - } - if (target.defense <= 0 && target.canGhostHeal && !player.moonLeech) + if (target.Calamity().miscDefenseLoss < target.defense) + target.Calamity().miscDefenseLoss += 1; + + if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal && !player.moonLeech) { player.statLife += 4; player.HealEffect(4); } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5f), 0f, player.whoAmI); - if (target.life <= (target.lifeMax * 0.5f)) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(player.Center.X, player.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)((float)item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), knockback, player.whoAmI); - } - if (target.life <= 0 && !player.moonLeech) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - } + + OnHitEffects(player, target.Center, target.life, target.lifeMax, knockback, damage, crit); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.5f), 0f, player.whoAmI); - if (target.statLife <= (target.statLifeMax2 * 0.5f)) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(player.Center.X, player.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); - Projectile.NewProjectile(player.Center.X, player.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)((float)item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.75f), item.knockBack, player.whoAmI); - } - if (target.statLife <= 0 && !player.moonLeech) - { - float randomSpeedX = (float)Main.rand.Next(9); - float randomSpeedY = (float)Main.rand.Next(6, 15); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - } + 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) + { + if (crit) + damage /= 2; + + Projectile.NewProjectile(targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.5f), 0f, player.whoAmI); + if (targetLife <= (targetMaxLife * 0.5f) && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) + { + float randomSpeedX = Main.rand.Next(6, 13); + float randomSpeedY = Main.rand.Next(6, 13); + Projectile.NewProjectile(targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); + Projectile.NewProjectile(targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); + Projectile.NewProjectile(targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), (int)(damage * 0.75f), knockback, player.whoAmI); + } + if (targetLife <= 0 && !player.moonLeech && player.ownedProjectileCounts[ModContent.ProjectileType()] < 3) + { + float randomSpeedX = Main.rand.Next(3, 7); + float randomSpeedY = Main.rand.Next(3, 7); + Projectile.NewProjectile(targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + Projectile.NewProjectile(targetPos.X, targetPos.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) diff --git a/Items/Weapons/Melee/GrandGuardian.png b/Items/Weapons/Melee/GrandGuardian.png index cab77cc792..fc6194f528 100644 Binary files a/Items/Weapons/Melee/GrandGuardian.png and b/Items/Weapons/Melee/GrandGuardian.png differ diff --git a/Items/Weapons/Melee/GreatswordofBlah.cs b/Items/Weapons/Melee/GreatswordofBlah.cs index ce745ede37..e8708bf5f3 100644 --- a/Items/Weapons/Melee/GreatswordofBlah.cs +++ b/Items/Weapons/Melee/GreatswordofBlah.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = item.height = 102; - item.damage = 300; + item.damage = 125; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -31,19 +31,18 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; - item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 47c9bb69c6..f88d172004 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 78; - item.damage = 60; + item.damage = 48; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,11 +30,10 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 78; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index 05d1284942..90963a5a7d 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -21,13 +21,14 @@ namespace CalamityMod.Items.Weapons.Melee 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 = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.autoReuse = true; item.shootSpeed = 18f; @@ -59,8 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) + for (int num108 = 0; num108 < 3; num108++) { 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); diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index d394a1ad1c..c1e25b4b14 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 60; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; } diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index bafef201d8..7b62fab1b1 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -28,15 +28,17 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 20; item.knockBack = 7.5f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 64; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; } - public override void AddRecipes() + 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); diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index 481d157a65..12cff13204 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -18,18 +18,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 84; - item.damage = 100; + item.damage = 180; item.melee = true; - item.useAnimation = 22; + item.useAnimation = 30; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 22; + 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 = 7; + item.rare = ItemRarityID.Lime; } public override void AddRecipes() @@ -45,9 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 174); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/HolidayHalberd.cs b/Items/Weapons/Melee/HolidayHalberd.cs deleted file mode 100644 index 1657fe4757..0000000000 --- a/Items/Weapons/Melee/HolidayHalberd.cs +++ /dev/null @@ -1,66 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class HolidayHalberd : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Holiday Halberd"); - Tooltip.SetDefault("idk I'm miserable with names\n" + - "- The General\n" + - "Fires red and green bouncing gift bags that emit clouds as they travel"); - } - - public override void SetDefaults() - { - item.width = 70; - item.damage = 98; - item.melee = true; - item.useAnimation = 17; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 17; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 72; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - int dustType = 0; - switch (Main.rand.Next(4)) - { - case 1: - dustType = 107; - break; - case 2: - dustType = 90; - break; - } - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType); - } - } - - 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 (Main.rand.NextBool(3)) - { - type = ModContent.ProjectileType(); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); - return false; - } - } -} diff --git a/Items/Weapons/Melee/HolidayHalberd.png b/Items/Weapons/Melee/HolidayHalberd.png deleted file mode 100644 index f41f2f0ebb..0000000000 Binary files a/Items/Weapons/Melee/HolidayHalberd.png and /dev/null differ diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index 6c2242bb99..a1ee34def1 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,5 +1,4 @@ using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -18,7 +17,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 94; - item.damage = 400; + item.height = 80; + item.scale = 1.5f; + item.damage = 270; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; @@ -27,35 +28,16 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 80; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; item.shootSpeed = 10f; + + 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, player.position); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - + Main.PlaySound(SoundID.Item14, target.position); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; @@ -71,26 +53,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Main.PlaySound(SoundID.Item14, player.position); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - + Main.PlaySound(SoundID.Item14, target.position); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 1c6669f6f7..1cdcf1af99 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class InsidiousImpaler : ModItem + public class InsidiousImpaler : ModItem { public override void SetStaticDefaults() { @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 66; - item.damage = 390; + item.damage = 210; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -28,23 +28,13 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 70; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; + + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.maxProjectiles; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; } } diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.cs b/Items/Weapons/Melee/KelvinCatalystMelee.cs deleted file mode 100644 index cbc7739b66..0000000000 --- a/Items/Weapons/Melee/KelvinCatalystMelee.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Accessories.Wings; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class KelvinCatalystMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); - } - - public override void SetDefaults() - { - item.width = 20; - item.damage = 70; - 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(0, 48, 0, 0); - item.rare = 6; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 8f; - item.melee = true; - item.Calamity().customRarity = CalamityRarity.Dedicated; - } - - 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, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 200); - recipe.AddIngredient(ItemID.FrozenKey); - recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ItemID.FrostCore, 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.png b/Items/Weapons/Melee/KelvinCatalystMelee.png deleted file mode 100644 index 86a074d801..0000000000 Binary files a/Items/Weapons/Melee/KelvinCatalystMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index f473722f4d..c52d057142 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 30; item.height = 26; item.melee = true; - item.damage = 100; + item.damage = 107; item.knockBack = 7f; item.useTime = 20; item.useAnimation = 20; @@ -39,10 +39,10 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.value = Item.buyPrice(platinum: 1, gold: 40); - } + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } public override void AddRecipes() { diff --git a/Items/Weapons/Melee/LeechingDagger.cs b/Items/Weapons/Melee/LeechingDagger.cs index d753a621fb..bae221eaa9 100644 --- a/Items/Weapons/Melee/LeechingDagger.cs +++ b/Items/Weapons/Melee/LeechingDagger.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Leeching Dagger"); - Tooltip.SetDefault("Enemies release homing leech orbs on death"); + Tooltip.SetDefault("Enemies release homing leech orbs on hit"); } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() @@ -47,25 +47,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.life <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - } + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * 0.5f * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (target.statLife <= 0) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 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 * 0.5f * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/LifefruitScythe.cs b/Items/Weapons/Melee/LifefruitScythe.cs index 49797fa2eb..70a5c80be0 100644 --- a/Items/Weapons/Melee/LifefruitScythe.cs +++ b/Items/Weapons/Melee/LifefruitScythe.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Lifehunt Scythe"); - Tooltip.SetDefault("Heals the player on enemy hits and shoots an energy scythe"); + Tooltip.SetDefault("Heals you on hit and shoots an energy scythe"); } public override void SetDefaults() { item.width = 62; - item.damage = 250; + item.damage = 156; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item71; item.autoReuse = true; item.height = 72; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; } public override void AddRecipes() @@ -47,17 +47,14 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + if (!target.canGhostHeal || player.moonLeech) return; - } + player.statLife += 5; player.HealEffect(5); } @@ -66,6 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.moonLeech) return; + player.statLife += 5; player.HealEffect(5); } diff --git a/Items/Weapons/Melee/LionHeart.cs b/Items/Weapons/Melee/LionHeart.cs index ab70b17bb0..9c84e74c35 100644 --- a/Items/Weapons/Melee/LionHeart.cs +++ b/Items/Weapons/Melee/LionHeart.cs @@ -7,14 +7,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class LionHeart : ModItem + public class LionHeart : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Lion Heart"); Tooltip.SetDefault("Summons an energy explosion on enemy hits\n" + - "Right click to summon an energy shell for a few seconds that halves all damage sources\n" + - "This has a 45 second cooldown"); + "Right click to summon an energy shell for a few seconds that halves all damage sources\n" + + "This has a 45 second cooldown"); } public override void SetDefaults() @@ -22,8 +22,9 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 60; item.height = 62; - item.damage = 700; + item.damage = 323; item.knockBack = 5.5f; + item.scale = 1.5f; item.useStyle = ItemUseStyleID.SwingThrow; item.useAnimation = 15; item.useTime = 15; @@ -35,66 +36,64 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().donorItem = true; } - public override bool AltFunctionUse(Player player) => true; + public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.shoot = ModContent.ProjectileType(); - } - else - { - item.shoot = ProjectileID.None; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + item.shoot = player.altFunctionUse == 2 ? ModContent.ProjectileType() : ProjectileID.None; + return base.CanUseItem(player); + } 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) - { - if (!player.Calamity().energyShellCooldown && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); - } - } + if (player.altFunctionUse == 2) + { + if (!player.Calamity().energyShellCooldown && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } return false; } - public override bool? CanHitNPC(Player player, NPC target) - { - if (player.altFunctionUse == 2) - { - return false; - } - return null; - } + public override bool? CanHitNPC(Player player, NPC target) + { + if (player.altFunctionUse == 2) + { + return false; + } + return null; + } - public override bool CanHitPvp(Player player, Player target) => player.altFunctionUse != 2; + public override bool CanHitPvp(Player player, Player target) => player.altFunctionUse != 2; public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - int explosion = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI, 0f, 0f); - Main.projectile[explosion].Calamity().forceMelee = true; + if (crit) + damage /= 2; + + int explosion = Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + if (explosion.WithinBounds(Main.maxProjectiles)) + Main.projectile[explosion].Calamity().forceMelee = true; } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - int explosion = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI, 0f, 0f); - Main.projectile[explosion].Calamity().forceMelee = true; + if (crit) + damage /= 2; + + 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; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 132); - } } } } diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index 0eec0dd93f..1fc9efb7c3 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Lucrecia"); Tooltip.SetDefault("Finesse\n" + "Striking an enemy makes you immune for a short time\n" + - "Using this weapon drains your life\n" + "Fires a DNA chain"); } @@ -36,25 +35,11 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 32f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) { - player.statLife -= 5; - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-5, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s DNA was destroyed."), 1000.0, 0, false); - } Projectile.NewProjectile(position.X, position.Y, item.shootSpeed * player.direction, 0f, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } @@ -81,19 +66,31 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (!player.immune) + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) { player.immune = true; - player.immuneTime = 5; + player.immuneTime = item.useTime / 5; } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (!player.immune) + bool isImmune = false; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + if (player.hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) { player.immune = true; - player.immuneTime = 5; + player.immuneTime = item.useTime / 5; } } } diff --git a/Items/Weapons/Melee/MajesticGuard.cs b/Items/Weapons/Melee/MajesticGuard.cs index 71889588be..f9de47fc29 100644 --- a/Items/Weapons/Melee/MajesticGuard.cs +++ b/Items/Weapons/Melee/MajesticGuard.cs @@ -9,14 +9,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Majestic Guard"); - Tooltip.SetDefault("Has a chance to lower enemy defense by 10 when striking them\n" + + Tooltip.SetDefault("Lowers enemy defense by 1 with every strike\n" + "If enemy defense is 0 or below your attacks will heal you"); } public override void SetDefaults() { - item.width = 98; - item.damage = 60; + item.width = 100; + item.height = 100; + item.scale = 1.5f; + item.damage = 70; item.melee = true; item.useAnimation = 22; item.useStyle = ItemUseStyleID.SwingThrow; @@ -25,21 +27,20 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 98; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (Main.rand.NextBool(5)) - target.defense -= 10; + if (target.Calamity().miscDefenseLoss < target.defense) + target.Calamity().miscDefenseLoss += 1; - // Healing effect does not trigger versus dummies - if (target.type == NPCID.TargetDummy || player.moonLeech) + // Healing effect does not trigger versus dummies + if (player.moonLeech) return; - if (target.defense <= 0 && target.canGhostHeal) + if (target.Calamity().miscDefenseLoss >= target.defense && target.canGhostHeal) { player.statLife += 3; player.HealEffect(3); diff --git a/Items/Weapons/Melee/MajesticGuard.png b/Items/Weapons/Melee/MajesticGuard.png index ab7923fee8..b78ea4c4e1 100644 Binary files a/Items/Weapons/Melee/MajesticGuard.png and b/Items/Weapons/Melee/MajesticGuard.png differ diff --git a/Items/Weapons/Melee/MandibleClaws.cs b/Items/Weapons/Melee/MandibleClaws.cs index 4989c50ecb..214d4185a0 100644 --- a/Items/Weapons/Melee/MandibleClaws.cs +++ b/Items/Weapons/Melee/MandibleClaws.cs @@ -14,18 +14,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 26; - item.damage = 14; + item.damage = 13; item.melee = true; - item.useAnimation = 6; + item.useAnimation = 7; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 6; + 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 = 1; + item.rare = ItemRarityID.Blue; } } } diff --git a/Items/Weapons/Melee/MangroveChakramMelee.cs b/Items/Weapons/Melee/MangroveChakramMelee.cs deleted file mode 100644 index c0be4942a7..0000000000 --- a/Items/Weapons/Melee/MangroveChakramMelee.cs +++ /dev/null @@ -1,45 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class MangroveChakramMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mangrove Chakram"); - } - - public override void SetDefaults() - { - 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.melee = true; - item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 7); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/MangroveChakramMelee.png b/Items/Weapons/Melee/MangroveChakramMelee.png deleted file mode 100644 index 5e0ab11e47..0000000000 Binary files a/Items/Weapons/Melee/MangroveChakramMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index a2bd797c9e..1593ec0ae0 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -17,18 +17,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 26; - item.damage = 120; + item.damage = 88; item.melee = true; - item.useAnimation = 8; + item.useAnimation = 6; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 8; + 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 = 7; + 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 0d0c869f39..c16741b9e2 100644 --- a/Items/Weapons/Melee/Mariana.cs +++ b/Items/Weapons/Melee/Mariana.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Mariana"); Tooltip.SetDefault("Tropical and deadly\n" + - "Enemies explode into water orbs on death"); + "Enemies explode into water orbs on hit"); } public override void SetDefaults() @@ -22,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.damage = 90; item.width = 54; item.height = 62; + item.scale = 1.5f; item.melee = true; item.useAnimation = 24; item.useStyle = ItemUseStyleID.SwingThrow; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; } public override void AddRecipes() @@ -49,79 +50,73 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddRecipe(); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - int num251 = Main.rand.Next(4, 6); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)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); - } - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + int num251 = Main.rand.Next(2, 4); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + } + 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); + } + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (target.statLife <= 0) - { - int num251 = Main.rand.Next(4, 6); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) - { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - value15.Normalize(); - value15 *= (float)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); - } - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } - } + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + int num251 = Main.rand.Next(2, 4); + for (int num252 = 0; num252 < num251; num252++) + { + Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + } + 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); + } + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } public override void MeleeEffects(Player player, Rectangle hitbox) { diff --git a/Items/Weapons/Melee/MarniteSpear.cs b/Items/Weapons/Melee/MarniteSpear.cs index 830da229cf..0084cb1ec6 100644 --- a/Items/Weapons/Melee/MarniteSpear.cs +++ b/Items/Weapons/Melee/MarniteSpear.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 50; - item.damage = 20; + item.damage = 26; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -25,15 +25,17 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 21; item.knockBack = 5.25f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 50; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; } - public override void AddRecipes() + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddRecipeGroup("AnyGoldBar", 5); diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 13cadae545..441977cd3c 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class MirrorBlade : ModItem { - private int baseDamage = 295; + private int baseDamage = 180; public override void SetStaticDefaults() { @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 62; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shootSpeed = 9f; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); - 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/MonstrousKnives.cs b/Items/Weapons/Melee/MonstrousKnives.cs index 35800a9933..09cfe0db0f 100644 --- a/Items/Weapons/Melee/MonstrousKnives.cs +++ b/Items/Weapons/Melee/MonstrousKnives.cs @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class MonstrousKnives : ModItem + public class MonstrousKnives : ModItem { public override void SetStaticDefaults() { @@ -23,17 +23,19 @@ namespace CalamityMod.Items.Weapons.Melee item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 21; - item.useStyle = 1; + item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 21; item.knockBack = 3f; item.UseSound = SoundID.Item39; item.autoReuse = true; item.height = 20; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = ItemRarityID.Green; + item.Calamity().donorItem = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.Calamity().customRarity = CalamityRarity.Dedicated; } 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,8 +48,8 @@ namespace CalamityMod.Items.Weapons.Melee { yDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; } - Vector2 vector = new Vector2(xDist, yDist); - float speedMult = vector.Length(); + Vector2 vector = new Vector2(xDist, yDist); + float speedMult = vector.Length(); if ((float.IsNaN(xDist) && float.IsNaN(yDist)) || (xDist == 0f && yDist == 0f)) { xDist = player.direction; @@ -84,8 +86,8 @@ namespace CalamityMod.Items.Weapons.Melee float spreadMult = 0.05f * i; xVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; yVec += Main.rand.NextFloat(-25f, 25f) * spreadMult; - Vector2 directionToShoot = new Vector2(xVec, yVec); - speedMult = directionToShoot.Length(); + Vector2 directionToShoot = new Vector2(xVec, yVec); + speedMult = directionToShoot.Length(); speedMult = speed / speedMult; xVec *= speedMult; yVec *= speedMult; diff --git a/Items/Weapons/Melee/Mourningstar.cs b/Items/Weapons/Melee/Mourningstar.cs index 65bb92e1c4..763d596057 100644 --- a/Items/Weapons/Melee/Mourningstar.cs +++ b/Items/Weapons/Melee/Mourningstar.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 16; item.height = 16; - item.damage = 230; + item.damage = 127; item.noMelee = true; item.noUseGraphic = true; item.channel = true; @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 2.5f; item.UseSound = SoundID.Item116; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shootSpeed = 24f; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shootSpeed = 24f; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index 0f73f79295..49d498e579 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -11,22 +11,22 @@ namespace CalamityMod.Items.Weapons.Melee { public class Murasama : ModItem { - private int frameCounter = 0; - private int frame = 0; + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Murasama"); 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)); } public override void SetDefaults() { item.height = 128; item.width = 56; - item.damage = 20001; - item.crit += 30; + item.damage = 3001; item.melee = true; item.noMelee = true; item.noUseGraphic = true; @@ -37,53 +37,42 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6.5f; item.autoReuse = false; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.Violet; Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 14)); } - internal Rectangle GetCurrentFrame(bool frameCounterUp = true) + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 30; + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { //0 = 6 frames, 8 = 3 frames] - int applicableCounter = frame == 0 ? 36 : frame == 8 ? 24 : 6; - - if (frameCounter >= applicableCounter) - { - frameCounter = -1; - frame = frame == 13 ? 0 : frame + 1; - } - if (frameCounterUp) - frameCounter++; - return new Rectangle(0, item.height * frame, item.width, item.height); - } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { Texture2D texture = ModContent.GetTexture(Texture); - spriteBatch.Draw(texture, position, GetCurrentFrame(), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + 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, GetCurrentFrame(), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + 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) return false; - return CalamityWorld.downedYharon || player.name == "Sam" || player.name == "Samuel Rodrigues"; + return CalamityWorld.downedYharon || player.name == "Jetstream Sam" || player.name == "Samuel Rodrigues"; } 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/MycelialClaws.cs b/Items/Weapons/Melee/MycelialClaws.cs index a45636ce4b..6c026eadc3 100644 --- a/Items/Weapons/Melee/MycelialClaws.cs +++ b/Items/Weapons/Melee/MycelialClaws.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 22; - item.damage = 14; + item.damage = 20; item.melee = true; - item.useAnimation = 6; + item.useAnimation = 7; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 6; + 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 = 2; + 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 dda2c9cee2..75b6e8d8fe 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee { public class Nadir : ModItem { - public static int BaseDamage = 700; + public static int BaseDamage = 280; public static float ShootSpeed = 12f; public override void SetStaticDefaults() @@ -35,29 +35,22 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.HoldingOut; item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(1, 80, 0, 0); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = ShootSpeed; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < Main.projectile.Length; ++i) - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - return false; - return true; - } + 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(), 15); - recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Weapons/Melee/NanoblackReaperMelee.cs b/Items/Weapons/Melee/NanoblackReaperMelee.cs deleted file mode 100644 index 5332cf626b..0000000000 --- a/Items/Weapons/Melee/NanoblackReaperMelee.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class NanoblackReaperMelee : ModItem - { - public static int BaseDamage = 800; - public static float Knockback = 9f; - public static float Speed = 16f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); - Tooltip.SetDefault("Unleashes a storm of nanoblack energy blades\nBlades target bosses whenever possible\n'She smothered them in Her hatred'"); - } - - public override void SetDefaults() - { - item.width = 78; - item.height = 64; - item.melee = true; - 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.rare = 10; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.value = Item.buyPrice(5, 0, 0, 0); - - 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddTile(ModContent.TileType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType(), 40); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ItemID.Nanites, 400); - r.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/NanoblackReaperMelee.png b/Items/Weapons/Melee/NanoblackReaperMelee.png deleted file mode 100644 index a4de09bee1..0000000000 Binary files a/Items/Weapons/Melee/NanoblackReaperMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index 17e5b3f214..e57f98fb83 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 16; item.height = 16; item.damage = 60; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.noMelee = true; item.noUseGraphic = true; item.channel = true; diff --git a/Items/Weapons/Melee/NeptunesBounty.cs b/Items/Weapons/Melee/NeptunesBounty.cs index e195edaca8..a3095c0180 100644 --- a/Items/Weapons/Melee/NeptunesBounty.cs +++ b/Items/Weapons/Melee/NeptunesBounty.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 122; item.height = 122; - item.damage = 380; + item.damage = 251; item.melee = true; item.useAnimation = 22; item.useTime = 22; @@ -32,10 +32,10 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 9f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; + + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; } diff --git a/Items/Weapons/Melee/NightsStabber.cs b/Items/Weapons/Melee/NightsStabber.cs index 445f576ddf..185974f036 100644 --- a/Items/Weapons/Melee/NightsStabber.cs +++ b/Items/Weapons/Melee/NightsStabber.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Night's Stabber"); Tooltip.SetDefault("Don't underestimate the power of stabby knives\n" + - "Enemies release homing dark energy on death"); + "Enemies release homing dark energy on hit"); } public override void SetDefaults() @@ -23,14 +23,14 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 15; item.width = 28; item.height = 34; - item.damage = 52; + 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 = 3; + item.rare = ItemRarityID.Orange; } public override void AddRecipes() @@ -56,31 +56,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 14); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - for (int i = 0; i <= 2; i++) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - } - } - } + 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); + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (target.statLife <= 0) - { - for (int i = 0; i <= 2; i++) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.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); + } } } diff --git a/Items/Weapons/Melee/OldLordOathsword.cs b/Items/Weapons/Melee/OldLordOathsword.cs index 9a7ddea88c..ef1b69e6ad 100644 --- a/Items/Weapons/Melee/OldLordOathsword.cs +++ b/Items/Weapons/Melee/OldLordOathsword.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 34; + item.damage = 60; item.width = 70; item.height = 70; item.melee = true; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index cff0e16ea8..abe904e2f2 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 62; - item.damage = 220; + item.damage = 130; item.melee = true; item.useAnimation = 18; item.useTime = 18; @@ -29,18 +29,19 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 62; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - 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) { - for (int projectiles = 0; projectiles <= 2; projectiles++) + for (int projectiles = 0; projectiles < 3; projectiles++) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/Omniblade.cs b/Items/Weapons/Melee/Omniblade.cs index aad75f2df4..566097b9bd 100644 --- a/Items/Weapons/Melee/Omniblade.cs +++ b/Items/Weapons/Melee/Omniblade.cs @@ -1,6 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,8 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 64; - item.damage = 63; - item.crit += 45; + item.damage = 100; item.melee = true; item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,29 +28,18 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 146; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 24f; + item.rare = ItemRarityID.Yellow; } - public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) - { - hitbox = CalamityUtils.FixSwingHitbox(102, 102); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 45; - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), 360); - } - } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (Main.rand.NextBool(5)) - { - target.AddBuff(ModContent.BuffType(), 360); - } - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Omniblade.png b/Items/Weapons/Melee/Omniblade.png index 53936276b5..1afd373fd5 100644 Binary files a/Items/Weapons/Melee/Omniblade.png and b/Items/Weapons/Melee/Omniblade.png differ diff --git a/Items/Weapons/Melee/Oracle.cs b/Items/Weapons/Melee/Oracle.cs index 4855ab593d..4dd5bd38ac 100644 --- a/Items/Weapons/Melee/Oracle.cs +++ b/Items/Weapons/Melee/Oracle.cs @@ -10,17 +10,18 @@ namespace CalamityMod.Items.Weapons.Melee { public class Oracle : ModItem { - public const int YoyoBaseDamage = 380; - public const int AuraBaseDamage = 120; - public const int AuraMaxDamage = 400; - - public override void SetStaticDefaults() + public const int YoyoBaseDamage = 170; + public const int AuraBaseDamage = 100; + public const int AuraMaxDamage = 220; + + public override void SetStaticDefaults() { DisplayName.SetDefault("The Oracle"); Tooltip.SetDefault("Gaze into the past, the present, the future... and the circumstances of your inevitable demise\n" + - "Emits an aura of red lightning which charges up when hitting enemies\n" + - "Fires auric orbs when supercharged\n" + - "An exceptionally agile yoyo\n"); + "Emits an aura of red lightning which charges up when hitting enemies\n" + + "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; @@ -46,9 +47,9 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(platinum: 2, gold: 50); + 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) @@ -68,8 +69,8 @@ namespace CalamityMod.Items.Weapons.Melee r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 4); - r.AddRecipe(); + r.AddIngredient(ModContent.ItemType(), 4); + r.AddRecipe(); } } } diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 901a31e9f1..89807177c4 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 50; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; } diff --git a/Items/Weapons/Melee/PhoenixBlade.cs b/Items/Weapons/Melee/PhoenixBlade.cs index 7a16c00a43..8166f627c6 100644 --- a/Items/Weapons/Melee/PhoenixBlade.cs +++ b/Items/Weapons/Melee/PhoenixBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 106; - item.damage = 120; + item.damage = 160; item.melee = true; item.useAnimation = 27; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,42 +30,41 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 106; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shootSpeed = 12f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { if (target.life <= 0) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - float randomSpeedX = (float)Main.rand.Next(5); - float randomSpeedY = (float)Main.rand.Next(3, 7); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI); - } + OnHitEffects(player, target.Center, knockback, damage, crit); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { if (target.statLife <= 0) - { - int boom = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[boom].Calamity().forceMelee = true; - float randomSpeedX = (float)Main.rand.Next(5); - float randomSpeedY = (float)Main.rand.Next(3, 7); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, player.whoAmI); - } + OnHitEffects(player, target.Center, item.knockBack, damage, crit); + } + + private void OnHitEffects(Player player, Vector2 targetPos, float kBack, int damage, bool crit) + { + if (crit) + damage /= 2; + + int boom = Projectile.NewProjectile(targetPos, Vector2.Zero, ModContent.ProjectileType(), damage, kBack, player.whoAmI, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].Calamity().forceMelee = true; + + float randomSpeedX = Main.rand.Next(5); + float randomSpeedY = Main.rand.Next(3, 7); + Projectile.NewProjectile(targetPos.X, targetPos.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), damage, kBack, player.whoAmI); + Projectile.NewProjectile(targetPos.X, targetPos.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), damage, kBack, player.whoAmI); } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); } public override void AddRecipes() diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.cs b/Items/Weapons/Melee/PhosphorescentGauntlet.cs new file mode 100644 index 0000000000..8c977ce9b8 --- /dev/null +++ b/Items/Weapons/Melee/PhosphorescentGauntlet.cs @@ -0,0 +1,50 @@ +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class PhosphorescentGauntlet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phosphorescent Gauntlet"); + Tooltip.SetDefault("Releases rapid sulphurous punches\n" + + "On use, you lunge in the direction of the mouse\n" + + "On collision, you are knocked back"); + } + + 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; + } + + // 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 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), type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Melee/PhosphorescentGauntlet.png b/Items/Weapons/Melee/PhosphorescentGauntlet.png new file mode 100644 index 0000000000..a470c6a68d Binary files /dev/null and b/Items/Weapons/Melee/PhosphorescentGauntlet.png differ diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs new file mode 100644 index 0000000000..5b6bee5630 --- /dev/null +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -0,0 +1,53 @@ +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class PhotonRipper : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Photon Ripper"); + Tooltip.SetDefault("Projects a directed stream of hardlight teeth at ultra high velocity\n" + + "This weapon and its projectiles function as a chainsaw"); + } + + public override void SetDefaults() + { + item.height = 134; + item.width = 54; + item.damage = 4050; + + // Displayed axe% is 1/5th of axePower here because trees have 500% hardness. This corrects for that. + item.axe = 6000 / 5; + item.melee = true; + item.noMelee = true; + item.noUseGraphic = true; + item.channel = true; + item.useStyle = ItemUseStyleID.HoldingOut; + item.useTime = 5; + item.useAnimation = 25; + item.knockBack = 12f; + item.autoReuse = false; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 1f; + + 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 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), type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Melee/PhotonRipper.png b/Items/Weapons/Melee/PhotonRipper.png new file mode 100644 index 0000000000..7a425f4909 Binary files /dev/null and b/Items/Weapons/Melee/PhotonRipper.png differ diff --git a/Items/Weapons/Melee/PlagueKeeper.cs b/Items/Weapons/Melee/PlagueKeeper.cs index 79ec5adbf0..068124e44a 100644 --- a/Items/Weapons/Melee/PlagueKeeper.cs +++ b/Items/Weapons/Melee/PlagueKeeper.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 74; - item.damage = 80; + item.damage = 75; item.melee = true; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; @@ -28,11 +29,10 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 90; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.BeeKeeper); recipe.AddIngredient(ItemID.FragmentSolar, 10); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); @@ -50,26 +50,38 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + if (crit) + damage /= 2; + + target.AddBuff(ModContent.BuffType(), 300); for (int i = 0; i < 3; i++) { - int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), - player.beeDamage((int)(item.damage * player.MeleeDamage()) / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); - Main.projectile[bee].penetrate = 1; - Main.projectile[bee].Calamity().forceMelee = true; + int bee = Projectile.NewProjectile(player.Center, Vector2.Zero, player.beeType(), + player.beeDamage(damage / 3), player.beeKB(0f), player.whoAmI); + if (bee.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[bee].penetrate = 1; + Main.projectile[bee].Calamity().forceMelee = true; + } } } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + if (crit) + damage /= 2; + + target.AddBuff(ModContent.BuffType(), 300); for (int i = 0; i < 3; i++) { - int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), - player.beeDamage((int)(item.damage * player.MeleeDamage()) / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); - Main.projectile[bee].penetrate = 1; - Main.projectile[bee].Calamity().forceMelee = true; + int bee = Projectile.NewProjectile(player.Center, Vector2.Zero, player.beeType(), + player.beeDamage(damage / 3), player.beeKB(0f), player.whoAmI); + if (bee.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[bee].penetrate = 1; + Main.projectile[bee].Calamity().forceMelee = true; + } } - } + } } } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index fb0ec5f0da..da46d4a986 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -16,47 +16,46 @@ namespace CalamityMod.Items.Weapons.Melee public class PrismaticBreaker : ModItem { private int alpha = 50; - public Color[] colors = new Color[] - { - new Color(255, 0, 0, 50), //Red - new Color(255, 128, 0, 50), //Orange - new Color(255, 255, 0, 50), //Yellow - new Color(128, 255, 0, 50), //Lime - new Color(0, 255, 0, 50), //Green - new Color(0, 255, 128, 50), //Turquoise - new Color(0, 255, 255, 50), //Cyan - new Color(0, 128, 255, 50), //Light Blue - new Color(0, 0, 255, 50), //Blue - new Color(128, 0, 255, 50), //Purple - new Color(255, 0, 255, 50), //Fuschia - new Color(255, 0, 128, 50) //Hot Pink - }; - List colorSet = new List() - { - new Color(255, 0, 0, 50), //Red - new Color(255, 255, 0, 50), //Yellow - new Color(0, 255, 0, 50), //Green - new Color(0, 255, 255, 50), //Cyan - new Color(0, 0, 255, 50), //Blue - new Color(255, 0, 255, 50), //Fuschia - }; + public Color[] colors = new Color[] + { + new Color(255, 0, 0, 50), //Red + new Color(255, 128, 0, 50), //Orange + new Color(255, 255, 0, 50), //Yellow + new Color(128, 255, 0, 50), //Lime + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 128, 50), //Turquoise + new Color(0, 255, 255, 50), //Cyan + new Color(0, 128, 255, 50), //Light Blue + new Color(0, 0, 255, 50), //Blue + new Color(128, 0, 255, 50), //Purple + new Color(255, 0, 255, 50), //Fuschia + new Color(255, 0, 128, 50) //Hot Pink + }; + List colorSet = new List() + { + new Color(255, 0, 0, 50), //Red + new Color(255, 255, 0, 50), //Yellow + new Color(0, 255, 0, 50), //Green + new Color(0, 255, 255, 50), //Cyan + new Color(0, 0, 255, 50), //Blue + new Color(255, 0, 255, 50), //Fuschia + }; public override void SetStaticDefaults() { DisplayName.SetDefault("Prismatic Breaker"); Tooltip.SetDefault("Seems to belong to a certain magical girl. Radiates with intense cosmic energy.\n" + "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; + "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; } public override void SetDefaults() { - item.damage = 1200; - item.crit += 8; - item.useStyle = 1; - item.useTime = item.useAnimation = 15; + item.damage = 662; + item.useStyle = ItemUseStyleID.SwingThrow; + item.useTime = item.useAnimation = 13; item.useTurn = true; item.melee = true; item.knockBack = 7f; @@ -67,64 +66,65 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; item.value = CalamityGlobalItem.Rarity14BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().donorItem = true; } - //Cancel out normal melee damage boosts and replace it with the average of melee and ranged damage boosts - //all damage boosts should still apply + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + + //Cancel out normal melee damage boosts and replace it with the average of melee and ranged damage boosts + //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; + float damageMult = (player.meleeDamage + player.rangedDamage - 2f) / 2f; add += damageMult - player.meleeDamage + 1f; - } + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - //item.width and then item.height - 2f - Vector2 origin = new Vector2(25f, 23f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + } + else + { + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI); } - else - { - Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI, 0f, 0f); - } return false; } - public override bool AltFunctionUse(Player player) => true; + public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.UseSound = SoundID.Item1; - item.useStyle = 1; - item.useTurn = true; - item.autoReuse = true; - item.noMelee = false; - item.channel = false; - } - else - { - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); - item.useStyle = 5; - item.useTurn = false; - item.autoReuse = false; - item.noMelee = true; - item.channel = true; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.UseSound = SoundID.Item1; + item.useStyle = ItemUseStyleID.SwingThrow; + 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; + } + return base.CanUseItem(player); + } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) { @@ -136,7 +136,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.CursedInferno, 120); @@ -148,7 +147,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.CursedInferno, 120); diff --git a/Items/Weapons/Melee/ProfanedSword.cs b/Items/Weapons/Melee/ProfanedSword.cs index aceefd4f42..06916b6641 100644 --- a/Items/Weapons/Melee/ProfanedSword.cs +++ b/Items/Weapons/Melee/ProfanedSword.cs @@ -20,16 +20,17 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.damage = 75; + 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 = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item1; item.autoReuse = true; item.shootSpeed = 20f; @@ -65,22 +66,26 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + if (crit) + damage /= 2; + + target.AddBuff(ModContent.BuffType(), 300); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + if (crit) + damage /= 2; + + target.AddBuff(ModContent.BuffType(), 300); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), damage, item.knockBack, Main.myPlayer); } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(4)) - { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, (int)CalamityDusts.Brimstone); - } } public override void AddRecipes() diff --git a/Items/Weapons/Melee/PwnagehammerMelee.cs b/Items/Weapons/Melee/PwnagehammerMelee.cs index ee275ed591..733978f19c 100644 --- a/Items/Weapons/Melee/PwnagehammerMelee.cs +++ b/Items/Weapons/Melee/PwnagehammerMelee.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,15 +12,14 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Pwnagehammer"); Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + - "There is a 20 percent chance for the hammer to home in on a target\n" + - "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); + "There is a 20 percent chance for the hammer to home in on a target\n" + + "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); } public override void SetDefaults() { - item.width = 68; + item.width = 66; item.damage = 210; - item.crit = 10; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -29,21 +28,24 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 10f; item.UseSound = SoundID.Item1; item.melee = true; - item.height = 68; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { - Vector2 speed = new Vector2(speedX, speedY); - Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; - if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) - { - position += yeetOffset; - } + Vector2 speed = new Vector2(speedX, speedY); + Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; + if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) + { + position += yeetOffset; + } Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : -1f); return false; } diff --git a/Items/Weapons/Melee/PwnagehammerMelee.png b/Items/Weapons/Melee/PwnagehammerMelee.png index 7a6cb7bc22..8b699f9155 100644 Binary files a/Items/Weapons/Melee/PwnagehammerMelee.png and b/Items/Weapons/Melee/PwnagehammerMelee.png differ diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 38902118c6..09906dec0b 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.value = Item.buyPrice(gold: 60); } diff --git a/Items/Weapons/Melee/RedSun.cs b/Items/Weapons/Melee/RedSun.cs index b82929fc9e..d964bc6292 100644 --- a/Items/Weapons/Melee/RedSun.cs +++ b/Items/Weapons/Melee/RedSun.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 62; item.height = 62; - item.damage = 2500; + item.damage = 500; item.melee = true; item.useTime = 5; item.reuseDelay = 20; @@ -33,11 +33,12 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 4; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.Calamity().customRarity = CalamityRarity.Developer; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override void AddRecipes() @@ -106,9 +107,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 64); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/RedtideSword.cs b/Items/Weapons/Melee/RedtideSword.cs index e13aed66fa..42630242c5 100644 --- a/Items/Weapons/Melee/RedtideSword.cs +++ b/Items/Weapons/Melee/RedtideSword.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 42; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; } diff --git a/Items/Weapons/Melee/Roxcalibur.cs b/Items/Weapons/Melee/Roxcalibur.cs index a500f545bc..c2227a10c5 100644 --- a/Items/Weapons/Melee/Roxcalibur.cs +++ b/Items/Weapons/Melee/Roxcalibur.cs @@ -19,17 +19,16 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Roxcalibur"); Tooltip.SetDefault("You couldn’t get it out of the rock, so you just brought the rock instead\n" + - "A hellish entity of flesh holds the key to this weapon’s power\n" + - "Left click to shoot several rock shards\n" + - "Right click to dive downwards and bounce off enemies\n" + - "Diving into blocks creates a shockwave"); + "A hellish entity of flesh holds the key to this weapon’s power\n" + + "Left click to shoot several rock shards\n" + + "Right click to dive downwards and bounce off enemies\n" + + "Diving into blocks creates a shockwave"); } public override void SetDefaults() { item.damage = 80; item.knockBack = 13; - item.crit += 8; item.melee = true; item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.NPCHit42; @@ -42,11 +41,14 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = Item.buyPrice(CalamityGlobalItem.Rarity5BuyPrice); + item.rare = ItemRarityID.Pink; + item.Calamity().donorItem = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -192,8 +194,8 @@ namespace CalamityMod.Items.Weapons.Melee } } // Makes the player forcefully dive down - if (CalamityUtils.CountHookProj() <= 0) - player.velocity.Y = player.maxFallSpeed; + if (CalamityUtils.CountHookProj() <= 0) + player.velocity.Y = player.maxFallSpeed; //Rotates the sprite of the item on alt fire to have it point downwards player.itemRotation = player.direction * MathHelper.ToRadians(135f); //Dust trail @@ -258,22 +260,22 @@ namespace CalamityMod.Items.Weapons.Melee { if (item.useStyle == ItemUseStyleID.HoldingUp) { - if (player.whoAmI == Main.myPlayer) - { - //"Well you did refresh the cooldown but like i dont want it to be wasted on an enemy hit so imma ask you for a refund" - if (Didrefresh) - { - Roxcooldown = 600; - Didrefresh = false; - } - //End the alt attack - player.itemAnimation = 0; - player.itemTime = 0; - RoxAlt = false; - RoxCanUse = 0; - player.velocity.Y = -16f; - player.fallStart = (int)(player.position.Y / 16f); - } + if (player.whoAmI == Main.myPlayer) + { + //"Well you did refresh the cooldown but like i dont want it to be wasted on an enemy hit so imma ask you for a refund" + if (Didrefresh) + { + Roxcooldown = 600; + Didrefresh = false; + } + //End the alt attack + player.itemAnimation = 0; + player.itemTime = 0; + RoxAlt = false; + RoxCanUse = 0; + player.velocity.Y = -16f; + player.fallStart = (int)(player.position.Y / 16f); + } } } @@ -281,22 +283,22 @@ namespace CalamityMod.Items.Weapons.Melee { if (item.useStyle == ItemUseStyleID.HoldingUp) { - if (player.whoAmI == Main.myPlayer) - { - //"Well you did refresh the cooldown but like i dont want it to be wasted on a player hit so imma ask you for a refund" - if (Didrefresh) - { - Roxcooldown = 600; - Didrefresh = false; - } - //End the alt attack - player.itemAnimation = 0; - player.itemTime = 0; - RoxAlt = false; - RoxCanUse = 0; - player.velocity.Y = -16f; - player.fallStart = (int)(player.position.Y / 16f); - } + if (player.whoAmI == Main.myPlayer) + { + //"Well you did refresh the cooldown but like i dont want it to be wasted on a player hit so imma ask you for a refund" + if (Didrefresh) + { + Roxcooldown = 600; + Didrefresh = false; + } + //End the alt attack + player.itemAnimation = 0; + player.itemTime = 0; + RoxAlt = false; + RoxCanUse = 0; + player.velocity.Y = -16f; + player.fallStart = (int)(player.position.Y / 16f); + } } } } diff --git a/Items/Weapons/Melee/RoyalKnivesMelee.cs b/Items/Weapons/Melee/RoyalKnivesMelee.cs index fc6cabc9ce..a1121b06a9 100644 --- a/Items/Weapons/Melee/RoyalKnivesMelee.cs +++ b/Items/Weapons/Melee/RoyalKnivesMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 18; - item.damage = 2000; + item.damage = 400; item.melee = true; item.noMelee = true; item.noUseGraphic = true; @@ -31,11 +31,13 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item39; item.autoReuse = true; item.height = 20; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 9f; - item.Calamity().customRarity = CalamityRarity.Developer; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) @@ -93,8 +95,7 @@ namespace CalamityMod.Items.Weapons.Melee num149 *= num80; float x4 = vector2.X; float y4 = vector2.Y; - int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[knife].Calamity().forceMelee = true; + Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index 03528cd944..bcd63e15e9 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -27,15 +27,17 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 20; item.knockBack = 6.25f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 42; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; } - public override void AddRecipes() + 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); diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 543a96349d..e6ab4a736a 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -1,7 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 18; - item.damage = 1300; + item.width = item.height = 64; + item.damage = 478; item.melee = true; item.noMelee = true; item.noUseGraphic = true; @@ -29,22 +27,20 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 5f; item.UseSound = SoundID.Item109; item.autoReuse = true; - item.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.Calamity().customRarity = CalamityRarity.Violet; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); + recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 200); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.png b/Items/Weapons/Melee/ScourgeoftheCosmos.png index f5b527abdf..b9cfa8ce5a 100644 Binary files a/Items/Weapons/Melee/ScourgeoftheCosmos.png and b/Items/Weapons/Melee/ScourgeoftheCosmos.png differ diff --git a/Items/Weapons/Melee/SeashellBoomerangMelee.cs b/Items/Weapons/Melee/SeashellBoomerangMelee.cs deleted file mode 100644 index d226d3ca7a..0000000000 --- a/Items/Weapons/Melee/SeashellBoomerangMelee.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class SeashellBoomerangMelee : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Seashell Boomerang"); - } - - public override void SetDefaults() - { - 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.melee = true; - item.height = 34; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 11.5f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Melee/SeashellBoomerangMelee.png b/Items/Weapons/Melee/SeashellBoomerangMelee.png deleted file mode 100644 index 4e0fba13e0..0000000000 Binary files a/Items/Weapons/Melee/SeashellBoomerangMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/SeashineSword.cs b/Items/Weapons/Melee/SeashineSword.cs index 403b518c62..b2c566e942 100644 --- a/Items/Weapons/Melee/SeashineSword.cs +++ b/Items/Weapons/Melee/SeashineSword.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee item.height = 38; item.knockBack = 2; item.shootSpeed = 11; - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item1; } diff --git a/Items/Weapons/Melee/Shimmerspark.cs b/Items/Weapons/Melee/Shimmerspark.cs index 783b48dc67..7c906067a2 100644 --- a/Items/Weapons/Melee/Shimmerspark.cs +++ b/Items/Weapons/Melee/Shimmerspark.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Shimmerspark"); - Tooltip.SetDefault("Fires stars when enemies are near"); + 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; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.value = Item.buyPrice(gold: 36); } diff --git a/Items/Weapons/Melee/SolarFlare.cs b/Items/Weapons/Melee/SolarFlare.cs index f99be3b328..605c395c5d 100644 --- a/Items/Weapons/Melee/SolarFlare.cs +++ b/Items/Weapons/Melee/SolarFlare.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 40; item.height = 38; item.melee = true; - item.damage = 60; + item.damage = 71; item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.buyPrice(platinum: 1, gold: 20); - } + 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 da9697e8bd..5935f6ee4a 100644 --- a/Items/Weapons/Melee/SolsticeClaymore.cs +++ b/Items/Weapons/Melee/SolsticeClaymore.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 86; - item.damage = 520; + item.damage = 300; item.melee = true; item.useAnimation = 16; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,11 +30,10 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 86; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/SoulEdge.cs b/Items/Weapons/Melee/SoulEdge.cs index 875f594be7..18ef5e6b5d 100644 --- a/Items/Weapons/Melee/SoulEdge.cs +++ b/Items/Weapons/Melee/SoulEdge.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,41 +10,47 @@ namespace CalamityMod.Items.Weapons.Melee { public class SoulEdge : ModItem { + static internal LegacySoundStyle ProjectileDeathSound = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Edge"); Tooltip.SetDefault("Fires the ghastly souls of long-deceased abyss dwellers"); + + ProjectileDeathSound = SoundID.NPCDeath39.WithVolume(0.5f); } public override void SetDefaults() { item.width = 88; - item.damage = 365; + item.height = 88; + item.damage = 174; item.melee = true; - item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 18; + item.useTime = 23; + item.useAnimation = 23; item.useTurn = true; item.knockBack = 5.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 88; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; + + 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 num6 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) + int numShots = 2; + for (int i = 0; i < numShots; ++i) { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; float ai1 = Main.rand.NextFloat() + 0.5f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, Main.rand.Next(type, type + 3), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, ai1); + // TODO -- unchecked type addition math assumes we can guarantee load order + // this is extremely unsafe and load order may become non deterministic in 1.4 + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, Main.rand.Next(type, type + 3), damage, knockBack, player.whoAmI, 0.0f, ai1); } return false; } diff --git a/Items/Weapons/Melee/SoulHarvester.cs b/Items/Weapons/Melee/SoulHarvester.cs index 15200cba64..6a44dfcaa1 100644 --- a/Items/Weapons/Melee/SoulHarvester.cs +++ b/Items/Weapons/Melee/SoulHarvester.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 64; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; } @@ -62,26 +62,23 @@ namespace CalamityMod.Items.Weapons.Melee if (target.life <= (target.lifeMax * 0.15f)) { Main.PlaySound(SoundID.Item14, target.position); - - // DEFECT -- HiveBombExplosion does not exist. - // Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - - for (int num621 = 0; num621 < 30; num621++) + player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), 0f, 0, false); + for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 50; num623++) + for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } @@ -94,26 +91,22 @@ namespace CalamityMod.Items.Weapons.Melee if (target.statLife <= (target.statLifeMax * 0.15f)) { Main.PlaySound(SoundID.Item14, target.position); - - // DEFECT -- HiveBombExplosion does not exist. - // Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); - - for (int num621 = 0; num621 < 30; num621++) + for (int num621 = 0; num621 < 10; num621++) { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 50; num623++) + for (int num623 = 0; num623 < 20; num623++) { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 89, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } } diff --git a/Items/Weapons/Melee/SpatialLance.cs b/Items/Weapons/Melee/SpatialLance.cs index ac33398c35..c65e022c4b 100644 --- a/Items/Weapons/Melee/SpatialLance.cs +++ b/Items/Weapons/Melee/SpatialLance.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 88; - item.damage = 210; + item.damage = 160; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -30,26 +30,15 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 88; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.Turquoise; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs new file mode 100644 index 0000000000..4f1b9a089e --- /dev/null +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class SpineOfThanatos : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spine of Thanatos"); + Tooltip.SetDefault("Releases 3 fast metallic whips outward\n" + + "Once all three collide, a prism of light is shot outward\n" + + "If an enemy is within the line of sight of the whips on collision, the light will fire towards it"); + } + + 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(); + } + + 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) + { + for (int i = 0; i < 2; i++) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, (i == 0f).ToDirectionInt()); + + // Create a third, final whip that does not swing around at all and instead simply flies towards the mouse. + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Melee/SpineOfThanatos.png b/Items/Weapons/Melee/SpineOfThanatos.png new file mode 100644 index 0000000000..cbac11a060 Binary files /dev/null and b/Items/Weapons/Melee/SpineOfThanatos.png differ diff --git a/Items/Weapons/Melee/SporeKnife.cs b/Items/Weapons/Melee/SporeKnife.cs index feb2b1eb20..6799af073e 100644 --- a/Items/Weapons/Melee/SporeKnife.cs +++ b/Items/Weapons/Melee/SporeKnife.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Spore Knife"); - Tooltip.SetDefault("Enemies release spore clouds on death"); + Tooltip.SetDefault("Enemies release spore clouds on hit"); } public override void SetDefaults() @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; } public override void AddRecipes() @@ -44,27 +44,21 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 2); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 2); } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - if (target.life <= 0) - { - int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), knockback, Main.myPlayer); - Main.projectile[proj].Calamity().forceMelee = true; - } - } + 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); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; + } - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - if (target.statLife <= 0) - { - int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f)), item.knockBack, Main.myPlayer); - 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); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; + } } } diff --git a/Items/Weapons/Melee/SporeKnife.png b/Items/Weapons/Melee/SporeKnife.png index 3627904887..eda8bd0455 100644 Binary files a/Items/Weapons/Melee/SporeKnife.png and b/Items/Weapons/Melee/SporeKnife.png differ diff --git a/Items/Weapons/Melee/StarnightLance.cs b/Items/Weapons/Melee/StarnightLance.cs index 0d710c75aa..4ff3f3af7e 100644 --- a/Items/Weapons/Melee/StarnightLance.cs +++ b/Items/Weapons/Melee/StarnightLance.cs @@ -27,15 +27,17 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 23; item.knockBack = 6; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 72; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; } - public override void AddRecipes() + 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); diff --git a/Items/Weapons/Melee/StellarContemptMelee.cs b/Items/Weapons/Melee/StellarContemptMelee.cs index f9ca0abeda..ebf5b3bf10 100644 --- a/Items/Weapons/Melee/StellarContemptMelee.cs +++ b/Items/Weapons/Melee/StellarContemptMelee.cs @@ -1,14 +1,13 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class StellarContemptMelee : ModItem + public class StellarContemptMelee : ModItem { - public static int BaseDamage = 350; + public static int BaseDamage = 300; public static float Speed = 18f; public override void SetStaticDefaults() @@ -33,21 +32,13 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; - item.shoot = ModContent.ProjectileType(); + 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index ecd72572cd..f105df58ec 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -17,7 +17,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 84; - item.damage = 640; + item.height = 90; + item.scale = 1.5f; + item.damage = 480; item.melee = true; item.useAnimation = 25; item.useStyle = ItemUseStyleID.SwingThrow; @@ -26,30 +28,24 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 90; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shootSpeed = 12f; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shootSpeed = 12f; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) - { - return; - } if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, knockback); + SpawnFlares(player, knockback, damage, crit); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { if (player.whoAmI == Main.myPlayer) - SpawnFlares(player, item.knockBack); + SpawnFlares(player, item.knockBack, damage, crit); } - private void SpawnFlares(Player player, float knockBack) + private void SpawnFlares(Player player, float knockBack, int damage, bool crit) { Main.PlaySound(SoundID.Item88, player.position); int i = Main.myPlayer; @@ -73,7 +69,10 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num112 = 2; + if (crit) + damage /= 2; + + int num112 = 2; for (int num113 = 0; num113 < num112; num113++) { vector2 = new Vector2(player.Center.X + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); @@ -95,8 +94,9 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(item.damage * player.MeleeDamage() * 0.5), knockBack, i, 0f, (float)Main.rand.Next(3)); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, ProjectileID.LunarFlare, (int)(damage * 0.5), knockBack, i, 0f, (float)Main.rand.Next(3)); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } } diff --git a/Items/Weapons/Melee/StormRuler.cs b/Items/Weapons/Melee/StormRuler.cs index ecd1264918..4b241e3ada 100644 --- a/Items/Weapons/Melee/StormRuler.cs +++ b/Items/Weapons/Melee/StormRuler.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 82; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; } diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 3afea0d9e3..92f13b5594 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 68; + item.height = 64; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/StormSaber.png b/Items/Weapons/Melee/StormSaber.png index 0e632902ef..a4606164bd 100644 Binary files a/Items/Weapons/Melee/StormSaber.png and b/Items/Weapons/Melee/StormSaber.png differ diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index 4ab2194d10..2b01247bbe 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 100; - item.damage = 350; + item.damage = 112; item.melee = true; item.noMelee = true; item.useTurn = true; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 100; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().customRarity = CalamityRarity.DarkBlue; @@ -41,27 +41,15 @@ namespace CalamityMod.Items.Weapons.Melee public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(50f, 48f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/StreamGougeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/StreamGougeGlow")); } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 14); - recipe.AddRecipeGroup("NForEE", 7); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 1c1e3249c6..1678372b82 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useTurn = true; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; } public override void MeleeEffects(Player player, Rectangle hitbox) @@ -42,12 +42,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.7f), knockback, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.7f), item.knockBack, Main.myPlayer); + if (crit) + damage /= 2; + + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * 0.7f), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/SubmarineShocker.png b/Items/Weapons/Melee/SubmarineShocker.png index cfececae90..c1a04b66b1 100644 Binary files a/Items/Weapons/Melee/SubmarineShocker.png and b/Items/Weapons/Melee/SubmarineShocker.png differ diff --git a/Items/Weapons/Melee/SulphurousGrabber.cs b/Items/Weapons/Melee/SulphurousGrabber.cs index e03e4d6b21..f0c04581f0 100644 --- a/Items/Weapons/Melee/SulphurousGrabber.cs +++ b/Items/Weapons/Melee/SulphurousGrabber.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.rare = 5; + 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 fd2a34ecaa..8964ea5e7a 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -19,39 +19,39 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 84; + item.width = 88; item.damage = 60; item.melee = true; item.useAnimation = 30; item.useTime = 30; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = 15f; + item.knockBack = 7f; item.UseSound = SoundID.Item60; item.autoReuse = true; - item.height = 84; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.height = 90; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = 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) { switch (Main.rand.Next(4)) { case 0: - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); break; case 1: - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); break; case 2: - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); break; case 3: - type = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); break; } float num72 = Main.rand.Next(22, 30); @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Melee num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 2f, 0f); } return false; } @@ -106,7 +106,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 480); - target.AddBuff(ModContent.BuffType(), 480); + target.AddBuff(BuffID.Frostburn, 480); target.AddBuff(ModContent.BuffType(), 480); target.AddBuff(ModContent.BuffType(), 480); } @@ -114,7 +114,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 480); - target.AddBuff(ModContent.BuffType(), 480); + target.AddBuff(BuffID.Frostburn, 480); target.AddBuff(ModContent.BuffType(), 480); target.AddBuff(ModContent.BuffType(), 480); } diff --git a/Items/Weapons/Melee/Swordsplosion.png b/Items/Weapons/Melee/Swordsplosion.png index 6714d41334..22b5b123e8 100644 Binary files a/Items/Weapons/Melee/Swordsplosion.png and b/Items/Weapons/Melee/Swordsplosion.png differ diff --git a/Items/Weapons/Melee/TeardropCleaver.cs b/Items/Weapons/Melee/TeardropCleaver.cs index 734d625898..10d49af2b4 100644 --- a/Items/Weapons/Melee/TeardropCleaver.cs +++ b/Items/Weapons/Melee/TeardropCleaver.cs @@ -16,23 +16,24 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 56; - item.damage = 18; + item.damage = 30; item.melee = true; item.useAnimation = 24; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 24; item.useTurn = true; - item.knockBack = 4.5f; + item.knockBack = 5.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 66; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - } + item.rare = ItemRarityID.Green; + item.Calamity().challengeDrop = true; + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Items/Weapons/Melee/TemporalFloeSword.cs b/Items/Weapons/Melee/TemporalFloeSword.cs index f60bd4a45f..b5824845df 100644 --- a/Items/Weapons/Melee/TemporalFloeSword.cs +++ b/Items/Weapons/Melee/TemporalFloeSword.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 60; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; } @@ -46,7 +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); @@ -63,19 +63,13 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (Main.rand.NextBool(3)) - { - target.AddBuff(ModContent.BuffType(), 120); - } + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 600); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - if (Main.rand.NextBool(3)) - { - target.AddBuff(ModContent.BuffType(), 120); - } + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 600); } } diff --git a/Items/Weapons/Melee/TenebreusTides.cs b/Items/Weapons/Melee/TenebreusTides.cs index d4b147c54b..064f712819 100644 --- a/Items/Weapons/Melee/TenebreusTides.cs +++ b/Items/Weapons/Melee/TenebreusTides.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Tenebreus Tides"); Tooltip.SetDefault("Inundatio ex Laminis\n" + - "Shoots a water spear that pierces enemies and terrain\n" + - "Striking enemies summon liquid blades and spears to assault the struck foe"); + "Shoots a water spear that pierces enemies and terrain\n" + + "Striking enemies summon liquid blades and spears to assault the struck foe"); } public override void SetDefaults() @@ -28,15 +28,16 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.width = item.height = 72; - item.useStyle = 5; + 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.value = CalamityGlobalItem.Rarity9BuyPrice; - item.rare = 9; - item.Calamity().customRarity = CalamityRarity.Dedicated; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Melee/TenebreusTides.png b/Items/Weapons/Melee/TenebreusTides.png index 6b5fac2a7a..bc1fb44020 100644 Binary files a/Items/Weapons/Melee/TenebreusTides.png and b/Items/Weapons/Melee/TenebreusTides.png differ diff --git a/Items/Weapons/Melee/TerraDiskMelee.cs b/Items/Weapons/Melee/TerraDiskMelee.cs deleted file mode 100644 index cdcfb0e8b1..0000000000 --- a/Items/Weapons/Melee/TerraDiskMelee.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - public class TerraDiskMelee : ModItem - { - public static int BaseDamage = 100; - public static float Speed = 12f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Disk"); - Tooltip.SetDefault(@"Throws a disk that has a chance to generate several disks if enemies are near it -A max of three disks can be active at a time"); - } - - public override void SetDefaults() - { - 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.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - - item.melee = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = Speed; - } - - public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[item.shoot] >= 3) - { - return false; - } - else - { - return 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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceMelee = true; - return false; - } - - 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(); - } - } -} diff --git a/Items/Weapons/Melee/TerraDiskMelee.png b/Items/Weapons/Melee/TerraDiskMelee.png deleted file mode 100644 index 32b39a6f1e..0000000000 Binary files a/Items/Weapons/Melee/TerraDiskMelee.png and /dev/null differ diff --git a/Items/Weapons/Melee/TerraEdge.cs b/Items/Weapons/Melee/TerraEdge.cs index d3451bfce9..0de1b5cb2b 100644 --- a/Items/Weapons/Melee/TerraEdge.cs +++ b/Items/Weapons/Melee/TerraEdge.cs @@ -19,7 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 58; - item.damage = 112; + item.height = 58; + item.scale = 1.5f; + item.damage = 112; item.melee = true; item.useAnimation = 17; item.useStyle = ItemUseStyleID.SwingThrow; @@ -28,9 +30,8 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 58; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } @@ -62,18 +63,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Ichor, 120); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + + if (!target.canGhostHeal || player.moonLeech) return; - } + int healAmount = Main.rand.Next(2) + 2; player.statLife += healAmount; player.HealEffect(healAmount); @@ -82,8 +81,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.Ichor, 120); + if (player.moonLeech) return; + int healAmount = Main.rand.Next(2) + 2; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/TerraLance.cs b/Items/Weapons/Melee/TerraLance.cs index 7355f241e1..9d9a6e54a8 100644 --- a/Items/Weapons/Melee/TerraLance.cs +++ b/Items/Weapons/Melee/TerraLance.cs @@ -30,24 +30,14 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 44; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; } - public override bool CanUseItem(Player player) - { - for (int i = 0; i < 1000; ++i) - { - if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == item.shoot) - { - return false; - } - } - return true; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ChlorophytePartisan); diff --git a/Items/Weapons/Melee/TerraShiv.cs b/Items/Weapons/Melee/TerraShiv.cs index 4a39609a7a..bd439804f6 100644 --- a/Items/Weapons/Melee/TerraShiv.cs +++ b/Items/Weapons/Melee/TerraShiv.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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/Terracotta.cs b/Items/Weapons/Melee/Terracotta.cs index 8613959193..11a4fa4edb 100644 --- a/Items/Weapons/Melee/Terracotta.cs +++ b/Items/Weapons/Melee/Terracotta.cs @@ -19,18 +19,19 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 50; - item.damage = 125; + item.height = 62; + item.scale = 1.5f; + item.damage = 110; item.melee = true; - item.useAnimation = 17; - item.useTime = 17; + item.useAnimation = 15; + item.useTime = 15; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 62; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shootSpeed = 5f; } @@ -38,11 +39,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.life <= 0) { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + float randomSpeedX = Main.rand.Next(3); + float randomSpeedY = Main.rand.Next(3, 5); + 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, 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); } @@ -51,11 +52,11 @@ namespace CalamityMod.Items.Weapons.Melee { if (target.statLife <= 0) { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - Projectile.NewProjectile(target.Center.X, target.Center.Y, -randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, randomSpeedX, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, -randomSpeedY, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + float randomSpeedX = Main.rand.Next(3); + float randomSpeedY = Main.rand.Next(3, 5); + 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, 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); } @@ -63,9 +64,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); } } } diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 78b2011564..9845f0c13d 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -1,5 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Weapons.Melee DisplayName.SetDefault("Terratomere"); Tooltip.SetDefault("Linked to the essence of Terraria\n" + "Heals the player on true melee hits\n" + - "Fires a barrage of homing beams that freeze enemies"); + "Fires a barrage of 4 homing beams that freeze enemies"); } public override void SetDefaults() { - item.width = 64; - item.damage = 125; + item.width = 60; + item.damage = 260; item.melee = true; item.useAnimation = 21; item.useStyle = ItemUseStyleID.SwingThrow; @@ -30,22 +30,23 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + 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) { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) + for (int index = 0; index < 4; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); } + return false; } @@ -56,7 +57,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ItemID.TerraBlade); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); @@ -65,7 +66,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); @@ -74,18 +75,16 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 107); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || player.moonLeech) - { + target.AddBuff(ModContent.BuffType(), 30); + + if (!target.canGhostHeal || player.moonLeech) return; - } + int healAmount = Main.rand.Next(3) + 2; player.statLife += healAmount; player.HealEffect(healAmount); @@ -93,9 +92,11 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 30); + if (player.moonLeech) return; + int healAmount = Main.rand.Next(3) + 2; player.statLife += healAmount; player.HealEffect(healAmount); diff --git a/Items/Weapons/Melee/Terratomere.png b/Items/Weapons/Melee/Terratomere.png index ebcd82bb9e..a7c34d324c 100644 Binary files a/Items/Weapons/Melee/Terratomere.png and b/Items/Weapons/Melee/Terratomere.png differ diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index 593b852799..51cd4ad815 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Items.Weapons.Melee { public class TerrorBlade : ModItem { + internal const float TerrorBlastMultiplier = 0.3f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Terror Blade"); @@ -19,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 88; - item.damage = 350; + item.damage = 630; item.melee = true; item.useAnimation = 18; item.useTime = 18; @@ -29,25 +31,22 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 80; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; + + 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) - { - Vector2 origin = new Vector2(44f, 38f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TerrorBladeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 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/Melee/TerrorBladeGlow")); + } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 60); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 60); } } } diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index 134ba00dc2..15ae2be156 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -1,6 +1,5 @@ using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,94 +8,57 @@ namespace CalamityMod.Items.Weapons.Melee { public class TheBurningSky : ModItem { + private const int ProjectilesPerBarrage = 6; + public override void SetStaticDefaults() { DisplayName.SetDefault("The Burning Sky"); - Tooltip.SetDefault("Summons a massive barrage of burning meteors from the sky"); + 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; } public override void SetDefaults() { item.width = 62; - item.damage = 200; - item.melee = true; - item.useTime = 5; - item.useAnimation = 15; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTurn = true; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; item.height = 64; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.damage = 244; + item.knockBack = 2.5f; + + item.melee = true; + item.noMelee = true; + + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = ItemUseStyleID.HoldingOut; + item.autoReuse = true; + item.UseSound = SoundID.Item105; + item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 35f; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shootSpeed = 14f; + + 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) { - int i = Main.myPlayer; - 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; - if (player.gravDir == -1f) + // 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); + + Vector2 originalVelocity = new Vector2(speedX, speedY); + float speed = originalVelocity.Length(); + for (int i = 0; i < ProjectilesPerBarrage; ++i) { - 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; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - - int num107 = 10; - for (int num108 = 0; num108 < num107; num108++) - { - 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 -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-1000, 1001) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-1000, 1001) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, i, 0f, (float)Main.rand.Next(10)); + float randomSpeed = speed * Main.rand.NextFloat(0.7f, 1.4f); + CalamityUtils.ProjectileRain(Main.MouseWorld, 290f, 130f, 850f, 1100f, randomSpeed, type, damage, knockBack, player.whoAmI); } return false; } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 244); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 600); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Daybreak, 600); + public override void OnHitPvp(Player player, Player target, int damage, bool crit) => target.AddBuff(BuffID.Daybreak, 600); } } diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index 01e7eebf04..f73a27cef9 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -14,13 +14,15 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The Enforcer"); - Tooltip.SetDefault("Fires an essence flame burst and spawns essence flames on enemy hits"); + Tooltip.SetDefault("Spawns essence flames on hit"); } public override void SetDefaults() { item.width = 100; - item.damage = 1900; + item.height = 100; + item.scale = 1.5f; + item.damage = 890; item.melee = true; item.useAnimation = 17; item.useStyle = ItemUseStyleID.SwingThrow; @@ -29,38 +31,34 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 9f; item.UseSound = SoundID.Item20; item.autoReuse = true; - item.height = 100; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.rare = ItemRarityID.Red; item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.DarkBlue; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(50f, 48f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/TheEnforcerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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); int i = Main.myPlayer; - float num72 = 6f; - float num74 = 7f; + float num72 = 3f; 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; + float num78 = Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = Main.mouseY + Main.screenPosition.Y + vector2.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + num79 = Main.screenPosition.Y + Main.screenHeight + Main.mouseY + vector2.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { - num78 = (float)player.direction; + num78 = player.direction; num79 = 0f; num80 = num72; } @@ -69,14 +67,14 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num107 = 2; + int num107 = 5; for (int num108 = 0; num108 < num107; num108++) { - 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); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + vector2 = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(401) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-400, 401); + vector2.Y -= 100 * num108; + num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; @@ -85,9 +83,9 @@ namespace CalamityMod.Items.Weapons.Melee { num79 = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.25f), num74, i, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.25f), 0f, i, 0f, Main.rand.Next(3)); } } @@ -95,20 +93,19 @@ namespace CalamityMod.Items.Weapons.Melee { Main.PlaySound(SoundID.Item73, player.position); int i = Main.myPlayer; - float num72 = 6f; - float num74 = 7f; + float num72 = 3f; 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; + float num78 = Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = Main.mouseY + Main.screenPosition.Y + vector2.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + num79 = Main.screenPosition.Y + Main.screenHeight + Main.mouseY + vector2.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { - num78 = (float)player.direction; + num78 = player.direction; num79 = 0f; num80 = num72; } @@ -117,14 +114,14 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num107 = 2; + int num107 = 5; for (int num108 = 0; num108 < num107; num108++) { - 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); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + vector2 = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(401) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-400, 401); + vector2.Y -= 100 * num108; + num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; @@ -133,25 +130,22 @@ namespace CalamityMod.Items.Weapons.Melee { num79 = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.25f), num74, i, 0f, (float)Main.rand.Next(3)); + Projectile.NewProjectile(vector2, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 0.25f), 0f, i, 0f, Main.rand.Next(3)); } } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddRecipeGroup("NForEE", 7); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/TheEyeofCalamitas.cs b/Items/Weapons/Melee/TheEyeofCalamitas.cs index d03fbc0b6b..a87934118b 100644 --- a/Items/Weapons/Melee/TheEyeofCalamitas.cs +++ b/Items/Weapons/Melee/TheEyeofCalamitas.cs @@ -10,7 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Oblivion"); - Tooltip.SetDefault("Fires brimstone lasers when enemies are near"); + 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; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.value = Item.buyPrice(gold: 60); } } diff --git a/Items/Weapons/Melee/TheEyeofCalamitas.png b/Items/Weapons/Melee/TheEyeofCalamitas.png index 3d25fe1600..e749d3cb9b 100644 Binary files a/Items/Weapons/Melee/TheEyeofCalamitas.png and b/Items/Weapons/Melee/TheEyeofCalamitas.png differ diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index f997cf0ed5..c9132e44a2 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("The God's Gambit"); - Tooltip.SetDefault("Fires a stream of slime when enemies are near"); + 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; @@ -38,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.value = Item.buyPrice(gold: 12); } diff --git a/Items/Weapons/Melee/TheLastMourning.cs b/Items/Weapons/Melee/TheLastMourning.cs index 70975ce34b..b2c126470f 100644 --- a/Items/Weapons/Melee/TheLastMourning.cs +++ b/Items/Weapons/Melee/TheLastMourning.cs @@ -1,7 +1,8 @@ +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.NPCs.DevourerofGods; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,8 +11,6 @@ namespace CalamityMod.Items.Weapons.Melee { public class TheLastMourning : ModItem { - public static int BaseDamage = 480; - public override void SetStaticDefaults() { DisplayName.SetDefault("The Last Mourning"); @@ -22,94 +21,46 @@ namespace CalamityMod.Items.Weapons.Melee { item.width = 94; item.height = 94; + item.scale = 1.5f; item.melee = true; - item.damage = BaseDamage; + item.damage = 360; item.knockBack = 8.5f; - item.useAnimation = 24; - item.useTime = 24; + item.useAnimation = 20; + item.useTime = 20; item.autoReuse = true; item.useTurn = true; item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(1, 40, 0, 0); + 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) { - int logicCheckScreenHeight = Main.LogicCheckScreenHeight; - int logicCheckScreenWidth = Main.LogicCheckScreenWidth; - int num = Main.rand.Next(100, 300); - int num2 = Main.rand.Next(100, 300); - switch (Main.rand.Next(4)) + if (crit) + damage /= 2; + + bool isDoGSegment = target.type == ModContent.NPCType() || + target.type == ModContent.NPCType() || + target.type == ModContent.NPCType(); + if (!isDoGSegment || Main.rand.NextBool(3)) { - case 0: - num -= logicCheckScreenWidth / 2 + num; - break; - case 1: - num += logicCheckScreenWidth / 2 - num; - break; - case 2: - num2 -= logicCheckScreenHeight / 2 + num2; - break; - case 3: - num2 += logicCheckScreenHeight / 2 - num2; - break; - default: - break; + CalamityPlayerOnHit.HorsemansBladeOnHit(player, target.whoAmI, damage, knockback, 0, ModContent.ProjectileType()); + CalamityPlayerOnHit.HorsemansBladeOnHit(player, target.whoAmI, damage, knockback, 1); } - num += (int)player.position.X; - num2 += (int)player.position.Y; - float speed = 8f; - Vector2 vector = new Vector2((float)num, (float)num2); - float num3 = target.position.X - vector.X; - float num4 = target.position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - num5 = speed / num5; - num3 *= num5; - num4 *= num5; - Projectile.NewProjectile((float)num, (float)num2, num3, num4, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 1.5f), knockback, player.whoAmI, (float)target.whoAmI, 0f); - CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 1.5f), knockback, true); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - int logicCheckScreenHeight = Main.LogicCheckScreenHeight; - int logicCheckScreenWidth = Main.LogicCheckScreenWidth; - int num = Main.rand.Next(100, 300); - int num2 = Main.rand.Next(100, 300); - switch (Main.rand.Next(4)) - { - case 0: - num -= logicCheckScreenWidth / 2 + num; - break; - case 1: - num += logicCheckScreenWidth / 2 - num; - break; - case 2: - num2 -= logicCheckScreenHeight / 2 + num2; - break; - case 3: - num2 += logicCheckScreenHeight / 2 - num2; - break; - default: - break; - } - num += (int)player.position.X; - num2 += (int)player.position.Y; - float speed = 8f; - Vector2 vector = new Vector2((float)num, (float)num2); - float num3 = target.position.X - vector.X; - float num4 = target.position.Y - vector.Y; - float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); - num5 = speed / num5; - num3 *= num5; - num4 *= num5; - Projectile.NewProjectile((float)num, (float)num2, num3, num4, ModContent.ProjectileType(), (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 1.5f), item.knockBack, player.whoAmI, (float)target.whoAmI, 0f); - CalamityGlobalItem.HorsemansBladeOnHit(player, target.whoAmI, (int)(item.damage * (player.allDamage + player.meleeDamage - 1f) * 1.5f), item.knockBack, true); + if (crit) + damage /= 2; + + CalamityPlayerOnHit.HorsemansBladeOnHit(player, -1, damage, item.knockBack, 0, ModContent.ProjectileType()); + CalamityPlayerOnHit.HorsemansBladeOnHit(player, -1, damage, item.knockBack, 1); } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index 779e884570..a241dd93cd 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.rare = 9; + 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 b0660650be..159e44f4af 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Materials; using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,14 +13,15 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("The Mutilator"); Tooltip.SetDefault("Striking an enemy below 20% life will trigger a bloodsplosion\n" + - "Bloodsplosions cause hearts to drop that can be picked up to heal you"); + "Bloodsplosions cause hearts to drop that can be picked up to heal you"); } public override void SetDefaults() { item.width = 90; item.height = 90; - item.damage = 700; + item.scale = 1.5f; + item.damage = 483; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -29,24 +30,24 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shootSpeed = 10f; - item.Calamity().customRarity = CalamityRarity.PureGreen; + + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { if (target.life <= (target.lifeMax * 0.2f) && target.canGhostHeal) { - if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool(2)) - { - int heartDrop = CalamityPlayer.areThereAnyDamnBosses ? 1 : Main.rand.Next(1, 3); - for (int i = 0; i < heartDrop; i++) - { - Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 58, 1, false, 0, false, false); - } - } + if (!CalamityPlayer.areThereAnyDamnBosses || Main.rand.NextBool(2)) + { + int heartDrop = CalamityPlayer.areThereAnyDamnBosses ? 1 : Main.rand.Next(1, 3); + for (int i = 0; i < heartDrop; i++) + { + 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); target.position.X += target.width / 2; target.position.Y += target.height / 2; diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 737747f98e..3ad17f6554 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 42; item.height = 40; item.melee = true; - item.damage = 370; + item.damage = 255; item.knockBack = 7.5f; item.useTime = 20; item.useAnimation = 20; @@ -37,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.value = Item.buyPrice(platinum: 1, gold: 40); - } + 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 8c6cd8417a..4c28fa7b40 100644 --- a/Items/Weapons/Melee/ThePlaguebringer.cs +++ b/Items/Weapons/Melee/ThePlaguebringer.cs @@ -10,7 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Pandemic"); - Tooltip.SetDefault("Fires plague seekers when enemies are near"); + 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; @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.rare = 8; + 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 cf31e4570f..6c777fe941 100644 --- a/Items/Weapons/Melee/TitanArm.cs +++ b/Items/Weapons/Melee/TitanArm.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,35 +12,53 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Titan Arm"); - Tooltip.SetDefault("Slap Hand but better"); + Tooltip.SetDefault("Slap Hand but better\n" + + "Sends enemies straight to the stars at the speed of light"); } public override void SetDefaults() { item.width = 46; item.height = 58; - item.damage = 60; - item.crit += 96; //more knockback huehue + 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.useAnimation = 12; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 12; - item.knockBack = 9001f; - item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + 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. + public override void GetWeaponCrit(Player player, ref int crit) => crit = 100; + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); + YeetEnemies(player, target, crit); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); } + + private void YeetEnemies(Player player, NPC target, bool crit) + { + // Manually doing knockback because it is capped in vanilla. This lets Titan Arm reach its full potential. =D + // 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 + if (crit) + kbAmt *= 1.4f; + float kbAmtY = target.noGravity ? kbAmt * -0.5f : kbAmt * -0.75f; + target.velocity.Y += kbAmtY; + target.velocity.X += kbAmt * player.direction; + } } } diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs index 1cb1f1e4bd..78144a45c2 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; @@ -7,7 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TriactisTruePaladinianMageHammerofMightMelee : ModItem + public class TriactisTruePaladinianMageHammerofMightMelee : ModItem { public override void SetStaticDefaults() { @@ -18,7 +18,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 160; - item.damage = 10000; + item.height = 160; + item.damage = 2000; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -28,12 +29,12 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 50f; item.UseSound = SoundID.Item1; item.melee = true; - item.height = 160; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; - item.Calamity().customRarity = CalamityRarity.Developer; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override void AddRecipes() diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png index 3f86fa3c6d..60e00a746b 100644 Binary files a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png and b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee.png differ diff --git a/Items/Weapons/Melee/Trinity.cs b/Items/Weapons/Melee/Trinity.cs index f12d436eb6..ba121b1f69 100644 --- a/Items/Weapons/Melee/Trinity.cs +++ b/Items/Weapons/Melee/Trinity.cs @@ -28,33 +28,26 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 54; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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) { - switch (Main.rand.Next(3)) - { - case 0: - type = ProjectileID.RubyBolt; - break; - case 1: - type = ProjectileID.SapphireBolt; - break; - case 2: - type = ProjectileID.AmethystBolt; - break; - default: - break; - } + type = Utils.SelectRandom(Main.rand, new int[] + { + ProjectileID.RubyBolt, + ProjectileID.SapphireBolt, + ProjectileID.AmethystBolt + }); for (int projectiles = 0; projectiles <= 3; projectiles++) { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6), knockBack, Main.myPlayer, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.6), knockBack, Main.myPlayer, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } return false; } diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 75f7020e26..1fab6296ac 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -31,22 +31,18 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 60; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) { - switch (Main.rand.Next(2)) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - } + type = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); int beam = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * 0.75), knockBack, Main.myPlayer, 1f); Main.projectile[beam].localNPCHitCooldown = 14; int i = Main.myPlayer; @@ -98,7 +94,8 @@ namespace CalamityMod.Items.Weapons.Melee float speedX2 = num78 + (float)Main.rand.Next(-160, 161) * 0.02f; float speedY2 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX2, speedY2, ProjectileID.HallowStar, damage / 3, num74, i, 0f, (float)Main.rand.Next(10)); - Main.projectile[proj].Calamity().forceMelee = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; speedX2 = num78 + (float)Main.rand.Next(-80, 81) * 0.02f; speedY2 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index f043fe7c76..d3798af489 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 54; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/TrueBloodyEdge.cs b/Items/Weapons/Melee/TrueBloodyEdge.cs index 477a61ae48..b3eab3342e 100644 --- a/Items/Weapons/Melee/TrueBloodyEdge.cs +++ b/Items/Weapons/Melee/TrueBloodyEdge.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("True Bloody Edge"); Tooltip.SetDefault("Chance to heal the player on enemy hits\n" + + "Inflicts Burning Blood\n" + "Fires a bloody blade"); } @@ -28,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 64; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; } @@ -46,35 +48,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || player.moonLeech) - { - return; - } - int healAmount = Main.rand.Next(6) + 1; - if (Main.rand.NextBool(2)) - { - player.statLife += healAmount; - player.HealEffect(healAmount); - } + target.AddBuff(BuffID.Ichor, 60); + target.AddBuff(ModContent.BuffType(), 60); + OnHitEffects(player); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { + target.AddBuff(BuffID.Ichor, 60); + target.AddBuff(ModContent.BuffType(), 60); + OnHitEffects(player); + } + + private void OnHitEffects(Player player) + { if (player.moonLeech) return; - int healAmount = Main.rand.Next(6) + 1; + + int healAmount = Main.rand.Next(3) + 3; if (Main.rand.NextBool(2)) { player.statLife += healAmount; player.HealEffect(healAmount); } - } + } } } diff --git a/Items/Weapons/Melee/TrueCausticEdge.cs b/Items/Weapons/Melee/TrueCausticEdge.cs index 1377f73494..cc690df279 100644 --- a/Items/Weapons/Melee/TrueCausticEdge.cs +++ b/Items/Weapons/Melee/TrueCausticEdge.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("True Caustic Edge"); Tooltip.SetDefault("Fires a bouncing caustic beam\n" + - "Bounces increase the beam's damage\n" + "Inflicts on fire, poison, and venom"); } @@ -30,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 74; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; } diff --git a/Items/Weapons/Melee/TrueCausticEdge.png b/Items/Weapons/Melee/TrueCausticEdge.png index 1c0fb1c10f..be963cd180 100644 Binary files a/Items/Weapons/Melee/TrueCausticEdge.png and b/Items/Weapons/Melee/TrueCausticEdge.png differ diff --git a/Items/Weapons/Melee/TrueExcaliburShortsword.cs b/Items/Weapons/Melee/TrueExcaliburShortsword.cs index a3580d3bb1..a62c68c92a 100644 --- a/Items/Weapons/Melee/TrueExcaliburShortsword.cs +++ b/Items/Weapons/Melee/TrueExcaliburShortsword.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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/TrueForbiddenOathblade.cs b/Items/Weapons/Melee/TrueForbiddenOathblade.cs index 301bc8de9b..7fd6b07e00 100644 --- a/Items/Weapons/Melee/TrueForbiddenOathblade.cs +++ b/Items/Weapons/Melee/TrueForbiddenOathblade.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } @@ -62,9 +62,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 173); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Melee/TrueNightsStabber.cs b/Items/Weapons/Melee/TrueNightsStabber.cs index 3d3970a71c..b80c23c8d1 100644 --- a/Items/Weapons/Melee/TrueNightsStabber.cs +++ b/Items/Weapons/Melee/TrueNightsStabber.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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/TruePaladinsHammerMelee.cs b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs index bce78402a4..e93aca2520 100644 --- a/Items/Weapons/Melee/TruePaladinsHammerMelee.cs +++ b/Items/Weapons/Melee/TruePaladinsHammerMelee.cs @@ -1,12 +1,12 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class TruePaladinsHammerMelee : ModItem + public class TruePaladinsHammerMelee : ModItem { public override void SetStaticDefaults() { @@ -28,9 +28,9 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.melee = true; item.height = 28; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = ModContent.ProjectileType(); + item.value = Item.buyPrice(gold: 80); + item.rare = ItemRarityID.Yellow; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; } diff --git a/Items/Weapons/Melee/TruePaladinsHammerMelee.png b/Items/Weapons/Melee/TruePaladinsHammerMelee.png index b527ef88b6..84ff0dfaa4 100644 Binary files a/Items/Weapons/Melee/TruePaladinsHammerMelee.png and b/Items/Weapons/Melee/TruePaladinsHammerMelee.png differ diff --git a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs index bf9811f014..6d111d8c7c 100644 --- a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { item.width = 102; - item.damage = 185; + item.damage = 112; item.melee = true; item.useAnimation = 18; item.useStyle = ItemUseStyleID.SwingThrow; @@ -32,11 +32,11 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 102; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - 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) @@ -55,7 +55,8 @@ namespace CalamityMod.Items.Weapons.Melee default: break; } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, Main.myPlayer); + Main.projectile[proj].extraUpdates += 1; return false; } diff --git a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.png b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.png index 2de0d2d06e..d13da49497 100644 Binary files a/Items/Weapons/Melee/TrueTyrantYharimsUltisword.png and b/Items/Weapons/Melee/TrueTyrantYharimsUltisword.png differ diff --git a/Items/Weapons/Melee/Tumbleweed.cs b/Items/Weapons/Melee/Tumbleweed.cs index 44d41224c8..d7084a7f19 100644 --- a/Items/Weapons/Melee/Tumbleweed.cs +++ b/Items/Weapons/Melee/Tumbleweed.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.noUseGraphic = true; item.knockBack = 8f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.autoReuse = true; item.channel = true; diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index dc3b122407..876d536d87 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.noUseGraphic = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.DD2_SkyDragonsFurySwing; item.autoReuse = true; item.channel = true; diff --git a/Items/Weapons/Melee/TyrantYharimsUltisword.cs b/Items/Weapons/Melee/TyrantYharimsUltisword.cs index 153324131f..54ec36a4a5 100644 --- a/Items/Weapons/Melee/TyrantYharimsUltisword.cs +++ b/Items/Weapons/Melee/TyrantYharimsUltisword.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 88; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/TyrantYharimsUltisword.png b/Items/Weapons/Melee/TyrantYharimsUltisword.png index 10b1593e0f..e2c52d8f0d 100644 Binary files a/Items/Weapons/Melee/TyrantYharimsUltisword.png and b/Items/Weapons/Melee/TyrantYharimsUltisword.png differ diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index ed8d836c01..145cf912fc 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -12,16 +12,18 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Ultimus Cleaver"); - Tooltip.SetDefault("Launches damaging homing sparks"); + Tooltip.SetDefault("Launches damaging homing sparks and explodes on enemy hits"); } public override void SetDefaults() { item.damage = 130; item.melee = true; - item.rare = 8; + 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; @@ -31,7 +33,50 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; } - public override void MeleeEffects(Player player, Rectangle hitbox) + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.meleeDamage - 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); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + int num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 200, default, num50); + Dust dust = Main.dust[num54]; + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust.noGravity = true; + dust.velocity.Y -= 6f; + dust.velocity *= 3f; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, num51); + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; + dust.velocity.Y -= 6f; + dust.velocity *= 2f; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.color = Color.Crimson * 0.5f; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, num52); + Dust dust = Main.dust[num56]; + dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; + dust.noGravity = true; + dust.velocity.Y -= 6f; + dust.velocity *= 0.5f; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + + public override void MeleeEffects(Player player, Rectangle hitbox) { if (player.whoAmI == Main.myPlayer) { @@ -97,7 +142,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.1f), 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 c6e6bef3f9..f0a889e03c 100644 --- a/Items/Weapons/Melee/UrchinFlail.cs +++ b/Items/Weapons/Melee/UrchinFlail.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee item.noUseGraphic = true; item.knockBack = 6f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item1; item.autoReuse = true; item.channel = true; diff --git a/Items/Weapons/Melee/UrchinSpear.cs b/Items/Weapons/Melee/UrchinSpear.cs index e251016645..0eba891d12 100644 --- a/Items/Weapons/Melee/UrchinSpear.cs +++ b/Items/Weapons/Melee/UrchinSpear.cs @@ -27,15 +27,17 @@ namespace CalamityMod.Items.Weapons.Melee item.useTime = 25; item.knockBack = 5f; item.UseSound = SoundID.Item1; - item.autoReuse = false; + item.autoReuse = true; item.height = 56; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 4f; } - public override void AddRecipes() + 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); diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index 02350c2c5c..0de7f3b9af 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 50; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; } diff --git a/Items/Weapons/Melee/Verdant.cs b/Items/Weapons/Melee/Verdant.cs index a649f8c471..a1367e9cf6 100644 --- a/Items/Weapons/Melee/Verdant.cs +++ b/Items/Weapons/Melee/Verdant.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 30; item.height = 30; item.melee = true; - item.damage = 128; + item.damage = 86; item.knockBack = 6f; item.useTime = 22; item.useAnimation = 22; @@ -38,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - item.rare = 10; item.autoReuse = true; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.buyPrice(platinum: 1, gold: 20); - } + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs new file mode 100644 index 0000000000..306590f0c4 --- /dev/null +++ b/Items/Weapons/Melee/Violence.cs @@ -0,0 +1,49 @@ +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class Violence : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Violence"); + Tooltip.SetDefault("Releases a blazing fork which stays near the mouse and shreds enemies"); + } + + public override void SetDefaults() + { + item.height = item.width = 142; + item.damage = 204; + 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; + } + + 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) + { + Vector2 shootVelocity = new Vector2(speedX, speedY); + Projectile.NewProjectile(position, shootVelocity, type, damage, knockBack, player.whoAmI, 0f, shootVelocity.ToRotation()); + return false; + } + } +} diff --git a/Items/Weapons/Melee/Violence.png b/Items/Weapons/Melee/Violence.png new file mode 100644 index 0000000000..0946ba16ec Binary files /dev/null and b/Items/Weapons/Melee/Violence.png differ diff --git a/Items/Weapons/Melee/VirulentKatana.cs b/Items/Weapons/Melee/VirulentKatana.cs index 4e7379b522..6586699818 100644 --- a/Items/Weapons/Melee/VirulentKatana.cs +++ b/Items/Weapons/Melee/VirulentKatana.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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/Warblade.cs b/Items/Weapons/Melee/Warblade.cs index c413967bd7..911198d694 100644 --- a/Items/Weapons/Melee/Warblade.cs +++ b/Items/Weapons/Melee/Warblade.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.25f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item1; item.autoReuse = true; } diff --git a/Items/Weapons/Melee/Whirlpool.cs b/Items/Weapons/Melee/Whirlpool.cs index 51685046a2..2053668191 100644 --- a/Items/Weapons/Melee/Whirlpool.cs +++ b/Items/Weapons/Melee/Whirlpool.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { DisplayName.SetDefault("Riptide"); - Tooltip.SetDefault("Sprays a spiral of aqua streams in random directions"); + 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; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.buyPrice(gold: 2); } diff --git a/Items/Weapons/Melee/WindBlade.cs b/Items/Weapons/Melee/WindBlade.cs index 5fa592c5b3..3089b52cbb 100644 --- a/Items/Weapons/Melee/WindBlade.cs +++ b/Items/Weapons/Melee/WindBlade.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.height = 58; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 3f; } diff --git a/Items/Weapons/Melee/WulfrumBlade.cs b/Items/Weapons/Melee/WulfrumBlade.cs index 34b3bbbbb0..30b4da78e1 100644 --- a/Items/Weapons/Melee/WulfrumBlade.cs +++ b/Items/Weapons/Melee/WulfrumBlade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) diff --git a/Items/Weapons/Melee/XerocsGreatsword.cs b/Items/Weapons/Melee/XerocsGreatsword.cs index 364fa0609a..6a3971658d 100644 --- a/Items/Weapons/Melee/XerocsGreatsword.cs +++ b/Items/Weapons/Melee/XerocsGreatsword.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index 5488338b04..a50307d9a7 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -33,15 +33,15 @@ namespace CalamityMod.Items.Weapons.Melee item.melee = true; item.noMelee = true; item.channel = true; - item.autoReuse = false; + item.autoReuse = true; item.useTurn = true; item.useStyle = ItemUseStyleID.HoldingOut; item.UseSound = SoundID.Item1; - item.rare = 2; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = Item.buyPrice(0, 2, 0, 0); + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = ItemRarityID.Green; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = ShootSpeed; @@ -58,19 +58,22 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 20; item.channel = false; + item.autoReuse = true; item.useAnimation = 33; item.useTime = 33; item.shootSpeed = 4.5f; + return player.ownedProjectileCounts[item.shoot] <= 0; } else { item.damage = BaseDamage; item.channel = true; + item.autoReuse = false; item.useAnimation = 22; item.useTime = 22; item.shootSpeed = ShootSpeed; + return base.CanUseItem(player); } - return base.CanUseItem(player); } 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/YinYo.cs b/Items/Weapons/Melee/YinYo.cs index eb29299eaa..d661d938c6 100644 --- a/Items/Weapons/Melee/YinYo.cs +++ b/Items/Weapons/Melee/YinYo.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Yin-Yo"); Tooltip.SetDefault("Fires light or dark shards when enemies are near\n" + - "Light shards fly up and down while dark shards fly left and right"); + "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; @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.value = Item.buyPrice(gold: 36); } diff --git a/Items/Weapons/Ranged/AMR.cs b/Items/Weapons/Ranged/AMR.cs index cc26c11ea7..f06bbd0fee 100644 --- a/Items/Weapons/Ranged/AMR.cs +++ b/Items/Weapons/Ranged/AMR.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -13,16 +12,15 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Anti-materiel Rifle"); - Tooltip.SetDefault("Fires a .50 caliber sniper round that rips apart enemy defense and DR\n" + - "If you crit the target a second swarm of bullets will fire near the target"); + Tooltip.SetDefault("Converts musket balls into .50 caliber sniper rounds that rip apart enemy defense and DR\n" + + "If you crit the target a second swarm of bullets will fire"); } public override void SetDefaults() { - item.damage = 7000; + item.damage = 3240; item.ranged = true; item.width = 76; - item.crit += 20; item.height = 30; item.useTime = 60; item.useAnimation = 60; @@ -30,34 +28,39 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 9.5f; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.Bullet; item.shootSpeed = 12f; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 1.3), knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 637dd4dc54..49a26ce573 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -15,13 +15,13 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Ace's High"); Tooltip.SetDefault("Fires a string of cards with varying effects based on card type\n" + - "Hearts grant lifesteal. Spades pierce and ignore immunity frames.\n" + - "Diamonds explode. Clubs split into three."); + "Hearts grant lifesteal. Spades pierce and ignore immunity frames.\n" + + "Diamonds explode. Clubs split into three."); } public override void SetDefaults() { - item.damage = 1599; + item.damage = 325; item.ranged = true; item.width = 48; item.height = 30; @@ -31,14 +31,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + + 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.Calamity().customRarity = CalamityRarity.Dedicated; } public override Vector2? HoldoutOffset() @@ -61,13 +63,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) { - int card = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); + int card = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); Projectile.NewProjectile(position.X, position.Y, speedX, speedY, card, damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/Aeries.cs b/Items/Weapons/Ranged/Aeries.cs index 73f1d677d5..8f7b53b5d6 100644 --- a/Items/Weapons/Ranged/Aeries.cs +++ b/Items/Weapons/Ranged/Aeries.cs @@ -11,27 +11,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Aeries"); - Tooltip.SetDefault("Fires shockblast rounds that can steal enemy life"); + Tooltip.SetDefault("Converts musket balls into shockblast rounds that steal enemy life"); } public override void SetDefaults() { item.damage = 35; item.ranged = true; - item.width = 50; - item.height = 32; + item.width = 56; + item.height = 30; item.useTime = 10; item.useAnimation = 10; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 24f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -41,8 +42,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Aeries.png b/Items/Weapons/Ranged/Aeries.png index a3aee2e65c..1d1d592af0 100644 Binary files a/Items/Weapons/Ranged/Aeries.png and b/Items/Weapons/Ranged/Aeries.png differ diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 99f4f3ed4c..3b4e1c9946 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -15,71 +15,76 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Alluvion"); - Tooltip.SetDefault("Moderate chance to convert wooden arrows to sharks\n" + - "Low chance to convert wooden arrows to typhoon arrows\n" + - "Fires a torrent of ten arrows at once"); + Tooltip.SetDefault("Converts wooden arrows into sharks, torrential and typhoon arrows\n" + + "Fires a torrent of six arrows at once"); } public override void SetDefaults() { - item.damage = 70; + item.damage = 165; item.ranged = true; item.width = 60; item.height = 90; - item.useTime = 9; - item.useAnimation = 18; + 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 = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 17f; + 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) { - Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = (float)Math.PI * 0.1f; - int totalProjectiles = 10; + Vector2 source = player.RotatedRelativePoint(player.MountedCenter); + float num117 = MathHelper.Pi * 0.1f; + int totalProjectiles = 6; Vector2 velocity = new Vector2(speedX, speedY); velocity.Normalize(); - velocity *= 20f; + velocity *= 35f; bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); for (int i = 0; i < totalProjectiles; i++) { - float num120 = (float)i - ((float)totalProjectiles - 1f) / 2f; - Vector2 offset = velocity.RotatedBy((double)(num117 * num120), default); + float num120 = i - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(num117 * num120); if (!canHit) - { offset -= velocity; - } + if (type == ProjectileID.WoodenArrowFriendly) { - if (Main.rand.NextBool(12)) - { - type = ModContent.ProjectileType(); - } - if (Main.rand.NextBool(25)) - { - type = ProjectileID.MiniSharkron; - } - if (Main.rand.NextBool(100)) - { - type = ModContent.ProjectileType(); - } - int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceRanged = true; - Main.projectile[proj].noDropItem = true; - Main.projectile[proj].arrow = true; + int newType = type; + switch (i) + { + case 0: + case 5: + newType = ModContent.ProjectileType(); + break; + case 1: + case 4: + newType = ModContent.ProjectileType(); + break; + case 2: + case 3: + newType = ModContent.ProjectileType(); + break; + } + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, newType, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].arrow = true; + Main.projectile[proj].extraUpdates += 1; + } } else { - int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[proj].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index eac6e4b69b..c7dbbbf0d5 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -10,13 +10,14 @@ namespace CalamityMod.Items.Weapons.Ranged { public class AngelicShotgun : ModItem { - private static int BaseDamage = 100; + private static int BaseDamage = 96; private static float BulletSpeed = 12f; public override void SetStaticDefaults() { DisplayName.SetDefault("Angelic Shotgun"); Tooltip.SetDefault(@"Each shot casts a radiant beam of holy light from the sky +Converts musket balls into illuminated bullets Fighting 'til the war's won"); } @@ -36,14 +37,15 @@ Fighting 'til the war's won"); item.UseSound = SoundID.Item38; item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = 10; - item.value = Item.buyPrice(1, 20, 0, 0); - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; item.shootSpeed = BulletSpeed; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -52,7 +54,7 @@ Fighting 'til the war's won"); 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 NumBullets = Main.rand.Next(5,8); + int NumBullets = Main.rand.Next(5, 8); Vector2 baseVelocity = new Vector2(speedX, speedY).SafeNormalize(Vector2.Zero) * BulletSpeed; // Fire a shotgun spread of bullets. @@ -61,8 +63,12 @@ Fighting 'til the war's won"); float dx = Main.rand.NextFloat(-1.3f, 1.3f); float dy = Main.rand.NextFloat(-1.3f, 1.3f); Vector2 randomVelocity = baseVelocity + new Vector2(dx, dy); - Projectile.NewProjectile(position, randomVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } + + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, randomVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, randomVelocity, type, damage, knockBack, player.whoAmI); + } // Spawn a beam from the sky ala Deathhail Staff or Lunar Flare float laserSpeed = 8f; diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 2caa6c376d..b51b1c2387 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -28,13 +28,14 @@ Right click to fire a burst of bullets"); item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item31; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 11f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/Animosity.png b/Items/Weapons/Ranged/Animosity.png index e6df7ae736..41a91b1e3e 100644 Binary files a/Items/Weapons/Ranged/Animosity.png and b/Items/Weapons/Ranged/Animosity.png differ diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index 633d343339..8b4e8a262f 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -12,44 +12,51 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Aquashard Shotgun"); - Tooltip.SetDefault("Shoots aquashards which split upon hitting an enemy"); + Tooltip.SetDefault("Converts musket balls into aquashards that split upon hitting an enemy"); } public override void SetDefaults() { - item.damage = 11; + item.damage = 14; item.ranged = true; item.width = 62; item.height = 26; - item.crit += 6; item.useTime = 26; item.useAnimation = 26; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item61; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 22f; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 6; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { int num6 = Main.rand.Next(2, 4); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].timeLeft = 200; - } + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; + + if (type == ProjectileID.Bullet) + { + int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + Main.projectile[projectile].timeLeft = 200; + } + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + } return false; } diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index 6998cd5678..39150ef06c 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -7,45 +7,73 @@ namespace CalamityMod.Items.Weapons.Ranged { public class Arbalest : ModItem { + private int totalProjectiles = 1; + private float arrowScale = 0.5f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arbalest"); - Tooltip.SetDefault("Fires volleys of high-speed arrows"); + Tooltip.SetDefault("Fires a volley of 10 high-speed arrows\n" + + "Arrows start off small and grow in size with continuous fire\n" + + "Arrow damage, spread and knockback scale with arrow size"); } public override void SetDefaults() { - item.damage = 25; + item.damage = 36; item.ranged = true; - item.crit += 20; - item.width = 58; - item.height = 22; - item.useTime = 20; - item.useAnimation = 20; + 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 = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item5; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.UseSound = null; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 10f; - item.useAmmo = 40; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Arrow; + item.Calamity().challengeDrop = true; + item.Calamity().canFirePointBlankShots = true; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 3; i++) - { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += i; - Main.projectile[proj].noDropItem = true; - } - return false; + Main.PlaySound(SoundID.Item5, (int)player.Center.X, (int)player.Center.Y); + + if (totalProjectiles > 4) + { + totalProjectiles = 1; + + if (arrowScale < 1.5f) + arrowScale += 0.05f; + } + + float spreadScale = arrowScale * arrowScale; + int spread = (int)(30f * spreadScale); + for (int i = 0; i < totalProjectiles; i++) + { + float SpeedX = speedX + Main.rand.Next(-spread, spread + 1) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-spread, spread + 1) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * arrowScale), knockBack * arrowScale, player.whoAmI); + Main.projectile[proj].scale = arrowScale; + Main.projectile[proj].extraUpdates += 1; + Main.projectile[proj].noDropItem = true; + } + + totalProjectiles++; + + if (arrowScale >= 1.5f) + arrowScale = 0.5f; + + return false; } } } diff --git a/Items/Weapons/Ranged/Arbalest.png b/Items/Weapons/Ranged/Arbalest.png index 3948608583..3afdc72789 100644 Binary files a/Items/Weapons/Ranged/Arbalest.png and b/Items/Weapons/Ranged/Arbalest.png differ diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 3645170f9a..8b6ec50918 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Archerfish"); - Tooltip.SetDefault("Fires a stream of water"); + Tooltip.SetDefault("Converts musket balls into streams of water"); } public override void SetDefaults() @@ -26,13 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -41,8 +42,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/ArterialAssault.cs b/Items/Weapons/Ranged/ArterialAssault.cs index 4d954653d1..2540705c3e 100644 --- a/Items/Weapons/Ranged/ArterialAssault.cs +++ b/Items/Weapons/Ranged/ArterialAssault.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Arterial Assault"); - Tooltip.SetDefault("Fires a chain of arrows from the sky\n" + - "Wooden arrows are converted to homing bloodfire arrows"); + Tooltip.SetDefault("Fires a chain of 5 arrows from the sky\n" + + "Wooden arrows are converted into homing bloodfire arrows"); } public override void SetDefaults() { - item.damage = 232; + item.damage = 128; item.ranged = true; item.width = 44; item.height = 100; @@ -29,14 +29,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.25f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item102; + 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 = 40; - item.Calamity().customRarity = CalamityRarity.PureGreen; + item.useAmmo = AmmoID.Arrow; } public override void AddRecipes() @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Ranged } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } return false; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 076ca3c920..6255a3defb 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -12,13 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Blaster"); - Tooltip.SetDefault("Fires a homing astral round"); + Tooltip.SetDefault("Converts musket balls into homing astral rounds"); } public override void SetDefaults() { item.damage = 120; - item.crit += 25; item.ranged = true; item.width = 40; item.height = 24; @@ -28,23 +27,28 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.75f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 14f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + + public override Vector2? HoldoutOffset() => new Vector2(-5, 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/AstralRepeater.cs b/Items/Weapons/Ranged/AstralRepeater.cs index 87df0cd217..1ae1daabb4 100644 --- a/Items/Weapons/Ranged/AstralRepeater.cs +++ b/Items/Weapons/Ranged/AstralRepeater.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 90; - item.crit += 25; + item.damage = 99; item.ranged = true; item.width = 38; item.height = 78; @@ -27,13 +26,17 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item5; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.WoodenArrowFriendly; item.shootSpeed = 16f; - item.useAmmo = 40; - } + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = true; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 874f77695d..596c4b2117 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -7,20 +7,20 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class AstrealDefeat : ModItem + public class AstrealDefeat : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Astreal Defeat"); Tooltip.SetDefault("Ethereal bow of the tyrant king's mother\n" + - "The mother strongly discouraged acts of violence throughout her life\n" + - "Though she kept this bow close to protect her family in times of great disaster\n" + - "Fires Astreal Arrows that emit flames as they travel"); + "The mother strongly discouraged acts of violence throughout her life\n" + + "Though she kept this bow close, to protect her family in times of great disaster\n" + + "All arrows are converted to Astreal Arrows that emit flames as they travel"); } public override void SetDefaults() { - item.damage = 140; + item.damage = 153; item.ranged = true; item.width = 40; item.height = 78; @@ -30,25 +30,28 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item102; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 4f; - item.useAmmo = 40; - } + 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) { - Vector2 velocity = new Vector2(speedX, speedY); - if (velocity.Length() > 8f) - { - velocity.Normalize(); - velocity *= 8f; - } + Vector2 velocity = new Vector2(speedX, speedY); + float speed = velocity.Length(); + if (speed > 8f) + velocity *= 8f / speed; - float ai0 = (float)Main.rand.Next(4); - Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, ai0, 0f); + // 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; + float aiVar = Main.rand.Next(4); + + Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, aiVar); return false; } diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs new file mode 100644 index 0000000000..ca38b36f73 --- /dev/null +++ b/Items/Weapons/Ranged/Auralis.cs @@ -0,0 +1,84 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Auralis : ModItem + { + public static readonly Color blueColor = new Color(0, 77, 255); + public static readonly Color greenColor = new Color(0, 255, 77); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auralis"); + Tooltip.SetDefault("Fires a high speed glowing bullet that inflicts debilitating debuffs\n" + + "Right click to zoom out\n" + + "Standing still provides increasing damage bonuses up to 25%\n" + + "Standing still for 5 or more seconds while using the scope ability will summon an aurora\n" + + "The aurora reduces the damage of the next projectile hit by a flat 100\n" + + "This effect lasts up to 20 seconds and has a 30 second cooldown\n" + + "50% chance to not consume bullets"); + } + + 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.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; + } + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + { + float damageMult = MathHelper.Lerp(0f, 0.25f, player.Calamity().auralisStealthCounter / 300f); + add += damageMult; + } + + 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); + 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")); + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50; + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddIngredient(ItemID.SniperRifle); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/Auralis.png b/Items/Weapons/Ranged/Auralis.png new file mode 100644 index 0000000000..88f823e30a Binary files /dev/null and b/Items/Weapons/Ranged/Auralis.png differ diff --git a/Items/Weapons/Ranged/AuralisGlow.png b/Items/Weapons/Ranged/AuralisGlow.png new file mode 100644 index 0000000000..8abfbe742e Binary files /dev/null and b/Items/Weapons/Ranged/AuralisGlow.png differ diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index 6d6583af85..aa1f32c2c2 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 68; item.height = 36; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.UseSound = SoundID.Item34; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + 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,9 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/AuroraBlazerGlow"); - Vector2 origin = new Vector2(glowmask.Width / 2f, glowmask.Height / 2f - 2f); - spriteBatch.Draw(glowmask, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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 5e6b65ff19..869e4e609e 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -3,7 +3,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -//using TerrariaOverhaul; namespace CalamityMod.Items.Weapons.Ranged { @@ -12,12 +11,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Barinade"); - Tooltip.SetDefault("Shoots electric bolt arrows that explode"); + Tooltip.SetDefault("Converts wooden arrows into electric bolt arrows that explode"); } public override void SetDefaults() { - item.damage = 8; + item.damage = 9; item.ranged = true; item.width = 30; item.height = 44; @@ -27,23 +26,23 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; item.useAmmo = AmmoID.Arrow; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ + 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index 9ff306beba..f31c43fc25 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -11,12 +11,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Barinautical"); - Tooltip.SetDefault("Shoots a string of electric bolt arrows that explode"); + Tooltip.SetDefault("Converts wooden arrows into strings of 3 electric bolt arrows that explode"); } public override void SetDefaults() { - item.damage = 25; + item.damage = 28; item.ranged = true; item.width = 30; item.height = 42; @@ -27,18 +27,23 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.useAmmo = 40; - } + 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/Barinautical.png b/Items/Weapons/Ranged/Barinautical.png index 5ca5835f63..5c680e03a9 100644 Binary files a/Items/Weapons/Ranged/Barinautical.png and b/Items/Weapons/Ranged/Barinautical.png differ diff --git a/Items/Weapons/Ranged/BarracudaGun.cs b/Items/Weapons/Ranged/BarracudaGun.cs index 28588e51e6..65fddbd1ab 100644 --- a/Items/Weapons/Ranged/BarracudaGun.cs +++ b/Items/Weapons/Ranged/BarracudaGun.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item10; item.autoReuse = true; item.shootSpeed = 15f; diff --git a/Items/Weapons/Ranged/BladedgeGreatbow.cs b/Items/Weapons/Ranged/BladedgeGreatbow.cs index adc7c99bcb..bb0ec23516 100644 --- a/Items/Weapons/Ranged/BladedgeGreatbow.cs +++ b/Items/Weapons/Ranged/BladedgeGreatbow.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Bladedge Railbow"); Tooltip.SetDefault("Fires 4 arrows at once\n" + - "Fires 2 additional leafs"); + "Fires 2 additional leaves"); } public override void SetDefaults() { - item.damage = 25; + item.damage = 28; item.ranged = true; item.width = 74; item.height = 24; @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 14f; - item.useAmmo = 40; - } + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -46,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-60, 61) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-60, 61) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; } Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -64,8 +65,9 @@ namespace CalamityMod.Items.Weapons.Ranged { value9 -= vector7; } - int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage / 2, 0f, player.whoAmI, 0f, 0f); - Main.projectile[projectile].Calamity().forceRanged = true; + int projectile = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ProjectileID.Leaf, damage / 2, 0f, player.whoAmI); + if (projectile.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile].Calamity().forceRanged = true; } return false; } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 88d05dc3a7..1a46ad6de9 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 75; + item.damage = 80; item.ranged = true; item.width = 76; item.height = 30; @@ -25,14 +25,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; + 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 = 771; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 429d3b1ba1..c554807c27 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -14,44 +14,41 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Blood Boiler"); Tooltip.SetDefault("Fires a stream of lifestealing bloodfire\n" + - "Must be used in 10 second bursts\n" + - "Uses your life as ammo"); + "Uses your health as ammo\n" + "25% chance to not consume ammo"); } public override void SetDefaults() { - item.damage = 415; + item.damage = 250; item.ranged = true; item.width = 60; item.height = 30; item.useTime = 5; - item.useAnimation = 600; + item.useAnimation = 15; + item.autoReuse = true; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.autoReuse = true; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.Calamity().postMoonLordRarity = 13; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 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) { - //using this weapon once will subtract 120 health in total - player.statLife -= 1; + if (Main.rand.NextFloat() > 0.75f) + --player.statLife; if (player.statLife <= 0) { - player.KillMe(PlayerDeathReason.ByCustomReason(Main.rand.NextBool(2) ? player.name + " suffered from severe anemia." : player.name + " was unable to obtain a blood transfusion."), 1000.0, 0, false); + PlayerDeathReason pdr = PlayerDeathReason.ByCustomReason(Main.rand.NextBool(2) ? player.name + " suffered from severe anemia." : player.name + " was unable to obtain a blood transfusion."); + player.KillMe(pdr, 1000.0, 0, false); + return false; } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index 9952255947..6067fa792a 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -11,32 +11,32 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blossom Flux"); - Tooltip.SetDefault("Legendary Drop\n" + - "Fires a stream of leaves\n" + - "Right click to fire a spore orb that explodes into a cloud of spore gas\n" + - "Revengeance drop"); + Tooltip.SetDefault("Fires a stream of leaves\n" + + "Right click to fire a spore orb that explodes into a cloud of spore gas"); } public override void SetDefaults() { - item.damage = 22; + item.damage = 25; item.ranged = true; - item.width = 40; - item.height = 62; + item.width = 38; + item.height = 68; item.useTime = 4; item.useAnimation = 16; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 0.15f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.useAmmo = 40; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - } + item.useAmmo = AmmoID.Arrow; + + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; + item.Calamity().challengeDrop = true; + item.Calamity().canFirePointBlankShots = true; + } public override bool AltFunctionUse(Player player) { @@ -64,11 +64,11 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 4.0), knockBack * 60f, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 4D), knockBack * 60f, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/BlossomFlux.png b/Items/Weapons/Ranged/BlossomFlux.png index 65ff75f648..82ebdb8d59 100644 Binary files a/Items/Weapons/Ranged/BlossomFlux.png and b/Items/Weapons/Ranged/BlossomFlux.png differ diff --git a/Items/Weapons/Ranged/BrimstoneFlameblaster.cs b/Items/Weapons/Ranged/BrimstoneFlameblaster.cs index b2c93c6f06..bcd5d9e084 100644 --- a/Items/Weapons/Ranged/BrimstoneFlameblaster.cs +++ b/Items/Weapons/Ranged/BrimstoneFlameblaster.cs @@ -27,11 +27,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 3.5f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs b/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs index 984d746581..18471e68b8 100644 --- a/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs +++ b/Items/Weapons/Ranged/BrimstoneFlamesprayer.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 1.5f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8.5f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index d6e9398c30..c4cb43dbc0 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Fury"); - Tooltip.SetDefault("Fires a spread of brimstone bolts"); + Tooltip.SetDefault("Converts wooden arrows into spreads of 3 brimstone bolts"); } public override void SetDefaults() { - item.damage = 35; + item.damage = 39; item.ranged = true; item.width = 30; item.height = 58; @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.75f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - item.useAmmo = 40; - } + 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) { @@ -42,8 +43,15 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } + + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + { + int proj = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; + } + } return false; } diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs new file mode 100644 index 0000000000..7f1e333b9f --- /dev/null +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -0,0 +1,77 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class BulletFilledShotgun : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet-Filled Shotgun"); + Tooltip.SetDefault("Fires a massive spread of bouncing bullets\n" + + "Consumes five bullets per-use\n" + + "Aim? What's that?"); + } + 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.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; + } + + public override Vector2? HoldoutOffset() => new Vector2(-7, 0); + + 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; + int bulletAmt = Main.rand.Next(25,35); + for (int i = 0; i < bulletAmt; i++) + { + float newSpeedX = speedX + Main.rand.NextFloat(-15f, 15f); + float newSpeedY = speedY + Main.rand.NextFloat(-15f, 15f); + Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); + } + + // Consume 5 ammo per shot + 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(); + } + } +} diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.png b/Items/Weapons/Ranged/BulletFilledShotgun.png new file mode 100644 index 0000000000..2635f2a49c Binary files /dev/null and b/Items/Weapons/Ranged/BulletFilledShotgun.png differ diff --git a/Items/Weapons/Ranged/Butcher.cs b/Items/Weapons/Ranged/Butcher.cs index 95006a28b1..c9901d3439 100644 --- a/Items/Weapons/Ranged/Butcher.cs +++ b/Items/Weapons/Ranged/Butcher.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useTime = 40; item.useAnimation = 40; item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.knockBack = 1f; item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = SoundID.Item38; @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged 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; diff --git a/Items/Weapons/Ranged/Butcher.png b/Items/Weapons/Ranged/Butcher.png index 3b6458a45f..49ddff2d33 100644 Binary files a/Items/Weapons/Ranged/Butcher.png and b/Items/Weapons/Ranged/Butcher.png differ diff --git a/Items/Weapons/Ranged/ChargedDartRifle.cs b/Items/Weapons/Ranged/ChargedDartRifle.cs index 61f49ceed9..fe9fa2c295 100644 --- a/Items/Weapons/Ranged/ChargedDartRifle.cs +++ b/Items/Weapons/Ranged/ChargedDartRifle.cs @@ -20,21 +20,22 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 100; item.ranged = true; - item.width = 60; - item.height = 24; + item.width = 74; + item.height = 40; item.useTime = 25; item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); item.autoReuse = true; item.shootSpeed = 22f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 283; - } + item.useAmmo = AmmoID.Dart; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/ChargedDartRifle.png b/Items/Weapons/Ranged/ChargedDartRifle.png index a99401fc36..7dd38ace60 100644 Binary files a/Items/Weapons/Ranged/ChargedDartRifle.png and b/Items/Weapons/Ranged/ChargedDartRifle.png differ diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index d17cfaf6d5..f75a48d2d0 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -11,39 +11,69 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Chicken Cannon"); - Tooltip.SetDefault("Fires chicken rockets"); + Tooltip.SetDefault("Fires chicken flares which create enormous incendiary explosions\n" + + "Right click to detonate all airborne rockets"); } public override void SetDefaults() { - item.damage = 12; + item.damage = 416; item.ranged = true; item.width = 76; item.height = 24; - item.useTime = 13; - item.useAnimation = 13; + item.useTime = item.useAnimation = 33; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; - item.knockBack = 8.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; + 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 = 24f; - item.shoot = ModContent.ProjectileType(); - item.useAmmo = 771; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.shootSpeed = 14.5f; + item.shoot = ModContent.ProjectileType(); + item.useAmmo = AmmoID.Rocket; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override bool AltFunctionUse(Player player) => true; + + // Right click doesn't use ammo because it's a detonation signal. + public override bool ConsumeAmmo(Player player) => player.altFunctionUse != 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + // Play a sound and detonate all in-flight rockets, but don't shoot anything. + if (player.altFunctionUse == 2) + { + Main.PlaySound(SoundID.Item110, position); + DetonateRockets(player); + return false; + } + + // Otherwise just play a grenade launcher sound and fire a rocket. + Main.PlaySound(SoundID.Item61, position); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), item.shoot, damage, knockBack, player.whoAmI); return false; } + + private void DetonateRockets(Player player) + { + for (int i = 0; i < Main.maxProjectiles; ++i) + { + Projectile p = Main.projectile[i]; + 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. + p.timeLeft = 1; + p.netUpdate = true; + p.netSpam = 0; + } + } + + // Right clicking to detonate all rockets is very fast. + public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; } } diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index bc793a6355..ff6720a85e 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Clamor Rifle"); - Tooltip.SetDefault("Shoots homing energy bolts"); + Tooltip.SetDefault("Converts musket balls into homing energy bolts"); } public override void SetDefaults() @@ -28,17 +28,22 @@ namespace CalamityMod.Items.Weapons.Ranged item.value = Item.buyPrice(0, 36, 0, 0); item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"); item.autoReuse = true; - item.rare = 5; + 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); 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), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + return false; } } diff --git a/Items/Weapons/Ranged/ClaretCannon.cs b/Items/Weapons/Ranged/ClaretCannon.cs index 8ee1d8d91f..92ffba69f4 100644 --- a/Items/Weapons/Ranged/ClaretCannon.cs +++ b/Items/Weapons/Ranged/ClaretCannon.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Claret Cannon"); - Tooltip.SetDefault("Fires a string of bloodfire bullets that drain enemy health"); + Tooltip.SetDefault("Converts musket balls into strings of 3 bloody tears that drain enemy health"); } public override void SetDefaults() { - item.damage = 215; + item.damage = 140; item.ranged = true; item.width = 48; item.height = 30; @@ -27,20 +27,18 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item40; + 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 = 97; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.shoot = ModContent.ProjectileType(); + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void AddRecipes() { @@ -53,8 +51,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index b56133746c..7c691feecb 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 130; item.ranged = true; item.width = 64; item.height = 32; @@ -29,18 +29,17 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 4f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.useAmmo = 23; + 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) { - Vector2 origin = new Vector2(32f, 14f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/CleansingBlazeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) @@ -71,7 +70,6 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddRecipeGroup("NForEE", 6); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/ClockGatlignum.cs b/Items/Weapons/Ranged/ClockGatlignum.cs index 782225824c..99d9dabe11 100644 --- a/Items/Weapons/Ranged/ClockGatlignum.cs +++ b/Items/Weapons/Ranged/ClockGatlignum.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Clock Gatlignum"); Tooltip.SetDefault("33% chance to not consume ammo\n" + - "Fires a string of high velocity bullets"); + "Converts musket balls into strings of 3 high velocity bullets"); } public override void SetDefaults() @@ -28,22 +28,28 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.75f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item31; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 20f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() => new Vector2(-5, 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 SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; + float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + + return false; } public override bool ConsumeAmmo(Player player) diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 4dae2866d9..d5cf85a26a 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 50; + item.damage = 66; item.ranged = true; item.width = 34; item.height = 100; @@ -26,14 +26,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.25f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 30f; - item.useAmmo = 40; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAmmo = AmmoID.Arrow; } public override void AddRecipes() @@ -74,20 +73,7 @@ namespace CalamityMod.Items.Weapons.Ranged num80 = num72 / num80; } - int num130 = 15; - if (Main.rand.NextBool(3)) - { - num130++; - } - if (Main.rand.NextBool(4)) - { - num130++; - } - if (Main.rand.NextBool(5)) - { - num130++; - } - for (int num131 = 0; num131 < num130; num131++) + for (int num131 = 0; num131 < 10; num131++) { 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); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); @@ -106,9 +92,9 @@ namespace CalamityMod.Items.Weapons.Ranged num80 = num72 / num80; num78 *= num80; num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-600, 601) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-600, 601) * 0.02f; - int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i, 0f, 0f); + float speedX4 = num78 + (float)Main.rand.Next(-600, 601) * 0.01f; + float speedY5 = num79 + (float)Main.rand.Next(-600, 601) * 0.01f; + int projectile = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, num73, num74, i); Main.projectile[projectile].tileCollide = false; Main.projectile[projectile].timeLeft = 240; Main.projectile[projectile].noDropItem = true; diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs new file mode 100644 index 0000000000..0e1ac58cf0 --- /dev/null +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -0,0 +1,80 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Condemnation : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Condemnation"); + Tooltip.SetDefault("Left clicks allows you to charge the repeater and release more arrows the longer the charge lasts\n" + + "Right clicks release fast moving arrows"); + } + + public override void SetDefaults() + { + item.damage = 566; + item.ranged = true; + item.width = 130; + item.height = 42; + item.useTime = item.useAnimation = 16; + item.useStyle = ItemUseStyleID.HoldingOut; + 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); + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noUseGraphic = false; + item.UseSound = SoundID.DD2_BallistaTowerShot; + item.channel = false; + } + else + { + item.noUseGraphic = true; + item.UseSound = SoundID.Item20; + item.channel = true; + return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + } + return base.CanUseItem(player); + } + + public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.7f : 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) + { + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + + // Single arrow firing. + if (player.altFunctionUse == 2) + { + Vector2 tipPosition = position + shootDirection * 110f; + Projectile.NewProjectile(tipPosition, shootVelocity, item.shoot, damage, knockBack, player.whoAmI); + } + + // Charge-up. Done via a holdout projectile. + else + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), 0, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/Condemnation.png b/Items/Weapons/Ranged/Condemnation.png new file mode 100644 index 0000000000..09d5d3c1fb Binary files /dev/null and b/Items/Weapons/Ranged/Condemnation.png differ diff --git a/Items/Weapons/Ranged/ConferenceCall.cs b/Items/Weapons/Ranged/ConferenceCall.cs index 1b5d374212..fbe8e1ec2f 100644 --- a/Items/Weapons/Ranged/ConferenceCall.cs +++ b/Items/Weapons/Ranged/ConferenceCall.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 4.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item38; item.autoReuse = true; - item.shootSpeed = 13f; + item.shootSpeed = 12f; item.shoot = ProjectileID.PurificationPowder; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); } float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -97,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index e55426048e..9ee11ae909 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 4000; + item.damage = 880; item.ranged = true; item.width = 22; item.height = 50; @@ -29,14 +29,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.noUseGraphic = true; item.channel = true; item.knockBack = 5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.useAmmo = 40; - item.Calamity().customRarity = CalamityRarity.Developer; - } + item.useAmmo = AmmoID.Arrow; + + 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; @@ -52,7 +54,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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/CoralCannon.cs b/Items/Weapons/Ranged/CoralCannon.cs index bc12424758..7c52f826c1 100644 --- a/Items/Weapons/Ranged/CoralCannon.cs +++ b/Items/Weapons/Ranged/CoralCannon.cs @@ -20,34 +20,34 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 52; item.height = 40; - item.crit += 10; 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 = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item61; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - } + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { if (Main.rand.NextBool(5)) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 2.0), knockBack * 2f, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 487a68ca53..a8e60906e1 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -12,34 +12,41 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Corroded Caustibow"); - Tooltip.SetDefault("Shoots slow, powerful shells that trail an irradiated aura"); + Tooltip.SetDefault("Converts wooden arrows into slow, powerful shells that trail an irradiated aura"); } public override void SetDefaults() { - item.damage = 80; + item.damage = 88; item.ranged = true; item.width = 30; item.height = 38; - item.crit += 20; 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 = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - item.useAmmo = 40; - } + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = true; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/CosmicBolter.cs b/Items/Weapons/Ranged/CosmicBolter.cs index 989137331e..c2be9197fb 100644 --- a/Items/Weapons/Ranged/CosmicBolter.cs +++ b/Items/Weapons/Ranged/CosmicBolter.cs @@ -13,12 +13,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Bolter"); - Tooltip.SetDefault("Fires three sliding energy bolts"); + Tooltip.SetDefault("Fires three arrows at once\n" + + "Converts wooden arrows into sliding energy bolts"); } public override void SetDefaults() { - item.damage = 35; + item.damage = 39; item.ranged = true; item.width = 40; item.height = 76; @@ -28,13 +29,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.75f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) { @@ -50,10 +52,15 @@ namespace CalamityMod.Items.Weapons.Ranged float offsetAmt = i - (projAmt - 1f) / 2f; Vector2 offset = velocity.RotatedBy(piOver10 * offsetAmt, default); if (!canHit) - { offset -= velocity; - } - Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + { + int proj = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; + } } return false; } diff --git a/Items/Weapons/Ranged/CursedCapper.cs b/Items/Weapons/Ranged/CursedCapper.cs index f4d6636b88..521369a4f0 100644 --- a/Items/Weapons/Ranged/CursedCapper.cs +++ b/Items/Weapons/Ranged/CursedCapper.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 35; item.ranged = true; - item.width = 44; + item.width = 52; item.height = 32; item.useTime = 10; item.useAnimation = 10; @@ -25,13 +25,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item41; item.autoReuse = true; item.shootSpeed = 14f; item.shoot = ProjectileID.CursedBullet; - item.useAmmo = 97; - } + 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) { @@ -44,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.PhoenixBlaster); recipe.AddIngredient(ItemID.CursedFlame, 10); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/CursedCapper.png b/Items/Weapons/Ranged/CursedCapper.png index 7b0eef9535..ce5af668df 100644 Binary files a/Items/Weapons/Ranged/CursedCapper.png and b/Items/Weapons/Ranged/CursedCapper.png differ diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 0840edaa83..b6d40846c7 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -12,20 +12,18 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Daemon's Flame"); - Tooltip.SetDefault("Shoots daemon flame fireballs as well as regular arrows"); + Tooltip.SetDefault("Shoots daemon flame fireballs as well as 4 regular arrows"); } public override void SetDefaults() { - item.damage = 160; + item.damage = 135; item.width = 62; item.height = 128; item.useTime = 12; item.useAnimation = 12; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.UseSound = SoundID.Item5; item.noMelee = true; item.noUseGraphic = true; @@ -34,21 +32,23 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.useAmmo = 40; + item.useAmmo = AmmoID.Arrow; + + 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 void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Vector2 origin = new Vector2(31f, 62f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DaemonsFlameGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); - } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 21772861cb..6221cf189a 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 34; + item.damage = 37; item.ranged = true; item.width = 34; item.height = 62; @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 4; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 12f; - item.useAmmo = 40; - } + 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) { @@ -41,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; } - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage, knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.CrystalDart, damage / 2, knockBack, player.whoAmI); Main.projectile[projectile].penetrate = 3; return false; } diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index b5ee19e731..1134e3999e 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Deathwind"); - Tooltip.SetDefault("Fires a spread of arrows\n" + - "Wooden arrows are converted to nebula arrows"); + Tooltip.SetDefault("Fires a spread of 4 arrows\n" + + "Wooden arrows are converted into nebula arrows"); } public override void SetDefaults() { - item.damage = 265; + item.damage = 248; item.ranged = true; item.width = 40; item.height = 82; @@ -27,36 +27,35 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; + 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 = 40; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = true; + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(20f, 41f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/DeathwindGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) { - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) + for (int index = 0; index < 4; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } else { - int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.8), knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs index b38fd89fff..488888343d 100644 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ b/Items/Weapons/Ranged/DodusHandcannon.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,59 +12,44 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Dodu's Handcannon"); - Tooltip.SetDefault("The power of the nut rests in your hands"); + Tooltip.SetDefault("The power of the nut rests in your hands\n" + + "Fires high explosive peanut shells, literally"); } public override void SetDefaults() { - item.width = 70; - item.height = 42; - item.damage = 485; - item.crit += 16; + 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 = 10f; + item.knockBack = 6f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + // 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); - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 13f; + item.useAmmo = AmmoID.Bullet; - item.shootSpeed = 24f; - item.shoot = ProjectileID.BulletHighVelocity; - item.useAmmo = 97; - } - - public override Vector2? HoldoutOffset() - { - return new Vector2(-15, 5); - } - - public override bool CanUseItem(Player player) - { - return CalamityGlobalItem.HasEnoughAmmo(player, item, 5); - } + 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) { - for (int i = 0; i < 5; i++) - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0f, 0f); - - // Consume 5 ammo per shot - CalamityGlobalItem.ConsumeAdditionalAmmo(player, item, 5); - - return false; + type = item.shoot; + return true; } - // Disable vanilla ammo consumption - public override bool ConsumeAmmo(Player player) - { - return false; - } + public override Vector2? HoldoutOffset() => new Vector2(-17, 5); public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/DodusHandcannon.png b/Items/Weapons/Ranged/DodusHandcannon.png index 9172b786ee..d78a7a37f7 100644 Binary files a/Items/Weapons/Ranged/DodusHandcannon.png and b/Items/Weapons/Ranged/DodusHandcannon.png differ diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index 42b8c5e8e8..e46d503b62 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -8,55 +8,160 @@ namespace CalamityMod.Items.Weapons.Ranged { public class DragonsBreath : ModItem { + public const int BetweenShotsPause = 15; + public const int PelletsPerShot = 6; + public const float FullAutoFireRateMult = 0.8f; + public const float FullAutoDamageMult = 0.8f; + // note this is extremely low because it's per pellet + public const float Spread = 0.018f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon's Breath"); - Tooltip.SetDefault("80% chance to not consume ammo\n" + - "Shoots a spread of exploding fire bullets"); + Tooltip.SetDefault("Left click fires in two-shot bursts\n" + + "The first shot is a spread of 6 normal bullets\n" + + "The second shot is a tight spread of 6 Dragon's Breath rounds\n" + + "Right click fires full auto and mixes the bullets randomly, but does 20% less damage\n" + + "This weapon has no randomness to its spread pattern\n" + + "66% chance to not consume ammo"); } public override void SetDefaults() { - item.damage = 260; + item.damage = 272; item.ranged = true; item.width = 64; item.height = 28; - item.useTime = 20; - item.useAnimation = 20; + + item.useTime = 9; + item.useAnimation = 18; + item.reuseDelay = BetweenShotsPause; + item.autoReuse = true; item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; item.knockBack = 6.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item36; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + // item.UseSound = SoundID.Item38; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + + item.Calamity().customRarity = CalamityRarity.Violet; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + } + public override bool ConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.66f; + + public override Vector2? HoldoutOffset() => new Vector2(-5, 5); + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + item.reuseDelay = player.altFunctionUse == 2 ? 0 : BetweenShotsPause; + return base.CanUseItem(player); } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 5); - } + public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? FullAutoFireRateMult : 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) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int i = 0; i < 13; i++) + Main.PlaySound(SoundID.Item38, position); + bool doDust = false; + Vector2 vel = new Vector2(speedX, speedY); + int[] bulletIDs = new int[PelletsPerShot]; + float spreadFactor = 1f; + + // Right click full auto: Randomly intermix three regular bullets and three Dragon's Breath Rounds in a wider spread + if (player.altFunctionUse == 2) { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + damage = (int)(damage * FullAutoDamageMult); + + for (int i = 0; i < PelletsPerShot; ++i) + bulletIDs[i] = type; + int dragonsBreathAdded = 0; + while (dragonsBreathAdded < PelletsPerShot / 2) + { + int i = Main.rand.Next(PelletsPerShot); + if (bulletIDs[i] == item.shoot) + continue; + bulletIDs[i] = item.shoot; + ++dragonsBreathAdded; + } + + spreadFactor = 1.52f; + } + // Left click first shot: Six regular bullets, low spread + else if (player.itemAnimation == player.itemAnimationMax - 1) + { + for (int i = 0; i < PelletsPerShot; ++i) + bulletIDs[i] = type; + } + // Left click second shot: Six Dragon's Breath Rounds, very low spread. Extra sound and dust blast. + else + { + Main.PlaySound(SoundID.Item74, position); + for (int i = 0; i < PelletsPerShot; ++i) + bulletIDs[i] = item.shoot; + + spreadFactor = 0.5f; + doDust = true; + } + + // Actually fire the chosen bullets. + float angleOffset = Spread * -0.5f * (PelletsPerShot - 1) * spreadFactor; + for (int i = 0; i < PelletsPerShot; ++i) + { + Vector2 rotatedVel = vel.RotatedBy(angleOffset); + Projectile.NewProjectile(position, rotatedVel, bulletIDs[i], damage, knockBack, player.whoAmI); + angleOffset += Spread * spreadFactor; + + if (doDust) + SpawnDragonsBreathDust(position, rotatedVel); } return false; } - public override bool ConsumeAmmo(Player player) + private void SpawnDragonsBreathDust(Vector2 pos, Vector2 velocity) { - if (Main.rand.Next(0, 100) < 80) - return false; - return true; + 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) + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + dustID = 262; + break; + case 1: + case 2: + dustID = 54; + break; + default: + dustID = 53; + break; + } + + // 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(velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Sometimes make smoke fly upward instead of outward. + if (Main.rand.NextBool(4)) + dustVel = Vector2.Lerp(dustVel, -Vector2.UnitY * dustVel.Length(), Main.rand.NextFloat(0.6f, 0.85f)) * 0.6f; + + // Pick a size for the smoke particle + float scale = Main.rand.NextFloat(0.5f, 1.6f); + + // Actually spawn the smoke + int idx = Dust.NewDust(pos, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + Main.dust[idx].position = pos; + } } } } diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 885b7d96e6..05c1402721 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -24,7 +24,7 @@ Right click to fire two devastating barrages of five empowered fireballs. public override void SetDefaults() { - item.damage = 700; + item.damage = 80; item.knockBack = 1f; item.shootSpeed = 18f; item.useStyle = ItemUseStyleID.HoldingOut; @@ -36,7 +36,7 @@ Right click to fire two devastating barrages of five empowered fireballs. item.UseSound = SoundID.Item5; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(platinum: 2, gold: 50); - item.rare = 10; + item.rare = ItemRarityID.Red; item.noMelee = true; item.noUseGraphic = true; item.ranged = true; diff --git a/Items/Weapons/Ranged/Dualpoon.cs b/Items/Weapons/Ranged/Dualpoon.cs index 5a82517b10..c6f3e6783a 100644 --- a/Items/Weapons/Ranged/Dualpoon.cs +++ b/Items/Weapons/Ranged/Dualpoon.cs @@ -26,12 +26,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 6.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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() { diff --git a/Items/Weapons/Ranged/EffluviumBow.cs b/Items/Weapons/Ranged/EffluviumBow.cs index 3e1e2011b8..45eeade8dc 100644 --- a/Items/Weapons/Ranged/EffluviumBow.cs +++ b/Items/Weapons/Ranged/EffluviumBow.cs @@ -11,12 +11,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Effluvium Bow"); - Tooltip.SetDefault("Fires two mist arrows at once"); + Tooltip.SetDefault("Fires two arrows at once\n" + + "Converts wooden arrows into mist arrows"); } public override void SetDefaults() { - item.damage = 51; + item.damage = 56; item.ranged = true; item.width = 26; item.height = 70; @@ -26,22 +27,30 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.useAmmo = 40; - } + 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) { for (int index = 0; index < 2; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } + float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; + + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + { + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; + } + } return false; } } diff --git a/Items/Weapons/Ranged/ElementalBlaster.cs b/Items/Weapons/Ranged/ElementalBlaster.cs index 18c979cc82..e72e79d38d 100644 --- a/Items/Weapons/Ranged/ElementalBlaster.cs +++ b/Items/Weapons/Ranged/ElementalBlaster.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 66; + item.damage = 50; item.ranged = true; item.width = 104; item.height = 42; @@ -27,13 +26,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.75f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + 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.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/ElementalEruption.cs b/Items/Weapons/Ranged/ElementalEruption.cs index abf998ede5..5f80285d74 100644 --- a/Items/Weapons/Ranged/ElementalEruption.cs +++ b/Items/Weapons/Ranged/ElementalEruption.cs @@ -18,48 +18,39 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 56; + item.damage = 77; item.ranged = true; item.width = 64; item.height = 34; - item.useTime = 7; + item.useTime = 14; item.useAnimation = 14; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.5f; item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.useAmmo = 23; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAmmo = AmmoID.Gel; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { - int num6 = Main.rand.Next(3, 5); - for (int index = 0; index < num6; ++index) + int numFirestreams = Main.rand.Next(3, 5); + for (int index = 0; index < numFirestreams; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) => Main.rand.NextFloat() > 0.9f; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index 3e321751a6..55791beb74 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -15,9 +15,9 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - item.damage = 73; + item.damage = 80; item.ranged = true; - item.width = 42; + item.width = 38; item.height = 62; item.useTime = 18; item.useAnimation = 18; @@ -26,18 +26,20 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) { float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.7f), knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; return true; diff --git a/Items/Weapons/Ranged/EternalBlizzard.png b/Items/Weapons/Ranged/EternalBlizzard.png index 98942e37af..8d0fcc4925 100644 Binary files a/Items/Weapons/Ranged/EternalBlizzard.png and b/Items/Weapons/Ranged/EternalBlizzard.png differ diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index f2a040e334..ccfc2e8e32 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Eviscerator"); - Tooltip.SetDefault("Fires a slow-moving blood clot"); + Tooltip.SetDefault("Converts musket balls into slow-moving blood clots"); } public override void SetDefaults() @@ -21,30 +21,34 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 58; item.height = 22; - item.crit += 25; 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 = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item40; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 22f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-7, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 25; + + public override Vector2? HoldoutOffset() => new Vector2(-7, 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index d6b97883e0..c504882bee 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -11,12 +11,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Fetid Emesis"); - Tooltip.SetDefault("Has a chance to release rotten chunks instead of bullets."); + Tooltip.SetDefault("Has a chance to release rotten chunks instead of bullets"); } public override void SetDefaults() { - item.damage = 200; + item.damage = 129; item.ranged = true; item.width = 76; item.height = 46; @@ -24,26 +24,24 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 16f; item.useAmmo = AmmoID.Bullet; - } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().canFirePointBlankShots = true; + } + + public override Vector2? HoldoutOffset() => new Vector2(-5, 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) { if (Main.rand.NextBool(8)) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 0.45f, + Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 0.8f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); for (int i = 0; i < 5; i++) { @@ -51,12 +49,12 @@ namespace CalamityMod.Items.Weapons.Ranged dust.velocity = Vector2.Normalize(new Vector2(speedX, speedY)).RotatedByRandom(MathHelper.ToRadians(15f)); dust.noGravity = true; } - if (player.Calamity().soundCooldown <= 0) - { - // WoF vomit sound. - Main.PlaySound(SoundID.NPCKilled, (int)position.X, (int)position.Y, 13, 0.5f, 0f); - player.Calamity().soundCooldown = 120; - } + if (player.Calamity().soundCooldown <= 0) + { + // WoF vomit sound. + Main.PlaySound(SoundID.NPCKilled, (int)position.X, (int)position.Y, 13, 0.5f, 0f); + player.Calamity().soundCooldown = 120; + } return false; } return true; diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 858549f145..4acca964fc 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -27,35 +27,20 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.Flare; item.shootSpeed = 5.5f; - item.useAmmo = 931; - } + item.useAmmo = AmmoID.Flare; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; - } + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 70; - public override bool AltFunctionUse(Player player) - { - return true; - } - - public override bool CanUseItem(Player player) - { - return base.CanUseItem(player); - } + public override bool AltFunctionUse(Player player) => true; public override float UseTimeMultiplier (Player player) { @@ -73,10 +58,13 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-50, 51) * 0.05f; - int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 1.4), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[flare].penetrate = 1; - Main.projectile[flare].timeLeft = 600; - Main.projectile[flare].Calamity().forceRanged = true; + int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 1.4), knockBack, player.whoAmI); + if (flare.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[flare].penetrate = 1; + Main.projectile[flare].timeLeft = 600; + Main.projectile[flare].Calamity().forceRanged = true; + } } return false; } @@ -87,10 +75,13 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[projectile].Calamity().forceRanged = true; - Main.projectile[projectile].timeLeft = 200; - Main.projectile[projectile].penetrate = 3; + int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + if (flare.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[flare].Calamity().forceRanged = true; + Main.projectile[flare].timeLeft = 200; + Main.projectile[flare].penetrate = 3; + } } return false; } diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index ce2117d615..742e214d34 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.channel = true; item.knockBack = 0f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; //30 diff --git a/Items/Weapons/Ranged/FlakToxicannon.cs b/Items/Weapons/Ranged/FlakToxicannon.cs index a2cc82d87f..782f56d146 100644 --- a/Items/Weapons/Ranged/FlakToxicannon.cs +++ b/Items/Weapons/Ranged/FlakToxicannon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged } public override void SetDefaults() { - item.damage = 25; + item.damage = 50; item.ranged = true; item.width = 88; item.height = 28; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item109; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index e84d56e2c8..0da50d130c 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Flarewing Bow"); - Tooltip.SetDefault("Shoots a spread of arrows\n" + - "Wooden arrows are converted to bouncing obsidian bats"); + Tooltip.SetDefault("Shoots a spread of 5 arrows\n" + + "Wooden arrows are converted into bouncing obsidian bats"); } public override void SetDefaults() { - item.damage = 15; + item.damage = 17; item.ranged = true; item.width = 20; item.height = 62; @@ -28,13 +28,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.WoodenArrowFriendly; item.shootSpeed = 16f; - item.useAmmo = 40; - } + 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) { @@ -55,12 +56,12 @@ namespace CalamityMod.Items.Weapons.Ranged } if (type == ProjectileID.WoodenArrowFriendly) { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); Main.projectile[num123].noDropItem = true; } else { - int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int num123 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index de3a235f7f..69410261b9 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -7,27 +7,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class FlurrystormCannon : ModItem + public class FlurrystormCannon : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Flurrystorm Cannon"); Tooltip.SetDefault("Fires a chain of snowballs that become faster over time\n" + - "Has a chance to also fire an ice chunk that shatters into shards\n" + - "50% chance to not consume snowballs"); + "Has a chance to also fire an ice chunk that shatters into shards\n" + + "50% chance to not consume snowballs"); } public override void SetDefaults() { item.damage = 12; - item.width = 58; - item.height = 34; + item.width = 68; + item.height = 38; item.useTime = 8; item.useAnimation = 8; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 1.2f; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; + item.Calamity().donorItem = true; + item.UseSound = SoundID.Item11; item.noMelee = true; item.noUseGraphic = true; @@ -35,14 +38,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.channel = true; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Snowball; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.shootSpeed = 18f; - } + 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 Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; diff --git a/Items/Weapons/Ranged/FlurrystormCannon.png b/Items/Weapons/Ranged/FlurrystormCannon.png index 049336535e..6d56826c9a 100644 Binary files a/Items/Weapons/Ranged/FlurrystormCannon.png and b/Items/Weapons/Ranged/FlurrystormCannon.png differ diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 9bfbb41b24..f8dec6064c 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -10,14 +10,16 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Frostbite Blaster"); - Tooltip.SetDefault("Fires a spread of icicles"); + Tooltip.SetDefault("Fires a spread of 6 bullets\n" + + "Converts musket balls into icicles"); } + public override void SetDefaults() { item.damage = 31; item.ranged = true; - item.width = 54; - item.height = 30; + item.width = 56; + item.height = 22; item.useTime = 7; item.useAnimation = 21; item.reuseDelay = 54; @@ -26,26 +28,32 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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); - - type = ProjectileID.Blizzard; for (int i = 0; i < 2; i++) { float newSpeedX = speedX + Main.rand.Next(-40, 41) * 0.06f; float newSpeedY = speedY + Main.rand.Next(-40, 41) * 0.06f; - int p = Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); - Main.projectile[p].magic = false; - Main.projectile[p].ranged = true; - } + + 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; + } + else + Projectile.NewProjectile(position.X, position.Y, newSpeedX, newSpeedY, type, damage, knockBack, player.whoAmI); + } return true; } } diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.png b/Items/Weapons/Ranged/FrostbiteBlaster.png index 18f1ddd993..f71f58da68 100644 Binary files a/Items/Weapons/Ranged/FrostbiteBlaster.png and b/Items/Weapons/Ranged/FrostbiteBlaster.png differ diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index a7d097672a..7b135c185f 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -11,12 +11,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Fungicide"); - Tooltip.SetDefault("Shoots fungal rounds that split on death"); + Tooltip.SetDefault("Converts musket balls into fungal rounds that split on death"); } public override void SetDefaults() { - item.damage = 11; + item.damage = 15; item.ranged = true; item.width = 40; item.height = 26; @@ -26,13 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item61; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -41,8 +42,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index 8036a8c90f..c91ba8a8ea 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 16; + item.damage = 18; item.ranged = true; item.width = 32; item.height = 52; @@ -27,20 +27,21 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + 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) { for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage / 4, 0f, player.whoAmI); } return true; } diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index 7d4db85f6c..ce1c8d6cd5 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Items.Weapons.Ranged { public class GoldenEagle : ModItem { + private const float Spread = 0.0425f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Golden Eagle"); @@ -15,48 +17,39 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 36; + item.damage = 85; item.ranged = true; item.noMelee = true; item.width = 46; item.height = 30; - item.useTime = 10; - item.useAnimation = 10; + item.useTime = 19; + item.useAnimation = 19; item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.Bullet; item.shootSpeed = 20f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 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 SpeedX = speedX + 5f * 0.05f; - float SpeedY = speedY + 5f * 0.05f; - float SpeedX2 = speedX - 5f * 0.05f; - float SpeedY2 = speedY - 5f * 0.05f; - float SpeedX3 = speedX + 0f * 0.05f; - float SpeedY3 = speedY + 0f * 0.05f; - float SpeedX4 = speedX - 10f * 0.05f; - float SpeedY4 = speedY - 10f * 0.05f; - float SpeedX5 = speedX + 10f * 0.05f; - float SpeedY5 = speedY + 10f * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX5, SpeedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; - } + Vector2 velocity = new Vector2(speedX, speedY); + + // Fire extra bullets to the left and right + for (int i = 0; i < 2; i++) + { + Projectile.NewProjectile(position, velocity.RotatedBy(-Spread * (i + 1)), type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(position, velocity.RotatedBy(+Spread * (i + 1)), type, damage, knockBack, player.whoAmI); + } + + return true; + } } } diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index ad9f925dc3..da1b21c01d 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; + item.damage = 33; item.ranged = true; item.width = 30; item.height = 50; @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + 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) { @@ -53,9 +54,12 @@ namespace CalamityMod.Items.Weapons.Ranged offset -= velocity; } int index = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY) * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI); - Main.projectile[index].Calamity().forceRanged = true; - Main.projectile[index].usesLocalNPCImmunity = true; - Main.projectile[index].localNPCHitCooldown = 10; + if (index.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[index].Calamity().forceRanged = true; + Main.projectile[index].usesLocalNPCImmunity = true; + Main.projectile[index].localNPCHitCooldown = 10; + } } return true; } diff --git a/Items/Weapons/Ranged/GreatbowofTurmoil.cs b/Items/Weapons/Ranged/GreatbowofTurmoil.cs index 04d5cf69fe..43fea7ed39 100644 --- a/Items/Weapons/Ranged/GreatbowofTurmoil.cs +++ b/Items/Weapons/Ranged/GreatbowofTurmoil.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 31; + item.damage = 34; item.ranged = true; item.width = 18; item.height = 36; @@ -28,13 +28,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) { @@ -57,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Ranged { type = ProjectileID.FireArrow; } - int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) @@ -70,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Ranged ProjectileID.HellfireArrow, ProjectileID.IchorArrow }); - int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, (int)(damage * 0.5f), knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; Main.projectile[index].usesLocalNPCImmunity = true; Main.projectile[index].localNPCHitCooldown = 10; diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index 0f89a88cb3..37489dd7dd 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item36; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 5f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index 9c1823d718..ec0d89ae76 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -1,4 +1,3 @@ -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,61 +6,49 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { public class HalibutCannon : ModItem - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Halibut Cannon"); - Tooltip.SetDefault("Becomes more powerful as you progress\n" + - "(Yes, it's still overpowered)\n" + - "Revengeance drop"); + Tooltip.SetDefault("Yes, it's still overpowered"); } public override void SetDefaults() { - item.damage = 12; + item.damage = 50; item.ranged = true; item.width = 108; item.height = 54; item.useTime = 10; item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = 10; + item.rare = ItemRarityID.Red; item.noMelee = true; item.knockBack = 1f; item.value = Item.buyPrice(1, 0, 0, 0); - item.UseSound = SoundID.Item38; + 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 void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - float damageMult = 0f + - (NPC.downedPlantBoss ? 0.1f : 0f) + - (NPC.downedGolemBoss ? 0.1f : 0f) + - (NPC.downedAncientCultist ? 0.2f : 0f) + - (NPC.downedMoonlord ? 1f : 0f) + - (CalamityWorld.downedProvidence ? 0.15f : 0f) + - (CalamityWorld.downedPolterghast ? 0.3f : 0f) + - (CalamityWorld.downedDoG ? 0.6f : 0f) + - (CalamityWorld.downedYharon ? 1f : 0f); - mult += damageMult; - } - 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 bulletAmt = Main.rand.Next(25, 36); + Main.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) { float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[shot].timeLeft = 120; } + return false; } } diff --git a/Items/Weapons/Ranged/HalleysInferno.cs b/Items/Weapons/Ranged/HalleysInferno.cs index d30aae8053..b09ef658ef 100644 --- a/Items/Weapons/Ranged/HalleysInferno.cs +++ b/Items/Weapons/Ranged/HalleysInferno.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1666; - item.crit += 20; + item.damage = 1350; item.knockBack = 5f; item.ranged = true; item.useTime = item.useAnimation = 30; @@ -37,10 +36,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override Vector2? HoldoutOffset() => new Vector2(-15, 0); public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 50; diff --git a/Items/Weapons/Ranged/HandheldTank.cs b/Items/Weapons/Ranged/HandheldTank.cs index 4d0ebd6e89..dd68a0ad2e 100644 --- a/Items/Weapons/Ranged/HandheldTank.cs +++ b/Items/Weapons/Ranged/HandheldTank.cs @@ -19,8 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 110; item.height = 46; item.ranged = true; - item.damage = 1000; - item.crit += 15; + item.damage = 940; item.knockBack = 16f; item.useTime = 71; item.useAnimation = 71; @@ -30,25 +29,25 @@ namespace CalamityMod.Items.Weapons.Ranged item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TankCannon"); item.noMelee = true; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; item.useAmmo = AmmoID.Rocket; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); return false; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-33, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-33, 0); public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 9cd820a391..a72de55197 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -11,75 +11,85 @@ namespace CalamityMod.Items.Weapons.Ranged { public class HeavenlyGale : ModItem { + public const float NormalArrowDamageMult = 1.25f; + private static int[] ExoArrows; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenly Gale"); - Tooltip.SetDefault("Fires a barrage of 5 random exo arrows\n" + - "Green exo arrows explode into a tornado on death\n" + - "Blue exo arrows cause a second group of arrows to fire on enemy hits\n" + - "Orange exo arrows cause explosions on death\n" + - "Teal exo arrows ignore enemy immunity frames\n" + + Tooltip.SetDefault("Converts wooden arrows into barrages of 5 random exo arrows\n" + + "Green exo arrows erupt into swirling tornadoes\n" + + "Blue exo arrows burst into barrages of following arrows\n" + + "Orange exo arrows explode into flames\n" + + "Teal exo arrows pierce infinitely and ignore immunity frames\n" + + $"Any non-wooden arrows used will deal {NormalArrowDamageMult}x damage\n" + "66% chance to not consume ammo"); + + ExoArrows = new int[] + { + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; } public override void SetDefaults() { - item.damage = 600; + item.damage = 198; item.ranged = true; item.width = 44; item.height = 58; - item.useTime = 11; - item.useAnimation = 22; + item.useTime = 15; + item.useAnimation = 30; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 17f; + 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) { Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); - float dmgMult = 1f; + Vector2 vel = new Vector2(speedX, speedY); float piOver10 = MathHelper.Pi * 0.1f; - int arrowAmt = 5; - Vector2 speed = new Vector2(speedX, speedY); - speed.Normalize(); - speed *= 40f; - bool canHit = Collision.CanHit(source, 0, 0, source + speed, 0, 0); - for (int i = 0; i < arrowAmt; i++) + + // This is not related to speed, but rather placing the arrows correctly along the large bow. + Vector2 baseOffset = new Vector2(speedX, speedY); + baseOffset.Normalize(); + baseOffset *= 40f; + + bool againstWall = !Collision.CanHit(source, 0, 0, source + baseOffset, 0, 0); + + int numArrows = 5; + for (int i = 0; i < numArrows; i++) { - float offsetAmt = i - (arrowAmt - 1f) / 2f; - Vector2 offset = speed.RotatedBy((double)(piOver10 * offsetAmt), default); - if (!canHit) + float offsetAmt = i - (numArrows - 1f) / 2f; + Vector2 offset = baseOffset.RotatedBy(piOver10 * offsetAmt); + if (againstWall) + offset -= baseOffset; + + if (type == ProjectileID.WoodenArrowFriendly) { - offset -= speed; + int thisArrowType = Main.rand.Next(ExoArrows); + // Teal exo arrows deal less damage. + float dmgMult = thisArrowType == ProjectileType() ? 0.66f : 1f; + int finalDamage = (int)(damage * dmgMult); + Projectile.NewProjectile(source + offset, vel, thisArrowType, finalDamage, knockBack, player.whoAmI); } - int arrow = Utils.SelectRandom(Main.rand, new int[] + else { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }); - if (player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] > 5) - { - arrow = Utils.SelectRandom(Main.rand, new int[] - { - ProjectileType(), - ProjectileType(), - ProjectileType() - }); + int normalArrowDamage = (int)(damage * NormalArrowDamageMult); + int proj = Projectile.NewProjectile(source + offset, vel, type, normalArrowDamage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; } - if (arrow == ProjectileType()) - dmgMult = 0.5f; - Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, arrow, (int)(damage * dmgMult), knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index a3ba1b9d97..bb73630b3b 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -10,56 +10,105 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Hellborn"); - Tooltip.SetDefault("Converts all bullets to explosive rounds\n" + - "Enemies that touch the gun while it's being fired take massive damage"); + Tooltip.SetDefault("Fires a spread of 3 bullets\n" + + "Converts musket balls into explosive bullets\n" + + "Enemies that touch the gun while it's being fired trigger a massive explosion\n" + + "After the explosion, this gun gains a massive boost to damage, fire rate and knockback for 10 seconds\n" + + "These stat bonuses slowly decay over time"); } public override void SetDefaults() { - item.damage = 21; + item.damage = 14; item.ranged = true; - item.width = 50; - item.height = 24; - item.useTime = 9; - item.useAnimation = 9; + item.width = 66; + item.height = 34; + item.useTime = 10; + item.useAnimation = 10; item.useStyle = ItemUseStyleID.HoldingOut; - item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item11; + item.knockBack = 2f; + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 14f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + item.Calamity().challengeDrop = true; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override float UseTimeMultiplier(Player player) => 1f + (player.Calamity().hellbornBoost * (1f / 600f)); + + public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) => mult += player.Calamity().hellbornBoost * (1f / 600f); + + public override void GetWeaponKnockback(Player player, ref float knockback) => knockback *= 1f + (player.Calamity().hellbornBoost * (1f / 600f)); + + public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { - for (int index = 0; index < 3; ++index) + for (int index = 0; index < 3; index++) { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[bullet].usesLocalNPCImmunity = true; - Main.projectile[bullet].localNPCHitCooldown = 10; - } + float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + + if (type == ProjectileID.Bullet) + { + int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI); + Main.projectile[bullet].usesLocalNPCImmunity = true; + Main.projectile[bullet].localNPCHitCooldown = 10; + } + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + } return false; } public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) { - damage *= 15; - } + player.Calamity().hellbornBoost = 600; + damage *= 10; + player.ApplyDamageToNPC(target, (int)(item.damage * (player.allDamage + player.rangedDamage - 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); + 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); + Dust dust = Main.dust[num54]; + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * target.width / 2f; + dust.noGravity = true; + dust.velocity.Y -= 6f; + dust.velocity *= 3f; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 100, default, num51); + dust.position = target.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * target.width / 2f; + dust.velocity.Y -= 6f; + dust.velocity *= 2f; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.color = Color.Crimson * 0.5f; + dust.velocity += value4 * Main.rand.NextFloat(); + } + for (int num55 = 0; num55 < 40; num55++) + { + int num56 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 174, 0f, 0f, 0, default, num52); + Dust dust = Main.dust[num56]; + dust.position = target.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(target.velocity.ToRotation()) * target.width / 3f; + dust.noGravity = true; + dust.velocity.Y -= 6f; + dust.velocity *= 0.5f; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + } + } public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) { - damage *= 15; + damage *= 10; } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) diff --git a/Items/Weapons/Ranged/Hellborn.png b/Items/Weapons/Ranged/Hellborn.png index b64c8d5a53..bcd63a70e0 100644 Binary files a/Items/Weapons/Ranged/Hellborn.png and b/Items/Weapons/Ranged/Hellborn.png differ diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index 8abd01de1c..ee77c727ed 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -26,13 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 11.5f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/Impaler.cs b/Items/Weapons/Ranged/Impaler.cs index 59314c0b2a..4dd46de45c 100644 --- a/Items/Weapons/Ranged/Impaler.cs +++ b/Items/Weapons/Ranged/Impaler.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 120; item.ranged = true; - item.crit += 14; item.width = 40; item.height = 26; item.useTime = 20; @@ -29,18 +28,19 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.useAmmo = 1836; - } + item.useAmmo = AmmoID.Stake; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(0, -10); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 14; + + public override Vector2? HoldoutOffset() => new Vector2(0, -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) { @@ -48,11 +48,11 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedY = speedY + (float)Main.rand.Next(-2, 3) * 0.05f; if (Main.rand.NextBool(3)) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } else { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 822326f822..2a3cbd3923 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 30; + item.damage = 22; item.ranged = true; item.width = 56; item.height = 24; @@ -31,15 +31,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity10BuyPrice; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item31; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 12f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().challengeDrop = true; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/Interfacer.cs b/Items/Weapons/Ranged/Interfacer.cs index 6482e0ce7d..64e1d1b089 100644 --- a/Items/Weapons/Ranged/Interfacer.cs +++ b/Items/Weapons/Ranged/Interfacer.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 50; + item.damage = 52; item.ranged = true; item.width = 66; item.height = 24; @@ -26,14 +26,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item38; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item38; item.autoReuse = true; item.shootSpeed = 13f; item.shoot = ProjectileID.PurificationPowder; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -54,23 +53,23 @@ namespace CalamityMod.Items.Weapons.Ranged int num6 = Main.rand.Next(4, 6); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; int bullet = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[bullet].extraUpdates += 1; } 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; + float num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + num79 = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - vector2.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { - num78 = (float)player.direction; + num78 = player.direction; } else { @@ -82,11 +81,11 @@ namespace CalamityMod.Items.Weapons.Ranged int bulletDamage = (int)(damage * 0.7f); for (int num108 = 0; num108 < num107; num108++) { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + vector2 = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(51) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-50, 51); + vector2.Y -= 100 * num108; + num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; @@ -95,22 +94,22 @@ namespace CalamityMod.Items.Weapons.Ranged { num79 = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; num78 *= num80; num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedX4 = num78 + Main.rand.Next(-30, 31) * 0.02f; + float speedY5 = num79 + Main.rand.Next(-30, 31) * 0.02f; int bullet = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, bulletDamage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[bullet].extraUpdates += 1; Main.projectile[bullet].tileCollide = false; //bullets from below - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(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(-50, 51); //200 - vector2.Y += (float)(100 * num108); //-= - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; //+ - - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; //+ - + vector2 = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(51) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y + 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + Main.rand.Next(-50, 51); + vector2.Y += 100 * num108; + num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; @@ -119,12 +118,12 @@ namespace CalamityMod.Items.Weapons.Ranged { num79 = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; num78 *= num80; num79 *= num80; - float speedX6 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; - float speedY7 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; + float speedX6 = num78 + Main.rand.Next(-30, 31) * 0.02f; + float speedY7 = num79 + Main.rand.Next(-30, 31) * 0.02f; int bullet2 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX6, -speedY7, type, bulletDamage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[bullet2].extraUpdates += 1; Main.projectile[bullet2].tileCollide = false; diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index 2f4d4081da..d3457396b7 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 94; item.height = 44; item.ranged = true; - item.damage = 1380; + item.damage = 900; item.knockBack = 12f; item.useTime = 52; item.useAnimation = 52; @@ -32,9 +32,9 @@ namespace CalamityMod.Items.Weapons.Ranged item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"); item.noMelee = true; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1f; @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { ModRecipe r = new ModRecipe(mod); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ItemID.LargeRuby); r.AddIngredient(ModContent.ItemType(), 5); r.AddIngredient(ModContent.ItemType(), 10); r.AddIngredient(ModContent.ItemType(), 15); diff --git a/Items/Weapons/Ranged/LeadWizard.cs b/Items/Weapons/Ranged/LeadWizard.cs index 7c592996ee..9b22bf7de4 100644 --- a/Items/Weapons/Ranged/LeadWizard.cs +++ b/Items/Weapons/Ranged/LeadWizard.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { item.damage = 58; - item.crit += 30; item.ranged = true; item.width = 66; item.height = 34; @@ -27,20 +26,21 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item31; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.BulletHighVelocity; item.shootSpeed = 20f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().challengeDrop = true; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 30; + + public override Vector2? HoldoutOffset() => new Vector2(-5, 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,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < 2; i++) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i == 1 ? 0 : 2)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, ProjectileID.BulletHighVelocity, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index ab9315b9ba..1e44e0b934 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Leviatitan"); - Tooltip.SetDefault("Fires green and normal water blasts"); + Tooltip.SetDefault("Converts musket balls into toxic and normal water blasts"); } public override void SetDefaults() @@ -26,12 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item92; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 18f; - } + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -40,17 +42,20 @@ 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 SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); - } - else - { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + + if (type == ProjectileID.Bullet) + { + if (Main.rand.NextBool(3)) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.5), knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + } + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index a87230089b..1d84649a85 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -13,12 +13,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Lunarian Bow"); - Tooltip.SetDefault("Fires two sliding energy bolts"); + Tooltip.SetDefault("Fires two arrows at once\n" + + "Converts wooden arrows into sliding energy bolts"); } public override void SetDefaults() { - item.damage = 29; + item.damage = 32; item.ranged = true; item.width = 22; item.height = 62; @@ -28,13 +29,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + 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) { @@ -50,10 +52,15 @@ namespace CalamityMod.Items.Weapons.Ranged float offsetAmt = i - (projAmt - 1f) / 2f; Vector2 offset = velocity.RotatedBy(piOver10 * offsetAmt, default); if (!canHit) - { offset -= velocity; - } - Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + { + int proj = Projectile.NewProjectile(source + offset, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; + } } return false; } diff --git a/Items/Weapons/Ranged/MagnaStriker.cs b/Items/Weapons/Ranged/MagnaStriker.cs index bada51268d..77800c71bd 100644 --- a/Items/Weapons/Ranged/MagnaStriker.cs +++ b/Items/Weapons/Ranged/MagnaStriker.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 35; item.ranged = true; - item.width = 60; - item.height = 22; + item.width = 72; + item.height = 38; item.useTime = 5; item.reuseDelay = 6; item.useAnimation = 20; @@ -28,13 +28,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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 = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/MagnaStriker.png b/Items/Weapons/Ranged/MagnaStriker.png index ae4b94e72a..f841775c43 100644 Binary files a/Items/Weapons/Ranged/MagnaStriker.png and b/Items/Weapons/Ranged/MagnaStriker.png differ diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index ac425bae1e..69e1b179d9 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1450; + item.damage = 357; item.ranged = true; item.width = 84; item.height = 30; @@ -32,11 +32,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 9.5f; item.UseSound = SoundID.Item11; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.useAmmo = 771; + item.useAmmo = AmmoID.Rocket; item.Calamity().customRarity = CalamityRarity.Violet; } diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 178fe4cafb..0c716b2a55 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -11,12 +11,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Malevolence"); - Tooltip.SetDefault("Fires two plague arrows that explode into bees on death"); + Tooltip.SetDefault("Fires two arrows at once\n" + + "Converts wooden arrows into plague arrows that explode into bees on death"); } public override void SetDefaults() { - item.damage = 51; + item.damage = 56; item.ranged = true; item.width = 36; item.height = 58; @@ -26,22 +27,30 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item97; item.autoReuse = true; item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 40; - } + 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) { for (int i = 0; i < 2; i++) { - float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } + float SpeedX = speedX + Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-20, 21) * 0.05f; + + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + { + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; + } + } return false; } } diff --git a/Items/Weapons/Ranged/MandibleBow.cs b/Items/Weapons/Ranged/MandibleBow.cs index c07ea8e099..509c79b3e2 100644 --- a/Items/Weapons/Ranged/MandibleBow.cs +++ b/Items/Weapons/Ranged/MandibleBow.cs @@ -1,7 +1,6 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -//using TerrariaOverhaul; namespace CalamityMod.Items.Weapons.Ranged { @@ -14,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 13; + item.damage = 14; item.ranged = true; item.width = 22; item.height = 40; @@ -24,17 +23,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item5; item.autoReuse = false; item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 30f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ + 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 673a3e4fe1..449cbaa2db 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -10,20 +10,19 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Marksman Bow"); - Tooltip.SetDefault("Fires three arrows at a time\n" + + Tooltip.SetDefault("Fires three arrows at once\n" + "Wooden arrows are converted into Jester's arrows"); } public override void SetDefaults() { - item.damage = 27; + item.damage = 30; item.ranged = true; - item.crit += 20; item.width = 36; item.height = 110; item.useTime = 18; item.useAnimation = 18; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6f; item.UseSound = SoundID.Item5; @@ -31,10 +30,15 @@ namespace CalamityMod.Items.Weapons.Ranged item.shoot = ProjectileID.JestersArrow; item.shootSpeed = 10f; item.useAmmo = AmmoID.Arrow; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; - } + + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; public override Vector2? HoldoutOffset() => new Vector2(-4, 0); @@ -46,14 +50,15 @@ namespace CalamityMod.Items.Weapons.Ranged for (int i = 0; i < 3; i++) { + int randomExtraUpdates = Main.rand.Next(3); float SpeedX = speedX + Main.rand.NextFloat(-10f, 10f) * 0.05f; float SpeedY = speedY + Main.rand.NextFloat(-10f, 10f) * 0.05f; - int arrow = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int arrow = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[arrow].noDropItem = true; - Main.projectile[arrow].extraUpdates += Main.rand.Next(3); //0 to 2 extra updates + Main.projectile[arrow].extraUpdates += randomExtraUpdates; //0 to 2 extra updates if (type == ProjectileID.JestersArrow) { - Main.projectile[arrow].localNPCHitCooldown = 10; + Main.projectile[arrow].localNPCHitCooldown = 10 * (randomExtraUpdates + 1); Main.projectile[arrow].usesLocalNPCImmunity = true; } } diff --git a/Items/Weapons/Ranged/MarniteRifleSpear.cs b/Items/Weapons/Ranged/MarniteRifleSpear.cs index c51dad9a98..7b4e91d3e8 100644 --- a/Items/Weapons/Ranged/MarniteRifleSpear.cs +++ b/Items/Weapons/Ranged/MarniteRifleSpear.cs @@ -23,13 +23,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item41; item.autoReuse = true; item.shootSpeed = 22f; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; item.shoot = ProjectileID.PurificationPowder; - } + item.Calamity().canFirePointBlankShots = true; + } public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/Megafleet.cs b/Items/Weapons/Ranged/Megafleet.cs index b804555cb7..916f0af691 100644 --- a/Items/Weapons/Ranged/Megafleet.cs +++ b/Items/Weapons/Ranged/Megafleet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 1000; + item.damage = 200; item.ranged = true; item.width = 96; item.height = 38; @@ -27,15 +27,17 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 18f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Developer; - } + item.useAmmo = AmmoID.Bullet; + + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/Megafleet.png b/Items/Weapons/Ranged/Megafleet.png index 839b2a8aab..ac0d0b0f01 100644 Binary files a/Items/Weapons/Ranged/Megafleet.png and b/Items/Weapons/Ranged/Megafleet.png differ diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 7d2f4d9b5e..cb018c0fec 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 16f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -42,8 +43,8 @@ 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 SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); return false; } diff --git a/Items/Weapons/Ranged/Meowthrower.cs b/Items/Weapons/Ranged/Meowthrower.cs index d093097adc..9f9bf292e0 100644 --- a/Items/Weapons/Ranged/Meowthrower.cs +++ b/Items/Weapons/Ranged/Meowthrower.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 1.25f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5.5f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/MepheticSprayer.cs b/Items/Weapons/Ranged/MepheticSprayer.cs index b81d3cc519..3f89face49 100644 --- a/Items/Weapons/Ranged/MepheticSprayer.cs +++ b/Items/Weapons/Ranged/MepheticSprayer.cs @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 2f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7.5f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/MineralMortar.cs b/Items/Weapons/Ranged/MineralMortar.cs index bb3f6d1a3b..0a369a61f7 100644 --- a/Items/Weapons/Ranged/MineralMortar.cs +++ b/Items/Weapons/Ranged/MineralMortar.cs @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shootSpeed = 14f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 771; + item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Minigun.cs b/Items/Weapons/Ranged/Minigun.cs index 2500a5defa..264737882c 100644 --- a/Items/Weapons/Ranged/Minigun.cs +++ b/Items/Weapons/Ranged/Minigun.cs @@ -26,15 +26,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item41; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 22f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -43,9 +44,9 @@ 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 SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); return false; } @@ -60,8 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ChainGun); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/Minigun.png b/Items/Weapons/Ranged/Minigun.png index ecdd97bef4..3e41aa0fbc 100644 Binary files a/Items/Weapons/Ranged/Minigun.png and b/Items/Weapons/Ranged/Minigun.png differ diff --git a/Items/Weapons/Ranged/MolecularManipulator.cs b/Items/Weapons/Ranged/MolecularManipulator.cs index 2257236e07..3f795bc38f 100644 --- a/Items/Weapons/Ranged/MolecularManipulator.cs +++ b/Items/Weapons/Ranged/MolecularManipulator.cs @@ -14,29 +14,29 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Molecular Manipulator"); Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + - "Fires a fast null bullet that distorts NPC stats\n" + - "Uses your life as ammo"); + "Fires a fast null bullet that distorts NPC stats"); } public override void SetDefaults() { - item.damage = 890; + item.damage = 580; item.ranged = true; - item.width = 60; - item.height = 30; + item.width = 56; + item.height = 34; item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 8f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item33; + 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().customRarity = CalamityRarity.PureGreen; - } + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -45,12 +45,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) { - player.statLife -= 5; - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.Male ? player.name + " was vaporized by the imbuement of his life." : player.name + " was vaporized by the imbuement of her life."), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/MolecularManipulator.png b/Items/Weapons/Ranged/MolecularManipulator.png index a13a3964d4..ea6f70892c 100644 Binary files a/Items/Weapons/Ranged/MolecularManipulator.png and b/Items/Weapons/Ranged/MolecularManipulator.png differ diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 95b6cb3235..95672567ba 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -14,66 +14,72 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Monsoon"); Tooltip.SetDefault("Fires a spread of 5 arrows\n" + - "Wooden arrows have a chance to be converted to typhoon arrows or sharks"); + "Wooden arrows are converted into typhoon arrows and sharks"); } public override void SetDefaults() { - item.damage = 142; + item.damage = 121; item.ranged = true; item.width = 46; item.height = 78; - item.useTime = 12; - item.useAnimation = 12; + item.useTime = 20; + item.useAnimation = 20; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().customRarity = (CalamityRarity)13; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.WoodenArrowFriendly; - item.shootSpeed = 15f; - item.useAmmo = 40; - } + 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) { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; - int num118 = 5; - Vector2 vector7 = new Vector2(speedX, speedY); - vector7.Normalize(); - vector7 *= 40f; - bool flag11 = Collision.CanHit(vector2, 0, 0, vector2 + vector7, 0, 0); - for (int num119 = 0; num119 < num118; num119++) + Vector2 source = player.RotatedRelativePoint(player.MountedCenter); + float piOver10 = MathHelper.Pi * 0.1f; + int totalProjectiles = 5; + Vector2 velocity = new Vector2(speedX, speedY); + velocity.Normalize(); + velocity *= 40f; + bool canHit = Collision.CanHit(source, 0, 0, source + velocity, 0, 0); + for (int p = 0; p < totalProjectiles; p++) { - float num120 = (float)num119 - ((float)num118 - 1f) / 2f; - Vector2 value9 = vector7.RotatedBy((double)(num117 * num120), default); - if (!flag11) - { - value9 -= vector7; - } + float offsetAmt = p - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(piOver10 * offsetAmt); + if (!canHit) + offset -= velocity; + if (type == ProjectileID.WoodenArrowFriendly) { - if (Main.rand.NextBool(5)) - { - type = ProjectileID.MiniSharkron; - } - if (Main.rand.NextBool(15)) - { - type = ModContent.ProjectileType(); - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)(damage * 1.1f), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].Calamity().forceRanged = true; - Main.projectile[num121].noDropItem = true; - Main.projectile[num121].arrow = true; - Main.projectile[num121].extraUpdates += 1; + int newType = type; + switch (p) + { + case 0: + case 1: + case 3: + case 4: + newType = ModContent.ProjectileType(); + break; + case 2: + newType = ModContent.ProjectileType(); + break; + } + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, newType, (int)(damage * 1.1), knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].arrow = true; + Main.projectile[proj].extraUpdates += 1; + } } else { - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[num121].noDropItem = true; + int proj = Projectile.NewProjectile(source.X + offset.X, source.Y + offset.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + Main.projectile[proj].noDropItem = true; } } return false; diff --git a/Items/Weapons/Ranged/Needler.cs b/Items/Weapons/Ranged/Needler.cs index d2fd642406..fe75634cca 100644 --- a/Items/Weapons/Ranged/Needler.cs +++ b/Items/Weapons/Ranged/Needler.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Needler"); - Tooltip.SetDefault("Fires needles that stick to enemies and explode"); + Tooltip.SetDefault("Converts musket balls into needles that stick to enemies and explode"); } public override void SetDefaults() @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 5.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item108; item.autoReuse = true; item.shootSpeed = 9f; @@ -41,8 +41,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/Needler.png b/Items/Weapons/Ranged/Needler.png index 5ae90b6cb2..3a3465d842 100644 Binary files a/Items/Weapons/Ranged/Needler.png and b/Items/Weapons/Ranged/Needler.png differ diff --git a/Items/Weapons/Ranged/NettlelineGreatbow.cs b/Items/Weapons/Ranged/NettlelineGreatbow.cs index b7fc40d441..abc109ad35 100644 --- a/Items/Weapons/Ranged/NettlelineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlelineGreatbow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 115; + item.damage = 73; item.ranged = true; item.width = 36; item.height = 64; @@ -26,15 +26,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; + 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 = 40; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + 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) { @@ -53,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Ranged { value9 -= vector7; } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } for (int i = 0; i < 2; i++) @@ -71,7 +72,7 @@ namespace CalamityMod.Items.Weapons.Ranged default: break; } - int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + int index = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); Main.projectile[index].noDropItem = true; } return false; diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index 84778f3741..d92e8e0475 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -11,11 +11,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Norfleet"); - } + Tooltip.SetDefault("Fire everything!"); + } public override void SetDefaults() { - item.damage = 1000; + item.damage = 442; item.knockBack = 15f; item.shootSpeed = 30f; item.useStyle = ItemUseStyleID.HoldingOut; @@ -26,17 +27,18 @@ namespace CalamityMod.Items.Weapons.Ranged item.height = 42; item.UseSound = SoundID.Item92; item.shoot = ModContent.ProjectileType(); - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.noMelee = true; + 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.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/NullificationRifle.cs b/Items/Weapons/Ranged/NullificationRifle.cs index b04a77e85b..c7f533c1c6 100644 --- a/Items/Weapons/Ranged/NullificationRifle.cs +++ b/Items/Weapons/Ranged/NullificationRifle.cs @@ -13,28 +13,28 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Nullification Pistol"); Tooltip.SetDefault("Is it nullable or not? Let's find out!\n" + - "Fires a fast null bullet that distorts NPC stats\n" + - "Uses your life as ammo"); + "Fires a fast null bullet that distorts NPC stats"); } public override void SetDefaults() { item.damage = 135; item.ranged = true; - item.width = 64; - item.height = 30; + 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 = 8; + 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() { @@ -43,16 +43,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) { - player.statLife -= 5; - if (Main.myPlayer == player.whoAmI) - { - player.HealEffect(-5, true); - } - if (player.statLife <= 0) - { - player.KillMe(PlayerDeathReason.ByCustomReason(player.Male ? player.name + " was vaporized by the imbuement of his life." : player.name + " was vaporized by the imbuement of her life."), 1000.0, 0, false); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/NullificationRifle.png b/Items/Weapons/Ranged/NullificationRifle.png index dd2b683b9d..055d04f93f 100644 Binary files a/Items/Weapons/Ranged/NullificationRifle.png and b/Items/Weapons/Ranged/NullificationRifle.png differ diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index 6c21317f68..3dff3384bc 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 40; + item.damage = 51; item.ranged = true; item.width = 64; item.height = 32; @@ -25,15 +25,15 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item36; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item36; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.BlackBolt; item.shootSpeed = 24f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -42,14 +42,20 @@ 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 SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.9f, SpeedY * 0.9f, ProjectileID.BlackBolt, damage, knockBack, player.whoAmI, 0f, 0f); - for (int i = 0; i <= 3; i++) + Vector2 velocity = new Vector2(speedX, speedY); + + // Fire the Onyx Shard that is characteristic of the Onyx Blaster + // The shard deals 250% damage and double knockback + int shardDamage = (int)(2.5f * damage); + float shardKB = 2f * knockBack; + Vector2 offset = new Vector2(Main.rand.Next(-25, 26) * 0.05f, Main.rand.Next(-25, 26) * 0.05f); + Projectile shard = Projectile.NewProjectileDirect(position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + shard.timeLeft = (int)(shard.timeLeft * 1.25f); + + for (int i = 0; i < 4; i++) { - float SpeedNewX = speedX + (float)Main.rand.Next(-45, 46) * 0.05f; - float SpeedNewY = speedY + (float)Main.rand.Next(-45, 46) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedNewX, SpeedNewY, type, (int)(damage * 1.25f), knockBack, player.whoAmI, 0f, 0f); + offset = new Vector2(Main.rand.Next(-45, 46) * 0.05f, Main.rand.Next(-45, 46) * 0.05f); + Projectile.NewProjectile(position, velocity + offset, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index ba192d21bd..339b09ecaf 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -20,24 +20,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 200; + item.damage = 90; item.ranged = true; item.width = 84; item.height = 34; - item.useTime = 9; - item.useAnimation = 9; + item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item36; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.UseSound = SoundID.Item36; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; // wait why + item.shoot = ProjectileID.BlackBolt; item.shootSpeed = 28f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -46,25 +46,24 @@ 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 = new Vector2(speedX, speedY); + // Fire the Onyx Shard that is characteristic of the Onyx Blaster - // The shard deals triple damage and double knockback - int shardDamage = (int)(2.5 * damage); + // The shard deals 145% damage and double knockback + int shardDamage = (int)(1.45f * damage); float shardKB = 2f * knockBack; - float shardVelocityX = (speedX + (float)Main.rand.Next(-25, 26) * 0.05f) * 0.9f; - float shardVelocityY = (speedY + (float)Main.rand.Next(-25, 26) * 0.05f) * 0.9f; - int onyx = Projectile.NewProjectile(position.X, position.Y, shardVelocityX, shardVelocityY, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); - Main.projectile[onyx].timeLeft -= 20; + Projectile shard = Projectile.NewProjectileDirect(position, velocity, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI, 0f, 0f); + shard.timeLeft = (int)(shard.timeLeft * 1.4f); // Fire three symmetric pairs of bullets alongside it - Vector2 baseVelocity = new Vector2(speedX, speedY); for (int i = 0; i < 3; i++) { float randAngle = Main.rand.NextFloat(0.035f); float randVelMultiplier = Main.rand.NextFloat(0.92f, 1.08f); - Vector2 left = baseVelocity.RotatedBy(-randAngle) * randVelMultiplier; - Vector2 right = baseVelocity.RotatedBy(randAngle) * randVelMultiplier; - Projectile.NewProjectile(position.X, position.Y, left.X, left.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(position.X, position.Y, right.X, right.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); + Vector2 ccwVelocity = velocity.RotatedBy(-randAngle) * randVelMultiplier; + Vector2 cwVelocity = velocity.RotatedBy(randAngle) * randVelMultiplier; + Projectile.NewProjectile(position, ccwVelocity, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, cwVelocity, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } @@ -81,7 +80,7 @@ namespace CalamityMod.Items.Weapons.Ranged ModRecipe r = new ModRecipe(mod); r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ModContent.ItemType(), 2); r.AddTile(ModContent.TileType()); r.SetResult(this); r.AddRecipe(); diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index e02eeb06e3..a02e22c36e 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 9; item.ranged = true; - item.width = 64; - item.height = 16; + item.width = 46; + item.height = 30; item.useTime = 5; item.reuseDelay = 25; item.useAnimation = 20; @@ -27,12 +27,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 0f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + 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 = 97; + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/OpalStriker.png b/Items/Weapons/Ranged/OpalStriker.png index 72da079908..4f8e18f1cb 100644 Binary files a/Items/Weapons/Ranged/OpalStriker.png and b/Items/Weapons/Ranged/OpalStriker.png differ diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index bca705351f..a27af79b2e 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -27,12 +27,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item9; item.autoReuse = true; item.shootSpeed = 6.5f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index 011b5ff209..72c81187b2 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 6; + item.damage = 12; item.ranged = true; item.width = 60; item.height = 28; @@ -27,29 +27,27 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 18f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { return new Vector2(-14, -1); } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - for (int i = 0; i < 2; ++i) - { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return 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) + { + float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } public override bool ConsumeAmmo(Player player) { diff --git a/Items/Weapons/Ranged/P90.png b/Items/Weapons/Ranged/P90.png index 317a9342bf..92ae0dde36 100644 Binary files a/Items/Weapons/Ranged/P90.png and b/Items/Weapons/Ranged/P90.png differ diff --git a/Items/Weapons/Ranged/PaintballBlaster.cs b/Items/Weapons/Ranged/PaintballBlaster.cs index 9ddd9dfc9e..d4fd52c7da 100644 --- a/Items/Weapons/Ranged/PaintballBlaster.cs +++ b/Items/Weapons/Ranged/PaintballBlaster.cs @@ -27,12 +27,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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) { diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 516e4fc598..3450057d44 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -8,32 +8,40 @@ namespace CalamityMod.Items.Weapons.Ranged { public class PearlGod : ModItem { + private const int defaultSpread = 1; + private int spread = defaultSpread; + private bool finalShot = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl God"); - Tooltip.SetDefault("Your life is mine..."); + Tooltip.SetDefault("Your life is mine...\n" + + "Fires shockblast rounds that emit massive explosions and steal enemy life as well as additional bullets\n" + + "Every seventh shot fires a massive shockblast"); } public override void SetDefaults() { - item.damage = 40; + item.damage = 125; item.ranged = true; - item.width = 50; - item.height = 32; + item.width = 80; + item.height = 46; item.useTime = 12; item.useAnimation = 12; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.UseSound = SoundID.Item41; + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 24f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().challengeDrop = true; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -42,13 +50,57 @@ 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) { - for (int index = 0; index < 2; ++index) - { - float speedMult = (float)(index + 1) * 0.15f; - Projectile.NewProjectile(position.X, position.Y, speedX * speedMult, speedY * speedMult, ModContent.ProjectileType(), (int)((double)damage * 0.75), knockBack, player.whoAmI, 0f, 0f); - } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (spread > 6) + { + spread = defaultSpread; + finalShot = true; + } + + Vector2 velocity = new Vector2(speedX, speedY); + float rotation = MathHelper.ToRadians(spread); + if (!finalShot) + { + int totalLoops = 1; + switch (spread) + { + case 1: + case 2: + break; + case 3: + case 4: + totalLoops = 2; + break; + case 5: + case 6: + totalLoops = 3; + break; + } + + for (int i = 0; i < totalLoops; i++) + { + int proj = Projectile.NewProjectile(position, velocity.RotatedBy(-rotation * (i + 1)), type, (int)(damage * 0.5), knockBack * 0.5f, player.whoAmI); + Main.projectile[proj].extraUpdates += spread; + int proj2 = Projectile.NewProjectile(position, velocity.RotatedBy(+rotation * (i + 1)), type, (int)(damage * 0.5), knockBack * 0.5f, player.whoAmI); + Main.projectile[proj2].extraUpdates += spread; + } + + int proj3 = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, spread); + Main.projectile[proj3].extraUpdates += spread; + + spread++; + } + else + { + for (int i = 0; i < 3; i++) + { + int proj = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage * 2, knockBack * 2f, player.whoAmI, 0f, 10f); + Main.projectile[proj].extraUpdates += 9; + } + + finalShot = false; + } + + return false; } } } diff --git a/Items/Weapons/Ranged/PearlGod.png b/Items/Weapons/Ranged/PearlGod.png index c6d7466c3a..f4c5a835b5 100644 Binary files a/Items/Weapons/Ranged/PearlGod.png and b/Items/Weapons/Ranged/PearlGod.png differ diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index f800ed5ca8..d3a9ceb651 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Pestilent Defiler"); - Tooltip.SetDefault("Fires a plague round that explodes and splits on death"); + Tooltip.SetDefault("Converts musket balls into plague rounds that explode and split apart on death"); } public override void SetDefaults() @@ -26,13 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 9.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item40; item.autoReuse = true; - item.shootSpeed = 20f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -41,8 +42,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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + + return false; } } } diff --git a/Items/Weapons/Ranged/Phangasm.cs b/Items/Weapons/Ranged/Phangasm.cs index 6ecc2ce7ce..d661f44127 100644 --- a/Items/Weapons/Ranged/Phangasm.cs +++ b/Items/Weapons/Ranged/Phangasm.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Phangasm"); - Tooltip.SetDefault("Fires a spread of arrows and emits phantom arrows on enemy hits"); + Tooltip.SetDefault("Fires a spread of 5 arrows and emits phantom arrows on enemy hits"); } public override void SetDefaults() { - item.damage = 86; + item.damage = 110; item.width = 20; item.height = 12; item.useTime = 12; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.knockBack = 3f; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item5; item.noMelee = true; item.noUseGraphic = true; @@ -35,15 +35,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.useAmmo = 40; + 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 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 5cf9a42d4f..0bfa278040 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Items.Weapons.Ranged public class Photoviscerator : ModItem { public const int CooldownTime = 60 * 7; // 7 second cooldown. - public const double AltFireDamageMult = 4.27; - + public const double AltFireDamageMult = 1D; + public override void SetStaticDefaults() { DisplayName.SetDefault("Photoviscerator"); @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 250; + item.damage = 71; item.ranged = true; item.width = 84; item.height = 30; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 2f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.autoReuse = true; item.shootSpeed = 6f; item.useAmmo = AmmoID.Gel; @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 velocity = new Vector2(speedX, speedY).RotatedByRandom(0.05f); Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 0f); } - if (Main.rand.NextBool(8)) + if (Main.rand.NextBool(10)) { for (int i = 0; i < 2; i++) { @@ -110,8 +110,8 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs index 0b35ec650a..cac500b1b0 100644 --- a/Items/Weapons/Ranged/PlanetaryAnnihilation.cs +++ b/Items/Weapons/Ranged/PlanetaryAnnihilation.cs @@ -13,29 +13,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Planetary Annihilation"); - Tooltip.SetDefault("Fires a storm of arrows from the sky\n" + - "Wooden arrows are converted to homing energy bolts"); + Tooltip.SetDefault("Fires a storm of 7 arrows from the sky\n" + + "Wooden arrows are converted into homing energy bolts"); } public override void SetDefaults() { - item.damage = 65; + item.damage = 58; item.ranged = true; item.width = 58; item.height = 102; - item.useTime = 23; - item.useAnimation = 23; + item.useTime = 22; + item.useAnimation = 22; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item75; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.useAmmo = 40; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAmmo = AmmoID.Arrow; } public override Vector2? HoldoutOffset() @@ -47,16 +46,16 @@ namespace CalamityMod.Items.Weapons.Ranged { 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; + float num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (player.gravDir == -1f) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + num79 = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - vector2.Y; } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) { - num78 = (float)player.direction; + num78 = player.direction; num79 = 0f; num80 = num72; } @@ -65,11 +64,11 @@ namespace CalamityMod.Items.Weapons.Ranged 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 + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + 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; + num78 = Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = Main.mouseY + Main.screenPosition.Y - vector2.Y; if (num79 < 0f) { num79 *= -1f; @@ -78,7 +77,7 @@ namespace CalamityMod.Items.Weapons.Ranged { num79 = 20f; } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = (float)Math.Sqrt(num78 * num78 + num79 * num79); num80 = num72 / num80; num78 *= num80; num79 *= num80; @@ -86,18 +85,18 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int i = 0; i < 7; i++) { - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, (float)i); + float speedX4 = num78 + Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + Main.rand.Next(-120, 121) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, i); } } else { for (int i = 0; i < 7; i++) { - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + float speedX4 = num78 + Main.rand.Next(-120, 121) * 0.02f; + float speedY5 = num79 + Main.rand.Next(-120, 121) * 0.02f; + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs index 61fa7e259e..49d5d0873b 100644 --- a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.cs @@ -9,67 +9,63 @@ namespace CalamityMod.Items.Weapons.Ranged { public class PrideHuntersPlanarRipper : ModItem { - private int counter = 0; + private int counter = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Prideful Hunter's Planar Ripper"); - Tooltip.SetDefault("Converts musket balls into lightning bolts\n" + - "Lightning bolts travel extremely fast and explode on enemy kills\n" + - "Every fourth lightning bolt fired will deal 35 percent more damage.\n" + - "Additionally, lightning bolt crits grant a stacking speed boost to the player\n" + - "This stacks up to 20 percent bonus movement speed and acceleration\n" + - "The boost will reset if the player holds a different item"); + Tooltip.SetDefault("Every fourth shot deals 135% damage\n" + + "Converts musket balls into lightning bolts\n" + + "Lightning bolts travel extremely fast and explode on enemy kills\n" + + "Lightning bolt crits grant a stacking speed boost to the player\n" + + "This stacks up to 20 percent bonus movement speed and acceleration\n" + + "The boost will reset if the player holds a different item\n" + + "33% chance to not consume ammo"); } public override void SetDefaults() { - item.damage = 77; + 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.value = CalamityGlobalItem.Rarity12BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.UseSound = SoundID.Item11; - item.autoReuse = true; item.shoot = ProjectileID.Bullet; - item.shootSpeed = 15f; item.useAmmo = AmmoID.Bullet; - } + item.shootSpeed = 15f; - public override Vector2? HoldoutOffset() - { - return new Vector2(-12, -6); - } + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().donorItem = true; + item.Calamity().canFirePointBlankShots = true; + } - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 33) - return false; - return true; - } + public override Vector2? HoldoutOffset() => new Vector2(-12, -6); + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 33; 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 using standard musket balls (or Silver Bullets actually), fire the special lightning bolts and have special properties. if (type == ProjectileID.Bullet) - { - counter++; - float damageMult = 1f; - if (counter == 4) - damageMult = 1.35f; + type = ModContent.ProjectileType(); - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * damageMult), knockBack, player.whoAmI); - if (counter >= 4) + // Every 4th shot deals 35% increased damage and resets the counter. + counter++; + if (counter == 4) + { + damage = (int)(damage * 1.35f); counter = 0; - return false; } - return true; + + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.png b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.png index 15634d47db..94819c931f 100644 Binary files a/Items/Weapons/Ranged/PrideHuntersPlanarRipper.png and b/Items/Weapons/Ranged/PrideHuntersPlanarRipper.png differ diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index d15fb38d28..a3c02a7a95 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -9,17 +9,15 @@ namespace CalamityMod.Items.Weapons.Ranged { public class PristineFury : ModItem { - private int frameCounter = 0; - private int frame = 0; - public static int BaseDamage = 140; + public int frameCounter = 0; + public int frame = 0; + public static int BaseDamage = 96; public override void SetStaticDefaults() { DisplayName.SetDefault("Pristine Fury"); - Tooltip.SetDefault("Legendary Drop\n" + - "Fires an intense helix of flames that explode into a column of fire\n" + - "Right click to fire a short ranged cloud of lingering flames\n" + - "Revengeance drop"); + Tooltip.SetDefault("Fires an intense helix of flames that explode into a column of fire\n" + + "Right click to fire a short ranged cloud of lingering flames"); } public override void SetDefaults() @@ -33,15 +31,17 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.rare = 10; - item.value = Item.buyPrice(1, 20, 0, 0); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; item.UseSound = SoundID.Item34; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; - item.useAmmo = 23; - } + item.useAmmo = AmmoID.Gel; + + item.rare = ItemRarityID.Purple; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() => new Vector2(-25, -10); @@ -66,52 +66,41 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - int flameAmt = 3; - for (int index = 0; index < flameAmt; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.8f), knockBack, player.whoAmI, 0f, 0f); - } + int flameAmt = 3; + damage = (int)(damage * 1.2); + for (int index = 0; index < flameAmt; ++index) + { + float SpeedX = speedX + Main.rand.NextFloat(-1.25f, 1.25f); + float SpeedY = speedY + Main.rand.NextFloat(-1.25f, 1.25f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 0.8f), knockBack, player.whoAmI); + } } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + damage = (int)(damage * 0.94); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } - return false; + return false; } - internal Rectangle GetCurrentFrame(bool frameCounterUp = true) - { - int frameAmt = 4; - if (frameCounter >= 5) - { - frameCounter = -1; - frame = frame == frameAmt - 1 ? 0 : frame + 1; - } - if (frameCounterUp) - frameCounter++; - return new Rectangle(0, item.height * frame, item.width, item.height); - } + 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); + return false; + } - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Ranged/PristineFury_Animated"); - spriteBatch.Draw(texture, position, GetCurrentFrame(), 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); + 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, GetCurrentFrame(), 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, GetCurrentFrame(false), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); - } + 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); + } } } diff --git a/Items/Weapons/Ranged/ProporsePistol.cs b/Items/Weapons/Ranged/ProporsePistol.cs index d0b2542485..9e492d98cc 100644 --- a/Items/Weapons/Ranged/ProporsePistol.cs +++ b/Items/Weapons/Ranged/ProporsePistol.cs @@ -26,17 +26,17 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item33; item.autoReuse = true; item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; - } + 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 021cd8b2a9..b3292b61a8 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -26,13 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1.25f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 11f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -68,15 +69,15 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.JackOLantern, (int)((double)damage * 1.65), knockBack * 4f, player.whoAmI, 0f, 0f); + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.JackOLantern, (int)(damage * 1.4), knockBack * 4f, player.whoAmI); } else { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Ranged/RaidersGlory.cs b/Items/Weapons/Ranged/RaidersGlory.cs index ade619b15f..ef08ed1baf 100644 --- a/Items/Weapons/Ranged/RaidersGlory.cs +++ b/Items/Weapons/Ranged/RaidersGlory.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 40; + item.damage = 44; item.ranged = true; - item.crit += 10; - item.width = 58; + item.width = 50; item.height = 22; item.useTime = 20; item.useAnimation = 20; @@ -27,17 +26,21 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 15f; - item.useAmmo = 40; - } + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = 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 Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI, 0f, 0f); + int projectile = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.IchorArrow, damage, knockBack, player.whoAmI); Main.projectile[projectile].extraUpdates++; return false; } diff --git a/Items/Weapons/Ranged/RaidersGlory.png b/Items/Weapons/Ranged/RaidersGlory.png index 40b507aa2f..be692e2725 100644 Binary files a/Items/Weapons/Ranged/RaidersGlory.png and b/Items/Weapons/Ranged/RaidersGlory.png differ diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index 9765a18abc..da4d1c8c9d 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Realm Ravager"); - Tooltip.SetDefault("Shoots a burst of explosive bullets"); + Tooltip.SetDefault("Shoots a burst of 3 to 4 bullets\n" + + "Converts musket balls into explosive bullets"); } public override void SetDefaults() @@ -26,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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); @@ -41,10 +43,14 @@ namespace CalamityMod.Items.Weapons.Ranged int numBullets = Main.rand.NextBool() ? 4 : 3; for (int index = 0; index < numBullets; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } + float SpeedX = speedX + Main.rand.Next(-75, 76) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-75, 76) * 0.05f; + + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + } return false; } } diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index 9a41a5dd4e..786a4e731a 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -15,32 +15,35 @@ namespace CalamityMod.Items.Weapons.Ranged DisplayName.SetDefault("Rubico Prime"); Tooltip.SetDefault("Semi-automatic sniper that fires in 5 second bursts\n" + "Fires impact rounds that have an increased crit multiplier and deal bonus damage to inorganic targets"); - //would do less to organic targets if like this wasn't meant to be used against yharon lole + //would do less to organic targets if like this wasn't meant to be used against yharon lole } public override void SetDefaults() { - item.damage = 2601; + item.damage = 1178; item.ranged = true; - item.crit += 40; item.knockBack = 10f; item.useTime = 30; item.useAnimation = 300; item.autoReuse = false; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.width = 82; item.height = 28; - item.shoot = 10; + item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 12f; item.useAmmo = AmmoID.Bullet; - item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - } + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 40; public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -48,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index f645bcf725..db5d24a737 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -20,40 +20,40 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 200; + item.damage = 100; item.ranged = true; item.width = 74; item.height = 34; - item.crit += 15; 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 = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 16f; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; item.Calamity().customRarity = CalamityRarity.DarkBlue; - } + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 15; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 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 SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-5, 6) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-5, 6) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-5, 6) * 0.05f; if (Main.rand.NextBool(5)) { - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SandstormGun.cs b/Items/Weapons/Ranged/SandstormGun.cs index f07dc2539c..b4ecebc218 100644 --- a/Items/Weapons/Ranged/SandstormGun.cs +++ b/Items/Weapons/Ranged/SandstormGun.cs @@ -12,12 +12,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Sandstorm"); - Tooltip.SetDefault("Fires sand bullets that explode"); + Tooltip.SetDefault("Fires sand bullets that explode and slow enemies on hit\n" + + "50% chance to not consume sand"); } public override void SetDefaults() { - item.damage = 73; + item.damage = 80; item.ranged = true; item.width = 62; item.height = 26; @@ -27,22 +28,30 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + 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() { return new Vector2(-10, 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) + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 50) + return false; + return 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, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Scorpion.cs b/Items/Weapons/Ranged/Scorpion.cs index ba3eb73002..94ef613e54 100644 --- a/Items/Weapons/Ranged/Scorpion.cs +++ b/Items/Weapons/Ranged/Scorpion.cs @@ -17,26 +17,28 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 60; + item.damage = 80; item.ranged = true; item.width = 58; item.height = 26; - item.useTime = item.useAnimation = 13; - item.useStyle = ItemUseStyleID.HoldingOut; + item.useTime = 13; + item.reuseDelay = 30; + item.useAnimation = 39; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6.5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item11; + item.rare = ItemRarityID.Cyan; + item.UseSound = null; item.autoReuse = true; item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 771; + item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() { - return new Vector2(-10, 0); + return new Vector2(-20, 10); } public override bool AltFunctionUse(Player player) @@ -49,10 +51,10 @@ namespace CalamityMod.Items.Weapons.Ranged return base.CanUseItem(player); } - public override float UseTimeMultiplier (Player player) + public override float UseTimeMultiplier(Player player) { if (player.altFunctionUse == 2) - return (13f/42f); + return 13f/39f; return 1f; } @@ -60,12 +62,12 @@ namespace CalamityMod.Items.Weapons.Ranged { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 2.2999), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 1.25), knockBack * 2f, player.whoAmI); return false; } else { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Ranged/Scorpion.png b/Items/Weapons/Ranged/Scorpion.png index 2a1bab81e0..91088edf6e 100644 Binary files a/Items/Weapons/Ranged/Scorpion.png and b/Items/Weapons/Ranged/Scorpion.png differ diff --git a/Items/Weapons/Ranged/Seabow.cs b/Items/Weapons/Ranged/Seabow.cs index e1f677c778..3c457a1b88 100644 --- a/Items/Weapons/Ranged/Seabow.cs +++ b/Items/Weapons/Ranged/Seabow.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 11; + item.damage = 12; item.ranged = true; item.width = 22; item.height = 46; @@ -27,19 +27,20 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 16f; - item.useAmmo = 40; - } + 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) { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)((double)damage * 0.4), 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX * 0.5f, SpeedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 0.4), 0f, player.whoAmI); return true; } diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 5166b370dd..c9b7f05eb4 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -19,24 +19,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 108; + item.damage = 70; item.ranged = true; - item.width = 78; - item.height = 26; + 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 = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item11; + 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 = 97; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/Seadragon.png b/Items/Weapons/Ranged/Seadragon.png index 442f7e2cac..a9421d10a8 100644 Binary files a/Items/Weapons/Ranged/Seadragon.png and b/Items/Weapons/Ranged/Seadragon.png differ diff --git a/Items/Weapons/Ranged/SeasSearing.cs b/Items/Weapons/Ranged/SeasSearing.cs index f806265a32..d9e74117d2 100644 --- a/Items/Weapons/Ranged/SeasSearing.cs +++ b/Items/Weapons/Ranged/SeasSearing.cs @@ -13,10 +13,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Sea's Searing"); - Tooltip.SetDefault("Legendary Drop\n" + - "Fires a string of bubbles summoning a shower of bubbles on hit\n" + - "Right click to fire a slower, larger water blast that summons a water spout\n" + - "Revengeance drop"); + Tooltip.SetDefault("Fires a string of bubbles summoning a shower of bubbles on hit\n" + + "Right click to fire a slower, larger water blast that summons a water spout"); } public override void SetDefaults() @@ -31,14 +29,15 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.rare = 5; - item.value = Item.buyPrice(0, 36, 0, 0); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; - } + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() { diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index fe682ba41b..d996f36aeb 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -1,23 +1,22 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; -using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Ranged { - public class SepticSkewer : ModItem + public class SepticSkewer : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Septic Skewer"); Tooltip.SetDefault("Launches a spiky harpoon infested with toxins\n" + - "Releases bacteria when returning to the player"); + "Releases bacteria when returning to the player"); } public override void SetDefaults() { - item.damage = 501; + item.damage = 272; item.ranged = true; item.width = 46; item.height = 24; @@ -26,18 +25,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; item.UseSound = SoundID.Item10; item.autoReuse = true; item.shootSpeed = 20f; item.shoot = ModContent.ProjectileType(); - } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + 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 ccb34cce8a..8d4671a5f6 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 1.5f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5.5f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index d6d1c91932..02e0b70984 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -11,34 +11,41 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shellshooter"); - Tooltip.SetDefault("Shoots slow, powerful shells"); + Tooltip.SetDefault("Converts wooden arrows into slow, powerful shells"); } public override void SetDefaults() { - item.damage = 30; + item.damage = 33; item.ranged = true; item.width = 30; item.height = 38; - item.crit += 15; 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 = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 1.5f; - item.useAmmo = 40; - } + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = true; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index bbcbb2f539..a3e65695b0 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 25; + item.damage = 27; item.ranged = true; item.width = 56; item.height = 24; @@ -29,25 +29,19 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 1.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item31; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.Bullet; item.shootSpeed = 12f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Turquoise; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(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) { @@ -56,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int index = 0; index < bulletAmt; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } @@ -67,9 +61,10 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int index = 0; index < bulletAmt; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + float SpeedX = speedX + Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-30, 31) * 0.05f; + int shredderBoltDamage = (int)(0.85f * damage); + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), shredderBoltDamage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index aa8cd532d0..41e50b4277 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -11,43 +11,39 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shroomer"); - Tooltip.SetDefault("Has a chance to fire an extremely powerful homing mushroom"); + Tooltip.SetDefault("Fires bullets and an extremely powerful homing mushroom"); } public override void SetDefaults() { item.damage = 150; item.ranged = true; - item.width = 96; - item.height = 40; - item.crit += 35; + 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 = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item40; item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; + item.shoot = ProjectileID.Bullet; item.shootSpeed = 10f; - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 35; + + public override Vector2? HoldoutOffset() => new Vector2(-25, 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, type, damage, knockBack, player.whoAmI, 0f, 0f); - if (Main.rand.NextBool(5)) - { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); - } - return false; + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * 0.5), knockBack, player.whoAmI); + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Shroomer.png b/Items/Weapons/Ranged/Shroomer.png index 05044fbba2..bc192faae4 100644 Binary files a/Items/Weapons/Ranged/Shroomer.png and b/Items/Weapons/Ranged/Shroomer.png differ diff --git a/Items/Weapons/Ranged/Skullmasher.cs b/Items/Weapons/Ranged/Skullmasher.cs index e695dd2781..bbf4b19e9e 100644 --- a/Items/Weapons/Ranged/Skullmasher.cs +++ b/Items/Weapons/Ranged/Skullmasher.cs @@ -10,45 +10,46 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Skullmasher"); - Tooltip.SetDefault("Sniper shotgun, because why not?\n" + - "If you crit the target a second swarm of bullets will fire near the target"); + Tooltip.SetDefault("Makes their brain hurt\n" + + "Fires a spread of 4 high velocity bullets that split into additional bullets upon hitting an enemy"); } public override void SetDefaults() { - item.damage = 2310; + item.damage = 1100; item.ranged = true; - item.width = 76; - item.crit += 5; - item.height = 30; + item.width = 142; + item.height = 40; item.useTime = 60; item.useAnimation = 60; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 12f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().challengeDrop = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 5; + + public override Vector2? HoldoutOffset() => new Vector2(-50, 0); //beeg gun public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - for (int index = 0; index < 5; ++index) - { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } + for (int index = 0; index < 4; ++index) + { + float SpeedX = speedX + Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, type, 1f); + } + return false; } } diff --git a/Items/Weapons/Ranged/Skullmasher.png b/Items/Weapons/Ranged/Skullmasher.png index 81faacaed6..a5ccd98f68 100644 Binary files a/Items/Weapons/Ranged/Skullmasher.png and b/Items/Weapons/Ranged/Skullmasher.png differ diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index 5ee03954bf..0906533a84 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Slag Magnum"); - Tooltip.SetDefault("Shoots fossil shards that split into additional shards on death"); + Tooltip.SetDefault("Converts musket balls into fossil shards that split into additional shards on death"); } public override void SetDefaults() @@ -26,13 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item41; item.autoReuse = true; - item.shootSpeed = 22f; + item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 97; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() { @@ -41,8 +42,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } } } diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index 38ed410cb8..b32aa6ea8b 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -13,35 +13,36 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Soma Prime"); - Tooltip.SetDefault("Shoots extremely powerful high velocity rounds that inflict a powerful bleed debuff"); + Tooltip.SetDefault("Converts musket balls into extremely powerful high velocity rounds that inflict a powerful bleed debuff"); } public override void SetDefaults() { - item.damage = 1000; + item.damage = 200; item.ranged = true; item.width = 94; item.height = 34; - item.crit += 40; item.useTime = 2; item.useAnimation = 2; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; item.UseSound = SoundID.Item40; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.Developer; - } + item.useAmmo = AmmoID.Bullet; - public override Vector2? HoldoutOffset() - { - return new Vector2(-25, 0); - } + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 40; + + public override Vector2? HoldoutOffset() => new Vector2(-25, 0); public override void AddRecipes() { @@ -58,10 +59,14 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int i = 0; i < 2; i++) { - float SpeedX = speedX + (float)Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - } + float SpeedX = speedX + Main.rand.Next(-10, 11) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-10, 11) * 0.05f; + + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + } return false; } diff --git a/Items/Weapons/Ranged/SomaPrime.png b/Items/Weapons/Ranged/SomaPrime.png index f9728bdfc6..2c0f7cf58f 100644 Binary files a/Items/Weapons/Ranged/SomaPrime.png and b/Items/Weapons/Ranged/SomaPrime.png differ diff --git a/Items/Weapons/Ranged/SparkSpreader.cs b/Items/Weapons/Ranged/SparkSpreader.cs index 449eae6502..ba1ef75c9d 100644 --- a/Items/Weapons/Ranged/SparkSpreader.cs +++ b/Items/Weapons/Ranged/SparkSpreader.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spark Spreader"); - Tooltip.SetDefault("20% chance to not consume gel"); + Tooltip.SetDefault("70% chance to not consume gel"); } public override void SetDefaults() @@ -32,12 +32,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; } public override Vector2? HoldoutOffset() => new Vector2(-4, 0); - public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 20; + public override bool ConsumeAmmo(Player player) => Main.rand.Next(100) >= 70; public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index 8ffd263021..576599aa0f 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -27,13 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 1.5f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ProjectileID.Flare; item.shootSpeed = 9.5f; - item.useAmmo = 931; - } + item.useAmmo = AmmoID.Flare; + item.Calamity().canFirePointBlankShots = true; + } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -49,15 +50,21 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); - Main.projectile[flare].timeLeft = 200; - Main.projectile[flare].Calamity().forceRanged = true; + if (flare.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[flare].timeLeft = 200; + Main.projectile[flare].Calamity().forceRanged = true; + } float SpeedX2 = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - int soul = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - Main.projectile[soul].timeLeft = 600; - Main.projectile[soul].Calamity().forceRanged = true; - Main.projectile[soul].frame = Main.rand.Next(4); + int soul = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 2f, 0f); + if (soul.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[soul].timeLeft = 600; + Main.projectile[soul].Calamity().forceRanged = true; + Main.projectile[soul].frame = Main.rand.Next(4); + } return false; } diff --git a/Items/Weapons/Ranged/SpectreRifle.cs b/Items/Weapons/Ranged/SpectreRifle.cs index ff79224e6c..e8eb645419 100644 --- a/Items/Weapons/Ranged/SpectreRifle.cs +++ b/Items/Weapons/Ranged/SpectreRifle.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spectre Rifle"); - Tooltip.SetDefault("Fires a powerful homing soul"); + Tooltip.SetDefault("Converts musket balls into powerful homing souls"); } public override void SetDefaults() @@ -20,31 +21,38 @@ namespace CalamityMod.Items.Weapons.Ranged item.ranged = true; item.width = 88; item.height = 30; - item.crit += 22; item.useTime = 25; item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; - item.knockBack = 7; + item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item40; item.autoReuse = false; item.shoot = ProjectileID.LostSoulFriendly; - item.shootSpeed = 24f; - item.useAmmo = 97; - } + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + item.Calamity().canFirePointBlankShots = true; + } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 22; + + public override Vector2? HoldoutOffset() => new Vector2(-10, 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) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().forceRanged = true; - return false; + if (type == ProjectileID.Bullet) + { + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.LostSoulFriendly, damage, knockBack, player.whoAmI, 2f, 0f); + Main.projectile[proj].Calamity().forceRanged = true; + Main.projectile[proj].extraUpdates += 2; + } + else + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Spyker.cs b/Items/Weapons/Ranged/Spyker.cs index 834abf780c..3b80d4a580 100644 --- a/Items/Weapons/Ranged/Spyker.cs +++ b/Items/Weapons/Ranged/Spyker.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Spyker"); - Tooltip.SetDefault("Fires spikes that stick to enemies, tiles, and explode into shrapnel"); + Tooltip.SetDefault("Converts musket balls into spikes that stick to enemies, tiles and explode into shrapnel"); } public override void SetDefaults() { - item.damage = 240; + item.damage = 150; item.ranged = true; item.width = 44; item.height = 26; @@ -26,14 +26,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 6f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item108; + 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.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() @@ -43,8 +43,12 @@ 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - return false; + if (type == ProjectileID.Bullet) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Spyker.png b/Items/Weapons/Ranged/Spyker.png index c16af3bef7..807a4b5a82 100644 Binary files a/Items/Weapons/Ranged/Spyker.png and b/Items/Weapons/Ranged/Spyker.png differ diff --git a/Items/Weapons/Ranged/StarCannonEX.cs b/Items/Weapons/Ranged/StarCannonEX.cs index 4af049b1e6..ed8b29d2da 100644 --- a/Items/Weapons/Ranged/StarCannonEX.cs +++ b/Items/Weapons/Ranged/StarCannonEX.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 95; item.ranged = true; - item.width = 66; - item.height = 22; + item.width = 74; + item.height = 24; item.useTime = 10; item.useAnimation = 10; item.useStyle = ItemUseStyleID.HoldingOut; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.noMelee = true; item.knockBack = 8f; item.value = Item.buyPrice(0, 60, 0, 0); @@ -37,10 +37,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAmmo = AmmoID.FallenStar; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 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) { @@ -49,20 +46,15 @@ namespace CalamityMod.Items.Weapons.Ranged { float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - switch (Main.rand.Next(3)) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ProjectileID.Starfury; - break; - case 2: - type = ModContent.ProjectileType(); - break; - } - int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[star].Calamity().forceRanged = true; + type = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ProjectileID.Starfury, + ModContent.ProjectileType() + }); + int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); + if (star.WithinBounds(Main.maxProjectiles)) + Main.projectile[star].Calamity().forceRanged = true; } return false; } diff --git a/Items/Weapons/Ranged/StarCannonEX.png b/Items/Weapons/Ranged/StarCannonEX.png index fdb8ecbc56..2610187918 100644 Binary files a/Items/Weapons/Ranged/StarCannonEX.png and b/Items/Weapons/Ranged/StarCannonEX.png differ diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index a100ad0ece..0f3ca2af5f 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -31,12 +31,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 15f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item92; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; - item.useAmmo = 75; + item.useAmmo = AmmoID.FallenStar; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Starfleet.cs b/Items/Weapons/Ranged/Starfleet.cs index 854eec0872..b413423e50 100644 --- a/Items/Weapons/Ranged/Starfleet.cs +++ b/Items/Weapons/Ranged/Starfleet.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 78; + item.damage = 68; item.ranged = true; item.width = 76; item.height = 36; @@ -25,14 +25,13 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 15f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item92; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item92; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; - item.useAmmo = 75; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.useAmmo = AmmoID.FallenStar; } public override Vector2? HoldoutOffset() @@ -44,8 +43,8 @@ namespace CalamityMod.Items.Weapons.Ranged { for (int index = 0; index < 5; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); } return false; diff --git a/Items/Weapons/Ranged/StarfleetMK2.cs b/Items/Weapons/Ranged/StarfleetMK2.cs index d506bca341..0e71a2c4b9 100644 --- a/Items/Weapons/Ranged/StarfleetMK2.cs +++ b/Items/Weapons/Ranged/StarfleetMK2.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 222; + item.damage = 135; item.knockBack = 15f; item.shootSpeed = 16f; item.useStyle = ItemUseStyleID.HoldingOut; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.UseSound = SoundID.Item92; item.shoot = ModContent.ProjectileType(); item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.noMelee = true; item.noUseGraphic = true; item.ranged = true; diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index 2a7feab749..b1cbb29080 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item92; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/StormDragoon.cs b/Items/Weapons/Ranged/StormDragoon.cs index 0b80a58e10..bb848061a3 100644 --- a/Items/Weapons/Ranged/StormDragoon.cs +++ b/Items/Weapons/Ranged/StormDragoon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 94; + item.damage = 62; item.ranged = true; item.width = 74; item.height = 34; @@ -26,15 +26,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.25f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item31; + 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 = 97; - item.Calamity().customRarity = CalamityRarity.PureGreen; - } + 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 79b2aeab93..d18b5df548 100644 --- a/Items/Weapons/Ranged/StormSurge.cs +++ b/Items/Weapons/Ranged/StormSurge.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 5f; item.UseSound = SoundID.Item122; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.autoReuse = false; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; diff --git a/Items/Weapons/Ranged/StormSurge.png b/Items/Weapons/Ranged/StormSurge.png index 86f9b5ac18..0d8231258c 100644 Binary files a/Items/Weapons/Ranged/StormSurge.png and b/Items/Weapons/Ranged/StormSurge.png differ diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index ef3377c279..f95cf3cb4c 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 220; + item.damage = 132; item.ranged = true; item.width = 90; item.height = 30; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 6f; item.autoReuse = true; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item95; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs new file mode 100644 index 0000000000..94b23d9a56 --- /dev/null +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -0,0 +1,87 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class SurgeDriver : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Surge Driver"); + Tooltip.SetDefault("Left clicks release a laser ray that explodes on collision\n" + + "Right clicks release a barrage of laser beams that release homing energy on enemy hits"); + } + + 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.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); + + public override bool AltFunctionUse(Player player) => true; + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noUseGraphic = false; + item.reuseDelay = 0; + item.UseSound = SoundID.Item14; + item.channel = false; + } + else + { + item.noUseGraphic = true; + item.reuseDelay = 28; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.channel = true; + return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + } + return base.CanUseItem(player); + } + + public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 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) + { + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + Vector2 gunTip = position + shootDirection * item.scale * 126f; + gunTip.Y -= 6f; + + // Large bullet/rocket releasing. + if (player.altFunctionUse == 2) + { + for (int i = 0; i < 2; i++) + { + 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); + } + } + + // Snipe blast. Done via a held projectile. + else + Projectile.NewProjectile(gunTip, shootVelocity, ModContent.ProjectileType(), 0, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/SurgeDriver.png b/Items/Weapons/Ranged/SurgeDriver.png new file mode 100644 index 0000000000..12d9fe4928 Binary files /dev/null and b/Items/Weapons/Ranged/SurgeDriver.png differ diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index c33f24268b..8945b125ce 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -14,12 +14,12 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Svantechnical"); Tooltip.SetDefault("Fires several barrages of bullets\n" + - "Right click to zoom out"); + "Right click to zoom out"); } public override void SetDefaults() { - item.damage = 720; + item.damage = 150; item.ranged = true; item.width = 60; item.height = 26; @@ -29,14 +29,16 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.5f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; + + 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 = 97; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 6ced351bc1..abdf89fff4 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -11,34 +11,48 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Telluric Glare"); - Tooltip.SetDefault("Shoots an extremely fast energy arrow"); + Tooltip.SetDefault("Fires volleys of four colossal radiant arrows which can pass through walls"); } public override void SetDefaults() { - item.damage = 70; + item.damage = 176; item.ranged = true; item.width = 54; item.height = 92; - item.useTime = 15; - item.useAnimation = 15; + item.useTime = 5; + item.useAnimation = 20; + item.reuseDelay = 23; + item.knockBack = 7.5f; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; - item.knockBack = 4f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.useAmmo = 40; + + 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; + } + + public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + // Always fires Radiant Arrows regardless of ammo used + 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. + Vector2 velocity = new Vector2(speedX, speedY); + Vector2 offset = Vector2.Normalize(velocity.RotatedBy(MathHelper.PiOver2)); + position += offset * Main.rand.NextFloat(-19f, 19f); + position -= 3f * velocity; + return true; } } } diff --git a/Items/Weapons/Ranged/TerraFlameburster.cs b/Items/Weapons/Ranged/TerraFlameburster.cs index fd01f97192..e4e01279e5 100644 --- a/Items/Weapons/Ranged/TerraFlameburster.cs +++ b/Items/Weapons/Ranged/TerraFlameburster.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 3.25f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7.5f; - item.useAmmo = 23; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index e2e2446527..346e55e7e0 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -11,12 +11,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("The Ballista"); - Tooltip.SetDefault("Shoots greatarrows that crush enemy armor and break into shards on death"); + Tooltip.SetDefault("Converts wooden arrows into greatarrows that crush enemy armor and break into shards on death"); } public override void SetDefaults() { - item.damage = 90; + item.damage = 99; item.ranged = true; item.width = 40; item.height = 70; @@ -26,18 +26,23 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 8f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item5; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; - item.useAmmo = 40; - } + 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/TheEmpyrean.cs b/Items/Weapons/Ranged/TheEmpyrean.cs index e0221afb11..f5058c8201 100644 --- a/Items/Weapons/Ranged/TheEmpyrean.cs +++ b/Items/Weapons/Ranged/TheEmpyrean.cs @@ -28,11 +28,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 3.5f; item.UseSound = SoundID.Item34; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 7.5f; - item.useAmmo = 23; + item.shootSpeed = 9f; + item.useAmmo = AmmoID.Gel; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index 96350ccf26..37edee1ae0 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 70; + item.damage = 80; item.ranged = true; item.width = 62; item.height = 30; @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item61; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; - item.useAmmo = 771; + item.useAmmo = AmmoID.Rocket; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs new file mode 100644 index 0000000000..c6e9cd92cc --- /dev/null +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -0,0 +1,49 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class TheJailor : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Jailor"); + Tooltip.SetDefault("Releases electric mines outward that connect to each-other via arcs"); + } + + 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; + } + + public override Vector2? HoldoutOffset() => new Vector2(-40f, -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) + { + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + Vector2 gunTip = position + shootDirection * item.scale * 45f; + + Projectile.NewProjectile(gunTip, shootVelocity, item.shoot, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Ranged/TheJailor.png b/Items/Weapons/Ranged/TheJailor.png new file mode 100644 index 0000000000..fe3c9379ec Binary files /dev/null and b/Items/Weapons/Ranged/TheJailor.png differ diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index 6b4b4744c7..c3e7aa4aba 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 2500; - item.crit += 8; + item.damage = 1000; item.ranged = true; item.width = 96; item.height = 40; @@ -28,24 +27,25 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 7.5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shootSpeed = 24f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = 771; + item.useAmmo = AmmoID.Rocket; + + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + item.Calamity().donorItem = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-40, 0); - } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + + public override Vector2? HoldoutOffset() => new Vector2(-40, 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, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index 105bce9557..21453f6289 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("The Storm"); Tooltip.SetDefault("Fires a spread of arrows from the sky\n" + - "Wooden arrows are converted to lightning bolts"); + "Converts wooden arrows into lightning bolts"); } public override void SetDefaults() { - item.damage = 44; + item.damage = 24; item.ranged = true; item.width = 34; item.height = 50; @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 3.5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item122; + 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 = 40; - item.Calamity().customRarity = CalamityRarity.PureGreen; + 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) @@ -83,21 +83,21 @@ namespace CalamityMod.Items.Weapons.Ranged num80 = num72 / num80; num78 *= num80; num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; - float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; + float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.01f; + float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.01f; if (type == ProjectileID.WoodenArrowFriendly) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, ModContent.ProjectileType(), damage, num74, i); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, ModContent.ProjectileType(), damage, num74, i); } else { - int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i, 0f, 0f); + int num121 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.9f, type, damage, num74, i); Main.projectile[num121].noDropItem = true; - int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i, 0f, 0f); + int num122 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.8f, type, damage, num74, i); Main.projectile[num122].noDropItem = true; - int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i, 0f, 0f); + int num123 = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5 * 0.7f, type, damage, num74, i); Main.projectile[num123].noDropItem = true; } } diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 83d234f9ee..86fb0cd8d0 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Ranged item.autoReuse = true; item.shootSpeed = 6f; item.shoot = ModContent.ProjectileType(); - item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -43,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 velocity = Vector2.Normalize(new Vector2(speedX, speedY)); velocity *= item.shootSpeed; - Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 96f44bd015..d01476ce31 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -12,12 +12,12 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Toxibow"); - Tooltip.SetDefault("Fires slow arrows that occasionally inflict sulfuric poisoning"); + Tooltip.SetDefault("Converts wooden arrows into slow arrows that occasionally inflict sulfuric poisoning"); } public override void SetDefaults() { - item.damage = 8; + item.damage = 9; item.ranged = true; item.width = 20; item.height = 54; @@ -26,20 +26,25 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), - damage, 0f, player.whoAmI, 0f, 0f); - return false; + if (type == ProjectileID.WoodenArrowFriendly) + Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, 0f, player.whoAmI); + else + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + + return false; } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Ranged/Triploon.cs b/Items/Weapons/Ranged/Triploon.cs index ccab6173d2..c867012af2 100644 --- a/Items/Weapons/Ranged/Triploon.cs +++ b/Items/Weapons/Ranged/Triploon.cs @@ -18,22 +18,23 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 75; + item.damage = 70; item.ranged = true; item.width = 46; item.height = 24; - item.useTime = 16; - item.useAnimation = 16; + 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 = 7; + 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() { @@ -52,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged for (int projIndex = 0; projIndex < projCount; projIndex++) { float num120 = projIndex - (projCount - 1f) / 2f; - Vector2 offset = velocity.RotatedBy((double)(piOverTen * num120), default); + Vector2 offset = velocity.RotatedBy(piOverTen * num120); if (!canHit) { offset -= velocity; diff --git a/Items/Weapons/Ranged/TrueConferenceCall.cs b/Items/Weapons/Ranged/TrueConferenceCall.cs index e9aa772f86..b183ce77ed 100644 --- a/Items/Weapons/Ranged/TrueConferenceCall.cs +++ b/Items/Weapons/Ranged/TrueConferenceCall.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 35; + item.damage = 40; item.ranged = true; item.width = 66; item.height = 26; @@ -25,15 +25,15 @@ namespace CalamityMod.Items.Weapons.Ranged item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item38; item.autoReuse = true; - item.shootSpeed = 18f; + item.shootSpeed = 12f; item.shoot = ProjectileID.PurificationPowder; - item.useAmmo = 97; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.useAmmo = AmmoID.Bullet; + item.Calamity().challengeDrop = true; + } public override Vector2? HoldoutOffset() { @@ -42,58 +42,78 @@ 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 bulletAmt = 6; + Vector2 velocity = new Vector2(speedX, speedY); + int bulletAmt = 5; for (int index = 0; index < bulletAmt; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; - int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += 1; - } - 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; - 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; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; + velocity.X += Main.rand.Next(-15, 16) * 0.05f; + velocity.Y += Main.rand.Next(-15, 16) * 0.05f; + int proj = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + Main.projectile[proj].extraUpdates += 2; } - for (int num108 = 0; num108 < bulletAmt; num108++) + int maxTargets = 12; + int[] targets = new int[maxTargets]; + int targetArrayIndex = 0; + Rectangle rectangle = new Rectangle((int)player.Center.X - 960, (int)player.Center.Y - 540, 1920, 1080); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.active && npc.chaseable && npc.lifeMax > 5 && !npc.dontTakeDamage && !npc.friendly && !npc.immortal) + { + if (npc.Hitbox.Intersects(rectangle)) + { + if (targetArrayIndex < maxTargets) + { + targets[targetArrayIndex] = i; + targetArrayIndex++; + } + else + break; + } + } + } + + if (targetArrayIndex == 0) + return false; + + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + int extraBulletDamage = (int)(damage * 0.7); + + for (int j = 0; j < targetArrayIndex; j++) { - 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 -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78 + (float)Main.rand.Next(-15, 16) * 0.01f; - float speedY5 = num79 + (float)Main.rand.Next(-15, 16) * 0.01f; - int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].extraUpdates += 1; + vector2 = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + 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; + + int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft /= 2; } + + if (targetArrayIndex == 12) + return false; + + // Fire bullets at the same targets if 12 unique targets aren't found + for (int k = 0; k < maxTargets - targetArrayIndex; k++) + { + int randomTarget = Main.rand.Next(targetArrayIndex); + + vector2 = new Vector2(player.position.X + player.width * 0.5f + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + 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; + + int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI); + Main.projectile[proj].extraUpdates += 2; + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft /= 2; + } + return false; } } diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index fa56707ae3..60ea879ec3 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -20,8 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 4200; - item.crit += 35; + item.damage = 2250; item.knockBack = 9.5f; item.ranged = true; item.useTime = 55; @@ -33,14 +32,19 @@ namespace CalamityMod.Items.Weapons.Ranged item.width = 94; item.height = 32; - item.useStyle = 5; + item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + item.value = CalamityGlobalItem.Rarity15BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.Calamity().customRarity = CalamityRarity.Violet; + item.Calamity().donorItem = true; + item.Calamity().canFirePointBlankShots = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 35; + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index 4ac1d21e23..4454ddcbbf 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -16,23 +16,21 @@ namespace CalamityMod.Items.Weapons.Ranged { DisplayName.SetDefault("Ultima"); Tooltip.SetDefault("Casts a continuous stream of plasma bolts\n" + - "Over time the bolts are replaced with powerful lasers\n" + - "Bolts power up into solid beams as you continue shooting\n" + - "90% chance to not consume ammo"); + "Over time the bolts are replaced with powerful lasers\n" + + "Bolts power up into solid beams as you continue shooting\n" + + "90% chance to not consume ammo"); } public override void SetDefaults() { - item.damage = 119; + item.damage = 116; item.ranged = true; item.width = 44; item.height = 58; - item.useTime = item.useAnimation = 3; + item.useTime = item.useAnimation = 8; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 2f; - item.value = CalamityGlobalItem.RarityVioletBuyPrice; - item.rare = 10; item.UseSound = SoundID.Item33; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -42,8 +40,11 @@ namespace CalamityMod.Items.Weapons.Ranged item.useTurn = false; item.autoReuse = true; item.noUseGraphic = true; - item.Calamity().customRarity = CalamityRarity.Dedicated; - } + 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) { @@ -61,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Ranged/Vortexpopper.cs b/Items/Weapons/Ranged/Vortexpopper.cs index 18b875c2f6..9d38631c35 100644 --- a/Items/Weapons/Ranged/Vortexpopper.cs +++ b/Items/Weapons/Ranged/Vortexpopper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 22; + item.damage = 30; item.ranged = true; item.width = 46; item.height = 22; @@ -26,12 +26,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 3.25f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item95; item.autoReuse = true; item.shootSpeed = 50f; item.shoot = ProjectileID.Xenopopper; - item.useAmmo = 97; + item.useAmmo = AmmoID.Bullet; } public override Vector2? HoldoutOffset() @@ -68,12 +68,7 @@ namespace CalamityMod.Items.Weapons.Ranged } float ai = new Vector2(num78, num79).ToRotation(); float num96 = 2.09439516f; - int num97 = Main.rand.Next(6, 10); - if (Main.rand.NextBool(4)) - { - num97++; - } - for (int num98 = 0; num98 < num97; num98++) + for (int num98 = 0; num98 < 6; num98++) { float scaleFactor2 = (float)Main.rand.NextDouble() * 0.2f + 0.05f; Vector2 vector6 = new Vector2(num78, num79).RotatedBy((double)(num96 * (float)Main.rand.NextDouble() - num96 / 2f), default) * scaleFactor2; @@ -81,8 +76,7 @@ namespace CalamityMod.Items.Weapons.Ranged Main.projectile[num99].localAI[0] = (float)type; Main.projectile[num99].localAI[1] = 12f; } - int num107 = Main.rand.Next(5, 10); - for (int num108 = 0; num108 < num107; num108++) + for (int num108 = 0; num108 < 6; num108++) { 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(-800, 801); diff --git a/Items/Weapons/Ranged/WulfrumBow.cs b/Items/Weapons/Ranged/WulfrumBow.cs index 0e94240971..0d62042ba2 100644 --- a/Items/Weapons/Ranged/WulfrumBow.cs +++ b/Items/Weapons/Ranged/WulfrumBow.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; -//using TerrariaOverhaul; namespace CalamityMod.Items.Weapons.Ranged { @@ -15,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - item.damage = 10; + item.damage = 11; item.ranged = true; item.width = 27; item.height = 38; @@ -25,18 +24,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item5; item.autoReuse = false; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 12f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ + item.useAmmo = AmmoID.Arrow; + item.Calamity().canFirePointBlankShots = true; + } public override void AddRecipes() { diff --git a/Items/Weapons/Ranged/WulfrumBow.png b/Items/Weapons/Ranged/WulfrumBow.png index ad309cc5e0..c935117185 100644 Binary files a/Items/Weapons/Ranged/WulfrumBow.png and b/Items/Weapons/Ranged/WulfrumBow.png differ diff --git a/Items/Weapons/Rogue/AccretionDisk.cs b/Items/Weapons/Rogue/AccretionDisk.cs index b9852d9422..ecb0466b2b 100644 --- a/Items/Weapons/Rogue/AccretionDisk.cs +++ b/Items/Weapons/Rogue/AccretionDisk.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,13 +12,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Elemental Disk"); - Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it"); + Tooltip.SetDefault("Throws a disk that has a chance to generate several disks if enemies are near it\n" + + "Stealth strikes fly slower but travel farther, pierce through enemies, and spawn extra disks more frequently"); } public override void SafeSetDefaults() { item.width = 38; - item.damage = 157; + item.damage = 100; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -28,20 +29,29 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 9f; item.UseSound = SoundID.Item1; item.height = 38; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 13f; 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) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; + if (player.Calamity().StealthStrikeAvailable()) + { + speedX *= 0.7f; + speedY *= 0.7f; + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].timeLeft *= 3; + Main.projectile[proj].localNPCHitCooldown *= 2; + } + return false; + } + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/AcidicRainBarrel.cs b/Items/Weapons/Rogue/AcidicRainBarrel.cs index 37b7463dcd..4c5f0ff8bd 100644 --- a/Items/Weapons/Rogue/AcidicRainBarrel.cs +++ b/Items/Weapons/Rogue/AcidicRainBarrel.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; item.Calamity().rogue = true; @@ -41,7 +41,8 @@ namespace CalamityMod.Items.Weapons.Rogue Vector2 initialVelocity = new Vector2(speedX, speedY); int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockBack, player.whoAmI); - Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs index 771fcdcee7..79cc9e9d75 100644 --- a/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs +++ b/Items/Weapons/Rogue/AdamantiteThrowingAxe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 30; item.maxStack = 999; item.value = 1600; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -39,9 +39,12 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + } return false; } return true; diff --git a/Items/Weapons/Rogue/AlphaVirus.cs b/Items/Weapons/Rogue/AlphaVirus.cs index fcb64f6b27..163e5e6fa7 100644 --- a/Items/Weapons/Rogue/AlphaVirus.cs +++ b/Items/Weapons/Rogue/AlphaVirus.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { + item.damage = 333; item.width = 44; - item.damage = 400; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 31; @@ -30,11 +30,11 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 44; item.maxStack = 1; - item.value = Item.buyPrice(0, 16, 0, 0); + item.value = CalamityGlobalItem.Rarity12BuyPrice; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 4f; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; item.Calamity().rogue = true; } @@ -43,7 +43,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, item.shootSpeed, 0f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index aa832fd900..edfd680d6f 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -28,11 +28,10 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 64; item.useTime = 24; item.useAnimation = 24; - item.useStyle = 1; + item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 10f; - item.crit = 20; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item1; item.noMelee = true; item.noUseGraphic = true; @@ -40,13 +39,17 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; @@ -65,8 +68,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(item.width / 2f, item.height / 2f - 2f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ApoctolithGlow")); } } } diff --git a/Items/Weapons/Rogue/AshenStalactite.cs b/Items/Weapons/Rogue/AshenStalactite.cs index e7ddae13ff..cad05a800f 100644 --- a/Items/Weapons/Rogue/AshenStalactite.cs +++ b/Items/Weapons/Rogue/AshenStalactite.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.maxStack = 1; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().rogue = true; @@ -45,7 +45,8 @@ namespace CalamityMod.Items.Weapons.Rogue float stealthDamageMult = 1.15f; float stealthKnockbackMult = 2.5f; int p = Projectile.NewProjectile(position.X, position.Y, speedX * stealthSpeedMult, speedY * stealthSpeedMult, stealthType, (int)(damage * stealthDamageMult), (int)(knockBack * stealthKnockbackMult), player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index 93098fceea..10c429bc35 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Items.Weapons.Rogue item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 30; - item.useStyle = 1; + 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 = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; @@ -39,16 +39,15 @@ 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) { - int star = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[star].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int star = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (star.WithinBounds(Main.maxProjectiles)) + Main.projectile[star].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Texture2D glowmask = Main.itemTexture[item.type]; - Vector2 origin = new Vector2(glowmask.Width / 2f, glowmask.Height / 2f - 2f); - spriteBatch.Draw(glowmask, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Main.itemTexture[item.type]); } } } diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index 45d20c00b4..16e6c9fc34 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 38; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -45,8 +46,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, perturbedspeed, type, Math.Max(damage / 3, 1), knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; spread -= Main.rand.Next(2,6); } return false; diff --git a/Items/Weapons/Rogue/BlastBarrel.cs b/Items/Weapons/Rogue/BlastBarrel.cs index 38c339e34b..22e0d7b90f 100644 --- a/Items/Weapons/Rogue/BlastBarrel.cs +++ b/Items/Weapons/Rogue/BlastBarrel.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 12, 0, 0); //2 gold 40 silver sellprice - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Rogue //unitY additive is do it doesn't exploe initially int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type, damage, knockBack, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; } diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 43c7d1e52f..95f4522aee 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.damage = 92; - item.crit = 4; item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; @@ -31,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item1; item.maxStack = 3; @@ -39,6 +38,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + 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()) @@ -48,11 +50,16 @@ namespace CalamityMod.Items.Weapons.Rogue 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))); - Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f, 0f).Calamity().stealthStrike = true; + Projectile proj = Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + if (proj.whoAmI.WithinBounds(Main.maxProjectiles)) + proj.Calamity().stealthStrike = true; - Projectile projectile = Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f); - projectile.penetrate = -1; - projectile.Calamity().stealthStrike = true; + Projectile projectile = Projectile.NewProjectileDirect(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + if (projectile.whoAmI.WithinBounds(Main.maxProjectiles)) + { + projectile.penetrate = -1; + projectile.Calamity().stealthStrike = true; + } } return false; diff --git a/Items/Weapons/Rogue/BloodsoakedCrasher.cs b/Items/Weapons/Rogue/BloodsoakedCrasher.cs index 55c542f890..fbfc79c7d6 100644 --- a/Items/Weapons/Rogue/BloodsoakedCrasher.cs +++ b/Items/Weapons/Rogue/BloodsoakedCrasher.cs @@ -7,8 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class BloodsoakedCrasher : RogueWeapon //This weapon has been coded by Ben || Termi - { + public class BloodsoakedCrasher : RogueWeapon //This weapon has been coded by Ben || Termi + { public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodsoaked Crasher"); @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 300; + item.damage = 245; item.knockBack = 3f; item.autoReuse = true; item.Calamity().rogue = true; - item.useAnimation = item.useTime = 18; - item.shootSpeed = 15f; + item.useAnimation = item.useTime = 24; + item.shootSpeed = 9f; item.shoot = ModContent.ProjectileType(); item.width = 66; @@ -33,21 +33,22 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; + 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) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); //setting the stealth strike + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } public override void AddRecipes() { - ModRecipe recipe = new ModRecipe(mod); //post-Prov rogue weapon + ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 12); recipe.AddTile(TileID.LunarCraftingStation); diff --git a/Items/Weapons/Rogue/BouncingBetty.cs b/Items/Weapons/Rogue/BouncingBetty.cs index 3972c1f479..8a2cae0daf 100644 --- a/Items/Weapons/Rogue/BouncingBetty.cs +++ b/Items/Weapons/Rogue/BouncingBetty.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 22; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 4, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Vector2 velocity = new Vector2(speedX, speedY); int projectileIndex = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().stealthStrike = true; } diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index a38e49554a..e4842ad5af 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.useAnimation = 23; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 3.5f; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.buyPrice(0, 2, 0, 0); item.Calamity().rogue = true; item.noUseGraphic = true; @@ -46,7 +46,8 @@ namespace CalamityMod.Items.Weapons.Rogue { initialVelocity *= 2f; int p = Projectile.NewProjectile(position, initialVelocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; } else { diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index e7ea6bde8c..75b0f0789e 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -32,7 +32,7 @@ Stealth strikes provide a bigger boost after richocheting"); item.maxStack = 999; item.height = 14; item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.Calamity().rogue = true; @@ -42,8 +42,9 @@ Stealth strikes provide a bigger boost after richocheting"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/BrackishFlask.cs b/Items/Weapons/Rogue/BrackishFlask.cs index 1f63de6c31..cce83ac787 100644 --- a/Items/Weapons/Rogue/BrackishFlask.cs +++ b/Items/Weapons/Rogue/BrackishFlask.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 30; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -39,8 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/Brimblade.cs b/Items/Weapons/Rogue/Brimblade.cs index 07aa7437e5..2ee7a022f4 100644 --- a/Items/Weapons/Rogue/Brimblade.cs +++ b/Items/Weapons/Rogue/Brimblade.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.height = 26; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -41,14 +41,16 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int blade = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[blade].Calamity().stealthStrike = true; + int blade = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (blade.WithinBounds(Main.maxProjectiles)) + Main.projectile[blade].Calamity().stealthStrike = true; for (int i = -6; i <= 6; i += 4) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI, 0f, 0f); - Main.projectile[dart].Calamity().forceRogue = true; + int dart = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack * 0.5f, player.whoAmI); + if (dart.WithinBounds(Main.maxProjectiles)) + Main.projectile[dart].Calamity().forceRogue = true; } return false; } diff --git a/Items/Weapons/Rogue/BurningStrife.cs b/Items/Weapons/Rogue/BurningStrife.cs index b74e338755..29b15827e6 100644 --- a/Items/Weapons/Rogue/BurningStrife.cs +++ b/Items/Weapons/Rogue/BurningStrife.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.useStyle = ItemUseStyleID.SwingThrow; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.autoReuse = true; item.noUseGraphic = true; item.noMelee = true; @@ -31,13 +31,15 @@ namespace CalamityMod.Items.Weapons.Rogue item.useAnimation = 25; item.useTime = 25; item.damage = 80; - item.crit = 8; item.shootSpeed = 8f; item.shoot = ModContent.ProjectileType(); item.Calamity().rogue = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + 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 speedMult = 1f; @@ -45,8 +47,8 @@ namespace CalamityMod.Items.Weapons.Rogue { speedMult = 1.25f; } - int proj = Projectile.NewProjectile(position, new Vector2(speedX * speedMult, speedY * speedMult), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - if (player.Calamity().StealthStrikeAvailable()) + int proj = Projectile.NewProjectile(position, new Vector2(speedX * speedMult, speedY * speedMult), type, damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; Main.projectile[proj].penetrate = 5; diff --git a/Items/Weapons/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index c856f46b9b..ad21a8f0b4 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -8,7 +8,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CelestialReaper : RogueWeapon { - public const int BaseDamage = 120; + public const int BaseDamage = 140; + public override void SetStaticDefaults() { DisplayName.SetDefault("Celestial Reaper"); @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 6f; - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item71; item.autoReuse = true; item.value = Item.buyPrice(platinum: 1); //sell price of 20 gold @@ -36,12 +37,17 @@ namespace CalamityMod.Items.Weapons.Rogue 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) { + bool usingStealth = player.Calamity().StealthStrikeAvailable(); + float strikeValue = usingStealth.ToInt(); //0 if false, 1 if true + Vector2 velocity = new Vector2(speedX, speedY); - float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true - int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, strikeValue); - if (player.Calamity().StealthStrikeAvailable()) + // Directly nerf stealth strikes by 10%, but only stealth strikes. + int finalDamage = (int)(damage * (usingStealth ? 0.9f : 1.0f)); + int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), finalDamage, knockBack, player.whoAmI, strikeValue); + if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; } diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 16f99eb217..8fcae4a0c3 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 1130; + item.damage = 240; item.knockBack = 6f; - item.useAnimation = item.useTime = 20; + item.useAnimation = item.useTime = 22; item.Calamity().rogue = true; item.autoReuse = true; item.shootSpeed = 25f; @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noMelee = true; item.noUseGraphic = true; item.value = Item.buyPrice(platinum: 2, gold: 50); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.Violet; } @@ -41,8 +41,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * 0.4), knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } return true; } diff --git a/Items/Weapons/Rogue/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index 94dde06ab3..502a3e6f14 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -21,9 +21,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.damage = BaseDamage; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.knockBack = Knockback; - item.crit = 8; item.autoReuse = true; item.useTime = 15; item.useAnimation = 15; @@ -39,12 +38,16 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + 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, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/CobaltKunai.cs b/Items/Weapons/Rogue/CobaltKunai.cs index ce7d94d42c..ceb5c94eda 100644 --- a/Items/Weapons/Rogue/CobaltKunai.cs +++ b/Items/Weapons/Rogue/CobaltKunai.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 40; item.maxStack = 999; item.value = 900; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = -6; i <= 6; i += 6) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } return false; } diff --git a/Items/Weapons/Rogue/CobaltKunai.png b/Items/Weapons/Rogue/CobaltKunai.png index 01aeb2d044..554ff1471f 100644 Binary files a/Items/Weapons/Rogue/CobaltKunai.png and b/Items/Weapons/Rogue/CobaltKunai.png differ diff --git a/Items/Weapons/Rogue/ConsecratedWater.cs b/Items/Weapons/Rogue/ConsecratedWater.cs index 4a6cabf8ee..c00482d590 100644 --- a/Items/Weapons/Rogue/ConsecratedWater.cs +++ b/Items/Weapons/Rogue/ConsecratedWater.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Items.Weapons.Rogue public class ConsecratedWater : RogueWeapon { public const int BaseDamage = 48; + public override void SetStaticDefaults() { DisplayName.SetDefault("Consecrated Water"); @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.5f; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item106; item.autoReuse = true; item.value = Item.buyPrice(gold: 48); //sell price of 9 gold 60 silver @@ -37,21 +38,23 @@ namespace CalamityMod.Items.Weapons.Rogue 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) { Vector2 velocity = new Vector2(speedX, speedY); float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, ai1: strikeValue); - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HolyWater, 100); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.CrystalShard, 20); + recipe.AddRecipeGroup("AnyAdamantiteBar", 5); + recipe.AddIngredient(ItemID.CrystalShard, 20); recipe.AddIngredient(ItemID.SoulofLight, 7); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); diff --git a/Items/Weapons/Rogue/ContaminatedBile.cs b/Items/Weapons/Rogue/ContaminatedBile.cs index 72e58d750e..48ffaac962 100644 --- a/Items/Weapons/Rogue/ContaminatedBile.cs +++ b/Items/Weapons/Rogue/ContaminatedBile.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.5f; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.buyPrice(0, 2, 0, 0); item.UseSound = SoundID.Item106; item.autoReuse = true; @@ -37,7 +37,8 @@ namespace CalamityMod.Items.Weapons.Rogue { Vector2 velocity = new Vector2(speedX, speedY); int p = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); - Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 5429079bfc..ff44328602 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,14 +13,17 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Corpus Avertor"); Tooltip.SetDefault("Seems like it has worn down over time\n" + "Attacks grant lifesteal based on damage dealt\n" + - "The lower your HP the more damage this weapon does and heals the player on enemy hits"); + "The lower your HP the more damage this weapon does and heals the player on enemy hits\n" + + "Stealth strikes throw a single rainbow outlined dagger\n" + + "On enemy hits, this dagger boosts the damage and life regen of all members of your team\n" + + "However, there is a small chance it will cut your health in half instead"); } public override void SafeSetDefaults() { item.width = 18; item.height = 32; - item.damage = 140; + item.damage = 98; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 15; @@ -29,26 +32,31 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 3f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; + item.value = Item.buyPrice(gold: 80); + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; item.Calamity().rogue = true; } - // Gains 20% of missing health as base damage. - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + // Gains 10% of missing health as base damage. + public override void SafeModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { int lifeAmount = player.statLifeMax2 - player.statLife; - flat += lifeAmount * 0.2f * player.RogueDamage(); + flat += lifeAmount * 0.1f * player.RogueDamage(); } 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 dagger = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[dagger].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; + if (player.Calamity().StealthStrikeAvailable()) + { + int dagger = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage * 2, knockBack * 2f, player.whoAmI); + if (dagger.WithinBounds(Main.maxProjectiles)) + Main.projectile[dagger].Calamity().stealthStrike = true; + return false; + } + return true; } } } diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index d1bf2b054d..59dd4e0c13 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CosmicKunai : RogueWeapon { + private int counter = 0; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Kunai"); @@ -18,29 +20,31 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 26; - item.damage = 150; + item.damage = 114; 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 = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + 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.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 stealth = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 10) + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 10 && counter == 0 && stealth.WithinBounds(Main.maxProjectiles)) { + damage = (int)(damage * 3.21); Main.projectile[stealth].Calamity().stealthStrike = true; Main.PlaySound(SoundID.Item73, player.position); for (float i = 0; i < 5; i++) @@ -49,6 +53,10 @@ namespace CalamityMod.Items.Weapons.Rogue Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType(), (int)(damage * 0.8f), knockBack, player.whoAmI, angle, 0f); } } + + counter++; + 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 2a1e7a4ca2..d6c294e09f 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 4f; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; @@ -50,8 +50,9 @@ namespace CalamityMod.Items.Weapons.Rogue { type = ModContent.ProjectileType(); } - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index d1adf9c3dd..633409e307 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 22; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11f; item.Calamity().rogue = true; @@ -42,10 +43,13 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < 5; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 10; + int proj = Projectile.NewProjectile(position, perturbedspeed, type, Math.Max(damage / 5, 1), knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 10; + } spread -= Main.rand.Next(1,4); } return false; diff --git a/Items/Weapons/Rogue/CrystalPiercer.cs b/Items/Weapons/Rogue/CrystalPiercer.cs index f27d2da7f3..09e0b2b8e8 100644 --- a/Items/Weapons/Rogue/CrystalPiercer.cs +++ b/Items/Weapons/Rogue/CrystalPiercer.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 62; item.maxStack = 999; item.value = 2500; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; @@ -42,11 +42,14 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].aiStyle = -1; - Main.projectile[stealth].tileCollide = false; - Main.projectile[stealth].usesLocalNPCImmunity = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].aiStyle = -1; + Main.projectile[stealth].tileCollide = false; + Main.projectile[stealth].usesLocalNPCImmunity = true; + } return false; } return true; diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index 675602ca33..0db18b60e3 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Crystalline"); - Tooltip.SetDefault("Splits into several projectiles as it travels \n" + + Tooltip.SetDefault("Splits into several projectiles as it travels\n" + "Stealth strikes make the blade split more and create crystals when destroyed"); } @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 44; item.damage = 16; - item.crit += 4; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 18; @@ -30,12 +29,15 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 44; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -51,8 +53,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/CursedDagger.cs b/Items/Weapons/Rogue/CursedDagger.cs index 9cee3f0275..36bb27c842 100644 --- a/Items/Weapons/Rogue/CursedDagger.cs +++ b/Items/Weapons/Rogue/CursedDagger.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 34; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -39,9 +39,12 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + } return false; } return true; diff --git a/Items/Weapons/Rogue/CursedDagger.png b/Items/Weapons/Rogue/CursedDagger.png index 9a81c1fccc..d4da0bab1d 100644 Binary files a/Items/Weapons/Rogue/CursedDagger.png and b/Items/Weapons/Rogue/CursedDagger.png differ diff --git a/Items/Weapons/Rogue/DeepSeaDumbbell.cs b/Items/Weapons/Rogue/DeepSeaDumbbell.cs index 5beb803159..652f1c21c7 100644 --- a/Items/Weapons/Rogue/DeepSeaDumbbell.cs +++ b/Items/Weapons/Rogue/DeepSeaDumbbell.cs @@ -8,53 +8,47 @@ namespace CalamityMod.Items.Weapons.Rogue { public class DeepSeaDumbbell : RogueWeapon { - private static int BaseDamage = 900; - private static float MeleeFlexMult = 25f; - private float flexBonusDamageMult = 0f; + private const float FlexMultMax = 5f; + private float flexMult = 1f; public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Sea Dumbbell"); Tooltip.SetDefault("Throws a dumbbell that bounces and flings weights with each bounce\n" + - "Right click to flex with it, increasing the power of your next throw with a stealth strike\n" + - "Can boost the projectile damage up to 7.5 times its original damage"); + "Right click to flex, increasing the damage of your next attack up to 5 times damage\n" + + "Flexes can hit enemies directly"); } public override void SafeSetDefaults() { item.width = 38; - item.damage = BaseDamage; - item.crit -= 2; + item.height = 24; + item.damage = 466; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 25; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 25; - item.knockBack = 16f; + item.useAnimation = 25; + item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.useTurn = false; - item.height = 24; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.Calamity().donorItem = true; } - public override bool AltFunctionUse(Player player) - { - return true; - } + public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) { item.useStyle = ItemUseStyleID.HoldingUp; - item.useAnimation = 45; - item.useTime = 45; item.noMelee = false; item.noUseGraphic = false; item.autoReuse = false; @@ -63,8 +57,6 @@ namespace CalamityMod.Items.Weapons.Rogue else { item.useStyle = ItemUseStyleID.SwingThrow; - item.useAnimation = 25; - item.useTime = 25; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -73,42 +65,36 @@ namespace CalamityMod.Items.Weapons.Rogue return base.CanUseItem(player); } - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + public override float SafeSetUseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 5f / 9f : 1f; + + public override void SafeModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { - if (player.Calamity().StealthStrikeAvailable() && player.altFunctionUse != 2) - mult += flexBonusDamageMult; - base.ModifyWeaponDamage(player, ref add, ref mult, ref flat); + mult += flexMult - 1f; } - // Flexes deal 25x damage if you actually hit with them directly. - public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) - { - damage = (int)(damage * MeleeFlexMult); - } - - public override void ModifyHitPvp(Player player, Player target, ref int damage, ref bool crit) - { - damage = (int)(damage * MeleeFlexMult); - } + // Reset flex multiplier on direct hits. + public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) => flexMult = 1f; + public override void OnHitPvp(Player player, Player target, int damage, bool crit) => flexMult = 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) { - // Alt fire doesn't actually shoot anything. It flexes, increasing the damage of the next stealth strike + // Alt fire doesn't actually shoot anything. It flexes, increasing the damage of the next attack. if (player.altFunctionUse == 2) { - flexBonusDamageMult += 1f; - if (flexBonusDamageMult > 6.5f) - flexBonusDamageMult = 6.5f; + flexMult = MathHelper.Clamp(flexMult + 1f, 1f, FlexMultMax); return false; } - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); if (player.Calamity().StealthStrikeAvailable()) - { + damage = (int)(damage * 1.3); + + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; - flexBonusDamageMult = 0f; - } + + // Reset flex damage on any throw, stealth strike or not. + flexMult = 1f; return false; } } diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 75e9dbdf5c..65d337a302 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 48; item.maxStack = 1; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.value = Item.buyPrice(0, 60, 0, 0); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; @@ -45,8 +45,9 @@ namespace CalamityMod.Items.Weapons.Rogue velocity.Normalize(); velocity *= item.shootSpeed * stealthSpeedMult; - int p = Projectile.NewProjectile(position.X, position.Y, velocity.X, velocity.Y, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI, 0f, 1f); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 57524c28af..b85c1dfc67 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -36,7 +36,7 @@ Stealth strikes launch all 4 sphere types at once"); item.UseSound = SoundID.Item15; //phaseblade sound effect item.value = Item.buyPrice(0, 16, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.Calamity().rogue = true; item.shoot = ProjectileType(); @@ -83,14 +83,18 @@ Stealth strikes launch all 4 sphere types at once"); if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); - int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); - int stealth3 = Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); - int stealth4 = Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, ProjectileType(), damage / 2, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth2].Calamity().stealthStrike = true; - Main.projectile[stealth3].Calamity().stealthStrike = true; - Main.projectile[stealth4].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage / 2, knockBack, player.whoAmI); + int stealth2 = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, ProjectileType(), damage / 2, knockBack, player.whoAmI); + int stealth3 = Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, ProjectileType(), damage / 2, knockBack, player.whoAmI); + int stealth4 = Projectile.NewProjectile(position.X, position.Y, SpeedX4, SpeedY4, ProjectileType(), damage / 2, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth2.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth2].Calamity().stealthStrike = true; + if (stealth3.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth3].Calamity().stealthStrike = true; + if (stealth4.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth4].Calamity().stealthStrike = true; } else { diff --git a/Items/Weapons/Rogue/DeificThunderbolt.cs b/Items/Weapons/Rogue/DeificThunderbolt.cs index 4647493c50..3f97e89f68 100644 --- a/Items/Weapons/Rogue/DeificThunderbolt.cs +++ b/Items/Weapons/Rogue/DeificThunderbolt.cs @@ -20,9 +20,8 @@ Stealth strikes summon more lightning and travel faster"); public override void SafeSetDefaults() { - item.damage = 567; + item.damage = 457; item.knockBack = 10f; - item.crit += 12; item.width = 56; item.height = 56; @@ -30,11 +29,11 @@ Stealth strikes summon more lightning and travel faster"); item.noMelee = true; item.noUseGraphic = true; - item.value = Item.buyPrice(1, 40, 0, 0); item.useTime = 21; item.useAnimation = 21; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; //13 + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; item.Calamity().rogue = true; item.autoReuse = true; @@ -42,20 +41,23 @@ Stealth strikes summon more lightning and travel faster"); item.shoot = ModContent.ProjectileType(); } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 12; + 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 stealthSpeedMult = 1f; - if (player.Calamity().StealthStrikeAvailable()) - stealthSpeedMult = 1.5f; - float rainSpeedMult = 1f; - if (Main.raining) - rainSpeedMult = 1.5f; + float stealthSpeedMult = 1f; + if (player.Calamity().StealthStrikeAvailable()) + stealthSpeedMult = 1.5f; + float rainSpeedMult = 1f; + if (Main.raining) + rainSpeedMult = 1.5f; - int thunder = Projectile.NewProjectile(position.X, position.Y, speedX * rainSpeedMult * stealthSpeedMult, speedY * rainSpeedMult * stealthSpeedMult, type, damage, knockBack, player.whoAmI, 0f, 0f); - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - Main.projectile[thunder].Calamity().stealthStrike = true; - } + int thunder = Projectile.NewProjectile(position.X, position.Y, speedX * rainSpeedMult * stealthSpeedMult, speedY * rainSpeedMult * stealthSpeedMult, type, damage, knockBack, player.whoAmI, 0f, 0f); + if (player.Calamity().StealthStrikeAvailable() && thunder.WithinBounds(Main.maxProjectiles)) //setting the stealth strike + { + Main.projectile[thunder].Calamity().stealthStrike = true; + } return false; } diff --git a/Items/Weapons/Rogue/DesecratedWater.cs b/Items/Weapons/Rogue/DesecratedWater.cs index fb8ef41490..7835964f59 100644 --- a/Items/Weapons/Rogue/DesecratedWater.cs +++ b/Items/Weapons/Rogue/DesecratedWater.cs @@ -27,7 +27,7 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.5f; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item106; item.autoReuse = true; item.value = Item.buyPrice(gold: 48); //sell price of 9 gold 60 silver @@ -40,8 +40,9 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; @@ -51,7 +52,7 @@ Stealth strikes spawn additional bubbles that inflict Ichor and Cursed Inferno") { ModRecipe recipe = new ModRecipe(mod); recipe.AddRecipeGroup("AnyEvilWater", 100); - recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddRecipeGroup("AnyAdamantiteBar", 5); recipe.AddRecipeGroup("CursedFlameIchor", 5); recipe.AddIngredient(ItemID.SoulofNight, 7); recipe.AddTile(TileID.MythrilAnvil); diff --git a/Items/Weapons/Rogue/DukesDecapitator.cs b/Items/Weapons/Rogue/DukesDecapitator.cs index ce7038a314..632515a33c 100644 --- a/Items/Weapons/Rogue/DukesDecapitator.cs +++ b/Items/Weapons/Rogue/DukesDecapitator.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { @@ -29,10 +30,18 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 2f; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (Main.projectile.IndexInRange(proj)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } } } diff --git a/Items/Weapons/Rogue/DuneHopper.cs b/Items/Weapons/Rogue/DuneHopper.cs index 9c44f3eb67..56e7f373ca 100644 --- a/Items/Weapons/Rogue/DuneHopper.cs +++ b/Items/Weapons/Rogue/DuneHopper.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,13 +29,13 @@ Stealth strikes throw three high speed spears"); item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 44; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.value = CalamityGlobalItem.Rarity2BuyPrice; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = 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) { @@ -45,7 +46,9 @@ Stealth strikes throw three high speed spears"); for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = new Vector2(speedX - 3f, speedY - 3f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(position, perturbedSpeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } return false; } diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index a01a81e3f0..d09e22f919 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 24; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -40,8 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 8afad26224..39f4604d36 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -20,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 1060; + item.damage = 564; item.knockBack = 3.5f; item.useAnimation = item.useTime = 21; item.autoReuse = true; @@ -33,19 +32,19 @@ namespace CalamityMod.Items.Weapons.Rogue item.noMelee = true; item.noUseGraphic = true; item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Violet; + 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) { if (player.Calamity().StealthStrikeAvailable()) - { type = ModContent.ProjectileType(); - } + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } @@ -55,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs deleted file mode 100644 index 518361349f..0000000000 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ /dev/null @@ -1,114 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class EmpyreanKnivesThrown : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Empyrean Knives"); - Tooltip.SetDefault("Throws a flurry of bouncing knives that can heal the user"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 520; - 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 = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - 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) - { - 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; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - 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; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.NextBool(2)) - { - num146++; - } - if (Main.rand.NextBool(4)) - { - num146++; - } - if (Main.rand.NextBool(8)) - { - num146++; - } - if (Main.rand.NextBool(16)) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-25, 26) * num150; - num149 += (float)Main.rand.Next(-25, 26) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.VampireKnives); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 999); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.png b/Items/Weapons/Rogue/EmpyreanKnivesThrown.png deleted file mode 100644 index 23985d4fdc..0000000000 Binary files a/Items/Weapons/Rogue/EmpyreanKnivesThrown.png and /dev/null differ diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index f5f217b07c..c46532259c 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 36; item.maxStack = 1; item.value = 1000; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.buyPrice(0, 4, 0, 0); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; @@ -44,7 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/EpidemicShredder.cs b/Items/Weapons/Rogue/EpidemicShredder.cs index 220cb62a14..04a7efacc8 100644 --- a/Items/Weapons/Rogue/EpidemicShredder.cs +++ b/Items/Weapons/Rogue/EpidemicShredder.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Epidemic Shredder"); Tooltip.SetDefault("Contrary to its name, it will probably cause an epidemic if used incorrectly\n" + "Throws a plagued boomerang that releases plague seekers when it hits tiles or enemies\n" + - "Stealth strikes cause the boomerang release plague seekers constantly as it travels"); + "Stealth strikes cause the boomerang to release plague seekers constantly as it travels"); } public override void SafeSetDefaults() @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 4.5f; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; item.Calamity().rogue = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Rogue Vector2 velocity = new Vector2(speedX, speedY); float strikeValue = player.Calamity().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true int projectileIndex = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, ai1: strikeValue); - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && projectileIndex.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectileIndex].Calamity().stealthStrike = strikeValue == 1f; } diff --git a/Items/Weapons/Rogue/Equanimity.cs b/Items/Weapons/Rogue/Equanimity.cs index 1edee00726..4f6c06c010 100644 --- a/Items/Weapons/Rogue/Equanimity.cs +++ b/Items/Weapons/Rogue/Equanimity.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 36; item.maxStack = 1; - item.rare = 5; - item.value = Item.buyPrice(0, 4, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 5d89e84644..b38ffc38fe 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,45 +9,50 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Eradicator : RogueWeapon { + public static float Speed = 10.5f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eradicator"); - Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies"); + Tooltip.SetDefault("Throws a disk that fires lasers at nearby enemies\n" + + "Stealth strikes stick to enemies and unleash a barrage of lasers in all directions"); } public override void SafeSetDefaults() { item.width = 38; - item.damage = 300; + item.damage = 685; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useAnimation = 19; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 19; + item.useTime = 33; + item.useAnimation = 33; item.knockBack = 7f; item.UseSound = SoundID.Item1; item.height = 54; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = Speed; item.Calamity().rogue = true; - 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) { + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 0.25f); + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/EradicatorGlow")); } } } diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 3249a74251..050935ff19 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ExecutionersBlade : RogueWeapon { + private int counter = 0; + public override void SetStaticDefaults() { DisplayName.SetDefault("Executioner's Blade"); @@ -20,18 +22,19 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 64; - item.damage = 420; + 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 = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 26f; item.Calamity().rogue = true; @@ -40,15 +43,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(32f, 30f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ExecutionersBladeGlow")); } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 11); - recipe.AddRecipeGroup("NForEE", 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); @@ -56,13 +57,18 @@ 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()) - { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + bool usingStealth = player.Calamity().StealthStrikeAvailable() && counter == 0; + if (usingStealth) + damage = (int)(damage * 3.61); + + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (usingStealth && stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; + + counter++; + 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 f5e8a70cdc..641dd164e2 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 42; item.maxStack = 1; - item.rare = 5; - item.value = Item.buyPrice(0, 16, 0, 0); + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 2f, damage); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; } else { @@ -55,8 +56,10 @@ namespace CalamityMod.Items.Weapons.Rogue { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.HallowedBar, 12); - recipe.AddIngredient(ItemID.SoulofSight, 20); - recipe.AddIngredient(ItemID.HolyWater, 10); + recipe.AddIngredient(ItemID.SoulofMight, 6); + recipe.AddIngredient(ItemID.SoulofSight, 6); + recipe.AddIngredient(ItemID.SoulofFright, 6); + recipe.AddIngredient(ItemID.HolyWater, 10); recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this, 1); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index 22df27c2bb..200cbbc478 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -33,7 +33,7 @@ Stealth strikes release more souls and leave behind souls as they travel"); item.height = 62; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 60, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; item.Calamity().rogue = true; @@ -43,8 +43,9 @@ Stealth strikes release more souls and leave behind souls as they travel"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/FeatherKnife.cs b/Items/Weapons/Rogue/FeatherKnife.cs index ae706ef4a0..f5b7503340 100644 --- a/Items/Weapons/Rogue/FeatherKnife.cs +++ b/Items/Weapons/Rogue/FeatherKnife.cs @@ -31,11 +31,12 @@ Stealth strike throws a volley of knives"); item.autoReuse = true; item.height = 32; item.maxStack = 999; - item.value = 300; - item.rare = 3; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; item.Calamity().rogue = true; + + item.value = Item.sellPrice(copper: 60); + item.rare = ItemRarityID.Orange; } public override void AddRecipes() @@ -55,8 +56,12 @@ Stealth strike throws a volley of knives"); for (int i = 0; i < 5; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3, 4), speedY + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].noDropItem = true; + } spread -= Main.rand.Next(2, 6); } return false; diff --git a/Items/Weapons/Rogue/FinalDawn.cs b/Items/Weapons/Rogue/FinalDawn.cs index 15c1c17a54..e8f4f344ce 100644 --- a/Items/Weapons/Rogue/FinalDawn.cs +++ b/Items/Weapons/Rogue/FinalDawn.cs @@ -11,14 +11,15 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("The Final Dawn"); Tooltip.SetDefault("We shall ride into the sunrise once more\n" + - "Attack enemies with a giant scythe swing to replenish stealth\n" + - "Press up and attack to throw the scythe \n" + - "Stealth strikes perform a horizontal swing that leaves a lingering fire aura\n" + - "Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge"); + "Attack enemies with a giant scythe swing to replenish stealth\n" + + "Press up and attack to throw the scythe \n" + + "Stealth strikes perform a horizontal swing that leaves a lingering fire aura\n" + + "Stealth strikes performed while pressing up fling yourself at the enemy and slice through them, causing homing fireballs to emerge"); } + public override void SafeSetDefaults() { - item.damage = 5000; + item.damage = 1500; item.Calamity().rogue = true; item.width = 78; item.height = 66; @@ -26,20 +27,23 @@ namespace CalamityMod.Items.Weapons.Rogue item.useTime = item.useAnimation = 15; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + + 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.channel = true; item.noUseGraphic = true; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] <= 0; - } + } } \ No newline at end of file diff --git a/Items/Weapons/Rogue/FlameScythe.cs b/Items/Weapons/Rogue/FlameScythe.cs index d301f2742d..ee85b8edcd 100644 --- a/Items/Weapons/Rogue/FlameScythe.cs +++ b/Items/Weapons/Rogue/FlameScythe.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,29 +7,30 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class FlameScythe : RogueWeapon + public class FlameScythe : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Subduction Slicer"); - Tooltip.SetDefault("Throws a scythe that explodes on enemy hits"); + Tooltip.SetDefault("Throws a scythe that explodes on enemy hits\n" + + "Stealth strikes also summon an orange pillar of fire on enemy hits"); } public override void SafeSetDefaults() { item.width = 50; - item.height = 48; + item.height = 48; item.damage = 90; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; - item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 20; + 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 = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -38,8 +39,8 @@ 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) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index bd9f0a5943..02f6fa661a 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,9 +25,8 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl item.damage = 100; item.knockBack = 12; item.thrown = true; - item.crit = 16; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.useTime = 19; item.useAnimation = 19; item.width = 32; @@ -41,6 +41,9 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl item.Calamity().rogue = 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 Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = Main.player[Main.myPlayer].Calamity(); @@ -51,15 +54,17 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, perturbedspeed, type, Math.Max(damage / 3, 1), knockBack / 3f, player.whoAmI, 0f, 1f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; spread -= 10; } int spread2 = 3; - for (int i = 0; i < Main.rand.Next(6,11); i++) + int icicleAmt = Main.rand.Next(6,11); + for (int i = 0; i < icicleAmt; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread2)); - Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), damage / 2, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedspeed, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType()), Math.Max(damage / 3, 1), 0f, player.whoAmI, 0f, 0f); spread2 -= Main.rand.Next(1,4); } return false; @@ -71,7 +76,7 @@ Stealth strikes throw three short ranged boomerangs along with a spread of icicl { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ModContent.ItemType(), 40); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddTile(TileID.MythrilAnvil); diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 8aa60e0f39..dcfd43e0c2 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 0, 8, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 22f; item.maxStack = 999; @@ -44,8 +44,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int gemstone = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[gemstone].Calamity().stealthStrike = true; + int flare = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + if (flare.WithinBounds(Main.maxProjectiles)) + Main.projectile[flare].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/FrostyFlare.png b/Items/Weapons/Rogue/FrostyFlare.png index 407de1a344..1d11db6d7f 100644 Binary files a/Items/Weapons/Rogue/FrostyFlare.png and b/Items/Weapons/Rogue/FrostyFlare.png differ diff --git a/Items/Weapons/Rogue/GalaxySmasherRogue.cs b/Items/Weapons/Rogue/GalaxySmasherRogue.cs deleted file mode 100644 index 84e32b09f6..0000000000 --- a/Items/Weapons/Rogue/GalaxySmasherRogue.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class GalaxySmasherRogue : RogueWeapon - { - public static int BaseDamage = 390; - public static float Speed = 18f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galaxy Smasher"); - Tooltip.SetDefault("Explodes and summons death lasers on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 86; - item.height = 72; - 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.rare = 10; - item.Calamity().customRarity = CalamityRarity.DarkBlue; - item.value = Item.buyPrice(1, 80, 0, 0); - - 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe r = new ModRecipe(mod); - r.SetResult(this); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType(), 5); - r.AddIngredient(ModContent.ItemType()); - r.AddTile(ModContent.TileType()); - r.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/GalaxySmasherRogue.png b/Items/Weapons/Rogue/GalaxySmasherRogue.png deleted file mode 100644 index 9b40695ec7..0000000000 Binary files a/Items/Weapons/Rogue/GalaxySmasherRogue.png and /dev/null differ diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index dc0f702264..c5b20465ae 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 28; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 2, 50); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; item.Calamity().rogue = true; @@ -42,11 +42,14 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; - Main.projectile[stealth].penetrate = 6; - Main.projectile[stealth].aiStyle = -1; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + Main.projectile[stealth].penetrate = 6; + Main.projectile[stealth].aiStyle = -1; + } return false; } return true; diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index 318f5099a1..e3ae13baf5 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -12,45 +12,44 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Ghoulish Gouger"); - Tooltip.SetDefault("Throws a ghoulish scythe that ignores immunity frames\n" + - "Stealth strikes spawn souls on enemy hits"); + Tooltip.SetDefault("Throws sets of four ghoulish scythes at ultra high velocity\n" + + "Stealth strikes summon a flurry of tormented souls on hit"); } public override void SafeSetDefaults() { item.width = 74; - item.damage = 110; + item.height = 68; + + item.damage = 166; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 12; - item.useTime = 12; + 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.height = 68; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 20f; + item.shootSpeed = 16f; item.Calamity().rogue = true; + + 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) - { - Vector2 origin = new Vector2(37f, 32f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/GhoulishGougerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 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/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) { - if (player.Calamity().StealthStrikeAvailable()) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; - } - return true; + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; } - } + } } diff --git a/Items/Weapons/Rogue/GildedDagger.cs b/Items/Weapons/Rogue/GildedDagger.cs index 5c9d62a210..e595f23e2a 100644 --- a/Items/Weapons/Rogue/GildedDagger.cs +++ b/Items/Weapons/Rogue/GildedDagger.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 36; item.maxStack = 1; - item.value = Item.buyPrice(0, 0, 20, 0); - item.rare = 1; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().rogue = true; @@ -42,8 +42,11 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; - Main.projectile[p].penetrate = 4; + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].Calamity().stealthStrike = true; + Main.projectile[p].penetrate = 4; + } return false; } return true; diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index aba7b11d9a..ccd3245ffd 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -23,7 +23,6 @@ Stealth strikes are super fast and pierce infinitely"); public override void SafeSetDefaults() { item.damage = BaseDamage; - item.crit = 4; item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; @@ -34,7 +33,7 @@ Stealth strikes are super fast and pierce infinitely"); item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = Knockback; item.value = Item.buyPrice(0, 1, 40, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.maxStack = 3; @@ -42,6 +41,9 @@ Stealth strikes are super fast and pierce infinitely"); item.shoot = ModContent.ProjectileType(); } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + 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 ai1 = 0f; @@ -53,7 +55,7 @@ Stealth strikes are super fast and pierce infinitely"); } int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, ai1); - if (player.Calamity().StealthStrikeAvailable()) + if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; } diff --git a/Items/Weapons/Rogue/GleamingDagger.cs b/Items/Weapons/Rogue/GleamingDagger.cs index 18698a1eae..62111e83dd 100644 --- a/Items/Weapons/Rogue/GleamingDagger.cs +++ b/Items/Weapons/Rogue/GleamingDagger.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 36; item.maxStack = 1; - item.value = Item.buyPrice(0, 0, 20, 0); - item.rare = 1; + item.value = CalamityGlobalItem.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().rogue = true; @@ -42,8 +42,11 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; - Main.projectile[p].penetrate = 4; + if (p.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[p].Calamity().stealthStrike = true; + Main.projectile[p].penetrate = 4; + } return false; } return true; diff --git a/Items/Weapons/Rogue/GleamingDagger.png b/Items/Weapons/Rogue/GleamingDagger.png index 95e0b396b9..74fa7601a8 100644 Binary files a/Items/Weapons/Rogue/GleamingDagger.png and b/Items/Weapons/Rogue/GleamingDagger.png differ diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 286efddbcf..6314525c45 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -4,14 +4,13 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { public class GodsParanoia : RogueWeapon { - private static int damage = 125; + private static int damage = 98; private static int knockBack = 5; public override void SetStaticDefaults() @@ -36,7 +35,7 @@ Right click to delete all existing spiky balls"); item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = knockBack; item.value = Item.buyPrice(0, 18, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; item.UseSound = SoundID.Item1; item.autoReuse = true; @@ -51,7 +50,7 @@ Right click to delete all existing spiky balls"); { if (player.altFunctionUse == 2) { - item.shoot = 0; + item.shoot = ProjectileID.None; item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } @@ -70,8 +69,10 @@ Right click to delete all existing spiky balls"); modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + damage = (int)(damage * 1.345); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; @@ -90,8 +91,7 @@ Right click to delete all existing spiky balls"); recipe.AddIngredient(ItemID.SpikyBall, 200); recipe.AddIngredient(ModContent.ItemType(), 2); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/HardenedHoneycomb.cs b/Items/Weapons/Rogue/HardenedHoneycomb.cs index 1838cbd016..ed7456e999 100644 --- a/Items/Weapons/Rogue/HardenedHoneycomb.cs +++ b/Items/Weapons/Rogue/HardenedHoneycomb.cs @@ -32,7 +32,7 @@ Stealth strikes can bounce off walls and enemies"); item.height = 32; item.maxStack = 999; item.value = 300; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; @@ -42,9 +42,12 @@ Stealth strikes can bounce off walls and enemies"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = 3; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].penetrate = 3; + } return false; } return true; diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index 95ec66c1ef..0b5634d03f 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.width = 38; item.height = 34; item.damage = 115; - item.crit += 20; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 25; @@ -31,22 +30,26 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + 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 proj = Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; } else { - Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, 0f, -10f, type, damage, knockBack, player.whoAmI); } return false; } diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs index 3f9fd0407f..bcc4beba4d 100644 --- a/Items/Weapons/Rogue/HellsSun.cs +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -8,9 +8,9 @@ using CalamityMod.CalPlayer; namespace CalamityMod.Items.Weapons.Rogue { - public class HellsSun : RogueWeapon + public class HellsSun : RogueWeapon { - private static int damage = 84; + private static int damage = 85; private static int knockBack = 5; private static float SdamageMult = 0.6f; @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Hell's Sun"); Tooltip.SetDefault("The Subterranean Sun in the palm of your hand.\n" + - "Shoots a gravity-defying spiky ball. Stacks up to 10.\n" + + "Shoots a gravity-defying spiky ball. Stacks up to 10.\n" + "Once stationary, periodically emits small suns that explode on hit\n" + "Stealth strikes emit suns at a faster rate and last for a longer amount of time\n" + - "Right click to delete all existing spiky balls"); + "Right click to delete all existing spiky balls"); } public override void SafeSetDefaults() @@ -36,9 +36,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.useAnimation = 15; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = knockBack; - item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise;; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item1; item.autoReuse = true; item.maxStack = 10; @@ -47,33 +46,36 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2) - { - item.shoot = 0; - item.shootSpeed = 0f; - return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; - } - else - { - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 5f; - int UseMax = item.stack; - return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; - } - } + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + 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; + return player.ownedProjectileCounts[ModContent.ProjectileType()] < UseMax; + } + } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = false; + modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * SdamageMult), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].penetrate = -1; - Main.projectile[stealth].timeLeft = 2400; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * SdamageMult), knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].penetrate = -1; + Main.projectile[stealth].timeLeft = 2400; + } return false; } return true; @@ -82,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool AltFunctionUse(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.killSpikyBalls = true; + modPlayer.killSpikyBalls = true; return true; } diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index 3854bd8d5b..ddd8c0c2d6 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,15 +7,16 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Hypothermia : RogueWeapon + public class Hypothermia : RogueWeapon { - private int counter = 0; - + // For more consistent DPS, always alternates between throwing 1 and 2 instead of picking randomly + private bool throwTwo = true; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hypothermia"); - Tooltip.SetDefault("Fires a constant barrage of black ice shards\n" + - "Stealth strikes additionally fire a short ranged ice chunk that shatters into ice shards"); + Tooltip.SetDefault("Throws a constant barrage of black ice shards\n" + + "Stealth strikes hurl a set of razor sharp ice chunks that shatter on impact"); } public override void SafeSetDefaults() @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.noMelee = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.UseSound = SoundID.Item9; + item.UseSound = SoundID.Item7; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; - item.damage = 369; + item.damage = 200; item.useAnimation = 21; item.useTime = 3; - item.crit = 16; + item.reuseDelay = 1; item.knockBack = 3f; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; @@ -43,26 +43,38 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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 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() && counter == 0) //setting up the stealth strikes - { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (player.Calamity().StealthStrikeAvailable()) + { + int stealthDamage = (int)(damage * 1.2f); + for (int i = 0; i < 4; ++i) + { + Vector2 chunkVelocity = new Vector2(speedX, speedY).RotatedByRandom(0.07f) * Main.rand.NextFloat(1.1f, 1.18f); + int stealth = Projectile.NewProjectile(position, chunkVelocity, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + } + + // On a stealth strike, only the chunks are thrown. + return false; } - int projAmt = Main.rand.Next(1, 3); - for (int index = 0; index < projAmt; ++index) - { - float SpeedX = speedX + Main.rand.NextFloat(-2f, 2f); - float SpeedY = speedY + Main.rand.NextFloat(-2f, 2f); - Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, damage, knockBack, player.whoAmI, Main.rand.Next(4), 0f); - } + + // Regular attacks alternate between throwing one and two shards at a time. + int projAmt = throwTwo ? 2 : 1; + throwTwo = !throwTwo; + + for (int i = 0; i < projAmt; ++i) + { + float SpeedX = speedX + Main.rand.NextFloat(-2f, 2f); + float SpeedY = speedY + Main.rand.NextFloat(-2f, 2f); + int texID = Main.rand.Next(4); + Projectile.NewProjectile(position, new Vector2(SpeedX, SpeedY), type, damage, knockBack, player.whoAmI, texID, 0f); + } - counter++; - if (counter >= 7) - { - counter = 0; - } return false; } @@ -72,7 +84,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ModContent.ItemType(), 24); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index 4a082ccfeb..7cc67de187 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -18,33 +18,35 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 62; item.damage = 45; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; item.useAnimation = 12; - item.crit = 7; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 12; item.knockBack = 2.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 62; + item.width = item.height = 66; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = 5; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 7; + 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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/IceStar.png b/Items/Weapons/Rogue/IceStar.png index cfeebe4f90..23f466e046 100644 Binary files a/Items/Weapons/Rogue/IceStar.png and b/Items/Weapons/Rogue/IceStar.png differ diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index a1aa6a5137..5b9b716648 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.melee = true; item.height = 60; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -38,8 +38,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index fa902a23b9..c8c2d0b979 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 52; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; @@ -39,9 +39,12 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + } return false; } return true; diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index 7b369ce570..923bc083b4 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 30; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 5, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/IronFrancisca.cs b/Items/Weapons/Rogue/IronFrancisca.cs index 810a99d3e8..7a3b1d209d 100644 --- a/Items/Weapons/Rogue/IronFrancisca.cs +++ b/Items/Weapons/Rogue/IronFrancisca.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 36; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = 0; + item.rare = ItemRarityID.White; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/JawsOfOblivion.cs b/Items/Weapons/Rogue/JawsOfOblivion.cs index ec15ef1d98..f0e3ca3140 100644 --- a/Items/Weapons/Rogue/JawsOfOblivion.cs +++ b/Items/Weapons/Rogue/JawsOfOblivion.cs @@ -13,14 +13,15 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Jaws of Oblivion"); Tooltip.SetDefault("Throws a tight spread of six venomous reaper fangs that stick in enemies\n" + - "Stealth strikes cause the teeth to emit a crushing shockwave on impact\n" + - "You're gonna need a bigger boat"); + "Stealth strikes cause the teeth to emit a crushing shockwave on impact\n" + + "You're gonna need a bigger boat"); } public override void SafeSetDefaults() { item.width = 42; - item.damage = 195; + item.height = 40; + item.damage = 159; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 15; @@ -29,14 +30,12 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 1f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 40; - item.maxStack = 1; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 25f; - item.Calamity().customRarity = CalamityRarity.PureGreen; item.Calamity().rogue = true; + + 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) @@ -52,12 +51,13 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, currentDirection.X, currentDirection.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(position, currentDirection, type, (int)(damage * 1.8), knockBack + 6f, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; } else { - int p = Projectile.NewProjectile(position.X, position.Y, currentDirection.X, currentDirection.Y, type, (int)(damage * 1.5f), 10, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, currentDirection, type, damage, knockBack, player.whoAmI); } } return false; @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ModContent.ItemType(), 15); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this, 1); + recipe.SetResult(this); recipe.AddRecipe(); } } diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index 0f170ce3fa..411e73a055 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -4,7 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Kelvin Catalyst"); - Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits"); + Tooltip.SetDefault("Throws an icy blade that splits into multiple ice stars on enemy hits\n" + + "Stealth strikes will briefly gain sentience and ram nearby enemies before returning to the player"); } public override void SafeSetDefaults() @@ -33,18 +34,19 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 4f; item.UseSound = SoundID.Item1; item.height = 20; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.value = Item.buyPrice(gold: 48); + item.rare = ItemRarityID.LightPurple; + item.Calamity().donorItem = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Dedicated; } 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 proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } @@ -53,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Rogue ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 200); recipe.AddIngredient(ItemID.FrozenKey); - recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType(), 20); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 2); recipe.AddIngredient(ModContent.ItemType(), 2); diff --git a/Items/Weapons/Rogue/Kylie.cs b/Items/Weapons/Rogue/Kylie.cs index 046cc17f12..ee839e2811 100644 --- a/Items/Weapons/Rogue/Kylie.cs +++ b/Items/Weapons/Rogue/Kylie.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,9 +22,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.damage = 63; item.knockBack = 12; item.thrown = true; - item.crit = 16; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.useTime = 25; item.useAnimation = 25; item.width = 32; @@ -37,6 +37,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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 Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { CalamityPlayer p = Main.player[Main.myPlayer].Calamity(); @@ -47,8 +50,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockBack / 3f, player.whoAmI, 0f, 1f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; spread -= 10; } return false; diff --git a/Items/Weapons/Rogue/LatcherMine.cs b/Items/Weapons/Rogue/LatcherMine.cs index f2437be008..a11c7a099f 100644 --- a/Items/Weapons/Rogue/LatcherMine.cs +++ b/Items/Weapons/Rogue/LatcherMine.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 3, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ 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) { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/LeadTomahawk.cs b/Items/Weapons/Rogue/LeadTomahawk.cs index fa1580de50..187e90ec67 100644 --- a/Items/Weapons/Rogue/LeadTomahawk.cs +++ b/Items/Weapons/Rogue/LeadTomahawk.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 36; item.maxStack = 999; item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = 0; + item.rare = ItemRarityID.White; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index fa62e10005..f9c4b2476c 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -11,14 +11,13 @@ namespace CalamityMod.Items.Weapons.Rogue { public static readonly Color blueColor = new Color(48, 208, 255); public static readonly Color purpleColor = new Color(208, 125, 218); + public override void SetStaticDefaults() { DisplayName.SetDefault("Leonid Progenitor"); - Tooltip.SetDefault("Legendary Drop\n" + - "Throws a bombshell that explodes, summoning a meteor to impact the site\n" + + Tooltip.SetDefault("Throws a bombshell that explodes, summoning a meteor to impact the site\n" + "Right click to throw a spread of gravity affected comets that explode, leaving behind a star\n" + - "Stealth strikes lob a bombshell that additionally splits into comets on hit\n" + - "Revengeance drop"); + "Stealth strikes lob a bombshell that additionally splits into comets on hit"); } public override void SafeSetDefaults() @@ -33,13 +32,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.width = 32; item.height = 48; - item.useStyle = 1; + item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.noUseGraphic = true; item.UseSound = SoundID.Item61; + item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.rare = ItemRarityID.Lime; + item.Calamity().challengeDrop = true; } public override bool AltFunctionUse(Player player) => true; @@ -59,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue return base.CanUseItem(player); } - public override float UseTimeMultiplier (Player player) + public override float SafeSetUseTimeMultiplier(Player player) { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) return 1f; @@ -70,8 +70,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) { - int bomb = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[bomb].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int bomb = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (bomb.WithinBounds(Main.maxProjectiles)) + Main.projectile[bomb].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } else @@ -80,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Rogue for (float i = -2.5f; i < 3f; ++i) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(position, perturbedSpeed, type, (int)(damage * dmgMult), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, perturbedSpeed, type, (int)(damage * dmgMult), knockBack, player.whoAmI); } } return false; @@ -88,8 +89,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(item.width / 2f, item.height / 2f - 2f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow")); } } } diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index 4bde96dd81..e4fcf30d0a 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 38; item.maxStack = 1; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -59,14 +59,18 @@ namespace CalamityMod.Items.Weapons.Rogue if (stealthStrike) { - int tooth = Projectile.NewProjectile(position.X, position.Y, offsetSpeedX * 1.5f, offsetSpeedY * 1.5f, type, damage, knockBack * 10f, player.whoAmI, 0f, 0f); - Main.projectile[tooth].Calamity().stealthStrike = true; - Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); + int tooth = Projectile.NewProjectile(position.X, position.Y, offsetSpeedX * 1.5f, offsetSpeedY * 1.5f, type, damage, knockBack * 10f, player.whoAmI); + if (tooth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[tooth].Calamity().stealthStrike = true; + Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); + } } else { - int tooth = Projectile.NewProjectile(position.X, position.Y, offsetSpeedX, offsetSpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); + int tooth = Projectile.NewProjectile(position.X, position.Y, offsetSpeedX, offsetSpeedY, type, damage, knockBack, player.whoAmI); + if (tooth.WithinBounds(Main.maxProjectiles)) + Main.projectile[tooth].Calamity().lineColor = Main.rand.Next(3); } } return false; diff --git a/Items/Weapons/Rogue/Lionfish.cs b/Items/Weapons/Rogue/Lionfish.cs index 28db5d8cd3..05dbb31f43 100644 --- a/Items/Weapons/Rogue/Lionfish.cs +++ b/Items/Weapons/Rogue/Lionfish.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 40; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -39,8 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/LuminousStriker.cs b/Items/Weapons/Rogue/LuminousStriker.cs index cbebf08305..c4e48f7c47 100644 --- a/Items/Weapons/Rogue/LuminousStriker.cs +++ b/Items/Weapons/Rogue/LuminousStriker.cs @@ -3,6 +3,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Rogue { @@ -31,12 +32,20 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(1, 0, 0, 0); - item.rare = 10; + 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (Main.projectile.IndexInRange(proj)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/LunarKunai.cs b/Items/Weapons/Rogue/LunarKunai.cs index 8ede908a84..ed3b3ab870 100644 --- a/Items/Weapons/Rogue/LunarKunai.cs +++ b/Items/Weapons/Rogue/LunarKunai.cs @@ -14,14 +14,14 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Lunar Kunai"); Tooltip.SetDefault("Throws out a set of three kunai that ignore gravity and slightly home in on enemies\n" +"After traveling enough distance, the kunai supercharge with lunar energy, homing in far more aggressively and exploding on impact\n" - +"Stealth strikes instantly throw five supercharged Kunai"); + +"Stealth strikes instantly throw eight supercharged Kunai"); } public override void SafeSetDefaults() { item.width = 38; item.height = 38; - item.damage = 100; + item.damage = 120; item.maxStack = 999; item.consumable = true; item.noMelee = true; @@ -33,10 +33,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item39; item.autoReuse = true; item.value = Item.buyPrice(0, 0, 1, 20); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 22f; - item.Calamity().customRarity = CalamityRarity.Turquoise; item.Calamity().rogue = true; } @@ -65,7 +64,7 @@ namespace CalamityMod.Items.Weapons.Rogue num79 *= num80; if (player.Calamity().StealthStrikeAvailable()) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 8; i++) { float num148 = num78; float num149 = num79; @@ -79,7 +78,8 @@ namespace CalamityMod.Items.Weapons.Rogue float x4 = vector2.X; float y4 = vector2.Y; int stealth = Projectile.NewProjectile(x4, y4, num148, num149, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } } else diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 9cf65f1c0e..b82323811f 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -11,11 +11,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Malachite"); - Tooltip.SetDefault("Legendary Drop\n" + - "Throws a stream of kunai that stick to enemies and explode\n" + + Tooltip.SetDefault("Throws a stream of kunai that stick to enemies and explode\n" + "Right click to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit\n" + - "Stealth strikes fire three kunai that home in, stick to enemies, and explode\n" + - "Revengeance drop"); + "Stealth strikes fire three kunai that home in, stick to enemies, and explode"); } public override void SafeSetDefaults() @@ -30,12 +28,13 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 58; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; + item.Calamity().challengeDrop = true; } public override bool AltFunctionUse(Player player) => true; @@ -60,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Rogue return base.CanUseItem(player); } - public override float UseTimeMultiplier (Player player) + public override float SafeSetUseTimeMultiplier(Player player) { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse == 2) return 1f; @@ -75,8 +74,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (float i = -6.5f; i <= 6.5f; i += 6.5f) { Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int stealth = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, perturbedSpeed, type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } return false; } @@ -88,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Rogue { dmgMult = 1f; } - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * dmgMult), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * dmgMult), knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Rogue/MangroveChakram.cs b/Items/Weapons/Rogue/MangroveChakram.cs index e9fbe78f30..f97f8811a0 100644 --- a/Items/Weapons/Rogue/MangroveChakram.cs +++ b/Items/Weapons/Rogue/MangroveChakram.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -7,11 +7,12 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class MangroveChakram : RogueWeapon + public class MangroveChakram : RogueWeapon { public override void SetStaticDefaults() { DisplayName.SetDefault("Mangrove Chakram"); + Tooltip.SetDefault("Stealth strikes leave a trail of lingering flowers"); } public override void SafeSetDefaults() @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 7.5f; item.UseSound = SoundID.Item1; item.height = 38; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.value = Item.buyPrice(gold: 60); + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -37,8 +38,8 @@ 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) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/MetalMonstrosity.cs b/Items/Weapons/Rogue/MetalMonstrosity.cs index 1062543202..e52a058c1e 100644 --- a/Items/Weapons/Rogue/MetalMonstrosity.cs +++ b/Items/Weapons/Rogue/MetalMonstrosity.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.noMelee = true; item.UseSound = SoundID.Item1; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.value = Item.buyPrice(0, 4, 0, 0); item.damage = 30; @@ -40,8 +40,8 @@ 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) { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - if (player.Calamity().StealthStrikeAvailable()) + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; return false; } diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 52455782c0..b212ed8fb6 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 28; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; @@ -50,7 +50,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 4f); - Main.projectile[proj].Calamity().stealthStrike = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index e64c29892c..30055ef004 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public class MoltenAmputator : RogueWeapon { + public const float Speed = 21f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Molten Amputator"); @@ -18,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.width = 60; - item.damage = 169; + item.damage = 166; item.noMelee = true; item.noUseGraphic = true; item.autoReuse = true; @@ -28,20 +30,22 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 9f; item.UseSound = SoundID.Item1; item.height = 60; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; - item.Calamity().rogue = true; + 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) { if (player.Calamity().StealthStrikeAvailable()) { - int boomer = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[boomer].Calamity().stealthStrike = true; + damage = (int)(damage * 1.07); + int ss = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (ss.WithinBounds(Main.maxProjectiles)) + Main.projectile[ss].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/MonkeyDarts.cs b/Items/Weapons/Rogue/MonkeyDarts.cs index 4a1025cd8f..0b7255241a 100644 --- a/Items/Weapons/Rogue/MonkeyDarts.cs +++ b/Items/Weapons/Rogue/MonkeyDarts.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,14 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Monkey Darts"); - Tooltip.SetDefault("Stealth strikes throw 3 bouncing dart at high speed\n" + "'Perfect for popping'"); + Tooltip.SetDefault("Stealth strikes throw 3 bouncing darts at high speed\n" + "'Perfect for popping'"); } public override void SafeSetDefaults() { item.damage = 150; item.knockBack = 4; - item.crit = 18; item.noMelee = true; item.noUseGraphic = true; item.consumable = true; @@ -30,13 +30,16 @@ namespace CalamityMod.Items.Weapons.Rogue item.useTime = 20; item.useAnimation = 20; item.value = Item.buyPrice(0, 0, 4, 0); - item.rare = 7; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 18; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //Checks if stealth is avalaible to shoot a spread of 3 darts @@ -46,8 +49,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX * 1.25f, speedY * 1.25f).RotatedBy(MathHelper.ToRadians(spread)); - int p = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1); - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockBack, player.whoAmI, 1); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; spread -= 7; } return false; diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 0613df6623..f8baf93fdc 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 32; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.buyPrice(0, 2, 0, 0); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; @@ -37,19 +37,18 @@ 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) { - float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - int stealth = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20) + float SpeedX = speedX + Main.rand.NextFloat(-1.5f, 1.5f); + float SpeedY = speedY + Main.rand.NextFloat(-1.5f, 1.5f); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; for (float i = 0; i < Main.rand.Next(7,11); i++) { - Vector2 velocity = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - velocity.Normalize(); - velocity *= (float)Main.rand.Next(10, 51) * 0.01f; - int spore = Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[spore].Calamity().lineColor = 1; + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 10f, 50f, 0.01f); + int spore = Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockBack, player.whoAmI); + if (spore.WithinBounds(Main.maxProjectiles)) + Main.projectile[spore].Calamity().lineColor = 1; } } return false; diff --git a/Items/Weapons/Rogue/MythrilKnife.cs b/Items/Weapons/Rogue/MythrilKnife.cs index 032f75a77d..1dea9f1038 100644 --- a/Items/Weapons/Rogue/MythrilKnife.cs +++ b/Items/Weapons/Rogue/MythrilKnife.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 30; item.maxStack = 999; item.value = 1100; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -39,8 +39,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/NanoblackReaperRogue.cs b/Items/Weapons/Rogue/NanoblackReaperRogue.cs index 13cfc320d5..4630e9d635 100644 --- a/Items/Weapons/Rogue/NanoblackReaperRogue.cs +++ b/Items/Weapons/Rogue/NanoblackReaperRogue.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; @@ -11,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class NanoblackReaperRogue : RogueWeapon { - public static int BaseDamage = 500; + public static int BaseDamage = 100; public static float Knockback = 9f; public static float Speed = 16f; @@ -36,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item18; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.value = Item.buyPrice(5, 0, 0, 0); + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; item.Calamity().rogue = true; item.shoot = ModContent.ProjectileType(); @@ -48,8 +47,8 @@ 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) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } @@ -59,11 +58,10 @@ namespace CalamityMod.Items.Weapons.Rogue r.SetResult(this); r.AddTile(ModContent.TileType()); r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); - r.AddIngredient(ModContent.ItemType()); + r.AddIngredient(ModContent.ItemType()); r.AddIngredient(ModContent.ItemType(), 5); r.AddIngredient(ModContent.ItemType(), 40); - r.AddIngredient(ModContent.ItemType(), 10); + r.AddIngredient(ModContent.ItemType(), 20); r.AddIngredient(ItemID.Nanites, 400); r.AddRecipe(); } diff --git a/Items/Weapons/Rogue/NastyCholla.cs b/Items/Weapons/Rogue/NastyCholla.cs index 95cea7ae77..506b2327bd 100644 --- a/Items/Weapons/Rogue/NastyCholla.cs +++ b/Items/Weapons/Rogue/NastyCholla.cs @@ -34,7 +34,7 @@ Stealth strikes throw five at once"); item.UseSound = SoundID.Item1; item.height = 18; item.value = Item.buyPrice(0, 0, 0, 50); - item.rare = 0; + item.rare = ItemRarityID.White; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.Calamity().rogue = true; @@ -48,8 +48,9 @@ Stealth strikes throw five at once"); for (int i = 0; i < 5; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; spread -= Main.rand.Next(1,4); } return false; diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 275f6b3f85..ba3a074909 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -15,14 +15,14 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Night's Gaze"); Tooltip.SetDefault("Strike your foes with this spear of the night\n" + - "Throws a spear that shatters when it hits an enemy\n" + - "Stealth strikes cause the spear to summon homing stars as it flies"); + "Throws a spear that shatters when it hits an enemy\n" + + "Stealth strikes cause the spear to summon homing stars as it flies"); } public override void SafeSetDefaults() { item.width = 82; - item.damage = 800; + item.damage = 531; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 20; @@ -33,10 +33,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 82; item.maxStack = 1; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; item.Calamity().rogue = true; } @@ -45,19 +44,19 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].Calamity().stealthStrike = true; + damage = (int)(damage * 1.22); + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; } - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/NightsGazeGlow"); - Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f - 2f); - spriteBatch.Draw(texture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 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/Rogue/NightsGazeGlow")); + } public override void AddRecipes() { diff --git a/Items/Weapons/Rogue/Nychthemeron.cs b/Items/Weapons/Rogue/Nychthemeron.cs index 687670d704..63a17cf9d2 100644 --- a/Items/Weapons/Rogue/Nychthemeron.cs +++ b/Items/Weapons/Rogue/Nychthemeron.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 18; item.maxStack = 10; item.value = Item.buyPrice(0, 3, 60, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; item.Calamity().rogue = true; @@ -61,12 +62,13 @@ namespace CalamityMod.Items.Weapons.Rogue 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, damage, knockBack, player.whoAmI, 0f, 1f); + 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); Projectile p = Main.projectile[pIndex]; - p.Calamity().stealthStrike = true; + if (pIndex.WithinBounds(Main.maxProjectiles)) + p.Calamity().stealthStrike = true; int pID = p.identity; - CreateOrbs(position, orbDamage, knockBack, pID, player); + CreateOrbs(position, (int)(orbDamage * 0.75f), knockBack, pID, player, true); } } else @@ -74,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Rogue int pIndex = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); int pID = Main.projectile[pIndex].identity; - CreateOrbs(position, orbDamage, knockBack, pID, player); + CreateOrbs(position, orbDamage, knockBack, pID, player, false); } return false; } @@ -83,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.altFunctionUse == 2) { - item.shoot = 0; + item.shoot = ProjectileID.None; item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } @@ -102,13 +104,13 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ItemID.SpikyBall, 30); recipe.AddIngredient(ItemID.LightShard); recipe.AddIngredient(ItemID.DarkShard); - recipe.AddIngredient(ItemID.HallowedBar, 2); - recipe.AddTile(TileID.MythrilAnvil); + recipe.AddRecipeGroup("AnyAdamantiteBar", 2); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } - private static void CreateOrbs(Vector2 position, int damage, float knockBack, int projectileID, Player player) + private static void CreateOrbs(Vector2 position, int damage, float knockBack, int projectileID, Player player, bool stealth) { float rotationOffset = 0f; @@ -154,12 +156,20 @@ namespace CalamityMod.Items.Weapons.Rogue rotationOffset += MathHelper.ToRadians(72f); } - int orb1 = Projectile.NewProjectile(position.X, position.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, orb1Col, projectileID); - int orb2 = Projectile.NewProjectile(position.X, position.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, orb2Col, projectileID); - Main.projectile[orb1].localAI[1] = pos; - Main.projectile[orb2].localAI[1] = pos; - Main.projectile[orb1].rotation = rotationOffset; - Main.projectile[orb2].rotation = rotationOffset + MathHelper.ToRadians(180f); + int orb1 = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, orb1Col, projectileID); + int orb2 = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, orb2Col, projectileID); + if (orb1.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[orb1].localAI[1] = pos; + Main.projectile[orb1].rotation = rotationOffset; + Main.projectile[orb1].Calamity().lineColor = stealth ? 1 : 0; + } + if (orb2.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[orb2].localAI[1] = pos; + Main.projectile[orb2].rotation = rotationOffset + MathHelper.ToRadians(180f); + Main.projectile[orb2].Calamity().lineColor = stealth ? 1 : 0; + } } } } diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs index 55afca0c10..4b01ee1864 100644 --- a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs +++ b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ProjectileID.StarAnise; item.maxStack = 999; item.value = 1200; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -40,11 +40,14 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int gemstone = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[gemstone].Calamity().stealthStrike = true; - Main.projectile[gemstone].usesLocalNPCImmunity = true; - Main.projectile[gemstone].timeLeft = 900; - Main.projectile[gemstone].penetrate = -1; + int gemstone = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (gemstone.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[gemstone].Calamity().stealthStrike = true; + Main.projectile[gemstone].usesLocalNPCImmunity = true; + Main.projectile[gemstone].timeLeft = 900; + Main.projectile[gemstone].penetrate = -1; + } return false; } return true; diff --git a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png index 3868486806..22503b2728 100644 Binary files a/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png and b/Items/Weapons/Rogue/OrichalcumSpikedGemstone.png differ diff --git a/Items/Weapons/Rogue/PalladiumJavelin.cs b/Items/Weapons/Rogue/PalladiumJavelin.cs index ea6eb6f105..d093957879 100644 --- a/Items/Weapons/Rogue/PalladiumJavelin.cs +++ b/Items/Weapons/Rogue/PalladiumJavelin.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ProjectileID.StarAnise; item.maxStack = 999; item.value = 1200; - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -38,10 +38,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) { - int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - if (!player.Calamity().StealthStrikeAvailable()) - Main.projectile[javelin].usesLocalNPCImmunity = false; + int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (javelin.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (!player.Calamity().StealthStrikeAvailable()) + Main.projectile[javelin].usesLocalNPCImmunity = false; + } return false; } diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index 76c004631d..afb2183f5e 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Penumbra"); - Tooltip.SetDefault("Throws a shadow bomb that explodes into homing souls \n" + + Tooltip.SetDefault("Throws a shadow bomb that explodes into homing souls\n" + "Stealth strikes make the bomb manifest on the cursor and explode into more souls"); } @@ -28,12 +27,11 @@ namespace CalamityMod.Items.Weapons.Rogue item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item103; item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; - item.damage = 1600; + item.damage = 1008; item.useAnimation = 40; item.useTime = 40; - item.crit = 16; item.knockBack = 8f; item.shoot = ModContent.ProjectileType(); item.shootSpeed = ShootSpeed; @@ -42,6 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.Calamity().rogue = 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 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()) @@ -60,7 +61,8 @@ namespace CalamityMod.Items.Weapons.Rogue } vector2 += new Vector2(num78, num79); int proj = Projectile.NewProjectile(vector2, new Vector2(0f,-0.5f), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[proj].Calamity().stealthStrike = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; @@ -72,7 +74,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ModContent.ItemType(), 6); recipe.AddIngredient(ModContent.ItemType(), 24); recipe.AddIngredient(ModContent.ItemType(), 6); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index f7806b6747..5381430c3c 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -12,14 +12,14 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Phantasmal Ruin"); - Tooltip.SetDefault(@"Fires an enormous ghost lance that leaves lost souls in its wake -Explodes into phantom spirits on enemy hits -Stealth strikes summon ghost clones instead of lost souls"); + Tooltip.SetDefault(@"Fires an enormous ghost lance that emits lost souls as it flies +Explodes into tormented souls on enemy hits +Stealth strikes continuously leave spectral clones in their wake"); } public override void SafeSetDefaults() { - item.damage = 1500; + item.damage = 955; item.knockBack = 8f; item.width = 102; @@ -27,26 +27,26 @@ Stealth strikes summon ghost clones instead of lost souls"); item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.noUseGraphic = true; - - item.value = Item.buyPrice(1, 40, 0, 0); - item.useTime = 25; - item.useAnimation = 25; + item.useTime = 35; + item.useAnimation = 35; + item.autoReuse = true; + item.shootSpeed = 14.5f; + item.shoot = ModContent.ProjectileType(); item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; item.Calamity().rogue = true; - item.autoReuse = true; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); + 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) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int) ((double)damage * 0.2), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + damage = (int)(damage * 1.22); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; @@ -58,7 +58,7 @@ Stealth strikes summon ghost clones instead of lost souls"); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 4); recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddIngredient(ModContent.ItemType (), 500); + recipe.AddIngredient(ModContent.ItemType(), 500); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/PhantomLance.cs b/Items/Weapons/Rogue/PhantomLance.cs index 616cf7307c..f9a67c76b0 100644 --- a/Items/Weapons/Rogue/PhantomLance.cs +++ b/Items/Weapons/Rogue/PhantomLance.cs @@ -30,7 +30,7 @@ Stealth strikes don't slow down and souls always deal full damage"); item.noUseGraphic = true; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.useTime = 23; item.useAnimation = 23; item.maxStack = 999; @@ -47,8 +47,9 @@ Stealth strikes don't slow down and souls always deal full damage"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/Plaguenade.cs b/Items/Weapons/Rogue/Plaguenade.cs index 8c162bf461..814ecda2b4 100644 --- a/Items/Weapons/Rogue/Plaguenade.cs +++ b/Items/Weapons/Rogue/Plaguenade.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguenade"); - Tooltip.SetDefault("Releases a swarm of angry plague bees\n" + - "Stealth strikes spawn more bees and generate a larger explosion"); + Tooltip.SetDefault("Releases a swarm of angry plague bees\n" + + "Stealth strikes spawn more bees and generate a larger explosion"); } public override void SafeSetDefaults() @@ -31,12 +31,12 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 28; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 8; + 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.Calamity().customRarity = CalamityRarity.Dedicated; } 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,7 +44,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; + return false; } return true; } diff --git a/Items/Weapons/Rogue/PoisonPack.cs b/Items/Weapons/Rogue/PoisonPack.cs index 16ffc490fa..1585f1d558 100644 --- a/Items/Weapons/Rogue/PoisonPack.cs +++ b/Items/Weapons/Rogue/PoisonPack.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public class PoisonPack : RogueWeapon { - private static int damage = 20; - private static float knockBack = 1.8f; + private static int baseDamage = 20; + private static float baseKnockback = 1.8f; public override void SetStaticDefaults() { @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = damage; - item.crit = 4; + item.damage = baseDamage; item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; @@ -32,9 +31,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.useTime = 19; item.useAnimation = 19; item.useStyle = ItemUseStyleID.SwingThrow; - item.knockBack = knockBack; + item.knockBack = baseKnockback; item.value = Item.buyPrice(0, 0, 33, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item1; item.maxStack = 3; @@ -42,11 +41,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) { - item.shoot = 0; + item.shoot = ProjectileID.None; item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } @@ -65,8 +67,9 @@ namespace CalamityMod.Items.Weapons.Rogue modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/Prismalline.cs b/Items/Weapons/Rogue/Prismalline.cs index 81ff9d8208..47f5108f95 100644 --- a/Items/Weapons/Rogue/Prismalline.cs +++ b/Items/Weapons/Rogue/Prismalline.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 46; item.damage = 18; - item.crit += 4; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 16; @@ -32,18 +31,22 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 46; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + 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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 39a2dcb009..0f05ee5748 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -18,9 +18,8 @@ Stealth strikes spawn smaller spears to fly along side it"); public override void SafeSetDefaults() { - item.damage = 231; + item.damage = 322; item.knockBack = 8f; - item.crit += 15; item.width = 56; item.height = 56; @@ -28,25 +27,29 @@ Stealth strikes spawn smaller spears to fly along side it"); item.noMelee = true; item.noUseGraphic = true; - item.value = Item.buyPrice(1, 20, 0, 0); item.useTime = 18; item.useAnimation = 18; item.UseSound = SoundID.Item1; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; //12 + 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.shoot = ModContent.ProjectileType(); } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ProfanedTrident.cs b/Items/Weapons/Rogue/ProfanedTrident.cs index 2eb6842430..31030aa6b5 100644 --- a/Items/Weapons/Rogue/ProfanedTrident.cs +++ b/Items/Weapons/Rogue/ProfanedTrident.cs @@ -10,36 +10,36 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetStaticDefaults() { - DisplayName.SetDefault("Infernal Spear"); - Tooltip.SetDefault("Throws a homing spear that explodes on enemy hits\n" + - "Stealth strikes summon fireballs as they fly before exploding into a fiery fountain"); + DisplayName.SetDefault("Wrathwing"); + Tooltip.SetDefault("Throws an agile, homing winged spear that constantly spits fire\n" + + "Stealth strikes create an eruption of cinders on hit"); } public override void SafeSetDefaults() { item.width = 72; - item.damage = 1000; + item.damage = 592; + item.knockBack = 5f; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 13; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 13; - item.knockBack = 8f; - item.UseSound = SoundID.Item1; + item.useTime = item.useAnimation = 13; item.autoReuse = true; + item.UseSound = SoundID.Item1; item.height = 72; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + 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.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) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/Pwnagehammer.cs b/Items/Weapons/Rogue/Pwnagehammer.cs deleted file mode 100644 index 76a7b4b3a2..0000000000 --- a/Items/Weapons/Rogue/Pwnagehammer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class Pwnagehammer : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Pwnagehammer"); - Tooltip.SetDefault("Throws a heavy, gravity-affected hammer that creates a loud blast of hallowed energy when it hits something\n" + - "There is a 20 percent chance for the hammer to home in on a target\n" + - "Homing hammers summon an additional spectral hammer on hit and are guaranteed to land a critical hit"); - } - - public override void SafeSetDefaults() - { - item.width = 68; - item.damage = 210; - item.crit = 10; - 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.Calamity().rogue = true; - item.height = 68; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24.4f; - } - - 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 speed = new Vector2(speedX, speedY); - Vector2 yeetOffset = Vector2.Normalize(speed) * 40f; - if (Collision.CanHit(position, 0, 0, position + yeetOffset, 0, 0)) - { - position += yeetOffset; - } - int proj = Projectile.NewProjectile(position, speed, type, damage, knockBack, player.whoAmI, Main.rand.NextBool(5) ? 1f : -1f); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - 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(); - } - } -} diff --git a/Items/Weapons/Rogue/Pwnagehammer.png b/Items/Weapons/Rogue/Pwnagehammer.png deleted file mode 100644 index 7a6cb7bc22..0000000000 Binary files a/Items/Weapons/Rogue/Pwnagehammer.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Quasar.cs b/Items/Weapons/Rogue/Quasar.cs index 18d82acb66..b8ca4a1802 100644 --- a/Items/Weapons/Rogue/Quasar.cs +++ b/Items/Weapons/Rogue/Quasar.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 52; item.damage = 80; //50 - item.crit += 12; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 12; @@ -29,18 +28,22 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 48; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.value = CalamityGlobalItem.Rarity9BuyPrice; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + item.Calamity().challengeDrop = true; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 12; 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 knife = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int knife = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (knife.WithinBounds(Main.maxProjectiles)) + Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/RadiantStar.cs b/Items/Weapons/Rogue/RadiantStar.cs index 144a4ad26a..5f30eb0029 100644 --- a/Items/Weapons/Rogue/RadiantStar.cs +++ b/Items/Weapons/Rogue/RadiantStar.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 52; item.damage = 55; //33 - item.crit += 8; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 12; @@ -32,12 +31,15 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 48; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -54,8 +56,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs new file mode 100644 index 0000000000..48056eeaad --- /dev/null +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -0,0 +1,50 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class RefractionRotor : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Refraction Rotor"); + Tooltip.SetDefault("Fires a huge prismatic disk shuriken\n" + + "The shuriken shatters moments after impact into homing rockets\n" + + "Stealth strikes shatter into many more rockets"); + } + + 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.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; + } + + 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()) + damage = (int)(damage * 0.75D); + + int shuriken = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(shuriken)) + Main.projectile[shuriken].Calamity().stealthStrike = true; + return false; + } + } +} diff --git a/Items/Weapons/Rogue/RefractionRotor.png b/Items/Weapons/Rogue/RefractionRotor.png new file mode 100644 index 0000000000..9b945f0278 Binary files /dev/null and b/Items/Weapons/Rogue/RefractionRotor.png differ diff --git a/Items/Weapons/Rogue/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index f646a017cb..0f1218dee1 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -30,7 +30,7 @@ Stealth strikes explode into energy stars"); item.useTime = 26; item.useAnimation = 26; item.UseSound = SoundID.Item1; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.Calamity().rogue = true; item.autoReuse = true; @@ -42,8 +42,9 @@ Stealth strikes explode into energy stars"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index 2d6abe3359..71498bbd17 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using System; using System.Collections.Generic; using System.Linq; @@ -13,17 +14,17 @@ namespace CalamityMod.Items.Weapons.Rogue { } - public float StealthStrikeDamage; + public float StealthStrikePrefixBonus; public RogueWeapon() { - StealthStrikeDamage = 1f; + StealthStrikePrefixBonus = 1f; } public override ModItem Clone(Item itemClone) { RogueWeapon myClone = (RogueWeapon)base.Clone(itemClone); - myClone.StealthStrikeDamage = StealthStrikeDamage; + myClone.StealthStrikePrefixBonus = StealthStrikePrefixBonus; return myClone; } @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool NewPreReforge() { - StealthStrikeDamage = 1f; + StealthStrikePrefixBonus = 1f; return true; } @@ -74,19 +75,25 @@ namespace CalamityMod.Items.Weapons.Rogue item.summon = false; } - // Simply add the player's dedicated rogue damage. + // Add both the player's dedicated rogue damage and stealth strike damage as applicable. // Rogue weapons are internally throwing so they already benefit from throwing damage boosts. // 5E-06 to prevent downrounding is not needed anymore, added by TML itself - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) + public sealed override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { - add += player.Calamity().throwingDamage - 1f; - //Boost (or lower) the weapon's damage if it has a stealth strike available and an associated prefix - if (player.Calamity().StealthStrikeAvailable() && item.prefix > 0) - { - mult += StealthStrikeDamage - 1f; - } + CalamityPlayer mp = player.Calamity(); + + SafeModifyWeaponDamage(player, ref add, ref mult, ref flat); + + // Both regular rogue damage stat and stealth damage are added to the weapon simultaneously. + 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) + mult += StealthStrikePrefixBonus - 1f; } + public virtual void SafeModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) { } + // Simply add the player's dedicated rogue crit chance. // Rogue crit isn't boosted by Calamity universal crit boosts, so this won't double-add universal crit. public override void GetWeaponCrit(Player player, ref int crit) @@ -94,47 +101,59 @@ namespace CalamityMod.Items.Weapons.Rogue crit += player.Calamity().throwingCrit; } - public override float UseTimeMultiplier(Player player) + public sealed override float UseTimeMultiplier(Player player) { - float rogueAS = 1f; + float baseMultiplier = SafeSetUseTimeMultiplier(player); + float rogueAS = baseMultiplier == -1f ? 1f : baseMultiplier; if (player.Calamity().gloveOfPrecision) rogueAS -= 0.2f; if (player.Calamity().gloveOfRecklessness) - rogueAS += 0.2f; + rogueAS += 0.12f; if (player.Calamity().titanHeartMantle) rogueAS -= 0.15f; return rogueAS; } + public virtual float SafeSetUseTimeMultiplier(Player player) => -1f; + public override void ModifyTooltips(List tooltips) { - TooltipLine tt = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); - if (tt != null) + TooltipLine damageTooltip = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.mod == "Terraria"); + if (damageTooltip != null) { - string[] splitText = tt.text.Split(' '); - string damageValue = splitText.First(); - string damageWord = splitText.Last(); - tt.text = damageValue + " rogue " + damageWord; + // Replace the word "throwing" with "rogue" in the item's damage line. + string text = damageTooltip.text.Replace(" throwing ", " rogue "); + + // Split visible damage into stealth and non-stealth damage values if the player has the stealth mechanic available to them. + Player p = Main.LocalPlayer; + CalamityPlayer mp = p.Calamity(); + if (mp.rogueStealthMax > 0f) + { + int damageNumberSubstringIndex = text.IndexOf(' '); + 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)); + text = damageWithoutStealth + restOfTooltip + " : " + damageWithStealth + " stealth strike damage"; + } + + damageTooltip.text = text; } + + // Add a tooltip line for the stealth strike damage bonus of the item's prefix, if applicable. if (item.prefix > 0) { - float ssDmgBoost = StealthStrikeDamage - 1f; - if (ssDmgBoost > 0) + float ssDmgBoost = StealthStrikePrefixBonus - 1f; + if (ssDmgBoost != 0f) { - TooltipLine StealthBonus = new TooltipLine(mod, "PrefixSSDmg", "+" + Math.Round(ssDmgBoost * 100f) + "% stealth strike damage") - { - isModifier = true - }; - tooltips.Add(StealthBonus); - } - else if (ssDmgBoost < 0) - { - TooltipLine StealthBonus = new TooltipLine(mod, "PrefixSSDmg", "-" + Math.Round(Math.Abs(ssDmgBoost) * 100f) + "% stealth strike damage") + bool badModifier = ssDmgBoost < 0f; + string txt = (badModifier ? "-" : "+") + Math.Round(Math.Abs(ssDmgBoost) * 100f) + "% stealth strike damage"; + TooltipLine stealthTooltip = new TooltipLine(mod, "PrefixSSDmg", txt) { isModifier = true, - isModifierBad = true + isModifierBad = badModifier }; - tooltips.Add(StealthBonus); + tooltips.Add(stealthTooltip); } } } diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 66ae3177ef..bcb7b28055 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.consumable = true; item.noUseGraphic = true; item.useAnimation = 13; - item.crit = 8; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 13; item.knockBack = 2.5f; @@ -32,19 +31,25 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 30; item.maxStack = 999; item.value = 1000; - item.rare = 3; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + 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()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + } return false; } return true; diff --git a/Items/Weapons/Rogue/RoyalKnives.cs b/Items/Weapons/Rogue/RoyalKnives.cs deleted file mode 100644 index 03098ed750..0000000000 --- a/Items/Weapons/Rogue/RoyalKnives.cs +++ /dev/null @@ -1,113 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class RoyalKnives : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Illustrious Knives"); - Tooltip.SetDefault("Throws a flurry of homing knives that can heal the user"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 2000; - 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 = 20; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Developer; - } - - 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; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - 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; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num146 = 4; - if (Main.rand.NextBool(2)) - { - num146++; - } - if (Main.rand.NextBool(4)) - { - num146++; - } - if (Main.rand.NextBool(6)) - { - num146++; - } - if (Main.rand.NextBool(8)) - { - num146++; - } - for (int num147 = 0; num147 < num146; num147++) - { - float num148 = num78; - float num149 = num79; - float num150 = 0.05f * (float)num147; - num148 += (float)Main.rand.Next(-35, 36) * num150; - num149 += (float)Main.rand.Next(-35, 36) * num150; - num80 = (float)Math.Sqrt((double)(num148 * num148 + num149 * num149)); - num80 = num72 / num80; - num148 *= num80; - num149 *= num80; - float x4 = vector2.X; - float y4 = vector2.Y; - int knife = Projectile.NewProjectile(x4, y4, num148, num149, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[knife].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 3); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/RoyalKnives.png b/Items/Weapons/Rogue/RoyalKnives.png deleted file mode 100644 index 4d31893202..0000000000 Binary files a/Items/Weapons/Rogue/RoyalKnives.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs new file mode 100644 index 0000000000..df429d45e3 --- /dev/null +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -0,0 +1,70 @@ +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class Sacrifice : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrifice"); + Tooltip.SetDefault("Releases a dagger that sticks to enemies\n" + + "Right clicking causes all stuck daggers to fly back at you and give you life\n" + + "Daggers stuck to enemies release bloodsplosions over time\n" + + "Stealth strikes provide much more life when returning to you"); + } + + public override void SafeSetDefaults() + { + item.damage = 266; + item.width = item.height = 68; + item.useAnimation = item.useTime = 6; + item.noMelee = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.SwingThrow; + item.knockBack = 4f; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.Calamity().rogue = true; + } + + 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) + { + if (player.altFunctionUse == 2) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != type || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + continue; + + if (Main.projectile[i].ai[0] != 1f) + continue; + + NPC attachedNPC = Main.npc[(int)Main.projectile[i].ai[1]]; + Main.projectile[i].ai[0] = 2f; + Main.projectile[i].ModProjectile().AbleToHealOwner = attachedNPC.type != NPCID.TargetDummy && attachedNPC.type != ModContent.NPCType(); + Main.projectile[i].netUpdate = true; + } + return false; + } + + Vector2 velocity = new Vector2(speedX, speedY); + position += velocity * 3f; + int proj = Projectile.NewProjectile(position, velocity, type, damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(proj)) + Main.projectile[proj].Calamity().stealthStrike = true; + return false; + } + } +} diff --git a/Items/Weapons/Rogue/Sacrifice.png b/Items/Weapons/Rogue/Sacrifice.png new file mode 100644 index 0000000000..4ad5c25480 Binary files /dev/null and b/Items/Weapons/Rogue/Sacrifice.png differ diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index 919b973711..0abf17e0e7 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 14f; item.Calamity().rogue = true; @@ -59,8 +60,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < 2; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-2,3), speedY + Main.rand.Next(-2,3)).RotatedBy(MathHelper.ToRadians(spread)); - int stealth = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X * 1.5f, perturbedspeed.Y * 1.5f, ModContent.ProjectileType(), Math.Max((int)(damage * 0.75), 1), knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; spread -= Main.rand.Next(1,3); } return false; diff --git a/Items/Weapons/Rogue/Sandslasher.cs b/Items/Weapons/Rogue/Sandslasher.cs index e9d124a1bc..25600caea7 100644 --- a/Items/Weapons/Rogue/Sandslasher.cs +++ b/Items/Weapons/Rogue/Sandslasher.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; item.Calamity().rogue = true; @@ -39,10 +39,11 @@ 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()) + if (player.Calamity().StealthStrikeAvailable()) { int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().stealthStrike = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ScarletDevil.cs b/Items/Weapons/Rogue/ScarletDevil.cs index 0cfb18d8a9..41d9c88861 100644 --- a/Items/Weapons/Rogue/ScarletDevil.cs +++ b/Items/Weapons/Rogue/ScarletDevil.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,33 +14,43 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Scarlet Devil"); Tooltip.SetDefault("Throws an ultra high velocity spear, which creates more projectiles that home in\n" + - "The spear creates a Scarlet Blast upon hitting an enemy\n" + - "Stealth strikes grant you lifesteal\n" + - "'Divine Spear \"Spear the Gungnir\"'"); + "The spear creates a Scarlet Blast upon hitting an enemy\n" + + "Stealth strikes grant you lifesteal\n" + + "'Divine Spear \"Spear the Gungnir\"'"); } public override void SafeSetDefaults() { item.width = 94; item.height = 94; - item.damage = 40000; - item.crit += 20; + item.damage = 8000; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 60; + item.useAnimation = item.useTime = 81; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 60; item.knockBack = 8f; item.UseSound = SoundID.Item60; item.autoReuse = true; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 8; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 30f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + + 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) + { + int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (Main.projectile.IndexInRange(proj)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; + } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs deleted file mode 100644 index a126f5de1d..0000000000 --- a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class ScourgeoftheCosmosThrown : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scourge of the Cosmos"); - Tooltip.SetDefault("Throws a bouncing cosmic scourge that emits tiny homing cosmic scourges on death and tile hits"); - } - - public override void SafeSetDefaults() - { - item.width = 18; - item.damage = 1100; - 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.height = 20; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 15f; - 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) - { - int javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[javelin].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ScourgeoftheCorruptor); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 200); - recipe.AddTile(ModContent.TileType()); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.png b/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.png deleted file mode 100644 index f5b527abdf..0000000000 Binary files a/Items/Weapons/Rogue/ScourgeoftheCosmosThrown.png and /dev/null differ diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index f921a3f08b..8fe1619e99 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -29,7 +29,7 @@ Stealth strikes gain damage as they damage enemies"); item.autoReuse = true; item.height = 44; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -39,8 +39,9 @@ Stealth strikes gain damage as they damage enemies"); { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index 2eacb0374e..1082f1fc05 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.value = Item.buyPrice(0, 36, 0, 0); } @@ -40,7 +40,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SeafoamBomb.cs b/Items/Weapons/Rogue/SeafoamBomb.cs index 3949f42128..cd7a4a64b9 100644 --- a/Items/Weapons/Rogue/SeafoamBomb.cs +++ b/Items/Weapons/Rogue/SeafoamBomb.cs @@ -30,7 +30,7 @@ Stealth strikes are faster and explode into 5 bubbles"); item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.Calamity().rogue = true; @@ -50,8 +50,9 @@ Stealth strikes are faster and explode into 5 bubbles"); { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX + speedX / 3, speedY + speedY / 3), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX + speedX / 3, speedY + speedY / 3), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index d56a78eca5..1f7f5c83d6 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -18,33 +18,37 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.damage = 169; + item.damage = 150; item.knockBack = 5f; item.useAnimation = item.useTime = 25; - item.useStyle = 1; + item.useStyle = ItemUseStyleID.SwingThrow; item.Calamity().rogue = true; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = 14f; item.noMelee = item.noUseGraphic = true; item.height = item.width = 34; item.UseSound = SoundID.Item106; - item.value = CalamityGlobalItem.Rarity13BuyPrice; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + 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) - { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return 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()) + { + // Directly nerf stealth strikes by 20%, but only stealth strikes. + int stealthDamage = (int)(damage * 0.8f); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, stealthDamage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } public override void AddRecipes() { @@ -55,5 +59,5 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.SetResult(this); recipe.AddRecipe(); } - } + } } diff --git a/Items/Weapons/Rogue/SeashellBoomerang.cs b/Items/Weapons/Rogue/SeashellBoomerang.cs index 3f5f16ef1f..d627f75c7f 100644 --- a/Items/Weapons/Rogue/SeashellBoomerang.cs +++ b/Items/Weapons/Rogue/SeashellBoomerang.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Seashell Boomerang"); + Tooltip.SetDefault("Stealth strikes fire seashells at nearby enemies"); } public override void SafeSetDefaults() @@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.height = 34; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 11.5f; item.Calamity().rogue = true; @@ -36,8 +37,8 @@ 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) { int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } diff --git a/Items/Weapons/Rogue/ShatteredSun.cs b/Items/Weapons/Rogue/ShatteredSun.cs index 5bd1692dad..f9468493fa 100644 --- a/Items/Weapons/Rogue/ShatteredSun.cs +++ b/Items/Weapons/Rogue/ShatteredSun.cs @@ -20,8 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 56; item.height = 56; - item.damage = 82; - item.crit += 10; + item.damage = 80; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 12; @@ -30,14 +29,17 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 6f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + 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.Calamity().customRarity = CalamityRarity.Turquoise; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 10; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -52,8 +54,10 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + damage = (int)(damage * 1.2); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ShinobiBlade.cs b/Items/Weapons/Rogue/ShinobiBlade.cs index 49d9401678..ac324c7b90 100644 --- a/Items/Weapons/Rogue/ShinobiBlade.cs +++ b/Items/Weapons/Rogue/ShinobiBlade.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 30; + item.width = 16; + item.height = 42; item.damage = 15; item.noMelee = true; item.noUseGraphic = true; @@ -27,10 +28,9 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 1f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 34; item.maxStack = 1; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; @@ -48,8 +48,9 @@ namespace CalamityMod.Items.Weapons.Rogue { Vector2 currentDirection = baseDirection.RotatedBy(spreadAngle * i); - int p = Projectile.NewProjectile(position.X, position.Y, currentDirection.X, currentDirection.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(position, currentDirection, type, damage, knockBack, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; } return false; } diff --git a/Items/Weapons/Rogue/ShinobiBlade.png b/Items/Weapons/Rogue/ShinobiBlade.png index 1cf29b4d30..023861ee02 100644 Binary files a/Items/Weapons/Rogue/ShinobiBlade.png and b/Items/Weapons/Rogue/ShinobiBlade.png differ diff --git a/Items/Weapons/Rogue/ShockGrenade.cs b/Items/Weapons/Rogue/ShockGrenade.cs index 7c004ec3f2..d41b96b6ff 100644 --- a/Items/Weapons/Rogue/ShockGrenade.cs +++ b/Items/Weapons/Rogue/ShockGrenade.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 30; item.maxStack = 999; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7.5f; item.Calamity().rogue = true; @@ -41,8 +41,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; @@ -50,8 +51,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(item.width / 2, item.height / 2); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("CalamityMod/Items/Weapons/Rogue/ShockGrenadeGlow")); } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/Shroomerang.cs b/Items/Weapons/Rogue/Shroomerang.cs index 77e213a379..8244457b6f 100644 --- a/Items/Weapons/Rogue/Shroomerang.cs +++ b/Items/Weapons/Rogue/Shroomerang.cs @@ -27,7 +27,7 @@ Stealth strikes grant the Mushy buff to the user on enemy hits and summon homing item.knockBack = 1.5f; item.UseSound = SoundID.Item1; item.height = 50; - item.rare = 2; + item.rare = ItemRarityID.Green; item.value = Item.buyPrice(0, 2, 0, 0); item.shoot = ModContent.ProjectileType(); item.shootSpeed = 15f; @@ -38,8 +38,9 @@ Stealth strikes grant the Mushy buff to the user on enemy hits and summon homing { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SkyStabber.cs b/Items/Weapons/Rogue/SkyStabber.cs index a20ed6cf8f..14f982357b 100644 --- a/Items/Weapons/Rogue/SkyStabber.cs +++ b/Items/Weapons/Rogue/SkyStabber.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { item.damage = damage; - item.crit = 4; item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; @@ -35,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = knockBack; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item1; item.maxStack = 4; @@ -43,11 +42,14 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) { - item.shoot = 0; + item.shoot = ProjectileID.None; item.shootSpeed = 0f; return player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; } @@ -66,8 +68,9 @@ namespace CalamityMod.Items.Weapons.Rogue modPlayer.killSpikyBalls = false; if (modPlayer.StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SkyfinBombers.cs b/Items/Weapons/Rogue/SkyfinBombers.cs index dc798627a2..9d306bee9b 100644 --- a/Items/Weapons/Rogue/SkyfinBombers.cs +++ b/Items/Weapons/Rogue/SkyfinBombers.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue DisplayName.SetDefault("Skyfin Bombers"); Tooltip.SetDefault("Fishy bombers inbound!\n" + "Launches a skyfin nuke that homes in on enemies below it\n" + - "Stealth strikes throw three skyfin nukes that home in regardless of enemy position"); + "Stealth strikes rapidly home in regardless of enemy position"); } public override void SafeSetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 30; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -40,12 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - for (int i = -8; i <= 8; i += 8) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int stealth = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, player.whoAmI, 0f, 0f); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; - } return false; } return true; diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index 74348f00f1..38e737ccd9 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.DD2_GhastlyGlaivePierce; item.autoReuse = true; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 22f; item.Calamity().rogue = true; @@ -44,7 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue { 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); - Main.projectile[projectileIndex].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (projectileIndex.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectileIndex].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index 1da1868d16..664dda4466 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 30; item.maxStack = 999; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.value = Item.sellPrice(0, 0, 0, 40); + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.Calamity().rogue = true; @@ -44,7 +44,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, type, damage, knockBack * 3, player.whoAmI, 0f, 1f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SnapClam.cs b/Items/Weapons/Rogue/SnapClam.cs index bce343461f..84e160580f 100644 --- a/Items/Weapons/Rogue/SnapClam.cs +++ b/Items/Weapons/Rogue/SnapClam.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -44,8 +45,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < 5; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position, perturbedspeed, ModContent.ProjectileType(), Math.Max(damage / 5, 1), knockBack / 5f, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; spread -= Main.rand.Next(1,3); } return false; diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index 8801178ce1..bc9de7d7f0 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -12,13 +12,14 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Spear of Destiny"); Tooltip.SetDefault("Throws three spears with the outer two having homing capabilities\n" + - "Stealth strikes cause all three spears to home in, ignore tiles, and pierce more"); + "Stealth strikes cause all three spears to home in, ignore tiles, and pierce more\n" + + "Challenge Drop"); } public override void SafeSetDefaults() { item.width = 52; - item.damage = 25; + item.damage = 32; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 20; @@ -28,12 +29,12 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 52; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.Calamity().challengeDrop = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; } 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,8 +44,9 @@ namespace CalamityMod.Items.Weapons.Rogue { int projType = (i != 0 || player.Calamity().StealthStrikeAvailable()) ? type : ModContent.ProjectileType(); Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(i)); - int spear = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, projType, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[spear].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int spear = Projectile.NewProjectile(position, perturbedSpeed, projType, damage, knockBack, player.whoAmI); + if (spear.WithinBounds(Main.maxProjectiles)) + Main.projectile[spear].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); } return false; } diff --git a/Items/Weapons/Rogue/SpearofDestiny.png b/Items/Weapons/Rogue/SpearofDestiny.png index b991524840..3dae694b7d 100644 Binary files a/Items/Weapons/Rogue/SpearofDestiny.png and b/Items/Weapons/Rogue/SpearofDestiny.png differ diff --git a/Items/Weapons/Rogue/SpearofPaleolith.cs b/Items/Weapons/Rogue/SpearofPaleolith.cs index bc6571ad50..dde4800b5d 100644 --- a/Items/Weapons/Rogue/SpearofPaleolith.cs +++ b/Items/Weapons/Rogue/SpearofPaleolith.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 54; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 35f; item.Calamity().rogue = true; @@ -50,8 +50,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stabDevice = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stabDevice].Calamity().stealthStrike = true; + int stabDevice = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stabDevice.WithinBounds(Main.maxProjectiles)) + Main.projectile[stabDevice].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SpentFuelContainer.cs b/Items/Weapons/Rogue/SpentFuelContainer.cs index 6e99ed1b8f..b1c6049c79 100644 --- a/Items/Weapons/Rogue/SpentFuelContainer.cs +++ b/Items/Weapons/Rogue/SpentFuelContainer.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Spent Fuel Container"); Tooltip.SetDefault("War Never Changes\n" + //Fallout reference breh, pls don't fall out with me :cri: - "Throws a fuel container with trace amounts of plutonium that explodes into a nuclear explosion\n" + + "Throws a fuel container with trace amounts of plutonium that causes a nuclear explosion\n" + "The explosion does not occur if there are no tiles below it\n" + "Stealth strikes leave a lingering irradiated zone after the explosion dissipates"); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 4.5f; - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item106; item.autoReuse = true; item.value = Item.buyPrice(gold: 48); //sell price of 9 gold 60 silver @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Rogue Vector2 velocity = new Vector2(speedX, speedY); bool stealthAvailable = player.Calamity().StealthStrikeAvailable(); int p = Projectile.NewProjectile(position, velocity, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, stealthAvailable ? 1f : 0f); - if (stealthAvailable) + if (stealthAvailable && p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; } diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index fb30175d44..7a71be96c9 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; item.Calamity().rogue = true; @@ -41,7 +41,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/StellarContemptRogue.cs b/Items/Weapons/Rogue/StellarContemptRogue.cs deleted file mode 100644 index 711828c154..0000000000 --- a/Items/Weapons/Rogue/StellarContemptRogue.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class StellarContemptRogue : RogueWeapon - { - public static int BaseDamage = 325; - public static float Speed = 18f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Contempt"); - Tooltip.SetDefault("Lunar flares rain down on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 66; - item.height = 64; - 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.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = Item.buyPrice(1, 20, 0, 0); - - 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - 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(); - } - } -} diff --git a/Items/Weapons/Rogue/StellarContemptRogue.png b/Items/Weapons/Rogue/StellarContemptRogue.png deleted file mode 100644 index d77b953151..0000000000 Binary files a/Items/Weapons/Rogue/StellarContemptRogue.png and /dev/null differ diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index ca67e08474..5c7c901bf0 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -8,7 +8,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public class StellarKnife : RogueWeapon { - int knifeCount = 15; + int knifeCount = 10; + int knifeLimit = 20; public override void SetStaticDefaults() { DisplayName.SetDefault("Stellar Knife"); @@ -22,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.width = 32; item.height = 34; item.damage = 50; - item.crit += 4; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 9; @@ -32,23 +32,38 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 4; + 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[ModContent.ProjectileType()] < 10) + if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[item.shoot] < knifeLimit) { + int knifeAmt = knifeCount; + 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); + if (knife.WithinBounds(Main.maxProjectiles)) + Main.projectile[knife].Calamity().stealthStrike = true; + } + int spread = 20; for (int i = 0; i < knifeCount; i++) { speedX *= 0.9f; Vector2 perturbedspeed = new Vector2(speedX, speedY + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI, 1f, i % 5 == 0 ? 1f : 0f); - spread -= Main.rand.Next(1, 3); + int knife2 = Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI, 1f, i % 5 == 0 ? 1f : 0f); + if (knife2.WithinBounds(Main.maxProjectiles)) + Main.projectile[knife2].Calamity().stealthStrike = true; + spread -= Main.rand.Next(1, 3); } return false; } diff --git a/Items/Weapons/Rogue/StickySpikyBall.cs b/Items/Weapons/Rogue/StickySpikyBall.cs index 28f78f1baf..146f0ec7fe 100644 --- a/Items/Weapons/Rogue/StickySpikyBall.cs +++ b/Items/Weapons/Rogue/StickySpikyBall.cs @@ -30,7 +30,7 @@ Stealth strikes throw seven at once and last a lot longer"); item.UseSound = SoundID.Item1; item.height = 14; item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 8f; item.Calamity().rogue = true; @@ -44,10 +44,13 @@ Stealth strikes throw seven at once and last a lot longer"); for (int i = 0; i < 7; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].timeLeft *= 4; - Main.projectile[proj].localNPCHitCooldown += 15; + int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].timeLeft *= 4; + Main.projectile[proj].localNPCHitCooldown += 15; + } spread -= Main.rand.Next(1,4); } return false; diff --git a/Items/Weapons/Rogue/StormfrontRazor.cs b/Items/Weapons/Rogue/StormfrontRazor.cs index 65e3b12d14..1bc0993b65 100644 --- a/Items/Weapons/Rogue/StormfrontRazor.cs +++ b/Items/Weapons/Rogue/StormfrontRazor.cs @@ -27,19 +27,20 @@ namespace CalamityMod.Items.Weapons.Rogue item.UseSound = SoundID.Item1; item.autoReuse = true; item.useStyle = ItemUseStyleID.SwingThrow; - item.value = Item.buyPrice(0, 30, 0, 0); - item.rare = 5; - + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; item.useAnimation = 15; item.useTime = 15; item.damage = 50; - item.crit += 8; item.knockBack = 7f; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 7f; item.Calamity().rogue = true; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -57,7 +58,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int p = Projectile.NewProjectile(position, new Vector2(speedX * 1.6f, speedY * 1.6f), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0, 40f); - Main.projectile[p].Calamity().stealthStrike = true; + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } else diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index b2b02583b7..a0819b7d78 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -21,7 +21,7 @@ Stealth strikes release energy as they fly"); public override void SafeSetDefaults() { item.width = 34; - item.damage = 2250; + item.damage = 675; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 24; @@ -32,7 +32,7 @@ Stealth strikes release energy as they fly"); item.autoReuse = true; item.height = 36; item.value = Item.buyPrice(platinum: 2, gold: 50); - item.rare = 10; + item.rare = ItemRarityID.Red; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -43,8 +43,10 @@ Stealth strikes release energy as they fly"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + damage = (int)(damage * 0.9f); + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/SylvanSlasher.cs b/Items/Weapons/Rogue/SylvanSlasher.cs index 1f7169befb..639eef6899 100644 --- a/Items/Weapons/Rogue/SylvanSlasher.cs +++ b/Items/Weapons/Rogue/SylvanSlasher.cs @@ -18,7 +18,7 @@ Does not consume stealth and cannot stealth strike"); public override void SafeSetDefaults() { item.width = 72; - item.damage = 87; + item.damage = 52; item.Calamity().rogue = true; item.noMelee = true; item.noUseGraphic = true; @@ -29,16 +29,16 @@ Does not consume stealth and cannot stealth strike"); item.knockBack = 3f; item.autoReuse = false; item.height = 78; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); return false; } } diff --git a/Items/Weapons/Rogue/TarragonThrowingDart.cs b/Items/Weapons/Rogue/TarragonThrowingDart.cs index 0c40848ac3..8298c0a940 100644 --- a/Items/Weapons/Rogue/TarragonThrowingDart.cs +++ b/Items/Weapons/Rogue/TarragonThrowingDart.cs @@ -32,8 +32,9 @@ Stealth strikes erupt into thorns on enemy hits"); item.height = 34; item.maxStack = 999; item.value = Item.sellPrice(silver: 3); + item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 24f; + item.shootSpeed = 12f; item.Calamity().rogue = true; item.Calamity().customRarity = CalamityRarity.Turquoise; } @@ -42,10 +43,9 @@ Stealth strikes erupt into thorns on enemy hits"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; - Main.projectile[stealth].usesIDStaticNPCImmunity = false; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/TerraDisk.cs b/Items/Weapons/Rogue/TerraDisk.cs index 6396bcb0ad..4bdb033c8b 100644 --- a/Items/Weapons/Rogue/TerraDisk.cs +++ b/Items/Weapons/Rogue/TerraDisk.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -16,7 +16,8 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Terra Disk"); Tooltip.SetDefault(@"Throws a disk that has a chance to generate several disks if enemies are near it -A max of three disks can be active at a time"); +A max of three disks can be active at a time +Stealth strikes travel slower and are rapidly orbited by the smaller disks"); } public override void SafeSetDefaults() @@ -34,8 +35,8 @@ A max of three disks can be active at a time"); item.useStyle = ItemUseStyleID.SwingThrow; item.UseSound = SoundID.Item1; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.value = Item.buyPrice(gold: 80); + item.rare = ItemRarityID.Yellow; item.Calamity().rogue = true; item.shoot = ModContent.ProjectileType(); @@ -43,22 +44,36 @@ A max of three disks can be active at a time"); } public override bool CanUseItem(Player player) - { - if (player.ownedProjectileCounts[item.shoot] >= 3) + { + //Stealth strikes ignore the proj cap + int terraDiskCount = 0; + for (int p = 0; p < Main.maxProjectiles; p++) { - return false; + Projectile proj = Main.projectile[p]; + if (!proj.active || proj.owner != player.whoAmI) + continue; + if (proj.type == item.shoot && !proj.Calamity().stealthStrike) + { + terraDiskCount++; + } + if (terraDiskCount >= 3) + break; } - else - { - return true; - } - } + return terraDiskCount < 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) { + if (player.Calamity().StealthStrikeAvailable()) + { + speedX *= 0.75f; + speedY *= 0.75f; + } int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + } return false; } diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index e465d03bfd..27eed3b4d3 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 24; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + item.rare = ItemRarityID.LightPurple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10.5f; item.Calamity().rogue = true; @@ -42,8 +42,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { float stealthDamageMult = 3.25f; - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * stealthDamageMult), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), (int)(damage * stealthDamageMult), knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } else { diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs new file mode 100644 index 0000000000..e640233cc8 --- /dev/null +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -0,0 +1,46 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class TheAtomSplitter : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Atom Splitter"); + Tooltip.SetDefault("Throws a quantum-superimposed javelin that strikes from numerous timelines at once\n" + + "Stealth strikes perform far more simultaneous strikes"); + } + + public override void SafeSetDefaults() + { + item.width = item.height = 128; + item.damage = 410; + 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; + } + + 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 javelin = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, -1f); + if (player.Calamity().StealthStrikeAvailable() && Main.projectile.IndexInRange(javelin)) + Main.projectile[javelin].Calamity().stealthStrike = true; + return false; + } + } +} diff --git a/Items/Weapons/Rogue/TheAtomSplitter.png b/Items/Weapons/Rogue/TheAtomSplitter.png new file mode 100644 index 0000000000..c1d0c0131b Binary files /dev/null and b/Items/Weapons/Rogue/TheAtomSplitter.png differ diff --git a/Items/Weapons/Rogue/TheReaper.cs b/Items/Weapons/Rogue/TheReaper.cs index 69bc7cb8c9..01eaa0217d 100644 --- a/Items/Weapons/Rogue/TheReaper.cs +++ b/Items/Weapons/Rogue/TheReaper.cs @@ -12,13 +12,13 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("The Reaper"); Tooltip.SetDefault("Slice 'n dice\n" + - "Stealth strikes throw four at once"); + "Stealth strikes throw four at once"); } public override void SafeSetDefaults() { - item.width = 80; - item.damage = 150; + item.width = 106; + item.damage = 153; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 22; @@ -27,26 +27,32 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 4f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.height = 104; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.RareVariant; - } + + item.value = CalamityGlobalItem.Rarity13BuyPrice; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.rare = ItemRarityID.Purple; + item.Calamity().challengeDrop = 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()) //setting the stealth strike { + damage = (int)(damage * 0.8); + int spread = 10; for (int i = 0; i < 4; i++) { Vector2 perturbedspeed = new Vector2(speedX + Main.rand.Next(-3,4), speedY + Main.rand.Next(-3,4)).RotatedBy(MathHelper.ToRadians(spread)); - int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].penetrate = 6; + int proj = Projectile.NewProjectile(position, perturbedspeed, type, damage / 2, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + } spread -= Main.rand.Next(5,8); } return false; diff --git a/Items/Weapons/Rogue/TheReaper.png b/Items/Weapons/Rogue/TheReaper.png index 0714005470..d73efddcc8 100644 Binary files a/Items/Weapons/Rogue/TheReaper.png and b/Items/Weapons/Rogue/TheReaper.png differ diff --git a/Items/Weapons/Rogue/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index f1087d35ad..03f23ab638 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.shoot = ModContent.ProjectileType(); item.shootSpeed = Speed; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.Calamity().rogue = true; } @@ -45,8 +45,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 1f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 1f); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/TheSyringe.png b/Items/Weapons/Rogue/TheSyringe.png index 9eb9fc7d3b..00d39fd3ad 100644 Binary files a/Items/Weapons/Rogue/TheSyringe.png and b/Items/Weapons/Rogue/TheSyringe.png differ diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index 66e6d63fcf..1440e588e3 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -16,18 +16,16 @@ namespace CalamityMod.Items.Weapons.Rogue } public override void SafeSetDefaults() { - item.damage = 7; + item.damage = 14; item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); item.width = 26; item.height = 20; - item.useTime = 20; - item.useAnimation = 20; + item.useTime = item.useAnimation = 40; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5f; - item.crit = 20; item.value = Item.buyPrice(0, 0, 0, 50); - item.rare = 0; + item.rare = ItemRarityID.White; item.maxStack = 999; item.UseSound = SoundID.Item1; item.consumable = true; @@ -35,13 +33,18 @@ namespace CalamityMod.Items.Weapons.Rogue item.noUseGraphic = true; item.Calamity().rogue = true; } + + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 20; + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { //Check if stealth is full if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1); - Main.projectile[p].Calamity().stealthStrike = true; + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1); + if (p.WithinBounds(Main.maxProjectiles)) + Main.projectile[p].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ThrowingBrick.png b/Items/Weapons/Rogue/ThrowingBrick.png index 3790f358ac..0f749d88f0 100644 Binary files a/Items/Weapons/Rogue/ThrowingBrick.png and b/Items/Weapons/Rogue/ThrowingBrick.png differ diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 1303d6996d..1f220218c9 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Time Bolt"); Tooltip.SetDefault("There should be no boundary to human endeavor.\n" + - "Stealth strikes can hit more enemies and create a larger time field"); + "Stealth strikes can hit more enemies and create a larger time field"); } public override void SafeSetDefaults() { item.width = 24; item.height = 46; - item.damage = 720; + item.damage = 432; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = 20; @@ -29,9 +29,10 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 4f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Dedicated; + 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; @@ -39,9 +40,15 @@ 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) { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - Main.projectile[proj].penetrate = 11; + if (player.Calamity().StealthStrikeAvailable()) + damage = (int)(damage * 0.68); + + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (player.Calamity().StealthStrikeAvailable() && proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].penetrate = 11; + } return false; } diff --git a/Items/Weapons/Rogue/TitaniumShuriken.cs b/Items/Weapons/Rogue/TitaniumShuriken.cs index 5bf4de4d84..e5667fcc74 100644 --- a/Items/Weapons/Rogue/TitaniumShuriken.cs +++ b/Items/Weapons/Rogue/TitaniumShuriken.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.consumable = true; item.noUseGraphic = true; item.useAnimation = 9; - item.crit = 10; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 9; item.knockBack = 3f; @@ -30,21 +29,27 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 38; item.maxStack = 999; item.value = 2000; - item.rare = 4; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 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) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; - Main.projectile[stealth].aiStyle = -1; - Main.projectile[stealth].extraUpdates = 1; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + Main.projectile[stealth].aiStyle = -1; + Main.projectile[stealth].extraUpdates = 1; + } return false; } return true; diff --git a/Items/Weapons/Rogue/TitaniumShuriken.png b/Items/Weapons/Rogue/TitaniumShuriken.png index 91b3bddea8..3949871d04 100644 Binary files a/Items/Weapons/Rogue/TitaniumShuriken.png and b/Items/Weapons/Rogue/TitaniumShuriken.png differ diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 317dc13453..ccac5d3507 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.consumable = true; item.noUseGraphic = true; item.useAnimation = 13; - item.crit = 8; item.useStyle = ItemUseStyleID.SwingThrow; item.useTime = 13; item.knockBack = 2.5f; @@ -32,19 +31,25 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 30; item.maxStack = 999; item.value = 1000; - item.rare = 3; + 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 + public override void GetWeaponCrit(Player player, ref int crit) => crit += 8; + 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()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; - Main.projectile[stealth].usesLocalNPCImmunity = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].usesLocalNPCImmunity = true; + } return false; } return true; diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index d0c954ec52..61a77c1623 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -31,7 +31,7 @@ Stealth strikes leak tar as they fly"); item.autoReuse = true; item.height = 40; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -41,8 +41,9 @@ Stealth strikes leak tar as they fly"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index 3ca00f2b2b..d4733c4c90 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Rogue { item.width = 42; item.height = 46; - item.damage = 488; + item.damage = 323; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = item.useTime = 20; @@ -28,19 +28,19 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 18f; item.Calamity().rogue = true; + + 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) { - double stealthMult = player.Calamity().StealthStrikeAvailable() ? 1.3333 : 1D; - int boomer = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, (int)(damage * stealthMult), knockBack, player.whoAmI, 0f, 0f); - Main.projectile[boomer].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + int boomer = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (boomer.WithinBounds(Main.maxProjectiles)) + Main.projectile[boomer].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); return false; } } diff --git a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs deleted file mode 100644 index a55ae882c3..0000000000 --- a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class TriactisTruePaladinianMageHammerofMight : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Triactis' True Paladinian Mage-Hammer of Might"); - Tooltip.SetDefault("Explodes on enemy hits"); - } - - public override void SafeSetDefaults() - { - item.width = 160; - item.damage = 10000; - 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.height = 160; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 25f; - item.Calamity().rogue = true; - item.Calamity().customRarity = CalamityRarity.Developer; - } - - 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 proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - 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(); - } - } -} diff --git a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.png b/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.png deleted file mode 100644 index 3f86fa3c6d..0000000000 Binary files a/Items/Weapons/Rogue/TriactisTruePaladinianMageHammerofMight.png and /dev/null differ diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.cs b/Items/Weapons/Rogue/TruePaladinsHammer.cs deleted file mode 100644 index a68434ff8a..0000000000 --- a/Items/Weapons/Rogue/TruePaladinsHammer.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Hybrid; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class TruePaladinsHammer : RogueWeapon - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fallen Paladin's Hammer"); - Tooltip.SetDefault("Explodes on enemy hits"); - } - - public override void SafeSetDefaults() - { - 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.height = 28; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - 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) - { - int proj = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - return false; - } - - 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(); - } - } -} diff --git a/Items/Weapons/Rogue/TruePaladinsHammer.png b/Items/Weapons/Rogue/TruePaladinsHammer.png deleted file mode 100644 index b527ef88b6..0000000000 Binary files a/Items/Weapons/Rogue/TruePaladinsHammer.png and /dev/null differ diff --git a/Items/Weapons/Rogue/Turbulance.cs b/Items/Weapons/Rogue/Turbulance.cs index 0d02193358..789380eaa1 100644 --- a/Items/Weapons/Rogue/Turbulance.cs +++ b/Items/Weapons/Rogue/Turbulance.cs @@ -31,7 +31,7 @@ Stealth strikes are trailed by homing wind slashes"); item.autoReuse = true; item.height = 14; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -41,8 +41,9 @@ Stealth strikes are trailed by homing wind slashes"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/UrchinStinger.cs b/Items/Weapons/Rogue/UrchinStinger.cs index d70ddd1b2b..be1b217dd7 100644 --- a/Items/Weapons/Rogue/UrchinStinger.cs +++ b/Items/Weapons/Rogue/UrchinStinger.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 26; item.maxStack = 999; item.value = 200; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; diff --git a/Items/Weapons/Rogue/UtensilPoker.cs b/Items/Weapons/Rogue/UtensilPoker.cs index 8b3b8241ab..4500d58c06 100644 --- a/Items/Weapons/Rogue/UtensilPoker.cs +++ b/Items/Weapons/Rogue/UtensilPoker.cs @@ -1,3 +1,4 @@ +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -6,76 +7,84 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class UtensilPoker : RogueWeapon - { + public class UtensilPoker : RogueWeapon + { private int counter = 0; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Utensil Poker"); - Tooltip.SetDefault("Space chickens, that is all.\n" + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Utensil Poker"); + Tooltip.SetDefault("Space chickens, that is all.\n" + "Fires random utensils in bursts of three\n" + - "Grants Well Fed on enemy hits\n" + - "Stealth strikes launch an additional butcher knife"); - } + "Grants Well Fed on enemy hits\n" + + "Stealth strikes replace any utensil with a powerful butcher knife"); + } - public override void SafeSetDefaults() - { - item.width = 44; - item.height = 66; - item.damage = 540; - 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 = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 16f; - } + 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; + } - 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() && counter == 0) - { - int stealth = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, ModContent.ProjectileType(), (int)(damage * 1.4), knockBack, player.whoAmI); - Main.projectile[stealth].Calamity().stealthStrike = true; - } - int utensil = item.shoot; - float dmgMult = 1f; - float kbMult = 1f; - switch (Main.rand.Next(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) + { + CalamityPlayer mp = player.Calamity(); + + if (mp.StealthStrikeAvailable()) { - case 0: - utensil = item.shoot; - dmgMult = 1.1f; - kbMult = 2f; - break; - case 1: - utensil = ModContent.ProjectileType(); - dmgMult = 1.2f; - kbMult = 1f; - break; - case 2: - utensil = ModContent.ProjectileType(); - dmgMult = 1f; - kbMult = 1f; - break; - default: - break; + int stealthDamage = damage * 2; + float stealthSpeedMult = 1.4f; + Vector2 stealthVelocity = new Vector2(speedX, speedY) * stealthSpeedMult; + int stealth = Projectile.NewProjectile(position, stealthVelocity, ModContent.ProjectileType(), stealthDamage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; + } + else + { + int utensil = item.shoot; + double dmgMult = 1D; + float kbMult = 1f; + switch (Main.rand.Next(3)) + { + case 0: + utensil = item.shoot; + dmgMult = 1.1; + kbMult = 2f; + break; + case 1: + utensil = ModContent.ProjectileType(); + dmgMult = 1.2; + kbMult = 1f; + break; + case 2: + utensil = ModContent.ProjectileType(); + dmgMult = 1D; + kbMult = 1f; + break; + default: + break; + } + Projectile.NewProjectile(position, new Vector2(speedX, speedY), utensil, (int)(damage * dmgMult), knockBack * kbMult, player.whoAmI); } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, utensil, (int)(damage * dmgMult), knockBack * kbMult, player.whoAmI); counter++; - if (counter >= 3) + if (counter == 3) counter = 0; - return false; - } - } + return false; + } + } } diff --git a/Items/Weapons/Rogue/Valediction.cs b/Items/Weapons/Rogue/Valediction.cs index f047e1a40b..cfb719cc8d 100644 --- a/Items/Weapons/Rogue/Valediction.cs +++ b/Items/Weapons/Rogue/Valediction.cs @@ -12,27 +12,27 @@ namespace CalamityMod.Items.Weapons.Rogue { DisplayName.SetDefault("Valediction"); Tooltip.SetDefault("Throws a homing reaper scythe\n" + - "Stealth strikes spawn razorblade typhoons on enemy hits"); + "Stealth strikes spawn razorblade typhoons on enemy hits"); } public override void SafeSetDefaults() { item.width = 80; - item.damage = 405; + item.height = 64; + item.damage = 243; item.noMelee = true; item.noUseGraphic = true; - item.useAnimation = 15; - item.useTime = 15; + item.useAnimation = 17; + item.useTime = 17; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 20f; item.Calamity().rogue = true; + + item.value = CalamityGlobalItem.Rarity13BuyPrice; item.Calamity().customRarity = CalamityRarity.PureGreen; } @@ -40,8 +40,9 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); - Main.projectile[stealth].Calamity().stealthStrike = true; + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/Valediction.png b/Items/Weapons/Rogue/Valediction.png index 1c3cefaf35..bddd62e87f 100644 Binary files a/Items/Weapons/Rogue/Valediction.png and b/Items/Weapons/Rogue/Valediction.png differ diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs index d95e54c019..1d51578630 100644 --- a/Items/Weapons/Rogue/WebBall.cs +++ b/Items/Weapons/Rogue/WebBall.cs @@ -30,7 +30,7 @@ Stealth strikes slow enemies down longer"); item.UseSound = SoundID.Item1; item.height = 18; item.value = Item.buyPrice(0, 0, 0, 30); - item.rare = 0; + item.rare = ItemRarityID.White; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6.5f; item.Calamity().rogue = true; @@ -40,8 +40,9 @@ Stealth strikes slow enemies down longer"); { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { - int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, item.damage, item.knockBack, player.whoAmI, 0f, 0f); - Main.projectile[proj].Calamity().stealthStrike = true; + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = true; return false; } return true; diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index e3237c91dd..9a24f519bf 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Rogue item.autoReuse = true; item.height = 38; item.maxStack = 999; - item.value = Item.buyPrice(0, 0, 1, 0); - item.rare = 1; + item.value = Item.sellPrice(0, 0, 0, 5); + item.rare = ItemRarityID.Blue; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; item.Calamity().rogue = true; @@ -52,10 +52,13 @@ namespace CalamityMod.Items.Weapons.Rogue { int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY) * 1.3f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); Projectile proj = Main.projectile[p]; - proj.Calamity().stealthStrike = true; - proj.penetrate = 4; - proj.usesLocalNPCImmunity = true; - proj.localNPCHitCooldown = 1; + if (p.WithinBounds(Main.maxProjectiles)) + { + proj.Calamity().stealthStrike = true; + proj.penetrate = 4; + proj.usesLocalNPCImmunity = true; + proj.localNPCHitCooldown = 1; + } return false; } return true; diff --git a/Items/Weapons/Rogue/XerocPitchfork.cs b/Items/Weapons/Rogue/XerocPitchfork.cs index 86bd16da89..cc0eb2c397 100644 --- a/Items/Weapons/Rogue/XerocPitchfork.cs +++ b/Items/Weapons/Rogue/XerocPitchfork.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue item.height = 48; item.maxStack = 999; item.value = 10000; - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; item.Calamity().rogue = true; @@ -42,7 +42,8 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable()) { int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); - Main.projectile[stealth].Calamity().stealthStrike = true; + if (stealth.WithinBounds(Main.maxProjectiles)) + Main.projectile[stealth].Calamity().stealthStrike = true; } return !player.Calamity().StealthStrikeAvailable(); } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index 74be280dec..e781e5838c 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -8,17 +8,17 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class AbandonedSlimeStaff : ModItem + public class AbandonedSlimeStaff : ModItem { - int slimeSlots; + int slimeSlots; public override void SetStaticDefaults() { DisplayName.SetDefault("Abandoned Slime Staff"); Tooltip.SetDefault("Cast down from the heavens in disgust, this relic sings a song of quiet tragedy...\n" + - "Consumes all of the remaining minion slots on use\n" + - "Must be used from the hotbar\n" + - "Increased power and size based on the number of minion slots used\n" + - "Holding this weapon grants 20% increased jump speed"); + "Consumes all of the remaining minion slots on use\n" + + "Must be used from the hotbar\n" + + "Increased power and size based on the number of minion slots used\n" + + "Holding this weapon grants 10% increased jump speed"); } public override void SetDefaults() @@ -37,57 +37,41 @@ namespace CalamityMod.Items.Weapons.Summon item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.Calamity().customRarity = CalamityRarity.Dedicated; //rarity 21 + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = ItemRarityID.Lime; + item.Calamity().donorItem = true; } - public override void ModifyTooltips(List list) + public override void HoldItem(Player player) { - bool autoJump = Main.player[Main.myPlayer].autoJump; - string jumpAmt = autoJump ? "5" : "20"; - foreach (TooltipLine line2 in list) + player.jumpSpeedBoost += 0.5f; + + double minionCount = 0; + for (int j = 0; j < Main.projectile.Length; j++) { - if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + Projectile projectile = Main.projectile[j]; + if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType()) { - line2.text = "Holding this weapon grants " + jumpAmt + "% increased jump speed"; + minionCount += projectile.minionSlots; } } + slimeSlots = (int)(player.maxMinions - minionCount); } - public override void HoldItem(Player player) - { - //same boost as Aero Stone - player.jumpSpeedBoost += player.autoJump ? 0.25f : 1f; - - double minionCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { - Projectile projectile = Main.projectile[j]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType()) - { - minionCount += projectile.minionSlots; - } - } - slimeSlots = (int)(player.maxMinions - minionCount); - } - public override bool CanUseItem(Player player) - { - return slimeSlots >= 1; - } + { + return slimeSlots >= 1; + } 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); - float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; - float size = ((float)Math.Log(slimeSlots, 10f)) + 1f; + CalamityUtils.KillShootProjectiles(true, type, player); + float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; position = Main.MouseWorld; speedX = 0; speedY = 0; int slime = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, (int)(damage * damageMult), knockBack, player.whoAmI); - Main.projectile[slime].Calamity().lineColor = slimeSlots; - Main.projectile[slime].scale = size; + Main.projectile[slime].minionSlots = slimeSlots; return false; } } diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index dd0ced89f2..6c8ecdc6de 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item30; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index 5c6794a6f0..7502e45db7 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -8,32 +8,32 @@ namespace CalamityMod.Items.Weapons.Summon { public class AngryChickenStaff : ModItem { + public const int Damage = 107; public override void SetStaticDefaults() { DisplayName.SetDefault("Yharon's Kindle Staff"); Tooltip.SetDefault("Summons the Son of Yharon to fight for you\n" + - "The dragon increases your life regen, defense, and movement speed while summoned\n" + "Requires 4 minion slots to use"); } public override void SetDefaults() { - item.mana = 50; - item.damage = 130; + item.mana = 10; + item.damage = Damage; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 32; item.height = 32; item.useTime = item.useAnimation = 10; item.noMelee = true; item.knockBack = 7f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; + 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.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/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index df9fafc995..717ff7121d 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 5; - item.mana = 9; + item.mana = 10; item.width = 40; item.height = 40; item.useTime = item.useAnimation = 35; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 1f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index 1128e9a54f..5f970ff13e 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -14,15 +14,15 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Temporal Umbrella"); Tooltip.SetDefault("Surprisingly sturdy, I reckon this could defeat the Mafia in a single blow\n" + - "Summons a magic hat to hover above your head\n" + - "The hat will release a variety of objects to assault your foes\n" + - "Requires 5 minion slots to use\n" + - "There can only be one"); + "Summons a magic hat to hover above your head\n" + + "The hat will release a variety of objects to assault your foes\n" + + "Requires 5 minion slots to use\n" + + "There can only be one"); } public override void SetDefaults() { - item.damage = 963; + item.damage = 193; item.knockBack = 1f; item.mana = 99; item.useTime = item.useAnimation = 10; @@ -35,9 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon item.height = 72; item.noMelee = true; item.UseSound = SoundID.Item68; - item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + 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; diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 121e537e48..f9029fbb2a 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; - item.rare = 4; + 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 45094ef7de..7a59a8a330 100644 --- a/Items/Weapons/Summon/BlightedEyeStaff.cs +++ b/Items/Weapons/Summon/BlightedEyeStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item82; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/BlightedEyeStaff.png b/Items/Weapons/Summon/BlightedEyeStaff.png index 7503c09f9d..4f19cd0ad8 100644 Binary files a/Items/Weapons/Summon/BlightedEyeStaff.png and b/Items/Weapons/Summon/BlightedEyeStaff.png differ diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs index bc06032153..948f6fb161 100644 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ b/Items/Weapons/Summon/BloodClotStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 62ab1d1dd2..6c7bcb1c84 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 35; - item.mana = 15; + item.mana = 10; item.width = 48; item.height = 56; item.useTime = item.useAnimation = 20; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item44; //item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 655a09d704..051591a096 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 640; - item.mana = 32; + item.damage = 384; + item.mana = 10; item.summon = true; item.sentry = true; item.width = 54; @@ -26,23 +26,18 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.Calamity().postMoonLordRarity = 13; - item.rare = 10; item.UseSound = SoundID.NPCDeath13; item.shoot = ModContent.ProjectileType(); + + 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) { - if (player.altFunctionUse != 2) - { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); - if (CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) - return false; - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); - player.UpdateMaxTurrets(); - } + //CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 4a2b7b8f0c..47f3d41d16 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 158; + item.damage = 95; item.mana = 10; item.width = 62; item.height = 62; @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2.5f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item83; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 2febdbe250..8814674728 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.Weapons.Summon { item.damage = 8; item.mana = 10; - item.width = 10; - item.height = 32; + item.width = 36; + item.height = 42; item.useTime = item.useAnimation = 35; item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 0f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -38,11 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - position = Main.MouseWorld; - Point mouseTileCoords = position.ToTileCoordinates(); - if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y + 1)) - return false; - Projectile.NewProjectile(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/CausticCroakerStaff.png b/Items/Weapons/Summon/CausticCroakerStaff.png index 77d97c90da..0c1aa28176 100644 Binary files a/Items/Weapons/Summon/CausticCroakerStaff.png and b/Items/Weapons/Summon/CausticCroakerStaff.png differ diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 451d825b50..aa5dced730 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Items.Weapons.Summon { public class CausticStaff : ModItem @@ -11,27 +12,29 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Caustic Staff"); Tooltip.SetDefault("Summons a mini dragon to fight for you\n" + - "The dragon can inflict several debilitating debuffs if you hold a summon weapon or tool"); + "The dragon can inflict several debilitating debuffs if you hold a summon weapon or tool"); } public override void SetDefaults() { - item.mana = 10; - item.damage = 15; - item.useStyle = 1; - item.shootSpeed = 10f; - item.shoot = ModContent.ProjectileType(); - item.width = 26; - item.height = 28; - item.UseSound = SoundID.Item77; - item.useAnimation = item.useTime = 25; - item.rare = 4; - item.noMelee = true; - item.knockBack = 2f; - item.summon = true; - item.value = Item.buyPrice(0, 12, 0, 0); - item.Calamity().customRarity = CalamityRarity.Dedicated; - item.autoReuse = true; + 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.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.Calamity().donorItem = true; + + item.noMelee = true; + item.knockBack = 2f; + item.summon = true; + 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/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index 4d9f9e8720..c2627313ca 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item34; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index a3de15573c..c8c47b61c1 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -14,59 +14,51 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Cold Divinity"); - Tooltip.SetDefault("Legendary Drop\n" + - "Summons the power of the ancient ice castle\n" + - "For each minion slot used, you will gain an additional orbiting shield spike\n" + - "These spikes accelerate rapidly towards a nearby enemy to inflict heavy damage\n" + - "They take some time to regenerate after launching themselves at the target, however\n" + - "On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding\n" + - "Minion damage bonuses apply to this weapon twice for more damage\n" + - "Revengeance Drop"); + Tooltip.SetDefault("Summons the power of the ancient ice castle\n" + + "For each minion slot used, you will gain an additional orbiting shield spike\n" + + "These spikes accelerate rapidly towards a nearby enemy to inflict heavy damage\n" + + "They take some time to regenerate after launching themselves at the target, however\n" + + "On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding"); } public override void SetDefaults() { item.damage = 60; - item.mana = 20; + item.mana = 10; item.width = 52; item.height = 50; item.useTime = item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingUp; item.noMelee = true; item.knockBack = 4.5f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; item.UseSound = SoundID.Item30; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; - } + + item.value = CalamityGlobalItem.Rarity5BuyPrice; + item.rare = ItemRarityID.Pink; + item.Calamity().challengeDrop = true; + } public override void ModifyTooltips(List list) { - if (CalamityWorld.death) - { - foreach (TooltipLine line2 in list) - { - if (line2.mod == "Terraria" && line2.Name == "Tooltip7") - { - line2.text = "Provides heat and cold protection in Death Mode when in use\n" + - "Revengeance Drop"; - } - } - } + if (CalamityWorld.death) + { + foreach (TooltipLine line2 in list) + { + if (line2.mod == "Terraria" && line2.Name == "Tooltip4") + { + line2.text = "Provides heat and cold protection in Death Mode when in use\n" + + "On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding"; + } + } + } } - public override void ModifyWeaponDamage(Player player, ref float add, ref float mult, ref float flat) - { - mult += player.MinionDamage() - 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) { - //damage = (int)(damage * player.MinionDamage()); float totalMinionSlots = 0f; for (int i = 0; i < Main.projectile.Length; i++) { diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 3fd764654c..049c722d19 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 62e00f7e15..5c9550ae63 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -25,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; item.summon = true; - item.mana = 11; - item.damage = 300; + item.mana = 10; + item.damage = 97; item.knockBack = 2f; item.autoReuse = true; item.useTime = item.useAnimation = 10; @@ -34,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon item.shootSpeed = 13f; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; } @@ -53,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ItemID.RavenStaff); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 959a262002..275ed972c3 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -3,14 +3,13 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class CosmicImmaterializer : ModItem + public class CosmicImmaterializer : ModItem { public override void SetStaticDefaults() { @@ -24,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 100; - item.damage = 3000; + item.mana = 10; + item.damage = 560; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 74; item.height = 72; @@ -33,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 0f; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item60; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; @@ -45,9 +44,9 @@ 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) { - CalamityUtils.KillShootProjectiles(true, type, player); + CalamityUtils.KillShootProjectiles(true, type, player); CalamityPlayer modPlayer = player.Calamity(); - bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.godSlayerSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; //demonshade included so summoner isn't forced to use auric for BR + bool hasSummonerSet = modPlayer.tarraSummon || modPlayer.bloodflareSummon || modPlayer.silvaSummon || modPlayer.dsSetBonus || modPlayer.omegaBlueSet || modPlayer.fearmongerSet; //demonshade included so summoner isn't forced to use auric for BR Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockBack, player.whoAmI, 0f, 0f); return false; } @@ -59,8 +58,8 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 4); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index a3674cf226..13e8d4b50c 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,7 +1,6 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using System; using Terraria; @@ -20,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 295; + item.damage = 111; item.mana = 10; item.width = 46; item.height = 28; @@ -28,14 +27,14 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.HoldingUp; item.noMelee = true; item.knockBack = 6f; - item.value = Item.buyPrice(2, 50, 0, 0); item.UseSound = SoundID.Item15; //phaseblade sound effect item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; - item.rare = 10; - item.Calamity().postMoonLordRarity = 14; + + 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) @@ -82,7 +81,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 20); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index f041ee5d2c..27a60c8411 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 130; + item.damage = 89; item.mana = 10; item.width = 42; item.height = 60; @@ -26,14 +26,14 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item44; + 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.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) => player.maxMinions >= 2; diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 0bc4f464ff..6da34911c3 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index c5e872ef1e..23b14d1f2b 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -27,22 +27,19 @@ Fire rate and range increase the longer it targets an enemy"); item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 4f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + + item.value = CalamityGlobalItem.Rarity6BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().devItem = true; + 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) { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); - player.UpdateMaxTurrets(); - } + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs new file mode 100644 index 0000000000..3cad138015 --- /dev/null +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class DaedalusGolemStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Golem Staff"); + Tooltip.SetDefault("Summons a Daedalus Golem soldier that fires pellets and electricity\n" + + "Shining god of greed"); // Funny Hollow Knight reference. + } + + 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.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) + { + Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); + if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) + Projectile.NewProjectile(Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.png b/Items/Weapons/Summon/DaedalusGolemStaff.png new file mode 100644 index 0000000000..974e746cb9 Binary files /dev/null and b/Items/Weapons/Summon/DaedalusGolemStaff.png differ diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 7edaeacbc8..1f4d29ea1f 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2.25f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index f4679ecafa..e0b3b8f0ff 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -22,16 +22,16 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.DD2_DarkMageHealImpact; item.summon = true; - item.mana = 12; - item.damage = 40; + 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 = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.rare = ItemRarityID.Purple; item.Calamity().customRarity = CalamityRarity.Turquoise; } diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs new file mode 100644 index 0000000000..d528e934b8 --- /dev/null +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -0,0 +1,42 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class DeathstareRod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deathstare Rod"); + Tooltip.SetDefault("Summons an eye above your head that watches you and shoots at enemies"); + } + + 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.Rarity1BuyPrice; + item.rare = ItemRarityID.Blue; + item.UseSound = SoundID.NPCHit8; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + 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); + Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Items/Weapons/Summon/DeathstareRod.png b/Items/Weapons/Summon/DeathstareRod.png new file mode 100644 index 0000000000..fdabc4bd48 Binary files /dev/null and b/Items/Weapons/Summon/DeathstareRod.png differ diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 4e341143a6..f36bc1f1e2 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/DeepseaStaff.png b/Items/Weapons/Summon/DeepseaStaff.png index a2eb7a5345..47da2775bb 100644 Binary files a/Items/Weapons/Summon/DeepseaStaff.png and b/Items/Weapons/Summon/DeepseaStaff.png differ diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 64a9677742..54d423f24c 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 42; - item.mana = 12; + item.mana = 10; item.width = item.height = 32; item.useTime = item.useAnimation = 25; item.useStyle = ItemUseStyleID.SwingThrow; @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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 f54d4b2645..d81b6f5988 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -19,18 +19,18 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 300; - item.mana = 30; + 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 = Item.buyPrice(1, 40, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.PureGreen; - item.UseSound = SoundID.DD2_SkeletonDeath; + 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; diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index b6048dba73..d9cde879ff 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 4.5f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item113; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -38,10 +38,8 @@ 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) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + //CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index ac360cdd80..ad1c4edb2f 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 140; + item.damage = 50; item.summon = true; item.mana = 10; item.width = 36; @@ -26,13 +26,12 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item44; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - 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/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index af0c0d74b2..7895ed20d6 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -25,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.Item60; item.summon = true; - item.mana = 25; - item.damage = 450; + item.mana = 10; + item.damage = 180; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 10; @@ -34,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon item.shootSpeed = 10f; item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.DarkBlue; } @@ -55,12 +54,12 @@ namespace CalamityMod.Items.Weapons.Summon } if (bodyExists) { - Projectile.NewProjectileDirect(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); + Projectile.NewProjectileDirect(player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); } else { bodyIndex = Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); - Projectile.NewProjectile(player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); + Projectile.NewProjectile(player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, bodyIndex); for (int i = 0; i < 72; i++) { Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); @@ -80,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ItemID.StaffoftheFrostHydra); recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddTile(ModContent.TileType()); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index f877344aed..d71f77e32c 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -17,14 +17,14 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Endogenesis"); Tooltip.SetDefault("Summons an ascended ice construct to protect you \n" + - "Changes attack modes by resummoning or reusing the staff \n" + - "The first mode makes it shoot sweeping lasers aimed at the enemy \n" + - "The second mode sacrifices its limbs to shoot out homing projectiles \n" + - "The third mode allows it to agressively tackle its enemies \n" + - "The fourth mode makes the limbs function as endothermic flamethrowers \n" + - "Requires 10 minion slots to be summoned \n" + - "There can only be one \n" + - "[c/B0FBFF:Ice puns not included]"); //Icy no problems with that + "Changes attack modes by resummoning or reusing the staff \n" + + "The first mode makes it shoot sweeping lasers aimed at the enemy \n" + + "The second mode sacrifices its limbs to shoot out homing projectiles \n" + + "The third mode allows it to agressively tackle its enemies \n" + + "The fourth mode makes the limbs function as endothermic flamethrowers \n" + + "Requires 10 minion slots to be summoned \n" + + "There can only be one \n" + + "[c/B0FBFF:Ice puns not included]"); //Icy no problems with that } public override void SetDefaults() @@ -37,16 +37,16 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.mana = 80; - item.damage = 6500; + item.damage = 1300; item.knockBack = 4f; - item.crit += 18; item.autoReuse = true; item.useTime = item.useAnimation = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.value = Item.buyPrice(5, 0, 0, 0); - item.Calamity().customRarity = CalamityRarity.ItemSpecific; + item.value = CalamityGlobalItem.Rarity16BuyPrice; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; } public override bool CanUseItem(Player player) => player.maxMinions >= 10f; @@ -56,27 +56,15 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { player.itemTime = item.useTime; - Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); - source.X = Main.mouseX + Main.screenPosition.X; - source.Y = Main.mouseY + Main.screenPosition.Y; CalamityUtils.KillShootProjectileMany(player, new int[] { type, ModContent.ProjectileType(), ModContent.ProjectileType() }); - float dmgMult = 1f; - if (AttackMode == 0) //lasers - dmgMult = 0.65f; - if (AttackMode == 1) //icicles - dmgMult = 1f; - if (AttackMode == 2) //melee - dmgMult = 0.95f; - if (AttackMode == 3) //flamethrower - dmgMult = 0.9f; - int body = Projectile.NewProjectile(source, Vector2.Zero, type, (int)(damage * dmgMult), knockBack, player.whoAmI, AttackMode, 0f); - int limbs = Projectile.NewProjectile(source, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockBack, player.whoAmI, AttackMode, body); - Main.projectile[body].ai[1] = limbs; + + SummonEndoCooper(AttackMode, Main.MouseWorld, damage, knockBack, player, out _, out _); + AttackMode++; if (AttackMode > 3) AttackMode = 0; @@ -84,6 +72,26 @@ namespace CalamityMod.Items.Weapons.Summon return false; } + public static void SummonEndoCooper(int attackMode, Vector2 spawnPosition, int damage, float knockBack, Player owner, out int bodyIndex, out int limbsIndex) + { + bodyIndex = limbsIndex = -1; + if (Main.myPlayer != owner.whoAmI) + return; + + float dmgMult = 1f; + if (attackMode == 0) //lasers + dmgMult = 0.65f; + if (attackMode == 1) //icicles + dmgMult = 1f; + if (attackMode == 2) //melee + dmgMult = 0.95f; + if (attackMode == 3) //flamethrower + dmgMult = 0.9f; + bodyIndex = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockBack, owner.whoAmI, attackMode, 0f); + limbsIndex = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockBack, owner.whoAmI, attackMode, bodyIndex); + Main.projectile[bodyIndex].ai[1] = limbsIndex; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index d297a1659f..259d852c49 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -17,30 +17,27 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 170; + item.damage = 128; item.summon = true; item.sentry = true; - item.mana = 25; + item.mana = 10; item.width = 66; item.height = 68; item.useTime = item.useAnimation = 15; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.autoReuse = true; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + 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) { - if (player.altFunctionUse != 2) - { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 8f); - player.UpdateMaxTurrets(); - } + //CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 16f); + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 139cdae3f3..a20e2333e8 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 75; + item.damage = 45; item.mana = 10; item.width = 66; item.height = 70; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 1f; item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.rare = ItemRarityID.Red; item.UseSound = SoundID.Item82; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -39,8 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Vector2 origin = new Vector2(33f, 33f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.GetTexture("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) diff --git a/Items/Weapons/Summon/ExhumedVigilance.cs b/Items/Weapons/Summon/ExhumedVigilance.cs new file mode 100644 index 0000000000..c7ba200da7 --- /dev/null +++ b/Items/Weapons/Summon/ExhumedVigilance.cs @@ -0,0 +1,50 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class ExhumedVigilance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exhumed Vigilance"); + Tooltip.SetDefault("Summons either Cataclysm or Catastrophe at the mouse position\n" + + "They will look at you for a moment before charging at you\n" + + "They can do damage to both you and enemies"); + } + + public override void SetDefaults() + { + item.mana = 10; + item.damage = 1666; + item.useStyle = ItemUseStyleID.SwingThrow; + item.width = 58; + item.height = 64; + item.useTime = item.useAnimation = 30; + 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; + } + + 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) + { + if (Main.rand.NextBool(2)) + type = ModContent.ProjectileType(); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/ExhumedVigilance.png b/Items/Weapons/Summon/ExhumedVigilance.png new file mode 100644 index 0000000000..96d3b0caf3 Binary files /dev/null and b/Items/Weapons/Summon/ExhumedVigilance.png differ diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs new file mode 100644 index 0000000000..5b6c81d1b7 --- /dev/null +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -0,0 +1,56 @@ +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; +using Terraria; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class EyeOfNight : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Night"); + Tooltip.SetDefault("Summons a diseased eyeball that attaches to enemies and explodes"); + } + + public override void SetDefaults() + { + item.damage = 35; + 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.UseSound = SoundID.NPCHit1; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = 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) + Projectile.NewProjectile(Main.MouseWorld, Vector2.UnitY * -3f, 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(ItemID.ImpStaff); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/EyeOfNight.png b/Items/Weapons/Summon/EyeOfNight.png new file mode 100644 index 0000000000..6e5a635902 Binary files /dev/null and b/Items/Weapons/Summon/EyeOfNight.png differ diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs new file mode 100644 index 0000000000..210b65829c --- /dev/null +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -0,0 +1,49 @@ +using Terraria.ModLoader; +using Terraria.ID; +using TerrariaAudio = Terraria.Audio; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Materials; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class FleshOfInfidelity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flesh of Infidelity"); + Tooltip.SetDefault("Summons a tentacled ball of flesh that splashes blood onto enemies"); + } + + public override void SetDefaults() + { + item.damage = 26; + 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; + + // 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; + } + + 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.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/FleshOfInfidelity.png b/Items/Weapons/Summon/FleshOfInfidelity.png new file mode 100644 index 0000000000..cb2bb8757c Binary files /dev/null and b/Items/Weapons/Summon/FleshOfInfidelity.png differ diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs new file mode 100644 index 0000000000..02aa74bf4e --- /dev/null +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -0,0 +1,64 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class FlowersOfMortality : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flowers of Mortality"); + Tooltip.SetDefault("Summons five rainbow flowers over your head\n" + + "The combined flowers consume two and a half minion slots"); + } + + public override void SetDefaults() + { + item.damage = 405; + 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.RarityTurquoiseBuyPrice; + item.rare = ItemRarityID.Red; + item.UseSound = SoundID.Item44; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.Calamity().customRarity = CalamityRarity.Turquoise; + } + + 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) + { + CalamityUtils.KillShootProjectiles(false, type, player); + for (int i = 0; i < 5; i++) + { + Projectile blossom = Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + blossom.ai[0] = MathHelper.TwoPi * i / 5f; + blossom.rotation = blossom.ai[0]; + } + return false; + } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.LunarBar, 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/FlowersOfMortality.png b/Items/Weapons/Summon/FlowersOfMortality.png new file mode 100644 index 0000000000..6a81cbc728 Binary files /dev/null and b/Items/Weapons/Summon/FlowersOfMortality.png differ diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 447071087b..404194e337 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Items.Weapons.Summon item.summon = true; item.UseSound = SoundID.Item89; item.noMelee = true; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.value = Item.buyPrice(0, 36, 0, 0); item.autoReuse = true; item.knockBack = 4f; - item.mana = 15; + item.mana = 10; item.damage = 28; item.useTime = item.useAnimation = 25; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index f7111abbca..94a26efe1a 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item28; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index f14f0ca899..c84933dbdb 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 7f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item106; item.autoReuse = true; item.noUseGraphic = true; diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 193359e6db..4fe40746e6 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Heart"); - Tooltip.SetDefault("Summons radioactive heads that are bound by your body\n" + - "If the entity already exists, using this item again will cause it to gain more heads"); + Tooltip.SetDefault("Summons radioactive heads that are bound by your body"); } public override void SetDefaults() @@ -23,24 +22,22 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.Item42; item.summon = true; - item.mana = 16; - item.damage = 120; + item.mana = 10; + item.damage = 173; item.knockBack = 3f; item.autoReuse = true; item.useTime = item.useAnimation = 15; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - item.rare = 10; + 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) { if (player.altFunctionUse != 2) - { Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI); - } return false; } } diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 380aac1b23..acee402844 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 1f; item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item76; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index 258c47d857..cb5bd64bce 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 1.25f; item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; + item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 25b164e886..b204063ee5 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item60; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 70bc426e7c..ede1b24df2 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 1.25f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item21; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index e5046a6a05..bd480246aa 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -27,18 +27,16 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 4f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + 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) { - if (player.altFunctionUse != 2) - { - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); - player.UpdateMaxTurrets(); - } + //CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 349d7318f3..3fef682e1c 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 34; - item.mana = 19; + item.mana = 10; item.width = 52; item.height = 50; item.useTime = item.useAnimation = 25; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 4.5f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item71; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index 41c024823b..93ac76a49b 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -9,16 +9,16 @@ namespace CalamityMod.Items.Weapons.Summon { public class InfectedRemote : ModItem { - int viruliSlots; + int viruliSlots; public override void SetStaticDefaults() { DisplayName.SetDefault("Infected Remote"); Tooltip.SetDefault("There’s a faded note written on it in green\n" + - "Only the first line is readable: 'She won’t afflict you, I promise!'\n" + - "Summons the harbinger of the plague...?\n" + - "Consumes all of the remaining minion slots on use\n" + - "Must be used from the hotbar\n" + - "Increased power based on the number of minion slots used"); + "Only the first line is readable: 'She won’t afflict you, I promise!'\n" + + "Summons the harbinger of the plague...?\n" + + "Consumes all of the remaining minion slots on use\n" + + "Must be used from the hotbar\n" + + "Increased power based on the number of minion slots used"); } public override void SetDefaults() @@ -35,34 +35,35 @@ namespace CalamityMod.Items.Weapons.Summon item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; item.summon = true; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; } - public override void HoldItem(Player player) + public override void HoldItem(Player player) { - double minionCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { + double minionCount = 0; + for (int j = 0; j < Main.projectile.Length; j++) + { Projectile projectile = Main.projectile[j]; - if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType()) - { - minionCount += projectile.minionSlots; - } - } - viruliSlots = (int)((double)player.maxMinions - minionCount); - } + if (projectile.active && projectile.owner == player.whoAmI && projectile.minion && projectile.type != ModContent.ProjectileType()) + { + minionCount += projectile.minionSlots; + } + } + viruliSlots = (int)((double)player.maxMinions - minionCount); + } 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) { - CalamityUtils.KillShootProjectiles(true, type, player); - float damageMult = ((float)Math.Log(viruliSlots, 10f)) + 1f; + CalamityUtils.KillShootProjectiles(true, type, player); + float damageMult = ((float)Math.Log(viruliSlots, 10f)) + 1f; position = Main.MouseWorld; speedX = 0; speedY = 0; diff --git a/Items/Weapons/Summon/LanternoftheSoul.cs b/Items/Weapons/Summon/LanternoftheSoul.cs index 0f0db90d30..75733953e4 100644 --- a/Items/Weapons/Summon/LanternoftheSoul.cs +++ b/Items/Weapons/Summon/LanternoftheSoul.cs @@ -17,9 +17,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 250; + item.damage = 235; item.summon = true; - item.sentry = true; + item.sentry = true; item.mana = 10; item.width = 42; item.height = 60; @@ -27,20 +27,19 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 5f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; + item.rare = ItemRarityID.Purple; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); - item.Calamity().customRarity = CalamityRarity.RareVariant; - item.UseSound = SoundID.Item44; + item.Calamity().challengeDrop = true; + 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) { - position = Main.MouseWorld; - speedX = 0; - speedY = 0; - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + //CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/MagicalConch.cs b/Items/Weapons/Summon/MagicalConch.cs index 53303132e1..752c22a1ce 100644 --- a/Items/Weapons/Summon/MagicalConch.cs +++ b/Items/Weapons/Summon/MagicalConch.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index bd4d3be5a7..aa6fda68b0 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -1,6 +1,5 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -18,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.damage = 240; - item.mana = 12; + item.damage = 91; + item.mana = 10; item.width = item.height = 32; item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; @@ -32,13 +31,13 @@ namespace CalamityMod.Items.Weapons.Summon item.shootSpeed = 10f; item.summon = true; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - 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) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI); return false; } public override void AddRecipes() @@ -46,9 +45,8 @@ namespace CalamityMod.Items.Weapons.Summon ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.XenoStaff); recipe.AddIngredient(ItemID.MoonlordTurretStaff); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddIngredient(ModContent.ItemType(), 25); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index 6e73d46fcb..f946bc78f1 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item42; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs new file mode 100644 index 0000000000..cb774babb9 --- /dev/null +++ b/Items/Weapons/Summon/Perdition.cs @@ -0,0 +1,57 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class Perdition : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Perdition"); + Tooltip.SetDefault("Summons a beacon at the position of the mouse\n" + + "When a target is manually selected via right click it releases torrents of souls from below onto the target"); + } + + public override void SetDefaults() + { + item.damage = 444; + item.mana = 10; + item.width = item.height = 56; + item.useTime = item.useAnimation = 42; + 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.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.Violet; + } + + public override bool AltFunctionUse(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) + { + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); + } + else + { + // Play some demonic noises prior to a target being selected. + Main.PlaySound(SoundID.Zombie, player.Center, 93); + Main.PlaySound(SoundID.Item119, player.Center); + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/Perdition.png b/Items/Weapons/Summon/Perdition.png new file mode 100644 index 0000000000..84db27a998 Binary files /dev/null and b/Items/Weapons/Summon/Perdition.png differ diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index b2cffa339d..d71231ee12 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 1f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.UseSound = SoundID.Item76; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs new file mode 100644 index 0000000000..faee489bb3 --- /dev/null +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -0,0 +1,44 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class PolypLauncher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polyp Launcher"); + Tooltip.SetDefault("Summons a polyp bunch that launches coral chunks at nearby enemies"); + } + + 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; + } + + 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.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 20f); + player.UpdateMaxTurrets(); + return false; + } + } +} diff --git a/Items/Weapons/Summon/PolypLauncher.png b/Items/Weapons/Summon/PolypLauncher.png new file mode 100644 index 0000000000..09678f9271 Binary files /dev/null and b/Items/Weapons/Summon/PolypLauncher.png differ diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 4d059c5f8c..e5f2a09002 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -17,30 +17,32 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Flamsteed Ring"); - Tooltip.SetDefault(@"Summons a colossal controllable mech -Right click to display the mech's control panel -The panel has 3 configurations, selected using the brackets on the edges of the UI -Each bracket powers 2 out of 3 possible functions, represented by the circular icons. -The bottom left icon miniaturizes the mech to the size of a player, but weakens its weapons. -The bottom right icon is a powerful jet booster which greatly enhances movement. -The top icon is the mech's weaponry. It must be powered in order to attack. -Click the top icon to switch between Regicide, an enormous energy blade, and a powerful Gauss rifle. -Exiting the mount while a boss is alive will temporarily hinder your movement -[c/87ceeb:Now, make them pay.]"); + Tooltip.SetDefault("Summons a colossal controllable mech\n" + + "Right click to display the mech's control panel\n" + + "The panel has 3 configurations, selected using the brackets on the edges of the UI\n" + + "Each bracket powers 2 out of 3 possible functions, represented by the circular icons.\n" + + "The bottom left icon miniaturizes the mech to the size of a player, but weakens its weapons.\n" + + "The bottom right icon is a powerful jet booster which greatly enhances movement.\n" + + "The top icon is the mech's weaponry. It must be powered in order to attack.\n" + + "Click the top icon to switch between Regicide, an enormous energy blade, and a powerful Gauss rifle.\n" + + "Exiting the mount while a boss is alive will temporarily hinder your movement\n" + + CalamityUtils.ColorMessage("Now, make them pay.", new Color(135, 206, 235))); } public override void SetDefaults() { item.mana = 200; - item.damage = 9999; + item.damage = 1999; item.useStyle = ItemUseStyleID.HoldingUp; item.width = item.height = 28; item.useTime = item.useAnimation = 10; item.noMelee = true; item.knockBack = 1f; + item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - item.Calamity().customRarity = CalamityRarity.ItemSpecific; - item.rare = 10; + item.Calamity().customRarity = CalamityRarity.HotPink; + item.Calamity().devItem = true; + item.UseSound = SoundID.Item117; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; @@ -86,5 +88,98 @@ Exiting the mount while a boss is alive will temporarily hinder your movement // Otherwise create one. return true; } + + // Moved from CalamityGlobalItem since it's just a function called in one place. + internal static bool TransformItemUsage(Item item, Player player) + { + if (player.whoAmI != Main.myPlayer) + return false; + + int robotIndex = -1; + + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && + Main.projectile[i].type == ModContent.ProjectileType() && + Main.projectile[i].owner == player.whoAmI) + { + robotIndex = i; + break; + } + } + if (robotIndex != -1) + { + Projectile robot = Main.projectile[robotIndex]; + GiantIbanRobotOfDoom robotModProjectile = ((GiantIbanRobotOfDoom)robot.modProjectile); + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && + robotModProjectile.TopIconActive && + (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || + !robotModProjectile.RightIconActive)) // "Melee" attack + { + int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge; + if (item.Calamity().rogue) + { + damage = (int)(damage * player.RogueDamage()); + } + if (item.melee) + { + damage = (int)(damage * player.MeleeDamage()); + } + if (item.ranged) + { + damage = (int)(damage * player.RangedDamage()); + } + if (item.magic) + { + damage = (int)(damage * player.MagicDamage()); + } + if (item.summon) + { + damage = (int)(damage * player.MinionDamage()); + } + Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, + Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); + + if (blade.whoAmI.WithinBounds(Main.maxProjectiles)) + { + if (item.Calamity().rogue) + { + blade.Calamity().forceRogue = true; + } + if (item.melee) + { + blade.Calamity().forceMelee = true; + } + if (item.ranged) + { + blade.Calamity().forceRanged = true; + } + if (item.magic) + { + blade.Calamity().forceMagic = true; + } + if (item.summon) + { + blade.Calamity().forceMinion = true; + } + } + } + + if (!robotModProjectile.TopIconActive && + (robotModProjectile.LeftBracketActive || robotModProjectile.RightBracketActive) && + !robotModProjectile.BottomBracketActive && + robotModProjectile.LaserCooldown <= 0 && + (robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime || + !robotModProjectile.RightIconActive)) // "Ranged" attack + { + robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft * 2; + if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot) + { + robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft + 1; + } + } + } + return false; + } } } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index ae6af0b315..d801fab9be 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -8,7 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { - public class ResurrectionButterfly : ModItem + public class ResurrectionButterfly : ModItem { public override void SetStaticDefaults() { @@ -27,9 +27,11 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 1f; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.Calamity().customRarity = CalamityRarity.Dedicated; + + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; + item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -81,8 +83,6 @@ namespace CalamityMod.Items.Weapons.Summon r.AddIngredient(ItemID.Ectoplasm, 20); r.AddIngredient(ModContent.ItemType(), 5); r.AddIngredient(ItemID.ButterflyDust, 2); - r.AddIngredient(ModContent.ItemType()); - //r.AddIngredient(ModContent.ItemType()); r.AddTile(TileID.Loom); r.SetResult(this); r.AddRecipe(); diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 86a81dc44f..02d585dce3 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 0.5f; item.value = CalamityGlobalItem.Rarity1BuyPrice; - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item15; // Phaseblade sound effect item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index cbe8aed05d..2a59c3c760 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; + item.rare = ItemRarityID.Lime; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 042398a9a0..3794d0f2f1 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,17 +29,17 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_BetsyFlameBreath; item.summon = true; - item.mana = 100; - item.damage = 426; + item.mana = 10; + item.damage = 145; item.knockBack = 4f; item.useTime = item.useAnimation = 10; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 10f; - item.value = Item.buyPrice(2, 50, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Violet; - } + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.DarkBlue; + } public override void HoldItem(Player player) { @@ -72,8 +71,8 @@ namespace CalamityMod.Items.Weapons.Summon { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(ModContent.TileType()); + recipe.AddIngredient(ModContent.ItemType(), 25); + recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index f3d14ff91b..78f4b71479 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 0.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item83; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SeaboundStaff.cs b/Items/Weapons/Summon/SeaboundStaff.cs index f5ed30b147..118f88cae1 100644 --- a/Items/Weapons/Summon/SeaboundStaff.cs +++ b/Items/Weapons/Summon/SeaboundStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index e339fc04cb..b624a01951 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 2173e3cf9a..a515e42b6a 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -29,15 +29,15 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item44; item.summon = true; - item.mana = 60; - item.damage = 275; + 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 = 10; + item.rare = ItemRarityID.Red; item.Calamity().customRarity = CalamityRarity.PureGreen; } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs new file mode 100644 index 0000000000..fbabc6c6be --- /dev/null +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -0,0 +1,48 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class SlimePuppetStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Slime Puppet Staff"); + 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; + } + + public override void SetDefaults() + { + item.damage = 26; + item.mana = 10; + item.width = 48; + item.height = 56; + item.useTime = item.useAnimation = 24; + 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; + } + + public override Vector2? HoldoutOrigin() => new Vector2(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) + { + if (player.altFunctionUse != 2) + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, Main.myPlayer); + + return false; + } + } +} diff --git a/Items/Weapons/Summon/SlimePuppetStaff.png b/Items/Weapons/Summon/SlimePuppetStaff.png new file mode 100644 index 0000000000..119db86506 Binary files /dev/null and b/Items/Weapons/Summon/SlimePuppetStaff.png differ diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 59fe58d3b1..3768abcc23 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + item.rare = ItemRarityID.Yellow; item.autoReuse = true; item.shootSpeed = 20f; item.UseSound = SoundID.Item78; @@ -36,14 +36,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.altFunctionUse != 2) - { - Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); - if (CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).active()) - return false; - Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 120f, 0f); - player.UpdateMaxTurrets(); - } + //CalamityUtils.OnlyOneSentry(player, type); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 120f, 0f); + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index fb43684b17..2c28e91909 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 0.5f; item.value = Item.buyPrice(0, 0, 50, 0); - item.rare = 0; + item.rare = ItemRarityID.White; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index e19d6adc18..3116cf867f 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 3.5f; item.value = Item.buyPrice(0, 12, 0, 0); - item.rare = 4; + item.rare = ItemRarityID.LightRed; item.UseSound = SoundID.Item44; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 3a343e2281..01d1650b6b 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -1,5 +1,6 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,18 +9,18 @@ namespace CalamityMod.Items.Weapons.Summon { public class StaffoftheMechworm : ModItem { + // This value is also referenced by the God Slayer and Auric summoner helmets. + public const int BaseDamage = 144; // originally 325 public override void SetStaticDefaults() { DisplayName.SetDefault("Staff of the Mechworm"); - Tooltip.SetDefault("Summons an aerial mechworm to fight for you\n" + - "Damage scales with the amount of minion slots you have\n" + - "The damage scaling stops growing after 10 minion slots"); + Tooltip.SetDefault("Summons an aerial mechworm to fight for you"); } public override void SetDefaults() { - item.damage = 30; - item.mana = 15; + item.damage = BaseDamage; + item.mana = 10; item.width = 58; item.height = 58; item.useTime = 12; @@ -27,14 +28,14 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 2f; - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item113; + 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.Calamity().customRarity = CalamityRarity.PureGreen; } public override bool CanUseItem(Player player) @@ -56,27 +57,55 @@ namespace CalamityMod.Items.Weapons.Summon return true; } + public static void SummonBaseMechworm(int damage, float knockBack, Player owner, out int tailIndex) + { + tailIndex = -1; + if (Main.myPlayer != owner.whoAmI) + return; + + int curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, 0f, 0f); + curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[curr].identity, 0f); + int prev = curr; + curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[curr].identity, 0f); + Main.projectile[prev].localAI[1] = curr; + prev = curr; + curr = Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[curr].identity, 0f); + Main.projectile[prev].localAI[1] = curr; + + tailIndex = curr; + } + + public static void AddSegmentToMechworm(int tailIndex, int damage, float knockBack, Player owner) + { + if (Main.myPlayer != owner.whoAmI) + return; + + Vector2 spawnPosition = Main.projectile[tailIndex].Center; + Projectile tailAheadSegment = Main.projectile.Take(Main.maxProjectiles).FirstOrDefault(proj => MechwormBody.SameIdentity(proj, owner.whoAmI, (int)Main.projectile[tailIndex].ai[0])); + int body = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, tailAheadSegment.identity, 0f); + int body2 = body; + body = Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), damage, knockBack, owner.whoAmI, Main.projectile[body].identity, 0f); + + var m = Main.projectileIdentity; + Main.projectile[tailIndex].ai[0] = Main.projectile[body].identity; + Main.projectile[tailIndex].netUpdate = 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 maxMinionScale = player.maxMinions; - if (maxMinionScale > 10) - { - maxMinionScale = 10; - } - damage = (int)(damage * ((player.MinionDamage() * 5 / 3) + (player.MinionDamage() * 0.46f * (maxMinionScale - 1)))); int head = -1; int tail = -1; - for (int num187 = 0; num187 < Main.projectile.Length; num187++) + for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[num187].active && Main.projectile[num187].owner == Main.myPlayer) + if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer) { - if (head == -1 && Main.projectile[num187].type == ModContent.ProjectileType()) + if (head == -1 && Main.projectile[i].type == ModContent.ProjectileType()) { - head = num187; + head = i; } - if (tail == -1 && Main.projectile[num187].type == ModContent.ProjectileType()) + if (tail == -1 && Main.projectile[i].type == ModContent.ProjectileType()) { - tail = num187; + tail = i; } if (head != -1 && tail != -1) { @@ -85,35 +114,9 @@ namespace CalamityMod.Items.Weapons.Summon } } if (head == -1 && tail == -1) - { - speedX = 0f; - speedY = 0f; - position.X = (float)Main.mouseX + Main.screenPosition.X; - position.Y = (float)Main.mouseY + Main.screenPosition.Y; - int curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, curr, 0f); - int head2 = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, curr, 0f); - Main.projectile[head2].localAI[1] = curr; - head2 = curr; - curr = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, curr, 0f); - Main.projectile[head2].localAI[1] = curr; - } + SummonBaseMechworm(damage, knockBack, player, out _); else if (head != -1 && tail != -1) - { - int body = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, Projectile.GetByUUID(Main.myPlayer, Main.projectile[tail].ai[0]), 0f); - int body2 = body; - body = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, body, 0f); - Main.projectile[body2].localAI[1] = body; - Main.projectile[body2].netUpdate = true; - Main.projectile[body2].ai[1] = 1f; - Main.projectile[body].localAI[1] = tail; - Main.projectile[body].netUpdate = true; - Main.projectile[body].ai[1] = 1f; - Main.projectile[tail].ai[0] = Main.projectile[body].projUUID; - Main.projectile[tail].netUpdate = true; - Main.projectile[tail].ai[1] = 1f; - } + AddSegmentToMechworm(tail, damage, knockBack, player); return false; } } diff --git a/Items/Weapons/Summon/StaffoftheMechworm2.cs b/Items/Weapons/Summon/StaffoftheMechworm2.cs new file mode 100644 index 0000000000..40d5d25904 --- /dev/null +++ b/Items/Weapons/Summon/StaffoftheMechworm2.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class StaffoftheMechworm2 : ModItem + { + // This is unfinished atm. + public override bool Autoload(ref string name) => false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Staff of the Mechworm (But Exhumed!)"); + Tooltip.SetDefault("Summons a sepulcher to fight for you\n" + + "While the sepulcher is active brimstone hearts will begin to appear and orbit you\n" + + "The sepulcher will attempt to attack you more and more frequently depending on how many hearts are present\n" + + "The sepulcher takes up 4 minion slots"); + } + + public override void SetDefaults() + { + item.damage = 666; + item.mana = 10; + item.width = 58; + item.height = 58; + item.useTime = item.useAnimation = 12; + 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.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + 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(Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockBack, player.whoAmI); + return false; + } + } +} diff --git a/Items/Weapons/Summon/StaffoftheMechworm2.png b/Items/Weapons/Summon/StaffoftheMechworm2.png new file mode 100644 index 0000000000..ffcc7066c0 Binary files /dev/null and b/Items/Weapons/Summon/StaffoftheMechworm2.png differ diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index e17a54b118..92fdeaa521 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.NPCDeath34; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index e6aee8b1c1..e8cd44d18b 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -19,14 +19,14 @@ namespace CalamityMod.Items.Weapons.Summon { item.damage = 60; item.mana = 10; - item.width = 50; - item.height = 50; + 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 = 6; + item.rare = ItemRarityID.LightPurple; item.UseSound = SoundID.Item44; item.shoot = ModContent.ProjectileType(); item.summon = true; diff --git a/Items/Weapons/Summon/SunGodStaff.png b/Items/Weapons/Summon/SunGodStaff.png index eb6e2a4027..9921a6e592 100644 Binary files a/Items/Weapons/Summon/SunGodStaff.png and b/Items/Weapons/Summon/SunGodStaff.png differ diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 9f709f605c..7ba6f0b356 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -20,13 +20,13 @@ namespace CalamityMod.Items.Weapons.Summon item.damage = 12; item.mana = 10; item.width = 44; - item.height = 42; + item.height = 48; item.useTime = item.useAnimation = 35; item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; item.knockBack = 1.15f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item44; item.shoot = ModContent.ProjectileType(); item.summon = true; diff --git a/Items/Weapons/Summon/SunSpiritStaff.png b/Items/Weapons/Summon/SunSpiritStaff.png index 65e3a45f4f..49151061e7 100644 Binary files a/Items/Weapons/Summon/SunSpiritStaff.png and b/Items/Weapons/Summon/SunSpiritStaff.png differ diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index c96e44f729..e57ab79416 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,5 +1,5 @@ -using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Tactical Plague Engine"); Tooltip.SetDefault("Summons a plague jet to pummel your enemies into submission\n" + - "Consumes bullets\n" + + "Jets will fire ammo from your inventory, 66% chance to not consume ammo\n" + "Sometimes shoots a missile instead of a bullet"); } public override void SetDefaults() { - item.damage = 45; + item.damage = 52; item.mana = 10; item.width = 28; item.height = 20; @@ -27,22 +27,19 @@ namespace CalamityMod.Items.Weapons.Summon item.useStyle = ItemUseStyleID.HoldingUp; item.noMelee = true; item.knockBack = 0.5f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 1; + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; item.UseSound = SoundID.Item14; item.autoReuse = true; item.summon = true; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 16f; - 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) { if (player.altFunctionUse != 2) - { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); - } return false; } @@ -53,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 15); - recipe.AddIngredient(ModContent.ItemType(), 8); + recipe.AddIngredient(ModContent.ItemType(), 8); recipe.AddIngredient(ItemID.LunarBar, 5); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index bdc739f0fe..c8a77a5513 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 3f; item.value = CalamityGlobalItem.Rarity5BuyPrice; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.UseSound = SoundID.Item46; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Summon recipe.AddIngredient(ItemID.HallowedBar, 5); recipe.AddIngredient(ItemID.SoulofLight, 15); recipe.AddIngredient(ItemID.SoulofNight, 15); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(TileID.MythrilAnvil); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs new file mode 100644 index 0000000000..10806aa174 --- /dev/null +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -0,0 +1,91 @@ +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.Items.Materials; +using CalamityMod.Items.SummonItems; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class UniverseSplitter : ModItem + { + public const float ItemUseDustMaxRadius = 36f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Universe Splitter"); + Tooltip.SetDefault("Summons an energy field at the mouse cursor\n" + + "After the field has been deployed, it begins to summon multiple small beams\n" + + "After several seconds have passed, an enormous laser beam appears at the field's position\n" + + "This effect has a cooldown\n" + + "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)); + } + + public override void SetDefaults() + { + item.width = 54; + item.height = 76; + item.useStyle = ItemUseStyleID.SwingThrow; + item.noMelee = true; + item.UseSound = SoundID.Item122; + + item.summon = true; + item.mana = 300; + item.damage = 18000; + item.knockBack = 7f; + item.autoReuse = true; + 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; + } + + 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) + { + if (player.altFunctionUse != 2) + { + if (!player.HasBuff(ModContent.BuffType())) + { + player.AddBuff(ModContent.BuffType(), 45 * 60); + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + for (int i = 0; i < 36; i++) + { + float angle = MathHelper.TwoPi / 36f * i + Main.rand.NextFloat(MathHelper.TwoPi / 36f); + Dust dust = Dust.NewDustPerfect(position + angle.ToRotationVector2() * ItemUseDustMaxRadius, 247); + dust.velocity = Vector2.Normalize(angle.ToRotationVector2()) * 2.5f; + dust.noGravity = true; + dust.scale = 0.8f; + } + } + else + { + Projectile.NewProjectile(position, Vector2.UnitY * 3f, ProjectileID.SaucerScrap, 5, 0f, player.whoAmI); + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddIngredient(ModContent.ItemType(), 5); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/UniverseSplitter.png b/Items/Weapons/Summon/UniverseSplitter.png new file mode 100644 index 0000000000..9397d8d05a Binary files /dev/null and b/Items/Weapons/Summon/UniverseSplitter.png differ diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs new file mode 100644 index 0000000000..250df5d6c7 --- /dev/null +++ b/Items/Weapons/Summon/Vigilance.cs @@ -0,0 +1,66 @@ +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class Vigilance : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vigilance"); + Tooltip.SetDefault("Summons a soul seeker to fight for you"); + } + + public override void SetDefaults() + { + item.damage = 333; + 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.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) + { + if (player.altFunctionUse != 2) + { + int seekerIndex = 0; + int totalSeekers = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != type || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + continue; + + totalSeekers++; + } + + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != type || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + continue; + Main.projectile[i].ai[0] = seekerIndex / (float)totalSeekers; + Main.projectile[i].netUpdate = true; + + seekerIndex++; + } + } + return false; + } + } +} diff --git a/Items/Weapons/Summon/Vigilance.png b/Items/Weapons/Summon/Vigilance.png new file mode 100644 index 0000000000..cdc748ad35 Binary files /dev/null and b/Items/Weapons/Summon/Vigilance.png differ diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index 4b64f37e23..50b2bfccad 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 0.5f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item2; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs new file mode 100644 index 0000000000..77be9227c7 --- /dev/null +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -0,0 +1,67 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class ViralSprout : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Viral Sprout"); + Tooltip.SetDefault("Summons a sage spirit to fight for you\n" + + "Inflicts Sage Poison, a debuff that becomes stronger the more spirits you own"); + } + + public override void SetDefaults() + { + item.damage = 32; + item.mana = 10; + item.width = 48; + item.height = 56; + item.useTime = item.useAnimation = 20; + 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; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI); + + int minionCount = 0; + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != type || !Main.projectile[i].active || Main.projectile[i].owner != player.whoAmI) + continue; + + Main.projectile[i].localAI[0] = minionCount; + Main.projectile[i].netUpdate = true; + minionCount++; + } + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Summon/ViralSprout.png b/Items/Weapons/Summon/ViralSprout.png new file mode 100644 index 0000000000..062b3bc149 Binary files /dev/null and b/Items/Weapons/Summon/ViralSprout.png differ diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs new file mode 100644 index 0000000000..83f8740fd0 --- /dev/null +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -0,0 +1,110 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Weapons.Summon +{ + public class ViridVanguard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Virid Vanguard"); + Tooltip.SetDefault("Summons 2 blades that rotate around you\n" + + "Right clicking prompts all blades to fly upward and redirect towards the mouse"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 156; + item.summon = true; + item.sentry = true; + item.mana = 10; + item.width = 26; + item.height = 36; + item.useTime = item.useAnimation = 15; + 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; + } + + 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 totalMinionSlots = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].minion && Main.projectile[i].owner == player.whoAmI) + { + totalMinionSlots += Main.projectile[i].minionSlots; + } + } + if (player.altFunctionUse != 2 && totalMinionSlots + 1.5f < player.maxMinions) + { + position = Main.MouseWorld; + int swordCount = 0; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI) + { + if ((Main.projectile[i].modProjectile as ViridVanguardBlade).FiringTime > 0f) + continue; + swordCount++; + for (int j = 0; j < 22; j++) + { + Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 2); + dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); + dust.noGravity = true; + } + } + } + + Projectile newBlade = Projectile.NewProjectileDirect(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + (newBlade.modProjectile as ViridVanguardBlade).AltTexture = swordCount % 2 == 1; + newBlade.netUpdate = true; + swordCount++; + + newBlade = Projectile.NewProjectileDirect(position, Vector2.Zero, type, damage, knockBack, player.whoAmI); + (newBlade.modProjectile as ViridVanguardBlade).AltTexture = swordCount % 2 == 1; + newBlade.netUpdate = true; + swordCount++; + + float angleVariance = MathHelper.TwoPi / swordCount; + float angle = 0f; + for (int i = 0; i < Main.projectile.Length; i++) + { + if (Main.projectile[i].active && Main.projectile[i].type == type && Main.projectile[i].owner == player.whoAmI) + { + if ((Main.projectile[i].modProjectile as ViridVanguardBlade).FiringTime > 0f) + continue; + Main.projectile[i].ai[0] = angle; + Main.projectile[i].localAI[1] = 80f; + angle += angleVariance; + for (int j = 0; j < 22; j++) + { + Dust dust = Dust.NewDustDirect(Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height, 6); + dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool(2).ToDirectionInt(); + dust.noGravity = true; + } + } + } + } + return false; + } + 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(); + } + } +} diff --git a/Items/Weapons/Summon/ViridVanguard.png b/Items/Weapons/Summon/ViridVanguard.png new file mode 100644 index 0000000000..6455e12c54 Binary files /dev/null and b/Items/Weapons/Summon/ViridVanguard.png differ diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs new file mode 100644 index 0000000000..7059d4f4db --- /dev/null +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -0,0 +1,66 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + class VoidConcentrationStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Concentration Staff"); + Tooltip.SetDefault("Summons a foreboding aura\n" + //If you have flavour text ideas, feel free to implement, my brain is still like nonexistant as per usual yeah. + "Requires three minion slots to use\n" + + "Only one may exist\n" + + "Right click to launch a black hole that grows in size"); + } + + 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 = 10; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + + item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; + item.rare = ItemRarityID.Purple; + item.Calamity().customRarity = CalamityRarity.PureGreen; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse != 2) + return player.ownedProjectileCounts[ModContent.ProjectileType()] == 0; + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + Projectile.NewProjectile(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f); + player.AddBuff(ModContent.BuffType(), 120); + } + return false; + } + + public override bool AltFunctionUse(Player player) + { + return base.AltFunctionUse(player); + } + } +} diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.png b/Items/Weapons/Summon/VoidConcentrationStaff.png new file mode 100644 index 0000000000..d1cf945db4 Binary files /dev/null and b/Items/Weapons/Summon/VoidConcentrationStaff.png differ diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs new file mode 100644 index 0000000000..2e541f0170 --- /dev/null +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Summon +{ + public class WitherBlossomsStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wither Blossoms Staff"); + Tooltip.SetDefault("Summons four decaying flowers over your head\n" + + "The combined flowers consume two minion slots"); + } + + 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.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 10f; + item.summon = true; + } + + 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) + { + CalamityUtils.KillShootProjectiles(false, type, player); + for (int i = 0; i < 4; i++) + { + Projectile blossom = Projectile.NewProjectileDirect(player.Center, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); + blossom.ai[0] = MathHelper.TwoPi * i / 4f; + blossom.rotation = blossom.ai[0]; + } + return false; + } + 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(); + } + } +} diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.png b/Items/Weapons/Summon/WitherBlossomsStaff.png new file mode 100644 index 0000000000..c74966ede5 Binary files /dev/null and b/Items/Weapons/Summon/WitherBlossomsStaff.png differ diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 73811e9ff8..430f1c1023 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.knockBack = 0.5f; item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; + item.rare = ItemRarityID.Blue; item.UseSound = SoundID.Item15; //phaseblade sound effect item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Typeless/AeroDynamite.cs b/Items/Weapons/Typeless/AeroDynamite.cs index 96353fef66..8b34159771 100644 --- a/Items/Weapons/Typeless/AeroDynamite.cs +++ b/Items/Weapons/Typeless/AeroDynamite.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Aero Dynamite"); - Tooltip.SetDefault("Throws a floaty explosive that defies gravity"); + Tooltip.SetDefault("You don't need an aerodynamics major to use this\n" + + "Throws a floaty explosive that defies gravity"); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Typeless item.noUseGraphic = true; item.UseSound = SoundID.Item1; item.value = Item.buyPrice(0, 0, 40, 0); // Crafted 10 at a time - item.rare = 3; + item.rare = ItemRarityID.Orange; } public override void UpdateInventory(Player player) diff --git a/Items/Weapons/Typeless/Aestheticus.cs b/Items/Weapons/Typeless/Aestheticus.cs index 36432205b7..0d94064b8b 100644 --- a/Items/Weapons/Typeless/Aestheticus.cs +++ b/Items/Weapons/Typeless/Aestheticus.cs @@ -15,13 +15,12 @@ namespace CalamityMod.Items.Weapons.Typeless DisplayName.SetDefault("Aestheticus"); Tooltip.SetDefault("Fires crystals that explode and slow enemies down\n" + "This weapon scales with all your damage stats at once"); - } + } public override void SetDefaults() { item.width = 58; item.damage = 8; - item.rare = 3; item.useAnimation = 25; item.useTime = 25; item.useStyle = ItemUseStyleID.SwingThrow; @@ -29,10 +28,13 @@ namespace CalamityMod.Items.Weapons.Typeless item.UseSound = SoundID.Item109; item.autoReuse = true; item.height = 58; - item.value = Item.buyPrice(0, 4, 0, 0); + + item.value = CalamityGlobalItem.Rarity3BuyPrice; + item.rare = ItemRarityID.Orange; + item.Calamity().donorItem = true; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 5f; - item.Calamity().customRarity = CalamityRarity.Dedicated; } // Aestheticus scales off of all damage types simultaneously (meaning it scales 5x from universal damage boosts). @@ -56,25 +58,25 @@ 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(ItemID.HellstoneBar, 10); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddIngredient(ModContent.ItemType(), 5); recipe.AddIngredient(ItemID.Glass, 20); recipe.AddIngredient(ItemID.Gel, 15); - recipe.AddIngredient(ItemID.FallenStar, 5); - recipe.AddTile(TileID.Anvils); + recipe.AddIngredient(ItemID.FallenStar, 5); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Items/Weapons/Typeless/AethersWhisper.cs b/Items/Weapons/Typeless/AethersWhisper.cs index c56a1641b5..c5141383e9 100644 --- a/Items/Weapons/Typeless/AethersWhisper.cs +++ b/Items/Weapons/Typeless/AethersWhisper.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetDefaults() { - item.damage = 1150; + item.damage = 504; item.knockBack = 5.5f; item.useTime = item.useAnimation = 24; item.shootSpeed = 12f; @@ -36,9 +36,9 @@ namespace CalamityMod.Items.Weapons.Typeless item.noMelee = true; item.useStyle = ItemUseStyleID.HoldingOut; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.value = Item.buyPrice(1, 40, 0, 0); - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.PureGreen; + + item.value = CalamityGlobalItem.Rarity12BuyPrice; + item.Calamity().customRarity = CalamityRarity.Turquoise; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs index a15d10c70a..4bbda299a5 100644 --- a/Items/Weapons/Typeless/FiniteUse/Bazooka.cs +++ b/Items/Weapons/Typeless/FiniteUse/Bazooka.cs @@ -29,24 +29,21 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse item.noMelee = true; item.knockBack = 10f; item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; + 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; - } } public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - { item.Calamity().timesUsed = 2; - } + return true; } @@ -63,22 +60,18 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - { 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) { if (CalamityPlayer.areThereAnyDamnBosses) { - player.inventory[player.selectedItem].Calamity().timesUsed++; + player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type) - { + if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; - } } } return true; diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs index 65ff91d229..f5c15e33d3 100644 --- a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs +++ b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.cs @@ -21,66 +21,54 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { item.damage = 2000; - item.crit += 66; - item.width = 46; + item.width = 56; item.height = 26; item.useTime = 19; item.useAnimation = 19; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; item.knockBack = 8f; - item.value = Item.buyPrice(1, 20, 0, 0); - item.rare = 10; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/Magnum"); item.autoReuse = true; item.shootSpeed = 12f; item.shoot = ModContent.ProjectileType(); item.useAmmo = ModContent.ItemType(); - item.Calamity().customRarity = CalamityRarity.Turquoise; if (CalamityPlayer.areThereAnyDamnBosses) - { item.Calamity().timesUsed = 3; - } } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 66; + public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - { item.Calamity().timesUsed = 3; - } + return true; } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 3; - } + public override bool CanUseItem(Player player) => item.Calamity().timesUsed < 3; - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - { 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) { if (CalamityPlayer.areThereAnyDamnBosses) { - player.inventory[player.selectedItem].Calamity().timesUsed++; + player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type) - { + if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; - } } } return true; diff --git a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png index 3b05169cb0..e5b2a62323 100644 Binary files a/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png and b/Items/Weapons/Typeless/FiniteUse/ElephantKiller.png differ diff --git a/Items/Weapons/Typeless/FiniteUse/Hydra.cs b/Items/Weapons/Typeless/FiniteUse/Hydra.cs index 44a54cf9f7..e628f1e0a6 100644 --- a/Items/Weapons/Typeless/FiniteUse/Hydra.cs +++ b/Items/Weapons/Typeless/FiniteUse/Hydra.cs @@ -29,24 +29,21 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse item.noMelee = true; item.knockBack = 10f; item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; + 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; - } } public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - { item.Calamity().timesUsed = 1; - } + return true; } @@ -63,30 +60,28 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - { 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) { - for (int index = 0; index < 15; ++index) + for (int index = 0; index < 8; ++index) { - float SpeedX = speedX + (float)Main.rand.Next(-65, 66) * 0.05f; - float SpeedY = speedY + (float)Main.rand.Next(-65, 66) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = speedY + Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI); } + if (CalamityPlayer.areThereAnyDamnBosses) { - player.inventory[player.selectedItem].Calamity().timesUsed++; + player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type) - { + if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; - } } } + return false; } diff --git a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs index 97b538dd98..02c8b6c4bf 100644 --- a/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs +++ b/Items/Weapons/Typeless/FiniteUse/LightningHawk.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { item.damage = 400; - item.crit += 56; item.width = 50; item.height = 28; item.useTime = 21; @@ -30,56 +29,46 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse item.noMelee = true; item.knockBack = 8f; item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; + 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; - } } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 56; + public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - { item.Calamity().timesUsed = 3; - } + return true; } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 3; - } + public override bool CanUseItem(Player player) => item.Calamity().timesUsed < 3; - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - { 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) { if (CalamityPlayer.areThereAnyDamnBosses) { - player.inventory[player.selectedItem].Calamity().timesUsed++; + player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type) - { + if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; - } } } return true; diff --git a/Items/Weapons/Typeless/FiniteUse/Magnum.cs b/Items/Weapons/Typeless/FiniteUse/Magnum.cs index 758d926046..40baee1e7e 100644 --- a/Items/Weapons/Typeless/FiniteUse/Magnum.cs +++ b/Items/Weapons/Typeless/FiniteUse/Magnum.cs @@ -21,65 +21,54 @@ namespace CalamityMod.Items.Weapons.Typeless.FiniteUse public override void SetDefaults() { item.damage = 80; - item.crit += 46; - item.width = 46; - item.height = 24; + 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 = 2; + 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; - } } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 46; + public override bool OnPickup(Player player) { if (CalamityPlayer.areThereAnyDamnBosses) - { item.Calamity().timesUsed = 3; - } + return true; } - public override bool CanUseItem(Player player) - { - return item.Calamity().timesUsed < 3; - } + public override bool CanUseItem(Player player) => item.Calamity().timesUsed < 3; - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override void UpdateInventory(Player player) { if (!CalamityPlayer.areThereAnyDamnBosses) - { 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) { if (CalamityPlayer.areThereAnyDamnBosses) { - player.inventory[player.selectedItem].Calamity().timesUsed++; + player.HeldItem.Calamity().timesUsed++; for (int i = 0; i < Main.maxInventory; i++) { - if (player.inventory[i].type == item.type) - { + if (player.inventory[i].type == item.type && player.inventory[i] != player.HeldItem) player.inventory[i].Calamity().timesUsed++; - } } } return true; diff --git a/Items/Weapons/Typeless/FiniteUse/Magnum.png b/Items/Weapons/Typeless/FiniteUse/Magnum.png index 10f48dd4eb..8e1aa0e9f4 100644 Binary files a/Items/Weapons/Typeless/FiniteUse/Magnum.png and b/Items/Weapons/Typeless/FiniteUse/Magnum.png differ diff --git a/Items/Weapons/Typeless/GoldenGun.cs b/Items/Weapons/Typeless/GoldenGun.cs index 52e34318c6..caa74c7dbd 100644 --- a/Items/Weapons/Typeless/GoldenGun.cs +++ b/Items/Weapons/Typeless/GoldenGun.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Typeless item.noMelee = true; item.knockBack = 2f; item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.rare = ItemRarityID.Orange; item.UseSound = SoundID.Item11; item.autoReuse = true; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index 6184c7dffe..64d5a47dad 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Typeless { item.width = 80; item.damage = 9; - item.rare = 5; + item.rare = ItemRarityID.Pink; item.useAnimation = 15; item.useTime = 15; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Typeless/MarkedMagnum.cs b/Items/Weapons/Typeless/MarkedMagnum.cs index 08f95a0fe7..beffd897ee 100644 --- a/Items/Weapons/Typeless/MarkedMagnum.cs +++ b/Items/Weapons/Typeless/MarkedMagnum.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Typeless item.noMelee = true; item.knockBack = 3f; item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; + item.rare = ItemRarityID.Green; item.UseSound = SoundID.Item33; item.autoReuse = false; item.shootSpeed = 12f; diff --git a/Items/Weapons/Typeless/MarkedMagnum.png b/Items/Weapons/Typeless/MarkedMagnum.png index 69b7d5ecb0..9b22e7e3d7 100644 Binary files a/Items/Weapons/Typeless/MarkedMagnum.png and b/Items/Weapons/Typeless/MarkedMagnum.png differ diff --git a/Items/Weapons/Typeless/RelicOfDeliverance.cs b/Items/Weapons/Typeless/RelicOfDeliverance.cs index 481b20a897..206c8f88d7 100644 --- a/Items/Weapons/Typeless/RelicOfDeliverance.cs +++ b/Items/Weapons/Typeless/RelicOfDeliverance.cs @@ -22,19 +22,20 @@ namespace CalamityMod.Items.Weapons.Typeless item.height = 46; item.damage = 1350; item.useTime = item.useAnimation = 25; - item.crit += 16; item.reuseDelay = 15; item.useStyle = ItemUseStyleID.HoldingOut; item.UseSound = SoundID.Item46; item.noMelee = true; item.noUseGraphic = true; item.channel = true; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); } + // 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; } } diff --git a/Items/Weapons/Typeless/RelicOfResilience.cs b/Items/Weapons/Typeless/RelicOfResilience.cs index a2da4ccee0..f8b115884d 100644 --- a/Items/Weapons/Typeless/RelicOfResilience.cs +++ b/Items/Weapons/Typeless/RelicOfResilience.cs @@ -1,6 +1,8 @@ using CalamityMod.Buffs.Cooldowns; using CalamityMod.Projectiles.Damageable; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,15 +30,14 @@ namespace CalamityMod.Items.Weapons.Typeless { item.width = 40; item.height = 34; - item.rare = 10; - item.Calamity().customRarity = CalamityRarity.Turquoise; item.useAnimation = item.useTime = 28; item.useStyle = ItemUseStyleID.HoldingUp; item.UseSound = SoundID.Item45; item.autoReuse = true; item.noMelee = true; - item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - item.shoot = ModContent.ProjectileType(); + item.value = CalamityGlobalItem.Rarity11BuyPrice; + item.rare = ItemRarityID.Purple; + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 0f; } public override bool CanUseItem(Player player) => !player.HasBuff(ModContent.BuffType()); @@ -44,6 +45,15 @@ namespace CalamityMod.Items.Weapons.Typeless 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.AddBuff(ModContent.BuffType(), CooldownSeconds * 60); + int[] shardTypes = new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + }; if (player.ownedProjectileCounts[item.shoot] > 0) { for (int i = 0; i < Main.projectile.Length; i++) @@ -55,7 +65,7 @@ namespace CalamityMod.Items.Weapons.Typeless } } } - else + else if (shardTypes.All(proj => player.ownedProjectileCounts[proj] == 0)) { Projectile.NewProjectile(Main.MouseWorld, Vector2.Zero, type, damage, knockBack, player.whoAmI, 0f, 0f); } diff --git a/Items/Weapons/Typeless/StarStruckWater.cs b/Items/Weapons/Typeless/StarStruckWater.cs index d78cf18e64..ab30d2a0ff 100644 --- a/Items/Weapons/Typeless/StarStruckWater.cs +++ b/Items/Weapons/Typeless/StarStruckWater.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Typeless { item.useStyle = ItemUseStyleID.SwingThrow; item.shootSpeed = 14f; - item.rare = 3; + item.rare = ItemRarityID.Orange; item.damage = 20; item.shoot = ModContent.ProjectileType(); item.width = 18; diff --git a/Items/Weapons/Typeless/StarStruckWater.png b/Items/Weapons/Typeless/StarStruckWater.png index 31498f0b6e..48dd4dc502 100644 Binary files a/Items/Weapons/Typeless/StarStruckWater.png and b/Items/Weapons/Typeless/StarStruckWater.png differ diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs index 119821b428..b190a9f7f5 100644 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Weapons.Typeless public override void SetStaticDefaults() { DisplayName.SetDefault("Yanmei's Knife"); - Tooltip.SetDefault("When hitting a boss or its minions, you gain various boosts and cripple the enemy hit\n" + - "A knife from an unknown world\n" + - "An owner whose heart is pure and free of taint\n" + - "A heart of iron and valor"); + Tooltip.SetDefault("When hitting a boss, miniboss, or their minions, you gain various boosts and cripple the enemy hit\n" + + "A knife from an unknown world\n" + + "An owner whose heart is pure and free of taint\n" + + "A heart of iron and valor"); } public override void SetDefaults() @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Typeless item.height = 44; item.width = 48; item.damage = 8; - item.crit += 6; item.noMelee = true; item.noUseGraphic = true; item.useAnimation = item.useTime = 32; @@ -31,13 +30,16 @@ namespace CalamityMod.Items.Weapons.Typeless item.knockBack = 4.5f; item.autoReuse = false; item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.rare = ItemRarityID.Yellow; + item.Calamity().donorItem = true; item.UseSound = SoundID.Item71; - item.rare = 8; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 24f; - item.Calamity().customRarity = CalamityRarity.Dedicated; } + // Terraria seems to really dislike high crit values in SetDefaults + public override void GetWeaponCrit(Player player, ref int crit) => crit += 6; + public override bool CanUseItem(Player player) { if (player.Calamity().KameiBladeUseDelay > 0) @@ -52,17 +54,17 @@ namespace CalamityMod.Items.Weapons.Typeless return false; } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); + 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.anyIronBar = true; recipe.AddIngredient(ModContent.ItemType(), 50); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } diff --git a/Localization/CalamityLocalization.cs b/Localization/CalamityLocalization.cs index 69d830aff5..07aca5bfa0 100644 --- a/Localization/CalamityLocalization.cs +++ b/Localization/CalamityLocalization.cs @@ -46,34 +46,44 @@ namespace CalamityMod.Localization new [] { "GhostBossText3", "Long-dead prisoners seek their zealous revenge..." }, new [] { "GhostBossText4", "The souls released stir the acidic storms..." }, - new [] { "SupremeBossText3", "Alright, let's get started. Not sure why you're bothering." }, // start - new [] { "SupremeBossText4", "You seem so confident, even though you are painfully ignorant of what has yet to transpire." }, //75% - new [] { "SupremeBossText5", "Everything was going well until you came along." }, //75% - new [] { "SupremeBossText6", "Brothers, could you assist me for a moment? This ordeal is growing tiresome." }, //45% - new [] { "SupremeBossText", "Don't worry, I still have plenty of tricks left." }, //40% - new [] { "SupremeBossText7", "Hmm...perhaps I should let the little ones out to play for a while." },//30% - new [] { "SupremeBossText8", "Impressive...but still not good enough!" }, //20% - new [] { "SupremeBossText9", "I'm just getting started!" }, //10% - new [] { "SupremeBossText20", "How are you still alive!?" }, //8% - new [] { "SupremeBossText21", "Just stop!" }, //6% - new [] { "SupremeBossText22", "Even if you defeat me you would still have the lord to contend with!" }, //4% - new [] { "SupremeBossText23", "He has never lost a battle!" }, //2% - new [] { "SupremeBossText24", "Not even I could defeat him! What hope do you have!?" }, //1% - new [] { "SupremeBossText25", "He has grown far stronger since we last fought...you stand no chance." }, //1% after 10 seconds - new [] { "SupremeBossText26", "Well...I suppose this is the end..." }, //1% after 15 seconds - new [] { "SupremeBossText27", "Perhaps one of these times I'll change my mind..." }, //1% after first win - new [] { "SupremeBossText28", "You aren't hurting as much as I'd like...are you cheating?" }, //not taking enough damage - new [] { "SupremeBossText2", "Go to hell." }, //cheater - new [] { "SupremeBossText10", "At long last I am free...for a time. I'll keep coming back, just like you. Until we meet again, farewell." }, //end after 20 seconds - new [] { "SupremeBossText11", "Do you enjoy going through hell?" }, //rebattle after killing once - new [] { "SupremeBossText12", "Don't get me wrong, I like pain too, but you're just ridiculous." }, //rebattle after killing four times - new [] { "SupremeBossText13", "You must enjoy dying more than most people, huh?" }, //rebattle five deaths - new [] { "SupremeBossText14", "Do you have a fetish for getting killed or something?" }, //rebattle twenty deaths - new [] { "SupremeBossText15", "Alright, I'm done counting. You probably died this much just to see what I'd say." }, //rebattle fifty deaths - new [] { "SupremeBossText16", "You didn't die at all huh? Welp, you probably cheated. Do it again, for real this time...but here's your reward I guess." }, //die 0 times - new [] { "SupremeBossText17", "One death? That's it? ...I guess you earned this then." }, //die 1 time and win - new [] { "SupremeBossText18", "Two deaths, nice job. Here's your reward." }, //die 2 times and win - new [] { "SupremeBossText19", "Third time's the charm. Here's a special reward." }, //die 3 times and win + new [] { "SCalSummonText", "Do you enjoy going through hell?" }, + new [] { "SCalStartText", "You should have just died..." }, + new [] { "SCalBH2Text", "It wasn't too long ago you barely managed to defeat my doppelganger. Quite the failure, wasn't it?" }, + new [] { "SCalBH3Text", "You've harnessed great power, but you wield it for no one but yourself." }, + new [] { "SCalBrothersText", "Would you like to meet my family? Horrible, isn't it?" }, + new [] { "SCalPhase2Text", "You will suffer greatly." }, + new [] { "SCalBH4Text", "It's absurd to even think of trying to get away. As long as you live, you will suffer." }, + new [] { "SCalSeekerRingText", "An upstart who recklessly stole and killed their way to power. I wonder, who does that remind me of...?" }, + new [] { "SCalBH5Text", "You have no stake in this battle. No one gave you any say in this matter!" }, + new [] { "SCalSepulcher2Text", "Once the dust has settled and only one remains, if it is you, what value will this have had?!" }, + new [] { "SCalDesparationText1", "Just stop!" }, + new [] { "SCalDesparationText2", "I have no future if I lose here." }, + new [] { "SCalDesparationText3", "Once you have bested me, you too will only have one path forward." }, + new [] { "SCalDesparationText4", "And that path... also has no future." }, + new [] { "SCalAcceptanceText1", "Even if he has thrown all else away, his power remains." }, + new [] { "SCalAcceptanceText2", "I have no more energy left to resent him, or you..." }, + new [] { "SCalAcceptanceText3", "It will all be in your hands now." }, + + // Some of these keys are incorrect in terms of their contents, but they remain as their bases + an addon at the end to make it + // easier to define them. + new [] { "SCalSummonTextRematch", "You called? If you're looking to get scorched, you've got the right person." }, + new [] { "SCalStartTextRematch", "Ha! You saw it coming this time." }, + new [] { "SCalBH2TextRematch", "Don't get cocky just because you've won once." }, + new [] { "SCalBH3TextRematch", "You know, I was expecting a house call from the Tyrant at this point. Think he died?" }, + new [] { "SCalBH3TextRematch2", "Haha, no way." }, + new [] { "SCalBrothersTextRematch", "Would you like to meet my family? Horrible, isn't it?" }, + new [] { "SCalBrothersTextRematch2", "I'm joking. They are but empty shells now. Did I frighten you?" }, + new [] { "SCalPhase2TextRematch", "Here we go again." }, + new [] { "SCalBH4TextRematch", "Remember these? I bet you've seen them a few times since the last battle... in your nightmares." }, + new [] { "SCalSeekerRingTextRematch", "It seems your skill hasn't faltered in the least." }, + new [] { "SCalBH5TextRematch", "One last go." }, + new [] { "SCalSepulcher2TextRematch", "And... you never cease to amaze." }, + new [] { "SCalDesparationText1Rematch", "You may even have a proper chance now." }, + new [] { "SCalDesparationText2Rematch", "I wonder if you've met his mechanic yet." }, + new [] { "SCalDesparationText3Rematch", "I trust you will not make the same mistakes he did." }, + new [] { "SCalDesparationText4Rematch", "Now... even I cannot see what your future holds." }, + + new [] { "SCalFunnyCheatText", "Go to hell." }, new [] { "EdgyBossText", "Don't get cocky, kid!" }, new [] { "EdgyBossText2", "You think...you can butcher...ME!?" }, @@ -107,7 +117,12 @@ namespace CalamityMod.Localization new [] { "CryogenBossText", "Cryogen is derping out!" }, - new [] { "BloodMoonText", "The Blood Moon is rising..." }, + new [] { "HardmodeOreTier1Text", "Your world has been blessed with Cobalt and Palladium!" }, + new [] { "HardmodeOreTier2Text", "Your world has been blessed with Mythril and Orichalcum!" }, + new [] { "HardmodeOreTier3Text", "Your world has been blessed with Adamantite and Titanium!" }, + new [] { "HardmodeOreTier4Text", "The hallow has been blessed with consecrated stone!" }, + + new [] { "BloodMoonText", "The Blood Moon is rising..." }, new [] { "DargonBossText", "The dark sun awaits." }, new [] { "DargonBossText2", "My dragon deems you an unworthy opponent. You must acquire the power of the dark sun to witness his true power." }, @@ -115,10 +130,13 @@ namespace CalamityMod.Localization new [] { "RevengeText", "Revengeance is active." }, new [] { "RevengeText2", "Revengeance is not active." }, - new [] { "DeathText", "Death is active, enjoy the fun." }, - new [] { "DeathText2", "Death is not active, not fun enough for you?" }, + new [] { "DeathText", "Death is active; enjoy the fun." }, + new [] { "DeathText2", "Death is not active; not fun enough for you?" }, - new [] { "ArmageddonText", "Bosses will now kill you instantly." }, + new [] { "MaliceText", "Malice is active; witness the horror!" }, + new [] { "MaliceText2", "Malice is not active." }, + + new [] { "ArmageddonText", "Bosses will now kill you instantly." }, new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." }, new [] { "DefiledText", "Your soul is mine..." }, @@ -127,6 +145,8 @@ namespace CalamityMod.Localization new [] { "IronHeartText", "Iron Heart is active, healing is disabled." }, new [] { "IronHeartText2", "Iron Heart is not active, healing is restored." }, + new [] { "ChangingTheRules", "You cannot change the rules now." }, + new [] { "FlameText", "The air is getting warmer around you." }, new [] { "BossRushStartText", "Hmm? Ah, another contender. Very well, may the ritual commence!" }, diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 56614fb90b..dbec5dd680 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -2,8 +2,12 @@ using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles; +using CalamityMod.UI; +using CalamityMod.UI.CalamitasEnchants; using CalamityMod.World; using System; +using System.Collections.Generic; +using System.Linq; using Terraria; namespace CalamityMod @@ -69,6 +73,20 @@ namespace CalamityMod case "the slime god": return CalamityWorld.downedSlimeGod; + case "hmclam": + case "clamhm": + case "hm clam": + case "clam hm": + case "hmgiantclam": + case "giantclamhm": + case "hm giant clam": + case "giant clam hm": + case "hardmodeclam": + case "hardmode clam": + case "hardmodegiantclam": + case "hardmode giant clam": + return CalamityWorld.downedCLAMHardMode; + case "cryogen": return CalamityWorld.downedCryogen; @@ -236,28 +254,34 @@ namespace CalamityMod case "the devourer of gods": return CalamityWorld.downedDoG; - case "darksun": - case "darksuneclipse": - case "darksun eclipse": - case "buffedeclipse": - case "buffed eclipse": - case "mothron": - case "darksunmothron": - case "darksun mothron": - case "buffedmothron": - case "buffed mothron": - return CalamityWorld.downedBuffedMothron; - case "yharon": case "jungledragonyharon": case "jungle dragon yharon": case "jungle dragon, yharon": return CalamityWorld.downedYharon; + case "draedon": + case "exomechs": + case "exo mechs": + case "the exo mechs": + case "apollo": + case "artemis": + case "thanatos": + case "ares": + return CalamityWorld.downedExoMechs; + case "scal": case "supremecalamitas": case "supreme calamitas": return CalamityWorld.downedSCal; + + case "adulteidolonwyrm": + case "adult eidolon wyrm": + case "adultwyrm": + case "adult wyrm": + case "adulteidolon": + case "adult eidolon": + return CalamityWorld.downedAdultEidolonWyrm; } } #endregion @@ -396,19 +420,17 @@ namespace CalamityMod case "death mode": return CalamityWorld.death; + case "malice": + case "malicemode": + case "malice mode": + return CalamityWorld.malice; + case "br": case "bossrush": case "boss rush": case "bossrushactive": case "boss rush active": - return CalamityWorld.bossRushActive; - - case "defiled": - case "defiledrune": - case "defiled rune": - case "defiledmode": - case "defiled mode": - return CalamityWorld.defiled; + return BossRushEvent.BossRushActive; case "armageddon": case "arma": @@ -420,9 +442,6 @@ namespace CalamityMod case "ironheart": case "iron heart": - case "steelsoul": - case "steel soul": - case "permadeath": return CalamityWorld.ironHeart; } } @@ -452,19 +471,17 @@ namespace CalamityMod case "death mode": return CalamityWorld.death = enabled; + case "malice": + case "malicemode": + case "malice mode": + return CalamityWorld.malice = enabled; + case "br": case "bossrush": case "boss rush": case "bossrushactive": case "boss rush active": - return CalamityWorld.bossRushActive = enabled; - - case "defiled": - case "defiledrune": - case "defiled rune": - case "defiledmode": - case "defiled mode": - return CalamityWorld.defiled = enabled; + return BossRushEvent.BossRushActive = enabled; case "armageddon": case "arma": @@ -565,811 +582,6 @@ namespace CalamityMod } #endregion - #region Player Armor Set Bonuses - /// - /// Returns whether the specified player has the set bonus corresponding to the given string. - /// - /// The player whose set bonuses are being questioned. - /// The set bonus to check for. - /// Whether the player currently has the set bonus. - public static bool GetSetBonus(Player p, string setBonus) - { - CalamityPlayer mp = p.Calamity(); - - setBonus = setBonus.ToLower(); - - // LATER -- no summon set bonuses are written well. all use two bools, neither of which actually controls the function - - // Desert Prowler - if (setBonus == "desertprowler" || setBonus == "desert prowler") - return mp.desertProwler; - - // Snow Ruffian - if (setBonus == "snowruffian" || setBonus == "snow ruffian") - return mp.snowRuffianSet; - - // Victide - if (setBonus == "victide_summon" || setBonus == "victide summon") - return mp.urchin; // the bool set directly by VictideHelmet.UpdateArmorSet - else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) - return mp.victideSet; - - // Aerospec - if (setBonus == "aerospec_summon" || setBonus == "aerospec summon") - return mp.valkyrie; // the bool set directly by AerospecHelmet.UpdateArmorSet - else if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) - return mp.aeroSet; - - // Statigel - if (setBonus == "statigel_summon" || setBonus == "statigel summon") - return mp.slimeGod; // the bool set directly by StatigelHood.UpdateArmorSet - if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) - return mp.statigelSet; - - // Mollusk - if (setBonus == "mollusk") - return mp.molluskSet; - - // Forbidden Circlet - if (setBonus == "forbidden_circlet" || setBonus == "forbidden circlet") - return mp.forbiddenCirclet; - - // Daedalus - switch (setBonus) - { - default: - break; - case "daedalus": - return mp.daedalusReflect || mp.daedalusShard || mp.daedalusAbsorb || mp.daedalusCrystal || mp.daedalusSplit; - case "daedalus_melee": - case "daedalus melee": - return mp.daedalusReflect; - case "daedalus_ranged": - case "daedalus ranged": - return mp.daedalusShard; - case "daedalus_magic": - case "daedalus magic": - return mp.daedalusAbsorb; - case "daedalus_summon": - case "daedalus summon": - return mp.daedalusCrystal; - case "daedalus_rogue": - case "daedalus rogue": - return mp.daedalusSplit; - } - - // Reaver - switch (setBonus) - { - default: - break; - case "reaver": - return mp.reaverBlast || mp.reaverDoubleTap || mp.reaverBurst || mp.reaverOrb || mp.reaverSpore; - case "reaver_melee": - case "reaver melee": - return mp.reaverBlast; - case "reaver_ranged": - case "reaver ranged": - return mp.reaverDoubleTap; - case "reaver_magic": - case "reaver magic": - return mp.reaverBurst; - case "reaver_summon": - case "reaver summon": - return mp.reaverOrb; - case "reaver_rogue": - case "reaver rogue": - return mp.reaverSpore; - } - - // Fathom Swarmer - if (setBonus == "fathomswarmer" || setBonus == "fathom swarmer") - return mp.fathomSwarmer; - - // Brimflame - if (setBonus == "brimflame") - return mp.brimflameSet; - - // Umbraphile - if (setBonus == "umbraphile") - return mp.umbraphileSet; - - // Hydrothermic (Ataxia is legacy name) - switch (setBonus) - { - default: - break; - case "ataxia": - case "hydrothermic": - case "hydrothermal": - return mp.ataxiaBlaze; - case "ataxia_melee": - case "ataxia melee": - case "hydrothermic_melee": - case "hydrothermic melee": - case "hydrothermal_melee": - case "hydrothermal melee": - return mp.ataxiaGeyser; - case "ataxia_ranged": - case "ataxia ranged": - case "hydrothermic_ranged": - case "hydrothermic ranged": - case "hydrothermal_ranged": - case "hydrothermal ranged": - return mp.ataxiaBolt; - case "ataxia_magic": - case "ataxia magic": - case "hydrothermic_magic": - case "hydrothermic magic": - case "hydrothermal_magic": - case "hydrothermal magic": - return mp.ataxiaMage; - case "ataxia_summon": - case "ataxia summon": - case "hydrothermic_summon": - case "hydrothermic summon": - case "hydrothermal_summon": - case "hydrothermal summon": - return mp.chaosSpirit; - case "ataxia_rogue": - case "ataxia rogue": - case "hydrothermic_rogue": - case "hydrothermic rogue": - case "hydrothermal_rogue": - case "hydrothermal rogue": - return mp.ataxiaVolley; - } - - // Plague Reaper - if (setBonus == "plaguereaper" || setBonus == "plague reaper") - return mp.plagueReaper; - - // Plaguebringer - if (setBonus == "plaguebringer" || setBonus == "plaguebringerpatron" || setBonus == "plaguebringer patron") - return mp.plaguebringerPatronSet; - - // Astral - if (setBonus == "astral") - return mp.astralStarRain; - - // Xeroc - if (setBonus == "xeroc") - return mp.xerocSet; - - // Tarragon - switch (setBonus) - { - default: - break; - case "tarragon": - return mp.tarraSet; - case "tarragon_melee": - case "tarragon melee": - return mp.tarraMelee; - case "tarragon_ranged": - case "tarragon ranged": - return mp.tarraRanged; - case "tarragon_magic": - case "tarragon magic": - return mp.tarraMage; - case "tarragon_summon": - case "tarragon summon": - return mp.tarraSummon; - case "tarragon_rogue": - case "tarragon rogue": - return mp.tarraThrowing; - } - - // Prismatic - if (setBonus == "prismatic" || setBonus == "prism") - return mp.prismaticSet; - - // Bloodflare - switch (setBonus) - { - default: - break; - case "bloodflare": - return mp.bloodflareSet; - case "bloodflare_melee": - case "bloodflare melee": - return mp.bloodflareMelee; - case "bloodflare_ranged": - case "bloodflare ranged": - return mp.bloodflareRanged; - case "bloodflare_magic": - case "bloodflare magic": - return mp.bloodflareMage; - case "bloodflare_summon": - case "bloodflare summon": - return mp.bloodflareSummon; - case "bloodflare_rogue": - case "bloodflare rogue": - return mp.bloodflareThrowing; - } - - // Omega Blue - if (setBonus == "omegablue" || setBonus == "omega blue") - return mp.omegaBlueSet; - - // God Slayer - switch (setBonus) - { - default: - break; - case "godslayer": - case "god slayer": - return mp.godSlayer; - case "godslayer_melee": - case "godslayer melee": - case "god slayer melee": - return mp.godSlayerDamage; // melee helm's unique damage reducing property - case "godslayer_ranged": - case "godslayer ranged": - case "god slayer ranged": - return mp.godSlayerRanged; - case "godslayer_magic": - case "godslayer magic": - case "god slayer magic": - return mp.godSlayerMage; - case "godslayer_summon": - case "godslayer summon": - case "god slayer summon": - return mp.godSlayerSummon; - case "godslayer_rogue": - case "godslayer rogue": - case "god slayer rogue": - return mp.godSlayerThrowing; - } - - // Fearmonger - if (setBonus == "fearmonger") - return mp.fearmongerSet; - - // Silva - switch (setBonus) - { - default: - break; - case "silva": - return mp.silvaSet; - case "silva_melee": - case "silva melee": - return mp.silvaMelee; - case "silva_ranged": - case "silva ranged": - return mp.silvaRanged; - case "silva_magic": - case "silva magic": - return mp.silvaMage; - case "silva_summon": - case "silva summon": - return mp.silvaSummon; - case "silva_rogue": - case "silva rogue": - return mp.silvaThrowing; - } - - // Auric Tesla - if (setBonus == "auric" || setBonus == "aurictesla" || setBonus == "auric tesla") - return mp.auricSet; - - // Demonshade - if (setBonus == "demonshade") - return mp.dsSetBonus; - - return false; - } - - /// - /// Turns the set bonus corresponding to the given string on or off for the specified player. - /// - /// The player whose set bonuses are being toggled. - /// The set bonus to check for. - /// Whether the set bonus should be enabled (true) or disabled (false). - /// Whether any set bonus was adjusted. - public static bool SetSetBonus(Player p, string setBonus, bool enabled) - { - CalamityPlayer mp = p.Calamity(); - setBonus = setBonus.ToLower(); - - // Desert Prowler - if (setBonus == "desertprowler" || setBonus == "desert prowler") - { - mp.desertProwler = enabled; - return true; - } - - // Snow Ruffian - if (setBonus == "snowruffian" || setBonus == "snow ruffian") - { - mp.snowRuffianSet = enabled; - return true; - } - - // Victide - if (setBonus == "victide_summon" || setBonus == "victide summon") - { - mp.victideSet = enabled; - mp.urchin = enabled; // LATER -- remove this when player.urchin actually controls victide summoner - return true; - } - else if (setBonus == "victide" || setBonus.StartsWith("victide_") || setBonus.StartsWith("victide ")) - { - mp.victideSet = true; - return true; - } - - // Aerospec - if (setBonus == "aerospec_summon" || setBonus == "aerospec summon") - { - mp.aeroSet = enabled; - mp.valkyrie = enabled; // LATER -- remove this when player.valkyrie actually controls aerospec summoner - return true; - } - else if (setBonus == "aerospec" || setBonus.StartsWith("aerospec_") || setBonus.StartsWith("aerospec ")) - { - mp.aeroSet = enabled; - return true; - } - - // Statigel - if (setBonus == "statigel_summon" || setBonus == "statigel summon") - { - mp.statigelSet = enabled; - mp.slimeGod = enabled; // LATER -- remove this when player.slimeGod actually controls statigel summoner - return true; - } - else if (setBonus == "statigel" || setBonus.StartsWith("statigel_") || setBonus.StartsWith("statigel ")) - { - mp.statigelSet = enabled; - return true; - } - - // Mollusk - if (setBonus == "mollusk") - { - mp.molluskSet = enabled; - return true; - } - - // Forbidden Circlet - if (setBonus == "forbidden_circlet" || setBonus == "forbidden circlet") - { - mp.forbiddenCirclet = enabled; - return true; - } - - // Daedalus - switch (setBonus) - { - default: - break; - case "daedalus_melee": - case "daedalus melee": - mp.daedalusReflect = enabled; - return true; - case "daedalus_ranged": - case "daedalus ranged": - mp.daedalusShard = enabled; - return true; - case "daedalus_magic": - case "daedalus magic": - mp.daedalusAbsorb = enabled; - return true; - case "daedalus_summon": - case "daedalus summon": - mp.daedalusCrystal = enabled; // LATER -- remove this when player.daedalusCrystal actually controls daedalus summoner - return true; - case "daedalus_rogue": - case "daedalus rogue": - mp.daedalusSplit = enabled; - return true; - } - - // Reaver - switch (setBonus) - { - default: - break; - case "reaver_melee": - case "reaver melee": - mp.reaverBlast = enabled; - return true; - case "reaver_ranged": - case "reaver ranged": - mp.reaverDoubleTap = enabled; - return true; - case "reaver_magic": - case "reaver magic": - mp.reaverBurst = enabled; - return true; - case "reaver_summon": - case "reaver summon": - mp.reaverOrb = enabled; // LATER -- remove this when player.reaverOrb actually controls reaver summoner - return true; - case "reaver_rogue": - case "reaver rogue": - mp.reaverSpore = enabled; - return true; - } - - // Fathom Swarmer - if (setBonus == "fathomswarmer" || setBonus == "fathom swarmer") - { - mp.fathomSwarmer = enabled; - return true; - } - - // Brimflame - if (setBonus == "brimflame") - { - mp.brimflameSet = enabled; - return true; - } - - // Umbraphile - if (setBonus == "umbraphile") - { - mp.umbraphileSet = enabled; - return true; - } - - // Hydrothermic (Ataxia as legacy name) - switch (setBonus) - { - default: - break; - case "ataxia": - case "hydrothermic": - case "hydrothermal": - mp.ataxiaBlaze = enabled; - return true; - case "ataxia_melee": - case "ataxia melee": - case "hydrothermic_melee": - case "hydrothermic melee": - case "hydrothermal_melee": - case "hydrothermal melee": - mp.ataxiaBlaze = enabled; - mp.ataxiaGeyser = enabled; - return true; - case "ataxia_ranged": - case "ataxia ranged": - case "hydrothermic_ranged": - case "hydrothermic ranged": - case "hydrothermal_ranged": - case "hydrothermal ranged": - mp.ataxiaBlaze = enabled; - mp.ataxiaBolt = enabled; - return true; - case "ataxia_magic": - case "ataxia magic": - case "hydrothermic_magic": - case "hydrothermic magic": - case "hydrothermal_magic": - case "hydrothermal magic": - mp.ataxiaBlaze = enabled; - mp.ataxiaMage = enabled; - return true; - case "ataxia_summon": - case "ataxia summon": - case "hydrothermic_summon": - case "hydrothermic summon": - case "hydrothermal_summon": - case "hydrothermal summon": - mp.ataxiaBlaze = enabled; - mp.chaosSpirit = enabled; // LATER -- remove this when player.chaosSpirit actually controls ataxia summoner - return true; - case "ataxia_rogue": - case "ataxia rogue": - case "hydrothermic_rogue": - case "hydrothermic rogue": - case "hydrothermal_rogue": - case "hydrothermal rogue": - mp.ataxiaBlaze = enabled; - mp.ataxiaVolley = enabled; - return true; - } - - // Plague Reaper - if (setBonus == "plaguereaper" || setBonus == "plague reaper") - { - mp.plagueReaper = enabled; - return true; - } - - // Plaguebringer - if (setBonus == "plaguebringer" || setBonus == "plaguebringerpatron" || setBonus == "plaguebringer patron") - { - mp.plaguebringerPatronSet = enabled; - return true; - } - - // Astral - if (setBonus == "astral") - { - mp.astralStarRain = enabled; - return true; - } - - // Xeroc - if (setBonus == "xeroc") - { - mp.xerocSet = enabled; - return true; - } - - // Tarragon - switch (setBonus) - { - default: - break; - case "tarragon": - mp.tarraSet = enabled; - return true; - case "tarragon_melee": - case "tarragon melee": - mp.tarraSet = enabled; - mp.tarraMelee = enabled; - return true; - case "tarragon_ranged": - case "tarragon ranged": - mp.tarraSet = enabled; - mp.tarraRanged = enabled; - return true; - case "tarragon_magic": - case "tarragon magic": - mp.tarraSet = enabled; - mp.tarraMage = enabled; - return true; - case "tarragon_summon": - case "tarragon summon": - mp.tarraSet = enabled; - mp.tarraSummon = enabled; // LATER -- remove this when player.tarraSummon actually controls life aura - return true; - case "tarragon_rogue": - case "tarragon rogue": - mp.tarraSet = enabled; - mp.tarraThrowing = enabled; - return true; - } - - // Prismatic - if (setBonus == "prismatic" || setBonus == "prism") - { - mp.prismaticSet = enabled; - return true; - } - - // Bloodflare - switch (setBonus) - { - default: - break; - case "bloodflare": - mp.bloodflareSet = enabled; - return true; - case "bloodflare_melee": - case "bloodflare melee": - mp.bloodflareSet = enabled; - mp.bloodflareMelee = enabled; - return true; - case "bloodflare_ranged": - case "bloodflare ranged": - mp.bloodflareSet = enabled; - mp.bloodflareRanged = enabled; - return true; - case "bloodflare_magic": - case "bloodflare magic": - mp.bloodflareSet = enabled; - mp.bloodflareMage = enabled; - return true; - case "bloodflare_summon": - case "bloodflare summon": - mp.bloodflareSet = enabled; - mp.bloodflareSummon = enabled; // LATER -- remove this when player.bloodflareSummon actually controls bloodflare orbs - return true; - case "bloodflare_rogue": - case "bloodflare rogue": - mp.bloodflareSet = enabled; - mp.bloodflareThrowing = enabled; - return true; - } - - // Omega Blue - if (setBonus == "omegablue" || setBonus == "omega blue") - { - mp.omegaBlueSet = enabled; - return true; - } - - // God Slayer - switch (setBonus) - { - default: - break; - case "godslayer": - case "god slayer": - mp.godSlayer = enabled; - return true; - case "godslayer_melee": - case "godslayer melee": - case "god slayer melee": - mp.godSlayer = enabled; - mp.godSlayerDamage = enabled; // melee helm's unique damage reducing property - return true; - case "godslayer_ranged": - case "godslayer ranged": - case "god slayer ranged": - mp.godSlayer = enabled; - mp.godSlayerRanged = enabled; - return true; - case "godslayer_magic": - case "godslayer magic": - case "god slayer magic": - mp.godSlayer = enabled; - mp.godSlayerMage = enabled; - return true; - case "godslayer_summon": - case "godslayer summon": - case "god slayer summon": - mp.godSlayer = enabled; - mp.godSlayerSummon = enabled; // LATER -- remove this when player.godSlayerSummon actually controls mechworm - return true; - case "godslayer_rogue": - case "godslayer rogue": - case "god slayer rogue": - mp.godSlayer = enabled; - mp.godSlayerThrowing = enabled; - return true; - } - - // Fearmonger - if (setBonus == "fearmonger") - { - mp.fearmongerSet = enabled; - return true; - } - - // Silva - switch (setBonus) - { - default: - break; - case "silva": - mp.silvaSet = enabled; - return true; - case "silva_melee": - case "silva melee": - mp.silvaSet = enabled; - mp.silvaMelee = enabled; - return true; - case "silva_ranged": - case "silva ranged": - mp.silvaSet = enabled; - mp.silvaRanged = enabled; - return true; - case "silva_magic": - case "silva magic": - mp.silvaSet = enabled; - mp.silvaMage = enabled; - return true; - case "silva_summon": - case "silva summon": - mp.silvaSet = enabled; - mp.silvaSummon = enabled; // LATER -- remove this when player.silvaSummon actually controls silva crystal - return true; - case "silva_rogue": - case "silva rogue": - mp.silvaSet = enabled; - mp.silvaThrowing = enabled; - return true; - } - - // Auric Tesla (includes all components) - switch (setBonus) - { - default: - break; - case "auric": - case "aurictesla": - case "auric tesla": - mp.tarraSet = enabled; - mp.bloodflareSet = enabled; - mp.godSlayer = enabled; - mp.silvaSet = enabled; - mp.auricSet = enabled; - return true; - case "auric_melee": - case "auric melee": - case "aurictesla_melee": - case "aurictesla melee": - case "auric tesla melee": - mp.tarraSet = enabled; - mp.tarraMelee = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareMelee = enabled; - mp.godSlayer = enabled; - mp.godSlayerDamage = enabled; - mp.silvaSet = enabled; - mp.silvaMelee = enabled; - mp.auricSet = enabled; - return true; - case "auric_ranged": - case "auric ranged": - case "aurictesla_ranged": - case "aurictesla ranged": - case "auric tesla ranged": - mp.tarraSet = enabled; - mp.tarraRanged = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareRanged = enabled; - mp.godSlayer = enabled; - mp.godSlayerRanged = enabled; - mp.silvaSet = enabled; - mp.silvaRanged = enabled; - mp.auricSet = enabled; - return true; - case "auric_magic": - case "auric magic": - case "aurictesla_magic": - case "aurictesla magic": - case "auric tesla magic": - mp.tarraSet = enabled; - mp.tarraMage = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareMage = enabled; - mp.godSlayer = enabled; - mp.godSlayerMage = enabled; - mp.silvaSet = enabled; - mp.silvaMage = enabled; - mp.auricSet = enabled; - return true; - case "auric_summon": - case "auric summon": - case "aurictesla_summon": - case "aurictesla summon": - case "auric tesla summon": - mp.tarraSet = enabled; - mp.tarraSummon = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareSummon = enabled; - mp.godSlayer = enabled; - mp.godSlayerSummon = enabled; - mp.silvaSet = enabled; - mp.silvaSummon = enabled; - mp.auricSet = enabled; - return true; - case "auric_rogue": - case "auric rogue": - case "aurictesla_rogue": - case "aurictesla rogue": - case "auric tesla rogue": - mp.tarraSet = enabled; - mp.tarraThrowing = enabled; - mp.bloodflareSet = enabled; - mp.bloodflareThrowing = enabled; - mp.godSlayer = enabled; - mp.godSlayerThrowing = enabled; - mp.silvaSet = enabled; - mp.silvaThrowing = enabled; - mp.auricSet = enabled; - return true; - } - - // Demonshade - if (setBonus == "demonshade") - { - mp.dsSetBonus = enabled; - mp.rDevil = enabled; // LATER -- remove this when player.rDevil controls demonshade summoned minion - return true; - } - - return false; - } - #endregion - #region Other Player Stats public static int GetLightStrength(Player p) => p?.Calamity()?.GetTotalLightStrength() ?? 0; @@ -1418,6 +630,7 @@ namespace CalamityMod #endregion #region Call + public static object Call(params object[] args) { bool isValidPlayerArg(object o) => o is int || o is Player; @@ -1441,6 +654,24 @@ namespace CalamityMod return null; } + // Certain IDs in vanilla's files are shorts instead of ints for some reason. + // Instead of expecting developers to have to manually cast these IDs, this function is used + // to handle IDs that are either ints OR shorts, without the worry of missing a cast and wondering why + // the Mod Call did nothing. + bool castID(object o, out int id) + { + id = -1; + if (!(o is int) && !(o is short)) + return false; + + if (o is short shortID) + id = shortID; + if (o is int intID) + id = intID; + + return true; + } + if (args is null || args.Length <= 0) return new ArgumentNullException("ERROR: No function name specified. First argument must be a function name."); if (!(args[0] is string)) @@ -1660,39 +891,6 @@ namespace CalamityMod return new ArgumentException("ERROR: The first argument to \"SetRogue\" must be a Projectile or an int."); return SetRogue(castProjectile(args[1]), isRogue); - case "SetBonus": - case "SetBonusActive": - case "HasSetBonus": - case "GetSetBonus": - case "GetSetBonusActive": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and a set bonus name as a string."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify a set bonus name as a string."); - if (!(args[2] is string)) - return new ArgumentException("ERROR: The second argument to \"SetBonus\" must be a string."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetBonus\" must be a Player or an int."); - return GetSetBonus(castPlayer(args[1]), args[2].ToString()); - - case "SetSetBonus": - case "ToggleSetBonus": - case "SetSetBonusActive": - case "ToggleSetBonusActive": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Player object (or int index of a Player), a set bonus name as a string, and a bool."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify a set bonus name as a string and a bool."); - if (args.Length < 4) - return new ArgumentNullException("ERROR: Must specify a bool."); - if (!(args[3] is bool setBonusEnabled)) - return new ArgumentException("ERROR: The third argument to \"SetSetBonus\" must be a bool."); - if (!(args[2] is string)) - return new ArgumentException("ERROR: The second argument to \"SetSetBonus\" must be a string."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetSetBonus\" must be a Player or an int."); - return SetSetBonus(castPlayer(args[1]), args[2].ToString(), setBonusEnabled); - case "DR": case "DamageReduction": case "SetDR": @@ -1703,10 +901,9 @@ namespace CalamityMod return new ArgumentNullException("ERROR: Must specify damage reduction as a float or double."); if (!(args[2] is float) && !(args[2] is double)) return new ArgumentException("ERROR: The second argument to \"SetDamageReduction\" must be a float or a double."); - if (!(args[1] is string)) - return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int."); + if (!castID(args[1], out int npcID)) + return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int or short ID."); - int npcID = (int)args[1]; float DR = (float)args[2]; return SetDamageReduction(npcID, DR); @@ -1740,18 +937,42 @@ namespace CalamityMod case "SetPostMLRarity": case "SetPostMoonLordRarity": if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both an Item and desired rarity as an int."); + return new ArgumentNullException("ERROR: Must specify both an Item and desired rarity as an int or short ID."); if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify desired rarity as an int."); - if (!(args[2] is int)) - return new ArgumentException("ERROR: The second argument to \"SetCalamityRarity\" must be an int."); + return new ArgumentNullException("ERROR: Must specify desired rarity as an int or short ID."); + if (!castID(args[2], out int rarity)) + return new ArgumentException("ERROR: The second argument to \"SetCalamityRarity\" must be an int or short ID."); if (!(args[1] is Item)) return new ArgumentException("ERROR: The first argument to \"SetCalamityRarity\" must be an Item."); Item itemToSet = (Item)args[1]; - int rarity = (int)args[2]; return SetCalamityRarity(itemToSet, rarity); + case "GetDoGCountdown": + case "GetDoGFightCountdown": + case "GetDoGStage2Countdown": + return CalamityWorld.DoGSecondStageCountdown; + + case "AcidRainActive": + case "IsAcidRainActive": + case "GetAcidRainActive": + return CalamityWorld.rainingAcid; + + case "StartAcidRain": + AcidRainEvent.TryStartEvent(true); + CalamityNetcode.SyncWorld(); + return true; + + case "StopAcidRain": + if (CalamityWorld.rainingAcid) + { + CalamityWorld.acidRainPoints = 0; + CalamityWorld.triedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + } + return true; + + // This is intentionally separate from the above because it will stop other events when they are added. case "AbominationnClearEvents": bool eventActive = CalamityWorld.rainingAcid; bool canClear = Convert.ToBoolean(args[1]); //This is to indicate whether abomm is able to clear the event due to a cooldown @@ -1763,6 +984,123 @@ namespace CalamityMod } return eventActive; + case "ExcludeMinionsFromResurrection": + // This assumes all arguments after the calling command name are projectile types. + IEnumerable secondaryArguments = args.Skip(1); + if (secondaryArguments.Any(argument => !castID(argument, out _))) + return new ArgumentException("ERROR: All arguments after the calling command to \"ExcludeMinionsFromResurrection\" must be int or short IDs."); + + CalamityLists.MinionsToNotResurrectList.AddRange(secondaryArguments.Select(argument => + { + castID(argument, out int id); + return id; + })); + return null; + + case "CreateEnchantment": + case "RegisterEnchantment": + EnchantmentManager.ConstructFromModcall(args.Skip(1)); + return null; + + case "DeclareMiniboss": + case "DeclareMinibossForHealthBar": + if (args.Length != 2) + return new ArgumentNullException("ERROR: Must specify both an NPC type as an int."); + if (!castID(args[1], out int npcType)) + return new ArgumentException("ERROR: The first argument to \"DeclareMiniboss\" must be an int or short ID."); + + BossHealthBarManager.MinibossHPBarList.Add(npcType); + return null; + + case "ExcludeBossFromHealthBar": + if (args.Length != 2) + return new ArgumentNullException("ERROR: Must specify both an NPC type as an int."); + if (!castID(args[1], out int npcType2)) + return new ArgumentException("ERROR: The first argument to \"ExcludeBossFromHealthBar\" must be an int or short ID."); + + BossHealthBarManager.BossExclusionList.Add(npcType2); + return null; + + case "DeclareOneToManyRelationshipForHealthBar": + if (args.Length < 3) + return new ArgumentNullException("ERROR: Must specify both an NPC type as an int for the first argument and the other NPC types in the relationship as ints for the rest of the arguments."); + if (!args.Skip(1).All(a => castID(a, out _))) + return new ArgumentException("ERROR: All secondary and onward arguments to \"DeclareOneToManyRelationshipForHealthBar\" must be int or short IDs."); + + castID(args[1], out int npcType3); + + int[] npcsInRelationship = args.Skip(2).Select(a => (int)a).ToArray(); + BossHealthBarManager.OneToMany[npcType3] = npcsInRelationship; + return null; + + // For context, the boolean argument in the second delegate refers to whether the function should be accumulating max life (true) or just life (false), and the returned long should be the accumulated health. + case "DeclareSpecialHPCalculationDecisionForHealthBar": + if (args.Length != 3) + return new ArgumentNullException("ERROR: Must specify both a usage requirement as a Func and a health calculator function as a Func."); + if (!(args[1] is Func usageRequirement)) + return new ArgumentException("ERROR: The first argument to \"DeclareSpecialHPCalculationDecisionForHealthBar\" must be a Func."); + if (!(args[2] is Func healthCalculatorFunction)) + return new ArgumentException("ERROR: The first argument to \"DeclareSpecialHPCalculationDecisionForHealthBar\" must be a Func."); + + BossHealthBarManager.SpecialHPRequirements[new BossHealthBarManager.NPCSpecialHPGetRequirement(usageRequirement)] = new BossHealthBarManager.NPCSpecialHPGetFunction(healthCalculatorFunction); + return null; + + case "CreateNameExtensionHandlerForHealthBar": + if (args.Length < 4) + return new ArgumentNullException("ERROR: Must specify a extension name as a string, the main NPC type as an int, and the other NPC types to check for as ints the rest of the arguments."); + if (!(args[1] is string name)) + return new ArgumentException("ERROR: The first argument to \"CreateNameExtensionHandlerForHealthBar\" must be a string."); + if (!castID(args[1], out int npcType4)) + return new ArgumentException("ERROR: The second argument to \"CreateNameExtensionHandlerForHealthBar\" must be an int or short ID."); + if (!args.Skip(3).All(a => a is int)) + return new ArgumentException("ERROR: All ternary and onward arguments to \"CreateNameExtensionHandlerForHealthBar\" must be ints."); + + int[] npcsToCheckFor = args.Skip(3).Select(a => (int)a).ToArray(); + BossHealthBarManager.EntityExtensionHandler[npcType4] = new BossHealthBarManager.BossEntityExtension(name, npcsToCheckFor); + return null; + + // In the following two mod calls, the first argument is the NPC type, the second is the time change context (-1 being night, 0 being nothing, and 1 being day), + // the third being the boss spawning function, the fourth being the overriding countdown to use, the fifth being whether the boss uses a special sound on spawning, + // and the sixth being the array of NPCs present in the battle that should not be deleted by the Boss Rush itself, and the seventh being the potential NPCs + // that will end up killing, assuming the initial boss isn't that (such as P1 Hive Mind turning into its second form and you being expected to kill that). + case "GetBossRushEntries": + List<(int, int, Action, int, bool, int[], int[])> entries = new List<(int, int, Action, int, bool, int[], int[])>(); + foreach (BossRushEvent.Boss boss in BossRushEvent.Bosses) + { + int[] deathEntries = BossRushEvent.BossIDsAfterDeath.ContainsKey(boss.EntityID) ? BossRushEvent.BossIDsAfterDeath[boss.EntityID] : null; + entries.Add((boss.EntityID, (int)boss.ToChangeTimeTo, new Action(boss.SpawnContext), boss.SpecialSpawnCountdown, boss.UsesSpecialSound, boss.HostileNPCsToNotDelete.ToArray(), deathEntries)); + } + + return entries; + + case "SetBossRushEntries": + if (args.Length != 2) + return new ArgumentNullException("ERROR: Must specify a list of bosses as a List<(int, int, Action, int, bool, int[], int[])>."); + if (!(args[1] is List<(int, int, Action, int, bool, int[], int[])> entries2)) + return new ArgumentException("ERROR: The first argument to \"SetBossRushEntries\" must be a List<(int, int, Action, int, bool, int[], int[])>."); + + BossRushEvent.Bosses.Clear(); + BossRushEvent.BossIDsAfterDeath.Clear(); + foreach (var entry in entries2) + { + if (entry.Item7 != null) + BossRushEvent.BossIDsAfterDeath[entry.Item1] = entry.Item7; + BossRushEvent.Bosses.Add(new BossRushEvent.Boss(entry.Item1, (BossRushEvent.TimeChangeContext)entry.Item2, new BossRushEvent.Boss.OnSpawnContext(entry.Item3), entry.Item4, entry.Item5, entry.Item6)); + } + + return null; + + case "CreateCustomDeathEffectForBossRush": + if (args.Length != 3) + return new ArgumentNullException("ERROR: Must specify both an NPC type and an Action that determines what happens when the NPC is killed."); + if (!castID(args[1], out int npcType5)) + return new ArgumentException("ERROR: The first argument to \"CreateCustomDeathEffectForBossRush\" must be an int or short ID."); + if (!(args[2] is Action deathEffect)) + return new ArgumentException("ERROR: The first argument to \"CreateCustomDeathEffectForBossRush\" must be an Action."); + + BossRushEvent.BossDeathEffects[npcType5] = deathEffect; + return null; + default: return new ArgumentException("ERROR: Invalid method name."); } diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index b2ee759c05..dd8536beeb 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -29,6 +29,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; @@ -41,6 +42,10 @@ using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; @@ -74,6 +79,42 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod { + internal class Downed + { + public static readonly Func DownedDesertScourge = () => CalamityWorld.downedDesertScourge; + public static readonly Func DownedGiantClam = () => CalamityWorld.downedCLAM; + public static readonly Func DownedCrabulon = () => CalamityWorld.downedCrabulon; + public static readonly Func DownedHiveMind = () => CalamityWorld.downedHiveMind; + public static readonly Func DownedPerfs = () => CalamityWorld.downedPerforator; + public static readonly Func DownedSlimeGod = () => CalamityWorld.downedSlimeGod; + public static readonly Func DownedCryogen = () => CalamityWorld.downedCryogen; + public static readonly Func DownedBrimstoneElemental = () => CalamityWorld.downedBrimstoneElemental; + public static readonly Func DownedAquaticScourge = () => CalamityWorld.downedAquaticScourge; + public static readonly Func DownedCalamitas = () => CalamityWorld.downedCalamitas; + public static readonly Func DownedGSS = () => CalamityWorld.downedGSS; + public static readonly Func DownedLeviathan = () => CalamityWorld.downedLeviathan; + public static readonly Func DownedAureus = () => CalamityWorld.downedAstrageldon; + public static readonly Func DownedPBG = () => CalamityWorld.downedPlaguebringer; + public static readonly Func DownedRavager = () => CalamityWorld.downedScavenger; + public static readonly Func DownedDeus = () => CalamityWorld.downedStarGod; + public static readonly Func DownedGuardians = () => CalamityWorld.downedGuardians; + public static readonly Func DownedBirb = () => CalamityWorld.downedBumble; + public static readonly Func DownedProvidence = () => CalamityWorld.downedProvidence; + public static readonly Func DownedCeaselessVoid = () => CalamityWorld.downedSentinel1; + public static readonly Func DownedStormWeaver = () => CalamityWorld.downedSentinel2; + public static readonly Func DownedSignus = () => CalamityWorld.downedSentinel3; + public static readonly Func DownedPolterghast = () => CalamityWorld.downedPolterghast; + public static readonly Func DownedBoomerDuke = () => CalamityWorld.downedBoomerDuke; + public static readonly Func DownedDoG = () => CalamityWorld.downedDoG; + public static readonly Func DownedYharon = () => CalamityWorld.downedYharon; + public static readonly Func DownedExoMechs = () => CalamityWorld.downedExoMechs; + public static readonly Func DownedSCal = () => CalamityWorld.downedSCal; + public static readonly Func DownedAdultEidolonWyrm = () => CalamityWorld.downedAdultEidolonWyrm; + + public static readonly Func DownedAcidRainInitial = () => CalamityWorld.downedEoCAcidRain; + public static readonly Func DownedAcidRainHardmode = () => CalamityWorld.downedAquaticScourgeAcidRain; + } + internal class WeakReferenceSupport { private static readonly Dictionary BossDifficulty = new Dictionary @@ -85,8 +126,8 @@ namespace CalamityMod { "Perforators", 3.51f }, { "SlimeGod", 5.5f }, { "Cryogen", 6.5f }, - { "BrimstoneElemental", 7.5f }, - { "AquaticScourge", 8.5f }, + { "AquaticScourge", 7.5f }, + { "BrimstoneElemental", 8.5f }, { "Calamitas", 9.7f }, { "GreatSandShark", 10.09f }, { "Leviathan", 10.5f }, @@ -104,8 +145,9 @@ namespace CalamityMod { "OldDuke", 16.5f }, { "DevourerOfGods", 17f }, { "Yharon", 18f }, - // { "Draedon", 18.5f }, + { "ExoMechs", 18.5f }, { "SupremeCalamitas", 19f }, + { "AdultEidolonWyrm", 19.5f }, // { "Yharim", 20f }, // { "Noxus", 120f }, // { "Xeroc", 121f }, @@ -114,7 +156,7 @@ namespace CalamityMod private static readonly Dictionary InvasionDifficulty = new Dictionary { { "Acid Rain Initial", 2.4f }, - { "Acid Rain Aquatic Scourge", 8.51f }, + { "Acid Rain Aquatic Scourge", 7.51f }, { "Acid Rain Polterghast", 16.49f } }; @@ -191,9 +233,8 @@ namespace CalamityMod /// private static void BossChecklistSupport() { - Mod bossChecklist = ModLoader.GetMod("BossChecklist"); - Mod calamity = GetInstance(); - + CalamityMod calamity = GetInstance(); + Mod bossChecklist = calamity.bossChecklist; if (bossChecklist is null) return; @@ -286,7 +327,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Cryogen", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.FrostCore, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FrozenKey, ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemID.FrostCore, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.FrozenKey, ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Snow Biome"; string despawn = CalamityUtils.ColorMessage("Cryogen drifts away, carried on a freezing wind.", new Color(0x00, 0xFF, 0xFF)); @@ -294,6 +335,19 @@ namespace CalamityMod AddBoss(bossChecklist, calamity, "Cryogen", order, type, DownedCryogen, summon, loot, collection, instructions, despawn, bossLogTex); } + // Aquatic Scourge + { + BossDifficulty.TryGetValue("AquaticScourge", out float order); + List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = $"Use a [i:{summon}] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"; + string despawn = CalamityUtils.ColorMessage("The Aquatic Scourge swam back into the open ocean.", new Color(0xF0, 0xE6, 0x8C)); + string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist"; + AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, loot, collection, instructions, despawn, bossLogTex); + } + // Brimstone Elemental { BossDifficulty.TryGetValue("BrimstoneElemental", out float order); @@ -306,19 +360,6 @@ namespace CalamityMod AddBoss(bossChecklist, calamity, "Brimstone Elemental", order, type, DownedBrimstoneElemental, summon, loot, collection, instructions, despawn); } - // Aquatic Scourge - { - BossDifficulty.TryGetValue("AquaticScourge", out float order); - List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; - int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; - string instructions = $"Use a [i:{summon}] in the Sulphuric Sea or wait for it to spawn in the Sulphuric Sea"; - string despawn = CalamityUtils.ColorMessage("The Aquatic Scourge swam back into the open ocean.", new Color(0xF0, 0xE6, 0x8C)); - string bossLogTex = "CalamityMod/NPCs/AquaticScourge/AquaticScourge_BossChecklist"; - AddBoss(bossChecklist, calamity, "Aquatic Scourge", order, segments, DownedAquaticScourge, summon, loot, collection, instructions, despawn, bossLogTex); - } - // Calamitas { BossDifficulty.TryGetValue("Calamitas", out float order); @@ -386,9 +427,9 @@ namespace CalamityMod BossDifficulty.TryGetValue("Ravager", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; - string instructions = $"Use an [i:{summon}]"; + string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The automaton of misshapen victims went looking for the true perpetrator.", new Color(0xB2, 0x22, 0x22)); string bossLogTex = "CalamityMod/NPCs/Ravager/Ravager_BossChecklist"; AddBoss(bossChecklist, calamity, "Ravager", order, segments, DownedRavager, summon, loot, collection, instructions, despawn, bossLogTex); @@ -415,7 +456,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("ProfanedGuardians", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemID.GreaterHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Hallow or Underworld Biomes"; string despawn = CalamityUtils.ColorMessage("The guardians must protect their goddess at all costs.", new Color(0xFF, 0xA5, 0x00)); @@ -428,7 +469,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Dragonfolly", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use [i:{summon}] in the Jungle Biome"; string despawn = CalamityUtils.ColorMessage("The failed experiment returns to its reproductive routine.", new Color(0xFF, 0xD7, 0x00)); @@ -438,22 +479,22 @@ namespace CalamityMod // Providence { BossDifficulty.TryGetValue("Providence", out float order); - List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; - List summons = new List() { ItemType(), ItemType() }; - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + int type = NPCType(); + int summon = ItemType(); + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; - string instructions = $"Use either [i:{ItemType()}] or [i:{ItemType()}] in the Hallow or Underworld Biomes"; + string instructions = $"Use [i:{summon}] in the Hallow or Underworld Biomes"; string despawn = CalamityUtils.ColorMessage("The Profaned Goddess vanishes in a burning blaze.", new Color(0xFF, 0xA5, 0x00)); string bossLogTex = "CalamityMod/NPCs/Providence/Providence_BossChecklist"; - AddBoss(bossChecklist, calamity, "Providence", order, bosses, DownedProvidence, summons, loot, collection, instructions, despawn, bossLogTex); + AddBoss(bossChecklist, calamity, "Providence", order, type, DownedProvidence, summon, loot, collection, instructions, despawn, bossLogTex); } // Ceaseless Void { BossDifficulty.TryGetValue("CeaselessVoid", out float order); - List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; + List bosses = new List() { NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Dungeon"; string despawn = CalamityUtils.ColorMessage("The rift in time and space has moved away from your reach.", new Color(0x4B, 0x00, 0x82)); @@ -465,7 +506,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("StormWeaver", out float order); List segments = new List() { NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in Space"; string despawn = CalamityUtils.ColorMessage("Storm Weaver hid itself once again within the stormfront.", new Color(0xEE, 0x82, 0xEE)); @@ -478,7 +519,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Signus", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Underworld"; string despawn = CalamityUtils.ColorMessage("The Devourer's assassin has finished its easy task.", new Color(0xBA, 0x55, 0xD3)); @@ -490,7 +531,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("Polterghast", out float order); List bosses = new List() { NPCType(), NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Kill 30 phantom spirits or use a [i:{summon}] in the Dungeon"; string despawn = CalamityUtils.ColorMessage("The volatile spirits disperse throughout the depths of the dungeon.", new Color(0xB0, 0xE0, 0xE6)); @@ -502,7 +543,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("OldDuke", out float order); List bosses = new List() { NPCType() }; int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.SuperHealingPotion }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Defeat the Acid Rain event post-Polterghast or fish using a [i:{summon}] in the Sulphurous Sea"; string despawn = CalamityUtils.ColorMessage("The old duke disappears amidst the acidic downpour.", new Color(0xF0, 0xE6, 0x8C)); @@ -514,7 +555,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("DevourerOfGods", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("The Devourer of Gods has slain everyone and feasted on their essence.", new Color(0x00, 0xFF, 0xFF)); @@ -531,23 +572,50 @@ namespace CalamityMod List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), /*ItemType(), */ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use a [i:{summon}] in the Jungle Biome"; - // TODO -- this setup code is only run once, so the despawn message can't be changed post-eclipse. Find a way around this. string despawn = CalamityUtils.ColorMessage("Yharon found you too weak to stay near your gravestone.", new Color(0xFF, 0xA5, 0x00)); string bossLogTex = "CalamityMod/NPCs/Yharon/Yharon_BossChecklist"; AddBoss(bossChecklist, calamity, "Yharon", order, type, DownedYharon, summon, loot, collection, instructions, despawn, bossLogTex); } + // Exo Mechs + // Loot requires edits + // Collection requires edits + // Instructions require edits + // Despawn requires edits + /*{ + BossDifficulty.TryGetValue("ExoMechs", out float order); + List bosses = new List() { NPCType(), NPCType(), NPCType(), NPCType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, ItemID.SonarPotion, ItemID.CratePotion, ItemID.GreaterHealingPotion }; + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; + string instructions = "By using a high-tech computer thing that somebody as stupid as you shouldn't be able to use, but whatever"; + string despawn = CalamityUtils.ColorMessage("An imperfection after all...what a shame.", new Color(0x7F, 0xFF, 0xD4)); + string bossLogTex = "CalamityMod/NPCs/ExoMechs/ExoMechs_BossChecklist"; + AddBoss(bossChecklist, calamity, "ExoMechs", order, bosses, DownedExoMechs, null, loot, collection, instructions, despawn, bossLogTex); + }*/ + // Supreme Calamitas { BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summon, loot, collection, instructions, despawn); } + + // Adult Eidolon Wyrm + { + BossDifficulty.TryGetValue("AdultEidolonWyrm", out float order); + int type = NPCType(); + int summon = ItemID.RodofDiscord; + List loot = new List() { ItemType(), ItemType(), ItemID.Ectoplasm, ItemType(), ItemType() }; + List collection = new List() { ItemType() }; + string instructions = $"While in the Abyss, use an item that inflicts Chaos State"; + string despawn = CalamityUtils.ColorMessage("...", new Color(0x7F, 0xFF, 0xD4)); + AddBoss(bossChecklist, calamity, "Adult Eidolon Wyrm", order, type, DownedAdultEidolonWyrm, summon, loot, collection, instructions, despawn); + } } private static void AddCalamityInvasions(Mod bossChecklist, Mod calamity) @@ -606,7 +674,7 @@ namespace CalamityMod // Eye of Cthulhu AddLoot(bossChecklist, "EyeofCthulhu", - new List() { ItemType(), ItemType(), ItemType() }, + new List() { ItemType(), ItemType() }, new List() { ItemType() } ); @@ -737,7 +805,7 @@ namespace CalamityMod // Frost Moon AddLoot(bossChecklist, "Frost Moon", - new List() { ItemType(), ItemType() }, + new List() { ItemType() }, null ); AddLoot(bossChecklist, "Ice Queen", @@ -764,13 +832,10 @@ namespace CalamityMod private static void FargosSupport() { - Mod fargos = ModLoader.GetMod("Fargowiltas"); + Mod fargos = GetInstance().fargos; if (fargos is null) return; - // Mark Fargo's Mutant Mod as loaded so that Calamity doesn't add ANY boss summons to vanilla NPCs, even for its own bosses - GetInstance().fargosMutant = true; - void AddToMutantShop(string bossName, string summonItemName, Func downed, int price) { BossDifficulty.TryGetValue(bossName, out float order); @@ -790,8 +855,8 @@ namespace CalamityMod AddToMutantShop("Perforators", "BloodyWormFood", DownedPerfs, Item.buyPrice(gold: 10)); AddToMutantShop("SlimeGod", "OverloadedSludge", DownedSlimeGod, Item.buyPrice(gold: 15)); AddToMutantShop("Cryogen", "CryoKey", DownedCryogen, Item.buyPrice(gold: 15)); - AddToMutantShop("BrimstoneElemental", "CharredIdol", DownedBrimstoneElemental, Item.buyPrice(gold: 20)); AddToMutantShop("AquaticScourge", "Seafood", DownedAquaticScourge, Item.buyPrice(gold: 20)); + AddToMutantShop("BrimstoneElemental", "CharredIdol", DownedBrimstoneElemental, Item.buyPrice(gold: 20)); AddToMutantShop("AstrumAureus", "AstralChunk", DownedAureus, Item.buyPrice(gold: 25)); AddToMutantShop("PlaguebringerGoliath", "Abomination", DownedPBG, Item.buyPrice(gold: 50)); AddToMutantShop("Ravager", "AncientMedallion", DownedRavager, Item.buyPrice(gold: 50)); @@ -804,7 +869,7 @@ namespace CalamityMod private static void CensusSupport() { - Mod censusMod = ModLoader.GetMod("Census"); + Mod censusMod = GetInstance().census; if (censusMod != null) { censusMod.Call("TownNPCCondition", NPCType(), "Defeat a Giant Clam after defeating the Desert Scourge"); @@ -816,7 +881,7 @@ namespace CalamityMod private static void SummonersAssociationSupport() { - Mod sAssociation = ModLoader.GetMod("SummonersAssociation"); + Mod sAssociation = GetInstance().summonersAssociation; if (sAssociation is null) return; @@ -859,7 +924,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/Abyss/AEWScreenShaderData.cs b/NPCs/Abyss/AEWScreenShaderData.cs new file mode 100644 index 0000000000..4d0c5fc4ab --- /dev/null +++ b/NPCs/Abyss/AEWScreenShaderData.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Abyss +{ + public class AEWScreenShaderData : ScreenShaderData + { + private int AEWIndex; + + public AEWScreenShaderData(string passName) + : base(passName) + { + } + + private void UpdateAEWIndex() + { + int AEWType = ModContent.NPCType(); + if (AEWIndex >= 0 && Main.npc[AEWIndex].active && Main.npc[AEWIndex].type == AEWType) + { + return; + } + AEWIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == AEWType) + { + AEWIndex = i; + break; + } + } + } + + public override void Apply() + { + UpdateAEWIndex(); + if (AEWIndex != -1) + { + UseTargetPosition(Main.npc[AEWIndex].Center); + } + base.Apply(); + } + } +} diff --git a/NPCs/SupremeCalamitas/SCalSky.cs b/NPCs/Abyss/AEWSky.cs similarity index 65% rename from NPCs/SupremeCalamitas/SCalSky.cs rename to NPCs/Abyss/AEWSky.cs index 4b8ec5cb18..074be772c1 100644 --- a/NPCs/SupremeCalamitas/SCalSky.cs +++ b/NPCs/Abyss/AEWSky.cs @@ -4,72 +4,66 @@ using Terraria; using Terraria.Graphics.Effects; using Terraria.ModLoader; -namespace CalamityMod.NPCs.SupremeCalamitas +namespace CalamityMod.NPCs.Abyss { - public class SCalSky : CustomSky + public class AEWSky : CustomSky { private bool isActive = false; private float intensity = 0f; - private int SCalIndex = -1; + private int AEWIndex = -1; public override void Update(GameTime gameTime) { if (isActive && intensity < 1f) - { intensity += 0.01f; - } else if (!isActive && intensity > 0f) - { intensity -= 0.01f; - } } private float GetIntensity() { - if (this.UpdateSCalIndex()) + if (UpdateAEWIndex()) { float x = 0f; - if (this.SCalIndex != -1) - { - x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); - } - return 1f - Utils.SmoothStep(3000f, 6000f, x); + if (AEWIndex != -1) + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[AEWIndex].Center); + + return 1f - Utils.SmoothStep(3000f, 6000f, x); } return 0f; } public override Color OnTileColor(Color inColor) { - float intensity = this.GetIntensity(); + float intensity = GetIntensity(); return new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - intensity)); } - private bool UpdateSCalIndex() + private bool UpdateAEWIndex() { - int SCalType = ModContent.NPCType(); - if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + int AEWType = ModContent.NPCType(); + if (AEWIndex >= 0 && Main.npc[AEWIndex].active && Main.npc[AEWIndex].type == AEWType) { return true; } - SCalIndex = -1; + AEWIndex = -1; for (int i = 0; i < Main.npc.Length; i++) { - if (Main.npc[i].active && Main.npc[i].type == SCalType) + if (Main.npc[i].active && Main.npc[i].type == AEWType) { - SCalIndex = i; + AEWIndex = i; break; } } - //this.DoGIndex = DoGIndex; - return SCalIndex != -1; + return AEWIndex != -1; } public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { if (maxDepth >= 0 && minDepth < 0) { - float intensity = this.GetIntensity(); - spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + float intensity = GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 15) * intensity); } } diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index ab039a4777..da2b8cac3b 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -27,11 +27,10 @@ namespace CalamityMod.NPCs.Abyss npc.width = 74; npc.height = 94; npc.defense = 100; - npc.lifeMax = 12000; + npc.lifeMax = 9000; npc.aiStyle = -1; aiType = -1; npc.value = Item.buyPrice(0, 0, 30, 0); - npc.buffImmune[ModContent.BuffType()] = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.knockBackResist = 0.9f; @@ -162,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 900, true); + player.AddBuff(ModContent.BuffType(), 300, true); } public override void FindFrame(int frameHeight) @@ -189,7 +188,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 2, 5, 7); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 2, 3); diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index 261accaea7..eaefbf7dcc 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -25,18 +25,18 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { npc.lavaImmune = true; - npc.aiStyle = -1; + 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 = 10000; + npc.lifeMax = 7500; npc.knockBackResist = 0f; aiType = -1; npc.noGravity = true; npc.value = Item.buyPrice(0, 0, 50, 0); - npc.buffImmune[ModContent.BuffType()] = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; @@ -232,18 +232,11 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 300, true); player.AddBuff(ModContent.BuffType(), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300); - player.AddBuff(ModContent.BuffType(), 120, true); - } } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 2, 5, 7); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 2, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index 590f58e3c0..15f8a730da 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -29,7 +29,6 @@ namespace CalamityMod.NPCs.Abyss npc.alpha = 20; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 0, 80); npc.HitSound = SoundID.NPCHit25; npc.DeathSound = SoundID.NPCDeath28; @@ -213,10 +212,9 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - int abyssShockerChance = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 40 : 50; + int abyssShockerChance = Main.expertMode ? 40 : 50; DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, abyssShockerChance, 1, 1); - float necklaceDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.01f; - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, necklaceDropRate); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); } } } diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 72dc99d16d..c560f7e961 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -32,12 +32,11 @@ namespace CalamityMod.NPCs.Abyss npc.lavaImmune = true; npc.width = 78; npc.height = 70; - npc.defense = 25; - npc.lifeMax = 7500; + npc.defense = 50; + npc.lifeMax = 5625; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 30, 0); npc.HitSound = SoundID.NPCHit23; npc.DeathSound = SoundID.NPCDeath28; @@ -51,7 +50,7 @@ namespace CalamityMod.NPCs.Abyss 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 ? 230 : 115) : 0; + npc.damage = puffedUp ? (Main.expertMode ? 175 : 100) : 0; if (!puffing || !unpuffing) @@ -121,7 +120,7 @@ namespace CalamityMod.NPCs.Abyss Main.PlaySound(SoundID.NPCDeath14, (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient && puffedUp) { - int damageBoom = 100; + 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); } @@ -140,7 +139,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -206,7 +205,11 @@ namespace CalamityMod.NPCs.Abyss public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.Calamity().ZoneAbyssLayer4 && spawnInfo.water) + if (spawnInfo.player.Calamity().ZoneAbyssLayer2 && spawnInfo.water) + { + return SpawnCondition.CaveJellyfish.Chance * 0.4f; + } + if (spawnInfo.player.Calamity().ZoneAbyssLayer3 && spawnInfo.water) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -215,13 +218,12 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 10, 26); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 180); if (puffedUp) { diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index f19fa19680..6b35083632 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Ranged; @@ -39,29 +40,6 @@ namespace CalamityMod.NPCs.Abyss npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.timeLeft = NPC.activeTime * 30; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit20; @@ -412,7 +390,7 @@ namespace CalamityMod.NPCs.Abyss { damage = 55; } - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 111); + 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); } npc.rotation = npc.velocity.X * 0.05f; @@ -557,7 +535,7 @@ 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.player.Calamity().ZoneAbyssLayer4) && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType())) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } @@ -566,22 +544,16 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 600, true); - player.AddBuff(BuffID.Darkness, 600, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300); - player.AddBuff(ModContent.BuffType(), 300, true); - } + player.AddBuff(ModContent.BuffType(), 300, true); } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance / 100, 1, 1); DropHelper.DropItem(npc, ItemID.BlackInk, 3, 5); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 2, 26, 38); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 5, 7); 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) diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index fabeddcc84..aba420d53a 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -1,8 +1,8 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -29,11 +29,10 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 34; npc.width = 50; npc.height = 28; - npc.defense = 12; + npc.defense = 8; npc.lifeMax = 110; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit33; npc.DeathSound = SoundID.NPCDeath28; @@ -362,7 +361,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -371,10 +370,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Darkness, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 60, true); - } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -392,9 +387,8 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); - int inkBombDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 50 : 100; + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + int inkBombDropRate = Main.expertMode ? 50 : 100; DropHelper.DropItemChance(npc, ModContent.ItemType(), inkBombDropRate, 1, 1); } diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 52f471103a..36e7903cc0 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -29,14 +29,14 @@ namespace CalamityMod.NPCs.Abyss { npc.noGravity = true; npc.lavaImmune = true; - npc.damage = 90; + 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.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath1; @@ -274,7 +274,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -283,11 +283,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - player.AddBuff(ModContent.BuffType(), 120, true); - } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -305,12 +300,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 200, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index dbf075bf41..e51d360bd4 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -29,14 +29,14 @@ namespace CalamityMod.NPCs.Abyss { npc.noGravity = true; npc.lavaImmune = true; - npc.damage = 90; + 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.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath1; @@ -274,7 +274,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -283,11 +283,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - player.AddBuff(ModContent.BuffType(), 120, true); - } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -305,12 +300,10 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 1f, 3, 9); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedGolemBoss, 200, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 32bcbc21f0..77f7c27de9 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -26,10 +26,6 @@ namespace CalamityMod.NPCs.Abyss aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -49,37 +45,42 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -109,14 +110,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -131,7 +129,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -149,10 +147,6 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) @@ -162,12 +156,5 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm2"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - player.AddBuff(ModContent.BuffType(), 200, true); - player.AddBuff(ModContent.BuffType(), 200); - } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index 4f4d418e2f..0d3ac48dda 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -26,10 +26,6 @@ namespace CalamityMod.NPCs.Abyss aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -49,37 +45,42 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -109,14 +110,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -131,7 +129,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -149,10 +147,6 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) @@ -162,12 +156,5 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm3"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - player.AddBuff(ModContent.BuffType(), 200, true); - player.AddBuff(ModContent.BuffType(), 200); - } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs index b14e0c6fc3..81d23586b9 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs @@ -1,7 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,19 +18,17 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 60; //36 + npc.damage = 100; + npc.width = 60; npc.height = 88; npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new + npc.LifeMaxNERB(2100000, 2415000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.Opacity = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -41,133 +40,169 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + 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; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - 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); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + 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; + + bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; + 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) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + 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) + { + 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) + { + 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); + 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); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; 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) + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < 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 + 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((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + 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; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 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 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyAltGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } 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); - } + Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult3"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - player.AddBuff(ModContent.BuffType(), 200, true); - player.AddBuff(ModContent.BuffType(), 200); - } } } diff --git a/NPCs/Abyss/EidolonWyrmBodyHuge.cs b/NPCs/Abyss/EidolonWyrmBodyHuge.cs index c74de819f5..8ece35eb3f 100644 --- a/NPCs/Abyss/EidolonWyrmBodyHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyHuge.cs @@ -1,7 +1,8 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,19 +18,17 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 60; //36 + npc.damage = 100; + npc.width = 60; npc.height = 88; npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new + npc.LifeMaxNERB(2100000, 2415000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.Opacity = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -41,133 +40,169 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + 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; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - 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); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + 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; + + bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; + 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) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + 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) + { + 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) + { + 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); + 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); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; 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) + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < 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 + 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((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + 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; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 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 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmBodyGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } 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); - } + Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult2"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 500, true); - player.AddBuff(ModContent.BuffType(), 200, true); - player.AddBuff(ModContent.BuffType(), 200); - } } } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 7e0f802838..8cce28d27a 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -34,19 +34,16 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.npcSlots = 8f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 8f; npc.damage = 170; npc.width = 126; //36 npc.height = 76; //20 - npc.defense = 300; + npc.defense = 70; npc.DR_NERD(0.15f); npc.lifeMax = 160000; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 25, 0, 0); npc.behindTiles = true; @@ -76,7 +73,13 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState || adultWyrmAlive) { detectsPlayer = true; npc.damage = Main.expertMode ? 340 : 170; @@ -101,9 +104,9 @@ namespace CalamityMod.NPCs.Abyss Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), (int)npc.position.X, (int)npc.position.Y); } } - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { @@ -149,31 +152,23 @@ namespace CalamityMod.NPCs.Abyss npc.localAI[0] = 0f; npc.TargetClosest(true); npc.netUpdate = true; - int damage = 80; - if (Main.expertMode) - { - damage = 60; - } + 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)); int random = Main.rand.Next(3); if (random == 0) { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector2, Vector2.Zero, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); } else if (random == 1) { 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); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); + vec = new Vector2(npc.direction, 0f); } + Vector2 vector4 = vec * (adultWyrmAlive ? 6f : 4f); + Projectile.NewProjectile(vector2, vector4, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); } else { @@ -243,7 +238,7 @@ namespace CalamityMod.NPCs.Abyss { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f) { npc.active = false; } @@ -282,6 +277,14 @@ namespace CalamityMod.NPCs.Abyss num188 = 15f; num189 = 0.25f; } + if (adultWyrmAlive) + { + if (!Main.player[npc.target].Calamity().ZoneAbyssLayer4) + { + num188 = 22.5f; + num189 = 0.375f; + } + } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -428,7 +431,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -448,7 +451,19 @@ namespace CalamityMod.NPCs.Abyss return 0f; } - public override void NPCLoot() + public override bool PreNPCLoot() + { + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + return !adultWyrmAlive; + } + + public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 30, 40); if (Main.rand.NextBool(10)) @@ -456,8 +471,6 @@ namespace CalamityMod.NPCs.Abyss DropHelper.DropItem(npc, ItemID.BlueLunaticHood); DropHelper.DropItem(npc, ItemID.BlueLunaticRobe); } - int chance = CalamityGlobalNPCLoot.halibutCannonBaseDropChance / 100; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, chance, 1, 1); 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.downedCalamitas, 1, 6, 8); @@ -487,33 +500,12 @@ namespace CalamityMod.NPCs.Abyss { return false; } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 1200, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 600, true); - player.AddBuff(ModContent.BuffType(), 600); - } + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 99ee5e30c8..4dea815380 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -2,9 +2,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,15 +18,57 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Abyss { - public class EidolonWyrmHeadHuge : ModNPC + [AutoloadBossHead] + public class EidolonWyrmHeadHuge : ModNPC { - private Vector2 patrolSpot = Vector2.Zero; - public bool detectsPlayer = false; - public const int minLength = 40; - public const int maxLength = 41; - public float speed = 7.5f; //10 - public float turnSpeed = 0.15f; //0.15 - bool TailSpawned = false; + public enum Phase + { + ChargeOne = 0, + LightningRain = 1, + FastCharge = 2, + EidolonWyrmSpawn = 3, + ChargeTwo = 4, + IceMist = 5, + ShadowFireballSpin = 6, + AncientDoomSummon = 7, + LightningCharge = 8, + EidolistSpawn = 9, + FinalPhase = 10 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + // Base distance from the target for most attacks + private const float baseDistance = 1000f; + + // Base distance from target location in order to continue turning + private const float baseTurnDistance = 160f; + + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 2800f; + + // The end location of each charge + Vector2 chargeDestination = default; + + // Length variables + private const int minLength = 40; + private const int maxLength = 41; + + // Variable used to stop the segment spawning loop + private bool TailSpawned = false; + + // The direction to spin in during spin phases + private int rotationDirection = 0; + + // Used in the lerp to smoothly scale velocity up and down + private float chargeVelocityScalar = 0f; + + // How much less time is needed before activating fast charge + private const float fastChargeGateValue = 120f; public override void SetStaticDefaults() { @@ -33,21 +77,21 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.npcSlots = 24f; - npc.damage = 1500; - npc.width = 254; //36 - npc.height = 138; //20 - npc.defense = 3000; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.999999f; - global.unbreakableDR = true; - npc.lifeMax = 1000000; - npc.aiStyle = -1; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 50f; + npc.GetNPCDamage(); + npc.width = 254; + npc.height = 138; + npc.defense = 100; + npc.DR_NERD(0.4f); + CalamityGlobalNPC global = npc.Calamity(); + global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); + npc.LifeMaxNERB(2100000, 2415000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.Opacity = 0f; npc.knockBackResist = 0f; npc.value = Item.buyPrice(10, 0, 0, 0); npc.behindTiles = true; @@ -56,470 +100,1253 @@ namespace CalamityMod.NPCs.Abyss npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.netAlways = true; - } + npc.boss = true; + music = CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ?? MusicID.Boss3; + } public override void SendExtraAI(BinaryWriter writer) { - writer.WriteVector2(patrolSpot); - writer.Write(detectsPlayer); - writer.Write(npc.chaseable); - } + writer.Write(npc.dontTakeDamage); + 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]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { - patrolSpot = reader.ReadVector2(); - detectsPlayer = reader.ReadBoolean(); - npc.chaseable = reader.ReadBoolean(); - } + npc.dontTakeDamage = reader.ReadBoolean(); + 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(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.adultEidolonWyrmHead = npc.whoAmI; + + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Phases + bool phase2 = lifeRatio < 0.8f; + bool phase3 = lifeRatio < 0.6f; + bool phase4 = lifeRatio < 0.4f; + bool phase5 = lifeRatio < 0.2f; + 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(); + + // 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(); + + // Target variable + Player player = Main.player[npc.target]; + + bool targetDownDeep = player.Calamity().ZoneAbyssLayer4; + bool targetOnMount = player.mount.Active; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Play spawn sound + if (!TailSpawned && npc.ai[0] == 0f) { - npc.TargetClosest(true); + 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 (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState) - { - if (!detectsPlayer) + + // Spawn segments + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned && npc.ai[0] == 0f) { - if (Main.netMode != NetmodeID.Server) + int Previous = npc.whoAmI; + for (int i = 0; i < maxLength; i++) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Scare"), (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y); + 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); + else + 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); + + 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); + Previous = lol; + Main.npc[Previous].ai[3] = i / 2; } - detectsPlayer = true; + TailSpawned = true; } - npc.damage = 1500; - } - else - { - npc.damage = 0; - } - npc.chaseable = detectsPlayer; - if (detectsPlayer) - { - if (npc.soundDelay <= 0 && Main.netMode != NetmodeID.Server) - { - npc.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - else - { - if (Main.rand.NextBool(900) && Main.netMode != NetmodeID.Server) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose").WithVolume(2.5f), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned && npc.ai[0] == 0f) - { - 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); - } - else - { - 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); - } - 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); - Previous = lol; - } - TailSpawned = true; - } - if (detectsPlayer) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - npc.netUpdate = true; - int damage = Main.expertMode ? 300 : 400; - 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 random = Main.rand.Next(3); - if (random == 0) - { - Projectile.NewProjectile(vector2.X, vector2.Y, 0f, 0f, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, 0f, 0f, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); - } - else if (random == 1) - { - 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); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(vector2.X, vector2.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(-vector2.X, -vector2.Y, -vector4.X, -vector4.Y, 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) - { - Main.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); - Main.dust[num622].velocity *= 0.6f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - Main.dust[num624].velocity *= 0.2f; - } - if (Math.Abs(Main.player[npc.target].velocity.X) > 0.1f) - { - Main.player[npc.target].velocity.X = -Main.player[npc.target].velocity.X * 2f; - } - if (Math.Abs(Main.player[npc.target].velocity.Y) > 0.1f) - { - Main.player[npc.target].velocity.Y = -Main.player[npc.target].velocity.Y * 2f; - } - } - } - } - } - } + } - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - - if (Main.player[npc.target].dead) + // Despawn if target is dead + bool targetDead = false; + if (player.dead) { npc.TargetClosest(false); - - 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) + player = Main.player[npc.target]; + if (player.dead) { - for (int a = 0; a < Main.maxNPCs; a++) + targetDead = true; + 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 += 2f; + if (npc.position.Y > Main.worldSurface * 16.0) + npc.velocity.Y += 2f; + + if (npc.position.Y > Main.rockLayer * 16.0) { - 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; + 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()) + Main.npc[a].active = false; + } } } } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } + // General AI pattern + // Charge + // Charge : Phase 2 - Spin around target and summon Shadow Fireballs + // Charge : Phase 4 - Swim to the right and dash towards the target, summon Lightning Bolts from above during it + // Turn invisible, swim above the target and summon predictive Lightning Bolts + // Turn visible and charge towards the target quickly 1 time, soon after the previous attack ends + // Spawn an Eidolon Wyrm and swim below the target for 10 seconds, or less, if the Wyrm dies + // Charge + // Charge : Phase 3 - Turn invisible and summon Ancient Dooms around the target + // Charge : Phase 4 - Turn visible, swim to the left and dash towards the target, summon Lightning Bolts from above during it + // Turn invisible, swim beneath the target and summon Ice Mist + // Turn visible and charge towards the target quickly 1 time, soon after the previous attack ends + // Spawn Eidolists and swim below the target for 10 seconds, or less, if the Eidolists die - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6400f || !NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } + // Final phase + // Spin around the target and summon Ancient Dooms and Shadow Fireballs - 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); + // Attack patterns + // Phase 1 - 0, 0, 0, 1, 2, 3, 4, 4, 4, 5, 2, 9 + // Phase 2 - 0, 6, 0, 1, 2, 3, 4, 4, 4, 5, 2, 9 + // Phase 3 - 0, 6, 0, 1, 2, 3, 4, 7, 4, 5, 2, 9 + // Phase 4 - 0, 6, 8, 1, 2, 3, 4, 7, 8, 5, 2, 9 + // Phase 5 - 0, 6, 8, 1, 2, 2, 4, 7, 8, 5, 2, 2 + // Phase 6 - 10 - if (patrolSpot == Vector2.Zero) - patrolSpot = Main.player[npc.target].Center; + // Phase gate values + float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + float lightningRainDuration = malice ? 150f : 180f; + float eidolonWyrmPhaseDuration = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; + float iceMistDuration = malice ? 150f : 180f; + float spinPhaseDuration = malice ? 210f : death ? 240f : revenge ? 255f : expertMode ? 270f : 300f; + float ancientDoomPhaseGateValue = 30f; + float ancientDoomGateValue = malice ? 80f : death ? 95f : revenge ? 100f : expertMode ? 105f : 120f; + float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; - float num191 = detectsPlayer ? Main.player[npc.target].Center.X : patrolSpot.X; - float num192 = detectsPlayer ? Main.player[npc.target].Center.Y : patrolSpot.Y; + // 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[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - if (!detectsPlayer) + // 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); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC.newAI[2] <= lightningChargePhaseGateValue + 1f && AIState == (float)Phase.LightningCharge; + bool invisiblePhase = AIState == (float)Phase.LightningRain || AIState == (float)Phase.IceMist || AIState == (float)Phase.AncientDoomSummon; + npc.dontTakeDamage = invisiblePartOfChargePhase || invisiblePartOfLightningChargePhase || invisiblePhase; + if (!invisiblePartOfChargePhase && !invisiblePartOfLightningChargePhase && !invisiblePhase) { - num192 += 800; - if (Math.Abs(npc.Center.X - num191) < 400f) //500 - { - if (npc.velocity.X > 0f) + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + 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; + + // Default vector to swim to + Vector2 destination = player.Center; + + // Charge variables + Vector2 chargeVector = Vector2.Zero; + float chargeDistance = baseDistance; + float turnDistance = baseTurnDistance; + float chargeLocationDistance = turnDistance * 0.2f; + switch ((int)calamityGlobalNPC.newAI[1]) + { + case 0: + chargeVector.X -= chargeDistance; + break; + case 1: + chargeVector.X += chargeDistance; + break; + case 2: + chargeVector.Y -= chargeDistance; + break; + case 3: + chargeVector.Y += chargeDistance; + break; + case 4: + chargeVector.X -= chargeDistance; + chargeVector.Y -= chargeDistance; + break; + case 5: + chargeVector.X += chargeDistance; + chargeVector.Y += chargeDistance; + break; + case 6: + chargeVector.X -= chargeDistance; + chargeVector.Y += chargeDistance; + break; + case 7: + chargeVector.X += chargeDistance; + chargeVector.Y -= chargeDistance; + break; + } + Vector2 chargeLocation = destination + chargeVector; + Vector2 chargeVectorFlipped = chargeVector * -1f; + float chargePredictionAmt = malice ? 60f : death ? 50f : revenge ? 40f : expertMode ? 30f : 20f; + + // Lightning Rain variables + Vector2 lightningRainLocation = new Vector2(0f, -baseDistance); + float lightningRainLocationDistance = turnDistance * 0.2f; + + // Wyrm and Eidolist variables + Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, baseDistance); + float eidolonWyrmPhaseLocationDistance = turnDistance * 0.5f; + int eidolistScale = malice ? 4 : death ? 3 : revenge ? 2 : expertMode ? 1 : 0; + int maxEidolists = (targetDownDeep ? 3 : 5) + eidolistScale; + + // Ice Mist variables + Vector2 iceMistLocation = new Vector2(0f, baseDistance); + float iceMistLocationDistance = turnDistance * 0.2f; + + // Spin variables + float spinRadius = baseDistance; + Vector2 spinLocation = new Vector2(0f, -spinRadius); + float spinLocationDistance = turnDistance * 0.1f; + + // Ancient Doom variables + Vector2 ancientDoomLocation = new Vector2(0f, -baseDistance); + float ancientDoomLocationDistance = turnDistance * 0.2f; + int ancientDoomScale = malice ? 4 : death ? 3 : revenge ? 2 : expertMode ? 1 : 0; + int ancientDoomLimit = (targetDownDeep ? 4 : 6) + ancientDoomScale; + int ancientDoomDistance = malice ? 480 : death ? 520 : revenge ? 535 : expertMode ? 550 : 600; + float maxAncientDoomRings = 3f; + + // Lightning charge variables + Vector2 lightningChargeVector = npc.localAI[2] == 0f ? new Vector2(baseDistance, 0f) : new Vector2(-baseDistance, 0f); + float lightningChargeLocationDistance = turnDistance * 0.2f; + Vector2 lightningChargeLocation = destination + lightningChargeVector; + Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; + float lightningSpawnY = 540f; + 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; + + // Velocity and turn speed values + float velocityScale = malice ? 4f : death ? 2.5f : revenge ? 2f : expertMode ? 1.5f : 0f; + float baseVelocity = targetDownDeep ? 12f : 18f; + float turnSpeed = baseVelocity * 0.125f; + float normalChargeVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); + float normalChargeTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar); + float invisiblePhaseVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); + float invisiblePhaseTurnSpeedMult = MathHelper.Lerp(1f, 6f, chargeVelocityScalar); + float fastChargeVelocityMult = MathHelper.Lerp(1f, 3f, chargeVelocityScalar); + float fastChargeTurnSpeedMult = MathHelper.Lerp(1f, 12f, chargeVelocityScalar); + float chargeVelocityScalarIncrement = 0.025f; + + // Phase switch + switch ((int)AIState) + { + // First charge combo + case (int)Phase.ChargeOne: + + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) { - num191 += 500f; + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; + turnDistance = chargeLocationDistance; + + 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); + + chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + } + else + { + // Charge + + // Become totally visible + npc.Opacity = 1f; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < chargeLocationDistance) + { + npc.ai[3] += 1f; + float maxCharges = phase4 ? 1 : phase2 ? 2 : 3; + if (npc.ai[3] >= maxCharges) + { + npc.ai[3] = 0f; + AIState = phase4 ? (float)Phase.ShadowFireballSpin : (float)Phase.LightningRain; + } + else if (phase2) + AIState = (float)Phase.ShadowFireballSpin; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[2] = 0f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + } + else + destination += chargeVector; } else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Turn invisible, swim above and summon predictive lightning bolts + case (int)Phase.LightningRain: + + // Swim up + destination += lightningRainLocation; + turnDistance = lightningRainLocationDistance; + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; + + if ((destination - npc.Center).Length() < lightningRainLocationDistance || calamityGlobalNPC.newAI[2] > 0f) { - num191 -= 500f; + 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.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 2; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = targetDownDeep ? 45f : 60f; + float lightningVelocityScale = malice ? 3f : death ? 2f : revenge ? 1.5f : expertMode ? 1f : 0f; + float lightningVelocity = ((targetDownDeep && !targetOnMount) ? 6f : 8f) + lightningVelocityScale; + for (int i = 0; i < numProjectiles; i++) + { + // Predictive bolt + 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); + Main.projectile[proj].tileCollide = false; + + // Opposite bolt + 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); + Main.projectile[proj].tileCollide = false; + + // Normal bolt + 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); + Main.projectile[proj].tileCollide = false; + } + } + } + + calamityGlobalNPC.newAI[2] += 1f; + + 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; + 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); + Main.dust[dust].velocity = Vector2.Zero; + Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].noGravity = true; + + if (calamityGlobalNPC.newAI[2] >= lightningRainDuration) + { + npc.localAI[0] = 0f; + AIState = (float)Phase.FastCharge; + calamityGlobalNPC.newAI[2] = fastChargeGateValue; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } } + + break; + + // Turn visible and charge quickly + case (int)Phase.FastCharge: + + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) + { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= fastChargeVelocityMult; + turnSpeed *= fastChargeTurnSpeedMult; + turnDistance = chargeLocationDistance; + + 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); + + chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + } + else + { + // Charge very quickly + + // Become totally visible + npc.Opacity = 1f; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < chargeLocationDistance) + { + if (!phase5) + { + 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] = 0f; + AIState = npc.localAI[0] == 0f ? (float)Phase.ChargeTwo : (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + } + else + calamityGlobalNPC.newAI[2] = fastChargeGateValue; + } + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + } + else + destination += chargeVector; + } + else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Summon an Eidolon Wyrm and swim below the target for 3 seconds, or less, if the Wyrm dies + case (int)Phase.EidolonWyrmSpawn: + + destination += eidolonWyrmPhaseLocation; + turnDistance = eidolonWyrmPhaseLocationDistance; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[2] == 0f) + { + 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); + + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + } + } + } + + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration) + { + AIState = (float)Phase.ChargeTwo; + calamityGlobalNPC.newAI[2] = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + + break; + + // Second charge combo + case (int)Phase.ChargeTwo: + + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) + { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= normalChargeVelocityMult; + turnSpeed *= normalChargeTurnSpeedMult; + turnDistance = chargeLocationDistance; + + 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); + + chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + } + else + { + // Charge + + // Become totally visible + npc.Opacity = 1f; + + destination = chargeDestination; + + if ((destination - npc.Center).Length() < chargeLocationDistance) + { + npc.ai[3] += 1f; + float maxCharges = phase4 ? 1 : phase3 ? 2 : 3; + if (npc.ai[3] >= maxCharges) + { + npc.ai[3] = 0f; + AIState = phase4 ? (float)Phase.AncientDoomSummon : (float)Phase.IceMist; + } + else if (phase3) + AIState = (float)Phase.AncientDoomSummon; + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 7f) + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[2] = 0f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + } + else + destination += chargeVector; + } + else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Turn invisible, swim beneath the target and summon ice mist + case (int)Phase.IceMist: + + // Swim down + destination += iceMistLocation; + turnDistance = iceMistLocationDistance; + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; + + if ((destination - npc.Center).Length() < iceMistLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + if (calamityGlobalNPC.newAI[2] % 60f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 2; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = targetDownDeep ? 90f : 120f; + float iceMistVelocityScale = malice ? 3f : death ? 2f : revenge ? 1.5f : expertMode ? 1f : 0f; + float iceMistVelocity = (targetDownDeep ? 12f : 16f) + iceMistVelocityScale; + for (int i = 0; i < numProjectiles; i++) + { + // Predictive mist + 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); + + // Opposite mist + 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); + + // Normal bolt + projectileDestination = targetCenterArray[i] - npc.Center; + projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; + 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); + + 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; + 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); + Main.dust[dust].velocity = Vector2.Zero; + Main.dust[dust].position = npc.Center + dustPosition; + Main.dust[dust].noGravity = true; + + if (calamityGlobalNPC.newAI[2] >= iceMistDuration) + { + npc.localAI[0] = 1f; + AIState = (float)Phase.FastCharge; + calamityGlobalNPC.newAI[2] = fastChargeGateValue; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + + break; + + // Phase 2 attack - Get in position for spin, spin around target and summon shadow fireballs + case (int)Phase.ShadowFireballSpin: + + // Swim up + destination += spinLocation; + turnDistance = spinLocationDistance; + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; + + // Spin around target + if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + calamityGlobalNPC.newAI[2] += 1f; + + float spinVelocityDivisor = baseVelocity * 2f; + if (rotationDirection == 0) + { + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + rotationDirection = 1; + 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; + } + else + { + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); + + if (calamityGlobalNPC.newAI[2] >= spinPhaseDuration) + { + rotationDirection = 0; + AIState = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + + // Return to prevent other velocity code from being called + return; + } + + break; + + // Phase 3 attack - Swim above, turn invisible and summon ancient dooms around the target + case (int)Phase.AncientDoomSummon: + + // Swim up + destination += ancientDoomLocation; + turnDistance = ancientDoomLocationDistance; + + if (npc.localAI[1] < maxAncientDoomRings) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= ancientDoomPhaseGateValue) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; + if (aiGateValue % ancientDoomGateValue == 0f) + { + // Spawn 3 (or more) circles of Ancient Dooms around the target + int ancientDoomScale2 = (int)(aiGateValue / ancientDoomGateValue); + ancientDoomLimit += ancientDoomScale2; + ancientDoomDistance += ancientDoomScale2 * 45; + int ancientDoomDegrees = 360 / ancientDoomLimit; + for (int i = 0; i < ancientDoomLimit; i++) + { + 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); + } + npc.localAI[1] += 1f; + npc.TargetClosest(); + } + } + } + } + + if (npc.localAI[1] >= maxAncientDoomRings) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] >= ancientDoomGateValue + maxAncientDoomRings) + { + npc.localAI[1] = 0f; + AIState = phase4 ? (float)Phase.LightningCharge : (float)Phase.ChargeTwo; + calamityGlobalNPC.newAI[2] = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + + break; + + // Phase 4 attack - Swim to the right or left and charge towards the target, summon a wall of lightning bolts in the direction of the charge + case (int)Phase.LightningCharge: + + if (calamityGlobalNPC.newAI[2] >= lightningChargePhaseGateValue) + { + ChargeDust(7, (float)Math.PI); + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= fastChargeVelocityMult; + turnSpeed *= fastChargeTurnSpeedMult; + turnDistance = lightningChargeLocationDistance; + + 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); + + chargeDestination = destination + lightningChargeVectorFlipped + player.velocity * chargePredictionAmt; + npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity; + } + else + { + // Charge + + // Become totally visible + npc.Opacity = 1f; + + destination = chargeDestination; + + // Lightning barrage + 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); + + npc.localAI[3] = 1f; + int type = ProjectileID.CultistBossLightningOrbArc; + 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); + Main.projectile[proj].tileCollide = false; + lightningSpawnLocation.Y += distanceBetweenBolts; + if (i == numLightningBolts / 2) + lightningSpawnLocation.Y += distanceBetweenBolts; + } + } + + if ((destination - npc.Center).Length() < lightningChargeLocationDistance) + { + 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[3] = 0f; + chargeVelocityScalar = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + } + } + else + destination += lightningChargeVector; + } + else + calamityGlobalNPC.newAI[2] += 1f; + + break; + + // Summon Eidolists and swim below the target for 3 seconds, or less, if the Eidolists die + case (int)Phase.EidolistSpawn: + + destination += eidolonWyrmPhaseLocation; + turnDistance = eidolonWyrmPhaseLocationDistance; + + if (calamityGlobalNPC.newAI[2] == 0f) + { + 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); + + // Spawn Eidolists randomly around the target + for (int i = 0; i < maxEidolists; i++) + { + Point npcCenter = npc.Center.ToTileCoordinates(); + Point playerCenter = player.Center.ToTileCoordinates(); + Vector2 distance = player.Center - npc.Center; + + int baseSpawnDistance = 60; + int minDistance = 3; + int maxDistance = 7; + int collisionRange = 2; + int iterations = 0; + bool tooFar = distance.Length() > 2800f; + while (!tooFar && iterations < 100) + { + iterations++; + int randomX = Main.rand.Next(playerCenter.X - baseSpawnDistance, playerCenter.X + baseSpawnDistance + 1); + int randomY = Main.rand.Next(playerCenter.Y - baseSpawnDistance, playerCenter.Y + baseSpawnDistance + 1); + if ((randomY < playerCenter.Y - maxDistance || randomY > playerCenter.Y + maxDistance || randomX < playerCenter.X - maxDistance || randomX > playerCenter.X + maxDistance) && (randomY < npcCenter.Y - minDistance || randomY > npcCenter.Y + minDistance || randomX < npcCenter.X - minDistance || randomX > npcCenter.X + minDistance) && !Main.tile[randomX, randomY].nactive()) + { + bool canSpawn = true; + if (canSpawn && Collision.SolidTiles(randomX - collisionRange, randomX + collisionRange, randomY - collisionRange, randomY + collisionRange)) + canSpawn = false; + + if (canSpawn) + { + NPC.NewNPC(randomX * 16 + 8, randomY * 16 + 8, ModContent.NPCType()); + break; + } + } + } + } + } + } + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= eidolonWyrmPhaseDuration) + { + AIState = (float)Phase.ChargeOne; + calamityGlobalNPC.newAI[2] = 0f; + FinalPhaseCheck(); + npc.TargetClosest(); + } + + break; + + // Spin around target, summon Ancient Dooms and shoot Shadow Fireballs from body segments + case (int)Phase.FinalPhase: + + // Ancient Dooms + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= ancientDoomPhaseGateValue) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float aiGateValue = calamityGlobalNPC.newAI[2] - ancientDoomPhaseGateValue; + if (aiGateValue % ancientDoomGateValue == 0f) + { + // Spawn 3 (or more) circles of Ancient Dooms around the target + int ancientDoomScale2 = (int)(aiGateValue / ancientDoomGateValue); + ancientDoomLimit += ancientDoomScale2; + ancientDoomDistance += ancientDoomScale2 * 45; + int ancientDoomDegrees = 360 / ancientDoomLimit; + for (int i = 0; i < ancientDoomLimit; i++) + { + 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); + } + + if (calamityGlobalNPC.newAI[2] >= 240f) + calamityGlobalNPC.newAI[2] = -90f; + + npc.TargetClosest(); + } + } + } + + // Spin + // Swim up + destination += spinLocation; + turnDistance = spinLocationDistance; + + // Use a lerp to smoothly scale up velocity and turn speed + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + + baseVelocity *= invisiblePhaseVelocityMult; + turnSpeed *= invisiblePhaseTurnSpeedMult; + + // Spin around target + if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[1] > 0f) + { + calamityGlobalNPC.newAI[1] += 1f; + float spinVelocityDivisor = baseVelocity * 2f; + if (rotationDirection == 0) + { + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + rotationDirection = 1; + 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; + } + else + { + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocityDivisor * -rotationDirection); + + // Swim above target again if enough time has passed + if (calamityGlobalNPC.newAI[1] >= spinPhaseDuration) + { + calamityGlobalNPC.newAI[1] = 0f; + + chargeVelocityScalar = 0f; + rotationDirection = 0; + + npc.TargetClosest(); + } + } + + // Return to prevent other velocity code from being called + return; + } + + break; + } + + void FinalPhaseCheck() + { + if (phase6) + { + npc.localAI[1] = 0f; + AIState = (float)Phase.FinalPhase; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + rotationDirection = 0; } } - else - { - num188 = 10f; - num189 = 0.175f; - if (!Main.player[npc.target].wet) - { - num188 = 20f; - num189 = 0.25f; - } - } - float num48 = num188 * 1.3f; - float num49 = num188 * 0.7f; - float num50 = npc.velocity.Length(); - if (num50 > 0f) - { - if (num50 > num48) - { - npc.velocity.Normalize(); - npc.velocity *= num48; - } - else if (num50 < num49) - { - npc.velocity.Normalize(); - npc.velocity *= num49; - } - } - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - 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 < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - 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 (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - 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 (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - 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 (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - 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) - { - cooldownSlot = 1; - return true; - } + 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; - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - { - return detectsPlayer; - } - return null; - } + // Acceleration + if (!((destination - npc.Center).Length() < turnDistance)) + { + float targetAngle = npc.AngleTo(destination); + float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + npc.velocity = f.ToRotationVector2() * baseVelocity; + } + } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + // Velocity upper limit + if (npc.velocity.Length() > baseVelocity) + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * baseVelocity; + + // Storm code + if (calamityGlobalNPC.newAI[3] == 0f) + { + // Start a storm + if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu)) + return; + + CalamityUtils.StartRain(true, true); + calamityGlobalNPC.newAI[3] = 1f; + } + } + + 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 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; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 70f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CalamityUtils.AntiButcher(npc, ref damage, 0.1f); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - 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)); + 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((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmHeadGlowHuge"), 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().ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(ModContent.NPCType()) && CalamityWorld.downedPolterghast) - { - return SpawnCondition.CaveJellyfish.Chance * 0.012f; - } - return 0f; - } + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ModContent.ItemType(); + } - public override void NPCLoot() + public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); DropHelper.DropItem(npc, ModContent.ItemType()); DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge); + DropHelper.DropItem(npc, ModContent.ItemType()); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); } - public override void HitEffect(int hitDirection, double damage) - { - if (detectsPlayer) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } - 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); - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); - } - } - } + 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); - public override bool CheckActive() - { - if (detectsPlayer && !Main.player[npc.target].dead) - { - return false; - } - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } + 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); - public override void OnHitPlayer(Player player, int damage, bool crit) + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult"), 1f); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + 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) { - player.AddBuff(ModContent.BuffType(), 1200, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 1200, true); - player.AddBuff(ModContent.BuffType(), 1200); - } + if (npc.Opacity == 1f) + player.AddBuff(ModContent.BuffType(), 600, true); } } } diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge_Head_Boss.png b/NPCs/Abyss/EidolonWyrmHeadHuge_Head_Boss.png new file mode 100644 index 0000000000..ffafb0bc3b Binary files /dev/null and b/NPCs/Abyss/EidolonWyrmHeadHuge_Head_Boss.png differ diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index f8e6ce9535..78180c8a80 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -25,10 +25,6 @@ namespace CalamityMod.NPCs.Abyss aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -48,37 +44,42 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -108,14 +109,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -130,7 +128,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -148,10 +146,6 @@ namespace CalamityMod.NPCs.Abyss public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } if (npc.life <= 0) { for (int k = 0; k < 10; k++) @@ -161,11 +155,5 @@ namespace CalamityMod.NPCs.Abyss Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/Wyrm4"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(ModContent.BuffType(), 60, true); - } } } diff --git a/NPCs/Abyss/EidolonWyrmTailHuge.cs b/NPCs/Abyss/EidolonWyrmTailHuge.cs index c77d688ed9..4ea332258d 100644 --- a/NPCs/Abyss/EidolonWyrmTailHuge.cs +++ b/NPCs/Abyss/EidolonWyrmTailHuge.cs @@ -1,6 +1,7 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,19 +17,17 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 100; //70 - npc.width = 86; //28 - npc.height = 120; //28 + npc.damage = 100; + npc.width = 86; + npc.height = 120; npc.defense = 0; - npc.lifeMax = 1000000; - npc.aiStyle = -1; //new - aiType = -1; //new + npc.LifeMaxNERB(2100000, 2415000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; npc.knockBackResist = 0f; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + npc.Opacity = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -40,132 +39,135 @@ namespace CalamityMod.NPCs.Abyss npc.chaseable = false; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { npc.damage = 0; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - 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); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + 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; + + bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); + bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; + 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) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + 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); + num191 = (int)(num191 / 16f) * 16; + num192 = (int)(num192 / 16f) * 16; + vector18.X = (int)(vector18.X / 16f) * 16; + vector18.Y = (int)(vector18.Y / 16f) * 16; 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) + + float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + if (npc.ai[1] > 0f && npc.ai[1] < 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 + 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((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; + 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; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 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 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Width, (float)(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Color color = new Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + vector -= new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Width, ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge").Height) * 0.5f; + vector += vector11 * 1f + new Vector2(0f, 4f + npc.gfxOffY); + Color color = new Color(127, 127, 127, 0).MultiplyRGBA(Color.LightYellow) * npc.Opacity; Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/NPCs/Abyss/EidolonWyrmTailGlowHuge"), vector, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 4, hitDirection, -1f, 0, default, 1f); - } 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); - } + Gore.NewGore(npc.Center, npc.velocity, mod.GetGoreSlot("Gores/WyrmAdult4"), 1f); } } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Bleeding, 60, true); - player.AddBuff(ModContent.BuffType(), 60, true); - } } } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index ad29e0c4a9..f9f9b6677f 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Ranged; @@ -30,11 +31,10 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 100; npc.width = 50; npc.height = 220; - npc.defense = 25; + npc.defense = 18; npc.lifeMax = 800; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 15, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -220,7 +220,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -243,19 +243,15 @@ namespace CalamityMod.NPCs.Abyss { player.AddBuff(ModContent.BuffType(), 180, true); player.AddBuff(BuffID.Darkness, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - player.AddBuff(ModContent.BuffType(), 120, true); - } } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 2, 4); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 1, 2); + int inkBombDropRate = Main.expertMode ? 25 : 40; + DropHelper.DropItemChance(npc, ModContent.ItemType(), inkBombDropRate, 1, 1); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index 40c43a7968..07f15548f6 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -20,16 +20,12 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 90; //70 npc.width = 56; //36 npc.height = 36; - npc.defense = 80; - npc.lifeMax = 80000; + npc.defense = 30; + npc.lifeMax = 60000; npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -49,37 +45,41 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -109,14 +109,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -131,7 +128,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -166,7 +163,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } } diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index d9e0a41b8e..ea46ef12a6 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -20,16 +20,12 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 90; //70 npc.width = 36; //36 npc.height = 36; - npc.defense = 80; - npc.lifeMax = 80000; + npc.defense = 30; + npc.lifeMax = 60000; npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -49,37 +45,41 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -109,14 +109,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -131,7 +128,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -166,7 +163,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 712cec5fdb..9ee3de6cdb 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -31,17 +31,14 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.damage = 135; + npc.Calamity().canBreakPlayerDefense = true; + npc.damage = 135; npc.width = 66; //36 npc.height = 86; //20 - npc.defense = 50; - npc.lifeMax = 80000; + npc.defense = 10; + npc.lifeMax = 60000; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 50, 0); npc.behindTiles = true; @@ -79,9 +76,9 @@ namespace CalamityMod.NPCs.Abyss detectsPlayer = true; } npc.chaseable = detectsPlayer; - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { @@ -137,7 +134,7 @@ namespace CalamityMod.NPCs.Abyss { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(ModContent.NPCType())) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) { npc.active = false; } @@ -317,7 +314,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -338,7 +335,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 2, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 6, 8); @@ -361,36 +357,9 @@ namespace CalamityMod.NPCs.Abyss } } - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 300, true); player.AddBuff(ModContent.BuffType(), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(ModContent.BuffType(), 180, true); - } } } } diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 668c670a5a..77d03dbcd4 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -20,16 +20,12 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 65; //70 npc.width = 54; //28 npc.height = 76; //28 - npc.defense = 100; - npc.lifeMax = 80000; + npc.defense = 50; + npc.lifeMax = 60000; npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -49,37 +45,41 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -109,14 +109,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -131,7 +128,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -165,7 +162,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 60, true); player.AddBuff(ModContent.BuffType(), 60, true); } } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 22910df1fa..c2f0ead0b8 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -26,11 +26,10 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 40; npc.width = 60; npc.height = 26; - npc.defense = 25; + npc.defense = 15; npc.lifeMax = 480; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit51; npc.DeathSound = SoundID.NPCDeath26; @@ -91,7 +90,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -112,7 +111,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); } diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index adcfb99402..2a464acdf2 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -32,11 +32,10 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 10; npc.width = 74; npc.height = 56; - npc.defense = 20; + npc.defense = 12; npc.lifeMax = 800; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 15, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -263,7 +262,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -286,7 +285,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 8, 15); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index b4701b7713..4df2aebc7f 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -38,7 +38,6 @@ namespace CalamityMod.NPCs.Abyss npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 25, 0); npc.HitSound = SoundID.NPCHit25; npc.DeathSound = SoundID.NPCDeath28; @@ -182,7 +181,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -208,14 +207,12 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, 10, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 2, 5, 7); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 5, 7); 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); - float necklaceDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.01f; - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, necklaceDropRate); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 97d594c28d..7bef66a3c8 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -26,7 +26,6 @@ namespace CalamityMod.NPCs.Abyss npc.lifeMax = 360; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -70,7 +69,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); player.AddBuff(BuffID.Venom, 90, true); } diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index 5daa4643a8..fce746d5e7 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -24,10 +24,6 @@ namespace CalamityMod.NPCs.Abyss aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,37 +43,41 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -107,14 +107,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 8cc1326420..53917a4345 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -1,7 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -36,10 +35,6 @@ namespace CalamityMod.NPCs.Abyss npc.lifeMax = 4000; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.behindTiles = true; @@ -68,21 +63,17 @@ namespace CalamityMod.NPCs.Abyss 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; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + + 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); - } - npc.velocity.Length(); + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned && npc.ai[0] == 0f) @@ -109,27 +100,21 @@ namespace CalamityMod.NPCs.Abyss TailSpawned = true; } } + 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); - } + npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(ModContent.NPCType())) - { + + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) npc.active = false; - } float num188 = speed; float num189 = turnSpeed; @@ -310,7 +295,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 3, 5); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 1, 2); } @@ -330,35 +314,9 @@ namespace CalamityMod.NPCs.Abyss } } - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 90); - player.AddBuff(ModContent.BuffType(), 90, true); - } + player.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index 89a90fa4f0..6e31e553cd 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -24,10 +24,6 @@ namespace CalamityMod.NPCs.Abyss aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,38 +43,41 @@ namespace CalamityMod.NPCs.Abyss public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - npc.velocity.Length(); - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -108,14 +107,11 @@ namespace CalamityMod.NPCs.Abyss npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 791609236e..7c447ec42e 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Potions; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.World; @@ -29,7 +30,8 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - npc.npcSlots = 6f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 6f; npc.noGravity = true; npc.lavaImmune = true; npc.damage = 160; @@ -39,29 +41,6 @@ namespace CalamityMod.NPCs.Abyss npc.lifeMax = 190000; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.timeLeft = NPC.activeTime * 30; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit56; @@ -648,15 +627,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); player.AddBuff(ModContent.BuffType(), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - player.AddBuff(ModContent.BuffType(), 120, true); - } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -675,16 +646,15 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance / 100, 1, 1); DropHelper.DropItem(npc, ModContent.ItemType(), 40, 50); - DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); + DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 2, 10, 17); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 4, 5); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 1f, 3, 4); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast, 3, 1, 1); if (CalamityWorld.downedPolterghast) { - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), 0.3333f, 0.01f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); } } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index e29963bdc8..bde527ebfc 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.Abyss npc.aiStyle = -1; aiType = -1; npc.value = Item.buyPrice(0, 0, 5, 0); - npc.buffImmune[ModContent.BuffType()] = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.knockBackResist = 0.15f; @@ -106,7 +105,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -114,7 +113,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + player.AddBuff(BuffID.Poisoned, 120, true); } public override void FindFrame(int frameHeight) @@ -149,7 +148,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 2, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f, 2, 3); } diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 9f819e7eb9..fd343b31b2 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -27,11 +27,10 @@ namespace CalamityMod.NPCs.Abyss npc.damage = 75; npc.width = 72; npc.height = 30; - npc.defense = 15; + npc.defense = 10; npc.lifeMax = 320; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -89,7 +88,7 @@ namespace CalamityMod.NPCs.Abyss 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, 0f + 4f + npc.gfxOffY); + 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); @@ -97,13 +96,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 90); - player.AddBuff(ModContent.BuffType(), 90, true); - } } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -121,7 +114,6 @@ namespace CalamityMod.NPCs.Abyss public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, CalamityGlobalNPCLoot.halibutCannonBaseDropChance, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.25f); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 0.5f, 1, 2); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 0.5f); diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index f8a6109622..513b166b73 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; @@ -8,11 +9,13 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.NPCs.AcidRain { public class AcidEel : ModNPC { + public Player Target => Main.player[npc.target]; + public ref float DirectionRedecideTimer => ref npc.ai[0]; public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Eel"); @@ -27,29 +30,25 @@ namespace CalamityMod.NPCs.AcidRain npc.height = 18; npc.damage = 20; - npc.lifeMax = 100; + npc.lifeMax = 80; npc.defense = 4; npc.knockBackResist = 0.9f; if (CalamityWorld.downedPolterghast) { npc.DR_NERD(0.05f); - npc.damage = 120; - npc.lifeMax = 5500; - npc.defense = 45; + npc.damage = 100; + npc.lifeMax = 3300; + npc.defense = 20; npc.knockBackResist = 0.7f; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 80; - npc.lifeMax = 420; + npc.damage = 50; + npc.lifeMax = 240; } npc.value = Item.buyPrice(0, 0, 3, 32); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.aiStyle = -1; aiType = -1; npc.lavaImmune = false; @@ -59,85 +58,69 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void AI() { npc.TargetClosest(false); + // Play a slither sound from time to time. if (Main.rand.NextBool(480)) - Main.PlaySound(SoundID.Zombie, npc.Center, 32); // Slither sound + Main.PlaySound(SoundID.Zombie, npc.Center, 32); - if (npc.ai[2] == 0f && !npc.wet) - { - npc.netUpdate = true; - npc.ai[2] = 1f; - } - if (npc.ai[2] == 1f && npc.wet) - { - npc.netUpdate = true; - npc.ai[2] = 0f; - } - - if (npc.ai[2] == 0f) - { - npc.ai[1] += 1f; - if (npc.ai[1] % 150f == 0f || npc.direction == 0) - { - npc.direction = (Main.player[npc.target].position.X > npc.position.X).ToDirectionInt(); - } - float acceleration = 0.3f; - float yAcceleration = 0.08f; - float maxSpeedX = 15f; - float maxSpeedY = 4f; - if (CalamityWorld.downedPolterghast) - { - acceleration = 0.6f; - yAcceleration = 0.15f; - maxSpeedX = 20f; - maxSpeedY = 7f; - } - npc.velocity.X += npc.direction * acceleration; - - if (npc.collideX) - npc.direction *= -1; - - npc.spriteDirection = npc.direction; - - npc.velocity.Y += (Main.player[npc.target].position.Y > npc.position.Y).ToDirectionInt() * yAcceleration; - if (npc.velocity.X > maxSpeedX) - { - npc.velocity.X = maxSpeedX; - npc.netUpdate = true; - } - if (npc.velocity.X < -maxSpeedX) - { - npc.velocity.X = -maxSpeedX; - npc.netUpdate = true; - } - if (npc.velocity.Y > maxSpeedY) - { - npc.velocity.Y = maxSpeedY; - npc.netUpdate = true; - } - if (npc.velocity.Y < -maxSpeedY) - { - npc.velocity.Y = -maxSpeedY; - npc.netUpdate = true; - } - npc.rotation = npc.velocity.X * 0.02f; - } + if (npc.wet) + SwimTowardsTarget(); else { + // 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; } } + + public void SwimTowardsTarget() + { + DirectionRedecideTimer++; + if (DirectionRedecideTimer % 150f == 0f || npc.direction == 0) + { + npc.direction = (Target.position.X > npc.position.X).ToDirectionInt(); + npc.netUpdate = true; + } + + float horizontalAcceleration = 0.3f; + float verticalAcceleration = 0.08f; + float maxSpeedX = 15f; + float maxSpeedY = 4f; + if (CalamityWorld.downedPolterghast) + { + horizontalAcceleration = 0.6f; + verticalAcceleration = 0.15f; + maxSpeedX = 20f; + maxSpeedY = 7f; + } + + npc.velocity.X += npc.direction * horizontalAcceleration; + + if (Main.netMode != NetmodeID.MultiplayerClient && npc.collideX) + { + npc.direction *= -1; + npc.netUpdate = true; + } + + npc.spriteDirection = npc.direction; + + npc.velocity.Y += (Target.position.Y > npc.position.Y).ToDirectionInt() * verticalAcceleration; + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-maxSpeedX, -maxSpeedY), new Vector2(maxSpeedX, maxSpeedY)); + npc.rotation = npc.velocity.X * 0.02f; + } + public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 2 * (CalamityWorld.downedAquaticScourge ? 6 : 1), 1, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); } + public override void FindFrame(int frameHeight) { npc.frameCounter++; @@ -146,44 +129,31 @@ namespace CalamityMod.NPCs.AcidRain 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); - } - } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); } + 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) { 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); - } } } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } + + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/NPCs/AcidRain/BloodwormFleeing.cs b/NPCs/AcidRain/BloodwormFleeing.cs index 8e37e3e65b..0421bac8d6 100644 --- a/NPCs/AcidRain/BloodwormFleeing.cs +++ b/NPCs/AcidRain/BloodwormFleeing.cs @@ -21,10 +21,6 @@ namespace CalamityMod.NPCs.AcidRain npc.defense = 0; npc.lifeMax = 5; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = true; npc.noGravity = true; npc.noTileCollide = true; @@ -37,8 +33,13 @@ namespace CalamityMod.NPCs.AcidRain Player player = Main.player[Player.FindClosest(npc.Center, 1, 1)]; if (npc.velocity == Vector2.Zero) npc.velocity = Vector2.UnitY * 12f; + float intertia = 24f; - npc.velocity = (npc.velocity * intertia - npc.DirectionTo(player.Center) * 12f) / (intertia + 1f); + + // Attempt to flee from the nearest player. + 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; } @@ -51,9 +52,7 @@ namespace CalamityMod.NPCs.AcidRain npc.frameCounter = 0; npc.frame.Y += frameHeight; if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - { npc.frame.Y = 0; - } } } diff --git a/NPCs/AcidRain/BloodwormNormal.cs b/NPCs/AcidRain/BloodwormNormal.cs index 430b4314ab..1bcaa5f906 100644 --- a/NPCs/AcidRain/BloodwormNormal.cs +++ b/NPCs/AcidRain/BloodwormNormal.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.SummonItems; using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,10 +24,6 @@ namespace CalamityMod.NPCs.AcidRain npc.defense = 0; npc.lifeMax = 5; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = false; npc.noTileCollide = false; @@ -102,7 +99,16 @@ namespace CalamityMod.NPCs.AcidRain public override float SpawnChance(NPCSpawnInfo spawnInfo) { - return (spawnInfo.player.Calamity().ZoneSulphur && CalamityWorld.downedPolterghast && !CalamityWorld.rainingAcid) ? SpawnCondition.WormCritter.Chance * 1.569f : 0f; + 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); + 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; + + return spawnRate; } public override void OnCatchNPC(Player player, Item item) diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index b6d0e8b50b..6920dfb8e9 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -17,6 +17,21 @@ namespace CalamityMod.NPCs.AcidRain { public class CragmawMire : ModNPC { + public Player Target => Main.player[npc.target]; + public ref float Time => ref npc.ai[0]; + public bool HasMadeShellBreakGore + { + 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; + } + } public override void SetStaticDefaults() { DisplayName.SetDefault("Cragmaw Mire"); @@ -25,7 +40,9 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - npc.width = 68; + npc.Calamity().canBreakPlayerDefense = true; + + npc.width = 68; npc.height = 54; npc.aiStyle = aiType = -1; @@ -36,57 +53,44 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { npc.damage = 160; - npc.lifeMax = 146600; + npc.lifeMax = 80630; npc.defense = 80; } npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 3, 60, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = false; npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; } - public bool Phase2 - { - get - { - float ratio = CalamityWorld.revenge ? 0.85f : 0.7f; - return npc.life / (float)npc.lifeMax < ratio && CalamityWorld.downedPolterghast; - } - } + public override void AI() { + Time++; npc.TargetClosest(false); - Player player = Main.player[npc.target]; - - npc.ai[0]++; // Summons a spinning spiral of dust and a dust telegraph - if (npc.ai[0] % 420f > 240f && npc.ai[0] % 420f < 300f) + if (Time % 420f > 240f && Time % 420f < 300f) { - float vectorRotationAngle = (npc.ai[0] % 420f - 240f) / 60f * MathHelper.Pi * 4f; + float vectorRotationAngle = (Time % 420f - 240f) / 60f * MathHelper.Pi * 4f; for (int i = 0; i < 25; i++) { float angle = MathHelper.TwoPi * i / 25f; float y = (float)Math.Sin(angle) * (float)Math.Log(Math.Abs(Math.Cos(angle))); if (!float.IsNaN(y)) { - Vector2 velocity = new Vector2((float)Math.Cos(angle), y) * MathHelper.Lerp(2.4f, 4.2f, (npc.ai[0] - 240f) / 60f); + Vector2 velocity = new Vector2((float)Math.Cos(angle), y) * MathHelper.Lerp(2.4f, 4.2f, (Time - 240f) / 60f); Dust dust = Dust.NewDustPerfect(npc.Center, (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = velocity.RotatedBy(vectorRotationAngle); dust.noGravity = true; - dust.scale = MathHelper.Lerp(1.2f, 2.5f, (npc.ai[0] - 240f) / 60f); + dust.scale = MathHelper.Lerp(1.2f, 2.5f, (Time - 240f) / 60f); } } - float length = MathHelper.Lerp(20f, 1200f, (npc.ai[0] % 420f - 240f) / 60f); - float outwardness = 1f - (npc.ai[0] % 420f - 240f) / 60f; + float length = MathHelper.Lerp(20f, 1200f, (Time % 420f - 240f) / 60f); + float outwardness = 1f - (Time % 420f - 240f) / 60f; for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - length; i -= 6f) { float angle = i / 32f; @@ -98,18 +102,17 @@ namespace CalamityMod.NPCs.AcidRain dust.noGravity = true; } } - // Release a laser beam and create an explosion - if (npc.ai[0] % 420f == 300f) + + // Release a laser beam upward and create an explosion. + if (Time % 420f == 300f) { - npc.ai[1] = Main.rand.NextFloat(3f); - npc.ai[2] = Main.rand.NextFloat(4f); - npc.netUpdate = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); // Moon lord beam sound + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); int damage = CalamityWorld.downedPolterghast ? 120 : 40; Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 4f, Main.myPlayer, 0f, npc.whoAmI); } + Vector2 circlePointVector = -Vector2.UnitY; float lerpStart = Main.rand.Next(12, 16); float lerpEnd = Main.rand.Next(3, 6); @@ -136,133 +139,162 @@ namespace CalamityMod.NPCs.AcidRain circlePointVector = circlePointVector.RotatedBy(MathHelper.TwoPi / 9f); } } + npc.netUpdate = true; } - else if (npc.ai[0] % 420f > 300f && npc.ai[0] % 7f == 6f && CalamityWorld.downedPolterghast) + + // Release acid into the air. + else if (Time % 420f > 300f && Time % 7f == 6f && CalamityWorld.downedPolterghast) { if (Main.netMode != NetmodeID.MultiplayerClient) - { Projectile.NewProjectile(npc.Center, -Vector2.UnitY.RotatedByRandom(0.6f) * Main.rand.NextFloat(10f, 15f), ModContent.ProjectileType(), 69, 4f, Main.myPlayer, 0f, npc.whoAmI); - } } - if (!Phase2) - { - npc.Calamity().DR = 0.4f; - if (!player.wet) - npc.Calamity().DR = 0.6f; - npc.HitSound = SoundID.NPCHit42; - if (npc.ai[0] % 420f < 240f) - { - float bubbleShootTimer = CalamityWorld.downedPolterghast ? 24f : 50f; - if (npc.ai[0] % bubbleShootTimer == bubbleShootTimer - 1f && Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = CalamityWorld.downedPolterghast ? 47 : 30; - int idx = Projectile.NewProjectile(npc.Top + new Vector2(0f, 5f), -Vector2.UnitY.RotatedByRandom(0.25f) * 4f, ModContent.ProjectileType(), damage, 1f); - Main.projectile[idx].timeLeft = Main.rand.Next(120, 180); - Main.projectile[idx].netUpdate = true; - } - if (npc.ai[0] % 50f == 49f && Main.rand.NextBool(4)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - List possibleEnemies = new List(); - if (CalamityWorld.downedPolterghast) - { - possibleEnemies.Add(ModContent.NPCType()); - possibleEnemies.Add(ModContent.NPCType()); - possibleEnemies.Add(ModContent.NPCType()); - } - else - { - possibleEnemies.Add(ModContent.NPCType()); - possibleEnemies.Add(ModContent.NPCType()); - } - - Vector2 spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -360f, 360f); - int attempts = 0; - while (!WorldGen.InWorld((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)) - { - spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -460f, 460f); - attempts++; - if (attempts > 200) - return; - } - attempts = 0; - - while (CalamityUtils.TileSelectionSolidSquare((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16, 8, 8) || - CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16).liquid != 255) - { - spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -620f, 620f); - attempts++; - if (attempts > 300) - return; - } - - NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, Utils.SelectRandom(Main.rand, possibleEnemies.ToArray())); - } - } - } - } + if (InPhase2) + DoPhase2AI(); else + DoPhase1AI(); + } + + public void DoPhase1AI() + { + // Become harder to damage to if the target is not in water. + npc.Calamity().DR = Target.wet ? 0.3f : 0.5f; + + // Use a rock-like hit sound. + npc.HitSound = SoundID.NPCHit42; + + if (Time % 420f < 240f) { - if (npc.localAI[0] == 0f) + float bubbleShootRate = CalamityWorld.downedPolterghast ? 24f : 50f; + if (Main.netMode != NetmodeID.MultiplayerClient && Time % bubbleShootRate == bubbleShootRate - 1f) { - 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); - npc.localAI[0] = 1f; - } - npc.Calamity().DR = CalamityWorld.revenge ? 0.125f : 0f; - npc.HitSound = SoundID.NPCHit1; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] % 600f == 20f) + int damage = CalamityWorld.downedPolterghast ? 47 : 30; + Vector2 bubbleSpawnPosition = npc.Top + Vector2.UnitY * 5f; + Vector2 bubbleShootVelocity = -Vector2.UnitY.RotatedByRandom(0.25f) * 4f; + int bubble = Projectile.NewProjectile(bubbleSpawnPosition, bubbleShootVelocity, ModContent.ProjectileType(), damage, 1f); + + if (Main.projectile.IndexInRange(bubble)) { - Projectile.NewProjectile(npc.Center, Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.whoAmI, npc.target); + Main.projectile[bubble].timeLeft = Main.rand.Next(120, 180); + Main.projectile[bubble].netUpdate = true; } - if (npc.ai[0] % 600f == 240f) + } + + // Summon enemies from time to time. + if (Time % 50f == 49f && Main.rand.NextBool(4)) + { + List possibleEnemies = new List(); + if (CalamityWorld.downedPolterghast) { - int damage = CalamityWorld.downedPolterghast ? 52 : 33; - for (int i = 0; i < 16; i++) - { - float angle = MathHelper.TwoPi / 16f * i; - float angleDelta = Main.rand.NextFloat(MathHelper.TwoPi / 16f) * 0.6f; - angle += angleDelta - angleDelta / 2f; - Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 6f, ModContent.ProjectileType(), damage, 4f); - } + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + } + else + { + possibleEnemies.Add(ModContent.NPCType()); + possibleEnemies.Add(ModContent.NPCType()); + } + + SummonEnemyNearSelf(possibleEnemies); + } + } + } + + public void DoPhase2AI() + { + // Release shell gore the first frame this enemy is in the second phase. + if (!HasMadeShellBreakGore) + { + 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; + } + + // Have DR depend on the current mode. + npc.Calamity().DR = CalamityWorld.revenge ? 0.125f : 0f; + + // And use the squishy slime hit sound. + npc.HitSound = SoundID.NPCHit1; + + // Release a tether that attempts to grab the target and then release spikes upward a bit afterwards. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Time % 600f == 20f) + Projectile.NewProjectile(npc.Center, Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.whoAmI, npc.target); + if (Time % 600f == 240f) + { + int damage = CalamityWorld.downedPolterghast ? 52 : 33; + for (int i = 0; i < 16; i++) + { + float shootDirectionAngle = MathHelper.TwoPi / 16f * i; + float offsetAngle = Main.rand.NextFloatDirection() * MathHelper.TwoPi / 27f; + shootDirectionAngle += offsetAngle; + Projectile.NewProjectile(npc.Center, shootDirectionAngle.ToRotationVector2() * 6f, ModContent.ProjectileType(), damage, 4f); } } } } + + public void SummonEnemyNearSelf(IList possibleEnemies) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + int attempts = 0; + Vector2 spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -360f, 360f); + + // Ensure that the potential spawn position is actually in the world. + while (!WorldGen.InWorld((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)) + { + spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -460f, 460f); + attempts++; + if (attempts > 200) + return; + } + + attempts = 0; + + // As well as an open tile wiht water. + while (CalamityUtils.TileSelectionSolidSquare((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16, 8, 8) || + CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16).liquid != 255) + { + spawnPosition = npc.Center + Utils.RandomVector2(Main.rand, -620f, 620f); + attempts++; + if (attempts > 300) + return; + } + + NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, Main.rand.Next(possibleEnemies)); + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { 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 = Phase2 ? ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire2") : ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire"); + Texture2D texture = InPhase2 ? ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire2") : ModContent.GetTexture("CalamityMod/NPCs/AcidRain/CragmawMire"); CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, 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; - } } + 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) { Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore"), npc.scale); @@ -270,10 +302,9 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(npc.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, mod.GetGoreSlot("Gores/AcidRain/CragmawMireP2Gore3"), npc.scale); } } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } + + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), CalamityWorld.downedPolterghast ? 0.1f : 1f); diff --git a/NPCs/AcidRain/FlakBaby.cs b/NPCs/AcidRain/FlakBaby.cs index c1726fb879..bfbeb4f625 100644 --- a/NPCs/AcidRain/FlakBaby.cs +++ b/NPCs/AcidRain/FlakBaby.cs @@ -28,10 +28,6 @@ namespace CalamityMod.NPCs.AcidRain npc.lifeMax = 5; npc.defense = 5; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 5, 55); npc.lavaImmune = true; npc.noGravity = false; @@ -43,11 +39,7 @@ namespace CalamityMod.NPCs.AcidRain npc.dontTakeDamageFromHostiles = true; npc.catchItem = (short)ModContent.ItemType(); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override void AI() { if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) @@ -99,6 +91,7 @@ namespace CalamityMod.NPCs.AcidRain } } } + public override void FindFrame(int frameHeight) { if (npc.ai[1] <= 0f) @@ -124,6 +117,7 @@ namespace CalamityMod.NPCs.AcidRain } } } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !CalamityWorld.downedAquaticScourge) diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 62078c88ce..f02e6167ae 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -10,10 +10,19 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + 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 const int TotalHitsNeededToDoDamage = 10; public override void SetStaticDefaults() { DisplayName.SetDefault("Flak Crab"); @@ -25,22 +34,18 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 28; npc.height = 70; - npc.damage = 0; - npc.lifeMax = 600; + npc.damage = 10; + npc.lifeMax = 300; npc.aiStyle = aiType = -1; if (CalamityWorld.downedPolterghast) { - npc.lifeMax = 7000; - npc.DR_NERD(0.4f); + npc.lifeMax = 4125; + npc.DR_NERD(0.2f); } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 5, 55); npc.lavaImmune = true; npc.noGravity = false; @@ -50,80 +55,72 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); - writer.Write(npc.localAI[1]); + writer.Write(FleeCountdownTimer); + writer.Write(TotalHits); } + public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); - npc.localAI[1] = reader.ReadSingle(); - } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); + FleeCountdownTimer = reader.ReadSingle(); + TotalHits = reader.ReadSingle(); } + public override void AI() { - Player closest = Main.player[Player.FindClosest(npc.Top, 0, 0)]; - npc.ai[0]++; - npc.defense = npc.localAI[1] < 10f ? 999999 : 20; + // Enables expert scaling, if damage is 0 in set defaults expert scaling will not happen. + npc.damage = 0; + + ChasabilityTimer++; + npc.defense = TotalHits < TotalHitsNeededToDoDamage ? 999999 : 20; if (npc.justHit) { - npc.localAI[0] = 240; + FleeCountdownTimer = 240; npc.netUpdate = true; } - if (npc.localAI[0] == 0f || npc.localAI[1] < 10f) + + if (FleeCountdownTimer == 0f || TotalHits < TotalHitsNeededToDoDamage) { - if (npc.ai[0] < 300f) + if (ChasabilityTimer < 300f) { npc.chaseable = false; npc.knockBackResist = 0f; } - if (Math.Abs(closest.Center.X - npc.Center.X) < 320f && - closest.Center.Y - npc.Top.Y < -60f && - npc.ai[1]++ >= Main.rand.Next(90, 135)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float speed = CalamityWorld.downedPolterghast ? 29f : 17f; - speed *= Main.rand.NextFloat(0.8f, 1.2f); - int damage = CalamityWorld.downedPolterghast ? 42 : 23; - Projectile.NewProjectile(npc.Top + Vector2.UnitY * 6f, npc.DirectionTo(closest.Center).RotatedByRandom(0.25f) * speed, - ModContent.ProjectileType(), damage, 2f); - npc.ai[1] = 0; - } - } + + 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)) + ShootFlakAcidAtTarget(closestTargetToTop); + npc.velocity.X *= 0.97f; } else { - npc.localAI[0]--; - npc.chaseable = true; + FleeCountdownTimer--; if (npc.velocity.Y == 0f) { + HopTimer++; npc.knockBackResist = 0.6f; npc.TargetClosest(true); npc.velocity.X *= 0.85f; - npc.ai[2]++; - float hopRate = 10f + 15f * (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, Main.player[npc.target].Center, 1, 1)) - { + if (Collision.CanHit(npc.Center, 1, 1, Target.Center, 1, 1)) lungeForwardSpeed *= 1.5f; - } - if (npc.ai[2] > hopRate) + + if (Main.netMode != NetmodeID.MultiplayerClient && HopTimer > hopRate) { - npc.ai[3] += 1f; - if (npc.ai[3] >= 3f) - { - npc.ai[3] = 0f; + HopCounter++; + + // Make a bigger leap every 3 hops. + if (HopCounter % 3f == 2f) lungeForwardSpeed *= 1.5f; - } - npc.ai[2] = 0f; + + HopTimer = 0f; npc.velocity.Y -= jumpSpeed; npc.velocity.X = lungeForwardSpeed * -npc.direction; npc.netUpdate = true; @@ -134,32 +131,53 @@ namespace CalamityMod.NPCs.AcidRain npc.knockBackResist = 0.2f; npc.velocity.X *= 0.995f; } - } - if (npc.ai[0] >= 300f && !npc.chaseable) - { npc.chaseable = true; } + + if (ChasabilityTimer >= 300f && !npc.chaseable) + npc.chaseable = true; } + + public void ShootFlakAcidAtTarget(Player closestTargetToTop) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + float speed = CalamityWorld.downedPolterghast ? 29f : 17f; + 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 shootVelocity = (closestTargetToTop.Center - spawnPosition).SafeNormalize(Vector2.UnitY).RotatedByRandom(0.25f) * speed; + Projectile.NewProjectile(spawnPosition, shootVelocity, ModContent.ProjectileType(), damage, 2f); + + AcidShootTimer = 0; + npc.netUpdate = true; + } + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { - // Don't draw the bar if in stealth mode - if (npc.localAI[0] == 0f || npc.localAI[1] < 10f) + // Don't draw the bar if in stealth mode. + if (FleeCountdownTimer == 0f || TotalHits < TotalHitsNeededToDoDamage) return false; return null; } + public override void NPCLoot() { 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 (npc.localAI[1] < 10f) + if (TotalHits < TotalHitsNeededToDoDamage) { npc.frame.Y = 0; return; } - if (npc.localAI[0] > 0f) + + if (FleeCountdownTimer > 0f) { if (npc.frameCounter++ % 6 == 5) { @@ -169,14 +187,13 @@ namespace CalamityMod.NPCs.AcidRain { npc.frame.Y = frameHeight * 3; // Frames 1 and 2 are for transitioning. Frame 0 is sitting still, and the rest are walking frames } - if (npc.localAI[0] <= 8) + if (FleeCountdownTimer <= 8) npc.frame.Y = frameHeight; } else - { npc.frame.Y = 0; - } } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -193,7 +210,9 @@ namespace CalamityMod.NPCs.AcidRain Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/FlakCrab3"), 1f); } - npc.localAI[1]++; + + TotalHits++; + npc.netUpdate = true; } } } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index f5c6b234e3..01d52e8b43 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -6,21 +6,22 @@ using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; -using System.Collections.Generic; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.AcidRain { - public abstract class CalamityBoss : ModNPC - { - public abstract List Loot { get; } - } public class GammaSlime : ModNPC { - public float angularMultiplier1; - public float angularMultiplier2; + public float DustAngleMultiplier1; + public float DustAngleMultiplier2; + 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 override void SetStaticDefaults() { @@ -33,19 +34,15 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 40; npc.height = 44; - npc.damage = 130; - npc.lifeMax = 5915; + npc.damage = 110; + npc.lifeMax = 5060; npc.DR_NERD(0.15f); - npc.defense = 50; + npc.defense = 25; npc.aiStyle = aiType = -1; npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 8, 30); npc.alpha = 50; npc.lavaImmune = false; @@ -56,101 +53,96 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(angularMultiplier1); - writer.Write(angularMultiplier2); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - angularMultiplier1 = reader.ReadSingle(); - angularMultiplier2 = reader.ReadSingle(); - } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + 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); + // 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); + npc.TargetClosest(false); - Player player = Main.player[npc.target]; - if (npc.velocity.Y == 0f && npc.ai[3] <= 0f && !player.npcTypeNoAggro[npc.type]) + + if (npc.velocity.Y == 0f && LaserShootCountdown <= 0f && !Target.npcTypeNoAggro[npc.type]) { npc.velocity.X *= 0.8f; - if (npc.ai[0]++ >= 30f) + + GammaAcidShootTimer++; + + // Jump into the air and release gamma acid upward. + if (GammaAcidShootTimer % 30f == 29f) { - npc.velocity.Y -= MathHelper.Clamp(Math.Abs(player.Center.Y - npc.Center.Y) / 16f, 5f, 15f); - npc.velocity.X = npc.DirectionTo(player.Center).X * 16f; - npc.ai[0] = 0f; - npc.ai[1]++; + 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) { for (int i = 0; i < 5; i++) { - float angle = MathHelper.TwoPi / 5f * i + (npc.ai[1] % 2) * MathHelper.PiOver2; - Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 7f, ModContent.ProjectileType(), - 45, 3f); + 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); } } npc.netUpdate = true; } } else - { npc.velocity.X *= 0.9935f; - } - if (npc.ai[3] > 0f) - npc.ai[3]--; - if (npc.ai[3] > 240f) + + if (LaserShootCountdown > 0f) + LaserShootCountdown--; + + // Stop moving for a bit after the laser. + if (LaserShootCountdown > 240f) { npc.velocity.X *= 0.95f; npc.velocity.Y += 0.2f; } + // Hold energy for laser - if (npc.ai[3] > 480f) + if (LaserShootCountdown > 480f) { - float scale = npc.ai[3] < 530 ? 2.25f : 1.65f; + float scale = LaserShootCountdown < 530f ? 2.25f : 1.65f; Vector2 destination = npc.Top + new Vector2(0f, 6f); - Dust dust = Dust.NewDustPerfect(destination + new Vector2(0f, 12f).RotatedByRandom(MathHelper.TwoPi), (int)CalamityDusts.SulfurousSeaAcid); + Dust dust = Dust.NewDustPerfect(destination + Main.rand.NextVector2CircularEdge(12f, 12f), (int)CalamityDusts.SulfurousSeaAcid); dust.velocity = Vector2.Normalize(destination - dust.position) * 3f; dust.scale = scale; dust.noGravity = true; - if (npc.ai[3] <= 540f) + + if (LaserShootCountdown <= 540f) { - float length = MathHelper.Lerp(20f, 550f, (npc.ai[3] - 480f) / 60f); - float outwardness = MathHelper.Lerp(1f, 0f, (npc.ai[3] - 480f) / 60f); - for (float i = npc.Top.Y + 4f; i >= npc.Top.Y + 4f - length; 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); dust = Dust.NewDustPerfect(spawnPosition, (int)CalamityDusts.SulfurousSeaAcid); dust.scale = 1.5f; - dust.velocity = Vector2.UnitX * (float)Math.Cos(angle) * 4f * outwardness; + dust.velocity = Vector2.UnitX * (float)Math.Cos(angle) * (1f - LaserTelegraphPower) * 4f; dust.noGravity = true; } } } - // Release laser - if (npc.ai[3] == 480f) + + // Release a gamma laser upward. + if (LaserShootCountdown == 480f) { - angularMultiplier1 = Main.rand.NextFloat(3f); - angularMultiplier2 = Main.rand.NextFloat(4f); - npc.netUpdate = true; + DustAngleMultiplier1 = Main.rand.NextFloat(3f); + DustAngleMultiplier2 = Main.rand.NextFloat(4f); if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); // Moon lord beam sound - Projectile.NewProjectile(npc.Center, -Vector2.UnitY, ModContent.ProjectileType(), 120, 4f, Main.myPlayer, 0f, npc.whoAmI); + 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); } + npc.netUpdate = true; } + // Very complex particle effects while releasing the beam - else if (npc.ai[3] >= 300f) + else if (LaserShootCountdown >= 300f) { - float angle = (npc.ai[3] / 30f) % MathHelper.TwoPi; - float x = (float)Math.Sin(angle * angularMultiplier1) * (float)Math.Cos(angle); - float y = (float)Math.Cos(angle * angularMultiplier1) * (float)Math.Sin(angle); - Vector2 velocity = new Vector2(x * 4.5f, y * 2f); + float angle = LaserShootCountdown / 30f % MathHelper.TwoPi; + 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.velocity = velocity; dust.scale = (float)Math.Cos(angle) + 2f; @@ -161,12 +153,12 @@ namespace CalamityMod.NPCs.AcidRain dust.scale = (float)Math.Cos(angle) + 2f; dust.noGravity = true; } - if (Math.Abs(player.Center.X - npc.Center.X) < 250f && - player.Center.X - npc.Center.X < 0f && - npc.ai[3] == 0f && - Main.rand.NextBool(110) && !player.npcTypeNoAggro[npc.type]) + + // 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]) { - npc.ai[3] = 600f; + LaserShootCountdown = 600f; npc.netUpdate = true; } } @@ -174,15 +166,11 @@ 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); - } 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); } @@ -190,23 +178,17 @@ namespace CalamityMod.NPCs.AcidRain public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - if (npc.ai[3] >= 480f && npc.ai[3] <= 540f) + if (LaserShootCountdown >= 480f && LaserShootCountdown <= 540f) { - float length = MathHelper.Lerp(20f, 550f, (npc.ai[3] - 480f) / 60f); - float opacity = MathHelper.Lerp(0.3f, 0.9f, (npc.ai[3] - 480f) / 60f); - Utils.DrawLine(spriteBatch, npc.Top + new Vector2(0f, 4f), npc.Top + new Vector2(0f, 4f) - Vector2.UnitY * length, Color.Lerp(Color.Lime, Color.Transparent, opacity)); + 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")); } - 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(), 300); - } + 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 9e529eed89..2f74df3527 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -13,6 +13,7 @@ namespace CalamityMod.NPCs.AcidRain public class IrradiatedSlime : ModNPC { public bool Falling = true; + public override void SetStaticDefaults() { DisplayName.SetDefault("Irradiated Slime"); @@ -24,16 +25,13 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 40; npc.height = 30; - npc.damage = 75; - npc.lifeMax = 425; + npc.damage = 42; + npc.lifeMax = 220; npc.defense = 5; npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + aiType = NPCID.ToxicSludge; npc.value = Item.buyPrice(0, 0, 5, 0); npc.alpha = 50; npc.lavaImmune = false; @@ -44,19 +42,19 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(Falling); + writer.Write(npc.aiStyle); } + public override void ReceiveExtraAI(BinaryReader reader) { Falling = reader.ReadBoolean(); + npc.aiStyle = reader.ReadInt32(); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + 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); @@ -81,7 +79,6 @@ namespace CalamityMod.NPCs.AcidRain else { npc.aiStyle = 1; - aiType = NPCID.ToxicSludge; } } @@ -101,10 +98,12 @@ namespace CalamityMod.NPCs.AcidRain 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")); } + public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 30); @@ -112,7 +111,7 @@ namespace CalamityMod.NPCs.AcidRain public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index c1d60e6e58..6bda0229b1 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -9,20 +9,58 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; namespace CalamityMod.NPCs.AcidRain { public class NuclearTerror : ModNPC { + public enum SpecialAttackState + { + DivergingBullets, + ConeStreamOfBullets, + ShotgunBurstOfBullets + } + public int AttackIndex = 0; public int DelayTime = 0; public bool Dying = false; public bool Walking = false; public float JumpTimer = 0f; public Vector2 ShootPosition; - public static readonly int[] PhaseArray = new int[] + 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]); + set + { + 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 static readonly SpecialAttackState[] PhaseArray = new SpecialAttackState[] { - 2, 0, 1, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 1, 0, 2, 1 + SpecialAttackState.ShotgunBurstOfBullets, + SpecialAttackState.DivergingBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.ShotgunBurstOfBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.DivergingBullets, + SpecialAttackState.ShotgunBurstOfBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.DivergingBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.ShotgunBurstOfBullets, + SpecialAttackState.ConeStreamOfBullets, + SpecialAttackState.DivergingBullets, + SpecialAttackState.ShotgunBurstOfBullets, + SpecialAttackState.ConeStreamOfBullets }; public const int AttackCycleTime = 520; public const int SpecialAttackTime = 240; @@ -39,20 +77,18 @@ namespace CalamityMod.NPCs.AcidRain public override void SetDefaults() { - npc.width = 176; + npc.Calamity().canBreakPlayerDefense = true; + + npc.width = 176; npc.height = 138; npc.aiStyle = aiType = -1; - npc.lifeMax = 360420; + npc.lifeMax = 198230; npc.defense = 50; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 20, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.DR_NERD(0.4f); + npc.DR_NERD(0.3f); npc.lavaImmune = false; npc.noGravity = false; npc.noTileCollide = false; @@ -79,144 +115,109 @@ namespace CalamityMod.NPCs.AcidRain JumpTimer = reader.ReadSingle(); ShootPosition = reader.ReadVector2(); } + public override void AI() { Lighting.AddLight(npc.Center, (Dying ? Color.Lime.ToVector3() : Color.White.ToVector3()) * 2f); if (Dying) return; + 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; - } return; } + if (npc.target < 0 || npc.target >= 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(false); npc.netUpdate = true; } - if (npc.ai[1] > -TeleportCooldown) - { + + if (TeleportCountdown > -TeleportCooldown) TeleportEffects(); - } - Player player = Main.player[npc.target]; + npc.defDamage = 170; npc.damage = Dying ? 0 : npc.defDamage; - TeleportCheck(player); - npc.ai[0]++; + TeleportCheck(); + + AttackTime++; + float wrappedAttackTime = AttackTime % AttackCycleTime; + Walking = false; - // For teleporting if constantly spam-colliding + + // Teleport if spam-collisions are done, they are pretty good indicators of being stuck. if (npc.collideX) { - if (npc.localAI[0] > 0) - { - npc.localAI[1]++; - } - npc.localAI[0] = 20f; + if (HorizontalCollisionCounterDelay > 0) + HorizontalCollisionSpamCounter++; + HorizontalCollisionCounterDelay = 20f; } - if (npc.localAI[0] > 0) - { - npc.localAI[0]--; - } - if (npc.ai[0] % AttackCycleTime < 240f) + + if (HorizontalCollisionCounterDelay > 0) + HorizontalCollisionCounterDelay--; + + if (wrappedAttackTime < 240f) { if (npc.velocity.Y == 0f) { + JumpTimer++; npc.velocity.X *= 0.8f; - if (JumpTimer++ >= 70f || !Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + + // 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)) { - npc.velocity.Y -= MathHelper.Clamp(Math.Abs(player.Center.Y - npc.Center.Y) / 12.5f, 8f, 18f); - npc.velocity.X = npc.DirectionTo(player.Center).X * 18f; 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; } else { - bool wasWalking = Walking; - if (wasWalking != Math.Abs(npc.velocity.X) > 4f) + if (Walking != Math.Abs(npc.velocity.X) > 4f) { 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) { - JumpTimer = 50; // Force a jump the next frame to overcome the obstacle + JumpTimer = 50; npc.netUpdate = true; } - else if (Math.Abs(player.Center.X - npc.Center.X) > 125f) + + // Otherwise walk towards the target if they're not super close. + else if (Math.Abs(Target.Center.X - npc.Center.X) > 125f) { - npc.velocity.X += Math.Sign(npc.DirectionTo(player.Center).X) * 3f; + 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.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); } else { - if (npc.ai[0] % AttackCycleTime == 255f) + npc.velocity.X *= 0.96f; + if (wrappedAttackTime == 255f) { - ShootPosition = player.Center; + ShootPosition = Target.Center; npc.netUpdate = true; npc.spriteDirection = (ShootPosition.X - npc.Center.X < 0).ToDirectionInt(); } - switch (PhaseArray[AttackIndex]) - { - // Tightly packed, diverging bullets - case 0: - npc.velocity.X *= 0.9f; - if (((npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 20f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 32f) || - (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 50f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 62f) || - (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 80f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 92f) || - (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 110f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 122f) || - (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 140f && npc.ai[0] % AttackCycleTime <= AttackCycleTime - SpecialAttackTime + 152f)) && npc.ai[0] % 3f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float angle = (npc.ai[0] % AttackCycleTime - (AttackCycleTime - SpecialAttackTime + 20f)) % 12f / 12f * MathHelper.ToRadians(15f) - MathHelper.ToRadians(7.5f); - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(ShootPosition).RotatedBy(angle) * 14f, ModContent.ProjectileType(), 48, 4f); - Main.projectile[idx].localAI[0] = angle; - } - Main.PlaySound(SoundID.NPCDeath13, npc.Center); - } - if (npc.ai[0] % AttackCycleTime >= (AttackCycleTime - SpecialAttackTime + 35f) && npc.ai[0] % 10f == 9f) - { - Projectile.NewProjectile(npc.Center, npc.DirectionTo(player.Center) * 12f, ModContent.ProjectileType(), 48, 3f); - } - break; - // Cone of bullets - case 1: - npc.velocity.X *= 0.9f; - if (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 35f && npc.ai[0] % 4f == 3f) - { - float angle = MathHelper.Lerp(MathHelper.ToRadians(35f), MathHelper.ToRadians(5f), (npc.ai[0] % AttackCycleTime - (AttackCycleTime - SpecialAttackTime + 35f)) / (SpecialAttackTime + 35f)); - Projectile.NewProjectile(npc.Center, npc.DirectionTo(player.Center).RotatedBy(angle) * 16f, ModContent.ProjectileType(), 48, 4.5f); - Projectile.NewProjectile(npc.Center, npc.DirectionTo(player.Center).RotatedBy(-angle) * 16f, ModContent.ProjectileType(), 48, 4.5f); - } - break; - // Shotgun bursts of bullets - case 2: - npc.velocity.X *= 0.9f; - if (npc.ai[0] % AttackCycleTime >= AttackCycleTime - SpecialAttackTime + 35f && npc.ai[0] % 20f == 19f) - { - for (int i = 0; i < 3; i++) - { - float angle = MathHelper.Lerp(-0.5f, 0.5f, i / 3f); - Projectile.NewProjectile(npc.Center, npc.DirectionTo(ShootPosition).RotatedBy(angle) * 13f, ModContent.ProjectileType(), 48, 4f); - } - } - break; - } - if (npc.ai[0] % AttackCycleTime == AttackCycleTime - 1f) + + PerformSpecialAttack(wrappedAttackTime); + + if (wrappedAttackTime == AttackCycleTime - 1f) { DelayTime = phase2 ? 45 : 75; AttackIndex++; @@ -224,83 +225,83 @@ namespace CalamityMod.NPCs.AcidRain } } } - public void TeleportCheck(Player player) + public void TeleportCheck() { - if (npc.ai[1] <= -TeleportCooldown) + 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); + if (TeleportCountdown <= -TeleportCooldown) { - if (npc.Distance(player.Center) > 2700f || - (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && npc.Distance(player.Center) > 900f) || - StuckOnPlatform(player) || - npc.wet || - npc.localAI[1] > 5f) + if (distanceFromTarget <= 2700f && !(targetIsFarOff && targetNotInLineOfSight) && !StuckOnPlatform() && !npc.wet && HorizontalCollisionSpamCounter <= 5f) + return; + + Point playerPositionTileCoords = Target.position.ToTileCoordinates(); + Point npcPositionTileCoords = npc.position.ToTileCoordinates(); + + for (int tries = 0; tries < 250; tries++) { - Point playerPositionTileCoords = player.position.ToTileCoordinates(); - Point npcPositionTileCoords = npc.position.ToTileCoordinates(); - int tries = 0; - int maxTeleportDistance = 20; - bool cannotTeleport = false; - while (!cannotTeleport && tries < 250) + int maxTeleportDistance = 30 + tries / 3; + int x = Main.rand.Next(playerPositionTileCoords.X - maxTeleportDistance, playerPositionTileCoords.X + maxTeleportDistance); + int yStart = Main.rand.Next(playerPositionTileCoords.Y - maxTeleportDistance, playerPositionTileCoords.Y + maxTeleportDistance); + + // Have a downward bias for the teleport if stuck on a platform above the target. + if (StuckOnPlatform()) + yStart = Main.rand.Next(playerPositionTileCoords.Y, playerPositionTileCoords.Y + maxTeleportDistance * 4); + + for (int y = yStart; y < playerPositionTileCoords.Y + maxTeleportDistance; y++) { - tries++; - int x = Main.rand.Next(playerPositionTileCoords.X - maxTeleportDistance, playerPositionTileCoords.X + maxTeleportDistance); - int yStart = Main.rand.Next(playerPositionTileCoords.Y - maxTeleportDistance, playerPositionTileCoords.Y + maxTeleportDistance); - if (StuckOnPlatform(player)) + 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(); + if (!veryCloseToTarget && !veryCloseToSelf && solidGround) { - yStart = Main.rand.Next(playerPositionTileCoords.Y, playerPositionTileCoords.Y + 4 * maxTeleportDistance); - } - for (int y = yStart; y < playerPositionTileCoords.Y + maxTeleportDistance; y++) - { - if ((y < playerPositionTileCoords.Y - 12 || y > playerPositionTileCoords.Y + 12 || x < playerPositionTileCoords.X - 12 || x > playerPositionTileCoords.X + 12) - && (y < npcPositionTileCoords.Y - 8 || y > npcPositionTileCoords.Y + 8 || x < npcPositionTileCoords.X - 7 || x > npcPositionTileCoords.X + 7) - && CalamityUtils.ParanoidTileRetrieval(x, y).nactive()) + // If the below tile has lava, skip it. + if (CalamityUtils.ParanoidTileRetrieval(x, y - 1).lava()) + continue; + + // If there's any tiles in the way, skip it. + if (Collision.SolidTiles(x - 12, x + 12, y - 7, y - 7)) + continue; + + // If there's any liquid near the tile, skip it. + for (int dy = y - 8; dy <= y + 8; dy++) { - bool canTeleport = true; - if (CalamityUtils.ParanoidTileRetrieval(x, y - 1).lava()) - { - canTeleport = false; - } - if (canTeleport && - Main.tileSolid[CalamityUtils.ParanoidTileRetrieval(x, y).type] && - !Collision.SolidTiles(x - 12, x + 12, y - 7, y - 7)) - { - for (int dy = y - 5; dy <= y; dy++) - { - if (CalamityUtils.ParanoidTileRetrieval(x, dy).liquid > 0) - { - continue; - } - } - npc.ai[1] = TeleportTime; - npc.ai[2] = x; - npc.ai[3] = y - 3; - cannotTeleport = true; - npc.localAI[1] = 0f; - break; - } + if (CalamityUtils.ParanoidTileRetrieval(x, dy).liquid > 0) + goto Continue; } + + TeleportCountdown = TeleportTime; + TeleportLocation = new Vector2(x, y - 6f); + HorizontalCollisionSpamCounter = 0f; + npc.netUpdate = true; + + return; + Continue: + continue; } } - npc.netUpdate = true; } } } + public void TeleportEffects() { - if (npc.ai[1] > TeleportTime) - npc.ai[1] = TeleportTime; - npc.ai[1]--; - if (npc.ai[1] >= 0f) + if (TeleportCountdown > TeleportTime) + TeleportCountdown = TeleportTime; + TeleportCountdown--; + if (TeleportCountdown >= 0f) { - if (npc.ai[1] == 0f && npc.ai[2] != 0f && npc.ai[3] != 0f) + if (TeleportCountdown == 0f && TeleportLocation != Vector2.Zero) { - npc.position.X = npc.ai[2] * 16f - npc.width / 2 + 8f; - npc.position.Y = npc.ai[3] * 16f - npc.height; + npc.position = TeleportLocation.ToWorldCoordinates(8f, 0f) - npc.Size; npc.netUpdate = true; npc.velocity = Vector2.Zero; } else { - npc.alpha = (int)MathHelper.Lerp(0f, 255f, 1f - npc.ai[1] / TeleportTime); + npc.Opacity = TeleportCountdown / TeleportTime; + int totalDust = (int)(30 * npc.alpha / 255f); for (int i = 0; i < totalDust; i++) { @@ -309,18 +310,20 @@ namespace CalamityMod.NPCs.AcidRain 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; - } } return; } - else if (npc.ai[1] >= -TeleportFadeinTime) + + // Release some dust before going back to normal. + if (TeleportCountdown >= -TeleportFadeinTime) { - npc.alpha = (int)MathHelper.Lerp(255f, 0f, npc.ai[1] / -TeleportFadeinTime); - if (npc.ai[1] == -TeleportFadeinTime) + npc.Opacity = TeleportCountdown / -TeleportFadeinTime; + if (TeleportCountdown == -TeleportFadeinTime) { for (int i = 0; i < 48; i++) { @@ -332,16 +335,79 @@ namespace CalamityMod.NPCs.AcidRain } } } - public bool StuckOnPlatform(Player player) + + public bool StuckOnPlatform() { - for (int i = 0; i < 18; i++) + 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] && player.Top.Y > npc.Bottom.Y + 48) + if (TileID.Sets.Platforms[CalamityUtils.ParanoidTileRetrieval(bottom.X, bottom.Y).type] && Target.Top.Y > npc.Bottom.Y + 48) return true; } return false; } + + public void PerformSpecialAttack(float wrappedAttackTime) + { + 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); + switch (PhaseArray[AttackIndex]) + { + case SpecialAttackState.DivergingBullets: + npc.velocity.X *= 0.9f; + float shootAdjustedTime = wrappedAttackTime - (AttackCycleTime - SpecialAttackTime); + bool shouldShoot = shootAdjustedTime >= 20f; + shouldShoot &= (shootAdjustedTime - 20f) % 30f < 12f; + shouldShoot &= shootAdjustedTime <= 152f; + shouldShoot &= shootAdjustedTime % 3f == 0f; + + if (shouldShoot) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float angle = (wrappedAttackTime - (AttackCycleTime - SpecialAttackTime + 20f)) % 12f / 12f * MathHelper.ToRadians(15f) - MathHelper.ToRadians(7.5f); + 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); + } + if (wrappedAttackTime >= (AttackCycleTime - SpecialAttackTime + 35f) && AttackTime % 10f == 9f) + Projectile.NewProjectile(mouthPosition, directionToTarget * 12f, ModContent.ProjectileType(), 48, 3f); + break; + case SpecialAttackState.ConeStreamOfBullets: + if (wrappedAttackTime >= AttackCycleTime - SpecialAttackTime + 35f && AttackTime % 4f == 3f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float angle = MathHelper.Lerp(MathHelper.ToRadians(35f), MathHelper.ToRadians(5f), (wrappedAttackTime - (AttackCycleTime - SpecialAttackTime + 35f)) / (SpecialAttackTime + 35f)); + 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(); + } + break; + case SpecialAttackState.ShotgunBurstOfBullets: + if (wrappedAttackTime >= AttackCycleTime - SpecialAttackTime + 35f && AttackTime % 20f == 19f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 3; i++) + { + float angle = MathHelper.Lerp(-0.5f, 0.5f, i / 3f); + Projectile.NewProjectile(mouthPosition, directionToShootPosition.RotatedBy(angle) * 13f, ModContent.ProjectileType(), 48, 4f); + } + } + npc.spriteDirection = (ShootPosition.X - npc.Center.X < 0).ToDirectionInt(); + } + break; + } + } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); @@ -350,12 +416,13 @@ namespace CalamityMod.NPCs.AcidRain public override void FindFrame(int frameHeight) { npc.frameCounter++; - int framesNeeded = Dying ? 7 : 6; + int frameChangeRate = Dying ? 7 : 6; + + // Walk faster the faster this thing is moving. if (Walking) - { - framesNeeded = 8 - (int)Math.Ceiling(Math.Abs(npc.velocity.X) / 5f); // Walk faster the faster we're moving - } - if (npc.frameCounter >= framesNeeded) + frameChangeRate = 8 - (int)Math.Ceiling(Math.Abs(npc.velocity.X) / 5f); + + if (npc.frameCounter >= frameChangeRate) { npc.frame.Y += frameHeight; npc.frameCounter = 0; @@ -383,14 +450,10 @@ namespace CalamityMod.NPCs.AcidRain npc.frame.Y = frameHeight * 8; } 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; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { @@ -403,34 +466,34 @@ namespace CalamityMod.NPCs.AcidRain } return false; } + public override bool CheckDead() { if (!Dying) { + Dying = true; npc.active = true; npc.life = 1; npc.dontTakeDamage = true; - Dying = true; npc.velocity = Vector2.Zero; npc.netUpdate = true; return false; } return Dying; } + 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); - } - } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); } + + 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); } } } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 2c29460b57..fee70fb9dd 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Placeables.Banners; @@ -7,11 +8,12 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.NPCs.AcidRain { public class NuclearToad : ModNPC { + public Player Target => Main.player[npc.target]; public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Toad"); @@ -32,22 +34,18 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 200; - npc.lifeMax = 5750; - npc.defense = 33; + npc.damage = 80; + npc.lifeMax = 2750; + npc.defense = 15; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 80; - npc.lifeMax = 380; + npc.damage = 35; + npc.lifeMax = 200; } npc.knockBackResist = 0.7f; npc.value = Item.buyPrice(0, 0, 5, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = true; npc.noTileCollide = false; @@ -56,61 +54,56 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void AI() { npc.TargetClosest(false); - Player player = Main.player[npc.target]; - // Slow down over time on the X axis (to prevent endless sliding as a result of KB) + // Slow down over time on the X axis (to prevent endless sliding as a result of KB). npc.velocity.X *= 0.96f; - // Hover on the top of the water + // Bob on the top of the water. 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; - } } 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; } + + // Make a frog croak sound from time to time. if (Main.rand.NextBool(480)) - Main.PlaySound(SoundID.Zombie, npc.Center, 13); // Ribbit sound + Main.PlaySound(SoundID.Zombie, npc.Center, 13); + float explodeDistance = CalamityWorld.downedAquaticScourge ? 295f : 195f; if (CalamityWorld.downedPolterghast) explodeDistance = 470f; - if (npc.Distance(player.Center) < explodeDistance) + + // Explode if a player gets too close. + if (npc.WithinRange(Target.Center, explodeDistance)) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = CalamityWorld.downedAquaticScourge ? 27 : 10; + int damage = Main.expertMode ? CalamityWorld.downedAquaticScourge ? 21 : 8 : CalamityWorld.downedAquaticScourge ? 27 : 10; float speed = Main.rand.NextFloat(6f, 9f); if (CalamityWorld.downedPolterghast) { speed *= 1.8f; - damage = 45; + damage = Main.expertMode ? 36 : 45; } + for (int i = 0; i < 7; i++) - { - float angle = Main.rand.NextFloat(MathHelper.TwoPi); - Projectile.NewProjectile(npc.Center, angle.ToRotationVector2() * 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; @@ -119,11 +112,7 @@ namespace CalamityMod.NPCs.AcidRain 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); - } + public override void FindFrame(int frameHeight) { npc.frameCounter++; @@ -132,18 +121,15 @@ namespace CalamityMod.NPCs.AcidRain 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); - } + if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AcidRain/NuclearToadGore1"), npc.scale); @@ -151,18 +137,12 @@ namespace CalamityMod.NPCs.AcidRain 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); - } } } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow"), true); - } + + 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); } } diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index bcfefb1355..2666daf81f 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; @@ -9,11 +10,24 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; -using CalamityMod.Buffs.StatDebuffs; + 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 bool PerformingJump + { + get => npc.ai[3] == 1f; + set + { + if (Main.netMode == NetmodeID.Server && value != PerformingJump) + npc.netUpdate = true; + npc.ai[3] = value.ToInt(); + } + } public override void SetStaticDefaults() { DisplayName.SetDefault("Orthocera"); @@ -26,24 +40,20 @@ namespace CalamityMod.NPCs.AcidRain npc.height = 34; npc.aiStyle = aiType = -1; - npc.damage = 75; - npc.lifeMax = 520; + npc.damage = 45; + npc.lifeMax = 280; npc.defense = 15; npc.DR_NERD(0.075f); if (CalamityWorld.downedPolterghast) { - npc.damage = 150; - npc.lifeMax = 4500; - npc.defense = 65; - npc.DR_NERD(0.35f); + npc.damage = 120; + npc.lifeMax = 3850; + npc.defense = 35; + npc.DR_NERD(0.15f); } npc.knockBackResist = 0.6f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 4, 20); npc.lavaImmune = false; npc.noGravity = true; @@ -53,115 +63,127 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void AI() { + Time++; npc.TargetClosest(false); - npc.ai[1] += 1f; float maxSpeed = CalamityWorld.downedPolterghast ? 12.8f : 10.5f; - if (npc.target >= 0 && npc.target < 255) + if (!Main.player.IndexInRange(npc.target)) + return; + + Player player = Main.player[npc.target]; + + // Swim. + if (Time % 250f < 180f) { - Player player = Main.player[npc.target]; - // Swim - if (npc.ai[1] % 250f < 180f) + if (npc.wet) { - if (npc.wet) - { - // Reset so we can jum again. - npc.ai[3] = 0f; + // Reset to allow a jumps. + if (PerformingJump) + PerformingJump = false; - // Swim towards the player if we're not too close. - // If we're close, simply resume our current movement. - if (npc.Distance(player.Center) > 150f) + // Swim towards the player if we're not too close. + // If close, simply resume current movement. + if (!npc.WithinRange(player.Center, 150f)) + { + npc.velocity = (npc.velocity * 17f + npc.SafeDirectionTo(player.Center, -Vector2.UnitY) * maxSpeed) / 18f; + if (FallDelay != 12f) { - npc.velocity = (npc.velocity * 17f + npc.DirectionTo(player.Center) * maxSpeed) / 18f; - if (npc.ai[0] != 12f) - { - npc.ai[0] = 12f; - npc.netUpdate = true; - } + FallDelay = 12f; + npc.netUpdate = true; } - // Variable for X movement later. - // It seems to slow down for some dumb reason in the jump phase without this value - npc.ai[2] = npc.velocity.X; - - // Make sure the value isn't 0 since we're relying on multiplication - if (npc.ai[2] == 0f) - npc.ai[2] = 0.1f; - - if (Math.Abs(npc.ai[2]) < 7f) - npc.ai[2] = Math.Abs(npc.ai[2]) * 7f; - if (Math.Abs(npc.ai[2]) > 16f) - npc.ai[2] = Math.Abs(npc.ai[2]) * 16f; - npc.ai[2] = Math.Abs(npc.ai[2]) * (player.Center.X - npc.Center.X > 0).ToDirectionInt(); } + + // 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; + + // Make sure the value isn't 0 since we're relying on multiplication + if (HorizontalSpeed == 0f) + HorizontalSpeed = 0.1f; + + if (Math.Abs(HorizontalSpeed) < 7f) + 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(); + } + else + { + if (FallDelay <= 0f) + npc.velocity.Y += 0.2f; else - { - if (npc.ai[0] <= 0f) - npc.velocity.Y += 0.2f; - else - npc.ai[0] -= 1f; - } - npc.direction = npc.spriteDirection = (npc.velocity.X > 0).ToDirectionInt(); + FallDelay--; } - // And jump/shoot - else if (npc.ai[1] % 220f > 180f) - { - float yAcceleration = CalamityWorld.downedPolterghast ? 0.07f : 0.05f; - if (npc.ai[1] % 220f < 200f) - { - npc.velocity.Y -= yAcceleration; - } - else - { - npc.velocity.Y += yAcceleration; - } - if (npc.ai[1] % 220f == 219f) - npc.ai[3] = 1f; - if (!npc.wet) - npc.velocity.X = npc.ai[2]; - } - // Don't jump mid-air - if (npc.ai[1] % 220f > 180f && npc.ai[3] == 1f) - { - npc.ai[1] = 0f; - npc.netUpdate = true; - } - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4 + MathHelper.PiOver2 + MathHelper.Pi; - - 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) - { - npc.velocity.X *= 0.92f; - // Spit out a stream of acid based on our rotation - if (npc.ai[1] % 220f == 195f) - { - float rotation = npc.rotation - MathHelper.Pi - MathHelper.PiOver2 - MathHelper.PiOver4; - if (npc.spriteDirection == -1) - rotation += MathHelper.PiOver2; - int damage = CalamityWorld.downedPolterghast ? 40 : CalamityWorld.downedAquaticScourge ? 26 : 18; - if (CalamityWorld.downedPolterghast) - { - damage = 44; - for (int i = 0; i < 2; i++) - { - float angle = MathHelper.Lerp(-0.3f, 0.3f, i / 2f); - Projectile.NewProjectile(npc.Center, (rotation + angle).ToRotationVector2() * 10f, ModContent.ProjectileType(), damage, 2f); - } - } - Projectile.NewProjectile(npc.Center, rotation.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.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; + else + npc.velocity.Y += verticalAcceleration; + + if (Time % 220f == 219f) + PerformingJump = true; + if (!npc.wet) + npc.velocity.X = HorizontalSpeed; + } + + // Don't jump mid-air. + if (Time % 220f > 180f && PerformingJump) + { + Time = 0f; + npc.netUpdate = true; + } + + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4 + MathHelper.PiOver2 + MathHelper.Pi; + + 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) + { + 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) + spitDirection += MathHelper.PiOver2; + + int damage = CalamityWorld.downedPolterghast ? 40 : CalamityWorld.downedAquaticScourge ? 26 : 18; + if (Main.expertMode) + damage = (int)Math.Round(damage * 0.8); + + // Spit two extra streams of acid at the target post-Polterghast. + if (CalamityWorld.downedPolterghast) + { + 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.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)); } + public override void NPCLoot() { 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++; @@ -170,35 +192,23 @@ namespace CalamityMod.NPCs.AcidRain npc.frameCounter = 0; npc.frame.Y += frameHeight; if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - { npc.frame.Y = 0; - } } } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + 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) { 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); - } } } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } + + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 9f6c3f98a9..d28a1a0a10 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -29,22 +29,18 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { - npc.damage = 200; - npc.lifeMax = 4000; + npc.damage = 60; + npc.lifeMax = 3250; npc.defense = 20; } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 75; + npc.damage = 30; npc.lifeMax = 130; npc.defense = 10; } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 5, 0); npc.lavaImmune = false; npc.noGravity = false; diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 882f287281..8a775663ad 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -9,15 +10,21 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; + namespace CalamityMod.NPCs.AcidRain { public class Skyfin : ModNPC { + public bool Flying = false; + public Player Target => Main.player[npc.target]; + public ref float Time => ref npc.ai[0]; + public ref float DiveTimer => ref npc.ai[1]; + public ref float HorizontalDiveSpeed => ref npc.ai[2]; + public ref float WaitBeforeFlyingMovement => ref npc.ai[3]; public const float DiveDelay = 120f; public const float DiveTime = 90f; - public const float TotalTime = DiveDelay + DiveTime; - public bool Flying = false; + public const float TotalDiveTime = DiveDelay + DiveTime; + public override void SetStaticDefaults() { DisplayName.SetDefault("Skyfin"); @@ -38,23 +45,19 @@ namespace CalamityMod.NPCs.AcidRain if (CalamityWorld.downedPolterghast) { npc.knockBackResist = 0.8f; - npc.damage = 150; - npc.lifeMax = 5001; - npc.defense = 58; + npc.damage = 88; + npc.lifeMax = 3025; + npc.defense = 18; npc.DR_NERD(0.05f); } else if (CalamityWorld.downedAquaticScourge) { - npc.damage = 85; - npc.lifeMax = 400; + npc.damage = 38; + npc.lifeMax = 220; npc.DR_NERD(0.05f); } npc.value = Item.buyPrice(0, 0, 3, 65); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = true; npc.HitSound = SoundID.NPCHit1; @@ -62,162 +65,153 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Flying); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - Flying = reader.ReadBoolean(); - } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); + + public override void ReceiveExtraAI(BinaryReader reader) => Flying = reader.ReadBoolean(); + public override void AI() { npc.TargetClosest(false); - Player player = Main.player[npc.target]; - if (!Flying) - { - npc.ai[0] += 1f; - if (npc.ai[1] > 0f) - npc.ai[1] -= 1f; - if (npc.wet) - { - // Swim around, moving towards the player - bool canSwimToPlayer = Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height); - if (canSwimToPlayer) - { - if (npc.ai[0] % 55f == 54f) - { - float horizontalSchoolingSpeed = 9f; - if (CalamityWorld.downedAquaticScourge) - { - horizontalSchoolingSpeed = 15f; - } - if (CalamityWorld.downedPolterghast) - { - horizontalSchoolingSpeed = 24f; - } - npc.velocity = Vector2.UnitX * (player.Center.X - npc.Center.X > 0).ToDirectionInt() * horizontalSchoolingSpeed; - } - if ((Math.Abs(player.Center.Y - npc.Center.Y) > 50f && player.wet) || (!player.wet && npc.ai[1] <= 0f)) - { - float speedY = CalamityWorld.downedPolterghast ? 10f : 6f; - npc.velocity.Y = (player.Center.Y - npc.Center.Y > 0).ToDirectionInt() * speedY; - } - if (Math.Abs(npc.velocity.X) < 6f) - npc.velocity.X *= 1.04f; - } - else if (!canSwimToPlayer && Math.Abs(npc.velocity.Y) < 4f) - { - npc.velocity.Y *= 0.97f; - } - // Turn around if we hit a tile on the X axis - if (!canSwimToPlayer && npc.collideX) - { - npc.velocity.X *= -1f; - } - // Check if we can dive - if (player.Center.Y < npc.Top.Y - 10f && - npc.ai[1] <= 0f) - { - if (Main.rand.NextBool(10)) - { - npc.ai[1] = TotalTime; - } - npc.ai[2] = (player.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f; - } - } - else + if (Flying) + FlyTowardsTarget(); + else + DoSwimMovement(); + int idealDirection = (npc.velocity.X > 0).ToDirectionInt(); + npc.direction = npc.spriteDirection = idealDirection; + if (idealDirection != npc.direction) + npc.netUpdate = true; + + npc.rotation = npc.velocity.ToRotation() + (npc.direction > 0).ToInt() * MathHelper.Pi; + } + + public void FlyTowardsTarget() + { + npc.noTileCollide = true; + Time++; + if (Time % 300f >= 180f) + { + // Rise upward. + if (Time % 300f <= 205f) + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, -6.5f, 0.07f); + + // And fly towards the target. + if (Time % 300f == 235f) { - // Consistently update the enemy. - if (npc.ai[3] % 40f == 39f) - { - npc.netUpdate = true; - } - // Dive upward in an attempt to hit to the player - if (npc.ai[1] > TotalTime - DiveTime) - { - npc.velocity.X = npc.ai[2]; - if (npc.ai[1] > TotalTime - DiveTime * 0.5f) - { - float flySpeed = CalamityWorld.downedAquaticScourge ? 0.115f : 0.085f; - if (CalamityWorld.downedPolterghast) - { - flySpeed = 0.135f; - } - npc.velocity.Y -= flySpeed; - } - else - { - npc.ai[1] = TotalTime - DiveTime; - npc.velocity.Y += 0.2f; - } - } - else - { - // Don't fall too fast because of wings - npc.ai[1] = TotalTime - DiveTime; - npc.velocity.Y += 0.1f; - npc.ai[3]++; - if (npc.ai[3] > 420f) - { - npc.ai[0] = npc.ai[1] = npc.ai[2] = npc.ai[3] = 0f; - Flying = true; - npc.netUpdate = true; - } - } - } - // If sitting on land, rotate in a way that looks like we're stuck on the ground - if (!npc.wet) - { - npc.velocity.X *= 0.92f; + float chargeSpeed = 8f; + if (CalamityWorld.downedAquaticScourge) + chargeSpeed = 14f; + if (CalamityWorld.downedPolterghast) + chargeSpeed = 18f; + npc.velocity = npc.SafeDirectionTo(Target.Center, Vector2.UnitY) * chargeSpeed; } } else { - npc.noTileCollide = true; - npc.ai[0]++; - if (npc.ai[0] % 300f >= 180f) + if (Math.Abs(Target.Center.X - npc.Center.X) > 320f) + npc.velocity.X = MathHelper.Lerp(npc.velocity.X, (Target.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f, 0.05f); + if (Math.Abs(Target.Center.Y - npc.Center.Y) > 50f) + npc.velocity.Y = npc.SafeDirectionTo(Target.Center).Y * 9f; + } + } + + public void DoSwimMovement() + { + Time++; + if (DiveTimer > 0f) + DiveTimer -= 1f; + if (npc.wet) + { + // Swim around, moving towards the player. + bool canSwimToPlayer = Collision.CanHit(npc.position, npc.width, npc.height, Target.position, Target.width, Target.height); + if (canSwimToPlayer) { - if (npc.ai[0] % 300f == 205f) + if (Time % 55f == 54f) { - npc.velocity.Y = -6.5f; - } - if (npc.ai[0] % 300f == 235f) - { - float chargeSpeed = 8f; + float horizontalSchoolingSpeed = 9f; if (CalamityWorld.downedAquaticScourge) - { - chargeSpeed = 14f; - } + horizontalSchoolingSpeed = 15f; if (CalamityWorld.downedPolterghast) - { - chargeSpeed = 18f; - } - npc.velocity = npc.DirectionTo(player.Center) * chargeSpeed; + horizontalSchoolingSpeed = 24f; + npc.velocity = Vector2.UnitX * (Target.Center.X - npc.Center.X > 0).ToDirectionInt() * horizontalSchoolingSpeed; + } + if ((Math.Abs(Target.Center.Y - npc.Center.Y) > 50f && Target.wet) || (!Target.wet && DiveTimer <= 0f)) + { + float verticalSwimSpeed = CalamityWorld.downedPolterghast ? 10f : 6f; + npc.velocity.Y = (Target.Center.Y - npc.Center.Y > 0).ToDirectionInt() * verticalSwimSpeed; + } + + // Speed up if there is little horizontal movement. + if (Math.Abs(npc.velocity.X) < 6f) + npc.velocity.X *= 1.04f; + } + + // Slow down increasingly vertically if it's already low. + else if (!canSwimToPlayer && Math.Abs(npc.velocity.Y) < 4f) + npc.velocity.Y *= 0.97f; + + // Turn around if we hit a tile on the X axis + if (!canSwimToPlayer && npc.collideX) + npc.velocity.X *= -1f; + + // Check if a dive is possible. + if (Target.Center.Y < npc.Top.Y - 10f && DiveTimer <= 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10)) + { + DiveTimer = TotalDiveTime; + npc.netUpdate = true; + } + + HorizontalDiveSpeed = (Target.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f; + } + } + else + { + // Dive upward in an attempt to hit to the player. + if (DiveTimer > TotalDiveTime - DiveTime) + { + npc.velocity.X = HorizontalDiveSpeed; + if (DiveTimer > TotalDiveTime - DiveTime * 0.5f) + { + float upwardDiveSpeed = CalamityWorld.downedAquaticScourge ? 0.115f : 0.085f; + if (CalamityWorld.downedPolterghast) + upwardDiveSpeed = 0.135f; + npc.velocity.Y -= upwardDiveSpeed; + } + else + { + DiveTimer = TotalDiveTime - DiveTime; + npc.velocity.Y += 0.2f; } } else { - if (Math.Abs(player.Center.X - npc.Center.X) > 320f) + // Don't fall too fast because of wings + DiveTimer = TotalDiveTime - DiveTime; + npc.velocity.Y += 0.1f; + WaitBeforeFlyingMovement++; + + // Consistently sync the enemy. + if (WaitBeforeFlyingMovement % 40f == 39f) + npc.netUpdate = true; + + if (WaitBeforeFlyingMovement > 180f) { - npc.velocity.X = MathHelper.Lerp(npc.velocity.X, (player.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f, 0.05f); - } - if (Math.Abs(player.Center.Y - npc.Center.Y) > 50f) - { - npc.velocity.Y = npc.DirectionTo(player.Center).Y * 9f; + Time = DiveTimer = HorizontalDiveSpeed = WaitBeforeFlyingMovement = 0f; + Flying = true; + npc.netUpdate = true; } } } - int idealDirection = (npc.velocity.X > 0).ToDirectionInt(); - npc.direction = npc.spriteDirection = idealDirection; - if (idealDirection != npc.direction) + // If sitting on land, rotate in a way that looks like we're stuck on the ground + if (!npc.wet) { - npc.netUpdate = true; + npc.velocity.X *= 0.92f; } - npc.rotation = npc.velocity.ToRotation() + - (npc.direction > 0).ToInt() * MathHelper.Pi; } + public override void FindFrame(int frameHeight) { npc.frameCounter++; @@ -226,41 +220,30 @@ namespace CalamityMod.NPCs.AcidRain 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 * (CalamityWorld.downedAquaticScourge ? 6 : 1), 1, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAquaticScourge, 0.05f); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + 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) { 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); - } } } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } + + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/NPCs/AcidRain/SulfurousSkater.cs b/NPCs/AcidRain/SulfurousSkater.cs index 001078709c..485f11854c 100644 --- a/NPCs/AcidRain/SulfurousSkater.cs +++ b/NPCs/AcidRain/SulfurousSkater.cs @@ -18,6 +18,9 @@ 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 override void SetStaticDefaults() { DisplayName.SetDefault("Sulphurous Skater"); @@ -25,36 +28,29 @@ namespace CalamityMod.NPCs.AcidRain NPCID.Sets.TrailingMode[npc.type] = 1; NPCID.Sets.TrailCacheLength[npc.type] = 6; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Flying); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - Flying = reader.ReadBoolean(); - } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); + + public override void ReceiveExtraAI(BinaryReader reader) => Flying = reader.ReadBoolean(); + public override void SetDefaults() { npc.width = 48; npc.height = 48; - npc.damage = 70; - npc.lifeMax = 520; + npc.damage = 48; + npc.lifeMax = 280; npc.defense = 3; if (CalamityWorld.downedPolterghast) { - npc.damage = 100; - npc.lifeMax = 5000; - npc.defense = 33; + npc.damage = 85; + npc.lifeMax = 3850; + npc.defense = 15; } npc.knockBackResist = 0.8f; npc.value = Item.buyPrice(0, 0, 5, 25); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = true; npc.noTileCollide = false; @@ -65,106 +61,125 @@ namespace CalamityMod.NPCs.AcidRain npc.aiStyle = aiType = -1; } + public override void AI() { npc.TargetClosest(false); - Player player = Main.player[npc.target]; if (!Flying) + JumpToDestination(); + else + DoFlyMovement(); + } + + public void JumpToDestination() + { + npc.knockBackResist = 0.8f; + npc.DR_NERD(0.35f); + npc.noGravity = false; + Projectile closestBubble = SearchForNearestBubble(out float distanceToBubbele); + + Vector2 destination = Target.Center; + + // Jump towards any nearby bubbles if they exist. + if (closestBubble != null) + destination = closestBubble.Center; + + // Stay on water instead of falling into it + 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.knockBackResist = 0.8f; - npc.DR_NERD(0.35f); - npc.noGravity = false; - float minimumDistance = float.PositiveInfinity; - Projectile closestBubble = null; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.projectile[i].type == ModContent.ProjectileType() && Main.projectile[i].active) - { - if (Math.Abs(npc.Center.X - Main.projectile[i].Center.X) < minimumDistance && - Collision.CanHit(npc.position, npc.width, npc.height, Main.projectile[i].position, Main.projectile[i].width, Main.projectile[i].height) && - Main.projectile[i].Center.Y > npc.Bottom.Y) - { - minimumDistance = npc.Distance(Main.projectile[i].Center); - closestBubble = Main.projectile[i]; - } - } - } - if (minimumDistance >= 2400f) - { - closestBubble = null; - } + npc.velocity.Y += 0.2f; - Vector2 destination = player.Center; - - if (closestBubble != null) + if (closestBubble.Hitbox.Intersects(npc.Hitbox)) { - destination = closestBubble.Center; - } - // Stay on water instead of falling into it - if (npc.wet) - { - if (npc.velocity.Y >= 0f) - { - npc.velocity.Y = -3f; - } - } - - if (closestBubble != null && minimumDistance < 200f) - { - npc.velocity.Y += 0.2f; - - if (closestBubble.Hitbox.Intersects(npc.Hitbox)) - { - Flying = true; - closestBubble.Kill(); - npc.netSpam = 0; - npc.netUpdate = true; - } - } - if (npc.velocity.Y == 0f || npc.wet) - { - npc.TargetClosest(false); - npc.velocity.X *= 0.85f; - npc.ai[1]++; - float lungeForwardSpeed = 15f; - float jumpSpeed = 4f; - if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - lungeForwardSpeed *= 1.2f; - } - if (npc.ai[1] >= 17) - { - npc.ai[1] = 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; - } - } - else - { - npc.knockBackResist = 0f; + Flying = true; + npc.netSpam = 0; + npc.netUpdate = true; + closestBubble.Kill(); } } - else + + // Wait for a small amount of time and jump if there is little motion. + if (npc.velocity.Y == 0f || npc.wet) { - npc.knockBackResist = 0.5f; - npc.DR_NERD(0f); - float speed = CalamityWorld.downedPolterghast ? 17f : 14f; - float inertia = CalamityWorld.downedPolterghast ? 20f : 24.5f; - if (npc.Distance(player.Center) < 200f) - inertia *= 0.667f; - npc.velocity = (npc.velocity * inertia + npc.DirectionTo(player.Center) * speed) / (inertia + 1f); - npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt(); - if (npc.Distance(player.Center) < player.Size.Length()) + npc.TargetClosest(false); + + // Rapidly zero out horizontal movement. + npc.velocity.X *= 0.85f; + + JumpTimer++; + float lungeForwardSpeed = 15f; + float jumpSpeed = 4f; + if (Collision.CanHit(npc.Center, 1, 1, Target.Center, 1, 1)) + lungeForwardSpeed *= 1.2f; + + // Jump after a short amount of time. + if (JumpTimer >= 17) { - Flying = false; + 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; } } + else + npc.knockBackResist = 0f; } + + public void DoFlyMovement() + { + 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)) + flyInertia *= 0.667f; + 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())) + { + Flying = false; + npc.netSpam = 0; + npc.netUpdate = true; + } + } + + public Projectile SearchForNearestBubble(out float distanceToBubble) + { + int bubbleType = ModContent.ProjectileType(); + float minimumDistance = 2400f; + Projectile closestBubble = null; + + for (int i = 0; i < Main.maxProjectiles; i++) + { + 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)) + { + continue; + } + + minimumDistance = npc.Distance(Main.projectile[i].Center); + closestBubble = Main.projectile[i]; + } + + distanceToBubble = minimumDistance; + return closestBubble; + } + public override void FindFrame(int frameHeight) { if (!Flying) @@ -177,22 +192,16 @@ namespace CalamityMod.NPCs.AcidRain 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); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } public override void HitEffect(int hitDirection, double damage) { @@ -214,9 +223,6 @@ namespace CalamityMod.NPCs.AcidRain DropHelper.DropItemChance(npc, ModContent.ItemType(), 20); } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } + 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 04e13cc550..7ae8abb2cf 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -14,9 +14,10 @@ namespace CalamityMod.NPCs.AcidRain { public class Trilobite : ModNPC { - // When the abs(velocity) is less than this, lunge in the water + public Player Target => Main.player[npc.target]; + public ref float SpikeShootCountdown => ref npc.ai[0]; public const float MinSpeedLungePrompt = 0.5f; - public const float MinYDriftSpeed = 0.9f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Trilobite"); @@ -31,25 +32,20 @@ namespace CalamityMod.NPCs.AcidRain npc.height = 38; npc.aiStyle = aiType = -1; - npc.damage = 66; - npc.lifeMax = 600; + npc.damage = 45; + npc.lifeMax = 300; npc.defense = 15; npc.DR_NERD(0.25f); if (CalamityWorld.downedPolterghast) { - npc.damage = 120; - npc.lifeMax = 4900; - npc.defense = 78; - npc.DR_NERD(0.4f); + npc.damage = 80; + npc.lifeMax = 4125; + npc.defense = 30; } npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 4, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = true; npc.noTileCollide = false; @@ -58,106 +54,107 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } + public override void AI() { npc.TargetClosest(false); if (!npc.wet) { - if (npc.ai[0] > 0) - npc.ai[0]--; - npc.rotation += npc.velocity.X * 0.1f; - if (npc.velocity.Y == 0f) + GetStuckOnLand(); + return; + } + + // If this NPC doesn't have enough momentum, lunge towards its target. + if (npc.velocity.Length() < MinSpeedLungePrompt) + { + 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; + return; + } + + // Accelerate quickly through the water horizontally. + if (Math.Abs(npc.velocity.X) < 20f) + npc.velocity.X += npc.direction * 0.02f; + + 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; + + // 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) + { + float speedX = 18f; + float speedY = 9f; + if (CalamityWorld.downedPolterghast) { - npc.velocity.X *= 0.99f; - if (Math.Abs(npc.velocity.X) < 0.01f) - { - npc.velocity.X = 0f; - } - npc.netUpdate = true; - } - npc.velocity.Y += 0.3f; - if (npc.velocity.Y > 13f) - { - npc.velocity.Y = 13f; - npc.netUpdate = true; + speedX = 22f; + speedY = 11f; } + npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * new Vector2(speedX, speedY); + npc.netUpdate = true; + } + npc.velocity.Y *= 0.98f; + } + + public void GetStuckOnLand() + { + if (SpikeShootCountdown > 0) + SpikeShootCountdown--; + npc.rotation += npc.velocity.X * 0.1f; + + // If not moving vertically, slow down hotizontally. + if (npc.velocity.Y == 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) + { + npc.velocity.Y = 13f; + npc.netUpdate = true; } else - { - Player player = Main.player[npc.target]; - if (npc.velocity.Length() < MinSpeedLungePrompt) - { - npc.TargetClosest(true); - float speed = 15f; - if (CalamityWorld.downedPolterghast) - { - speed = 18.5f; - } + npc.velocity.Y += 0.3f; + } - npc.velocity = npc.DirectionTo(player.Center) * speed; - npc.velocity.X *= 1.6f; - npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; - npc.netUpdate = true; - } - else - { - if (Math.Abs(npc.velocity.X) < 20f) - { - npc.velocity.X += npc.direction * 0.02f; - } - npc.rotation = npc.velocity.X * 0.4f; - if (Math.Abs(npc.velocity.Y) < MinYDriftSpeed) - { - npc.velocity.X *= 0.96f; - } - else if (Math.Abs(npc.velocity.X) < 3.5f) - { - float speedX = 18f; - float speedY = 9f; - if (CalamityWorld.downedPolterghast) - { - speedX = 22f; - speedY = 11f; - } - npc.velocity = npc.DirectionTo(player.Center) * new Vector2(speedX, speedY); - npc.netUpdate = true; - } - npc.velocity.Y *= 0.98f; - } - } - } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } public override void NPCLoot() { 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); - } } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Main.netMode != NetmodeID.MultiplayerClient) + // 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) { - if (npc.ai[0] <= 0f) - { - Main.PlaySound(SoundID.NPCDeath11, npc.Center); - int projDamage = CalamityWorld.downedPolterghast ? 35 : CalamityWorld.downedAquaticScourge ? 29 : 21; - Projectile.NewProjectile(npc.Center + Utils.NextVector2Unit(Main.rand) * npc.Size * 0.7f, - -npc.velocity.RotatedByRandom(MathHelper.ToRadians(10f)), ModContent.ProjectileType(), - projDamage, 3f); - npc.ai[0] = Main.rand.Next(50, 65); - npc.netUpdate = true; - } + Main.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); + SpikeShootCountdown = Main.rand.Next(50, 65); + npc.netUpdate = true; } } + public override void FindFrame(int frameHeight) { npc.frameCounter++; @@ -166,11 +163,10 @@ namespace CalamityMod.NPCs.AcidRain 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++) @@ -188,6 +184,7 @@ namespace CalamityMod.NPCs.AcidRain } } } + public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); diff --git a/NPCs/AcidRain/WaterLeech.cs b/NPCs/AcidRain/WaterLeech.cs index 335f6901a9..9fa0b015fe 100644 --- a/NPCs/AcidRain/WaterLeech.cs +++ b/NPCs/AcidRain/WaterLeech.cs @@ -6,15 +6,23 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.StatDebuffs; using System.IO; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.NPCs.AcidRain { public class WaterLeech : ModNPC { + public Player Target => Main.player[npc.target]; + public bool LatchingOntoTarget + { + get => npc.ai[0] == 1f; + set => npc.ai[0] = value.ToInt(); + } + 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"); @@ -26,27 +34,18 @@ namespace CalamityMod.NPCs.AcidRain npc.width = 26; npc.height = 14; - npc.damage = 20; - npc.lifeMax = 60; - npc.defense = 0; + npc.lifeMax = 30; + npc.damage = 0; if (CalamityWorld.downedPolterghast) { - npc.damage = 120; - npc.lifeMax = 4000; - npc.defense = 30; + npc.lifeMax = 1235; + npc.defense = 10; } else if (CalamityWorld.downedAquaticScourge) - { - npc.damage = 80; - npc.lifeMax = 150; - } + npc.lifeMax = 90; npc.value = Item.buyPrice(0, 0, 2, 5); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.lavaImmune = false; npc.noGravity = true; npc.noTileCollide = false; @@ -55,83 +54,54 @@ namespace CalamityMod.NPCs.AcidRain banner = npc.type; bannerItem = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(npc.dontTakeDamage); + + public override void ReceiveExtraAI(BinaryReader reader) => npc.dontTakeDamage = reader.ReadBoolean(); + public override void AI() { if (npc.localAI[0] == 0f) { - npc.TargetClosest(false); + npc.TargetClosest(); npc.localAI[0] = 1f; } - // Anti-sticky movement and player targeting detection (only one leech and attack the player at once) - Player player = Main.player[npc.target]; bool playerAlreadyTargeted = false; float antiStickyAcceleration = 0.25f; - for (int i = 0; i < Main.npc.Length; i++) + + // Repel other leeches from this one. Also determine if one is already targeting a player. + // 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].whoAmI != npc.whoAmI && - Main.npc[i].active) - { - 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].type != npc.type || !Main.npc[i].active || Main.npc[i].whoAmI == npc.whoAmI) + continue; + + 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 (!playerAlreadyTargeted || player.Calamity().waterLeechTarget == -1) - { - player.Calamity().waterLeechTarget = npc.whoAmI; - } + if (!playerAlreadyTargeted || Target.Calamity().waterLeechTarget == -1) + Target.Calamity().waterLeechTarget = npc.whoAmI; - // Latch onto player - if (npc.ai[0] == 1f) + if (LatchingOntoTarget) { - if (npc.dontTakeDamage) - { - npc.dontTakeDamage = false; - npc.netUpdate = true; - } - if (npc.Distance(player.Top) >= 140f) - { - npc.ai[0] = 0f; - npc.netUpdate = true; - return; - } - Vector2 destination = ((player.gravDir == 1f) ? player.Top : player.Bottom) + player.direction * 4 * Vector2.UnitX; - float speed = Utils.SmoothStep(10f, ChaseMaxDistance, npc.Distance(destination)) * 16f; - npc.velocity = npc.DirectionTo(destination) * (speed + 7f); - if (npc.Distance(destination) < 45f) - { - player.AddBuff(BuffID.Bleeding, 180, true); - } - else if (!npc.wet && npc.Distance(destination) > 85f) - { - npc.ai[0] = 0f; - npc.netUpdate = true; - } + LatchOntoTarget(); return; } + 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) { npc.velocity.X *= 0.97f; - npc.velocity.Y += 0.5f; - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y + 0.4f, -4f, 16f); + LackOfWaterDeathTimer++; + if (LackOfWaterDeathTimer >= 300f) { npc.life = 0; npc.HitEffect(); @@ -139,29 +109,73 @@ namespace CalamityMod.NPCs.AcidRain npc.netUpdate = true; } } - else if (player.wet && player.Calamity().waterLeechTarget == npc.whoAmI) + + // Swim towards the target if they are in water. + else if (Target.wet && Target.Calamity().waterLeechTarget == npc.whoAmI) { - float speed = player.wet ? 23f : 17f; + float swimSpeed = Target.wet ? 23f : 17f; float swimIntertia = 24f; if (CalamityWorld.downedPolterghast) { - speed *= 1.6f; + swimSpeed *= 1.6f; swimIntertia = 17f; } - npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(player.Center) * speed) / swimIntertia; - } - else if (!player.wet) - { - npc.velocity *= 0.9f; + npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia; } - if (npc.Distance(player.Top) < ChasePromptDistance && player.active && !player.dead) + // Rapidly slow down if the target is not in water. + else if (!Target.wet) + npc.velocity *= 0.9f; + + if (npc.WithinRange(Target.Top, ChasePromptDistance) && Target.active && !Target.dead) { - npc.ai[0] = 1f; + LatchingOntoTarget = 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) + { + npc.dontTakeDamage = shouldNotTakeDamage; npc.netUpdate = true; } - npc.dontTakeDamage = !player.wet; } + + public void LatchOntoTarget() + { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.dontTakeDamage) + { + 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)) + { + LatchingOntoTarget = false; + 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; + + 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)) + { + LatchingOntoTarget = false; + npc.netUpdate = true; + } + } + public override void FindFrame(int frameHeight) { npc.frameCounter++; @@ -170,35 +184,22 @@ namespace CalamityMod.NPCs.AcidRain npc.frameCounter = 0; npc.frame.Y += frameHeight; if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight) - { npc.frame.Y = 0; - } } } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !spawnInfo.player.Calamity().ZoneSulphur || !Main.raining) - { return 0f; - } + return 0.115f; } 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); - } - } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); } public override void NPCLoot() diff --git a/NPCs/AquaticScourge/AquaticParasite.cs b/NPCs/AquaticScourge/AquaticParasite.cs index 68d7d4ad19..d83d57199d 100644 --- a/NPCs/AquaticScourge/AquaticParasite.cs +++ b/NPCs/AquaticScourge/AquaticParasite.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; @@ -21,13 +22,9 @@ namespace CalamityMod.NPCs.AquaticScourge npc.width = 28; npc.height = 28; npc.defense = 5; - npc.LifeMaxNERB((Main.hardMode ? 200 : 30), bossRush: 30000); + npc.LifeMaxNERB(Main.hardMode ? 200 : 30); npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 0, 60); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -197,7 +194,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 57478d54b2..3d1f279382 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,5 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,22 +19,19 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = 65; - npc.width = 32; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 32; npc.height = 32; npc.defense = 20; - npc.DR_NERD(0.05f); + npc.DR_NERD(0.1f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.LifeMaxNERB(73000, 85000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -41,7 +42,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.chaseable = false; npc.canGhostHeal = false; - if (CalamityWorld.death || CalamityWorld.bossRushActive) + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) npc.scale = 1.2f; else if (CalamityWorld.revenge) npc.scale = 1.15f; @@ -49,7 +50,19 @@ namespace CalamityMod.NPCs.AquaticScourge npc.scale = 1.1f; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 4; 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(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } @@ -59,7 +72,29 @@ namespace CalamityMod.NPCs.AquaticScourge CalamityAI.AquaticScourgeAI(npc, mod, false); } - public override bool? CanBeHitByProjectile(Projectile projectile) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[3] > 480f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) { @@ -81,7 +116,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -105,8 +140,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 7c757d090d..a8ed986573 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,5 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,22 +19,18 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = 55; - npc.width = 32; + npc.GetNPCDamage(); + npc.width = 32; npc.height = 32; npc.defense = 15; - npc.DR_NERD(0.05f); + npc.DR_NERD(0.1f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.LifeMaxNERB(73000, 85000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.chaseable = false; npc.canGhostHeal = false; - if (CalamityWorld.death || CalamityWorld.bossRushActive) + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) npc.scale = 1.2f; else if (CalamityWorld.revenge) npc.scale = 1.15f; @@ -49,7 +49,19 @@ namespace CalamityMod.NPCs.AquaticScourge npc.scale = 1.1f; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 4; 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(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } @@ -59,7 +71,29 @@ namespace CalamityMod.NPCs.AquaticScourge CalamityAI.AquaticScourgeAI(npc, mod, false); } - public override bool? CanBeHitByProjectile(Projectile projectile) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[3] > 480f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) { @@ -81,7 +115,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -104,8 +138,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 27d38349d9..f633fd921e 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -14,10 +14,10 @@ using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using CalamityMod.Items.Armor.Vanity; @@ -34,20 +34,17 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { npc.npcSlots = 16f; - npc.damage = 80; - npc.width = 90; + npc.GetNPCDamage(); + npc.Calamity().canBreakPlayerDefense = true; + npc.width = 90; npc.height = 90; npc.defense = 10; - npc.DR_NERD(0.1f); + npc.DR_NERD(0.05f); npc.aiStyle = -1; aiType = -1; - npc.LifeMaxNERB(73000, 85000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 12, 0, 0); npc.behindTiles = true; @@ -58,7 +55,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.netAlways = true; bossBag = ModContent.ItemType(); - if (CalamityWorld.death || CalamityWorld.bossRushActive) + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) npc.scale = 1.2f; else if (CalamityWorld.revenge) npc.scale = 1.15f; @@ -66,32 +63,53 @@ namespace CalamityMod.NPCs.AquaticScourge npc.scale = 1.1f; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.chaseable); + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); writer.Write(npc.localAI[1]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.chaseable = reader.ReadBoolean(); + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); npc.localAI[1] = reader.ReadSingle(); - } + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { - if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || CalamityWorld.bossRushActive) - { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge"); - else - music = MusicID.Boss2; - } + if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive) + music = CalamityMod.Instance.GetMusicFromMusicMod("AquaticScourge") ?? MusicID.Boss2; + CalamityAI.AquaticScourgeAI(npc, mod, true); } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + + if (npc.Calamity().newAI[3] > 480f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((npc.Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { Rectangle targetHitbox = target.Hitbox; @@ -114,23 +132,25 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) - { return npc.Calamity().newAI[0] == 1f; - } + return null; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe) - { + if (spawnInfo.player.Calamity().disableNaturalScourgeSpawns) return 0f; - } + + if (spawnInfo.playerSafe) + return 0f; + if (spawnInfo.player.Calamity().ZoneSulphur && spawnInfo.water) { if (!NPC.AnyNPCs(ModContent.NPCType())) return 0.01f; } + return 0f; } @@ -154,25 +174,22 @@ namespace CalamityMod.NPCs.AquaticScourge { DropHelper.DropBags(npc); - DropHelper.DropItem(npc, ItemID.GreaterHealingPotion, 8, 14); + // Legendary drops for Aquatic Scourge + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + 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.DropResidentEvilAmmo(npc, CalamityWorld.downedAquaticScourge, 4, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedAquaticScourge); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { - // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), 11, 20); - DropHelper.DropItem(npc, ItemID.Coral, 5, 9); - DropHelper.DropItem(npc, ItemID.Seashell, 5, 9); - DropHelper.DropItem(npc, ItemID.Starfish, 5, 9); - // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -182,7 +199,7 @@ namespace CalamityMod.NPCs.AquaticScourge ); // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 9); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 9); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); @@ -197,43 +214,35 @@ namespace CalamityMod.NPCs.AquaticScourge 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); - string sulfSeaBoostMessage = "Mods.CalamityMod.WetWormBossText"; + string sulfSeaBoostKey = "Mods.CalamityMod.WetWormBossText"; Color sulfSeaBoostColor = AcidRainEvent.TextColor; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(sulfSeaBoostMessage), sulfSeaBoostColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(sulfSeaBoostMessage), sulfSeaBoostColor); - } - //set a timer for acid rain to start after 10 seconds - CalamityWorld.forceRainTimer = 601; + CalamityUtils.DisplayLocalizedText(sulfSeaBoostKey, sulfSeaBoostColor); + //set a timer for acid rain to start after 10 seconds + CalamityWorld.forceRainTimer = 601; } // Mark Aquatic Scourge as dead CalamityWorld.downedAquaticScourge = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { 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); - } + 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); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/AquaticScourgeGores/ASHead"), 1f); } } @@ -241,20 +250,14 @@ namespace CalamityMod.NPCs.AquaticScourge public override bool CheckActive() { if (npc.Calamity().newAI[0] == 1f && !Main.player[npc.target].dead && npc.Calamity().newAI[1] != 1f) - { return false; - } + return true; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 360, true); - player.AddBuff(BuffID.Venom, 360, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - } + player.AddBuff(ModContent.BuffType(), 360, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index e7e675c560..7cb06929d0 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,5 +1,9 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,8 +19,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = 45; - npc.width = 32; + npc.GetNPCDamage(); + npc.width = 32; npc.height = 32; npc.defense = 25; npc.DR_NERD(0.15f); @@ -24,13 +28,9 @@ namespace CalamityMod.NPCs.AquaticScourge aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.LifeMaxNERB(73000, 85000, 10000000); + npc.LifeMaxNERB(80000, 92000, 1000000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.chaseable = false; npc.canGhostHeal = false; - if (CalamityWorld.death || CalamityWorld.bossRushActive) + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) npc.scale = 1.2f; else if (CalamityWorld.revenge) npc.scale = 1.15f; @@ -49,7 +49,19 @@ namespace CalamityMod.NPCs.AquaticScourge npc.scale = 1.1f; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 4; 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(); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } @@ -59,7 +71,29 @@ namespace CalamityMod.NPCs.AquaticScourge CalamityAI.AquaticScourgeAI(npc, mod, false); } - public override bool? CanBeHitByProjectile(Projectile projectile) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); + Color color = npc.GetAlpha(lightColor); + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[3] > 480f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[3] - 480f) / 180f, 0f, 1f)); + + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) { @@ -81,7 +115,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -103,8 +137,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/AquaticScourge/AquaticSeekerBody.cs b/NPCs/AquaticScourge/AquaticSeekerBody.cs index 54053ab9de..853a3fb6ec 100644 --- a/NPCs/AquaticScourge/AquaticSeekerBody.cs +++ b/NPCs/AquaticScourge/AquaticSeekerBody.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Placeables.Banners; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -16,23 +15,15 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = Main.hardMode ? 30 : 15; + npc.damage = 15; npc.width = 16; npc.height = 16; npc.defense = 10; - npc.lifeMax = Main.hardMode ? 500 : 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } + npc.lifeMax = 60; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -51,54 +42,47 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + 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); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = 1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = -1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } } + 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); @@ -128,14 +112,11 @@ namespace CalamityMod.NPCs.AquaticScourge npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = 1; - } else if (num191 > 0f) - { npc.spriteDirection = -1; - } } } diff --git a/NPCs/AquaticScourge/AquaticSeekerHead.cs b/NPCs/AquaticScourge/AquaticSeekerHead.cs index 812a0741fe..e367cd63e8 100644 --- a/NPCs/AquaticScourge/AquaticSeekerHead.cs +++ b/NPCs/AquaticScourge/AquaticSeekerHead.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.World; using Microsoft.Xna.Framework; using System; using Terraria; @@ -24,21 +23,13 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = Main.hardMode ? 40 : 20; + npc.damage = 20; npc.width = 22; npc.height = 28; npc.defense = 5; - npc.lifeMax = Main.hardMode ? 500 : 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } + npc.lifeMax = 60; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 0, 80); npc.behindTiles = true; @@ -53,15 +44,14 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(true); } - npc.velocity.Length(); if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned && npc.ai[0] == 0f) @@ -105,7 +95,7 @@ namespace CalamityMod.NPCs.AquaticScourge { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(ModContent.NPCType())) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) { npc.active = false; } @@ -284,35 +274,9 @@ namespace CalamityMod.NPCs.AquaticScourge } } - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 60); - } + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/AquaticScourge/AquaticSeekerTail.cs b/NPCs/AquaticScourge/AquaticSeekerTail.cs index cafbb6386b..acf7b445b5 100644 --- a/NPCs/AquaticScourge/AquaticSeekerTail.cs +++ b/NPCs/AquaticScourge/AquaticSeekerTail.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Placeables.Banners; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -16,23 +15,15 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - npc.damage = Main.hardMode ? 15 : 5; + npc.damage = 5; npc.width = 16; npc.height = 22; npc.defense = 20; - npc.lifeMax = Main.hardMode ? 500 : 60; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 60000; - } + npc.lifeMax = 60; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -51,54 +42,47 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + 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); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = 1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = -1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } } + 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); @@ -128,14 +112,11 @@ namespace CalamityMod.NPCs.AquaticScourge npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = 1; - } else if (num191 > 0f) - { npc.spriteDirection = -1; - } } } diff --git a/NPCs/AquaticScourge/AquaticUrchin.cs b/NPCs/AquaticScourge/AquaticUrchin.cs index a2adc34731..b8e1710feb 100644 --- a/NPCs/AquaticScourge/AquaticUrchin.cs +++ b/NPCs/AquaticScourge/AquaticUrchin.cs @@ -1,6 +1,6 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,15 +23,7 @@ namespace CalamityMod.NPCs.AquaticScourge npc.height = 40; npc.defense = 10; npc.lifeMax = Main.hardMode ? 300 : 50; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } npc.knockBackResist = 0.8f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 0, 80); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath15; @@ -47,7 +39,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index b42a0d3920..c7aa291415 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -26,8 +26,8 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { npc.damage = 50; - npc.width = 56; - npc.height = 54; + npc.width = 66; + npc.height = 64; npc.aiStyle = 41; npc.defense = 14; npc.DR_NERD(0.15f); @@ -37,7 +37,6 @@ namespace CalamityMod.NPCs.Astral npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 85; diff --git a/NPCs/Astral/Aries.png b/NPCs/Astral/Aries.png index 601d4ab743..29bdfbb473 100644 Binary files a/NPCs/Astral/Aries.png and b/NPCs/Astral/Aries.png differ diff --git a/NPCs/Astral/AriesGlow.png b/NPCs/Astral/AriesGlow.png index 908836638e..ed0cfb23cd 100644 Binary files a/NPCs/Astral/AriesGlow.png and b/NPCs/Astral/AriesGlow.png differ diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index ca0288334e..19031a1f44 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.Astral npc.DeathSound = SoundID.NPCDeath14; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 30; @@ -222,7 +221,7 @@ namespace CalamityMod.NPCs.Astral 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, 4f + npc.gfxOffY); + 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); diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 823eeb5d01..4573ff85c5 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -23,8 +23,8 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { npc.damage = 40; - npc.width = 44; - npc.height = 28; + npc.width = 36; + npc.height = 31; npc.aiStyle = 1; npc.defense = 8; npc.lifeMax = 200; @@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.BlueSlime; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 65; @@ -84,8 +83,7 @@ namespace CalamityMod.NPCs.Astral int oreMin = Main.expertMode ? 11 : 8; int oreMax = Main.expertMode ? 16 : 12; DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedStarGod, oreMin, oreMax); - float slimeStaffDrop = (CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.03f); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, slimeStaffDrop, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 0.05f, 1, 1); } } } diff --git a/NPCs/Astral/AstralSlime.png b/NPCs/Astral/AstralSlime.png index 121e7e9173..155317e97f 100644 Binary files a/NPCs/Astral/AstralSlime.png and b/NPCs/Astral/AstralSlime.png differ diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 9b70b290a9..49b04aa869 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -45,9 +45,6 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.WallCreeper; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[BuffID.Confused] = false; if (CalamityWorld.downedAstrageldon) { npc.damage = 90; diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 7a016831c3..d0db01ba81 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -42,13 +42,10 @@ namespace CalamityMod.NPCs.Astral npc.knockBackResist = 0f; npc.noGravity = true; npc.value = Item.buyPrice(0, 0, 20, 0); - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[BuffID.Confused] = false; npc.timeLeft = NPC.activeTime * 2; animationType = NPCID.BlackRecluseWall; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 90; diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 4e58b5c791..5d0dd8115c 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -101,7 +101,8 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { - npc.lavaImmune = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.lavaImmune = true; npc.width = 78; npc.height = 88; npc.damage = 70; @@ -114,7 +115,6 @@ namespace CalamityMod.NPCs.Astral npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AtlasDeath"); banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 100; @@ -616,18 +616,18 @@ namespace CalamityMod.NPCs.Astral } else if (spawnInfo.player.InAstral(1) && NPC.downedAncientCultist && !CalamityWorld.downedStarGod) { - return 0.18f; + return 0.27f; } else if (spawnInfo.player.InAstral(1)) { - return 0.06f; + return 0.09f; } return 0f; } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(ModContent.BuffType(), 300, true); } public override void NPCLoot() diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index cb11cdb772..f0947b4215 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = -1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 85; diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 626ed46787..8b8f519211 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -41,7 +41,6 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.SandShark; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 65; diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 1e36ba89e4..e581f4b28e 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.Astral npc.value = Item.buyPrice(0, 0, 15, 0); banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 80; @@ -203,7 +202,7 @@ namespace CalamityMod.NPCs.Astral { DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 2, 1, 2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 2, 2, 3); } } } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index e7c160b5d8..dd341acca9 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { npc.width = 38; - npc.height = 60; + npc.height = 62; npc.aiStyle = -1; npc.damage = 55; npc.defense = 15; @@ -38,7 +38,6 @@ namespace CalamityMod.NPCs.Astral npc.value = Item.buyPrice(0, 0, 15, 0); banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 90; diff --git a/NPCs/Astral/Hive.png b/NPCs/Astral/Hive.png index fcd1ef8827..f3350a53e8 100644 Binary files a/NPCs/Astral/Hive.png and b/NPCs/Astral/Hive.png differ diff --git a/NPCs/Astral/HiveGlow.png b/NPCs/Astral/HiveGlow.png index eae1314103..e3c9ac019a 100644 Binary files a/NPCs/Astral/HiveGlow.png and b/NPCs/Astral/HiveGlow.png differ diff --git a/NPCs/Astral/Hiveling.cs b/NPCs/Astral/Hiveling.cs index 13edef2367..e578b40fa1 100644 --- a/NPCs/Astral/Hiveling.cs +++ b/NPCs/Astral/Hiveling.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.Astral npc.knockBackResist = 0.5f; npc.noGravity = true; npc.value = Item.buyPrice(0, 0, 5, 0); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 50; @@ -64,6 +63,18 @@ namespace CalamityMod.NPCs.Astral 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; + if (!myTarget.dead && myTarget.active) + { + npc.spriteDirection = npc.direction = (toTarget.X > 0).ToDirectionInt(); + } + else + { + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + } + if (npc.spriteDirection == 1) + npc.rotation += MathHelper.Pi; } } diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 1e7d63a62a..b4dc0af2c4 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -28,7 +28,8 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { - npc.damage = 55; + npc.Calamity().canBreakPlayerDefense = true; + npc.damage = 55; npc.width = 60; npc.height = 58; npc.aiStyle = -1; @@ -40,7 +41,6 @@ namespace CalamityMod.NPCs.Astral npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 85; diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index b872bba02a..51d013c589 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -48,7 +48,6 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = -1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 75; diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index d09d79a452..1e0409db31 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.Astral npc.aiStyle = -1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; if (CalamityWorld.downedAstrageldon) { npc.damage = 58; diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index 3e1006dd62..f24a9e2a74 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -41,8 +41,6 @@ namespace CalamityMod.NPCs.Astral animationType = NPCID.GiantFlyingFox; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[BuffID.Confused] = false; if (CalamityWorld.downedAstrageldon) { npc.damage = 90; diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 870e531655..c3b4448cbb 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -1,5 +1,4 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -20,7 +19,6 @@ using System.IO; using System.Threading; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.AstrumAureus @@ -42,54 +40,24 @@ namespace CalamityMod.NPCs.AstrumAureus npc.lavaImmune = true; npc.noGravity = true; npc.npcSlots = 15f; - npc.damage = 80; - npc.width = 400; + npc.GetNPCDamage(); + npc.Calamity().canBreakPlayerDefense = true; + npc.width = 400; npc.height = 280; - npc.defense = 50; + npc.defense = 40; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(96000, NPC.downedMoonlord ? 440000 : 122000, 8400000); // 30 seconds in boss rush + npc.LifeMaxNERB(84000, NPC.downedMoonlord ? 292500 : 107000, 740000); // 30 seconds in boss rush npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 15, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.Venom] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("Astrageldon") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); if (NPC.downedMoonlord && CalamityWorld.revenge) { - npc.value = Item.buyPrice(0, 35, 0, 0); + npc.value = Item.buyPrice(0, 25, 0, 0); } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -100,14 +68,20 @@ namespace CalamityMod.NPCs.AstrumAureus writer.Write(stomping); writer.Write(npc.dontTakeDamage); writer.Write(npc.chaseable); - } + writer.Write(npc.alpha); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { stomping = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); - } + npc.alpha = reader.ReadInt32(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { @@ -280,7 +254,7 @@ namespace CalamityMod.NPCs.AstrumAureus } int frameCount = Main.npcFrameCount[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / frameCount / 2)); + 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; @@ -298,16 +272,16 @@ namespace CalamityMod.NPCs.AstrumAureus Color color38 = drawColor; color38 = Color.Lerp(color38, color36, amount9); 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)NPCTexture.Width, (float)(NPCTexture.Height / frameCount)) * scale / 2f; + color38 *= (num153 - num155) / 15f; + 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; - vector43 -= new Vector2((float)NPCTexture.Width, (float)(NPCTexture.Height / frameCount)) * scale / 2f; + 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); @@ -323,9 +297,9 @@ namespace CalamityMod.NPCs.AstrumAureus Color color41 = color40; color41 = Color.Lerp(color41, color36, amount9); 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)GlowMaskTexture.Width, (float)(GlowMaskTexture.Height / frameCount)) * scale / 2f; + color41 *= (num153 - num163) / 15f; + 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); } @@ -346,9 +320,11 @@ namespace CalamityMod.NPCs.AstrumAureus { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Astrum Aureus + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedAstrageldon); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedAstrageldon, 4, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard, ModContent.NPCType() }, CalamityWorld.downedAstrageldon); @@ -360,7 +336,7 @@ namespace CalamityMod.NPCs.AstrumAureus DropHelper.DropItemSpray(npc, ItemID.FallenStar, 25, 40); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -378,7 +354,7 @@ namespace CalamityMod.NPCs.AstrumAureus } // Drop an Astral Meteor if applicable - ThreadPool.QueueUserWorkItem(WorldGenerationMethods.AstralMeteorThreadWrapper); + ThreadPool.QueueUserWorkItem(_ => AstralBiome.PlaceAstralMeteor()); // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops if (!CalamityWorld.downedAstrageldon) @@ -387,21 +363,13 @@ namespace CalamityMod.NPCs.AstrumAureus string key2 = "Mods.CalamityMod.AureusBossText2"; Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(key2, messageColor); } // Mark Astrum Aureus as dead CalamityWorld.downedAstrageldon = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void HitEffect(int hitDirection, double damage) @@ -418,12 +386,12 @@ namespace CalamityMod.NPCs.AstrumAureus } 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.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 - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(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 < 50; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -431,7 +399,7 @@ namespace CalamityMod.NPCs.AstrumAureus if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 100; num623++) @@ -448,7 +416,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 625da296da..542c154698 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -22,26 +22,16 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetDefaults() { - npc.aiStyle = -1; + npc.Calamity().canBreakPlayerDefense = true; + npc.aiStyle = -1; aiType = -1; - npc.damage = 0; - npc.width = 90; + npc.GetNPCDamage(); + npc.width = 90; npc.height = 60; npc.alpha = 255; - npc.defense = 0; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.999999f; - global.unbreakableDR = true; - npc.lifeMax = Main.expertMode ? 1007 : 1012; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 1002; - } + npc.defense = 10; + npc.lifeMax = 3000; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -49,21 +39,26 @@ namespace CalamityMod.NPCs.AstrumAureus npc.DeathSound = SoundID.NPCDeath1; } - 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() + public override void AI() { + 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); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; + npc.spriteDirection = npc.direction; + if (npc.alpha > 0) { npc.alpha -= 5; @@ -76,22 +71,33 @@ namespace CalamityMod.NPCs.AstrumAureus num = num245; } } - npc.TargetClosest(true); - if (npc.life <= 1000 || Main.dayTime) + + npc.TargetClosest(); + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + if (lifeRatio <= 0.5f || Main.dayTime) { - npc.dontTakeDamage = true; + 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 (vector.Length() < 60f || flag121) + if (npc.ai[1] > 300f) + { + 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) { - npc.dontTakeDamage = false; + npc.dontTakeDamage = false; CheckDead(); npc.life = 0; return; } - float num1372 = CalamityWorld.bossRushActive ? 24f : 18f; + 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; @@ -103,17 +109,18 @@ namespace CalamityMod.NPCs.AstrumAureus npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; return; } - float num1446 = CalamityWorld.bossRushActive ? 10f : 7f; + + float num1446 = 7f; int num1447 = 480; - float num244; if (npc.localAI[1] == 1f) { npc.localAI[1] = 0f; if (Main.rand.NextBool(4)) { - npc.ai[0] = (float)num1447; + npc.ai[0] = num1447; } } + 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); @@ -132,6 +139,7 @@ namespace CalamityMod.NPCs.AstrumAureus { npc.velocity *= 0.98f; } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) { Main.PlaySound(SoundID.Item8, npc.Center); @@ -160,11 +168,9 @@ namespace CalamityMod.NPCs.AstrumAureus num = num1451; } } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)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(); @@ -207,8 +213,16 @@ namespace CalamityMod.NPCs.AstrumAureus } } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + if (npc.Calamity().newAI[0] >= 45f) + return false; + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -229,14 +243,14 @@ namespace CalamityMod.NPCs.AstrumAureus 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -251,7 +265,7 @@ namespace CalamityMod.NPCs.AstrumAureus 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -289,16 +303,18 @@ namespace CalamityMod.NPCs.AstrumAureus player.AddBuff(ModContent.BuffType(), 120, true); } - public override bool CheckDead() + public override bool PreNPCLoot() => false; + + 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 = 150; - npc.width = npc.height = 216; + npc.damage = 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 < 15; num621++) + 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); Main.dust[num622].velocity *= 3f; @@ -309,7 +325,7 @@ namespace CalamityMod.NPCs.AstrumAureus } Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + 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); Main.dust[num624].noGravity = true; diff --git a/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2.png b/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2.png new file mode 100644 index 0000000000..80988be266 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodyGlow3.png b/NPCs/AstrumDeus/AstrumDeusBodyGlow3.png new file mode 100644 index 0000000000..a84bb78a17 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyGlow3.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodyGlow4.png b/NPCs/AstrumDeus/AstrumDeusBodyGlow4.png new file mode 100644 index 0000000000..30363b9f3d Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusBodyGlow4.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index 1581dd2df0..b9791d57d8 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -19,19 +21,19 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetDefaults() { - npc.damage = 100; - npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 38; npc.height = 44; npc.defense = 50; - npc.LifeMaxNERB(187500, 225000, 6500000); + npc.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.scale = 1.2f; - if (Main.expertMode) + if (Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice) { npc.scale = 1.35f; } @@ -41,29 +43,25 @@ namespace CalamityMod.NPCs.AstrumDeus npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); npc.netAlways = true; npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; npc.dontCountMe = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -82,7 +80,11 @@ namespace CalamityMod.NPCs.AstrumDeus if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = npc.localAI[3] == 1f ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral") : Main.npcTexture[npc.type]; + bool altBodyTextures = npc.localAI[3] == 1f; + bool drawCyan = npc.Calamity().newAI[3] >= 600f; + bool doubleWormPhase = npc.Calamity().newAI[0] != 0f; + + 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); Color color36 = Color.White; @@ -99,20 +101,25 @@ namespace CalamityMod.NPCs.AstrumDeus 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/AstrumDeus/AstrumDeusBodyAltGlow") : ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow"); - Color phaseColor = npc.Calamity().newAI[3] >= 600f ? Color.Cyan : Color.Orange; - Color color37 = Color.Lerp(Color.White, npc.Calamity().newAI[0] != 0f ? phaseColor : Color.Cyan, 0.5f) * npc.Opacity; - Color color42 = Color.Lerp(Color.White, npc.Calamity().newAI[0] != 0f ? phaseColor : Color.Orange, 0.5f) * npc.Opacity; + texture2D15 = altBodyTextures ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow") : ModContent.GetTexture("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; + } + Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * npc.Opacity; + Color color42 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * npc.Opacity; if (CalamityConfig.Instance.Afterimages) { @@ -123,10 +130,10 @@ namespace CalamityMod.NPCs.AstrumDeus 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - if (npc.localAI[3] != 1f) + if (!altBodyTextures) { Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); @@ -136,10 +143,16 @@ namespace CalamityMod.NPCs.AstrumDeus } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + int timesToDraw = drawCyan ? 1 : 2; + for (int i = 0; i < timesToDraw; i++) + spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - if (npc.localAI[3] != 1f) - spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + if (!altBodyTextures) + { + timesToDraw = drawCyan ? 2 : 1; + for (int i = 0; i < timesToDraw; i++) + spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } return false; } @@ -198,7 +211,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusHeadGlow3.png b/NPCs/AstrumDeus/AstrumDeusHeadGlow3.png new file mode 100644 index 0000000000..fc07ca9a11 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHeadGlow3.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHeadGlow4.png b/NPCs/AstrumDeus/AstrumDeusHeadGlow4.png new file mode 100644 index 0000000000..cfa0f73fb3 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusHeadGlow4.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 98993a144f..9b0f7640d1 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -34,51 +35,48 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetDefaults() { - npc.damage = 120; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 56; npc.height = 56; npc.defense = 25; - npc.LifeMaxNERB(187500, 225000, 6500000); + npc.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.scale = 1.2f; - if (Main.expertMode) + if (Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice) { npc.scale = 1.35f; } npc.boss = true; - npc.value = Item.buyPrice(0, 20, 0, 0); + npc.value = Item.buyPrice(0, 25, 0, 0); npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() @@ -97,6 +95,9 @@ namespace CalamityMod.NPCs.AstrumDeus if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; + bool drawCyan = npc.Calamity().newAI[3] >= 600f; + bool doubleWormPhase = npc.Calamity().newAI[0] != 0f; + 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); @@ -114,20 +115,25 @@ namespace CalamityMod.NPCs.AstrumDeus 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); - Color phaseColor = npc.Calamity().newAI[3] >= 600f ? Color.Cyan : Color.Orange; - Color color37 = Color.Lerp(Color.White, npc.Calamity().newAI[0] != 0f ? phaseColor : Color.Cyan, 0.5f) * npc.Opacity; - Color color42 = Color.Lerp(Color.White, npc.Calamity().newAI[0] != 0f ? phaseColor : Color.Orange, 0.5f) * npc.Opacity; + 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; + } + Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * npc.Opacity; + Color color42 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * npc.Opacity; if (CalamityConfig.Instance.Afterimages) { @@ -138,7 +144,7 @@ namespace CalamityMod.NPCs.AstrumDeus 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, 4f + npc.gfxOffY); + 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; @@ -148,9 +154,13 @@ namespace CalamityMod.NPCs.AstrumDeus } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + int timesToDraw = 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(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + timesToDraw = drawCyan ? 2 : 1; + for (int i = 0; i < timesToDraw; i++) + spriteBatch.Draw(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; } @@ -186,13 +196,7 @@ namespace CalamityMod.NPCs.AstrumDeus } } - public override void BossLoot(ref string name, ref int potionType) - { - if (npc.Calamity().newAI[0] == 0f) - return; - - potionType = ModContent.ItemType(); - } + public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType(); public override bool SpecialNPCLoot() { @@ -209,16 +213,35 @@ namespace CalamityMod.NPCs.AstrumDeus public override void NPCLoot() { - if (npc.Calamity().newAI[0] == 0f) + // Unsplit Deus does not drop anything when killed/despawned. + if (npc.Calamity().newAI[0] == 0f) return; + // 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) + { + // Kill the other worm head after setting it to not drop loot. + otherWormHead.Calamity().newAI[0] = 0f; + otherWormHead.life = 0; + otherWormHead.checkDead(); + otherWormHead.netUpdate = true; + } + } + DropHelper.DropBags(npc); - DropHelper.DropItem(npc, ItemID.GreaterHealingPotion, 8, 14); + // Legendary drops for Astrum Deus + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + 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.DropResidentEvilAmmo(npc, CalamityWorld.downedStarGod, 4, 2, 1); // Drop a large spray of all 4 lunar fragments int minFragments = Main.expertMode ? 20 : 12; @@ -235,7 +258,7 @@ namespace CalamityMod.NPCs.AstrumDeus DropHelper.DropItemSpray(npc, ItemID.FallenStar, 80, 150); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -244,10 +267,7 @@ namespace CalamityMod.NPCs.AstrumDeus DropHelper.WeightStack(w) ); - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); // Vanity @@ -259,15 +279,12 @@ namespace CalamityMod.NPCs.AstrumDeus { string key = "Mods.CalamityMod.AstralBossText"; Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); } // Mark Astrum Deus as dead CalamityWorld.downedStarGod = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/AstrumDeus/AstrumDeusTailGlow2.png b/NPCs/AstrumDeus/AstrumDeusTailGlow2.png new file mode 100644 index 0000000000..b511857357 Binary files /dev/null and b/NPCs/AstrumDeus/AstrumDeusTailGlow2.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 0c0ef1fe72..3c533db815 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -19,19 +21,19 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetDefaults() { - npc.damage = 80; - npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 52; npc.height = 68; npc.defense = 75; - npc.LifeMaxNERB(187500, 225000, 6500000); + npc.LifeMaxNERB(200000, 240000, 650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.scale = 1.2f; - if (Main.expertMode) + if (Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice) { npc.scale = 1.35f; } @@ -41,29 +43,25 @@ namespace CalamityMod.NPCs.AstrumDeus npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath"); npc.netAlways = true; npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("AstrumDeus") ?? MusicID.Boss3; npc.dontCountMe = true; } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -82,6 +80,9 @@ namespace CalamityMod.NPCs.AstrumDeus if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; + bool drawCyan = npc.Calamity().newAI[3] >= 600f; + bool doubleWormPhase = npc.Calamity().newAI[0] != 0f; + 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; @@ -98,19 +99,23 @@ namespace CalamityMod.NPCs.AstrumDeus 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); - Color phaseColor = npc.Calamity().newAI[3] >= 600f ? Color.Cyan : Color.Orange; - Color color37 = Color.Lerp(Color.White, npc.Calamity().newAI[0] != 0f ? phaseColor : Color.Orange, 0.5f) * npc.Opacity; + Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; + if (doubleWormPhase) + { + texture2D15 = drawCyan ? ModContent.GetTexture("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2") : texture2D15; + } + Color color37 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * npc.Opacity; if (CalamityConfig.Instance.Afterimages) { @@ -121,12 +126,14 @@ namespace CalamityMod.NPCs.AstrumDeus 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, 4f + npc.gfxOffY); + 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); + int timesToDraw = drawCyan ? 2 : 1; + for (int i = 0; i < timesToDraw; i++) + spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; } @@ -185,7 +192,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index b9898e609c..e763bc5f72 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -16,7 +17,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { private bool boostDR = false; public static float normalDR = 0.15f; - public static float boostedDR = 0.8f; + public static float boostedDR = 0.6f; public override void SetStaticDefaults() { @@ -33,36 +34,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.height = 60; npc.defense = 0; npc.DR_NERD(normalDR); - npc.lifeMax = 4000; + npc.lifeMax = 2000; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -70,11 +43,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.DeathSound = SoundID.NPCDeath39; if (CalamityWorld.downedProvidence) { - npc.lifeMax = 40000; + npc.lifeMax = 26000; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } } @@ -99,8 +72,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.netUpdate = true; return; } - bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.1; - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + + 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; @@ -113,9 +87,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental } // Set DR based on boost status - npc.Calamity().DR = boostDR ? boostedDR : CalamityWorld.revenge ? normalDR : 0f; + npc.Calamity().DR = boostDR ? boostedDR : normalDR; - float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); + float num1446 = goIntoShell ? 1f : 6f; int num1447 = 480; if (npc.localAI[1] == 1f) { @@ -132,12 +106,12 @@ namespace CalamityMod.NPCs.BrimstoneElemental 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] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= (CalamityWorld.malice ? 180f : 360f) && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) { 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 = CalamityWorld.bossRushActive ? 7.5f : 5f; + 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(-10, 11); float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); @@ -145,8 +119,9 @@ namespace CalamityMod.NPCs.BrimstoneElemental num8 = speed / num8; num6 *= num8; num7 *= num8; - int projectileDamage = Main.expertMode ? 28 : 35; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, ModContent.ProjectileType(), projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + 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, 0f, 0f); } } if (vector251.Length() > 400f || !flag104) diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 4145c72e53..b3d2ff17cf 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -9,13 +9,13 @@ using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.BrimstoneElemental @@ -32,18 +32,18 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void SetDefaults() { npc.npcSlots = 64f; - npc.damage = 60; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 150; npc.defense = 15; npc.value = Item.buyPrice(0, 12, 0, 0); - npc.LifeMaxNERB(30000, 41000, 6500000); + npc.LifeMaxNERB(30000, 41000, 650000); npc.DR_NERD(0.15f); - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; npc.defense *= 4; - npc.lifeMax *= 8; + npc.lifeMax *= 5; npc.value *= 3f; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -51,45 +51,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; npc.HitSound = SoundID.NPCHit23; npc.DeathSound = SoundID.NPCDeath39; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone"); - else - music = MusicID.Boss4; + music = CalamityMod.Instance.GetMusicFromMusicMod("LeftAlone") ?? MusicID.Boss4; bossBag = ModContent.ItemType(); } @@ -98,13 +66,17 @@ namespace CalamityMod.NPCs.BrimstoneElemental writer.Write(npc.chaseable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); - } + for (int i = 0; i < 4; 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(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() @@ -114,13 +86,10 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } + player.AddBuff(ModContent.BuffType(), 180, true); } - public override void FindFrame(int frameHeight) //9 total frames + public override void FindFrame(int frameHeight) // 9 total frames { npc.frameCounter += 1.0; if (npc.ai[0] <= 2f) @@ -178,10 +147,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Brimstone Elemental + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBrimstoneElemental); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBrimstoneElemental, 4, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, CalamityWorld.downedBrimstoneElemental); @@ -192,7 +164,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 1f, 20, 30); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -200,7 +172,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental ); // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); // Vanity @@ -211,22 +183,17 @@ namespace CalamityMod.NPCs.BrimstoneElemental string key2 = "Mods.CalamityMod.BrimmyBossText"; Color messageColor2 = Color.Crimson; if (!CalamityWorld.downedBrimstoneElemental) - { - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key2), messageColor2); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } + CalamityUtils.DisplayLocalizedText(key2, messageColor2); // mark brimmy as dead CalamityWorld.downedBrimstoneElemental = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Bumblebirb/Birb.png b/NPCs/Bumblebirb/Birb.png index afd119a6d9..96e58ba41f 100644 Binary files a/NPCs/Bumblebirb/Birb.png and b/NPCs/Bumblebirb/Birb.png differ diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index e5f9584873..5f19f42c20 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -35,48 +37,24 @@ namespace CalamityMod.NPCs.Bumblebirb public override void SetDefaults() { - npc.npcSlots = 32f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 32f; npc.aiStyle = -1; aiType = -1; - npc.damage = 160; - npc.width = 130; + npc.GetNPCDamage(); + npc.width = 130; npc.height = 100; npc.defense = 40; npc.DR_NERD(0.1f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(227500, 252500, 3000000); + npc.LifeMaxNERB(170625, 189375, 300000); // Old HP - 227500, 252500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm"); - else - music = MusicID.Boss4; + npc.noTileCollide = true; + music = CalamityMod.Instance.GetMusicFromMusicMod("Murderswarm") ?? MusicID.Boss4; npc.lavaImmune = true; npc.noGravity = true; npc.value = Item.buyPrice(0, 30, 0, 0); @@ -92,6 +70,8 @@ namespace CalamityMod.NPCs.Bumblebirb 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]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -101,6 +81,8 @@ namespace CalamityMod.NPCs.Bumblebirb 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(); } public override void AI() @@ -118,12 +100,16 @@ namespace CalamityMod.NPCs.Bumblebirb { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || CalamityWorld.malice || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); @@ -203,11 +189,15 @@ namespace CalamityMod.NPCs.Bumblebirb { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || CalamityWorld.malice || BossRushEvent.BossRushActive; // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; // Phases bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; @@ -275,7 +265,7 @@ namespace CalamityMod.NPCs.Bumblebirb 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, 4f + npc.gfxOffY); + vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -330,7 +320,7 @@ namespace CalamityMod.NPCs.Bumblebirb 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, 4f + npc.gfxOffY); + vector42 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector42, npc.frame, color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -340,7 +330,7 @@ namespace CalamityMod.NPCs.Bumblebirb 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, 4f + npc.gfxOffY); + 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) @@ -371,7 +361,7 @@ namespace CalamityMod.NPCs.Bumblebirb 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } @@ -383,7 +373,7 @@ namespace CalamityMod.NPCs.Bumblebirb 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, 4f + npc.gfxOffY); + vector45 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector45, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -406,16 +396,18 @@ namespace CalamityMod.NPCs.Bumblebirb public override void BossLoot(ref string name, ref int potionType) { name = "A Dragonfolly"; - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } public override void NPCLoot() { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Dragonfolly + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBumble); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBumble, 5, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor }, CalamityWorld.downedBumble); @@ -426,15 +418,13 @@ namespace CalamityMod.NPCs.Bumblebirb DropHelper.DropItemSpray(npc, ModContent.ItemType(), 11, 17); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w) ); - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - // Equipment DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); @@ -444,13 +434,13 @@ namespace CalamityMod.NPCs.Bumblebirb // Mark The Dragonfolly as dead CalamityWorld.downedBumble = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index b297c15e81..a24dd7120c 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -26,35 +26,14 @@ namespace CalamityMod.NPCs.Bumblebirb npc.npcSlots = 1f; npc.aiStyle = -1; aiType = -1; - npc.damage = 110; - npc.width = 120; + npc.GetNPCDamage(); + npc.width = 120; npc.height = 80; npc.defense = 20; - npc.LifeMaxNERB(20000, 25000, 60000); + npc.LifeMaxNERB(9000, 11250, 5000); // Old HP - 12000, 15000 npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.lavaImmune = true; + npc.noTileCollide = true; npc.noGravity = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit51; @@ -67,14 +46,15 @@ namespace CalamityMod.NPCs.Bumblebirb { return 0f; } - return SpawnCondition.SurfaceJungle.Chance * 0.09f; + return SpawnCondition.SurfaceJungle.Chance * 0.14f; } public override void AI() { + npc.damage = CalamityPlayer.areThereAnyDamnBosses ? npc.defDamage : (int)(npc.defDamage * 0.8); + Player player = Main.player[npc.target]; Vector2 vector = npc.Center; - npc.damage = npc.defDamage; bool increasedAggression = CalamityPlayer.areThereAnyDamnBosses; @@ -89,24 +69,21 @@ namespace CalamityMod.NPCs.Bumblebirb } } - npc.noTileCollide = false; - npc.noGravity = true; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; if (npc.ai[0] == 0f || npc.ai[0] == 1f) { - for (int num1376 = 0; num1376 < Main.maxNPCs; num1376++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (num1376 != npc.whoAmI && Main.npc[num1376].active && Main.npc[num1376].type == npc.type) + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) { - Vector2 value42 = Main.npc[num1376].Center - npc.Center; + Vector2 value42 = Main.npc[i].Center - npc.Center; if (value42.Length() < (npc.width + npc.height)) { value42.Normalize(); value42 *= -0.1f; npc.velocity += value42; - NPC nPC6 = Main.npc[num1376]; + NPC nPC6 = Main.npc[i]; nPC6.velocity -= value42; } } @@ -135,7 +112,6 @@ namespace CalamityMod.NPCs.Bumblebirb { Vector2 value43 = new Vector2(0f, -8f); npc.velocity = (npc.velocity * 21f + value43) / 10f; - npc.noTileCollide = true; npc.dontTakeDamage = true; return; } @@ -144,30 +120,6 @@ namespace CalamityMod.NPCs.Bumblebirb { npc.TargetClosest(true); npc.spriteDirection = npc.direction; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 4f) - { - npc.velocity.X = 4f; - } - if (npc.velocity.X < -4f) - { - npc.velocity.X = -4f; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 4f) - { - npc.velocity.Y = 4f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } Vector2 value44 = Main.player[npc.target].Center - npc.Center; if (value44.Length() > 2800f) { @@ -203,9 +155,6 @@ namespace CalamityMod.NPCs.Bumblebirb { if (npc.ai[0] == 1f) { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) { npc.TargetClosest(true); @@ -253,7 +202,6 @@ namespace CalamityMod.NPCs.Bumblebirb } npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; - npc.noTileCollide = true; Vector2 vector242 = Main.player[npc.target].Center - npc.Center; vector242.Y -= 8f; float scaleFactor22 = increasedAggression ? 18f : 14f; @@ -288,7 +236,6 @@ namespace CalamityMod.NPCs.Bumblebirb } else if (npc.ai[0] == 2.1f) { - npc.damage = (int)(npc.defDamage * 1.3); if (npc.velocity.X < 0f) { npc.direction = -1; @@ -299,7 +246,6 @@ namespace CalamityMod.NPCs.Bumblebirb } npc.spriteDirection = npc.direction; npc.velocity *= 1.01f; - npc.noTileCollide = true; npc.ai[1] += 1f; int num1380 = 30; if (npc.ai[1] > num1380) @@ -322,10 +268,11 @@ namespace CalamityMod.NPCs.Bumblebirb } } - public override bool PreNPCLoot() => !CalamityPlayer.areThereAnyDamnBosses; - public override void NPCLoot() { + if (CalamityPlayer.areThereAnyDamnBosses) + return; + DropHelper.DropItemSpray(npc, ModContent.ItemType(), 2, 4); } @@ -365,14 +312,14 @@ namespace CalamityMod.NPCs.Bumblebirb 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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; diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs deleted file mode 100644 index 7d12b97f01..0000000000 --- a/NPCs/Calamitas/Calamitas.cs +++ /dev/null @@ -1,204 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Calamitas -{ - [AutoloadBossHead] - public class Calamitas : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; - } - - public override void SetDefaults() - { - npc.damage = 55; - npc.npcSlots = 14f; - npc.width = 120; - npc.height = 120; - npc.defense = 15; - npc.DR_NERD(0.15f); - npc.value = 0f; - npc.LifeMaxNERB(37500, 51750, 5200000); - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) - { - npc.damage *= 3; - npc.defense *= 3; - npc.lifeMax *= 3; - } - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.boss = true; - npc.noGravity = true; - npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - music = MusicID.Boss2; - } - - 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; - } - - public override void AI() - { - CalamityAI.CalamitasCloneAI(npc, mod, false); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - 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)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; - - if (CalamityConfig.Instance.Afterimages) - { - for (int num155 = 1; num155 < num153; num155 += 2) - { - Color color38 = lightColor; - color38 = Color.Lerp(color38, color36, amount9); - 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, 4f + 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/CalamitasGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); - - if (CalamityConfig.Instance.Afterimages) - { - for (int num163 = 1; num163 < num153; num163++) - { - 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, 4f + 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); - - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, hitDirection, -1f, 0, default, 1f); - } - } - else - { - 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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - } - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - 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) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - player.AddBuff(ModContent.BuffType(), 300, true); - } - } -} diff --git a/NPCs/Calamitas/Calamitas.png b/NPCs/Calamitas/Calamitas.png deleted file mode 100644 index 11e605674c..0000000000 Binary files a/NPCs/Calamitas/Calamitas.png and /dev/null differ diff --git a/NPCs/Calamitas/CalamitasGlow.png b/NPCs/Calamitas/CalamitasGlow.png deleted file mode 100644 index 740ffc38fb..0000000000 Binary files a/NPCs/Calamitas/CalamitasGlow.png and /dev/null differ diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 54f7f037f0..0129bfff98 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; @@ -9,6 +9,8 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.IO; + namespace CalamityMod.NPCs.Calamitas { [AutoloadBossHead] @@ -23,63 +25,44 @@ namespace CalamityMod.NPCs.Calamitas public override void SetDefaults() { - npc.damage = 60; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 120; npc.height = 120; npc.defense = 10; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(9000, 13200, 800000); - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + npc.LifeMaxNERB(9000, 13200, 80000); + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; npc.defense *= 5; - npc.lifeMax *= 3; + npc.lifeMax *= 5; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; + music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; } + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 4; 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(); + } + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; @@ -115,14 +98,14 @@ namespace CalamityMod.NPCs.Calamitas 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -137,7 +120,7 @@ namespace CalamityMod.NPCs.Calamitas 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -155,8 +138,8 @@ namespace CalamityMod.NPCs.Calamitas public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 12); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 12); + 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) @@ -201,12 +184,7 @@ namespace CalamityMod.NPCs.Calamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(ModContent.BuffType(), 180, true); - } - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index a874d2a0b8..e08fe2fdad 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.World; @@ -9,6 +9,8 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.IO; + namespace CalamityMod.NPCs.Calamitas { [AutoloadBossHead] @@ -23,18 +25,19 @@ namespace CalamityMod.NPCs.Calamitas public override void SetDefaults() { - npc.damage = 65; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 120; npc.height = 120; npc.defense = 10; npc.DR_NERD(0.15f); - npc.LifeMaxNERB(7500, 11025, 800000); - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + npc.LifeMaxNERB(7500, 11025, 80000); + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; npc.defense *= 5; - npc.lifeMax *= 3; + npc.lifeMax *= 5; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -43,43 +46,23 @@ namespace CalamityMod.NPCs.Calamitas npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; + music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; } + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 4; 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(); + } + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; @@ -115,14 +98,14 @@ namespace CalamityMod.NPCs.Calamitas 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -137,7 +120,7 @@ namespace CalamityMod.NPCs.Calamitas 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -155,7 +138,7 @@ namespace CalamityMod.NPCs.Calamitas public override void NPCLoot() { DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 12); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); } public override void HitEffect(int hitDirection, double damage) @@ -200,12 +183,7 @@ namespace CalamityMod.NPCs.Calamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(ModContent.BuffType(), 180, true); - } - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 4127fea5d2..d5047b4aee 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -35,19 +36,20 @@ namespace CalamityMod.NPCs.Calamitas public override void SetDefaults() { - npc.damage = 70; - npc.npcSlots = 14f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 14f; npc.width = 120; npc.height = 120; npc.defense = 25; npc.value = Item.buyPrice(0, 15, 0, 0); npc.DR_NERD(0.15f); - npc.LifeMaxNERB(28125, 38812, 3900000); - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + npc.LifeMaxNERB(37500, 45000, 520000); + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { npc.damage *= 3; npc.defense *= 3; - npc.lifeMax *= 3; + npc.lifeMax *= 2; npc.value *= 2.5f; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -55,55 +57,29 @@ namespace CalamityMod.NPCs.Calamitas npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; + music = CalamityMod.Instance.GetMusicFromMusicMod("Calamitas") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) @@ -116,7 +92,7 @@ namespace CalamityMod.NPCs.Calamitas public override void AI() { - CalamityAI.CalamitasCloneAI(npc, mod, true); + CalamityAI.CalamitasCloneAI(npc, mod); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -141,14 +117,14 @@ namespace CalamityMod.NPCs.Calamitas 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/CalamitasRun3Glow"); @@ -163,7 +139,7 @@ namespace CalamityMod.NPCs.Calamitas 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -177,10 +153,12 @@ namespace CalamityMod.NPCs.Calamitas { DropHelper.DropBags(npc); - DropHelper.DropItem(npc, ItemID.BrokenHeroSword, true); + // Legendary drop for Cal Clone + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItem(npc, ItemID.BrokenHeroSword, true); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), !CalamityWorld.downedCalamitas); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedCalamitas, 4, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedCalamitas); @@ -193,7 +171,7 @@ namespace CalamityMod.NPCs.Calamitas DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 1f, 30, 40); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -202,7 +180,7 @@ namespace CalamityMod.NPCs.Calamitas ); // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); @@ -217,15 +195,12 @@ namespace CalamityMod.NPCs.Calamitas 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); - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); } // Mark Calamitas as dead CalamityWorld.downedCalamitas = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void BossLoot(ref string name, ref int potionType) @@ -277,17 +252,13 @@ namespace CalamityMod.NPCs.Calamitas public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.damage = (int)(npc.damage * 0.8f); 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 (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/Calamitas_Head_Boss.png b/NPCs/Calamitas/Calamitas_Head_Boss.png deleted file mode 100644 index 2ec7449442..0000000000 Binary files a/NPCs/Calamitas/Calamitas_Head_Boss.png and /dev/null differ diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index bd72406bfb..d676ab6f0a 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -24,19 +24,18 @@ namespace CalamityMod.NPCs.Calamitas npc.height = 30; npc.defense = 8; npc.lifeMax = 200; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + npc.lifeMax = 3000; } npc.aiStyle = 5; aiType = NPCID.Probe; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.25f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.25f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[BuffID.OnFire] = true; } public override bool PreAI() @@ -77,14 +76,14 @@ namespace CalamityMod.NPCs.Calamitas 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 / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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 / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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/Calamitas/LifeSeekerGlow"); @@ -99,7 +98,7 @@ namespace CalamityMod.NPCs.Calamitas 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 / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -109,16 +108,6 @@ namespace CalamityMod.NPCs.Calamitas return false; } - public override bool PreNPCLoot() - { - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 120, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index 1dbcbf1584..dcf59123b9 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -20,6 +21,7 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Soul Seeker"); + Main.npcFrameCount[npc.type] = 5; NPCID.Sets.TrailingMode[npc.type] = 1; } @@ -35,97 +37,80 @@ namespace CalamityMod.NPCs.Calamitas npc.damage = 40; npc.defense = 10; npc.DR_NERD(0.1f); - npc.lifeMax = 2500; - if (CalamityWorld.bossRushActive) + npc.lifeMax = CalamityWorld.death ? 1500 : 2500; + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 150000; + npc.lifeMax = 15000; } - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; } + 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; + } + public override bool PreAI() { // Setting this in SetDefaults will disable expert mode scaling, so put it here instead npc.damage = 0; - bool expertMode = Main.expertMode; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) { npc.active = false; npc.netUpdate = true; return false; } + + NPC parent = Main.npc[CalamityGlobalNPC.calamitas]; if (start) { - for (int num621 = 0; num621 < 15; num621++) + for (int d = 0; d < 15; d++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 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]; start = false; } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= CalamityWorld.bossRushActive ? 14f : 9f; - npc.rotation = direction.ToRotation(); + + npc.TargetClosest(); + + Vector2 velocity = Main.player[npc.target].Center - npc.Center; + velocity.Normalize(); + velocity *= 9f; + npc.rotation = velocity.ToRotation() + MathHelper.Pi; + timer++; if (timer > 60) { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10) && Main.npc[CalamityGlobalNPC.calamitas].ai[1] < 2f) + if (Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(10) && parent.ai[1] < 2f && parent.Calamity().newAI[2] <= 0f) { - if (NPC.CountNPCS(ModContent.NPCType()) < 3) - { - int x = (int)(npc.position.X + Main.rand.Next(npc.width - 25)); - int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 25)); - int num663 = ModContent.NPCType(); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - } - for (int num621 = 0; num621 < 3; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default, 2f); - } - int damage = expertMode ? 25 : 30; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, ModContent.ProjectileType(), damage, 1f, npc.target); + int npcType = ModContent.NPCType(); + if (NPC.CountNPCS(npcType) < 3) + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npcType); + + for (int d = 0; d < 3; d++) + 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); } timer = 0; } - NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; + double deg = npc.ai[1]; double rad = deg * (Math.PI / 180); - double dist = 150; + 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] += 2f; + npc.ai[1] += death ? 0.5f : 2f; return false; } @@ -137,41 +122,34 @@ namespace CalamityMod.NPCs.Calamitas } if (npc.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 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 < 20; num621++) + 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 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; + 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)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[red].scale = 0.5f; + Main.dust[red].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 40; num623++) + for (int d = 0; d < 40; d++) { - 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); - Main.dust[num624].velocity *= 2f; + 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); + Main.dust[red].velocity *= 2f; } } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -179,50 +157,50 @@ namespace CalamityMod.NPCs.Calamitas 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)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 5; + 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; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int a = 1; a < afterImageAmt; a += 2) { - Color color38 = lightColor; - color38 = Color.Lerp(color38, color36, amount9); - 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)) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + Color afterImageColor = lightColor; + afterImageColor = Color.Lerp(afterImageColor, white, colorLerpAmt); + 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 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, 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); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/SoulSeekerGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + texture = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/SoulSeekerGlow"); + Color glow = Color.Lerp(Color.White, Color.Red, colorLerpAmt); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int a = 1; a < afterImageAmt; a++) { - 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)) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + 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); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, drawPos, npc.frame, white, npc.rotation, origin, npc.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Calamitas/SoulSeeker.png b/NPCs/Calamitas/SoulSeeker.png index 93b13e9d0b..02e32b4f45 100644 Binary files a/NPCs/Calamitas/SoulSeeker.png and b/NPCs/Calamitas/SoulSeeker.png differ diff --git a/NPCs/Calamitas/SoulSeekerGlow.png b/NPCs/Calamitas/SoulSeekerGlow.png index ee7fef5c87..b41d2136a9 100644 Binary files a/NPCs/Calamitas/SoulSeekerGlow.png and b/NPCs/Calamitas/SoulSeekerGlow.png differ diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index fb50db4cb0..0f73c6a25b 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; @@ -23,23 +24,26 @@ using Microsoft.Xna.Framework.Audio; using System; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs { public class CalamityAI { + // Master Mode changes + // 1 - Sand clouds spread out far more and more are spawned in instead of sand blasts, 2 - Far longer and larger, 3 - Sand blasts accelerate #region Aquatic Scourge public static void AquaticScourgeAI(NPC npc, Mod mod, bool head) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; // Adjust hostility and stats - if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || CalamityWorld.bossRushActive || + if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive || Main.npc[(int)npc.ai[1]].life <= Main.npc[(int)npc.ai[1]].lifeMax * 0.99) { // Kiss my motherfucking ass you piece of shit game @@ -47,8 +51,14 @@ namespace CalamityMod.NPCs npc.timeLeft *= 20; calamityGlobalNPC.newAI[0] = 1f; + Main.npc[(int)npc.ai[1]].Calamity().newAI[0] = 1f; + Main.npc[(int)npc.ai[2]].Calamity().newAI[0] = 1f; + npc.damage = npc.defDamage; npc.boss = head; + npc.netUpdate = true; + Main.npc[(int)npc.ai[1]].netUpdate = true; + Main.npc[(int)npc.ai[2]].netUpdate = true; } else npc.damage = 0; @@ -56,26 +66,57 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Homing only works if the boss is hostile if (head) npc.chaseable = calamityGlobalNPC.newAI[0] == 1f; // Set worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Get a 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 == 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(); Player player = Main.player[npc.target]; + bool notOcean = player.position.Y < 400f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + float enrageScale = 0f; + if ((!player.Calamity().ZoneSulphur && notOcean) || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + Vector2 vectorCenter = npc.Center; // Circular movement bool doSpiral = false; if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && revenge) { + bool isWet = Collision.WetCollision(npc.position, npc.width, npc.height); float ai3 = 660f; calamityGlobalNPC.newAI[3] += 1f; doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= ai3; @@ -84,11 +125,11 @@ namespace CalamityMod.NPCs // Barf if (calamityGlobalNPC.newAI[3] % 40f == 0f) { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); + Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 13); if (Main.netMode != NetmodeID.MultiplayerClient) { - float num742 = CalamityWorld.bossRushActive ? 12f : 8f; + float num742 = death ? 10f : 8f; float num743 = player.Center.X - vectorCenter.X; float num744 = player.Center.Y - vectorCenter.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); @@ -97,9 +138,10 @@ namespace CalamityMod.NPCs num743 *= num745; num744 *= num745; - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(23, 1.5) : 28; - int numProj = 3; - int spread = 36; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 5 : 3; + int spread = death ? 60 : 36; float rotation = MathHelper.ToRadians(spread); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); double startAngle = Math.Atan2(num743, num744) - rotation / 2; @@ -109,7 +151,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; } } @@ -122,7 +164,7 @@ namespace CalamityMod.NPCs npc.velocity *= 24f; } - // Spin velocity + // Spin velocity float velocity = (float)(Math.PI * 2D) / 120f; npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; @@ -130,16 +172,36 @@ namespace CalamityMod.NPCs // Reset and charge at target if (calamityGlobalNPC.newAI[3] >= ai3 + 120f) { - npc.TargetClosest(true); - calamityGlobalNPC.newAI[3] = 0f; - float chargeVelocity = death ? 16f : 12f; + // Add 2 seconds to timer so that spinning happens more often if Scourge isn't wet when spin ends + calamityGlobalNPC.newAI[3] = isWet ? 0f : 120f; + float chargeVelocity = (death ? 16f : 12f) + 3f * enrageScale; npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; + npc.TargetClosest(); } } else + { + if (isWet && calamityGlobalNPC.newAI[3] > 0f) + calamityGlobalNPC.newAI[3] -= 2f; + npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; + } } + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = doSpiral; + 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[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + if (Main.netMode != NetmodeID.MultiplayerClient) { if (head) @@ -173,65 +235,49 @@ namespace CalamityMod.NPCs } // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral) + if (calamityGlobalNPC.newAI[0] == 1f && !doSpiral && phase2) { npc.localAI[0] += 1f; if (player.gravDir == -1f && expertMode) npc.localAI[0] += 2f; - if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 300f : (revenge ? 360f : 420f))) + if (npc.localAI[0] >= (revenge ? 360f : 420f)) { - int npcPosX = (int)(npc.position.X + (npc.width / 2)) / 16; - int npcPosY = (int)(npc.position.Y + (npc.height / 2)) / 16; - - if (npcPosX < 0) - npcPosX = 0; - if (npcPosX > Main.maxTilesX) - npcPosX = Main.maxTilesX; - if (npcPosY < 0) - npcPosY = 0; - if (npcPosY > Main.maxTilesY) - npcPosY = Main.maxTilesY; - - if (!Main.tile[npcPosX, npcPosY].active() && Vector2.Distance(player.Center, npc.Center) > 300f) + if (Vector2.Distance(player.Center, npc.Center) > 320f) { npc.localAI[0] = 0f; npc.netUpdate = true; - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 13); + Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 13); if (Main.netMode != NetmodeID.MultiplayerClient) { - int damageBoom = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(23, 1.5) : 28; - float velocity = revenge ? 7.5f : 6.5f; - if (death) - velocity += 2f; - if (CalamityWorld.bossRushActive) - velocity = 11f; - - int totalProjectiles = expertMode ? 30 : 20; + float velocity = death ? 9.5f : revenge ? 7.5f : 6.5f; + int totalProjectiles = malice ? 40 : expertMode ? 30 : 20; float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); for (int i = 0; i < totalProjectiles; i++) { - int projectileType = ModContent.ProjectileType(); Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); } - damageBoom = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 33; - int num320 = expertMode ? 14 : 7; - for (int num321 = 0; num321 < num320; num321++) + if (phase3) { - Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401) * 0.01f; + int num320 = malice ? 21 : expertMode ? 14 : 7; + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + for (int num321 = 0; num321 < num320; num321++) + { + Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + vector15.Normalize(); + vector15 *= Main.rand.Next(50, 401) * 0.01f; - if (expertMode) - vector15 *= 1f + (death ? 0.25f : 0.25f * (1f - lifeRatio)); + if (expertMode) + vector15 *= 1f + (death ? 0.25f : 0.25f * (1f - lifeRatio)); - if (CalamityWorld.bossRushActive) - vector15 *= 1.25f; - - Projectile.NewProjectile(npc.Center, vector15, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); + Projectile.NewProjectile(npc.Center, vector15, type, damage, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); + } } } } @@ -244,56 +290,56 @@ namespace CalamityMod.NPCs { if (calamityGlobalNPC.newAI[0] == 1f) { + npc.localAI[0] += 1f; + float shootProjectile = 300; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if (npc.type == ModContent.NPCType()) { - int num = expertMode ? 4 : 3; - npc.localAI[0] += Main.rand.Next(num); - if (npc.localAI[0] >= Main.rand.Next(700, 10000)) + if (npc.localAI[0] % divisor == 0f) { - npc.localAI[0] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 17); + Main.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; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - int projectileType = ModContent.ProjectileType(); - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(25, 1.5) : 30; - float num941 = CalamityWorld.bossRushActive ? 7.5f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float num941 = death ? 9f : 8f; num944 = num941 / num944; num942 *= num944; num943 *= num944; vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer); npc.netUpdate = true; } } } else if (npc.type == ModContent.NPCType()) { - npc.localAI[0] += Main.rand.Next(4); - if (npc.localAI[0] >= Main.rand.Next(700, 10000)) + if (npc.localAI[0] % divisor == 0f) { - npc.localAI[0] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { 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; float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - int projectileType = ModContent.ProjectileType(); - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(23, 1.5) : 28; - float num941 = CalamityWorld.bossRushActive ? 12f : 8f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float num941 = death ? 15f : 12f; num944 = num941 / num944; num942 *= num944; num943 *= num944; vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } } @@ -309,14 +355,17 @@ namespace CalamityMod.NPCs for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { shouldDespawn = false; + break; + } } if (!shouldDespawn) { - if (npc.ai[1] > 0f) - shouldDespawn = false; - else if (Main.npc[(int)npc.ai[1]].life > 0) - shouldDespawn = false; + if (npc.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + shouldDespawn = true; } if (shouldDespawn) { @@ -327,12 +376,8 @@ namespace CalamityMod.NPCs } } - // Despawn - bool notOcean = player.position.Y < 400f || - player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - - if (player.dead || (notOcean && !CalamityWorld.bossRushActive && !player.Calamity().ZoneSulphur)) + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance) { calamityGlobalNPC.newAI[1] = 1f; npc.TargetClosest(false); @@ -394,27 +439,24 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] == 1f) { - num188 = revenge ? 13f : 11f; - num189 = revenge ? 0.14f : 0.12f; + num188 = revenge ? 9f : 7f; + num189 = revenge ? 0.12f : 0.1f; if (expertMode) { - num188 += death ? 4f : 4f * (1f - lifeRatio); - num189 += death ? 0.04f : 0.04f * (1f - lifeRatio); - } - if (notOcean) - { - num188 += 2f; - num189 += 0.02f; + num188 += 8f * (1f - lifeRatio); + num189 += 0.06f * (1f - lifeRatio); } if (player.gravDir == -1f && expertMode) { num188 = 21f; num189 = 0.21f; } - if (CalamityWorld.bossRushActive) + num188 += 3f * enrageScale; + num189 += 0.06f * enrageScale; + if (death) { - num188 = 25f; - num189 = 0.3f; + num188 += Vector2.Distance(player.Center, npc.Center) * 0.004f * (1f - lifeRatio); + num189 += Vector2.Distance(player.Center, npc.Center) * 0.00004f * (1f - lifeRatio); } } @@ -557,6 +599,8 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Cycles between attacks faster, 2 - Brimstone Ray splits off into brimstone darts when fired, 3 - Brimlings stay very close to their mother to act as meat shields #region Brimstone Elemental public static void BrimstoneElementalAI(NPC npc, Mod mod) { @@ -572,15 +616,22 @@ namespace CalamityMod.NPCs Vector2 vectorCenter = npc.Center; // Get a 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 == 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(); Player player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) + + bool despawnDistance = Vector2.Distance(player.Center, vectorCenter) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + if (!player.active || player.dead || despawnDistance) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vectorCenter) > 5600f) + if (!player.active || player.dead || despawnDistance) { npc.rotation = npc.velocity.X * 0.04f; @@ -617,13 +668,37 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Variables for buffing the AI - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool calamity = modPlayer.ZoneCalamity; - bool phase2 = (lifeRatio < 0.5f && revenge) || death; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.5f && revenge; + bool phase3 = lifeRatio < 0.33f; + + float enrageScale = 0f; + if (!player.ZoneUnderworldHeight || malice) + enrageScale += 1f; + if (!modPlayer.ZoneCalamity || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.15f; // Emit dust int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; @@ -643,18 +718,10 @@ namespace CalamityMod.NPCs } // Speed while moving in phase 1 - float speed = expertMode ? 5f : 4.5f; - if (CalamityWorld.bossRushActive) - speed = 12f; - else if (!calamity) - speed = 7f; - else if (death) - speed = 6f; - else if (revenge) - speed = 5.5f; - + float speed = death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f; if (expertMode) - speed += death ? 2f : 2f * (1f - lifeRatio); + speed += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + speed += 3f * enrageScale; // Variables for target location relative to npc location float xDistance = player.Center.X - vectorCenter.X; @@ -678,16 +745,36 @@ namespace CalamityMod.NPCs } } + if (npc.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int phase; + int random = phase2 ? 6 : 5; + do phase = Main.rand.Next(random); + while (phase == npc.ai[1] || (phase == 0 && phase3) || phase == 1 || phase == 2); + + npc.ai[0] = phase; + npc.ai[1] = 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; + } + } + // Pick a location to teleport to - if (npc.ai[0] == 0f) + else if (npc.ai[0] == 0f) { npc.chaseable = true; if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (npc.localAI[1] >= (CalamityWorld.bossRushActive ? 90f : 180f)) + if (npc.localAI[1] >= (malice ? 60f : death ? 150f : 180f)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.localAI[1] = 0f; int timer = 0; int playerPosX; @@ -736,7 +823,7 @@ namespace CalamityMod.NPCs Main.dust[dust].noGravity = true; Main.dust[dust].fadeIn = 1f; } - npc.alpha += 2; + npc.alpha += malice ? 4 : 2; if (npc.alpha >= 255) { if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(ModContent.NPCType()) < 2 && revenge) @@ -767,7 +854,7 @@ namespace CalamityMod.NPCs npc.alpha = 0; if (npc.ai[3] >= 2f || phase2) { - npc.ai[0] = phase2 ? 5f : 3f; + npc.ai[0] = -1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -791,14 +878,16 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.ai[1] += 1f; - float divisor = expertMode ? (death ? 30f : revenge ? 35f : 40f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 45f; + float divisor = expertMode ? (death ? 40f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; + divisor -= 5f * enrageScale; float divisor2 = divisor * 2f; if (npc.ai[1] % divisor == divisor - 1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - float num742 = CalamityWorld.bossRushActive ? 6f : 4f; + float num742 = death ? 5f : 4f; + num742 += 2f * enrageScale; float num743 = player.position.X + player.width * 0.5f - vectorCenter.X; float num744 = player.position.Y + player.height * 0.5f - vectorCenter.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); @@ -809,7 +898,8 @@ namespace CalamityMod.NPCs vectorCenter.X += num743 * 3f; vectorCenter.Y += num744 * 3f; - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(25, 1.5) : 30; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); int numProj = 4; int spread = 45; float rotation = MathHelper.ToRadians(spread); @@ -818,25 +908,22 @@ namespace CalamityMod.NPCs double deltaAngle = rotation / numProj; double offsetAngle; - if (npc.ai[1] % divisor2 == divisor2 - 1f || !calamity) + if (npc.ai[1] % divisor2 == divisor2 - 1f) { for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); } } - float projectileSpeed = CalamityWorld.bossRushActive ? 7f : 5f; - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - projectileSpeed += 4f; + float projectileSpeed = death ? 6f : 5f; if (revenge) projectileSpeed += 1f; - if (!calamity) - projectileSpeed += 2f; + projectileSpeed += 2f * enrageScale; if (expertMode) - projectileSpeed += death ? 3f : 3f * (1f - lifeRatio); + projectileSpeed += 3f * (1f - lifeRatio); vectorCenter = npc.Center; float relativeSpeedX = player.position.X + player.width * 0.5f - vectorCenter.X; @@ -847,59 +934,65 @@ namespace CalamityMod.NPCs relativeSpeedY *= totalRelativeSpeed; vectorCenter.X += relativeSpeedX * 3f; vectorCenter.Y += relativeSpeedY * 3f; - int projectileDamage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 35; - int projectileType = ModContent.ProjectileType(); - int projectileShot = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, relativeSpeedX, relativeSpeedY, projectileType, projectileDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + int projectileShot = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, relativeSpeedX, relativeSpeedY, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); Main.projectile[projectileShot].timeLeft = 240; } } - if (npc.position.Y > player.position.Y - 150f) //200 + float maxVelocityY = death ? 2.5f : 3f; + float maxVelocityX = death ? 7f : 8f; + maxVelocityY -= 0.5f * enrageScale; + maxVelocityX -= 1.5f * enrageScale; + + if (npc.position.Y > player.position.Y - 150f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y -= death ? 0.12f : 0.1f; - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; + if (npc.velocity.Y > maxVelocityY) + npc.velocity.Y = maxVelocityY; } - else if (npc.position.Y < player.position.Y - 350f) //500 + else if (npc.position.Y < player.position.Y - 350f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y += death ? 0.12f : 0.1f; - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; + if (npc.velocity.Y < -maxVelocityY) + npc.velocity.Y = -maxVelocityY; } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 150f) //100 + + if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 150f) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.985f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X -= death ? 0.12f : 0.1f; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; + if (npc.velocity.X > maxVelocityX) + npc.velocity.X = maxVelocityX; } - if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 150f) //100 + if (npc.position.X + (npc.width / 2) < player.position.X + (player.width / 2) - 150f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.985f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X += death ? 0.12f : 0.1f; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; + if (npc.velocity.X < -maxVelocityX) + npc.velocity.X = -maxVelocityX; } if (npc.ai[1] >= divisor * 10f) { - npc.TargetClosest(true); - npc.ai[0] = 4f; - npc.ai[1] = 0f; + npc.TargetClosest(); + npc.ai[0] = -1f; + npc.ai[1] = 3f; npc.ai[2] = 0f; npc.ai[3] = 0f; npc.netUpdate = true; @@ -909,28 +1002,22 @@ namespace CalamityMod.NPCs // Cocoon bullet hell else if (npc.ai[0] == 4f) { - npc.defense = 99999; + npc.defense = npc.defDefense * 4; + npc.chaseable = false; if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; if (expertMode) - npc.localAI[0] += death ? 1f : 1f * (1f - lifeRatio); - - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.localAI[0] += 2f; - if (!calamity) - npc.localAI[0] += 2f; + npc.localAI[0] += 1f - lifeRatio; + npc.localAI[0] += 1f * enrageScale; if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - float projectileSpeed = revenge ? 8f : 6f; - if (CalamityWorld.bossRushActive) - projectileSpeed = 12f; - - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(25, 1.5) : 30; + float projectileSpeed = death ? 9f : revenge ? 8f : 6f; + projectileSpeed += 3f * enrageScale; vectorCenter = player.Center - vectorCenter; @@ -945,22 +1032,32 @@ namespace CalamityMod.NPCs int totalProjectiles = 6; float offsetAngle = (float)Math.PI * radialOffset; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); for (int j = 0; j < totalProjectiles; j++) { float radians = j - (totalProjectiles - 1f) / 2f; - Vector2 offset = velocity.RotatedBy(offsetAngle * radians, default); - int proj = Projectile.NewProjectile(npc.Center + offset, vectorCenter, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Vector2 offset = velocity.RotatedBy(offsetAngle * radians); + int proj = Projectile.NewProjectile(npc.Center + offset, vectorCenter, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 300; Main.projectile[proj].tileCollide = false; } - totalProjectiles = 12; + totalProjectiles = death ? 16 : 12; float radians2 = MathHelper.TwoPi / totalProjectiles; + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + double angleA = radians2 * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -projectileSpeed).RotatedBy(radians2 * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + Projectile.NewProjectile(npc.Center, vector255, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); } + + npc.localAI[2] += 1f; } } @@ -971,13 +1068,14 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.ai[1] += 1f; - if (npc.ai[1] >= 300f) + if (npc.ai[1] >= (death ? 240f : 300f)) { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; + npc.TargetClosest(); + npc.ai[0] = -1f; + npc.ai[1] = 4f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.localAI[0] = 0f; npc.netUpdate = true; } } @@ -985,11 +1083,11 @@ namespace CalamityMod.NPCs // Laser beam attack else if (npc.ai[0] == 5f) { - npc.defense = npc.defDefense * 3; + npc.defense = npc.defDefense * 2; Vector2 source = new Vector2(vectorCenter.X + (npc.spriteDirection > 0 ? 34f : -34f), vectorCenter.Y - 74f); Vector2 aimAt = player.Center + player.velocity * 20f; - float aimResponsiveness = (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; + float aimResponsiveness = malice ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; Vector2 aimVector = Vector2.Normalize(aimAt - source); if (aimVector.HasNaNs()) @@ -1010,14 +1108,14 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (npc.ai[1] >= 240f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[2] += 1f; npc.localAI[0] = 0f; npc.localAI[1] = 0f; if (npc.ai[2] >= (death ? 1f : 2f)) { - npc.ai[0] = 3f; - npc.ai[1] = 0f; + npc.ai[0] = -1f; + npc.ai[1] = 5f; npc.ai[2] = 0f; calamityGlobalNPC.newAI[0] = 0f; } @@ -1037,7 +1135,9 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Item68, source); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); - Projectile.NewProjectile(source, laserVelocity2, ModContent.ProjectileType(), CalamityUtils.GetMasterModeProjectileDamage(40, 1.5) + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(source, laserVelocity2, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, npc.whoAmI); } } } @@ -1064,7 +1164,7 @@ namespace CalamityMod.NPCs } if (npc.ai[1] % playSoundTimer == 0f) - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 20); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1088,147 +1188,218 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Brothers are midgets and faster, 2 - Calamitas no longer gains increased defense while brothers are alive, 3 - Calamitas moves far quicker and her fireballs split into brimstone darts on death #region Calamitas Clone - public static void CalamitasCloneAI(NPC npc, Mod mod, bool phase2) + public static void CalamitasCloneAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); + // Variables for increasing difficulty + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Spawn phase 2 Cal - if (lifeRatio <= 0.75f && Main.netMode != NetmodeID.MultiplayerClient && !phase2) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - string key = "Mods.CalamityMod.CalamitasBossText"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - npc.active = false; - npc.netUpdate = true; - return; - } + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Variables for increasing difficulty - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + // Phases + bool phase3 = lifeRatio < 0.7f; + bool phase4 = lifeRatio < 0.35f; + bool phase5 = npc.life / (float)npc.lifeMax < 0.1f && revenge; + + // Don't take damage during bullet hells + npc.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; // Variable for live brothers bool brotherAlive = false; - if (phase2) + // For seekers + CalamityGlobalNPC.calamitas = npc.whoAmI; + + // Seeker ring + if (calamityGlobalNPC.newAI[1] == 0f && phase4 && expertMode) { - // For seekers - CalamityGlobalNPC.calamitas = npc.whoAmI; - - // Seeker ring - if (calamityGlobalNPC.newAI[1] == 0f && lifeRatio <= 0.35f && expertMode) + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.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; + for (int i = 0; i < seekerAmt; i++) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 74); - for (int I = 0; I < 5; I++) - { - int FireEye = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 72) * 150)), (int)(npc.Center.Y + (Math.Cos(I * 72) * 150)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - NPC Eye = Main.npc[FireEye]; - Eye.ai[0] = I * 72; - } - } - - string key = "Mods.CalamityMod.CalamitasBossText3"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - - calamityGlobalNPC.newAI[1] = 1f; - } - - // Spawn brothers - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = npc.lifeMax; - - if (npc.life > 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num660 = (int)(npc.lifeMax * 0.3); //70%, 40%, and 10% - if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) - { - calamityGlobalNPC.newAI[0] = npc.life; - if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.1) - { - 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); - - string key = "Mods.CalamityMod.CalamitasBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - else if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.4) - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - else - NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - } + int spawn = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(npc.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); + Main.npc[spawn].ai[0] = i * seekerSpread; } } - // Huge defense boost if brothers are alive - int num568 = 0; - if (expertMode) - { - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - { - brotherAlive = true; - num568 += 255; - } - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - { - brotherAlive = true; - num568 += 255; - } - } - npc.defense += num568 * 50; - if (!brotherAlive) - npc.defense = provy ? 150 : 25; - } + string key = "Mods.CalamityMod.CalamitasBossText3"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); - // Disable homing if brothers are alive - npc.chaseable = !brotherAlive; + calamityGlobalNPC.newAI[1] = 1f; + } + + // Do bullet hell or spawn brothers + if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) + calamityGlobalNPC.newAI[0] = npc.lifeMax; + + // Bullet hells at 70% and 10%, brothers at 40% + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num660 = (int)(npc.lifeMax * 0.3); + if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) + { + calamityGlobalNPC.newAI[0] = npc.life; + if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.1) + { + Main.PlaySound(SoundID.Item109, npc.Center); + calamityGlobalNPC.newAI[2] = 2f; + SpawnDust(); + npc.alpha = 255; + } + else if (calamityGlobalNPC.newAI[0] <= (float)npc.lifeMax * 0.4) + { + 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); + + string key = "Mods.CalamityMod.CalamitasBossText2"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + else + { + Main.PlaySound(SoundID.Item109, npc.Center); + calamityGlobalNPC.newAI[2] = 1f; + SpawnDust(); + npc.alpha = 255; + } + } + } + } + + // Huge DR boost if brothers are alive + if (expertMode) + { + if (CalamityGlobalNPC.cataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + { + brotherAlive = true; + } + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + { + brotherAlive = true; + } + } + if (brotherAlive) + { + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; + } + else + { + calamityGlobalNPC.DR = 0.15f; + calamityGlobalNPC.unbreakableDR = false; + } + } + + // Disable homing if brothers are alive + npc.chaseable = !brotherAlive; + + void SpawnDust() + { + int dustAmt = 50; + int random = 3; + + for (int j = 0; j < 10; j++) + { + random += j; + int dustAmtSpawned = 0; + int scale = random * 6; + float dustPositionX = npc.Center.X - (scale / 2); + float dustPositionY = npc.Center.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) + { + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position.X = npc.Center.X; + Main.dust[dust].position.Y = npc.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; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; + } + } } // Get a 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 == 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(); // Target variable Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + // 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 num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; + Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); + Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); + Vector2 rotationVector = npcCenter - lookAt; + + // Malice Mode predictive charge rotation + if (npc.ai[1] == 4f && phase5 && malice) + { + // Velocity + float chargeVelocity = 30f; + chargeVelocity += 5f * enrageScale; + if (provy) + chargeVelocity *= 1.25f; + + lookAt += Main.player[npc.target].velocity * 20f; + rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; + } + + float num803 = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; if (num803 < 0f) num803 += MathHelper.TwoPi; else if (num803 > MathHelper.TwoPi) @@ -1260,11 +1431,11 @@ namespace CalamityMod.NPCs npc.rotation = num803; // Despawn - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -1279,6 +1450,10 @@ namespace CalamityMod.NPCs { npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.alpha = 0; npc.netUpdate = true; } return; @@ -1287,25 +1462,182 @@ namespace CalamityMod.NPCs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + // Reset damage from bullet hell phases + npc.damage = npc.defDamage; + + // Bullet hell phase + if (calamityGlobalNPC.newAI[2] > 0f) + { + float num823 = expertMode ? 10f : 8.5f; + float num824 = expertMode ? 0.18f : 0.155f; + num823 += 4f * enrageScale; + num824 += 0.1f * enrageScale; + + if (death) + { + num823 += 2f * (1f - lifeRatio); + num824 += 0.04f * (1f - lifeRatio); + } + + if (provy) + { + num823 *= 1.25f; + num824 *= 1.25f; + } + + 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) - 360f - vector82.Y; + float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + + if (npc.velocity.X < num825) + { + npc.velocity.X += num824; + if (npc.velocity.X < 0f && num825 > 0f) + npc.velocity.X += num824; + } + else if (npc.velocity.X > num825) + { + npc.velocity.X -= num824; + if (npc.velocity.X > 0f && num825 < 0f) + npc.velocity.X -= num824; + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y += num824; + if (npc.velocity.Y < 0f && num826 > 0f) + npc.velocity.Y += num824; + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y -= num824; + if (npc.velocity.Y > 0f && num826 < 0f) + npc.velocity.Y -= num824; + } + + if (calamityGlobalNPC.newAI[3] < 900f) + { + calamityGlobalNPC.newAI[3] += 1f; + npc.damage = 0; + npc.chaseable = false; + npc.dontTakeDamage = true; + + float num740 = player.Center.X - npc.Center.X; + float num741 = player.Center.Y - npc.Center.Y; + npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[2] == 2f) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type) + (provy ? 30 : 0); + float gigaBlastFrequency = (expertMode ? 180f : 240f) - enrageScale * 15f; + float projSpeed = malice ? 6.25f : 5f; + if (calamityGlobalNPC.newAI[3] <= 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] > 600f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + } + + npc.ai[0] += 1f; + float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale; + if (npc.ai[0] >= hellblastGateValue) + { + npc.ai[0] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type) + (provy ? 30 : 0); + float projSpeed = malice ? 5f : 4f; + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + } + else + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.alpha = 0; + npc.netUpdate = true; + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == ModContent.ProjectileType()) + { + projectile.ai[1] = 1f; + + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + } + } + } + + return; + } + // Float above target and fire lasers or fireballs if (npc.ai[1] == 0f) { - float num823 = expertMode ? 9.5f : 8f; - float num824 = expertMode ? 0.175f : 0.15f; - if (phase2) - { - num823 = expertMode ? 10f : 8.5f; - num824 = expertMode ? 0.18f : 0.155f; - } + float num823 = expertMode ? 10f : 8.5f; + float num824 = expertMode ? 0.18f : 0.155f; + num823 += 4f * enrageScale; + num824 += 0.1f * enrageScale; + if (death) { - num823 += 1f; - num824 += 0.02f; + num823 += 2f * (1f - lifeRatio); + num824 += 0.04f * (1f - lifeRatio); } // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num824 *= 0.5f; } @@ -1315,15 +1647,10 @@ namespace CalamityMod.NPCs num823 *= 1.25f; num824 *= 1.25f; } - if (CalamityWorld.bossRushActive) - { - num823 *= 1.5f; - num824 *= 1.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) - ((CalamityWorld.bossRushActive ? 400f : 300f) + (phase2 ? 60f : 0f)) - vector82.Y; + float num826 = player.position.Y + (player.height / 2) - 360f - vector82.Y; float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); num827 = num823 / num827; num825 *= num827; @@ -1355,100 +1682,78 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= (phase2 ? 200f : 300f)) + float phaseTimer = 200f - (death ? 60f * (1f - lifeRatio) : 0f); + if (npc.ai[2] >= phaseTimer || phase5) { npc.ai[1] = 1f; npc.ai[2] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } - num825 = player.position.X + (player.width / 2) - vector82.X; - num826 = player.position.Y + (player.height / 2) - vector82.Y; + num825 = player.Center.X - vector82.X; + num826 = player.Center.Y - vector82.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (phase2) - { - if (!brotherAlive) - { - if (expertMode) - npc.localAI[1] += death ? 1f : 1f * (1f - lifeRatio); - if (revenge) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] > 180f) - { - npc.localAI[1] = 0f; - float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 14f : 12.5f); - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num828 += 5f; - - int num829 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(34, 1.5) : 42; - int num830 = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 6f; - vector82.Y += num826 * 6f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - int proj = Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, player.Center.X, player.Center.Y); - Main.projectile[proj].tileCollide = false; - } - else - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - else + if (!brotherAlive) { + if (expertMode) + npc.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; if (revenge) npc.localAI[1] += 0.5f; + } - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + + float num828 = expertMode ? 14f : 12.5f; + num828 += 3f * enrageScale; + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - npc.localAI[1] = 0f; - float num828 = CalamityWorld.bossRushActive ? 16f : (expertMode ? 13f : 10.5f); - int num829 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 35; - int num830 = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 12f; - vector82.Y += num826 * 12f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, num830, num829 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Main.projectile[proj].tileCollide = false; } + else + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer); } } } - // Float to the side of the target and fire lasers + // Float to the side of the target and fire else if (npc.ai[1] == 1f) { int num831 = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + if (npc.Center.X < player.Center.X) num831 = -1; - float num832 = expertMode ? 9.5f : 8f; - float num833 = expertMode ? 0.25f : 0.2f; - if (phase2) - { - num832 = expertMode ? 10f : 8.5f; - num833 = expertMode ? 0.255f : 0.205f; - } + float num832 = expertMode ? 10f : 8.5f; + float num833 = expertMode ? 0.255f : 0.205f; + num832 += 4f * enrageScale; + num833 += 0.1f * enrageScale; + if (death) { - num832 += 1f; - num833 += 0.02f; + num832 += 2f * (1f - lifeRatio); + num833 += 0.04f * (1f - lifeRatio); } // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num833 *= 0.5f; } @@ -1458,14 +1763,9 @@ namespace CalamityMod.NPCs num832 *= 1.25f; num833 *= 1.25f; } - if (CalamityWorld.bossRushActive) - { - num832 *= 1.5f; - num833 *= 1.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 * (CalamityWorld.bossRushActive ? 460 : 360)) - vector83.X; + Vector2 vector83 = npc.Center; + float num834 = player.position.X + (player.width / 2) + (num831 * 360) - vector83.X; float num835 = player.position.Y + (player.height / 2) - vector83.Y; float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num832 / num836; @@ -1497,73 +1797,59 @@ namespace CalamityMod.NPCs npc.velocity.Y -= num833; } - num834 = player.position.X + (player.width / 2) - vector83.X; - num835 = player.position.Y + (player.height / 2) - vector83.Y; + num834 = player.Center.X - vector83.X; + num835 = player.Center.Y - vector83.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (phase2) - { - if (!brotherAlive) - { - if (revenge) - npc.localAI[1] += 0.5f; - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - npc.localAI[1] += 0.5f; - if (expertMode) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - float num837 = CalamityWorld.bossRushActive ? 15f : 11f; - int num838 = brotherAlive ? (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(34, 1.5) : 42) : (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(28, 1.5) : 35); - int num839 = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); - num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 12f; - vector83.Y += num835 * 12f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - int proj = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, ModContent.ProjectileType(), (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(34, 1.5) : 42) + (provy ? 30 : 0), 0f, Main.myPlayer, player.Center.X, player.Center.Y); - Main.projectile[proj].tileCollide = false; - } - else - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - else + if (!brotherAlive) { if (revenge) npc.localAI[1] += 0.5f; + if (expertMode) + npc.localAI[1] += 0.5f; + } - if (npc.localAI[1] >= 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + if (npc.localAI[1] >= 60f && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + npc.localAI[1] = 0f; + + float num837 = expertMode ? 12.5f : 11f; + num837 += 3f * enrageScale; + + int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 8f; + vector83.Y += num835 * 8f; + + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - npc.localAI[1] = 0f; - float num837 = CalamityWorld.bossRushActive ? 14f : 10.5f; - int num838 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(20, 1.5) : 24; - int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 12f; - vector83.Y += num835 * 12f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + type = ModContent.ProjectileType(); + damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Main.projectile[proj].tileCollide = false; + } + else + { + float ai0 = type == ModContent.ProjectileType() ? 1f : 0f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, ai0, 0f); } } } npc.ai[2] += 1f; - if (npc.ai[2] >= (phase2 ? 120f : 180f)) + float phaseTimer = 120f - (death ? 30f * (1f - lifeRatio) : 0f); + if (npc.ai[2] >= phaseTimer || phase5) { - npc.ai[1] = phase2 && !brotherAlive && lifeRatio < 0.7f && revenge ? 4f : 0f; + npc.ai[1] = !brotherAlive && phase3 && revenge ? 4f : 0f; npc.ai[2] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } } @@ -1571,30 +1857,26 @@ namespace CalamityMod.NPCs { npc.rotation = num803; - float chargeVelocity = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 27f : 25f; + float chargeVelocity = phase5 ? 30f : (25f + (death ? 4f * (1f - lifeRatio) : 0f)); + chargeVelocity += 5f * enrageScale; if (provy) chargeVelocity *= 1.25f; - if (CalamityWorld.bossRushActive) - chargeVelocity *= 1.5f; - - Vector2 vector = Vector2.Normalize(player.Center + player.velocity * 10f - npc.Center); + Vector2 vector = Vector2.Normalize(player.Center + (phase5 && malice ? player.velocity * 20f : Vector2.Zero) - npc.Center); npc.velocity = vector * chargeVelocity; npc.ai[1] = 3f; + npc.netUpdate = true; } else if (npc.ai[1] == 3f) { npc.ai[2] += 1f; - float chargeTime = 70f; - if (CalamityWorld.bossRushActive) - chargeTime *= 0.8f; - + float chargeTime = phase5 ? 35f : (45f - (death ? 6f * (1f - lifeRatio) : 0f)); if (npc.ai[2] >= chargeTime) { - npc.velocity *= 0.93f; + npc.velocity *= 0.9f; 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) @@ -1603,26 +1885,38 @@ namespace CalamityMod.NPCs else npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= chargeTime + 15f) + if (npc.ai[2] >= chargeTime + 10f) { - npc.ai[3] += 1f; + if (!phase5) + npc.ai[3] += 1f; + npc.ai[2] = 0f; - npc.target = 255; + npc.rotation = num803; - if (npc.ai[3] > 1f) + npc.TargetClosest(); + npc.netUpdate = true; + + if (npc.ai[3] >= 2f) { npc.ai[1] = 0f; npc.ai[3] = 0f; return; } + npc.ai[1] = 4f; } } else { - int num62 = 500; - float num63 = (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 20f : 14f; - float num64 = (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 0.5f : 0.35f; + int num62 = phase5 ? 300 : 400; + float num63 = 14f; + float num64 = 0.35f; + + if (death) + { + num63 += 4f * (1f - lifeRatio); + num64 += 0.1f * (1f - lifeRatio); + } if (provy) { @@ -1630,17 +1924,11 @@ namespace CalamityMod.NPCs num64 *= 1.25f; } - if (CalamityWorld.bossRushActive) - { - num63 *= 1.5f; - num64 *= 1.5f; - } - int num408 = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) num408 = -1; - Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector11 = npc.Center; float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num62 * num408) - vector11.X; float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector11.Y; float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66); @@ -1675,9 +1963,9 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= 45f) + if (npc.ai[2] >= (phase5 ? 15f : 30f)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 2f; npc.ai[2] = 0f; npc.netUpdate = true; @@ -1689,22 +1977,49 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); CalamityGlobalNPC.cataclysm = npc.whoAmI; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + 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(); Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; @@ -1738,11 +2053,11 @@ namespace CalamityMod.NPCs if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) npc.rotation = num842; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -1772,23 +2087,21 @@ namespace CalamityMod.NPCs { float num861 = 5f; float num862 = 0.1f; + num861 += 2f * enrageScale; + num862 += 0.06f * enrageScale; + if (provy) { num861 *= 1.25f; num862 *= 1.25f; } - if (CalamityWorld.bossRushActive) - { - num861 *= 1.5f; - num862 *= 1.5f; - } int num863 = 1; if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num863 = -1; Vector2 vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num864 = player.position.X + (player.width / 2) + (num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; + float num864 = player.position.X + (player.width / 2) + (num863 * 180) - vector86.X; float num865 = player.position.Y + (player.height / 2) - vector86.Y; float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); @@ -1837,10 +2150,10 @@ namespace CalamityMod.NPCs npc.velocity.Y -= num862; } - npc.ai[2] += (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f; - if (npc.ai[2] >= 240f) + npc.ai[2] += 1f; + if (npc.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 1f; npc.ai[2] = 0f; npc.target = 255; @@ -1854,7 +2167,7 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 22f) { npc.localAI[2] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 34); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1866,9 +2179,10 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 12f) { npc.localAI[1] = 0f; - float num867 = CalamityWorld.bossRushActive ? 9f : 6f; - int num868 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(30, 1.5) : 38; - int num869 = ModContent.ProjectileType(); + float num867 = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; + num867 += enrageScale; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num864 = player.position.X + (player.width / 2) - vector86.X; num865 = player.position.Y + (player.height / 2) - vector86.Y; @@ -1878,9 +2192,9 @@ namespace CalamityMod.NPCs num865 *= num866; num865 += npc.velocity.Y * 0.5f; num864 += npc.velocity.X * 0.5f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + vector86.X -= num864; + vector86.Y -= num865; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); } } } @@ -1889,26 +2203,21 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); npc.rotation = num842; - float num870 = 14f; + float num870 = 14f + (death ? 4f * (1f - lifeRatio) : 0f); + num870 += 3f * enrageScale; if (expertMode) num870 += 2f; if (revenge) num870 += 2f; - if (death) - num870 += 2f; - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num870 += 4f; if (provy) num870 *= 1.15f; - if (CalamityWorld.bossRushActive) - num870 *= 1.25f; - Vector2 vector87 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num871 = player.position.X + (player.width / 2) - vector87.X; - float num872 = player.position.Y + (player.height / 2) - vector87.Y; + Vector2 vector87 = npc.Center; + float num871 = player.Center.X - vector87.X; + float num872 = player.Center.Y - vector87.Y; float num873 = (float)Math.Sqrt(num871 * num871 + num872 * num872); num873 = num870 / num873; npc.velocity.X = num871 * num873; @@ -1919,13 +2228,11 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 2f) { - npc.ai[2] += 1f; + npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); if (expertMode) npc.ai[2] += 0.25f; if (revenge) npc.ai[2] += 0.25f; - if (CalamityWorld.bossRushActive) - npc.ai[2] += 0.25f; if (npc.ai[2] >= 75f) { @@ -1946,6 +2253,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; npc.target = 255; npc.rotation = num842; + npc.TargetClosest(); if (npc.ai[3] >= 3f) { npc.ai[1] = 0f; @@ -1962,22 +2270,49 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Emit light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); CalamityGlobalNPC.catastrophe = npc.whoAmI; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool dayTime = Main.dayTime && !CalamityWorld.bossRushActive; - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + 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(); Player player = Main.player[npc.target]; + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + float num840 = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); float num841 = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); float num842 = (float)Math.Atan2(num841, num840) + MathHelper.PiOver2; @@ -2011,11 +2346,11 @@ namespace CalamityMod.NPCs if (npc.rotation > num842 - num843 && npc.rotation < num842 + num843) npc.rotation = num842; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || (dayTime && !Main.eclipse)) + if (!player.active || player.dead) { if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -2045,24 +2380,22 @@ namespace CalamityMod.NPCs { float num861 = 4.5f; float num862 = 0.2f; + num861 += 2f * enrageScale; + num862 += 0.1f * enrageScale; + if (provy) { num861 *= 1.25f; num862 *= 1.25f; } - if (CalamityWorld.bossRushActive) - { - num861 *= 1.5f; - num862 *= 1.5f; - } int num863 = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) + if (npc.Center.X < player.Center.X) num863 = -1; - Vector2 vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num864 = player.position.X + (player.width / 2) + (num863 * (CalamityWorld.bossRushActive ? 270 : 180)) - vector86.X; - float num865 = player.position.Y + (player.height / 2) - vector86.Y; + Vector2 vector86 = npc.Center; + float num864 = player.Center.X + (num863 * 180) - vector86.X; + float num865 = player.Center.Y - vector86.Y; float num866 = (float)Math.Sqrt(num864 * num864 + num865 * num865); if (expertMode || provy) @@ -2110,24 +2443,24 @@ namespace CalamityMod.NPCs npc.velocity.Y -= num862; } - npc.ai[2] += (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f; - if (npc.ai[2] >= 180f) + npc.ai[2] += 1f; + if (npc.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 1f; npc.ai[2] = 0f; npc.target = 255; npc.netUpdate = true; } - bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; + bool fireDelay = npc.ai[2] > 120f || lifeRatio < 0.9f; if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) { npc.localAI[2] += 1f; if (npc.localAI[2] > 36f) { npc.localAI[2] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 34); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 34); } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2139,9 +2472,10 @@ namespace CalamityMod.NPCs if (npc.localAI[1] > 50f) { npc.localAI[1] = 0f; - float num867 = CalamityWorld.bossRushActive ? 18f : 12f; - int num868 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(29, 1.5) : 36; - int num869 = ModContent.ProjectileType(); + float num867 = death ? 14f : 12f; + num867 += 3f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); vector86 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num864 = player.position.X + (player.width / 2) - vector86.X; num865 = player.position.Y + (player.height / 2) - vector86.Y; @@ -2151,9 +2485,9 @@ namespace CalamityMod.NPCs num865 *= num866; num865 += npc.velocity.Y * 0.5f; num864 += npc.velocity.X * 0.5f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, num868 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + vector86.X -= num864; + vector86.Y -= num865; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); } } } @@ -2162,22 +2496,17 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 1f) { - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); npc.rotation = num842; - float num870 = 16f; + float num870 = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); + num870 += 4f * enrageScale; if (expertMode) num870 += 2f; if (revenge) num870 += 2f; - if (death) - num870 += 2f; - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num870 += 4f; if (provy) num870 *= 1.15f; - if (CalamityWorld.bossRushActive) - num870 *= 1.25f; Vector2 vector87 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num871 = player.position.X + (player.width / 2) - vector87.X; @@ -2192,13 +2521,11 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 2f) { - npc.ai[2] += 1f; + npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); if (expertMode) npc.ai[2] += 0.25f; if (revenge) npc.ai[2] += 0.25f; - if (CalamityWorld.bossRushActive) - npc.ai[2] += 0.25f; if (npc.ai[2] >= 60f) //50 { @@ -2217,7 +2544,7 @@ namespace CalamityMod.NPCs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = 255; + npc.TargetClosest(); npc.rotation = num842; if (npc.ai[3] >= 4f) { @@ -2232,6 +2559,8 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Smaller, 2 - Much faster, 3 - Aureus Spawns are bigger and are aggro immediately #region Astrum Aureus public static void AstrumAureusAI(NPC npc, Mod mod) { @@ -2242,20 +2571,42 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Variables - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Variables + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; float shootTimer = 1f; if (expertMode) - shootTimer += death ? 1 : (int)(2f * (1f - lifeRatio)); + shootTimer += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - bool dayTime = Main.dayTime; + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } // Get a 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 == 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(); Player player = Main.player[npc.target]; @@ -2263,15 +2614,17 @@ namespace CalamityMod.NPCs npc.spriteDirection = (npc.direction > 0) ? 1 : -1; // Phases - bool phase2 = lifeRatio < 0.75f || death; - bool phase3 = lifeRatio < 0.5f || death; + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + + bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; // Despawn - if (!player.active || player.dead || dayTime) + if (!player.active || player.dead || despawnDistance) { npc.TargetClosest(false); player = Main.player[npc.target]; - if (!player.active || player.dead || dayTime) + if (!player.active || player.dead || despawnDistance) { npc.noTileCollide = true; @@ -2303,72 +2656,97 @@ namespace CalamityMod.NPCs Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); // Fire projectiles while walking, teleporting, or falling - if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || - calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (npc.ai[0] == 2f || npc.ai[0] >= 5f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += (npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer; + npc.localAI[0] += npc.ai[0] == 2f ? 4f : shootTimer; + + float astralFlameGateValue = phase3 ? 30f : 60f; + if (npc.localAI[0] >= astralFlameGateValue) + { + // Fire astral flames while teleporting + 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); + + float velocity = death ? 8f : 7f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + damage *= 2; + float spreadLimit = (phase3 ? 100f : 50f) + enrageScale * 50f; + float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; + Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f); + Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f); + Projectile.NewProjectile(npc.Center, Vector2.Normalize(destination - npc.Center) * velocity, type, damage, 0f, Main.myPlayer); + } + + npc.netUpdate = true; + } + if (npc.localAI[0] >= 180f) { - npc.localAI[0] = 0f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); - int laserDamage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(32, 1.5) : 37; - if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) - laserDamage *= 3; - - // Fire astral flames while teleporting - if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + // Fire astral lasers while walking + if (npc.ai[0] == 2f) { - float velocity = CalamityWorld.bossRushActive ? 10f : 7f; - int totalProjectiles = 8; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) + npc.localAI[0] = 0f; + Main.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; + int spread = malice ? 80 : death ? 60 : 45; + + if (!phase2) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), laserDamage, 0f, Main.myPlayer, 0f, 0f); + maxProjectiles /= 2; + spread /= 2; } - } - // Fire astral lasers while falling or walking - else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) - { - float num179 = CalamityWorld.bossRushActive ? 24f : 18.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; float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - npc.netUpdate = true; num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num185 = ModContent.ProjectileType(); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 5; num186++) + value9.X += num180; + value9.Y += num182; + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + damage *= 2; + + for (int i = 0; i < maxProjectiles; i++) { num180 = player.position.X + player.width * 0.5f - value9.X; num182 = player.position.Y + player.height * 0.5f - value9.Y; num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); num183 = num179 / num183; - num180 += Main.rand.Next(-60, 61); - num182 += Main.rand.Next(-60, 61); + num180 += Main.rand.Next(-spread, spread + 1); + num182 += Main.rand.Next(-spread, spread + 1); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer); } + + npc.netUpdate = true; } } } } + else + npc.localAI[0] = 0f; - // Start up - if (npc.ai[0] == 0f) + // Start up + if (npc.ai[0] == 0f) { // If hit or after two seconds start Idle phase npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 120f) + if (npc.justHit || npc.ai[1] >= 120f || malice) { // Set AI to next phase (Idle) and reset other AI npc.ai[0] = 1f; @@ -2386,21 +2764,20 @@ namespace CalamityMod.NPCs npc.defense = 0; // Slow down - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; + npc.velocity.X *= 0.9f; // Stay vulnerable for a maximum of 1.5 or 2.5 seconds npc.ai[1] += 1f; - if (npc.ai[1] >= ((phase3 || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) + if (npc.ai[1] >= 120f || malice) { // Increase defense - npc.defense = 70; + npc.defense = npc.defDefense; // Stop colliding with tiles npc.noTileCollide = true; // Set AI to next phase (Walk) and reset other AI - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 2f; npc.ai[1] = 0f; npc.netUpdate = true; @@ -2413,9 +2790,10 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 2f) { // Set walking speed - float num823 = CalamityWorld.bossRushActive ? 9f : 6f; + float num823 = 6f; + num823 += 4f * enrageScale; if (expertMode) - num823 += death ? 2f : 2f * (1f - lifeRatio); + num823 += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); if (revenge) num823 += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; @@ -2446,41 +2824,43 @@ namespace CalamityMod.NPCs if (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) flag52 = true; - if (flag52) - npc.velocity.Y += 0.5f; - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; + if (flag52) + { + 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 > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; + if (npc.velocity.Y > -0.2) + npc.velocity.Y -= 0.025f; + else + npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + else + { + if (npc.velocity.Y < 0f) + npc.velocity.Y = 0f; - if (npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } + if (npc.velocity.Y < 0.1) + npc.velocity.Y += 0.025f; + else + npc.velocity.Y += 0.5f; + } // Walk for a maximum of 6 seconds npc.ai[1] += 1f; - if (npc.ai[1] >= 360f) + if (npc.ai[1] >= ((malice ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) { // Collide with tiles again npc.noTileCollide = false; // Set AI to next phase (Jump) and reset other AI - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 3f; npc.ai[1] = 0f; npc.netUpdate = true; @@ -2503,14 +2883,20 @@ namespace CalamityMod.NPCs // Half second delay before jumping npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - npc.ai[1] = -20f; - else if (npc.ai[1] == -1f) - { - // Set jump velocity, reset and set AI to next phase (Stomp) - float velocityX = CalamityWorld.bossRushActive ? 12f : 9f; + if (npc.ai[1] >= 30f) + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + // Set jump velocity, reset and set AI to next phase (Stomp) + float velocityX = 9f; + velocityX += 6f * enrageScale; if (expertMode) - velocityX += death ? 3f : 3f * (1f - lifeRatio); + velocityX += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.velocity.X = velocityX * npc.direction; @@ -2518,31 +2904,35 @@ namespace CalamityMod.NPCs if (revenge) { + float multiplier = 0.001f + 0.0005f * enrageScale; if (distanceBelowTarget > 0f) - calamityGlobalNPC.newAI[0] = 1f + distanceBelowTarget * 0.001f; + calamityGlobalNPC.newAI[0] = 1f + distanceBelowTarget * multiplier; - if (calamityGlobalNPC.newAI[0] > 2f) - calamityGlobalNPC.newAI[0] = 2f; + float speedMultLimit = 2f + 1f * enrageScale; + if (calamityGlobalNPC.newAI[0] > speedMultLimit) + calamityGlobalNPC.newAI[0] = speedMultLimit; } if (expertMode) - { - if (player.position.Y < npc.Bottom.Y) - npc.velocity.Y = -14.5f; - else - npc.velocity.Y = 1f; + { + if (player.position.Y < npc.Bottom.Y) + npc.velocity.Y = -14.5f; + else + npc.velocity.Y = 1f; - npc.noTileCollide = true; - } - else - npc.velocity.Y = -14.5f; + npc.noTileCollide = true; + } + else + npc.velocity.Y = -14.5f; if (calamityGlobalNPC.newAI[0] > 1f) npc.velocity.Y *= calamityGlobalNPC.newAI[0]; npc.ai[0] = 4f; - npc.ai[1] = 0f; - } + npc.ai[1] = 0f; + + npc.netUpdate = true; + } } CustomGravity(); @@ -2557,15 +2947,23 @@ namespace CalamityMod.NPCs Main.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(true); + npc.TargetClosest(); npc.ai[2] += 1f; - if (npc.ai[2] >= 3f) - { - npc.ai[0] = (phase2 || revenge) ? 5f : 1f; - npc.ai[2] = 0f; - } - else - npc.ai[0] = 3f; + float maxStompAmt = death ? 2f : 3f; + if (npc.ai[2] >= maxStompAmt) + { + npc.ai[0] = phase2 ? 5f : 1f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + else + { + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + + npc.ai[0] = 3f; + npc.netUpdate = true; + } calamityGlobalNPC.newAI[0] = 0f; @@ -2578,6 +2976,43 @@ namespace CalamityMod.NPCs Main.dust[num624].velocity *= 0.2f; } } + + // Fire lasers on stomp + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 33); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num179 = death ? 20f : 18.5f; + int maxProjectiles = malice ? 12 : death ? 6 : 4; + int spread = malice ? 120 : death ? 60 : 45; + 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; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (NPC.downedMoonlord && revenge && !BossRushEvent.BossRushActive) + damage *= 2; + value9.X += num180; + value9.Y += num182; + for (int i = 0; i < maxProjectiles; i++) + { + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + num183 = num179 / num183; + num180 += Main.rand.Next(-spread, spread + 1); + num182 += Main.rand.Next(-spread, spread + 1); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + + npc.netUpdate = true; + } } else { @@ -2598,8 +3033,9 @@ namespace CalamityMod.NPCs if (npc.Bottom.Y < player.position.Y) { float fallSpeed = 1.2f; + fallSpeed += 0.8f * enrageScale; if (expertMode) - fallSpeed += death ? 0.4f : 0.4f * (1f - lifeRatio); + fallSpeed += death ? 0.6f * (1f - lifeRatio) : 0.4f * (1f - lifeRatio); if (calamityGlobalNPC.newAI[0] > 1f) fallSpeed *= calamityGlobalNPC.newAI[0]; @@ -2609,16 +3045,18 @@ namespace CalamityMod.NPCs } else { - float velocityXChange = 0.02f + Math.Abs(npc.Center.X - player.Center.X) * 0.0005f; + float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; + velocityXChange += 0.1f * enrageScale; if (npc.direction < 0) npc.velocity.X -= velocityXChange; else if (npc.direction > 0) npc.velocity.X += velocityXChange; - float num626 = CalamityWorld.bossRushActive ? 15f : 12f; + float num626 = 12f; + num626 += 8f * enrageScale; if (expertMode) - num626 += death ? 3f : 3f * (1f - lifeRatio); + num626 += death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); if (npc.velocity.X < -num626) npc.velocity.X = -num626; @@ -2634,16 +3072,16 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 5f) { // Slow down - npc.velocity *= 0.95f; + npc.velocity.X *= 0.9f; // Spawn slimes and start teleport if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - npc.localAI[1] += 5f; + if (phase3) + npc.localAI[1] += 1f; - if (npc.localAI[1] >= 240f) + if (npc.localAI[1] >= ((malice ? 120f : 240f) - (death ? 60f * (1f - lifeRatio) : 0f))) { // Spawn slimes bool spawnFlag = revenge; @@ -2653,7 +3091,7 @@ namespace CalamityMod.NPCs NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, ModContent.NPCType()); // Reset localAI and find a teleport destination - npc.TargetClosest(true); + npc.TargetClosest(); npc.localAI[1] = 0f; int num1249 = 0; int num1250; @@ -2710,7 +3148,7 @@ namespace CalamityMod.NPCs if (npc.soundDelay == 0) { npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); } // Emit dust to make the teleport pretty @@ -2730,7 +3168,7 @@ namespace CalamityMod.NPCs if (npc.alpha <= 0) { // Spawn slimes - bool spawnFlag = revenge; + bool spawnFlag = phase3; if (NPC.CountNPCS(ModContent.NPCType()) > 1) spawnFlag = false; if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) @@ -2751,7 +3189,7 @@ namespace CalamityMod.NPCs if (npc.soundDelay == 0) { npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 109); } // Emit dust to make the teleport pretty @@ -2765,21 +3203,8 @@ namespace CalamityMod.NPCs void CustomGravity() { - float gravity = 0.3f; - float maxFallSpeed = 10f; - if (npc.wet) - { - if (npc.honeyWet) - { - gravity *= 0.33f; - maxFallSpeed *= 0.4f; - } - else - { - gravity *= 0.66f; - maxFallSpeed *= 0.7f; - } - } + float gravity = 0.36f + 0.12f * enrageScale; + float maxFallSpeed = 12f + 4f * enrageScale; if (calamityGlobalNPC.newAI[0] > 1f) maxFallSpeed *= calamityGlobalNPC.newAI[0]; @@ -2791,39 +3216,63 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Deus worms in phase 2 gain DR proportional to the amount of HP the other worm has left (to force the player to damage both to around 10% to finish the fight) #region Astrum Deus public static void AstrumDeusAI(NPC npc, Mod mod, bool head) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Difficulty variables - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool enraged = calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive); + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; - // Deus cannot hit for 3 seconds + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1.5f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 0.5f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 0.5f; + } + + // Deus cannot hit for 3 seconds or while invulnerable if (calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage) npc.damage = 0; else npc.damage = npc.defDamage; - // 10 seconds of reistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 600f) + // 5 seconds of resistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 300f) calamityGlobalNPC.newAI[1] += 1f; // Get a 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 == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); Player player = Main.player[npc.target]; + bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Despawn safety, make sure to target another player if the current player target is too far away + if (increaseSpeedMore && head) + npc.TargetClosest(); + // Inflict Extreme Gravity to nearby players if (revenge) { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 5600f) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } } @@ -2831,14 +3280,16 @@ namespace CalamityMod.NPCs // Life float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases based on life percentage - bool halfHealth = lifeRatio < 0.5f; + bool halfHealth = npc.life / (float)npc.lifeMax < 0.5f; bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; - bool phase2 = (lifeRatio < 0.9f && expertMode) || death || (doubleWormPhase && expertMode); bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; - bool phase3 = (lifeRatio < 0.7f && expertMode) || death || (doubleWormPhase && expertMode); - bool phase4 = lifeRatio < 0.5f && doubleWormPhase && expertMode; - bool phase5 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; // Set timed DR if (!doubleWormPhase) @@ -2878,56 +3329,86 @@ namespace CalamityMod.NPCs bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; + // + // CODE TWEAKED BY: OZZATRON + // September 20th, 2020 + // reason: fixing Astrum Deus death mode NPC cap bug + // + + // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. if (despawning) { - if (!doubleWormPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int startCount = npc.whoAmI + phase1Length + 1; - int npc2 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type, startCount); - Main.npc[npc2].Calamity().newAI[0] = 1f; - Main.npc[npc2].velocity = Vector2.Normalize(player.Center - Main.npc[npc2].Center) * 16f; - Main.npc[npc2].timeLeft *= 20; - Main.npc[npc2].netUpdate = true; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)npc2); - netMessage.Write(Main.npc[npc2].Calamity().newAI[0]); - netMessage.Write(Main.npc[npc2].Calamity().newAI[1]); - netMessage.Write(Main.npc[npc2].Calamity().newAI[2]); - netMessage.Write(Main.npc[npc2].Calamity().newAI[3]); - netMessage.Send(); - } + // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. + if (doubleWormPhase) + return; - int npc3 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type, startCount + phase2Length + 1); - Main.npc[npc3].Calamity().newAI[0] = 2f; - Main.npc[npc3].Calamity().newAI[3] = 600f; - Main.npc[npc3].velocity = Vector2.Normalize(player.Center - Main.npc[npc3].Center) * 16f; - Main.npc[npc3].timeLeft *= 20; - Main.npc[npc3].netUpdate = true; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); - netMessage.Write((byte)npc3); - netMessage.Write(Main.npc[npc3].Calamity().newAI[0]); - netMessage.Write(Main.npc[npc3].Calamity().newAI[1]); - netMessage.Write(Main.npc[npc3].Calamity().newAI[2]); - netMessage.Write(Main.npc[npc3].Calamity().newAI[3]); - netMessage.Send(); - } + // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + if (wormseg.type == bodyID || wormseg.type == tailID) + { + wormseg.life = 0; + wormseg.active = false; } } - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i == npc.whoAmI || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType()) - Main.npc[i].life = 0; - } + // The unsplit Astrum Deus worm head will die next frame. + npc.life = 0; + // Do not spawn worms client side. The server handles this. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Now that the original worm doesn't exist, startCount can be zero. + // int startCount = npc.whoAmI + phase1Length + 1; + int startIndexHeadOne = 1; + int headOneID = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); + Main.npc[headOneID].Calamity().newAI[0] = 1f; + Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; + Main.npc[headOneID].timeLeft *= 20; + Main.npc[headOneID].netUpdate = true; + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)headOneID); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[0]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[1]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[2]); + netMessage.Write(Main.npc[headOneID].Calamity().newAI[3]); + netMessage.Send(); + } + + // Make sure the second split worm is also contiguous. + int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; + int headTwoID = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); + Main.npc[headTwoID].Calamity().newAI[0] = 2f; + Main.npc[headTwoID].Calamity().newAI[3] = 600f; + Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; + Main.npc[headTwoID].timeLeft *= 20; + Main.npc[headTwoID].netUpdate = true; + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)headTwoID); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[0]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[1]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[2]); + netMessage.Write(Main.npc[headTwoID].Calamity().newAI[3]); + netMessage.Send(); + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSplit"), player.Center); + } return; } } @@ -2941,8 +3422,8 @@ namespace CalamityMod.NPCs } // Set worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Emit 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); @@ -2968,19 +3449,20 @@ namespace CalamityMod.NPCs } // Check if other segments are still alive, if not, die - if (npc.type > ModContent.NPCType()) + if (npc.type != ModContent.NPCType()) { bool shouldDespawn = true; + int headType = ModContent.NPCType(); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) - shouldDespawn = false; + if (Main.npc[i].type != headType || !Main.npc[i].active) + continue; + shouldDespawn = false; + break; } - if (!shouldDespawn) + if (shouldDespawn) { - if (npc.ai[1] > 0f) - shouldDespawn = false; - else if (Main.npc[(int)npc.ai[1]].life > 0) + if (Main.npc.IndexInRange((int)npc.ai[1]) && Main.npc[(int)npc.ai[1]].active && Main.npc[(int)npc.ai[1]].life > 0) shouldDespawn = false; } if (shouldDespawn) @@ -2989,6 +3471,7 @@ namespace CalamityMod.NPCs npc.HitEffect(0, 10.0); npc.checkDead(); npc.active = false; + npc.netUpdate = true; } } @@ -3118,8 +3601,8 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; // Despawn - float fallSpeed = 16f; - if (player.dead || Main.dayTime) + float fallSpeed = death ? 17.5f : 16f; + if (player.dead) { flag2 = false; float velocity = 2f; @@ -3130,28 +3613,37 @@ namespace CalamityMod.NPCs npc.velocity.Y -= velocity; } + int headType = ModContent.NPCType(); + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); if ((double)npc.position.Y < Main.topWorld + 16f) { for (int num957 = 0; num957 < Main.maxNPCs; num957++) { - if (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType()) + if (Main.npc[num957].type == headType || Main.npc[num957].type == bodyType || Main.npc[num957].type == tailType) + { Main.npc[num957].active = false; + Main.npc[num957].netUpdate = true; + } } } } - float fallSpeedBoost = death ? 5f : 5f * (1f - lifeRatio); + float fallSpeedBoost = 5f * (1f - lifeRatio); fallSpeed += fallSpeedBoost; + fallSpeed += 4f * enrageScale; // Speed and movement - float speedBoost = death ? (targetFloatingUp ? 0.26f : 0.13f) : ((targetFloatingUp ? 0.26f : 0.13f) * (1f - lifeRatio)); - float turnSpeedBoost = death ? (targetFloatingUp ? 0.4f : 0.2f) : ((targetFloatingUp ? 0.4f : 0.2f) * (1f - lifeRatio)); - float speed = 0.13f + speedBoost; - float turnSpeed = 0.2f + turnSpeedBoost; + float speedBoost = death ? ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.26f : 0.13f) * (1f - lifeRatio)); + float turnSpeedBoost = death ? ((targetFloatingUp ? 0.36f : 0.18f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.4f : 0.2f) * (1f - lifeRatio)); + float speed = (death ? 0.18f : 0.13f) + speedBoost; + float turnSpeed = (death ? 0.25f : 0.2f) + turnSpeedBoost; + speed += 0.05f * enrageScale; + turnSpeed += 0.08f * enrageScale; if (flyAtTarget) { - float speedMultiplier = doubleWormPhase ? (phase5 ? 1.25f : phase4 ? 1.2f : 1.15f) : 1f; + float speedMultiplier = doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; speed *= speedMultiplier; } @@ -3163,11 +3655,9 @@ namespace CalamityMod.NPCs fallSpeed *= revMultiplier; } - if (CalamityWorld.bossRushActive) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + speed *= increaseSpeedMore ? 4f : increaseSpeed ? 2f : 1f; + turnSpeed *= increaseSpeedMore ? 4f : increaseSpeed ? 2f : 1f; + fallSpeed *= increaseSpeedMore ? 4f : increaseSpeed ? 2f : 1f; Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num20 = player.position.X + (player.width / 2); @@ -3182,9 +3672,7 @@ namespace CalamityMod.NPCs if (!flag2) { - npc.TargetClosest(true); npc.velocity.Y += 0.15f; - if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; @@ -3349,33 +3837,20 @@ namespace CalamityMod.NPCs // Shoot lasers if (npc.type == ModContent.NPCType() && Main.netMode != NetmodeID.MultiplayerClient) { - int shootTime = 1; - if (phase2 || targetFloatingUp) - shootTime += 1; - if (phase3 || targetFloatingUp) - shootTime += 1; - + int shootTime = ((doubleWormPhase && expertMode) || targetFloatingUp) ? 2 : 1; npc.localAI[0] += 1f; - float shootProjectile = 600 / shootTime; + float shootProjectile = 400 / shootTime; float timer = npc.ai[0] + 15f; float divisor = timer + shootProjectile; if (!flyAtTarget) { if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Vector2.Distance(player.Center, npc.Center) > 80f) { Main.PlaySound(SoundID.Item12, npc.Center); - float num941 = revenge ? 14f : 13f; - if (CalamityWorld.bossRushActive) - { - num941 = 24f; - } - else if (death) - { - num941 = 16f; - } + float num941 = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; if (targetFloatingUp) { num941 *= 2f; @@ -3387,11 +3862,11 @@ namespace CalamityMod.NPCs num944 = num941 / num944; num942 *= num944; num943 *= num944; - int num945 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(38, 1.5) : 45; - int num946 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); npc.netUpdate = true; } } @@ -3400,9 +3875,9 @@ namespace CalamityMod.NPCs { if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { - int num945 = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(45, 1.5) : 60; - int num946 = ModContent.ProjectileType(); - int proj = Projectile.NewProjectile(npc.Center, Vector2.Zero, num946, num945, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); } } } @@ -3450,36 +3925,84 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Dark Energies are smaller and spread out from each other, 2 - Void accelerates quicker #region Ceaseless Void public static void CeaselessVoidAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - if (CalamityWorld.bossRushActive) - { - calamityGlobalNPC.DR = 0.999999f; - calamityGlobalNPC.unbreakableDR = true; - } - - double lifeRatio = npc.life / (double)npc.lifeMax; - int lifePercentage = (int)(100.0 * lifeRatio); - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - CalamityGlobalNPC.voidBoss = npc.whoAmI; + Vector2 vector = npc.Center; + // Percent life remaining + double lifeRatio = npc.life / (double)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + int lifePercentage = (int)(100.0 * lifeRatio); + + // Difficulty modes + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + // Phases + bool phase2 = lifeRatio <= 0.7; + bool phase3 = lifeRatio <= 0.4; + bool phase4 = lifeRatio <= 0.1; + bool theBigSucc = npc.life / (double)npc.lifeMax <= 0.1; + bool succSoHardThatYouDie = npc.life / (double)npc.lifeMax <= 0.005; + + // Spawn Dark Energies + int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; + if (phase2) + darkEnergyAmt += 1; + if (phase3) + darkEnergyAmt += 1; + if (phase4) + darkEnergyAmt += 1; + + // Spawn a few Dark Energies as soon as the fight starts + int spacing = 360 / darkEnergyAmt; + int distance2 = 10; + if (npc.ai[2] == 0f) + { + npc.ai[2] = 1f; + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + } + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); + } + + // If there are any Dark Energies alive, change AI and don't take damage + bool anyDarkEnergies = NPC.AnyNPCs(ModContent.NPCType()); + bool movingDuringSuccPhase = npc.ai[3] == 0f; + npc.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; + // Get a target - npc.TargetClosest(true); + 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(); Player player = Main.player[npc.target]; - if (NPC.CountNPCS(ModContent.NPCType()) > 0 || NPC.CountNPCS(ModContent.NPCType()) > 0 || NPC.CountNPCS(ModContent.NPCType()) > 0) - npc.dontTakeDamage = true; - else - npc.dontTakeDamage = false; + // Speed enrage + bool moveVeryFast = Vector2.Distance(npc.Center, player.Center) > 960f || (!player.ZoneDungeon && !BossRushEvent.BossRushActive && player.position.Y < Main.worldSurface * 16.0); + // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { npc.TargetClosest(false); @@ -3513,197 +4036,402 @@ namespace CalamityMod.NPCs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - // Detect active tiles around Void - int radius = 20; // 20 tile radius - int diameter = radius * 2; - int npcCenterX = (int)(npc.Center.X / 16f); - int npcCenterY = (int)(npc.Center.Y / 16f); - Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - int nearbyActiveTiles = 0; // 0 to 1600 - for (int x = area.Left; x < area.Right; x++) - { - for (int y = area.Top; y < area.Bottom; y++) - { - 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]) - nearbyActiveTiles++; - } - } - } - // Scale multiplier based on nearby active tiles - float tileEnrageMult = 1f; - if (nearbyActiveTiles < 800) - tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f + float tileEnrageMult = enraged ? 1.5f : BossRushEvent.BossRushActive ? 1.375f : malice ? 1.25f : 1f; + npc.Calamity().CurrentlyEnraged = (tileEnrageMult > 1f && !BossRushEvent.BossRushActive) || enraged; + + // Set AI variable to be used by Dark Energies + npc.ai[1] = tileEnrageMult; // Increase projectile fire rate based on number of nearby active tiles - float projectileFireRateMultiplier = MathHelper.Lerp(1f, 4f, 1f - ((tileEnrageMult - 1f) / 0.8f)); + float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); - // Decrease projectile time left based on number of nearby active tiles - int baseProjectileTimeLeft = (int)(333.4f * tileEnrageMult); - - // Increase damage of projectiles and contact damage based on number of nearby active tiles - int damageIncrease = 0; - if (nearbyActiveTiles < 400) - damageIncrease += (400 - nearbyActiveTiles) / 40; // Ranges from 0 to 10 - - npc.damage = npc.defDamage + damageIncrease * 4; - - if (lifePercentage < 90) + // Succ attack + if (!anyDarkEnergies) { - float num472 = npc.Center.X; - float num473 = npc.Center.Y; - float num474 = (death ? 250f : (float)(250D * (1D - lifeRatio))) * tileEnrageMult; - if (!player.ZoneDungeon) - num474 *= 1.25f; + // This is here because it's used in multiple places + float suckDistance = malice ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; - npc.ai[0] += 1f; - if (npc.ai[0] >= 45f * projectileFireRateMultiplier) + // Move closer to the target before trying to succ + if (movingDuringSuccPhase) { - npc.ai[0] = 0f; - - int numDust = (int)(0.2f * MathHelper.TwoPi * num474); - float angleIncrement = MathHelper.TwoPi / numDust; - Vector2 dustOffset = new Vector2(num474, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - - for (int i = 0; i < numDust; i++) + if (Vector2.Distance(vector, player.Center) > 320f || !Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) + Movement(true); + else + npc.ai[3] = 1f; + } + else + { + // Use this to generate more and more dust in final phase + float finalPhaseDustRatio = 1f; + if (succSoHardThatYouDie) { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, (int)CalamityDusts.PurpleCosmolite); - Main.dust[dust].position = npc.Center + dustOffset; - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].scale = 0.5f; + finalPhaseDustRatio = 5f; + } + else if (theBigSucc) + { + float amount = (10f - (float)(npc.life / (double)npc.lifeMax) * 100f) / 10f; + finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); } - float pullVelocity = (player.Calamity().gravityNormalizer ? 9f : 15f) * tileEnrageMult; - for (int num475 = 0; num475 < Main.maxPlayers; num475++) - { - if (Collision.CanHit(npc.Center, 1, 1, Main.player[num475].Center, 1, 1)) - { - float num476 = Main.player[num475].position.X + (Main.player[num475].width / 2); - float num477 = Main.player[num475].position.Y + (Main.player[num475].height / 2); - float num478 = Math.Abs(npc.position.X + (npc.width / 2) - num476) + Math.Abs(npc.position.Y + (npc.height / 2) - num477); + // Slow down + if (npc.velocity.Length() > 0.5f) + npc.velocity *= 0.8f; + else + npc.velocity = Vector2.Zero; - if (num478 < num474) + // Move towards target again if they get outside the succ radius + float moveCloserGateValue = suckDistance * 0.75f; + if (Vector2.Distance(vector, player.Center) > moveCloserGateValue) + npc.ai[3] = 0f; + + // Ceaseless Void sucks in dark energy in different patterns + // This attack also sucks in all players that are within reach of the succ + int dustRings = 3; + for (int h = 0; h < dustRings; h++) + { + float distanceDivisor = h + 1f; + float dustDistance = suckDistance / distanceDivisor; + int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); + float angleIncrement = MathHelper.TwoPi / (float)numDust; + Vector2 dustOffset = new Vector2(dustDistance, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + + int var = (int)(dustDistance / finalPhaseDustRatio); + float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; + for (int i = 0; i < numDust; i++) + { + if (Main.rand.NextBool(var)) { - if (Main.player[num475].position.X < num472) - Main.player[num475].velocity.X += pullVelocity; + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dust = Dust.NewDust(vector, 1, 1, ModContent.DustType()); + Main.dust[dust].position = vector + dustOffset; + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].velocity = Vector2.Normalize(vector - Main.dust[dust].position) * dustVelocity; + Main.dust[dust].scale = 3f - h; + } + } + } + + float succPower = 0.1f + finalPhaseDustRatio * 0.1f; + for (int i = 0; i < Main.maxPlayers; i++) + { + float distance = Vector2.Distance(Main.player[i].Center, vector); + if (distance < suckDistance && Main.player[i].grappling[0] == -1) + { + if (Collision.CanHit(vector, 1, 1, Main.player[i].Center, 1, 1)) + { + float distanceRatio = distance / suckDistance; + float multiplier = 1f - distanceRatio; + + if (Main.player[i].Center.X < vector.X) + Main.player[i].velocity.X += succPower * multiplier; else - Main.player[num475].velocity.X -= pullVelocity; - if (Main.player[num475].position.Y < num473) - Main.player[num475].velocity.Y += pullVelocity; + Main.player[i].velocity.X -= succPower * multiplier; + + if (Main.player[i].Center.Y < vector.Y) + Main.player[i].velocity.Y += succPower * multiplier; else - Main.player[num475].velocity.Y -= pullVelocity; + Main.player[i].velocity.Y -= succPower * multiplier; + } + } + } + + // Projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Slowly die in final phase and then implode + // This phase lasts 20 seconds + if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) + { + int damageAmt = npc.lifeMax / 200; + npc.life -= damageAmt; + npc.HealEffect(-damageAmt, true); + + if (npc.life <= 0) + { + npc.life = 0; + npc.HitEffect(); + npc.checkDead(); + } + + npc.netUpdate = true; + } + + // Beam Portals + if (calamityGlobalNPC.newAI[1] == 0f) + { + int numBeamPortals = malice ? 3 : revenge ? 2 : 1; + float degrees = 360 / numBeamPortals; + float beamPortalDistance = malice ? 800f : death ? 960f : revenge ? 1000f : expertMode ? 1040f : 1080f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + for (int i = 0; i < numBeamPortals; i++) + { + float ai1 = i * degrees; + Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, player.whoAmI, ai1, 0f); + } + } + + // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active + float beamPortalTimeLeft = 600f; + bool summonLessDarkEnergies = false; + if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) + { + calamityGlobalNPC.newAI[1] += 1f; + summonLessDarkEnergies = true; + } + else if (theBigSucc) + calamityGlobalNPC.newAI[1] += 1f; + + // Suck in Dark Energy projectiles from far away + calamityGlobalNPC.newAI[3] += 1f; + float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 36f : 12f) * projectileFireRateMultiplier; + if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) + { + calamityGlobalNPC.newAI[3] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f == 0f; + float speed = 0.5f; + int totalProjectiles = 4; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1]); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + npc.localAI[1] += 10f; + } + + // Summon some extra projectiles in Expert Mode + if (phase2 && expertMode && !summonLessDarkEnergies) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) + { + npc.localAI[2] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f != 0f; + float speed = 2f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + + // Summon some extra projectiles in Revengeance Mode + if (phase4 && revenge && !summonLessDarkEnergies) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) + { + npc.localAI[3] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f == 0f; + float speed = 4f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } } } } } } - - if (Main.netMode != NetmodeID.MultiplayerClient) + else { - calamityGlobalNPC.newAI[1] += expertMode ? 1.5f : 1f; - calamityGlobalNPC.newAI[1] += calamityGlobalNPC.newAI[2]; - if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - calamityGlobalNPC.newAI[1] += 2f; + Movement(false); - if (calamityGlobalNPC.newAI[1] >= 600f * projectileFireRateMultiplier) + // Count up all Dark Energy HP values + int totalDarkEnergyHP = 0; + for (int i = 0; i < Main.maxNPCs; i++) { - calamityGlobalNPC.newAI[1] = 0f; - int damage = (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(50, 1.5) : 60) + damageIncrease; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) + totalDarkEnergyHP += darkEnergy.life; + } + + // Destroy all Dark Energies if their total HP is below 20% + int darkEnergyMaxHP = BossRushEvent.BossRushActive ? 44000 : (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) ? 12000 : 3000; + int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; + int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; + int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); + if (totalDarkEnergyHP < succPhaseGateValue) + { + Main.PlaySound(SoundID.NPCDeath44, vector); + + // Kill all Dark Energies + for (int i = 0; i < Main.maxNPCs; i++) { - float num941 = 3f * tileEnrageMult; - 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; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num946 = ModContent.ProjectileType(); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, damage, 0f, Main.myPlayer, tileEnrageMult, 0f); - Main.projectile[num947].timeLeft = baseProjectileTimeLeft / 2; - npc.netUpdate = true; + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) + { + darkEnergy.HitEffect(); + darkEnergy.active = false; + darkEnergy.netUpdate = true; + } } - if (revenge) + // Generate a dust explosion + int dustAmt = 30; + int random = 3; + for (int j = 0; j < 10; j++) { - if (lifePercentage < 50 || death || !player.ZoneDungeon) + random += j * 2; + int dustAmtSpawned = 0; + int scale = random * 13; + float dustPositionX = vector.X - (scale / 2); + float dustPositionY = vector.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) { - for (int i = 0; i < 12; i++) - { - float ai1 = player.ZoneDungeon ? 0f : 1f; - int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, i * 30, ai1); - Main.projectile[proj].timeLeft = baseProjectileTimeLeft; - } - } - else - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - float passedVar = 1f; - - for (i = 0; i < 4; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, passedVar, 0f); - Main.projectile[proj].timeLeft = baseProjectileTimeLeft; - passedVar += 1f; - } + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position.X = vector.X; + Main.dust[dust].position.Y = vector.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; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; } } } } - float num823 = (expertMode ? 7.5f : 6f) * tileEnrageMult; - float num824 = expertMode ? 0.08f : 0.06f; - if (!player.ZoneDungeon || CalamityWorld.bossRushActive) - num823 = expertMode ? 25f : 20f; + // Basic movement towards a location + void Movement(bool succ) + { + float velocity = moveVeryFast ? 25f : BossRushEvent.BossRushActive ? 15f : ((expertMode ? 7.5f : 6f) + (float)(death ? 2f * (1D - lifeRatio) : 0f)) * tileEnrageMult; + float acceleration = moveVeryFast ? 0.75f : malice ? 0.3f : death ? 0.2f : expertMode ? 0.16f : 0.12f; - 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) - vector82.Y; - float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + // Increase speed dramatically in succ phase + if (succ) + { + velocity *= 2f; + acceleration *= 2f; + } - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; + Vector2 moveTo = new Vector2(player.Center.X - vector.X, player.Center.Y - vector.Y); - if (npc.velocity.X < num825) - { - npc.velocity.X += num824; - if (npc.velocity.X < 0f && num825 > 0f) - npc.velocity.X += num824; - } - else if (npc.velocity.X > num825) - { - npc.velocity.X -= num824; - if (npc.velocity.X > 0f && num825 < 0f) - npc.velocity.X -= num824; - } - if (npc.velocity.Y < num826) - { - npc.velocity.Y += num824; - if (npc.velocity.Y < 0f && num826 > 0f) - npc.velocity.Y += num824; - } - else if (npc.velocity.Y > num826) - { - npc.velocity.Y -= num824; - if (npc.velocity.Y > 0f && num826 < 0f) - npc.velocity.Y -= num824; + // Move between 8 different positions around the player, in order + float maxDistance = 320f; + Vector2 moveToOffset = succ ? Vector2.Zero : new Vector2(0f, -maxDistance); + if (!succ) + { + // Move to a new location every few seconds + calamityGlobalNPC.newAI[2] += 1f; + float newPositionGateValue = malice ? 180f : death ? 270f : revenge ? 300f : expertMode ? 360f : 480f; + if (calamityGlobalNPC.newAI[2] > newPositionGateValue) + { + calamityGlobalNPC.newAI[2] = 0f; + + npc.ai[0] += 1f; + if (npc.ai[0] > 7f) + npc.ai[0] = 0f; + } + + switch ((int)npc.ai[0]) + { + case 0: + break; + case 1: + moveToOffset.X = -maxDistance; + break; + case 2: + moveToOffset.X = -maxDistance; + moveToOffset.Y = 0f; + break; + case 3: + moveToOffset.X = -maxDistance; + moveToOffset.Y = maxDistance; + break; + case 4: + moveToOffset.Y = maxDistance; + break; + case 5: + moveToOffset.X = maxDistance; + moveToOffset.Y = maxDistance; + break; + case 6: + moveToOffset.X = maxDistance; + moveToOffset.Y = 0f; + break; + case 7: + moveToOffset.X = maxDistance; + break; + } + } + + moveTo += moveToOffset; + + float distance = (float)Math.Sqrt(moveTo.X * moveTo.X + moveTo.Y * moveTo.Y); + + distance = velocity / distance; + moveTo.X *= distance; + moveTo.Y *= distance; + + if (npc.velocity.X < moveTo.X) + { + npc.velocity.X += acceleration; + if (npc.velocity.X < 0f && moveTo.X > 0f) + npc.velocity.X += acceleration; + } + else if (npc.velocity.X > moveTo.X) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X > 0f && moveTo.X < 0f) + npc.velocity.X -= acceleration; + } + if (npc.velocity.Y < moveTo.Y) + { + npc.velocity.Y += acceleration; + if (npc.velocity.Y < 0f && moveTo.Y > 0f) + npc.velocity.Y += acceleration; + } + else if (npc.velocity.Y > moveTo.Y) + { + npc.velocity.Y -= acceleration; + if (npc.velocity.Y > 0f && moveTo.Y < 0f) + npc.velocity.Y -= acceleration; + } } + // Spawn more Dark Energies as the fight progresses if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) calamityGlobalNPC.newAI[0] = npc.lifeMax; @@ -3711,23 +4439,67 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)(npc.lifeMax * 0.26); - if ((npc.life + num660) < calamityGlobalNPC.newAI[0]) + int healthGateValue = (int)(npc.lifeMax * 0.3); + if ((npc.life + healthGateValue) < calamityGlobalNPC.newAI[0]) { + npc.TargetClosest(); calamityGlobalNPC.newAI[0] = npc.life; - calamityGlobalNPC.newAI[2] += 1f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.ai[3] = 0f; + npc.localAI[0] += 1f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + npc.localAI[3] = 0f; - int glob = expertMode ? 6 : 4; - if (calamityGlobalNPC.newAI[0] <= 0.5f) - glob = expertMode ? 12 : 8; - - glob = (int)(glob * MathHelper.Clamp(tileEnrageMult * 0.85f, 1f, 1.5f)); - - for (int num662 = 0; num662 < glob; num662++) + if (phase4) { - NPC.NewNPC((int)npc.Center.X - 200, (int)npc.Center.Y - 200, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X + 200, (int)npc.Center.Y - 200, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 200, ModContent.NPCType()); + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); + } + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); + } + else if (phase3) + { + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); + } + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); + } + else + { + for (int i = 0; i < darkEnergyAmt; i++) + { + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(i * spacing) * distance2)), (int)(vector.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); + } + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); + NPC.NewNPC((int)(vector.X + (Math.Sin(0) * distance2)), (int)(vector.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); + } + + // Despawn potentially hazardous projectiles when entering a new phase + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 30) + projectile.timeLeft = 30; + } + } } } } @@ -3735,25 +4507,47 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Always has 1 added to its enraged scale, 2 - Lightning auras are horizontal instead of vertical #region Bumblebirb public static void BumblebirbAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Get a 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 == 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(); Player player = Main.player[npc.target]; // Variables float rotationMult = 3f; float rotationAmt = 0.03f; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; Vector2 vector = npc.Center; + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.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[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + // If target is outside the jungle for more than 3 seconds, enrage if (!player.ZoneJungle) { @@ -3771,11 +4565,20 @@ namespace CalamityMod.NPCs npc.localAI[2] = 2f; // Enrage scale - int enrageScale = 1; - if (npc.localAI[1] >= 300f) - enrageScale += 1; - if (npc.localAI[2] > 0f) - enrageScale += 1; + float enrageScale = death ? 1.5f : 1f; + if (npc.localAI[1] >= 300f || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (npc.localAI[2] > 0f || malice) + enrageScale += 1f; + + if (enraged) + npc.Calamity().CurrentlyEnraged = true; + + if (enrageScale > 3f) + enrageScale = 3f; // Despawn if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) @@ -3793,8 +4596,6 @@ namespace CalamityMod.NPCs if (npc.velocity.Y < -12f) npc.velocity.Y = -12f; - npc.noTileCollide = true; - if (npc.timeLeft > 60) npc.timeLeft = 60; @@ -3803,7 +4604,6 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; npc.netUpdate = true; } @@ -3816,8 +4616,12 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases - bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; float birbSpawnPhaseTimer = 180f; @@ -3827,14 +4631,10 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = phaseSwitchPhase; - calamityGlobalNPC.DR = (npc.ai[0] == 5f || enrageScale == 3) ? 0.75f : 0.1f; + calamityGlobalNPC.DR = (npc.ai[0] == 5f || (enrageScale == 3f && !malice && !enraged)) ? 0.75f : 0.1f; if (phaseSwitchPhase) { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - if (npc.velocity.X < 0f) npc.direction = -1; else if (npc.velocity.X > 0f) @@ -3860,11 +4660,13 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) { calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 1f; calamityGlobalNPC.newAI[3] = 1f; npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.SyncExtraAI(); + npc.netUpdate = true; } } else @@ -3888,7 +4690,8 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.SyncExtraAI(); + npc.netUpdate = true; } } @@ -3898,31 +4701,19 @@ namespace CalamityMod.NPCs value52.Normalize(); value52 *= scaleFactor16; npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; - npc.netSpam = 5; - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } return; } // Max spawn amount - int maxBirbs = phase2 ? 1 : 2; + int maxBirbs = enraged ? 5 : revenge ? 3 : 2; // Variable for charging - float chargeDistance = 600f; + float chargeDistance = enraged ? 500f : 600f; if (phase2) chargeDistance -= 50f; if (phase3) chargeDistance -= 50f; - chargeDistance -= (enrageScale - 1) * 100f; - - // Don't collide with tiles, disable gravity - npc.noTileCollide = false; - npc.noGravity = true; - - // Reset damage - npc.damage = npc.defDamage; + chargeDistance -= (enrageScale - 1f) * 100f; // Phase switch if (npc.ai[0] == 0f) @@ -3936,38 +4727,19 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - // Slow down if colliding with tiles - if (npc.collideX) - { - npc.velocity.X *= -npc.oldVelocity.X * 0.5f; - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - // Fly to target if target is too far away, otherwise get close to target and then slow down Vector2 value51 = player.Center - npc.Center; value51.Y -= 200f; if (value51.Length() > 2800f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; } else if (value51.Length() > 240f) { - float scaleFactor15 = 12f + (enrageScale - 1) * 6f; + float scaleFactor15 = 12f + (enrageScale - 1f) * 6f; float num1306 = 30f; value51.Normalize(); value51 *= scaleFactor15; @@ -3984,8 +4756,7 @@ namespace CalamityMod.NPCs { npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; + while (npc.ai[0] == 0f) { if (phase2) @@ -3995,10 +4766,14 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= (phase3 ? 7 : 9) && canHit) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 5f; npc.localAI[0] = 0f; + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + // Decrease enraged attacks by 1 if (npc.localAI[2] > 0f) npc.localAI[2] -= 1f; @@ -4013,14 +4788,19 @@ namespace CalamityMod.NPCs if (phase3) num1307 = 1; - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(50, 1.5) : 60; - float featherVelocity = 3f + (enrageScale - 1) * 1.5f; + float featherVelocity = 2f + (enrageScale - 1f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); if (num1307 == 0 && canHit && npc.localAI[3] == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 2f; + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + // Decrease enraged attacks by 1 if (npc.localAI[2] > 0f) npc.localAI[2] -= 1f; @@ -4030,7 +4810,7 @@ namespace CalamityMod.NPCs } else if (num1307 == 1) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 3f; // Decrease enraged attacks by 1 @@ -4041,23 +4821,46 @@ namespace CalamityMod.NPCs if (npc.localAI[3] > 0f) npc.localAI[3] -= 1f; - if (phase2) + if (phase2 && npc.ai[3] == 0f) { + npc.ai[3] = 3f; Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); - int totalProjectiles = phase3 ? 4 : 3; + int totalProjectiles = 40; float radians = MathHelper.TwoPi / totalProjectiles; - int distance = 560; + int distance = 800; + bool spawnRight = player.velocity.X > 0f; for (int i = 0; i < totalProjectiles; i++) { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(spawnVector, velocity, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); + if (spawnRight) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + else + { + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } } } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; + } } else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && npc.localAI[3] == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 4f; // Birb will do at least 2 different attacks before entering this phase again @@ -4067,29 +4870,54 @@ namespace CalamityMod.NPCs if (npc.localAI[2] > 0f) npc.localAI[2] -= 1f; - Main.PlaySound(SoundID.Item102, (int)player.position.X, (int)player.position.Y); - int totalProjectiles = phase2 ? 5 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = phase2 ? 720 : 880; - for (int i = 0; i < totalProjectiles; i++) + if (npc.ai[3] == 0f) { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(spawnVector, velocity, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); + npc.ai[3] = 3f; + Main.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; + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (spawnRight) + { + if (i >= totalProjectiles / 2) + break; + + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + else + { + if (i >= totalProjectiles / 2) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (npc.ai[3] > 0f) + npc.ai[3] -= 1f; } } } } + + npc.netUpdate = true; + npc.SyncExtraAI(); } } // Fly to target else if (npc.ai[0] == 1f) { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - if (npc.velocity.X < 0f) npc.direction = -1; else if (npc.velocity.X > 0f) @@ -4101,24 +4929,20 @@ namespace CalamityMod.NPCs Vector2 value52 = player.Center - npc.Center; if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.netUpdate = true; + npc.SyncExtraAI(); } - float velocity = 14f + (enrageScale - 1) * 4f; + float velocity = 14f + (enrageScale - 1f) * 4f; float scaleFactor16 = velocity + value52.Length() / 100f; float num1308 = 25f; value52.Normalize(); value52 *= scaleFactor16; npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; - npc.netSpam = 5; - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } } // Fly towards target quickly @@ -4126,11 +4950,12 @@ namespace CalamityMod.NPCs { if (npc.target < 0 || !player.active || player.dead) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.netUpdate = true; + npc.SyncExtraAI(); } if (player.Center.X - 10f < npc.Center.X) @@ -4141,30 +4966,13 @@ namespace CalamityMod.NPCs npc.spriteDirection = npc.direction; npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f; - if (npc.collideX) - { - npc.velocity.X *= -npc.oldVelocity.X * 0.5f; - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - Vector2 value53 = player.Center - npc.Center; value53.Y -= 20f; npc.ai[2] += 0.0222222228f; if (expertMode) npc.ai[2] += 0.0166666675f; - float velocity = 8f + (enrageScale - 1) * 2f; + float velocity = 8f + (enrageScale - 1f) * 2f; float scaleFactor17 = velocity + npc.ai[2] + value53.Length() / 120f; float num1309 = 20f; value53.Normalize(); @@ -4174,19 +4982,18 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.netUpdate = true; + npc.SyncExtraAI(); } } // Line up charge else if (npc.ai[0] == 3f) { - npc.noTileCollide = true; - if (npc.velocity.X < 0f) npc.direction = -1; else @@ -4202,15 +5009,17 @@ namespace CalamityMod.NPCs else value54.X -= chargeDistance; - float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1) * 20f; + float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) { npc.ai[0] = 3.1f; npc.ai[1] = 0f; + npc.netUpdate = true; + npc.SyncExtraAI(); } npc.ai[1] += 0.0333333351f; - float velocity = 16f + (enrageScale - 1) * 4f; + float velocity = 16f + (enrageScale - 1f) * 4f; float scaleFactor18 = velocity + npc.ai[1]; float num1310 = 4f; value54.Normalize(); @@ -4221,13 +5030,11 @@ namespace CalamityMod.NPCs // Prepare to charge else if (npc.ai[0] == 3.1f) { - npc.noTileCollide = true; - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; Vector2 vector206 = player.Center - npc.Center; vector206.Y -= 12f; - float scaleFactor19 = 28f + (enrageScale - 1) * 4f; + float scaleFactor19 = 28f + (enrageScale - 1f) * 4f; float num1311 = 8f; vector206.Normalize(); vector206 *= scaleFactor19; @@ -4251,41 +5058,36 @@ namespace CalamityMod.NPCs npc.direction = 1; npc.ai[0] = 3.2f; - npc.ai[1] = 0f; npc.ai[1] = npc.direction; + npc.netUpdate = true; + npc.SyncExtraAI(); } } // Charge else if (npc.ai[0] == 3.2f) { - npc.damage = (int)(npc.defDamage * 1.3); - - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.ai[2] += 0.0333333351f; - float velocity = 28f + (enrageScale - 1) * 4f; + float velocity = 28f + (enrageScale - 1f) * 4f; npc.velocity.X = (velocity + npc.ai[2]) * npc.ai[1]; if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) { if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.netUpdate = true; } else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] = 0f; + npc.netUpdate = true; } } @@ -4298,7 +5100,7 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { Vector2 destination2 = player.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * 18f; + Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; npc.SimpleFlyMovement(desiredVelocity2, 1.5f); if (npc.velocity.X < 0f) @@ -4342,12 +5144,13 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || npc.ai[1] == 170f); + bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f); if (spawnFlag) { Vector2 vector7 = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); if (Vector2.Distance(vector7, player.Center) > 150f) NPC.NewNPC((int)vector7.X, (int)vector7.Y, ModContent.NPCType(), npc.whoAmI); + npc.netUpdate = true; } } @@ -4359,6 +5162,8 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -4378,10 +5183,11 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; - float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1); + float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); if (ai0 > 3f) ai0 = 3f; Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); + npc.netUpdate = true; } } @@ -4396,17 +5202,30 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Every NPC in the fight is bigger, 2 - Cycles between attacks quicker #region Old Duke public static void OldDukeAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.Calamity().canBreakPlayerDefense = true; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Variables - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.7 : 0.5) || death; - bool phase3 = npc.life <= npc.lifeMax * (death ? 0.5 : (revenge ? 0.35 : 0.2)) && expertMode; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); + bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -4415,121 +5234,118 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[0] >= 300f) calamityGlobalNPC.newAI[1] = 1f; - if (calamityGlobalNPC.newAI[1] == 1f) - { - // Play tired sound - if (calamityGlobalNPC.newAI[0] % 60f == 0f) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeHuff"), (int)npc.position.X, (int)npc.position.Y); - - calamityGlobalNPC.newAI[0] -= 1f; - if (calamityGlobalNPC.newAI[0] <= 0f) - calamityGlobalNPC.newAI[1] = 0f; - } - // Adjust stats calamityGlobalNPC.DR = calamityGlobalNPC.newAI[1] == 1f ? 0f : 0.5f; npc.defense = calamityGlobalNPC.newAI[1] == 1f ? 0 : npc.defDefense; if (phase3AI) { - npc.damage = (int)(npc.defDamage * 1.32f); + npc.damage = (int)(npc.defDamage * 1.3f); + npc.defense = calamityGlobalNPC.newAI[1] == 1f ? 0 : npc.defDefense - 40; } else if (phase2AI) { - npc.damage = (int)(npc.defDamage * 1.44f); + npc.damage = (int)(npc.defDamage * 1.2f); + npc.defense = calamityGlobalNPC.newAI[1] == 1f ? 0 : npc.defDefense - 20; } else { npc.damage = npc.defDamage; } - int num2 = 60; - float num3 = 0.6f; - float scaleFactor = 10f; + int idlePhaseTimer = expertMode ? 55 : 60; + float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; + float idlePhaseVelocity = expertMode ? 14f : 13f; if (phase3AI) { - num3 = 0.75f; - scaleFactor = 13f; + idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; + idlePhaseVelocity = expertMode ? 12f : 11f; } else if (phase2AI & charging) { - num3 = 0.65f; - scaleFactor = 11f; + idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; + idlePhaseVelocity = expertMode ? 15f : 14f; } - int chargeTime = 36; - float chargeVelocity = 19f; + int chargeTime = expertMode ? 34 : 36; + float chargeVelocity = expertMode ? 20f : 19f; if (phase3AI) { - chargeTime = 30; - chargeVelocity = 25f; + chargeTime = expertMode ? 28 : 30; + chargeVelocity = expertMode ? 26f : 25f; } else if (charging & phase2AI) { - chargeTime = 33; - chargeVelocity = 23f; + chargeTime = expertMode ? 31 : 33; + chargeVelocity = expertMode ? 24f : 23f; } - if (death) + if (malice) { - num2 = 54; - num3 *= 1.05f; - scaleFactor *= 1.08f; - chargeTime -= 2; - chargeVelocity *= 1.13f; - } - else if (revenge) - { - num2 = 57; - num3 *= 1.025f; - scaleFactor *= 1.04f; - chargeTime -= 1; - chargeVelocity *= 1.065f; - } - - if (CalamityWorld.bossRushActive) - { - num2 = 35; - num3 *= 1.1f; - scaleFactor *= 1.15f; + idlePhaseTimer = 35; + idlePhaseAcceleration *= 1.25f; + idlePhaseVelocity *= 1.2f; chargeTime -= 3; chargeVelocity *= 1.25f; } + else if (death) + { + idlePhaseTimer = 51; + idlePhaseAcceleration *= 1.05f; + idlePhaseVelocity *= 1.05f; + chargeTime -= 2; + chargeVelocity *= 1.1f; + } + else if (revenge) + { + idlePhaseTimer = 53; + idlePhaseAcceleration *= 1.025f; + idlePhaseVelocity *= 1.025f; + chargeTime -= 1; + chargeVelocity *= 1.05f; + } if (calamityGlobalNPC.newAI[1] == 1f) - scaleFactor *= 0.25f; + idlePhaseVelocity *= 0.25f; // Variables - int num6 = CalamityWorld.bossRushActive ? 60 : 120; - int num7 = CalamityWorld.bossRushActive ? 12 : 24; - float num8 = CalamityWorld.bossRushActive ? 0.6f : 0.4f; - float scaleFactor2 = CalamityWorld.bossRushActive ? 10f : 7f; + int toothBallBelchPhaseTimer = malice ? 35 : death ? 90 : 120; + int toothBallBelchPhaseDivisor = malice ? 7 : death ? 18 : 24; + float toothBallBelchPhaseAcceleration = malice ? 0.95f : death ? 0.6f : 0.55f; + float toothBallBelchPhaseVelocity = malice ? 14f : death ? 10f : 9f; + float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; + float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; + float sharkronVelocity = malice ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; int num9 = 120; int num10 = 180; - int num11 = 180; int num12 = 30; - int num13 = CalamityWorld.bossRushActive ? 60 : 120; - int num14 = CalamityWorld.bossRushActive ? 12 : 24; + int num13 = malice ? 35 : death ? 90 : 120; + int toothBallSpinPhaseDivisor = malice ? 7 : death ? 18 : 24; float spinTime = num13 / 2; - float scaleFactor3 = CalamityWorld.bossRushActive ? 11f : 9f; + float toothBallSpinToothBallVelocity = malice ? 14f : death ? 9.5f : 9f; float scaleFactor4 = 22f; float num15 = MathHelper.TwoPi / spinTime; int num16 = 75; Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; // Get target if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; npc.netUpdate = true; } + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + // Despawn - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + if (player.dead || Vector2.Distance(player.Center, vector) > 8800f) { + npc.TargetClosest(); + npc.velocity.Y -= 0.4f; if (npc.timeLeft > 10) @@ -4551,23 +5367,54 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; } + if (calamityGlobalNPC.newAI[1] == 1f) + { + npc.Calamity().canBreakPlayerDefense = false; + + npc.damage /= 4; + + // Play tired sound + if (calamityGlobalNPC.newAI[0] % 60f == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeHuff"), player.Center); + + calamityGlobalNPC.newAI[0] -= malice ? 1.5f : 1f; + if (calamityGlobalNPC.newAI[0] <= 0f) + calamityGlobalNPC.newAI[1] = 0f; + } + // Enrage variable - bool enrage = !CalamityWorld.bossRushActive && + bool enrage = !BossRushEvent.BossRushActive && (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7200f && player.position.X < (Main.maxTilesX * 16 - 7200))); + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + npc.Calamity().CurrentlyEnraged = enrage || enraged; // If the player isn't in the ocean biome or Old Duke is transitioning between phases, become immune if (!phase3AI) - npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || enrage; + npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; // Enrage - if (enrage) + if (enrage || enraged) { - num2 = 30; - npc.damage = npc.defDamage * 2; - npc.defense = npc.defDefense * 2; - npc.ai[3] = 0f; + toothBallBelchPhaseTimer = 30; + toothBallBelchPhaseDivisor = 6; + toothBallBelchPhaseAcceleration = 1f; + toothBallBelchPhaseVelocity = 15f; + goreVelocityX = 12f; + goreVelocityY = 16f; + sharkronVelocity = 20f; + idlePhaseTimer = 20; + idlePhaseAcceleration = 1.2f; + idlePhaseVelocity = 20f; + chargeTime = 25; chargeVelocity += 8f; + toothBallSpinPhaseDivisor = 6; + toothBallSpinToothBallVelocity = 15f; + + if (!enraged) + { + npc.damage = npc.defDamage * 2; + npc.defense = npc.defDefense * 3; + } } // Set variables for spawn effects @@ -4584,7 +5431,45 @@ namespace CalamityMod.NPCs } // Rotation - float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); + float rateOfRotation = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) + rateOfRotation = 0f; + if (npc.ai[0] == 3f || npc.ai[0] == 4f) + rateOfRotation = 0.01f; + if (npc.ai[0] == 8f || npc.ai[0] == 13f) + rateOfRotation = 0.05f; + + Vector2 rotationVector = player.Center - vector; + if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) + { + // Rotate to show direction of predictive charge + if (npc.ai[0] == 0f && !phase2) + { + if (npc.ai[3] < 6f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + } + } + else if (npc.ai[0] == 5f && !phase3) + { + if (npc.ai[3] < 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + } + } + else if (npc.ai[0] == 10f) + { + if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + } + } + } + + float num17 = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) num17 += pie; if (num17 < 0f) @@ -4594,42 +5479,32 @@ namespace CalamityMod.NPCs if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) num17 = 0f; if (npc.ai[0] == 8f || npc.ai[0] == 13f) - { num17 = pie * 0.1666666667f * npc.spriteDirection; - } - - float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) - num18 = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - num18 = 0.01f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - num18 = 0.05f; if (npc.rotation < num17) { if (num17 - npc.rotation > pie) - npc.rotation -= num18; + npc.rotation -= rateOfRotation; else - npc.rotation += num18; + npc.rotation += rateOfRotation; } if (npc.rotation > num17) { if (npc.rotation - num17 > pie) - npc.rotation += num18; + npc.rotation += rateOfRotation; else - npc.rotation -= num18; + npc.rotation -= rateOfRotation; } if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) { - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation) npc.rotation = num17; 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) + if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation) npc.rotation = num17; } @@ -4711,8 +5586,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(vector3, num3); + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(vector3, idlePhaseAcceleration); // Rotation and direction int num22 = Math.Sign(player.Center.X - vector.X); @@ -4733,7 +5608,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) { npc.ai[2] += 1f; - if (npc.ai[2] >= num2 || (phase2 && !phase2AI)) + if (npc.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) { int num23 = 0; switch ((int)npc.ai[3]) @@ -4839,6 +5714,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -4850,14 +5726,14 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor2; - npc.SimpleFlyMovement(vector5, num8); + Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * toothBallBelchPhaseVelocity; + npc.SimpleFlyMovement(vector5, toothBallBelchPhaseAcceleration); // 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); - if (npc.ai[2] % num7 == 0f) + 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); @@ -4880,12 +5756,13 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num6) + if (npc.ai[2] >= toothBallBelchPhaseTimer) { calamityGlobalNPC.newAI[0] += 30f; npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -4919,6 +5796,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -4939,8 +5817,8 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 150f; - NPC.NewNPC((int)(vector.X + 50f + calamityGlobalNPC.newAI[2]), (int)(vector.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -12f, 255); - NPC.NewNPC((int)(vector.X - 50f - calamityGlobalNPC.newAI[2]), (int)(vector.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -12f, 255); + NPC.NewNPC((int)(vector.X + 50f + calamityGlobalNPC.newAI[2]), (int)(vector.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC((int)(vector.X - 50f - calamityGlobalNPC.newAI[2]), (int)(vector.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); } } @@ -4954,6 +5832,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -4965,8 +5844,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(vector8, num3); + Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - vector - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(vector8, idlePhaseAcceleration); // Direction and rotation int num27 = Math.Sign(player.Center.X - vector.X); @@ -4987,7 +5866,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) { npc.ai[2] += 1f; - if (npc.ai[2] >= num2 || (phase3 && !phase3AI)) + if (npc.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) { int num28 = 0; switch ((int)npc.ai[3]) @@ -5105,6 +5984,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5117,15 +5997,16 @@ namespace CalamityMod.NPCs { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(100, 1.5) : 140; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(vortexSpawn, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + Projectile.NewProjectile(vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); } } - if (npc.ai[2] % num14 == 0f) + 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); @@ -5135,7 +6016,7 @@ namespace CalamityMod.NPCs Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; + Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; Main.npc[num31].netUpdate = true; Main.npc[num31].ai[3] = Main.rand.Next(30, 181); } @@ -5152,6 +6033,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 5f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5171,12 +6053,13 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(55, 1.5) : 70; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); for (int i = 0; i < 20; i++) { - float velocityX = npc.direction * 6 * (Main.rand.NextFloat() + 0.5f); - float velocityY = 8f * (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(vector7.X, vector7.Y, velocityX, -velocityY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat() + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(vector7.X, vector7.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -5200,6 +6083,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 5f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5212,21 +6096,21 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == num11 - 60) + if (npc.ai[2] == num10 - 60) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.ai[2] >= num11 - 60) + if (npc.ai[2] >= num10 - 60) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 18f == 0f) { calamityGlobalNPC.newAI[2] += 200f; - NPC.NewNPC((int)(vector.X + 50f + calamityGlobalNPC.newAI[2]), (int)(vector.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, 12f, 255); - NPC.NewNPC((int)(vector.X - 50f - calamityGlobalNPC.newAI[2]), (int)(vector.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, 12f, 255); + NPC.NewNPC((int)(vector.X + 50f + calamityGlobalNPC.newAI[2]), (int)(vector.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); + NPC.NewNPC((int)(vector.X - 50f - calamityGlobalNPC.newAI[2]), (int)(vector.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); } } npc.ai[2] += 1f; - if (npc.ai[2] >= num11) + if (npc.ai[2] >= num10) { calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -5235,6 +6119,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5247,12 +6132,12 @@ namespace CalamityMod.NPCs if (npc.alpha < 0) npc.alpha = 0; - // Teleport location + // Movement location if (npc.ai[1] == 0f) - npc.ai[1] = 540 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 500 * Math.Sign((vector - player.Center).X); - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, num3); + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - vector - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); // Rotation and direction int num32 = Math.Sign(player.Center.X - vector.X); @@ -5277,7 +6162,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] != 1f) { npc.ai[2] += 1f; - if (npc.ai[2] >= num2) + if (npc.ai[2] >= idlePhaseTimer) { int num33 = 0; switch ((int)npc.ai[3]) @@ -5398,6 +6283,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5427,7 +6313,7 @@ namespace CalamityMod.NPCs { // Teleport location if (npc.ai[1] == 0f) - npc.ai[1] = 480 * Math.Sign((vector - player.Center).X); + npc.ai[1] = 600 * Math.Sign((vector - player.Center).X); // Rotation and direction Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); @@ -5483,12 +6369,13 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(55, 1.5) : 70; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); for (int i = 0; i < 20; i++) { - float velocityX = npc.direction * 6 * (Main.rand.NextFloat() + 0.5f); - float velocityY = 8f * (Main.rand.NextFloat() + 0.5f); - Projectile.NewProjectile(vector7.X, vector7.Y, velocityX, -velocityY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat() + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat() + 0.5f); + Projectile.NewProjectile(vector7.X, vector7.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -5512,6 +6399,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 10f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5524,15 +6412,16 @@ namespace CalamityMod.NPCs { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/OldDukeRoar"), (int)npc.position.X, (int)npc.position.Y); - int damage = expertMode ? CalamityUtils.GetMasterModeProjectileDamage(100, 1.5) : 140; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); Vector2 vortexSpawn = vector + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(vortexSpawn, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + Projectile.NewProjectile(vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); } } - if (npc.ai[2] % num14 == 0f) + 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); @@ -5542,7 +6431,7 @@ namespace CalamityMod.NPCs Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, ModContent.NPCType()); Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; + Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; Main.npc[num31].netUpdate = true; Main.npc[num31].ai[3] = Main.rand.Next(30, 361); } @@ -5559,6 +6448,7 @@ namespace CalamityMod.NPCs npc.ai[0] = 10f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5627,16 +6517,16 @@ namespace CalamityMod.NPCs float lifeRatio = npc.life / (float)npc.lifeMax; // Variables for buffing the AI - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool calamity = modPlayer.ZoneCalamity; bool phase2 = (lifeRatio < 0.5f && revenge) || death; // Speed while moving in phase 1 float speed = expertMode ? 5f : 4.5f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) speed = 12f; else if (!calamity) speed = 7f; @@ -5732,7 +6622,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y -= BossRushEvent.BossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -5742,7 +6632,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y += BossRushEvent.BossRushActive ? 0.15f : 0.1f; if (npc.velocity.Y < -3f) npc.velocity.Y = -3f; @@ -5752,7 +6642,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.985f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X -= BossRushEvent.BossRushActive ? 0.15f : 0.1f; if (npc.velocity.X > 8f) npc.velocity.X = 8f; @@ -5762,7 +6652,7 @@ namespace CalamityMod.NPCs if (npc.velocity.X < 0f) npc.velocity.X *= 0.985f; - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.15f : 0.1f); + npc.velocity.X += (BossRushEvent.BossRushActive ? 0.15f : 0.1f); if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -5789,7 +6679,7 @@ namespace CalamityMod.NPCs npc.localAI[0] += 1f; float projectileSpeed = revenge ? 8f : 6f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) projectileSpeed = 12f; Vector2 targetVector = player.Center - vectorCenter; @@ -6000,7 +6890,7 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 180f) { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 104); + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 104); Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); laserVelocity2.Normalize(); @@ -6041,7 +6931,7 @@ namespace CalamityMod.NPCs } if (npc.ai[1] % playSoundTimer == 0f) - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 20); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6294,8 +7184,8 @@ namespace CalamityMod.NPCs #region Unicorn AI public static void UnicornAI(NPC npc, Mod mod, bool spin, float bounciness, float speedDetect, float speedAdditive, float bouncy1 = -8.5f, float bouncy2 = -7.5f, float bouncy3 = -7f, float bouncy4 = -6f, float bouncy5 = -8f) { - bool DogPhase1 = npc.type == ModContent.NPCType() && (double)npc.life > (double)npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); - bool DogPhase2 = npc.type == ModContent.NPCType() && (double)npc.life <= (double)npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); + bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); + bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : 0.5); int num = 30; bool flag2 = false; bool flag3 = false; @@ -6371,7 +7261,7 @@ namespace CalamityMod.NPCs npc.velocity.Y -= bounciness; if (npc.type == ModContent.NPCType()) { - Main.PlaySound(2, npc.Center, 14); + Main.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); @@ -6379,7 +7269,7 @@ namespace CalamityMod.NPCs } if (npc.type == ModContent.NPCType()) { - Main.PlaySound(3, npc.Center, 7); + Main.PlaySound(SoundID.NPCHit, npc.Center, 7); } if (DogPhase2) { diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index ecd462d38b..62f7197ddf 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1,13 +1,20 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using ReLogic.Utilities; using System; using System.Collections.Generic; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; @@ -17,122 +24,49 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs { - public class CalamityGlobalAI + public partial class CalamityGlobalAI { - #region Queen Bee Lore AI Changes - public static void QueenBeeLoreEffect(NPC npc) - { - npc.damage = 0; - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) - npc.TargetClosest(true); - - float num = 5f; - float num2 = 0.1f; - npc.localAI[0] += 1f; - - float num3 = (npc.localAI[0] - 60f) / 60f; - if (num3 > 1f) - num3 = 1f; - else - { - if (npc.velocity.X > 6f) - npc.velocity.X = 6f; - if (npc.velocity.X < -6f) - npc.velocity.X = -6f; - if (npc.velocity.Y > 6f) - npc.velocity.Y = 6f; - if (npc.velocity.Y < -6f) - npc.velocity.Y = -6f; - } - - num2 *= num3; - Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num4 = npc.direction * num / 2f; - float num5 = -num / 2f; - - if (npc.velocity.X < num4) - { - npc.velocity.X += num2; - if (npc.velocity.X < 0f && num4 > 0f) - npc.velocity.X += num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X -= num2; - if (npc.velocity.X > 0f && num4 < 0f) - npc.velocity.X -= num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y += num2; - if (npc.velocity.Y < 0f && num5 > 0f) - npc.velocity.Y += num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y -= num2; - if (npc.velocity.Y > 0f && num5 < 0f) - npc.velocity.Y -= num2; - } - - if (npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) - { - if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - - npc.rotation = npc.velocity.X * 0.1f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float num11 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num11; - - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - npc.velocity.X = 2f; - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - npc.velocity.X = -2f; - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num11; - - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5) - npc.velocity.Y = 2f; - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5) - 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) - npc.netUpdate = true; - } - #endregion - + // Master Mode changes + /* 1 - Rainbow colored + 2 - Spawns a rainbow slime every 5% HP + 3 - Teleports ahead of his target + 4 - Can use a jump and slam like a Big Mimic*/ #region Buffed King Slime AI - public static bool BuffedKingSlimeAI(NPC npc, Mod mod) + public static bool BuffedKingSlimeAI(NPC npc, bool enraged, Mod mod) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Variables float num234 = 1f; - bool flag8 = false; + bool teleporting = false; bool flag9 = false; npc.aiAction = 0; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Get a target + 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(); // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Phases based on life percentage - bool phase2 = lifeRatio < 0.5f || death; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Spawn crystal in phase 2 - if (phase2 && !NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient) + // Phases based on life percentage + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + + // Spawn crystal in phase 2 + if (phase3 && !NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector = npc.Center + new Vector2(-40f, -(float)npc.height / 2); for (int num621 = 0; num621 < 20; num621++) @@ -159,7 +93,6 @@ namespace CalamityMod.NPCs { npc.ai[0] = -100f; npc.localAI[3] = 1f; - npc.TargetClosest(true); npc.netUpdate = true; } @@ -167,7 +100,7 @@ namespace CalamityMod.NPCs int despawnDistance = 500; if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > despawnDistance) { if (npc.timeLeft > 10) @@ -183,8 +116,8 @@ namespace CalamityMod.NPCs } // Faster fall - if (npc.velocity.Y > 0f && CalamityWorld.bossRushActive) - npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 0f) + npc.velocity.Y += enraged ? 0.15f : malice ? 0.1f : death ? 0.05f : 0f; // Activate teleport if (!Main.player[npc.target].dead && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) @@ -291,14 +224,14 @@ namespace CalamityMod.NPCs npc.ai[0] = 0f; npc.ai[1] = 0f; npc.netUpdate = true; - flag8 = false; + teleporting = false; } // Get closer to activating teleport if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - npc.ai[2] += 1f; + npc.ai[2] += death ? 2f : 1f; if (Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f) - npc.ai[2] += 1f; + npc.ai[2] += death ? 2f : 1f; // Dust variable Dust dust; @@ -306,7 +239,7 @@ namespace CalamityMod.NPCs // Teleport if (npc.ai[1] == 5f) { - flag8 = true; + teleporting = true; npc.aiAction = 1; npc.ai[0] += 1f; num234 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); @@ -347,7 +280,7 @@ namespace CalamityMod.NPCs // Post-teleport else if (npc.ai[1] == 6f) { - flag8 = true; + teleporting = true; npc.aiAction = 0; npc.ai[0] += 1f; num234 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); @@ -358,14 +291,14 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[0] = 0f; npc.netUpdate = true; - npc.TargetClosest(true); + npc.TargetClosest(); } if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) { npc.ai[1] = 0f; npc.ai[0] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); } for (int num247 = 0; num247 < 10; num247++) @@ -384,32 +317,32 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) + if (npc.velocity.X > -0.1f && npc.velocity.X < 0.1f) npc.velocity.X = 0f; - if (!flag8) + if (!teleporting) { npc.ai[0] += 2f; - if (CalamityWorld.bossRushActive) + if (malice) npc.ai[0] += 9f; else { - if (npc.life < npc.lifeMax * 0.8 || death) + if (lifeRatio < 0.8f) npc.ai[0] += 1f; - if (npc.life < npc.lifeMax * 0.6 || death) + if (lifeRatio < 0.6f) npc.ai[0] += 1f; - if (npc.life < npc.lifeMax * 0.4 || death) + if (lifeRatio < 0.4f) npc.ai[0] += 2f; } - if (npc.life < npc.lifeMax * 0.2 || death) + if (lifeRatio < 0.2f) npc.ai[0] += 3f; - if (npc.life < npc.lifeMax * 0.1 || death) + if (lifeRatio < 0.1f) npc.ai[0] += 4f; if (npc.ai[0] >= 0f) { npc.netUpdate = true; - npc.TargetClosest(true); + npc.TargetClosest(); float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); float speedMult = 1f; @@ -419,23 +352,24 @@ namespace CalamityMod.NPCs if (speedMult > 2f) speedMult = 2f; - // Jump type + // Jump type + float jumpSpeedMult = enraged ? 2f : 1.5f; if (npc.ai[1] == 3f) { npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (phase2 ? 4f : 3.5f) * npc.direction; - if (CalamityWorld.bossRushActive) - npc.velocity.X *= 2f; + npc.velocity.X += (phase2 ? (death ? 5.5f : 4.5f) : 3.5f) * npc.direction; + if (malice) + npc.velocity.X *= jumpSpeedMult; - npc.ai[0] = -200f; + npc.ai[0] = -200f; npc.ai[1] = 0f; } else if (npc.ai[1] == 2f) { npc.velocity.Y = -6f * speedMult; - npc.velocity.X += (phase2 ? 5f : 4.5f) * npc.direction; - if (CalamityWorld.bossRushActive) - npc.velocity.X *= 2f; + npc.velocity.X += (phase2 ? (death ? 6.5f : 5.5f) : 4.5f) * npc.direction; + if (malice) + npc.velocity.X *= jumpSpeedMult; npc.ai[0] = -120f; npc.ai[1] += 1f; @@ -443,9 +377,9 @@ namespace CalamityMod.NPCs else { npc.velocity.Y = -8f * speedMult; - npc.velocity.X += (phase2 ? 4.5f : 4f) * npc.direction; - if (CalamityWorld.bossRushActive) - npc.velocity.X *= 2f; + npc.velocity.X += (phase2 ? (death ? 6f : 5f) : 4f) * npc.direction; + if (malice) + npc.velocity.X *= jumpSpeedMult; npc.ai[0] = -120f; npc.ai[1] += 1f; @@ -460,9 +394,9 @@ namespace CalamityMod.NPCs else if (npc.target < Main.maxPlayers && ((npc.direction == 1 && npc.velocity.X < 3f) || (npc.direction == -1 && npc.velocity.X > -3f))) { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.4f : 0.2f) * npc.direction; + npc.velocity.X += (malice ? 0.4f : death ? 0.25f : 0.2f) * npc.direction; else - npc.velocity.X *= CalamityWorld.bossRushActive ? 0.9f : 0.93f; + npc.velocity.X *= malice ? 0.9f : death ? 0.92f : 0.93f; } // Spawn dust @@ -474,8 +408,10 @@ namespace CalamityMod.NPCs if (npc.life <= 0) return false; - // Adjust size npcd on HP - lifeRatio = lifeRatio * 0.5f + 0.75f; + // Adjust size based on HP + float maxScale = death ? 3f : 1.25f; + float minScale = 0.75f; + lifeRatio = lifeRatio * (maxScale - minScale) + minScale; lifeRatio *= num234; if (lifeRatio != npc.scale) { @@ -502,7 +438,7 @@ namespace CalamityMod.NPCs int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); int random = phase2 ? 10 : 8; - int npcType = Main.rand.Next(random); + int npcType = death ? Main.rand.Next(4) + 6 : Main.rand.Next(random); switch (npcType) { case 0: @@ -533,7 +469,7 @@ namespace CalamityMod.NPCs break; } - if ((Main.raining || CalamityWorld.bossRushActive) && Main.rand.NextBool(10)) + if ((Main.raining || malice) && Main.rand.NextBool(10)) { npcType = NPCID.UmbrellaSlime; @@ -541,10 +477,10 @@ namespace CalamityMod.NPCs npcType = NPCID.RainbowSlime; } - if (Main.rand.NextBool(250)) + if (Main.rand.NextBool(250) || enraged) npcType = NPCID.Pinky; - int num255 = NPC.NewNPC(x, y, npcType, 0, 0f, 0f, 0f, 0f, 255); + int num255 = NPC.NewNPC(x, y, npcType); Main.npc[num255].SetDefaults(npcType, -1f); Main.npc[num255].velocity.X = Main.rand.Next(-15, 16) * 0.1f; Main.npc[num255].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; @@ -558,27 +494,56 @@ namespace CalamityMod.NPCs } return false; } - #endregion + #endregion - #region Buffed Eye of Cthulhu AI - public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod) + // Master Mode changes + /* 1 - Spawns a clone of itself that copies every movement of the main eye but inverted (if main is on top and to the left, the mirror is on bottom and to the right) + 2 - Damaging either eye causes damage to both + 3 - Horizontal dashes are far more common + 4 - The delay between dashes and horizontal dashes is reduced*/ + #region Buffed Eye of Cthulhu AI + public static bool BuffedEyeofCthulhuAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - float num5 = 20f; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = lifeRatio < 0.85f || death; - bool phase3 = lifeRatio < 0.75f || death; - bool phase4 = lifeRatio < 0.65f || death; - bool phase5 = lifeRatio < 0.5f || death; - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - bool dead = Main.player[npc.target].dead; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.65f; + bool phase4 = lifeRatio < 0.55f; + bool phase5 = lifeRatio < 0.4f; + float num5 = (float)(death ? 20 - Math.Round(5f * (1f - lifeRatio)) : 20); + + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + // Get a target + 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(); + + bool dead = Main.player[npc.target].dead; float num6 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); float num7 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); float num8 = (float)Math.Atan2(num7, num6) + MathHelper.PiOver2; @@ -635,7 +600,7 @@ namespace CalamityMod.NPCs dust.velocity.Y *= 0.1f; } - if (Main.dayTime | dead) + if (dead) { npc.velocity.Y -= 0.04f; @@ -649,8 +614,16 @@ namespace CalamityMod.NPCs { float num11 = 7f; float num12 = 0.15f; + num11 += 5f * enrageScale; + num12 += 0.1f * enrageScale; - Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + if (death) + { + num11 += 8f * (1f - lifeRatio); + num12 += 0.17f * (1f - lifeRatio); + } + + Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num13 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector.X; float num14 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 200f - vector.Y; float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14); @@ -686,14 +659,14 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - float num17 = 180f; + float num17 = 180f - (death ? 200f * (1f - lifeRatio) : 0f); if (npc.ai[2] >= num17) { npc.ai[1] = 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.target = Main.maxPlayers; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } else if (num16 < 500f) { @@ -743,8 +716,11 @@ namespace CalamityMod.NPCs { npc.rotation = num8; float num24 = 7.25f; + num24 += 5f * enrageScale; + if (death) + num24 += 8.5f * (1f - lifeRatio); - Vector2 vector4 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector4 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num25 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector4.X; float num26 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector4.Y; float num27 = (float)Math.Sqrt(num25 * num25 + num26 * num26); @@ -774,18 +750,21 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; int num28 = 90; - if (npc.ai[2] >= num28) + if (death) + num28 -= (int)Math.Round(120f * (1f - lifeRatio)); + + if (npc.ai[2] >= num28) { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; - npc.rotation = num8; + npc.TargetClosest(); + npc.rotation = num8; if (npc.ai[3] >= 3f) { npc.ai[1] = 0f; npc.ai[3] = 0f; - } + } else npc.ai[1] = 1f; } @@ -797,7 +776,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; if (npc.netSpam > 10) npc.netSpam = 10; @@ -809,7 +789,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 1f) { npc.ai[2] += 0.005f; - if (npc.ai[2] > 0.5) + if (npc.ai[2] > 0.5f) npc.ai[2] = 0.5f; } else @@ -883,6 +863,7 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } } + 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); npc.velocity *= 0.98f; @@ -894,7 +875,7 @@ namespace CalamityMod.NPCs else { - npc.defense = 6; + npc.defense = 0; npc.damage = (int)(npc.defDamage * (phase5 ? 1.4f : 1.2f)); if (npc.ai[1] == 0f & phase5) @@ -902,13 +883,16 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) { - float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f) + 3.5f * (0.85f - lifeRatio); - float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f) + 0.025f * (0.85f - lifeRatio); - if (CalamityWorld.bossRushActive) - { - num37 *= 2f; - num38 *= 2f; - } + float num37 = 5.5f + 3.5f * (0.75f - lifeRatio); + float num38 = 0.06f + 0.025f * (0.75f - lifeRatio); + num37 += 4f * enrageScale; + num38 += 0.04f * enrageScale; + + if (death) + { + num37 += 5f * (0.75f - lifeRatio); + num38 += 0.04f * (0.75f - lifeRatio); + } Vector2 vector8 = 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) - vector8.X; @@ -961,7 +945,8 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= 200f) + float phaseLimit = 200f - (death ? 200f * (0.75f - lifeRatio) : 0f); + if (npc.ai[2] >= phaseLimit) { npc.ai[1] = 1f; npc.ai[2] = 0f; @@ -970,8 +955,8 @@ namespace CalamityMod.NPCs if (phase4) npc.ai[1] = 3f; - npc.target = Main.maxPlayers; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -980,13 +965,14 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); npc.rotation = num8; - float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f) + 4f * (0.85f - lifeRatio); - if (npc.ai[3] == 1f) + float num42 = 6.2f + 4f * (0.75f - lifeRatio); + num42 += 4f * enrageScale; + if (death) + num42 += 5.5f * (0.75f - lifeRatio); + if (npc.ai[3] == 1f) num42 *= 1.15f; if (npc.ai[3] == 2f) num42 *= 1.3f; - if (CalamityWorld.bossRushActive) - num42 *= 2f; Vector2 vector9 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num43 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector9.X; @@ -1020,12 +1006,15 @@ namespace CalamityMod.NPCs npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; int num47 = 80; - if (npc.ai[2] >= num47) + if (death) + num47 -= (int)Math.Round(40f * (0.75f - lifeRatio)); + + if (npc.ai[2] >= num47) { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; - npc.rotation = num8; + npc.TargetClosest(); + npc.rotation = num8; if (npc.ai[3] >= 3f) { @@ -1036,7 +1025,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 3f; npc.ai[3] += Main.rand.Next(1, 4); } - npc.netUpdate = true; + npc.netUpdate = true; if (npc.netSpam > 10) npc.netSpam = 10; @@ -1050,7 +1039,7 @@ namespace CalamityMod.NPCs { if ((npc.ai[3] == 4f & phase5) && npc.Center.Y > Main.player[npc.target].Center.Y) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -1061,11 +1050,9 @@ namespace CalamityMod.NPCs } else if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.TargetClosest(true); - float speedBoost = death ? 2.45f : 3.5f * (0.7f - lifeRatio); - float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + speedBoost; - if (CalamityWorld.bossRushActive) - num48 *= 1.5f; + float speedBoost = death ? 5f * (0.65f - lifeRatio) : 3.5f * (0.65f - lifeRatio); + float num48 = 18f + speedBoost; + num48 += 10f * enrageScale; Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; @@ -1127,6 +1114,7 @@ namespace CalamityMod.NPCs npc.velocity.X = num59; npc.velocity.Y = num58; } + npc.ai[1] = 4f; npc.netUpdate = true; @@ -1168,11 +1156,12 @@ namespace CalamityMod.NPCs npc.ai[3] += 1f; npc.ai[2] = 0f; - if (npc.ai[3] >= 5f) + float maxCharges = death ? (lifeRatio < 0.05f ? 1f : lifeRatio < 0.1f ? 2f : lifeRatio < 0.15f ? 3f : lifeRatio < 0.25f ? 4f : 5f) : lifeRatio < 0.2f ? 4f : 5f; + if (npc.ai[3] >= maxCharges) { npc.ai[1] = 0f; npc.ai[3] = 0f; - } + } else npc.ai[1] = 3f; } @@ -1181,15 +1170,10 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 5f) { float num62 = 600f; - float speedBoost = death ? 2f : 4f * (0.5f - lifeRatio); - float speedBoost2 = death ? 0.05f : 0.1f * (0.5f - lifeRatio); - float num63 = ((enraged || configBossRushBoost) ? 12f : 8f) + speedBoost; - float num64 = ((enraged || configBossRushBoost) ? 0.4f : 0.25f) + speedBoost2; - if (CalamityWorld.bossRushActive) - { - num63 *= 2f; - num64 *= 2f; - } + float speedBoost = death ? 6f * (0.4f - lifeRatio) : 4f * (0.4f - lifeRatio); + float speedBoost2 = death ? 0.15f * (0.4f - lifeRatio) : 0.1f * (0.4f - lifeRatio); + float num63 = 8f + speedBoost; + float num64 = 0.25f + speedBoost2; Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector11.X; @@ -1240,7 +1224,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] % 45f == 0f) { - float num19 = CalamityWorld.bossRushActive ? 9f : 6f; + float num19 = 6f; Vector2 vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num20 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector.X; float num21 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector.Y; @@ -1256,7 +1240,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.ServantofCthulhu) < 4) { - int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, 0f, 0f, 255); + int num23 = NPC.NewNPC((int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu); Main.npc[num23].velocity.X = vector3.X; Main.npc[num23].velocity.Y = vector3.Y; @@ -1266,15 +1250,12 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.NPCDeath13, npc.position); - int num; - for (int m = 0; m < 10; m = num + 1) - { + for (int m = 0; m < 10; m++) Dust.NewDust(vector2, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, default, 1f); - num = m; - } } - if (npc.ai[2] >= (horizontalCharge ? 100f : 70f)) + float timeGateValue = horizontalCharge ? (100f - (death ? 20f * (0.4f - lifeRatio) : 0f)) : (70f - (death ? 15f * (0.4f - lifeRatio) : 0f)); + if (npc.ai[2] >= timeGateValue) { switch ((int)calamityGlobalNPC.newAI[0]) { @@ -1299,10 +1280,13 @@ namespace CalamityMod.NPCs break; } + npc.TargetClosest(); calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] > 3f) calamityGlobalNPC.newAI[0] = 0f; - } + + npc.SyncExtraAI(); + } npc.netUpdate = true; @@ -1314,11 +1298,9 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.TargetClosest(true); - float speedBoost = death ? 2f : 4f * (0.5f - lifeRatio); - float num48 = ((enraged || configBossRushBoost) ? 26f : 18f) + speedBoost; - if (CalamityWorld.bossRushActive) - num48 *= 1.5f; + float speedBoost = death ? 6f * (0.4f - lifeRatio) : 4f * (0.4f - lifeRatio); + float num48 = 18f + speedBoost; + num48 += 10f * enrageScale; Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; @@ -1342,7 +1324,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - float num60 = num5 * 2.5f; + float num60 = (float)Math.Round(num5 * 2.5f); npc.ai[2] += 1f; if (npc.ai[2] == num60 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) @@ -1375,17 +1357,54 @@ namespace CalamityMod.NPCs return false; } - #endregion + #endregion - #region Buffed Eater of Worlds AI - public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) + // Master Mode changes + /* 1 - First head that spawns will spawn 4 other heads, creating 5 worms in total + 2 - Each worm is 30 segments long and is immune to debuffs + 3 - Worm heads push away from each other + 4 - Vile Spits home in on the target slightly and no longer die when hit*/ + #region Buffed Eater of Worlds AI + public static bool BuffedEaterofWorldsAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Total body segments - float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Causes it to split far more in malice mode + if (malice && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail)) + { + calamityGlobalNPC.DR = 0.8f; + npc.defense = npc.defDefense * 4; + } + + // Get a target + 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.type == NPCID.EaterofWorldsHead) + npc.TargetClosest(); + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!Main.player[npc.target].ZoneCorrupt || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + enrageScale += 1f; + + // Total body segments + float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); // Count segments remaining float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); @@ -1393,29 +1412,29 @@ namespace CalamityMod.NPCs // Percent segments remaining, add two to total for head and tail float lifeRatio = segmentCount / (totalSegments + 2); + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // 10 seconds of resistance to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < 600f && CalamityWorld.bossRushActive) + if (calamityGlobalNPC.newAI[1] < 600f && BossRushEvent.BossRushActive) calamityGlobalNPC.newAI[1] += 1f; // Phases - bool phase2 = lifeRatio < 0.9f || death; - bool phase3 = lifeRatio < 0.75f || death; - bool phase4 = lifeRatio < 0.4f || death; - bool phase5 = lifeRatio < 0.1f || (death && lifeRatio < 0.33f); - - // Damage - if (phase4 && npc.type == NPCID.EaterofWorldsHead) - npc.damage = (int)(npc.defDamage * (phase5 ? 1.2f : 1.1f)); + bool phase2 = lifeRatio < 0.9f; + bool phase3 = lifeRatio < 0.75f; + bool phase4 = lifeRatio < 0.4f; + bool phase5 = lifeRatio < 0.1f; // Fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient && !phase5) + if (Main.netMode != NetmodeID.MultiplayerClient && (!phase5 || death)) { // Vile spit if (npc.type == NPCID.EaterofWorldsBody) { if (Main.rand.NextBool(900) && phase2) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) NPC.NewNPC((int)(npc.position.X + (npc.width / 2) + npc.velocity.X), (int)(npc.position.Y + (npc.height / 2) + npc.velocity.Y), NPCID.VileSpit, 0, 0f, 1f, 0f, 0f, 255); } @@ -1425,16 +1444,16 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.EaterofWorldsHead) { calamityGlobalNPC.newAI[0] += 1f; - float timer = 90f; - float shootBoost = death ? 18f : lifeRatio * 180f; + float timer = enrageScale > 0f ? 90f : 120f; + float shootBoost = death ? lifeRatio * 90f : lifeRatio * 180f; timer += shootBoost; + if (enrageScale >= 2f) + timer = 60f; + if (calamityGlobalNPC.newAI[0] >= timer && phase3) { calamityGlobalNPC.newAI[0] = 0f; - - npc.TargetClosest(true); - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) { Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -1445,11 +1464,8 @@ namespace CalamityMod.NPCs num349 *= num351; num350 *= num351; - float num418 = CalamityWorld.bossRushActive ? 18f : 12f; - int num419 = 15; - if (death) - num419 += 2; - int num420 = ProjectileID.CursedFlameHostile; + float num418 = 12f; + int type = ProjectileID.CursedFlameHostile; num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); num351 = num418 / num351; num349 *= num351; @@ -1457,25 +1473,12 @@ namespace CalamityMod.NPCs vector34.X += num349 * 3f; vector34.Y += num350 * 3f; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num420, num419, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); } } } } - // Set worm variable for worms - if (CalamityWorld.bossRushActive) - { - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - } - else - npc.realLife = -1; - - // Target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) - npc.TargetClosest(true); - // Despawn if (Main.player[npc.target].dead) { @@ -1483,163 +1486,106 @@ namespace CalamityMod.NPCs npc.timeLeft = 300; } - if (CalamityWorld.bossRushActive) - { - if (npc.life <= npc.lifeMax * 0.05) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.NPCLoot(); - - for (int n = 0; n < Main.maxNPCs; n++) - { - if (Main.npc[n].aiStyle == npc.aiStyle) - Main.npc[n].active = false; - } - } - - // Check if other segments are still alive, if not, die - if (npc.type > NPCID.EaterofWorldsHead) - { - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.EaterofWorldsHead) - shouldDespawn = false; - } - if (!shouldDespawn) - { - if (npc.ai[1] > 0f) - shouldDespawn = false; - else if (Main.npc[(int)npc.ai[1]].life > 0) - shouldDespawn = false; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - } - } - } - - // Spawn segments + // All functions that modify the active worm segments are here. This includes spawning the worm originally and splitting effects. if (Main.netMode != NetmodeID.MultiplayerClient) { - if (CalamityWorld.bossRushActive) + // If this segment is a head or a body without a next-segment defined, then it needs to spawn its own next segment. + if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) { - // Spawn segments from head - if (npc.ai[0] == 0f && npc.type == NPCID.EaterofWorldsHead) + int spawnX = (int)npc.position.X; + int spawnY = (int)npc.position.Y; + + // A head sets the length variable (npc.ai[2]) and then sets its next segment to a freshly spawned body. + if (npc.type == NPCID.EaterofWorldsHead) { - npc.ai[3] = npc.whoAmI; - npc.realLife = npc.whoAmI; - int index = npc.whoAmI; + // Set head's "length beyond this point" to be the total length of the worm. + npc.ai[2] = totalSegments; - for (int j = 0; j <= totalSegments; j++) - { - int type = NPCID.EaterofWorldsBody; - if (j == totalSegments) - type = NPCID.EaterofWorldsTail; - - int segment = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[segment].ai[3] = npc.whoAmI; - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[1] = index; - Main.npc[index].ai[0] = segment; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0, 0, 0); - index = segment; - } + // Body spawn + npc.ai[0] = NPC.NewNPC(spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } + + // A body with a "length beyond this point" greater than zero just sets its next spawned segment to a freshly spawned body. + else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) + npc.ai[0] = NPC.NewNPC(spawnX, spawnY, NPCID.EaterofWorldsBody, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + + // If the worm stops here ("length beyond this point" is zero), then spawn a tail instead. + else + npc.ai[0] = NPC.NewNPC(spawnX, spawnY, NPCID.EaterofWorldsTail, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + + // Maintain the linked list of worm segments, and correctly set the "length beyond this point" of this segment. + 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; } - else + + // Helper function to destroy this Eater of Worlds worm segment. + void DestroyThisSegment() { - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - // Spawn entire worm - if (npc.type == NPCID.EaterofWorldsHead) - { - // Length - npc.ai[2] = totalSegments; + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } - // Body spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - { - // Body spawn - 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 - { - // Tail spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } + // If this segment's previous and next segments are both dead, make it explode instantly. Single segments cannot live. + if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + DestroyThisSegment(); - // Worm shit - 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; - } + // If this segment is a head and its next segment is dead, make it explode instantly. It's been decapitated. + if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) + DestroyThisSegment(); - // Splitting effect - 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); - } - if (npc.type == NPCID.EaterofWorldsHead && !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); - } - if (npc.type == NPCID.EaterofWorldsTail && !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); - } - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsHead; - int whoAmI = npc.whoAmI; - float num25 = npc.life / (float)npc.lifeMax; - float num26 = npc.ai[0]; - int aiTimer = calamityGlobalNPC.AITimer; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num25); - npc.ai[0] = num26; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI; - calamityGlobalNPC.AITimer = aiTimer; - } - if (npc.type == NPCID.EaterofWorldsBody && (!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]; - int aiTimer = calamityGlobalNPC.AITimer; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num27); - npc.ai[1] = num28; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI2; - calamityGlobalNPC.AITimer = aiTimer; - } + // If this segment is a tail and its previous segment is dead, make it explode instantly. It's been chopped off. + if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) + DestroyThisSegment(); - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + // If this segment is a body and its previous segment is dead (or was rendered into a tail), transform into a head. + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsHead; + float segmentLifeRatio = npc.life / (float)npc.lifeMax; + int whoAmI = npc.whoAmI; + float ai0Holdover = npc.ai[0]; + float newAI1Holdover = calamityGlobalNPC.newAI[1]; + int aiTimer = calamityGlobalNPC.AITimer; + + // Actually transform the body segment into a head segment. + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * segmentLifeRatio); + npc.whoAmI = whoAmI; + npc.ai[0] = ai0Holdover; + // Heads spawned mid fight by splitting do not get reset spawn invincibility. + CalamityGlobalNPC newCGN = npc.Calamity(); + newCGN.newAI[1] = newAI1Holdover; + newCGN.AITimer = aiTimer; + npc.TargetClosest(); + npc.netUpdate = true; + npc.netSpam = 0; } + + // If this segment is a body and its next segment is dead (or was rendered into a head), transform into a tail. + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) + { + npc.type = NPCID.EaterofWorldsTail; + float segmentLifeRatio = npc.life / (float)npc.lifeMax; + int whoAmI = npc.whoAmI; + float ai1Holdover = npc.ai[1]; + int aiTimer = calamityGlobalNPC.AITimer; + + // Actually transform the body segment into a tail segment. + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * segmentLifeRatio); + npc.whoAmI = whoAmI; + npc.ai[1] = ai1Holdover; + npc.Calamity().AITimer = aiTimer; + npc.TargetClosest(); + npc.netUpdate = true; + npc.netSpam = 0; + } + + // If for any reason this segment was deleted, send info to clients so they also see it die. + if (!npc.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f); } // Movement @@ -1657,8 +1603,8 @@ namespace CalamityMod.NPCs num32 = Main.maxTilesY; // Fly or not - bool flag2 = false; - if (!flag2) + bool inTiles = false; + if (!inTiles) { for (int num33 = num29; num33 < num30; num33++) { @@ -1671,7 +1617,7 @@ namespace CalamityMod.NPCs 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) { - flag2 = true; + inTiles = true; if (Main.rand.NextBool(100) && Main.tile[num33, num34].nactive()) { WorldGen.KillTile(num33, num34, true, true, false); @@ -1681,14 +1627,16 @@ namespace CalamityMod.NPCs } } } - if (!flag2 && npc.type == NPCID.EaterofWorldsHead) + if (!inTiles && npc.type == NPCID.EaterofWorldsHead) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num35 = 850; - if (CalamityWorld.bossRushActive) - num35 /= 2; + int num35 = death ? 700 : 850; + num35 -= (int)(enrageScale * 300f); - bool flag3 = true; + if (num35 < 100) + num35 = 100; + + bool freeMoveAnyway = true; for (int num36 = 0; num36 < Main.maxPlayers; num36++) { if (Main.player[num36].active) @@ -1696,30 +1644,32 @@ namespace CalamityMod.NPCs Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2); if (rectangle.Intersects(rectangle2)) { - flag3 = false; + freeMoveAnyway = false; break; } } } - if (flag3) - flag2 = true; + if (freeMoveAnyway) + inTiles = true; } // Velocity and acceleration - float velocityBoost = death ? 2.4f : 2.4f * (1f - lifeRatio); - float accelerationBoost = death ? 0.03f : 0.03f * (1f - lifeRatio); + float velocityScale = (death ? 4.8f : 2.4f) * enrageScale; + float velocityBoost = velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.06f : 0.03f) * enrageScale; + float accelerationBoost = accelerationScale * (1f - lifeRatio); float num37 = 12f + velocityBoost; float num38 = 0.15f + accelerationBoost; if (phase5) { - num37 += 2.4f; - num38 += 0.03f; + num37 += 2.4f * enrageScale; + num38 += 0.03f * enrageScale; } else if (phase4) { - num37 += 1.2f; - num38 += 0.015f; + num37 += 1.2f * enrageScale; + num38 += 0.015f * enrageScale; } Vector2 vector2 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -1734,6 +1684,7 @@ namespace CalamityMod.NPCs num40 -= vector2.Y; float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + // Does this worm segment have a "previous segment" defined? if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) { try @@ -1756,6 +1707,8 @@ namespace CalamityMod.NPCs npc.position.X += num39; npc.position.Y += num40; } + + // Otherwise this is a head. (Why does this not just check for head NPC type?) else { // Prevent new heads from being slowed when they spawn @@ -1764,14 +1717,12 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[1] += 1f; // Set velocity for when a new head spawns - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num37 * (CalamityWorld.bossRushActive ? 0.8f : 0.4f)); + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (num37 * (death ? 0.5f : 0.4f)); } - if (!flag2) + if (!inTiles) { - npc.TargetClosest(true); - - npc.velocity.Y += 0.11f; + npc.velocity.Y += death ? 0.15f : 0.11f; if (npc.velocity.Y > num37) npc.velocity.Y = num37; @@ -1789,7 +1740,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > num39) npc.velocity.X -= num38; } - else if (npc.velocity.Y > 4f) + else if (npc.velocity.Y > (death ? 6f : 4f)) { if (npc.velocity.X < 0f) npc.velocity.X += num38 * 0.9f; @@ -1820,17 +1771,20 @@ namespace CalamityMod.NPCs num40 *= num57; // Despawn - bool flag4 = npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead); - if (flag4 && !CalamityWorld.bossRushActive) + bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && Main.player[npc.target].dead; + if (shouldDespawn && !BossRushEvent.BossRushActive) { - bool flag5 = true; + bool everyoneDead = true; for (int num58 = 0; num58 < Main.maxPlayers; num58++) { - if (Main.player[num58].active && !Main.player[num58].dead && (Main.player[num58].ZoneCorrupt || Main.player[num58].ZoneCrimson)) - flag5 = false; + if (Main.player[num58].active && !Main.player[num58].dead) + { + everyoneDead = false; + break; + } } - if (flag5) + if (everyoneDead) { if (Main.netMode != NetmodeID.MultiplayerClient && (npc.position.Y / 16f) > (Main.rockLayer + Main.maxTilesY) / 2.0) { @@ -1920,7 +1874,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.EaterofWorldsHead) { - if (flag2) + if (inTiles) { if (npc.localAI[0] != 1f) npc.netUpdate = true; @@ -1939,23 +1893,72 @@ namespace CalamityMod.NPCs } } + // Manually sync newAI because there is no GlobalNPC.SendExtraAI + if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server) + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + packet.Write((byte)npc.whoAmI); + packet.Write(calamityGlobalNPC.newAI[0]); + packet.Write(calamityGlobalNPC.newAI[1]); + packet.Write(calamityGlobalNPC.newAI[2]); + packet.Write(calamityGlobalNPC.newAI[3]); + packet.Send(-1, -1); + } return false; } public static int GetEaterOfWorldsSegmentsCountRevDeath() { - return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 80 : 75; + return (CalamityWorld.death || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 82 : 77; } #endregion + // Master Mode changes + /* 1 - Afterimages are fully visible at all times in phase 2; below 60%, they begin moving on their own, deal contact damage, but the player will be able to knock them back + 2 - No longer spins before charging in final phase + 3 - Creepers spread out from each other + 4 - Creepers are immune to debuffs*/ #region Buffed Brain of Cthulhu AI public static bool BuffedBrainofCthulhuAI(NPC npc, bool enraged, Mod mod) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // whoAmI variable NPC.crimsonBoss = npc.whoAmI; - // Spawn Creepers - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!Main.player[npc.target].ZoneCrimson || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + // Spawn Creepers + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) { npc.localAI[0] = 1f; int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath(); @@ -1975,8 +1978,6 @@ namespace CalamityMod.NPCs // Despawn if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.TargetClosest(true); - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 6000f) { npc.active = false; @@ -2011,12 +2012,15 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases based on HP - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = lifeRatio < 0.85f || death; - bool phase3 = lifeRatio < 0.7f || death; - bool phase4 = lifeRatio < 0.5f || death; - bool phase5 = lifeRatio < 0.3f || death; + bool phase2 = lifeRatio < 0.85f; + bool phase3 = lifeRatio < 0.7f; + bool phase4 = lifeRatio < 0.55f; + bool phase5 = lifeRatio < 0.4f; bool spinning = npc.ai[0] == -4f; // KnockBack @@ -2029,13 +2033,10 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = false; // Deal no damage while spinning - npc.damage = spinning ? 0 : (int)(npc.defDamage * (phase5 ? 1.2f : 1f)); + npc.damage = spinning ? 0 : npc.defDamage; - // Move towards target - npc.TargetClosest(true); - - // Target distance X - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + // Target distance X + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; // Charge if (!spinning) @@ -2048,10 +2049,9 @@ namespace CalamityMod.NPCs float num795 = Main.player[npc.target].Center.X - vector98.X; float num796 = Main.player[npc.target].Center.Y - vector98.Y; float num797 = (float)Math.Sqrt(num795 * num795 + num796 * num796); - float velocityBoost = death ? 2f : 2f * (1f - lifeRatio); - float num798 = 8f + velocityBoost; - if (CalamityWorld.bossRushActive) - num798 *= 2f; + float velocityScale = death ? 4f : 2f; + float velocityBoost = velocityScale * (1f - lifeRatio); + float num798 = 8f + velocityBoost + 3f * enrageScale; if (phase2 && !phase3) num798 *= 0.9f; @@ -2068,8 +2068,9 @@ namespace CalamityMod.NPCs { npc.ai[1] += 1f; - // Teleport - if (npc.ai[1] >= 115f) + // Teleport + float timeGateValue = death ? 90f : 115f; + if (npc.ai[1] >= timeGateValue) { if (npc.knockBackResist == 0f) npc.knockBackResist = GetCrimsonBossKnockBack(npc, CalamityGlobalNPC.GetActivePlayerCount(), lifeRatio, baseKnockBackResist); @@ -2087,7 +2088,7 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.ForceRoar, (int)npc.position.X, (int)npc.position.Y, -1, 1f, 0f); // Velocity - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (CalamityWorld.bossRushActive ? 21f : 14f); + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center + (malice ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * ((death ? 16f : 14f) + 4f * enrageScale); } } @@ -2138,72 +2139,23 @@ namespace CalamityMod.NPCs npc.ai[2] += 1f; - float timer = 60f + npc.ai[3]; + float timer = (death ? 30f - 30f * (1f - lifeRatio) : 30f) + npc.ai[3]; if (npc.ai[2] >= timer - 5f) { if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 400f) // 25 tile distance { npc.ai[2] -= 1f; - npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (CalamityWorld.bossRushActive ? -12f : -6f); + npc.velocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * ((death ? -8f : -6f) - 2f * enrageScale); } } - // Charge at target and spit blood, -6 is straight line movement, -5 is rubber band movement + // Charge at target, -6 is straight line movement, -5 is rubber band movement if (npc.ai[2] >= timer) { // Complete stop npc.velocity *= 0f; - // Blood spurt - if (phase5) - { - // Blood dust - for (int num621 = 0; num621 < 6; num621++) - { - int num622 = Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 12; num623++) - { - int num624 = Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100, default, 1.5f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(npc.position, npc.width, npc.height, 5, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - } - - // Projectile speed and spread - float num179 = 8f; - 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 num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - - // Fire 10 projectiles in an arc - for (int num186 = 0; num186 < 5; num186++) - { - 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(-120, 121); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, ModContent.ProjectileType(), 12, 0f, Main.myPlayer, 0f, 0f); - } - } - bool charge = phase4 ? Main.rand.Next(4) > 0 : Main.rand.NextBool(); if (phase5) charge = true; @@ -2221,6 +2173,7 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -2254,16 +2207,13 @@ namespace CalamityMod.NPCs int randomReduction = death ? 4 : (int)(5f * (1f - lifeRatio)); int random = 5 - randomReduction; if (npc.justHit) - npc.localAI[1] -= (float)Main.rand.Next(random); - - float num799 = (phase2 && !phase3) ? 60f : 90f; - if (CalamityWorld.bossRushActive) - num799 = 30f; + npc.localAI[1] -= Main.rand.Next(random); + float num799 = (phase2 && !phase3) ? 60f : (death ? 105f : 90f); if (npc.localAI[1] >= num799) { npc.localAI[1] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); int num800 = 0; int num801; int num802; @@ -2380,7 +2330,8 @@ namespace CalamityMod.NPCs { // Creeper count int creeperCount = NPC.CountNPCS(NPCID.Creeper); - int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; // 1 to 20 + int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; + creeperScale *= (int)enrageScale; bool phase2 = creeperCount <= 0; // Go to phase 2 @@ -2389,19 +2340,17 @@ namespace CalamityMod.NPCs npc.ai[0] = -1f; npc.localAI[1] = 0f; npc.alpha = 0; + npc.TargetClosest(); npc.netUpdate = true; return false; } // Move towards target - npc.TargetClosest(true); Vector2 vector99 = new Vector2(npc.Center.X, npc.Center.Y); float num803 = Main.player[npc.target].Center.X - vector99.X; float num804 = Main.player[npc.target].Center.Y - vector99.Y; float num805 = (float)Math.Sqrt(num803 * num803 + num804 * num804); - float num806 = (CalamityWorld.bossRushActive ? 5f : 1f) + (creeperScale * 0.1f); - if (CalamityWorld.bossRushActive) - num806 *= 1.5f; + float num806 = (death ? 2f : 1f) + (creeperScale * 0.1f); if (num805 < num806) { @@ -2421,11 +2370,11 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { // Teleport location - npc.localAI[1] += 1f + (creeperScale * 0.1f); + npc.localAI[1] += (death ? 2f : 1f) + (creeperScale * 0.1f); if (npc.localAI[1] >= 300f) { npc.localAI[1] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); int num809 = 0; int num810; int num811; @@ -2494,7 +2443,7 @@ namespace CalamityMod.NPCs } // Despawn - if ((Main.player[npc.target].dead || (!Main.player[npc.target].ZoneCrimson && !Main.player[npc.target].ZoneCorrupt)) && !CalamityWorld.bossRushActive) + if (Main.player[npc.target].dead && !BossRushEvent.BossRushActive) { if (npc.localAI[3] < 120f) npc.localAI[3] += 1f; @@ -2522,9 +2471,25 @@ namespace CalamityMod.NPCs return false; } - // Creeper count, 0 to 20 - int creeperCount = NPC.CountNPCS(NPCID.Creeper); - bool phase2 = creeperCount <= (CalamityWorld.death ? 7 : 6); + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson) + enrageScale += 2f; + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + enrageScale += 1f; + + // Creeper count, 0 to 20 + int creeperCount = NPC.CountNPCS(NPCID.Creeper); + bool phase2 = creeperCount <= (death ? 12 : 6); // Adjust knockback if (phase2) @@ -2537,9 +2502,8 @@ namespace CalamityMod.NPCs float num812 = Main.npc[NPC.crimsonBoss].Center.X - vector100.X; float num813 = Main.npc[NPC.crimsonBoss].Center.Y - vector100.Y; float num814 = (float)Math.Sqrt(num812 * num812 + num813 * num813); - float velocity = 9f; - if (CalamityWorld.bossRushActive) - velocity *= 2f; + float velocity = death ? 10f : 7f; + velocity += 4f * enrageScale; // Max distance from Brain if (num814 > 90f) @@ -2560,11 +2524,12 @@ namespace CalamityMod.NPCs // Charge at target int creeperScale = GetBrainOfCthuluCreepersCountRevDeath() + 1 - creeperCount; - npc.ai[1] += 0.5f + (creeperScale * 0.25f); + creeperScale *= (int)enrageScale; + npc.ai[1] += (death ? 1f : 0.5f) + (creeperScale * 0.25f); if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= 240f) { npc.ai[1] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); vector100 = new Vector2(npc.Center.X, npc.Center.Y); num812 = Main.player[npc.target].Center.X - vector100.X; num813 = Main.player[npc.target].Center.Y - vector100.Y; @@ -2580,9 +2545,11 @@ namespace CalamityMod.NPCs // Charge else { + float chargeVelocity = death ? 10f : 7f; + chargeVelocity += 4f * enrageScale; Vector2 value2 = Main.player[npc.target].Center - npc.Center; value2.Normalize(); - value2 *= 9f; + value2 *= chargeVelocity; npc.velocity = (npc.velocity * 99f + value2) / 100f; Vector2 vector101 = new Vector2(npc.Center.X, npc.Center.Y); @@ -2600,7 +2567,7 @@ namespace CalamityMod.NPCs public static int GetBrainOfCthuluCreepersCountRevDeath() { - return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 30 : 25; + return (CalamityWorld.death || CalamityWorld.malice || BossRushEvent.BossRushActive) ? 30 : 25; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) @@ -2635,37 +2602,67 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + /* 1 - Fires beehives in bee spawn phase instead of bees, beehives spawn bees even if they hit water + 2 - Charges start off slow but accelerate to insane speed after several frames, this delay becomes shorter for the second and third dashes + 3 - Fires stingers in a triple spread and they accelerate over time + 4 - All attacks inflict Venom*/ #region Buffed Queen Bee AI - public static bool BuffedQueenBeeAI(NPC npc, Mod mod) + public static bool BuffedQueenBeeAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - int enrageScale = 0; - if ((npc.position.Y / 16f) < Main.worldSurface) - enrageScale++; - if (!Main.player[npc.target].ZoneJungle) - enrageScale++; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; - if (CalamityWorld.bossRushActive) - enrageScale = 0; + float enrageScale = death ? 0.25f : 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 0.5f; + } + if (!Main.player[npc.target].ZoneJungle || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 0.5f; + } - // Boost defense and damage as health decreases - int statBoost = (int)(20f * (1f - npc.life / (float)npc.lifeMax)); - if (death) - { - npc.defense = npc.defDefense + 20; - npc.damage = npc.defDamage + 20; - } - else - { - npc.defense = npc.defDefense + statBoost; - npc.damage = npc.defDamage + statBoost; - } + if (enrageScale > 1f) + enrageScale = 1f; + + if (BossRushEvent.BossRushActive) + enrageScale = 2f; + + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale = 3f; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + bool phase5 = lifeRatio < 0.1f; + + // Boost defense as health decreases + int statBoost = (int)(10f * (1f - lifeRatio)); + npc.defense = npc.defDefense + statBoost; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + 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(); // Despawn float num616 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); @@ -2679,6 +2676,29 @@ namespace CalamityMod.NPCs if (Main.player[npc.target].dead) npc.ai[0] = 5f; + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = npc.ai[0] == 0f; + 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[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Always start in enemy spawning phase + if (calamityGlobalNPC.newAI[3] == 0f) + { + calamityGlobalNPC.newAI[3] = 1f; + npc.ai[0] = 2f; + npc.netUpdate = true; + npc.SyncExtraAI(); + } + if (npc.ai[0] == 5f) { npc.velocity.Y *= 0.98f; @@ -2718,11 +2738,12 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num618; - do num618 = Main.rand.Next(4); - while (num618 == npc.ai[1] || num618 == 1); + int phase; + do phase = Main.rand.Next(4); + while (phase == npc.ai[1] || phase == 1); - npc.ai[0] = num618; + npc.TargetClosest(); + npc.ai[0] = phase; npc.ai[1] = 0f; npc.ai[2] = 0f; } @@ -2732,8 +2753,8 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 0f) { // Number of charges - int chargeAmt = 2 + enrageScale; - if (npc.life < npc.lifeMax / 3 || death) + int chargeAmt = (int)Math.Ceiling(2f + enrageScale); + if (phase4) chargeAmt++; // Switch to a random phase if chargeAmt has been exceeded @@ -2748,18 +2769,13 @@ namespace CalamityMod.NPCs // Charge velocity float speed = 16f; - if (CalamityWorld.bossRushActive) - speed += 12f; - else - { - if (npc.life < npc.lifeMax * 0.75 || death) - speed += 2f; - if (npc.life < npc.lifeMax * 0.5 || death) - speed += 2f; - if (npc.life < npc.lifeMax * 0.25 || death) - speed += 2f; - } - if (npc.life < npc.lifeMax * 0.1 || death) + if (phase2) + speed += 2f; + if (phase3) + speed += 2f; + if (phase4) + speed += 2f; + if (phase5) speed += 2f; speed += 8f * enrageScale; @@ -2767,10 +2783,9 @@ namespace CalamityMod.NPCs // Line up and initiate charge if (npc.ai[1] % 2f == 0f) { - // Get target and initiate charge - npc.TargetClosest(true); + // Initiate charge float num620 = 20f; - num620 += 20 * enrageScale; + num620 += 20f * enrageScale; if (Math.Abs(npc.position.Y + (npc.height / 2) - (Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2))) < num620) { // Set AI variables and speed @@ -2788,7 +2803,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = num600 * num601; // Face the correct direction and play charge sound + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + 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); return false; } @@ -2797,27 +2815,27 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; float num602 = 12f; float num603 = 0.15f; - if (npc.life < npc.lifeMax * 0.75 || death) + if (phase2) { - num602 += 1f; - num603 += 0.05f; + num602 += 1.5f; + num603 += 0.0625f; } - if (npc.life < npc.lifeMax * 0.5 || death) + if (phase3) { - num602 += 1f; - num603 += 0.05f; + num602 += 1.5f; + num603 += 0.0625f; } - if (npc.life < npc.lifeMax * 0.25 || death) + if (phase4) { - num602 += 2f; - num603 += 0.05f; + num602 += 1.5f; + num603 += 0.0625f; } - if (npc.life < npc.lifeMax * 0.1 || death) + if (phase5) { - num602 += 2f; - num603 += 0.1f; + num602 += 1.5f; + num603 += 0.0625f; } - num602 += 3 * enrageScale; + num602 += 3f * enrageScale; num603 += 0.5f * enrageScale; // Velocity calculations @@ -2845,6 +2863,8 @@ namespace CalamityMod.NPCs npc.velocity.X = num602; // Face the correct direction + float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation2 < 0 ? 1 : -1; npc.spriteDirection = npc.direction; npc.netUpdate = true; @@ -2859,15 +2879,16 @@ namespace CalamityMod.NPCs npc.direction = -1; else npc.direction = 1; + npc.spriteDirection = npc.direction; // Charging distance from player - int num604 = 500; - if (npc.life < npc.lifeMax * 0.33 || death) - num604 = 300; - else if (npc.life < npc.lifeMax * 0.66) - num604 = 450; - num604 -= 100 * enrageScale; + int num604 = 450; + if (phase4) + num604 = 350; + else if (phase2) + num604 = 400; + num604 -= (int)(100f * enrageScale); // Get which side of the player the boss is on int num605 = 1; @@ -2886,7 +2907,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 1f; flag35 = true; } - if (enrageScale > 0 && flag35) + if (enrageScale > 0f && flag35) npc.velocity *= 0.5f; // Keep moving @@ -2898,35 +2919,40 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] > 90f) + { + npc.SyncExtraAI(); npc.velocity.X *= 1.01f; + } npc.localAI[0] = 1f; return false; } - // Get target, face correct direction, and slow down - npc.TargetClosest(true); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; + + // Slow down npc.localAI[0] = 0f; npc.velocity *= 0.9f; float num606 = 0.1f; - if (npc.life < npc.lifeMax / 2 || death) + if (phase3) { npc.velocity *= 0.9f; num606 += 0.05f; } - if (npc.life < npc.lifeMax / 3 || death) + if (phase4) { npc.velocity *= 0.9f; num606 += 0.05f; } - if (npc.life < npc.lifeMax / 5 || death) + if (phase5) { npc.velocity *= 0.9f; num606 += 0.05f; } - if (enrageScale > 0) + if (enrageScale > 0f) npc.velocity *= 0.7f; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num606) @@ -2934,6 +2960,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; npc.ai[1] += 1f; calamityGlobalNPC.newAI[0] = 0f; + npc.SyncExtraAI(); } npc.netUpdate = true; @@ -2946,8 +2973,8 @@ namespace CalamityMod.NPCs // Fly above target before bee spawning phase else if (npc.ai[0] == 2f) { - // Get target and face the correct direction - npc.TargetClosest(true); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; // Get target location @@ -2958,11 +2985,14 @@ namespace CalamityMod.NPCs float num611 = (float)Math.Sqrt(num609 * num609 + num610 * num610); // Go to bee spawn phase - if (num611 < (death ? 400f : 300f)) + calamityGlobalNPC.newAI[0] += 1f; + if (num611 < (death ? 400f : 300f) || calamityGlobalNPC.newAI[0] >= 180f) { npc.ai[0] = 1f; npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; npc.netUpdate = true; + npc.SyncExtraAI(); return false; } @@ -2996,9 +3026,7 @@ namespace CalamityMod.NPCs // Bee spawn phase else if (npc.ai[0] == 1f) { - // Reset localAI and get target npc.localAI[0] = 0f; - npc.TargetClosest(true); // Get target location and spawn bees from ass Vector2 vector76 = new Vector2(npc.position.X + (npc.width / 2) + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); @@ -3016,17 +3044,17 @@ namespace CalamityMod.NPCs num638++; } npc.ai[1] += num638 / 2; - if (npc.life < npc.lifeMax * 0.75 || death) + if (phase2) npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.5 || death) + if (phase3) npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.25 || death) + if (phase4) npc.ai[1] += 0.25f; - if (npc.life < npc.lifeMax * 0.1 || death) + if (phase5) npc.ai[1] += 0.25f; bool spawnBee = false; - int num640 = 15 - 12 * enrageScale; + float num640 = 15f - 12f * enrageScale; if (npc.ai[1] > num640) { npc.ai[1] = 0f; @@ -3040,24 +3068,15 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.NPCHit1, (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) { - int hornetAmt = CalamityMod.hornetList.Count; int spawnType = Main.rand.Next(210, 212); - if (npc.life < npc.lifeMax * 0.66 || death) - spawnType = 210; - - int random = death ? 5 : 6; - if (Main.rand.Next(random) == 0) - spawnType = CalamityMod.hornetList[Main.rand.Next(hornetAmt)]; - - int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType, 0, 0f, 0f, 0f, 0f, 255); + if (phase3) + spawnType = NPCID.Bee; + int spawn = NPC.NewNPC((int)vector76.X, (int)vector76.Y, spawnType); Main.npc[spawn].velocity = Main.player[npc.target].Center - npc.Center; Main.npc[spawn].velocity.Normalize(); Main.npc[spawn].velocity *= 5f; - - if (!CalamityMod.hornetList.Contains(spawnType)) - Main.npc[spawn].localAI[0] = 60f; - + Main.npc[spawn].localAI[0] = 60f; Main.npc[spawn].netUpdate = true; } } @@ -3102,6 +3121,8 @@ namespace CalamityMod.NPCs npc.velocity *= 0.9f; // Face the correct direction + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; // Go to a random phase @@ -3125,8 +3146,10 @@ namespace CalamityMod.NPCs float num623 = (float)Math.Sqrt(num621 * num621 + num622 * num622); npc.ai[1] += 1f; - int num650 = (npc.life < npc.lifeMax * 0.25) ? 15 : ((npc.life < npc.lifeMax * 0.5) ? 20 : ((npc.life < npc.lifeMax * 0.75) ? 25 : 30)); - num650 -= 5 * enrageScale; + int num650 = phase4 ? 15 : phase3 ? 20 : phase2 ? 25 : 30; + num650 -= (int)Math.Ceiling(5f * enrageScale); + if (num650 < 3) + num650 = 3; // 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)) @@ -3134,10 +3157,10 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Item17, npc.position); if (Main.netMode != NetmodeID.MultiplayerClient) { - float num624 = CalamityWorld.bossRushActive ? 16f : 12f; - if (npc.life < npc.lifeMax * 0.33 || death) + float num624 = 12f; + if (phase3) num624 += 3f; - num624 += 7 * enrageScale; + num624 += 3f * enrageScale; float num625 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector78.X; float num626 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector78.Y; @@ -3145,23 +3168,19 @@ namespace CalamityMod.NPCs num627 = num624 / num627; num625 *= num627; num626 *= num627; - - int damage = Main.player[npc.target].buffImmune[BuffID.Poisoned] ? 18 : 14; - if (death) - damage += 2; int type = ProjectileID.Stinger; - int projectile = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, type, damage, 0f, Main.myPlayer, 0f, 0f); + int projectile = Projectile.NewProjectile(vector78.X, vector78.Y, num625, num626, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].timeLeft = 300; } } // Movement calculations - float num620 = CalamityWorld.bossRushActive ? 0.1f : 0.075f; + float num620 = 0.075f; num620 += 0.2f * enrageScale; if (!Collision.CanHit(new Vector2(vector78.X, vector78.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - num620 = CalamityWorld.bossRushActive ? 0.125f : 0.1f; - if (enrageScale > 0) + num620 = 0.1f; + if (enrageScale > 0f) num620 = 0.5f; vector79 = vector78; @@ -3195,8 +3214,10 @@ namespace CalamityMod.NPCs } else if (num623 > 100f) { - npc.TargetClosest(true); + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; + if (npc.velocity.X < num621) { npc.velocity.X += num620; @@ -3266,88 +3287,112 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Arms are immune to damage and Skeletron no longer has increased defense while the arms are alive, 2 - Moves far more aggressively #region Buffed Skeletron AI public static bool BuffedSkeletronAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vectorCenter = npc.Center; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Phases - bool phase2 = lifeRatio < 0.33f || death; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Set defense - npc.defense = npc.defDefense; + // Phases + bool respawnHands = npc.life / (float)npc.lifeMax < 0.33f; + bool phase2 = respawnHands || death; - // Spawn hands - if (Main.netMode != NetmodeID.MultiplayerClient) + // Set defense + npc.defense = npc.defDefense; + + // Get a target + 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(); + + // Spawn hands + if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.ai[0] == 0f) { - npc.TargetClosest(true); npc.ai[0] = 1f; - - int num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = -1f; - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; - - num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = 1f; - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].ai[3] = 150f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; + SpawnHands(); + npc.netUpdate = true; } // Respawn hands - if (phase2 && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (respawnHands && calamityGlobalNPC.newAI[0] == 0f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { - npc.TargetClosest(true); calamityGlobalNPC.newAI[0] = 1f; Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, -0.25f); + SpawnHands(); - int num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = -1f; - - if (death) - Main.npc[num155].Calamity().newAI[0] = -1f; - - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].ai[3] = death ? -75f : 0f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; - - num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num155].ai[0] = 1f; - - if (death) - Main.npc[num155].Calamity().newAI[0] = -1f; - - Main.npc[num155].ai[1] = npc.whoAmI; - Main.npc[num155].ai[3] = death ? 75f : 150f; - Main.npc[num155].target = npc.target; - Main.npc[num155].netUpdate = true; + npc.netUpdate = true; + npc.SyncExtraAI(); } + + void SpawnHands() + { + int num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[num155].ai[0] = -1f; + Main.npc[num155].ai[1] = npc.whoAmI; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + + num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[num155].ai[0] = 1f; + Main.npc[num155].ai[1] = npc.whoAmI; + Main.npc[num155].ai[3] = 150f; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + + // Spawn two additional hands with different attack timings + if (death) + { + num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[num155].ai[0] = -1f; + Main.npc[num155].Calamity().newAI[0] = -1f; + Main.npc[num155].ai[1] = npc.whoAmI; + Main.npc[num155].ai[3] = respawnHands ? -75f : 0f; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + + num155 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.SkeletronHand, npc.whoAmI); + Main.npc[num155].ai[0] = 1f; + Main.npc[num155].Calamity().newAI[0] = -1f; + Main.npc[num155].ai[1] = npc.whoAmI; + Main.npc[num155].ai[3] = respawnHands ? 75f : 150f; + Main.npc[num155].target = npc.target; + Main.npc[num155].netUpdate = true; + } + } } // Distance from target float distance = Vector2.Distance(Main.player[npc.target].Center, npc.Center); // Despawn - if (Main.player[npc.target].dead || distance > (CalamityWorld.bossRushActive ? 6000f : 4000f)) + if (Main.player[npc.target].dead || distance > (BossRushEvent.BossRushActive ? 6000f : 4000f)) { - npc.TargetClosest(true); - if (Main.player[npc.target].dead || distance > (CalamityWorld.bossRushActive ? 6000f : 4000f)) + npc.TargetClosest(); + if (Main.player[npc.target].dead || distance > (BossRushEvent.BossRushActive ? 6000f : 4000f)) npc.ai[1] = 3f; } // Daytime enrage - if (Main.dayTime && !CalamityWorld.bossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) + 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); @@ -3357,12 +3402,14 @@ namespace CalamityMod.NPCs int num156 = 0; for (int num157 = 0; num157 < Main.maxNPCs; num157++) { - if (Main.npc[num157].active && Main.npc[num157].type == npc.type + 1) + if (Main.npc[num157].active && Main.npc[num157].type == NPCID.SkeletronHand) num156++; } bool handsDead = num156 == 0; npc.chaseable = handsDead; - npc.defense += num156 * (CalamityWorld.bossRushActive ? 2500 : 250); + calamityGlobalNPC.DR = (malice ? 0.45f : 0.05f) + num156 * 0.45f; + if (calamityGlobalNPC.DR > 0.95f) + calamityGlobalNPC.DR = 0.95f; // Teleport if (handsDead || phase2) @@ -3379,31 +3426,37 @@ namespace CalamityMod.NPCs // Fire magic bolt after teleport if (Main.netMode != NetmodeID.MultiplayerClient) { - float num151 = 2f + (distance * (CalamityWorld.bossRushActive ? 0.015f : 0.005f)); - if (CalamityWorld.bossRushActive) - { - if (num151 > 10f) - num151 = 10f; - } - else if (num151 > 5f) + float num151 = 2f + (distance * 0.005f); + if (num151 > 5f) num151 = 5f; - int num152 = 19; - if (death) - num152 += 2; - int num153 = ProjectileID.Shadowflames; + int type = ProjectileID.Shadowflames; + int damage = npc.GetProjectileDamage(type); + int numProj = death ? 5 : 3; - Vector2 value19 = Main.player[npc.target].Center - npc.Center; - value19.Normalize(); - value19 *= num151; - int numProj = 2; - float rotation = MathHelper.ToRadians(15); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num153, num152, 0f, Main.myPlayer, 0f, 1f); - Main.projectile[proj].timeLeft = 600; - } + float num743 = Main.player[npc.target].Center.X - vectorCenter.X; + float num744 = Main.player[npc.target].Center.Y - vectorCenter.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + + num745 = num151 / num745; + num743 *= num745; + num744 *= num745; + vectorCenter.X += num743 * 3f; + vectorCenter.Y += num744 * 3f; + + float rotation = MathHelper.ToRadians(60); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + + for (int i = 0; i < numProj; i++) + { + offsetAngle = startAngle + deltaAngle * i; + int proj = Projectile.NewProjectile(vectorCenter.X, vectorCenter.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[proj].timeLeft = 600; + } + npc.netUpdate = true; } // Teleport dust @@ -3419,7 +3472,7 @@ namespace CalamityMod.NPCs // If hands are dead: 7 seconds // If hands are not dead: 14 seconds // If hands are dead in phase 2: 4.7 seconds - npc.ai[3] += 1f + ((phase2 && handsDead) ? 0.5f : 0f) - (handsDead ? 0f : 0.5f); + npc.ai[3] += 1f + (((phase2 && handsDead) || malice) ? 0.5f : 0f) - ((handsDead || malice) ? 0f : 0.5f); // Dust to show teleport int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 @@ -3452,6 +3505,7 @@ namespace CalamityMod.NPCs // New location params calamityGlobalNPC.newAI[2] = num1458 * 16 - npc.width / 2; calamityGlobalNPC.newAI[3] = num1459 * 16 - npc.height; + npc.SyncExtraAI(); break; } } @@ -3498,6 +3552,7 @@ namespace CalamityMod.NPCs npc.ai[3] = -60f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; + npc.SyncExtraAI(); npc.netUpdate = true; } } @@ -3507,7 +3562,7 @@ namespace CalamityMod.NPCs // Skull shooting if (handsDead && npc.ai[1] == 0f) { - float num158 = phase2 ? 60f : 75f; + float num158 = enraged ? 5f : BossRushEvent.BossRushActive ? 10f : malice ? 15f : phase2 ? (60f - (death ? 30f * (1f - lifeRatio) : 0f)) : 75f; if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] >= num158) { calamityGlobalNPC.newAI[1] = 0f; @@ -3517,29 +3572,27 @@ namespace CalamityMod.NPCs float num161 = (float)Math.Sqrt(num159 * num159 + num160 * num160); if (Collision.CanHit(vector18, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { - float num162 = phase2 ? 5f : 4f; - if (CalamityWorld.bossRushActive) - num162 *= 1.5f; - + float num162 = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; float num163 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X + Main.rand.Next(-20, 21); float num164 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector18.Y + Main.rand.Next(-20, 21); float num165 = (float)Math.Sqrt(num163 * num163 + num164 * num164); num165 = num162 / num165; num163 *= num165; num164 *= num165; - Vector2 vector19 = new Vector2(num163 * 1f + Main.rand.Next(-50, 51) * 0.01f, num164 * 1f + Main.rand.Next(-50, 51) * 0.01f); + int spread = enraged ? 200 : malice ? 100 : 50; + Vector2 vector19 = new Vector2(num163 + Main.rand.Next(-spread, spread + 1) * 0.01f, num164 + Main.rand.Next(-spread, spread + 1) * 0.01f); vector19.Normalize(); vector19 *= num162; vector19 += npc.velocity; num163 = vector19.X; num164 = vector19.Y; - int num166 = 21; - if (death) - num166 += 2; - int num167 = ProjectileID.Skull; - vector18 += vector19 * 5f; - int num168 = Projectile.NewProjectile(vector18.X, vector18.Y, num163, num164, num167, num166, 0f, Main.myPlayer, -1f, 0f); + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); + vector18 += vector19 * 5f; + int num168 = Projectile.NewProjectile(vector18.X, vector18.Y, num163, num164, type, damage, 0f, Main.myPlayer, -1f, 0f); Main.projectile[num168].timeLeft = 300; + + npc.netUpdate = true; } } } @@ -3550,28 +3603,32 @@ namespace CalamityMod.NPCs npc.damage = lifeRatio > 0.99f ? 0 : npc.defDamage; calamityGlobalNPC.newAI[1] += 1f; - float phaseChangeRateBoost = death ? 3f : 3f * (1f - lifeRatio); + float phaseChangeRateBoost = 3f * (1f - lifeRatio); npc.ai[2] += 1f + phaseChangeRateBoost; if (npc.ai[2] >= 600f) { npc.ai[2] = 0f; npc.ai[1] = 1f; calamityGlobalNPC.newAI[1] = 0f; - npc.TargetClosest(true); + + npc.TargetClosest(); + npc.SyncExtraAI(); npc.netUpdate = true; } npc.rotation = npc.velocity.X / 15f; - float num169 = 0.04f; - float num170 = 3.5f; - float num171 = 0.08f; - float num172 = 8.5f; - if (CalamityWorld.bossRushActive) - { - num169 *= 1.5f; - num171 *= 1.5f; - } + float num169 = 0.04f + (death ? 0.04f * (1f - lifeRatio) : 0f); + float num170 = 3.5f - (death ? 1f - lifeRatio : 0f); + float num171 = 0.08f + (death ? 0.04f * (1f - lifeRatio) : 0f); + float num172 = 8.5f - (death ? 2f * (1f - lifeRatio) : 0f); + if (malice) + { + num169 *= 1.25f; + num170 *= 0.75f; + num171 *= 1.25f; + num172 *= 0.75f; + } if (npc.position.Y > Main.player[npc.target].position.Y - 250f) { @@ -3614,7 +3671,7 @@ namespace CalamityMod.NPCs { npc.defense -= 10; - float phaseChangeRateBoost = death ? 0.5f : 0.5f * (1f - lifeRatio); + float phaseChangeRateBoost = 0.5f * (1f - lifeRatio); npc.ai[2] += 1f + phaseChangeRateBoost; calamityGlobalNPC.newAI[1] += 1f; @@ -3626,6 +3683,10 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; npc.ai[1] = 0f; calamityGlobalNPC.newAI[1] = 0f; + + npc.TargetClosest(); + npc.SyncExtraAI(); + npc.netUpdate = true; } npc.rotation += npc.direction * 0.3f; @@ -3636,33 +3697,16 @@ namespace CalamityMod.NPCs // Increase speed while charging npc.damage = (int)(npc.defDamage * 1.3); - float num176 = CalamityWorld.bossRushActive ? 10f : 4.5f; + float num176 = enraged ? 12f : BossRushEvent.BossRushActive ? 9f : malice ? 6f : 4.5f; float velocityBoost = death ? 1f : 1f - lifeRatio; - if (handsDead) + if (handsDead || malice) num176 += velocityBoost; - if (enraged || configBossRushBoost) - num176 += 3f; - if (num175 > 150f) - num176 *= 1.05f; - if (num175 > 200f) - num176 *= 1.05f; - if (num175 > 250f) - num176 *= 1.05f; - if (num175 > 300f) - num176 *= 1.05f; - if (num175 > 350f) - num176 *= 1.05f; - if (num175 > 400f) - num176 *= 1.1f; - if (num175 > 450f) - num176 *= 1.1f; - if (num175 > 500f) - num176 *= 1.1f; - if (num175 > 550f) - num176 *= 1.15f; - if (num175 > 600f) - num176 *= 1.2f; + if (num175 > 150f) + { + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((num175 - 150f) * 0.0015f, 0.05f, 1.5f); + num176 *= baseDistanceVelocityMult; + } num175 = num176 / num175; npc.velocity.X = num173 * num175; @@ -3673,7 +3717,8 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 2f) { npc.damage = 1000; - npc.defense = 9999; + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; npc.rotation += npc.direction * 0.3f; Vector2 vector21 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num177 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector21.X; @@ -3719,6 +3764,17 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); + float yMultiplier = 1f; if (calamityGlobalNPC.newAI[0] != 0f) yMultiplier = calamityGlobalNPC.newAI[0]; @@ -3727,6 +3783,8 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.newAI[1] < 180f) { calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] % 15f == 0f) + npc.SyncExtraAI(); npc.damage = 0; } else @@ -3770,21 +3828,22 @@ namespace CalamityMod.NPCs if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) { - float maxX = CalamityWorld.bossRushActive ? 6f : 7f; - float maxY = CalamityWorld.bossRushActive ? 4.5f : 5f; + float maxX = enraged ? 1f : malice ? 4f : death ? 6f : 7f; + float maxY = enraged ? 0.5f : malice ? 3f : death ? 4.5f : 5f; + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.11f : 0.07f; + npc.velocity.Y *= 0.94f; + npc.velocity.Y -= 0.08f; if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f * yMultiplier) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.11f : 0.07f; + npc.velocity.Y *= 0.94f; + npc.velocity.Y += 0.08f; if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3792,8 +3851,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X *= 0.94f; + npc.velocity.X -= 0.12f; if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3801,8 +3860,8 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 120f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X *= 0.94f; + npc.velocity.X += 0.12f; if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3817,14 +3876,14 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - float maxX = CalamityWorld.bossRushActive ? 6f : 7f; - float maxY = CalamityWorld.bossRushActive ? 2f : 2.5f; + float maxX = enraged ? 1f : malice ? 4f : death ? 6f : 7f; + float maxY = enraged ? 0.25f : malice ? 1f : death ? 2f : 2.5f; if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f * yMultiplier) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.92f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.Y -= 0.1f; if (npc.velocity.Y > maxY) npc.velocity.Y = maxY; } @@ -3832,7 +3891,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.92f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.Y += 0.1f; if (npc.velocity.Y < -maxY) npc.velocity.Y = -maxY; } @@ -3841,7 +3900,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.X > 0f) npc.velocity.X *= 0.92f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.22f : 0.14f; + npc.velocity.X -= 0.18f; if (npc.velocity.X > maxX) npc.velocity.X = maxX; } @@ -3850,7 +3909,7 @@ namespace CalamityMod.NPCs { if (npc.velocity.X < 0f) npc.velocity.X *= 0.92f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.22f : 0.14f; + npc.velocity.X += 0.18f; if (npc.velocity.X < -maxX) npc.velocity.X = -maxX; } @@ -3878,15 +3937,15 @@ namespace CalamityMod.NPCs if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[2] = 2f; vector23 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num185 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector23.X; num186 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector23.Y; num187 = (float)Math.Sqrt(num185 * num185 + num186 * num186); - num187 = 23f / num187; - if (CalamityWorld.bossRushActive) + num187 = 22f / num187; + if (enraged) num187 *= 1.5f; npc.velocity.X = num185 * num187; @@ -3897,7 +3956,10 @@ namespace CalamityMod.NPCs else if (npc.ai[2] == 2f) { if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || npc.velocity == Vector2.Zero) + { npc.ai[2] = 3f; + npc.netUpdate = true; + } } else if (npc.ai[2] == 4f) { @@ -3916,15 +3978,15 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[2] = 5f; vector24 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num188 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector24.X; num189 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector24.Y; num190 = (float)Math.Sqrt(num188 * num188 + num189 * num189); - num190 = 24f / num190; - if (CalamityWorld.bossRushActive) + num190 = 23f / num190; + if (enraged) num190 *= 1.5f; npc.velocity.X = num188 * num190; @@ -3933,25 +3995,36 @@ namespace CalamityMod.NPCs } } else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2)) || npc.velocity == Vector2.Zero)) + { npc.ai[2] = 0f; + npc.netUpdate = true; + } return false; } #endregion + // Master Mode changes + // 1 - Hungries spawn detached and have more health, 2 - Moves quicker overall, 3 - Mouth vomits a tight spread of 3 demon scythes at the same time as its leech vomit, 4 - Eyes become immune to damage and stop firing when the wall drops below 15% health #region Buffed Wall of Flesh AI public static bool BuffedWallofFleshAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; // Despawn if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) npc.active = false; - // Set Wall of Flesh variables - if (npc.localAI[0] == 0f) + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + // Set Wall of Flesh variables + if (npc.localAI[0] == 0f) { npc.localAI[0] = 1f; Main.wofB = -1; @@ -3961,9 +4034,16 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Clamp life ratio to prevent bad velocity math. + lifeRatio = MathHelper.Clamp(lifeRatio, 0f, 1f); + // Phases based on HP - bool phase2 = lifeRatio < 0.66f || death; - bool phase3 = lifeRatio < 0.33f || death; + bool phase2 = lifeRatio < 0.66f; + bool phase3 = lifeRatio < 0.33f; // Start leech spawning based on HP npc.ai[1] += 1f; @@ -3973,6 +4053,8 @@ namespace CalamityMod.NPCs npc.ai[1] += 1f; if (phase3) npc.ai[1] += 1f; + if (malice) + npc.ai[1] += 3f; if (npc.ai[1] > 2700f) npc.ai[2] = 1f; @@ -3988,11 +4070,23 @@ namespace CalamityMod.NPCs if (npc.ai[2] > num330) npc.ai[2] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num331 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1, 0f, 0f, 0f, 0f, 255); - Main.npc[num331].velocity.X = npc.direction * 9; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int num331 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + (npc.height / 2) + 20f), NPCID.LeechHead, 1); + Main.npc[num331].velocity.X = npc.direction * 9; + + if (phase2) + { + // Get target vector + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * npc.velocity.Length(); + Vector2 projectileSpawn = npc.Center + projectileVelocity * 5f; + + int damage = npc.GetProjectileDamage(ProjectileID.DemonSickle); + int proj = Projectile.NewProjectile(projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, damage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); + Main.projectile[proj].timeLeft = 600; + Main.projectile[proj].tileCollide = false; + } + } } // Play sound @@ -4104,9 +4198,12 @@ namespace CalamityMod.NPCs float halfAverageScreenWidth = 960f; float distanceBeforeSlowingDown = 400f; - float timeBeforeEnrage = 600f; + float timeBeforeEnrage = 600f - (death ? 390f * (1f - lifeRatio) : 0f); float speedMult = 1f; + if (malice) + timeBeforeEnrage *= 0.25f; + if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) { if (distanceFromTarget > halfAverageScreenWidth || @@ -4120,7 +4217,7 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[1] = 1f; - // Tell eyes to stop firing lasers + // Tell eyes to fire different lasers npc.ai[3] = 1f; // Play roar sound on players nearby @@ -4138,10 +4235,7 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[0] -= 1f; } - if (speedMult > 2f) - speedMult = 2f; - if (speedMult < 0.75f) - speedMult = 0.75f; + speedMult = MathHelper.Clamp(speedMult, 0.75f, 2f); } // Enrage if target is off screen for too long @@ -4153,22 +4247,24 @@ namespace CalamityMod.NPCs // Return to normal if very close to target if (distanceFromTarget < distanceBeforeSlowingDown) { + npc.TargetClosest(); calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[1] = 0f; npc.ai[3] = 0f; } } - if (enraged || configBossRushBoost) + if (malice) + speedMult += 0.2f; + + if (enraged) speedMult += 0.7f; // NOTE: Max velocity is 8 in expert mode float velocityBoost = 4f * (1f - lifeRatio); - float velocityX = (death ? 3.5f : 2f) + velocityBoost; + float velocityX = (BossRushEvent.BossRushActive ? 7f : death ? 3.5f : 2f) + velocityBoost; velocityX *= speedMult; - if (CalamityWorld.bossRushActive) - velocityX *= 1.5f; // NOTE: Values below are based on Rev Mode only! // Max velocity without enrage is 12 @@ -4177,10 +4273,8 @@ namespace CalamityMod.NPCs // Set X velocity if (npc.velocity.X == 0f) - { - npc.TargetClosest(true); npc.velocity.X = npc.direction; - } + if (npc.velocity.X < 0f) { npc.velocity.X = -velocityX; @@ -4217,24 +4311,27 @@ namespace CalamityMod.NPCs // Expert hungry respawn over time if (Main.netMode != NetmodeID.MultiplayerClient) { - // Range of 1 to 11 - float spawnBoost = death ? 1f : lifeRatio * 10f; + // Range of 2 to 11 + float spawnBoost = death ? 1f : (float)Math.Ceiling(lifeRatio * 10f); int chance = (int)(1f + spawnBoost); - // Range of 1 to 121 + // Range of 4 to 121 chance *= chance; - // Range of 20 to 134 + // Range of 23 to 134 chance = (chance * 19 + 400) / 20; - // Range of 30 to 59 + // Range of 32 to 59 if (chance < 60) chance = (chance * 3 + 60) / 4; - // Range of 60 to 268 - chance = (int)(chance * 2D); + // Range of 64 to 268 + chance *= 2; - if (Main.rand.Next(chance) == 0) + if (malice) + chance /= 4; + + if (Main.rand.NextBool(chance)) { int num346 = 0; float[] array = new float[10]; @@ -4312,26 +4409,28 @@ namespace CalamityMod.NPCs public static bool BuffedWallofFleshEyeAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Despawn - if (Main.wof < 0) + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Despawn + if (Main.wof < 0) { npc.active = false; return false; } - // Stupid worm variable but for wall of flesh npc time npc.realLife = Main.wof; - // Life and target if (Main.npc[Main.wof].life > 0) npc.life = Main.npc[Main.wof].life; - npc.TargetClosest(true); - // Velocity, direction, and position - npc.position.X = Main.npc[Main.wof].position.X; + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); + + // Velocity, direction, and position + npc.position.X = Main.npc[Main.wof].position.X; npc.direction = Main.npc[Main.wof].direction; npc.spriteDirection = npc.direction; @@ -4385,23 +4484,49 @@ namespace CalamityMod.NPCs } // Fire lasers - if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[Main.wof].ai[3] == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient) { // Percent life remaining float lifeRatio = Main.npc[Main.wof].life / (float)Main.npc[Main.wof].lifeMax; - float shootBoost = death ? 1.5f : 1.5f * (1f - lifeRatio); + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + bool charging = Main.npc[Main.wof].ai[3] == 1f; + + // Set up enraged laser firing timer + float enragedLaserTimer = 300f; + if (charging) + npc.localAI[3] = enragedLaserTimer; + + bool fireAcceleratingLasers = npc.localAI[3] > 0f && npc.localAI[3] < enragedLaserTimer; + + // Decrement the enraged laser timer + if (npc.localAI[3] > 0f) + { + npc.localAI[3] -= 1f; + + // Stop firing normal lasers when enrage ends + if (npc.localAI[3] == 0f) + npc.localAI[1] = 0f; + } + + float shootBoost = enraged ? 5f : fireAcceleratingLasers ? (death ? 1.5f : 1.5f * (1f - lifeRatio)) : (death ? 3f : 4f * (1f - lifeRatio)); npc.localAI[1] += 1f + shootBoost; - if (npc.localAI[2] == 0f) + bool canHit = 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.localAI[2] == 0f) { - if (npc.localAI[1] > 400f) + if (npc.localAI[1] > 400f || fireAcceleratingLasers) { npc.localAI[2] = 1f; npc.localAI[1] = 0f; - } + npc.TargetClosest(); + } } - else if (npc.localAI[1] > 45f) + else if (npc.localAI[1] > 45f && (canHit || fireAcceleratingLasers) && !charging) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; @@ -4410,24 +4535,20 @@ namespace CalamityMod.NPCs if (flag30) { - bool phase2 = lifeRatio < 0.5 || death; - float velocity = 3f + shootBoost; - if (CalamityWorld.bossRushActive) - velocity *= 1.5f; + bool phase2 = lifeRatio < 0.5 || malice; + float velocity = (fireAcceleratingLasers ? 3f : 9f) + shootBoost; - int damage = phase2 ? 22 : 17; - if (death) - damage += 2; int projectileType = phase2 ? ProjectileID.DeathLaser : ProjectileID.EyeLaser; + int damage = npc.GetProjectileDamage(projectileType); - float laserSpawnDistance = 30f; - Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center + Main.player[npc.target].velocity * 20f - npc.Center) * velocity; + float laserSpawnDistance = fireAcceleratingLasers ? 30f : 10f; + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center + (fireAcceleratingLasers ? Main.player[npc.target].velocity * 40f : Vector2.Zero) - npc.Center) * velocity; Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; - int proj = Projectile.NewProjectile(projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, fireAcceleratingLasers ? 1f : 0f, 0f); Main.projectile[proj].timeLeft = 900; - 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 (!canHit) Main.projectile[proj].tileCollide = false; } @@ -4438,12 +4559,15 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Splits like the Eater of Worlds #region Buffed Destroyer AI public static bool BuffedDestroyerAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; // 10 seconds of resistance to prevent spawn killing if (calamityGlobalNPC.newAI[1] < 600f) @@ -4452,10 +4576,14 @@ namespace CalamityMod.NPCs // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Phases based on life percentage - bool phase2 = lifeRatio < 0.85f || death; - bool phase3 = lifeRatio < 0.7f || death; - bool startFlightPhase = lifeRatio < 0.5f || death; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Phases based on life percentage + bool phase2 = lifeRatio < 0.85f; + bool phase3 = lifeRatio < 0.7f; + bool startFlightPhase = lifeRatio < 0.5f; bool phase4 = lifeRatio < 0.25f; bool phase5 = lifeRatio < 0.1f; @@ -4463,23 +4591,47 @@ namespace CalamityMod.NPCs float newAISet = phase5 ? 900f : phase4 ? 450f : 0f; calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= 1800f) + { calamityGlobalNPC.newAI[3] = newAISet; + npc.TargetClosest(); + } // Set worm variable for worms if (npc.ai[3] > 0f) npc.realLife = (int)npc.ai[3]; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) - npc.TargetClosest(true); + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); Player player = Main.player[npc.target]; + bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Get a new target if current target is too far away + if (increaseSpeedMore && npc.type == NPCID.TheDestroyer) + npc.TargetClosest(); + + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + // Enrage variable if player is flying upside down bool targetFloatingUp = player.gravDir == -1f; // Phase for flying at the player - bool flyAtTarget = calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase; + bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= 900f && startFlightPhase) || (calamityGlobalNPC.newAI[1] < 600f && calamityGlobalNPC.newAI[1] > 60f); // Dust on spawn and alpha effects if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) @@ -4504,16 +4656,19 @@ namespace CalamityMod.NPCs bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyer) - shouldDespawn = false; + if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyer) + { + shouldDespawn = false; + break; + } } if (!shouldDespawn) { - if (npc.ai[1] > 0f) - shouldDespawn = false; - else if (Main.npc[(int)npc.ai[1]].life > 0) - shouldDespawn = false; - } + if (npc.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + shouldDespawn = true; + } if (shouldDespawn) { npc.life = 0; @@ -4525,17 +4680,8 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody) { - // Gain more defense as health lowers with a max of 30, lose defense if probe has been launched - if (npc.ai[2] == 0f) - { - int defenseBoost = death ? 30 : (int)(30f * (1f - lifeRatio)); - npc.defense = npc.defDefense + defenseBoost; - } - else - npc.defense = npc.defDefense - 10; - - // Enrage, fire more homing lasers - if (targetFloatingUp) + // Enrage, fire more cyan lasers + if (targetFloatingUp || (enrageScale > 0f && !malice && !enraged)) { if (calamityGlobalNPC.newAI[2] < 480f) calamityGlobalNPC.newAI[2] += 1f; @@ -4556,14 +4702,14 @@ namespace CalamityMod.NPCs npc.realLife = npc.whoAmI; int index = npc.whoAmI; - int totalSegments = 80; + int totalSegments = death ? 120 : 80; for (int j = 0; j <= totalSegments; j++) { int type = NPCID.TheDestroyerBody; if (j == totalSegments) type = NPCID.TheDestroyerTail; - int segment = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int segment = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI); Main.npc[segment].ai[3] = npc.whoAmI; Main.npc[segment].realLife = npc.whoAmI; Main.npc[segment].ai[1] = index; @@ -4574,80 +4720,55 @@ namespace CalamityMod.NPCs } // Fire lasers - if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 160f && !flyAtTarget) + if (npc.type == NPCID.TheDestroyerBody) { // Laser rate of fire - int shootTime = 4 + (death ? 2 : (int)Math.Ceiling(2f * (1f - lifeRatio))); - if (CalamityWorld.bossRushActive) - shootTime += 1; - if (enraged || configBossRushBoost) - shootTime += 2; + int shootTime = 1; + calamityGlobalNPC.newAI[0] += 1f; + float shootProjectile = 600 / shootTime; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; - calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); - int randomCount = death ? Main.rand.Next(1470, 27300) : Main.rand.Next(1330, 24700); - - if (calamityGlobalNPC.newAI[0] >= randomCount) + if (calamityGlobalNPC.newAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) { - calamityGlobalNPC.newAI[0] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { // Laser speed - float projectileSpeed = 4f; - if (phase2) - projectileSpeed += 0.25f; - if (phase3) - projectileSpeed += 0.25f; - if (CalamityWorld.bossRushActive) - projectileSpeed *= 1.25f; + float projectileSpeed = 4.5f; + projectileSpeed += enrageScale; // Set projectile damage and type, set projectile to saucer scrap if probe has been launched - int damage = death ? 25 : 23; int projectileType = ProjectileID.DeathLaser; float laserSpawnDistance = 5f; - if (npc.ai[2] == 0f || Main.rand.NextBool(2)) - { - int random = phase3 ? 4 : phase2 ? 3 : 2; - switch (Main.rand.Next(random)) - { - case 0: - case 1: - break; - case 2: - damage += 2; - projectileType = ModContent.ProjectileType(); - break; - case 3: - damage += 4; - projectileType = ModContent.ProjectileType(); - break; - } + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) + { + case 0: + case 1: + break; + case 2: + projectileType = ModContent.ProjectileType(); + break; + case 3: + projectileType = ModContent.ProjectileType(); + break; + } - if (calamityGlobalNPC.newAI[2] > 0f) - { - damage += 4; - projectileType = ModContent.ProjectileType(); - laserSpawnDistance = 10f; - } - } - else - projectileType = ProjectileID.SaucerScrap; + if (calamityGlobalNPC.newAI[2] > 0f || malice) + { + projectileType = ModContent.ProjectileType(); + laserSpawnDistance = 10f; + } // Get target vector - Vector2 projectileVelocity = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * projectileSpeed; - - if (projectileType == ProjectileID.SaucerScrap) - projectileVelocity *= 0.5f; - + Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * projectileSpeed; Vector2 projectileSpawn = npc.Center + projectileVelocity * laserSpawnDistance; - // Shoot projectile and set timeLeft if not a homing laser/metal scrap so lasers don't last for too long - int proj = Projectile.NewProjectile(npc.Center, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); - - if (projectileType == ProjectileID.SaucerScrap) - Main.projectile[proj].timeLeft = 480; - else - Main.projectile[proj].timeLeft = 600; + // Shoot projectile and set timeLeft if not a homing laser/metal scrap so lasers don't last for too long + int damage = npc.GetProjectileDamage(projectileType); + int proj = Projectile.NewProjectile(projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 900; npc.netUpdate = true; } @@ -4695,8 +4816,13 @@ namespace CalamityMod.NPCs // Start flying if target is not within a certain distance if (!flag2) { - if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); + if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) + { + if (flyAtTarget) + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.1f, 0.3f, 0.05f); + else + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.1f, 0.05f); + } npc.localAI[1] = 1f; @@ -4732,7 +4858,7 @@ namespace CalamityMod.NPCs // Despawn float fallSpeed = 16f; - if (Main.dayTime || player.dead) + if (player.dead) { flag2 = false; npc.velocity.Y += 1f; @@ -4753,14 +4879,17 @@ namespace CalamityMod.NPCs } } - float fallSpeedBoost = death ? 5f : 5f * (1f - lifeRatio); + float fallSpeedBoost = death ? 6.5f * (1f - lifeRatio) : 5f * (1f - lifeRatio); fallSpeed += fallSpeedBoost; + fallSpeed += 4f * enrageScale; // Speed and movement - float speedBoost = death ? (targetFloatingUp ? 0.2f : 0.1f) : ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); - float turnSpeedBoost = death ? (targetFloatingUp ? 0.3f : 0.15f) : ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); + float speedBoost = death ? ((targetFloatingUp ? 0.28f : 0.14f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.2f : 0.1f) * (1f - lifeRatio)); + float turnSpeedBoost = death ? ((targetFloatingUp ? 0.37f : 0.19f) * (1f - lifeRatio)) : ((targetFloatingUp ? 0.3f : 0.15f) * (1f - lifeRatio)); float speed = 0.1f + speedBoost; float turnSpeed = 0.15f + turnSpeedBoost; + speed += 0.04f * enrageScale; + turnSpeed += 0.06f * enrageScale; if (flyAtTarget) { @@ -4768,13 +4897,11 @@ namespace CalamityMod.NPCs speed *= speedMultiplier; } - if (CalamityWorld.bossRushActive) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + speed *= increaseSpeedMore ? 4f : increaseSpeed ? 2f : 1f; + turnSpeed *= increaseSpeedMore ? 4f : increaseSpeed ? 2f : 1f; + fallSpeed *= increaseSpeedMore ? 4f : increaseSpeed ? 2f : 1f; - Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + Vector2 vector3 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num20 = player.position.X + (player.width / 2); float num21 = player.position.Y + (player.height / 2); num20 = (int)(num20 / 16f) * 16; @@ -4809,9 +4936,7 @@ namespace CalamityMod.NPCs if (!flag2) { - npc.TargetClosest(true); - npc.velocity.Y += 0.15f; - + npc.velocity.Y += death ? 0.2f : 0.15f; if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; @@ -4829,7 +4954,7 @@ namespace CalamityMod.NPCs else if (npc.velocity.X > num20) npc.velocity.X -= speed; } - else if (npc.velocity.Y > 4f) + else if (npc.velocity.Y > (death ? 6f : 4f)) { if (npc.velocity.X < 0f) npc.velocity.X += speed * 0.9f; @@ -4989,7 +5114,22 @@ namespace CalamityMod.NPCs public static bool BuffedProbeAI(NPC npc, Mod mod) { - if (npc.target < 0 || npc.target <= 255 || Main.player[npc.target].dead) + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + + // 2 seconds of immunity to prevent spawn killing + if (npc.Calamity().newAI[1] < 120f) + { + npc.Calamity().newAI[1] += 1f; + if (npc.Calamity().newAI[1] % 15f == 0f) + npc.SyncExtraAI(); + + npc.dontTakeDamage = true; + } + else + npc.dontTakeDamage = false; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(); NPCAimedTarget targetData = npc.GetTargetData(); @@ -4997,8 +5137,8 @@ namespace CalamityMod.NPCs if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; - float velocity = 6f; - float acceleration = 0.05f; + float velocity = malice ? 8f : 6f; + float acceleration = malice ? 0.1f : 0.05f; Vector2 vector = npc.Center; float num4 = targetData.Center.X; @@ -5060,7 +5200,7 @@ namespace CalamityMod.NPCs npc.ai[0] = -200f; } - if (targetDead || Main.dayTime) + if (targetDead) { num4 = npc.direction * velocity / 2f; num5 = -velocity / 2f; @@ -5076,17 +5216,22 @@ namespace CalamityMod.NPCs else if (npc.velocity.Y > num5) npc.velocity.Y -= acceleration; - npc.localAI[0] += 1f; + if (npc.Calamity().newAI[1] >= 120f) + npc.localAI[0] += 1f; + if (npc.justHit) npc.localAI[0] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 240f) + float laserGateValue = malice ? 150f : 240f; + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= laserGateValue) { npc.localAI[0] = 0f; if (targetData.Type != 0 && Collision.CanHit(npc.position, npc.width, npc.height, targetData.Position, targetData.Width, targetData.Height)) { - int damage = Main.expertMode ? 22 : 25; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, ProjectileID.PinkLaser, damage, 0f, Main.myPlayer); + int type = ProjectileID.PinkLaser; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, type, damage, 0f, Main.myPlayer); + npc.netUpdate = true; } } @@ -5139,7 +5284,7 @@ namespace CalamityMod.NPCs npc.velocity.X *= 0.9f; } - if (targetDead || Main.dayTime) + if (targetDead) { npc.velocity.Y -= acceleration * 2f; if (npc.timeLeft > 10) @@ -5252,8 +5397,9 @@ namespace CalamityMod.NPCs num422 = 0.175f; } // Reduce acceleration if target is holding a true melee weapon - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { + num421 *= 0.75f; num422 *= 0.5f; } Vector2 vector39 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -5362,8 +5508,9 @@ namespace CalamityMod.NPCs num431 = 0.25f; } // Reduce acceleration if target is holding a true melee weapon - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { + num430 *= 0.75f; num431 *= 0.5f; } Vector2 vector40 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -5464,12 +5611,44 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Retinazer fires spreads of death lasers, moves and charges more often and faster, cycles attacks faster, 2 - Spazmatism moves and charges more often and faster, cycles attacks faster, 3 - Retinazer is slightly smaller and Spazmatism is slightly larger #region Buffed Twins AI public static bool BuffedRetinazerAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); + + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 0.5f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 0.5f; + } + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; // Enrage variable if player is floating upside down bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; @@ -5482,12 +5661,9 @@ namespace CalamityMod.NPCs if (CalamityGlobalNPC.fireEye != -1) spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; - bool enrage = npc.life < npc.lifeMax * (death ? 0.5 : 0.25); + bool enrage = lifeRatio < 0.25f; // I'm not commenting this entire fucking thing, already did spaz, I'm not doing ret - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); - float num376 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); float num377 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); @@ -5532,7 +5708,7 @@ namespace CalamityMod.NPCs dust.velocity.Y *= 0.1f; } - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) { for (int num381 = 0; num381 < Main.maxNPCs; num381++) { @@ -5542,7 +5718,7 @@ namespace CalamityMod.NPCs } } - if (Main.dayTime | Main.player[npc.target].dead) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -5558,12 +5734,14 @@ namespace CalamityMod.NPCs { float num382 = 8.25f; float num383 = 0.115f; + num382 += 4f * enrageScale; + num383 += 0.05f * enrageScale; - if (CalamityWorld.bossRushActive) - { - num382 *= 1.5f; - num383 *= 1.5f; - } + if (death) + { + num382 += 8f * (1f - lifeRatio); + num383 += 0.1f * (1f - lifeRatio); + } int num384 = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) @@ -5605,12 +5783,12 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= 450f) + if (npc.ai[2] >= 450f - (death ? 900f * (1f - lifeRatio) : 0f)) { npc.ai[1] = 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.target = Main.maxPlayers; + npc.TargetClosest(); npc.netUpdate = true; } @@ -5628,20 +5806,19 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - float num389 = CalamityWorld.bossRushActive ? 12f : 10.5f; - int num390 = 23; - if (death) - num390 += 2; - int num391 = ProjectileID.EyeLaser; + float num389 = 10.5f; + num389 += 3f * enrageScale; + int type = ProjectileID.EyeLaser; + int damage = npc.GetProjectileDamage(type); - num387 = (float)Math.Sqrt(num385 * num385 + num386 * num386); + num387 = (float)Math.Sqrt(num385 * num385 + num386 * num386); num387 = num389 / num387; num385 *= num387; num386 *= num387; vector40.X += num385 * 15f; vector40.Y += num386 * 15f; - Projectile.NewProjectile(vector40.X, vector40.Y, num385, num386, num391, num390, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector40.X, vector40.Y, num385, num386, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -5650,8 +5827,12 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 1f) { npc.rotation = num378; - float num393 = CalamityWorld.bossRushActive ? 22.5f : 15f; - Vector2 vector41 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num393 = 15f; + num393 += 10f * enrageScale; + if (death) + num393 += 12f * (1f - lifeRatio); + + Vector2 vector41 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num394 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector41.X; float num395 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector41.Y; float num396 = (float)Math.Sqrt(num394 * num394 + num395 * num395); @@ -5682,7 +5863,7 @@ namespace CalamityMod.NPCs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; + npc.TargetClosest(); npc.rotation = num378; if (npc.ai[3] >= 3f) { @@ -5695,12 +5876,13 @@ namespace CalamityMod.NPCs } // Enter phase 2 earlier - if (npc.life < npc.lifeMax * 0.7 || targetFloatingUp || death) + if (lifeRatio < 0.7f || targetFloatingUp) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -5769,32 +5951,31 @@ namespace CalamityMod.NPCs if (Main.npc[CalamityGlobalNPC.fireEye].active) spazInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; } - int defenseGain = spazInPhase1 ? 9999 : 20; + npc.chaseable = !spazInPhase1; npc.damage = (int)(npc.defDamage * 1.5); - npc.defense = npc.defDefense + defenseGain; + npc.defense = npc.defDefense + 10; + calamityGlobalNPC.DR = spazInPhase1 ? 0.9999f : 0.2f; + calamityGlobalNPC.unbreakableDR = spazInPhase1; npc.HitSound = SoundID.NPCHit4; if (npc.ai[1] == 0f) { - float num399 = 9.5f; - float num400 = 0.175f; + float num399 = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); + float num400 = 0.175f + (death ? 0.05f * (0.7f - lifeRatio) : 0f); + num399 += 4.5f * enrageScale; + num400 += 0.075f * enrageScale; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { + num399 *= 0.75f; num400 *= 0.5f; } - if (CalamityWorld.bossRushActive) - { - num399 *= 1.5f; - num400 *= 1.5f; - } - Vector2 vector42 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num401 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector42.X; float num402 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 300f - vector42.Y; @@ -5837,12 +6018,12 @@ namespace CalamityMod.NPCs npc.localAI[1] += 2f; } - if (npc.ai[2] >= 300f) + if (npc.ai[2] >= 300f - (death ? 120f * (0.7f - lifeRatio) : 0f)) { npc.ai[1] = 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } @@ -5853,20 +6034,19 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += 1f; + npc.localAI[1] += 1f + (death ? 0.7f - lifeRatio : 0f); if (npc.localAI[1] >= (spazAlive ? 72f : 24f)) { bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (canHit || !spazAlive || enrage) { npc.localAI[1] = 0f; - float num404 = CalamityWorld.bossRushActive ? 12f : 10f; - int num405 = 28; - if (death) - num405 += 3; - int num406 = ProjectileID.DeathLaser; + float num404 = 10f; + num404 += enrageScale; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); - num403 = (float)Math.Sqrt(num401 * num401 + num402 * num402); + num403 = (float)Math.Sqrt(num401 * num401 + num402 * num402); num403 = num404 / num403; num401 *= num403; num402 *= num403; @@ -5874,10 +6054,10 @@ namespace CalamityMod.NPCs vector42.Y += num402 * 15f; if (canHit) - Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, num406, num405, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, type, damage, 0f, Main.myPlayer, 0f, 0f); else { - int proj = Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, num406, num405, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(vector42.X, vector42.Y, num401, num402, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 300; } @@ -5893,22 +6073,19 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) num408 = -1; - float num409 = 9.5f; - float num410 = 0.25f; + float num409 = 9.5f + (death ? 3f * (0.7f - lifeRatio) : 0f); + float num410 = 0.25f + (death ? 0.075f * (0.7f - lifeRatio) : 0f); + num409 += 4.5f * enrageScale; + num410 += 0.15f * enrageScale; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { + num409 *= 0.75f; num410 *= 0.5f; } - if (CalamityWorld.bossRushActive) - { - num409 *= 1.5f; - num410 *= 1.5f; - } - Vector2 vector43 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num411 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + (num408 * 340) - vector43.X; float num412 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector43.Y; @@ -5956,20 +6133,18 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += 1f; + npc.localAI[1] += 1f + (death ? 0.7f - lifeRatio : 0f); if (npc.localAI[1] > (spazAlive ? 24f : 8f)) { bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); if (canHit || !spazAlive || enrage) { npc.localAI[1] = 0f; - float num414 = CalamityWorld.bossRushActive ? 11f : 9f; - int num415 = 21; - if (death) - num415 += 2; - int num416 = ProjectileID.DeathLaser; + float num414 = 9f; + int type = ProjectileID.DeathLaser; + int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); - num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412); + num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412); num413 = num414 / num413; num411 *= num413; num412 *= num413; @@ -5977,10 +6152,10 @@ namespace CalamityMod.NPCs vector43.Y += num412 * 15f; if (canHit) - Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, num416, num415, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, type, damage, 0f, Main.myPlayer, 0f, 0f); else { - int proj = Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, num416, num415, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(vector43.X, vector43.Y, num411, num412, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft = 300; } @@ -5989,12 +6164,12 @@ namespace CalamityMod.NPCs } npc.ai[2] += spazAlive ? 1f : 1.5f; - if (npc.ai[2] >= 180f) + if (npc.ai[2] >= 180f - (death ? 90f * (0.7f - lifeRatio) : 0f)) { npc.ai[1] = (!spazAlive || enrage) ? 4f : 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } } @@ -6004,18 +6179,16 @@ namespace CalamityMod.NPCs { // Set rotation and velocity npc.rotation = num378; - float num450 = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 24f : 22f; + float num450 = 22f + (death ? 8f * (0.7f - lifeRatio) : 0f); + num450 += 10f * enrageScale; - if (!spazAlive) + if (!spazAlive) num450 += 2f; // Enrage if (targetFloatingUp) num450 += 2f; - if (CalamityWorld.bossRushActive) - num450 *= 1.5f; - Vector2 vector47 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num451 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector47.X; float num452 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector47.Y; @@ -6030,9 +6203,12 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; - float chargeTime = spazAlive ? 110f : 75f; - if (CalamityWorld.bossRushActive) - chargeTime *= 0.8f; + float chargeTime = spazAlive ? 45f : 30f; + if (npc.ai[3] % 3f == 0f) + chargeTime = spazAlive ? 90f : 60f; + if (death) + chargeTime -= chargeTime * 0.25f * (0.7f - lifeRatio); + chargeTime -= chargeTime / 5 * enrageScale; // Slow down if (npc.ai[2] >= chargeTime) @@ -6047,49 +6223,58 @@ namespace CalamityMod.NPCs { npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - float fireRate = spazAlive ? 13f : 9f; - if (CalamityWorld.bossRushActive) - fireRate = 7f; + if (npc.ai[3] % 3f == 0f) + { + float fireRate = spazAlive ? 13f : 9f; - if (npc.ai[2] % fireRate == 0f) - { - Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; - float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; - float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); + if (npc.ai[2] % fireRate == 0f) + { + Vector2 vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num349 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector34.X; + float num350 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector34.Y; + float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(SoundID.Item33, npc.position); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(SoundID.Item33, npc.position); - float num353 = 6f; - int num354 = 30; - if (death) - num354 += 3; - int num355 = ModContent.ProjectileType(); + float num353 = 6f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - num349 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector34.X; - num350 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector34.Y; - num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); - num351 = num353 / num351; - num349 *= num351; - num350 *= num351; - vector34.X += num349; - vector34.Y += num350; + vector34 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + num349 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector34.X; + num350 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector34.Y; + num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350); + num351 = num353 / num351; + num349 *= num351; + num350 *= num351; + vector34.X += num349; + vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, num355, num354, 0f, Main.myPlayer, 0f, 0f); - } - } + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } } - // Charge once - if (npc.ai[2] >= chargeTime + 30f) + // Charge four times + float chargeGateValue = 30f; + chargeGateValue -= chargeGateValue / 4 * enrageScale; + if (npc.ai[2] >= chargeTime + 30f) { npc.ai[2] = 0f; - npc.target = Main.maxPlayers; + npc.ai[3] += 1f; + npc.TargetClosest(); npc.rotation = num378; - npc.ai[1] = 1f; + float maxChargeAmt = spazAlive ? 2f : 4f; + if (npc.ai[3] >= maxChargeAmt) + { + npc.ai[1] = 0f; + npc.ai[3] = 0f; + } + else + npc.ai[1] = 4f; } } @@ -6097,8 +6282,8 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 4f) { int num62 = spazAlive ? 600 : 500; - float num63 = (enraged || configBossRushBoost) ? 18f : 12f; - float num64 = (enraged || configBossRushBoost) ? 0.45f : 0.3f; + float num63 = 12f + (death ? 4f * (0.7f - lifeRatio) : 0f); + float num64 = 0.3f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); if (spazAlive) { @@ -6106,12 +6291,6 @@ namespace CalamityMod.NPCs num64 *= 0.75f; } - if (CalamityWorld.bossRushActive) - { - num63 *= 1.5f; - num64 *= 1.5f; - } - int num408 = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) num408 = -1; @@ -6152,9 +6331,9 @@ namespace CalamityMod.NPCs // Take 1.25 or 1 second to get in position, then charge npc.ai[2] += 1f; - if (npc.ai[2] >= (spazAlive ? 75f : 60f)) + if (npc.ai[2] >= (spazAlive ? 75f : 60f) - (death ? 20f * (0.7f - lifeRatio) : 0f)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 2f; npc.ai[2] = 0f; npc.netUpdate = true; @@ -6169,31 +6348,71 @@ namespace CalamityMod.NPCs public static bool BuffedSpazmatismAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - // Enrage variable if player is floating upside down - bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; - // Easier to send info to Retinazer - CalamityGlobalNPC.fireEye = 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(); + + // 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(); + + float enrageScale = 0f; + if (Main.dayTime || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 0.5f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 0.5f; + } + + // Enrage variable if player is floating upside down + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Easier to send info to Retinazer + CalamityGlobalNPC.fireEye = npc.whoAmI; // Check for Retinazer bool retAlive = false; if (CalamityGlobalNPC.laserEye != -1) retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; - bool enrage = npc.life < npc.lifeMax * (death ? 0.5 : 0.25); + bool enrage = lifeRatio < 0.25f; - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Rotation + Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); + Vector2 lookAt = new Vector2(Main.player[npc.target].position.X - (Main.player[npc.target].width / 2), Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2)); + Vector2 rotationVector = npcCenter - lookAt; - // Rotation - float num418 = npc.position.X + (npc.width / 2) - Main.player[npc.target].position.X - (Main.player[npc.target].width / 2); - float num419 = npc.position.Y + npc.height - 59f - Main.player[npc.target].position.Y - (Main.player[npc.target].height / 2); + // Malice Mode predictive charge rotation + if (npc.ai[1] == 5f && !retAlive && malice) + { + // Velocity + float chargeVelocity = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); + chargeVelocity += 10f * enrageScale; + if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == 4f)) + chargeVelocity *= 1.3f; - float num420 = (float)Math.Atan2(num419, num418) + MathHelper.PiOver2; + lookAt += Main.player[npc.target].velocity * 20f; + rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; + } + + float num420 = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; if (num420 < 0f) num420 += MathHelper.TwoPi; else if (num420 > MathHelper.TwoPi) @@ -6236,7 +6455,7 @@ namespace CalamityMod.NPCs } // Despawn Twins at the same time - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.dayTime && !Main.player[npc.target].dead && npc.timeLeft < 10) + if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead && npc.timeLeft < 10) { for (int num423 = 0; num423 < Main.maxNPCs; num423++) { @@ -6247,7 +6466,7 @@ namespace CalamityMod.NPCs } // Despawn - if (Main.dayTime | Main.player[npc.target].dead) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -6263,18 +6482,17 @@ namespace CalamityMod.NPCs // Cursed fireball phase if (npc.ai[1] == 0f) { - // New target - npc.TargetClosest(true); - // Velocity float num424 = 12f; float num425 = 0.4f; + num424 += 6f * enrageScale; + num425 += 0.2f * enrageScale; - if (CalamityWorld.bossRushActive) - { - num424 *= 1.5f; - num425 *= 1.5f; - } + if (death) + { + num424 += 9f * (1f - lifeRatio); + num425 += 0.3f * (1f - lifeRatio); + } int num426 = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) @@ -6316,13 +6534,13 @@ namespace CalamityMod.NPCs // Fire cursed flames for 5 seconds npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) + if (npc.ai[2] >= 300f - (death ? 600f * (1f - lifeRatio) : 0f)) { // Reset AI array and go to charging phase npc.ai[1] = 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.target = Main.maxPlayers; + npc.TargetClosest(); npc.netUpdate = true; } else @@ -6339,13 +6557,12 @@ namespace CalamityMod.NPCs num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { - float num430 = CalamityWorld.bossRushActive ? 20f : 15f; - int num431 = 27; - if (death) - num431 += 3; - int num432 = ProjectileID.CursedFlameHostile; + float num430 = 15f; + num430 += 3f * enrageScale; + int type = ProjectileID.CursedFlameHostile; + int damage = npc.GetProjectileDamage(type); - num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); + num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); num429 = num430 / num429; num427 *= num429; num428 *= num429; @@ -6354,7 +6571,7 @@ namespace CalamityMod.NPCs vector44.X += num427 * 4f; vector44.Y += num428 * 4f; - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, num431, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -6365,7 +6582,11 @@ namespace CalamityMod.NPCs { // Rotation and velocity npc.rotation = num420; - float num434 = CalamityWorld.bossRushActive ? 24f : 16f; + float num434 = 16f; + num434 += 8f * enrageScale; + if (death) + num434 += 12f * (1f - lifeRatio); + Vector2 vector45 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num435 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector45.X; float num436 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector45.Y; @@ -6400,9 +6621,13 @@ namespace CalamityMod.NPCs // Reset AI array and go to cursed fireball phase npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; + npc.TargetClosest(); npc.rotation = num420; - if (npc.ai[3] >= 8f) + float totalCharges = 8f; + if (death) + totalCharges -= (float)Math.Round(16f * (1f - lifeRatio)); + + if (npc.ai[3] >= totalCharges) { npc.ai[1] = 0f; npc.ai[3] = 0f; @@ -6413,13 +6638,14 @@ namespace CalamityMod.NPCs } // Enter phase 2 earlier - if (npc.life < npc.lifeMax * 0.7 || targetFloatingUp || death) + if (lifeRatio < 0.7f || targetFloatingUp) { // Reset AI array and go to transition phase npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -6494,26 +6720,25 @@ namespace CalamityMod.NPCs if (Main.npc[CalamityGlobalNPC.laserEye].active) retInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; } - int defenseGain = retInPhase1 ? 9999 : 30; + npc.chaseable = !retInPhase1; // Increase defense and damage npc.damage = (int)(npc.defDamage * 1.5); - npc.defense = npc.defDefense + defenseGain; + npc.defense = npc.defDefense + 18; + calamityGlobalNPC.DR = retInPhase1 ? 0.9999f : 0.2f; + calamityGlobalNPC.unbreakableDR = retInPhase1; - // Change hit sound to metal - npc.HitSound = SoundID.NPCHit4; + // Change hit sound to metal + npc.HitSound = SoundID.NPCHit4; // Shadowflamethrower phase if (npc.ai[1] == 0f) { - float num440 = 6.2f; - float num441 = 0.1f; - if (CalamityWorld.bossRushActive) - { - num440 *= 1.5f; - num441 *= 1.5f; - } + float num440 = 6.2f + (death ? 2f * (0.7f - lifeRatio) : 0f); + float num441 = 0.1f + (death ? 0.03f * (0.7f - lifeRatio) : 0f); + num440 += 4f * enrageScale; + num441 += 0.06f * enrageScale; int num442 = 1; if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + Main.player[npc.target].width) @@ -6534,10 +6759,6 @@ namespace CalamityMod.NPCs if (targetFloatingUp) num440 += 2f; - // Speed increase - if (enraged || configBossRushBoost) - num440 += 2f; - num445 = num440 / num445; num443 *= num445; num444 *= num445; @@ -6569,12 +6790,12 @@ namespace CalamityMod.NPCs // Fire flamethrower for x seconds npc.ai[2] += retAlive ? 1f : 2f; - if (npc.ai[2] >= 180f) + if (npc.ai[2] >= 180f - (death ? 60f * (0.7f - lifeRatio) : 0f)) { npc.ai[1] = (!retAlive || enrage) ? 5f : 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.target = Main.maxPlayers; + npc.TargetClosest(); npc.netUpdate = true; } @@ -6597,14 +6818,12 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; - float num446 = CalamityWorld.bossRushActive ? 9f : 6f; + float num446 = 6f; + num446 += 2f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - int num447 = 33; - if (death) - num447 += 3; - int num448 = ModContent.ProjectileType(); - - vector46 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + vector46 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num443 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector46.X; num444 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector46.Y; num445 = (float)Math.Sqrt(num443 * num443 + num444 * num444); @@ -6619,10 +6838,10 @@ namespace CalamityMod.NPCs vector46.Y -= num444 * 1f; if (canHit) - Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, num448, num447, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, type, damage, 0f, Main.myPlayer, 0f, 0f); else { - int proj = Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, num448, num447, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(vector46.X, vector46.Y, num443, num444, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].tileCollide = false; } } @@ -6641,22 +6860,15 @@ namespace CalamityMod.NPCs // Set rotation and velocity npc.rotation = num420; - float num450 = 16.75f; + float num450 = 16.75f + (death ? 5f * (0.7f - lifeRatio) : 0f); + num450 += 8f * enrageScale; - // Enrage - if (targetFloatingUp) + // Enrage + if (targetFloatingUp) num450 += 2f; - if (CalamityWorld.bossRushActive) - num450 *= 1.5f; - - Vector2 vector47 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num451 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector47.X; - float num452 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector47.Y; - float num453 = (float)Math.Sqrt(num451 * num451 + num452 * num452); - num453 = num450 / num453; - npc.velocity.X = num451 * num453; - npc.velocity.Y = num452 * num453; + Vector2 distanceVector = Main.player[npc.target].Center - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * num450; npc.ai[1] = 2f; return false; } @@ -6669,10 +6881,7 @@ namespace CalamityMod.NPCs if (targetFloatingUp) npc.ai[2] += 0.25f; - if (CalamityWorld.bossRushActive) - npc.ai[2] += 0.4f; - - float chargeTime = 50f; + float chargeTime = 50f - (death ? 12f * (0.7f - lifeRatio) : 0f); // Slow down if (npc.ai[2] >= chargeTime) @@ -6691,7 +6900,7 @@ namespace CalamityMod.NPCs { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = Main.maxPlayers; + npc.TargetClosest(); npc.rotation = num420; if (npc.ai[3] >= 5f) { @@ -6710,7 +6919,7 @@ namespace CalamityMod.NPCs float secondFastCharge = 4f; if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = retAlive ? 0f : 5f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -6727,29 +6936,24 @@ namespace CalamityMod.NPCs // Set charging velocity else if (Main.netMode != NetmodeID.MultiplayerClient) { - // Get a target - npc.TargetClosest(true); - // Velocity - float num48 = (enraged || configBossRushBoost) ? 30f : 20f; - if (CalamityWorld.bossRushActive) - num48 *= 1.5f; + float num48 = 20f + (death ? 6f * (0.7f - lifeRatio) : 0f); + num48 += 10f * enrageScale; if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) num48 *= 1.3f; - Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; - float num50 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector10.Y; - float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50); - float num52 = num51; + Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && malice ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; + npc.velocity = Vector2.Normalize(distanceVector) * num48; - num51 = num48 / num51; - npc.velocity.X = num49 * num51; - npc.velocity.Y = num50 * num51; - - if (retAlive) + if (retAlive) { - if (num52 < 100f) + Vector2 vector10 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num49 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector10.X; + float num50 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector10.Y; + float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50); + float num52 = num51; + + if (num52 < 100f) { if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { @@ -6781,9 +6985,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); - float num60 = (!retAlive && npc.ai[3] == 4f) ? 75f : 50f; - if (CalamityWorld.bossRushActive) - num60 *= 0.8f; + float num60 = ((!retAlive && npc.ai[3] == 4f) ? 75f : 50f) - (float)Math.Round(death ? 14f * (0.7f - lifeRatio) : 0f); npc.ai[2] += 1f; @@ -6821,8 +7023,8 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 5f) { float num62 = retAlive ? 600f : 500f; - float num63 = (enraged || configBossRushBoost) ? 24f : 16f; - float num64 = (enraged || configBossRushBoost) ? 0.6f : 0.4f; + float num63 = 16f + (death ? 5f * (0.7f - lifeRatio) : 0f); + float num64 = 0.4f + (death ? 0.1f * (0.7f - lifeRatio) : 0f); if (retAlive) { @@ -6830,12 +7032,6 @@ namespace CalamityMod.NPCs num64 *= 0.75f; } - if (CalamityWorld.bossRushActive) - { - num63 *= 1.5f; - num64 *= 1.5f; - } - Vector2 vector11 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num65 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector11.X; float num66 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) + num62 - vector11.Y; @@ -6876,32 +7072,20 @@ namespace CalamityMod.NPCs float fireRate = retAlive ? 30f : 20f; if (npc.ai[2] % fireRate == 0f) { - Vector2 vector44 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num427 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector44.X; - float num428 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector44.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { - float num430 = 16f; - int num431 = 31; - if (death) - num431 += 3; - int num432 = ModContent.ProjectileType(); - - float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - vector44.X += num427 * 4f; - vector44.Y += num428 * 4f; - - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, num431, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); + float velocity = 16f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 projectileVelocity = Vector2.Normalize(Main.player[npc.target].Center + (!retAlive && malice ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center) * velocity; + Projectile.NewProjectile(npc.Center + Vector2.Normalize(projectileVelocity) * 4f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); } } // Take 3 seconds to get in position, then charge - if (npc.ai[2] >= (retAlive ? 180f : 135f)) + if (npc.ai[2] >= (retAlive ? 180f : 135f) - (death ? 45f * (0.7f - lifeRatio) : 0f)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 3f; npc.ai[2] = -1f; } @@ -6918,42 +7102,60 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Charges far quicker, 2 - Arms and head accelerate extremely fast, 3 - Arms remain closer to the head and resist piercing #region Buffed Skeletron Prime AI public static bool BuffedSkeletronPrimeAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Get a target + 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(); // Enrage variable if player is floating upside down bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; - // Spawn arms - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Spawn arms + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - npc.TargetClosest(true); npc.ai[0] = 1f; - int arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeCannon, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeCannon, npc.whoAmI); Main.npc[arm].ai[0] = -1f; Main.npc[arm].ai[1] = npc.whoAmI; Main.npc[arm].target = npc.target; Main.npc[arm].netUpdate = true; - arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeSaw, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeSaw, npc.whoAmI); Main.npc[arm].ai[0] = 1f; Main.npc[arm].ai[1] = npc.whoAmI; Main.npc[arm].target = npc.target; Main.npc[arm].netUpdate = true; - arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeVice, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeVice, npc.whoAmI); Main.npc[arm].ai[0] = -1f; Main.npc[arm].ai[1] = npc.whoAmI; Main.npc[arm].target = npc.target; Main.npc[arm].ai[3] = 150f; Main.npc[arm].netUpdate = true; - arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeLaser, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + arm = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PrimeLaser, npc.whoAmI); Main.npc[arm].ai[0] = 1f; Main.npc[arm].ai[1] = npc.whoAmI; Main.npc[arm].target = npc.target; @@ -7000,21 +7202,17 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 5f) npc.damage = 0; else if (allArmsDead) - { npc.damage = npc.defDamage; - npc.defense = npc.defDefense; - } - else - { - npc.defense = npc.defDefense + (cannonAlive ? 8 : 0) + (laserAlive ? 8 : 0) + (viceAlive ? 8 : 0) + (sawAlive ? 8 : 0); - } - // Phases - bool phase2 = npc.life < npc.lifeMax * 0.66 || (death && allArmsDead); - bool phase3 = npc.life < npc.lifeMax * 0.33 || (death && allArmsDead); + int defenseBoost = malice ? 100 : 20; + npc.defense = npc.defDefense + (cannonAlive ? defenseBoost : 0) + (laserAlive ? defenseBoost : 0) + (viceAlive ? defenseBoost : 0) + (sawAlive ? defenseBoost : 0); + + // Phases + bool phase2 = lifeRatio < 0.66f; + bool phase3 = lifeRatio < 0.33f; // Kill all arms if Prime Head enters phase 2 - if (phase2 && !allArmsDead) + if (npc.life / (float)npc.lifeMax < 0.66f && !allArmsDead) { for (int i = 0; i < Main.maxNPCs; i++) { @@ -7032,13 +7230,13 @@ namespace CalamityMod.NPCs // Despawn if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) npc.ai[1] = 3f; } // Activate daytime enrage - if (Main.dayTime && !CalamityWorld.bossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) + if (Main.dayTime && !BossRushEvent.BossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) { // Heal if (Main.netMode != NetmodeID.MultiplayerClient) @@ -7057,15 +7255,31 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); } - // Float near player - if (npc.ai[1] == 0f || npc.ai[1] == 4f) + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = npc.ai[1] == 5f; + 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[ModContent.BuffType()] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + bool normalLaserRotation = calamityGlobalNPC.newAI[3] % 2f == 0f; + + // Float near player + if (npc.ai[1] == 0f || npc.ai[1] == 4f) { // Start other phases if arms are dead, start with spinning phase if (allArmsDead) { // Start spin phase after 5 seconds npc.ai[2] += phase3 ? 1.25f : 1f; - if (npc.ai[2] >= 300f) + if (npc.ai[2] >= (300f - (death ? 100f * (1f - lifeRatio) : 0f))) { bool shouldSpinAroundTarget = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 400f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; @@ -7077,7 +7291,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; npc.ai[1] = shouldSpinAroundTarget ? 5f : 1f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } } @@ -7096,17 +7310,23 @@ namespace CalamityMod.NPCs { npc.localAI[1] = 0f; - int totalProjectiles = 12; + int totalProjectiles = malice ? 24 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = death ? 34 : 31; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + float velocity = 5f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 480; } - } + calamityGlobalNPC.newAI[3] += 1f; + } } // Spread of rockets if cannon is dead @@ -7119,59 +7339,86 @@ namespace CalamityMod.NPCs if (npc.localAI[2] >= 300f) { npc.localAI[2] = 0f; - float num502 = CalamityWorld.bossRushActive ? 10f : 6.5f; - int num503 = 33; - if (death) - num503 += 3; - int num504 = ProjectileID.RocketSkeleton; - Vector2 value19 = Main.player[npc.target].Center - npc.Center; + float num502 = 1f; + int type = ProjectileID.RocketSkeleton; + int damage = npc.GetProjectileDamage(type); + Vector2 value19 = Main.player[npc.target].Center - npc.Center; value19.Normalize(); value19 *= num502; int numProj = 2; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num504, num503, 0f, Main.myPlayer, 0f, 1f); - } + float rotation = MathHelper.ToRadians(5); + if (malice) + { + rotation = MathHelper.ToRadians(8); + for (int i = 0; i < numProj; i++) + { + Projectile.NewProjectile(npc.Center, value19.RotatedBy(-rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(npc.Center, value19.RotatedBy(+rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); + } + Projectile.NewProjectile(npc.Center, value19, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + else + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } } } } npc.rotation = npc.velocity.X / 15f; - float velocity2 = 3f; - float acceleration = CalamityWorld.bossRushActive ? 0.2f : 0.1f; + float velocityY = 3f - (death ? 1f - lifeRatio : 0f); + float velocityX = 7f - (death ? 3.5f * (1f - lifeRatio) : 0f); + float acceleration = 0.1f + (death ? 0.05f * (1f - lifeRatio) : 0f); + if (!cannonAlive) { - velocity2 -= 0.35f; + velocityY -= 0.35f; acceleration += 0.025f; } if (!laserAlive) { - velocity2 -= 0.35f; + velocityY -= 0.35f; acceleration += 0.025f; } if (!viceAlive) { - velocity2 -= 0.35f; + velocityY -= 0.35f; acceleration += 0.025f; } if (!sawAlive) { - velocity2 -= 0.35f; + velocityY -= 0.35f; acceleration += 0.025f; } - if (npc.position.Y > Main.player[npc.target].position.Y - 350f) + if (malice) + { + velocityY = 0.25f; + velocityX = 0.5f; + acceleration = 0.3f; + } + + // Reduce acceleration if target is holding a true melee weapon + Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + { + acceleration *= 0.5f; + } + + if (npc.position.Y > Main.player[npc.target].position.Y - 350f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; npc.velocity.Y -= acceleration; - if (npc.velocity.Y > velocity2) - npc.velocity.Y = velocity2; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) { @@ -7180,8 +7427,8 @@ namespace CalamityMod.NPCs npc.velocity.Y += acceleration; - if (npc.velocity.Y < -velocity2) - npc.velocity.Y = -velocity2; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + 150f) @@ -7189,20 +7436,20 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.98f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X -= acceleration; - if (npc.velocity.X > 7f) - npc.velocity.X = 7f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 150f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.98f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X += acceleration; - if (npc.velocity.X < -7f) - npc.velocity.X = -7f; + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; } } @@ -7214,24 +7461,30 @@ namespace CalamityMod.NPCs npc.defense *= 2; npc.damage *= 2; - if (phase2) + if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; if (npc.localAI[1] >= 45f) { npc.localAI[1] = 0f; - int totalProjectiles = 12; + int totalProjectiles = malice ? 24 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = death ? 34 : 31; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + float velocity = 5f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = 480; } - } + calamityGlobalNPC.newAI[3] += 1f; + } } npc.ai[2] += 1f; @@ -7243,8 +7496,9 @@ namespace CalamityMod.NPCs if (phase2 && !phase3) phaseTimer += 120f; - if (npc.ai[2] >= phaseTimer) + if (npc.ai[2] >= (phaseTimer - (death ? 60f * (1f - lifeRatio) : 0f))) { + npc.TargetClosest(); npc.ai[2] = 0f; npc.ai[1] = 4f; } @@ -7255,26 +7509,21 @@ namespace CalamityMod.NPCs float num456 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector48.Y; float num457 = (float)Math.Sqrt(num455 * num455 + num456 * num456); - float speed = CalamityWorld.bossRushActive ? 7f : 3f; - if (phase2 || CalamityWorld.bossRushActive) + float speed = enraged ? 12f : BossRushEvent.BossRushActive ? 9f : 6f; + if (phase2) speed += 1f; - if (phase3 || CalamityWorld.bossRushActive) + if (phase3) speed += 1f; - if (enraged || configBossRushBoost) - speed += 3f; if (targetFloatingUp) speed += 5f; - float speedBuff = 3f + (3f * (1f - npc.life / (float)npc.lifeMax)); - float speedBuff2 = 8f + (8f * (1f - npc.life / (float)npc.lifeMax)); + if (num457 > 150f) + { + float baseDistanceVelocityMult = 1f + MathHelper.Clamp((num457 - 150f) * 0.0015f, 0.05f, 1.5f); + speed *= baseDistanceVelocityMult; + } - speed += num457 / 100f; - if (speed < speedBuff) - speed = speedBuff; - if (speed > speedBuff2) - speed = speedBuff2; - - num457 = speed / num457; + num457 = speed / num457; npc.velocity.X = num455 * num457; npc.velocity.Y = num456 * num457; } @@ -7283,7 +7532,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 2f) { npc.damage = 1000; - npc.defense = 9999; + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; npc.rotation += npc.direction * 0.3f; @@ -7327,10 +7577,9 @@ namespace CalamityMod.NPCs num160 = value.X; num161 = value.Y; - int num163 = 250; - int num164 = ProjectileID.Skull; + int type = ProjectileID.Skull; vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, type, 250, 0f, Main.myPlayer, -1f, 0f); Main.projectile[num165].timeLeft = 300; } } @@ -7350,7 +7599,7 @@ namespace CalamityMod.NPCs npc.timeLeft = 500; } - // Fly around target in a circle and spawn probes + // Fly around target in a circle if (npc.ai[1] == 5f) { npc.ai[2] += 1f; @@ -7378,11 +7627,12 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - // Spawn 6 Probes and maintain velocity, or spit skulls if probes are alive + // Maintain velocity and spit skulls else { npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); - if (npc.ai[2] % 30f == 0f) + float skullSpawnDivisor = enraged ? 10f : BossRushEvent.BossRushActive ? 15f : malice ? 20f : death ? 30f - (float)Math.Round(10f * (1f - lifeRatio)) : 30f; + if (npc.ai[2] % skullSpawnDivisor == 0f) { calamityGlobalNPC.newAI[1] += 1f; @@ -7391,7 +7641,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector16 = npc.Center; - float num159 = CalamityWorld.bossRushActive ? 6f : 4f; + float num159 = enraged ? 8f : 4f + (death ? 2f * (1f - lifeRatio) : 0f); float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); @@ -7405,13 +7655,11 @@ namespace CalamityMod.NPCs num160 = value.X; num161 = value.Y; - int num163 = 28; - if (death) - num163 += 3; - int num164 = ProjectileID.Skull; + int type = ProjectileID.Skull; + int damage = npc.GetProjectileDamage(type); vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 180; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, type, damage, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 480; Main.projectile[num165].tileCollide = false; } } @@ -7427,6 +7675,7 @@ namespace CalamityMod.NPCs npc.ai[3] = 0f; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -7436,94 +7685,69 @@ namespace CalamityMod.NPCs // Fly overhead and spit missiles if (npc.ai[1] == 6f) { - npc.ai[2] += 1f; + npc.damage = 0; npc.rotation = npc.velocity.X / 15f; - float flightVelocity = CalamityWorld.bossRushActive ? 15f : 10f; - float fligthAcceleration = CalamityWorld.bossRushActive ? 0.18f : 0.12f; + float flightVelocity = malice ? 25f : 15f + (death ? 5f * (1f - lifeRatio) : 0f); + float flightAcceleration = malice ? 0.25f : 0.15f + (death ? 0.5f * (1f - lifeRatio) : 0f); - // Spit homing missiles and then go to floating phase - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float posX = Main.player[npc.target].Center.X - center.X; - float posY = Main.player[npc.target].Center.Y - center.Y - 500f; + Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 500f); + npc.SimpleFlyMovement(Vector2.Normalize(destination - npc.Center) * flightVelocity, flightAcceleration); - float distance = (float)Math.Sqrt(posX * posX + posY * posY); - if (distance < 20f) - { - posX = npc.velocity.X; - posY = npc.velocity.Y; - } - else - { - distance = flightVelocity / distance; - posX *= distance; - posY *= distance; - } + // Spit homing missiles and then go to floating phase + if (Vector2.Distance(npc.Center, destination) < 160f || npc.ai[2] > 0f) + { + float missileSpawnDivisor = death ? 12f - (float)Math.Round(4f * (1f - lifeRatio)) : 12f; + npc.ai[2] += 1f; + if (npc.ai[2] % missileSpawnDivisor == 0f) + { + calamityGlobalNPC.newAI[1] += 1f; - if (npc.velocity.X < posX) - { - npc.velocity.X += fligthAcceleration; - if (npc.velocity.X < 0f && posX > 0f) - npc.velocity.X += fligthAcceleration; - } - else if (npc.velocity.X > posX) - { - npc.velocity.X -= fligthAcceleration; - if (npc.velocity.X > 0f && posX < 0f) - npc.velocity.X -= fligthAcceleration; - } - if (npc.velocity.Y < posY) - { - npc.velocity.Y += fligthAcceleration; - if (npc.velocity.Y < 0f && posY > 0f) - npc.velocity.Y += fligthAcceleration; - } - else if (npc.velocity.Y > posY) - { - npc.velocity.Y -= fligthAcceleration; - if (npc.velocity.Y > 0f && posY < 0f) - npc.velocity.Y -= fligthAcceleration; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); + velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); + velocity *= enraged ? 10f : 5f; + int type = ProjectileID.SaucerMissile; + int damage = npc.GetProjectileDamage(type); + float delayBeforeHoming = enraged ? 15f : malice ? 25f : 45f; + 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); + } - if (npc.ai[2] % 12f == 0f) - { - calamityGlobalNPC.newAI[1] += 1f; + Main.PlaySound(SoundID.Item39, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 velocity = new Vector2(-1f * (float)Main.rand.NextDouble() * 3f, 1f); - velocity = velocity.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver4); - velocity *= CalamityWorld.bossRushActive ? 7.5f : 5f; - int damage = 33; - if (death) - damage += 3; - float delayBeforeHoming = CalamityWorld.bossRushActive ? 30f : 45f; - Projectile.NewProjectile(npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 4f, velocity.X, velocity.Y, ProjectileID.SaucerMissile, damage, 0f, Main.myPlayer, 0f, delayBeforeHoming); - } - - Main.PlaySound(SoundID.Item39, npc.Center); - - if (calamityGlobalNPC.newAI[1] >= 10f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.localAI[1] = -90f; - npc.localAI[2] = -90f; - npc.netUpdate = true; - } - } + if (calamityGlobalNPC.newAI[1] >= 10f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.localAI[1] = -90f; + npc.localAI[2] = -90f; + npc.TargetClosest(); + npc.netUpdate = true; + } + } + } } } return false; } - public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) + public static bool BuffedPrimeLaserAI(NPC npc, bool enraged, Mod mod) { - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); // Set direction npc.spriteDirection = -(int)npc.ai[0]; @@ -7572,6 +7796,8 @@ namespace CalamityMod.NPCs else npc.damage = npc.defDamage; + bool normalLaserRotation = npc.localAI[1] % 2f == 0f; + // Phase 1 if (npc.ai[2] == 0f) { @@ -7593,28 +7819,32 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; npc.ai[2] = 1f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) + float velocityY = malice ? 0.5f : death ? 2f : 2.5f; + float velocityX = malice ? 1f : death ? 5f : 7f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y > 2.5f) - npc.velocity.Y = 2.5f; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y < -2.5f) - npc.velocity.Y = -2.5f; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) @@ -7622,23 +7852,22 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.21f : 0.14f; + npc.velocity.X -= malice ? 0.3f : death ? 0.16f : 0.14f; - if (npc.velocity.X > 7f) - npc.velocity.X = 7f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.21f : 0.14f; + npc.velocity.X += malice ? 0.3f : death ? 0.16f : 0.14f; - if (npc.velocity.X < -7f) - npc.velocity.X = -7f; + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; } - npc.TargetClosest(true); Vector2 vector62 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num506 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector62.X; float num507 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector62.Y; @@ -7659,17 +7888,16 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= 90f) { npc.localAI[0] = 0f; - float num509 = CalamityWorld.bossRushActive ? 13f : 11f; - int num510 = 31; - if (death) - num510 += 3; - int num511 = ProjectileID.DeathLaser; - num508 = num509 / num508; + npc.TargetClosest(); + float num509 = malice ? 13f : 11f; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + num508 = num509 / num508; num506 *= num508; num507 *= num508; vector62.X += num506 * 8f; vector62.Y += num507 * 8f; - Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, num511, num510, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector62.X, vector62.Y, num506, num507, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -7694,14 +7922,15 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } Vector2 vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 350f - vector63.X; - float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 120f - vector63.Y; // Used to be 20f + float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 320f - vector63.X; + float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 160f - vector63.Y; float num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); - num515 = (CalamityWorld.bossRushActive ? 10f : 7f) / num515; + num515 = 9f / num515; num513 *= num515; num514 *= num515; @@ -7709,32 +7938,30 @@ namespace CalamityMod.NPCs { if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X -= malice ? 0.3f : death ? 0.12f : 0.1f; } if (npc.velocity.X < num513) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.X += malice ? 0.3f : death ? 0.12f : 0.1f; } if (npc.velocity.Y > num514) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.09f : 0.06f; + npc.velocity.Y -= malice ? 0.3f : death ? 0.08f : 0.06f; } if (npc.velocity.Y < num514) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.09f : 0.06f; + npc.velocity.Y += malice ? 0.3f : death ? 0.08f : 0.06f; } - npc.TargetClosest(true); vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X; num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y; - num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); npc.rotation = (float)Math.Atan2(num514, num513) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) @@ -7751,27 +7978,42 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - - int totalProjectiles = 12; + npc.TargetClosest(); + int totalProjectiles = malice ? 24 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = death ? 34 : 31; - float velocity = CalamityWorld.bossRushActive ? 6.5f : 5f; + int type = ProjectileID.DeathLaser; + int damage = npc.GetProjectileDamage(type); + float velocity = enraged ? 8f : 5f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, ProjectileID.DeathLaser, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 300; + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].timeLeft = enraged ? 600 : 480; } - } + npc.localAI[1] += 1f; + } } } return false; } - public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) + public static bool BuffedPrimeCannonAI(NPC npc, bool enraged, Mod mod) { - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); npc.spriteDirection = -(int)npc.ai[0]; @@ -7846,6 +8088,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 1f; fireSlower = false; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -7869,6 +8112,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; fireSlower = true; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -7879,25 +8123,28 @@ namespace CalamityMod.NPCs if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) + float velocityY = malice ? 0.5f : death ? 2f : 2.5f; + float velocityX = malice ? 1f : death ? 5f : 7f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.Y -= malice ? 0.275f : death ? 0.1f : 0.08f; - if (npc.velocity.Y > 2.5f) - npc.velocity.Y = 2.5f; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.Y += malice ? 0.275f : death ? 0.1f : 0.08f; - if (npc.velocity.Y < -2.5f) - npc.velocity.Y = -2.5f; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f) @@ -7905,20 +8152,20 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.3f : 0.2f; + npc.velocity.X -= malice ? 0.275f : death ? 0.22f : 0.2f; - if (npc.velocity.X > 7f) - npc.velocity.X = 7f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.3f : 0.2f; + npc.velocity.X += malice ? 0.275f : death ? 0.22f : 0.2f; - if (npc.velocity.X < -7f) - npc.velocity.X = -7f; + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; } Vector2 vector60 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -7941,17 +8188,16 @@ namespace CalamityMod.NPCs if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - float num495 = CalamityWorld.bossRushActive ? 10f : 6.5f; - int num496 = 33; - if (death) - num496 += 3; - int num497 = ProjectileID.RocketSkeleton; - num494 = num495 / num494; + npc.TargetClosest(); + float num495 = 1f; + int type = ProjectileID.RocketSkeleton; + int damage = npc.GetProjectileDamage(type); + num494 = num495 / num494; num492 *= num494; num493 *= num494; vector60.X += num492 * 5f; vector60.Y += num493 * 5f; - Projectile.NewProjectile(vector60.X, vector60.Y, num492, num493, num497, num496, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(vector60.X, vector60.Y, num492, num493, type, damage, 0f, Main.myPlayer, 0f, 1f); } } } @@ -7961,9 +8207,9 @@ namespace CalamityMod.NPCs Vector2 vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num499 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector61.X; float num500 = Main.npc[(int)npc.ai[1]].position.Y - vector61.Y; - num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 80f - vector61.Y; + num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 160f - vector61.Y; float num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); - num501 = (CalamityWorld.bossRushActive ? 10f : 7f) / num501; + num501 = 9f / num501; num499 *= num501; num500 *= num501; @@ -7971,32 +8217,30 @@ namespace CalamityMod.NPCs { if (npc.velocity.X > 0f) npc.velocity.X *= 0.9f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.X -= malice ? 0.275f : death ? 0.1f : 0.08f; } if (npc.velocity.X < num499) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.9f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.X += malice ? 0.275f : death ? 0.1f : 0.08f; } if (npc.velocity.Y > num500) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.Y -= malice ? 0.275f : death ? 0.1f : 0.08f; } if (npc.velocity.Y < num500) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.9f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.12f : 0.08f; + npc.velocity.Y += malice ? 0.275f : death ? 0.1f : 0.08f; } - npc.TargetClosest(true); vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X; num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y; - num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); npc.rotation = (float)Math.Atan2(num500, num499) - MathHelper.PiOver2; if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack) @@ -8010,24 +8254,36 @@ namespace CalamityMod.NPCs if (!sawAlive) npc.localAI[0] += 0.5f; - if (npc.localAI[0] >= 180f) + if (npc.localAI[0] >= (enraged ? 90f : 180f)) { npc.localAI[0] = 0f; - float num502 = CalamityWorld.bossRushActive ? 10f : 6.5f; - int num503 = 33; - if (death) - num503 += 3; - int num504 = ProjectileID.RocketSkeleton; - Vector2 value19 = Main.player[npc.target].Center - npc.Center; + npc.TargetClosest(); + float num502 = 1f; + int type = ProjectileID.RocketSkeleton; + int damage = npc.GetProjectileDamage(type); + Vector2 value19 = Main.player[npc.target].Center - npc.Center; value19.Normalize(); value19 *= num502; int numProj = 2; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, num504, num503, 0f, Main.myPlayer, 0f, 1f); - } + float rotation = MathHelper.ToRadians(5); + if (malice) + { + rotation = MathHelper.ToRadians(8); + for (int i = 0; i < numProj; i++) + { + Projectile.NewProjectile(npc.Center, value19.RotatedBy(-rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(npc.Center, value19.RotatedBy(+rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); + } + Projectile.NewProjectile(npc.Center, value19, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + else + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } } } } @@ -8035,10 +8291,21 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPrimeViceAI(NPC npc, Mod mod) + public static bool BuffedPrimeViceAI(NPC npc, bool enraged, Mod mod) { - // Direction - npc.spriteDirection = -(int)npc.ai[0]; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool malice = CalamityWorld.malice || 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(); + + // 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(); + + // Direction + npc.spriteDirection = -(int)npc.ai[0]; // Where the vice should be in relation to the head Vector2 vector55 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); @@ -8101,25 +8368,28 @@ namespace CalamityMod.NPCs // Return to the head if (npc.ai[2] == 99f) { - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + float velocityY = malice ? 1f : death ? 5f : 7f; + float velocityX = malice ? 1.5f : death ? 8f : 10f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y > 7f) - npc.velocity.Y = 7f; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y < -7f) - npc.velocity.Y = -7f; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) @@ -8127,20 +8397,20 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.75f : 0.5f; + npc.velocity.X -= malice ? 1f : death ? 0.55f : 0.5f; - if (npc.velocity.X > 10f) - npc.velocity.X = 10f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.75f : 0.5f; + npc.velocity.X += malice ? 1f : death ? 0.55f : 0.5f; - if (npc.velocity.X < -10f) - npc.velocity.X = -10f; + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; } } @@ -8167,28 +8437,33 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) + float velocityY = malice ? 0.5f : death ? 2f : 2.5f; + float velocityX = malice ? 1.5f : death ? 7f : 8f; + float velocityX2 = malice ? 1.25f : death ? 6f : 7f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y > 2.5f) - npc.velocity.Y = 2.5f; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y < -2.5f) - npc.velocity.Y = -2.5f; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 250f) @@ -8196,26 +8471,25 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.94f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.45f : 0.3f; + npc.velocity.X -= malice ? 0.8f : death ? 0.33f : 0.3f; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.94f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.3f : 0.2f; + npc.velocity.X += malice ? 0.8f : death ? 0.22f : 0.2f; - if (npc.velocity.X < -7f) - npc.velocity.X = -7f; + if (npc.velocity.X < -velocityX2) + npc.velocity.X = -velocityX2; } Vector2 vector57 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num483 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector57.X; float num484 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector57.Y; - float num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); npc.rotation = (float)Math.Atan2(num484, num483) + MathHelper.PiOver2; return false; } @@ -8229,7 +8503,6 @@ namespace CalamityMod.NPCs Vector2 vector58 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num486 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 280f * npc.ai[0] - vector58.X; float num487 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; - float num488 = (float)Math.Sqrt(num486 * num486 + num487 * num487); npc.rotation = (float)Math.Atan2(num487, num486) + MathHelper.PiOver2; npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; @@ -8241,7 +8514,7 @@ namespace CalamityMod.NPCs if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) { - float chargeVelocity = CalamityWorld.bossRushActive ? 24f : 16f; + float chargeVelocity = enraged ? 24f : malice ? 20f : 16f; if (!cannonAlive) chargeVelocity += 1.5f; if (!laserAlive) @@ -8249,12 +8522,12 @@ namespace CalamityMod.NPCs if (!sawAlive) chargeVelocity += 1.5f; - npc.TargetClosest(true); npc.ai[2] = 2f; + npc.TargetClosest(); vector58 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num486 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector58.X; num487 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector58.Y; - num488 = (float)Math.Sqrt(num486 * num486 + num487 * num487); + float num488 = (float)Math.Sqrt(num486 * num486 + num487 * num487); num488 = chargeVelocity / num488; npc.velocity.X = num486 * num488; npc.velocity.Y = num487 * num488; @@ -8280,6 +8553,7 @@ namespace CalamityMod.NPCs // Return to head npc.ai[2] = 3f; npc.ai[3] = 0f; + npc.TargetClosest(); return false; } @@ -8294,7 +8568,6 @@ namespace CalamityMod.NPCs Vector2 vector59 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num489 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector59.X; float num490 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; - float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); npc.rotation = (float)Math.Atan2(num490, num489) + MathHelper.PiOver2; npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; @@ -8305,7 +8578,7 @@ namespace CalamityMod.NPCs if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 500f) { - float chargeVelocity = CalamityWorld.bossRushActive ? 21f : 14f; + float chargeVelocity = enraged ? 21f : malice ? 17.5f : 14f; if (!cannonAlive) chargeVelocity += 1.15f; if (!laserAlive) @@ -8313,12 +8586,12 @@ namespace CalamityMod.NPCs if (!sawAlive) chargeVelocity += 1.15f; - npc.TargetClosest(true); npc.ai[2] = 5f; + npc.TargetClosest(); vector59 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num489 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector59.X; num490 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector59.Y; - num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); + float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); num491 = chargeVelocity / num491; npc.velocity.X = num489 * num491; npc.velocity.Y = num490 * num491; @@ -8342,6 +8615,7 @@ namespace CalamityMod.NPCs // Return to head npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); return false; } @@ -8353,9 +8627,20 @@ namespace CalamityMod.NPCs return false; } - public static bool BuffedPrimeSawAI(NPC npc, Mod mod) + public static bool BuffedPrimeSawAI(NPC npc, bool enraged, Mod mod) { - Vector2 vector50 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool malice = CalamityWorld.malice || 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(); + + // 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(); + + Vector2 vector50 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num462 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector50.X; float num463 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector50.Y; float num464 = (float)Math.Sqrt(num462 * num462 + num463 * num463); @@ -8414,25 +8699,28 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 99f) { - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) + float velocityY = malice ? 1f : death ? 6f : 7f; + float velocityX = malice ? 1.5f : death ? 8f : 10f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y > 7f) - npc.velocity.Y = 7f; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; + npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; - if (npc.velocity.Y < -7f) - npc.velocity.Y = -7f; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) @@ -8440,20 +8728,20 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.75f : 0.5f; + npc.velocity.X -= malice ? 1.2f : death ? 0.55f : 0.5f; - if (npc.velocity.X > 10f) - npc.velocity.X = 10f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.75f : 0.5f; + npc.velocity.X += malice ? 1.2f : death ? 0.55f : 0.5f; - if (npc.velocity.X < -10f) - npc.velocity.X = -10f; + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; } } else @@ -8476,28 +8764,32 @@ namespace CalamityMod.NPCs { npc.ai[2] += 1f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) + float velocityY = malice ? 0.5f : death ? 2f : 2.5f; + float velocityX = malice ? 1.5f : death ? 8f : 10f; + + if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.06f : 0.04f; + npc.velocity.Y -= malice ? 0.15f : death ? 0.05f : 0.04f; - if (npc.velocity.Y > 2.5f) - npc.velocity.Y = 2.5f; + if (npc.velocity.Y > velocityY) + npc.velocity.Y = velocityY; } else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.96f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.06f : 0.04f; + npc.velocity.Y += malice ? 0.15f : death ? 0.05f : 0.04f; - if (npc.velocity.Y < -2.5f) - npc.velocity.Y = -2.5f; + if (npc.velocity.Y < -velocityY) + npc.velocity.Y = -velocityY; } if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) @@ -8505,26 +8797,25 @@ namespace CalamityMod.NPCs if (npc.velocity.X > 0f) npc.velocity.X *= 0.96f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.45f : 0.3f; + npc.velocity.X -= malice ? 0.8f : death ? 0.33f : 0.3f; - if (npc.velocity.X > 10f) - npc.velocity.X = 10f; + if (npc.velocity.X > velocityX) + npc.velocity.X = velocityX; } if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 250f) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.96f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.45f : 0.3f; + npc.velocity.X += malice ? 0.8f : death ? 0.33f : 0.3f; - if (npc.velocity.X < -10f) - npc.velocity.X = -10f; + if (npc.velocity.X < -velocityX) + npc.velocity.X = -velocityX; } Vector2 vector52 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num468 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector52.X; float num469 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector52.Y; - float num470 = (float)Math.Sqrt(num468 * num468 + num469 * num469); npc.rotation = (float)Math.Atan2(num469, num468) + MathHelper.PiOver2; return false; } @@ -8534,7 +8825,6 @@ namespace CalamityMod.NPCs Vector2 vector53 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num471 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector53.X; float num472 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector53.Y; - float num473 = (float)Math.Sqrt(num471 * num471 + num472 * num472); npc.rotation = (float)Math.Atan2(num472, num471) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; @@ -8544,7 +8834,7 @@ namespace CalamityMod.NPCs if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { - float chargeVelocity = CalamityWorld.bossRushActive ? 33f : 22f; + float chargeVelocity = enraged ? 33f : malice ? 27.5f : 22f; if (!cannonAlive) chargeVelocity += 1.5f; if (!laserAlive) @@ -8552,12 +8842,12 @@ namespace CalamityMod.NPCs if (!viceAlive) chargeVelocity += 1.5f; - npc.TargetClosest(true); npc.ai[2] = 2f; + npc.TargetClosest(); vector53 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num471 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector53.X; num472 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector53.Y; - num473 = (float)Math.Sqrt(num471 * num471 + num472 * num472); + float num473 = (float)Math.Sqrt(num471 * num471 + num472 * num472); num473 = chargeVelocity / num473; npc.velocity.X = num471 * num473; npc.velocity.Y = num472 * num473; @@ -8575,7 +8865,7 @@ namespace CalamityMod.NPCs { if (npc.ai[2] == 4f) { - float chargeVelocity = CalamityWorld.bossRushActive ? 16f : 11f; + float chargeVelocity = enraged ? 16.5f : malice ? 13.5f : 11f; if (!cannonAlive) chargeVelocity += 1.5f; if (!laserAlive) @@ -8583,7 +8873,6 @@ namespace CalamityMod.NPCs if (!viceAlive) chargeVelocity += 1.5f; - npc.TargetClosest(true); Vector2 vector54 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num474 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector54.X; float num475 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector54.Y; @@ -8592,29 +8881,30 @@ namespace CalamityMod.NPCs num474 *= num476; num475 *= num476; - if (npc.velocity.X > num474) + float acceleration = malice ? 0.15f : death ? 0.06f : 0.05f; + if (npc.velocity.X > num474) { if (npc.velocity.X > 0f) npc.velocity.X *= 0.97f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.075f : 0.05f; + npc.velocity.X -= acceleration; } if (npc.velocity.X < num474) { if (npc.velocity.X < 0f) npc.velocity.X *= 0.97f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.075f : 0.05f; + npc.velocity.X += acceleration; } if (npc.velocity.Y > num475) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.97f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.075f : 0.05f; + npc.velocity.Y -= acceleration; } if (npc.velocity.Y < num475) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.97f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.075f : 0.05f; + npc.velocity.Y += acceleration; } npc.ai[3] += 1f; @@ -8625,13 +8915,13 @@ namespace CalamityMod.NPCs { npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } vector54 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); num474 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector54.X; num475 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector54.Y; - num476 = (float)Math.Sqrt(num474 * num474 + num475 * num475); npc.rotation = (float)Math.Atan2(num475, num474) + MathHelper.PiOver2; return false; } @@ -8645,38 +8935,47 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Spawns multiple tentacle rings that now rotate, 2 - Spawns far more tentacles to protect herself in phase 2 and they resist piercing, 3 - Spore gas spreads out far more, 4 - Plantera is larger #region Buffed Plantera AI public static bool BuffedPlanteraAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases based on HP bool phase1phase2 = lifeRatio < 0.75f; bool phase2 = lifeRatio <= 0.5f; - bool phase3 = lifeRatio < 0.35f || (death && phase2); + bool phase3 = lifeRatio < 0.35f; bool phase4 = lifeRatio < 0.2f; // Variables and target - bool enrage = false; + bool enrage = malice; bool despawn = false; - npc.TargetClosest(true); - // Check for Jungle and remaining Tentacles - bool surface = !CalamityWorld.bossRushActive && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; - int tentacleCount = NPC.CountNPCS(NPCID.PlanterasTentacle); - bool tentaclesDead = tentacleCount == 0; + // Check for Jungle + bool surface = !BossRushEvent.BossRushActive && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; + int maxTentacles = death ? 25 : 20; float speedUpDistance = 480f; - if (tentaclesDead) - speedUpDistance -= 300f * (1f - lifeRatio); bool speedUp = Vector2.Distance(Main.player[npc.target].Center, npc.Center) > speedUpDistance; // 30 or 40 tile distance - // The base distance each tentacle ring spreads out from Plantera - float tentacleRingDistance = 60f; - // Despawn if (Main.player[npc.target].dead) { @@ -8701,9 +9000,9 @@ namespace CalamityMod.NPCs if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - int num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); + num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); + num729 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); } // Find positions of hooks @@ -8728,68 +9027,43 @@ namespace CalamityMod.NPCs num731 /= num732; // Velocity and acceleration - float velocity = 6f; - float acceleration = 0.06f; + float velocity = 4f; + float acceleration = 0.04f; if (phase3) { - velocity = 10f; - acceleration = 0.1f; - if (tentaclesDead || phase4) - { - velocity = 12f; - acceleration = 0.12f; - } + velocity = 6.5f; + acceleration = 0.06f; + if (phase4) + velocity = 7f; } else if (phase2) { - velocity = 8f; - acceleration = 0.08f; + velocity = 6f; + acceleration = 0.06f; } - // Move faster if inside active tiles - int radius = 2; // 2 tile radius - int diameter = radius * 2; - int npcCenterX = (int)(npc.Center.X / 16f); - int npcCenterY = (int)(npc.Center.Y / 16f); - Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - bool insideTiles = false; - for (int x = area.Left; x < area.Right; x++) - { - for (int y = area.Top; y < area.Bottom; y++) - { - 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]) - insideTiles = true; - } - } - } - - // Slow down if close to target and not inside tiles - if (!speedUp && !insideTiles) - { - velocity = 4f; - acceleration = 0.04f; - } + if (malice) + { + velocity += 2f; + acceleration += 0.02f; + } // Enrage if target is on the surface - if (!CalamityWorld.bossRushActive && (surface || Main.player[npc.target].position.Y > ((Main.maxTilesY - 200) * 16))) + if (!BossRushEvent.BossRushActive && (surface || Main.player[npc.target].position.Y > ((Main.maxTilesY - 200) * 16))) { enrage = true; velocity += 8f; acceleration = 0.15f; } - if (CalamityWorld.bossRushActive) - { - velocity *= 1.5f; - acceleration *= 1.5f; - } + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && enrage) || enraged; // Detect active tiles around Plantera - radius = 20; // 20 tile radius - diameter = radius * 2; - area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + int radius = 20; // 20 tile radius + int diameter = radius * 2; + int npcCenterX = (int)(npc.Center.X / 16f); + int npcCenterY = (int)(npc.Center.Y / 16f); + Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); int nearbyActiveTiles = 0; // 0 to 1600 for (int x = area.Left; x < area.Right; x++) { @@ -8806,13 +9080,20 @@ namespace CalamityMod.NPCs // Scale multiplier based on nearby active tiles float tileEnrageMult = 1f; if (nearbyActiveTiles < 800) - tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f + tileEnrageMult += (800 - nearbyActiveTiles) * 0.00075f; // Ranges from 1f to 1.6f + + if (malice) + tileEnrageMult = 1.6f; + + if (enraged) + tileEnrageMult = 1.8f; // Let hooks and tentacles know how enraged plantera is npc.ai[3] = tileEnrageMult; + float tentacleEnrageMult = 1f - lifeRatio + (tileEnrageMult - 1f); - // Movement relative to the target and hook positions - Vector2 vector91 = new Vector2(num730, num731); + // Movement relative to the target and hook positions + Vector2 vector91 = new Vector2(num730, num731); float num736 = Main.player[npc.target].Center.X - vector91.X; float num737 = Main.player[npc.target].Center.Y - vector91.Y; if (despawn) @@ -8823,6 +9104,12 @@ namespace CalamityMod.NPCs } float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + if (death) + { + velocity += velocity * 0.25f * (1f - lifeRatio); + acceleration += acceleration * 0.25f * (1f - lifeRatio); + } + // Increase speed based on nearby active tiles velocity *= tileEnrageMult; acceleration *= tileEnrageMult; @@ -8833,11 +9120,13 @@ namespace CalamityMod.NPCs // Velocity ranges from 17 to 30.6, Acceleration ranges from 0.15 to 0.27, enraged phase 3 // Distance Plantera can travel from her hooks - float maxDistanceFromHooks = enrage ? 900f : 600f; + float maxDistanceFromHooks = enrage ? 1000f : 600f; if (phase3) maxDistanceFromHooks += 150f; + if (death) + maxDistanceFromHooks += maxDistanceFromHooks * 0.2f * (1f - lifeRatio); - if (num738 >= maxDistanceFromHooks) + if (num738 >= maxDistanceFromHooks) { num738 = maxDistanceFromHooks / num738; num736 *= num738; @@ -8889,16 +9178,15 @@ namespace CalamityMod.NPCs } // Slow down considerably if near player - if (!speedUp && nearbyActiveTiles > 800 && !insideTiles) + if (!speedUp && nearbyActiveTiles > 800 && !Collision.SolidCollision(npc.position, npc.width, npc.height) && 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.velocity.Length() > velocity) - npc.velocity *= 0.97f; + if (npc.velocity.Length() > 4f) + npc.velocity *= 0.98f; } // Rotation - 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; + 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; // Phase 1 @@ -8909,41 +9197,35 @@ namespace CalamityMod.NPCs if (npc.localAI[0] == 1f) { npc.localAI[0] = 2f; - int totalTentacles = 6; - float radians = MathHelper.TwoPi / totalTentacles; + int baseTentacles = death ? 3 : 2; + int totalTentacles = (int)(baseTentacles * tileEnrageMult); for (int i = 0; i < totalTentacles; i++) { - Vector2 vector255 = new Vector2(0f, -tentacleRingDistance * totalTentacles).RotatedBy(radians * i); - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, vector255.X, vector255.Y, 1f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); } } } - // Adjust stats - npc.defense = 42 + tentacleCount * 5; + // Adjust stats + calamityGlobalNPC.DR = 0.15f; + calamityGlobalNPC.unbreakableDR = false; + npc.defense = 32; npc.damage = npc.defDamage; - if (enrage) - { - npc.defense *= 2; - npc.damage *= 2; - } // Fire projectiles if (Main.netMode != NetmodeID.MultiplayerClient) { - float shootBoost = death ? 4f : 8f * (1f - lifeRatio); + float shootBoost = 8f * (1f - lifeRatio); npc.localAI[1] += 1f + shootBoost; if (enrage) - { - npc.localAI[1] += 3f; + npc.localAI[1] += 2f; - // If hit, fire projectiles even if target is behind tiles - if (npc.justHit && Main.rand.NextBool(2)) - npc.localAI[3] = 1f; - } + // If hit, fire projectiles even if target is behind tiles + if (npc.justHit) + npc.localAI[3] = 1f; - if (npc.localAI[1] >= 75f) + if (npc.localAI[1] >= 75f) { npc.localAI[1] = 0f; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); @@ -8954,24 +9236,21 @@ namespace CalamityMod.NPCs } if (canHit) { - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); - float num742 = CalamityWorld.bossRushActive ? 27f : 18f; - float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - - int damage = 24; - int projectileType = ProjectileID.SeedPlantera; - if ((lifeRatio < 0.9f || death) && Main.rand.NextBool(2)) + npc.TargetClosest(); + int projectileType = ProjectileID.SeedPlantera; + float projectileVelocity = 17f; + int chance = malice ? 2 : 6; + if (Main.rand.NextBool(chance)) + { + projectileType = ModContent.ProjectileType(); + projectileVelocity = 3f; + } + if (lifeRatio < 0.9f && Main.rand.NextBool(3)) { - damage = 30; npc.localAI[1] = -30f; projectileType = ProjectileID.PoisonSeedPlantera; } - else if ((lifeRatio < 0.8f || death) && Main.rand.NextBool(4)) + else if (lifeRatio < 0.8f && Main.rand.NextBool(4)) { int thornBallCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) @@ -8984,23 +9263,24 @@ namespace CalamityMod.NPCs } if (thornBallCount < 2) { - damage = 34; npc.localAI[1] = -120f; projectileType = ProjectileID.ThornBall; } } - if (death) - damage += 3; + int damage = npc.GetProjectileDamage(projectileType); - if (enrage) - damage *= 2; + Vector2 vector93 = npc.Center; + float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + num745 = projectileVelocity / num745; + num743 *= num745; + num744 *= num745; - vector93.X += num743 * 3f; + vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - if (projectileType == ProjectileID.SeedPlantera) - Main.projectile[num748].timeLeft = 300; + Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, projectileType, damage, 0f, Main.myPlayer, 0f, projectileType == ProjectileID.ThornBall ? tileEnrageMult : 0f); } } } @@ -9009,15 +9289,12 @@ namespace CalamityMod.NPCs // Phase 2 else { - // Adjust stats - npc.defense = 21 + tentacleCount * 5; + // Adjust stats + calamityGlobalNPC.DR = 0.15f; + calamityGlobalNPC.unbreakableDR = false; + npc.defense = 10; npc.damage = (int)(npc.defDamage * 1.4f); npc.chaseable = true; - if (enrage) - { - npc.defense *= 4; - npc.damage *= 2; - } // Spawn tentacles if (Main.netMode != NetmodeID.MultiplayerClient) @@ -9025,24 +9302,13 @@ namespace CalamityMod.NPCs if (npc.localAI[0] == 2f) { npc.localAI[0] = 3f; - int totalTentacles = (int)((10 - NPC.CountNPCS(NPCID.PlanterasTentacle)) * tileEnrageMult); + int baseTentacles = death ? 10 : 8; + int totalTentacles = (int)(baseTentacles * tileEnrageMult); for (int i = 0; i < totalTentacles; i++) { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); } } - - if (phase4 && npc.localAI[0] == 3f) - { - npc.localAI[0] = 4f; - int totalTentacles = 8; - float radians = MathHelper.TwoPi / totalTentacles; - for (int i = 0; i < totalTentacles; i++) - { - Vector2 vector255 = new Vector2(0f, -tentacleRingDistance * totalTentacles).RotatedBy(radians * i); - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, vector255.X, vector255.Y, 1f, 0f, 255); - } - } } // Spawn gore @@ -9057,15 +9323,26 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient) { // Spawn spores - if (!phase4) - { - float spawnBoost = death ? 4f : 8f * (0.5f - lifeRatio); - npc.localAI[1] += 1f + spawnBoost; + float spawnBoost = 8f * (0.5f - lifeRatio); + npc.localAI[1] += 1f + spawnBoost; - if (npc.localAI[1] >= 360f) + // If hit, fire projectiles even if target is behind tiles + if (npc.justHit) + calamityGlobalNPC.newAI[2] = 1f; + + if (npc.localAI[1] >= 360f) + { + npc.localAI[1] = 0f; + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (calamityGlobalNPC.newAI[2] > 0f) { - float num757 = CalamityWorld.bossRushActive ? 12f : 8f; - Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + canHit = true; + calamityGlobalNPC.newAI[2] = 0f; + } + if (canHit) + { + float num757 = 4f; + Vector2 vector94 = npc.Center; float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); float num759 = Math.Abs(num758 * 0.2f); @@ -9079,33 +9356,41 @@ namespace CalamityMod.NPCs num758 *= num761; num760 *= num761; - int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); + int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); Main.npc[num762].velocity.X = num758; Main.npc[num762].velocity.Y = num760; + Main.npc[num762].dontTakeDamage = malice; Main.npc[num762].netUpdate = true; - npc.localAI[1] = 0f; } } // Fire spread of poison seeds - if (tentacleCount < 8) + if (nearbyActiveTiles > 600) + npc.localAI[3] += 0.5f + (0.5f - lifeRatio) * 8f; + else + npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (0.5f - lifeRatio) * 8f; + + // If hit, fire projectiles even if target is behind tiles + if (npc.justHit) + calamityGlobalNPC.newAI[3] = 1f; + + if (npc.localAI[3] >= 360f) { - int tentacleScale = 8 - tentacleCount; // 1 to 8 - - if (nearbyActiveTiles > 600) - npc.localAI[3] += 0.5f + ((tentacleScale - 1) * 0.5f); - else - npc.localAI[3] += (nearbyActiveTiles > 300 ? 1f : 5f) + (tentacleScale - 1); - - if (npc.localAI[3] >= 360f) + bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); + if (calamityGlobalNPC.newAI[3] > 0f) { - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); + canHit = true; + calamityGlobalNPC.newAI[3] = 0f; + } + if (canHit) + { + Vector2 vector93 = npc.Center; - float num742 = 8f - (tentacleScale * 0.25f); // 7.75f to 6f, slower projectiles are harder to avoid + float num742 = 8f + ((0.5f - lifeRatio) * 8f); // 8f to 12f if (nearbyActiveTiles < 300) - num742 = 8.5f; - if (CalamityWorld.bossRushActive) - num742 *= 1.5f; + num742 = 12f; + if (malice) + num742 += 4f; float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; @@ -9116,70 +9401,89 @@ namespace CalamityMod.NPCs vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int damage = 30; - if (death) - damage += 3; - int numProj = 2; - - int spread = 2 + tentacleScale; // 3 to 10, wider spread is harder to avoid - if (nearbyActiveTiles < 300) - spread = (Main.rand.NextBool(2) ? 3 : 6) + (tentacleScale / 2); - - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj + 1; i++) + bool anyThornBalls = false; + for (int i = 0; i < Main.maxProjectiles; i++) { - Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(vector93, perturbedSpeed, ProjectileID.PoisonSeedPlantera, damage, 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) + anyThornBalls = true; + + if (anyThornBalls) + break; + } + if (!anyThornBalls && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + int type = ProjectileID.ThornBall; + int damage = npc.GetProjectileDamage(type); + + Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, type, damage, 0f, Main.myPlayer, 0f, tileEnrageMult); + + npc.localAI[3] = -240f; + } + else + { + int numProj = 2; + int spread = 3 + (int)Math.Round((0.5f - lifeRatio) * 10f); // 3 to 8, wider spread is harder to avoid + if (nearbyActiveTiles < 300) + spread = Main.rand.Next(3, 7) + (int)Math.Round((0.5f - lifeRatio) * 8f); + + int type = ProjectileID.PoisonSeedPlantera; + int damage = npc.GetProjectileDamage(type); + + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(vector93, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + + npc.localAI[3] = 0f; } - npc.localAI[3] = 0f; } } // Fire spread of spore clouds - if (tentaclesDead || phase4) + float shootBoost = 2f * (0.5f - lifeRatio); + calamityGlobalNPC.newAI[0] += 1f + shootBoost; + + float sporeGasGateValue = malice ? 300f : 600f; + if (calamityGlobalNPC.newAI[0] >= sporeGasGateValue) { - float shootBoost = death ? 1f : 2f * (0.5f - lifeRatio); - calamityGlobalNPC.newAI[0] += 1f + shootBoost; + npc.TargetClosest(); + Main.PlaySound(SoundID.Item20, npc.position); - if (calamityGlobalNPC.newAI[0] >= 300f) + Vector2 vector93 = npc.Center; + float num742 = 3f; + float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; + float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; + float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); + num745 = num742 / num745; + num743 *= num745; + num744 *= num745; + vector93.X += num743 * 3f; + vector93.Y += num744 * 3f; + + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + int numProj = 4; + int spread = 30; + if (nearbyActiveTiles <= 300) + spread = Main.rand.NextBool(2) ? 45 : 60; + + float rotation = MathHelper.ToRadians(spread); + float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); + double startAngle = Math.Atan2(num743, num744) - rotation / 2; + double deltaAngle = rotation / numProj; + double offsetAngle; + + for (int i = 0; i < numProj; i++) { - Main.PlaySound(SoundID.Item20, npc.position); - - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y); - float num742 = CalamityWorld.bossRushActive ? 10f : 7f; - float num743 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector93.X; - float num744 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector93.Y; - float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; - num743 *= num745; - num744 *= num745; - vector93.X += num743 * 3f; - vector93.Y += num744 * 3f; - - int damage = 35; - if (death) - damage += 3; - int numProj = 4; - - int spread = 30; - if (nearbyActiveTiles <= 300) - spread = Main.rand.NextBool(2) ? 30 : 45; - - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); - double startAngle = Math.Atan2(num743, num744) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - - for (int i = 0; i < numProj; i++) - { - offsetAngle = startAngle + deltaAngle * i; - float ai0 = Main.rand.Next(3); - Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, 0f); - } - - calamityGlobalNPC.newAI[0] = 0f; + offsetAngle = startAngle + deltaAngle * i; + float ai0 = Main.rand.Next(3); + Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, ai0, 0f); } + + calamityGlobalNPC.newAI[0] = 0f; } } } @@ -9226,21 +9530,38 @@ namespace CalamityMod.NPCs } else { - npc.defense += 250; - if (npc.defense > 9999) - npc.defense = 9999; + calamityGlobalNPC.DR = 0.9999f; + calamityGlobalNPC.unbreakableDR = true; } } - return false; + if (npc.ai[0] == 0f && npc.life > 0) + npc.ai[0] = npc.lifeMax; + + if (npc.life > 0) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healthInterval = death ? (int)(npc.lifeMax * 0.08) : (int)(npc.lifeMax * 0.1); + if ((npc.life + healthInterval) < npc.ai[0]) + { + npc.ai[0] = npc.life; + + if (NPC.CountNPCS(NPCID.PlanterasTentacle) < maxTentacles) + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI, 0f, 0f, tentacleEnrageMult); + } + } + } + + return false; } public static bool BuffedPlanterasHookAI(NPC npc, Mod mod) { // Variables - bool enrage = false; + bool enrage = CalamityWorld.malice; bool despawn = false; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; // Despawn if Plantera is gone if (NPC.plantBoss < 0) @@ -9254,14 +9575,14 @@ namespace CalamityMod.NPCs float lifeRatio = Main.npc[NPC.plantBoss].life / (float)Main.npc[NPC.plantBoss].lifeMax; // Despawn if Plantera's target is dead - if (Main.player[Main.npc[NPC.plantBoss].target].dead && !CalamityWorld.bossRushActive) + if (Main.player[Main.npc[NPC.plantBoss].target].dead && !BossRushEvent.BossRushActive) despawn = true; // Tile enrage float tileEnrageMult = Main.npc[NPC.plantBoss].ai[3]; // Enrage if Plantera's target is on the surface - if (!CalamityWorld.bossRushActive && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) + if (!BossRushEvent.BossRushActive && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > ((Main.maxTilesY - 200) * 16)) | despawn)) { npc.localAI[0] -= 4f; enrage = true; @@ -9284,8 +9605,8 @@ namespace CalamityMod.NPCs npc.localAI[0] = 0f; // Timer dictating whether to pick a new location or not - float moveBoost = death ? 2f : 2f * (1f - lifeRatio); - npc.localAI[0] -= ((CalamityWorld.bossRushActive ? 4f : 1f) + moveBoost) * tileEnrageMult; + float moveBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + npc.localAI[0] -= (1f + moveBoost) * MathHelper.Lerp(1f, 3.6f, (tileEnrageMult - 1f) * 1.25f); if (enrage) npc.localAI[0] -= 6f; @@ -9352,8 +9673,8 @@ namespace CalamityMod.NPCs if (npc.ai[0] > 0f && npc.ai[1] > 0f) { // Hook movement velocity - float velocityBoost = death ? 3f : 3f * (1f - lifeRatio); - float velocity = ((CalamityWorld.bossRushActive ? 10f : 7f) + velocityBoost) * tileEnrageMult; + float velocityBoost = death ? 6f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + float velocity = (7f + velocityBoost) * tileEnrageMult; if (enrage) velocity *= 2f; if (despawn) @@ -9389,7 +9710,7 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; // Despawn if Plantera is gone if (NPC.plantBoss < 0) @@ -9400,105 +9721,78 @@ namespace CalamityMod.NPCs } // 3 seconds of resistance and no damage to prevent spawn killing and unfair hits - if (calamityGlobalNPC.newAI[1] < 180f) + if (calamityGlobalNPC.newAI[1] < 90f) { npc.damage = 0; - npc.defense = npc.defDefense + 999; calamityGlobalNPC.newAI[1] += 1f; } else - { npc.damage = npc.defDamage; - npc.defense = npc.defDefense; - } // Set Plantera to a variable int num778 = NPC.plantBoss; - if (npc.ai[3] > 0f) - num778 = (int)npc.ai[3] - 1; - - // Tile enrage - float tileEnrageMult = Main.npc[NPC.plantBoss].ai[3]; + float tileEnrageMult = Main.npc[num778].ai[3]; // Movement variables - if (npc.ai[2] == 0f) + if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.ai[0] == 0f || npc.ai[1] == 0f) { - npc.localAI[0] -= tileEnrageMult; - if (npc.localAI[0] <= 0f) - { - npc.localAI[0] = Main.rand.Next(120, 481); - npc.ai[0] = Main.rand.Next(-100, 101); - npc.ai[1] = Main.rand.Next(-100, 101); - npc.netUpdate = true; - } + npc.ai[0] = Main.rand.Next(-100, 101); + npc.ai[1] = Main.rand.Next(-100, 101); + npc.netUpdate = true; } } - else - npc.knockBackResist = 0f; - // Target - npc.TargetClosest(true); - - // Velocity and acceleration - float num779 = CalamityWorld.bossRushActive ? 1.2f : 0.8f; - float num781 = death ? 1f : 1f - npc.life / (float)npc.lifeMax; - float num780 = (CalamityWorld.bossRushActive ? 300f : 200f) + (num781 * 50f); - float deceleration = 0.8f; - - if (npc.ai[2] == 1f) - { - num779 *= 2f; - num780 *= 2f; - deceleration = 0.7f; - } + // Velocity and acceleration + float num779 = (death ? 2.4f : 1.6f) * tileEnrageMult; + float num781 = npc.ai[2]; + float num780 = 100f + (num781 * 150f); + float deceleration = (death ? 0.5f : 0.8f) / (1f + num781); // Despawn if Plantera is gone - if (!Main.npc[num778].active || NPC.plantBoss < 0) + if (!Main.npc[num778].active || num778 < 0) { npc.active = false; return false; } // Movement - float num782 = Main.npc[num778].position.X + (Main.npc[num778].width / 2); - float num783 = Main.npc[num778].position.Y + (Main.npc[num778].height / 2); - Vector2 vector97 = new Vector2(num782, num783); - float num784 = num782 + npc.ai[0]; - float num785 = num783 + npc.ai[1]; - float num786 = num784 - vector97.X; - float num787 = num785 - vector97.Y; + Vector2 planteraCenter = Main.npc[num778].Center; + float num784 = planteraCenter.X + npc.ai[0]; + float num785 = planteraCenter.Y + npc.ai[1]; + float num786 = num784 - planteraCenter.X; + float num787 = num785 - planteraCenter.Y; float num788 = (float)Math.Sqrt(num786 * num786 + num787 * num787); num788 = num780 / num788; num786 *= num788; num787 *= num788; - if (npc.position.X < num782 + num786) + if (npc.position.X < planteraCenter.X + num786) { npc.velocity.X += num779; if (npc.velocity.X < 0f && num786 > 0f) npc.velocity.X *= deceleration; } - else if (npc.position.X > num782 + num786) + else if (npc.position.X > planteraCenter.X + num786) { npc.velocity.X -= num779; if (npc.velocity.X > 0f && num786 < 0f) npc.velocity.X *= deceleration; } - if (npc.position.Y < num783 + num787) + if (npc.position.Y < planteraCenter.Y + num787) { npc.velocity.Y += num779; if (npc.velocity.Y < 0f && num787 > 0f) npc.velocity.Y *= deceleration; } - else if (npc.position.Y > num783 + num787) + else if (npc.position.Y > planteraCenter.Y + num787) { npc.velocity.Y -= num779; if (npc.velocity.Y > 0f && num787 < 0f) npc.velocity.Y *= deceleration; } - float velocityLimit = npc.ai[2] == 1f ? 18f : 12f; + float velocityLimit = 12f + 6f * num781; if (npc.velocity.X > velocityLimit) npc.velocity.X = velocityLimit; if (npc.velocity.X < -velocityLimit) @@ -9523,52 +9817,81 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Allow fists to travel further and faster, 2 - More projectiles, 3 - Fists can no longer be broken #region Buffed Golem AI public static bool BuffedGolemAI(NPC npc, bool enraged, Mod mod) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // whoAmI variable NPC.golemBoss = npc.whoAmI; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = lifeRatio < 0.75f || death; - bool phase3 = lifeRatio < 0.5f || death; - bool phase4 = lifeRatio < 0.25f || death; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; // Spawn parts if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - NPC.NewNPC((int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight, 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft); + NPC.NewNPC((int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight); + NPC.NewNPC((int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); } - // Despawn - if (npc.target >= 0 && Main.player[npc.target].dead) + // Get a target + 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(); + + // Despawn + if (npc.target >= 0 && Main.player[npc.target].dead) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Main.player[npc.target].dead) npc.noTileCollide = true; } // Enrage if the target isn't inside the temple + // Turbo enrage if target isn't inside the temple and it's malice mode bool enrage = true; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) - enrage = false; - } - if (CalamityWorld.bossRushActive) + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = malice; + } + else + turboEnrage = malice; + + if (malice) enrage = true; + if (enraged) + turboEnrage = true; + + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (enrage || turboEnrage)) || enraged; + // Alpha if (npc.alpha > 0) { @@ -9585,10 +9908,6 @@ namespace CalamityMod.NPCs bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); npc.dontTakeDamage = flag40 || flag41 || flag42; - // Damage - if (!flag40) - npc.damage = (int)(npc.defDamage * 1.5f); - // Phase 2, check for free head bool flag43 = NPC.AnyNPCs(NPCID.GolemHeadFree); @@ -9644,7 +9963,7 @@ namespace CalamityMod.NPCs if (npc.velocity.Y == 0f) { // Laser fire when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && !flag40) + if (Main.netMode != NetmodeID.MultiplayerClient && (!flag40 || turboEnrage)) { npc.localAI[1] += 1f; @@ -9659,7 +9978,7 @@ namespace CalamityMod.NPCs Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y - 60f); if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, vector82) > 160f || !flag43)) { - float num673 = enrage ? 12f : 6f; + float num673 = turboEnrage ? 12f : enrage ? 9f : 6f; float num674 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; float num675 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; float num676 = (float)Math.Sqrt(num674 * num674 + num675 * num675); @@ -9670,13 +9989,11 @@ namespace CalamityMod.NPCs vector82.X += num674 * 3f; vector82.Y += num675 * 3f; - int damage = 35; - if (death) - damage += 3; - + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { - int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer, 0f, 0f); + int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, type, damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num677].timeLeft = 480; } } @@ -9713,9 +10030,9 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == -1f) { // Set jump velocity - npc.TargetClosest(true); + npc.TargetClosest(); - float velocityBoost = death ? 8f : 8f * (1f - lifeRatio); + float velocityBoost = death ? 12f * (1f - lifeRatio) : 8f * (1f - lifeRatio); float velocityX = 4f + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -9725,30 +10042,37 @@ namespace CalamityMod.NPCs float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); float speedMult = 1f; - if (distanceBelowTarget > 0f && !flag43 && !flag40) - speedMult += distanceBelowTarget * 0.001f; - - if (speedMult > 2f) - speedMult = 2f; + float multiplier = turboEnrage ? 0.003f : enrage ? 0.002f : 0.0015f; + if (distanceBelowTarget > 0f && ((!flag41 && !flag42) || turboEnrage)) + speedMult += distanceBelowTarget * multiplier; + + float speedMultLimit = turboEnrage ? 4f : enrage ? 3f : 2.5f; + if (speedMult > speedMultLimit) + speedMult = speedMultLimit; if (Main.player[npc.target].position.Y < npc.Bottom.Y) - npc.velocity.Y = (((!flag43 && !flag40) ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; + npc.velocity.Y = (((!flag43 && !flag40) || turboEnrage ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; else npc.velocity.Y = 1f; npc.noTileCollide = true; + npc.netUpdate = true; npc.ai[0] = 1f; npc.ai[1] = 0f; } } - } + + CustomGravity(); + } // Fall down else if (npc.ai[0] == 1f) { if (npc.velocity.Y == 0f) { + npc.TargetClosest(); + // Play sound Main.PlaySound(SoundID.Item14, npc.position); @@ -9769,7 +10093,7 @@ namespace CalamityMod.NPCs } // Fireball explosion when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && !flag40) + if (Main.netMode != NetmodeID.MultiplayerClient && (!flag40 || turboEnrage)) { for (int num621 = 0; num621 < 10; num621++) { @@ -9794,29 +10118,29 @@ namespace CalamityMod.NPCs int spawnX = npc.width / 2; for (int i = 0; i < 5; i++) { - float velocityX = Main.rand.NextBool() ? Main.rand.Next(4, 6) : Main.rand.Next(-5, -3); - float velocityY = Main.rand.Next(-1, 2); + Vector2 spawnVector = new Vector2(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y + npc.height / 2 * 0.8f); + Vector2 velocity = new Vector2(Main.rand.NextBool() ? Main.rand.Next(4, 6) : Main.rand.Next(-5, -3), Main.rand.Next(-1, 2)); + + if (death) + velocity *= 1.5f; if (enrage) - { - velocityX *= 2f; - velocityY *= 2f; - } + velocity *= 1.25f; - int damage = 37; - if (death) - damage += 3; + if (turboEnrage) + velocity *= 1.25f; - int proj = Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-spawnX, spawnX), npc.Center.Y + (npc.height / 2) * 0.8f, - velocityX, velocityY, ProjectileID.Fireball, damage, 0f, Main.myPlayer, 0f, 0f); + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 240; } + + npc.netUpdate = true; } } else { - npc.TargetClosest(true); - // Fall through if (!Main.player[npc.target].dead) { @@ -9833,22 +10157,23 @@ namespace CalamityMod.NPCs if (npc.Bottom.Y < Main.player[npc.target].position.Y) { - float fallSpeedBoost = death ? 0.8f : 0.8f * (1f - lifeRatio); + float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); float fallSpeed = 0.2f + fallSpeedBoost; if (enrage) fallSpeed *= 1.5f; - npc.velocity.Y += fallSpeed; + npc.velocity.Y += fallSpeed; } } else { + float velocityXChange = death ? 0.3f : 0.2f; if (npc.direction < 0) - npc.velocity.X -= 0.2f; + npc.velocity.X -= velocityXChange; else if (npc.direction > 0) - npc.velocity.X += 0.2f; + npc.velocity.X += velocityXChange; - float velocityBoost = death ? 6f : 6f * (1f - lifeRatio); + float velocityBoost = death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); float num648 = 3f + velocityBoost; if (enrage) num648 *= 1.5f; @@ -9858,21 +10183,35 @@ namespace CalamityMod.NPCs if (npc.velocity.X > num648) npc.velocity.X = num648; } - } + + CustomGravity(); + } } - // Target - if (npc.target <= 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) - npc.TargetClosest(true); + void CustomGravity() + { + float gravity = turboEnrage ? 0.9f : enrage ? 0.6f : (!flag41 && !flag42) ? 0.45f : 0.3f; + float maxFallSpeed = turboEnrage ? 30f : enrage ? 20f : (!flag41 && !flag42) ? 15f : 10f; - // Despawn - int num649 = CalamityWorld.bossRushActive ? 4500 : 3000; + if (calamityGlobalNPC.newAI[0] > 1f) + maxFallSpeed *= calamityGlobalNPC.newAI[0]; + + npc.velocity.Y += gravity; + if (npc.velocity.Y > maxFallSpeed) + npc.velocity.Y = maxFallSpeed; + } + + // Despawn + int num649 = turboEnrage ? 7500 : enrage ? 6000 : 4500; if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num649) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > num649) + { npc.active = false; + npc.netUpdate = true; + } } return false; @@ -9880,64 +10219,69 @@ namespace CalamityMod.NPCs public static bool BuffedGolemHeadAI(NPC npc, bool enraged, Mod mod) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Don't collide npc.noTileCollide = true; - // Die if body is gone - if (NPC.golemBoss < 0) + // Get a target + 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(); + + // Die if body is gone + if (NPC.golemBoss < 0) { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.StrikeNPCNoInteraction(9999, 0f, 0); return false; } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Count body parts - bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + + // Count body parts + bool flag41 = NPC.AnyNPCs(NPCID.GolemFistLeft); bool flag42 = NPC.AnyNPCs(NPCID.GolemFistRight); npc.dontTakeDamage = flag41 || flag42; // Stay in position on top of body - float num650 = 28f; - Vector2 vector80 = new Vector2(npc.Center.X, npc.Center.Y); - float num651 = Main.npc[NPC.golemBoss].Center.X - vector80.X; - float num652 = Main.npc[NPC.golemBoss].Center.Y - vector80.Y; - num652 -= 57f; - num651 -= 3f; - float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); - if (num653 < 20f) - { - npc.rotation = 0f; - npc.velocity.X = num651; - npc.velocity.Y = num652; - } - else - { - num653 = num650 / num653; - npc.velocity.X = num651 * num653; - npc.velocity.Y = num652 * num653; - npc.rotation = npc.velocity.X * 0.1f; - } + npc.Center = Main.npc[NPC.golemBoss].Center - new Vector2(3f, 57f); // Enrage if the target isn't inside the temple bool enrage = true; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) - enrage = false; - } - if (CalamityWorld.bossRushActive) + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = malice; + } + else + turboEnrage = malice; + + if (malice) enrage = true; - // Alpha - if (npc.alpha > 0) + if (enraged) + turboEnrage = true; + + // Alpha + if (npc.alpha > 0) { npc.alpha -= 10; if (npc.alpha < 0) @@ -9950,20 +10294,20 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 0f) { npc.ai[1] += 1f; - int num654 = 180; + int num654 = 150; if (npc.ai[1] < 20f || npc.ai[1] > (num654 - 20)) npc.localAI[0] = 1f; else npc.localAI[0] = 0f; - if (npc.ai[1] >= num654) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= num654) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 0f; Vector2 vector81 = new Vector2(npc.Center.X, npc.Center.Y + 10f); - float num655 = enrage ? 16f : 8f; + float num655 = turboEnrage ? 12f : enrage ? 10f : 8f; float num656 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector81.X; float num657 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector81.Y; float num658 = (float)Math.Sqrt(num656 * num656 + num657 * num657); @@ -9972,20 +10316,17 @@ namespace CalamityMod.NPCs num656 *= num658; num657 *= num658; - int damage = 37; - if (death) - damage += 3; + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector81.X, vector81.Y, num656, num657, type, damage, 0f, Main.myPlayer, 0f, 0f); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(vector81.X, vector81.Y, num656, num657, ProjectileID.Fireball, damage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; } } // Shoot lasers and fireballs if arms are dead else if (npc.ai[0] == 1f) { - npc.TargetClosest(true); - // Fire projectiles from eye positions Vector2 vector82 = new Vector2(npc.Center.X, npc.Center.Y + 10f); if (Main.player[npc.target].Center.X < npc.Center.X - npc.width) @@ -10002,7 +10343,7 @@ namespace CalamityMod.NPCs npc.localAI[1] = 0f; // Fireballs - float shootBoost = death ? 2f : 2f * (1f - lifeRatio); + float shootBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); npc.ai[1] += 1f + shootBoost; int num662 = 240; @@ -10011,13 +10352,13 @@ namespace CalamityMod.NPCs else npc.localAI[0] = 0f; - if (npc.ai[1] >= num662) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= num662) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[1] = 0f; - float num663 = enrage ? 18f : 12f; + float num663 = turboEnrage ? 16f : enrage ? 14f : 12f; float num664 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector82.X; float num665 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector82.Y; float num666 = (float)Math.Sqrt(num664 * num664 + num665 * num665); @@ -10026,32 +10367,31 @@ namespace CalamityMod.NPCs num664 *= num666; num665 *= num666; - int damage = 37; - if (death) - damage += 3; + int type = ProjectileID.Fireball; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector82.X, vector82.Y, num664, num665, type, damage, 0f, Main.myPlayer, 0f, 0f); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(vector82.X, vector82.Y, num664, num665, ProjectileID.Fireball, damage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; } // Lasers - float shootBoost2 = death ? 3f : 3f * (1f - lifeRatio); + float shootBoost2 = death ? 5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); npc.ai[2] += 1f + shootBoost2; if (enrage) npc.ai[2] += 4f; if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) npc.ai[2] += 8f; - if (npc.ai[2] >= 150f) + if (npc.ai[2] >= 300f) { + npc.TargetClosest(); + npc.ai[2] = 0f; - int dmg = 35; - if (death) - dmg += 3; int projType = ProjectileID.EyeBeam; + int dmg = npc.GetProjectileDamage(projType); - if (npc.localAI[1] == 0f) + if (npc.localAI[1] == 0f) { for (int num672 = 0; num672 < 2; num672++) { @@ -10079,6 +10419,7 @@ namespace CalamityMod.NPCs { int num677 = Projectile.NewProjectile(vector82.X, vector82.Y, num674, num675, projType, dmg, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num677].timeLeft = enrage ? 480 : 300; + npc.netUpdate = true; } } } @@ -10108,13 +10449,14 @@ namespace CalamityMod.NPCs { int num682 = Projectile.NewProjectile(vector82.X, vector82.Y, num679, num680, projType, dmg, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num682].timeLeft = enrage ? 480 : 300; + npc.netUpdate = true; } } } } // Laser fire if arms are dead - if (!flag41 && !flag42) + if ((!flag41 && !flag42) || death) { npc.ai[0] = 1f; return false; @@ -10128,12 +10470,18 @@ namespace CalamityMod.NPCs { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - npc.damage = 0; + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); - // Die if body is gone - if (NPC.golemBoss < 0) + // 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(); + + // Die if body is gone + if (NPC.golemBoss < 0) { - npc.StrikeNPCNoInteraction(9999, 0f, 0, false, false, false); + npc.StrikeNPCNoInteraction(9999, 0f, 0); return false; } @@ -10143,14 +10491,49 @@ namespace CalamityMod.NPCs float combinedRatio = lifeRatio + golemLifeRatio; // Phases - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || death; - bool phase3 = lifeRatio < 0.4f || golemLifeRatio < 0.7f || death; - bool phase4 = lifeRatio < 0.1f || golemLifeRatio < 0.55f; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f; + bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f; + bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f; + + // Enrage if the target isn't inside the temple + bool enrage = true; + bool turboEnrage = false; + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + { + int num = (int)Main.player[npc.target].Center.X / 16; + int num2 = (int)Main.player[npc.target].Center.Y / 16; + + Tile tile = Framing.GetTileSafely(num, num2); + if (tile.wall == WallID.LihzahrdBrickUnsafe) + enrage = false; + else + turboEnrage = malice; + } + else + turboEnrage = malice; + + if (malice) + enrage = true; + + if (enraged) + turboEnrage = true; + + if (turboEnrage) + { + npc.Calamity().DR = 0.9999f; + npc.Calamity().unbreakableDR = true; + } + else + { + npc.Calamity().DR = 0.25f; + npc.Calamity().unbreakableDR = false; + } // Float through tiles or not bool flag44 = false; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3) + if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3 || turboEnrage) { npc.noTileCollide = true; flag44 = true; @@ -10158,33 +10541,15 @@ namespace CalamityMod.NPCs else npc.noTileCollide = false; - // Enrage if the target isn't inside the temple - bool enrage = true; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) - { - int num = (int)Main.player[npc.target].Center.X / 16; - int num2 = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(num, num2); - if (tile.wall == WallID.LihzahrdBrickUnsafe) - enrage = false; - } - if (CalamityWorld.bossRushActive) - enrage = true; - // Move to new location if (npc.ai[3] <= 0f) { - // Target - npc.TargetClosest(true); - npc.netSpam = 5; - npc.ai[3] = 300f; float maxDistance = 300f; // Four corners around target - if (phase3) + if (phase3 || turboEnrage) { if (calamityGlobalNPC.newAI[1] == -maxDistance) { @@ -10242,21 +10607,23 @@ namespace CalamityMod.NPCs calamityGlobalNPC.newAI[1] = -maxDistance; } + npc.netSpam = 5; + npc.SyncExtraAI(); npc.netUpdate = true; } npc.ai[3] -= 1f + - (phase2 ? 1f : 0f) + - (phase3 ? 1f : 0f) + - (phase4 ? 2f : 0f); + ((phase2 || turboEnrage) ? 1f : 0f) + + ((phase3 || turboEnrage) ? 1f : 0f) + + ((phase4 || turboEnrage) ? 2f : 0f); float offsetX = calamityGlobalNPC.newAI[0]; float offsetY = calamityGlobalNPC.newAI[1]; // Velocity and acceleration float num700 = 7f + - (phase2 ? 4f : 0f) + - (phase3 ? 14f : 0f); + ((phase2 || turboEnrage) ? 4f : 0f) + + ((phase3 || turboEnrage) ? 14f : 0f); Vector2 vector87 = new Vector2(npc.Center.X, npc.Center.Y); float num702 = Main.player[npc.target].Center.X - vector87.X + offsetX; @@ -10264,7 +10631,7 @@ namespace CalamityMod.NPCs float num704 = (float)Math.Sqrt(num702 * num702 + num703 * num703); // Static movement - if (phase3) + if (phase3 || turboEnrage) { if (enrage) num700 = 25f; @@ -10326,13 +10693,17 @@ namespace CalamityMod.NPCs { calamityGlobalNPC.newAI[2] += 1f; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + if (calamityGlobalNPC.newAI[2] % 15f == 0f) + { + npc.netUpdate = true; + npc.SyncExtraAI(); + } return false; } // Fireballs - float shootBoost = death ? 4f : 2f * (2f - (lifeRatio + golemLifeRatio)); + float shootBoost = death ? 3f * (2f - (lifeRatio + golemLifeRatio)) : 2f * (2f - (lifeRatio + golemLifeRatio)); npc.ai[1] += 1f + shootBoost; int num705 = 360; @@ -10344,12 +10715,14 @@ namespace CalamityMod.NPCs if (flag44 && !phase3) npc.ai[1] = 20f; - if (npc.ai[1] >= num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= num705 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { + npc.TargetClosest(); + npc.ai[1] = 0f; Vector2 vector88 = new Vector2(npc.Center.X, npc.Center.Y - 10f); - float num706 = enrage ? 10f : 5f; + float num706 = turboEnrage ? 8f : enrage ? 6.5f : 5f; float num709 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector88.X; float num710 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector88.Y; float num711 = (float)Math.Sqrt(num709 * num709 + num710 * num710); @@ -10359,21 +10732,17 @@ namespace CalamityMod.NPCs num710 *= num711; int projectileType = phase3 ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; - int damage = 40; - if (death) - damage += 4; - - if (Main.netMode != NetmodeID.MultiplayerClient) + int damage = npc.GetProjectileDamage(projectileType); + int proj = Projectile.NewProjectile(vector88.X, vector88.Y, num709, num710, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + if (projectileType == ProjectileID.InfernoHostileBolt) { - int proj = Projectile.NewProjectile(vector88.X, vector88.Y, num709, num710, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - if (projectileType == ProjectileID.InfernoHostileBolt) - { - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; - Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; - Main.projectile[proj].netUpdate = true; - } + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; + Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; + Main.projectile[proj].netUpdate = true; } + + npc.netUpdate = true; } // Lasers @@ -10381,8 +10750,10 @@ namespace CalamityMod.NPCs if (!Collision.CanHit(Main.npc[NPC.golemBoss].Center, 1, 1, Main.player[npc.target].Center, 1, 1)) npc.ai[2] += 8f; - if (npc.ai[2] >= 240f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 300f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f) { + npc.TargetClosest(); + npc.ai[2] = 0f; for (int num713 = 0; num713 < 2; num713++) @@ -10404,33 +10775,39 @@ namespace CalamityMod.NPCs vector89.X += num717 * 3f; vector89.Y += num718 * 3f; - int damage = 35; - if (death) - damage += 3; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num720 = Projectile.NewProjectile(vector89.X, vector89.Y, num717, num718, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num720].timeLeft = enrage ? 480 : 300; - } + int type = ProjectileID.EyeBeam; + int damage = npc.GetProjectileDamage(type); + int num720 = Projectile.NewProjectile(vector89.X, vector89.Y, num717, num718, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[num720].timeLeft = enrage ? 480 : 300; } - } - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + npc.netUpdate = true; + } return false; } #endregion + // Master Mode changes + // 1 - Cycles between attacks faster, 2 - Moves faster, 3 - Bigger tornadoes #region Buffed Duke Fishron AI public static bool BuffedDukeFishronAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Variables - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = npc.life <= npc.lifeMax * 0.66 || death; - bool phase3 = npc.life <= npc.lifeMax * (death ? 0.33 : 0.2); + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Variables + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.7f; + bool phase3 = lifeRatio < 0.4f; + bool phase4 = lifeRatio < 0.2f; bool phase2AI = npc.ai[0] > 4f; bool phase3AI = npc.ai[0] > 9f; bool charging = npc.ai[3] < 10f; @@ -10439,31 +10816,31 @@ namespace CalamityMod.NPCs if (phase3AI) { npc.damage = (int)(npc.defDamage * 1.32f); - npc.defense = (int)(npc.defDefense * 0.75f); - } + npc.defense = 0; + } else if (phase2AI) { npc.damage = (int)(npc.defDamage * 1.44f); - npc.defense = npc.defDefense; - } + npc.defense = (int)(npc.defDefense * 0.8f); + } else { npc.damage = npc.defDamage; - npc.defense = (int)(npc.defDefense * 1.2f); + npc.defense = npc.defDefense; } - int num2 = 30; - float num3 = 0.55f; - float scaleFactor = 8.5f; + int idlePhaseTimer = 30; + float idlePhaseAcceleration = 0.55f; + float idlePhaseVelocity = 8.5f; if (phase3AI) { - num3 = 0.7f; - scaleFactor = 12f; + idlePhaseAcceleration = 0.7f; + idlePhaseVelocity = 12f; } else if (phase2AI & charging) { - num3 = 0.6f; - scaleFactor = 10f; + idlePhaseAcceleration = 0.6f; + idlePhaseVelocity = 10f; } int chargeTime = 28; @@ -10481,51 +10858,53 @@ namespace CalamityMod.NPCs if (death) { - num2 = 28; - num3 *= 1.05f; - scaleFactor *= 1.08f; + idlePhaseTimer = 28; + idlePhaseAcceleration *= 1.05f; + idlePhaseVelocity *= 1.08f; chargeTime -= 1; chargeVelocity *= 1.13f; } - if (CalamityWorld.bossRushActive) - { - num2 = 25; - num3 *= 1.1f; - scaleFactor *= 1.15f; - chargeTime -= 2; - chargeVelocity *= 1.25f; - } - // Variables - int num6 = CalamityWorld.bossRushActive ? 40 : 80; - int num7 = CalamityWorld.bossRushActive ? 2 : 4; - float num8 = CalamityWorld.bossRushActive ? 0.5f : 0.3f; - float scaleFactor2 = CalamityWorld.bossRushActive ? 8f : 5f; - int num9 = 90; - int num10 = 180; - int num11 = 180; - int num12 = 30; - int num13 = CalamityWorld.bossRushActive ? 60 : 120; - int num14 = CalamityWorld.bossRushActive ? 2 : 4; - float scaleFactor3 = CalamityWorld.bossRushActive ? 10f : 7f; - float scaleFactor4 = 20f; - float num15 = MathHelper.TwoPi / (num13 / 2); - int num16 = 75; + int bubbleBelchPhaseTimer = death ? 60 : 80; + int bubbleBelchPhaseDivisor = death ? 3 : 4; + float bubbleBelchPhaseAcceleration = death ? 0.35f : 0.3f; + float bubbleBelchPhaseVelocity = death ? 5.5f : 5f; + + int sharknadoPhaseTimer = 90; + + int phaseTransitionTimer = 180; + + int teleportPhaseTimer = 30; + + int bubbleSpinPhaseTimer = malice ? 45 : death ? 90 : 120; + int bubbleSpinPhaseDivisor = death ? 3 : 4; + float bubbleSpinBubbleVelocity = death ? 8f : 7f; + float bubbleSpinPhaseVelocity = 20f; + float bubbleSpinPhaseRotation = MathHelper.TwoPi / (bubbleSpinPhaseTimer / 2); + + int spawnEffectPhaseTimer = 75; + Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; + Player player = Main.player[npc.target]; // Get target if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; npc.netUpdate = true; } - // Despawn - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); + + // Despawn + if (player.dead || Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles) { - npc.velocity.Y -= 0.4f; + npc.TargetClosest(); + + npc.velocity.Y -= 0.4f; if (npc.timeLeft > 10) npc.timeLeft = 10; @@ -10539,34 +10918,49 @@ namespace CalamityMod.NPCs } // Enrage variable - bool enrage = !CalamityWorld.bossRushActive && + bool enrage = !BossRushEvent.BossRushActive && (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && enrage) || enraged; + // If the player isn't in the ocean biome or Fishron is transitioning between phases, become immune if (!phase3AI) - npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f || enrage; + npc.dontTakeDamage = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; // Enrage - if (enrage) + if (enrage || malice || enraged) { - num2 = 20; - npc.damage = npc.defDamage * 2; - npc.defense = npc.defDefense * 2; - npc.ai[3] = 0f; - chargeVelocity += 8f; + bubbleBelchPhaseTimer = enraged ? 15 : 20; + bubbleBelchPhaseDivisor = 1; + bubbleBelchPhaseAcceleration = enraged ? 0.9f : 0.65f; + bubbleBelchPhaseVelocity = enraged ? 15f : 10f; + idlePhaseTimer = enraged ? 15 : 20; + idlePhaseAcceleration = enraged ? 1.3f : 1f; + idlePhaseVelocity = enraged ? 20f : 15f; + chargeTime = enraged ? 18 : 24; + chargeVelocity += enraged ? 8f : 5f; + bubbleSpinPhaseDivisor = 1; + bubbleSpinBubbleVelocity = enraged ? 20f : 15f; + + if (!malice) + { + npc.damage = npc.defDamage * 2; + npc.defense = npc.defDefense * 3; + } } // Spawn cthulhunadoes in phase 3 - if (phase3AI) + if (phase3AI && !phase4) { calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 600f) + float timeGateValue = 600f; + if (calamityGlobalNPC.newAI[0] >= timeGateValue) { calamityGlobalNPC.newAI[0] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); + Projectile.NewProjectile(vector, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1); npc.netUpdate = true; } @@ -10585,8 +10979,25 @@ namespace CalamityMod.NPCs } } - // Rotation - float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); + // Rotation + float rateOfRotation = 0.04f; + if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) + rateOfRotation = 0f; + if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) + rateOfRotation = 0.01f; + + Vector2 rotationVector = player.Center - vector; + if (!player.dead && malice && phase4) + { + // Rotate to show direction of predictive charge + if (npc.ai[0] == 10f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; + } + } + + float num17 = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) num17 += MathHelper.Pi; if (num17 < 0f) @@ -10596,14 +11007,8 @@ namespace CalamityMod.NPCs if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) num17 = 0f; - float num18 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f) - num18 = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 8f) - num18 = 0.01f; - - if (num18 != 0f) - npc.rotation = npc.rotation.AngleTowards(num17, num18); + if (rateOfRotation != 0f) + npc.rotation = npc.rotation.AngleTowards(num17, rateOfRotation); // Alpha adjustments if (npc.ai[0] != -1f && npc.ai[0] < 9f) @@ -10648,13 +11053,13 @@ namespace CalamityMod.NPCs } // Spawn dust and play sound - if (npc.ai[2] == num9 - 30) + if (npc.ai[2] == sharknadoPhaseTimer - 30) { int num20 = 36; for (int i = 0; i < num20; i++) { - Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20) + npc.Center; - Vector2 vector2 = dust - npc.Center; + Vector2 dust = (Vector2.Normalize(npc.velocity) * new Vector2(npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((i - (num20 / 2 - 1)) * MathHelper.TwoPi / num20) + vector; + Vector2 vector2 = dust - vector; int num21 = Dust.NewDust(dust + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f); Main.dust[num21].noGravity = true; Main.dust[num21].noLight = true; @@ -10665,7 +11070,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num16) + if (npc.ai[2] >= spawnEffectPhaseTimer) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -10681,8 +11086,8 @@ namespace CalamityMod.NPCs 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; - npc.SimpleFlyMovement(vector3, num3); + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(vector3, idlePhaseAcceleration); // Rotation and direction int num22 = Math.Sign(player.Center.X - vector.X); @@ -10701,7 +11106,7 @@ namespace CalamityMod.NPCs // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= num2) + if (npc.ai[2] >= idlePhaseTimer) { int num23 = 0; switch ((int)npc.ai[3]) @@ -10808,7 +11213,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -10819,16 +11225,16 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); - Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor2; - npc.SimpleFlyMovement(vector5, num8); + Vector2 vector5 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * bubbleBelchPhaseVelocity; + npc.SimpleFlyMovement(vector5, bubbleBelchPhaseAcceleration); // Play sounds and spawn bubbles if (npc.ai[2] == 0f) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - if (npc.ai[2] % num7 == 0f) + if (npc.ai[2] % bubbleBelchPhaseDivisor == 0f) { - Main.PlaySound(SoundID.NPCKilled, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); + Main.PlaySound(SoundID.NPCKilled, (int)vector.X, (int)vector.Y, 19, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -10848,12 +11254,13 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num6) + if (npc.ai[2] >= bubbleBelchPhaseTimer) { npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -10865,10 +11272,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound and spawn sharknadoes - if (npc.ai[2] == (num9 - 30)) + if (npc.ai[2] == (sharknadoPhaseTimer - 30)) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 9, 1f, 0f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num9 - 30) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == sharknadoPhaseTimer - 30) { Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + vector; bool normal = Main.rand.NextBool(); @@ -10884,12 +11291,13 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num9) + if (npc.ai[2] >= sharknadoPhaseTimer) { npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -10901,17 +11309,18 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Sound - if (npc.ai[2] == num10 - 60) + if (npc.ai[2] == phaseTransitionTimer - 60) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); npc.ai[2] += 1f; - if (npc.ai[2] >= num10) + if (npc.ai[2] >= phaseTransitionTimer) { npc.ai[0] = 5f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -10922,8 +11331,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((vector - player.Center).X); - Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(vector8, num3); + Vector2 vector8 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(vector8, idlePhaseAcceleration); // Direction and rotation int num27 = Math.Sign(player.Center.X - vector.X); @@ -10942,7 +11351,7 @@ namespace CalamityMod.NPCs // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= num2) + if (npc.ai[2] >= idlePhaseTimer) { int num28 = 0; switch ((int)npc.ai[3]) @@ -10995,7 +11404,7 @@ namespace CalamityMod.NPCs else if (num28 == 2) { // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * scaleFactor4; + npc.velocity = Vector2.Normalize(player.Center - vector) * bubbleSpinPhaseVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction @@ -11060,7 +11469,8 @@ namespace CalamityMod.NPCs npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -11071,20 +11481,20 @@ namespace CalamityMod.NPCs if (npc.ai[2] == 0f) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - if (npc.ai[2] % num14 == 0f) + if (npc.ai[2] % bubbleSpinPhaseDivisor == 0f) { - Main.PlaySound(SoundID.NPCKilled, (int)npc.Center.X, (int)npc.Center.Y, 19, 1f, 0f); + Main.PlaySound(SoundID.NPCKilled, (int)vector.X, (int)vector.Y, 19, 1f, 0f); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector10 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + vector; int num31 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.DetonatingBubble); Main.npc[num31].target = npc.target; - Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * scaleFactor3; + Main.npc[num31].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity; Main.npc[num31].netUpdate = true; Main.npc[num31].ai[3] = Main.rand.Next(80, 121) / 100f; - if (npc.ai[2] % (num14 * 5) == 0f) + if (npc.ai[2] % (bubbleSpinPhaseDivisor * 5) == 0f) { int npc2 = NPC.NewNPC((int)vector10.X, (int)vector10.Y + 45, NPCID.Sharkron2); Main.npc[npc2].ai[1] = 89f; @@ -11093,16 +11503,17 @@ namespace CalamityMod.NPCs } // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)num15 * (float)npc.direction); - npc.rotation -= num15 * npc.direction; + npc.velocity = npc.velocity.RotatedBy(-(double)bubbleSpinPhaseRotation * (float)npc.direction); + npc.rotation -= bubbleSpinPhaseRotation * npc.direction; npc.ai[2] += 1f; - if (npc.ai[2] >= num13) + if (npc.ai[2] >= bubbleSpinPhaseTimer) { npc.ai[0] = 5f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -11114,19 +11525,20 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound and spawn cthulhunado - if (npc.ai[2] == num9 - 30) + if (npc.ai[2] == sharknadoPhaseTimer - 30) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num9 - 30) + 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); npc.ai[2] += 1f; - if (npc.ai[2] >= num9) + if (npc.ai[2] >= sharknadoPhaseTimer) { npc.ai[0] = 5f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -11134,7 +11546,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 9f) { // Alpha adjustments - if (npc.ai[2] < num11 - 90) + if (npc.ai[2] < phaseTransitionTimer - 90) { if (Collision.SolidCollision(npc.position, npc.width, npc.height)) npc.alpha += 15; @@ -11158,17 +11570,18 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == num11 - 60) + if (npc.ai[2] == phaseTransitionTimer - 60) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); npc.ai[2] += 1f; - if (npc.ai[2] >= num11) + if (npc.ai[2] >= phaseTransitionTimer) { npc.ai[0] = 10f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -11190,8 +11603,8 @@ namespace CalamityMod.NPCs if (npc.ai[1] == 0f) npc.ai[1] = 360 * Math.Sign((vector - player.Center).X); - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - npc.SimpleFlyMovement(desiredVelocity, num3); + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * idlePhaseVelocity; + npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); // Rotation and direction int num32 = Math.Sign(player.Center.X - vector.X); @@ -11214,25 +11627,50 @@ namespace CalamityMod.NPCs // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= num2) + if (npc.ai[2] >= idlePhaseTimer) { int num33 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - num33 = 1; - break; - case 1: - case 4: - case 8: - num33 = 2; - break; - } + if (phase4) + { + switch ((int)npc.ai[3]) + { + case 0: + case 1: + case 2: + case 4: + case 5: + case 6: + case 7: + num33 = 1; + break; + case 3: + case 8: + num33 = 2; + break; + } + + if (death) + num33 = 1; + } + else + { + switch ((int)npc.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + num33 = 1; + break; + case 1: + case 4: + case 8: + num33 = 2; + break; + } + } // Set velocity for charge if (num33 == 1) @@ -11242,7 +11680,7 @@ namespace CalamityMod.NPCs npc.ai[2] = 0f; // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - vector) * chargeVelocity; + npc.velocity = Vector2.Normalize(player.Center + (malice && phase4 ? player.velocity * 20f : Vector2.Zero) - vector) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction @@ -11302,8 +11740,12 @@ namespace CalamityMod.NPCs npc.ai[0] = 10f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; + + if (!phase4 || !death) + npc.ai[3] += 1f; + + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -11326,10 +11768,10 @@ namespace CalamityMod.NPCs npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); // Play sound - if (npc.ai[2] == num12 / 2) + if (npc.ai[2] == teleportPhaseTimer / 2) Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, 20, 1f, 0f); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == num12 / 2) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPhaseTimer / 2) { // Teleport location if (npc.ai[1] == 0f) @@ -11358,7 +11800,7 @@ namespace CalamityMod.NPCs } npc.ai[2] += 1f; - if (npc.ai[2] >= num12) + if (npc.ai[2] >= teleportPhaseTimer) { npc.ai[0] = 10f; npc.ai[1] = 0f; @@ -11375,93 +11817,76 @@ namespace CalamityMod.NPCs return false; } #endregion - + + // Master Mode changes + // 1 - Use more dangerous attacks more often, 2 - Cycles between attacks faster #region Buffed Cultist AI public static bool BuffedCultistAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Set contact damage to 0 - npc.damage = npc.defDamage = 0; - // 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); - } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = lifeRatio < 0.8f || death; - bool phase3 = lifeRatio < 0.6f || death; - bool phase4 = lifeRatio < 0.4f || (death && lifeRatio < 0.7f); - bool phase5 = lifeRatio < 0.2f || (death && lifeRatio < 0.4f); + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.85f; + bool phase3 = lifeRatio < 0.7f; + bool phase4 = lifeRatio < 0.55f; + bool phase5 = lifeRatio < 0.4f; + bool phase6 = lifeRatio < 0.25f; // Variables bool isCultist = npc.type == NPCID.CultistBoss; bool dontTakeDamage = false; - int iceMistDamage = 38; - int fireballDamage = isCultist ? 30 : 27; - int lightningDamage = 45; + int iceMistDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossIceMist) : 0; + int fireballDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossFireBall) : npc.GetProjectileDamage(ProjectileID.CultistBossFireBallClone); + int lightningDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossLightningOrb) : 0; - if (death) - { - iceMistDamage += 3; - fireballDamage += 3; - lightningDamage += 4; - } + int iceMistFireRate = phase2 ? 50 : 60; + float iceMistSpeed = (phase6 ? 12f : 10f) + (death ? 2f * (1f - lifeRatio) : 0f); + int iceMistAmt = phase3 ? 2 : 1; + int fireballFireRate = phase5 ? 10 : 12; + float fireballSpeed = (phase6 ? 7.5f : 6f) + (death ? 2f * (1f - lifeRatio) : 0f) - (isCultist ? 0f : 3f); + int lightningOrbPhaseTime = phase2 ? 150 : 180; + int ancientLightSpawnRate = phase4 ? 25 : 30; + int ancientLightAmt = phase4 ? 3 : 2; + int ancientDoomLimit = 10; + int idleTime = phase3 ? 35 : 40; + float timeToFinishRitual = phase5 ? 300f : 360f; - int iceMistFireRate = 60 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - - (phase4 ? 5 : 0) - - (phase5 ? 5 : 0); - - float iceMistSpeed = death ? 6.5f : 6f; - - int fireballFireRate = 12; - - float fireballSpeed = (death ? 7f : 6.5f) - (isCultist ? 0f : 3f); - - int lightningOrbFireRate = 40 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - - (phase4 ? 5 : 0) - - (phase5 ? 5 : 0); - - int ancientLightSpawnRate = 30 - - (phase3 ? 10 : 0) - - (phase5 ? 10 : 0); - - int idleTime = 40 - - (phase2 ? 5 : 0) - - (phase3 ? 5 : 0) - - (phase4 ? 5 : 0) - - (phase5 ? 5 : 0); - - float timeToFinishRitual = 420f - - (phase2 ? 90f : 0f) - - (phase3 ? 60f : 0f) - - (phase4 ? 30f : 0f) - - (phase5 ? 15f : 0f); - - if (CalamityWorld.bossRushActive) + if (malice || enraged) { - iceMistFireRate = 30; - iceMistSpeed = 9f; - fireballSpeed *= 1.5f; - lightningOrbFireRate = 20; - ancientLightSpawnRate = 10; - idleTime = 20; + iceMistFireRate = enraged ? 30 : 40; + iceMistSpeed = enraged ? 20f : 14f; + iceMistAmt = enraged ? 4 : 3; + fireballFireRate = enraged ? 6 : 8; + fireballSpeed *= 1.2f; + lightningOrbPhaseTime = enraged ? 60 : 90; + ancientLightSpawnRate = enraged ? 15 : 20; + ancientLightAmt = enraged ? 5 : 4; + idleTime = enraged ? 15 : 30; } - // Center and target - Vector2 center = npc.Center; - Player player = Main.player[npc.target]; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(false); + + // Center and target + Vector2 center = npc.Center; + Player player = Main.player[npc.target]; if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) { npc.TargetClosest(false); @@ -11469,19 +11894,23 @@ namespace CalamityMod.NPCs npc.netUpdate = true; } - // Enrage - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(false); + + // Enrage + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 180f) + if (calamityGlobalNPC.newAI[0] >= 120f) { - calamityGlobalNPC.newAI[0] = 180f; - iceMistSpeed = 8f; - iceMistFireRate = 30; - lightningOrbFireRate = 15; + calamityGlobalNPC.newAI[0] = 120f; + iceMistSpeed = 16f; + iceMistFireRate = 15; + lightningOrbPhaseTime = 30; ancientLightSpawnRate = 5; - idleTime = 15; - timeToFinishRitual = 180f; + idleTime = 10; + timeToFinishRitual = 120f; } } else @@ -11500,6 +11929,7 @@ namespace CalamityMod.NPCs npc.active = false; return false; } + npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; dontTakeDamage = true; @@ -11518,15 +11948,15 @@ namespace CalamityMod.NPCs } // Despawn - if (player.dead || Vector2.Distance(player.Center, center) > 5600f) + if (player.dead || Vector2.Distance(player.Center, center) > CalamityGlobalNPC.CatchUpDistance350Tiles) { npc.life = 0; npc.HitEffect(0, 10.0); npc.active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) - { NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } + new List().Add(npc.whoAmI); for (int j = 0; j < Main.maxNPCs; j++) { @@ -11535,10 +11965,9 @@ namespace CalamityMod.NPCs Main.npc[j].life = 0; Main.npc[j].HitEffect(0, 10.0); Main.npc[j].active = false; + if (Main.netMode != NetmodeID.MultiplayerClient) - { NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } } } } @@ -11553,6 +11982,7 @@ namespace CalamityMod.NPCs npc.localAI[0] = 1f; npc.alpha = 255; npc.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) { npc.ai[0] = -1f; @@ -11565,9 +11995,8 @@ namespace CalamityMod.NPCs { npc.alpha -= 5; if (npc.alpha < 0) - { npc.alpha = 0; - } + npc.ai[1] += 1f; if (npc.ai[1] >= 420f) { @@ -11578,10 +12007,10 @@ namespace CalamityMod.NPCs else if (npc.ai[1] > 360f) { npc.velocity *= 0.95f; + if (npc.localAI[2] != 13f) - { Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 105, 1f, 0f); - } + npc.localAI[2] = 13f; } else if (npc.ai[1] > 300f) @@ -11590,13 +12019,10 @@ namespace CalamityMod.NPCs npc.localAI[2] = 10f; } else if (npc.ai[1] > 120f) - { npc.localAI[2] = 1f; - } else - { npc.localAI[2] = 0f; - } + dontTakeDamage = true; } @@ -11604,210 +12030,168 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 0f) { if (npc.ai[1] == 0f) - { npc.TargetClosest(false); - } + npc.localAI[2] = 10f; + int num14 = Math.Sign(player.Center.X - center.X); if (num14 != 0) - { npc.direction = npc.spriteDirection = num14; - } + npc.ai[1] += 1f; if (npc.ai[1] >= idleTime & isCultist) { - int num15 = 0; - if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num15 = 0; - break; - case 1: - num15 = 1; - break; - case 2: - num15 = 0; - break; - case 3: - num15 = 5; - break; - case 4: - num15 = 0; - break; - case 5: - num15 = 3; - break; - case 6: - num15 = 0; - break; - case 7: - num15 = 5; - break; - case 8: - num15 = 0; - break; - case 9: - num15 = 2; - break; - case 10: - num15 = 0; - break; - case 11: - num15 = 3; - break; - case 12: - num15 = 0; - break; - case 13: - num15 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num15 = 0; - break; - case 1: - num15 = 1; - break; - case 2: - num15 = 0; - break; - case 3: - num15 = 2; - break; - case 4: - num15 = 0; - break; - case 5: - num15 = 3; - break; - case 6: - num15 = 0; - break; - case 7: - num15 = 1; - break; - case 8: - num15 = 0; - break; - case 9: - num15 = 2; - break; - case 10: - num15 = 0; - break; - case 11: - num15 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } + // Phase switch + int phase = 0; + switch ((int)npc.ai[3]) + { + // Move to target + case 0: + case 2: + case 4: + case 6: + case 8: + case 10: + case 12: + case 14: + case 16: + case 18: + case 20: + phase = 0; + break; - int maxValue = 6 - - (phase3 ? 2 : 0) - - (phase4 ? 1 : 0); + // Fireball + case 1: + case 15: + phase = 1; + break; - // Spawn Ancient Dooms - if (phase2 && Main.rand.NextBool(maxValue) && num15 != 0 && num15 != 4 && num15 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) - { - num15 = 6; - } + // Ancient Light + case 3: + case 11: + phase = 5; + break; - // Move above target, also moves clones - if (num15 == 0) - { - // Set a location to move to - float num16 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); - if (num16 == 0f) - { - num16 = 1f; - } + // Lightning Orb + case 5: + case 13: + phase = 3; + break; - // Add self and clones to list - List list2 = new List(); - int num17 = 0; - list2.Add(npc.whoAmI); - for (int k = 0; k < Main.maxNPCs; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) - { - list2.Add(k); - } - } + // Ice Mist + case 7: + case 17: + phase = 2; + break; - // Move self and clones to location - bool flag5 = list2.Count % 2 == 0; - foreach (int current2 in list2) - { - NPC nPC2 = Main.npc[current2]; - Vector2 center2 = nPC2.Center; - float num18 = (num17 + flag5.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; - if (num17 % 2 == 1) - { - num18 *= -1f; - } - if (list2.Count == 1) - { - num18 = 0f; - } - Vector2 value = new Vector2(0f, -1f).RotatedBy(num18) * new Vector2(150f, 200f); - Vector2 value2 = player.Center + value - center2; - nPC2.ai[0] = 1f; - nPC2.ai[1] = num16; - nPC2.velocity = value2 / num16 * 2f; - if (npc.whoAmI >= nPC2.whoAmI) - { - nPC2.position -= nPC2.velocity; - } - nPC2.netUpdate = true; - num17++; - } - } + // Ancient Doom + case 9: + case 19: + // Pick a different random phase if too many Ancient Dooms are active + int[] attackPhases = new int[4] { 1, 2, 3, 5 }; + phase = NPC.CountNPCS(NPCID.AncientDoom) < ancientDoomLimit ? 6 : attackPhases[Main.rand.Next(attackPhases.Length)]; + break; + + // Dragon Summon + case 21: + phase = 4; + npc.ai[3] = -1f; + break; + + default: + npc.ai[3] = -1f; + break; + } // Set AI phase - if (num15 == 1) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - } - else if (num15 == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - } - else if (num15 == 3) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - else if (num15 == 4) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - } - if (num15 == 5) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - } - if (num15 == 6) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - } + switch (phase) + { + // Movement + case 0: + // Set a location to move to + float num16 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); + if (num16 == 0f) + num16 = 1f; + + // Add self and clones to list + List list2 = new List(); + int num17 = 0; + list2.Add(npc.whoAmI); + for (int k = 0; k < Main.maxNPCs; k++) + { + if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == npc.whoAmI) + list2.Add(k); + } + + // Move self and clones to location + bool flag5 = list2.Count % 2 == 0; + foreach (int current2 in list2) + { + NPC nPC2 = Main.npc[current2]; + Vector2 center2 = nPC2.Center; + float num18 = (num17 + flag5.ToInt() + 1) / 2 * MathHelper.TwoPi * 0.4f / list2.Count; + if (num17 % 2 == 1) + { + num18 *= -1f; + } + if (list2.Count == 1) + { + num18 = 0f; + } + Vector2 value = new Vector2(0f, -1f).RotatedBy(num18) * new Vector2(150f, 200f); + Vector2 value2 = player.Center + value - center2; + nPC2.ai[0] = 1f; + nPC2.ai[1] = num16; + nPC2.velocity = value2 / num16 * 2f; + if (npc.whoAmI >= nPC2.whoAmI) + { + nPC2.position -= nPC2.velocity; + } + nPC2.netUpdate = true; + num17++; + } + break; + + // Fireball + case 1: + npc.ai[0] = 3f; + npc.ai[1] = 0f; + break; + + // Ice Mist + case 2: + npc.ai[0] = 2f; + npc.ai[1] = 0f; + break; + + // Lightning Orb + case 3: + npc.ai[0] = 4f; + npc.ai[1] = 0f; + break; + + // Dragon Summon + case 4: + npc.ai[0] = 5f; + npc.ai[1] = 0f; + break; + + // Ancient Light + case 5: + npc.ai[0] = 7f; + npc.ai[1] = 0f; + break; + + // Ancient Doom + case 6: + npc.ai[0] = 8f; + npc.ai[1] = 0f; + break; + + default: + break; + } + npc.netUpdate = true; } } @@ -11816,11 +12200,12 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 1f) { dontTakeDamage = true; + npc.localAI[2] = 10f; + if (npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) - { npc.position -= npc.velocity; - } + npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) { @@ -11836,11 +12221,11 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 2f) { npc.localAI[2] = 11f; + Vector2 vec = Vector2.Normalize(player.Center - center); if (vec.HasNaNs()) - { vec = new Vector2(npc.direction, 0f); - } + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % iceMistFireRate == 0) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -11849,44 +12234,43 @@ namespace CalamityMod.NPCs for (int l = 0; l < Main.maxNPCs; l++) { if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == npc.whoAmI) - { list3.Add(l); - } } + foreach (int current3 in list3) { NPC nPC3 = Main.npc[current3]; Vector2 center3 = nPC3.Center; + int num19 = Math.Sign(player.Center.X - center3.X); if (num19 != 0) - { nPC3.direction = nPC3.spriteDirection = num19; - } + vec = Vector2.Normalize(player.Center - center3 + player.velocity * 20f); if (vec.HasNaNs()) - { vec = new Vector2(npc.direction, 0f); - } + Vector2 vector = center3 + new Vector2(npc.direction * 30, 12f); Vector2 vector2 = vec * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); vector2 = vector2.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector.X, vector.Y, vector2.X, vector2.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector, vector2, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } } + if (Main.netMode != NetmodeID.MultiplayerClient) { vec = Vector2.Normalize(player.Center - center + player.velocity * 20f); if (vec.HasNaNs()) - { vec = new Vector2(npc.direction, 0f); - } + Vector2 vector3 = npc.Center + new Vector2(npc.direction * 30, 12f); Vector2 vector4 = vec * iceMistSpeed; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(vector3, vector4, ProjectileID.CultistBossIceMist, iceMistDamage, 0f, Main.myPlayer, 0f, 1f); } } + npc.ai[1] += 1f; - if (npc.ai[1] >= (4 + iceMistFireRate * 2)) + if (npc.ai[1] >= (4 + iceMistFireRate * iceMistAmt)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -11900,11 +12284,11 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 3f) { npc.localAI[2] = 11f; + Vector2 vec2 = Vector2.Normalize(player.Center - center); if (vec2.HasNaNs()) - { vec2 = new Vector2(npc.direction, 0f); - } + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % fireballFireRate == 0) { if ((int)(npc.ai[1] - 4f) / fireballFireRate == 2) @@ -11913,51 +12297,49 @@ namespace CalamityMod.NPCs for (int num20 = 0; num20 < Main.maxNPCs; num20++) { if (Main.npc[num20].active && Main.npc[num20].type == NPCID.CultistBossClone && Main.npc[num20].ai[3] == npc.whoAmI) - { list4.Add(num20); - } } + if (Main.netMode != NetmodeID.MultiplayerClient) { foreach (int current4 in list4) { NPC nPC4 = Main.npc[current4]; Vector2 center4 = nPC4.Center; + int num21 = Math.Sign(player.Center.X - center4.X); if (num21 != 0) - { nPC4.direction = nPC4.spriteDirection = num21; - } + vec2 = Vector2.Normalize(player.Center - center4 + player.velocity * 20f); if (vec2.HasNaNs()) - { vec2 = new Vector2(npc.direction, 0f); - } + Vector2 vector5 = center4 + new Vector2(npc.direction * 30, 12f); Vector2 vector6 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); vector6 = vector6.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector5.X, vector5.Y, vector6.X, vector6.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector5, vector6, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } } } + int num23 = Math.Sign(player.Center.X - center.X); if (num23 != 0) - { npc.direction = npc.spriteDirection = num23; - } + if (Main.netMode != NetmodeID.MultiplayerClient) { vec2 = Vector2.Normalize(player.Center - center + player.velocity * 20f); if (vec2.HasNaNs()) - { vec2 = new Vector2(npc.direction, 0f); - } + Vector2 vector7 = npc.Center + new Vector2(npc.direction * 30, 12f); Vector2 vector8 = vec2 * (fireballSpeed + (float)Main.rand.NextDouble() * 4f); vector8 = vector8.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector7.X, vector7.Y, vector8.X, vector8.Y, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector7, vector8, ProjectileID.CultistBossFireBall, fireballDamage, 0f, Main.myPlayer); } } + npc.ai[1] += 1f; if (npc.ai[1] >= (4 + fireballFireRate * 4)) { @@ -11973,46 +12355,43 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 4f) { if (isCultist) - { npc.localAI[2] = 12f; - } else - { npc.localAI[2] = 11f; - } + if ((npc.ai[1] == 20f & isCultist) && Main.netMode != NetmodeID.MultiplayerClient) { List list5 = new List(); for (int num25 = 0; num25 < Main.maxNPCs; num25++) { if (Main.npc[num25].active && Main.npc[num25].type == NPCID.CultistBossClone && Main.npc[num25].ai[3] == npc.whoAmI) - { list5.Add(num25); - } } + foreach (int current5 in list5) { NPC nPC5 = Main.npc[current5]; Vector2 center5 = nPC5.Center; + int num26 = Math.Sign(player.Center.X - center5.X); if (num26 != 0) - { nPC5.direction = nPC5.spriteDirection = num26; - } + Vector2 vec3 = Vector2.Normalize(player.Center - center5 + player.velocity * 20f); if (vec3.HasNaNs()) - { vec3 = new Vector2(npc.direction, 0f); - } + Vector2 vector9 = center5 + new Vector2(npc.direction * 30, 12f); Vector2 vector10 = vec3 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); vector10 = vector10.RotatedByRandom(0.52359879016876221); - Projectile.NewProjectile(vector9.X, vector9.Y, vector10.X, vector10.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector9.X, vector9.Y, vector10.X, vector10.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); } - Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer, 0f, 0f); + + Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 100f, 0f, 0f, ProjectileID.CultistBossLightningOrb, lightningDamage, 0f, Main.myPlayer); } + npc.ai[1] += 1f; - if (npc.ai[1] >= (20 + lightningOrbFireRate)) + if (npc.ai[1] >= (20 + lightningOrbPhaseTime)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -12026,10 +12405,10 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 5f) { npc.localAI[2] = 10f; + if (Vector2.Normalize(player.Center - center).HasNaNs()) - { new Vector2(npc.direction, 0f); - } + if (npc.ai[1] >= 0f && npc.ai[1] < 30f) { dontTakeDamage = true; @@ -12041,42 +12420,37 @@ namespace CalamityMod.NPCs if ((npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient) & isCultist) { npc.localAI[1] += 1f; + Vector2 spinningpoint = new Vector2(180f, 0f); + List list6 = new List(); for (int num29 = 0; num29 < Main.maxNPCs; num29++) { if (Main.npc[num29].active && Main.npc[num29].type == NPCID.CultistBossClone && Main.npc[num29].ai[3] == npc.whoAmI) - { list6.Add(num29); - } } + int num30 = 6 - list6.Count; if (num30 > 2) - { num30 = 2; - } + int num31 = list6.Count + num30 + 1; float[] array = new float[num31]; for (int num32 = 0; num32 < array.Length; num32++) - { array[num32] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy(num32 * MathHelper.TwoPi / num31 - MathHelper.PiOver2), player.Center); - } + int num33 = 0; for (int num34 = 1; num34 < array.Length; num34++) { if (array[num33] > array[num34]) - { num33 = num34; - } } + if (num33 < num31 / 2) - { num33 += num31 / 2; - } else - { num33 -= num31 / 2; - } + int num35 = num30; for (int num36 = 0; num36 < array.Length; num36++) { @@ -12085,7 +12459,7 @@ namespace CalamityMod.NPCs Vector2 vector11 = npc.Center + spinningpoint.RotatedBy(num36 * MathHelper.TwoPi / num31 - MathHelper.PiOver2); if (num35-- > 0) { - int num37 = NPC.NewNPC((int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + int num37 = NPC.NewNPC((int)vector11.X, (int)vector11.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); Main.npc[num37].ai[3] = npc.whoAmI; Main.npc[num37].netUpdate = true; Main.npc[num37].localAI[1] = npc.localAI[1]; @@ -12098,66 +12472,55 @@ namespace CalamityMod.NPCs } } } - npc.ai[2] = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); + + npc.ai[2] = Projectile.NewProjectile(npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); npc.Center += spinningpoint.RotatedBy(num33 * MathHelper.TwoPi / num31 - MathHelper.PiOver2); npc.netUpdate = true; list6.Clear(); } + dontTakeDamage = true; npc.alpha = 255; + if (isCultist) { Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; vector12 -= npc.Center; if (vector12 == Vector2.Zero) - { vector12 = -Vector2.UnitY; - } + vector12.Normalize(); + if (Math.Abs(vector12.Y) < 0.77f) - { npc.localAI[2] = 11f; - } else if (vector12.Y < 0f) - { npc.localAI[2] = 12f; - } else - { npc.localAI[2] = 10f; - } + int num39 = Math.Sign(vector12.X); if (num39 != 0) - { npc.direction = npc.spriteDirection = num39; - } } else { Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; vector13 -= npc.Center; if (vector13 == Vector2.Zero) - { vector13 = -Vector2.UnitY; - } + vector13.Normalize(); + if (Math.Abs(vector13.Y) < 0.77f) - { npc.localAI[2] = 11f; - } else if (vector13.Y < 0f) - { npc.localAI[2] = 12f; - } else - { npc.localAI[2] = 10f; - } + int num40 = Math.Sign(vector13.X); if (num40 != 0) - { npc.direction = npc.spriteDirection = num40; - } } } else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) @@ -12169,61 +12532,49 @@ namespace CalamityMod.NPCs else if (npc.ai[1] >= 120f && npc.ai[1] < timeToFinishRitual) { npc.alpha = 0; + if (isCultist) { Vector2 vector14 = Main.projectile[(int)npc.ai[2]].Center; vector14 -= npc.Center; if (vector14 == Vector2.Zero) - { vector14 = -Vector2.UnitY; - } + vector14.Normalize(); + if (Math.Abs(vector14.Y) < 0.77f) - { npc.localAI[2] = 11f; - } else if (vector14.Y < 0f) - { npc.localAI[2] = 12f; - } else - { npc.localAI[2] = 10f; - } + int num42 = Math.Sign(vector14.X); if (num42 != 0) - { npc.direction = npc.spriteDirection = num42; - } } else { Vector2 vector15 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; vector15 -= npc.Center; if (vector15 == Vector2.Zero) - { vector15 = -Vector2.UnitY; - } + vector15.Normalize(); + if (Math.Abs(vector15.Y) < 0.77f) - { npc.localAI[2] = 11f; - } else if (vector15.Y < 0f) - { npc.localAI[2] = 12f; - } else - { npc.localAI[2] = 10f; - } + int num43 = Math.Sign(vector15.X); if (num43 != 0) - { npc.direction = npc.spriteDirection = num43; - } } } + npc.ai[1] += 1f; if (npc.ai[1] >= timeToFinishRitual) { @@ -12239,6 +12590,7 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 6f) { npc.localAI[2] = 13f; + npc.ai[1] += 1f; if (npc.ai[1] >= (idleTime * 3)) { @@ -12254,11 +12606,11 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 7f) { npc.localAI[2] = 11f; + Vector2 vec4 = Vector2.Normalize(player.Center - center); if (vec4.HasNaNs()) - { vec4 = new Vector2(npc.direction, 0f); - } + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % ancientLightSpawnRate == 0) { if ((int)(npc.ai[1] - 4f) / ancientLightSpawnRate == 2) @@ -12267,54 +12619,32 @@ namespace CalamityMod.NPCs for (int num44 = 0; num44 < Main.maxNPCs; num44++) { if (Main.npc[num44].active && Main.npc[num44].type == NPCID.CultistBossClone && Main.npc[num44].ai[3] == npc.whoAmI) - { list7.Add(num44); - } } + foreach (int current6 in list7) { NPC nPC6 = Main.npc[current6]; Vector2 center6 = nPC6.Center; + int num45 = Math.Sign(player.Center.X - center6.X); if (num45 != 0) - { nPC6.direction = nPC6.spriteDirection = num45; - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec4 = Vector2.Normalize(player.Center - center6 + player.velocity * 20f); - if (vec4.HasNaNs()) - { - vec4 = new Vector2(npc.direction, 0f); - } - Vector2 vector16 = center6 + new Vector2(npc.direction * 30, 12f); - int num46 = 0; - while (num46 < 5f) - { - Vector2 vector17 = vec4 * (fireballSpeed + (float)Main.rand.NextDouble() * 2f); - vector17 = vector17.RotatedByRandom(1.2566370964050293); - Projectile.NewProjectile(vector16.X, vector16.Y, vector17.X, vector17.Y, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer, 0f, 0f); - num46++; - } - } } } + int num47 = Math.Sign(player.Center.X - center.X); if (num47 != 0) - { npc.direction = npc.spriteDirection = num47; - } + if (Main.netMode != NetmodeID.MultiplayerClient) { vec4 = Vector2.Normalize(player.Center - center + player.velocity * 20f); if (vec4.HasNaNs()) - { vec4 = new Vector2(npc.direction, 0f); - } + Vector2 vector18 = npc.Center + new Vector2(npc.direction * 30, 12f); float scaleFactor = 10f; - if (CalamityWorld.bossRushActive) - scaleFactor *= 1.5f; float num48 = 0.251327425f; int num49 = 0; @@ -12329,8 +12659,9 @@ namespace CalamityMod.NPCs } } } + npc.ai[1] += 1f; - if (npc.ai[1] >= (4 + ancientLightSpawnRate * 2)) + if (npc.ai[1] >= (4 + ancientLightSpawnRate * ancientLightAmt)) { npc.ai[0] = 0f; npc.ai[1] = 0f; @@ -12344,65 +12675,74 @@ namespace CalamityMod.NPCs else if (npc.ai[0] == 8f) { npc.localAI[2] = 13f; - if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20 == 0) + + if ((npc.ai[1] >= 4f & isCultist) && (int)(npc.ai[1] - 4f) % 20f == 0f) { List list8 = new List(); for (int num51 = 0; num51 < Main.maxNPCs; num51++) { if (Main.npc[num51].active && Main.npc[num51].type == NPCID.CultistBossClone && Main.npc[num51].ai[3] == npc.whoAmI) - { list8.Add(num51); - } } + int num52 = list8.Count + 1; if (num52 > 3) - { num52 = 3; - } + int num53 = Math.Sign(player.Center.X - center.X); if (num53 != 0) - { npc.direction = npc.spriteDirection = num53; - } + if (Main.netMode != NetmodeID.MultiplayerClient) { - for (int num54 = 0; num54 < num52; num54++) - { - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector20 = Main.player[npc.target].Center - npc.Center; - int num55 = 20; - int num56 = 3; - int num57 = 7; - int num58 = 2; - int num59 = 0; - bool flag6 = false; - if (vector20.Length() > 2800f) - { - flag6 = true; - } - while (!flag6 && num59 < 100) - { - num59++; - int num60 = Main.rand.Next(point2.X - num55, point2.X + num55 + 1); - int num61 = Main.rand.Next(point2.Y - num55, point2.Y + num55 + 1); - if ((num61 < point2.Y - num57 || num61 > point2.Y + num57 || num60 < point2.X - num57 || num60 > point2.X + num57) && (num61 < point.Y - num56 || num61 > point.Y + num56 || num60 < point.X - num56 || num60 > point.X + num56) && !Main.tile[num60, num61].nactive()) - { - bool flag7 = true; - if (flag7 && Collision.SolidTiles(num60 - num58, num60 + num58, num61 - num58, num61 + num58)) - { - flag7 = false; - } - if (flag7) - { - NPC.NewNPC(num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI, 0f, 0f, 0f, 255); - break; - } - } - } - } + if (phase4) + { + // Spawn circle of Ancient Dooms around target + for (int i = 0; i < ancientDoomLimit; i++) + { + float ai2 = i * 120; + NPC.NewNPC((int)(player.Center.X + (float)(Math.Sin(i * 120) * 550)), (int)(player.Center.Y + (float)(Math.Cos(i * 120) * 550)), + NPCID.AncientDoom, 0, npc.whoAmI, 0f, ai2, 0f, Main.maxPlayers); + } + } + else + { + // Spawn Ancient Dooms randomly around the target + for (int num54 = 0; num54 < num52; num54++) + { + Point point = npc.Center.ToTileCoordinates(); + Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); + Vector2 vector20 = Main.player[npc.target].Center - npc.Center; + + int num55 = 20; + int num56 = 3; + int num57 = 7; + int num58 = 2; + int num59 = 0; + bool flag6 = vector20.Length() > 2800f; + while (!flag6 && num59 < 100) + { + num59++; + int num60 = Main.rand.Next(point2.X - num55, point2.X + num55 + 1); + int num61 = Main.rand.Next(point2.Y - num55, point2.Y + num55 + 1); + if ((num61 < point2.Y - num57 || num61 > point2.Y + num57 || num60 < point2.X - num57 || num60 > point2.X + num57) && (num61 < point.Y - num56 || num61 > point.Y + num56 || num60 < point.X - num56 || num60 > point.X + num56) && !Main.tile[num60, num61].nactive()) + { + bool flag7 = true; + if (flag7 && Collision.SolidTiles(num60 - num58, num60 + num58, num61 - num58, num61 + num58)) + flag7 = false; + + if (flag7) + { + NPC.NewNPC(num60 * 16 + 8, num61 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); + break; + } + } + } + } + } } } + npc.ai[1] += 1f; if (npc.ai[1] >= 64f) { @@ -12416,9 +12756,7 @@ namespace CalamityMod.NPCs // Set Clones to Cultist phase if (!isCultist) - { npc.ai[3] = clonePhase; - } // Take damage or not npc.dontTakeDamage = dontTakeDamage; @@ -12429,31 +12767,36 @@ namespace CalamityMod.NPCs public static bool BuffedAncientLightAI(NPC npc, Mod mod) { - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - - if (npc.velocity.Y == 0f && npc.ai[0] >= 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return false; - } + npc.dontTakeDamage = true; + // Slow and kill code if (npc.ai[0] == -1f) { - npc.velocity = Vector2.Zero; - npc.position = npc.oldPosition; - npc.ai[1] += 1f; - if (npc.ai[1] >= 5f) + // Slow down over time + if (npc.velocity.Length() >= 0.2f) { - npc.HitEffect(0, 9999.0); - npc.active = false; + npc.velocity *= 0.96f; } + else + { + npc.velocity = Vector2.Zero; + npc.position = npc.oldPosition; + + // Kill after 2 seconds + npc.ai[1] += 1f; + if (npc.ai[1] >= 240f) + { + npc.HitEffect(0, 9999.0); + npc.active = false; + } + } + return false; } npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; + // Set velocity and emit dust when spawned if (npc.localAI[0] == 0f) { npc.localAI[0] = 1f; @@ -12470,6 +12813,7 @@ namespace CalamityMod.NPCs } } + // Spawn dust for (int num1494 = 0; num1494 < 2; num1494++) { if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) @@ -12486,29 +12830,40 @@ namespace CalamityMod.NPCs Main.dust[num1495].noLight = true; } else - { Main.dust[num1495].velocity = npc.DirectionFrom(Main.dust[num1495].position) * Main.dust[num1495].velocity.Length(); - } } } - npc.dontTakeDamage = npc.ai[0] >= 0f && npc.ai[0] <= 180f; - if (npc.ai[0] >= 0f) { + // Triple damage if the Adult Eidolon Wyrm is alive + if (npc.ai[0] == 0f) + { + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + npc.damage *= 3; + } + } + npc.ai[0] += 1f; - if (npc.ai[0] > 60f) + + float duration = 120f; + + // Increase velocity for 1 second + if (npc.ai[0] < duration - 60f) { + if (npc.velocity.Length() < 20f) + npc.velocity *= 1.02f; + } + + // Intersect velocity paths with other Ancient Lights for 1 second + if (npc.ai[0] >= duration - 60f) npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); - } - if (npc.ai[0] > 120f) - { - npc.velocity *= 0.98f; - } - if (npc.velocity.Length() < 0.2f) - { - npc.velocity = Vector2.Zero; - } + + // Engage slow code + if (npc.ai[0] >= duration) + npc.ai[0] = -1f; } return false; @@ -12516,41 +12871,73 @@ namespace CalamityMod.NPCs public static bool BuffedAncientDoomAI(NPC npc, Mod mod) { - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; npc.damage = npc.defDamage = 0; - float num1496 = 420f; - float num1497 = 120f; - int num1498 = 1; - float value57 = 0f; - float value58 = 1f; - float num1499 = 5f; - if (CalamityWorld.bossRushActive) - num1499 *= 1.5f; + float duration = 420f; + float spawnAnimTime = 120f; + int rateOfChange = 1; + float splitProjVelocity = 5f; - bool flag110 = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; - if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) + // Percent life remaining for Cultist or Eidolon Wyrm + float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > Main.npc[(int)npc.ai[0]].Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = Main.npc[(int)npc.ai[0]].Calamity().killTimeRatio_IncreasedAggression; + + bool phase2 = lifeRatio < 0.7f; + bool phase3 = lifeRatio < (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType() ? 0.6f : 0.55f); + bool phase4 = lifeRatio < 0.4f; + + bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; + int target = Main.maxPlayers; + if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss || Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) { - if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 2 || death) - { - num1498 = 2; - } - if (Main.npc[(int)npc.ai[0]].life < Main.npc[(int)npc.ai[0]].lifeMax / 4 || death) - { - num1498 = 3; - } + if (target == Main.maxPlayers) + target = Main.npc[(int)npc.ai[0]].target; + + if (phase2 || death) + rateOfChange = 2; + + if (phase4 || death) + rateOfChange = 3; + + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + npc.dontTakeDamage = true; } else - { - flag110 = true; - } - npc.ai[1] += num1498; - float num1500 = npc.ai[1] / num1497; - num1500 = MathHelper.Clamp(num1500, 0f, 1f); + kill = true; + + npc.ai[1] += rateOfChange; + float growthRate = npc.ai[1] / spawnAnimTime; + growthRate = MathHelper.Clamp(growthRate, 0f, 1f); npc.position = npc.Center; - npc.scale = MathHelper.Lerp(value57, value58, num1500); + npc.scale = MathHelper.Lerp(0f, 1f, growthRate); npc.Center = npc.position; - npc.alpha = (int)(255f - num1500 * 255f); - if (Main.rand.NextBool(6)) + npc.alpha = (int)(255f - growthRate * 255f); + + if (phase3) + { + if (npc.ai[3] == 0f) + npc.ai[3] = npc.ai[2]; + + double deg = npc.ai[3]; + double rad = deg * (Math.PI / 180); + double dist = 550; + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + { + float aiGateValue = Main.npc[(int)npc.ai[0]].Calamity().newAI[2] - 30f; + int ancientDoomScale = (int)(aiGateValue / 120f); + dist += ancientDoomScale * 45; + } + npc.position.X = Main.player[target].Center.X - (int)(Math.Cos(rad) * dist) - npc.width / 2; + npc.position.Y = Main.player[target].Center.Y - (int)(Math.Sin(rad) * dist) - npc.height / 2; + float spinVelocity = 8f * (1f - (npc.ai[1] / duration)); + npc.ai[3] += spinVelocity; + } + + if (Main.rand.NextBool(6)) { Vector2 spinningpoint4 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); Dust dust17 = Main.dust[Dust.NewDust(npc.Center - spinningpoint4 * 20f, 0, 0, 27, 0f, 0f, 0, default, 1f)]; @@ -12580,25 +12967,32 @@ namespace CalamityMod.NPCs dust19.fadeIn = 0.5f; dust19.noLight = true; } - npc.localAI[0] += 0.05235988f; - npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f).Y * 0.25f; - if (npc.ai[1] >= num1496) - { - int damage = 50; - if (death) - damage += 5; - flag110 = true; + npc.localAI[0] += 0.05235988f; + + npc.localAI[1] = 0.25f + Vector2.UnitY.RotatedBy(npc.ai[1] * MathHelper.TwoPi / 60f).Y * 0.25f; + + if (npc.ai[1] >= duration) + { + int type = ProjectileID.AncientDoomProjectile; + int damage = npc.GetProjectileDamage(type); + + // Triple damage if the Adult Eidolon Wyrm is alive + if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) + damage *= 3; + + kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { for (int num1501 = 0; num1501 < 4; num1501++) { - Vector2 vector255 = new Vector2(0f, -num1499).RotatedBy(MathHelper.PiOver2 * num1501); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector255.X, vector255.Y, ProjectileID.AncientDoomProjectile, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 vector255 = new Vector2(0f, -splitProjVelocity).RotatedBy(MathHelper.PiOver2 * num1501); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); } } } - if (flag110) + + if (kill) { npc.HitEffect(0, 9999.0); npc.active = false; @@ -12608,12 +13002,15 @@ namespace CalamityMod.NPCs } #endregion + // Master Mode changes + // 1 - Moon Lord is at maximum aggression at all times #region Buffed Moon Lord AI public static bool BuffedMoonLordAI(NPC npc, bool enraged, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; int aggressionLevel = 4; if (npc.type == NPCID.MoonLordCore || npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) @@ -12636,7 +13033,15 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.MoonLordCore) + if (malice) + aggressionLevel = 5; + + if (enraged) + aggressionLevel = 6; + + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + if (npc.type == NPCID.MoonLordCore) { // Play a random Moon Lord sound if (npc.ai[0] != -1f && npc.ai[0] != 2f && Main.rand.NextBool(200)) @@ -12746,7 +13151,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num = NPC.NewNPC((int)Main.npc[(int)npc.localAI[2]].Center.X, (int)Main.npc[(int)npc.localAI[2]].Center.Y, NPCID.MoonLordFreeEye, 0, 0f, 0f, 0f, 0f, 255); + int num = NPC.NewNPC((int)Main.npc[(int)npc.localAI[2]].Center.X, (int)Main.npc[(int)npc.localAI[2]].Center.Y, NPCID.MoonLordFreeEye); Main.npc[num].ai[3] = npc.whoAmI; Main.npc[num].netUpdate = true; } @@ -12761,9 +13166,15 @@ namespace CalamityMod.NPCs Vector2 value4 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); if (value4.Length() > 20f) { - float velocity = CalamityWorld.bossRushActive ? 12.5f : 9.25f; + float velocity = death ? 9.5f : 9.25f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; + case 5: + velocity += 2f; + break; case 4: break; case 3: @@ -12834,9 +13245,15 @@ namespace CalamityMod.NPCs Vector2 value5 = Main.player[npc.target].Center - npc.Center + new Vector2(0f, 130f); if (value5.Length() > 20f) { - float velocity = CalamityWorld.bossRushActive ? 12.5f : 9.25f; + float velocity = death ? 9.5f : 9.25f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; + case 5: + velocity += 2f; + break; case 4: break; case 3: @@ -13311,12 +13728,18 @@ namespace CalamityMod.NPCs { if (calamityGlobalNPC.newAI[1] == 0f) { - calamityGlobalNPC.newAI[1] = CalamityWorld.bossRushActive ? 390f : 420f; + calamityGlobalNPC.newAI[1] = 420f; if (death) calamityGlobalNPC.newAI[1] -= 60f; switch (aggressionLevel) { + case 6: + calamityGlobalNPC.newAI[1] -= 180f; + break; + case 5: + calamityGlobalNPC.newAI[1] -= 90f; + break; case 4: break; case 3: @@ -13333,24 +13756,10 @@ namespace CalamityMod.NPCs } } - int damage = 95; - if (death) - damage += 10; - if (num1207 == 180f && Main.netMode != NetmodeID.MultiplayerClient) { int projectileType = ProjectileID.PhantasmalDeathray; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active) - { - if (Main.projectile[i].type == projectileType) - { - calamityGlobalNPC.newAI[1] *= 1.5f; - break; - } - } - } + int damage = npc.GetProjectileDamage(projectileType); npc.TargetClosest(false); Vector2 vector200 = Main.player[npc.target].Center - npc.Center; @@ -13361,7 +13770,7 @@ namespace CalamityMod.NPCs num1225 = 1f; vector200 = vector200.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, projectileType, damage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], (float)npc.whoAmI); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector200.X, vector200.Y, projectileType, damage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); npc.ai[2] = (vector200.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1225; npc.netUpdate = true; } @@ -13424,7 +13833,7 @@ namespace CalamityMod.NPCs if (projectile6.active && projectile6.type == ProjectileID.MoonLeech && Main.player[(int)projectile6.ai[1]].FindBuffIndex(145) != -1) { Vector2 center21 = Main.player[npc.target].Center; - int num1230 = NPC.NewNPC((int)center21.X, (int)center21.Y, NPCID.MoonLordLeechBlob, 0, 0f, 0f, 0f, 0f, 255); + int num1230 = NPC.NewNPC((int)center21.X, (int)center21.Y, NPCID.MoonLordLeechBlob); Main.npc[num1230].netUpdate = true; Main.npc[num1230].ai[0] = npc.whoAmI + 1; Main.npc[num1230].ai[1] = num1229; @@ -13448,6 +13857,12 @@ namespace CalamityMod.NPCs bool shootThirdBolt = num1207 == num1208; switch (aggressionLevel) { + case 6: + v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 30f - npc.Center; + break; + case 5: + v4 = Main.player[npc.target].Center + Main.player[npc.target].velocity * 25f - npc.Center; + break; case 4: break; case 3: @@ -13474,17 +13889,15 @@ namespace CalamityMod.NPCs if (num1207 == num1208 - 35f) Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); - int damage = 40; - if (death) - damage += 4; - if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector203 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value19 * npc.localAI[1]); - float velocity = CalamityWorld.bossRushActive ? 9f : 6.75f; + float velocity = death ? 6.75f : 6.25f; switch (aggressionLevel) { + case 6: + case 5: case 4: break; case 3: @@ -13501,7 +13914,9 @@ namespace CalamityMod.NPCs } Vector2 vector204 = Vector2.Normalize(v4) * velocity; - Projectile.NewProjectile(npc.Center.X + vector203.X, npc.Center.Y + vector203.Y, vector204.X, vector204.Y, ProjectileID.PhantasmalBolt, damage, 0f, Main.myPlayer, 0f, 0f); + int type = ProjectileID.PhantasmalBolt; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center.X + vector203.X, npc.Center.Y + vector203.Y, vector204.X, vector204.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -13627,9 +14042,15 @@ namespace CalamityMod.NPCs { vector167.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 10.5f : 7.5f; + float velocity = death ? 7.75f : 7.5f; switch (aggressionLevel) { + case 6: + velocity += 3f; + break; + case 5: + velocity += 1.5f; + break; case 4: break; case 3: @@ -13662,20 +14083,26 @@ namespace CalamityMod.NPCs int num1186 = 7; int num1187 = 4; - float divisor = 4f; + float divisor = 6f; switch (aggressionLevel) { + case 6: + divisor = 3f; + break; + case 5: + divisor = 4f; + break; case 4: break; case 3: - divisor = 6f; - break; - case 2: divisor = 8f; break; - case 1: + case 2: divisor = 10f; break; + case 1: + divisor = 12f; + break; default: break; } @@ -13695,29 +14122,27 @@ namespace CalamityMod.NPCs float num1188 = MathHelper.TwoPi * (num1178 % (num1186 * num1187)) / (num1186 * num1187) - MathHelper.PiOver2; npc.localAI[0] = new Vector2((float)Math.Cos(num1188) * vector165.X, (float)Math.Sin(num1188) * vector165.Y).ToRotation(); - int damage = 40; - if (death) - damage += 4; - if (num1178 % divisor == 0f) { Vector2 value11 = new Vector2(1f * -num1177, 3f); Vector2 vector168 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); Vector2 vector169 = npc.Center + Vector2.Normalize(vector168) * vector165.Length() * 0.4f + value11; - float velocity = CalamityWorld.bossRushActive ? 12f : 9f; + float velocity = death ? 3.5f : 3f; switch (aggressionLevel) { + case 6: + case 5: case 4: break; case 3: - velocity -= 0.25f; + velocity += 0.5f; break; case 2: - velocity -= 0.5f; + velocity += 1f; break; case 1: - velocity -= 0.75f; + velocity += 1.5f; break; default: break; @@ -13725,7 +14150,11 @@ namespace CalamityMod.NPCs Vector2 vector170 = Vector2.Normalize(vector168) * velocity; float ai = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * num1177; - Projectile.NewProjectile(vector169.X, vector169.Y, vector170.X, vector170.Y, ProjectileID.PhantasmalEye, damage, 0f, Main.myPlayer, 0f, ai); + int type = ProjectileID.PhantasmalEye; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(vector169, vector170, type, damage, 0f, Main.myPlayer, 0f, ai); + Main.projectile[proj].timeLeft = 1200; + Main.projectile[proj].Calamity().lineColor = (malice || enraged) ? 1 : aggressionLevel; } } else @@ -13751,9 +14180,15 @@ namespace CalamityMod.NPCs value12 += new Vector2(num1177 * 100f, -50f); Vector2 value13 = new Vector2(400f * num1177, -60f); - float velocityMultiplier = CalamityWorld.bossRushActive ? 0.87f : 0.885f; + float velocityMultiplier = death ? 0.88f : 0.885f; switch (aggressionLevel) { + case 6: + velocityMultiplier -= 0.04f; + break; + case 5: + velocityMultiplier -= 0.02f; + break; case 4: break; case 3: @@ -13777,9 +14212,15 @@ namespace CalamityMod.NPCs Vector2 vector172 = vector171; vector172.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + float velocity = death ? 11f : 10f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; + case 5: + velocity += 2f; + break; case 4: break; case 3: @@ -13803,13 +14244,15 @@ namespace CalamityMod.NPCs num1180 = 1; int num1190 = (int)num1178 - 30; - int damage = 65; - if (death) - damage += 6; - int divisor = 30; switch (aggressionLevel) { + case 6: + divisor = 15; + break; + case 5: + divisor = 20; + break; case 4: break; case 3: @@ -13832,7 +14275,10 @@ namespace CalamityMod.NPCs vector173.X += (num1191 - 3.5f) * num1177 * 3f; vector173.Y += (num1191 - 4.5f) * 1f; vector173 *= 1.2f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, ProjectileID.PhantasmalSphere, damage, 1f, Main.myPlayer, 0f, npc.whoAmI); + int type = ProjectileID.PhantasmalSphere; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector173.X, vector173.Y, type, damage, 1f, Main.myPlayer, 0f, npc.whoAmI); + Main.projectile[proj].timeLeft = 1200; } Vector2 vector174 = Vector2.SmoothStep(value12, value12 + value13, (num1178 - 30f) / 180f) - npc.Center; @@ -13841,9 +14287,15 @@ namespace CalamityMod.NPCs Vector2 vector175 = vector174; vector175.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 32f : 24f; + float velocity = death ? 26.5f : 24f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; + case 5: + velocity += 2f; + break; case 4: break; case 3: @@ -13888,9 +14340,15 @@ namespace CalamityMod.NPCs if (float.IsNaN(vector176.X) || float.IsNaN(vector176.Y)) vector176 = Vector2.UnitY; - float velocity = CalamityWorld.bossRushActive ? 3f : 2f; + float velocity = death ? 2.2f : 2f; switch (aggressionLevel) { + case 6: + velocity += 3f; + break; + case 5: + velocity += 1.5f; + break; case 4: break; case 3: @@ -13925,9 +14383,15 @@ namespace CalamityMod.NPCs Vector2 vector178 = vector177; vector178.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 24.5f : 17.5f; + float velocity = death ? 19.75f : 17.5f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; + case 5: + velocity += 2f; + break; case 4: break; case 3: @@ -13956,9 +14420,15 @@ namespace CalamityMod.NPCs Vector2 vector180 = vector179; vector180.Normalize(); - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + float velocity = death ? 11f : 10f; switch (aggressionLevel) { + case 6: + velocity += 4f; + break; + case 5: + velocity += 2f; + break; case 4: break; case 3: @@ -13994,6 +14464,12 @@ namespace CalamityMod.NPCs bool shootThirdBolt = num1178 == num1179; switch (aggressionLevel) { + case 6: + v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 30f - npc.Center; + break; + case 5: + v = Main.player[npc.target].Center + Main.player[npc.target].velocity * 25f - npc.Center; + break; case 4: break; case 3: @@ -14021,17 +14497,15 @@ namespace CalamityMod.NPCs if (num1178 == num1179 - 35f) Main.PlaySound(SoundID.NPCKilled, (int)npc.position.X, (int)npc.position.Y, 6, 1f, 0f); - int damage = 40; - if (death) - damage += 4; - if ((shootFirstBolt || shootSecondBolt || shootThirdBolt) && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector181 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), vector165 * npc.localAI[1]); - float velocity = CalamityWorld.bossRushActive ? 9f : 6.75f; + float velocity = death ? 6.75f : 6.25f; switch (aggressionLevel) { + case 6: + case 5: case 4: break; case 3: @@ -14048,7 +14522,9 @@ namespace CalamityMod.NPCs } Vector2 vector182 = Vector2.Normalize(v) * velocity; - Projectile.NewProjectile(npc.Center.X + vector181.X, npc.Center.Y + vector181.Y, vector182.X, vector182.Y, ProjectileID.PhantasmalBolt, damage, 0f, Main.myPlayer, 0f, 0f); + int type = ProjectileID.PhantasmalBolt; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center.X + vector181.X, npc.Center.Y + vector181.Y, vector182.X, vector182.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -14221,7 +14697,7 @@ namespace CalamityMod.NPCs npc.localAI[2] = MathHelper.Lerp(npc.localAI[2], 1f, 0.2f); - float velocity = CalamityWorld.bossRushActive ? 42f : 36f; + float velocity = death ? 38f : 36f; Vector2 center23 = npc.Center; Vector2 center24 = Main.player[npc.target].Center; Vector2 value24 = center24 - center23; @@ -14297,12 +14773,18 @@ namespace CalamityMod.NPCs if ((num1245 == num1241 - 14f || num1245 == num1241 - 7f || num1245 == num1241) && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector214 = Utils.Vector2FromElipse(npc.localAI[0].ToRotationVector2(), value22 * npc.localAI[1]); - Vector2 vector215 = Vector2.Normalize(v8) * 8f; - Projectile.NewProjectile(npc.Center.X + vector214.X, npc.Center.Y + vector214.Y, vector215.X, vector215.Y, ProjectileID.PhantasmalBolt, 35, 0f, Main.myPlayer, 0f, 0f); + float velocity = death ? 9f : 8f; + Vector2 vector215 = Vector2.Normalize(v8) * velocity; + int type = ProjectileID.PhantasmalBolt; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center.X + vector214.X, npc.Center.Y + vector214.Y, vector215.X, vector215.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); } } - else if (npc.ai[0] == 2f) + else if (npc.ai[0] == 2f || npc.ai[0] == 4f) { + int type = ProjectileID.PhantasmalSphere; + int damage = npc.GetProjectileDamage(type); + if (num1245 < 15f) { npc.localAI[1] -= 0.07f; @@ -14371,8 +14853,10 @@ namespace CalamityMod.NPCs if (vector217.HasNaNs()) vector217 = Vector2.UnitY * -1f; + float spreadVelocity = death ? 4.5f : 4f; vector217 *= 4f; - Projectile.NewProjectile(npc.Center.X + vector216.X, npc.Center.Y + vector216.Y, vector217.X, vector217.Y, ProjectileID.PhantasmalSphere, 0, 0f, Main.myPlayer, 30f, npc.whoAmI); + int proj = Projectile.NewProjectile(npc.Center.X + vector216.X, npc.Center.Y + vector216.Y, vector217.X, vector217.Y, type, 0, 0f, Main.myPlayer, 30f, npc.whoAmI); + Main.projectile[proj].timeLeft = 1200; } } else @@ -14394,7 +14878,7 @@ namespace CalamityMod.NPCs for (int num1255 = 0; num1255 < Main.maxProjectiles; num1255++) { Projectile projectile7 = Main.projectile[num1255]; - if (projectile7.active && projectile7.type == ProjectileID.PhantasmalSphere && projectile7.ai[1] == npc.whoAmI && projectile7.ai[0] != -1f) + if (projectile7.active && projectile7.type == type && projectile7.ai[1] == npc.whoAmI && projectile7.ai[0] != -1f) { Projectile projectile8 = projectile7; projectile8.velocity += npc.velocity; @@ -14419,17 +14903,17 @@ namespace CalamityMod.NPCs if (num1245 == 105f) npc.netUpdate = true; - float velocity = CalamityWorld.bossRushActive ? 16f : 12f; + float velocity = death ? 13.25f : 12f; Vector2 velocity6 = (npc.ai[2] - MathHelper.PiOver2).ToRotationVector2() * velocity; npc.velocity = velocity6 * 2f; for (int num1256 = 0; num1256 < Main.maxProjectiles; num1256++) { Projectile projectile9 = Main.projectile[num1256]; - if (projectile9.active && projectile9.type == ProjectileID.PhantasmalSphere && projectile9.ai[1] == npc.whoAmI && projectile9.ai[0] != -1f) + if (projectile9.active && projectile9.type == type && projectile9.ai[1] == npc.whoAmI && projectile9.ai[0] != -1f) { projectile9.ai[0] = -1f; - projectile9.damage = 55; + projectile9.damage = damage; projectile9.velocity = velocity6; projectile9.netUpdate = true; } @@ -14504,10 +14988,13 @@ namespace CalamityMod.NPCs if ((num1245 - 15f - 30f) % 10f == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector219 = npc.Center + Vector2.Normalize(vector218) * value22.Length() * 0.4f; - float velocity = CalamityWorld.bossRushActive ? 14f : 10f; + float velocity = death ? 6f : 5f; Vector2 vector220 = Vector2.Normalize(vector218) * velocity; float ai3 = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * npc.ai[2]; - Projectile.NewProjectile(vector219.X, vector219.Y, vector220.X, vector220.Y, ProjectileID.PhantasmalEye, 35, 0f, Main.myPlayer, 0f, ai3); + int type = ProjectileID.PhantasmalEye; + int damage = npc.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(vector219, vector220, type, damage, 0f, Main.myPlayer, 0f, ai3); + Main.projectile[proj].timeLeft = 1200; } } } @@ -14581,7 +15068,9 @@ namespace CalamityMod.NPCs num1262 = 1f; vector222 = vector222.RotatedBy(-(double)num1262 * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector222.X, vector222.Y, ProjectileID.PhantasmalDeathray, 50, 0f, Main.myPlayer, num1262 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); + int type = ProjectileID.PhantasmalDeathray; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector222.X, vector222.Y, type, damage, 0f, Main.myPlayer, num1262 * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); npc.ai[2] = (vector222.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * num1262; npc.netUpdate = true; } @@ -14655,9 +15144,6 @@ namespace CalamityMod.NPCs // Heal limits int num1273 = death ? 1500 : 1250; - if (CalamityWorld.bossRushActive) - num1273 *= 10; - int num1274 = Main.npc[num1268].lifeMax - Main.npc[num1268].life; int num1275 = Main.npc[num1269].lifeMax - Main.npc[num1269].life; int num1276 = Main.npc[num1270].lifeMax - Main.npc[num1270].life; @@ -14752,1047 +15238,8 @@ namespace CalamityMod.NPCs } #endregion - #region Buffed Mothron AI - public static bool BuffedMothronAI(NPC npc) - { - npc.noTileCollide = false; - npc.noGravity = true; - npc.knockBackResist = 0f; - npc.damage = npc.defDamage; - - // Percent life remaining - float lifeRatio = (float)npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.4f; - bool phase3 = lifeRatio < 0.1f; - - if (!Main.eclipse) - npc.ai[0] = -1f; - else if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - if (Main.player[npc.target].dead) - npc.ai[0] = -1f; - } - - if (npc.ai[0] == -1f) - { - Vector2 value37 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 22f + value37) / 10f; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return false; - } - - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - - if (npc.Center.X < Main.player[npc.target].Center.X - 2f) - npc.direction = 1; - if (npc.Center.X > Main.player[npc.target].Center.X + 2f) - npc.direction = -1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - - if (npc.collideX) - { - npc.velocity.X *= -npc.oldVelocity.X * 0.5f; - - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; - - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - Vector2 value38 = Main.player[npc.target].Center - npc.Center; - value38.Y -= 200f; - if (value38.Length() > 3000f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value38.Length() > 600f) - { - float scaleFactor15 = 15f; - float num1354 = 30f; - value38.Normalize(); - value38 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1354 - 1f) + value38) / num1354; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - npc.ai[1] += 1f; - - if (npc.ai[1] >= 10f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - - while (npc.ai[0] == 0f) - { - int num1355 = Main.rand.Next(3); - if (phase3) - num1355 = 1; - else if (phase2) - num1355 = Main.rand.Next(2); - - if (num1355 == 0 && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.ai[0] = 2f; - else if (num1355 == 1) - npc.ai[0] = 3f; - else if (num1355 == 2 && NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 2) - npc.ai[0] = 4f; - } - } - } - else - { - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - npc.TargetClosest(true); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.02f) / 10f; - - Vector2 value39 = Main.player[npc.target].Center - npc.Center; - if (value39.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - float scaleFactor16 = 18f + value39.Length() / 100f; - float num1356 = 25f; - value39.Normalize(); - value39 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1356 - 1f) + value39) / num1356; - return false; - } - - if (npc.ai[0] == 2f) - { - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - if (Main.player[npc.target].Center.X - 10f < npc.Center.X) - npc.direction = -1; - else if (Main.player[npc.target].Center.X + 10f > npc.Center.X) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.025f) / 5f; - - if (npc.collideX) - { - npc.velocity.X *= -npc.oldVelocity.X * 0.5f; - - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; - - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - Vector2 value40 = Main.player[npc.target].Center - npc.Center; - value40.Y -= 20f; - - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - npc.ai[2] += 0.0166666675f; - - float scaleFactor17 = 12f + npc.ai[2] + value40.Length() / 120f; - float num1357 = 20f; - value40.Normalize(); - value40 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1357 - 1f) + value40) / num1357; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else - { - if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - - Vector2 value41 = Main.player[npc.target].Center - npc.Center; - value41.Y -= 12f; - if (npc.Center.X > Main.player[npc.target].Center.X) - value41.X += 600f; - else - value41.X -= 600f; - - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 550f && Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) < 20f) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = 24f + npc.ai[1]; - float num1358 = 4f; - value41.Normalize(); - value41 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1358 - 1f) + value41) / num1358; - return false; - } - - if (npc.ai[0] == 3.1f) - { - npc.noTileCollide = true; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - - Vector2 vector237 = Main.player[npc.target].Center - npc.Center; - vector237.Y -= 12f; - float scaleFactor19 = 32f; - float num1359 = 8f; - vector237.Normalize(); - vector237 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1359 - 1f) + vector237) / num1359; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = vector237; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; - } - } - else - { - if (npc.ai[0] == 3.2f) - { - npc.damage = (int)((double)npc.defDamage * 1.2); - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; - - if ((npc.ai[1] > 0f && npc.Center.X > Main.player[npc.target].Center.X + 460f) || (npc.ai[1] < 0f && npc.Center.X < Main.player[npc.target].Center.X - 460f)) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 800f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; - return false; - } - - if (npc.ai[0] == 4f) - { - npc.ai[0] = 0f; - npc.TargetClosest(true); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = -1f; - npc.ai[2] = -1f; - - int num; - for (int num1360 = 0; num1360 < 1000; num1360 = num + 1) - { - int num1361 = (int)Main.player[npc.target].Center.X / 16; - int num1362 = (int)Main.player[npc.target].Center.Y / 16; - int num1363 = 30 + num1360 / 50; - int num1364 = 20 + num1360 / 75; - - num1361 += Main.rand.Next(-num1363, num1363 + 1); - num1362 += Main.rand.Next(-num1364, num1364 + 1); - - if (!WorldGen.SolidTile(num1361, num1362)) - { - while (!WorldGen.SolidTile(num1361, num1362) && (double)num1362 < Main.worldSurface) - num1362++; - - if ((new Vector2((float)(num1361 * 16 + 8), (float)(num1362 * 16 + 8)) - Main.player[npc.target].Center).Length() < 1600f) - { - npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1361; - npc.ai[2] = (float)num1362; - break; - } - } - num = num1360; - } - } - npc.netUpdate = true; - return false; - } - - if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - npc.direction = -1; - else if (npc.velocity.X > 2f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - npc.noTileCollide = true; - - int num1365 = (int)npc.ai[1]; - int num1366 = (int)npc.ai[2]; - float x2 = (float)(num1365 * 16 + 8); - float y2 = (float)(num1366 * 16 - 20); - Vector2 vector238 = new Vector2(x2, y2); - vector238 -= npc.Center; - float num1367 = 12f + vector238.Length() / 150f; - - if (num1367 > 20f) - num1367 = 20f; - - if (vector238.Length() < 10f) - npc.ai[0] = 4.2f; - - vector238.Normalize(); - vector238 *= num1367; - float num1368 = 10f; - npc.velocity = (npc.velocity * (num1368 - 1f) + vector238) / num1368; - return false; - } - - if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; - npc.noTileCollide = true; - - int num1369 = (int)npc.ai[1]; - int num1370 = (int)npc.ai[2]; - float x3 = (float)(num1369 * 16 + 8); - float y3 = (float)(num1370 * 16 - 20); - Vector2 vector239 = new Vector2(x3, y3); - vector239 -= npc.Center; - float num1371 = 4f; - float num1372 = 2f; - - if (Main.netMode != NetmodeID.MultiplayerClient && vector239.Length() < 4f) - { - int num1373 = 20; - if (Main.expertMode) - num1373 = (int)((double)num1373 * 0.75); - - npc.ai[3] += 1f; - - if (npc.ai[3] == (float)num1373) - NPC.NewNPC(num1369 * 16 + 8, num1370 * 16, 478, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - else if (npc.ai[3] == (float)(num1373 * 2)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (NPC.CountNPCS(478) + NPC.CountNPCS(479) < 3 && Main.rand.Next(3) != 0) - npc.ai[0] = 4f; - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 1f; - } - } - - if (vector239.Length() > num1371) - { - vector239.Normalize(); - vector239 *= num1371; - } - npc.velocity = (npc.velocity * (num1372 - 1f) + vector239) / num1372; - } - } - } - } - return false; - } - #endregion - - #region Buffed Pumpking and Pumpking Blade AI - public static bool BuffedPumpkingAI(NPC npc) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > 6f) - { - npc.localAI[0] = 0f; - npc.localAI[1] += 1f; - - if (npc.localAI[1] > 4f) - npc.localAI[1] = 0f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 300f) - { - npc.ai[3] = (float)Main.rand.Next(3); - npc.localAI[2] = 0f; - } - else if (npc.ai[3] == 0f && npc.localAI[2] % 30f == 0f && npc.localAI[2] > 30f) - { - float num856 = 10f; - Vector2 vector109 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - if (!WorldGen.SolidTile((int)vector109.X / 16, (int)vector109.Y / 16)) - { - float num857 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector109.X; - float num858 = Main.player[npc.target].position.Y - vector109.Y; - num857 += (float)Main.rand.Next(-50, 51); - num858 += (float)Main.rand.Next(50, 201); - num858 *= 0.2f; - float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); - num859 = num856 / num859; - num857 *= num859; - num858 *= num859; - num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; - Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, ProjectileID.GreekFire1 + Main.rand.Next(3), 60, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(true); - npc.ai[0] = 1f; - - int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PumpkingBlade, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num861].ai[0] = -1f; - Main.npc[num861].ai[1] = (float)npc.whoAmI; - Main.npc[num861].target = npc.target; - Main.npc[num861].netUpdate = true; - - num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PumpkingBlade, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[num861].ai[0] = 1f; - Main.npc[num861].ai[1] = (float)npc.whoAmI; - Main.npc[num861].ai[3] = 150f; - Main.npc[num861].target = npc.target; - Main.npc[num861].netUpdate = true; - } - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - { - npc.TargetClosest(true); - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - npc.ai[1] = 2f; - } - - if (Main.dayTime) - { - npc.velocity.Y += 0.3f; - npc.velocity.X *= 0.9f; - } - else if (npc.ai[1] == 0f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - if (npc.ai[3] != 1f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.TargetClosest(true); - npc.netUpdate = true; - } - } - - Vector2 vector110 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num862 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector110.X; - float num863 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector110.Y; - float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863)); - float num865 = 8f; - - if (npc.ai[3] == 1f) - { - if (num864 > 900f) - num865 = 14f; - else if (num864 > 600f) - num865 = 12f; - else if (num864 > 300f) - num865 = 10f; - } - - if (num864 > 50f) - { - num864 = num865 / num864; - npc.velocity.X = (npc.velocity.X * 14f + num862 * num864) / 15f; - npc.velocity.Y = (npc.velocity.Y * 14f + num863 * num864) / 15f; - } - } - else if (npc.ai[1] == 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 600f || npc.ai[3] != 1f) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - } - - Vector2 vector111 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num866 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector111.X; - float num867 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector111.Y; - float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); - num868 = 20f / num868; - - npc.velocity.X = (npc.velocity.X * 49f + num866 * num868) / 50f; - npc.velocity.Y = (npc.velocity.Y * 49f + num867 * num868) / 50f; - } - else if (npc.ai[1] == 2f) - { - npc.ai[1] = 3f; - npc.velocity.Y += 0.1f; - - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - - if (npc.timeLeft > 500) - npc.timeLeft = 500; - } - npc.rotation = npc.velocity.X * -0.02f; - - return false; - } - - public static bool BuffedPumpkingBladeAI(NPC npc) - { - npc.spriteDirection = -(int)npc.ai[0]; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) - { - npc.life = -1; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[(int)npc.ai[1]].ai[3] == 2f) - { - npc.localAI[1] += 1f; - if (npc.localAI[1] > 30f) - { - npc.localAI[1] = 0f; - - float num869 = 0.01f; - Vector2 vector112 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float num870 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector112.X; - float num871 = Main.player[npc.target].position.Y - vector112.Y; - float num872 = (float)Math.Sqrt((double)(num870 * num870 + num871 * num871)); - - num872 = num869 / num872; - num870 *= num872; - num871 *= num872; - - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num870, num871, ProjectileID.FlamingScythe, 70, 0f, Main.myPlayer, npc.rotation, (float)npc.spriteDirection); - } - } - - if (Main.dayTime) - { - npc.velocity.Y += 0.3f; - npc.velocity.X *= 0.9f; - return false; - } - - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) - npc.timeLeft = 10; - - npc.ai[3] += 1f; - if (npc.ai[3] >= 180f) - { - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector113 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num874 = (Main.player[npc.target].Center.X + Main.npc[(int)npc.ai[1]].Center.X) / 2f; - float num875 = (Main.player[npc.target].Center.Y + Main.npc[(int)npc.ai[1]].Center.Y) / 2f; - num874 += -170f * npc.ai[0] - vector113.X; - num875 += 90f - vector113.Y; - - float num876 = Math.Abs(Main.player[npc.target].Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(Main.player[npc.target].Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - if (num876 > 700f) - { - num874 = Main.npc[(int)npc.ai[1]].Center.X - 170f * npc.ai[0] - vector113.X; - num875 = Main.npc[(int)npc.ai[1]].Center.Y + 90f - vector113.Y; - } - - float num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); - float num878 = 8f; - if (num877 > 1000f) - num878 = 23f; - else if (num877 > 800f) - num878 = 20f; - else if (num877 > 600f) - num878 = 17f; - else if (num877 > 400f) - num878 = 14f; - else if (num877 > 200f) - num878 = 11f; - - if (npc.ai[0] < 0f && npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - num874 -= 4f; - if (npc.ai[0] > 0f && npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - num874 += 4f; - - num877 = num878 / num877; - npc.velocity.X = (npc.velocity.X * 14f + num874 * num877) / 15f; - npc.velocity.Y = (npc.velocity.Y * 14f + num875 * num877) / 15f; - num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); - - if (num877 > 20f) - npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - Vector2 vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num879 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector114.X; - float num880 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector114.Y; - float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); - - npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + MathHelper.PiOver2; - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.3f; - - if (npc.velocity.Y < -18f) - npc.velocity.Y = -18f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - npc.TargetClosest(true); - npc.ai[2] = 2f; - - vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num879 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector114.X; - num880 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector114.Y; - num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); - num881 = 24f / num881; - - npc.velocity.X = num879 * num881; - npc.velocity.Y = num880 * num881; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - float num882 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || num882 > 800f) - npc.ai[2] = 3f; - } - else if (npc.ai[2] == 4f) - { - Vector2 vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num883 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector115.X; - float num884 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector115.Y; - float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); - - npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + MathHelper.PiOver2; - npc.velocity.Y *= 0.95f; - npc.velocity.X += 0.3f * -npc.ai[0]; - - if (npc.velocity.X < -18f) - npc.velocity.X = -18f; - if (npc.velocity.X > 18f) - npc.velocity.X = 18f; - - if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) - { - npc.TargetClosest(true); - npc.ai[2] = 5f; - - vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num883 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector115.X; - num884 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector115.Y; - num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); - num885 = 17f / num885; - - npc.velocity.X = num883 * num885; - npc.velocity.Y = num884 * num885; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f) - { - float num886 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); - - if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || num886 > 800f) - npc.ai[2] = 0f; - } - - return false; - } - #endregion - - #region Buffed Ice Queen AI - public static bool BuffedIceQueenAI(NPC npc) - { - if (Main.dayTime) - { - if (npc.velocity.X > 0f) - npc.velocity.X += 0.25f; - else - npc.velocity.X -= 0.25f; - - npc.velocity.Y -= 0.1f; - npc.rotation = npc.velocity.X * 0.05f; - } - else if (npc.ai[0] == 0f) - { - if (npc.ai[2] == 0f) - { - npc.TargetClosest(true); - - if (npc.Center.X < Main.player[npc.target].Center.X) - npc.ai[2] = 1f; - else - npc.ai[2] = -1f; - } - - npc.TargetClosest(true); - int num887 = 800; - float num888 = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - - if (npc.Center.X < Main.player[npc.target].Center.X && npc.ai[2] < 0f && num888 > (float)num887) - npc.ai[2] = 0f; - if (npc.Center.X > Main.player[npc.target].Center.X && npc.ai[2] > 0f && num888 > (float)num887) - npc.ai[2] = 0f; - - float num889 = 0.6f; - float num890 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num889 = 0.7f; - num890 = 12f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num889 = 0.8f; - num890 = 14f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num889 = 0.95f; - num890 = 16f; - } - - npc.velocity.X += npc.ai[2] * num889; - if (npc.velocity.X > num890) - npc.velocity.X = num890; - if (npc.velocity.X < -num890) - npc.velocity.X = -num890; - - float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); - if (num891 < 150f) - npc.velocity.Y -= 0.2f; - if (num891 > 200f) - npc.velocity.Y += 0.2f; - if (npc.velocity.Y > 9f) - npc.velocity.Y = 9f; - if (npc.velocity.Y < -9f) - npc.velocity.Y = -9f; - - npc.rotation = npc.velocity.X * 0.05f; - - if ((num888 < 500f || npc.ai[3] < 0f) && npc.position.Y < Main.player[npc.target].position.Y) - { - npc.ai[3] += 1f; - int num892 = 8; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num892 = 7; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num892 = 6; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num892 = 5; - - num892++; - if (npc.ai[3] > (float)num892) - npc.ai[3] = (float)-(float)num892; - - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector116 = new Vector2(npc.Center.X, npc.Center.Y); - vector116.X += npc.velocity.X * 7f; - float num893 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector116.X; - float num894 = Main.player[npc.target].Center.Y - vector116.Y; - float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); - - float num896 = 8f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num896 = 9f; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num896 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num896 = 11f; - - num895 = num896 / num895; - num893 *= num895; - num894 *= num895; - - Projectile.NewProjectile(vector116.X, vector116.Y, num893, num894, ProjectileID.FrostWave, 50, 0f, Main.myPlayer, 0f, 0f); - } - } - else if (npc.ai[3] < 0f) - npc.ai[3] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - - if (npc.ai[1] > 600f && num888 < 600f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 1f) - { - npc.TargetClosest(true); - - float num898 = 0.2f; - float num899 = 10f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num898 = 0.24f; - num899 = 12f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num898 = 0.28f; - num899 = 14f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num898 = 0.32f; - num899 = 16f; - } - num898 -= 0.05f; - num899 -= 1f; - - if (npc.Center.X < Main.player[npc.target].Center.X) - { - npc.velocity.X += num898; - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - } - if (npc.Center.X > Main.player[npc.target].Center.X) - { - npc.velocity.X -= num898; - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - } - if (npc.velocity.X > num899 || npc.velocity.X < -num899) - npc.velocity.X *= 0.95f; - - float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); - if (num900 < 180f) - npc.velocity.Y -= 0.1f; - if (num900 > 200f) - npc.velocity.Y += 0.1f; - - if (npc.velocity.Y > 7f) - npc.velocity.Y = 7f; - if (npc.velocity.Y < -7f) - npc.velocity.Y = -7f; - - npc.rotation = npc.velocity.X * 0.01f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - int num901 = 10; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num901 = 8; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num901 = 6; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num901 = 4; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num901 = 2; - - num901 += 3; - if (npc.ai[3] >= (float)num901) - { - npc.ai[3] = 0f; - Vector2 vector117 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); - int i2 = (int)(vector117.X / 16f); - int j2 = (int)(vector117.Y / 16f); - if (!WorldGen.SolidTile(i2, j2)) - { - float num902 = npc.velocity.Y; - - if (num902 < 0f) - num902 = 0f; - - num902 += 3f; - float speedX2 = npc.velocity.X * 0.25f; - Projectile.NewProjectile(vector117.X, vector117.Y, speedX2, num902, ProjectileID.FrostShard, 44, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - - if (npc.ai[1] > 450f) - npc.ai[0] = -1f; - } - } - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - - Vector2 vector118 = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float num904 = (float)Main.rand.Next(-1000, 1001); - float num905 = (float)Main.rand.Next(-1000, 1001); - float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); - float num907 = 20f; - - npc.velocity *= 0.95f; - num906 = num907 / num906; - num904 *= num906; - num905 *= num906; - npc.rotation += 0.2f; - vector118.X += num904 * 4f; - vector118.Y += num905 * 4f; - - npc.ai[3] += 1f; - int num908 = 7; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num908--; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num908 -= 2; - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num908 -= 3; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num908 -= 4; - - if (npc.ai[3] > (float)num908) - { - npc.ai[3] = 0f; - int num909 = Projectile.NewProjectile(vector118.X, vector118.Y, num904, num905, ProjectileID.FrostShard, 40, 0f, Main.myPlayer, 0f, 0f); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] += (float)Main.rand.Next(1, 4); - - if (npc.ai[1] > 300f) - npc.ai[0] = -1f; - } - } - if (npc.ai[0] == -1f) - { - int num910 = Main.rand.Next(3); - npc.TargetClosest(true); - - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 1000f) - num910 = 0; - - npc.ai[0] = (float)num910; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - return false; - } - #endregion - #region Revengeance Dungeon Guardian AI - public static void RevengeanceDungeonGuardianAI(NPC npc, bool configBossRushBoost, bool enraged) + public static void RevengeanceDungeonGuardianAI(NPC npc) { Player target = Main.player[npc.target]; if (npc.ai[1] != 3f) @@ -16813,9 +16260,10 @@ namespace CalamityMod.NPCs // If there's nothing in the way of the player, swim towards them if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1)) { - npc.velocity = (npc.velocity * 19f + npc.DirectionTo(Main.player[npc.target].Center) * 10f) / 20f; + npc.velocity = (npc.velocity * 19f + npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f) / 20f; return false; } + float velocityMultiplier = 10f; if (npc.velocity.Y > 0f) { @@ -17094,7 +16542,7 @@ namespace CalamityMod.NPCs npc.localAI[3] = 0f; Vector2 spawnPosition = npc.Center; spawnPosition += npc.velocity; - NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, NPCID.ChaosBall, 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, NPCID.ChaosBall); } } } @@ -17250,7 +16698,7 @@ namespace CalamityMod.NPCs for (int j = 0; j < 2; j++) { // Randomize and normalize. You know the drill - Vector2 dustVelocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi); + Vector2 dustVelocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); dustVelocity *= (float)Main.rand.Next(0, 100) * 0.1f; dustVelocity.Normalize(); dustVelocity *= (float)Main.rand.Next(50, 90) * 0.1f; @@ -17336,11 +16784,8 @@ namespace CalamityMod.NPCs { npc.ai[2] -= 1f; npc.TargetClosest(true); - Vector2 vectorToPlayer = npc.DirectionTo(Main.player[npc.target].Top + new Vector2(0f, -30f)); - if (vectorToPlayer.HasNaNs()) - { - vectorToPlayer = Vector2.Normalize(new Vector2((float)npc.spriteDirection, -1f)); - } + Vector2 vectorToPlayer = npc.SafeDirectionTo(Main.player[npc.target].Top - Vector2.UnitY * 30f, Vector2.Normalize(new Vector2(npc.spriteDirection, -1f))); + npc.velocity = vectorToPlayer * velocityMultiplier; npc.netUpdate = true; return false; @@ -17719,14 +17164,13 @@ namespace CalamityMod.NPCs } Vector2 velocityDelta = -Vector2.One; for (int j = 0; j < i; j++) - { - velocityDelta += npc.DirectionTo(Main.npc[players[j]].Center); - } + velocityDelta += npc.SafeDirectionTo(Main.npc[players[j]].Center); + velocityDelta.Normalize(); for (int j = 0; j < nailCount; j++) { - float velocityMultiplier = (float)Main.rand.Next(8, 13); - Vector2 nailVelocity = Vector2.One.RotatedByRandom(Math.PI * 2.0); + float velocityMultiplier = Main.rand.Next(8, 13); + Vector2 nailVelocity = Vector2.UnitY.RotatedByRandom(Math.PI * 2.0); if (i > 0) { nailVelocity += velocityDelta; @@ -17736,9 +17180,10 @@ namespace CalamityMod.NPCs if (i > 0) { i--; - nailVelocity = npc.DirectionTo(Main.npc[players[i]].Center) * velocityMultiplier; + nailVelocity = npc.SafeDirectionTo(Main.npc[players[i]].Center, -Vector2.UnitY) * velocityMultiplier; } - Projectile.NewProjectile(npc.Center + Vector2.UnitY * (float)(npc.width / 4), nailVelocity, ProjectileID.Nail, (int)(npc.damage * 0.15), 1f, 255, 0f, 0f); + + Projectile.NewProjectile(npc.Center + Vector2.UnitY * (npc.width / 4), nailVelocity, ProjectileID.Nail, (int)(npc.damage * 0.15), 1f, 255, 0f, 0f); } } } @@ -18601,21 +18046,19 @@ namespace CalamityMod.NPCs } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (float)(240 + Main.rand.Next(240)) && npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.DirectionTo(Main.player[npc.target].Center).Y) < 0.5f && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) + npc.localAI[2]++; + bool closeToPlayer = npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.SafeDirectionTo(Main.player[npc.target].Center).Y) < 0.5f; + if (npc.localAI[2] >= Main.rand.Next(240, 480) && closeToPlayer && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) { npc.localAI[2] = 0f; - Vector2 spawnPos = npc.Center + new Vector2((float)(npc.direction * 30), 2f); - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * 9f; - if (velocity.HasNaNs()) - { - velocity = new Vector2((float)(npc.direction * 10), 0f); - } + Vector2 spawnPosition = npc.Center + new Vector2(npc.direction * 30f, 2f); + Vector2 baseLaserVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, Vector2.UnitX * npc.direction) * 9f; + int damage = Main.expertMode ? 50 : 75; for (int i = 0; i < 4; i++) { - Vector2 vector17 = velocity + Utils.RandomVector2(Main.rand, -0.8f, 0.8f); - Projectile.NewProjectile(spawnPos, vector17, ProjectileID.VortexLaser, damage, 1f, Main.myPlayer, 0f, 0f); + Vector2 randomizedVelocity = baseLaserVelocity + Utils.RandomVector2(Main.rand, -0.8f, 0.8f); + Projectile.NewProjectile(spawnPosition, randomizedVelocity, ProjectileID.VortexLaser, damage, 1f, Main.myPlayer, 0f, 0f); } } } @@ -18793,7 +18236,7 @@ namespace CalamityMod.NPCs 229 }); Dust dust = Main.dust[Dust.NewDust(npc.Center + new Vector2((float)((npc.spriteDirection == 1) ? 8 : -20), -20f), 8, 8, dustType, npc.velocity.X, npc.velocity.Y, 100, default, 1f)]; - dust.velocity = dust.velocity / 4f + npc.DirectionTo(Main.player[npc.target].Top); + dust.velocity = dust.velocity / 4f + npc.SafeDirectionTo(Main.player[npc.target].Top); dust.scale = 1.2f; dust.noLight = true; } @@ -18859,7 +18302,7 @@ namespace CalamityMod.NPCs if (npc.localAI[0] > (float)Main.rand.Next(120, 240)) { npc.localAI[0] = 0f; - Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f); } } if (npcType == NPCID.IceGolem) @@ -18880,7 +18323,7 @@ namespace CalamityMod.NPCs if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 90f && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.netUpdate = true; - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * 15; + Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 15; Projectile.NewProjectile(npc.Center - Vector2.UnitY * 28 + velocity * 2f, velocity, ProjectileID.FrostBeam, 32, 0f, Main.myPlayer, 0f, 0f); npc.ai[2] = 0f; } @@ -20399,14 +19842,13 @@ namespace CalamityMod.NPCs bool flag = npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.LeechHead || npc.type == NPCID.DuneSplicerHead || (!Main.player[npc.target].ZoneUndergroundDesert && npc.type == NPCID.TombCrawlerHead); float num4 = npc.type == NPCID.TombCrawlerHead ? 0.1f : 0.2f; - bool isSplittingNPC = (npc.type >= NPCID.DevourerHead && npc.type <= NPCID.DevourerTail) || (npc.type >= NPCID.DiggerHead && npc.type <= NPCID.DiggerTail) || - (npc.type >= NPCID.SeekerHead && npc.type <= NPCID.SeekerTail) || (npc.type >= NPCID.DuneSplicerHead && npc.type <= NPCID.DuneSplicerTail); + bool isSplittingNPC = (npc.type >= NPCID.DiggerHead && npc.type <= NPCID.DiggerTail) || (npc.type >= NPCID.SeekerHead && npc.type <= NPCID.SeekerTail) || (npc.type >= NPCID.DuneSplicerHead && npc.type <= NPCID.DuneSplicerTail); - bool isSplittingNPCHead = npc.type == NPCID.DevourerHead || npc.type == NPCID.DiggerHead || npc.type == NPCID.SeekerHead || npc.type == NPCID.DuneSplicerHead; + bool isSplittingNPCHead = npc.type == NPCID.DiggerHead || npc.type == NPCID.SeekerHead || npc.type == NPCID.DuneSplicerHead; - bool isSplittingNPCBody = npc.type == NPCID.DevourerBody || npc.type == NPCID.DiggerBody || npc.type == NPCID.SeekerBody || npc.type == NPCID.DuneSplicerBody; + bool isSplittingNPCBody = npc.type == NPCID.DiggerBody || npc.type == NPCID.SeekerBody || npc.type == NPCID.DuneSplicerBody; - bool isSplittingNPCTail = npc.type == NPCID.DevourerTail || npc.type == NPCID.DiggerTail || npc.type == NPCID.SeekerTail || npc.type == NPCID.DuneSplicerTail; + bool isSplittingNPCTail = npc.type == NPCID.DiggerTail || npc.type == NPCID.SeekerTail || npc.type == NPCID.DuneSplicerTail; if (isSplittingNPC) { @@ -20520,9 +19962,9 @@ namespace CalamityMod.NPCs } } - if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) + if ((isSplittingNPCHead || isSplittingNPCBody || npc.type == NPCID.GiantWormHead || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerHead || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody) && npc.ai[0] == 0f) { - if (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) + if (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead) { if (!isSplittingNPCHead) { @@ -20557,7 +19999,7 @@ namespace CalamityMod.NPCs npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - else if ((isSplittingNPCBody || npc.type == NPCID.GiantWormBody || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechBody) && npc.ai[2] > 0f) + else if ((isSplittingNPCBody || npc.type == NPCID.GiantWormBody || npc.type == NPCID.DevourerBody || npc.type == NPCID.BoneSerpentBody || npc.type == NPCID.LeechBody) && npc.ai[2] > 0f) { npc.ai[0] = (float)NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); } @@ -20716,7 +20158,7 @@ namespace CalamityMod.NPCs } } - if (!flag2 && (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead || npc.type == NPCID.TombCrawlerHead)) + if (!flag2 && (isSplittingNPCHead || npc.type == NPCID.GiantWormHead || npc.type == NPCID.DevourerHead || npc.type == NPCID.BoneSerpentHead || npc.type == NPCID.LeechHead || npc.type == NPCID.TombCrawlerHead)) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int num35 = 1000; @@ -21898,11 +21340,12 @@ namespace CalamityMod.NPCs { if (!Collision.SolidCollision(npc.position, npc.width, npc.height) && 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; int damage = 17; int type = ProjectileID.CursedFlameHostile; - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 180; + Vector2 flameVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 12f; + + int flame = Projectile.NewProjectile(npc.Center, flameVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[flame].timeLeft = 180; npc.localAI[0] = 0f; } else @@ -21925,7 +21368,8 @@ namespace CalamityMod.NPCs { absoluteYDistance = 0f; } - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance) * speed; + + Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed; int idx = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore, 0, 0f, 0f, 0f, 0f, 255); Main.npc[idx].velocity = velocity; @@ -21944,7 +21388,7 @@ namespace CalamityMod.NPCs #region Bat AI public static bool BuffedBatAI(NPC npc, Mod mod) { - if (npc.type == NPCID.Hellbat || npc.type == NPCID.Lavabat) + if (npc.type == NPCID.Hellbat || npc.type == NPCID.Lavabat || npc.type == ModContent.NPCType()) { int num203 = Dust.NewDust(npc.position, npc.width, npc.height, 6, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, default(Color), 2f); Main.dust[num203].noGravity = true; @@ -22054,7 +21498,8 @@ namespace CalamityMod.NPCs npc.type == NPCID.IceBat || npc.type == NPCID.Lavabat || npc.type == NPCID.GiantFlyingFox || - npc.type == ModContent.NPCType()) + npc.type == ModContent.NPCType() || + npc.type == ModContent.NPCType()) { maxSpeedX = 6f; maxSpeedY = 2.5f; @@ -22172,11 +21617,12 @@ namespace CalamityMod.NPCs { 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 = 6f; int damage = 15; int type = ProjectileID.HarpyFeather; - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 300; + Vector2 featherVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 6f; + + int feather = Projectile.NewProjectile(npc.Center, featherVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[feather].timeLeft = 300; } } else if (npc.ai[0] >= 400f + Main.rand.Next(200)) @@ -22191,11 +21637,12 @@ namespace CalamityMod.NPCs { 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 = 0.2f; int damage = 21; int type = ProjectileID.DemonSickle; - int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 300; + Vector2 sickleVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 0.2f; + + int sickle = Projectile.NewProjectile(npc.Center, sickleVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[sickle].timeLeft = 300; } } else if (npc.ai[0] >= 300f + Main.rand.Next(200)) @@ -22210,16 +21657,16 @@ namespace CalamityMod.NPCs { 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 = 0.2f; Vector2 spawnPosition = npc.Center; - Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed; + float tridentSpeed = 0.2f; + Vector2 tridentVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * tridentSpeed; + spawnPosition += npc.velocity * 5f; int damage = 80; int type = ProjectileID.UnholyTridentHostile; - spawnPosition += npc.velocity * 5f; - int idx = Projectile.NewProjectile(spawnPosition + velocity * 100f, velocity, type, damage, 3f, Main.myPlayer, 0f, 0f); - Main.projectile[idx].timeLeft = 300; + int trident = Projectile.NewProjectile(spawnPosition + tridentVelocity * 100f, tridentVelocity, type, damage, 3f, Main.myPlayer, 0f, 0f); + Main.projectile[trident].timeLeft = 300; } } else if (npc.ai[0] >= 250f + Main.rand.Next(200)) @@ -22406,8 +21853,8 @@ namespace CalamityMod.NPCs } } } - int x = (int)npc.Center.Y / 16; - int y = (int)npc.Center.X / 16; + int x = (int)npc.Center.X / 16; + int y = (int)npc.Center.Y / 16; if (Main.tile[x, y - 1] is null) { Main.tile[x, y - 1] = new Tile(); @@ -22630,12 +22077,9 @@ namespace CalamityMod.NPCs npc.localAI[0] = 1f; } npc.TargetClosest(true); - float speed = 14f; - if (npc.type == NPCID.GreenJellyfish) - { - speed = 18f; - } - npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed; + + float lungeSpeed = npc.type == NPCID.GreenJellyfish ? 18f : 14f; + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * lungeSpeed; } } // General floating around. @@ -23569,9 +23013,10 @@ namespace CalamityMod.NPCs // Charge if (npc.ai[0] == 0f) { - float speed = 12f; - npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed; + float chargeSpeed = 12f; + npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * chargeSpeed; npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4; + // Slow down npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -25469,12 +24914,11 @@ namespace CalamityMod.NPCs float speed = 6f; float acceleration = 0.25f; - Vector2 idealVelocity = npc.DirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed; + Vector2 idealVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed; float playerDistance = npc.Distance(Main.player[npc.target].Center); if (playerDistance < 20f) - { idealVelocity = npc.velocity; - } + // Yes, I understand that npc.SimpleFlyMovement exists. However, the "acceleration * 2f" is not a part of that method. // It is not identical to what is being achieved here. if (npc.velocity.X < idealVelocity.X) @@ -25538,23 +24982,21 @@ namespace CalamityMod.NPCs #endregion #region Spore AI - public static bool BuffedSporeAI(NPC npc, Mod mod, bool death) + public static bool BuffedSporeAI(NPC npc, Mod mod) { if (npc.timeLeft > 5) - { npc.timeLeft = 5; - } + npc.noTileCollide = true; npc.velocity.Y += 0.02f; // Ensure slow fall if (npc.velocity.Y > 1f) - { npc.velocity.Y = 1f; - } + npc.TargetClosest(true); - float acceleration = death ? 0.25f : 0.2f; - float velocity = death ? 7f : 5f; + float acceleration = 0.2f; + float velocity = 5f; // Simple movement AI. You shouldn't need any help from comments to parse this. if (npc.Center.X < Main.player[npc.target].position.X) @@ -26367,8 +25809,195 @@ namespace CalamityMod.NPCs } return false; } - #endregion + #endregion - #endregion + #endregion + + #region DD2 Event AIs + public static int DD2EventEnemySpawnRate + { + get + { + int enemySpawnRateSpeedup = 0; + if (Main.npc.IndexInRange(CalamityGlobalNPC.DD2CrystalIndex) && Main.npc[CalamityGlobalNPC.DD2CrystalIndex].active) + enemySpawnRateSpeedup = (int)Main.npc[CalamityGlobalNPC.DD2CrystalIndex].ai[2]; + return Utils.Clamp(DD2Event.LaneSpawnRate - enemySpawnRateSpeedup, 15, DD2Event.LaneSpawnRate); + } + } + + public static void DD2PortalAI(NPC npc) + { + // Idly emit light if the portal has completely faded in. + if (npc.alpha == 0) + Lighting.AddLight(npc.Center, 0.5f, 0.1f, 0.3f); + + ref float enemySpawnTimer = ref npc.ai[0]; + ref float fadeOutTimer = ref npc.ai[2]; + ref float fadeInTimer = ref npc.localAI[0]; + ref float idlePlaySoundId = ref npc.localAI[3]; + if (npc.ai[1] == 0f) + { + // Play the portal opening sound at the moment of the portal's creation. + if (fadeInTimer == 0f) + { + Main.PlayTrackedSound(SoundID.DD2_EtherianPortalOpen, npc.Center); + idlePlaySoundId = SlotId.Invalid.ToFloat(); + } + + if (fadeInTimer > 150f && Main.GetActiveSound(SlotId.FromFloat(idlePlaySoundId)) == null) + idlePlaySoundId = Main.PlayTrackedSound(SoundID.DD2_EtherianPortalIdleLoop, npc.Center).ToFloat(); + + if (!DD2Event.EnemySpawningIsOnHold) + enemySpawnTimer++; + + if (enemySpawnTimer >= DD2EventEnemySpawnRate) + { + if (enemySpawnTimer >= DD2EventEnemySpawnRate * 3) + enemySpawnTimer = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient && (int)enemySpawnTimer % DD2EventEnemySpawnRate == 0) + { + DD2Event.SpawnMonsterFromGate(npc.Bottom); + + // If enemy spawning is on hold, add 1 to the spawn timer to ensure that the above + // modulo doesn't get activated every single frame due to no other change above. + if (DD2Event.EnemySpawningIsOnHold) + enemySpawnTimer++; + } + npc.netUpdate = true; + } + + fadeInTimer++; + + // Begin to fade out of existence if the crystal is gone and the portal is done doing fade-in effects. + if (Main.netMode != NetmodeID.MultiplayerClient && !NPC.AnyNPCs(NPCID.DD2EterniaCrystal) && fadeInTimer >= 180f) + { + npc.ai[1] = 1f; + enemySpawnTimer = 0f; + npc.dontTakeDamage = true; + npc.netUpdate = true; + } + } + + // Fade-out effects. + else if (npc.ai[1] == 1f) + { + fadeOutTimer++; + npc.scale = MathHelper.Lerp(1f, 0.05f, Utils.InverseLerp(500f, 600f, fadeOutTimer, true)); + + // Reset the idle play sound if it didn't get activated before for some reason. + if (Main.GetActiveSound(SlotId.FromFloat(idlePlaySoundId)) == null) + idlePlaySoundId = Main.PlayTrackedSound(SoundID.DD2_EtherianPortalIdleLoop, npc.Center).ToFloat(); + + ActiveSound activeSound = Main.GetActiveSound(SlotId.FromFloat(idlePlaySoundId)); + if (activeSound != null) + activeSound.Volume = npc.scale; + + // Kill the portal after enough time has passed. + if (fadeOutTimer >= 550f) + { + npc.dontTakeDamage = false; + npc.life = 0; + npc.checkDead(); + npc.netUpdate = true; + if (activeSound != null) + { + activeSound.Stop(); + return; + } + } + } + } + + public static void DD2CrystalExtraAI(NPC npc) + { + CalamityGlobalNPC.DD2CrystalIndex = npc.whoAmI; + + ref float initialClickDelay = ref npc.localAI[3]; + ref float enemySpawnRateSpeedup = ref npc.ai[2]; + ref float animationCountdown = ref npc.ai[3]; + + if (animationCountdown > 0f) + animationCountdown--; + + // This is done to ensure that the initial click on the pedestal is not registered as a click to the crystal itself. + initialClickDelay++; + + bool clickingOnCrystal = Main.mouseRight && Main.mouseRightRelease && CalamityUtils.MouseHitbox.Intersects(npc.Hitbox) && initialClickDelay > 25f; + + // Reset the spawn rate speed-up after the wave is over. + if (Main.netMode != NetmodeID.MultiplayerClient && DD2Event.TimeLeftBetweenWaves > 1 && enemySpawnRateSpeedup != 0f) + { + enemySpawnRateSpeedup = 0f; + npc.netUpdate = true; + } + + if (clickingOnCrystal && npc.WithinRange(Main.LocalPlayer.Center, 285f)) + { + bool changeOccured = false; + + // If the event is waiting for time to pass and a player clicks on the crystal skip the wait. + if (DD2Event.TimeLeftBetweenWaves > 1) + { + DD2Event.TimeLeftBetweenWaves = 1; + if (Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.CrystalInvasionSendWaitTime, -1, -1, null, DD2Event.TimeLeftBetweenWaves); + changeOccured = true; + } + + // Otherwise speed up the portal spawn rate for this wave. + else + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int oldSpawnRate = DD2EventEnemySpawnRate; + enemySpawnRateSpeedup += 8f; + + // Release a circle of dust if a change was made to show that changes are indeed being done + // since the animation might be ongoing when this action is performed. + if (!Main.dedServ && oldSpawnRate != DD2EventEnemySpawnRate) + { + for (int i = 0; i < 55; i++) + { + for (float speed = 6f; speed < 13f; speed += 4f) + { + Vector2 shootDirection = (MathHelper.TwoPi * i / 55f).ToRotationVector2() * new Vector2(1f, 0.6f); + Dust etherealLight = Dust.NewDustPerfect(npc.Center - Vector2.UnitY * 20f + shootDirection * 12f, 264); + etherealLight.velocity = shootDirection * speed; + etherealLight.fadeIn = 0f; + etherealLight.scale = 2.3f; + etherealLight.noGravity = true; + etherealLight.noLight = true; + } + } + changeOccured = true; + } + npc.netUpdate = true; + } + } + + // Play an animation to accompany the change. + if (changeOccured) + { + if (animationCountdown <= 0f) + animationCountdown = 120f; + Main.PlaySound(SoundID.DD2_DarkMageHealImpact); + } + + // As well as some indicator text. + if (changeOccured) + { + bool dramaticText = DD2EventEnemySpawnRate <= 25; + Color textColor = dramaticText ? Color.DeepPink : Color.Pink; + string[] potentialTexts = new string[] + { + "The invasion hastens!", + "The ethereal invaders march ever-faster!" + }; + CombatText.NewText(npc.Hitbox, textColor, Main.rand.Next(potentialTexts), dramaticText); + } + } + } + #endregion DD2 Event AIs } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 4b45165340..a6c2a82564 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5,6 +5,9 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; @@ -20,12 +23,17 @@ using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; @@ -35,10 +43,8 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -54,8 +60,8 @@ using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.GameContent.Events; +using Terraria.Graphics.Effects; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -81,17 +87,47 @@ namespace CalamityMod.NPCs public Dictionary flatDRReductions = new Dictionary(); public Dictionary multDRReductions = new Dictionary(); + /// + /// Allows hostile NPCs to deal damage to the player's defense stat, used mostly for hard-hitting bosses. + /// + public bool canBreakPlayerDefense = false; + + // Total defense loss from some true melee hits and other things that reduce defense + public int miscDefenseLoss = 0; + + // Distance values for when bosses increase velocity to catch up to their target + public const float CatchUpDistance200Tiles = 3200f; + public const float CatchUpDistance350Tiles = 5600f; + + // Boss Zen distance + private const float BossZenDistance = 6400f; + + // Boss contact and projectile damage multiplier in Malice Mode + public const double MaliceModeDamageMultiplier = 1.35; + + // Variable used to nerf desert prehardmode enemies pre-Desert Scourge + private const double DesertEnemyStatMultiplier = 0.75; + // Max velocity used in contact damage scaling public float maxVelocity = 0f; + // Dash damage immunity timer + public const int maxPlayerImmunities = Main.maxPlayers + 1; + public int[] dashImmunityTime = new int[maxPlayerImmunities]; + // Town NPC shop alert animation variables public int shopAlertAnimTimer = 0; public int shopAlertAnimFrame = 0; + // Rage interactions + public bool DoesNotGenerateRage = false; + // NewAI internal const int maxAIMod = 4; public float[] newAI = new float[maxAIMod]; public int AITimer = 0; + public int AIIncreasedAggressionTimer = 0; + public float killTimeRatio_IncreasedAggression = 0f; // Town NPC Patreon public bool setNewName = true; @@ -99,6 +135,13 @@ namespace CalamityMod.NPCs // Draedons Remote public static bool DraedonMayhem = false; + // Stuff used by the Boss Health UI + public bool SplittingWorm = false; + + // Timer for how long an NPC is immune to certain debuffs + public const int slowingDebuffResistanceMin = 1800; + public int debuffResistanceTimer = 0; + // Debuffs public int vaporfied = 0; public int timeSlow = 0; @@ -116,7 +159,7 @@ namespace CalamityMod.NPCs public int wCleave = 0; public int bBlood = 0; public int dFlames = 0; - public int marked = 0; + public int marked = 0; public int irradiated = 0; public int bFlames = 0; public int hFlames = 0; @@ -138,9 +181,14 @@ namespace CalamityMod.NPCs public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; public int GaussFluxTimer = 0; + public int sagePoisonTime = 0; + public int sagePoisonDamage = 0; + public int vulnerabilityHex = 0; + public int banishingFire = 0; // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; + public static int DD2CrystalIndex = -1; public static int hiveMind = -1; public static int perfHive = -1; public static int slimeGodPurple = -1; @@ -174,82 +222,98 @@ namespace CalamityMod.NPCs public static int SCalCatastrophe = -1; public static int SCal = -1; public static int SCalWorm = -1; + public static int draedonExoMechWorm = -1; + public static int draedonExoMechTwinRed = -1; + public static int draedonExoMechTwinGreen = -1; + public static int draedonExoMechPrime = -1; + public static int adultEidolonWyrmHead = -1; + + // Drawing variables. + public FireParticleSet VulnerabilityHexFireDrawer = null; + + // Boss Enrage variable for use with the boss health UI. + // The logic behind this is as follows: + // 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player. + // 2 - Otherwise, check if the demonshade enrage is active. If it is, register this as true. If not, go to step 3. + // 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4. + // 4 - Check if malice is active and Boss Rush isn't. If so, set this to true. + public bool CurrentlyEnraged; // Collections public static SortedDictionary BossRushHPChanges = new SortedDictionary { // Tier 1 - { NPCID.QueenBee, 3150000 }, // 30 seconds + { NPCID.QueenBee, 315000 }, // 30 seconds - { NPCID.BrainofCthulhu, 1000000 }, // 30 seconds with creepers - { NPCID.Creeper, 100000 }, + { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers + { NPCID.Creeper, 10000 }, - { NPCID.KingSlime, 3000000 }, // 30 seconds - { NPCID.BlueSlime, 36000 }, - { NPCID.SlimeSpiked, 72000 }, - { NPCID.GreenSlime, 27000 }, - { NPCID.RedSlime, 54000 }, - { NPCID.PurpleSlime, 72000 }, - { NPCID.YellowSlime, 63000 }, - { NPCID.IceSlime, 45000 }, - { NPCID.UmbrellaSlime, 54000 }, - { NPCID.RainbowSlime, 300000 }, - { NPCID.Pinky, 150000 }, + { NPCID.KingSlime, 300000 }, // 30 seconds + { NPCID.BlueSlime, 3600 }, + { NPCID.SlimeSpiked, 7200 }, + { NPCID.GreenSlime, 2700 }, + { NPCID.RedSlime, 5400 }, + { NPCID.PurpleSlime, 7200 }, + { NPCID.YellowSlime, 6300 }, + { NPCID.IceSlime, 4500 }, + { NPCID.UmbrellaSlime, 5400 }, + { NPCID.RainbowSlime, 30000 }, + { NPCID.Pinky, 15000 }, - { NPCID.EyeofCthulhu, 4500000 }, // 30 seconds - { NPCID.ServantofCthulhu, 60000 }, + { NPCID.EyeofCthulhu, 450000 }, // 30 seconds + { NPCID.ServantofCthulhu, 6000 }, - { NPCID.SkeletronPrime, 1100000 }, // 30 seconds - { NPCID.PrimeVice, 540000 }, - { NPCID.PrimeCannon, 450000 }, - { NPCID.PrimeSaw, 450000 }, - { NPCID.PrimeLaser, 380000 }, + { NPCID.SkeletronPrime, 110000 }, // 30 seconds + { NPCID.PrimeVice, 54000 }, + { NPCID.PrimeCannon, 45000 }, + { NPCID.PrimeSaw, 45000 }, + { NPCID.PrimeLaser, 38000 }, - { NPCID.Golem, 500000 }, // 30 seconds - { NPCID.GolemHead, 300000 }, - { NPCID.GolemHeadFree, 300000 }, - { NPCID.GolemFistLeft, 250000 }, - { NPCID.GolemFistRight, 250000 }, + { NPCID.Golem, 50000 }, // 30 seconds + { NPCID.GolemHead, 30000 }, + { NPCID.GolemHeadFree, 30000 }, + { NPCID.GolemFistLeft, 25000 }, + { NPCID.GolemFistRight, 25000 }, - { NPCID.EaterofWorldsHead, 15000000 }, // 30 seconds - { NPCID.EaterofWorldsBody, 15000000 }, - { NPCID.EaterofWorldsTail, 15000000 }, + { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start + { NPCID.EaterofWorldsBody, 10000 }, + { NPCID.EaterofWorldsTail, 10000 }, // Tier 2 - { NPCID.TheDestroyer, 2500000 }, // 30 seconds + immunity timer at start - { NPCID.TheDestroyerBody, 2500000 }, - { NPCID.TheDestroyerTail, 2500000 }, - { NPCID.Probe, 100000 }, + { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start + { NPCID.TheDestroyerBody, 250000 }, + { NPCID.TheDestroyerTail, 250000 }, + { NPCID.Probe, 10000 }, - { NPCID.Spazmatism, 1500000 }, // 30 seconds - { NPCID.Retinazer, 1250000 }, + { NPCID.Spazmatism, 150000 }, // 30 seconds + { NPCID.Retinazer, 125000 }, - { NPCID.WallofFlesh, 4500000 }, // 30 seconds - { NPCID.WallofFleshEye, 4500000 }, + { NPCID.WallofFlesh, 450000 }, // 30 seconds + { NPCID.WallofFleshEye, 450000 }, - { NPCID.SkeletronHead, 1600000 }, // 30 seconds - { NPCID.SkeletronHand, 600000 }, + { NPCID.SkeletronHead, 160000 }, // 30 seconds + { NPCID.SkeletronHand, 60000 }, // Tier 3 - { NPCID.CultistBoss, 2200000 }, // 30 seconds - { NPCID.CultistDragonHead, 600000 }, - { NPCID.CultistDragonBody1, 600000 }, - { NPCID.CultistDragonBody2, 600000 }, - { NPCID.CultistDragonBody3, 600000 }, - { NPCID.CultistDragonBody4, 600000 }, - { NPCID.CultistDragonTail, 600000 }, - { NPCID.AncientCultistSquidhead, 500000 }, + { NPCID.CultistBoss, 220000 }, // 30 seconds + { NPCID.CultistDragonHead, 60000 }, + { NPCID.CultistDragonBody1, 60000 }, + { NPCID.CultistDragonBody2, 60000 }, + { NPCID.CultistDragonBody3, 60000 }, + { NPCID.CultistDragonBody4, 60000 }, + { NPCID.CultistDragonTail, 60000 }, + { NPCID.AncientCultistSquidhead, 50000 }, - { NPCID.Plantera, 1600000 }, // 30 seconds - { NPCID.PlanterasTentacle, 400000 }, + { NPCID.Plantera, 160000 }, // 30 seconds + { NPCID.PlanterasTentacle, 40000 }, // Tier 4 - { NPCID.DukeFishron, 2900000 }, // 30 seconds + { NPCID.DukeFishron, 290000 }, // 30 seconds - { NPCID.MoonLordCore, 1600000 }, // 1 minute - { NPCID.MoonLordHand, 450000 }, - { NPCID.MoonLordHead, 600000 }, - { NPCID.MoonLordLeechBlob, 8000 } + { NPCID.MoonLordCore, 160000 }, // 1 minute + { NPCID.MoonLordHand, 45000 }, + { NPCID.MoonLordHead, 60000 }, + { NPCID.MoonLordLeechBlob, 800 } // 8 minutes in total for vanilla Boss Rush bosses }; @@ -263,10 +327,9 @@ namespace CalamityMod.NPCs { NPCID.MoonLordCore, Item.buyPrice(0, 30) } }; - /// - /// Lists of enemies that resist piercing to some extent (mostly worms). - /// Could prove useful for other things as well. - /// + // Lists of enemies that resist piercing to some extent (mostly worms). + // Could prove useful for other things as well. + public static List AstrumDeusIDs = new List { NPCType(), @@ -274,6 +337,16 @@ namespace CalamityMod.NPCs NPCType() }; + public static List DevourerOfGodsIDs = new List + { + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + public static List CosmicGuardianIDs = new List { NPCType(), @@ -316,6 +389,19 @@ namespace CalamityMod.NPCs NPCID.EaterofWorldsTail }; + public static List DeathModeSplittingWormIDs = new List + { + NPCID.DuneSplicerHead, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.DiggerHead, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.SeekerHead, + NPCID.SeekerBody, + NPCID.SeekerTail + }; + public static List DestroyerIDs = new List { NPCID.TheDestroyer, @@ -323,6 +409,23 @@ namespace CalamityMod.NPCs NPCID.TheDestroyerTail }; + public static List ThanatosIDs = new List + { + NPCType(), + NPCType(), + NPCType(), + NPCType() + }; + + public static List SkeletronPrimeIDs = new List + { + NPCID.SkeletronPrime, + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice + }; + public static List StormWeaverIDs = new List { NPCType(), @@ -380,7 +483,11 @@ namespace CalamityMod.NPCs NPCID.PirateCrossbower, NPCID.PirateDeadeye, NPCID.PirateCaptain, + NPCID.SnowmanGangsta, + NPCID.SnowBalla, NPCID.DrManFly, + NPCID.Eyezor, + NPCID.Nailhead, NPCID.MartianWalker, NPCID.MartianTurret, NPCID.ElfCopter, @@ -392,7 +499,164 @@ namespace CalamityMod.NPCs NPCID.MartianSaucerCannon, NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, - NPCID.Probe + NPCID.Probe, + NPCID.CultistBoss, + NPCID.GolemHeadFree, + NPCID.MoonLordFreeEye, + //NPCID.BloodSquid, + NPCID.PlanterasHook + }; + + // Reduce contact damage by 25% + public static List HardmodeNPCNerfList = new List + { + NPCID.AnglerFish, + NPCID.AngryTrapper, + NPCID.Arapaima, + NPCID.BlackRecluse, + NPCID.BlackRecluseWall, + NPCID.BloodJelly, + NPCID.FungoFish, + NPCID.GreenJellyfish, + NPCID.Clinger, + NPCID.ArmoredSkeleton, + NPCID.ArmoredViking, + NPCID.Mummy, + NPCID.DarkMummy, + NPCID.LightMummy, + NPCID.BloodFeeder, + NPCID.DesertBeast, + NPCID.ChaosElemental, + //NPCID.BloodMummy, + NPCID.CorruptSlime, + NPCID.Slimeling, + NPCID.Corruptor, + NPCID.Crimslime, + NPCID.BigCrimslime, + NPCID.LittleCrimslime, + NPCID.CrimsonAxe, + NPCID.CursedHammer, + NPCID.Derpling, + NPCID.Herpling, + NPCID.DiggerHead, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.DesertGhoul, + NPCID.DesertGhoulCorruption, + NPCID.DesertGhoulCrimson, + NPCID.DesertGhoulHallow, + NPCID.DuneSplicerHead, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.EnchantedSword, + NPCID.FloatyGross, + NPCID.GiantBat, + NPCID.GiantFlyingFox, + NPCID.GiantFungiBulb, + NPCID.FungiSpore, + NPCID.GiantTortoise, + NPCID.IceTortoise, + NPCID.HoppinJack, + NPCID.Mimic, + NPCID.IchorSticker, + NPCID.IcyMerman, + NPCID.IlluminantBat, + NPCID.IlluminantSlime, + NPCID.JungleCreeper, + NPCID.JungleCreeperWall, + NPCID.DesertLamiaDark, + NPCID.DesertLamiaLight, + NPCID.BigMossHornet, + NPCID.GiantMossHornet, + NPCID.LittleMossHornet, + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.Moth, + NPCID.PigronCorruption, + NPCID.PigronCrimson, + NPCID.PigronHallow, + NPCID.Pixie, + NPCID.PossessedArmor, + //NPCID.RockGolem, + NPCID.DesertScorpionWalk, + NPCID.DesertScorpionWall, + NPCID.Slimer, + NPCID.Slimer2, + NPCID.ToxicSludge, + NPCID.Unicorn, + NPCID.WanderingEye, + NPCID.Werewolf, + NPCID.Wolf, + NPCID.SeekerHead, + NPCID.SeekerBody, + NPCID.SeekerTail, + NPCID.Wraith, + NPCID.ChatteringTeethBomb, + NPCID.Clown, + NPCID.AngryNimbus, + NPCID.IceGolem, + NPCID.RainbowSlime, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + NPCID.ShadowFlameApparition, + NPCID.Parrot, + NPCID.PirateCorsair, + NPCID.PirateDeckhand, + //NPCID.PiratesCurse, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBonesSword, + NPCID.BoneLee, + NPCID.DungeonSpirit, + NPCID.FlyingSnake, + NPCID.HellArmoredBones, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBonesSword, + NPCID.MisterStabby, + NPCID.SnowBalla, + NPCID.SnowmanGangsta, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.DeadlySphere, + NPCID.Frankenstein, + NPCID.Fritz, + NPCID.Psycho, + NPCID.Reaper, + NPCID.SwampThing, + NPCID.ThePossessed, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.HeadlessHorseman, + NPCID.Hellhound, + NPCID.Poltergeist, + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.Splinterling, + NPCID.Flocko, + NPCID.GingerbreadMan, + NPCID.Krampus, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.PresentMimic, + NPCID.Yeti, + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl + //NPCID.BloodEelHead, + //NPCID.BloodEelBody, + //NPCID.BloodEelTail, + //NPCID.HemogoblinShark, + //NPCID.WanderingEyeFish, + //NPCID.ZombieMerman, }; #endregion @@ -427,7 +691,8 @@ namespace CalamityMod.NPCs for (int i = 0; i < bobbitWormBottom.Length; i++) ResetSavedIndex(ref bobbitWormBottom[i], NPCType()); - ResetSavedIndex(ref hiveMind, NPCType(), NPCType()); + ResetSavedIndex(ref DD2CrystalIndex, NPCID.DD2EterniaCrystal); + ResetSavedIndex(ref hiveMind, NPCType()); ResetSavedIndex(ref perfHive, NPCType()); ResetSavedIndex(ref slimeGodPurple, NPCType(), NPCType()); ResetSavedIndex(ref slimeGodRed, NPCType(), NPCType()); @@ -461,8 +726,18 @@ namespace CalamityMod.NPCs ResetSavedIndex(ref SCal, NPCType()); ResetSavedIndex(ref SCalWorm, NPCType()); - CalamityGlobalTownNPC.ResetTownNPCNameBools(npc, mod); - } + ResetSavedIndex(ref draedonExoMechWorm, NPCType()); + ResetSavedIndex(ref draedonExoMechTwinRed, NPCType()); + ResetSavedIndex(ref draedonExoMechTwinGreen, NPCType()); + ResetSavedIndex(ref draedonExoMechPrime, NPCType()); + + ResetSavedIndex(ref adultEidolonWyrmHead, NPCType()); + + CalamityGlobalTownNPC.ResetTownNPCNameBools(npc, mod); + + // Reset the enraged state every frame. The expectation is that bosses will continuously set it back to true if necessary. + CurrentlyEnraged = false; + } #endregion #region Life Regen @@ -475,19 +750,15 @@ namespace CalamityMod.NPCs if (CalamityWorld.abyssSide) { if ((double)(npc.position.X / 16f) < abyssChasmX + 80) - { abyssPosX = true; - } } else { if ((double)(npc.position.X / 16f) > abyssChasmX - 80) - { abyssPosX = true; - } } - bool inAbyss = ((npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && ((double)(npc.position.Y / 16f) <= Main.maxTilesY - 250) && abyssPosX) || CalamityWorld.abyssTiles > 200; + bool inAbyss = (npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && ((double)(npc.position.Y / 16f) <= Main.maxTilesY - 250) && abyssPosX; bool hurtByAbyss = npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && inAbyss && !npc.buffImmune[BuffType()]; if (hurtByAbyss) { @@ -500,22 +771,16 @@ namespace CalamityMod.NPCs !npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[BuffType()]) { if (npc.wet) - { npc.AddBuff(BuffID.Poisoned, 2); - } if (Main.raining) - { npc.AddBuff(BuffType(), 2); - } } if (npc.venom) { if (npc.lifeRegen > 0) - { npc.lifeRegen = 0; - } int projectileCount = 0; for (int j = 0; j < Main.maxProjectiles; j++) @@ -533,25 +798,20 @@ namespace CalamityMod.NPCs npc.lifeRegen -= projectileCount * 30; if (damage < projectileCount * 6) - { damage = projectileCount * 6; - } } } if (npc.javelined) { if (npc.lifeRegen > 0) - { npc.lifeRegen = 0; - } int projectileCount = 0; for (int j = 0; j < Main.maxProjectiles; j++) { - if (Main.projectile[j].active && - (Main.projectile[j].type == ProjectileType() && - Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI)) + if (Main.projectile[j].active && Main.projectile[j].type == ProjectileType() && + Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI) { projectileCount++; } @@ -562,21 +822,20 @@ namespace CalamityMod.NPCs npc.lifeRegen -= projectileCount * 20; if (damage < projectileCount * 4) - { damage = projectileCount * 4; - } } } if (shellfishVore > 0) { int projectileCount = 0; + int owner = 255; for (int j = 0; j < Main.maxProjectiles; j++) { - if (Main.projectile[j].active && - (Main.projectile[j].type == ProjectileType()) && + if (Main.projectile[j].active && Main.projectile[j].type == ProjectileType() && Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI) { + owner = Main.projectile[j].owner; projectileCount++; if (projectileCount >= 5) { @@ -586,7 +845,28 @@ namespace CalamityMod.NPCs } } - ApplyDPSDebuff(shellfishVore, projectileCount * 250, projectileCount * 50, ref npc.lifeRegen, ref damage); + Item heldItem = Main.player[owner].ActiveItem(); + int totalDamage = (int)(150 * Main.player[owner].minionDamage); + 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); + + double summonNerfMult = reducedNerf ? 0.75 : 0.5; + if (!Main.player[owner].Calamity().profanedCrystalBuffs) + { + if (heldItem.type > ItemID.None) + { + if (!heldItem.summon && + (heldItem.melee || heldItem.ranged || heldItem.magic || heldItem.Calamity().rogue) && + heldItem.hammer == 0 && heldItem.pick == 0 && heldItem.axe == 0 && heldItem.useStyle != 0 && + !heldItem.accessory && heldItem.ammo == AmmoID.None) + { + totalDamage = (int)(totalDamage * summonNerfMult); + } + } + } + + int totalDisplayedDamage = totalDamage / 5; + ApplyDPSDebuff(shellfishVore, projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); } if (clamDebuff > 0) @@ -609,33 +889,23 @@ namespace CalamityMod.NPCs if (cDepth > 0) { if (npc.defense < 0) - { npc.defense = 0; - } - int depthDamage = Main.hardMode ? 80 : 12; + int depthDamage = Main.hardMode ? 36 : 12; if (hurtByAbyss) - { depthDamage = 300; - } int calcDepthDamage = depthDamage - npc.defense; if (calcDepthDamage < 0) - { calcDepthDamage = 0; - } if (npc.lifeRegen > 0) - { npc.lifeRegen = 0; - } npc.lifeRegen -= calcDepthDamage * 5; if (damage < calcDepthDamage) - { damage = calcDepthDamage; - } } if (irradiated > 0) @@ -651,42 +921,49 @@ namespace CalamityMod.NPCs } if (projectileCount > 0) - { ApplyDPSDebuff(irradiated, projectileCount * 20, projectileCount * 4, ref npc.lifeRegen, ref damage); - } else - { ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage); + } + + // Exo Freeze, Glacial State and Temporal Sadness don't work on normal/expert Queen Bee. + if (debuffResistanceTimer <= 0 || (debuffResistanceTimer > slowingDebuffResistanceMin)) + { + if (npc.type != NPCID.QueenBee || CalamityWorld.revenge || CalamityWorld.malice || BossRushEvent.BossRushActive) + { + if (eFreeze > 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + npc.velocity.X *= 0.5f; + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 15f) + npc.velocity.Y = 15f; + } + else + npc.velocity *= 0.5f; + } + else if (gState > 0) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + npc.velocity.X *= 0.5f; + npc.velocity.Y += 0.05f; + if (npc.velocity.Y > 15f) + npc.velocity.Y = 15f; + } + else + npc.velocity *= 0.5f; + } + else if (tSad > 0) + npc.velocity *= 0.5f; } - } + } - // Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies. - if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type)) - { - if (eFreeze > 0 && !CalamityWorld.bossRushActive) - { - npc.velocity.X = 0f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 15f) - npc.velocity.Y = 15f; - } - else if (gState > 0) - { - npc.velocity.X = 0f; - npc.velocity.Y += 0.05f; - if (npc.velocity.Y > 15f) - npc.velocity.Y = 15f; - } - if (tSad > 0) - { - npc.velocity /= 2f; - } - } - - //Oiled debuff makes flame debuffs 25% more effective + // Oiled debuff makes flame debuffs 25% more effective if (npc.oiled) { - int oiledDoT = (bFlames > 0 ? 10 : 0) + (hFlames > 0 ? 13 : 0) + (gsInferno > 0 ? 63 : 0) + (aFlames > 0 ? 32 : 0) + (dFlames > 0 ? 625 : 0); + int oiledDoT = (bFlames > 0 ? 10 : 0) + (hFlames > 0 ? 13 : 0) + (gsInferno > 0 ? 63 : 0) + (aFlames > 0 ? 32 : 0) + (dFlames > 0 ? 625 : 0) + (banishingFire > 0 ? 375 : 0); if (oiledDoT > 0) { int lifeRegenValue = oiledDoT * 4 + 12; @@ -707,13 +984,22 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(pShred, 1500, 300, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); - ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(vulnerabilityHex, 6660, 666, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(kamiFlu, 250, 25, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); - if (npc.velocity.X == 0) - ApplyDPSDebuff(electrified, 10, 2, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(sagePoisonTime, 90, npc.Calamity().sagePoisonDamage, ref npc.lifeRegen, ref damage); + + int electrifiedDamage = CalamityPlayer.areThereAnyDamnBosses ? 5 : 10; + int displayedValue = electrifiedDamage / 5; + if (npc.velocity.X == 0) + ApplyDPSDebuff(electrified, electrifiedDamage, displayedValue, ref npc.lifeRegen, ref damage); else - ApplyDPSDebuff(electrified, 40, 8, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(electrified, electrifiedDamage * 4, displayedValue * 4, ref npc.lifeRegen, ref damage); + if (npc.lifeMax < 1000000) // 2000 hp per second as minimum + ApplyDPSDebuff(banishingFire, 4000, 800, ref npc.lifeRegen, ref damage); + else // On big health enemies, do 0.2% hp per second + ApplyDPSDebuff(banishingFire, npc.lifeMax / 500, npc.lifeMax / 2500, ref npc.lifeRegen, ref damage); } public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -721,16 +1007,12 @@ namespace CalamityMod.NPCs if (debuff > 0) { if (lifeRegen > 0) - { lifeRegen = 0; - } lifeRegen -= lifeRegenValue; if (damage < damageValue) - { damage = damageValue; - } } } #endregion @@ -738,10 +1020,11 @@ namespace CalamityMod.NPCs #region Set Defaults public override void SetDefaults(NPC npc) { - for (int m = 0; m < maxAIMod; m++) - { + for (int i = 0; i < maxPlayerImmunities; i++) + dashImmunityTime[i] = 0; + + for (int m = 0; m < maxAIMod; m++) newAI[m] = 0f; - } // Apply DR to vanilla NPCs. // This also applies DR to other mods' NPCs who have set up their NPCs to have DR. @@ -757,69 +1040,64 @@ namespace CalamityMod.NPCs KillTime = revKillTime; } - if (npc.boss && CalamityWorld.revenge) - { - if (npc.type != NPCType() && npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - ((npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) && npc.Calamity().newAI[0] != 0f)) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.LocalPlayer.dead && Main.LocalPlayer.active) - { - Main.LocalPlayer.Calamity().adrenaline = 0; - } - } - } - } + // Fixing more red mistakes + if (npc.type == NPCID.WallofFleshEye) + npc.netAlways = true; - DebuffImmunities(npc); + sagePoisonDamage = 0; + if (npc.type == NPCID.Golem && (CalamityWorld.revenge || CalamityWorld.malice)) + npc.noGravity = true; - if (CalamityWorld.bossRushActive) - { + DeclareBossHealthUIVariables(npc); + DebuffImmunities(npc); + + if (BossRushEvent.BossRushActive) BossRushStatChanges(npc, mod); - } BossValueChanges(npc); - if (CalamityWorld.defiled) - { - npc.value = (int)(npc.value * 1.5); - } - if (DraedonMayhem) - { DraedonMechaMayhemStatChanges(npc); - } if (CalamityWorld.revenge) - { - RevengeanceStatChanges(npc, mod); - } + RevDeathStatChanges(npc, mod); OtherStatChanges(npc); } - #endregion + #endregion - #region Debuff Immunities - private void DebuffImmunities(NPC npc) + #region Boss Health UI Variable Setting + public void DeclareBossHealthUIVariables(NPC npc) + { + if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + SplittingWorm = true; + } + #endregion + + #region Debuff Immunities + private void DebuffImmunities(NPC npc) { - if (CalamityMod.enemyImmunityList.Contains(npc.type) || npc.boss) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffID.Webbed] = true; - npc.buffImmune[BuffID.Slow] = true; - } + // Check out NPCDebuffs.cs as this function sets the debuff immunities for all enemies in Cal bar the ones described below. + npc.SetNPCDebuffImmunities(); - if (DestroyerIDs.Contains(npc.type) || (EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC || npc.type == NPCID.SpikeBall || npc.type == NPCID.BlazingWheel) + // All bosses and several enemies are automatically immune to Pearl Aura. + if (CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) + npc.buffImmune[BuffType()] = true; + + // All enemies are automatically immune to the Confused debuff, so we must specifically set them not to be. + // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). + if (CalamityLists.confusionEnemyList.Contains(npc.type)) + npc.buffImmune[BuffID.Confused] = false; + + // Any enemy not immune to Venom shouldn't be immune to Sulphuric Poisoning as it is an upgrade. + if (!npc.buffImmune[BuffID.Venom]) + npc.buffImmune[BuffType()] = false; + + // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. + if (((DesertScourgeIDs.Contains(npc.type) || npc.type == NPCID.Creeper || PerforatorIDs.Contains(npc.type)) && CalamityWorld.malice) || + DestroyerIDs.Contains(npc.type) || npc.type == NPCID.SkeletronHead || npc.type == NPCID.SpikeBall || npc.type == NPCID.BlazingWheel || + (EaterofWorldsIDs.Contains(npc.type) && (BossRushEvent.BossRushActive || CalamityWorld.malice)) || + npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) { for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -835,14 +1113,16 @@ namespace CalamityMod.NPCs } } - if (!npc.buffImmune[BuffID.Venom]) - { - npc.buffImmune[BuffType()] = false; - } - + // Most bosses and boss servants are not immune to Kami Flu. if (YanmeisKnifeSlash.CanRecieveCoolEffectsFrom(npc)) npc.buffImmune[BuffType()] = false; + + // Nothing should be immune to Enraged. npc.buffImmune[BuffType()] = false; + + // Extra Notes: + // Shellfish minions set debuff immunity to Shellfish Claps on enemy hits, so most things are technically not immune. + // The Spiteful Candle sets the debuff immunity of Spite to all nearby enemies in the tile file for an enemy with less than 99% DR. } #endregion @@ -852,18 +1132,7 @@ namespace CalamityMod.NPCs if (!npc.friendly) { npc.buffImmune[BuffType()] = false; - - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffID.Webbed] = true; - npc.buffImmune[BuffID.Slow] = true; } foreach (KeyValuePair BossRushHPChange in BossRushHPChanges) @@ -910,7 +1179,7 @@ namespace CalamityMod.NPCs break; case NPCID.SkeletronPrime: - npc.lifeMax = (int)(npc.lifeMax * 1.9); + npc.lifeMax = (int)(npc.lifeMax * 1.45); npc.npcSlots = 12f; break; @@ -918,7 +1187,7 @@ namespace CalamityMod.NPCs case NPCID.PrimeCannon: case NPCID.PrimeSaw: case NPCID.PrimeLaser: - npc.lifeMax = (int)(npc.lifeMax * 1.05); + npc.lifeMax = (int)(npc.lifeMax * 0.8); break; case NPCID.Retinazer: @@ -930,11 +1199,17 @@ namespace CalamityMod.NPCs } #endregion - #region Revengeance Stat Changes - private void RevengeanceStatChanges(NPC npc, Mod mod) + #region Revengeance and Death Mode Stat Changes + private void RevDeathStatChanges(NPC npc, Mod mod) { npc.value = (int)(npc.value * 1.5); + if (DeathModeSplittingWormIDs.Contains(npc.type)) + { + if (CalamityWorld.death) + npc.lifeMax = (int)(npc.lifeMax * 0.5); + } + if (npc.type == NPCID.Mothron) { npc.scale = 1.25f; @@ -954,7 +1229,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.DukeFishron) { - npc.lifeMax = (int)(npc.lifeMax * 1.85); + npc.lifeMax = (int)(npc.lifeMax * 1.95); npc.npcSlots = 20f; } else if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) @@ -968,30 +1243,26 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.GolemHead) { - npc.lifeMax = (int)(npc.lifeMax * 1.5); + npc.lifeMax = (int)(npc.lifeMax * 1.5); } else if (npc.type == NPCID.GolemHeadFree) { - npc.lifeMax = (int)(npc.lifeMax * 1.25); + npc.lifeMax = (int)(npc.lifeMax * 1.7); + npc.width = 88; + npc.height = 90; npc.dontTakeDamage = false; } else if (npc.type == NPCID.Plantera) { - npc.lifeMax = (int)(npc.lifeMax * 2.3); + npc.lifeMax = (int)(npc.lifeMax * 3.0); npc.npcSlots = 32f; } - else if (npc.type == NPCID.PlanterasHook) - { - npc.damage = npc.defDamage = 0; - } else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) { npc.lifeMax = (int)(npc.lifeMax * 1.9); if (npc.type == NPCID.WallofFlesh) - { npc.npcSlots = 20f; - } } else if (npc.type == NPCID.TheHungryII || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail) { @@ -999,18 +1270,30 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.SkeletronHead) { - npc.lifeMax = (int)(npc.lifeMax * 1.25); - npc.npcSlots = 12f; + if (CalamityWorld.death) + npc.lifeMax = (int)(npc.lifeMax * 0.5); + else + npc.lifeMax = (int)(npc.lifeMax * 0.75); + + npc.npcSlots = 12f; } else if (npc.type == NPCID.SkeletronHand) { - npc.lifeMax = (int)(npc.lifeMax * 0.75); - } + if (CalamityWorld.death) + npc.lifeMax = (int)(npc.lifeMax * 0.65); + else + npc.lifeMax = (int)(npc.lifeMax * 0.9); + } else if (npc.type == NPCID.QueenBee) { - npc.lifeMax = (int)(npc.lifeMax * 1.15); + npc.lifeMax = (int)(npc.lifeMax * 1.2); npc.npcSlots = 14f; } + else if ((npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall) && CalamityPlayer.areThereAnyDamnBosses) + { + npc.lifeMax = (int)(npc.lifeMax * 1.4); + npc.scale = 1.25f; + } else if (npc.type == NPCID.BrainofCthulhu) { npc.lifeMax = (int)(npc.lifeMax * 1.6); @@ -1025,15 +1308,21 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)(npc.lifeMax * 1.3); if (npc.type == NPCID.EaterofWorldsHead) - { npc.npcSlots = 10f; - } - } + + if (CalamityWorld.death) + npc.scale = 1.1f; + } else if (npc.type == NPCID.EyeofCthulhu) { - npc.lifeMax = (int)(npc.lifeMax * 1.25); + npc.lifeMax = (int)(npc.lifeMax * 1.3); npc.npcSlots = 10f; } + else if (npc.type == NPCID.KingSlime) + { + if (CalamityWorld.death) + npc.scale = 3f; + } else if (npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental) { npc.knockBackResist = 0f; @@ -1049,22 +1338,26 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.SkeletronPrime) { - npc.lifeMax = (int)(npc.lifeMax * 1.45); + npc.lifeMax = (int)(npc.lifeMax * 1.2); npc.npcSlots = 12f; } + else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) + { + npc.lifeMax = (int)(npc.lifeMax * 0.65); + } else if (npc.type == NPCID.Retinazer) - { - npc.lifeMax = (int)(npc.lifeMax * 1.25); - npc.npcSlots = 10f; - } - else if (npc.type == NPCID.Spazmatism) { npc.lifeMax = (int)(npc.lifeMax * 1.3); npc.npcSlots = 10f; } + else if (npc.type == NPCID.Spazmatism) + { + npc.lifeMax = (int)(npc.lifeMax * 1.35); + npc.npcSlots = 10f; + } } - if (CalamityMod.revengeanceLifeStealExceptionList.Contains(npc.type)) + if (CalamityLists.revengeanceLifeStealExceptionList.Contains(npc.type)) { npc.canGhostHeal = false; } @@ -1074,75 +1367,234 @@ namespace CalamityMod.NPCs #region Other Stat Changes private void OtherStatChanges(NPC npc) { - // Fix Sharkron hitboxes - if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) - { - npc.width = npc.height = 36; - } - - if (npc.type == NPCID.CultistBoss) - { - npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.revenge ? 2 : 1.2)); - npc.npcSlots = 20f; - } - else if (npc.type == NPCID.DungeonGuardian) + switch (npc.type) { - npc.lifeMax = (int)(npc.lifeMax * 0.1); + case NPCID.ArmedZombie: + case NPCID.ArmedZombieCenx: + case NPCID.ArmedZombieEskimo: + case NPCID.ArmedZombiePincussion: + case NPCID.ArmedZombieSlimed: + case NPCID.ArmedZombieSwamp: + case NPCID.ArmedZombieTwiggy: + case NPCID.KingSlime: + case NPCID.EyeofCthulhu: + case NPCID.BrainofCthulhu: + case NPCID.QueenBee: + case NPCID.EaterofSouls: + case NPCID.Crimera: + case NPCID.BigCrimera: + case NPCID.LittleCrimera: + case NPCID.Corruptor: + case NPCID.DevourerHead: + case NPCID.Crawdad: + case NPCID.Crawdad2: + case NPCID.ManEater: + case NPCID.AngryTrapper: + case NPCID.Snatcher: + case NPCID.SpikeBall: + case NPCID.DesertBeast: + case NPCID.BoneLee: + case NPCID.Paladin: + case NPCID.BigMimicCorruption: + case NPCID.BigMimicCrimson: + case NPCID.BigMimicHallow: + case NPCID.DiggerHead: + case NPCID.SeekerHead: + case NPCID.DuneSplicerHead: + case NPCID.SolarCrawltipedeHead: + case NPCID.Mimic: + case NPCID.SandShark: + case NPCID.SandsharkCorrupt: + case NPCID.SandsharkCrimson: + case NPCID.SandsharkHallow: + case NPCID.GoblinWarrior: + case NPCID.Butcher: + case NPCID.DeadlySphere: + case NPCID.Mothron: + case NPCID.Reaper: + case NPCID.Psycho: + case NPCID.PresentMimic: + case NPCID.Yeti: + case NPCID.NebulaBeast: + case NPCID.SolarCorite: + case NPCID.StardustWormHead: + case NPCID.EaterofWorldsHead: + case NPCID.SkeletronHead: + case NPCID.SkeletronHand: + case NPCID.WallofFlesh: + case NPCID.TheHungry: + case NPCID.TheHungryII: + case NPCID.Spazmatism: + case NPCID.Retinazer: + case NPCID.TheDestroyer: + case NPCID.TheDestroyerBody: + case NPCID.TheDestroyerTail: + case NPCID.SkeletronPrime: + case NPCID.PrimeVice: + case NPCID.PrimeSaw: + case NPCID.Plantera: + case NPCID.PlanterasTentacle: + case NPCID.Golem: + case NPCID.GolemFistLeft: + case NPCID.GolemFistRight: + case NPCID.CultistDragonHead: + case NPCID.AncientCultistSquidhead: + case NPCID.AncientLight: + case NPCID.DD2OgreT2: + case NPCID.DD2OgreT3: + case NPCID.DD2Betsy: + case NPCID.PumpkingBlade: + case NPCID.SantaNK1: + case NPCID.DukeFishron: + canBreakPlayerDefense = true; + break; + + // Reduce prehardmode desert enemy stats pre-Desert Scourge + case NPCID.WalkingAntlion: + if (!CalamityWorld.downedDesertScourge) + { + npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + npc.defense /= 2; + npc.defDefense = npc.defense; + } + canBreakPlayerDefense = true; + break; + + case NPCID.Antlion: + case NPCID.FlyingAntlion: + if (!CalamityWorld.downedDesertScourge) + { + npc.lifeMax = (int)(npc.lifeMax * DesertEnemyStatMultiplier); + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + npc.defense /= 2; + npc.defDefense = npc.defense; + } + break; + + // Reduce Dungeon Guardian HP + case NPCID.DungeonGuardian: + npc.lifeMax = (int)(npc.lifeMax * 0.1); + canBreakPlayerDefense = true; + break; + + // Reduce Tomb Crawler stats + case NPCID.TombCrawlerHead: + npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.downedDesertScourge ? 0.6 : 0.45)); + if (!CalamityWorld.downedDesertScourge) + { + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + // Tomb Crawler Head has 0 defense so there is no need to reduce it + } + canBreakPlayerDefense = true; + break; + + case NPCID.TombCrawlerBody: + case NPCID.TombCrawlerTail: + npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.downedDesertScourge ? 0.6 : 0.45)); + if (!CalamityWorld.downedDesertScourge) + { + npc.damage = (int)(npc.damage * DesertEnemyStatMultiplier); + npc.defDamage = npc.damage; + npc.defense /= 2; + npc.defDefense = npc.defense; + } + break; + + // Fix Sharkron hitboxes + case NPCID.Sharkron: + case NPCID.Sharkron2: + npc.width = npc.height = 36; + canBreakPlayerDefense = true; + break; + + // Make Core hitbox bigger + case NPCID.MartianSaucerCore: + npc.width *= 2; + npc.height *= 2; + break; + + // Increase Cultist HP + case NPCID.CultistBoss: + npc.lifeMax = (int)(npc.lifeMax * (CalamityWorld.revenge ? 2 : 1.2)); + npc.npcSlots = 20f; + break; + + // Nerf Green Jellyfish because they spawn in prehardmode + case NPCID.GreenJellyfish: + npc.damage = 40; + npc.defDamage = npc.damage; + npc.defense = 4; + npc.defDefense = npc.defense; + break; + + default: + break; } - if (npc.type >= NPCID.TombCrawlerHead && npc.type <= NPCID.TombCrawlerTail && !Main.hardMode) - { - npc.lifeMax = (int)(npc.lifeMax * 0.6); - } - - if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) + // Reduce mech boss HP and damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - npc.damage = 40; + if (!NPC.downedMechBossAny) + { + if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8); + npc.damage = (int)(npc.damage * 0.8); + npc.defDamage = npc.damage; + } + } + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + { + if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) + { + npc.lifeMax = (int)(npc.lifeMax * 0.9); + npc.damage = (int)(npc.damage * 0.9); + npc.defDamage = npc.damage; + } + } + } + + if (Main.hardMode && HardmodeNPCNerfList.Contains(npc.type)) + { + npc.damage = (int)(npc.damage * 0.75); npc.defDamage = npc.damage; - npc.defense = 4; - npc.defDefense = npc.defense; } - if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000 && npc.damage > 0) + if (CalamityWorld.downedDoG) { - npc.lifeMax = (int)(npc.lifeMax * 3.5); - npc.damage += 100; - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } - - if (CalamityWorld.downedDoG) - { - if (CalamityMod.pumpkinMoonBuffList.Contains(npc.type)) + if (CalamityLists.pumpkinMoonBuffList.Contains(npc.type)) { npc.lifeMax = (int)(npc.lifeMax * 7.5); - npc.damage += 160; + npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (CalamityMod.frostMoonBuffList.Contains(npc.type)) + else if (CalamityLists.frostMoonBuffList.Contains(npc.type)) { - npc.lifeMax = (int)(npc.lifeMax * 6.0); - npc.damage += 160; + npc.lifeMax = (int)(npc.lifeMax * 6D); + npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - } - - if (CalamityMod.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse) - { - npc.lifeMax = (int)(npc.lifeMax * 32.5); - npc.damage += 210; - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } + else if (CalamityLists.eclipseBuffList.Contains(npc.type)) + { + npc.lifeMax = (int)(npc.lifeMax * 10D); + npc.damage += 30; + npc.life = npc.lifeMax; + npc.defDamage = npc.damage; + } + } if (NPC.downedMoonlord) { - if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) + if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) { npc.lifeMax = (int)(npc.lifeMax * 2.5); - npc.damage += 150; + npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } @@ -1151,35 +1603,45 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge) { double damageMultiplier = 1D; - if (CalamityMod.revengeanceEnemyBuffList25Percent.Contains(npc.type)) + bool containsNPC = false; + if (CalamityLists.revengeanceEnemyBuffList25Percent.Contains(npc.type)) { damageMultiplier += 0.25; + containsNPC = true; } - else if (CalamityMod.revengeanceEnemyBuffList20Percent.Contains(npc.type)) + else if (CalamityLists.revengeanceEnemyBuffList20Percent.Contains(npc.type)) { damageMultiplier += 0.2; + containsNPC = true; } - else if (CalamityMod.revengeanceEnemyBuffList15Percent.Contains(npc.type)) + else if (CalamityLists.revengeanceEnemyBuffList15Percent.Contains(npc.type)) { damageMultiplier += 0.15; + containsNPC = true; } - else if (CalamityMod.revengeanceEnemyBuffList10Percent.Contains(npc.type)) + else if (CalamityLists.revengeanceEnemyBuffList10Percent.Contains(npc.type)) { damageMultiplier += 0.1; + containsNPC = true; } - else if (CalamityMod.revengeanceEnemyBuffList5Percent.Contains(npc.type)) + + if (containsNPC) { - damageMultiplier += 0.05; + if (CalamityWorld.death) + damageMultiplier += (damageMultiplier - 1D) * 0.6; + + npc.damage = (int)(npc.damage * damageMultiplier); + npc.defDamage = npc.damage; } + } - if (CalamityWorld.death) - damageMultiplier += (damageMultiplier - 1D) * 0.6; - - npc.damage = (int)(npc.damage * damageMultiplier); + if (npc.type < NPCID.Count && NPCStats.EnemyStats.ContactDamageValues.ContainsKey(npc.type)) + { + npc.GetNPCDamage(); npc.defDamage = npc.damage; } - if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || CalamityMod.bossHPScaleList.Contains(npc.type)) + if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || CalamityLists.bossHPScaleList.Contains(npc.type)) { double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -1256,48 +1718,46 @@ namespace CalamityMod.NPCs #region Scale Expert Multiplayer Stats public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) { - if (CalamityWorld.revenge) - { - ScaleThoriumBossHealth(npc, mod); - } - + // Do absolutely nothing in single player, or in multiplayer with only one player connected. if (Main.netMode == NetmodeID.SinglePlayer || numPlayers <= 1) - { return; - } - if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) || - (npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod"))) + 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; + + // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. + if (scalesLikeBoss || isCalamityNPC) { double scalar; - switch (numPlayers) //Decrease HP in multiplayer before vanilla scaling + switch (numPlayers) // Decrease HP in multiplayer before vanilla scaling { case 1: scalar = 1.0; break; case 2: - scalar = 0.76; + scalar = 0.82; // 1.64 break; case 3: - scalar = 0.63; + scalar = 0.72; // 2.16 break; case 4: - scalar = 0.525; + scalar = 0.64; // 2.56 break; case 5: - scalar = 0.43; + scalar = 0.57; // 2.85 break; case 6: - scalar = 0.36; + scalar = 0.52; // 3.12 break; default: - scalar = 0.295; + scalar = 0.47; // 3.29 + 0.47 per player beyond 7 break; } @@ -1306,126 +1766,13 @@ namespace CalamityMod.NPCs } #endregion - #region Scale Thorium Boss Health - private void ScaleThoriumBossHealth(NPC npc, Mod mod) - { - if (CalamityConfig.Instance.BuffThoriumBosses) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("Hatchling") || npc.type == thorium.NPCType("DistractJelly") || npc.type == thorium.NPCType("ViscountBaby") || - npc.type == thorium.NPCType("BoreanHopper") || npc.type == thorium.NPCType("BoreanMyte1") || npc.type == thorium.NPCType("EnemyBeholder") || - npc.type == thorium.NPCType("ThousandSoulPhalactry") || npc.type == thorium.NPCType("AbyssalSpawn")) - { - npc.lifeMax = (int)(npc.lifeMax * 1.5); - } - else if (npc.type == thorium.NPCType("TheGrandThunderBirdv2")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.5); - } - else if (npc.type == thorium.NPCType("QueenJelly")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.35); - } - else if (npc.type == thorium.NPCType("Viscount")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.25); - } - else if (npc.type == thorium.NPCType("GraniteEnergyStorm")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.1); - } - else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.2); - } - else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || - npc.type == thorium.NPCType("PyroCore")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.3); - } - else if (npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("BoreanStriderPopped")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.4); - } - else if (npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.6); - } - else if (npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.6); - } - else if (npc.type == thorium.NPCType("Abyssion") || npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.5); - } - else if (npc.type == thorium.NPCType("SlagFury") || npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || - npc.type == thorium.NPCType("Aquaius") || npc.type == thorium.NPCType("Aquaius2")) - { - npc.buffImmune[BuffType()] = true; - npc.buffImmune[BuffType()] = true; - - npc.lifeMax = (int)(npc.lifeMax * 1.3); - } - } - } - } - #endregion - #region Can Hit Player public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot) { - if (!npc.boss && !npc.friendly && !npc.dontTakeDamage) - { - if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon)) - { - cooldownSlot = 1; - } - - if (CalamityWorld.buffedEclipse && Main.eclipse) - { - cooldownSlot = 1; - } - } - if (target.Calamity().prismaticHelmet && !CalamityPlayer.areThereAnyDamnBosses) { if (npc.lifeMax < 500) - { return false; - } } return true; @@ -1435,25 +1782,27 @@ namespace CalamityMod.NPCs #region Strike NPC public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { + // Don't bother tampering with the damage is it is already zero. + // Zero damage does not happen in the base game and is always indicative of antibutcher in Calamity. + if (damage == 0D) + return false; + // Damage reduction on spawn - bool destroyerResist = DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || CalamityWorld.bossRushActive); - bool eaterofWorldsResist = EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive; + bool destroyerResist = DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice); + bool eaterofWorldsResist = EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive; if (destroyerResist || eaterofWorldsResist || AstrumDeusIDs.Contains(npc.type)) { - if (newAI[1] < 600f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) - { + float resistanceGateValue = AstrumDeusIDs.Contains(npc.type) ? 300f : 600f; + if (newAI[1] < resistanceGateValue || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) damage *= 0.01; - } } // Large Deus worm takes reduced damage to last a long enough time if (AstrumDeusIDs.Contains(npc.type) && newAI[0] == 0f) - { damage *= 0.8; - } // Override hand/head eye 'death' code and use custom 'death' code instead, this is here just in case the AI code fails - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) { @@ -1485,7 +1834,9 @@ namespace CalamityMod.NPCs (wCleave > 0 ? WarCleave.DefenseReduction : 0) - (gState > 0 ? GlacialState.DefenseReduction : 0) - (aCrunch > 0 ? ArmorCrunch.DefenseReduction : 0) - - (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0); + (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) - + Main.LocalPlayer.armorPenetration - + miscDefenseLoss; // Defense can never be negative and has a minimum value of zero. if (effectiveDefense < 0) @@ -1495,16 +1846,19 @@ namespace CalamityMod.NPCs damage = Main.CalculateDamage((int)damage, effectiveDefense); // DR applies after vanilla defense. - damage = ApplyDR(npc, damage); + damage = ApplyDR(npc, damage, yellowCandleDamage); - // Add Yellow Candle damage if the NPC isn't supposed to be "near invincible" - if (yellowCandle > 0 && DR < 0.99f && npc.takenDamageMultiplier > 0.05f) - damage += yellowCandleDamage; + // Inflict 0 damage if it's below 0.5 + damage = damage < 0.5 ? 0D : damage < 1D ? 1D : damage; - // Cancel out vanilla defense math by reversing the calculation vanilla is about to perform. - // While roundabout, this is safer than returning false to stop vanilla damage calculations entirely. - // Other mods will probably expect the vanilla code to run and may compensate for it themselves. - damage = Main.CalculateDamage((int)damage, -defense); + // Disable vanilla damage method if damage is less than 0.5 + if (damage == 0D) + return false; + + // Cancel out vanilla defense math by reversing the calculation vanilla is about to perform. + // While roundabout, this is safer than returning false to stop vanilla damage calculations entirely. + // Other mods will probably expect the vanilla code to run and may compensate for it themselves. + damage = Main.CalculateDamage((int)damage, -defense); return true; } @@ -1514,7 +1868,7 @@ namespace CalamityMod.NPCs /// /// Incoming damage. Has been modified by Main.DamageVar and boosted by armor penetration, but nothing else. /// - private double ApplyDR(NPC npc, double damage) + private double ApplyDR(NPC npc, double damage, double yellowCandleDamage) { if ((DR <= 0f && KillTime == 0) || damage <= 1.0) return damage; @@ -1527,18 +1881,34 @@ namespace CalamityMod.NPCs if (effectiveDR <= 0f) effectiveDR = 0f; + // Add Yellow Candle damage if the NPC isn't supposed to be "near invincible" + if (yellowCandle > 0 && DR < 0.99f && npc.takenDamageMultiplier > 0.05f) + damage += yellowCandleDamage; + // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac - if (KillTime > 0 && AITimer < KillTime && !CalamityWorld.bossRushActive) + if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive) { - float DRScalar = !GetDownedBossVariable(npc.type) || CalamityConfig.Instance.FullPowerReactiveBossDR ? 1.5f : 1f; + float DRScalar = CalamityWorld.malice ? 2f : (!GetDownedBossVariable(npc.type) || CalamityConfig.Instance.FullPowerReactiveBossDR) ? 1.5f : 1f; - /*if (Main.masterMode) - DRScalar = 5f;*/ - - // Boost Providence timed DR during the night - if (npc.type == NPCType() && !Main.dayTime) + // Boost Providence timed DR during the night or in Malice Mode + if (npc.type == NPCType() && (!Main.dayTime || CalamityWorld.malice)) DRScalar = 10f; + // Boost most worm boss timed DR to prevent speed killing + if ((DestroyerIDs.Contains(npc.type) && (!NPC.downedPlantBoss || CalamityWorld.malice)) || + (AquaticScourgeIDs.Contains(npc.type) && (!NPC.downedPlantBoss || CalamityWorld.malice)) || + (AstrumDeusIDs.Contains(npc.type) && (!NPC.downedMoonlord || CalamityWorld.malice)) || + (StormWeaverIDs.Contains(npc.type) && (!CalamityWorld.downedDoG || CalamityWorld.malice) && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2)) || + ThanatosIDs.Contains(npc.type)) + DRScalar = 5f; + + // Boost Desert Scourge and Perforator Worm timed DR during Malice Mode to prevent speed killing + if (CalamityWorld.malice) + { + if (DesertScourgeIDs.Contains(npc.type) || PerforatorIDs.Contains(npc.type)) + DRScalar = 5f; + } + // The limit for how much extra DR the boss can have float extraDRLimit = (1f - DR) * DRScalar; @@ -1558,7 +1928,7 @@ namespace CalamityMod.NPCs } double newDamage = (1f - effectiveDR) * damage; - return newDamage < 1.0 ? 1.0 : newDamage; + return newDamage; } private float DefaultDRMath(NPC npc, float DR) @@ -1636,30 +2006,36 @@ namespace CalamityMod.NPCs #region Boss Head Slot public override void BossHeadSlot(NPC npc, ref int index) { - if (CalamityWorld.revenge) - { - if (npc.type == NPCID.BrainofCthulhu) - { - if (npc.life / (float)npc.lifeMax < (CalamityWorld.death ? 0.33f : 0.2f)) - index = -1; - } + if (CalamityWorld.revenge || CalamityWorld.malice) + { + if (npc.type == NPCID.BrainofCthulhu) + { + if (npc.life / (float)npc.lifeMax < ((CalamityWorld.death || CalamityWorld.malice) ? 1f : 0.2f)) + index = -1; + } - if (CalamityWorld.death) - { - if (npc.type == NPCID.DukeFishron) - { - if (npc.life / (float)npc.lifeMax < 0.15f) - index = -1; - } - } - } + if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || CalamityWorld.malice)) + { + if (npc.life / (float)npc.lifeMax < 0.4f) + index = -1; + } + } } #endregion #region Pre AI public override bool PreAI(NPC npc) { - CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod); + if (VulnerabilityHexFireDrawer != null) + VulnerabilityHexFireDrawer.Update(); + CalamityGlobalTownNPC.SetPatreonTownNPCName(npc, mod); + + // Decrement each immune timer if it's greater than 0. + for (int i = 0; i < maxPlayerImmunities; i++) + { + if (dashImmunityTime[i] > 0) + dashImmunityTime[i]--; + } if (CalamityPlayer.areThereAnyDamnBosses) { @@ -1667,8 +2043,29 @@ namespace CalamityMod.NPCs maxVelocity = npc.velocity.Length(); } - if (KillTime > 0 && AITimer < KillTime) - AITimer++; + if (KillTime > 0) + { + // If any boss NPC is active, apply Zen to nearby players to reduce spawn rate + if (CalamityConfig.Instance.BossZen) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < BossZenDistance) + Main.player[Main.myPlayer].AddBuff(BuffType(), 2); + } + } + + if (AITimer < KillTime) + AITimer++; + + // Separate timer for aggression to avoid entering later phases too quickly + int aggressionTimerCap = (int)(KillTime * 1.35); + if (AIIncreasedAggressionTimer < aggressionTimerCap) + AIIncreasedAggressionTimer++; + + // Increases aggression over time if the fight is taking too long + killTimeRatio_IncreasedAggression = 1f - (AIIncreasedAggressionTimer / (float)aggressionTimerCap); + } if (npc.type == NPCID.TargetDummy || npc.type == NPCType()) { @@ -1678,32 +2075,34 @@ namespace CalamityMod.NPCs // Setting this in SetDefaults will disable expert mode scaling, so put it here instead if (ZeroContactDamageNPCList.Contains(npc.type)) - npc.damage = 0; + npc.damage = npc.defDamage = 0; - if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type)) + // Don't do damage for 42 frames after spawning in + if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2) + npc.damage = npc.alpha > 0 ? 0 : npc.defDamage; + + if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type)) npc.buffImmune[BuffType()] = false; - if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.Hornet || npc.type == NPCID.HornetFatty || npc.type == NPCID.HornetHoney || - npc.type == NPCID.HornetLeafy || npc.type == NPCID.HornetSpikey || npc.type == NPCID.HornetStingy || npc.type == NPCID.BigHornetStingy || npc.type == NPCID.LittleHornetStingy || - npc.type == NPCID.BigHornetSpikey || npc.type == NPCID.LittleHornetSpikey || npc.type == NPCID.BigHornetLeafy || npc.type == NPCID.LittleHornetLeafy || - npc.type == NPCID.BigHornetHoney || npc.type == NPCID.LittleHornetHoney || npc.type == NPCID.BigHornetFatty || npc.type == NPCID.LittleHornetFatty) - { - if (Main.player[npc.target].Calamity().queenBeeLore) - { - CalamityGlobalAI.QueenBeeLoreEffect(npc); - return false; - } - } - - if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) + if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC) BossRushForceDespawnOtherNPCs(npc, mod); - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + if (NPC.LunarApocalypseIsUp) + PillarEventProgressionEdit(npc); + + // Adult Wyrm Ancient Doom + if (npc.type == NPCID.AncientDoom) + { + if (Main.npc[(int)npc.ai[0]].type == NPCType()) + return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod); + } + + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { switch (npc.type) { case NPCID.KingSlime: - return CalamityGlobalAI.BuffedKingSlimeAI(npc, mod); + return CalamityGlobalAI.BuffedKingSlimeAI(npc, enraged > 0, mod); case NPCID.EyeofCthulhu: return CalamityGlobalAI.BuffedEyeofCthulhuAI(npc, enraged > 0, mod); @@ -1711,7 +2110,7 @@ namespace CalamityMod.NPCs case NPCID.EaterofWorldsHead: case NPCID.EaterofWorldsBody: case NPCID.EaterofWorldsTail: - return CalamityGlobalAI.BuffedEaterofWorldsAI(npc, mod); + return CalamityGlobalAI.BuffedEaterofWorldsAI(npc, enraged > 0, mod); case NPCID.BrainofCthulhu: return CalamityGlobalAI.BuffedBrainofCthulhuAI(npc, enraged > 0, mod); @@ -1719,7 +2118,7 @@ namespace CalamityMod.NPCs return CalamityGlobalAI.BuffedCreeperAI(npc, enraged > 0, mod); case NPCID.QueenBee: - return CalamityGlobalAI.BuffedQueenBeeAI(npc, mod); + return CalamityGlobalAI.BuffedQueenBeeAI(npc, enraged > 0, mod); case NPCID.SkeletronHand: return CalamityGlobalAI.BuffedSkeletronHandAI(npc, enraged > 0, mod); @@ -1747,13 +2146,13 @@ namespace CalamityMod.NPCs case NPCID.SkeletronPrime: return CalamityGlobalAI.BuffedSkeletronPrimeAI(npc, enraged > 0, mod); case NPCID.PrimeLaser: - return CalamityGlobalAI.BuffedPrimeLaserAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeLaserAI(npc, enraged > 0, mod); case NPCID.PrimeCannon: - return CalamityGlobalAI.BuffedPrimeCannonAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeCannonAI(npc, enraged > 0, mod); case NPCID.PrimeVice: - return CalamityGlobalAI.BuffedPrimeViceAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeViceAI(npc, enraged > 0, mod); case NPCID.PrimeSaw: - return CalamityGlobalAI.BuffedPrimeSawAI(npc, mod); + return CalamityGlobalAI.BuffedPrimeSawAI(npc, enraged > 0, mod); case NPCID.Plantera: return CalamityGlobalAI.BuffedPlanteraAI(npc, enraged > 0, mod); @@ -1797,7 +2196,7 @@ namespace CalamityMod.NPCs break; case NPCID.Mothron: - if (CalamityWorld.buffedEclipse) + if (CalamityWorld.downedDoG) { return CalamityGlobalAI.BuffedMothronAI(npc); } @@ -2364,7 +2763,7 @@ namespace CalamityMod.NPCs { case NPCID.FungiSpore: case NPCID.Spore: - return CalamityGlobalAI.BuffedSporeAI(npc, mod, true); + return CalamityGlobalAI.BuffedSporeAI(npc, mod); } break; case 73: @@ -2417,9 +2816,15 @@ namespace CalamityMod.NPCs else if (Main.expertMode) { if (npc.type == NPCID.FungiSpore || npc.type == NPCID.Spore) - return CalamityGlobalAI.BuffedSporeAI(npc, mod, false); + return CalamityGlobalAI.BuffedSporeAI(npc, mod); } + if (npc.type == NPCID.DD2LanePortal) + { + CalamityGlobalAI.DD2PortalAI(npc); + return false; + } + return true; } #endregion @@ -2427,466 +2832,274 @@ namespace CalamityMod.NPCs #region Boss Rush Force Despawn Other NPCs private void BossRushForceDespawnOtherNPCs(NPC npc, Mod mod) { - switch (CalamityWorld.bossRushStage) - { - case 0: - if (npc.type != NPCID.QueenBee) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 1: - if (npc.type != NPCID.BrainofCthulhu && npc.type != NPCID.Creeper) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 2: - if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked && npc.type != NPCType() && - npc.type != NPCID.YellowSlime && npc.type != NPCID.PurpleSlime && npc.type != NPCID.GreenSlime && npc.type != NPCID.RedSlime && - npc.type != NPCID.IceSlime && npc.type != NPCID.UmbrellaSlime && npc.type != NPCID.RainbowSlime && npc.type != NPCID.Pinky) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 3: - if (npc.type != NPCID.EyeofCthulhu && npc.type != NPCID.ServantofCthulhu) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 4: - if (npc.type != NPCID.SkeletronPrime && npc.type != NPCID.PrimeSaw && npc.type != NPCID.PrimeVice && - npc.type != NPCID.PrimeCannon && npc.type != NPCID.PrimeLaser && npc.type != NPCID.Probe) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 5: - if (npc.type != NPCID.Golem && npc.type != NPCID.GolemFistLeft && npc.type != NPCID.GolemFistRight && - npc.type != NPCID.GolemHead && npc.type != NPCID.GolemHeadFree) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 6: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 7: - if (!EaterofWorldsIDs.Contains(npc.type) && npc.type != NPCID.VileSpit) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 8: - if (npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 9: - if (!DestroyerIDs.Contains(npc.type) && npc.type != NPCID.Probe) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 10: - if (npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 11: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 12: - if (npc.type != NPCID.WallofFlesh && npc.type != NPCID.WallofFleshEye && npc.type != NPCID.TheHungry && - npc.type != NPCID.TheHungryII && npc.type != NPCID.LeechHead && npc.type != NPCID.LeechBody && - npc.type != NPCID.LeechTail) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 13: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 14: - if (npc.type != NPCID.SkeletronHead && npc.type != NPCID.SkeletronHand) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 15: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 16: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 17: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 18: - if (npc.type != NPCID.CultistBoss && npc.type != NPCID.CultistBossClone && npc.type != NPCID.CultistDragonHead && - npc.type != NPCID.CultistDragonBody1 && npc.type != NPCID.CultistDragonBody2 && npc.type != NPCID.CultistDragonBody3 && - npc.type != NPCID.CultistDragonBody4 && npc.type != NPCID.CultistDragonTail && npc.type != NPCID.AncientCultistSquidhead && - npc.type != NPCID.AncientLight && npc.type != NPCID.AncientDoom) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 19: - if (npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 20: - if (npc.type != NPCID.Plantera && npc.type != NPCID.PlanterasTentacle && npc.type != NPCID.PlanterasHook && - npc.type != NPCID.Spore) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 21: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 22: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 23: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 24: - if (npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 25: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 26: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 27: - if (npc.type != NPCID.DukeFishron && npc.type != NPCID.DetonatingBubble && npc.type != NPCID.Sharkron && - npc.type != NPCID.Sharkron2) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 28: - if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand && - npc.type != NPCID.MoonLordLeechBlob && npc.type != NPCID.MoonLordFreeEye) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 29: - if (!AstrumDeusIDs.Contains(npc.type)) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 30: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 31: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 32: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 33: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCID.DetonatingBubble) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 34: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) + if (!BossRushEvent.Bosses[BossRushEvent.BossRushStage].HostileNPCsToNotDelete.Contains(npc.type)) + { + npc.active = false; + npc.netUpdate = true; + } + } + #endregion + + #region Pillar Event Progression Edit + private void PillarEventProgressionEdit(NPC npc) + { + // Make pillars a bit more fun by forcing more difficult enemies based on progression. + int solarTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerSolar / 25D); + switch (solarTowerShieldStrength) + { + case 4: + // Possible spawns: Drakanian, Drakomire, Drakomire Rider + switch (npc.type) + { + case NPCID.SolarCrawltipedeHead: + case NPCID.SolarCrawltipedeBody: + case NPCID.SolarCrawltipedeTail: + case NPCID.SolarSolenian: + case NPCID.SolarSroller: + case NPCID.SolarCorite: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 3: + // Possible spawns: Drakomire, Drakomire Rider, Sroller + switch (npc.type) + { + case NPCID.SolarCrawltipedeHead: + case NPCID.SolarCrawltipedeBody: + case NPCID.SolarCrawltipedeTail: + case NPCID.SolarSpearman: + case NPCID.SolarSolenian: + case NPCID.SolarCorite: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 2: + // Possible spawns: Drakomire Rider, Selenian, Sroller + switch (npc.type) + { + case NPCID.SolarDrakomire: + case NPCID.SolarCrawltipedeHead: + case NPCID.SolarCrawltipedeBody: + case NPCID.SolarCrawltipedeTail: + case NPCID.SolarSpearman: + case NPCID.SolarCorite: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 1: + // Possible spawns: Corite, Selenian, Sroller + switch (npc.type) + { + case NPCID.SolarDrakomire: + case NPCID.SolarCrawltipedeHead: + case NPCID.SolarCrawltipedeBody: + case NPCID.SolarCrawltipedeTail: + case NPCID.SolarSpearman: + case NPCID.SolarDrakomireRider: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 0: + // Possible spawns: Corite, Crawltipede, Selenian + switch (npc.type) + { + case NPCID.SolarDrakomire: + case NPCID.SolarSpearman: + case NPCID.SolarDrakomireRider: + case NPCID.SolarSroller: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + } + + int vortexTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerVortex / 25D); + switch (vortexTowerShieldStrength) + { + case 4: + // Possible spawns: Alien Larva, Alien Hornet, Alien Queen + switch (npc.type) + { + case NPCID.VortexSoldier: + case NPCID.VortexRifleman: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 3: + // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian + if (npc.type == NPCID.VortexRifleman) { npc.active = false; npc.netUpdate = true; } - break; + case 2: + // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Storm Diver + if (npc.type == NPCID.VortexSoldier) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 1: + case 0: + // Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian, Storm Diver + break; + } - case 35: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } + int nebulaTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerNebula / 25D); + switch (nebulaTowerShieldStrength) + { + case 4: + // Possible spawns: Brain Suckler + switch (npc.type) + { + case NPCID.NebulaBeast: + case NPCID.NebulaBrain: + case NPCID.NebulaSoldier: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 3: + // Possible spawns: Brain Suckler, Predictor + switch (npc.type) + { + case NPCID.NebulaBeast: + case NPCID.NebulaBrain: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 2: + // Possible spawns: Brain Suckler, Predictor, Evolution Beast + if (npc.type == NPCID.NebulaBrain) + { + npc.active = false; + npc.netUpdate = true; + } + break; + case 1: + case 0: + // Possible spawns: Predictor, Evolution Beast, Nebula Floater + if (npc.type == NPCID.NebulaHeadcrab) + { + npc.active = false; + npc.netUpdate = true; + } + break; + } - break; + int stardustTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerStardust / 25D); + switch (stardustTowerShieldStrength) + { + case 4: + // Possible spawns: Milkyway Weaver, Star Cell + switch (npc.type) + { + case NPCID.StardustSpiderBig: + case NPCID.StardustSoldier: + case NPCID.StardustJellyfishBig: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 3: + // Possible spawns: Milkyway Weaver, Stargazer, Twinkle Popper + switch (npc.type) + { + case NPCID.StardustCellBig: + case NPCID.StardustJellyfishBig: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 2: + // Possible spawns: Stargazer, Twinkle Popper, Flow Invader + switch (npc.type) + { + case NPCID.StardustCellBig: + case NPCID.StardustWormHead: + case NPCID.StardustWormBody: + case NPCID.StardustWormTail: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + case 1: + case 0: + // Possible spawns: Twinkle Popper, Flow Invader + switch (npc.type) + { + case NPCID.StardustCellBig: + case NPCID.StardustWormHead: + case NPCID.StardustWormBody: + case NPCID.StardustWormTail: + case NPCID.StardustSoldier: + npc.active = false; + npc.netUpdate = true; + break; + default: + break; + } + break; + } + } + #endregion - case 36: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 37: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 38: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - - case 39: - if (npc.type != NPCType() && npc.type != NPCType() && - npc.type != NPCType()) - { - npc.active = false; - npc.netUpdate = true; - } - - break; - } - } - #endregion - - #region AI - public override void AI(NPC npc) + #region AI + public override void AI(NPC npc) { - if (!CalamityWorld.spawnedHardBoss) - { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.SkeletronPrime || - npc.type == NPCID.Plantera || npc.type == NPCType() || npc.type == NPCType() || - npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || - npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || - npc.type == NPCType() || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem) - { - CalamityWorld.spawnedHardBoss = true; - CalamityMod.UpdateServerBoolean(); - } - } - - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - bool configBossRushBoost = CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive; - - switch (npc.type) - { - case NPCID.DungeonGuardian: - CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc, configBossRushBoost, enraged > 0); - break; - - default: - break; - } - } + if (CalamityWorld.revenge && npc.type == NPCID.DungeonGuardian) + CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc); } - #endregion + #endregion + + #region Post AI + public override void PostAI(NPC npc) + { + // Debuff decrements + if (debuffResistanceTimer > 0) + debuffResistanceTimer--; - #region Post AI - public override void PostAI(NPC npc) - { - //Debuff decrements if (timeSlow > 0) timeSlow--; if (tesla > 0) @@ -2903,11 +3116,16 @@ namespace CalamityMod.NPCs eutrophication--; if (webbed > 0) webbed--; - if (slowed > 0) - slowed--; - if (electrified > 0) - electrified--; - if (yellowCandle > 0) + if (slowed > 0) + slowed--; + if (kamiFlu > 0) + kamiFlu--; + if (vaporfied > 0) + vaporfied--; + + if (electrified > 0) + electrified--; + if (yellowCandle > 0) yellowCandle--; if (pearlAura > 0) pearlAura--; @@ -2917,10 +3135,10 @@ namespace CalamityMod.NPCs bBlood--; if (dFlames > 0) dFlames--; + if (vulnerabilityHex > 0) + vulnerabilityHex--; if (marked > 0) marked--; - if (vaporfied > 0) - vaporfied--; if (irradiated > 0) irradiated--; if (bFlames > 0) @@ -2953,6 +3171,8 @@ namespace CalamityMod.NPCs clamDebuff--; if (sulphurPoison > 0) sulphurPoison--; + if (sagePoisonTime > 0) + sagePoisonTime--; if (kamiFlu > 0) kamiFlu--; if (relicOfResilienceCooldown > 0) @@ -2963,34 +3183,41 @@ namespace CalamityMod.NPCs GaussFluxTimer--; if (ladHearts > 0) ladHearts--; + if (vulnerabilityHex > 0) + vulnerabilityHex--; + if (banishingFire > 0) + banishingFire--; - // Bosses and any specific other NPCs are completely immune to having their movement impaired. - if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) - return; + // Queen Bee is completely immune to having her movement impaired if not in a high difficulty mode. + if (npc.type == NPCID.QueenBee && !CalamityWorld.revenge && !CalamityWorld.malice && !BossRushEvent.BossRushActive) + return; - if (kamiFlu > 0) - { - npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-KamiDebuff.MaxNPCSpeed), new Vector2(KamiDebuff.MaxNPCSpeed)); - } + if (debuffResistanceTimer <= 0 || (debuffResistanceTimer > slowingDebuffResistanceMin)) + { + if (eFreeze <= 0 && gState <= 0 && tSad <= 0) + { + if (silvaStun > 0 || eutrophication > 0) + npc.velocity *= 0.5f; + else if (timeSlow > 0 || webbed > 0) + npc.velocity *= 0.85f; + else if (slowed > 0 || tesla > 0 || vaporfied > 0) + npc.velocity *= 0.9f; + else if (vulnerabilityHex > 0) + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-Calamity.MaxNPCSpeed), new Vector2(Calamity.MaxNPCSpeed, 10f)); + else if (kamiFlu > 420) + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-KamiDebuff.MaxNPCSpeed), new Vector2(KamiDebuff.MaxNPCSpeed)); + } + } - if (!CalamityPlayer.areThereAnyDamnBosses) + if (!CalamityPlayer.areThereAnyDamnBosses && !CalamityLists.enemyImmunityList.Contains(npc.type)) { if (pearlAura > 0) npc.velocity *= 0.9f; - if (vaporfied > 0) - npc.velocity *= 0.9f; } - if (!CalamityWorld.bossRushActive) - { - if (silvaStun > 0 || eutrophication > 0) - npc.velocity = Vector2.Zero; - else if (timeSlow > 0 || webbed > 0) - npc.velocity *= 0.85f; - else if (slowed > 0 || tesla > 0) - npc.velocity *= 0.9f; - } - } + if (npc.type == NPCID.DD2EterniaCrystal) + CalamityGlobalAI.DD2CrystalExtraAI(npc); + } #endregion #region On Hit Player @@ -3079,237 +3306,40 @@ namespace CalamityMod.NPCs break; } } - - if (CalamityWorld.revenge) - { - if (CalamityConfig.Instance.BuffThoriumBosses) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("GraniteEnergyStorm") || npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || - npc.type == thorium.NPCType("TheBuriedWarrior2") || npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || - npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || npc.type == thorium.NPCType("SlagFury") || - npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") || - npc.type == thorium.NPCType("Aquaius2")) - { - target.AddBuff(BuffType(), 180); - } - else if (npc.type == thorium.NPCType("ViscountBaby") || npc.type == thorium.NPCType("EnemyBeholder") || npc.type == thorium.NPCType("AbyssalSpawn") || - npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2") || - npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("Abyssion") || - npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased")) - { - target.AddBuff(BuffType(), 180); - target.AddBuff(BuffType(), 180); - } - } - } - - switch (npc.type) - { - case NPCID.DemonEye: - case NPCID.EaterofSouls: - case NPCID.EaterofWorldsTail: - case NPCID.ChaosBall: - case NPCID.VileSpit: - case NPCID.LeechHead: - case NPCID.Crimera: - case NPCID.FaceMonster: - case NPCID.BloodCrawler: - case NPCID.BloodCrawlerWall: - target.AddBuff(BuffType(), 60); - break; - - case NPCID.DevourerHead: - case NPCID.EaterofWorldsBody: - case NPCID.CorruptBunny: - case NPCID.CorruptGoldfish: - case NPCID.CorruptSlime: - case NPCID.Corruptor: - case NPCID.Clinger: - case NPCID.Slimer: - case NPCID.WanderingEye: - case NPCID.Frankenstein: - case NPCID.WallCreeper: - case NPCID.WallCreeperWall: - case NPCID.SwampThing: - case NPCID.CorruptPenguin: - case NPCID.Herpling: - case NPCID.FloatyGross: - case NPCID.Crimslime: - case NPCID.BloodFeeder: - case NPCID.BloodJelly: - case NPCID.IchorSticker: - case NPCID.Ghost: - case NPCID.CreatureFromTheDeep: - case NPCID.Fritz: - case NPCID.CrimsonBunny: - case NPCID.CrimsonGoldfish: - case NPCID.CrimsonPenguin: - case NPCID.Drippler: - target.AddBuff(BuffType(), 120); - break; - - case NPCID.EyeofCthulhu: - case NPCID.ServantofCthulhu: - case NPCID.SkeletronHead: - case NPCID.Demon: - case NPCID.VoodooDemon: - case NPCID.CursedHammer: - case NPCID.SeekerHead: - case NPCID.RedDevil: - case NPCID.BlackRecluse: - case NPCID.CrimsonAxe: - case NPCID.Nymph: - case NPCID.BlackRecluseWall: - case NPCID.Eyezor: - case NPCID.BrainofCthulhu: - case NPCID.HeadlessHorseman: - case NPCID.Splinterling: - case NPCID.Hellhound: - case NPCID.Poltergeist: - case NPCID.Nailhead: - case NPCID.DrManFly: - case NPCID.ThePossessed: - case NPCID.Mothron: - case NPCID.Medusa: - case NPCID.SandsharkCorrupt: - case NPCID.SandsharkCrimson: - target.AddBuff(BuffType(), 180); - break; - - case NPCID.MourningWood: - case NPCID.Pumpking: - target.AddBuff(BuffType(), 240); - break; - - case NPCID.WallofFlesh: - case NPCID.Krampus: - target.AddBuff(BuffType(), 300); - break; - - case NPCID.DungeonGuardian: - target.AddBuff(BuffType(), 1200); - break; - - case NPCID.Creeper: - target.AddBuff(BuffType(), 60); - target.AddBuff(BuffType(), 120); - break; - - case NPCID.CursedSkull: - case NPCID.SkeletronHand: - case NPCID.TheHungry: - case NPCID.TheHungryII: - case NPCID.PumpkingBlade: - case NPCID.BloodZombie: - target.AddBuff(BuffType(), 120); - target.AddBuff(BuffType(), 120); - break; - - case NPCID.DarkMummy: - target.AddBuff(BuffType(), 180); - target.AddBuff(BuffType(), 120); - break; - - case NPCID.EaterofWorldsHead: - case NPCID.GiantCursedSkull: - case NPCID.Butcher: - case NPCID.Psycho: - target.AddBuff(BuffType(), 180); - target.AddBuff(BuffType(), 180); - break; - - case NPCID.Wraith: - case NPCID.VampireBat: - case NPCID.Vampire: - case NPCID.Reaper: - target.AddBuff(BuffType(), 240); - target.AddBuff(BuffType(), 180); - break; - - case NPCID.AncientCultistSquidhead: - target.AddBuff(BuffType(), 240); - target.AddBuff(BuffType(), 240); - break; - - case NPCID.DungeonSpirit: - target.AddBuff(BuffType(), 300); - target.AddBuff(BuffType(), 180); - break; - - case NPCID.AncientDoom: - target.AddBuff(BuffType(), 300); - target.AddBuff(BuffType(), 300); - break; - - case NPCID.Snatcher: - target.AddBuff(BuffType(), 60); - break; - - case NPCID.BurningSphere: - case NPCID.ManEater: - case NPCID.Mummy: - case NPCID.EnchantedSword: - case NPCID.Werewolf: - target.AddBuff(BuffType(), 120); - break; - - case NPCID.Spazmatism: - case NPCID.Probe: - case NPCID.QueenBee: - case NPCID.Spore: - case NPCID.BoneLee: - case NPCID.Flocko: - case NPCID.DukeFishron: - case NPCID.Sharkron: - case NPCID.Sharkron2: - case NPCID.ShadowFlameApparition: - case NPCID.MartianDrone: - target.AddBuff(BuffType(), 180); - break; - - case NPCID.Mimic: - case NPCID.AngryTrapper: - target.AddBuff(BuffType(), 240); - break; - - case NPCID.DetonatingBubble: - target.AddBuff(BuffType(), 360); - break; - - case NPCID.PrimeSaw: - case NPCID.PrimeVice: - target.AddBuff(BuffID.Bleeding, 300); - target.AddBuff(BuffType(), 180); - break; - - case NPCID.SkeletronPrime: - target.AddBuff(BuffID.Bleeding, 300); - break; - - case NPCID.Golem: - case NPCID.GolemHead: - case NPCID.GolemHeadFree: - target.AddBuff(BuffID.BrokenArmor, 180); - break; - - case NPCID.GolemFistRight: - case NPCID.GolemFistLeft: - target.AddBuff(BuffID.BrokenArmor, 180); - target.AddBuff(BuffType(), 180); - break; - - default: - break; - } - } } - #endregion + #endregion - #region Modify Hit By Projectile - public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + #region Modify Hit + public override void ModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit) + { + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.camper && !player.StandingStill()) + damage = (int)(damage * 0.1); + + // True melee resists + if (DesertScourgeIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || + PerforatorIDs.Contains(npc.type) || AquaticScourgeIDs.Contains(npc.type) || DestroyerIDs.Contains(npc.type) || + AstrumDeusIDs.Contains(npc.type) || StormWeaverIDs.Contains(npc.type) || ThanatosIDs.Contains(npc.type) || + npc.type == NPCType() || npc.type == NPCType()) + { + if (item.melee && item.type != ItemType() && item.type != ItemType()) + damage = (int)(damage * 0.5); + } + else if (npc.type == NPCType()) + { + if (item.type == ItemType()) + damage = (int)(damage * 0.75); + } + else if (npc.type == NPCType()) + { + if (item.type == ItemType()) + damage = (int)(damage * 0.75); + } + } + #endregion + + #region Modify Hit By Projectile + public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); @@ -3318,326 +3348,237 @@ namespace CalamityMod.NPCs if (!projectile.npcProj && !projectile.trap) { - if (ShouldAffectNPC(npc) && Main.rand.NextBool(15) && !CalamityPlayer.areThereAnyDamnBosses) - { - if (modPlayer.eGauntlet && projectile.melee) - { - damage = npc.lifeMax * 3; - } - - if (modPlayer.eTalisman && projectile.magic) - { - damage = npc.lifeMax * 3; - } - - if (modPlayer.nanotech && projectile.Calamity().rogue) - { - damage = npc.lifeMax * 3; - } - - if (modPlayer.eQuiver && projectile.ranged) - { - damage = npc.lifeMax * 3; - } - - if (modPlayer.nucleogenesis) - { - if (projectile.IsSummon()) - { - damage = npc.lifeMax * 3; - } - } - } - if (projectile.ranged && modPlayer.plagueReaper && pFlames > 0) - { damage = (int)(damage * 1.1); - } } - // Expert Mode resists, mostly worms - if (Main.expertMode) + // Any weapons that shoot projectiles from anywhere other than the player's center aren't affected by point-blank shot damage boost. + if (!Main.player[projectile.owner].ActiveItem().IsAir && Main.player[projectile.owner].ActiveItem().Calamity().canFirePointBlankShots && projectile.ranged) { - if (AstrumDeusIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - - // Old resists - /*if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.1); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.2); - } - else if (projectile.type == player.beeType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.4); - }*/ - - // New resists - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.2); - } - else if (ProjectileID.Sets.StardustDragon[projectile.type] || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.25); - } - else if (projectile.type == ProjectileID.DD2BetsyArrow || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileID.Electrosphere) - { - damage = (int)(damage * 0.6); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.InfernoFriendlyBolt || projectile.type == ProjectileID.InfernoFriendlyBlast || projectile.type == ProjectileID.RainbowFront || projectile.type == ProjectileID.RainbowBack || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileID.ChargedBlasterLaser) - { - damage = (int)(damage * 0.75); - } - } - else if (CosmicGuardianIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - } - else if (StormWeaverIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.9); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = projectile.Calamity().stealthStrike ? 6 : 9; - damage = (int)(damage * 0.75); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage = (int)(damage * 0.1); - } - } - else if (DestroyerIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.75); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.38); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.25); - } - } - else if (AquaticScourgeIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.9); - } - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType()) - { - if (projectile.penetrate == -1) - projectile.penetrate = 2; - damage = (int)(damage * 0.1); - } - } - else if (PerforatorIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - } - else if (EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper) - { - if (npc.type == NPCID.Creeper) - GrenadeResist(projectile, ref damage); - - PierceResistGlobal(projectile, ref damage); - - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.7); - } - } - else if (DesertScourgeIDs.Contains(npc.type)) - { - GrenadeResist(projectile, ref damage); - PierceResistGlobal(projectile, ref damage); - } - } - - // Other projectile resists - if (npc.type == NPCType()) - { - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.2); - } - else if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.5); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.6); - } - else if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.75); - } - else if (projectile.type == ProjectileID.LunarFlare) - { - damage = (int)(damage * 0.8); - } - } - else if (npc.type == NPCID.CultistBoss) - { - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 0.75); - } - } - else if (npc.type == NPCID.DukeFishron) - { - if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) - { - damage = (int)(damage * 1.35); - } - } - else if (npc.type == NPCType()) - { - if (projectile.type == ProjectileType()) + if (projectile.Calamity().pointBlankShotDuration > 0) { + projectile.Calamity().pointBlankShotDuration = 0; damage = (int)(damage * 1.5); } } + + // Nerfed because the primary fire was buffed a lot. + if (projectile.type == ProjectileID.MonkStaffT3_AltShot || (projectile.type == ProjectileID.Electrosphere && Main.player[projectile.owner].ActiveItem().type == ItemID.MonkStaffT3)) + damage /= 4; + + // Nerfed because these are really overpowered. + if (projectile.type == ProjectileID.CursedDartFlame) + damage /= 2; + + // Nerf Mushroom Spear mushrooms. + if (projectile.type == ProjectileID.Mushroom && Main.player[projectile.owner].ActiveItem().type == ItemID.MushroomSpear) + damage /= 2; + + if (projectile.type == ProjectileID.SeedlerNut || projectile.type == ProjectileID.SeedlerThorn) + damage /= 3; + + if (CalamityLists.pierceResistList.Contains(npc.type)) + PierceResistGlobal(projectile, npc, ref damage); + + if (ThanatosIDs.Contains(npc.type)) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (npc.type == NPCType()) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (AstrumDeusIDs.Contains(npc.type)) + { + // 75% resist to Stardust Dragon Staff and Plaguenades. + if (ProjectileID.Sets.StardustDragon[projectile.type] || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.25); + + // 50% resist to true melee. + else if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + + // 25% resist to Lazhar, Inferno Fork, Cosmic Rainbow, Plague Staff, Resurrection Butterfly, Eidolon Staff and Charged Blaster Cannon. + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.75); + } + else if (npc.type == NPCType()) + { + // 30% resist to Surge Driver's alt click comets. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.7); + + // 20% resist to Executioner's Blade stealth strikes. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.8); + } + else if (DevourerOfGodsIDs.Contains(npc.type)) + { + // 15% increased damage from Time Bolt stealth strikes. + if (projectile.type == ProjectileType()) + { + if (projectile.Calamity().stealthStrike) + damage = (int)(damage * 1.15); + } + } + else if (npc.type == NPCType()) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (StormWeaverIDs.Contains(npc.type)) + { + // 10% resist to Shattered Sun. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.9); + + // 25% resist to Molten Amputator blobs. + else if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.75); + + // 50% resist to true melee, Elemental Axe, Dazzling Stabber Staff and Pristine Fury. + else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.5); + + // 90% resist to Stardust Dragon Staff. + else if (ProjectileID.Sets.StardustDragon[projectile.type]) + damage = (int)(damage * 0.1); + } + else if (DestroyerIDs.Contains(npc.type)) + { + // 25% resist to Spear of Paleolith, Desecrated Water, Kelvin Catalyst and Pearlwood Bow. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.75); + + // 50% resist to true melee and Dormant Brimseekers. + else if (projectile.Calamity().trueMelee || projectile.type == ProjectileType()) + damage = (int)(damage * 0.5); + } + else if (AquaticScourgeIDs.Contains(npc.type)) + { + // 50% resist to true melee and Dormant Brimseekers. + if (projectile.Calamity().trueMelee || projectile.type == ProjectileType()) + damage = (int)(damage * 0.5); + } + else if (PerforatorIDs.Contains(npc.type)) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (npc.type == NPCID.Creeper) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (EaterofWorldsIDs.Contains(npc.type)) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (DesertScourgeIDs.Contains(npc.type)) + { + // 50% resist to true melee. + if (projectile.Calamity().trueMelee) + damage = (int)(damage * 0.5); + } + else if (npc.type == NPCType()) + { + // 20.5% resist to Time Bolt. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.795); + + // 61% resist to Last Mourning. + else if (projectile.type == ProjectileType() || projectile.type == ProjectileID.FlamingJack) + damage = (int)(damage * 0.39); + } + else if (npc.type == NPCType()) + { + // 5% resist to Celestial Reaper. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.95); + } + else if (npc.type == NPCType()) + { + // 5% resist to Celestial Reaper. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.95); + } + else if (npc.type == NPCType()) + { + // 10% resist to Onyxia. + if (projectile.type == ProjectileID.BlackBolt) + damage = (int)(damage * 0.9); + } + else if (npc.type == NPCType() || npc.type == NPCType()) + { + // 10% resist to Phoenix Flame Barrage. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.9); + } + else if (npc.type == NPCType()) + { + // 85% resist to Chicken Cannon. + if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.15); + + // 30% resist to Murasama. + else if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.7); + + // 25% resist to Yharim's Crystal. + else if (projectile.type == ProjectileType()) + damage = (int)(damage * 0.75); + + // 10% resist to Surge Driver's alt click comets and Executioner's Blade stealth strikes. + else if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.9); + } + else if (npc.type == NPCID.CultistBoss) + { + // 25% resist to Resurrection Butterfly. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 0.75); + } + else if (npc.type == NPCID.DukeFishron) + { + // 35% increased damage from Resurrection Butterfly. + if (projectile.type == ProjectileType() || projectile.type == ProjectileType()) + damage = (int)(damage * 1.35); + } + + if (modPlayer.camper && !player.StandingStill()) + damage = (int)(damage * 0.1); } - private void GrenadeResist(Projectile projectile, ref int damage) + private void PierceResistGlobal(Projectile projectile, NPC npc, ref int damage) { if (GrenadeResistIDs.Contains(projectile.type)) - damage = (int)(damage * 0.2); - } + { + if (!EaterofWorldsIDs.Contains(npc.type)) + damage = (int)(damage * 0.2); + else if (!Main.expertMode) + damage = (int)(damage * 0.2); + } - private void PierceResistGlobal(Projectile projectile, ref int damage) - { - if (projectile.IsSummon()) - return; + float damageReduction = projectile.Calamity().timesPierced * projectile.Calamity().PierceResistHarshness; + if (damageReduction > projectile.Calamity().PierceResistCap) + damageReduction = projectile.Calamity().PierceResistCap; - if (projectile.penetrate == -1) - damage = (int)(damage * 0.5); - else if (projectile.penetrate > 1) - damage = (int)MathHelper.Clamp(damage * (float)Math.Pow(0.9, projectile.penetrate), damage * 0.5f, damage); + damage -= (int)(damage * damageReduction); + + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !projectile.IsSummon() && projectile.aiStyle != 99) + projectile.Calamity().timesPierced++; } #endregion - #region On Hit By Item - public override void OnHitByItem(NPC npc, Player player, Item item, int damage, float knockback, bool crit) - { - if (player.Calamity().bloodflareSet) - { - if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life < npc.lifeMax * 0.5) && - player.Calamity().bloodflareHeartTimer <= 0) - { - player.Calamity().bloodflareHeartTimer = 180; - DropHelper.DropItem(npc, ItemID.Heart); - } - else if (!npc.SpawnedFromStatue && npc.damage > 0 && (npc.life > npc.lifeMax * 0.5) && - player.Calamity().bloodflareManaTimer <= 0) - { - player.Calamity().bloodflareManaTimer = 180; - DropHelper.DropItem(npc, ItemID.Star); - } - } - } - #endregion - - #region On Hit By Projectile - public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - bool isSummon = projectile.IsSummon(); - - if (modPlayer.sGenerator) - { - if (isSummon && (npc.damage > 0 || npc.boss)) - { - int buffType = Utils.SelectRandom(Main.rand, new int[] - { - BuffType(), - BuffType(), - BuffType() - }); - player.AddBuff(buffType, 120); - } - } - - if (modPlayer.hallowedRune) - { - if (isSummon && (npc.damage > 0 || npc.boss)) - { - int buffType = Utils.SelectRandom(Main.rand, new int[] - { - BuffType(), - BuffType(), - BuffType() - }); - player.AddBuff(buffType, 120); - } - } - - if (modPlayer.bloodflareSet) - { - if (!npc.SpawnedFromStatue && (npc.damage > 0 || npc.boss) && (npc.life < npc.lifeMax * 0.5) && - modPlayer.bloodflareHeartTimer <= 0) - { - modPlayer.bloodflareHeartTimer = 180; - DropHelper.DropItem(npc, ItemID.Heart); - } - else if (!npc.SpawnedFromStatue && (npc.damage > 0 || npc.boss) && (npc.life > npc.lifeMax * 0.5) && - modPlayer.bloodflareManaTimer <= 0) - { - modPlayer.bloodflareManaTimer = 180; - DropHelper.DropItem(npc, ItemID.Star); - } - } - } - #endregion - #region Check Dead public override bool CheckDead(NPC npc) { @@ -3695,9 +3636,7 @@ namespace CalamityMod.NPCs npc2.ai[0] = -1000 * Main.rand.Next(3); if (Main.netMode == NetmodeID.Server && slime < Main.maxNPCs) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slime, 0f, 0f, 0f, 0, 0, 0); - } } } } @@ -3712,9 +3651,7 @@ namespace CalamityMod.NPCs case NPCID.EnchantedSword: case NPCID.CrimsonAxe: if (npc.life <= npc.lifeMax * 0.5) - { npc.justHit = false; - } break; @@ -3725,25 +3662,19 @@ namespace CalamityMod.NPCs case NPCID.BlackRecluse: case NPCID.BlackRecluseWall: if (npc.life <= npc.lifeMax * 0.25) - { npc.justHit = false; - } break; case NPCID.Paladin: if (npc.life <= npc.lifeMax * 0.15) - { npc.justHit = false; - } break; case NPCID.Clown: if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead) - { npc.ai[2] += 29f; - } break; } @@ -3751,11 +3682,21 @@ namespace CalamityMod.NPCs if (npc.type == NPCType() || npc.type == NPCType()) { if (npc.life <= npc.lifeMax * 0.25) - { npc.justHit = false; - } } } + + if (npc.life <= 0 && BossRushEvent.BossRushActive && npc.type == NPCID.WallofFlesh && BossRushEvent.CurrentlyFoughtBoss == npc.type) + { + // Post-Wall of Flesh teleport back to spawn. + // This appears to only work correctly client-side in MP. + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + bool appropriatePlayer = Main.myPlayer == playerIndex; + if (Main.player[playerIndex].active && appropriatePlayer) + Main.player[playerIndex].Spawn(); + } + } } #endregion @@ -3809,6 +3750,12 @@ namespace CalamityMod.NPCs } // Boosts + if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) + { + spawnRate = (int)(spawnRate * 0.75); + maxSpawns = (int)(maxSpawns * 3f); + } + if (player.Calamity().clamity) { spawnRate = (int)(spawnRate * 0.02); @@ -3821,21 +3768,22 @@ namespace CalamityMod.NPCs maxSpawns = (int)(maxSpawns * 10f); } - if (CalamityWorld.revenge) + if (NPC.LunarApocalypseIsUp) { - spawnRate = (int)(spawnRate * 0.85); + if ((player.ZoneTowerNebula && NPC.ShieldStrengthTowerNebula == 0) || (player.ZoneTowerStardust && NPC.ShieldStrengthTowerStardust == 0) || + (player.ZoneTowerVortex && NPC.ShieldStrengthTowerVortex == 0) || (player.ZoneTowerSolar && NPC.ShieldStrengthTowerSolar == 0)) + { + spawnRate = (int)(spawnRate * 0.85); + maxSpawns = (int)(maxSpawns * 1.25f); + } } + if (CalamityWorld.revenge) + spawnRate = (int)(spawnRate * 0.85); + if (CalamityWorld.demonMode) - { spawnRate = (int)(spawnRate * 0.75); - } - if (player.Calamity().perforatorLore) - { - spawnRate = (int)(spawnRate * 0.7); - maxSpawns = (int)(maxSpawns * 1.8f); - } if (Main.waterCandles > 0) { spawnRate = (int)(spawnRate * 0.9); @@ -3867,11 +3815,6 @@ namespace CalamityMod.NPCs } // Reductions - if (player.Calamity().hiveMindLore) - { - spawnRate = (int)(spawnRate * 1.3); - maxSpawns = (int)(maxSpawns * 0.6f); - } if (Main.peaceCandles > 0) { spawnRate = (int)(spawnRate * 1.1); @@ -4013,18 +3956,28 @@ namespace CalamityMod.NPCs } } } - } + + if (spawnInfo.playerSafe) + return; + + 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)) + pool.Remove(NPCID.VoodooDemon); + } #endregion #region Drawing public override void FindFrame(NPC npc, int frameHeight) { - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { if (npc.type == NPCID.SkeletronPrime) - { - npc.frameCounter = 0.0; - } + npc.frameCounter = 0D; } } @@ -4124,7 +4077,7 @@ namespace CalamityMod.NPCs } } - if (hFlames > 0) + if (hFlames > 0 || banishingFire > 0) { if (Main.rand.Next(5) < 4) { @@ -4321,51 +4274,40 @@ namespace CalamityMod.NPCs } if (gState > 0 || eFreeze > 0) - { drawColor = Color.Cyan; - } if (marked > 0 || sulphurPoison > 0 || vaporfied > 0) - { drawColor = Color.Fuchsia; - } if (pearlAura > 0) - { drawColor = Color.White; - } if (timeSlow > 0 || tesla > 0) - { drawColor = Color.Aquamarine; - } } public override Color? GetAlpha(NPC npc, Color drawColor) { if (Main.LocalPlayer.Calamity().trippy) - { return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); - } - if (enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { + if (enraged > 0) return new Color(200, 50, 50, npc.alpha); - } - if (npc.Calamity().kamiFlu > 0) - { + if (npc.Calamity().kamiFlu > 0 && !CalamityLists.kamiDebuffColorImmuneList.Contains(npc.type)) return new Color(51, 197, 108, npc.alpha); - } - return null; + if (npc.type == NPCID.AncientDoom) + return new Color(255, 255, 255, npc.alpha); + + return null; } public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) { if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f)) { - if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityMod.needsDebuffIconDisplayList.Contains(npc.type))) + if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) { List buffTextureList = new List(); @@ -4398,7 +4340,9 @@ namespace CalamityMod.NPCs buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff")); if (sulphurPoison > 0) buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning")); - if (vaporfied > 0) + if (sagePoisonTime > 0) + buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/SagePoison")); + if (vaporfied > 0) buffTextureList.Add(GetTexture("CalamityMod/Buffs/DamageOverTime/Vaporfied")); // Stat debuffs @@ -4530,14 +4474,27 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.TownNPCAlertSystem(npc, mod, spriteBatch); - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { - if (npc.type == NPCID.SkeletronPrime) - { + if (npc.type == NPCID.SkeletronPrime || DestroyerIDs.Contains(npc.type)) return false; - } } + if (npc.type == NPCID.GolemHeadFree) + { + // Draw the head as usual. + Texture2D golemHeadTexture = Main.npcTexture[npc.type]; + Vector2 headDrawPosition = npc.Center + Vector2.UnitY * npc.gfxOffY - Main.screenPosition; + spriteBatch.Draw(golemHeadTexture, headDrawPosition, npc.frame, npc.GetAlpha(drawColor), 0f, npc.frame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + + // Draw the eyes. The way vanilla handles this is hardcoded bullshit that cannot handle different hitboxes and thus requires rewriting. + Color eyeColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, 0); + Vector2 eyesDrawPosition = headDrawPosition - npc.scale * new Vector2(1f, 12f); + Rectangle eyesFrame = new Rectangle(0, 0, Main.golemTexture[1].Width, Main.golemTexture[1].Height / 2); + spriteBatch.Draw(Main.golemTexture[1], eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + return false; + } + if (Main.LocalPlayer.Calamity().trippy) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -4585,16 +4542,59 @@ namespace CalamityMod.NPCs Main.spriteBatch.Draw(Main.npcTexture[npc.type], new Vector2(position9.X - Main.screenPosition.X + npc.width / 2 - Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, position9.Y - Main.screenPosition.Y + npc.height - Main.npcTexture[npc.type].Height * npc.scale / Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + num66 + npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(npc.frame), alpha15, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } + } + else + { + if (npc.Calamity().vulnerabilityHex > 0) + { + float compactness = npc.width * 0.6f; + if (compactness < 10f) + compactness = 10f; + float power = npc.height / 100f; + if (power > 2.75f) + power = 2.75f; + if (VulnerabilityHexFireDrawer is null || VulnerabilityHexFireDrawer.LocalTimer >= VulnerabilityHexFireDrawer.SetLifetime) + VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); + else + VulnerabilityHexFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY)); + } + else + VulnerabilityHexFireDrawer = null; + } + + // Draw a pillar of light and fade the background as an animation when skipping things in the DD2 event. + if (npc.type == NPCID.DD2EterniaCrystal) + { + float animationTime = 120f - npc.ai[3]; + animationTime /= 120f; + + if (!Main.dedServ) + { + if (!Filters.Scene["CrystalDestructionColor"].IsActive()) + Filters.Scene.Activate("CrystalDestructionColor"); + + Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity((float)Math.Sin(animationTime * MathHelper.Pi) * 0.4f); + } + + Vector2 drawPosition = npc.Center - Main.screenPosition + Vector2.UnitY * 60f; + for (int i = 0; i < 4; i++) + { + float intensity = MathHelper.Clamp(animationTime * 2f - i / 3f, 0f, 1f); + Vector2 origin = new Vector2(Main.magicPixel.Width / 2f, Main.magicPixel.Height); + Vector2 scale = new Vector2((float)Math.Sqrt(intensity) * 50f, intensity * 4f); + Color beamColor = new Color(0.4f, 0.17f, 0.4f, 0f) * (intensity * (1f - MathHelper.Clamp((animationTime - 0.8f) / 0.2f, 0f, 1f))) * 0.5f; + spriteBatch.Draw(Main.magicPixel, drawPosition, null, beamColor, 0f, origin, scale, SpriteEffects.None, 0f); + } } return true; } public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) { - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { - // His afterimages I can't get to work, so fuck it - if (npc.type == NPCID.SkeletronPrime) + // His afterimages I can't get to work, so fuck it + if (npc.type == NPCID.SkeletronPrime) { Texture2D npcTexture = Main.npcTexture[npc.type]; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; @@ -4611,9 +4611,7 @@ namespace CalamityMod.NPCs newAI[3] = newAI[3] + frameHeight; if (newAI[3] / frameHeight >= 2f) - { newAI[3] = 0f; - } } } @@ -4635,15 +4633,53 @@ namespace CalamityMod.NPCs SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) - { spriteEffects = SpriteEffects.FlipHorizontally; - } - spriteBatch.Draw(npcTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + spriteBatch.Draw(npcTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); spriteBatch.Draw(Main.BoneEyesTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), - npc.frame, new Color(200, 200, 200, 0), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0); + npc.frame, new Color(200, 200, 200, 0), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); } + else if (DestroyerIDs.Contains(npc.type)) + { + if (drawColor != Color.Black) + { + Texture2D npcTexture = Main.npcTexture[npc.type]; + int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; + + Vector2 halfSize = npc.frame.Size() / 2; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + if (npc.type == NPCID.TheDestroyerBody) + { + if (npc.ai[2] == 0f) + npc.frame.Y = 0; + else + npc.frame.Y = frameHeight; + } + + // Draw segments + spriteBatch.Draw(npcTexture, npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), + npc.frame, npc.GetAlpha(drawColor), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + + // Draw lights + if (npc.ai[2] == 0f) + { + if ((newAI[3] >= 900f && npc.life / (float)npc.lifeMax < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) + { + spriteBatch.Draw(Main.destTexture[npc.type - NPCID.TheDestroyer], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, + new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + else + { + spriteBatch.Draw(Main.destTexture[npc.type - NPCID.TheDestroyer], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame, + new Color(255, 255, 255, 0) * (1f - npc.alpha / 255f), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } + } + } + } } } @@ -4653,9 +4689,6 @@ namespace CalamityMod.NPCs { switch (npc.type) { - case NPCID.DevourerHead: - case NPCID.DevourerBody: - case NPCID.DevourerTail: case NPCID.DiggerHead: case NPCID.DiggerBody: case NPCID.DiggerTail: @@ -4714,22 +4747,6 @@ namespace CalamityMod.NPCs } #endregion - #region Any Boss NPCs - public static bool AnyBossNPCS() - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type != NPCID.MartianSaucerCore && - (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == NPCType() || - Main.npc[i].type == NPCType() || Main.npc[i].type == NPCType() || Main.npc[i].type == NPCType())) - { - return true; - } - } - return CalamityUtils.FindFirstProjectile(ProjectileType()) != -1; - } - #endregion - #region Any Events public static bool AnyEvents(Player player) { @@ -4837,7 +4854,7 @@ namespace CalamityMod.NPCs { return CalamityWorld.downedBrimstoneElemental; } - else if (type == NPCType() || type == NPCType()) + else if (type == NPCType()) { return CalamityWorld.downedCalamitas; } @@ -4873,7 +4890,7 @@ namespace CalamityMod.NPCs { return CalamityWorld.downedProvidence; } - else if (type == NPCType() || type == NPCType() || type == NPCType()) + else if (type == NPCType() || type == NPCType()) { return CalamityWorld.downedSentinel1; } @@ -4901,12 +4918,20 @@ namespace CalamityMod.NPCs { return CalamityWorld.downedYharon; } + else if (type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType() || type == NPCType()) + { + return CalamityWorld.downedExoMechs; + } else if (type == NPCType()) { return CalamityWorld.downedSCal; } + else if (type == NPCType()) + { + return CalamityWorld.downedAdultEidolonWyrm; + } - return false; + return true; } #endregion @@ -4948,10 +4973,10 @@ namespace CalamityMod.NPCs if (EaterofWorldsIDs.Contains(target.type) || DestroyerIDs.Contains(target.type)) return false; - if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && - target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && - target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && - target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) + if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && + target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && + target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.GolemFistLeft && target.type != NPCID.GolemFistRight && + target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityLists.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) { return true; } @@ -4993,16 +5018,44 @@ namespace CalamityMod.NPCs projectile.ai[0] = 2f; projectile.netUpdate = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int boss = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, type); - CalamityUtils.BossAwakenMessage(boss); - } - else - { - NetMessage.SendData(MessageID.SpawnBoss, -1, -1, null, plr, (float)type, 0f, 0f, 0, 0, 0); - } - } + // The vanilla game uses a special packet for Duke Fishron spawning. + // However, this packet doesn't work on modded NPC types, so we must create + // a custom one. + // Also, you can't use Netmode != NetmodeID.MultiplayerClient in a projectile context that + // has an owner, hence the MyPlayer check. + if (Main.myPlayer == projectile.owner) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + if (!player.active || player.dead) + return; + + Projectile proj = null; + for (int i = 0; i < Main.maxProjectiles; i++) + { + proj = Main.projectile[i]; + if (Main.projectile[i].active && Main.projectile[i].bobber && Main.projectile[i].owner == player.whoAmI) + { + proj = Main.projectile[i]; + break; + } + } + + if (proj is null) + return; + + int oldDuke = NPC.NewNPC((int)proj.Center.X, (int)proj.Center.Y + 100, NPCType()); + CalamityUtils.BossAwakenMessage(oldDuke); + } + else + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ServersideSpawnOldDuke); + netMessage.Write((byte)player.whoAmI); + netMessage.Send(); + } + } + } break; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index c05a8edebe..922708a255 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Events; -using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.DifficultyItems; using CalamityMod.Items.LoreItems; @@ -13,39 +12,22 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Tiles.Ores; using CalamityMod.World; +using CalamityMod.World.Planets; using Microsoft.Xna.Framework; -using System.Collections.Generic; -using System.Linq; +using System.Threading; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs { - public class CalamityGlobalNPCLoot : GlobalNPC + public class CalamityGlobalNPCLoot : GlobalNPC { - public static int halibutCannonBaseDropChance = 100000; - #region Instance Per Entity public override bool InstancePerEntity => false; public override bool CloneNewInstances => false; @@ -54,208 +36,293 @@ namespace CalamityMod.NPCs #region PreNPCLoot public override bool PreNPCLoot(NPC npc) { - if (CalamityWorld.bossRushActive) - { - return BossRushLootCancel(npc, mod); - } - - bool abyssLootCancel = AbyssLootCancel(npc, mod); - if (abyssLootCancel) + // No bosses drop loot in Boss Rush. Progress the event instead. + if (BossRushEvent.BossRushActive) { + BossRushEvent.OnBossKill(npc, mod); return false; } - if (CalamityWorld.death) - { - switch (npc.type) - { - case NPCID.DevourerHead: - case NPCID.DevourerBody: - case NPCID.DevourerTail: - return SplittingWormLoot(npc, mod, 0); - case NPCID.DiggerHead: - case NPCID.DiggerBody: - case NPCID.DiggerTail: - return SplittingWormLoot(npc, mod, 1); - case NPCID.SeekerHead: - case NPCID.SeekerBody: - case NPCID.SeekerTail: - return SplittingWormLoot(npc, mod, 2); - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerTail: - return SplittingWormLoot(npc, mod, 3); - default: - break; - } - } + // TODO -- why do we have random enemies dying in the abyss regardless of whether they're underwater + // this just causes multiplayer desyncs if anything + if (AbyssLootCancel(npc, mod)) + return false; - if (CalamityWorld.revenge) + if (CalamityWorld.death && !SplittingWormLootBlockWrapper(npc, mod)) + return false; + + // Do not provide free hearts for certain boss NPCs in Rev+. + if ((CalamityWorld.revenge || CalamityWorld.malice) && CalamityLists.heartDropBlockList.Contains(npc.type) && CalamityPlayer.areThereAnyDamnBosses) + DropHelper.BlockDrops(ItemID.Heart); + + // + // Ozzatron 17FEB2021: A NOTE about PreNPCLoot vs NPCLoot + // PreNPCLoot runs before the boss is marked as dead. This means it is required for lore items and Resident Evil ammo. + // Because we already have clauses here for every boss, it is more convenient to drop everything here than it is. + // to iterate through all the bosses twice. + // + + // Since Calamity makes it spawn in pre-hardmode, don't want to cause other mods to freak out if they use it as a tier gate (like a new weapon or something) + if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) { - if (npc.type == NPCID.Probe || npc.type == NPCID.ServantofCthulhu) - { - return false; - } + DropHelper.DropItem(npc, ItemID.Glowstick, 1, 4); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + return false; } // Determine whether this NPC is the second Twin killed in a fight, regardless of which Twin it is. bool lastTwinStanding = false; if (npc.type == NPCID.Retinazer) - { lastTwinStanding = !NPC.AnyNPCs(NPCID.Spazmatism); - } else if (npc.type == NPCID.Spazmatism) - { lastTwinStanding = !NPC.AnyNPCs(NPCID.Retinazer); - } // Mechanical Bosses' combined lore item bool mechLore = !NPC.downedMechBossAny && (lastTwinStanding || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, mechLore); - if (npc.type == NPCID.KingSlime) - { - // Drop a huge spray of Gel items - int minGel = Main.expertMode ? 90 : 60; - int maxGel = Main.expertMode ? 120 : 80; - DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); + if (CalamityWorld.armageddon) + ArmageddonLoot(npc); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedSlimeKing); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedSlimeKing, 2, 0, 0); + if (npc.type == NPCID.KingSlime) + { + // Drop a huge spray of Gel items + int minGel = Main.expertMode ? 90 : 60; + int maxGel = Main.expertMode ? 120 : 80; + DropHelper.DropItemSpray(npc, ItemID.Gel, minGel, maxGel, 2); + // Legendary drop for King Slime + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedSlimeKing); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, NPC.downedSlimeKing); } - else if (npc.type == NPCID.EyeofCthulhu) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss1); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss1, 2, 0, 0); + else if (npc.type == NPCID.EyeofCthulhu) + { + // Legendary drops for Eye of Cthulhu + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss1); } - else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss2, 2, 0, 0); - + else if ((npc.boss && (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail)) || npc.type == NPCID.BrainofCthulhu) + { + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, WorldGen.crimson && !NPC.downedBoss2); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedBoss2); } - else if (npc.type == NPCID.QueenBee) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedQueenBee); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedQueenBee, 2, 0, 0); + else if (npc.type == NPCID.QueenBee) + { + // Drop weapons Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] queenBeeWeapons = new int[] + { + ItemID.BeeKeeper, + ItemID.BeesKnees, + ItemID.BeeGun, + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, queenBeeWeapons); + DropHelper.BlockDrops(queenBeeWeapons); + } + DropHelper.DropItemCondition(npc, ItemID.Stinger, !Main.expertMode, 5, 10); // Extra stingers + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 30, 50); + + // Legendary drop for Queen Bee + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedQueenBee); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Dryad }, NPC.downedQueenBee); } - else if (npc.type == NPCID.SkeletronHead) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, DropHelper.RareVariantDropRateInt, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss3); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedBoss3, 3, 1, 0); + else if (npc.type == NPCID.SkeletronHead) + { + DropHelper.DropItemSpray(npc, ItemID.Bone, 70, 100, 5); + // Legendary drop for Skeletron + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.Dryad }, NPC.downedBoss3); } - else if (npc.type == NPCID.WallofFlesh) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode && !CalamityWorld.demonMode); // Demon Trophy - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 8, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), !Main.hardMode, Main.hardMode ? 0.1f : 1f); // 100% chance on first kill, 10% chance afterwards - DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); + else if (npc.type == NPCID.WallofFlesh) + { + if (!Main.expertMode) + { + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + int[] wofWeapons = new int[] + { + ItemID.BreakerBlade, + ItemID.ClockworkAssaultRifle, + ModContent.ItemType(), + ItemID.LaserRifle, + ModContent.ItemType(), + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, wofWeapons); + DropHelper.BlockDrops(wofWeapons); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); - DropHelper.DropResidentEvilAmmo(npc, Main.hardMode, 3, 1, 0); + // Drop emblems Calamity style instead of mutually exclusive -- this includes the Rogue Emblem. + int[] emblems = new int[] + { + ItemID.WarriorEmblem, + ItemID.RangerEmblem, + ItemID.SorcererEmblem, + ItemID.SummonerEmblem, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, 0.25f, emblems); + DropHelper.BlockDrops(emblems); + } - CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, ModContent.NPCType() }, Main.hardMode); + // Drop Demon Trophy directly if it hasn't been used yet and Expert Mode is not active. + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode && !CalamityWorld.demonMode); + + // Drop Hermit's Box directly for EACH player, regardles of Expert or not. 100% chance on first kill, 10% chance afterwards. + float hermitBoxChance = Main.hardMode ? 1f : 0.1f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), true, hermitBoxChance); + + DropHelper.DropItemFromSetCondition(npc, !Main.expertMode, 0.2f, ItemID.CorruptionKey, ItemID.CrimsonKey); + + // Legendary drop for Wall of Flesh + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.hardMode); + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, ModContent.NPCType() }, Main.hardMode); // First kill text (this is not a loot function) if (!Main.hardMode) { - string key2 = "Mods.CalamityMod.UglyBossText"; //Sunken Sea buff - //string key = "Mods.CalamityMod.SteelSkullBossText"; //clone can now be fought + // Increase altar count to allow natural mech boss spawning. + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + WorldGen.altarCount++; + + string key2 = "Mods.CalamityMod.UglyBossText"; Color messageColor2 = Color.Aquamarine; - //Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) { - Main.NewText(Language.GetTextValue(key2), messageColor2); - // Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - //NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key3 = "Mods.CalamityMod.HardmodeOreTier1Text"; + Color messageColor3 = new Color(50, 255, 130); + CalamityUtils.SpawnOre(TileID.Cobalt, 12E-05, 0.4f, 0.6f, 3, 8); + CalamityUtils.SpawnOre(TileID.Palladium, 12E-05, 0.4f, 0.6f, 3, 8); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); } } - } - else if (lastTwinStanding) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss2); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss2, 4, 2, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityGlobalNPC.DraedonMayhem, 1f, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityGlobalNPC.DraedonMayhem, 1f, 8, 16); + } + else if (lastTwinStanding) + { + // Only drop hallowed bars after all mechs are down + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + DropHelper.BlockDrops(ItemID.HallowedBar); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + + // Legendary drop for Twins + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss2); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss2 || !CalamityConfig.Instance.SellVanillaSummons); - } - else if (npc.type == NPCID.TheDestroyer) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss1); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss1, 4, 2, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityGlobalNPC.DraedonMayhem, 1f, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityGlobalNPC.DraedonMayhem, 1f, 8, 16); + if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + SpawnMechBossHardmodeOres(); + } + else if (npc.type == NPCID.TheDestroyer) + { + // Only drop hallowed bars after all mechs are down + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + DropHelper.BlockDrops(ItemID.HallowedBar); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + + // Legendary drop for Destroyer + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss1 || !CalamityConfig.Instance.SellVanillaSummons); - } - else if (npc.type == NPCID.SkeletronPrime) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, npc.ai[1] == 2f && CalamityWorld.revenge); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMechBoss3, 4, 2, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityGlobalNPC.DraedonMayhem, 1f, 8, 16); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityGlobalNPC.DraedonMayhem, 1f, 8, 16); + if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + SpawnMechBossHardmodeOres(); + } + else if (npc.type == NPCID.SkeletronPrime) + { + // Only drop hallowed bars after all mechs are down + if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + DropHelper.BlockDrops(ItemID.HallowedBar); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16); + + // Legendary drop for Skeletron Prime + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle, ModContent.NPCType() }, NPC.downedMechBossAny); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss3 || !CalamityConfig.Instance.SellVanillaSummons); - } - else if (npc.type == NPCID.Plantera) - { - DropHelper.DropItemCondition(npc, ItemID.JungleKey, !Main.expertMode, 5, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedPlantBoss); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); + if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + SpawnMechBossHardmodeOres(); + } + else if (npc.type == NPCID.Plantera) + { + // Drop weapons Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] planteraWeapons = new int[] + { + ItemID.FlowerPow, + ItemID.Seedler, + ItemID.GrenadeLauncher, + ItemID.VenusMagnum, + ItemID.LeafBlower, + ItemID.NettleBurst, + ItemID.WaspGun, + ItemID.PygmyStaff + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, planteraWeapons); + DropHelper.BlockDrops(planteraWeapons); + } + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); + DropHelper.DropItemCondition(npc, ItemID.JungleKey, !Main.expertMode, 5, 1, 1); + + // Legendary drop for Plantera + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedPlantBoss); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); // Spawn Perennial Ore if Plantera has never been killed if (!NPC.downedPlantBoss) - { - string key2 = "Mods.CalamityMod.PlantOreText"; - Color messageColor2 = Color.GreenYellow; - string key3 = "Mods.CalamityMod.SandSharkText3"; - Color messageColor3 = Color.Goldenrod; + { + string key2 = "Mods.CalamityMod.PlantOreText"; + Color messageColor2 = Color.GreenYellow; + string key3 = "Mods.CalamityMod.SandSharkText3"; + Color messageColor3 = Color.Goldenrod; - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .5f, .7f); + CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.5f, 0.7f, 3, 8, TileID.Dirt, TileID.Stone); - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } - } - } + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); + } + } + + // These event enemies set shop variables and since those depend on downed bools they must be done in PreNPCLoot. else if (npc.type == NPCID.Pumpking) { CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Clothier }, NPC.downedHalloweenKing); @@ -273,509 +340,294 @@ namespace CalamityMod.NPCs CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Clothier }, NPC.downedChristmasIceQueen); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, !NPC.downedChristmasTree || !NPC.downedChristmasSantank || NPC.downedChristmasIceQueen); } - else if (npc.type == NPCID.Golem) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, DropHelper.RareVariantDropRateFloat); - DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !NPC.downedGolemBoss); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedGolemBoss); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedGolemBoss, 4, 2, 1); + else if (npc.type == NPCID.Golem) + { + // Drop loot Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] golemItems = new int[] + { + ItemID.GolemFist, + ItemID.PossessedHatchet, + ItemID.Stynger, + ItemID.HeatRay, + ItemID.StaffofEarth, + ItemID.EyeoftheGolem, + ItemID.SunStone, + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, golemItems); + DropHelper.BlockDrops(golemItems); + } + + // If Golem has never been killed, provide a Picksaw to all players. This only applies in Normal Mode. + // The Golem Treasure Bag is guaranteed to provide a Picksaw if one is not yet in the inventory. + DropHelper.DropItemCondition(npc, ItemID.Picksaw, true, !Main.expertMode && !NPC.downedGolemBoss); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 10); + + // Legendary drop for Golem + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedGolemBoss); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); - // If Golem has never been killed, send messages about PBG + // If Golem has never been killed, send a message about the Plague. if (!NPC.downedGolemBoss) - { - string key = "Mods.CalamityMod.BabyBossText"; - Color messageColor = Color.Lime; + { + string key = "Mods.CalamityMod.BabyBossText"; + Color messageColor = Color.Lime; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) - { - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBetsy, 4, 2, 1); + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + } + else if (npc.type == NPCID.DD2Betsy && !CalamityWorld.downedBetsy) + { + // Drop weapons Calamity style instead of mutually exclusive. + if (!Main.expertMode) + { + int[] betsyWeapons = new int[] + { + ItemID.DD2SquireBetsySword, // Flying Dragon + ItemID.MonkStaffT3, // Sky Dragon's Fury + ItemID.DD2BetsyBow, // Aerial Bane + ItemID.ApprenticeStaffT3, // Betsy's Wrath + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, betsyWeapons); + DropHelper.BlockDrops(betsyWeapons); + } - // Mark Betsy as dead (Vanilla does not keep track of her) - CalamityWorld.downedBetsy = true; - CalamityMod.UpdateServerBoolean(); - } - else if (npc.type == NPCID.DukeFishron) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedFishron); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedPlantBoss, 4, 2, 1); + // Mark Betsy as dead (Vanilla does not keep track of her) + CalamityWorld.downedBetsy = true; + CalamityNetcode.SyncWorld(); + } + else if (npc.type == NPCID.DukeFishron) + { + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + if (!Main.expertMode) + { + int[] dukeWeapons = new int[] + { + ItemID.Flairon, + ItemID.Tsunami, + ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, dukeWeapons); + DropHelper.BlockDrops(dukeWeapons); + } + // Legendary drop for Duke Fishron + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedFishron); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedFishron || !CalamityConfig.Instance.SellVanillaSummons); } - else if (npc.type == NPCID.CultistBoss) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedAncientCultist); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedAncientCultist, 4, 2, 1); + else if (npc.type == NPCID.CultistBoss) + { + // Legendary drops for Cultist + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - // Blood Moon lore item - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, Main.bloodMoon); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedAncientCultist); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, Main.bloodMoon); - // Deus text (this is not a loot function) - if (!NPC.downedAncientCultist) - { - string key = "Mods.CalamityMod.DeusText"; - Color messageColor = Color.Gold; + // Deus text (this is not a loot function) + if (!NPC.downedAncientCultist) + { + string key = "Mods.CalamityMod.DeusText"; + Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else if (npc.type == NPCID.MoonLordCore) - { - DropHelper.DropItemCondition(npc, ItemID.LunarOre, !Main.expertMode, 50, 50); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.expertMode); - DropHelper.DropItemCondition(npc, ItemID.GravityGlobe, !Main.expertMode); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 9, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, DropHelper.RareVariantDropRateInt, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, DropHelper.RareVariantDropRateInt, 1, 1); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMoonlord); - DropHelper.DropResidentEvilAmmo(npc, NPC.downedMoonlord, 5, 2, 1); + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + } + else if (npc.type == NPCID.MoonLordCore) + { + // Drop weapons Calamity style instead of mutually exclusive -- this includes Calamity weapons. + if (!Main.expertMode) + { + int[] moonLordWeapons = new int[] + { + ItemID.Meowmere, + ItemID.StarWrath, + ItemID.Terrarian, + ItemID.FireworksLauncher, // Celebration + // ItemID.CelebrationMK2, + ItemID.SDMG, + ItemID.LastPrism, + ItemID.LunarFlareBook, + ItemID.MoonlordTurretStaff, // Lunar Portal Staff + ItemID.RainbowCrystalStaff, + ModContent.ItemType(), + }; + DropHelper.DropEntireSet(npc, DropHelper.NormalWeaponDropRateFloat, moonLordWeapons); + DropHelper.BlockDrops(moonLordWeapons); + } + // Gravity Globe is available to Normal players as well + DropHelper.DropItemCondition(npc, ItemID.GravityGlobe, !Main.expertMode); + + // One Celestial Onion is given to each player individually + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !Main.expertMode); + + // Legendary drops for Moon Lord + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !NPC.downedMoonlord); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, NPC.downedMoonlord); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, NPC.downedMoonlord || !CalamityConfig.Instance.SellVanillaSummons); string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.MoonBossText2"; + Color messageColor2 = Color.Violet; + string key3 = "Mods.CalamityMod.MoonBossText3"; + Color messageColor3 = Color.Crimson; + string key4 = "Mods.CalamityMod.ProfanedBossText2"; + Color messageColor4 = Color.Cyan; + string key5 = "Mods.CalamityMod.FutureOreText"; + Color messageColor5 = Color.LightGray; - // Spawn Exodium and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet + if (!CalamityWorld.HasGeneratedLuminitePlanetoids) + { + // Generate luminite planetoids. + // This operation is done on a separate thread to lighten the load on servers so that they + // can focus on more critical operations asychronously and ideally avoid a time-out crash. + // Very few operations in Terraria utilize the pool, so it is highly unlikely that no threads will remain in it. + ThreadPool.QueueUserWorkItem(_ => LuminitePlanet.GenerateLuminitePlanetoids()); + + CalamityWorld.HasGeneratedLuminitePlanetoids = true; + + // If the moon lord is already marked as dead, an associated world sync packet will not be sent automatically + // Send one manually. + if (NPC.downedMoonlord) + CalamityNetcode.SyncWorld(); + } + + // Spawn Exodium planetoids and send messages about Providence, Bloodstone, Phantoplasm, etc. if ML has not been killed yet if (!NPC.downedMoonlord) - { - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .01f, .07f); - - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - Main.NewText(Language.GetTextValue(key4), messageColor4); - Main.NewText(Language.GetTextValue(key5), messageColor5); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); - } - } - } - //Since Calamity makes it spawn in pre-hardmode, don't want to cause other mods to freak out if they use it as a tier gate (like a new weapon or something) - else if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) - { - DropHelper.DropItem(npc, ItemID.Glowstick, 1, 4); - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.1f); - DropHelper.DropItemChance(npc, ItemID.Megaphone, Main.expertMode ? 0.2f : 0.1f); - DropHelper.DropItemCondition(npc, ItemID.JellyfishNecklace, CalamityWorld.defiled, DropHelper.DefiledDropRateFloat); - DropHelper.DropItemCondition(npc, ItemID.Megaphone, CalamityWorld.defiled, DropHelper.DefiledDropRateFloat); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - return false; + { + CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); + CalamityUtils.DisplayLocalizedText(key4, messageColor4); + CalamityUtils.DisplayLocalizedText(key5, messageColor5); + } } - else if (npc.type == NPCID.VoodooDemon && Main.player[npc.target].Calamity().underworldLore) + else if (npc.type == NPCID.RedDevil) { - NPCLoader.blockLoot.Add(ItemID.GuideVoodooDoll); + DropHelper.DropItemChance(npc, ItemID.FireFeather, 0.1f); + DropHelper.BlockDrops(ItemID.FireFeather); + } + else if (npc.type == NPCID.Vampire || npc.type == NPCID.VampireBat) + { + DropHelper.DropItemChance(npc, ItemID.MoonStone, 0.15f); + DropHelper.BlockDrops(ItemID.MoonStone); + } + else if (npc.type == NPCID.Werewolf) + { + DropHelper.DropItemChance(npc, ItemID.MoonCharm, 0.05f); + DropHelper.BlockDrops(ItemID.MoonCharm); + } + else if (npc.type == NPCID.Mimic) + { + float w = DropHelper.BagWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(ItemID.StarCloak, w), + DropHelper.WeightStack(ItemID.CrossNecklace, w), + DropHelper.WeightStack(ItemID.TitanGlove, w), + DropHelper.WeightStack(ItemID.DualHook, w), + DropHelper.WeightStack(ItemID.MagicDagger, w), + DropHelper.WeightStack(ItemID.Compass, w), + DropHelper.WeightStack(ItemID.PhilosophersStone, w) + ); + + int[] mimicDrops = new int[] + { + ItemID.StarCloak, + ItemID.CrossNecklace, + ItemID.TitanGlove, + ItemID.DualHook, + ItemID.MagicDagger, + ItemID.Compass, + ItemID.PhilosophersStone + }; + DropHelper.BlockDrops(mimicDrops); + } + else if (npc.type == NPCID.Moth) + { + DropHelper.DropItem(npc, ItemID.ButterflyDust); + DropHelper.BlockDrops(ItemID.ButterflyDust); + } + else if (npc.type >= NPCID.RustyArmoredBonesAxe && npc.type <= NPCID.HellArmoredBonesSword) + { + DropHelper.DropItemChance(npc, ItemID.WispinaBottle, 0.005f); + DropHelper.BlockDrops(ItemID.WispinaBottle); + } + else if (npc.type == NPCID.Paladin) + { + DropHelper.DropItemChance(npc, ItemID.PaladinsHammer, 0.15f); + DropHelper.DropItemChance(npc, ItemID.PaladinsShield, 0.2f); + + int[] paladinDrops = new int[] + { + ItemID.PaladinsHammer, + ItemID.PaladinsShield + }; + DropHelper.BlockDrops(paladinDrops); + } + else if (npc.type == NPCID.BoneLee) + { + DropHelper.DropItemChance(npc, ItemID.BlackBelt, 0.25f); + DropHelper.DropItemChance(npc, ItemID.Tabi, 0.25f); + + int[] boneLeeDrops = new int[] + { + ItemID.BlackBelt, + ItemID.Tabi + }; + DropHelper.BlockDrops(boneLeeDrops); } - return true; + return true; } - #endregion + #endregion - #region Boss Rush Loot Cancel - private bool BossRushLootCancel(NPC npc, Mod mod) - { - if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 7; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 9; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 12; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 14; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 16; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 17; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 18; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 20; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 22; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 23; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 24; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 25; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 26; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 27; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType() && npc.Calamity().newAI[0] != 0f) - { - CalamityWorld.bossRushStage = 30; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 31; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 32; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 33; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) - { - int bossType = (npc.type == ModContent.NPCType()) ? ModContent.NPCType() : ModContent.NPCType(); - if (!NPC.AnyNPCs(bossType)) - { - CalamityWorld.bossRushStage = 34; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - } - else if (npc.type == ModContent.NPCType()) + #region Spawn Mech Boss Hardmode Ores + private void SpawnMechBossHardmodeOres() + { + if (!NPC.downedMechBossAny) { - CalamityWorld.bossRushStage = 35; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; + string key = "Mods.CalamityMod.HardmodeOreTier2Text"; + Color messageColor = new Color(50, 255, 130); + CalamityUtils.SpawnOre(TileID.Mythril, 12E-05, 0.5f, 0.7f, 3, 8); + CalamityUtils.SpawnOre(TileID.Orichalcum, 12E-05, 0.5f, 0.7f, 3, 8); + CalamityUtils.DisplayLocalizedText(key, messageColor); } - else if (npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType()) - { - if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) - { - CalamityWorld.bossRushStage = 36; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) - { - CalamityWorld.bossRushStage = 36; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType() && !NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType()) && - NPC.CountNPCS(ModContent.NPCType()) < 2 && !NPC.AnyNPCs(ModContent.NPCType())) - { - CalamityWorld.bossRushStage = 36; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 37; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + { + string key = "Mods.CalamityMod.HardmodeOreTier3Text"; + Color messageColor = new Color(50, 255, 130); + CalamityUtils.SpawnOre(TileID.Adamantite, 12E-05, 0.6f, 0.8f, 3, 8); + CalamityUtils.SpawnOre(TileID.Titanium, 12E-05, 0.6f, 0.8f, 3, 8); + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + else + { + string key = "Mods.CalamityMod.HardmodeOreTier4Text"; + Color messageColor = new Color(50, 255, 130); + CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.45f, 0.8f, 3, 8, TileID.Pearlstone, TileID.HallowHardenedSand, TileID.HallowSandstone, TileID.HallowedIce); + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + } + #endregion - string key = "Mods.CalamityMod.BossRushTierFourEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 38; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - CalamityWorld.bossRushStage = 39; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - } - else if (npc.type == ModContent.NPCType()) - { - DropHelper.DropItem(npc, ModContent.ItemType(), true); - CalamityWorld.bossRushStage = 0; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - CalamityWorld.bossRushActive = false; - - CalamityMod.UpdateServerBoolean(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - } - - string key = "Mods.CalamityMod.BossRushTierFiveEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - - return false; - } - - switch (npc.type) - { - case NPCID.QueenBee: - CalamityWorld.bossRushStage = 1; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.BrainofCthulhu: - CalamityWorld.bossRushStage = 2; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.KingSlime: - CalamityWorld.bossRushStage = 3; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.EyeofCthulhu: - CalamityWorld.bossRushStage = 4; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.SkeletronPrime: - CalamityWorld.bossRushStage = 5; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.Golem: - CalamityWorld.bossRushStage = 6; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - CalamityWorld.bossRushStage = 8; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.TheDestroyer: - CalamityWorld.bossRushStage = 10; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - - string key = "Mods.CalamityMod.BossRushTierOneEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - - break; - - case NPCID.Spazmatism: - CalamityWorld.bossRushStage = 11; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.Retinazer: - CalamityWorld.bossRushStage = 11; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.WallofFlesh: - CalamityWorld.bossRushStage = 13; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.SkeletronHead: - CalamityWorld.bossRushStage = 15; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.CultistBoss: - CalamityWorld.bossRushStage = 19; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - - string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; - Color messageColor2 = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - - break; - - case NPCID.Plantera: - CalamityWorld.bossRushStage = 21; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - case NPCID.DukeFishron: - CalamityWorld.bossRushStage = 28; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - - string key3 = "Mods.CalamityMod.BossRushTierThreeEndText"; - Color messageColor3 = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } - - break; - - case NPCID.MoonLordCore: - CalamityWorld.bossRushStage = 29; - CalamityUtils.KillAllHostileProjectiles(); - CalamityWorld.bossRushHostileProjKillCounter = 3; - break; - - default: - break; - } - - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - var netMessage2 = mod.GetPacket(); - netMessage2.Write((byte)CalamityModMessageType.BRHostileProjKillSync); - netMessage2.Write(CalamityWorld.bossRushHostileProjKillCounter); - netMessage2.Send(); - } - - return false; - } - #endregion - - #region Abyss Loot Cancel - private bool AbyssLootCancel(NPC npc, Mod mod) + #region Abyss Loot Cancel + private bool AbyssLootCancel(NPC npc, Mod mod) { int x = Main.maxTilesX; int y = Main.maxTilesY; @@ -801,47 +653,112 @@ namespace CalamityMod.NPCs } bool hurtByAbyss = npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && - (((npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && - abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && !npc.buffImmune[ModContent.BuffType()]; + (npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && + abyssPosY && abyssPosX && !npc.buffImmune[ModContent.BuffType()]; return hurtByAbyss; + } + #endregion + + #region Splitting Worm Loot + internal static bool SplittingWormLootBlockWrapper(NPC npc, Mod mod) + { + if (!CalamityWorld.death) + return true; + + switch (npc.type) + { + case NPCID.DiggerHead: + case NPCID.DiggerBody: + case NPCID.DiggerTail: + return SplittingWormLoot(npc, mod, 0); + case NPCID.SeekerHead: + case NPCID.SeekerBody: + case NPCID.SeekerTail: + return SplittingWormLoot(npc, mod, 1); + case NPCID.DuneSplicerHead: + case NPCID.DuneSplicerBody: + case NPCID.DuneSplicerTail: + return SplittingWormLoot(npc, mod, 2); + default: + return true; + } + } + + internal static bool SplittingWormLoot(NPC npc, Mod mod, int wormType) + { + switch (wormType) + { + case 0: return CheckSegments(NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail); + case 1: return CheckSegments(NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); + case 2: return CheckSegments(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail); + default: + break; + } + + bool CheckSegments(int head, int body, int tail) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == head || Main.npc[i].type == body || Main.npc[i].type == tail)) + { + return false; + } + } + return true; + } + + return true; } #endregion - #region Splitting Worm Loot - private bool SplittingWormLoot(NPC npc, Mod mod, int wormType) + #region Armageddon Loot + private void ArmageddonLoot(NPC npc) { - switch (wormType) + switch (npc.type) { - case 0: return CheckSegments(NPCID.DevourerHead, NPCID.DevourerBody, NPCID.DevourerTail); - case 1: return CheckSegments(NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail); - case 2: return CheckSegments(NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); - case 3: return CheckSegments(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail); + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + if (npc.boss) // only drop from the 1 "boss" segment (redcode) + DropHelper.DropArmageddonBags(npc); + break; + + case NPCID.Retinazer: // only drop if spaz is already dead + if (!NPC.AnyNPCs(NPCID.Spazmatism)) + DropHelper.DropArmageddonBags(npc); + break; + + case NPCID.Spazmatism: // only drop if ret is already dead + if (!NPC.AnyNPCs(NPCID.Retinazer)) + DropHelper.DropArmageddonBags(npc); + break; + + case NPCID.KingSlime: + case NPCID.EyeofCthulhu: + case NPCID.BrainofCthulhu: + case NPCID.QueenBee: + case NPCID.SkeletronHead: + case NPCID.WallofFlesh: + case NPCID.TheDestroyer: + case NPCID.SkeletronPrime: + case NPCID.Plantera: + case NPCID.Golem: + case NPCID.DD2Betsy: + case NPCID.DukeFishron: + case NPCID.MoonLordCore: + DropHelper.DropArmageddonBags(npc); + break; + default: break; } - - bool CheckSegments(int head, int body, int tail) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == head || Main.npc[i].type == body || Main.npc[i].type == tail)) - { - return false; - } - } - return true; - } - - return true; } #endregion #region NPCLoot public override void NPCLoot(NPC npc) { - ResetAdrenaline(npc); - // LATER -- keeping bosses alive lets draedon mayhem continue even after killing mechs // Reset Draedon Mayhem to false if no bosses are alive if (CalamityGlobalNPC.DraedonMayhem) @@ -849,406 +766,20 @@ namespace CalamityMod.NPCs if (!CalamityPlayer.areThereAnyDamnBosses) { CalamityGlobalNPC.DraedonMayhem = false; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } } - if (CalamityWorld.defiled) - DefiledLoot(npc); - if (CalamityWorld.armageddon) - ArmageddonLoot(npc); - - AcidRainProgression(npc); + // Miscellaneous on-enemy-kill effects. CheckBossSpawn(npc); + if (CalamityWorld.rainingAcid) + AcidRainEvent.OnEnemyKill(npc); + ArmorSetLoot(npc); RareLoot(npc); - RareVariants(npc); CommonLoot(npc); TownNPCLoot(npc); - EventEnemyLoot(npc, Main.pumpkinMoon, Main.snowMoon, Main.eclipse); - } - #endregion - - #region Defiled Loot - private void DefiledLoot(NPC npc) - { - switch (npc.type) - { - case NPCID.Werewolf: - DropHelper.DropItemChance(npc, ItemID.MoonCharm, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, DropHelper.DefiledDropRateInt); - break; - - case NPCID.AnglerFish: - DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, DropHelper.DefiledDropRateInt); - break; - - case NPCID.DesertBeast: - DropHelper.DropItemChance(npc, ItemID.AncientHorn, DropHelper.DefiledDropRateInt); - break; - - case NPCID.ArmoredSkeleton: - case NPCID.HeavySkeleton: - DropHelper.DropItemChance(npc, ItemID.BeamSword, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.ArmorPolish, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Clown: - DropHelper.DropItemChance(npc, ItemID.Bananarang, DropHelper.DefiledDropRateInt); - break; - - case NPCID.ToxicSludge: - DropHelper.DropItemChance(npc, ItemID.Bezoar, DropHelper.DefiledDropRateInt); - break; - - case NPCID.EyeofCthulhu: - DropHelper.DropItemChance(npc, ItemID.Binoculars, DropHelper.DefiledDropRateInt); - break; - - case NPCID.WanderingEye: - DropHelper.DropItemChance(npc, ItemID.BlackLens, DropHelper.DefiledDropRateInt); - break; - - case NPCID.CorruptSlime: - DropHelper.DropItemChance(npc, ItemID.Blindfold, DropHelper.DefiledDropRateInt); - break; - - // This is all the random skeletons in the hardmode dungeon - case NPCID.RustyArmoredBonesAxe: - case NPCID.RustyArmoredBonesFlail: - case NPCID.RustyArmoredBonesSword: - case NPCID.RustyArmoredBonesSwordNoArmor: - case NPCID.BlueArmoredBones: - case NPCID.BlueArmoredBonesMace: - case NPCID.BlueArmoredBonesNoPants: - case NPCID.BlueArmoredBonesSword: - case NPCID.HellArmoredBones: - case NPCID.HellArmoredBonesSpikeShield: - case NPCID.HellArmoredBonesMace: - case NPCID.HellArmoredBonesSword: - DropHelper.DropItemChance(npc, ItemID.Keybrand, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.BoneFeather, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.MagnetSphere, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.WispinaBottle, DropHelper.DefiledDropRateInt); - break; - - case NPCID.UndeadMiner: - DropHelper.DropItemChance(npc, ItemID.BonePickaxe, DropHelper.DefiledDropRateInt); - break; - - case NPCID.ScutlixRider: - DropHelper.DropItemChance(npc, ItemID.BrainScrambler, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Vampire: - DropHelper.DropItemChance(npc, ItemID.BrokenBatWing, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.MoonStone, DropHelper.DefiledDropRateInt); - break; - - case NPCID.CaveBat: - DropHelper.DropItemChance(npc, ItemID.ChainKnife, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.DepthMeter, DropHelper.DefiledDropRateInt); - break; - - case NPCID.DarkCaster: - DropHelper.DropItemChance(npc, ItemID.ClothierVoodooDoll, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.TallyCounter, DropHelper.DefiledDropRateInt); - break; - - case NPCID.PirateCaptain: - DropHelper.DropItemChance(npc, ItemID.CoinGun, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.DiscountCard, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.Cutlass, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.LuckyCoin, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.PirateStaff, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Reaper: - DropHelper.DropItemChance(npc, ItemID.DeathSickle, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Demon: - case NPCID.VoodooDemon: - DropHelper.DropItemChance(npc, ItemID.DemonScythe, DropHelper.DefiledDropRateInt); - break; - - case NPCID.DesertDjinn: - DropHelper.DropItemChance(npc, ItemID.DjinnLamp, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.DjinnsCurse, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Shark: - DropHelper.DropItemChance(npc, ItemID.DivingHelmet, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Pixie: - case NPCID.Wraith: - case NPCID.Mummy: - DropHelper.DropItemChance(npc, ItemID.FastClock, DropHelper.DefiledDropRateInt); - break; - - case NPCID.RedDevil: - DropHelper.DropItemChance(npc, ItemID.FireFeather, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.UnholyTrident, DropHelper.DefiledDropRateInt); - break; - - case NPCID.IceElemental: - case NPCID.IcyMerman: - DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.FrostStaff, DropHelper.DefiledDropRateInt); - break; - - case NPCID.ArmoredViking: - DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); - break; - - case NPCID.IceTortoise: - DropHelper.DropItemChance(npc, ItemID.IceSickle, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.FrozenTurtleShell, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Harpy: - DropHelper.DropItemCondition(npc, ItemID.GiantHarpyFeather, Main.hardMode && !npc.SpawnedFromStatue, DropHelper.DefiledDropRateFloat); - break; - - case NPCID.Piranha: - DropHelper.DropItemChance(npc, ItemID.Hook, DropHelper.DefiledDropRateInt); - break; - - case NPCID.PinkJellyfish: - case NPCID.BlueJellyfish: - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Paladin: - DropHelper.DropItemChance(npc, ItemID.Kraken, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.PaladinsHammer, DropHelper.DefiledDropRateInt); - break; - - case NPCID.SkeletonArcher: - DropHelper.DropItemChance(npc, ItemID.Marrow, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.MagicQuiver, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Lavabat: - DropHelper.DropItemChance(npc, ItemID.MagmaStone, DropHelper.DefiledDropRateInt); - break; - - case NPCID.WalkingAntlion: - DropHelper.DropItemChance(npc, ItemID.AntlionClaw, DropHelper.DefiledDropRateInt); - break; - - case NPCID.DarkMummy: - DropHelper.DropItemChance(npc, ItemID.Blindfold, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.Megaphone, DropHelper.DefiledDropRateInt); - break; - - case NPCID.GreenJellyfish: - DropHelper.DropItemChance(npc, ItemID.Megaphone, DropHelper.DefiledDropRateInt); - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, DropHelper.DefiledDropRateInt); - break; - - case NPCID.CursedSkull: - DropHelper.DropItemChance(npc, ItemID.Nazar, DropHelper.DefiledDropRateInt); - break; - - case NPCID.FireImp: - DropHelper.DropItemChance(npc, ItemID.ObsidianRose, DropHelper.DefiledDropRateInt); - DropHelper.DropItemCondition(npc, ItemID.Cascade, NPC.downedBoss3, DropHelper.DefiledDropRateFloat); - break; - - case NPCID.BlackRecluse: - case NPCID.BlackRecluseWall: - DropHelper.DropItemChance(npc, ItemID.PoisonStaff, DropHelper.DefiledDropRateInt); - break; - - case NPCID.ChaosElemental: - DropHelper.DropItemChance(npc, ItemID.RodofDiscord, DropHelper.DefiledDropRateInt); - break; - - case NPCID.SnowFlinx: - DropHelper.DropItemChance(npc, ItemID.SnowballLauncher, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Plantera: - DropHelper.DropItemChance(npc, ItemID.TheAxe, DropHelper.DefiledDropRateInt); - break; - - case NPCID.GiantBat: - DropHelper.DropItemChance(npc, ItemID.TrifoldMap, DropHelper.DefiledDropRateInt); - break; - - case NPCID.AngryTrapper: - DropHelper.DropItemChance(npc, ItemID.Uzi, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Corruptor: - case NPCID.FloatyGross: - DropHelper.DropItemChance(npc, ItemID.Vitamins, DropHelper.DefiledDropRateInt); - break; - - case NPCID.GiantTortoise: - DropHelper.DropItemCondition(npc, ItemID.Yelets, NPC.downedMechBossAny, DropHelper.DefiledDropRateFloat); - break; - - case NPCID.DeadlySphere: - DropHelper.DropItemChance(npc, ItemID.DeadlySphereStaff, DropHelper.DefiledDropRateInt); - break; - - case NPCID.DrManFly: - DropHelper.DropItemChance(npc, ItemID.ToxicFlask, DropHelper.DefiledDropRateInt); - break; - - case NPCID.CreatureFromTheDeep: - DropHelper.DropItemChance(npc, ItemID.NeptunesShell, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Butcher: - DropHelper.DropItemChance(npc, ItemID.ButchersChainsaw, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Psycho: - DropHelper.DropItemChance(npc, ItemID.PsychoKnife, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Drippler: - case NPCID.BloodZombie: - DropHelper.DropItemCondition(npc, ItemID.SharkToothNecklace, !npc.SpawnedFromStatue, DropHelper.DefiledDropRateFloat); - DropHelper.DropItemCondition(npc, ItemID.MoneyTrough, !npc.SpawnedFromStatue, DropHelper.DefiledDropRateFloat); - break; - - case NPCID.GoblinWarrior: - DropHelper.DropItemChance(npc, ItemID.Harpoon, DropHelper.DefiledDropRateInt); - break; - - case NPCID.Pinky: - DropHelper.DropItemChance(npc, ItemID.SlimeStaff, DropHelper.DefiledDropRateInt); - break; - - case NPCID.FlyingSnake: - DropHelper.DropItemChance(npc, ItemID.LizardEgg, DropHelper.DefiledDropRateInt); - break; - - default: - break; - } - - // Every type of demon eye counts for Black Lenses - if (CalamityMod.demonEyeList.Contains(npc.type)) - { - DropHelper.DropItemChance(npc, ItemID.BlackLens, DropHelper.DefiledDropRateInt); - } - - // Every type of Skeleton counts for the Bone Sword - if (CalamityMod.skeletonList.Contains(npc.type) && npc.type != NPCID.ArmoredSkeleton && npc.type != NPCID.HeavySkeleton && npc.type != NPCID.SkeletonArcher && npc.type != NPCID.GreekSkeleton) - { - DropHelper.DropItemChance(npc, ItemID.BoneSword, DropHelper.DefiledDropRateInt); - } - - // Every type of Angry Bones counts for the Clothier Voodoo Doll - if (CalamityMod.angryBonesList.Contains(npc.type)) - { - DropHelper.DropItemChance(npc, ItemID.ClothierVoodooDoll, DropHelper.DefiledDropRateInt); - } - - // Every type of hornet AND moss hornet can drop Bezoar - if (CalamityMod.hornetList.Contains(npc.type) || CalamityMod.mossHornetList.Contains(npc.type)) - { - DropHelper.DropItemChance(npc, ItemID.Bezoar, DropHelper.DefiledDropRateInt); - } - - // Every type of moss hornet can drop Tattered Bee Wings - if (CalamityMod.mossHornetList.Contains(npc.type)) - { - DropHelper.DropItemChance(npc, ItemID.TatteredBeeWing, DropHelper.DefiledDropRateInt); - } - - // Because all switch cases must be constant at compile time, modded NPC IDs (which can change) can't be included. - if (npc.type == ModContent.NPCType()) - { - DropHelper.DropItemChance(npc, ItemID.HelFire, DropHelper.DefiledDropRateInt); - } - else if (npc.type == ModContent.NPCType()) - { - DropHelper.DropItemChance(npc, ItemID.Amarok, DropHelper.DefiledDropRateInt); - } - } - #endregion - - #region Armageddon Loot - private void ArmageddonLoot(NPC npc) - { - switch (npc.type) - { - case NPCID.KingSlime: - case NPCID.EyeofCthulhu: - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - if (npc.boss) // only drop from the 1 "boss" segment (redcode) - { - DropHelper.DropArmageddonBags(npc); - } - - break; - - case NPCID.BrainofCthulhu: - case NPCID.QueenBee: - case NPCID.SkeletronHead: - case NPCID.WallofFlesh: - case NPCID.Retinazer: // only drop if spaz is already dead - if (!NPC.AnyNPCs(NPCID.Spazmatism)) - { - DropHelper.DropArmageddonBags(npc); - } - - break; - - case NPCID.Spazmatism: // only drop if ret is already dead - if (!NPC.AnyNPCs(NPCID.Retinazer)) - { - DropHelper.DropArmageddonBags(npc); - } - - break; - - case NPCID.TheDestroyer: - case NPCID.SkeletronPrime: - case NPCID.Plantera: - case NPCID.Golem: - case NPCID.DD2Betsy: - case NPCID.DukeFishron: - case NPCID.MoonLordCore: - DropHelper.DropArmageddonBags(npc); - break; - - default: - break; - } - } - #endregion - - #region Reset Adrenaline - private void ResetAdrenaline(NPC npc) - { - bool revenge = CalamityWorld.revenge; - if (npc.boss && revenge) - { - if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && - npc.type != ModContent.NPCType()) - { - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.player[Main.myPlayer].Calamity().adrenaline = 0; - } - } - } - } + EventLoot(npc, Main.pumpkinMoon, Main.snowMoon, Main.eclipse); } #endregion @@ -1265,28 +796,14 @@ namespace CalamityMod.NPCs string key = "Mods.CalamityMod.GhostBossText2"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } else if (CalamityMod.ghostKillCount == 20) { string key = "Mods.CalamityMod.GhostBossText3"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } if (CalamityMod.ghostKillCount >= 30 && Main.netMode != NetmodeID.MultiplayerClient) @@ -1314,28 +831,14 @@ namespace CalamityMod.NPCs string key = "Mods.CalamityMod.SandSharkText"; Color messageColor = Color.Goldenrod; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } else if (CalamityMod.sharkKillCount == 8) { string key = "Mods.CalamityMod.SandSharkText2"; Color messageColor = Color.Goldenrod; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); } if (CalamityMod.sharkKillCount >= 10 && Main.netMode != NetmodeID.MultiplayerClient) { @@ -1366,7 +869,7 @@ namespace CalamityMod.NPCs private void ArmorSetLoot(NPC npc) { // Tarragon armor set bonus: 20% chance to drop hearts from all valid enemies - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().tarraSet) + if (Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity().tarraSet) { if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.lifeMax > 100) { @@ -1382,8 +885,8 @@ namespace CalamityMod.NPCs DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); // 50% chance of 1 orb with Bloodflare } - // 1/12 chance to get a Blood Orb with or without Bloodflare - DropHelper.DropItemChance(npc, ModContent.ItemType(), 12); + // 20% chance to get a Blood Orb with or without Bloodflare + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); } } #endregion @@ -1394,93 +897,108 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Drippler: - int eyeballDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 300; - DropHelper.DropItemChance(npc, ModContent.ItemType(), eyeballDropRate, 1, 1); + float bouncingEyeballChance = Main.expertMode ? 0.05f : 0.025f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), bouncingEyeballChance); break; case NPCID.FireImp: - int stalactiteDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 100 : 150; - DropHelper.DropItemChance(npc, ModContent.ItemType(), stalactiteDropRate, 1, 1); + float stalactiteDropRate = Main.expertMode ? 0.16f : 0.1f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), stalactiteDropRate); break; case NPCID.PossessedArmor: - int amuletDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 150 : 200; - DropHelper.DropItemChance(npc, ModContent.ItemType(), amuletDropRate, 1, 1); + float amuletDropRate = Main.expertMode ? 0.05f : 0.025f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), amuletDropRate); + break; + + case NPCID.VampireBat: + case NPCID.Vampire: + float batHookDropRate = Main.expertMode ? 0.05f : 0.025f; + DropHelper.DropItemChance(npc, ItemID.BatHook, batHookDropRate); break; case NPCID.SeaSnail: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); + DropHelper.DropItem(npc, ModContent.ItemType()); break; case NPCID.GreekSkeleton: - int gladiatorDropRate = Main.expertMode ? 15 : 20; - DropHelper.DropItemChance(npc, ItemID.GladiatorHelmet, gladiatorDropRate); - DropHelper.DropItemChance(npc, ItemID.GladiatorBreastplate, gladiatorDropRate); - DropHelper.DropItemChance(npc, ItemID.GladiatorLeggings, gladiatorDropRate); + // Calamity increases the drop chance of the Gladiator's set because it's actually a set + float gladiatorDropRate = Main.expertMode ? 0.16f : 0.1f; + int[] gladiatorArmor = new int[] + { + ItemID.GladiatorHelmet, + ItemID.GladiatorBreastplate, + ItemID.GladiatorLeggings, + }; + DropHelper.DropItemFromSetChance(npc, gladiatorDropRate, gladiatorArmor); + DropHelper.BlockDrops(gladiatorArmor); break; case NPCID.GiantTortoise: - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.2f : 0.142857f, 0.005f); + float shellChance = Main.expertMode ? 0.25f : 0.15f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), shellChance); break; case NPCID.GiantShelly: case NPCID.GiantShelly2: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + float shellDropRate = Main.expertMode ? 0.25f : 0.15f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), shellDropRate); break; case NPCID.AnomuraFungus: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + float fungalShellDropRate = Main.expertMode ? 0.25f : 0.15f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), fungalShellDropRate); break; case NPCID.Crawdad: case NPCID.Crawdad2: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + float carapaceDropRate = Main.expertMode ? 0.25f : 0.15f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), carapaceDropRate); break; case NPCID.GreenJellyfish: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + float vitalJellyDropRate = Main.expertMode ? 0.25f : 0.15f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), vitalJellyDropRate); break; case NPCID.PinkJellyfish: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + float lifeJellyDropRate = Main.expertMode ? 0.125f : 0.075f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), lifeJellyDropRate); break; case NPCID.BlueJellyfish: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + float manaJellyDropRate = Main.expertMode ? 0.25f : 0.15f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), manaJellyDropRate); break; case NPCID.DarkCaster: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.BigMimicHallow: case NPCID.BigMimicCorruption: case NPCID.BigMimicCrimson: case NPCID.BigMimicJungle: // arguably unnecessary - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 7); break; case NPCID.Clinger: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.Shark: - DropHelper.DropItemChance(npc, ItemID.SharkToothNecklace, Main.expertMode ? 20 : 30); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 30); + DropHelper.DropItemChance(npc, ItemID.SharkToothNecklace, Main.expertMode ? 15 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; - - case NPCID.PresentMimic: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - break; - + case NPCID.IchorSticker: - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.05f : 0.04f, 0.005f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.Harpy: - int glazeDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 60 : 80; + int glazeDropRate = Main.expertMode ? 30 : 50; DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss1, glazeDropRate, 1, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode && !npc.SpawnedFromStatue, Main.expertMode ? 2 : 3, 1, 1); break; @@ -1488,31 +1006,31 @@ namespace CalamityMod.NPCs case NPCID.Antlion: case NPCID.WalkingAntlion: case NPCID.FlyingAntlion: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 30 : 40); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 30 : 40); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 30 : 50); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 30 : 50); break; case NPCID.TombCrawlerHead: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 20); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.DuneSplicerHead: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedPlantBoss, Main.expertMode ? 20 : 30, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedPlantBoss, Main.expertMode ? 15 : 25, 1, 1); break; case NPCID.MartianSaucerCore: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 7); break; case NPCID.Demon: case NPCID.VoodooDemon: DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.BoneSerpentHead: DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 10 : 15); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 7 : 12); break; case NPCID.Tim: @@ -1520,54 +1038,52 @@ namespace CalamityMod.NPCs break; case NPCID.GoblinSorcerer: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.PirateDeadeye: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.PirateCrossbower: - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.05f : 0.04f, 0.005f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.GoblinSummoner: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 6); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 5); break; case NPCID.SandElemental: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, 20, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 6 : 10); break; case NPCID.GoblinWarrior: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 20); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.MartianWalker: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 5 : 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 7); break; case NPCID.GiantCursedSkull: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedLeviathan, 10, 1, 1); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedLeviathan, Main.expertMode ? 15 : 25, 1, 1); break; case NPCID.Necromancer: case NPCID.NecromancerArmored: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 20 : 25); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 15 : 25); break; case NPCID.DeadlySphere: - float defectiveDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : Main.expertMode ? 0.0375f : 0.025f; - DropHelper.DropItemChance(npc, ModContent.ItemType(), defectiveDropRate); //same as deadly sphere staff + float defectiveDropRate = Main.expertMode ? 0.33f : 0.2f; + DropHelper.DropItemChance(npc, ModContent.ItemType(), defectiveDropRate); break; case NPCID.BloodJelly: case NPCID.FungoFish: - float necklaceDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.01f; - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, necklaceDropRate); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); break; default: @@ -1575,107 +1091,21 @@ namespace CalamityMod.NPCs } // Every type of Moss Hornet counts for the Needler - if (CalamityMod.mossHornetList.Contains(npc.type)) + if (CalamityLists.mossHornetList.Contains(npc.type)) { - int needlerDropRate = Main.expertMode ? 20 : 25; + int needlerDropRate = Main.expertMode ? 15 : 25; DropHelper.DropItemChance(npc, ModContent.ItemType(), needlerDropRate); } // Every type of Skeleton counts for the Waraxe and Ancient Bone Dust - if (CalamityMod.skeletonList.Contains(npc.type)) + if (CalamityLists.skeletonList.Contains(npc.type)) { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.hardMode, Main.expertMode ? 15 : 20, 1, 1); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.hardMode, Main.expertMode ? 15 : 25, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 5); } } #endregion - #region Rare Variants - private void RareVariants(NPC npc) - { - switch (npc.type) - { - case NPCID.BloodZombie: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3 && !npc.SpawnedFromStatue, 200, 1, 1); - break; - - case NPCID.VortexRifleman: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 200); - break; - - case NPCID.DesertBeast: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 200); - break; - - case NPCID.DungeonSpirit: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 200); - break; - - case NPCID.RuneWizard: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - break; - - case NPCID.Mimic: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !npc.SpawnedFromStatue, 100, 1, 1); - break; - - default: - break; - } - } - #endregion - - #region Acid Rain - private void AcidRainProgression(NPC npc) - { - Dictionary possibleEnemies = AcidRainEvent.PossibleEnemiesPreHM; - - if (CalamityWorld.downedAquaticScourge) - possibleEnemies = AcidRainEvent.PossibleEnemiesAS; - if (CalamityWorld.downedPolterghast) - possibleEnemies = AcidRainEvent.PossibleEnemiesPolter; - - if (CalamityWorld.rainingAcid) - { - if (possibleEnemies.Select(enemy => enemy.Key).Contains(npc.type)) - { - CalamityWorld.acidRainPoints -= possibleEnemies[npc.type].InvasionContributionPoints; - if (CalamityWorld.downedPolterghast) - { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. - } - - // UpdateInvasion incorporates a world sync, so this is indeed synced as a result. - Main.rainTime += Main.rand.Next(240, 300 + 1); // Add some time to the rain, so that it doesn't end mid-way. - } - Dictionary possibleMinibosses = CalamityWorld.downedPolterghast ? AcidRainEvent.PossibleMinibossesPolter : AcidRainEvent.PossibleMinibossesAS; - if (possibleMinibosses.Select(miniboss => miniboss.Key).Contains(npc.type)) - { - CalamityWorld.acidRainPoints -= possibleMinibosses[npc.type].InvasionContributionPoints; - if (CalamityWorld.downedPolterghast) - { - CalamityWorld.acidRainPoints = (int)MathHelper.Max(1, CalamityWorld.acidRainPoints); // Cap at 1. The last point is for Old Duke. - } - - // UpdateInvasion incorporates a world sync, so this is indeed synced as a result. - Main.rainTime += Main.rand.Next(1800, 2100 + 1); // Add some time to the rain, so that it doesn't end mid-way. - } - } - - CalamityWorld.acidRainPoints = (int)MathHelper.Max(0, CalamityWorld.acidRainPoints); // To prevent negative completion ratios - - if (CalamityWorld.rainingAcid && CalamityWorld.downedPolterghast && - npc.type == ModContent.NPCType() && - CalamityWorld.acidRainPoints <= 2f) - { - CalamityWorld.triedToSummonOldDuke = false; - CalamityWorld.acidRainPoints = 0; - } - CalamityWorld.timeSinceAcidRainKill = 0; - AcidRainEvent.UpdateInvasion(); - } - #endregion - #region Common Loot private void CommonLoot(NPC npc) { @@ -1707,10 +1137,6 @@ namespace CalamityMod.NPCs DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); break; - case NPCID.Plantera: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 12, 18); - break; - case NPCID.SolarSpearman: //Drakanian case NPCID.SolarSolenian: //Selenian case NPCID.SolarCorite: @@ -1748,41 +1174,8 @@ namespace CalamityMod.NPCs DropHelper.DropItemChance(npc, ItemID.FragmentStardust, Main.expertMode ? 4 : 5); break; - case NPCID.DungeonGuardian: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode); - break; - - case NPCID.CultistBoss: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 5); - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); - break; - - case NPCID.EyeofCthulhu: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 2, 4); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 5, 1, 1); - break; - - case NPCID.QueenBee: - DropHelper.DropItemCondition(npc, ItemID.Stinger, !Main.expertMode, 5, 10); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), !Main.expertMode, 30, 50); - break; - - case NPCID.DevourerHead: - case NPCID.SeekerHead: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); - break; - - case NPCID.FaceMonster: - case NPCID.Herpling: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); - break; - - case NPCID.ManEater: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); - break; - case NPCID.AngryTrapper: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); break; case NPCID.MotherSlime: @@ -1790,42 +1183,21 @@ namespace CalamityMod.NPCs case NPCID.Crimslime: case NPCID.BigCrimslime: case NPCID.LittleCrimslime: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); - break; - - case NPCID.Moth: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 1f : 0.5f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 2 : 3); break; case NPCID.Derpling: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); break; case NPCID.SpikedJungleSlime: case NPCID.Arapaima: - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); break; case NPCID.Reaper: case NPCID.Psycho: DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas || NPC.downedPlantBoss, Main.expertMode ? 0.75f : 0.5f, 1, 4); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.buffedEclipse, Main.expertMode ? 0.06f : 0.04f, 1, 1); - break; - - //other solar eclipse creatures - case NPCID.Eyezor: - case NPCID.Frankenstein: - case NPCID.SwampThing: - case NPCID.Vampire: - case NPCID.VampireBat: - case NPCID.CreatureFromTheDeep: - case NPCID.Fritz: - case NPCID.ThePossessed: - case NPCID.Butcher: - case NPCID.DeadlySphere: - case NPCID.DrManFly: - case NPCID.Nailhead: - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.buffedEclipse, Main.expertMode ? 0.06f : 0.04f, 1, 1); break; case NPCID.MartianOfficer: @@ -1849,13 +1221,13 @@ namespace CalamityMod.NPCs } // All hardmode dungeon enemies drop Ectoblood - if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) + if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) { DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, Main.expertMode ? 3 : 1); } // Every type of moss hornet can drop stingers - if (CalamityMod.mossHornetList.Contains(npc.type)) + if (CalamityLists.mossHornetList.Contains(npc.type)) { DropHelper.DropItemChance(npc, ItemID.Stinger, Main.expertMode ? 1f : 0.6666f); } @@ -1888,87 +1260,98 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ItemID.GoldenFishingRod, Main.hardMode, 12, 1, 1); } } - #endregion + #endregion - #region Boss Loot - private void EventEnemyLoot(NPC npc, bool pumpkin, bool frost, bool eclipse) - { - // Not really loot code, but NPCLoot is the only death hook - if (npc.boss && !CalamityWorld.downedBossAny) - { - CalamityWorld.downedBossAny = true; - CalamityMod.UpdateServerBoolean(); - } + #region Event Loot + private void EventLoot(NPC npc, bool pumpkin, bool frost, bool eclipse) + { + // Nightmare Fuel, Endothermic Energy and Darksun Fragments + if (!CalamityWorld.downedDoG) + { + return; + } - // Nightmare Fuel, Endothermic Energy and Darksun Fragments - if (!CalamityWorld.downedDoG) - { - return; - } + if (frost) + { + switch (npc.type) + { + case NPCID.Nutcracker: + case NPCID.NutcrackerSpinning: + case NPCID.ElfCopter: + case NPCID.Flocko: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Krampus: + case NPCID.Yeti: + case NPCID.PresentMimic: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); + break; + case NPCID.Everscream: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.SantaNK1: + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); + break; + case NPCID.IceQueen: + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + break; + } + } + else if (pumpkin) + { + switch (npc.type) + { + case NPCID.Splinterling: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Hellhound: + case NPCID.Poltergeist: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); + break; + case NPCID.HeadlessHorseman: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.MourningWood: + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); + break; + case NPCID.Pumpking: + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + break; + } + } - if (frost) - { - switch (npc.type) - { - case NPCID.Nutcracker: - case NPCID.NutcrackerSpinning: - case NPCID.ElfCopter: - case NPCID.Flocko: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); - break; - case NPCID.Krampus: - case NPCID.Yeti: - case NPCID.PresentMimic: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); - break; - case NPCID.Everscream: - DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); - break; - case NPCID.SantaNK1: - DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); - break; - case NPCID.IceQueen: - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); - break; - } - } - else if (pumpkin) - { - switch (npc.type) - { - case NPCID.Splinterling: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); - break; - case NPCID.Hellhound: - case NPCID.Poltergeist: - DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); - break; - case NPCID.HeadlessHorseman: - DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); - break; - case NPCID.MourningWood: - DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); - break; - case NPCID.Pumpking: - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); - break; - } - } - - if (!CalamityWorld.buffedEclipse) - { - return; - } - - if (npc.type == NPCID.Mothron) - { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); - - // Mark a buffed Mothron as killed (allowing access to Yharon P2) - CalamityWorld.downedBuffedMothron = true; - CalamityMod.UpdateServerBoolean(); - } - } + if (eclipse) + { + switch (npc.type) + { + case NPCID.Frankenstein: + case NPCID.SwampThing: + case NPCID.Fritz: + case NPCID.CreatureFromTheDeep: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + break; + case NPCID.Reaper: + case NPCID.Psycho: + case NPCID.Vampire: + case NPCID.VampireBat: + case NPCID.ThePossessed: + case NPCID.Butcher: + case NPCID.DeadlySphere: + case NPCID.DrManFly: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Eyezor: + DropHelper.DropItem(npc, ModContent.ItemType(), 1, 2); + break; + case NPCID.Nailhead: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.Mothron: + DropHelper.DropItem(npc, ModContent.ItemType(), 20, 30); + break; + } + } + } #endregion } } diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index ad337af9e4..533ef54323 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1,19 +1,22 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Ammo.FiniteUse; using CalamityMod.Items.Dyes; using CalamityMod.Items.Dyes.HairDye; -using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Potions; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Weapons.Typeless.FiniteUse; using CalamityMod.NPCs.TownNPCs; using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,35 +26,192 @@ namespace CalamityMod.NPCs { public class CalamityGlobalTownNPC { + #region Town NPC Patreon Name Sets + private const int AnglerVanillaNames = 22; + private static readonly string[] AnglerNames = + { + "Dazren", + }; + private const int ArmsDealerVanillaNames = 24; + private static readonly string[] ArmsDealerNames = + { + "Drifter", + "Finchi", + "Heniek", // <@!363404700445442050> (Kazurgundu#3791) + "Fire", // <@!354362326947856384> (fire#0692) + "Barney", // <@!634462901431697410> (Potato Power#6578) + }; + private const int ClothierVanillaNames = 25; + private static readonly string[] ClothierNames = + { + "Joeseph Jostar", + }; + private const int CyborgVanillaNames = 22; + private static readonly string[] CyborgNames = + { + "Sylux", // <@!331812782183809025> (Gonk#2451) + }; + private const int DemolitionistVanillaNames = 22; + private static readonly string[] DemolitionistNames = null; + private const int DryadVanillaNames = 21; + private static readonly string[] DryadNames = + { + "Rythmi", + "Izuna", + "Jasmine", // <@!430532867479699456> (phantasmagoria#6777) + "Cybil", // <@!486507232666845185> (Captain Doofus#????) + }; + private const int DyeTraderVanillaNames = 16; + private static readonly string[] DyeTraderNames = null; + private const int GoblinTinkererVanillaNames = 25; + private static readonly string[] GoblinTinkererNames = + { + "Verth", + "Gormer", // <@!287651204924833795> (Picasso's Bean#2819 -- RIP) + "TingFlarg", // <@!185605031716847616> (Smug#7160) + }; + private const int GuideVanillaNames = 34; + private static readonly string[] GuideNames = + { + "Lapp", + "Ben Shapiro", + "StreakistYT", + "Necroplasmic", + "Devin", + "Woffle", // <@!185980979427540992> (Chipbeam#2268) + "Cameron", // <@!340401981711712258> (CammyWammy#8634) + "Wilbur", // <@!295171926324805634> (ChaosChaos#5979) + }; + private const int MechanicVanillaNames = 24; + private static readonly string[] MechanicNames = + { + "Lilly", + "Daawn", // <@!206162323541458944> (Daawnily#3859) + "Robin", // <@!654737510030639112> (Altzeus#8687) + "Curly", // <@!673092101780668416> (Curly~Brace#4830) + }; + private const int MerchantVanillaNames = 23; + private static readonly string[] MerchantNames = null; + private const int NurseVanillaNames = 24; + private static readonly string[] NurseNames = + { + "Farsni", + }; + private const int PainterVanillaNames = 18; + private static readonly string[] PainterNames = + { + "Picasso", // <@!353316526306361347> (SCONICBOOM#2164 -- for the late Picasso's Bean#2819) + }; + private const int PartyGirlVanillaNames = 17; + private static readonly string[] PartyGirlNames = null; + private const int PirateVanillaNames = 11; + private static readonly string[] PirateNames = + { + "Tyler Van Hook", + }; + private const int SkeletonMerchantVanillaNames = 10; + private static readonly string[] SkeletonMerchantNames = + { + "Sans Undertale", // <@!145379091648872450> (Shayy#5257) + "Papyrus Undertale", // <@!262663471189983242> (Nycro#0001) + }; + private const int SteampunkerVanillaNames = 20; + private static readonly string[] SteampunkerNames = + { + "Vorbis", + "Angel", + }; + private const int StylistVanillaNames = 20; + private static readonly string[] StylistNames = + { + "Amber", // <@!114677116473180169> (Mishiro Usui#1295) + }; + private const int TavernkeepVanillaNames = 16; + private static readonly string[] TavernkeepNames = + { + "Tim Lockwood", // <@!605839945483026434> (Deimelo#0001) + "Sir Samuel Winchester Jenkins Kester II", // <@!107659695749070848> (Ryaegos#1661) + }; + private const int TaxCollectorVanillaNames = 19; + private static readonly string[] TaxCollectorNames = + { + "Emmett", + }; + private const int TruffleVanillaNames = 12; + private static readonly string[] TruffleNames = null; + private const int WitchDoctorVanillaNames = 10; + private static readonly string[] WitchDoctorNames = + { + "Sok'ar", + "Toxin", // <@!348174404984766465> (Toxin#9598), + "Mixcoatl", // <@!284775927294984203> (SharZz#7777) + "Khatunz", // <@!303022375191183360> (jackshiz#7839) + }; + private const int WizardVanillaNames = 22; + private static readonly string[] WizardNames = + { + "Mage One-Trick", + "Inorim, son of Ivukey", + "Jensen", + "Merasmus", // <@!288066987819663360> (Spider pee pee#3328) + "Habolo", // <@!163028025494077441> (ChristmasGoat#7810) + "Ortho", // <@!264984390910738432> (Worcuus#5225) + "Chris Tallballs", // <@!770211589076418571> (Bewearium#1111) + }; + #endregion + #region Town NPC Names public static void ResetTownNPCNameBools(NPC npc, Mod mod) { - if (NPC.FindFirstNPC(NPCID.Guide) == -1) - CalamityWorld.guideName = false; - if (NPC.FindFirstNPC(NPCID.Wizard) == -1) - CalamityWorld.wizardName = false; - if (NPC.FindFirstNPC(NPCID.Steampunker) == -1) - CalamityWorld.steampunkerName = false; - if (NPC.FindFirstNPC(NPCID.Stylist) == -1) - CalamityWorld.stylistName = false; - if (NPC.FindFirstNPC(NPCID.WitchDoctor) == -1) - CalamityWorld.witchDoctorName = false; - if (NPC.FindFirstNPC(NPCID.TaxCollector) == -1) - CalamityWorld.taxCollectorName = false; - if (NPC.FindFirstNPC(NPCID.Pirate) == -1) - CalamityWorld.pirateName = false; - if (NPC.FindFirstNPC(NPCID.Mechanic) == -1) - CalamityWorld.mechanicName = false; - if (NPC.FindFirstNPC(NPCID.ArmsDealer) == -1) - CalamityWorld.armsDealerName = false; - if (NPC.FindFirstNPC(NPCID.Dryad) == -1) - CalamityWorld.dryadName = false; - if (NPC.FindFirstNPC(NPCID.Nurse) == -1) - CalamityWorld.nurseName = false; - if (NPC.FindFirstNPC(NPCID.Angler) == -1) - CalamityWorld.anglerName = false; - if (NPC.FindFirstNPC(NPCID.Clothier) == -1) - CalamityWorld.clothierName = false; + void ResetName(int npcID, ref bool nameBool) + { + if (NPC.FindFirstNPC(npcID) == -1) + nameBool = false; + } + + ResetName(NPCID.Angler, ref CalamityWorld.anglerName); + ResetName(NPCID.ArmsDealer, ref CalamityWorld.armsDealerName); + ResetName(NPCID.Clothier, ref CalamityWorld.clothierName); + ResetName(NPCID.Cyborg, ref CalamityWorld.cyborgName); + ResetName(NPCID.Demolitionist, ref CalamityWorld.demolitionistName); + ResetName(NPCID.Dryad, ref CalamityWorld.dryadName); + ResetName(NPCID.DyeTrader, ref CalamityWorld.dyeTraderName); + ResetName(NPCID.GoblinTinkerer, ref CalamityWorld.goblinTinkererName); + ResetName(NPCID.Guide, ref CalamityWorld.guideName); + ResetName(NPCID.Mechanic, ref CalamityWorld.mechanicName); + ResetName(NPCID.Merchant, ref CalamityWorld.merchantName); + ResetName(NPCID.Nurse, ref CalamityWorld.nurseName); + ResetName(NPCID.Painter, ref CalamityWorld.painterName); + ResetName(NPCID.PartyGirl, ref CalamityWorld.partyGirlName); + ResetName(NPCID.Pirate, ref CalamityWorld.pirateName); + ResetName(NPCID.SkeletonMerchant, ref CalamityWorld.skeletonMerchantName); + ResetName(NPCID.Steampunker, ref CalamityWorld.steampunkerName); + ResetName(NPCID.Stylist, ref CalamityWorld.stylistName); + ResetName(NPCID.DD2Bartender, ref CalamityWorld.tavernkeepName); + ResetName(NPCID.TaxCollector, ref CalamityWorld.taxCollectorName); + ResetName(NPCID.Truffle, ref CalamityWorld.truffleName); + ResetName(NPCID.WitchDoctor, ref CalamityWorld.witchDoctorName); + ResetName(NPCID.Wizard, ref CalamityWorld.wizardName); + } + + // Annoyingly, because npc.GivenName is a property, it can't be passed as a ref parameter. + private static string ChooseName(ref bool alreadySet, string currentName, int numVanillaNames, string[] patreonNames) + { + if (alreadySet || patreonNames is null || patreonNames.Length == 0) + { + alreadySet = true; + return currentName; + } + + alreadySet = true; + int index = Main.rand.Next(numVanillaNames + patreonNames.Length); + + // If the roll isn't low enough, then a "vanilla name" was picked, meaning we change nothing. + if (index >= patreonNames.Length) + return currentName; + + // Change the name to be a randomly selected Patreon name if the roll is low enough. + return patreonNames[index]; } public static void SetPatreonTownNPCName(NPC npc, Mod mod) @@ -61,262 +221,75 @@ namespace CalamityMod.NPCs npc.Calamity().setNewName = false; switch (npc.type) { - case NPCID.Guide: - if (CalamityWorld.guideName) - break; - CalamityWorld.guideName = true; - switch (Main.rand.Next(41)) // 34 guide names - { - case 0: - npc.GivenName = "Lapp"; - break; - - case 1: - npc.GivenName = "Ben Shapiro"; - break; - - case 2: - npc.GivenName = "StreakistYT"; - break; - - case 3: - npc.GivenName = "Neoplasmatic"; - break; - - case 4: - npc.GivenName = "Devin"; - break; - - case 5: - npc.GivenName = "Woffle"; // patron name for <@!185980979427540992> (Chipbeam#2268) - break; - - case 6: - npc.GivenName = "Cameron"; // patron name for <@!340401981711712258> (CammyWammy#8634) - break; - - default: - break; - } - - break; - - case NPCID.Wizard: - if (CalamityWorld.wizardName) - break; - CalamityWorld.wizardName = true; - switch (Main.rand.Next(26)) // 23 wizard names - { - case 0: - npc.GivenName = "Mage One-Trick"; - break; - - case 1: - npc.GivenName = "Inorim, son of Ivukey"; - break; - - case 2: - npc.GivenName = "Jensen"; - break; - - default: - break; - } - - break; - - case NPCID.Steampunker: - if (CalamityWorld.steampunkerName) - break; - CalamityWorld.steampunkerName = true; - switch (Main.rand.Next(23)) // 21 steampunker names - { - case 0: - npc.GivenName = "Vorbis"; - break; - - case 1: - npc.GivenName = "Angel"; - break; - - default: - break; - } - - break; - - case NPCID.Stylist: - if (CalamityWorld.stylistName) - break; - CalamityWorld.stylistName = true; - switch (Main.rand.Next(21)) // 20 stylist names - { - case 0: - npc.GivenName = "Amber"; - break; - - default: - break; - } - - break; - - case NPCID.WitchDoctor: - if (CalamityWorld.witchDoctorName) - break; - CalamityWorld.witchDoctorName = true; - switch (Main.rand.Next(11)) // 10 witch doctor names - { - case 0: - npc.GivenName = "Sok'ar"; - break; - - default: - break; - } - - break; - - case NPCID.TaxCollector: - if (CalamityWorld.taxCollectorName) - break; - CalamityWorld.taxCollectorName = true; - switch (Main.rand.Next(21)) // 20 tax collector names - { - case 0: - npc.GivenName = "Emmett"; - break; - - default: - break; - } - - break; - - case NPCID.Pirate: - if (CalamityWorld.pirateName) - break; - CalamityWorld.pirateName = true; - switch (Main.rand.Next(12)) // 11 pirate names - { - case 0: - npc.GivenName = "Tyler Van Hook"; - break; - - default: - break; - } - - break; - - case NPCID.Mechanic: - if (CalamityWorld.mechanicName) - break; - CalamityWorld.mechanicName = true; - switch (Main.rand.Next(26)) // 24 mechanic names - { - case 0: - npc.GivenName = "Lilly"; - break; - - case 1: - npc.GivenName = "Daawn"; - break; - - default: - break; - } - - break; - - case NPCID.ArmsDealer: - if (CalamityWorld.armsDealerName) - break; - CalamityWorld.armsDealerName = true; - switch (Main.rand.Next(26)) // 24 arms dealer names - { - case 0: - npc.GivenName = "Drifter"; - break; - - case 1: - npc.GivenName = "Finchi"; - break; - - default: - break; - } - - break; - - case NPCID.Dryad: - if (CalamityWorld.dryadName) - break; - CalamityWorld.dryadName = true; - switch (Main.rand.Next(23)) // 21 Dryad names - { - case 0: - npc.GivenName = "Rythmi"; - break; - - case 1: - npc.GivenName = "Izuna"; - break; - - default: - break; - } - - break; - - case NPCID.Nurse: - if (CalamityWorld.nurseName) - break; - CalamityWorld.nurseName = true; - switch (Main.rand.Next(25)) // 24 nurse names - { - case 0: - npc.GivenName = "Farsni"; - break; - - default: - break; - } - - break; - case NPCID.Angler: - if (CalamityWorld.anglerName) - break; - CalamityWorld.anglerName = true; - switch (Main.rand.Next(23)) // 22 angler names - { - case 0: - npc.GivenName = "Dazren"; - break; - - default: - break; - } - + npc.GivenName = ChooseName(ref CalamityWorld.anglerName, npc.GivenName, AnglerVanillaNames, AnglerNames); + break; + case NPCID.ArmsDealer: + npc.GivenName = ChooseName(ref CalamityWorld.armsDealerName, npc.GivenName, ArmsDealerVanillaNames, ArmsDealerNames); break; - case NPCID.Clothier: - if (CalamityWorld.clothierName) - break; - CalamityWorld.clothierName = true; - switch (Main.rand.Next(26)) // 25 clothier names - { - case 0: - npc.GivenName = "Joeseph Jostar"; - break; - - default: - break; - } - + npc.GivenName = ChooseName(ref CalamityWorld.clothierName, npc.GivenName, ClothierVanillaNames, ClothierNames); + break; + case NPCID.Cyborg: + npc.GivenName = ChooseName(ref CalamityWorld.cyborgName, npc.GivenName, CyborgVanillaNames, CyborgNames); + break; + case NPCID.Demolitionist: + npc.GivenName = ChooseName(ref CalamityWorld.demolitionistName, npc.GivenName, DemolitionistVanillaNames, DemolitionistNames); + break; + case NPCID.Dryad: + npc.GivenName = ChooseName(ref CalamityWorld.dryadName, npc.GivenName, DryadVanillaNames, DryadNames); + break; + case NPCID.DyeTrader: + npc.GivenName = ChooseName(ref CalamityWorld.dyeTraderName, npc.GivenName, DyeTraderVanillaNames, DyeTraderNames); + break; + case NPCID.GoblinTinkerer: + npc.GivenName = ChooseName(ref CalamityWorld.goblinTinkererName, npc.GivenName, GoblinTinkererVanillaNames, GoblinTinkererNames); + break; + case NPCID.Guide: + npc.GivenName = ChooseName(ref CalamityWorld.guideName, npc.GivenName, GuideVanillaNames, GuideNames); + break; + case NPCID.Mechanic: + npc.GivenName = ChooseName(ref CalamityWorld.mechanicName, npc.GivenName, MechanicVanillaNames, MechanicNames); + break; + case NPCID.Merchant: + npc.GivenName = ChooseName(ref CalamityWorld.merchantName, npc.GivenName, MerchantVanillaNames, MerchantNames); + break; + case NPCID.Nurse: + npc.GivenName = ChooseName(ref CalamityWorld.nurseName, npc.GivenName, NurseVanillaNames, NurseNames); + break; + case NPCID.Painter: + npc.GivenName = ChooseName(ref CalamityWorld.painterName, npc.GivenName, PainterVanillaNames, PainterNames); + break; + case NPCID.PartyGirl: + npc.GivenName = ChooseName(ref CalamityWorld.partyGirlName, npc.GivenName, PartyGirlVanillaNames, PartyGirlNames); + break; + case NPCID.Pirate: + npc.GivenName = ChooseName(ref CalamityWorld.pirateName, npc.GivenName, PirateVanillaNames, PirateNames); + break; + case NPCID.SkeletonMerchant: + npc.GivenName = ChooseName(ref CalamityWorld.skeletonMerchantName, npc.GivenName, SkeletonMerchantVanillaNames, SkeletonMerchantNames); + break; + case NPCID.Steampunker: + npc.GivenName = ChooseName(ref CalamityWorld.steampunkerName, npc.GivenName, SteampunkerVanillaNames, SteampunkerNames); + break; + case NPCID.Stylist: + npc.GivenName = ChooseName(ref CalamityWorld.stylistName, npc.GivenName, StylistVanillaNames, StylistNames); + break; + case NPCID.DD2Bartender: // Tavernkeep + npc.GivenName = ChooseName(ref CalamityWorld.tavernkeepName, npc.GivenName, TavernkeepVanillaNames, TavernkeepNames); + break; + case NPCID.TaxCollector: + npc.GivenName = ChooseName(ref CalamityWorld.taxCollectorName, npc.GivenName, TaxCollectorVanillaNames, TaxCollectorNames); + break; + case NPCID.Truffle: + npc.GivenName = ChooseName(ref CalamityWorld.truffleName, npc.GivenName, TruffleVanillaNames, TruffleNames); + break; + case NPCID.WitchDoctor: + npc.GivenName = ChooseName(ref CalamityWorld.witchDoctorName, npc.GivenName, WitchDoctorVanillaNames, WitchDoctorNames); + break; + case NPCID.Wizard: + npc.GivenName = ChooseName(ref CalamityWorld.wizardName, npc.GivenName, WizardVanillaNames, WizardNames); break; - default: break; } @@ -806,11 +779,6 @@ namespace CalamityMod.NPCs break; case NPCID.Wizard: - if (Main.rand.NextBool(10) && permadong != -1) - { - chat = "I'd let " + Main.npc[permadong].GivenName + " coldheart MY icicle."; - } - if (Main.rand.NextBool(10) && Main.hardMode) { chat = "Space just got way too close for comfort."; @@ -819,7 +787,7 @@ namespace CalamityMod.NPCs break; case NPCID.Dryad: - if (Main.rand.NextBool(5) && CalamityWorld.buffedEclipse && Main.eclipse) + if (Main.rand.NextBool(5) && CalamityWorld.downedDoG && Main.eclipse) { chat = "There's a dark solar energy emanating from the moths that appear during this time. Ah, the moths as you progress further get more powerful...hmm...what power was Yharon holding back?"; } @@ -1211,8 +1179,15 @@ namespace CalamityMod.NPCs #region Shop Stuff public static void ShopSetup(int type, Mod mod, ref Chest shop, ref int nextSlot) { + int goldCost = NPC.downedMoonlord ? 8 : Main.hardMode ? 4 : 2; + if (type == NPCID.Merchant) { + SetShopItem(ref shop, ref nextSlot, ItemID.WormholePotion, true, Item.buyPrice(0, 0, 25, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ArcheryPotion, NPC.downedBoss1, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.HealingPotion, NPC.downedBoss2); + SetShopItem(ref shop, ref nextSlot, ItemID.ManaPotion, NPC.downedBoss2); + SetShopItem(ref shop, ref nextSlot, ItemID.TitanPotion, NPC.downedBoss3, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.Flare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.BlueFlare, (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); SetShopItem(ref shop, ref nextSlot, ItemID.ApprenticeBait, NPC.downedBoss1); @@ -1224,19 +1199,38 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.UltrabrightTorch, CalamityWorld.death); } - // Because of the defiled condition, the dye trader does not receive an alert icon when hardmode starts. if (type == NPCID.DyeTrader) { - SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode && CalamityWorld.defiled, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemID.DyeTradersScimitar, true, Item.buyPrice(0, 15)); + } + + if (type == NPCID.Demolitionist) + { + SetShopItem(ref shop, ref nextSlot, ItemID.MiningPotion, NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.IronskinPotion, NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ShinePotion, NPC.downedBoss1, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.SpelunkerPotion, NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.ObsidianSkinPotion, NPC.downedBoss3, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.EndurancePotion, NPC.downedBoss3, Item.buyPrice(0, goldCost, 0, 0)); } if (type == NPCID.ArmsDealer) { SetShopItem(ref shop, ref nextSlot, ItemID.Stake, Main.LocalPlayer.HasItem(ItemType())); + bool hasMagnum = Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType()); + SetShopItem(ref shop, ref nextSlot, ItemType(), hasMagnum, Item.buyPrice(0, 3 * goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.HasItem(ItemType()), Item.buyPrice(0, 5 * goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.HasItem(ItemType()), Item.buyPrice(0, 7 * goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.Stake, Main.LocalPlayer.HasItem(ItemType())); + SetShopItem(ref shop, ref nextSlot, ItemID.AmmoReservationPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.HunterPotion, true, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.BattlePotion, NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, WorldGen.crimson ? ItemID.Musket : ItemID.TheUndertaker, WorldGen.shadowOrbSmashed || NPC.downedBoss2); SetShopItem(ref shop, ref nextSlot, ItemID.Boomstick, NPC.downedQueenBee, price: Item.buyPrice(0, 20, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.TacticalShotgun, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.SniperRifle, NPC.downedGolemBoss, Item.buyPrice(0, 25)); + SetShopItem(ref shop, ref nextSlot, ItemID.RifleScope, NPC.downedGolemBoss, Item.buyPrice(0, 25)); } if (type == NPCID.Stylist) @@ -1245,11 +1239,13 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemType(), Main.LocalPlayer.wingTimeMax > 0); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge && CalamityConfig.Instance.Rippers); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.revenge && CalamityConfig.Instance.Rippers); + SetShopItem(ref shop, ref nextSlot, ItemID.StylistKilLaKillScissorsIWish, true, Item.buyPrice(0, 15)); } if (type == NPCID.Cyborg) { SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25)); + SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPolterghast); } @@ -1260,6 +1256,10 @@ namespace CalamityMod.NPCs if (type == NPCID.Dryad) { + SetShopItem(ref shop, ref nextSlot, ItemID.ThornsPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.FeatherfallPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.RegenerationPotion, NPC.downedBoss2, Item.buyPrice(0, 2, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.SwiftnessPotion, NPC.downedBoss2, Item.buyPrice(0, goldCost, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.JungleRose, price: Item.buyPrice(0, 2)); SetShopItem(ref shop, ref nextSlot, ItemID.NaturesGift, price: Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, ItemID.SlimeCrown, NPC.downedSlimeKing && CalamityConfig.Instance.SellVanillaSummons, Item.buyPrice(0, 2)); @@ -1279,15 +1279,21 @@ namespace CalamityMod.NPCs if (type == NPCID.GoblinTinkerer) { + SetShopItem(ref shop, ref nextSlot, ItemID.StinkPotion, true, Item.buyPrice(0, 1, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); - SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(1)); + SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(0, 5)); SetShopItem(ref shop, ref nextSlot, ItemID.GoblinBattleStandard, price: Item.buyPrice(0, 1)); } + if (type == NPCID.Mechanic) + { + SetShopItem(ref shop, ref nextSlot, ItemID.BuilderPotion, true, Item.buyPrice(0, 1, 0, 0)); + } + if (type == NPCID.Clothier) { SetShopItem(ref shop, ref nextSlot, ItemType(), price: Item.buyPrice(copper: 10)); @@ -1319,6 +1325,9 @@ namespace CalamityMod.NPCs if (type == NPCID.Wizard) { + SetShopItem(ref shop, ref nextSlot, ItemID.ManaRegenerationPotion, true, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.MagicPowerPotion, true, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.GravitationPotion, true, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedBrimstoneElemental, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedAstrageldon, Item.buyPrice(0, 25)); @@ -1326,12 +1335,17 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemID.SpectreStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.InfernoFork, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.ShadowbeamStaff, NPC.downedGolemBoss, Item.buyPrice(0, 25)); + SetShopItem(ref shop, ref nextSlot, ItemID.MagnetSphere, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.CelestialSigil, NPC.downedMoonlord && CalamityConfig.Instance.SellVanillaSummons, Item.buyPrice(3)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedGuardians, Item.buyPrice(5)); } if (type == NPCID.WitchDoctor) { + SetShopItem(ref shop, ref nextSlot, ItemID.CalmingPotion, true, Item.buyPrice(0, 1, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.RagePotion, true, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.WrathPotion, true, Item.buyPrice(0, goldCost, 0, 0)); + SetShopItem(ref shop, ref nextSlot, ItemID.InfernoPotion, true, Item.buyPrice(0, 2, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemType()); SetShopItem(ref shop, ref nextSlot, ItemType(), Main.hardMode); @@ -1340,14 +1354,20 @@ namespace CalamityMod.NPCs SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedPlantBoss && CalamityConfig.Instance.SellVanillaSummons, Item.buyPrice(0, 20)); SetShopItem(ref shop, ref nextSlot, ItemID.SolarTablet, NPC.downedGolemBoss, Item.buyPrice(0, 25)); SetShopItem(ref shop, ref nextSlot, ItemID.LihzahrdPowerCell, NPC.downedGolemBoss && CalamityConfig.Instance.SellVanillaSummons, Item.buyPrice(0, 30)); - SetShopItem(ref shop, ref nextSlot, ItemType(), NPC.downedGolemBoss, Item.buyPrice(0, 10)); + SetShopItem(ref shop, ref nextSlot, ItemID.ButterflyDust, NPC.downedGolemBoss, Item.buyPrice(0, 10)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedScavenger, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedPlaguebringer, Item.buyPrice(0, 50)); SetShopItem(ref shop, ref nextSlot, ItemType(), CalamityWorld.downedBumble, Item.buyPrice(5)); } + if (type == NPCID.PartyGirl) + { + SetShopItem(ref shop, ref nextSlot, ItemID.GenderChangePotion, true, Item.buyPrice(0, 1, 0, 0)); + } + if (type == NPCID.SkeletonMerchant) { + SetShopItem(ref shop, ref nextSlot, ItemType(), true, Item.buyPrice(0, 1, 0, 0)); SetShopItem(ref shop, ref nextSlot, ItemID.Marrow, Main.hardMode, Item.buyPrice(0, 36)); } } @@ -1376,4 +1396,4 @@ namespace CalamityMod.NPCs } #endregion } -} \ No newline at end of file +} diff --git a/NPCs/CalamityVanillaMinibossesAI.cs b/NPCs/CalamityVanillaMinibossesAI.cs new file mode 100644 index 0000000000..1121e61b2f --- /dev/null +++ b/NPCs/CalamityVanillaMinibossesAI.cs @@ -0,0 +1,1051 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.NPCs +{ + public partial class CalamityGlobalAI + { + internal enum MothronAIState + { + DespawnYeet = -1, + NewAISelection = 0, + FlyTowardsPlayer = 1, + AccelerateTowardsPlayer = 2, + ChargeRedirect = 3, + ChargePreparation = 4, + DoTheFuckingCharge = 5, + PickSpotToLayEgg = 6, + FlyToEggSpot = 7, + LayEgg = 8 + } + + #region Buffed Mothron AI + public static bool BuffedMothronAI(NPC npc) + { + npc.noTileCollide = false; + npc.noGravity = true; + npc.knockBackResist = 0f; + npc.damage = npc.defDamage; + + ref float aiState = ref npc.ai[0]; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.4f; + bool phase3 = lifeRatio < 0.1f; + + Player target = Main.player[npc.target]; + + // Despawn if no valid target exists or there's no ongoing eclipse. + if (!Main.eclipse) + aiState = (int)MothronAIState.DespawnYeet; + else if (npc.target < 0 || target.dead || !target.active) + { + npc.TargetClosest(true); + if (target.dead) + { + aiState = (int)MothronAIState.DespawnYeet; + if (Main.netMode != NetmodeID.MultiplayerClient) + npc.netUpdate = true; + } + } + + float flyInertia; + float chargeSpeed = 32f; + Vector2 idealFlyVelocity; + switch ((MothronAIState)(int)aiState) + { + case MothronAIState.DespawnYeet: + Vector2 idealVelocity = Vector2.UnitY * -34f; + npc.velocity = (npc.velocity * 4f + idealVelocity) / 5f; + npc.noTileCollide = true; + npc.dontTakeDamage = true; + return false; + + case MothronAIState.NewAISelection: + ref float aiTimer = ref npc.ai[1]; + + npc.TargetClosest(true); + + if (npc.Center.X < target.Center.X - 2f) + npc.direction = 1; + if (npc.Center.X > target.Center.X + 2f) + npc.direction = -1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + + // Rebounding on tile collision. + if (npc.collideX) + { + npc.velocity.X *= -npc.oldVelocity.X * 0.5f; + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -4f, 4f); + } + if (npc.collideY) + { + npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -4f, 4f); + } + + Vector2 destinationAboveTarget = target.Center - Vector2.UnitY * 200f; + float distanceFromAboveTarget = npc.Distance(destinationAboveTarget); + if (distanceFromAboveTarget > 3000f) + { + aiState = (int)MothronAIState.FlyTowardsPlayer; + aiTimer = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + // Otherwise fly towards the destination if relatively far from it. + else if (distanceFromAboveTarget > 600f) + { + flyInertia = 30f; + idealFlyVelocity = npc.SafeDirectionTo(destinationAboveTarget, -Vector2.UnitY) * 15f; + npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia; + } + + // And otherwise, if near the destination, slow down a bit. + else if (npc.velocity.Length() > 2f) + npc.velocity *= 0.95f; + else if (npc.velocity.Length() < 1f) + npc.velocity *= 1.05f; + + aiTimer++; + + // Select a new AI state after 10 frames. + if (aiTimer >= 10f && Main.netMode != NetmodeID.MultiplayerClient) + { + aiTimer = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + while ((MothronAIState)(int)aiState == MothronAIState.NewAISelection) + { + int selection = Main.rand.Next(3); + if (phase3) + selection = 1; + else if (phase2) + selection = Main.rand.Next(2); + + if (selection == 0 && Collision.CanHit(npc.Center, 1, 1, target.Center, 1, 1)) + aiState = (int)MothronAIState.AccelerateTowardsPlayer; + else if (selection == 1) + aiState = (int)MothronAIState.ChargeRedirect; + else if (selection == 2 && NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 2) + aiState = (int)MothronAIState.PickSpotToLayEgg; + } + npc.netUpdate = true; + npc.netSpam = 0; + } + break; + + case MothronAIState.FlyTowardsPlayer: + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + if (npc.target < 0 || !target.active || target.dead) + npc.TargetClosest(true); + + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.02f) / 10f; + + // Don't bother flying anymore if we're stuck and the target is somewhat close. + if (npc.WithinRange(target.Center, 500f) && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + aiState = (int)MothronAIState.NewAISelection; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + float flySpeed = 18f + npc.Distance(target.Center) / 100f; + flyInertia = 25f; + idealFlyVelocity = npc.SafeDirectionTo(target.Center, -Vector2.UnitY) * flySpeed; + npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia; + break; + + case MothronAIState.AccelerateTowardsPlayer: + aiTimer = ref npc.ai[1]; + ref float flySpeedAdditive = ref npc.ai[2]; + + // If no valid target exists, try to find a new one and select a new attack. + if (npc.target < 0 || !target.active || target.dead) + { + npc.TargetClosest(true); + aiState = (int)MothronAIState.NewAISelection; + aiTimer = 0f; + flySpeedAdditive = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.025f) / 5f; + + // Rebounding on tile collision. + if (npc.collideX) + { + npc.velocity.X *= -npc.oldVelocity.X * 0.5f; + npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -4f, 4f); + } + if (npc.collideY) + { + npc.velocity.Y *= -npc.oldVelocity.Y * 0.5f; + npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -4f, 4f); + } + + Vector2 destination = target.Center - Vector2.UnitY * 20f; + + flySpeedAdditive += 0.0222222228f; + if (Main.expertMode) + flySpeedAdditive += 0.0166666675f; + + flySpeed = 12f + flySpeedAdditive + npc.Distance(destination) / 120f; + flyInertia = 20f; + idealFlyVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed; + npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia; + + aiTimer++; + // Stop flying if there's an obstacle between the npc and target. + if (aiTimer >= 120f || !Collision.CanHit(npc.Center, 1, 1, target.Center, 1, 1)) + { + aiState = (int)MothronAIState.NewAISelection; + aiTimer = 0f; + flySpeedAdditive = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + break; + + case MothronAIState.ChargeRedirect: + flySpeedAdditive = ref npc.ai[2]; + npc.noTileCollide = true; + + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + + destination = target.Center; + destination -= Vector2.UnitY * 12f; + + float xOffset = 600f; + if (npc.Center.X > target.Center.X) + destination.X += xOffset; + else + destination.X -= xOffset; + + // If close to the destination beside the player, enter the charge phase. + if (Main.netMode != NetmodeID.MultiplayerClient && + Math.Abs(npc.Center.X - target.Center.X) > xOffset - 50f && Math.Abs(npc.Center.Y - target.Center.Y) < 20f) + { + aiState = (int)MothronAIState.ChargePreparation; + flySpeedAdditive = 0f; + npc.netUpdate = true; + npc.netSpam = 0; + } + + flySpeedAdditive += 0.0333333351f; + flySpeed = 24f + flySpeedAdditive; + flyInertia = 4f; + idealVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed; + npc.velocity = (npc.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia; + break; + case MothronAIState.ChargePreparation: + aiTimer = ref npc.ai[1]; + ref float chargeDirection = ref npc.ai[2]; + + npc.noTileCollide = true; + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + + destination = target.Center - Vector2.UnitY * 12f; + + float chargePreperationInertia = 8f; + Vector2 chargeVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * chargeSpeed; + npc.velocity = (npc.velocity * (chargePreperationInertia - 1f) + chargeVelocity) / chargePreperationInertia; + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + + // Redirect for 10 frames. After that time has been spent, immediately charge as usual. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + aiTimer++; + if (aiTimer > 10f) + { + npc.velocity = chargeVelocity; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + aiState = (int)MothronAIState.DoTheFuckingCharge; + chargeDirection = npc.direction; + npc.netUpdate = true; + npc.netSpam = 0; + } + } + break; + + case MothronAIState.DoTheFuckingCharge: + chargeDirection = ref npc.ai[2]; + flySpeedAdditive = ref npc.ai[3]; + + npc.damage = (int)(npc.defDamage * 1.2); + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + flySpeedAdditive += 0.0333333351f; + npc.velocity.X = (chargeSpeed + flySpeedAdditive) * chargeDirection; + + float chargeDistance = 460f; + if (Main.netMode != NetmodeID.MultiplayerClient && + (chargeDirection > 0f && npc.Center.X > target.Center.X + chargeDistance) || + (chargeDirection < 0f && npc.Center.X < target.Center.X - chargeDistance)) + { + // If not stuck, pick a new attack. + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) + { + aiState = (int)MothronAIState.NewAISelection; + chargeDirection = 0f; + flySpeedAdditive = 0f; + npc.netUpdate = true; + } + + // Otherwise, if somewhat horizontally far from the target, go to typical flying by default. + else if (Math.Abs(npc.Center.X - target.Center.X) > chargeDistance * 2f - 120f) + { + aiState = (int)MothronAIState.FlyTowardsPlayer; + chargeDirection = 0f; + flySpeedAdditive = 0f; + npc.netUpdate = true; + } + npc.netSpam = 0; + } + npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.0175f) / 5f; + break; + + case MothronAIState.PickSpotToLayEgg: + ref float laySpotPositionX = ref npc.ai[2]; + ref float laySpotPositionY = ref npc.ai[3]; + // Fallback if the spot selection fails. + npc.TargetClosest(true); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + aiState = (int)MothronAIState.NewAISelection; + laySpotPositionX = laySpotPositionY = -1f; + + for (int i = 0; i < 1000; i++) + { + int potentialSpotX = (int)target.Center.X / 16; + int potentialSpotY = (int)target.Center.Y / 16; + + // Become more open to positions to search the more failed tries that have been accumulated. + int checkAreaX = 30 + i / 50; + int checkAreaY = 20 + i / 75; + + potentialSpotX += Main.rand.Next(-checkAreaX, checkAreaX + 1); + potentialSpotY += Main.rand.Next(-checkAreaY, checkAreaY + 1); + + if (!WorldGen.SolidTile(potentialSpotX, potentialSpotY)) + { + // Search downward until a solid tile is reached. + // Stop checking if the spot is below the world surface, to prevent potential infinite loops. + while (!WorldGen.SolidTile(potentialSpotX, potentialSpotY) && potentialSpotY < Main.worldSurface) + potentialSpotY++; + + // And ensure that the spot isn't too far away. + if (npc.WithinRange(new Vector2(potentialSpotX, potentialSpotY).ToWorldCoordinates(), 1600f)) + { + aiState = (int)MothronAIState.FlyToEggSpot; + laySpotPositionX = potentialSpotX; + laySpotPositionY = potentialSpotY; + break; + } + } + } + npc.netUpdate = true; + npc.netSpam = 0; + } + break; + + case MothronAIState.FlyToEggSpot: + npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt(); + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + npc.noTileCollide = true; + + Vector2 spotToLayEgg = new Vector2(npc.ai[2], npc.ai[3]).ToWorldCoordinates(8f, -20f); + float distanceFromSpot = npc.Distance(spotToLayEgg); + flySpeed = 12f + distanceFromSpot / 150f; + + if (flySpeed > 20f) + flySpeed = 20f; + + if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromSpot < 10f) + { + aiState = (int)MothronAIState.LayEgg; + npc.netUpdate = true; + } + + flyInertia = 10f; + npc.velocity = (npc.velocity * (flyInertia - 1f) + npc.SafeDirectionTo(spotToLayEgg, -Vector2.UnitY) * flySpeed) / flyInertia; + break; + + case MothronAIState.LayEgg: + npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.025f) / 10f; + npc.noTileCollide = false; + + spotToLayEgg = new Vector2(npc.ai[2], npc.ai[3]).ToWorldCoordinates(8f, -28f); + distanceFromSpot = npc.Distance(spotToLayEgg); + float hoverSpeed = 4f; + float hoverInertia = 2f; + + if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromSpot < 44f) + { + ref float attackTimer = ref npc.ai[1]; + int eggLayTime = 20; + if (Main.expertMode) + eggLayTime = (int)(eggLayTime * 0.75); + int waitTime = eggLayTime; + + attackTimer++; + if (attackTimer == eggLayTime) + NPC.NewNPC((int)spotToLayEgg.X, (int)spotToLayEgg.Y + 20, 478, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + else if (attackTimer == eggLayTime + waitTime) + { + aiState = (int)MothronAIState.NewAISelection; + attackTimer = 0f; + npc.ai[2] = npc.ai[3] = 0f; + + // Try to lay another egg at a 66% chance if the amount of eggs + spawns is not at the limit. + if (NPC.CountNPCS(NPCID.MothronEgg) + NPC.CountNPCS(NPCID.MothronSpawn) < 3 && Main.rand.Next(3) != 0) + aiState = (int)MothronAIState.PickSpotToLayEgg; + else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + aiState = (int)MothronAIState.FlyTowardsPlayer; + npc.netUpdate = true; + } + } + + if (distanceFromSpot < hoverSpeed) + hoverSpeed = distanceFromSpot; + + Vector2 hoverVelocity = npc.SafeDirectionTo(spotToLayEgg) * hoverSpeed; + npc.velocity = (npc.velocity * (hoverInertia - 1f) + hoverVelocity) / hoverInertia; + if (npc.velocity.HasNaNs()) + npc.velocity = Vector2.Zero; + break; + } + return false; + } + #endregion + + #region Buffed Pumpking and Pumpking Blade AI + public static bool BuffedPumpkingAI(NPC npc) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] > 6f) + { + npc.localAI[0] = 0f; + npc.localAI[1] += 1f; + + if (npc.localAI[1] > 4f) + npc.localAI[1] = 0f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] > 300f) + { + npc.ai[3] = (float)Main.rand.Next(3); + npc.localAI[2] = 0f; + } + else if (npc.ai[3] == 0f && npc.localAI[2] % 30f == 0f && npc.localAI[2] > 30f) + { + float num856 = 10f; + Vector2 vector109 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + if (!WorldGen.SolidTile((int)vector109.X / 16, (int)vector109.Y / 16)) + { + float num857 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector109.X; + float num858 = Main.player[npc.target].position.Y - vector109.Y; + num857 += (float)Main.rand.Next(-50, 51); + num858 += (float)Main.rand.Next(50, 201); + num858 *= 0.2f; + float num859 = (float)Math.Sqrt((double)(num857 * num857 + num858 * num858)); + num859 = num856 / num859; + num857 *= num859; + num858 *= num859; + num857 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + num858 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f; + Projectile.NewProjectile(vector109.X, vector109.Y, num857, num858, ProjectileID.GreekFire1 + Main.rand.Next(3), 60, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.TargetClosest(true); + npc.ai[0] = 1f; + + int num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PumpkingBlade, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num861].ai[0] = -1f; + Main.npc[num861].ai[1] = (float)npc.whoAmI; + Main.npc[num861].target = npc.target; + Main.npc[num861].netUpdate = true; + + num861 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)npc.position.Y + npc.height / 2, NPCID.PumpkingBlade, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[num861].ai[0] = 1f; + Main.npc[num861].ai[1] = (float)npc.whoAmI; + Main.npc[num861].ai[3] = 150f; + Main.npc[num861].target = npc.target; + Main.npc[num861].netUpdate = true; + } + + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + { + npc.TargetClosest(true); + + if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) + npc.ai[1] = 2f; + } + + if (Main.dayTime) + { + npc.velocity.Y += 0.3f; + npc.velocity.X *= 0.9f; + } + else if (npc.ai[1] == 0f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 300f) + { + if (npc.ai[3] != 1f) + { + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + else + { + npc.ai[2] = 0f; + npc.ai[1] = 1f; + npc.TargetClosest(true); + npc.netUpdate = true; + } + } + + Vector2 vector110 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num862 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector110.X; + float num863 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector110.Y; + float num864 = (float)Math.Sqrt((double)(num862 * num862 + num863 * num863)); + float num865 = 8f; + + if (npc.ai[3] == 1f) + { + if (num864 > 900f) + num865 = 14f; + else if (num864 > 600f) + num865 = 12f; + else if (num864 > 300f) + num865 = 10f; + } + + if (num864 > 50f) + { + num864 = num865 / num864; + npc.velocity.X = (npc.velocity.X * 14f + num862 * num864) / 15f; + npc.velocity.Y = (npc.velocity.Y * 14f + num863 * num864) / 15f; + } + } + else if (npc.ai[1] == 1f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 600f || npc.ai[3] != 1f) + { + npc.ai[2] = 0f; + npc.ai[1] = 0f; + } + + Vector2 vector111 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num866 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector111.X; + float num867 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector111.Y; + float num868 = (float)Math.Sqrt((double)(num866 * num866 + num867 * num867)); + num868 = 20f / num868; + + npc.velocity.X = (npc.velocity.X * 49f + num866 * num868) / 50f; + npc.velocity.Y = (npc.velocity.Y * 49f + num867 * num868) / 50f; + } + else if (npc.ai[1] == 2f) + { + npc.ai[1] = 3f; + npc.velocity.Y += 0.1f; + + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.95f; + + npc.velocity.X *= 0.95f; + + if (npc.timeLeft > 500) + npc.timeLeft = 500; + } + npc.rotation = npc.velocity.X * -0.02f; + + return false; + } + + public static bool BuffedPumpkingBladeAI(NPC npc) + { + npc.spriteDirection = -(int)npc.ai[0]; + + if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) + { + npc.ai[2] += 10f; + if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + { + npc.life = -1; + npc.HitEffect(0, 10.0); + npc.active = false; + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient && Main.npc[(int)npc.ai[1]].ai[3] == 2f) + { + npc.localAI[1] += 1f; + if (npc.localAI[1] > 30f) + { + npc.localAI[1] = 0f; + + float num869 = 0.01f; + Vector2 vector112 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float num870 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector112.X; + float num871 = Main.player[npc.target].position.Y - vector112.Y; + float num872 = (float)Math.Sqrt((double)(num870 * num870 + num871 * num871)); + + num872 = num869 / num872; + num870 *= num872; + num871 *= num872; + + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num870, num871, ProjectileID.FlamingScythe, 70, 0f, Main.myPlayer, npc.rotation, (float)npc.spriteDirection); + } + } + + if (Main.dayTime) + { + npc.velocity.Y += 0.3f; + npc.velocity.X *= 0.9f; + return false; + } + + if (npc.ai[2] == 0f || npc.ai[2] == 3f) + { + if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) + npc.timeLeft = 10; + + npc.ai[3] += 1f; + if (npc.ai[3] >= 180f) + { + npc.ai[2] += 1f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + + Vector2 vector113 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num874 = (Main.player[npc.target].Center.X + Main.npc[(int)npc.ai[1]].Center.X) / 2f; + float num875 = (Main.player[npc.target].Center.Y + Main.npc[(int)npc.ai[1]].Center.Y) / 2f; + num874 += -170f * npc.ai[0] - vector113.X; + num875 += 90f - vector113.Y; + + float num876 = Math.Abs(Main.player[npc.target].Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(Main.player[npc.target].Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + if (num876 > 700f) + { + num874 = Main.npc[(int)npc.ai[1]].Center.X - 170f * npc.ai[0] - vector113.X; + num875 = Main.npc[(int)npc.ai[1]].Center.Y + 90f - vector113.Y; + } + + float num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); + float num878 = 8f; + if (num877 > 1000f) + num878 = 23f; + else if (num877 > 800f) + num878 = 20f; + else if (num877 > 600f) + num878 = 17f; + else if (num877 > 400f) + num878 = 14f; + else if (num877 > 200f) + num878 = 11f; + + if (npc.ai[0] < 0f && npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) + num874 -= 4f; + if (npc.ai[0] > 0f && npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) + num874 += 4f; + + num877 = num878 / num877; + npc.velocity.X = (npc.velocity.X * 14f + num874 * num877) / 15f; + npc.velocity.Y = (npc.velocity.Y * 14f + num875 * num877) / 15f; + num877 = (float)Math.Sqrt((double)(num874 * num874 + num875 * num875)); + + if (num877 > 20f) + npc.rotation = (float)Math.Atan2((double)num875, (double)num874) + MathHelper.PiOver2; + } + else if (npc.ai[2] == 1f) + { + Vector2 vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num879 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector114.X; + float num880 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector114.Y; + float num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); + + npc.rotation = (float)Math.Atan2((double)num880, (double)num879) + MathHelper.PiOver2; + npc.velocity.X *= 0.95f; + npc.velocity.Y -= 0.3f; + + if (npc.velocity.Y < -18f) + npc.velocity.Y = -18f; + + if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) + { + npc.TargetClosest(true); + npc.ai[2] = 2f; + + vector114 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num879 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector114.X; + num880 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector114.Y; + num881 = (float)Math.Sqrt((double)(num879 * num879 + num880 * num880)); + num881 = 24f / num881; + + npc.velocity.X = num879 * num881; + npc.velocity.Y = num880 * num881; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 2f) + { + float num882 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + + if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f || num882 > 800f) + npc.ai[2] = 3f; + } + else if (npc.ai[2] == 4f) + { + Vector2 vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num883 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 200f * npc.ai[0] - vector115.X; + float num884 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector115.Y; + float num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); + + npc.rotation = (float)Math.Atan2((double)num884, (double)num883) + MathHelper.PiOver2; + npc.velocity.Y *= 0.95f; + npc.velocity.X += 0.3f * -npc.ai[0]; + + if (npc.velocity.X < -18f) + npc.velocity.X = -18f; + if (npc.velocity.X > 18f) + npc.velocity.X = 18f; + + if (npc.position.X + (float)(npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - 500f || npc.position.X + (float)(npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) + 500f) + { + npc.TargetClosest(true); + npc.ai[2] = 5f; + + vector115 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num883 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector115.X; + num884 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector115.Y; + num885 = (float)Math.Sqrt((double)(num883 * num883 + num884 * num884)); + num885 = 17f / num885; + + npc.velocity.X = num883 * num885; + npc.velocity.Y = num884 * num885; + npc.netUpdate = true; + } + } + else if (npc.ai[2] == 5f) + { + float num886 = Math.Abs(npc.Center.X - Main.npc[(int)npc.ai[1]].Center.X) + Math.Abs(npc.Center.Y - Main.npc[(int)npc.ai[1]].Center.Y); + + if ((npc.velocity.X > 0f && npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || (npc.velocity.X < 0f && npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) || num886 > 800f) + npc.ai[2] = 0f; + } + + return false; + } + #endregion + + #region Buffed Ice Queen AI + public static bool BuffedIceQueenAI(NPC npc) + { + if (Main.dayTime) + { + if (npc.velocity.X > 0f) + npc.velocity.X += 0.25f; + else + npc.velocity.X -= 0.25f; + + npc.velocity.Y -= 0.1f; + npc.rotation = npc.velocity.X * 0.05f; + } + else if (npc.ai[0] == 0f) + { + if (npc.ai[2] == 0f) + { + npc.TargetClosest(true); + + if (npc.Center.X < Main.player[npc.target].Center.X) + npc.ai[2] = 1f; + else + npc.ai[2] = -1f; + } + + npc.TargetClosest(true); + int num887 = 800; + float num888 = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); + + if (npc.Center.X < Main.player[npc.target].Center.X && npc.ai[2] < 0f && num888 > (float)num887) + npc.ai[2] = 0f; + if (npc.Center.X > Main.player[npc.target].Center.X && npc.ai[2] > 0f && num888 > (float)num887) + npc.ai[2] = 0f; + + float num889 = 0.6f; + float num890 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num889 = 0.7f; + num890 = 12f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num889 = 0.8f; + num890 = 14f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num889 = 0.95f; + num890 = 16f; + } + + npc.velocity.X += npc.ai[2] * num889; + if (npc.velocity.X > num890) + npc.velocity.X = num890; + if (npc.velocity.X < -num890) + npc.velocity.X = -num890; + + float num891 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); + if (num891 < 150f) + npc.velocity.Y -= 0.2f; + if (num891 > 200f) + npc.velocity.Y += 0.2f; + if (npc.velocity.Y > 9f) + npc.velocity.Y = 9f; + if (npc.velocity.Y < -9f) + npc.velocity.Y = -9f; + + npc.rotation = npc.velocity.X * 0.05f; + + if ((num888 < 500f || npc.ai[3] < 0f) && npc.position.Y < Main.player[npc.target].position.Y) + { + npc.ai[3] += 1f; + int num892 = 8; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num892 = 7; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num892 = 6; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num892 = 5; + + num892++; + if (npc.ai[3] > (float)num892) + npc.ai[3] = (float)-(float)num892; + + if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector116 = new Vector2(npc.Center.X, npc.Center.Y); + vector116.X += npc.velocity.X * 7f; + float num893 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector116.X; + float num894 = Main.player[npc.target].Center.Y - vector116.Y; + float num895 = (float)Math.Sqrt((double)(num893 * num893 + num894 * num894)); + + float num896 = 8f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num896 = 9f; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num896 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num896 = 11f; + + num895 = num896 / num895; + num893 *= num895; + num894 *= num895; + + Projectile.NewProjectile(vector116.X, vector116.Y, num893, num894, ProjectileID.FrostWave, 50, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (npc.ai[3] < 0f) + npc.ai[3] += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + + if (npc.ai[1] > 600f && num888 < 600f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 1f) + { + npc.TargetClosest(true); + + float num898 = 0.2f; + float num899 = 10f; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + { + num898 = 0.24f; + num899 = 12f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num898 = 0.28f; + num899 = 14f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.25) + { + num898 = 0.32f; + num899 = 16f; + } + num898 -= 0.05f; + num899 -= 1f; + + if (npc.Center.X < Main.player[npc.target].Center.X) + { + npc.velocity.X += num898; + if (npc.velocity.X < 0f) + npc.velocity.X *= 0.98f; + } + if (npc.Center.X > Main.player[npc.target].Center.X) + { + npc.velocity.X -= num898; + if (npc.velocity.X > 0f) + npc.velocity.X *= 0.98f; + } + if (npc.velocity.X > num899 || npc.velocity.X < -num899) + npc.velocity.X *= 0.95f; + + float num900 = Main.player[npc.target].position.Y - (npc.position.Y + (float)npc.height); + if (num900 < 180f) + npc.velocity.Y -= 0.1f; + if (num900 > 200f) + npc.velocity.Y += 0.1f; + + if (npc.velocity.Y > 7f) + npc.velocity.Y = 7f; + if (npc.velocity.Y < -7f) + npc.velocity.Y = -7f; + + npc.rotation = npc.velocity.X * 0.01f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[3] += 1f; + int num901 = 10; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num901 = 8; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num901 = 6; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num901 = 4; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num901 = 2; + + num901 += 3; + if (npc.ai[3] >= (float)num901) + { + npc.ai[3] = 0f; + Vector2 vector117 = new Vector2(npc.Center.X, npc.position.Y + (float)npc.height - 14f); + int i2 = (int)(vector117.X / 16f); + int j2 = (int)(vector117.Y / 16f); + if (!WorldGen.SolidTile(i2, j2)) + { + float num902 = npc.velocity.Y; + + if (num902 < 0f) + num902 = 0f; + + num902 += 3f; + float speedX2 = npc.velocity.X * 0.25f; + Projectile.NewProjectile(vector117.X, vector117.Y, speedX2, num902, ProjectileID.FrostShard, 44, 0f, Main.myPlayer, (float)Main.rand.Next(5), 0f); + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + + if (npc.ai[1] > 450f) + npc.ai[0] = -1f; + } + } + else if (npc.ai[0] == 2f) + { + npc.TargetClosest(true); + + Vector2 vector118 = new Vector2(npc.Center.X, npc.Center.Y - 20f); + float num904 = (float)Main.rand.Next(-1000, 1001); + float num905 = (float)Main.rand.Next(-1000, 1001); + float num906 = (float)Math.Sqrt((double)(num904 * num904 + num905 * num905)); + float num907 = 20f; + + npc.velocity *= 0.95f; + num906 = num907 / num906; + num904 *= num906; + num905 *= num906; + npc.rotation += 0.2f; + vector118.X += num904 * 4f; + vector118.Y += num905 * 4f; + + npc.ai[3] += 1f; + int num908 = 7; + if ((double)npc.life < (double)npc.lifeMax * 0.75) + num908--; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + num908 -= 2; + if ((double)npc.life < (double)npc.lifeMax * 0.25) + num908 -= 3; + if ((double)npc.life < (double)npc.lifeMax * 0.1) + num908 -= 4; + + if (npc.ai[3] > (float)num908) + { + npc.ai[3] = 0f; + int num909 = Projectile.NewProjectile(vector118.X, vector118.Y, num904, num905, ProjectileID.FrostShard, 40, 0f, Main.myPlayer, 0f, 0f); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] += (float)Main.rand.Next(1, 4); + + if (npc.ai[1] > 300f) + npc.ai[0] = -1f; + } + } + if (npc.ai[0] == -1f) + { + int num910 = Main.rand.Next(3); + npc.TargetClosest(true); + + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > 1000f) + num910 = 0; + + npc.ai[0] = (float)num910; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + return false; + } + #endregion + } +} diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index f36190247b..3ba094cea9 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -4,13 +4,17 @@ using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.IO; namespace CalamityMod.NPCs.CeaselessVoid { @@ -26,42 +30,63 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetDefaults() { - npc.damage = 150; - npc.npcSlots = 36f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 36f; npc.width = 100; npc.height = 100; - npc.defense = 0; + npc.defense = 80; CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.999999f; - //global.unbreakableDR = true; - npc.lifeMax = 200; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (CalamityWorld.DoGSecondStageCountdown <= 0) + global.DR = 0.5f; + + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1; + npc.LifeMaxNERB(notDoGFight ? 67200 : 16800, notDoGFight ? 77280 : 19320, 72000); + + // If fought alone, Ceaseless Void plays its own theme + if (notDoGFight) { npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Void"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("Void") ?? MusicID.Boss3; } - npc.aiStyle = -1; + // If fought as a DoG interlude, keep the DoG music playing + else + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.noGravity = true; npc.noTileCollide = true; npc.boss = true; npc.DeathSound = SoundID.NPCDeath14; + bossBag = ModContent.ItemType(); } - public override void FindFrame(int frameHeight) + 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]); + for (int i = 0; i < 4; 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(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -69,6 +94,11 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.frame.Y = frame * frameHeight; } + public override void AI() + { + CalamityAI.CeaselessVoidAI(npc, mod); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -91,14 +121,14 @@ namespace CalamityMod.NPCs.CeaselessVoid 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -113,7 +143,7 @@ namespace CalamityMod.NPCs.CeaselessVoid 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -123,43 +153,49 @@ namespace CalamityMod.NPCs.CeaselessVoid return false; } - public override void AI() + public override void NPCLoot() { - CalamityAI.CeaselessVoidAI(npc, mod); - } - - public override void NPCLoot() - { - // Only drop items if fought alone - if (CalamityWorld.DoGSecondStageCountdown <= 0) + // Only drop items if fought at full strength + bool fullStrength = !CalamityWorld.downedSentinel1 || CalamityWorld.DoGSecondStageCountdown <= 0; + if (fullStrength) { - // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 2, 3); + DropHelper.DropBags(npc); - // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); + // Legendary drop for Ceaseless Void + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - // Equipment - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), 0.2f, DropHelper.RareVariantDropRateFloat); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + bool lastSentinelKilled = !CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); - // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) + if (!Main.expertMode) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - } + // Materials + DropHelper.DropItem(npc, ModContent.ItemType(), true, 2, 3); - // Other - bool lastSentinelKilled = !CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedSentinel1, 5, 2, 1); + // Weapons + float dropChance = DropHelper.NormalWeaponDropRateFloat; + DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); + DropHelper.DropItemChance(npc, ModContent.ItemType(), dropChance); + + // Equipment + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + + // Vanity + 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()); + } + } } // If DoG's fight is active, set the timer for the remaining two sentinels - else if (CalamityWorld.DoGSecondStageCountdown > 14460) + if (CalamityWorld.DoGSecondStageCountdown > 14460) { CalamityWorld.DoGSecondStageCountdown = 14460; if (Main.netMode == NetmodeID.Server) @@ -172,29 +208,37 @@ namespace CalamityMod.NPCs.CeaselessVoid } // Mark Ceaseless Void as dead - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (fullStrength) { CalamityWorld.downedSentinel1 = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } } - public override void BossLoot(ref string name, ref int potionType) + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + + public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.soundDelay == 0) { npc.soundDelay = 8; Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/OtherworldlyHit"), npc.Center); } - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); - } + + for (int k = 0; k < 5; k++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + } + if (npc.life <= 0) { npc.position.X = npc.position.X + (float)(npc.width / 2); @@ -207,7 +251,8 @@ namespace CalamityMod.NPCs.CeaselessVoid { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; @@ -219,8 +264,10 @@ namespace CalamityMod.NPCs.CeaselessVoid 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.PurpleCosmolite, 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); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 7ec96a7a02..9412cd31e6 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -1,6 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -9,13 +8,18 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.CeaselessVoid { public class DarkEnergy : ModNPC { - public int invinceTime = 120; + private int invinceTime = 180; + private bool start = true; + private const double minDistance = 10D; + private double distance = minDistance; + private const double minMaxDistance = 800D; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Energy"); Main.npcFrameCount[npc.type] = 6; @@ -24,32 +28,29 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 0; - npc.dontTakeDamage = true; + 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 = 6000; + npc.lifeMax = 3000; if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) { - npc.lifeMax = 24000; + npc.lifeMax = 12000; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 44000; + npc.lifeMax = 4400; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0.25f; - npc.noGravity = true; + npc.knockBackResist = 0f; + npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.HitSound = SoundID.NPCHit53; npc.DeathSound = SoundID.NPCDeath44; } @@ -57,14 +58,22 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SendExtraAI(BinaryWriter writer) { writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } + writer.Write(start); + writer.Write(distance); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { invinceTime = reader.ReadInt32(); - npc.dontTakeDamage = reader.ReadBoolean(); - } + start = reader.ReadBoolean(); + distance = reader.ReadDouble(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void FindFrame(int frameHeight) { @@ -74,6 +83,107 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.frame.Y = frame * frameHeight; } + public override void AI() + { + // Set the degrees used for rotation + if (start) + { + start = false; + npc.ai[3] = npc.ai[0]; + } + + // Stay invincible for 3 seconds to avoid being instantly killed + if (invinceTime > 0) + { + npc.damage = 0; + invinceTime--; + } + else + { + 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; + return; + } + + // Set time left just in case something dumb happens with despawning + if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + // Gets how enraged Ceaseless Void is + float tileEnrageMult = Main.npc[CalamityGlobalNPC.voidBoss].ai[1]; + + // 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) + { + distance += rateOfChange; + if (distance >= maxDistance) + { + distance = maxDistance; + npc.Calamity().newAI[0] = 1f; + } + } + else + { + distance -= rateOfChange; + if (distance <= minDistance) + { + distance = minDistance; + 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); + + // Rotate around Ceaseless Void + NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; + 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; + + // Flash and pulse effect + if (npc.ai[2] == 0f) + { + npc.scale -= 0.01f; + npc.alpha += 15; + if (npc.alpha >= 125) + { + npc.alpha = 130; + npc.ai[2] = 1f; + } + } + else + { + npc.scale += 0.01f; + npc.alpha -= 15; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[2] = 0f; + } + } + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -82,11 +192,15 @@ namespace CalamityMod.NPCs.CeaselessVoid Texture2D texture2D15 = Main.npcTexture[npc.type]; Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow2"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(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; + 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) { for (int num155 = 1; num155 < num153; num155 += 2) @@ -94,17 +208,14 @@ namespace CalamityMod.NPCs.CeaselessVoid Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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 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, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow"); @@ -118,16 +229,16 @@ namespace CalamityMod.NPCs.CeaselessVoid Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); 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, 4f + npc.gfxOffY); + 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); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); color43 = npc.GetAlpha(color43); - color43 *= (float)(num153 - num163) / 15f; + color43 *= (num153 - num163) / 15f; spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -139,165 +250,51 @@ namespace CalamityMod.NPCs.CeaselessVoid return false; } - public override void AI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - - if (invinceTime > 0) - { - invinceTime--; - } - else - { - npc.damage = expertMode ? 240 : 120; - if (CalamityWorld.revenge) - npc.damage = 300; - npc.dontTakeDamage = false; - } - - Vector2 vectorCenter = npc.Center; - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - - double mult = 0.5 + - (CalamityWorld.revenge ? 0.2 : 0.0) + - (CalamityWorld.death ? 0.2 : 0.0); - - if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) - { - npc.knockBackResist = 0f; - } - - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 90f) - { - num786 = (CalamityWorld.bossRushActive ? 24f : 16f) / num786; - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 16f) - { - npc.velocity.Y = npc.velocity.Y * 1.1f; - npc.velocity.X = npc.velocity.X * 1.1f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = (CalamityWorld.bossRushActive ? 16f : 12f) / num786; - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - else - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= CalamityWorld.bossRushActive ? 16f : 11f; - npc.velocity = (npc.velocity * 99f + value4) / 100f; - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.voidBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.voidBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - npc.ai[2] += 1f; - if (num789 > 700f || npc.ai[2] >= 150f) - { - npc.ai[0] = 0f; - npc.ai[2] = 0f; - } - } - } - - public override bool CheckActive() + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - return CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active; + npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); } - public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) - { - if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) - { - if (projectile.type == ModContent.ProjectileType()) - damage = (int)(damage * 0.9); - } - } + public override bool CheckActive() => false; public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } - player.AddBuff(BuffID.VortexDebuff, 60, true); + player.AddBuff(BuffID.VortexDebuff, 20, true); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return true; - } - public override void HitEffect(int hitDirection, double damage) + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 35f; + } + + public override bool CheckDead() => false; + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); - } + for (int k = 0; k < 20; k++) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + Main.dust[dust].noGravity = true; + } } } } diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs deleted file mode 100644 index 0621a40eb1..0000000000 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ /dev/null @@ -1,261 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.NPCs.CeaselessVoid -{ - public class DarkEnergy2 : ModNPC - { - public int invinceTime = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; - npc.height = 80; - npc.defense = 50; - npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) - { - npc.lifeMax = 24000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 44000; - } - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.knockBackResist = 0.1f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - 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; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - 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((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 (CalamityConfig.Instance.Afterimages) - { - for (int num155 = 1; num155 < num153; num155 += 2) - { - Color color38 = lightColor; - color38 = Color.Lerp(color38, color36, amount9); - 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, 4f + 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow"); - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - - if (CalamityConfig.Instance.Afterimages) - { - for (int num163 = 1; num163 < num153; num163++) - { - 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, 4f + 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 *= (float)(num153 - num163) / 15f; - 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(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - return false; - } - - public override void AI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - if (invinceTime > 0) - { - invinceTime--; - } - else - { - npc.damage = expertMode ? 240 : 120; - if (CalamityWorld.revenge) - npc.damage = 300; - npc.dontTakeDamage = false; - } - - double mult = 0.5 + - (CalamityWorld.revenge ? 0.2 : 0.0) + - (CalamityWorld.death ? 0.2 : 0.0); - if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) - { - npc.knockBackResist = 0f; - } - - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - Vector2 vector145 = new Vector2(npc.Center.X, npc.Center.Y); - float num1258 = Main.player[npc.target].Center.X - vector145.X; - float num1259 = Main.player[npc.target].Center.Y - vector145.Y; - float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); - - float num1261 = expertMode ? 15f : 12f; - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - num1261 += 3f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num1261 += 3f; - - num1260 = num1261 / num1260; - num1258 *= num1260; - num1259 *= num1260; - npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; - npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; - } - - public override bool CheckActive() - { - return CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active; - } - - public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) - { - if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) - { - if (projectile.type == ModContent.ProjectileType()) - damage = (int)(damage * 0.9); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } - player.AddBuff(BuffID.VortexDebuff, 60, true); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/CeaselessVoid/DarkEnergy2.png b/NPCs/CeaselessVoid/DarkEnergy2.png deleted file mode 100644 index ad834020e5..0000000000 Binary files a/NPCs/CeaselessVoid/DarkEnergy2.png and /dev/null differ diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs deleted file mode 100644 index 84352e1b56..0000000000 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ /dev/null @@ -1,289 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CeaselessVoid -{ - public class DarkEnergy3 : ModNPC - { - public int invinceTime = 120; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dark Energy"); - Main.npcFrameCount[npc.type] = 6; - NPCID.Sets.TrailingMode[npc.type] = 1; - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.dontTakeDamage = true; - npc.width = 80; - npc.height = 80; - npc.defense = 50; - npc.lifeMax = 6000; - if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) - { - npc.lifeMax = 24000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 44000; - } - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0.3f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit53; - npc.DeathSound = SoundID.NPCDeath44; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(invinceTime); - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - invinceTime = reader.ReadInt32(); - 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; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - 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((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 (CalamityConfig.Instance.Afterimages) - { - for (int num155 = 1; num155 < num153; num155 += 2) - { - Color color38 = lightColor; - color38 = Color.Lerp(color38, color36, amount9); - 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, 4f + 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/CeaselessVoid/DarkEnergyGlow"); - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - - if (CalamityConfig.Instance.Afterimages) - { - for (int num163 = 1; num163 < num153; num163++) - { - 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, 4f + 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 *= (float)(num153 - num163) / 15f; - 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(texture2D16, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - - return false; - } - - public override void AI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - if (invinceTime > 0) - { - invinceTime--; - } - else - { - npc.damage = expertMode ? 240 : 120; - if (CalamityWorld.revenge) - npc.damage = 300; - npc.dontTakeDamage = false; - } - - double mult = 0.5 + - (CalamityWorld.revenge ? 0.2 : 0.0) + - (CalamityWorld.death ? 0.2 : 0.0); - if ((double)npc.life < (double)npc.lifeMax * mult || CalamityWorld.bossRushActive) - { - npc.knockBackResist = 0f; - } - - if (npc.ai[1] == 0f) - { - npc.scale -= 0.01f; - npc.alpha += 15; - if (npc.alpha >= 125) - { - npc.alpha = 130; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.01f; - npc.alpha -= 15; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } - npc.TargetClosest(true); - Player player = Main.player[npc.target]; - if (!player.active || player.dead || CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.velocity = new Vector2(0f, -10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - - float num1372 = expertMode ? 10f : 8f; - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - num1372 += 2f; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - num1372 += 2f; - - 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.ai[0] -= 1f; - if (num1375 < 200f || npc.ai[0] > 0f) - { - if (num1375 < 200f) - { - npc.ai[0] = 20f; - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - return; - } - 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; - } - if (num1375 < 300f) - { - npc.velocity.X = (npc.velocity.X * 7f + num1373) / 8f; - npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; - } - } - - public override bool CheckActive() - { - return CalamityGlobalNPC.voidBoss < 0 || !Main.npc[CalamityGlobalNPC.voidBoss].active; - } - - public override void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) - { - if (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel1) - { - if (projectile.type == ModContent.ProjectileType()) - damage = (int)(damage * 0.9); - } - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } - player.AddBuff(BuffID.VortexDebuff, 60, true); - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/CeaselessVoid/DarkEnergy3.png b/NPCs/CeaselessVoid/DarkEnergy3.png deleted file mode 100644 index ad834020e5..0000000000 Binary files a/NPCs/CeaselessVoid/DarkEnergy3.png and /dev/null differ diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 384291388f..bfa9301db0 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,13 +19,13 @@ namespace CalamityMod.NPCs.Crabulon public override void SetDefaults() { npc.aiStyle = -1; - npc.damage = 25; - npc.width = 14; + npc.GetNPCDamage(); + npc.width = 14; npc.height = 14; npc.lifeMax = 25; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 150000; + npc.lifeMax = 15000; } aiType = -1; npc.knockBackResist = 0.75f; @@ -46,22 +47,24 @@ namespace CalamityMod.NPCs.Crabulon 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); - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - float speed = revenge ? 1.25f : 1f; + bool enraged = npc.Calamity().enraged > 0; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + float xVelocityLimit = enraged ? 10f : CalamityWorld.malice ? 7.5f : 5f; + float yVelocityLimit = revenge ? 1.25f : 1f; Player player = Main.player[npc.target]; npc.velocity.Y += 0.02f; - if (npc.velocity.Y > speed) + if (npc.velocity.Y > yVelocityLimit) { - npc.velocity.Y = speed; + npc.velocity.Y = yVelocityLimit; } - npc.TargetClosest(true); + npc.TargetClosest(); if (npc.position.X + npc.width < player.position.X) { if (npc.velocity.X < 0f) { npc.velocity.X *= 0.98f; } - npc.velocity.X += (CalamityWorld.bossRushActive ? 0.2f : 0.1f); + npc.velocity.X += 0.1f; } else if (npc.position.X > player.position.X + player.width) { @@ -69,9 +72,9 @@ namespace CalamityMod.NPCs.Crabulon { npc.velocity.X *= 0.98f; } - npc.velocity.X -= (CalamityWorld.bossRushActive ? 0.2f : 0.1f); + npc.velocity.X -= 0.1f; } - if (npc.velocity.X > (CalamityWorld.bossRushActive ? 15f : 5f) || npc.velocity.X < (CalamityWorld.bossRushActive ? -15f : -5f)) + if (npc.velocity.X > xVelocityLimit || npc.velocity.X < -xVelocityLimit) { npc.velocity.X *= 0.97f; } @@ -85,11 +88,11 @@ namespace CalamityMod.NPCs.Crabulon 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 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, 4f + npc.gfxOffY); - + 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"); @@ -114,5 +117,5 @@ namespace CalamityMod.NPCs.Crabulon } } } - } + } } diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index a175da0e95..f3847667e7 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -32,25 +33,20 @@ namespace CalamityMod.NPCs.Crabulon public override void SetDefaults() { - npc.npcSlots = 14f; - npc.damage = 40; - npc.width = 280; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 14f; + npc.GetNPCDamage(); + npc.width = 280; npc.height = 160; npc.defense = 8; - npc.LifeMaxNERB(3000, 4000, 11000000); + npc.LifeMaxNERB(3000, 4000, 1100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; npc.noGravity = false; npc.noTileCollide = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon"); - else - music = MusicID.Boss4; + music = CalamityMod.Instance.GetMusicFromMusicMod("Crabulon") ?? MusicID.Boss4; npc.boss = true; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 4, 0, 0); @@ -73,26 +69,38 @@ namespace CalamityMod.NPCs.Crabulon public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + npc.gfxOffY = -16; Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.3f, 0.7f); - - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - npc.spriteDirection = npc.direction; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + npc.spriteDirection = npc.direction; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases - bool phase2 = (lifeRatio < 0.5f && expertMode) || death; - bool phase3 = (lifeRatio < 0.1f && expertMode) || death; + bool phase2 = lifeRatio < 0.66f && expertMode; + bool phase3 = lifeRatio < 0.33f && expertMode; // Get a 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 == 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(); Player player = Main.player[npc.target]; if (!player.active || player.dead) @@ -127,6 +135,25 @@ namespace CalamityMod.NPCs.Crabulon else if (npc.timeLeft < 1800) npc.timeLeft = 1800; + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!player.ZoneGlowshroom || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + 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); @@ -137,11 +164,6 @@ namespace CalamityMod.NPCs.Crabulon { int num352 = 1; npc.localAI[3] += 2f; - if (CalamityWorld.bossRushActive) - { - npc.localAI[3] += 2f; - num352 += 3; - } if (phase2) { npc.localAI[3] += 1f; @@ -169,13 +191,8 @@ namespace CalamityMod.NPCs.Crabulon npc.ai[3] = 0f; } float num353 = 10f; - int num354 = expertMode ? 12 : 16; - int num355 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); Main.PlaySound(SoundID.Item42, (int)npc.position.X, (int)npc.position.Y); - if (CalamityWorld.bossRushActive) - { - num353 += 3f; - } if (phase2) { num353 += 1f; @@ -193,7 +210,7 @@ namespace CalamityMod.NPCs.Crabulon num350 *= num351; vector34.X += num349; vector34.Y += num350; - Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, num355, num354, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector34.X, vector34.Y, num349, num350 - 5f, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 0f); } } } @@ -210,7 +227,7 @@ namespace CalamityMod.NPCs.Crabulon Main.dust[sporeDust].noGravity = true; Main.dust[sporeDust].velocity *= 0.5f; npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 420f) + if (npc.justHit || npc.ai[1] >= 600f) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -221,9 +238,9 @@ namespace CalamityMod.NPCs.Crabulon { npc.velocity *= 0.98f; npc.ai[1] += 1f; - if (npc.ai[1] >= (revenge ? 30f : 60f)) + if (npc.ai[1] >= (death ? 5f : revenge ? 10f : 15f)) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.noGravity = true; npc.noTileCollide = true; npc.ai[0] = 2f; @@ -233,28 +250,24 @@ namespace CalamityMod.NPCs.Crabulon } else if (npc.ai[0] == 2f) { - float num823 = 1.25f; - bool flag51 = false; + float num823 = 1f; if (phase2) - num823 = 1.5f; + num823 = 1.25f; if (phase3) - num823 = 2f; - if (CalamityWorld.bossRushActive) - num823 = 12f; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num823 = 16f; + num823 = 1.75f; + if (death) + num823 += 2f * (1f - lifeRatio); + num823 += 4f * enrageScale; - if (Math.Abs(npc.Center.X - player.Center.X) < 50f) - { + bool flag51 = false; + 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; - } } else { @@ -266,66 +279,56 @@ namespace CalamityMod.NPCs.Crabulon 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); - bool flag52 = false; - if (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) - { - flag52 = true; - } - if (flag52) + + 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; } else if (Collision.SolidCollision(position2, num854, num855)) { if (npc.velocity.Y > 0f) - { npc.velocity.Y = 0f; - } - if (npc.velocity.Y > -0.2) - { + + if (npc.velocity.Y > -0.2f) npc.velocity.Y -= 0.025f; - } else - { npc.velocity.Y -= 0.2f; - } + if (npc.velocity.Y < -4f) - { npc.velocity.Y = -4f; - } } else { if (npc.velocity.Y < 0f) - { npc.velocity.Y = 0f; - } - if (npc.velocity.Y < 0.1) - { + + if (npc.velocity.Y < 0.1f) npc.velocity.Y += 0.025f; - } else - { npc.velocity.Y += 0.5f; - } } + + if (npc.ai[1] % 25f == 24f) + npc.netUpdate = true; + npc.ai[1] += 1f; - if (npc.ai[1] >= 360f) + if (npc.ai[1] >= (360f - (death ? 120f * (1f - lifeRatio) : 0f))) { - npc.TargetClosest(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; - } } else if (npc.ai[0] == 3f) { @@ -334,6 +337,9 @@ namespace CalamityMod.NPCs.Crabulon { npc.velocity.X *= 0.8f; npc.ai[1] += 1f; + if (npc.ai[1] % 15f == 14f) + npc.netUpdate = true; + if (npc.ai[1] > 0f) { if (revenge) @@ -343,8 +349,6 @@ namespace CalamityMod.NPCs.Crabulon case 0: break; case 1: - npc.ai[1] += 1f; - break; case 2: npc.ai[1] += 3f; break; @@ -356,23 +360,20 @@ namespace CalamityMod.NPCs.Crabulon } } if (phase2) - { npc.ai[1] += !revenge ? 4f : 1f; - } if (phase3) - { npc.ai[1] += !revenge ? 4f : 1f; - } } - if (npc.ai[1] >= 300f) + float jumpGateValue = (malice ? 30f : 240f) / (enrageScale + 1f); + if (npc.ai[1] >= jumpGateValue) { npc.ai[1] = -20f; } else if (npc.ai[1] == -1f) { - int velocityX = CalamityWorld.bossRushActive ? 12 : 4; - float velocityY = CalamityWorld.bossRushActive ? -16f : -12f; + int velocityX = 4; + float velocityY = -12f; float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); float speedMult = 1f; @@ -418,10 +419,14 @@ namespace CalamityMod.NPCs.Crabulon else npc.velocity.Y = velocityY; + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.velocity.X = velocityX * npc.direction; npc.ai[0] = 4f; npc.ai[1] = 0f; + npc.netUpdate = true; } } } @@ -434,22 +439,30 @@ namespace CalamityMod.NPCs.Crabulon if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile((int)npc.Center.X, (int)npc.Center.Y + 20, 0f, 0f, ModContent.ProjectileType(), 20, 0f, Main.myPlayer, 0f, 0f); - int num354 = expertMode ? 12 : 16; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (npc.ai[2] % 2f == 0f && phase2 && revenge) { if (Main.netMode != NetmodeID.MultiplayerClient) { float velocityX = npc.ai[2] == 0f ? -4f : 4f; - for (int x = 0; x < 20; x++) + int totalMushrooms = malice ? 50 : 20; + int shotSpacingDecrement = malice ? 80 : 100; + if (malice) + shotSpacing = 2000; + + for (int x = 0; x < totalMushrooms; x++) { - Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, velocityX, 0f, ModContent.ProjectileType(), num354, 0f, Main.myPlayer, 0f, 0f); - shotSpacing -= 100; + Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, velocityX, 0f, type, damage, 0f, Main.myPlayer, 0f, 0f); + shotSpacing -= shotSpacingDecrement; } - shotSpacing = 1000; + + shotSpacing = malice ? 2000 : 1000; } } - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[2] += 1f; if (npc.ai[2] >= (phase2 ? 4f : 3f)) { @@ -457,7 +470,7 @@ namespace CalamityMod.NPCs.Crabulon { for (int x = 0; x < 20; x++) { - Projectile.NewProjectile(npc.Center.X + shotSpacing, npc.Center.Y - 1000f, 0f, 0f, ModContent.ProjectileType(), num354, 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; @@ -467,13 +480,19 @@ namespace CalamityMod.NPCs.Crabulon npc.ai[2] = 0f; if (revenge) npc.ai[3] = 0f; + npc.netUpdate = true; } else { - npc.ai[0] = 3f; + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + + npc.ai[0] = 3f; if (revenge) npc.ai[3] += 1f; - } + + npc.netUpdate = true; + } for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) { @@ -497,28 +516,27 @@ namespace CalamityMod.NPCs.Crabulon 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 += CalamityWorld.bossRushActive ? 0.3f : 0.15f; + npc.velocity.Y += death ? 0.18f : 0.15f; } else { float velocityX = 0.11f + (expertMode ? 0.02f : 0f) + - (revenge ? 0.02f : 0f); + (revenge ? 0.02f : 0f) + + (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; - float num626 = CalamityWorld.bossRushActive ? 5f : 2.5f; + float num626 = 2.5f; + num626 += enrageScale; if (revenge) { num626 += 1f; } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num626 += 3f; - } if (phase2) { num626 += 1f; @@ -551,13 +569,13 @@ namespace CalamityMod.NPCs.Crabulon if ((npc.life + num660) < npc.localAI[0]) { npc.localAI[0] = npc.life; - int num661 = expertMode ? Main.rand.Next(2, 4) : Main.rand.Next(1, 3); + 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 num663 = ModContent.NPCType(); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + int num664 = NPC.NewNPC(x, y, num663); Main.npc[num664].SetDefaults(num663, -1f); Main.npc[num664].velocity.X = Main.rand.Next(-50, 51) * 0.1f; Main.npc[num664].velocity.Y = Main.rand.Next(-50, -31) * 0.1f; @@ -599,7 +617,7 @@ namespace CalamityMod.NPCs.Crabulon 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, 4f + npc.gfxOffY); + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (npc.ai[0] > 2f) @@ -607,7 +625,7 @@ namespace CalamityMod.NPCs.Crabulon 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, 4f + npc.gfxOffY); + 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); @@ -618,7 +636,7 @@ namespace CalamityMod.NPCs.Crabulon 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, 4f + npc.gfxOffY); + 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); @@ -638,9 +656,11 @@ namespace CalamityMod.NPCs.Crabulon { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Crabulon + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedCrabulon); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedCrabulon, 2, 0, 0); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedCrabulon); @@ -652,7 +672,7 @@ namespace CalamityMod.NPCs.Crabulon DropHelper.DropItem(npc, ItemID.MushroomGrassSeeds, 3, 6); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -667,13 +687,13 @@ namespace CalamityMod.NPCs.Crabulon // Mark Crabulon as dead CalamityWorld.downedCrabulon = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index bebda2e086..2e4c4648f3 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -33,19 +33,17 @@ namespace CalamityMod.NPCs.Crags npc.DeathSound = SoundID.NPCDeath1; if (CalamityWorld.downedProvidence) { - npc.damage = 227; - npc.defense = 101; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 80; + npc.defense = 20; + npc.lifeMax = 3000; } banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() { - if ((double) npc.life < (double) npc.lifeMax * 0.5) + if (npc.life < npc.lifeMax * 0.5) { if (npc.direction == -1 && npc.velocity.X > -6f) { @@ -118,12 +116,7 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } } public override void NPCLoot() diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index 526bcf8c21..ab5b668108 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -1,5 +1,5 @@ using CalamityMod.World; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; @@ -37,10 +37,9 @@ namespace CalamityMod.NPCs.Crags npc.DeathSound = SoundID.NPCDeath1; if (CalamityWorld.downedProvidence) { - npc.damage = 227; - npc.defense = 90; - npc.lifeMax = 7500; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 80; + npc.defense = 20; + npc.lifeMax = 3500; } banner = npc.type; bannerItem = ModContent.ItemType(); @@ -55,15 +54,12 @@ namespace CalamityMod.NPCs.Crags return spawnInfo.player.Calamity().ZoneCalamity ? 0.08f : 0f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index 24c7f826ca..7b03fe74f4 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -20,26 +20,24 @@ namespace CalamityMod.NPCs.Crags npc.lavaImmune = true; npc.aiStyle = 3; npc.damage = 50; - npc.width = 18; //324 - npc.height = 40; //216 - npc.defense = 25; + 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, 2, 0); + npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath50; if (CalamityWorld.downedProvidence) { - npc.damage = 250; - npc.defense = 130; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 100; + npc.defense = 30; + npc.lifeMax = 3000; } banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -47,7 +45,12 @@ namespace CalamityMod.NPCs.Crags return (spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -58,18 +61,13 @@ namespace CalamityMod.NPCs.Crags for (int k = 0; k < 20; k++) { 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); } } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - } - public override void NPCLoot() { DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 251247e904..ab1a5ec815 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; @@ -20,8 +20,8 @@ namespace CalamityMod.NPCs.Crags npc.aiStyle = -1; aiType = -1; npc.damage = 40; - npc.width = 72; //324 - npc.height = 72; //216 + npc.width = 72; + npc.height = 72; npc.defense = 38; npc.DR_NERD(0.35f); npc.lifeMax = 120; @@ -33,14 +33,12 @@ namespace CalamityMod.NPCs.Crags npc.lavaImmune = true; if (CalamityWorld.downedProvidence) { - npc.damage = 190; - npc.defense = 185; - npc.lifeMax = 5000; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 80; + npc.defense = 50; + npc.lifeMax = 3000; } banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -48,14 +46,6 @@ namespace CalamityMod.NPCs.Crags CalamityAI.UnicornAI(npc, mod, true, CalamityWorld.death ? 6f : 4f, 5f, 0.2f); } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) { return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; @@ -67,7 +57,12 @@ namespace CalamityMod.NPCs.Crags DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -79,6 +74,8 @@ namespace CalamityMod.NPCs.Crags { 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); } } } diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs similarity index 83% rename from NPCs/NormalNPCs/HeatSpirit.cs rename to NPCs/Crags/HeatSpirit.cs index a0402cff51..4d066baeb4 100644 --- a/NPCs/NormalNPCs/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -6,7 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs +namespace CalamityMod.NPCs.Crags { public class HeatSpirit : ModNPC { @@ -30,19 +30,14 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath55; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Underworld.Chance * 0.065f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { if (npc.velocity.X < 0f) { @@ -74,7 +69,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } @@ -95,7 +89,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 4, 1, 1); + } } } diff --git a/NPCs/NormalNPCs/HeatSpirit.png b/NPCs/Crags/HeatSpirit.png similarity index 100% rename from NPCs/NormalNPCs/HeatSpirit.png rename to NPCs/Crags/HeatSpirit.png diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 91305387a5..9376752557 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -1,8 +1,7 @@ using CalamityMod.Dusts; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -21,8 +20,8 @@ namespace CalamityMod.NPCs.Crags npc.aiStyle = -1; aiType = -1; npc.damage = 50; - npc.width = 80; //324 - npc.height = 80; //216 + npc.width = 80; + npc.height = 80; npc.defense = 18; npc.lifeMax = 90; npc.alpha = 100; @@ -35,14 +34,12 @@ namespace CalamityMod.NPCs.Crags npc.lavaImmune = true; if (CalamityWorld.downedProvidence) { - npc.damage = 260; - npc.defense = 90; - npc.lifeMax = 4000; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 90; + npc.defense = 30; + npc.lifeMax = 2500; } banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -248,14 +245,6 @@ namespace CalamityMod.NPCs.Crags } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) { return spawnInfo.player.Calamity().ZoneCalamity ? 0.25f : 0f; @@ -265,10 +254,14 @@ namespace CalamityMod.NPCs.Crags { 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.downedYharon, CalamityWorld.defiled ? 0.05f : 0.02f); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -280,6 +273,7 @@ namespace CalamityMod.NPCs.Crags { 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); } } } diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index f7a841f738..2742b488c7 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -1,8 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -21,8 +20,8 @@ namespace CalamityMod.NPCs.Crags npc.aiStyle = -1; aiType = -1; npc.damage = 65; - npc.width = 80; //324 - npc.height = 80; //216 + npc.width = 80; + npc.height = 80; npc.defense = 10; npc.lifeMax = 50; npc.alpha = 100; @@ -35,14 +34,12 @@ namespace CalamityMod.NPCs.Crags npc.lavaImmune = true; if (CalamityWorld.downedProvidence) { - npc.damage = 320; - npc.defense = 80; - npc.lifeMax = 2300; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 110; + npc.defense = 20; + npc.lifeMax = 1500; } banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -248,14 +245,6 @@ namespace CalamityMod.NPCs.Crags } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) { return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; @@ -265,10 +254,14 @@ namespace CalamityMod.NPCs.Crags { 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.downedYharon, CalamityWorld.defiled ? 0.05f : 0.02f); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -280,6 +273,8 @@ namespace CalamityMod.NPCs.Crags { 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); } } } diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 29c1c70e67..2f880ba559 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; @@ -27,9 +27,9 @@ namespace CalamityMod.NPCs.Crags aiType = -1; npc.npcSlots = 1f; npc.damage = 30; - npc.width = 60; //324 - npc.height = 40; //216 - npc.defense = 40; + npc.width = 60; + npc.height = 40; + npc.defense = 30; npc.DR_NERD(0.15f); npc.lifeMax = 60; npc.knockBackResist = 0.65f; @@ -40,10 +40,9 @@ namespace CalamityMod.NPCs.Crags npc.DeathSound = SoundID.NPCDeath14; if (CalamityWorld.downedProvidence) { - npc.damage = 170; - npc.defense = 200; - npc.lifeMax = 3000; - npc.value = Item.buyPrice(0, 0, 50, 0); + npc.damage = 60; + npc.defense = 45; + npc.lifeMax = 2000; } banner = npc.type; bannerItem = ModContent.ItemType(); @@ -57,21 +56,22 @@ namespace CalamityMod.NPCs.Crags public override void AI() { bool provy = CalamityWorld.downedProvidence; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + Player target = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || target.dead) { npc.TargetClosest(true); } float num = 5f; float num2 = 0.07f; - 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 source = npc.Center; + float num4 = target.Center.X; + float num5 = target.Center.Y; num4 = (float)((int)(num4 / 8f) * 8); num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; + source.X = (float)((int)(source.X / 8f) * 8); + source.Y = (float)((int)(source.Y / 8f) * 8); + num4 -= source.X; + num5 -= source.Y; float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); float num7 = num6; bool flag = false; @@ -95,45 +95,45 @@ namespace CalamityMod.NPCs.Crags npc.ai[0] += 1f; if (npc.ai[0] > 0f) { - npc.velocity.Y = npc.velocity.Y + 0.023f; + npc.velocity.Y += 0.023f; } else { - npc.velocity.Y = npc.velocity.Y - 0.023f; + npc.velocity.Y -= 0.023f; } if (npc.ai[0] < -100f || npc.ai[0] > 100f) { - npc.velocity.X = npc.velocity.X + 0.023f; + npc.velocity.X += 0.023f; } else { - npc.velocity.X = npc.velocity.X - 0.023f; + npc.velocity.X -= 0.023f; } if (npc.ai[0] > 200f) { npc.ai[0] = -200f; } } - if (Main.player[npc.target].dead) + if (target.dead) { num4 = (float)npc.direction * num / 2f; num5 = -num / 2f; } if (npc.velocity.X < num4) { - npc.velocity.X = npc.velocity.X + num2; + npc.velocity.X += num2; } else if (npc.velocity.X > num4) { - npc.velocity.X = npc.velocity.X - num2; + npc.velocity.X -= num2; } if (npc.velocity.Y < num5) { - npc.velocity.Y = npc.velocity.Y + num2; + npc.velocity.Y += num2; } else if (npc.velocity.Y > num5) { - npc.velocity.Y = npc.velocity.Y - num2; + npc.velocity.Y -= num2; } npc.localAI[0] += 1f; if (npc.justHit) @@ -143,24 +143,24 @@ namespace CalamityMod.NPCs.Crags if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) { 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)) + if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - int num8 = 30; + int dmg = 30; if (Main.expertMode) { - num8 = 22; + dmg = 22; } - int num9 = ModContent.ProjectileType(); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int projType = ModContent.ProjectileType(); + Projectile.NewProjectile(source.X, source.Y, num4, num5, projType, dmg + (provy ? 30 : 0), 0f, Main.myPlayer, 1f, 0f); } } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; + 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.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.75f, 0f, 0f); + Lighting.AddLight((int)npc.Center.X / 16, (int)npc.Center.Y / 16, 0.75f, 0f, 0f); } if (num4 > 0f) { @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.Crags if (num4 < 0f) { npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; + npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + MathHelper.Pi; } float num12 = 0.7f; if (npc.collideX) @@ -190,11 +190,11 @@ namespace CalamityMod.NPCs.Crags { npc.netUpdate = true; npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) { npc.velocity.Y = 2f; } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) { npc.velocity.Y = -2f; } @@ -205,12 +205,12 @@ namespace CalamityMod.NPCs.Crags { if (Math.Abs(npc.velocity.X) < 12f) { - npc.velocity.X = npc.velocity.X * 1.05f; + npc.velocity.X *= 1.05f; } } else { - npc.velocity.X = 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) @@ -225,8 +225,8 @@ namespace CalamityMod.NPCs.Crags 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 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; int num153 = 5; @@ -240,18 +240,18 @@ namespace CalamityMod.NPCs.Crags 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)) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + 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)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + 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); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/SoulSeekerGlow"); + texture = ModContent.GetTexture("CalamityMod/NPCs/Crags/SoulSlurperGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -262,25 +262,17 @@ namespace CalamityMod.NPCs.Crags 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)) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, npc.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); + 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(texture2D15, 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 OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } - } - public override void NPCLoot() { DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 2, 1, 1); @@ -288,7 +280,12 @@ namespace CalamityMod.NPCs.Crags DropHelper.DropItemChance(npc, ModContent.ItemType(), (Main.hardMode ? 30 : 10)); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { @@ -296,10 +293,9 @@ namespace CalamityMod.NPCs.Crags } if (npc.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/CalamitasGores/SoulSlurper4"), 1f); + 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; diff --git a/NPCs/Crags/SoulSlurperGlow.png b/NPCs/Crags/SoulSlurperGlow.png new file mode 100644 index 0000000000..ee7fef5c87 Binary files /dev/null and b/NPCs/Crags/SoulSlurperGlow.png differ diff --git a/NPCs/Cryogen/Cryocore.cs b/NPCs/Cryogen/Cryocore.cs index f8b4e9f821..3ad439f611 100644 --- a/NPCs/Cryogen/Cryocore.cs +++ b/NPCs/Cryogen/Cryocore.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -17,24 +18,23 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { - npc.damage = 35; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 40; npc.defense = 6; npc.lifeMax = 220; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + npc.lifeMax = 3000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.75f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.75f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath15; - npc.coldDamage = true; } public override void FindFrame(int frameHeight) @@ -48,10 +48,10 @@ namespace CalamityMod.NPCs.Cryogen 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(true); + npc.TargetClosest(); bool revenge = CalamityWorld.revenge; float speed = revenge ? 12f : 11f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) speed = 24f; 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; @@ -99,11 +99,6 @@ namespace CalamityMod.NPCs.Cryogen player.AddBuff(BuffID.Chilled, 60, true); } - public override bool PreNPCLoot() - { - return false; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/Cryogen/Cryocore2.cs b/NPCs/Cryogen/Cryocore2.cs index b5cad284eb..c0481f955f 100644 --- a/NPCs/Cryogen/Cryocore2.cs +++ b/NPCs/Cryogen/Cryocore2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -17,24 +18,23 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { - npc.damage = 40; - npc.width = 66; + npc.GetNPCDamage(); + npc.width = 66; npc.height = 66; npc.defense = 10; npc.lifeMax = 300; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 40000; + npc.lifeMax = 4000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.5f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.5f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath15; - npc.coldDamage = true; } public override void FindFrame(int frameHeight) @@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.Cryogen npc.TargetClosest(true); bool revenge = CalamityWorld.revenge; float speed = revenge ? 14f : 12f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) speed = 28f; 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; @@ -99,11 +99,6 @@ namespace CalamityMod.NPCs.Cryogen player.AddBuff(BuffID.Chilled, 60, true); } - public override bool PreNPCLoot() - { - return false; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 9933d46989..b7d487275e 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1,5 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -10,8 +9,10 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; +using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -20,7 +21,6 @@ using System; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.Cryogen { @@ -41,59 +41,26 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { - npc.npcSlots = 24f; - npc.damage = 50; - npc.width = 86; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 24f; + npc.GetNPCDamage(); + npc.width = 86; npc.height = 88; npc.defense = 12; - npc.DR_NERD(0.1f); - npc.LifeMaxNERB(17900, 26300, 3000000); + npc.DR_NERD(0.3f); + npc.LifeMaxNERB(18795, 27615, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 12, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.OnFire] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.ShadowFlame] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; + npc.value = Item.buyPrice(0, 10, 0, 0); npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath15; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen"); - else - music = MusicID.FrostMoon; + music = CalamityMod.Instance.GetMusicFromMusicMod("Cryogen") ?? MusicID.FrostMoon; bossBag = ModContent.ItemType(); } @@ -103,7 +70,9 @@ namespace CalamityMod.NPCs.Cryogen writer.Write(iceShard); writer.Write(teleportLocationX); writer.Write(npc.dontTakeDamage); - } + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { @@ -111,42 +80,70 @@ namespace CalamityMod.NPCs.Cryogen iceShard = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); - } + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { + 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); // Get a 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 == 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(); Player player = Main.player[npc.target]; - bool isChill = player.ZoneSnow; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + float enrageScale = death ? 0.5f : 0f; + if (!player.ZoneSnow || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + + if (enrageScale > 2f) + enrageScale = 2f; + + if (BossRushEvent.BossRushActive) + enrageScale = 3f; + + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale = 4f; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases - bool phase2 = lifeRatio < (death ? 0.95 : revenge ? 0.89 : 0.83); - bool phase3 = lifeRatio < (death ? 0.8 : revenge ? 0.73 : 0.66); - bool phase4 = lifeRatio < (death ? 0.7 : revenge ? 0.6 : 0.49); - bool phase5 = lifeRatio < (death ? 0.55 : revenge ? 0.43 : 0.32); - bool phase6 = lifeRatio < (death ? 0.4 : revenge ? 0.27 : 0.15); - bool phase7 = lifeRatio < (death ? 0.25 : 0.15) && revenge; - bool phase8 = lifeRatio < (revenge ? 0.225 : 0.1); - bool phase9 = lifeRatio < (revenge ? 0.2 : 0.05) || death; + bool phase2 = lifeRatio < (revenge ? 0.85f : 0.8f); + bool phase3 = lifeRatio < (revenge ? 0.7f : 0.6f); + bool phase4 = lifeRatio < (revenge ? 0.55f : 0.4f); + bool phase5 = lifeRatio < (revenge ? 0.4f : 0.2f); + bool phase6 = lifeRatio < 0.25f && revenge; + bool phase7 = lifeRatio < 0.15f && revenge; - if ((int)npc.ai[0] + 1 > currentPhase && currentPhase < 6) - { + 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] < 4f || CalamityWorld.bossRushActive)) //spawn shield for phase 0 1 2 3, not 4 5 6 + if (npc.ai[2] == 0f && npc.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (npc.ai[0] < 3f || BossRushEvent.BossRushActive)) //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, 0f, 0f, 0f, 0f, 255); npc.ai[2] = num6 + 1; @@ -165,19 +162,11 @@ namespace CalamityMod.NPCs.Cryogen { npc.dontTakeDamage = false; npc.ai[2] = 0f; - if (npc.localAI[1] == -1f) - { - npc.localAI[1] = expertMode ? 720f : 1080f; - } - if (npc.localAI[1] > 0f) - { - npc.localAI[1] -= 1f; - } - } - if (npc.ai[0] != 5f) - { - npc.rotation = npc.velocity.X * 0.1f; + if (npc.localAI[1] == -1f) + npc.localAI[1] = expertMode ? 720f : 1080f; + if (npc.localAI[1] > 0f) + npc.localAI[1] -= 1f; } CalamityMod.StopRain(); @@ -210,44 +199,56 @@ namespace CalamityMod.NPCs.Cryogen else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !phase7)) + if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (npc.ai[0] < 5f || !phase6)) { time++; - if (time >= 600) + if (time >= (malice ? 480 : 600)) { + time = 0; + Main.PlaySound(SoundID.Item28, npc.Center); int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = 25; - float velocity = CalamityWorld.bossRushActive ? 12f : 4f; - Vector2 spinningPoint = Main.rand.NextBool(2) ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)) * velocity; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 4f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); } - time = 0; } } - if (npc.ai[0] == 0f) + float chargeGateValue = malice ? 240f : 360f; + + if (npc.ai[0] == 0f) { - if (Main.netMode != NetmodeID.MultiplayerClient) + npc.rotation = npc.velocity.X * 0.1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - int totalProjectiles = 16; + Main.PlaySound(SoundID.Item28, npc.Center); + int totalProjectiles = malice ? 24 : 16; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 12f : 8f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 9f + enrageScale; + Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); } } } @@ -257,15 +258,10 @@ namespace CalamityMod.NPCs.Cryogen float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); - float num1246 = isChill ? 4f : 8f; - if (death) - { - num1246 = isChill ? 5f : 10f; - } - if (CalamityWorld.bossRushActive) - { - num1246 = 14f; - } + + float num1246 = revenge ? 5f : 4f; + num1246 += 2f * enrageScale; + num1245 = num1246 / num1245; num1243 *= num1245; num1244 *= num1245; @@ -274,7 +270,7 @@ namespace CalamityMod.NPCs.Cryogen if (phase2) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 1f; npc.localAI[0] = 0f; npc.netUpdate = true; @@ -282,293 +278,313 @@ namespace CalamityMod.NPCs.Cryogen } else if (npc.ai[0] == 1f) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - int totalProjectiles = 12; - float radians = MathHelper.TwoPi / totalProjectiles; - int damage = expertMode ? 20 : 23; - float velocity2 = CalamityWorld.bossRushActive ? 12f : 8f; - for (int k = 0; k < totalProjectiles; k++) + if (npc.ai[1] < chargeGateValue) + { + npc.ai[1] += 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] = 0f; + npc.TargetClosest(); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - Vector2 vector255 = new Vector2(0f, -velocity2).RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Main.PlaySound(SoundID.Item28, npc.Center); + int totalProjectiles = malice ? 18 : 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + 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); + } } - } - } - } + } + } - float velocity = isChill ? 7.5f : 4f; - float acceleration = isChill ? 0.1f : 0.15f; - if (death) - velocity = isChill ? 7f : 3.5f; - if (CalamityWorld.bossRushActive) - { - velocity = 3f; - acceleration *= 1.5f; + float velocity = revenge ? 3.5f : 4f; + float acceleration = 0.15f; + velocity -= enrageScale * 0.8f; + acceleration += 0.07f * enrageScale; + + if (npc.position.Y > player.position.Y - 375f) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y *= 0.98f; + + npc.velocity.Y -= acceleration; + + if (npc.velocity.Y > velocity) + npc.velocity.Y = velocity; + } + else if (npc.position.Y < player.position.Y - 425f) + { + if (npc.velocity.Y < 0f) + npc.velocity.Y *= 0.98f; + + npc.velocity.Y += acceleration; + + 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.velocity.X > 0f) + npc.velocity.X *= 0.98f; + + npc.velocity.X -= acceleration; + + 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.velocity.X < 0f) + npc.velocity.X *= 0.98f; + + npc.velocity.X += acceleration; + + if (npc.velocity.X < -velocity) + npc.velocity.X = -velocity; + } } - - if (npc.position.Y > player.position.Y - 375f) + else if (npc.ai[1] < chargeGateValue + 30f) { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; + npc.ai[1] += 1f; - npc.velocity.Y -= acceleration; + calamityGlobalNPC.newAI[0] += 0.025f; + if (calamityGlobalNPC.newAI[0] > 0.5f) + calamityGlobalNPC.newAI[0] = 0.5f; - if (npc.velocity.Y > velocity) - npc.velocity.Y = velocity; + npc.rotation += calamityGlobalNPC.newAI[0]; + npc.velocity *= 0.98f; } - else if (npc.position.Y < player.position.Y - 425f) + else { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; + if (npc.ai[1] == chargeGateValue + 30f) + { + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (18f + enrageScale * 2f); - npc.velocity.Y += acceleration; + npc.ai[1] = chargeGateValue + 90f; + calamityGlobalNPC.newAI[0] = 0f; - if (npc.velocity.Y < -velocity) - npc.velocity.Y = -velocity; - } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item28, npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 9f + enrageScale; + for (int i = 0; i < 2; i++) + { + int totalProjectiles = 10; + float radians = MathHelper.TwoPi / totalProjectiles; + float newVelocity = velocity - (velocity * 0.5f * i); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + 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); + } + } + } + } + } - if (npc.position.X + (npc.width / 2) > player.position.X + (player.width / 2) + 300f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; + npc.ai[1] -= 1f; + if (npc.ai[1] == chargeGateValue + 30f) + { + npc.TargetClosest(); - npc.velocity.X -= acceleration; + npc.ai[1] = 0f; + npc.localAI[0] = 0f; - 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.velocity.X < 0f) - npc.velocity.X *= 0.98f; - - npc.velocity.X += acceleration; - - if (npc.velocity.X < -velocity) - npc.velocity.X = -velocity; + npc.rotation = npc.velocity.X * 0.1f; + } + else if (npc.ai[1] <= chargeGateValue + 45f) + { + npc.velocity *= 0.95f; + npc.rotation = npc.velocity.X * 0.15f; + } + else + npc.rotation += npc.direction * 0.5f; } if (phase3) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 2f; - npc.localAI[0] = 0f; - iceShard = 0; + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + iceShard = 0; npc.netUpdate = true; } } else if (npc.ai[0] == 2f) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - npc.netUpdate = true; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - if (Main.rand.NextBool(2)) - { - int totalProjectiles = 12; + if (npc.ai[1] < chargeGateValue) + { + npc.ai[1] += 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] = 0f; + npc.TargetClosest(); + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + { + Main.PlaySound(SoundID.Item28, npc.Center); + int totalProjectiles = malice ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 14f : 9f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 9f + enrageScale; + Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); } - } - else - { - float num179 = revenge ? 9f : 7f; - if (CalamityWorld.bossRushActive) - num179 = 14f; + } + } + } - 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; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 23 : 26; - int num185 = ModContent.ProjectileType(); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 6; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num179 / num183; - num180 += Main.rand.Next(-360, 361); - num182 += Main.rand.Next(-360, 361); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -8f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + 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); - 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); - float num1246 = isChill ? 6f : 12f; - if (death) - { - num1246 = isChill ? 7f : 14f; - } - if (CalamityWorld.bossRushActive) - { - num1246 = 20f; - } - 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; + float num1246 = revenge ? 7f : 6f; + num1246 += 2f * enrageScale; + + 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; + } + else if (npc.ai[1] < chargeGateValue + 20f) + { + 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; + } + else + { + if (npc.ai[1] == chargeGateValue + 20f) + { + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (18f + enrageScale * 2f); + + 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)) + { + Main.PlaySound(SoundID.Item28, npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 9f + enrageScale; + for (int i = 0; i < 3; i++) + { + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + float newVelocity = velocity - (velocity * 0.33f * i); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = i == 1 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + 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); + } + } + } + } + } + + npc.ai[1] -= 1f; + if (npc.ai[1] == chargeGateValue + 20f) + { + npc.TargetClosest(); + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] > 1f) + { + npc.ai[1] = 0f; + npc.localAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + } + + npc.rotation = npc.velocity.X * 0.1f; + } + else if (npc.ai[1] <= chargeGateValue + 35f) + { + npc.velocity *= 0.95f; + npc.rotation = npc.velocity.X * 0.15f; + } + else + npc.rotation += npc.direction * 0.5f; + } if (phase4) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.ai[0] = 3f; + npc.ai[1] = 0f; npc.localAI[0] = 0f; - npc.netUpdate = true; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 3f) { - if (Main.netMode != NetmodeID.MultiplayerClient) + npc.rotation = npc.velocity.X * 0.1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= 120f) + 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)) { - float num179 = revenge ? 9f : 7f; - if (CalamityWorld.bossRushActive) - num179 = 14f; - - 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; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 23 : 26; - int num185 = ModContent.ProjectileType(); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 12; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num179 / num183; - num180 += Main.rand.Next(-360, 361); - num182 += Main.rand.Next(-360, 361); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -2.5f, num185, num184, 0f, Main.myPlayer, 1f, 0f); - } - } - } - } - - float velocity = isChill ? 7.5f : 4f; - float acceleration = isChill ? 0.1f : 0.15f; - if (death) - velocity = isChill ? 7f : 3.5f; - if (CalamityWorld.bossRushActive) - { - velocity = 3f; - acceleration *= 1.5f; - } - - if (npc.position.Y > player.position.Y - 375f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - - npc.velocity.Y -= acceleration; - - if (npc.velocity.Y > velocity) - npc.velocity.Y = velocity; - } - else if (npc.position.Y < player.position.Y - 425f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - - npc.velocity.Y += acceleration; - - 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.velocity.X > 0f) - npc.velocity.X *= 0.98f; - - npc.velocity.X -= acceleration; - - 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.velocity.X < 0f) - npc.velocity.X *= 0.98f; - - npc.velocity.X += acceleration; - - if (npc.velocity.X < -velocity) - npc.velocity.X = -velocity; - } - - if (phase5) - { - npc.TargetClosest(true); - npc.ai[0] = 4f; - npc.localAI[0] = 0f; - iceShard = 0; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 60f && npc.alpha == 0) - { - npc.localAI[0] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - int totalProjectiles = 12; + Main.PlaySound(SoundID.Item28, npc.Center); + int totalProjectiles = malice ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 14f : 9f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 10f + enrageScale; + Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); } } } @@ -578,11 +594,10 @@ namespace CalamityMod.NPCs.Cryogen float num1243 = player.Center.X - vector142.X; float num1244 = player.Center.Y - vector142.Y; float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244); + float speed = revenge ? 5.5f : 5f; - if (CalamityWorld.bossRushActive) - { - speed = 10f; - } + speed += 1.5f * enrageScale; + num1245 = speed / num1245; num1243 *= num1245; num1244 *= num1245; @@ -594,9 +609,9 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[2] += 1f; - if (npc.localAI[2] >= (CalamityWorld.bossRushActive ? 90f : 180f)) + if (npc.localAI[2] >= 180f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.localAI[2] = 0f; int num1249 = 0; int num1250; @@ -644,11 +659,10 @@ namespace CalamityMod.NPCs.Cryogen Main.dust[dust].noGravity = true; } - npc.alpha += 2; - if (npc.alpha >= 255) + npc.Opacity -= 0.008f; + if (npc.Opacity <= 0f) { - Main.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; + npc.Opacity = 0f; npc.position = position; for (int n = 0; n < 15; n++) @@ -657,95 +671,131 @@ namespace CalamityMod.NPCs.Cryogen Main.dust[num39].noGravity = true; } - npc.ai[1] = 2f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + 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); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 9f + enrageScale; + for (int i = 0; i < 3; i++) + { + int totalProjectiles = malice ? 9 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float newVelocity = velocity - (velocity * 0.33f * i); + float velocityX = 0f; + if (i > 0) + { + double angleA = radians * 0.33 * (3 - i); + double angleB = MathHelper.ToRadians(90f) - angleA; + velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + } + Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + 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); + } + } + } + } + + npc.ai[1] = 2f; npc.netUpdate = true; } } else if (npc.ai[1] == 2f) { - npc.alpha -= 50; - if (npc.alpha <= 0) + npc.Opacity += 0.2f; + if (npc.Opacity >= 1f) { - npc.alpha = 0; + npc.Opacity = 1f; npc.ai[1] = 0f; npc.netUpdate = true; } } - if (phase6) + if (phase5) { - 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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - - float randomSpread = Main.rand.Next(-200, 200) / 100; - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/CryoGore3"), 1f); - - npc.TargetClosest(true); - npc.ai[0] = 5f; + 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; int chance = 100; if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) - { chance = 20; - } + if (Main.rand.NextBool(chance)) { string key = "Mods.CalamityMod.CryogenBossText"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + CalamityUtils.DisplayLocalizedText(key, messageColor); + } } } - else if (npc.ai[0] == 5f) + else if (npc.ai[0] == 4f) { - npc.damage = (int)(npc.defDamage * 1.5f); + npc.damage = npc.defDamage; - if (phase7) + if (phase6) { if (npc.ai[1] == 60f) - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * (CalamityWorld.bossRushActive ? 30f : (isChill ? 18f : 24f)); + { + 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)) + { + Main.PlaySound(SoundID.Item28, npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity = 9f + enrageScale; + for (int i = 0; i < 4; i++) + { + int totalProjectiles = malice ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float newVelocity = velocity - (velocity * 0.25f * i); + float velocityX = 0f; + if (i > 0) + { + double angleA = radians * 0.25 * (4 - i); + double angleB = MathHelper.ToRadians(90f) - angleA; + velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + } + Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + 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); + } + } + } + } + } + } npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) { npc.ai[3] += 1f; + npc.TargetClosest(); if (npc.ai[3] > 2f) { - npc.TargetClosest(true); npc.damage = 0; - npc.defense = npc.defDefense + 8; - npc.ai[0] = 6f; + npc.defense = 0; + npc.ai[0] = 5f; npc.ai[1] = 0f; npc.ai[3] = 0f; time = 0; @@ -766,11 +816,8 @@ namespace CalamityMod.NPCs.Cryogen return; } - float num1372 = isChill ? 16f : 24f; - if (CalamityWorld.bossRushActive) - { - num1372 = 32f; - } + float num1372 = 16f + enrageScale * 2f; + 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; @@ -780,42 +827,14 @@ namespace CalamityMod.NPCs.Cryogen num1374 *= num1376; iceShard--; - if (phase9) - { - if (num1375 < 170f || iceShard > 0) - { - if (num1375 < 170f) - { - iceShard = 17; - } - npc.rotation += npc.direction * 0.5f; - return; - } - } - else if (phase8) - { - if (num1375 < 190f || iceShard > 0) - { - if (num1375 < 190f) - { - iceShard = 19; - } - npc.rotation += npc.direction * 0.35f; - return; - } - } - else - { - if (num1375 < 200f || iceShard > 0) - { - if (num1375 < 200f) - { - iceShard = 20; - } - npc.rotation += npc.direction * 0.3f; - return; - } - } + if (num1375 < 200f || iceShard > 0) + { + if (num1375 < 200f) + iceShard = 20; + + 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; @@ -829,46 +848,49 @@ namespace CalamityMod.NPCs.Cryogen 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; } else { + npc.rotation = npc.velocity.X * 0.1f; + time++; - if (time >= 75) + if (time >= (malice ? 50 : 75)) { + time = 0; + Main.PlaySound(SoundID.Item28, npc.Center); int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = 25; - float velocity2 = CalamityWorld.bossRushActive ? 16f : 6f; - Vector2 spinningPoint = Main.rand.NextBool(2) ? new Vector2(0f, -velocity2) : Vector2.Normalize(new Vector2(-velocity2, -velocity2)) * velocity2; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float velocity2 = 6f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity2 * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity2) : new Vector2(velocityX, -velocity2); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer); } - time = 0; } npc.ai[1] += 1f; - if (npc.ai[1] >= 180f) + if (npc.ai[1] >= (malice ? 120f : 180f)) { - npc.TargetClosest(true); - npc.ai[0] = 5f; + npc.TargetClosest(); + npc.ai[0] = 4f; npc.ai[1] = 60f; time = 0; iceShard = 0; npc.netUpdate = true; } - float velocity = isChill ? 6f : 3f; - float acceleration = isChill ? 0.2f : 0.3f; - if (death) - velocity = isChill ? 5f : 2.5f; - if (CalamityWorld.bossRushActive) - { - velocity = 2f; - acceleration *= 1.5f; - } + float velocity = revenge ? 5f : 6f; + float acceleration = 0.2f; + velocity -= enrageScale; + acceleration += 0.07f * enrageScale; if (npc.position.Y > player.position.Y - 375f) { @@ -913,12 +935,11 @@ namespace CalamityMod.NPCs.Cryogen } } - if (!phase7) + if (!phase5) { if (npc.ai[3] == 0f && npc.life > 0) - { npc.ai[3] = npc.lifeMax; - } + if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) @@ -942,30 +963,23 @@ namespace CalamityMod.NPCs.Cryogen random = 2; break; case 4: - case 5: random = 3; break; default: break; } + int randomSpawn = Main.rand.Next(random); if (randomSpawn == 0) - { randomSpawn = ModContent.NPCType(); - } else if (randomSpawn == 1) - { randomSpawn = ModContent.NPCType(); - } else - { randomSpawn = ModContent.NPCType(); - } - int num664 = NPC.NewNPC(x, y, randomSpawn, 0, 0f, 0f, 0f, 0f, 255); + + int num664 = NPC.NewNPC(x, y, randomSpawn); if (Main.netMode == NetmodeID.Server && num664 < 200) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); - } + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664); } } } @@ -975,15 +989,33 @@ namespace CalamityMod.NPCs.Cryogen private void HandlePhaseTransition(int newPhase) { - int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1; + Main.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); - } - currentPhase = newPhase; - Main.PlaySound(SoundID.NPCDeath14, (int)npc.position.X, (int)npc.position.Y); - } + currentPhase = newPhase; + + switch (currentPhase) + { + case 0: + case 1: + break; + case 2: + npc.Calamity().DR = 0.27f; + break; + case 3: + npc.Calamity().DR = 0.21f; + break; + case 4: + npc.Calamity().DR = 0.12f; + break; + case 5: + case 6: + npc.Calamity().DR = 0f; + break; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) //for alt textures { @@ -991,8 +1023,17 @@ namespace CalamityMod.NPCs.Cryogen { string phase = "CalamityMod/NPCs/Cryogen/Cryogen_Phase" + currentPhase; Texture2D texture = ModContent.GetTexture(phase); - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor); - return false; + + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + return false; } return true; } @@ -1000,7 +1041,7 @@ 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 * 0.9f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -1047,19 +1088,20 @@ namespace CalamityMod.NPCs.Cryogen { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendar drop for Cryogen + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedCryogen); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedCryogen, 4, 2, 1); if (!Main.expertMode) { // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), 15, 25); DropHelper.DropItemSpray(npc, ModContent.ItemType(), 4, 8); - DropHelper.DropItem(npc, ItemID.FrostCore); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -1069,9 +1111,9 @@ namespace CalamityMod.NPCs.Cryogen DropHelper.WeightStack(w) ); - // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); + // Equipment + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); @@ -1092,17 +1134,14 @@ namespace CalamityMod.NPCs.Cryogen { string key = "Mods.CalamityMod.IceOreText"; Color messageColor = Color.LightSkyBlue; - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 15E-05, .45f, .65f); + CalamityUtils.SpawnOre(ModContent.TileType(), 15E-05, 0.45f, 0.65f, 3, 8, TileID.SnowBlock, TileID.IceBlock, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, ModContent.TileType(), ModContent.TileType()); - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); } // Mark Cryogen as dead CalamityWorld.downedCryogen = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 94f11df12b..3c9a5781ce 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -1,6 +1,7 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; -using CalamityMod.World; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,18 +17,19 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { - npc.aiStyle = -1; + npc.Calamity().canBreakPlayerDefense = true; + npc.aiStyle = -1; aiType = -1; npc.canGhostHeal = false; npc.noTileCollide = true; - npc.damage = 50; - npc.width = 190; + npc.GetNPCDamage(); + npc.width = 190; npc.height = 190; npc.DR_NERD(0.4f); npc.lifeMax = 1400; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.alpha = 255; npc.HitSound = SoundID.NPCHit5; @@ -76,7 +78,9 @@ namespace CalamityMod.NPCs.Cryogen npc.lifeMax = (int)(npc.lifeMax * 0.5f * bossLifeScale); } - public override void HitEffect(int hitDirection, double damage) + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { @@ -107,14 +111,18 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - int damage2 = Main.expertMode ? 20 : 23; - float velocity = CalamityWorld.bossRushActive ? 12f : 8f; - Vector2 spinningPoint = Main.rand.NextBool(2) ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)) * velocity; + double radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + int damage2 = npc.GetProjectileDamage(type); + float velocity = 9f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage2, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.Center, vector255, type, damage2, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 300; } } @@ -124,10 +132,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); - } - } } } diff --git a/NPCs/Cryogen/IceMass.cs b/NPCs/Cryogen/IceMass.cs index e403f21701..c601254076 100644 --- a/NPCs/Cryogen/IceMass.cs +++ b/NPCs/Cryogen/IceMass.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using System; using Terraria; @@ -17,21 +18,20 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { npc.aiStyle = 86; - npc.damage = 40; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 24; npc.defense = 8; npc.alpha = 100; npc.lifeMax = 220; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 30000; + npc.lifeMax = 3000; } npc.knockBackResist = 0f; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath15; - npc.coldDamage = true; } public override void FindFrame(int frameHeight) @@ -73,11 +73,6 @@ namespace CalamityMod.NPCs.Cryogen 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 bool PreNPCLoot() - { - return false; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 8cedfd6327..80c47e79f7 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -1,8 +1,8 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,29 +18,20 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 16; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 32; npc.height = 36; npc.defense = 6; npc.DR_NERD(0.05f); - npc.LifeMaxNERB(2300, 2650, 16500000); + npc.LifeMaxNERB(2600, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -49,21 +40,14 @@ namespace CalamityMod.NPCs.DesertScourge npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -72,60 +56,118 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { + Player player = Main.player[npc.target]; + bool enraged = npc.Calamity().enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + float burrowTimeGateValue = death ? 420f : 540f; + 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.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++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; } - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - if (Main.netMode != NetmodeID.MultiplayerClient && revenge) - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.localAI[0] += 4f; - } - if (npc.localAI[0] >= (float)Main.rand.Next(1400, 26000)) - { - 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)); - 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)); - int projectileType = ModContent.ProjectileType(); - int damage = 12; - float num941 = CalamityWorld.bossRushActive ? 12f : 6f; - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.NextBool(2) || CalamityWorld.bossRushActive) - { - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - } - npc.netUpdate = true; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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] = 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)); + 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)); + int projectileType = ModContent.ProjectileType(); + float num941 = enraged ? 12f : malice ? 9f : 6f; + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + if (Main.rand.NextBool(2) || enraged || malice) + { + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, npc.GetProjectileDamage(projectileType), 0f, Main.myPlayer, 0f, 0f); + } + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } } public override bool CheckActive() @@ -147,16 +189,13 @@ namespace CalamityMod.NPCs.DesertScourge Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); int seeker = NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server && seeker < 200) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, seeker, 0f, 0f, 0f, 0, 0, 0); - } - npc.netUpdate = true; } } + for (int k = 0; k < 3; k++) - { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); - } + if (npc.life <= 0) { float randomSpread = (float)(Main.rand.Next(-100, 100) / 100); @@ -164,16 +203,13 @@ namespace CalamityMod.NPCs.DesertScourge Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody2"), 1f); Gore.NewGore(npc.position, npc.velocity * randomSpread * Main.rand.NextFloat(), mod.GetGoreSlot("Gores/ScourgeBody3"), 1f); for (int k = 0; k < 10; k++) - { 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 * 0.85f); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertScourgeBodySmall.cs b/NPCs/DesertScourge/DesertScourgeBodySmall.cs index 7bef5630c7..268ac0fb2e 100644 --- a/NPCs/DesertScourge/DesertScourgeBodySmall.cs +++ b/NPCs/DesertScourge/DesertScourgeBodySmall.cs @@ -1,8 +1,9 @@ -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeBodySmall : ModNPC @@ -14,17 +15,12 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 10; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 40; npc.height = 40; npc.defense = 4; - npc.lifeMax = 800; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 350000; - } - npc.aiStyle = 6; + npc.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; @@ -45,21 +41,83 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override bool CheckActive() { diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 50531ef74c..d476040836 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Accessories; +using CalamityMod.Events; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; @@ -17,15 +18,15 @@ using System.IO; using System.Reflection; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.NPCs.DesertScourge { [AutoloadBossHead] public class DesertScourgeHead : ModNPC { - private bool flies = false; private bool TailSpawned = false; + public bool playRoarSound = false; public override void SetStaticDefaults() { @@ -34,23 +35,21 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 30; - npc.npcSlots = 12f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.defense = 4; + npc.npcSlots = 12f; npc.width = 32; npc.height = 80; - npc.LifeMaxNERB(2300, 2650, 16500000); + npc.LifeMaxNERB(2600, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.boss = true; npc.value = Item.buyPrice(0, 2, 0, 0); npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -58,81 +57,113 @@ namespace CalamityMod.NPCs.DesertScourge npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; bossBag = ModContent.ItemType(); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - else - music = MusicID.Boss1; - if (Main.expertMode) - { - npc.scale = 1.15f; - } + music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.dontTakeDamage); - } + writer.Write(playRoarSound); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { - npc.dontTakeDamage = reader.ReadBoolean(); - } + playRoarSound = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + // Get a target + 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(); + + Player player = Main.player[npc.target]; + + float enrageScale = 0f; + if (!player.ZoneDesert || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float speed = 8f; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) + 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; + + float speed = 0.12f; float turnSpeed = 0.08f; if (expertMode) { - speed += death ? 6f : 6f * (1f - lifeRatio); - turnSpeed += death ? 0.06f : 0.06f * (1f - lifeRatio); + float velocityScale = death ? 0.15f : 0.075f; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = death ? 0.09f : 0.06f; + turnSpeed += accelerationScale * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + speed += 0.08f * enrageScale; + turnSpeed += 0.04f * enrageScale; + + if (lungeUpward) { speed *= 1.25f; - turnSpeed *= 1.25f; + turnSpeed *= 1.5f; } - if (CalamityWorld.bossRushActive) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - - 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]; - - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - - npc.velocity.Length(); npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned && npc.ai[0] == 0f) { int Previous = npc.whoAmI; - int minLength = expertMode ? 30 : 25; + int minLength = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; for (int num36 = 0; num36 < minLength + 1; num36++) { int lol; @@ -144,8 +175,8 @@ namespace CalamityMod.NPCs.DesertScourge { 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].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); @@ -154,297 +185,354 @@ namespace CalamityMod.NPCs.DesertScourge TailSpawned = true; } } - 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; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000; - if (CalamityWorld.bossRushActive) - num954 /= 2; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead) - { - npc.TargetClosest(false); - flag94 = false; - npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y += 1f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y += turnSpeed * 0.75f; - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X -= num189 * 1.1f; - } - else - { - npc.velocity.X += num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - 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) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X += num189 * 0.9f; - } - else - { - npc.velocity.X -= num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - 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; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X -= num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y += num189; - } - else - { - if (npc.velocity.Y > num192) - { - 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 (npc.velocity.Y > 0f) - { - npc.velocity.Y += num189 * 2f; - } - else - { - 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 (npc.velocity.X > 0f) - { - npc.velocity.X += num189 * 2f; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y += num189; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X += num189; - } - else - { - npc.velocity.X -= num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - 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; - } - } - } + 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; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = lungeUpward; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + 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)) + { + 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) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + 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) + { + int rectWidth = num954 * 2; + int rectHeight = num954 * 2; + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + int rectX = (int)Main.player[m].position.X - num954; + int rectY = (int)Main.player[m].position.Y - num954; + Rectangle rectangle13 = new Rectangle(rectX, rectY, rectWidth, rectHeight); + if (rectangle.Intersects(rectangle13)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + + float num17 = 16f; + if (player.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; + num17 = 32f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType()) + { + Main.npc[a].active = false; + } + } + } + } + + float num18 = speed; + float num19 = turnSpeed; + float burrowDistance = malice ? 500f : 800f; + float burrowTarget = player.Center.Y + burrowDistance; + float lungeTarget = player.Center.Y - 600f; + Vector2 vector3 = npc.Center; + float num20 = player.Center.X; + float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + 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 (!playRoarSound) + { + Main.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) + { + 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 += 1f; + if (npc.Center.Y >= player.Center.Y) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + playRoarSound = false; + } + } + + // Reset variables if the burrow and lunge attack is taking too long + if (resetTime) + { + 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.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.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); + float num26 = Math.Abs(num21); + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + 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; + } + } #region Loot public override void BossLoot(ref string name, ref int potionType) @@ -466,10 +554,12 @@ namespace CalamityMod.NPCs.DesertScourge { DropHelper.DropBags(npc); - DropHelper.DropItem(npc, ItemID.LesserHealingPotion, 8, 14); + // Legendary drop for Desert Scourge + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItem(npc, ItemID.LesserHealingPotion, 8, 14); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedDesertScourge); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedDesertScourge, 2, 0, 0); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedDesertScourge); @@ -484,7 +574,7 @@ namespace CalamityMod.NPCs.DesertScourge // Weapons // Set up the base drop set, which includes Scourge of the Desert at its normal drop chance. - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.WeightedItemStack[] weapons = { DropHelper.WeightStack(w), @@ -493,18 +583,11 @@ namespace CalamityMod.NPCs.DesertScourge DropHelper.WeightStack(w), DropHelper.WeightStack(w), }; - - // If the RIV roll for Dune Hopper succeeds, REPLACE Scourge of the Desert with a guaranteed Dune Hopper. - float duneHopperChance = DropHelper.RareVariantDropRateFloat; - if (Main.rand.NextFloat() < duneHopperChance) - weapons[4] = DropHelper.WeightStack(); - DropHelper.DropEntireWeightedSet(npc, weapons); // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), DropHelper.RareVariantDropRateInt); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); @@ -520,16 +603,9 @@ namespace CalamityMod.NPCs.DesertScourge Color messageColor = Color.Aquamarine; string key2 = "Mods.CalamityMod.SandstormTrigger"; Color messageColor2 = Color.PaleGoldenrod; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } + + CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(key2, messageColor2); if (!Terraria.GameContent.Events.Sandstorm.Happening) typeof(Terraria.GameContent.Events.Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); @@ -537,7 +613,7 @@ namespace CalamityMod.NPCs.DesertScourge // Mark Desert Scourge as dead CalamityWorld.downedDesertScourge = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } #endregion @@ -561,7 +637,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 1.1f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index 25528fcf66..39e742a6b4 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -1,5 +1,6 @@ -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,9 +10,8 @@ namespace CalamityMod.NPCs.DesertScourge public class DesertScourgeHeadSmall : ModNPC { public bool flies = false; - public float speed = CalamityWorld.bossRushActive ? 20f : 12.5f; - public float turnSpeed = CalamityWorld.bossRushActive ? 0.2f : 0.125f; - public int minLength = 12; + public float speed = 0.085f; + public float turnSpeed = 0.125f; public int maxLength = 13; bool TailSpawned = false; @@ -22,17 +22,13 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 18; - npc.npcSlots = 2f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.defense = 2; npc.width = 60; npc.height = 60; - npc.defense = 0; - npc.lifeMax = 800; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 350000; - } - npc.aiStyle = 6; + npc.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; @@ -46,341 +42,345 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + 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); + + 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; + int num3 = maxLength; + for (int j = 0; j <= num3; j++) + { + int num4 = ModContent.NPCType(); + if (j == num3) + { + 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; + 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); + num2 = num5; + } + 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; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + 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)) + { + 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) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + 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) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + 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; + num17 = 32f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType()) + { + Main.npc[a].active = false; + } + } + } + } + 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); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + 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.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } } - Player player = Main.player[npc.target]; - npc.velocity.Length(); - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (!TailSpawned) - { - 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); - } - else - { - 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].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = CalamityWorld.death ? 300 : 1000; - if (CalamityWorld.bossRushActive) - num954 = 150; + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.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); + float num26 = Math.Abs(num21); + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + 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; + } + } - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead) - { - flag94 = 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.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.75f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - 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 = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - 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 (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - 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 (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - 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; - } - } - } + public override bool PreNPCLoot() + { + return false; + } - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index f338fd7bbc..7943e96365 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -1,6 +1,6 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,29 +16,20 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 12; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 32; npc.height = 48; npc.defense = 9; npc.DR_NERD(0.1f); - npc.LifeMaxNERB(2300, 2650, 16500000); + npc.LifeMaxNERB(2600, 3000, 1650000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("DesertScourge") ?? MusicID.Boss1; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,21 +38,14 @@ namespace CalamityMod.NPCs.DesertScourge npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(npc.dontTakeDamage); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - npc.dontTakeDamage = reader.ReadBoolean(); - } + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -70,28 +54,83 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; } - Player player = Main.player[npc.target]; - npc.dontTakeDamage = !player.ZoneDesert && !CalamityWorld.bossRushActive; - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override void HitEffect(int hitDirection, double damage) { @@ -122,7 +161,6 @@ namespace CalamityMod.NPCs.DesertScourge public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/DesertScourge/DesertScourgeTailSmall.cs b/NPCs/DesertScourge/DesertScourgeTailSmall.cs index 2a6e06b42f..608dda346d 100644 --- a/NPCs/DesertScourge/DesertScourgeTailSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeTailSmall.cs @@ -1,8 +1,9 @@ -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.DesertScourge { public class DesertScourgeTailSmall : ModNPC @@ -14,17 +15,12 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 8; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 32; npc.height = 32; npc.defense = 7; - npc.lifeMax = 800; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 350000; - } - npc.aiStyle = 6; + npc.lifeMax = BossRushEvent.BossRushActive ? 35000 : 800; + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; @@ -45,21 +41,83 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/DesertScourge/DriedSeekerBody.cs b/NPCs/DesertScourge/DriedSeekerBody.cs index 620dcce6b3..105f0f5518 100644 --- a/NPCs/DesertScourge/DriedSeekerBody.cs +++ b/NPCs/DesertScourge/DriedSeekerBody.cs @@ -1,4 +1,4 @@ -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,20 +15,16 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 8; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 18; npc.height = 18; npc.defense = 2; - npc.lifeMax = 100; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.knockBackResist = 0f; - npc.aiStyle = 6; + npc.lifeMax = BossRushEvent.BossRushActive ? 5000 : 100; + npc.knockBackResist = 0f; + npc.aiStyle = -1; aiType = -1; - npc.behindTiles = true; + npc.alpha = 255; + npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -45,20 +41,95 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override bool CheckActive() { return false; } - public override void HitEffect(int hitDirection, double damage) + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { diff --git a/NPCs/DesertScourge/DriedSeekerHead.cs b/NPCs/DesertScourge/DriedSeekerHead.cs index 0ec7821427..630dfab490 100644 --- a/NPCs/DesertScourge/DriedSeekerHead.cs +++ b/NPCs/DesertScourge/DriedSeekerHead.cs @@ -1,4 +1,6 @@ -using CalamityMod.World; +using CalamityMod.Events; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,27 +9,26 @@ namespace CalamityMod.NPCs.DesertScourge { public class DriedSeekerHead : ModNPC { - bool TailSpawned = false; + public const int maxLength = 4; + public float speed = 0.065f; + public float turnSpeed = 0.1f; + bool TailSpawned = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dried Seeker"); } public override void SetDefaults() { - npc.damage = 14; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 18; npc.height = 18; - npc.lifeMax = 100; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } - npc.aiStyle = 6; + npc.lifeMax = BossRushEvent.BossRushActive ? 5000 : 100; + npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = 0f; + npc.alpha = 255; + npc.knockBackResist = 0f; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -39,50 +40,345 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (!TailSpawned) - { - int Previous = npc.whoAmI; - for (int num36 = 0; num36 < 4; num36++) - { - int lol; - if (num36 >= 0 && num36 < 3) - { - 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); - } - 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); - Previous = lol; - } - TailSpawned = true; - } - if (Main.player[npc.target].dead) - { - 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.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].active = false; - } - } - } - } - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - public override void HitEffect(int hitDirection, double damage) + 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; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned) + { + npc.ai[2] = (float)npc.whoAmI; + npc.realLife = npc.whoAmI; + int num2 = npc.whoAmI; + int num3 = maxLength; + for (int j = 0; j <= num3; j++) + { + int num4 = ModContent.NPCType(); + if (j == num3) + { + 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; + 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); + num2 = num5; + } + 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; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + 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)) + { + 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) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + 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) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + 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; + num17 = 32f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType()) + { + Main.npc[a].active = false; + } + } + } + } + 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); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + 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.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.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); + float num26 = Math.Abs(num21); + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + 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; + } + } + + public override bool PreNPCLoot() + { + return false; + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { @@ -96,10 +392,5 @@ namespace CalamityMod.NPCs.DesertScourge } } } - - public override bool PreNPCLoot() - { - return false; - } } } diff --git a/NPCs/DesertScourge/DriedSeekerTail.cs b/NPCs/DesertScourge/DriedSeekerTail.cs index 95d0b199ce..4a85dfa52c 100644 --- a/NPCs/DesertScourge/DriedSeekerTail.cs +++ b/NPCs/DesertScourge/DriedSeekerTail.cs @@ -1,4 +1,4 @@ -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,18 +15,14 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - npc.damage = 6; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 18; npc.height = 18; npc.defense = 4; - npc.lifeMax = 100; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 50000; - } + npc.lifeMax = BossRushEvent.BossRushActive ? 5000 : 100; + npc.alpha = 255; npc.knockBackResist = 0f; - npc.aiStyle = 6; + npc.aiStyle = -1; aiType = -1; npc.behindTiles = true; npc.noGravity = true; @@ -45,13 +41,83 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - } + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override void HitEffect(int hitDirection, double damage) { @@ -68,7 +134,12 @@ namespace CalamityMod.NPCs.DesertScourge } } - public override bool CheckActive() + public override bool PreNPCLoot() + { + return false; + } + + public override bool CheckActive() { return false; } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 415f5d2b7e..9e1ee2cefa 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -23,17 +23,18 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 180; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 56; npc.height = 56; npc.defense = 70; CalamityGlobalNPC global = npc.Calamity(); - global.DR = CalamityWorld.death ? 0.95f : 0.925f; + global.DR = 0.925f; global.unbreakableDR = true; - npc.LifeMaxNERB(675000, 750000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.LifeMaxNERB(371250, 445500); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -47,15 +48,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; npc.dontCountMe = true; } @@ -78,8 +71,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - bool expertMode = Main.expertMode; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0f, 0.2f, 0.25f); if (invinceTime > 0) @@ -90,8 +81,8 @@ namespace CalamityMod.NPCs.DevourerofGods else npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -99,28 +90,32 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -137,33 +132,6 @@ namespace CalamityMod.NPCs.DevourerofGods npc.alpha = 0; } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += expertMode ? 1.5f : 1f; - int projectileType = ModContent.ProjectileType(); - int damage = expertMode ? 58 : 70; - float num941 = 5f; - if (npc.localAI[0] >= Main.rand.Next(1050, 12000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - 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; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - int proj = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].ai[0] = Main.player[npc.target].Center.X; - Main.projectile[proj].ai[1] = Main.player[npc.target].Center.Y; - Main.projectile[proj].netUpdate = true; - npc.netUpdate = true; - } - } - if (player.dead) npc.TargetClosest(false); @@ -216,7 +184,7 @@ namespace CalamityMod.NPCs.DevourerofGods Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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/DevourerofGodsBodyGlow"); @@ -229,7 +197,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 0; + cooldownSlot = 1; return true; } @@ -286,14 +254,13 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index 412d3e4725..80fec51e4f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -19,15 +19,14 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 130; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 34; npc.height = 34; npc.defense = 60; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.5f; global.unbreakableDR = true; - npc.lifeMax = 100000; + npc.lifeMax = 50000; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -39,10 +38,6 @@ namespace CalamityMod.NPCs.DevourerofGods npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; } @@ -79,25 +74,32 @@ namespace CalamityMod.NPCs.DevourerofGods npc.dontTakeDamage = false; } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) { - flag = true; + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } } - else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + if (!shouldDespawn) { - flag = true; + if (npc.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + shouldDespawn = true; } - if (flag) + if (shouldDespawn) { npc.life = 0; npc.HitEffect(0, 10.0); npc.checkDead(); + npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) @@ -108,11 +110,10 @@ namespace CalamityMod.NPCs.DevourerofGods Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } + 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); @@ -159,7 +160,7 @@ namespace CalamityMod.NPCs.DevourerofGods 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, 4f + npc.gfxOffY); + 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"); @@ -225,7 +226,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 120, true); - player.AddBuff(BuffID.Frostburn, 120, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index a79f6498cc..d9d295e2c0 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -23,16 +23,17 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 220; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 70; npc.height = 70; npc.defense = 70; CalamityGlobalNPC global = npc.Calamity(); - global.DR = CalamityWorld.death ? 0.97f : 0.955f; + global.DR = 0.925f; global.unbreakableDR = true; - npc.LifeMaxNERB(1150000, 1350000, 9200000); - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.LifeMaxNERB(517500, 621000, 920000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; @@ -47,15 +48,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; + music = CalamityMod.Instance.GetMusicFromMusicMod("UniversalCollapse") ?? MusicID.LunarBoss; npc.dontCountMe = true; } @@ -64,6 +57,7 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(invinceTime); writer.Write(setAlpha); writer.Write(npc.dontTakeDamage); + writer.Write(npc.alpha); } public override void ReceiveExtraAI(BinaryReader reader) @@ -71,6 +65,7 @@ namespace CalamityMod.NPCs.DevourerofGods invinceTime = reader.ReadInt32(); setAlpha = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + npc.alpha = reader.ReadInt32(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -86,23 +81,20 @@ namespace CalamityMod.NPCs.DevourerofGods 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.2f, 0.05f, 0.2f); + if (invinceTime > 0) { invinceTime--; npc.dontTakeDamage = true; } else - { npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; - } + if (Main.npc[(int)npc.ai[2]].dontTakeDamage) - { invinceTime = 240; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -110,35 +102,32 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) { npc.alpha -= 42; if (npc.alpha <= 0 && invinceTime <= 0) @@ -148,13 +137,11 @@ namespace CalamityMod.NPCs.DevourerofGods } } else - { npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } + if (player.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 = player.position.X + (float)(player.width / 2); float num192 = player.position.Y + (float)(player.height / 2); @@ -175,7 +162,7 @@ namespace CalamityMod.NPCs.DevourerofGods } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); int num194 = npc.width; num193 = (num193 - (float)num194) / num193; @@ -184,14 +171,11 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -206,7 +190,7 @@ namespace CalamityMod.NPCs.DevourerofGods 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, 4f + npc.gfxOffY); + 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) @@ -227,7 +211,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 0; + cooldownSlot = 1; return npc.alpha == 0 && invinceTime <= 0; } @@ -282,14 +266,13 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 8ddb2ed5a5..e8f5e17eef 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -1,25 +1,39 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Items.Potions; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ModLoader.Config; -using CalamityMod; namespace CalamityMod.NPCs.DevourerofGods { [AutoloadBossHead] public class DevourerofGodsHead : ModNPC { - private bool tail = false; + private enum LaserWallType + { + DiagonalRight = 0, + DiagonalLeft = 1, + DiagonalHorizontal = 2, + DiagonalCross = 3 + } + + private const int shotSpacingMax = 750; + private int shotSpacing = shotSpacingMax; + private const int spacingVar = 250; + private const int totalShots = 6; + private int laserWallType = 0; + private const float laserWallSpacingOffset = 16f; + + private bool tail = false; private const int minLength = 80; private const int maxLength = 81; private bool halfLife = false; @@ -33,35 +47,28 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 250; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 104; npc.height = 104; npc.defense = 50; - npc.LifeMaxNERB(675000, 750000); + npc.LifeMaxNERB(371250, 445500); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.takenDamageMultiplier = 1.25f; + npc.takenDamageMultiplier = 1.1f; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.boss = true; - npc.value = Item.buyPrice(0, 75, 0, 0); + npc.value = Item.buyPrice(0, 40, 0, 0); npc.alpha = 255; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; } public override void SendExtraAI(BinaryWriter writer) @@ -69,6 +76,10 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(halfLife); writer.Write(halfLife2); writer.Write(spawnDoGCountdown); + writer.Write(shotSpacing); + writer.Write(laserWallType); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -76,6 +87,10 @@ namespace CalamityMod.NPCs.DevourerofGods halfLife = reader.ReadBoolean(); halfLife2 = reader.ReadBoolean(); spawnDoGCountdown = reader.ReadInt32(); + shotSpacing = reader.ReadInt32(); + laserWallType = reader.ReadInt32(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() @@ -90,29 +105,56 @@ namespace CalamityMod.NPCs.DevourerofGods // Variables Vector2 vector = npc.Center; - bool flies = npc.ai[2] == 0f; - bool expertMode = Main.expertMode; - bool revenge = CalamityWorld.revenge; - bool death = CalamityWorld.death; + bool flies = npc.ai[3] == 0f; + bool malice = CalamityWorld.malice; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.2f; + + npc.Calamity().CurrentlyEnraged = malice; + // 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); // Worm variable - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + 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(); Player player = Main.player[npc.target]; + float distanceFromTarget = Vector2.Distance(player.Center, vector); + bool increaseSpeed = distanceFromTarget > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = distanceFromTarget > CalamityGlobalNPC.CatchUpDistance350Tiles; + + float takeLessDamageDistance = 1600f; + if (distanceFromTarget > takeLessDamageDistance) + { + float damageTakenScalar = MathHelper.Clamp(1f - ((distanceFromTarget - takeLessDamageDistance) / takeLessDamageDistance), 0f, 1f); + npc.takenDamageMultiplier = MathHelper.Lerp(1f, 1.1f, damageTakenScalar); + } + else + npc.takenDamageMultiplier = 1.1f; + // Spawn Guardians - if (lifeRatio < 0.2f) + if (phase3) { if (!halfLife) { @@ -121,11 +163,9 @@ namespace CalamityMod.NPCs.DevourerofGods string key = "Mods.CalamityMod.EdgyBossText"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); + npc.TargetClosest(); halfLife = true; } if (spawnDoGCountdown > 0) @@ -140,7 +180,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } } - else if (lifeRatio < 0.6f) + else if (phase2) { if (!halfLife2) { @@ -152,11 +192,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (spawnDoGCountdown > 0) { spawnDoGCountdown--; - - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); - if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + } } } @@ -199,7 +240,130 @@ namespace CalamityMod.NPCs.DevourerofGods } tail = true; } - } + + if (phase2) + { + float speed = 12f; + float spawnOffset = 1500f; + float divisor = malice ? 240f : death ? 360f : 480f; + + if (calamityGlobalNPC.newAI[1] % divisor == 0f) + { + Main.PlaySound(SoundID.Item12, player.position); + + // Side walls + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 start = default; + Vector2 velocity = default; + Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; + Vector2 aimClone = aim; + + switch (laserWallType) + { + case (int)LaserWallType.DiagonalRight: + + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing -= spacingVar; + } + + if (expertMode) + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + + laserWallType = (int)LaserWallType.DiagonalLeft; + break; + + case (int)LaserWallType.DiagonalLeft: + + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing -= spacingVar; + } + + if (expertMode) + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + + laserWallType = expertMode ? (int)LaserWallType.DiagonalHorizontal : (int)LaserWallType.DiagonalRight; + break; + + case (int)LaserWallType.DiagonalHorizontal: + + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing -= spacingVar; + } + + if (expertMode) + { + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + } + + laserWallType = revenge ? (int)LaserWallType.DiagonalCross : (int)LaserWallType.DiagonalRight; + break; + + case (int)LaserWallType.DiagonalCross: + + for (int x = 0; x < totalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, player.position.Y + shotSpacing); + aim.Y += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X - spawnOffset, player.position.Y + shotSpacing); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X + shotSpacing, player.position.Y + spawnOffset); + aimClone.X += laserWallSpacingOffset * (x - 3); + velocity = Vector2.Normalize(aimClone - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X + shotSpacing, player.position.Y - spawnOffset); + velocity = Vector2.Normalize(aimClone - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing -= spacingVar; + } + + if (expertMode) + { + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + } + + laserWallType = (int)LaserWallType.DiagonalRight; + break; + } + shotSpacing = shotSpacingMax; + } + + calamityGlobalNPC.newAI[1] += 1f; + } + else + calamityGlobalNPC.newAI[1] = 0f; + } // Despawn if (player.dead) @@ -211,12 +375,17 @@ namespace CalamityMod.NPCs.DevourerofGods 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) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; + if (Main.npc[a].type != npc.type && Main.npc[a].type != bodyType && Main.npc[a].type != tailType) + continue; + + Main.npc[a].active = false; + Main.npc[a].netUpdate = true; } } } @@ -242,28 +411,27 @@ namespace CalamityMod.NPCs.DevourerofGods npc.spriteDirection = 1; // Flight - if (npc.ai[2] == 0f) + if (npc.ai[3] == 0f) { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } // Flying movement npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[2] += 1f; + float phaseChangeRate = 1f + (expertMode ? 9f * (1f - lifeRatio) : 0f); + calamityGlobalNPC.newAI[2] += phaseChangeRate; - float speed = death ? 16.5f : 15f; - float turnSpeed = death ? 0.33f : 0.3f; - float homingSpeed = death ? 22.5f : 18f; - float homingTurnSpeed = death ? 0.405f : 0.33f; + float speed = malice ? 18f : death ? 16.5f : 15f; + float turnSpeed = malice ? 0.36f : death ? 0.33f : 0.3f; + float homingSpeed = malice ? 27f : death ? 22.5f : 18f; + float homingTurnSpeed = malice ? 0.48f : death ? 0.405f : 0.33f; if (expertMode) { - calamityGlobalNPC.newAI[2] += 9f * (1f - lifeRatio); - speed += 3f * (1f - lifeRatio); turnSpeed += 0.06f * (1f - lifeRatio); homingSpeed += 9f * (1f - lifeRatio); @@ -271,10 +439,12 @@ namespace CalamityMod.NPCs.DevourerofGods } // Go to ground phase sooner - if (Vector2.Distance(player.Center, vector) > 5600f) + if (increaseSpeedMore) calamityGlobalNPC.newAI[2] += 10f; + else if (increaseSpeed) + calamityGlobalNPC.newAI[2] += 2f; - float num188 = speed; + float num188 = speed; float num189 = turnSpeed; 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); @@ -319,10 +489,10 @@ namespace CalamityMod.NPCs.DevourerofGods num189 = homingTurnSpeed; } - if (revenge) + if (expertMode) { - num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f * (1f - lifeRatio); - num189 += Vector2.Distance(player.Center, npc.Center) * 0.0001f * (1f - lifeRatio); + num188 += distanceFromTarget * 0.005f * (1f - lifeRatio); + num189 += distanceFromTarget * 0.0001f * (1f - lifeRatio); } float num48 = num188 * 1.3f; @@ -427,8 +597,9 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > 900f) { - npc.ai[2] = 1f; + npc.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -438,40 +609,36 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } calamityGlobalNPC.newAI[2] += 1f; - float fallSpeed = death ? 17.75f : 16f; - float speed = death ? 0.22f : 0.18f; - float turnSpeed = death ? 0.18f : 0.12f; + float fallSpeed = malice ? 19.5f : death ? 17.75f : 16f; + float speed = malice ? 0.26f : death ? 0.22f : 0.18f; + float turnSpeed = malice ? 0.24f : death ? 0.18f : 0.12f; if (expertMode) { fallSpeed += 3.5f * (1f - lifeRatio); speed += 0.08f * (1f - lifeRatio); turnSpeed += 0.12f * (1f - lifeRatio); + speed += distanceFromTarget * 0.00005f * (1f - lifeRatio); + turnSpeed += distanceFromTarget * 0.00005f * (1f - lifeRatio); } - if (revenge) - { - speed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio); - turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio); - } - - bool increaseSpeed = Vector2.Distance(player.Center, vector) > 3200f; - // Enrage - if (Vector2.Distance(player.Center, vector) > 5600f) + if (increaseSpeedMore) { + fallSpeed *= 3f; speed *= 4f; turnSpeed *= 6f; } else if (increaseSpeed) { - speed *= 2f; + fallSpeed *= 1.5f; + speed *= 2f; turnSpeed *= 3f; } @@ -500,15 +667,21 @@ namespace CalamityMod.NPCs.DevourerofGods { npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 1000 - (int)(500f * (1f - lifeRatio)); - bool flag95 = true; + + int num954 = death ? 1100 : 1175; + if (expertMode) + num954 -= (int)(150f * (1f - lifeRatio)); + if (num954 < 1025) + num954 = 1025; + + bool flag95 = true; if (npc.position.Y > player.position.Y) { for (int num955 = 0; num955 < 255; num955++) { if (Main.player[num955].active) { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); + Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - 1000, (int)Main.player[num955].position.Y - 1000, 2000, num954); if (rectangle12.Intersects(rectangle13)) { flag95 = false; @@ -536,8 +709,6 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - npc.TargetClosest(true); - npc.velocity.Y += turnSpeed; if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; @@ -567,13 +738,18 @@ namespace CalamityMod.NPCs.DevourerofGods else { - double maximumSpeed1 = death ? 0.44 : 0.4; - double maximumSpeed2 = death ? 1.08 : 1D; + double maximumSpeed1 = malice ? 0.48 : death ? 0.44 : 0.4; + double maximumSpeed2 = malice ? 1.16 : death ? 1.08 : 1D; + if (increaseSpeedMore) + { + maximumSpeed1 *= 4; + maximumSpeed2 *= 4; + } if (increaseSpeed) { - maximumSpeed1 += 0.8; - maximumSpeed2 += 2D; + maximumSpeed1 *= 2; + maximumSpeed2 *= 2; } if (expertMode) @@ -682,8 +858,9 @@ namespace CalamityMod.NPCs.DevourerofGods if (calamityGlobalNPC.newAI[2] > 900f) { - npc.ai[2] = 0f; + npc.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -696,11 +873,11 @@ namespace CalamityMod.NPCs.DevourerofGods 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 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, 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, 4f + npc.gfxOffY); + 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/DevourerofGods/DevourerofGodsHeadGlow"); @@ -718,7 +895,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.None; + potionType = ModContent.ItemType(); } // DoG phase 1 does not drop loot, but starts the sentinel phase of the fight. @@ -748,10 +925,7 @@ namespace CalamityMod.NPCs.DevourerofGods { string key = "Mods.CalamityMod.EdgyBossText2"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); return false; } return true; @@ -778,12 +952,12 @@ namespace CalamityMod.NPCs.DevourerofGods if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGHead"), 1f); - 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 + (npc.width / 2); + npc.position.Y = npc.position.Y + (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 - (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.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -791,7 +965,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 30; num623++) @@ -814,11 +988,10 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 300, true); player.AddBuff(ModContent.BuffType(), 420, true); - player.AddBuff(BuffID.Frostburn, 300, true); - if (CalamityWorld.death) + /*if (CalamityWorld.death && !player.Calamity().lol) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); - } + }*/ if (player.Calamity().dogTextCooldown <= 0) { @@ -831,7 +1004,7 @@ namespace CalamityMod.NPCs.DevourerofGods "Mods.CalamityMod.EdgyBossText7" }); Color messageColor = Color.Cyan; - Rectangle location = new Microsoft.Xna.Framework.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 441976927f..ee155a3d42 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -24,12 +24,12 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 180; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); npc.width = 64; npc.height = 76; npc.defense = 40; - npc.lifeMax = 100000; + npc.lifeMax = 50000; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -41,10 +41,6 @@ namespace CalamityMod.NPCs.DevourerofGods npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } } public override void SendExtraAI(BinaryWriter writer) @@ -81,12 +77,13 @@ namespace CalamityMod.NPCs.DevourerofGods Vector2 vector = npc.Center; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + bool increaseSpeed = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + 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.alpha != 0) { @@ -97,9 +94,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.alpha -= 12; if (npc.alpha < 0) - { npc.alpha = 0; - } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -155,13 +150,18 @@ 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); - float num188 = CalamityWorld.revenge ? 16f : 14f; - float num189 = CalamityWorld.revenge ? 0.15f : 0.13f; + float num188 = CalamityWorld.malice ? 18f : CalamityWorld.revenge ? 16f : 14f; + float num189 = CalamityWorld.malice ? 0.17f : CalamityWorld.revenge ? 0.15f : 0.13f; - if (Vector2.Distance(player.Center, vector) > 3000f) //RAGE + if (increaseSpeedMore) + { + num188 *= 4f; + num189 *= 6f; + } + else if (increaseSpeed) { num188 *= 2f; - num189 *= 2f; + num189 *= 3f; } for (int num52 = 0; num52 < Main.maxNPCs; num52++) @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.DevourerofGods 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, 4f + npc.gfxOffY); + 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"); @@ -389,7 +389,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Frostburn, 180, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 8c0730774e..066d4c7bae 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1,9 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Placeables.FurnitureCosmilite; using CalamityMod.Items.Potions; @@ -21,7 +24,6 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -31,55 +33,75 @@ namespace CalamityMod.NPCs.DevourerofGods [AutoloadBossHead] public class DevourerofGodsHeadS : ModNPC { - private bool tail = false; + private enum LaserWallPhase + { + SetUp = 0, + FireLaserWalls = 1, + End = 2 + } + + private enum LaserWallType + { + Normal = 0, + Offset = 1, + MultiLayered = 2, + DiagonalHorizontal = 3, + DiagonalVertical = 4 + } + + private bool tail = false; private const int minLength = 100; private const int maxLength = 101; private bool halfLife = false; - private int[] shotSpacing = new int[4] { 1050, 1050, 1050, 1050 }; + + private const int shotSpacingMax = 1050; + private int[] shotSpacing = new int[4] { shotSpacingMax, shotSpacingMax, shotSpacingMax, shotSpacingMax }; private const int spacingVar = 105; + private const int diagonalSpacingVar = 350; private const int totalShots = 20; + private const int totalDiagonalShots = 6; + private const float laserWallSpacingOffset = 16f; + private int laserWallType = 0; + public int laserWallPhase = 0; + private const int idleCounterMax = 360; private int idleCounter = idleCounterMax; - public int laserWallPhase = 0; private int postTeleportTimer = 0; - private int laserWallType = 0; + private int teleportTimer = -1; - public override void SetStaticDefaults() + private int preventBullshitHitsAtStartofFinalPhaseTimer = 0; + + private const float alphaGateValue = 669f; + + public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } public override void SetDefaults() { - npc.damage = 300; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 186; npc.height = 186; npc.defense = 50; - npc.LifeMaxNERB(1150000, 1350000, 9200000); - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.LifeMaxNERB(517500, 621000, 920000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.takenDamageMultiplier = 1.25f; + npc.takenDamageMultiplier = 1.1f; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.boss = true; - npc.value = Item.buyPrice(1, 0, 0, 0); + npc.value = Item.buyPrice(0, 80, 0, 0); npc.alpha = 255; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; + music = CalamityMod.Instance.GetMusicFromMusicMod("UniversalCollapse") ?? MusicID.LunarBoss; bossBag = ModContent.ItemType(); } @@ -94,7 +116,12 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(idleCounter); writer.Write(laserWallPhase); writer.Write(postTeleportTimer); + writer.Write(preventBullshitHitsAtStartofFinalPhaseTimer); writer.Write(laserWallType); + writer.Write(teleportTimer); + writer.Write(npc.alpha); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -108,7 +135,12 @@ namespace CalamityMod.NPCs.DevourerofGods idleCounter = reader.ReadInt32(); laserWallPhase = reader.ReadInt32(); postTeleportTimer = reader.ReadInt32(); + preventBullshitHitsAtStartofFinalPhaseTimer = reader.ReadInt32(); laserWallType = reader.ReadInt32(); + teleportTimer = reader.ReadInt32(); + npc.alpha = reader.ReadInt32(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void BossHeadRotation(ref float rotation) @@ -126,87 +158,127 @@ namespace CalamityMod.NPCs.DevourerofGods // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Variables - Vector2 vector = npc.Center; - bool flies = npc.ai[2] == 0f; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool speedBoost = lifeRatio < 0.75f || (death && lifeRatio < 0.9f); - bool speedBoost2 = lifeRatio < 0.3f; - bool breathFireMore = lifeRatio < 0.15f || death; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // 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); + // Variables + Vector2 vector = npc.Center; + bool flies = npc.ai[3] == 0f; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + bool phase2 = lifeRatio < 0.8f; + bool phase3 = lifeRatio < 0.6f; + bool phase4 = lifeRatio < 0.3f; + bool phase5 = lifeRatio < 0.15f; + + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // 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); // Worm shit again - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + 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(); Player player = Main.player[npc.target]; float distanceFromTarget = Vector2.Distance(player.Center, vector); - bool tooFarAway = distanceFromTarget > 5600f; + bool increaseSpeed = distanceFromTarget > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = distanceFromTarget > CalamityGlobalNPC.CatchUpDistance350Tiles; + + float takeLessDamageDistance = 1600f; + if (distanceFromTarget > takeLessDamageDistance) + { + float damageTakenScalar = MathHelper.Clamp(1f - ((distanceFromTarget - takeLessDamageDistance) / takeLessDamageDistance), 0f, 1f); + npc.takenDamageMultiplier = MathHelper.Lerp(1f, 1.1f, damageTakenScalar); + } + else + npc.takenDamageMultiplier = 1.1f; // Immunity after teleport - npc.dontTakeDamage = postTeleportTimer > 0; + npc.dontTakeDamage = postTeleportTimer > 0 || preventBullshitHitsAtStartofFinalPhaseTimer > 0; + + // Teleport + if (teleportTimer >= 0) + { + teleportTimer--; + if (teleportTimer == 0) + Teleport(player, malice, death, revenge, expertMode, phase3); + } // Laser walls - if (speedBoost && !speedBoost2 && postTeleportTimer <= 0) + if (phase2 && !phase4 && postTeleportTimer <= 0) { - if (laserWallPhase == 0) // Start laser wall phase - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= 720f) - { - calamityGlobalNPC.newAI[3] = 0f; - laserWallPhase = 1; - } - } - } - else if (laserWallPhase == 1) // Turn invisible and fire laser walls - { - npc.alpha += 5; - if (npc.alpha == 255) - calamityGlobalNPC.newAI[1] = 0f; + if (laserWallPhase == (int)LaserWallPhase.SetUp) + { + // Increment next laser wall phase timer + calamityGlobalNPC.newAI[3] += 1f; - if (npc.alpha >= 255) - { - npc.alpha = 255; - idleCounter--; - if (idleCounter <= 0) - { - laserWallPhase = 2; - idleCounter = idleCounterMax; - } - } - } - else if (laserWallPhase == 2) // Turn visible - { - if (distanceFromTarget > 500f && revenge) - Teleport(player); - else + // Set alpha value prior to firing laser walls + if (calamityGlobalNPC.newAI[3] > alphaGateValue) { - npc.alpha -= 1; - if (npc.alpha <= 0) + // Disable teleports + if (teleportTimer >= 0) { - npc.alpha = 0; - laserWallPhase = 0; + GetRiftLocation(false); + teleportTimer = -1; } + + npc.alpha = (int)MathHelper.Clamp((calamityGlobalNPC.newAI[3] - alphaGateValue) * 5f, 0f, 255f); } - } + + // Fire laser walls every 12 seconds after a laser wall phase ends + if (calamityGlobalNPC.newAI[3] >= 720f) + { + npc.alpha = 255; + + // Reset laser wall timer to 0 + calamityGlobalNPC.newAI[1] = 0f; + + calamityGlobalNPC.newAI[3] = 0f; + laserWallPhase = (int)LaserWallPhase.FireLaserWalls; + } + } + else if (laserWallPhase == (int)LaserWallPhase.FireLaserWalls) + { + // Remain in laser wall firing phase for 6 seconds + idleCounter--; + if (idleCounter <= 0) + { + SpawnTeleportLocation(player); + laserWallPhase = (int)LaserWallPhase.End; + idleCounter = idleCounterMax; + } + } + else if (laserWallPhase == (int)LaserWallPhase.End) + { + // End laser wall phase after 4.25 seconds + npc.alpha -= 1; + if (npc.alpha <= 0) + { + npc.alpha = 0; + laserWallPhase = (int)LaserWallPhase.SetUp; + } + } } else { + // Set alpha after teleport if (postTeleportTimer > 0) { - postTeleportTimer -= 4; + postTeleportTimer--; if (postTeleportTimer < 0) postTeleportTimer = 0; @@ -219,25 +291,33 @@ namespace CalamityMod.NPCs.DevourerofGods npc.alpha = 0; } - if (laserWallPhase > 0) - laserWallPhase = 0; - } - - // Anger message - if (speedBoost2) - { - if (!halfLife) + // This exists so that DoG doesn't sometimes instantly kill the player when he goes to final phase + if (preventBullshitHitsAtStartofFinalPhaseTimer > 0) { - Teleport(player); + preventBullshitHitsAtStartofFinalPhaseTimer--; + if (npc.alpha < 1) + npc.alpha = 1; + } + + // Reset laser wall phase + if (laserWallPhase > (int)LaserWallPhase.SetUp) + laserWallPhase = (int)LaserWallPhase.SetUp; + + // Enter final phase + if (!halfLife && phase4) + { + SpawnTeleportLocation(player); + + preventBullshitHitsAtStartofFinalPhaseTimer = 180; + + // Anger message string key = "Mods.CalamityMod.EdgyBossText11"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); - if (Main.netMode != NetmodeID.MultiplayerClient) + // Summon Thots + if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); @@ -245,12 +325,12 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); } - halfLife = true; - } - } + halfLife = true; + } + } - // Spawn segments and fire projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) + // Spawn segments and fire projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) { // Segments if (!tail && npc.ai[0] == 0f) @@ -274,46 +354,39 @@ namespace CalamityMod.NPCs.DevourerofGods tail = true; } - int projectileDamage = expertMode ? 69 : 80; - // Fireballs if (npc.alpha <= 0 && distanceFromTarget > 500f) { calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (breathFireMore ? 60f : 120f) == 0f) - { - 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; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num430 = 16f; - int num432 = ModContent.ProjectileType(); + if (calamityGlobalNPC.newAI[0] >= 150f && calamityGlobalNPC.newAI[0] % (phase5 ? 60f : 120f) == 0f) + { + 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; + float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); + num429 = num430 / num429; + num427 *= num429; + num428 *= num429; + num428 += npc.velocity.Y * 0.5f; + num427 += npc.velocity.X * 0.5f; + vector44.X -= num427; + vector44.Y -= num428; - float num429 = (float)Math.Sqrt(num427 * num427 + num428 * num428); - num429 = num430 / num429; - num427 *= num429; - num428 *= num429; - num428 += npc.velocity.Y * 0.5f; - num427 += npc.velocity.X * 0.5f; - vector44.X -= num427 * 1f; - vector44.Y -= num428 * 1f; - - Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, num432, projectileDamage, 0f, Main.myPlayer, 0f, 0f); - } - } + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector44.X, vector44.Y, num427, num428, type, damage, 0f, Main.myPlayer); + } } else if (distanceFromTarget < 250f) calamityGlobalNPC.newAI[0] = 0f; // Laser walls - if (!speedBoost2 && (laserWallPhase == 1 || calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive))) + if (!phase4 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls) { - calamityGlobalNPC.newAI[1] += 1f; - float speed = 12f; float spawnOffset = 1500f; - float divisor = 120f; + float divisor = enraged ? 80f : malice ? 100f : 120f; if (calamityGlobalNPC.newAI[1] % divisor == 0f) { @@ -321,76 +394,143 @@ namespace CalamityMod.NPCs.DevourerofGods // Side walls float targetPosY = player.position.Y; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int halfTotalDiagonalShots = totalDiagonalShots / 2; + Vector2 start = default; + Vector2 velocity = default; + Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; + switch (laserWallType) { - case 0: + case (int)LaserWallType.Normal: for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, type, damage, 0f, Main.myPlayer); shotSpacing[0] -= spacingVar; } - laserWallType = 1; + + if (expertMode) + { + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + } + + laserWallType = (int)LaserWallType.Offset; break; - case 1: + case (int)LaserWallType.Offset: targetPosY += 50f; for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, type, damage, 0f, Main.myPlayer); shotSpacing[0] -= spacingVar; } - laserWallType = revenge ? 2 : 0; + + if (expertMode) + { + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + } + + laserWallType = revenge ? (int)LaserWallType.MultiLayered : expertMode ? (int)LaserWallType.DiagonalHorizontal : (int)LaserWallType.Normal; break; - case 2: + case (int)LaserWallType.MultiLayered: for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, type, damage, 0f, Main.myPlayer); shotSpacing[0] -= spacingVar; } - for (int x = 0; x < 10; x++) + + int totalBonusLasers = totalShots / 2; + for (int x = 0; x < totalBonusLasers; x++) { - Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[3], -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[3], speed, 0f, type, damage, 0f, Main.myPlayer); shotSpacing[3] -= Main.rand.NextBool(2) ? 180 : 200; } - shotSpacing[3] = 1050; - laserWallType = 0; + + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + + laserWallType = (int)LaserWallType.DiagonalHorizontal; + break; + + case (int)LaserWallType.DiagonalHorizontal: + + for (int x = 0; x < totalDiagonalShots + 1; x++) + { + start = new Vector2(player.position.X + spawnOffset, targetPosY + shotSpacing[0]); + aim.Y += laserWallSpacingOffset * (x - halfTotalDiagonalShots); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X - spawnOffset, targetPosY + shotSpacing[0]); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing[0] -= diagonalSpacingVar; + } + + Projectile.NewProjectile(player.Center.X, targetPosY + spawnOffset, 0f, -speed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.Center.X, targetPosY - spawnOffset, 0f, speed, type, damage, 0f, Main.myPlayer); + + laserWallType = revenge ? (int)LaserWallType.DiagonalVertical : (int)LaserWallType.Normal; + break; + + case (int)LaserWallType.DiagonalVertical: + + for (int x = 0; x < totalDiagonalShots + 1; x++) + { + start = new Vector2(player.position.X + shotSpacing[0], targetPosY + spawnOffset); + aim.X += laserWallSpacingOffset * (x - halfTotalDiagonalShots); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + start = new Vector2(player.position.X + shotSpacing[0], targetPosY - spawnOffset); + velocity = Vector2.Normalize(aim - start) * speed; + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer); + + shotSpacing[0] -= diagonalSpacingVar; + } + + Projectile.NewProjectile(player.position.X + spawnOffset, player.Center.Y, -speed, 0f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - spawnOffset, player.Center.Y, speed, 0f, type, damage, 0f, Main.myPlayer); + + laserWallType = (int)LaserWallType.Normal; break; } - shotSpacing[0] = 1050; // Lower wall for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffset, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffset, 0f, -speed, type, damage, 0f, Main.myPlayer); shotSpacing[1] -= spacingVar; } - shotSpacing[1] = 1050; // Upper wall for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffset, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffset, 0f, speed, type, damage, 0f, Main.myPlayer); shotSpacing[2] -= spacingVar; } - shotSpacing[2] = 1050; + for (int i = 0; i < shotSpacing.Length; i++) + shotSpacing[i] = shotSpacingMax; } - } + + calamityGlobalNPC.newAI[1] += 1f; + } } - // Despawn - if (!NPC.AnyNPCs(ModContent.NPCType())) - npc.active = false; - - float fallSpeed = death ? 17.75f : 16f; + float fallSpeed = enraged ? 21f : malice ? 19.5f : death ? 17.75f : 16f; if (expertMode) fallSpeed += 3.5f * (1f - lifeRatio); @@ -407,7 +547,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if ((double)npc.position.Y < Main.topWorld + 16f) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) Main.npc[a].active = false; @@ -435,28 +575,36 @@ namespace CalamityMod.NPCs.DevourerofGods else if (npc.velocity.X > 0f) npc.spriteDirection = 1; - // Flight - if (npc.ai[2] == 0f) + int phaseLimit = death ? 600 : 900; + + // Flight + if (npc.ai[3] == 0f) { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } + // 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; + return; + } + calamityGlobalNPC.newAI[2] += 1f; npc.localAI[1] = 0f; - int phaseLimit = death ? 600 : 900; - float speed = death ? 16.5f : 15f; - float turnSpeed = death ? 0.33f : 0.3f; - float homingSpeed = death ? 30f : 24f; - float homingTurnSpeed = death ? 0.405f : 0.33f; + float speed = enraged ? 20f : malice ? 18f : death ? 16.5f : 15f; + float turnSpeed = enraged ? 0.4f : malice ? 0.36f : death ? 0.33f : 0.3f; + float homingSpeed = enraged ? 40f : malice ? 36f : death ? 30f : 24f; + float homingTurnSpeed = enraged ? 0.55f : malice ? 0.48f : death ? 0.405f : 0.33f; if (expertMode) { - phaseLimit /= (1 + (int)(5f * (1f - lifeRatio))); + phaseLimit /= 1 + (int)(5f * (1f - lifeRatio)); if (phaseLimit < 180) phaseLimit = 180; @@ -468,25 +616,27 @@ namespace CalamityMod.NPCs.DevourerofGods } // Go to ground phase sooner - if (tooFarAway) + if (increaseSpeedMore) { - if (revenge && laserWallPhase == 0 && !player.dead && player.active) - Teleport(player); + if (laserWallPhase == (int)LaserWallPhase.SetUp && calamityGlobalNPC.newAI[3] <= alphaGateValue) + SpawnTeleportLocation(player); else calamityGlobalNPC.newAI[2] += 10f; } + else + calamityGlobalNPC.newAI[2] += 2f; float num188 = speed; float num189 = turnSpeed; - 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); + Vector2 vector18 = npc.Center; + float num191 = player.Center.X; + float num192 = player.Center.Y; int num42 = -1; int num43 = (int)(player.Center.X / 16f); int num44 = (int)(player.Center.Y / 16f); // Charge at target for 1.5 seconds - bool flyAtTarget = (!speedBoost || speedBoost2) && calamityGlobalNPC.newAI[2] > phaseLimit - 90 && revenge; + bool flyAtTarget = (!phase2 || phase4) && calamityGlobalNPC.newAI[2] > phaseLimit - 90 && revenge; for (int num45 = num43 - 2; num45 <= num43 + 2; num45++) { @@ -527,7 +677,7 @@ namespace CalamityMod.NPCs.DevourerofGods num189 = homingTurnSpeed; } - if (revenge) + if (expertMode) { num188 += Vector2.Distance(player.Center, npc.Center) * 0.005f * (1f - lifeRatio); num189 += Vector2.Distance(player.Center, npc.Center) * 0.0001f * (1f - lifeRatio); @@ -631,12 +781,13 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[2] = 1f; + npc.ai[3] = 1f; calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -646,32 +797,43 @@ namespace CalamityMod.NPCs.DevourerofGods { if (Main.netMode != NetmodeID.Server) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); } + // 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; + return; + } + calamityGlobalNPC.newAI[2] += 1f; - float turnSpeed = death ? 0.24f : 0.18f; + float turnSpeed = enraged ? 0.36f : malice ? 0.3f : death ? 0.24f : 0.18f; if (expertMode) - turnSpeed += 0.12f * (1f - lifeRatio); - - if (revenge) + { + turnSpeed += 0.1f * (1f - lifeRatio); turnSpeed += Vector2.Distance(player.Center, npc.Center) * 0.00005f * (1f - lifeRatio); - - bool increaseSpeed = distanceFromTarget > 3200f; + } // Enrage - if (tooFarAway) + if (increaseSpeedMore) { - if (revenge && laserWallPhase == 0 && !player.dead && player.active) - Teleport(player); + if (laserWallPhase == (int)LaserWallPhase.SetUp && calamityGlobalNPC.newAI[3] <= alphaGateValue) + SpawnTeleportLocation(player); else + { + fallSpeed *= 3f; turnSpeed *= 6f; + } } else if (increaseSpeed) + { + fallSpeed *= 1.5f; turnSpeed *= 3f; + } if (!flies) { @@ -713,7 +875,7 @@ namespace CalamityMod.NPCs.DevourerofGods bool flag95 = true; if (npc.position.Y > player.position.Y) { - for (int num955 = 0; num955 < 255; num955++) + for (int num955 = 0; num955 < Main.maxPlayers; num955++) { if (Main.player[num955].active) { @@ -733,9 +895,9 @@ namespace CalamityMod.NPCs.DevourerofGods npc.localAI[1] = 0f; float num189 = turnSpeed; - 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); + Vector2 vector18 = npc.Center; + float num191 = player.Center.X; + float num192 = player.Center.Y; num191 = (int)(num191 / 16f) * 16; num192 = (int)(num192 / 16f) * 16; vector18.X = (int)(vector18.X / 16f) * 16; @@ -746,8 +908,6 @@ namespace CalamityMod.NPCs.DevourerofGods if (!flies) { - npc.TargetClosest(true); - npc.velocity.Y += turnSpeed; if (npc.velocity.Y > fallSpeed) npc.velocity.Y = fallSpeed; @@ -776,19 +936,24 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - double maximumSpeed1 = death ? 0.46 : 0.4; - double maximumSpeed2 = death ? 1.125 : 1D; + double maximumSpeed1 = enraged ? 0.6 : malice ? 0.52 : death ? 0.46 : 0.4; + double maximumSpeed2 = enraged ? 1.4 : malice ? 1.25 : death ? 1.125 : 1D; + if (increaseSpeedMore) + { + maximumSpeed1 *= 4; + maximumSpeed2 *= 4; + } if (increaseSpeed) { - maximumSpeed1 += 0.8; - maximumSpeed2 += 2D; + maximumSpeed1 *= 2; + maximumSpeed2 *= 2; } if (expertMode) { - maximumSpeed1 += 0.12f * (1f - lifeRatio); - maximumSpeed2 += 0.25f * (1f - lifeRatio); + maximumSpeed1 += 0.1f * (1f - lifeRatio); + maximumSpeed2 += 0.2f * (1f - lifeRatio); } num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); @@ -871,7 +1036,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + 1.57f; + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; if (flies) { @@ -891,72 +1056,108 @@ namespace CalamityMod.NPCs.DevourerofGods 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] > (death ? 600f : 900f)) + if (calamityGlobalNPC.newAI[2] > phaseLimit) { - npc.ai[2] = 0f; + npc.ai[3] = 0f; calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } } - private void Teleport(Player player) + private void SpawnTeleportLocation(Player player) { - postTeleportTimer = 255; + if (teleportTimer > -1 || player.dead || !player.active) + return; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + 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); + } + + teleportTimer = (CalamityWorld.death || CalamityWorld.malice) ? 120 : CalamityWorld.revenge ? 140 : Main.expertMode ? 160 : 180; + } + + private void Teleport(Player player, bool malice, bool death, bool revenge, bool expertMode, bool phase3) + { + Vector2 newPosition = GetRiftLocation(true); + + if (player.dead || !player.active || newPosition == default) + return; + + if (phase3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float finalVelocity = 10f; + int totalSpreads = revenge ? 6 : 3; + float mult = revenge ? 1.5f : 3f; + for (int i = 0; i < totalSpreads; i++) + { + int totalProjectiles = malice ? 18 : 12; + float radians = MathHelper.TwoPi / totalProjectiles; + float newVelocity = finalVelocity - i * mult; + float velocityMult = 1f + ((finalVelocity - newVelocity) / (newVelocity * 2f) / 100f); + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = i < 3 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity); + float finalVelocityReduction = (float)Math.Pow(1.25, i) - 1f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(newPosition, vector255, type, damage, 0f, Main.myPlayer, velocityMult, finalVelocity - finalVelocityReduction); + } + } + } + } + + 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); npc.alpha = postTeleportTimer; - - 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)); - - npc.position = targetVector; + npc.velocity = Vector2.Normalize(player.Center + player.velocity * 40f - npc.Center) * chargeVelocity; npc.netUpdate = true; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType())) { - Main.npc[i].position = targetVector; + Main.npc[i].position = newPosition; + if (Main.npc[i].type == ModContent.NPCType()) - { ((DevourerofGodsTailS)Main.npc[i].modNPC).setInvulTime(720); - } + Main.npc[i].netUpdate = true; } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), player.Center); + } - int dustAmt = 50; - int random = 5; - - for (int j = 0; j < 10; j++) + private Vector2 GetRiftLocation(bool spawnDust) + { + for (int i = 0; i < Main.maxProjectiles; i++) { - random += j * 2; - int dustAmtSpawned = 0; - int scale = random * 13; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) + if (Main.projectile[i].type == ModContent.ProjectileType()) { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = targetVector.X; - Main.dust[dust].position.Y = targetVector.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; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; + if (!spawnDust) + Main.projectile[i].ai[0] = -1f; + + Main.projectile[i].Kill(); + return Main.projectile[i].Center; } } + return default; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -970,7 +1171,7 @@ namespace CalamityMod.NPCs.DevourerofGods Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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) @@ -1011,13 +1212,21 @@ namespace CalamityMod.NPCs.DevourerofGods DropHelper.DropBags(npc); - DropHelper.DropItem(npc, ModContent.ItemType(), 5, 15); + // Legendary drops for DoG + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 15); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedDoG); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedDoG, 6, 3, 2); CalamityGlobalTownNPC.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); + // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { @@ -1025,20 +1234,26 @@ namespace CalamityMod.NPCs.DevourerofGods DropHelper.DropItem(npc, ModContent.ItemType(), 25, 35); DropHelper.DropItem(npc, ModContent.ItemType(), 150, 250); - // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + // Weapons + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - Main.rand.NextBool() ? DropHelper.WeightStack(w) : DropHelper.WeightStack(w) + DropHelper.WeightStack(w) ); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - } + if (Main.rand.NextBool(5)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } + } // If DoG has not been killed yet, notify players that the holiday moons are buffed if (!CalamityWorld.downedDoG) @@ -1047,26 +1262,20 @@ namespace CalamityMod.NPCs.DevourerofGods Color messageColor = Color.Cyan; string key2 = "Mods.CalamityMod.DoGBossText2"; Color messageColor2 = Color.Orange; + string key3 = "Mods.CalamityMod.DargonBossText"; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } + CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor2); + } // Mark DoG as dead CalamityWorld.downedDoG = true; - CalamityMod.UpdateServerBoolean(); - } + CalamityNetcode.SyncWorld(); + } - // Can only hit the target if within certain distance - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + // Can only hit the target if within certain distance + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; @@ -1085,55 +1294,16 @@ namespace CalamityMod.NPCs.DevourerofGods if (dist4 < minDist) minDist = dist4; - return minDist <= 80f && npc.alpha <= 0; + return minDist <= 80f && (npc.alpha <= 0 || postTeleportTimer > 0) && preventBullshitHitsAtStartofFinalPhaseTimer <= 0; } - // Projectiles can only hit within certain distance - /*public override bool? CanBeHitByProjectile(Projectile projectile) - { - Rectangle projectileHitbox = projectile.Hitbox; - - float dist1 = Vector2.Distance(npc.Center, projectileHitbox.TopLeft()); - float dist2 = Vector2.Distance(npc.Center, projectileHitbox.TopRight()); - float dist3 = Vector2.Distance(npc.Center, projectileHitbox.BottomLeft()); - float dist4 = Vector2.Distance(npc.Center, projectileHitbox.BottomRight()); - - float minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; - - return minDist <= 80f; - }*/ - - // Melee hitboxes are fucked so I have no clue what to do here - /*public override bool? CanBeHitByItem(Player player, Item item) - { - 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 minDist = dist1; - if (dist2 < minDist) minDist = dist2; - if (dist3 < minDist) minDist = dist3; - if (dist4 < minDist) minDist = dist4; - - return minDist <= 80f && npc.alpha == 0; - }*/ - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { if (CalamityUtils.AntiButcher(npc, ref damage, 0.5f)) { string key = "Mods.CalamityMod.EdgyBossText2"; Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); return false; } return true; @@ -1198,11 +1368,10 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 300, true); player.AddBuff(ModContent.BuffType(), 420, true); - player.AddBuff(BuffID.Frostburn, 300, true); - if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.alpha <= 0) + /*if ((CalamityWorld.death || BossRushEvent.BossRushActive) && (npc.alpha <= 0 || postTeleportTimer > 0) && !player.Calamity().lol && preventBullshitHitsAtStartofFinalPhaseTimer <= 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); - } + }*/ if (player.Calamity().dogTextCooldown <= 0) { @@ -1215,7 +1384,7 @@ namespace CalamityMod.NPCs.DevourerofGods "Mods.CalamityMod.EdgyBossText7" }); Color messageColor = Color.Cyan; - Rectangle location = new Microsoft.Xna.Framework.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/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index ec3715cd16..7d65d93f10 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -20,14 +20,15 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 150; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 66; npc.height = 66; npc.defense = 50; - npc.LifeMaxNERB(675000, 750000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.LifeMaxNERB(371250, 445500); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -40,15 +41,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.netAlways = true; npc.boss = true; npc.takenDamageMultiplier = 1.25f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; npc.dontCountMe = true; } @@ -59,11 +52,10 @@ namespace CalamityMod.NPCs.DevourerofGods 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.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + 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]; // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -71,31 +63,42 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + 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); + } + else + npc.takenDamageMultiplier = 1.25f; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -106,16 +109,15 @@ namespace CalamityMod.NPCs.DevourerofGods Main.dust[num935].noLight = true; } } + npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } } + if (player.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 = player.position.X + (float)(player.width / 2); float num192 = player.position.Y + (float)(player.height / 2); @@ -145,14 +147,11 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -167,7 +166,7 @@ namespace CalamityMod.NPCs.DevourerofGods 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, 4f + npc.gfxOffY); + 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/DevourerofGodsTailGlow"); @@ -185,7 +184,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 0; + cooldownSlot = 1; return true; } @@ -244,14 +243,13 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(BuffID.Frostburn, 180, true); if (player.Calamity().dogTextCooldown <= 0) { diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index 7f29baaf87..123629defe 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -19,12 +19,11 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 100; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 30; npc.height = 50; npc.defense = 70; - npc.lifeMax = 100000; + npc.lifeMax = 50000; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -36,10 +35,6 @@ namespace CalamityMod.NPCs.DevourerofGods npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; } @@ -76,25 +71,32 @@ namespace CalamityMod.NPCs.DevourerofGods npc.dontTakeDamage = false; } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) { - flag = true; + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } } - else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) + if (!shouldDespawn) { - flag = true; + if (npc.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)npc.ai[1]].life <= 0) + shouldDespawn = true; } - if (flag) + if (shouldDespawn) { npc.life = 0; npc.HitEffect(0, 10.0); npc.checkDead(); + npc.active = false; } if (Main.npc[(int)npc.ai[1]].alpha < 128) @@ -105,11 +107,10 @@ namespace CalamityMod.NPCs.DevourerofGods Main.dust[num935].noGravity = true; Main.dust[num935].noLight = true; } + 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); @@ -156,7 +157,7 @@ namespace CalamityMod.NPCs.DevourerofGods 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, 4f + npc.gfxOffY); + 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"); @@ -222,7 +223,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 90, true); - player.AddBuff(BuffID.Frostburn, 90, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 7bbc4a6bd5..3e8edc1a42 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -29,13 +29,14 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - npc.damage = 180; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 80; npc.height = 140; npc.defense = 50; - npc.LifeMaxNERB(1150000, 1350000, 9200000); - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.LifeMaxNERB(517500, 621000, 920000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; npc.aiStyle = -1; @@ -49,15 +50,7 @@ namespace CalamityMod.NPCs.DevourerofGods npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; + music = CalamityMod.Instance.GetMusicFromMusicMod("UniversalCollapse") ?? MusicID.LunarBoss; npc.dontCountMe = true; } @@ -66,6 +59,7 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(invinceTime); writer.Write(setAlpha); writer.Write(npc.dontTakeDamage); + writer.Write(npc.alpha); } public override void ReceiveExtraAI(BinaryReader reader) @@ -73,6 +67,7 @@ namespace CalamityMod.NPCs.DevourerofGods invinceTime = reader.ReadInt32(); setAlpha = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + npc.alpha = reader.ReadInt32(); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -87,23 +82,21 @@ namespace CalamityMod.NPCs.DevourerofGods public override void AI() { - if (invinceTime > 0) + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + + if (invinceTime > 0) { invinceTime--; npc.dontTakeDamage = true; } else - { npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; - } + if (Main.npc[(int)npc.ai[2]].dontTakeDamage) - { invinceTime = 240; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -111,35 +104,41 @@ namespace CalamityMod.NPCs.DevourerofGods Player player = Main.player[npc.target]; - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) - { - npc.active = false; - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); + 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); + } + else + npc.takenDamageMultiplier = 1.25f; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) { npc.alpha -= 42; @@ -150,13 +149,11 @@ namespace CalamityMod.NPCs.DevourerofGods } } else - { npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } + if (player.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 = player.position.X + (float)(player.width / 2); float num192 = player.position.Y + (float)(player.height / 2); @@ -177,7 +174,7 @@ namespace CalamityMod.NPCs.DevourerofGods } catch { } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); int num194 = npc.width; num193 = (num193 - (float)num194) / num193; @@ -186,14 +183,11 @@ namespace CalamityMod.NPCs.DevourerofGods npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -208,7 +202,7 @@ namespace CalamityMod.NPCs.DevourerofGods 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, 4f + npc.gfxOffY); + 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) @@ -230,7 +224,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 0; + cooldownSlot = 1; Rectangle targetHitbox = target.Hitbox; @@ -324,14 +318,13 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(BuffID.Frostburn, 180, true); if (player.Calamity().dogTextCooldown <= 0) { @@ -341,7 +334,7 @@ namespace CalamityMod.NPCs.DevourerofGods "Mods.CalamityMod.EdgyBossText9" }); Color messageColor = Color.Cyan; - Rectangle location = new Microsoft.Xna.Framework.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/DoGSky.cs b/NPCs/DevourerofGods/DoGSky.cs index c4938af624..3dcbc3a28c 100644 --- a/NPCs/DevourerofGods/DoGSky.cs +++ b/NPCs/DevourerofGods/DoGSky.cs @@ -66,12 +66,12 @@ namespace CalamityMod.NPCs.DevourerofGods public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) + if (maxDepth >= 0 && minDepth < 0 && DoGIndex != -1) { - if (Main.npc[CalamityGlobalNPC.DoGHead].active) + if (Main.npc[DoGIndex].active) { float intensity = GetIntensity(); - if (Main.npc[CalamityGlobalNPC.DoGHead].life < Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) + if (Main.npc[DoGIndex].life < Main.npc[DoGIndex].lifeMax * 0.15 || CalamityWorld.death || CalamityWorld.malice) { spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * (intensity + 0.5f)); @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.DevourerofGods else { spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); + (Main.npc[DoGIndex].ai[3] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); } } } diff --git a/NPCs/DevourerofGods/DoGSkyS.cs b/NPCs/DevourerofGods/DoGSkyS.cs index 14c4e38e39..3be57d9454 100644 --- a/NPCs/DevourerofGods/DoGSkyS.cs +++ b/NPCs/DevourerofGods/DoGSkyS.cs @@ -66,12 +66,12 @@ namespace CalamityMod.NPCs.DevourerofGods public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) { - if (maxDepth >= 0 && minDepth < 0 && CalamityGlobalNPC.DoGHead != -1) + if (maxDepth >= 0 && minDepth < 0 && DoGIndex != -1) { - if (Main.npc[CalamityGlobalNPC.DoGHead].active) + if (Main.npc[DoGIndex].active) { float intensity = this.GetIntensity(); - if ((double)Main.npc[CalamityGlobalNPC.DoGHead].life < (double)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax * 0.15 || CalamityWorld.death) + if ((double)Main.npc[DoGIndex].life < (double)Main.npc[DoGIndex].lifeMax * 0.15 || CalamityWorld.death || CalamityWorld.malice) { spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * (intensity + 0.5f)); @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.DevourerofGods else { spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), - (Main.npc[CalamityGlobalNPC.DoGHead].ai[2] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); + (Main.npc[DoGIndex].ai[3] == 0f ? Color.Cyan : Color.Fuchsia) * intensity); } } } diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs new file mode 100644 index 0000000000..a033ce2ba1 --- /dev/null +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -0,0 +1,709 @@ +using CalamityMod.Events; +using CalamityMod.Items.Potions; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Apollo +{ + //[AutoloadBossHead] + public class Apollo : ModNPC + { + public enum Phase + { + Normal = 0, + RocketBarrage = 1, + ChargeCombo = 2, + PhaseTransition = 3 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + public enum SecondaryPhase + { + Nothing = 0, + Passive = 1, + PassiveAndImmune = 2 + } + + public float SecondaryAIState + { + get => npc.Calamity().newAI[1]; + set => npc.Calamity().newAI[1] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 10; + private const int maxFramesY = 9; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit_Phase1 = 9; + private const int chargeUpFrameLimit_Phase1 = 19; + private const int attackFrameLimit_Phase1 = 29; + private const int phaseTransitionFrameLimit = 59; // The lens pops off on frame 37 + private const int normalFrameLimit_Phase2 = 69; + private const int chargeUpFrameLimit_Phase2 = 79; + private const int attackFrameLimit_Phase2 = 89; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 2800f; + + // Total duration of attack telegraphs + public const float attackTelegraphDuration = 100f; + + // Total duration of the phase transition + public const float phaseTransitionDuration = 300f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XS-01 Artemis"); + } + + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.localAI[0]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.draedonExoMechTwinGreen = npc.whoAmI; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + bool exoWormAlive = false; + bool exoPrimeAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + { + otherExoMechsAlive++; + exoWormAlive = true; + } + } + if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) + { + // Link the HP of both twins + if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life) + npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life; + } + } + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + otherExoMechsAlive++; + exoPrimeAlive = true; + } + } + + // Percent life remaining + 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; + float exoPrimeLifeRatio = defaultLifeRatio; + if (exoWormAlive) + exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax; + if (exoPrimeAlive) + exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoPrimeLifeRatio; + + // Check if any of the other mechs are passive + bool exoWormPassive = false; + bool exoPrimePassive = false; + if (exoWormAlive) + exoWormPassive = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive; + if (exoPrimeAlive) + exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; + bool anyOtherExoMechPassive = exoWormPassive || exoPrimePassive; + + // Phases + bool phase2 = lifeRatio < 0.6f; + bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // If Artemis and Apollo don't go berserk + bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoPrimeLifeRatio < 0.4f; + + // Get a target + 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(); + + // Target variable + Player player = Main.player[npc.target]; + + // Spawn Artemis if it doesn't exist after the first 10 frames have passed + if (npc.ai[0] < 10f) + { + npc.ai[0] += 1f; + if (npc.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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].active = false; + } + } + } + } + + // General AI pattern + // 0 - Fly to the right of the target and fire plasma when ready + // 1 - Fly to the right of the target and fire homing rockets, the rockets home in until close to the target and then fly off in the direction they were moving in + // 2 - Fly below the target, create several line telegraphs to show the dash pattern and then dash along those lines extremely quickly + // 3 - Go passive and fly to the right of the target while firing less projectiles + // 4 - Go passive, immune and invisible; fly far to the left of the target and do nothing until next phase + + // Attack patterns + // If spawned first + // Phase 1 - 0, 1 + // Phase 2 - 4 + // Phase 3 - 3 + + // If berserk, this is the last phase of Artemis and Apollo + // Phase 4 - 0, 1, 2 + + // If not berserk + // Phase 4 - 4 + // Phase 5 - 0, 1 + + // If berserk, this is the last phase of Artemis and Apollo + // Phase 6 - 0, 1, 2 + + // If not berserk + // Phase 6 - 4 + + // Berserk, final phase of Artemis and Apollo + // Phase 7 - 0, 1, 2 + + // Adjust opacity + bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Predictiveness + float predictionAmt = malice ? 16f : death ? 12f : revenge ? 10f : expertMode ? 8f : 4f; + if (SecondaryAIState == (int)SecondaryPhase.Passive) + predictionAmt *= 0.5f; + + Vector2 predictionVector = AIState == (int)Phase.RocketBarrage ? Vector2.Zero : player.velocity * predictionAmt; + + // Rotation + if (AIState == (int)Phase.ChargeCombo) + { + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + } + else + { + float x = player.Center.X + predictionVector.X - npc.Center.X; + float y = player.Center.Y + predictionVector.Y - npc.Center.Y; + npc.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; + } + + // Light + Lighting.AddLight(npc.Center, 0.05f, 0.25f, 0.15f); + + // Default vector to fly to + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + 1200f, player.Center.Y) : AIState == (float)Phase.ChargeCombo ? new Vector2(player.Center.X, player.Center.Y + 500f) : new Vector2(player.Center.X + 750f, player.Center.Y); + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 14f * baseVelocityMult; + float baseAcceleration = 1f; + float decelerationVelocityMult = 0.85f; + if (berserk) + { + baseVelocity *= 1.5f; + baseAcceleration *= 1.5f; + } + Vector2 distanceFromDestination = destination - npc.Center; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; + + // Distance where Apollo stops moving + float movementDistanceGateValue = 100f; + + // Gate values + float chargePhaseGateValue = lastMechAlive ? 300f : 480f; + float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f; + + // Passive and Immune phases + switch ((int)SecondaryAIState) + { + case (int)SecondaryPhase.Nothing: + + // Spawn the other mechs if Artemis and Apollo are first + if (otherExoMechsAlive == 0) + { + if (spawnOtherExoMechs) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn code here + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + } + } + else + { + // If not spawned first, go to passive state if any other mech is passive or if Artemis and Apollo are under 70% life + // Do not run this if berserk + // Do not run this if any exo mech is dead + if ((anyOtherExoMechPassive || lifeRatio < 0.7f) && !berserk && totalOtherExoMechLifeRatio < 5f) + { + // Tells Apollo to return to the battle in passive state and reset everything + SecondaryAIState = (float)SecondaryPhase.Passive; + npc.TargetClosest(); + } + + // Go passive and immune if one of the other mechs is berserk + // This is only called if two exo mechs are alive + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + } + + break; + + // Fire projectiles less often + case (int)SecondaryPhase.Passive: + + // Enter passive and invincible phase if one of the other exo mechs is berserk + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + + // If Artemis and Apollo are the first mechs to go berserk + if (berserk) + { + // Reset everything + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + + // Fly above target and become immune + case (int)SecondaryPhase.PassiveAndImmune: + + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk + if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) + { + // 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.TargetClosest(); + } + + if (berserk) + { + // Reset everything + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + } + + // Needs edits + // Attacking phases + /*switch ((int)AIState) + { + // Fly above the target + case (int)Phase.Normal: + + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + + if (berserk) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] > deathrayPhaseGateValue) + { + calamityGlobalNPC.newAI[2] = 0f; + AIState = (float)Phase.Deathrays; + } + } + + break; + + // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays + case (int)Phase.Deathrays: + + if (!targetDead) + { + if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) + { + Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; + npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); + } + else + { + calamityGlobalNPC.newAI[3] = 1f; + npc.velocity *= decelerationVelocityMult; + + int totalProjectiles = malice ? 12 : expertMode ? 10 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); + bool normalLaserRotation = npc.localAI[0] % 2f == 0f; + float velocity = 6f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + spinningPoint.Normalize(); + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + { + // Fire deathray telegraph beams + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Set frames to deathray charge up frames, which begin on frame 12 + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int type = ModContent.ProjectileType(); + 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); + } + } + } + } + else + { + // Fire deathrays + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.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); + 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); + } + } + } + } + + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.localAI[0] += 1f; + npc.TargetClosest(); + } + } + } + + break; + }*/ + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } + + // Needs edits + /*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) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 0 + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 36, the start of the deathray firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) + frameX = frameY = 4; + } + } + }*/ + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + 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); + 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/Apollo/ApolloGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ModContent.ItemType(); + } + + // Needs edits + public override void NPCLoot() + { + /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); + + // Check if the other exo mechs are alive + bool otherExoMechsAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive = true; + } + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + otherExoMechsAlive = true; + } + + // Mark Exo Mechs as dead + if (!otherExoMechsAlive) + { + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + }*/ + } + + // 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); + + 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); + } + 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); + 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); + 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);*/ + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + } +} diff --git a/NPCs/ExoMechs/Apollo/Apollo.png b/NPCs/ExoMechs/Apollo/Apollo.png new file mode 100644 index 0000000000..ba39ad07db Binary files /dev/null and b/NPCs/ExoMechs/Apollo/Apollo.png differ diff --git a/NPCs/ExoMechs/Apollo/ApolloGlow.png b/NPCs/ExoMechs/Apollo/ApolloGlow.png new file mode 100644 index 0000000000..38c52cefe8 Binary files /dev/null and b/NPCs/ExoMechs/Apollo/ApolloGlow.png differ diff --git a/NPCs/ExoMechs/Ares/AresArmSegment.png b/NPCs/ExoMechs/Ares/AresArmSegment.png new file mode 100644 index 0000000000..120a62d7c5 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresArmSegment.png differ diff --git a/NPCs/ExoMechs/Ares/AresArmSegmentGlow.png b/NPCs/ExoMechs/Ares/AresArmSegmentGlow.png new file mode 100644 index 0000000000..981953b1a8 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresArmSegmentGlow.png differ diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs new file mode 100644 index 0000000000..24eb0611fc --- /dev/null +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -0,0 +1,726 @@ +using CalamityMod.Events; +using CalamityMod.Items.Potions; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Ares +{ + //[AutoloadBossHead] + public class AresBody : ModNPC + { + public enum Phase + { + Normal = 0, + Deathrays = 1 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + public enum SecondaryPhase + { + Nothing = 0, + Passive = 1, + PassiveAndImmune = 2 + } + + public float SecondaryAIState + { + get => npc.Calamity().newAI[1]; + set => npc.Calamity().newAI[1] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 6; + private const int maxFramesY = 8; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit = 11; + private const int firstStageDeathrayChargeFrameLimit = 23; + private const int secondStageDeathrayChargeFrameLimit = 35; + private const int finalStageDeathrayChargeFrameLimit = 47; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Variable used to stop the arm spawning loop + private bool armsSpawned = false; + + // Total duration of the deathray telegraph + public const float deathrayTelegraphDuration = 240f; + + // Total duration of the deathrays + public const float deathrayDuration = 600f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XF-09 Ares"); + } + + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameX); + writer.Write(frameY); + writer.Write(armsSpawned); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(npc.localAI[0]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + armsSpawned = reader.ReadBoolean(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.draedonExoMechPrime = npc.whoAmI; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Spawn arms + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!armsSpawned && npc.ai[0] == 0f) + { + int totalArms = 4; + 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); + break; + case 1: + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + break; + case 2: + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + break; + case 3: + 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].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + armsSpawned = true; + } + } + + 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; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + bool exoWormAlive = false; + bool exoTwinsAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + { + otherExoMechsAlive++; + exoWormAlive = true; + } + } + + // There is no point in checking for the other twin because they have linked HP + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { + otherExoMechsAlive++; + exoTwinsAlive = true; + } + } + + // These are 5 by default to avoid triggering passive phases after the other mechs are dead + float exoWormLifeRatio = defaultLifeRatio; + float exoTwinsLifeRatio = defaultLifeRatio; + if (exoWormAlive) + exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax; + if (exoTwinsAlive) + exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax; + float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoTwinsLifeRatio; + + // Check if any of the other mechs are passive + bool exoWormPassive = false; + bool exoTwinsPassive = false; + if (exoWormAlive) + exoWormPassive = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive; + if (exoTwinsAlive) + exoTwinsPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] == (float)Apollo.Apollo.SecondaryPhase.Passive; + bool anyOtherExoMechPassive = exoWormPassive || exoTwinsPassive; + + // Phases + bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // If Ares doesn't go berserk + bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f; + + // Get a target + 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(); + + // Target variable + Player player = Main.player[npc.target]; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + + // General AI pattern + // 0 - Fly above target + // 1 - Fly towards the target, slow down when close enough + // 2 - Fire deathrays from telegraph locations to avoid cheap hits and rotate them around for 10 seconds while the plasma and tesla arms fire projectiles to make dodging difficult + // 3 - Go passive and fly above the target while firing less projectiles + // 4 - Go passive, immune and invisible; fly above the target and do nothing until next phase + + // Attack patterns + // If spawned first + // Phase 1 - 0 + // Phase 2 - 4 + // Phase 3 - 3 + + // If berserk, this is the last phase of Ares + // Phase 4 - 1, 2 + + // If not berserk + // Phase 4 - 4 + // Phase 5 - 0 + + // If berserk, this is the last phase of Ares + // Phase 6 - 1, 2 + + // If not berserk + // Phase 6 - 4 + + // Berserk, final phase of Ares + // Phase 7 - 1, 2 + + // Adjust opacity + bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Rotation + npc.rotation = npc.velocity.X * 0.003f; + + // Light + float lightScale = 765f; + Lighting.AddLight(npc.Center, Main.DiscoR / lightScale, Main.DiscoG / lightScale, Main.DiscoB / lightScale); + + // Default vector to fly to + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X, player.Center.Y - 800f) : AIState != (float)Phase.Deathrays ? new Vector2(player.Center.X, player.Center.Y - 425f) : player.Center; + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 14f * baseVelocityMult; + float baseAcceleration = 1f; + float decelerationVelocityMult = 0.85f; + if (berserk) + { + baseVelocity *= 1.5f; + baseAcceleration *= 1.5f; + } + Vector2 distanceFromDestination = destination - npc.Center; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; + + // Distance from target + float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + + // Distance where Ares stops moving + float movementDistanceGateValue = 50f; + + // Gate values + float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f; + float deathrayDistanceGateValue = 480f; + + // Passive and Immune phases + switch ((int)SecondaryAIState) + { + case (int)SecondaryPhase.Nothing: + + // Spawn the other mechs if Ares is first + if (otherExoMechsAlive == 0) + { + if (spawnOtherExoMechs) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn code here + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + } + } + else + { + // If not spawned first, go to passive state if any other mech is passive or if Ares is under 70% life + // Do not run this if berserk + // Do not run this if any exo mech is dead + if ((anyOtherExoMechPassive || lifeRatio < 0.7f) && !berserk && totalOtherExoMechLifeRatio < 5f) + { + // Tells Ares to return to the battle in passive state and reset everything + SecondaryAIState = (float)SecondaryPhase.Passive; + npc.TargetClosest(); + } + + // Go passive and immune if one of the other mechs is berserk + // This is only called if two exo mechs are alive + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + } + + break; + + // Fire projectiles less often + case (int)SecondaryPhase.Passive: + + // Enter passive and invincible phase if one of the other exo mechs is berserk + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + + // If Ares is the first mech to go berserk + if (berserk) + { + // Reset everything + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + + // Fly above target and become immune + case (int)SecondaryPhase.PassiveAndImmune: + + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk + if ((exoWormLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk) + { + // 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(); + } + + if (berserk) + { + // Reset everything + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + } + + // Attacking phases + switch ((int)AIState) + { + // Fly above the target + case (int)Phase.Normal: + + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + + if (berserk) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] > deathrayPhaseGateValue) + { + calamityGlobalNPC.newAI[2] = 0f; + AIState = (float)Phase.Deathrays; + } + } + + break; + + // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays + case (int)Phase.Deathrays: + + if (!targetDead) + { + if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) + { + Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; + npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); + } + else + { + calamityGlobalNPC.newAI[3] = 1f; + npc.velocity *= decelerationVelocityMult; + + int totalProjectiles = malice ? 12 : expertMode ? 10 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); + bool normalLaserRotation = npc.localAI[0] % 2f == 0f; + float velocity = 6f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + spinningPoint.Normalize(); + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + { + // Fire deathray telegraph beams + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Set frames to deathray charge up frames, which begin on frame 12 + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + int type = ModContent.ProjectileType(); + 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); + } + } + } + } + else + { + // Fire deathrays + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.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); + 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); + } + } + } + } + + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.localAI[0] += 1f; + npc.TargetClosest(); + } + } + } + + break; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } + + 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) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 0 + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 36, the start of the deathray firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) + frameX = frameY = 4; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + 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); + 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"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ModContent.ItemType(); + } + + // Needs edits + public override void NPCLoot() + { + /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); + + // Check if the other exo mechs are alive + bool otherExoMechsAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive = true; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive = true; + } + + // Mark Exo Mechs as dead + if (!otherExoMechsAlive) + { + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + }*/ + } + + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/ExoMechs/Ares/AresBody.png b/NPCs/ExoMechs/Ares/AresBody.png new file mode 100644 index 0000000000..dc4bb33f62 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresBody.png differ diff --git a/NPCs/ExoMechs/Ares/AresBodyGlow.png b/NPCs/ExoMechs/Ares/AresBodyGlow.png new file mode 100644 index 0000000000..6e644a8fbe Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresBodyGlow.png differ diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs new file mode 100644 index 0000000000..1ef97be59d --- /dev/null +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -0,0 +1,495 @@ +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Ares +{ + //[AutoloadBossHead] + public class AresGaussNuke : ModNPC + { + public enum Phase + { + Nothing = 0, + GaussNuke = 1, + Reload = 2 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 9; + private const int maxFramesY = 12; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit = 11; + private const int firstStageGaussNukeChargeFrameLimit = 23; + private const int secondStageGaussNukeChargeFrameLimit = 35; + private const int finalStageGaussNukeChargeFrameLimit = 47; + private const int reloadFrameLimit = 107; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Total duration of the gauss nuke telegraph + private const float gaussNukeTelegraphDuration = 360f; + + // Total duration of the gauss nuke firing phase + private const float gaussNukeReloadDuration = 600f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XF-09 Ares Gauss Nuke"); + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 100; + npc.width = 170; + npc.height = 120; + npc.defense = 80; + npc.DR_NERD(0.25f); + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameX); + writer.Write(frameY); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + return; + } + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Phases + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // Target variable + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + + 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; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + + // Passive phase check + bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + + // Adjust opacity + bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Predictiveness + float predictionAmt = malice ? 20f : death ? 15f : revenge ? 12.5f : expertMode ? 10f : 5f; + if (passivePhase) + predictionAmt *= 0.5f; + + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + float projectileVelocity = passivePhase ? 9.6f : 12f; + if (lastMechAlive) + projectileVelocity *= 1.2f; + else if (berserk) + projectileVelocity *= 1.1f; + + float rateOfRotation = AIState == (int)Phase.GaussNuke ? 0.08f : 0.04f; + Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; + + float rotation = (float)Math.Atan2(lookAt.Y, lookAt.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); + + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Light + Lighting.AddLight(npc.Center, 0.2f, 0.25f, 0.05f); + + // Default vector to fly to + Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 16f * baseVelocityMult; + if (berserk) + baseVelocity *= 1.5f; + + Vector2 distanceFromDestination = destination - npc.Center; + + // Distance where Ares Nuke Arm stops moving + float movementDistanceGateValue = 50f; + + // Gate values + float gaussNukePhaseGateValue = 600f; + if (lastMechAlive) + gaussNukePhaseGateValue *= 0.7f; + else if (berserk) + gaussNukePhaseGateValue *= 0.85f; + + // Variable to disable deathray firing + bool doNotFire = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays || calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + if (doNotFire) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + } + + // Attacking phases + switch ((int)AIState) + { + // Do nothing and fly in place + case (int)Phase.Nothing: + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= gaussNukePhaseGateValue) + { + AIState = (float)Phase.GaussNuke; + calamityGlobalNPC.newAI[1] = 0f; + } + + break; + + // Fire gauss nuke that emits a wave pounder stealth strike-size explosion on death + case (int)Phase.GaussNuke: + + if (!targetDead) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < gaussNukeTelegraphDuration) + { + // Set frames to gauss nuke charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 12 + frameX = 1; + + // Y = 0 sets to frame 12 + frameY = 0; + } + + // Fire gauss nuke on frame 41 + if ((frameX * maxFramesY) + frameY == 41 && calamityGlobalNPC.newAI[1] == 0f) + { + calamityGlobalNPC.newAI[1] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.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); + float offset = 40f; + Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + + // Recoil + npc.velocity -= gaussNukeVelocity; + } + } + } + else + { + // Set frames to gauss nuke reload frames, which begin on frame 48 + AIState = (float)Phase.Reload; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 48 + frameX = 4; + + // Y = 0 sets to frame 48 + frameY = 0; + } + } + + break; + + case (int)Phase.Reload: + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= gaussNukeReloadDuration) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; + } + + // Movement + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override void FindFrame(int frameHeight) + { + // Use telegraph frames when using gauss nuke + npc.frameCounter += 1D; + if (AIState == (float)Phase.Nothing) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 12 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 12 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 0 + if ((frameX * maxFramesY) + frameY > reloadFrameLimit) + frameX = frameY = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + Vector2 center = npc.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool PreNPCLoot() => false; + + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.png b/NPCs/ExoMechs/Ares/AresGaussNuke.png new file mode 100644 index 0000000000..85c7d6b073 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresGaussNuke.png differ diff --git a/NPCs/ExoMechs/Ares/AresGaussNukeGlow.png b/NPCs/ExoMechs/Ares/AresGaussNukeGlow.png new file mode 100644 index 0000000000..c0bfa254f4 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresGaussNukeGlow.png differ diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs new file mode 100644 index 0000000000..a90d71f420 --- /dev/null +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -0,0 +1,552 @@ +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Ares +{ + //[AutoloadBossHead] + public class AresLaserCannon : ModNPC + { + public enum Phase + { + Nothing = 0, + Deathray = 1 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 6; + private const int maxFramesY = 8; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit = 11; + private const int firstStageDeathrayChargeFrameLimit = 23; + private const int secondStageDeathrayChargeFrameLimit = 35; + private const int finalStageDeathrayChargeFrameLimit = 47; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Total duration of the deathray telegraph + private const float deathrayTelegraphDuration = 240f; + + // Total duration of the deathray + private const float deathrayDuration = 60f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XF-09 Ares Laser Cannon"); + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 100; + npc.width = 154; + npc.height = 90; + npc.defense = 80; + npc.DR_NERD(0.25f); + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameX); + writer.Write(frameY); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + return; + } + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Phases + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // Target variable + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + + 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; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + + // Passive phase check + bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + + // Adjust opacity + bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Variable to fire normal lasers + bool fireNormalLasers = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; + + // Rotate the cannon to look at the target while not firing the beam + // Rotate the cannon to look in the direction it will fire only while it's charging or while it's firing + // Rotation + bool horizontalLaserSweep = calamityGlobalNPC.newAI[3] == 0f; + float rateOfRotation = AIState == (int)Phase.Deathray ? 0.08f : 0.04f; + Vector2 lookAt = AIState == (int)Phase.Deathray && !fireNormalLasers ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + 1000f, npc.Center.Y)) : player.Center; + + 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); + + // Direction + int direction = Math.Sign(((AIState == (int)Phase.Deathray && !horizontalLaserSweep) || fireNormalLasers ? lookAt.X : player.Center.X) - npc.Center.X); + if (direction != 0) + { + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Light + Lighting.AddLight(npc.Center, 0.25f, 0.1f, 0.1f); + + // Default vector to fly to + Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 16f * baseVelocityMult; + float baseAcceleration = 1f; + if (berserk) + { + baseVelocity *= 1.5f; + baseAcceleration *= 1.5f; + } + + 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; + + // Gate values + float deathrayPhaseGateValue = 420f; + if (lastMechAlive) + deathrayPhaseGateValue *= 0.7f; + else if (berserk) + deathrayPhaseGateValue *= 0.85f; + + float deathrayPhaseVelocity = passivePhase ? 12f : 15f; + if (lastMechAlive) + deathrayPhaseVelocity *= 1.2f; + else if (berserk) + deathrayPhaseVelocity *= 1.1f; + + // Variable to disable deathray firing + bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && fireNormalLasers); + if (doNotFire) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + } + + // Attacking phases + switch ((int)AIState) + { + // Do nothing, rotate to aim at the target and fly in place + case (int)Phase.Nothing: + + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= deathrayPhaseGateValue) + { + AIState = (float)Phase.Deathray; + calamityGlobalNPC.newAI[1] = 0f; + } + + break; + + // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays + case (int)Phase.Deathray: + + if (!targetDead) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + + // Set frames to deathray charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + } + } + else + { + // Fire regular Thanatos lasers if Ares is in deathray phase, otherwise, fire deathray + if (fireNormalLasers) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + + // Fire a Thanatos laser + int numLasers = lastMechAlive ? 3 : 2; + float divisor = deathrayDuration / numLasers; + + if (calamityGlobalNPC.newAI[2] % divisor == 0f) + { + 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); + Vector2 offset = laserVelocity * 70f + Vector2.UnitY * 16f; + Projectile.NewProjectile(npc.Center + offset, player.Center, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + else + { + // Two possible variants: 1 - Horizontal, 2 - Vertical + + // Movement while firing deathray + if (horizontalLaserSweep) + desiredVelocity.X = 0f; + else + desiredVelocity.Y = 0f; + + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); + npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity); + + // Fire deathray + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + 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 laserVelocity = Vector2.Normalize(lookAt - source); + if (laserVelocity.HasNaNs()) + laserVelocity = -Vector2.UnitY; + + Projectile.NewProjectile(source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + // Reset + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; + + // Change deathray sweep type for next deathray phase + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] > 1f) + calamityGlobalNPC.newAI[3] = 0f; + + npc.TargetClosest(); + } + } + + break; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override void FindFrame(int frameHeight) + { + // Use telegraph frames when using deathrays + npc.frameCounter += 1D; + if (AIState == (float)Phase.Nothing) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 36, the start of the deathray firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) + frameX = frameY = 4; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + Vector2 center = npc.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool PreNPCLoot() => false; + + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.png b/NPCs/ExoMechs/Ares/AresLaserCannon.png new file mode 100644 index 0000000000..46dad813bc Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresLaserCannon.png differ diff --git a/NPCs/ExoMechs/Ares/AresLaserCannonGlow.png b/NPCs/ExoMechs/Ares/AresLaserCannonGlow.png new file mode 100644 index 0000000000..be549f27bb Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresLaserCannonGlow.png differ diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs new file mode 100644 index 0000000000..20dfd7a411 --- /dev/null +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -0,0 +1,472 @@ +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Ares +{ + //[AutoloadBossHead] + public class AresPlasmaFlamethrower : ModNPC + { + public enum Phase + { + Nothing = 0, + PlasmaBolts = 1 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 6; + private const int maxFramesY = 8; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit = 11; + private const int firstStagePlasmaBoltChargeFrameLimit = 23; + private const int secondStagePlasmaBoltChargeFrameLimit = 35; + private const int finalStagePlasmaBoltChargeFrameLimit = 47; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Total duration of the plasma bolt telegraph + private const float plasmaBoltTelegraphDuration = 240f; + + // Total duration of the plasma bolt firing phase + private const float plasmaBoltDuration = 120f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XF-09 Ares Plasma Cannon"); + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 100; + npc.width = 152; + npc.height = 90; + npc.defense = 80; + npc.DR_NERD(0.25f); + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameX); + writer.Write(frameY); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + return; + } + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Phases + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // Target variable + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + + 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; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + + // Passive phase check + bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + + // Adjust opacity + bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Predictiveness + float predictionAmt = malice ? 20f : death ? 15f : revenge ? 12.5f : expertMode ? 10f : 5f; + if (passivePhase) + predictionAmt *= 0.5f; + + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + float projectileVelocity = passivePhase ? 9.6f : 12f; + if (lastMechAlive) + projectileVelocity *= 1.2f; + else if (berserk) + projectileVelocity *= 1.1f; + + float rateOfRotation = AIState == (int)Phase.PlasmaBolts ? 0.08f : 0.04f; + Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; + + float rotation = (float)Math.Atan2(lookAt.Y, lookAt.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); + + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Light + Lighting.AddLight(npc.Center, 0.1f, 0.25f, 0.05f); + + // Default vector to fly to + Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f); + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 16f * baseVelocityMult; + if (berserk) + baseVelocity *= 1.5f; + + Vector2 distanceFromDestination = destination - npc.Center; + + // Distance where Ares Plasma Arm stops moving + float movementDistanceGateValue = 50f; + + // Gate values + bool fireMoreBolts = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; + float plasmaBoltPhaseGateValue = fireMoreBolts ? 90f : 210f; + if (lastMechAlive) + plasmaBoltPhaseGateValue *= 0.7f; + else if (berserk) + plasmaBoltPhaseGateValue *= 0.85f; + + // Variable to cancel plasma bolt firing + bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays); + if (doNotFire) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + } + + // Attacking phases + switch ((int)AIState) + { + // Do nothing and fly in place + case (int)Phase.Nothing: + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= plasmaBoltPhaseGateValue) + { + AIState = (float)Phase.PlasmaBolts; + calamityGlobalNPC.newAI[1] = 0f; + } + + break; + + // Fire plasma bolts in a double burst that burst into a halo of smaller bolts + case (int)Phase.PlasmaBolts: + + if (!targetDead) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < plasmaBoltTelegraphDuration) + { + // Set frames to plasma orb charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + } + } + else + { + // Fire plasma bolts + int numPlasmaBolts = lastMechAlive ? 3 : 2; + float divisor = plasmaBoltDuration / numPlasmaBolts; + + if (calamityGlobalNPC.newAI[2] % divisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.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); + Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; + Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + } + } + } + + if (calamityGlobalNPC.newAI[2] >= plasmaBoltTelegraphDuration + plasmaBoltDuration) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + } + + break; + } + + // Movement + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override void FindFrame(int frameHeight) + { + // Use telegraph frames when using plasma bolts + npc.frameCounter += 1D; + if (AIState == (float)Phase.Nothing) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 36, the start of the plasma bolt firing animation loop + if ((frameX * maxFramesY) + frameY > finalStagePlasmaBoltChargeFrameLimit) + frameX = frameY = 4; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + Vector2 center = npc.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool PreNPCLoot() => false; + + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.png b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.png new file mode 100644 index 0000000000..a3e922c737 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.png differ diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow.png b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow.png new file mode 100644 index 0000000000..f3d1061106 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow.png differ diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs new file mode 100644 index 0000000000..8b9d847609 --- /dev/null +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -0,0 +1,473 @@ +using CalamityMod.Events; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Ares +{ + //[AutoloadBossHead] + public class AresTeslaCannon : ModNPC + { + public enum Phase + { + Nothing = 0, + TeslaOrbs = 1 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 6; + private const int maxFramesY = 8; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit = 11; + private const int firstStageTeslaOrbChargeFrameLimit = 23; + private const int secondStageTeslaOrbChargeFrameLimit = 35; + private const int finalStageTeslaOrbChargeFrameLimit = 47; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Total duration of the tesla orb telegraph + private const float teslaOrbTelegraphDuration = 240f; + + // Total duration of the tesla orb firing phase + private const float teslaOrbDuration = 120f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XF-09 Ares Tesla Cannon"); + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 100; + npc.width = 172; + npc.height = 108; + npc.defense = 80; + npc.DR_NERD(0.25f); + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameX); + writer.Write(frameY); + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameX = reader.ReadInt32(); + frameY = reader.ReadInt32(); + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + return; + } + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Phases + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // Target variable + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + + 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; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[2]].Calamity(); + + // Passive phase check + bool passivePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.Passive; + + // Adjust opacity + bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Predictiveness + float predictionAmt = malice ? 40f : death ? 30f : revenge ? 25f : expertMode ? 20f : 10f; + if (passivePhase) + predictionAmt *= 0.5f; + + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + float projectileVelocity = passivePhase ? 7.2f : 9f; + if (lastMechAlive) + projectileVelocity *= 1.2f; + else if (berserk) + projectileVelocity *= 1.1f; + + float rateOfRotation = AIState == (int)Phase.TeslaOrbs ? 0.08f : 0.04f; + Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; + + float rotation = (float)Math.Atan2(lookAt.Y, lookAt.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); + + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } + + // Light + Lighting.AddLight(npc.Center, 0.1f, 0.25f, 0.25f); + + // Default vector to fly to + Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f); + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 16f * baseVelocityMult; + if (berserk) + baseVelocity *= 1.5f; + + Vector2 distanceFromDestination = destination - npc.Center; + + // Distance where Ares Tesla Arm stops moving + float movementDistanceGateValue = 50f; + + // Gate values + bool fireMoreOrbs = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; + float teslaOrbPhaseGateValue = fireMoreOrbs ? 90f : 210f; + if (lastMechAlive) + teslaOrbPhaseGateValue *= 0.7f; + else if (berserk) + teslaOrbPhaseGateValue *= 0.85f; + + // Variable to cancel tesla orb firing + bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays); + if (doNotFire) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + } + + // Attacking phases + switch ((int)AIState) + { + // Do nothing and fly in place + case (int)Phase.Nothing: + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= teslaOrbPhaseGateValue) + { + AIState = (float)Phase.TeslaOrbs; + calamityGlobalNPC.newAI[1] = 0f; + } + + break; + + // Fire tesla orbs in a quadruple burst that arc electricity between them + case (int)Phase.TeslaOrbs: + + if (!targetDead) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < teslaOrbTelegraphDuration) + { + // Set frames to tesla orb charge up frames, which begin on frame 12 + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Reset the frame counter + npc.frameCounter = 0D; + + // X = 1 sets to frame 8 + frameX = 1; + + // Y = 4 sets to frame 12 + frameY = 4; + } + } + else + { + // Fire tesla orbs + int numTeslaOrbs = lastMechAlive ? 6 : berserk ? 5 : 4; + float divisor = teslaOrbDuration / numTeslaOrbs; + + if (calamityGlobalNPC.newAI[2] % divisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.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); + Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; + float identity = (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; + Projectile.NewProjectile(npc.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); + } + } + } + + if (calamityGlobalNPC.newAI[2] >= teslaOrbTelegraphDuration + teslaOrbDuration) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + } + + break; + } + + // Movement + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override void FindFrame(int frameHeight) + { + // Use telegraph frames when using tesla orbs + npc.frameCounter += 1D; + if (AIState == (float)Phase.Nothing) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 8 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames to frame 36, the start of the tesla orb firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageTeslaOrbChargeFrameLimit) + frameX = frameY = 4; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + Vector2 center = npc.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); + + return false; + } + + public override bool PreNPCLoot() => false; + + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.png b/NPCs/ExoMechs/Ares/AresTeslaCannon.png new file mode 100644 index 0000000000..7fcfe38bda Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresTeslaCannon.png differ diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannonGlow.png b/NPCs/ExoMechs/Ares/AresTeslaCannonGlow.png new file mode 100644 index 0000000000..5e38962b26 Binary files /dev/null and b/NPCs/ExoMechs/Ares/AresTeslaCannonGlow.png differ diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs new file mode 100644 index 0000000000..c0e62e2820 --- /dev/null +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -0,0 +1,1009 @@ +using CalamityMod.Events; +using CalamityMod.Items.Potions; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Artemis +{ + //[AutoloadBossHead] + public class Artemis : ModNPC + { + public enum Phase + { + Normal = 0, + Charge = 1, + LaserShotgun = 2, + Deathray = 3, + PhaseTransition = 4 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + public enum SecondaryPhase + { + Nothing = 0, + Passive = 1, + PassiveAndImmune = 2 + } + + public float SecondaryAIState + { + get => npc.Calamity().newAI[1]; + set => npc.Calamity().newAI[1] = value; + } + + // The vector used for charging + private Vector2 chargeVelocityNormalized = default; + + // Number of frames on the X and Y axis + private const int maxFramesX = 10; + private const int maxFramesY = 9; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit_Phase1 = 9; + private const int chargeUpFrameLimit_Phase1 = 19; + private const int attackFrameLimit_Phase1 = 29; + private const int phaseTransitionFrameLimit = 59; // The lens pops off on frame 37 + private const int normalFrameLimit_Phase2 = 69; + private const int chargeUpFrameLimit_Phase2 = 79; + private const int attackFrameLimit_Phase2 = 89; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 2800f; + + // Normal animation duration + private const float defaultAnimationDuration = 100f; + + // Total duration of attack telegraphs + private const float attackTelegraphDuration = 100f; + + // Total duration of the phase transition + private const float phaseTransitionDuration = 300f; + + // Where the timer should be when the lens pops off + private const float lensPopTime = 80f; + + // Total duration of the deathray telegraph + private const float deathrayTelegraphDuration = 60f; + + // Total duration of the deathray + private const float deathrayDuration = 180f; + + // Variable to pick a different location after each attack + private bool pickNewLocation = false; + + // The direction to spin in during spin phases + private int rotationDirection = 0; + + // The point to spin around + private Vector2 spinningPoint = default; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XS-01 Artemis"); + } + + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + 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]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = 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(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.draedonExoMechTwinRed = npc.whoAmI; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + bool exoWormAlive = false; + bool exoPrimeAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + { + otherExoMechsAlive++; + exoWormAlive = true; + } + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { + // Link the HP of both twins + if (npc.life > Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life) + npc.life = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life; + } + } + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + otherExoMechsAlive++; + exoPrimeAlive = true; + } + } + + // Percent life remaining + 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; + float exoPrimeLifeRatio = defaultLifeRatio; + if (exoWormAlive) + exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax; + if (exoPrimeAlive) + exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoPrimeLifeRatio; + + // Check if any of the other mechs are passive + bool exoWormPassive = false; + bool exoPrimePassive = false; + if (exoWormAlive) + exoWormPassive = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive; + if (exoPrimeAlive) + exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; + bool anyOtherExoMechPassive = exoWormPassive || exoPrimePassive; + + // Phases + bool phase2 = lifeRatio < 0.6f; + bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // If Artemis and Apollo don't go berserk + bool otherMechIsBerserk = exoWormLifeRatio < 0.4f || exoPrimeLifeRatio < 0.4f; + + // Get a target + 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(); + + // Target variable + Player player = Main.player[npc.target]; + + // Spawn Apollo if it doesn't exist after the first 10 frames have passed + if (npc.ai[0] < 10f) + { + npc.ai[0] += 1f; + if (npc.ai[0] == 10f && !NPC.AnyNPCs(ModContent.NPCType())) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Normal; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + rotationDirection = 0; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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].active = false; + } + } + } + } + + // General AI pattern + // 0 - Fly to the left of the target and fire lasers when ready + // 1 - Create a laser telegraph and charge extremely fast, this attack is replaced by a spread pattern of lasers in phase 2 + // 2 - Fly above the target, charge up and fire a deathray while moving in a clockwise or counterclockwise circle around the target's original position when the attack started + // 3 - Go passive and fly to the left of the target while firing less projectiles + // 4 - Go passive, immune and invisible; fly far to the left of the target and do nothing until next phase + + // Attack patterns + // If spawned first + // Phase 1 - 0, 1 + // Phase 2 - 4 + // Phase 3 - 3 + + // If berserk, this is the last phase of Artemis and Apollo + // Phase 4 - 0, 1, 2 + + // If not berserk + // Phase 4 - 4 + // Phase 5 - 0, 1 + + // If berserk, this is the last phase of Artemis and Apollo + // Phase 6 - 0, 1, 2 + + // If not berserk + // Phase 6 - 4 + + // Berserk, final phase of Artemis and Apollo + // Phase 7 - 0, 1, 2 + + // Adjust opacity + bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase || AIState == (float)Phase.PhaseTransition; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Predictiveness + float predictionAmt = malice ? 20f : death ? 15f : revenge ? 12.5f : expertMode ? 10f : 5f; + if (SecondaryAIState == (float)SecondaryPhase.Passive) + predictionAmt *= 0.5f; + + Vector2 predictionVector = AIState == (float)Phase.Deathray ? Vector2.Zero : player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + // Gate values + float attackPhaseGateValue = lastMechAlive ? 300f : 480f; + float timeToLineUpAttack = lastMechAlive ? 60f : 90f; + float deathrayPhaseGateValue = lastMechAlive ? 630f : 900f; + + // Spin variables + float spinRadius = 500f; + float spinLocationDistance = 50f; + + // Distance where Artemis stops moving + float movementDistanceGateValue = 100f; + + // Charge velocity + float chargeVelocity = malice ? 60f : death ? 50f : revenge ? 45f : expertMode ? 40f : 30f; + float chargeDistance = 1800f; + float chargeDuration = chargeDistance / chargeVelocity; + + // Laser shotgun variables + float laserShotgunDuration = lastMechAlive ? 45f : 60f; + + // Rotation + bool stopRotatingAndSlowDown = !phase2 && AIState == (float)Phase.Normal && calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; + if (!stopRotatingAndSlowDown) + { + if (AIState == (int)Phase.Charge) + { + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + } + else if (spinningPoint != default) + { + 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; + npc.rotation = (float)Math.Atan2(y, x) + MathHelper.PiOver2; + } + } + + // Light + Lighting.AddLight(npc.Center, 0.25f, 0.15f, 0.05f); + + // 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.netUpdate = true; + } + + // Default vector to fly to + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X - 1200f, player.Center.Y) : AIState == (float)Phase.Deathray ? new Vector2(player.Center.X, player.Center.Y - spinRadius) : new Vector2(player.Center.X - 750f, player.Center.Y); + + // 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]; + } + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 14f * baseVelocityMult; + float baseAcceleration = 1f; + float decelerationVelocityMult = 0.85f; + if (berserk) + { + baseVelocity *= 1.5f; + baseAcceleration *= 1.5f; + } + Vector2 distanceFromDestination = destination - npc.Center; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; + + // Set to transition to phase 2 if it hasn't happened yet + if (phase2 && npc.localAI[3] == 0f) + { + AIState = (float)Phase.PhaseTransition; + npc.localAI[3] = 1f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + } + + // Passive and Immune phases + switch ((int)SecondaryAIState) + { + case (int)SecondaryPhase.Nothing: + + // Spawn the other mechs if Artemis and Apollo are first + // Note: Only Apollo spawns the mechs because the twins HP values are linked + if (otherExoMechsAlive == 0) + { + if (spawnOtherExoMechs) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + } + else + { + // If not spawned first, go to passive state if any other mech is passive or if Artemis and Apollo are under 70% life + // Do not run this if berserk + // Do not run this if any exo mech is dead + if ((anyOtherExoMechPassive || lifeRatio < 0.7f) && !berserk && totalOtherExoMechLifeRatio < 5f) + { + // Tells Artemis to return to the battle in passive state and reset everything + SecondaryAIState = (float)SecondaryPhase.Passive; + npc.TargetClosest(); + } + + // Go passive and immune if one of the other mechs is berserk + // This is only called if two exo mechs are alive + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + } + + break; + + // Fire projectiles less often + case (int)SecondaryPhase.Passive: + + // Enter passive and invincible phase if one of the other exo mechs is berserk + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.TargetClosest(); + } + + // If Artemis and Apollo are the first mechs to go berserk + if (berserk) + { + // Reset everything + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + + // Fly above target and become immune + case (int)SecondaryPhase.PassiveAndImmune: + + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk + if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) + { + // 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.TargetClosest(); + } + + if (berserk) + { + // Reset everything + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + } + + // Attacking phases + switch ((int)AIState) + { + // Fly to the left of the target + case (int)Phase.Normal: + + if (!targetDead) + { + if (!stopRotatingAndSlowDown) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + else + { + if (chargeVelocityNormalized == default) + chargeVelocityNormalized = Vector2.Normalize(npc.velocity); + + npc.velocity *= decelerationVelocityMult; + } + } + + // Default animation for 100 frames and then go to telegraph animation + // newAI[3] tells Artemis what animation state it's currently in + bool attacking = calamityGlobalNPC.newAI[3] >= 2f; + bool firingLasers = attacking && calamityGlobalNPC.newAI[3] + 2f < attackPhaseGateValue; + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= defaultAnimationDuration || attacking) + { + if (firingLasers) + { + // Fire lasers + int numLasers = lastMechAlive ? 15 : 12; + float divisor = attackPhaseGateValue / numLasers; + float laserTimer = calamityGlobalNPC.newAI[3] - 2f; + if (laserTimer % divisor == 0f) + { + pickNewLocation = true; + 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(rotationVector); + Vector2 projectileDestination = player.Center + player.velocity * predictionAmt; + Vector2 offset = laserVelocity * 70f; + Projectile.NewProjectile(npc.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + else + calamityGlobalNPC.newAI[2] = 0f; + + // Enter charge phase after a certain time has passed + // This is replaced by a laser shotgun in phase 2 + // Enter deathray phase if in phase 2 and the localAI[2] variable is set to do so + calamityGlobalNPC.newAI[3] += 1f; + bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; + if (lineUpAttack) + { + // Draw a large laser telegraph for the charge + if (!phase2 && calamityGlobalNPC.newAI[3] == attackPhaseGateValue + 2f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + /*int type = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + Vector2 laserVelocity = Vector2.Normalize(rotationVector); + Vector2 projectileDestination = player.Center + player.velocity * predictionAmt; + Vector2 offset = laserVelocity * 70f; + Projectile.NewProjectile(npc.Center + offset, projectileDestination, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI);*/ + } + } + + bool doAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; + if (doAttack) + { + if (phase2) + { + 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 + AIState = (float)Phase.Charge; + npc.velocity = chargeVelocityNormalized * chargeVelocity; + } + } + } + } + + break; + + // Charge + case (int)Phase.Charge: + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= chargeDuration) + { + npc.velocity *= decelerationVelocityMult; + + if (calamityGlobalNPC.newAI[2] >= chargeDuration + 20f) + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); + } + } + + break; + + // Laser shotgun barrage + case (int)Phase.LaserShotgun: + + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + + // Fire lasers + int numSpreads = lastMechAlive ? 3 : 2; + int numLasersPerSpread = lastMechAlive ? 8 : 6; + float divisor2 = laserShotgunDuration / numSpreads; + if (calamityGlobalNPC.newAI[2] % divisor2 == 0f) + { + pickNewLocation = true; + 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(rotationVector); + int spread = 3 + (int)(calamityGlobalNPC.newAI[2] / divisor2) * 3; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < numLasersPerSpread + 1; i++) + { + Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numLasersPerSpread - 1))); + Vector2 offset = Vector2.Normalize(perturbedSpeed) * 70f; + Projectile.NewProjectile(npc.Center + offset, player.Center + perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= laserShotgunDuration) + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[2] = berserk ? 1f : 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); + } + + break; + + // Fly above target, fire deathray and move in a circle around the target + case (int)Phase.Deathray: + + // Fly above, stop doing this if in the proper position + if (!targetDead) + { + // Stop rotating and spin around a target point + if ((destination - npc.Center).Length() < spinLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + // Draw telegraph for deathray + if (calamityGlobalNPC.newAI[2] == 0f) + { + npc.velocity = Vector2.Zero; + spinningPoint = npc.Center + Vector2.UnitY * spinRadius; + 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); + Vector2 offset = laserVelocity * 70f; + Projectile.NewProjectile(npc.Center + offset, spinningPoint, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI);*/ + } + npc.netUpdate = true; + } + + // Fire deathray and spin + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration) + { + if (rotationDirection == 0) + { + // Set spin direction + if (Main.player[npc.target].velocity.X > 0f) + rotationDirection = 1; + else if (Main.player[npc.target].velocity.X < 0f) + rotationDirection = -1; + else + rotationDirection = player.direction; + + // Set spin velocity + npc.velocity.X = MathHelper.Pi * spinRadius / baseVelocity; + npc.velocity *= -rotationDirection; + npc.netUpdate = true; + + // Fire deathray + if (Main.netMode != NetmodeID.MultiplayerClient) + { + /*int type = ModContent.ProjectileType(); + 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;*/ + } + } + else + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / baseVelocity * -rotationDirection); + } + } + else + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + } + + // Reset phase and variables + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + rotationDirection = 0; + spinningPoint = default; + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); + } + + break; + + // Phase transition animation, that's all this exists for + case (int)Phase.PhaseTransition: + + if (!targetDead) + { + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = baseVelocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + } + + // Shoot lens gore at the target at the proper time + if (calamityGlobalNPC.newAI[2] == lensPopTime) + { + Vector2 goreVelocity = Vector2.Normalize(rotationVector); + Vector2 offset = goreVelocity * 70f; + Gore.NewGore(npc.Center + offset, goreVelocity * 24f, mod.GetGoreSlot("Gores/Artemis/ArtemisTransitionGore"), 1f); + } + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= phaseTransitionDuration) + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; + } + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 2f; + return null; + } + + public override void FindFrame(int frameHeight) + { + // Use telegraph frames before each attack + bool phase2 = npc.life / (float)npc.lifeMax < 0.6f; + npc.frameCounter += 1D; + if (AIState == (float)Phase.PhaseTransition) + { + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 9 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + } + } + else + { + if (AIState == (float)Phase.Normal) + { + int frameLimit = npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1; + if (phase2) + frameLimit += 60; + + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the frames + int currentFrame = (frameX * maxFramesY) + frameY; + if (currentFrame > frameLimit) + { + frameX = (currentFrame / (maxFramesY + 1)) - 1; + frameY = 0; + } + } + } + else if (AIState == (float)Phase.Charge || AIState == (float)Phase.LaserShotgun || AIState == (float)Phase.Deathray) + { + int frameLimit = attackFrameLimit_Phase1; + if (phase2) + frameLimit += 60; + + if (npc.frameCounter >= 10D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the frames + int currentFrame = (frameX * maxFramesY) + frameY; + if (currentFrame > frameLimit) + { + frameX = (currentFrame / (maxFramesY + 1)) - 1; + frameY = 0; + } + } + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + 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); + 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/Artemis/ArtemisGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ModContent.ItemType(); + } + + // Needs edits + public override void NPCLoot() + { + /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); + + // Check if the other exo mechs are alive + bool otherExoMechsAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + otherExoMechsAlive = true; + } + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + otherExoMechsAlive = true; + } + + // Mark Exo Mechs as dead + if (!otherExoMechsAlive) + { + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + }*/ + } + + // 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); + + 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); + } + 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); + 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); + 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);*/ + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + } +} diff --git a/NPCs/ExoMechs/Artemis/Artemis.png b/NPCs/ExoMechs/Artemis/Artemis.png new file mode 100644 index 0000000000..3dd4284440 Binary files /dev/null and b/NPCs/ExoMechs/Artemis/Artemis.png differ diff --git a/NPCs/ExoMechs/Artemis/ArtemisGlow.png b/NPCs/ExoMechs/Artemis/ArtemisGlow.png new file mode 100644 index 0000000000..bdb7078d12 Binary files /dev/null and b/NPCs/ExoMechs/Artemis/ArtemisGlow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs new file mode 100644 index 0000000000..fe8266beeb --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -0,0 +1,569 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + public class ThanatosBody1 : ModNPC + { + // Whether the body is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(vulnerable); + 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]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + vulnerable = 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(); + } + + 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.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; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + // Set vulnerable to false by default + vulnerable = false; + + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Set timer to whoAmI so that segments don't all fire lasers at the same time + if (npc.localAI[2] == 0f) + npc.localAI[2] = npc.ai[0]; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Set the AI to become more aggressive if head is berserk + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootLasers && !invisiblePhase) + { + 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 (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) + { + float divisor = 120f; + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); + for (int i = 0; i < numProjectiles; i++) + { + // 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); + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + else + { + // This is only used in deathray phase to prevent laser spam + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = 5D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + + npc.ai[3] += 1f; + float shootProjectile = 120f; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.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); + } + else + { + // Normal laser + if (malice && berserk) + 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); + + // Opposite laser + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + } + } + else + { + // Set alternating laser-firing body segments every 3 seconds + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + } + + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + else + { + // Body is vulnerable while venting + vulnerable = true; + } + } + + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + npc.Calamity().newAI[2] += 1f; + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.9999f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + SmokeDrawer.ParticleSpawnRate = 9999999; + if (vulnerable) + { + // Light + Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + + // Noise + float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; + if (npc.localAI[0] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); + + // Steam + npc.localAI[0] += 1f; + if (npc.localAI[0] < ThanatosHead.ventDuration) + { + SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; + } + } + else + { + // Light + Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + + npc.localAI[0] = 0f; + } + + SmokeDrawer.Update(); + + 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; + vector18.Y = (int)(vector18.Y / 16f) * 16; + 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) + { + 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; + } catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + 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; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 50f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + damage *= 0.01; + + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + 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 (shootLasers && !invisiblePhase) + { + if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) + { + if (npc.frameCounter >= 10D) + { + 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; + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + 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) + 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); + + 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); + + SmokeDrawer.DrawSet(npc.Center); + + return false; + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) + { + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.png b/NPCs/ExoMechs/Thanatos/ThanatosBody1.png new file mode 100644 index 0000000000..a1bbe33f52 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosBody1.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow.png b/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow.png new file mode 100644 index 0000000000..74f921332d Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs new file mode 100644 index 0000000000..48b7893c8c --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -0,0 +1,569 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + public class ThanatosBody2 : ModNPC + { + // Whether the body is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(vulnerable); + 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]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + vulnerable = 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(); + } + + 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.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; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + // Set vulnerable to false by default + vulnerable = false; + + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Set timer to whoAmI so that segments don't all fire lasers at the same time + if (npc.localAI[2] == 0f) + npc.localAI[2] = npc.ai[0]; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Set the AI to become more aggressive if head is berserk + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootLasers && !invisiblePhase) + { + 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 (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) + { + float divisor = 120f; + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); + for (int i = 0; i < numProjectiles; i++) + { + // 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); + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + else + { + // This is only used in deathray phase to prevent laser spam + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = 5D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + + npc.ai[3] += 1f; + float shootProjectile = 120f; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.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); + } + else + { + // Normal laser + if (malice && berserk) + 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); + + // Opposite laser + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + } + } + else + { + // Set alternating laser-firing body segments every 3 seconds + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + } + + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + else + { + // Body is vulnerable while venting + vulnerable = true; + } + } + + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + npc.Calamity().newAI[2] += 1f; + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.9999f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + SmokeDrawer.ParticleSpawnRate = 9999999; + if (vulnerable) + { + // Light + Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + + // Noise + float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; + if (npc.localAI[0] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); + + // Steam + npc.localAI[0] += 1f; + if (npc.localAI[0] < ThanatosHead.ventDuration) + { + SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; + } + } + else + { + // Light + Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + + npc.localAI[0] = 0f; + } + + SmokeDrawer.Update(); + + 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; + vector18.Y = (int)(vector18.Y / 16f) * 16; + 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) + { + 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; + } catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + 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; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 50f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + damage *= 0.01; + + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + 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 (shootLasers && !invisiblePhase) + { + if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) + { + if (npc.frameCounter >= 10D) + { + 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; + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + 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) + 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); + + 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); + + SmokeDrawer.DrawSet(npc.Center); + + return false; + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) + { + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.png b/NPCs/ExoMechs/Thanatos/ThanatosBody2.png new file mode 100644 index 0000000000..eb178bfffc Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosBody2.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow.png b/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow.png new file mode 100644 index 0000000000..34dc02d5b3 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs new file mode 100644 index 0000000000..19aad7eda9 --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -0,0 +1,951 @@ +using CalamityMod.Events; +using CalamityMod.Items.Potions; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + //[AutoloadBossHead] + public class ThanatosHead : ModNPC + { + public enum Phase + { + Charge = 0, + UndergroundLaserBarrage = 1, + Deathray = 2 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + public enum SecondaryPhase + { + Nothing = 0, + Passive = 1, + PassiveAndImmune = 2 + } + + public float SecondaryAIState + { + get => npc.Calamity().newAI[1]; + set => npc.Calamity().newAI[1] = value; + } + + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + + // Invincibility time for the first 10 seconds + public const float immunityTime = 600f; + + // Whether the head is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + + // Max time in vent phase + public const float ventDuration = 180f; + + // Spawn rate for vent clouds + public const int ventCloudSpawnRate = 5; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Base distance from the target for most attacks + private const float baseDistance = 800f; + + // Base distance from target location in order to continue turning + private const float baseTurnDistance = 160f; + + // Max distance from the target before they are unable to hear sound telegraphs + private const float soundDistance = 2800f; + + // Length variables + public const int minLength = 100; + private const int maxLength = 101; + + // Variable used to stop the segment spawning loop + private bool tailSpawned = false; + + // Used in the lerp to smoothly scale velocity up and down + private float chargeVelocityScalar = 0f; + + // Total duration of the deathray telegraph + private const float deathrayTelegraphDuration = 180f; + + // Total duration of the deathray + private const float deathrayDuration = 180f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + Main.npcFrameCount[npc.type] = 5; + } + + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + npc.chaseable = false; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + 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]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + 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(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + CalamityGlobalNPC.draedonExoMechWorm = npc.whoAmI; + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + bool exoPrimeAlive = false; + bool exoTwinsAlive = false; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + otherExoMechsAlive++; + exoPrimeAlive = true; + } + } + + // There is no need in checking for the other twin because they have linked HP + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { + otherExoMechsAlive++; + exoTwinsAlive = true; + } + } + + // These are 5 by default to avoid triggering passive phases after the other mechs are dead + float exoPrimeLifeRatio = defaultLifeRatio; + float exoTwinsLifeRatio = defaultLifeRatio; + if (exoPrimeAlive) + exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + if (exoTwinsAlive) + exoTwinsLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax; + float totalOtherExoMechLifeRatio = exoPrimeLifeRatio + exoTwinsLifeRatio; + + // Check if any of the other mechs are passive + bool exoPrimePassive = false; + bool exoTwinsPassive = false; + if (exoPrimeAlive) + exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[1] == (float)AresBody.SecondaryPhase.Passive; + if (exoTwinsAlive) + exoTwinsPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] == (float)Apollo.Apollo.SecondaryPhase.Passive; + bool anyOtherExoMechPassive = exoPrimePassive || exoTwinsPassive; + + // Phases + bool spawnOtherExoMechs = lifeRatio > 0.4f && otherExoMechsAlive == 0 && lifeRatio < 0.7f; + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + bool lastMechAlive = berserk && otherExoMechsAlive == 0; + + // Set vulnerable to false by default + vulnerable = false; + + // If Thanatos doesn't go berserk + bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoTwinsLifeRatio < 0.4f; + + // Get a target + 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(); + + // Target variable + Player player = Main.player[npc.target]; + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Spawn segments + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!tailSpawned && npc.ai[0] == 0f) + { + 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); + else + 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); + + 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); + Previous = lol; + } + tailSpawned = true; + } + } + + if (npc.life > Main.npc[(int)npc.ai[0]].life) + npc.life = Main.npc[(int)npc.ai[0]].life; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + 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() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + } + } + } + + // 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 + // 1 - Fly underneath the target and fire barrages of lasers + // 2 - Fire deathray from mouth with a telegraph similar to the railgun from enter the gungeon, turn speed is very low during this to avoid cheap hits + // 3 - Go passive and fly underneath the target while firing lasers + // 4 - Go passive, immune and invisible; fly far underneath the target and do nothing until next phase + + // Attack patterns + // If spawned first + // Phase 1 - 0, 1, 0, 2 + // Phase 2 - 4 + // Phase 3 - 3 + + // If berserk, this is the last phase of thanatos + // Phase 4 - 0, 1, 0, 2 + + // If not berserk + // Phase 4 - 4 + // Phase 5 - 0, 1, 0, 2 + + // If berserk, this is the last phase of thanatos + // Phase 6 - 0, 1, 0, 2 + + // If not berserk + // Phase 6 - 4 + + // Berserk, final phase of Thanatos + // Phase 7 - 0, 1, 0, 2 + + // Phase gate values + float velocityAdjustTime = 20f; + float speedUpTime = lastMechAlive ? 270f : berserk ? 360f : 480f; + float slowDownTime = lastMechAlive ? 60f : berserk ? 90f : 120f; + float chargePhaseGateValue = speedUpTime + slowDownTime; + float laserBarrageDuration = lastMechAlive ? 285f : berserk ? 330f : 420f; + + // Adjust opacity + bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + 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; + + // Default vector to fly to + Vector2 destination = player.Center; + + // Charge variables + float turnDistance = baseTurnDistance; + float chargeLocationDistance = turnDistance * 0.2f; + + // Laser Barrage variables + float laserBarrageLocationBaseDistance = SecondaryAIState == (int)SecondaryPhase.PassiveAndImmune ? baseDistance * 1.5f : baseDistance; + Vector2 laserBarrageLocation = new Vector2(0f, laserBarrageLocationBaseDistance); + float laserBarrageLocationDistance = turnDistance * 3f; + + // Velocity and turn speed values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 7f * baseVelocityMult; + float turnDegrees = baseVelocity * 0.11f; + if (berserk) + { + baseVelocity *= 1.5f; + turnDegrees *= 1.5f; + } + float turnSpeed = MathHelper.ToRadians(turnDegrees); + float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); + float chargeTurnSpeedMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); + float laserBarragePhaseVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); + float laserBarragePhaseTurnSpeedMult = MathHelper.Lerp(1f, 3f, chargeVelocityScalar); + float deathrayVelocityMult = MathHelper.Lerp(0.5f, 3f, chargeVelocityScalar); + float deathrayTurnSpeedMult = MathHelper.Lerp(0.5f, 3f, chargeVelocityScalar); + + // Base scale on total time spent in phase + float chargeVelocityScalarIncrement = 1f / speedUpTime; + float chargeVelocityScalarDecrement = 1f / slowDownTime; + + // Scalar to use during deathray phase + float deathrayVelocityScalarIncrement = 1f / deathrayDuration; + + // Scalar to use during laser barrage, passive and immune phases + float laserBarrageVelocityScalarIncrement = lastMechAlive ? 0.025f : berserk ? 0.02f : 0.01f; + float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; + + // Distance from target + float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + + // Passive and Immune phases + switch ((int)SecondaryAIState) + { + case (int)SecondaryPhase.Nothing: + + // Spawn the other mechs if Thanatos is first + if (otherExoMechsAlive == 0) + { + if (spawnOtherExoMechs) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + // Spawn code here + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + } + } + else + { + // If not spawned first, go to passive state if any other mech is passive or if Thanatos is under 70% life + // Do not run this if berserk + // Do not run this if any exo mech is dead + if ((anyOtherExoMechPassive || lifeRatio < 0.7f) && !berserk && totalOtherExoMechLifeRatio < 5f) + { + // 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; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + + // Go passive and immune if one of the other mechs is berserk + // This is only called if two exo mechs are alive + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + } + + break; + + // Fly underneath target and fire lasers + case (int)SecondaryPhase.Passive: + + // Fire lasers while passive + AIState = (float)Phase.UndergroundLaserBarrage; + + // Enter passive and invincible phase if one of the other exo mechs is berserk + if (otherMechIsBerserk) + { + // Reset everything + SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + + // If Thanatos is the first mech to go berserk + if (berserk) + { + // Reset everything + AIState = (float)Phase.Charge; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + + // Fly underneath target and become immune + case (int)SecondaryPhase.PassiveAndImmune: + + // Fire lasers while passive + AIState = (float)Phase.UndergroundLaserBarrage; + + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk + if ((exoPrimeLifeRatio < 0.7f || exoTwinsLifeRatio < 0.7f) && !otherMechIsBerserk) + { + // 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; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + + if (berserk) + { + // Reset everything + AIState = (float)Phase.Charge; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + + // Never be passive if berserk + SecondaryAIState = (float)SecondaryPhase.Nothing; + } + + break; + } + + // Attacking phases + switch ((int)AIState) + { + // Fly towards target and gain velocity over time + case (int)Phase.Charge: + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 0f) + { + chargeVelocityScalar += chargeVelocityScalarIncrement; + if (chargeVelocityScalar >= 1f) + { + chargeVelocityScalar = 1f; + calamityGlobalNPC.newAI[3] = 1f; + } + } + else + { + chargeVelocityScalar -= chargeVelocityScalarDecrement; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + } + + baseVelocity *= chargeVelocityMult; + turnSpeed *= chargeTurnSpeedMult; + turnDistance = chargeLocationDistance; + + // Gradually turn slower if within 20 tiles of the target + float turnSlowerDistanceGateValue = lastMechAlive ? 160f : 320f; + if (distanceFromTarget < turnSlowerDistanceGateValue) + turnSpeed *= distanceFromTarget / turnSlowerDistanceGateValue; + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue) + { + AIState = npc.localAI[0] == 1f ? (float)Phase.Deathray : (float)Phase.UndergroundLaserBarrage; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + + break; + + // Fly below and summon barrages of lasers + case (int)Phase.UndergroundLaserBarrage: + + // Fly down + destination += laserBarrageLocation; + turnDistance = laserBarrageLocationDistance; + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 0f) + { + chargeVelocityScalar += laserBarrageVelocityScalarIncrement; + if (chargeVelocityScalar > 1f) + chargeVelocityScalar = 1f; + } + + baseVelocity *= laserBarragePhaseVelocityMult; + turnSpeed *= laserBarragePhaseTurnSpeedMult; + + if ((destination - npc.Center).Length() < laserBarrageLocationDistance || calamityGlobalNPC.newAI[2] > 0f) + { + calamityGlobalNPC.newAI[2] += 1f; + + if (SecondaryAIState != (float)SecondaryPhase.Passive && SecondaryAIState != (float)SecondaryPhase.PassiveAndImmune) + { + if (calamityGlobalNPC.newAI[2] >= laserBarrageDuration) + { + // Use a lerp to smoothly scale down velocity and turn speed + chargeVelocityScalar -= laserBarrageVelocityScalarDecrement; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime) + { + npc.localAI[0] = berserk ? 1f : 0f; + AIState = (float)Phase.Charge; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + } + } + } + + break; + + // Move close to target, reduce velocity and turn speed when close enough, create telegraph beams, reduce turn speed, fire deathray + case (int)Phase.Deathray: + + // Head is vulnerable while charging and firing deathray + vulnerable = true; + + // If close enough to the target, prepare to fire deathray + float slowDownDistance = lastMechAlive ? 640f : 800f; + bool readyToFireDeathray = distanceFromTarget < slowDownDistance; + if (readyToFireDeathray) + npc.localAI[2] = 1f; + + // Use a lerp to smoothly scale up velocity and turn speed + if (calamityGlobalNPC.newAI[3] == 0f) + { + chargeVelocityScalar += deathrayVelocityScalarIncrement; + if (chargeVelocityScalar >= 1f) + { + chargeVelocityScalar = 1f; + + // If ready to fire deathray, start reducing the velocity scalar + if (npc.localAI[2] == 1f) + calamityGlobalNPC.newAI[3] = 1f; + } + } + else + { + // Reduce velocity scalar very quickly + chargeVelocityScalar -= deathrayVelocityScalarIncrement * 5f; + if (chargeVelocityScalar < 0f) + chargeVelocityScalar = 0f; + } + + baseVelocity *= deathrayVelocityMult; + turnSpeed *= deathrayTurnSpeedMult; + turnDistance = chargeLocationDistance; + + // Gradually turn and move slower if within 50 tiles of the target + if (npc.localAI[2] == 1f) + { + // Exponentially scale down velocity if close to the target + float velocityScale = distanceFromTarget / slowDownDistance; + if (velocityScale < 1f) + velocityScale *= velocityScale; + + baseVelocity *= velocityScale; + turnSpeed *= velocityScale; + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) + { + // Fire deathray telegraph beams + if (calamityGlobalNPC.newAI[2] == 1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/THanosLaser"), npc.Center); + 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); + + // 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[1] = MathHelper.Lerp(-0.74f, 0.74f, smoothenedRatio); + } + } + 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; + } + } + } + else + { + // Fire deathray + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + 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; + } + } + } + + if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) + { + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + AIState = (float)Phase.Charge; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } + } + + break; + } + + if (npc.localAI[3] < immunityTime) + npc.localAI[3] += 1f; + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.9999f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + SmokeDrawer.ParticleSpawnRate = 9999999; + if (vulnerable) + { + // Light + Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + + // Noise + if (npc.localAI[1] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); + + // Steam + npc.localAI[1] += 1f; + if (npc.localAI[1] < ventDuration) + { + SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.ParticleSpawnRate = ventCloudSpawnRate; + } + } + else + { + // Light + Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + + npc.localAI[1] = 0f; + } + + SmokeDrawer.Update(); + + 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; + + // Acceleration + if (!((destination - npc.Center).Length() < turnDistance)) + { + 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; + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 50f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (npc.localAI[3] < immunityTime) + damage *= 0.01; + + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + { + scale = 1.5f; + return null; + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + npc.frameCounter += 1D; + if (AIState == (float)Phase.Charge || AIState == (float)Phase.UndergroundLaserBarrage) + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + else + { + if (npc.frameCounter >= 10D) + { + 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; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + + 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); + + SmokeDrawer.DrawSet(npc.Center); + + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ModContent.ItemType(); + } + + public override void NPCLoot() + { + /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32); + + // Check if the other exo mechs are alive + bool otherExoMechsAlive = false; + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive = true; + } + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + otherExoMechsAlive = true; + } + + // Mark Exo Mechs as dead + if (!otherExoMechsAlive) + { + CalamityWorld.downedExoMechs = true; + CalamityNetcode.SyncWorld(); + }*/ + } + + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.png b/NPCs/ExoMechs/Thanatos/ThanatosHead.png new file mode 100644 index 0000000000..1cdc250fc9 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosHead.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png b/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png new file mode 100644 index 0000000000..477da0aa63 Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs new file mode 100644 index 0000000000..9e8e253f27 --- /dev/null +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -0,0 +1,569 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Thanatos +{ + public class ThanatosTail : ModNPC + { + // Whether the tail is venting heat or not, it is vulnerable to damage during venting + private bool vulnerable = false; + public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XM-05 Thanatos"); + 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(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + 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.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.dontCountMe = true; + npc.chaseable = false; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + writer.Write(vulnerable); + 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]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + vulnerable = 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(); + } + + 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.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; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + // Set vulnerable to false by default + vulnerable = false; + + CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); + + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Set timer to whoAmI so that segments don't all fire lasers at the same time + if (npc.localAI[2] == 0f) + npc.localAI[2] = npc.ai[0]; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + if (CalamityGlobalNPC.draedonExoMechPrime != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + otherExoMechsAlive++; + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + otherExoMechsAlive++; + } + + // Set the AI to become more aggressive if head is berserk + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage || berserk) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootLasers && !invisiblePhase) + { + 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 (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) + { + float divisor = 120f; + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); + for (int i = 0; i < numProjectiles; i++) + { + // 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); + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + else + { + // This is only used in deathray phase to prevent laser spam + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = 5D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + + npc.ai[3] += 1f; + float shootProjectile = 120f; + float timer = npc.ai[0] + 15f; + float divisor = timer + shootProjectile; + if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) + { + // Body is vulnerable while firing lasers + vulnerable = true; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.Calamity().newAI[0] += 1f; + if (npc.Calamity().newAI[0] >= 72f) + { + npc.Calamity().newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxTargets = 3; + int[] whoAmIArray = new int[maxTargets]; + Vector2[] targetCenterArray = new Vector2[maxTargets]; + int numProjectiles = 0; + float maxDistance = 2400f; + + for (int i = 0; i < Main.maxPlayers; i++) + { + if (!Main.player[i].active || Main.player[i].dead) + continue; + + Vector2 playerCenter = Main.player[i].Center; + float distance = Vector2.Distance(playerCenter, npc.Center); + if (distance < maxDistance) + { + whoAmIArray[numProjectiles] = i; + targetCenterArray[numProjectiles] = playerCenter; + int projectileLimit = numProjectiles + 1; + numProjectiles = projectileLimit; + if (projectileLimit >= targetCenterArray.Length) + break; + } + } + + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.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); + } + else + { + // Normal laser + if (malice && berserk) + 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); + + // Opposite laser + projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; + Projectile.NewProjectile(npc.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); + } + } + } + } + } + else + { + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + } + } + } + } + } + else + { + // Set alternating laser-firing body segments every 3 seconds + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 180f) + { + npc.localAI[1] = 0f; + npc.localAI[2] += 1f; + } + + npc.Calamity().newAI[0] -= 1f; + if (npc.Calamity().newAI[0] <= 0f) + { + npc.Calamity().newAI[0] = 0f; + npc.Calamity().newAI[1] = 0f; + } + else + { + // Body is vulnerable while venting + vulnerable = true; + } + } + + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + npc.Calamity().newAI[2] += 1f; + + // Homing only works if vulnerable is true + npc.chaseable = vulnerable; + + // Adjust DR based on vulnerable + npc.Calamity().DR = vulnerable ? 0f : 0.9999f; + npc.Calamity().unbreakableDR = !vulnerable; + + // Vent noise and steam + SmokeDrawer.ParticleSpawnRate = 9999999; + if (vulnerable) + { + // Light + Lighting.AddLight(npc.Center, 0.35f, 0.05f, 0.05f); + + // Noise + float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; + if (npc.localAI[0] == 0f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); + + // Steam + npc.localAI[0] += 1f; + if (npc.localAI[0] < ThanatosHead.ventDuration) + { + SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; + SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; + } + } + else + { + // Light + Lighting.AddLight(npc.Center, 0.05f, 0.2f, 0.2f); + + npc.localAI[0] = 0f; + } + + SmokeDrawer.Update(); + + 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; + vector18.Y = (int)(vector18.Y / 16f) * 16; + 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) + { + 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; + } catch + { + } + + npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2; + num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192); + 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; + + if (num191 < 0f) + npc.spriteDirection = -1; + else if (num191 > 0f) + npc.spriteDirection = 1; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 45f && npc.Opacity == 1f; + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) + damage *= 0.01; + + return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + } + + public override void FindFrame(int frameHeight) // 5 total frames + { + // Swap between venting and non-venting frames + 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 (shootLasers && !invisiblePhase) + { + if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) + { + if (npc.frameCounter >= 10D) + { + 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; + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + if (npc.frame.Y < 0) + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frame.Y -= frameHeight; + npc.frameCounter = 0D; + } + 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) + 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); + + 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); + + SmokeDrawer.DrawSet(npc.Center); + + return false; + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) + { + 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); + + 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); + } + 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); + 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); + 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); + } + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + } +} diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.png b/NPCs/ExoMechs/Thanatos/ThanatosTail.png new file mode 100644 index 0000000000..22edba05fd Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosTail.png differ diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTailGlow.png b/NPCs/ExoMechs/Thanatos/ThanatosTailGlow.png new file mode 100644 index 0000000000..8e758d699b Binary files /dev/null and b/NPCs/ExoMechs/Thanatos/ThanatosTailGlow.png differ diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index ebc05a0905..3ed9eed015 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -26,46 +26,22 @@ namespace CalamityMod.NPCs.GreatSandShark public override void SetDefaults() { - npc.noGravity = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.noGravity = true; npc.noTileCollide = true; npc.npcSlots = 15f; npc.damage = 100; npc.width = 300; npc.height = 120; - npc.defense = 60; + npc.defense = 40; npc.DR_NERD(0.25f); npc.LifeMaxNERB(8000, 11000); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 10, 0, 0); + npc.value = Item.buyPrice(0, 5, 0, 0); NPCID.Sets.TrailCacheLength[npc.type] = 8; NPCID.Sets.TrailingMode[npc.type] = 1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.netAlways = true; npc.HitSound = SoundID.NPCHit1; @@ -98,19 +74,22 @@ namespace CalamityMod.NPCs.GreatSandShark bool expertMode = Main.expertMode; bool revenge = CalamityWorld.revenge; bool death = CalamityWorld.death; - bool lowLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.75 : 0.5); - bool lowerLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.35 : 0.2); + 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) { CalamityUtils.StartSandstorm(); - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } + if (npc.soundDelay <= 0) { npc.soundDelay = 480; Main.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 (!resetAI) @@ -122,6 +101,7 @@ namespace CalamityMod.NPCs.GreatSandShark resetAI = true; npc.netUpdate = true; } + int num2 = expertMode ? 35 : 50; float num3 = expertMode ? 0.5f : 0.42f; float scaleFactor = expertMode ? 7.5f : 6.7f; @@ -147,150 +127,127 @@ namespace CalamityMod.NPCs.GreatSandShark num5 *= 1.5f; num4 = 20; } + Vector2 vector = npc.Center; Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) { - npc.TargetClosest(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.ai[0] = 0f; npc.ai[2] = 0f; } - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + + float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X); if (npc.spriteDirection == 1) - { - num17 += 3.14159274f; - } + num17 += MathHelper.Pi; if (num17 < 0f) - { - num17 += 6.28318548f; - } - if (num17 > 6.28318548f) - { - num17 -= 6.28318548f; - } + num17 += MathHelper.TwoPi; + if (num17 > MathHelper.TwoPi) + num17 -= MathHelper.TwoPi; + float num18 = 0.04f; if (npc.ai[0] == 1f) - { num18 = 0f; - } + if (npc.rotation < num17) { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) - { + if ((double)(num17 - npc.rotation) > MathHelper.Pi) npc.rotation -= num18; - } else - { npc.rotation += num18; - } } if (npc.rotation > num17) { - if ((double)(npc.rotation - num17) > 3.1415926535897931) - { + if ((double)(npc.rotation - num17) > MathHelper.Pi) npc.rotation += num18; - } else - { npc.rotation -= num18; - } } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { npc.rotation = num17; - } + if (npc.rotation < 0f) - { - npc.rotation += 6.28318548f; - } - if (npc.rotation > 6.28318548f) - { - npc.rotation -= 6.28318548f; - } + 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.ai[0] == 0f && !player.dead) { if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } + 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) { npc.velocity.X += num3; if (npc.velocity.X < 0f && vector3.X > 0f) - { npc.velocity.X += num3; - } } else if (npc.velocity.X > vector3.X) { npc.velocity.X -= num3; if (npc.velocity.X > 0f && vector3.X < 0f) - { npc.velocity.X -= num3; - } } if (npc.velocity.Y < vector3.Y) { npc.velocity.Y += num3; if (npc.velocity.Y < 0f && vector3.Y > 0f) - { npc.velocity.Y += num3; - } } else if (npc.velocity.Y > vector3.Y) { 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 += 3.14159274f; - } + npc.rotation += MathHelper.Pi; + npc.direction = num22; if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } + npc.rotation += MathHelper.Pi; + npc.spriteDirection = -npc.direction; } + npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) + 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((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); + if (num22 != 0) { npc.direction = num22; if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } + npc.rotation += MathHelper.Pi; + npc.spriteDirection = -npc.direction; } + npc.netUpdate = true; return; } @@ -298,13 +255,12 @@ namespace CalamityMod.NPCs.GreatSandShark else if (npc.ai[0] == 1f) { npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) + if (npc.ai[2] >= num4) { 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; @@ -317,40 +273,39 @@ namespace CalamityMod.NPCs.GreatSandShark { resetAI = false; if (npc.direction == 0) - { - npc.TargetClosest(true); - } + npc.TargetClosest(); + Point point15 = npc.Center.ToTileCoordinates(); Tile tileSafely = Framing.GetTileSafely(point15); bool flag121 = tileSafely.nactive() || tileSafely.liquid > 0; bool flag122 = 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) - { flag122 = true; - } + npc.localAI[1] += 1f; + if (lowLife) { 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); } } + if (npc.localAI[1] >= 300f) { npc.localAI[1] = 0f; if (npc.localAI[2] > 0f) - { npc.localAI[2] = 0f; - } + switch (Main.rand.Next(3)) { case 0: @@ -363,21 +318,19 @@ namespace CalamityMod.NPCs.GreatSandShark npc.ai[3] = 2f; break; } + int random = lowerLife ? 5 : 9; if (lowLife && Main.rand.Next(random) == 0) - { npc.localAI[3] = 1f; - } + npc.netUpdate = true; } + 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]; @@ -385,19 +338,17 @@ namespace CalamityMod.NPCs.GreatSandShark point15 = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); tileSafely = Framing.GetTileSafely(point15.X, point15.Y - 2); if (tileSafely.nactive()) - { flag123 = true; - } - npc.ai[1] = (float)flag123.ToInt(); + + npc.ai[1] = flag123.ToInt(); if (npc.ai[2] < 30f) - { npc.ai[2] += 1f; - } + if (flag122) { - npc.TargetClosest(true); - npc.velocity.X += (float)npc.direction * 0.15f; - npc.velocity.Y += (float)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]) @@ -431,8 +382,7 @@ namespace CalamityMod.NPCs.GreatSandShark 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) { @@ -446,7 +396,7 @@ namespace CalamityMod.NPCs.GreatSandShark if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 50; num623++) @@ -463,48 +413,40 @@ namespace CalamityMod.NPCs.GreatSandShark (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType(), 40, 0f, Main.myPlayer, 0f, 0f); } npc.ai[2] = -30f; - Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); - npc.velocity = vector261 * 18f; + + Vector2 upwardChargeDirection = npc.SafeDirectionTo(vector260 + new Vector2(0f, -80f), -Vector2.UnitY); + npc.velocity = upwardChargeDirection * 18f; } } else { float num1535 = 6f; - npc.velocity.X += (float)npc.direction * 0.1f; + 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; - } else - { npc.ai[0] = 1f; - } + float num1536 = 0.06f; float num1537 = 0.01f; if (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; - } } + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - { npc.velocity.Y *= 0.95f; - } } } else @@ -512,16 +454,14 @@ namespace CalamityMod.NPCs.GreatSandShark if (npc.velocity.Y == 0f) { if (flag122) - { - npc.TargetClosest(true); - } + npc.TargetClosest(); + float num1538 = 1f; - npc.velocity.X += (float)npc.direction * 0.1f; + 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) { npc.localAI[2] = 1f; @@ -553,17 +493,17 @@ namespace CalamityMod.NPCs.GreatSandShark velocityY *= 1.5f; } npc.velocity.Y = -velocityY; - npc.velocity.X = velocityX * (float)npc.direction; + npc.velocity.X = velocityX * npc.direction; npc.netUpdate = true; } + npc.velocity.Y += 0.4f; if (npc.velocity.Y > 10f) - { npc.velocity.Y = 10f; - } + npc.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + npc.rotation = npc.velocity.Y * npc.direction * 0.1f; npc.rotation = MathHelper.Clamp(npc.rotation, -0.1f, 0.1f); } } @@ -662,7 +602,7 @@ namespace CalamityMod.NPCs.GreatSandShark // Mark Great Sand Shark as dead CalamityWorld.downedGSS = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) @@ -673,8 +613,7 @@ namespace CalamityMod.NPCs.GreatSandShark public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Rabies, 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); + player.AddBuff(BuffID.Bleeding, 300, true); } } } diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 6a31dc6592..55a0ac975d 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -17,18 +18,19 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { - npc.damage = 25; - npc.width = 70; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 70; npc.height = 70; npc.defense = 6; npc.lifeMax = 90; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 20000; + npc.lifeMax = 2000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.3f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.3f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -38,10 +40,10 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - npc.TargetClosest(true); + npc.TargetClosest(); bool revenge = CalamityWorld.revenge; float speed = revenge ? 12f : 11f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) speed = 18f; if (npc.ai[1] < 90f) @@ -86,14 +88,6 @@ namespace CalamityMod.NPCs.HiveMind } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -114,9 +108,11 @@ namespace CalamityMod.NPCs.HiveMind public override void NPCLoot() { - if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) + if ((Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice) && Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType(), 14, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); } } } diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index ac03bf966c..2e67ef38cb 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -23,13 +24,13 @@ namespace CalamityMod.NPCs.HiveMind npc.height = 32; npc.defense = 2; npc.lifeMax = 150; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 18000; + npc.lifeMax = 1800; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.4f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.4f; npc.noGravity = true; npc.canGhostHeal = false; npc.chaseable = false; @@ -47,11 +48,11 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool revenge = CalamityWorld.revenge; - npc.TargetClosest(true); + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + npc.TargetClosest(); float num1164 = revenge ? 4.5f : 4f; float num1165 = revenge ? 0.8f : 0.75f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) { num1164 *= 2f; num1165 *= 2f; @@ -60,7 +61,7 @@ namespace CalamityMod.NPCs.HiveMind 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((double)(num1166 * num1166 + num1167 * num1167)); + float num1168 = (float)Math.Sqrt(num1166 * num1166 + num1167 * num1167); if (num1168 < 20f) { num1166 = npc.velocity.X; @@ -104,25 +105,21 @@ namespace CalamityMod.NPCs.HiveMind npc.velocity.Y = npc.velocity.Y - num1165 * 2f; } } - if (npc.position.X + (float)npc.width > Main.player[npc.target].position.X && npc.position.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)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] = 0f; - int num1169 = (int)(npc.position.X + 10f + (float)Main.rand.Next(npc.width - 20)); - int num1170 = (int)(npc.position.Y + (float)npc.height + 4f); - int num184 = Main.expertMode ? 14 : 18; - Projectile.NewProjectile((float)num1169, (float)num1170, 0f, 4f, ModContent.ProjectileType(), num184, 0f, Main.myPlayer, 0f, 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); + Projectile.NewProjectile(num1169, num1170, 0f, 4f, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } - public override bool PreNPCLoot() - { - return false; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 33f1b07baa..e42c56c57d 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -23,9 +24,9 @@ namespace CalamityMod.NPCs.HiveMind npc.width = 25; npc.height = 25; npc.lifeMax = 100; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 13000; + npc.lifeMax = 1300; } npc.knockBackResist = 0f; aiType = -1; @@ -39,9 +40,9 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; int num750 = CalamityGlobalNPC.hiveMind; if (num750 < 0 || !Main.npc[num750].active) @@ -140,9 +141,9 @@ namespace CalamityMod.NPCs.HiveMind num944 = num941 / num944; num942 *= num944; num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = ModContent.ProjectileType(); - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } } diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index c807499aa6..00f8794dc3 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -23,9 +24,9 @@ namespace CalamityMod.NPCs.HiveMind npc.width = 25; npc.height = 25; npc.lifeMax = 150; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 13000; + npc.lifeMax = 1300; } npc.knockBackResist = 0f; aiType = -1; @@ -39,9 +40,9 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; int num750 = CalamityGlobalNPC.hiveMind; if (num750 < 0 || !Main.npc[num750].active) @@ -140,9 +141,9 @@ namespace CalamityMod.NPCs.HiveMind num944 = num941 / num944; num942 *= num944; num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = ModContent.ProjectileType(); - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, type, damage, 0f, Main.myPlayer, 0f, 0f); npc.netUpdate = true; } } diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 254ba0bc61..48f29899a5 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.cs @@ -40,15 +40,18 @@ namespace CalamityMod.NPCs.HiveMind public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || spawnInfo.player.Calamity().corruptionLore) - { + if (spawnInfo.player.Calamity().disableHiveCystSpawns) return 0f; - } - else if (NPC.downedBoss2 && !CalamityWorld.downedHiveMind) - { - return SpawnCondition.Corruption.Chance * 1.5f; - } - return SpawnCondition.Corruption.Chance * (Main.hardMode ? 0.05f : 0.5f); + + bool anyBossElements = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); + bool corrupt = TileID.Sets.Corrupt[spawnInfo.spawnTileType] || spawnInfo.spawnTileType == TileID.Demonite && spawnInfo.player.ZoneCorrupt; + if (anyBossElements || spawnInfo.playerSafe || !corrupt) + return 0f; + + if (NPC.downedBoss2 && !CalamityWorld.downedHiveMind) + return 1.5f; + + return Main.hardMode ? 0.05f : 0.5f; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 30e245b064..fc52dfc390 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System.IO; @@ -21,27 +22,21 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { npc.npcSlots = 5f; - npc.damage = 20; - npc.width = 150; + npc.GetNPCDamage(); + npc.width = 150; npc.height = 120; npc.defense = 10; - npc.LifeMaxNERB(1200, 1800, 350000); + npc.LifeMaxNERB(1200, 1800, 35000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; npc.knockBackResist = 0f; npc.boss = true; npc.value = 0f; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - else - music = MusicID.Boss2; + music = CalamityMod.Instance.GetMusicFromMusicMod("HiveMind") ?? MusicID.Boss2; } public override void SendExtraAI(BinaryWriter writer) @@ -64,8 +59,15 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - npc.TargetClosest(true); - Player player = Main.player[npc.target]; + // Get a target + 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(); + + Player player = Main.player[npc.target]; if (!player.active || player.dead) { npc.TargetClosest(false); @@ -106,17 +108,33 @@ namespace CalamityMod.NPCs.HiveMind npc.noGravity = false; npc.noTileCollide = false; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; CalamityGlobalNPC.hiveMind = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient) + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!player.ZoneCorrupt || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { if (npc.localAI[0] == 0f) { npc.localAI[0] = 1f; - int maxBlobs = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + 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); @@ -124,23 +142,18 @@ namespace CalamityMod.NPCs.HiveMind } } - bool flag100 = false; - int num568 = 0; if (expertMode) { - for (int num569 = 0; num569 < Main.maxNPCs; num569++) - { - if (Main.npc[num569].active && Main.npc[num569].type == ModContent.NPCType()) - { - flag100 = true; - num568++; - } - } - - npc.defense += num568 * 25; - - if (!flag100) - npc.defense = npc.defDefense; + if (NPC.AnyNPCs(ModContent.NPCType())) + { + npc.Calamity().DR = 0.9999f; + npc.Calamity().unbreakableDR = true; + } + else + { + npc.Calamity().DR = 0f; + npc.Calamity().unbreakableDR = false; + } } if (npc.ai[3] == 0f && npc.life > 0) @@ -155,14 +168,14 @@ namespace CalamityMod.NPCs.HiveMind if ((npc.life + num660) < npc.ai[3]) { npc.ai[3] = npc.life; - int maxSpawns = death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); - int maxDankSpawns = death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; + 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 type = ModContent.NPCType(); - if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns) { type = ModContent.NPCType(); } @@ -181,7 +194,7 @@ namespace CalamityMod.NPCs.HiveMind burrowTimer--; if (burrowTimer < -120) { - burrowTimer = death ? 240 : revenge ? 300 : expertMode ? 360 : 420; + burrowTimer = (death ? 180 : revenge ? 300 : expertMode ? 360 : 420) - (int)enrageScale * 55; npc.scale = 1f; npc.alpha = 0; npc.dontTakeDamage = false; @@ -256,6 +269,7 @@ namespace CalamityMod.NPCs.HiveMind } else { + npc.TargetClosest(); npc.dontTakeDamage = true; npc.damage = 0; } @@ -265,7 +279,7 @@ namespace CalamityMod.NPCs.HiveMind public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -322,13 +336,5 @@ namespace CalamityMod.NPCs.HiveMind { return false; } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } - } } } diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index 7efcfe1733..f2d551bdb9 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -39,12 +40,12 @@ namespace CalamityMod.NPCs.HiveMind int minimumDriftTime = 300; int teleportRadius = 300; int decelerationTime = 30; - int reelbackFade = 3; //divide 255 by this for duration of reelback in ticks + int reelbackFade = 2; //divide 255 by this for duration of reelback in ticks float arcTime = 45f; //ticks needed to complete movement for spawn and rain attacks (DEATH ONLY) - float driftSpeed = 2f; //default speed when slowly floating at player + float driftSpeed = 1f; //default speed when slowly floating at player float driftBoost = 1f; //max speed added as health decreases int lungeDelay = 90; //# of ticks long hive mind spends sliding to a stop before lunging - int lungeTime = 30; + int lungeTime = 33; int lungeFade = 15; //divide 255 by this for duration of hive mind spin before slowing for lunge double lungeRots = 0.2; //number of revolutions made while spinning/fading in for lunge bool dashStarted = false; @@ -63,23 +64,22 @@ namespace CalamityMod.NPCs.HiveMind public override void SetStaticDefaults() { DisplayName.SetDefault("The Hive Mind"); - Main.npcFrameCount[npc.type] = 16; + Main.npcFrameCount[npc.type] = 8; } public override void SetDefaults() { - npc.npcSlots = 5f; - npc.damage = 35; - npc.width = 177; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.width = 177; npc.height = 142; npc.defense = 5; - npc.LifeMaxNERB(5800, 7560, 3000000); + npc.LifeMaxNERB(5800, 7560, 300000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 6, 0, 0); npc.boss = true; @@ -87,45 +87,42 @@ namespace CalamityMod.NPCs.HiveMind npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind"); - else - music = MusicID.Boss2; + music = CalamityMod.Instance.GetMusicFromMusicMod("HiveMind") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); NPCID.Sets.TrailCacheLength[npc.type] = 8; NPCID.Sets.TrailingMode[npc.type] = 1; if (Main.expertMode) { minimumDriftTime = 120; - reelbackFade = 5; + reelbackFade = 4; } if (CalamityWorld.revenge) { lungeRots = 0.3; minimumDriftTime = 90; - reelbackFade = 6; - lungeTime = 25; - driftSpeed = 3f; + reelbackFade = 5; + lungeTime = 28; + driftSpeed = 2f; driftBoost = 2f; } if (CalamityWorld.death) { lungeRots = 0.4; minimumDriftTime = 60; - reelbackFade = 7; - lungeTime = 20; - driftSpeed = 4f; + reelbackFade = 6; + lungeTime = 23; + driftSpeed = 3f; driftBoost = 1f; } - if (CalamityWorld.bossRushActive) - { - lungeRots = 0.4; - minimumDriftTime = 20; - reelbackFade = 15; - lungeTime = 10; - driftSpeed = 12f; - } + if (CalamityWorld.malice) + { + lungeRots = 0.4; + minimumDriftTime = 40; + reelbackFade = 10; + lungeTime = 16; + driftSpeed = 6f; + driftBoost = 1f; + } phase2timer = minimumDriftTime; rotationIncrement = 0.0246399424 * lungeRots * lungeFade; } @@ -142,7 +139,6 @@ namespace CalamityMod.NPCs.HiveMind writer.Write(reelCount); writer.Write(counter); writer.Write(initialised); - writer.Write(npc.dontTakeDamage); } public override void ReceiveExtraAI(BinaryReader reader) @@ -157,7 +153,6 @@ namespace CalamityMod.NPCs.HiveMind reelCount = reader.ReadInt32(); counter = reader.ReadInt32(); initialised = reader.ReadBoolean(); - npc.dontTakeDamage = reader.ReadBoolean(); } public override void FindFrame(int frameHeight) @@ -240,7 +235,7 @@ namespace CalamityMod.NPCs.HiveMind private void SpawnStuff() { - int maxSpawns = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5 : CalamityWorld.revenge ? 4 : Main.expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + int maxSpawns = (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 5 : CalamityWorld.revenge ? 4 : Main.expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); for (int i = 0; i < maxSpawns; i++) { int type = NPCID.EaterofSouls; @@ -251,19 +246,15 @@ namespace CalamityMod.NPCs.HiveMind switch (choice) { case 0: + case 1: type = NPCID.EaterofSouls; break; - case 1: + case 2: type = NPCID.DevourerHead; break; - case 2: - type = ModContent.NPCType(); - break; case 3: - type = ModContent.NPCType(); - break; case 4: - type = ModContent.NPCType(); + type = ModContent.NPCType(); break; default: break; @@ -281,7 +272,7 @@ namespace CalamityMod.NPCs.HiveMind npc.alpha = 0; phase2timer = 0; deceleration = npc.velocity / 255f * reelbackFade; - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { state = 2; Main.PlaySound(SoundID.ForceRoar, (int)npc.Center.X, (int)npc.Center.Y, -1, 1f, 0f); @@ -305,27 +296,55 @@ namespace CalamityMod.NPCs.HiveMind 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); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Get a target + 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(); Player player = Main.player[npc.target]; - npc.dontTakeDamage = (player.ZoneCorrupt || CalamityWorld.bossRushActive) ? false : true; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; - CalamityGlobalNPC.hiveMind = npc.whoAmI; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - if (npc.alpha != 0) + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!player.ZoneCorrupt || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + if (npc.alpha != 0) { if (npc.damage != 0) - { npc.damage = 0; - } } else - { npc.damage = npc.defDamage; - } + switch (state) { case 0: //slowdrift @@ -333,17 +352,17 @@ namespace CalamityMod.NPCs.HiveMind npc.alpha -= 3; if (nextState == 0) { - npc.TargetClosest(true); - if ((CalamityWorld.revenge && npc.life < npc.lifeMax * 0.66) || CalamityWorld.death || CalamityWorld.bossRushActive) + npc.TargetClosest(); + if ((CalamityWorld.revenge || malice) && lifeRatio < 0.66f) { - if (CalamityWorld.death || CalamityWorld.bossRushActive) + if (CalamityWorld.death || malice) { do nextState = Main.rand.Next(3, 6); while (nextState == previousState); previousState = nextState; } - else if (npc.life < npc.lifeMax * 0.33) + else if (lifeRatio < 0.33f) { do nextState = Main.rand.Next(3, 6); @@ -360,7 +379,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - if (CalamityWorld.revenge && (Main.rand.NextBool(3) || reelCount == 2)) + if ((CalamityWorld.revenge || malice) && (Main.rand.NextBool(3) || reelCount == 2)) { reelCount = 0; nextState = 2; @@ -423,25 +442,25 @@ namespace CalamityMod.NPCs.HiveMind phase2timer--; if (phase2timer <= -180) //no stalling drift mode forever { - npc.velocity *= 2f / 255f * reelbackFade; + npc.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); ReelBack(); npc.netUpdate = true; } else { npc.velocity.Normalize(); - if (Main.expertMode || CalamityWorld.bossRushActive) //variable velocity in expert and up + if (Main.expertMode || malice) //variable velocity in expert and up { - npc.velocity *= driftSpeed + driftBoost * (npc.lifeMax - npc.life) / npc.lifeMax; + npc.velocity *= driftSpeed + enrageScale + driftBoost * lifeRatio; } else { - npc.velocity *= driftSpeed; + npc.velocity *= driftSpeed + enrageScale; } } break; case 1: //reelback and teleport - npc.alpha += reelbackFade; + npc.alpha += reelbackFade + 2 * (int)enrageScale; npc.velocity -= deceleration; if (npc.alpha >= 255) { @@ -473,14 +492,14 @@ namespace CalamityMod.NPCs.HiveMind } break; case 2: //reelback for lunge + death legacy - npc.alpha += reelbackFade; + npc.alpha += reelbackFade + 2 * (int)enrageScale; npc.velocity -= deceleration; if (npc.alpha >= 255) { npc.alpha = 255; npc.velocity = Vector2.Zero; dashStarted = false; - if ((CalamityWorld.revenge && npc.life < npc.lifeMax * 0.66) || CalamityWorld.death || CalamityWorld.bossRushActive) + if ((CalamityWorld.revenge || malice) && lifeRatio < 0.66f) { state = nextState; nextState = 0; @@ -517,10 +536,10 @@ namespace CalamityMod.NPCs.HiveMind { if (phase2timer <= 0) { - phase2timer = lungeTime; - npc.velocity = player.Center - npc.Center; + phase2timer = lungeTime - 4 * (int)enrageScale; + npc.velocity = player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - npc.Center; npc.velocity.Normalize(); - npc.velocity *= teleportRadius / lungeTime; + npc.velocity *= teleportRadius / (lungeTime - (int)enrageScale); dashStarted = true; Main.PlaySound(SoundID.Roar, (int)npc.Center.X, (int)npc.Center.Y, 0); } @@ -577,7 +596,7 @@ namespace CalamityMod.NPCs.HiveMind { if (npc.ai[0] == 2 || npc.ai[0] == 4) { - if ((Main.expertMode || CalamityWorld.bossRushActive) && !NPC.AnyNPCs(ModContent.NPCType())) + if ((Main.expertMode || malice) && !NPC.AnyNPCs(ModContent.NPCType())) { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); } @@ -630,8 +649,9 @@ namespace CalamityMod.NPCs.HiveMind npc.ai[0]++; if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = Main.expertMode ? 14 : 18; - Projectile.NewProjectile(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height), 0, 0, ModContent.ProjectileType(), damage, 0, Main.myPlayer, 11, 0); + 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); } if (npc.ai[0] == 10) { @@ -682,7 +702,7 @@ namespace CalamityMod.NPCs.HiveMind public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.9f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -737,9 +757,11 @@ namespace CalamityMod.NPCs.HiveMind { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Evil boss tier 2 + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedHiveMind); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedHiveMind, 2, 0, 0); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedHiveMind); @@ -754,7 +776,7 @@ namespace CalamityMod.NPCs.HiveMind DropHelper.DropItemSpray(npc, ItemID.CursedFlame, 10, 20); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -777,25 +799,14 @@ namespace CalamityMod.NPCs.HiveMind { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .4f, .6f); + CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.4f, 0.6f, 3, 8); - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); } // Mark The Hive Mind as dead CalamityWorld.downedHiveMind = true; - CalamityMod.UpdateServerBoolean(); - } - - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } + CalamityNetcode.SyncWorld(); } } } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 74a1ed0095..661ff91b49 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -18,15 +19,16 @@ namespace CalamityMod.NPCs.Leviathan public override void SetDefaults() { - npc.aiStyle = -1; - npc.damage = 55; - npc.width = 50; + npc.Calamity().canBreakPlayerDefense = true; + npc.aiStyle = -1; + npc.GetNPCDamage(); + npc.width = 50; npc.height = 50; npc.defense = 14; npc.lifeMax = 1600; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.knockBackResist = 0f; npc.noGravity = true; @@ -173,11 +175,7 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Wet, 120, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - } + player.AddBuff(BuffID.Bleeding, 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/LevSky.cs b/NPCs/Leviathan/LevSky.cs index f75b1fddb7..60f6000283 100644 --- a/NPCs/Leviathan/LevSky.cs +++ b/NPCs/Leviathan/LevSky.cs @@ -36,8 +36,8 @@ namespace CalamityMod.NPCs.Leviathan float spawnAnimationTimer = 180f; float intensityScalar = 1f; - if (Main.npc[CalamityGlobalNPC.leviathan].Calamity().newAI[3] < spawnAnimationTimer) - intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[CalamityGlobalNPC.leviathan].Calamity().newAI[3] / spawnAnimationTimer); + if (Main.npc[LevIndex].Calamity().newAI[3] < spawnAnimationTimer) + intensityScalar = MathHelper.Lerp(0f, intensityScalar, Main.npc[LevIndex].Calamity().newAI[3] / spawnAnimationTimer); return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar; } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 6028e516e8..e7a7dae482 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -19,6 +20,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Leviathan { [AutoloadBossHead] @@ -26,22 +28,27 @@ namespace CalamityMod.NPCs.Leviathan { int counter = 0; bool initialised = false; + int soundDelay = 0; + public static Texture2D AttackTexture = null; public override void SetStaticDefaults() { DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[npc.type] = 3; + if (!Main.dedServ) + AttackTexture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); } public override void SetDefaults() { - npc.npcSlots = 20f; - npc.damage = 90; - npc.width = 650; - npc.height = 300; + 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(55200, 72560, 6000000); + npc.LifeMaxNERB(55200, 72560, 600000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -49,59 +56,28 @@ namespace CalamityMod.NPCs.Leviathan aiType = -1; npc.Opacity = 0f; npc.value = Item.buyPrice(0, 15, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit56; npc.DeathSound = SoundID.NPCDeath60; npc.noTileCollide = true; npc.noGravity = true; npc.boss = true; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndSiren") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); - writer.Write(counter); - writer.Write(initialised); + writer.Write(soundDelay); + writer.Write(npc.Calamity().newAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); - counter = reader.ReadInt32(); - initialised = reader.ReadBoolean(); + soundDelay = reader.ReadInt32(); + npc.Calamity().newAI[3] = reader.ReadSingle(); } public override void AI() @@ -110,9 +86,11 @@ namespace CalamityMod.NPCs.Leviathan CalamityGlobalNPC.leviathan = npc.whoAmI; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; Vector2 vector = npc.Center; // Is in spawning animation @@ -127,13 +105,15 @@ namespace CalamityMod.NPCs.Leviathan // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Phases - bool phase2 = (lifeRatio < 0.7f && expertMode) || death; + bool phase2 = lifeRatio < 0.7f && expertMode; bool phase3 = lifeRatio < 0.4f; bool phase4 = lifeRatio < 0.2f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - bool sirenAlive = false; if (CalamityGlobalNPC.siren != -1) sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; @@ -157,18 +137,55 @@ namespace CalamityMod.NPCs.Leviathan 40 }); + if (soundDelay > 0) + soundDelay--; + if (Main.rand.NextBool(600) && !spawnAnimation) - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); + Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); - Player player = Main.player[npc.target]; + // 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(); - bool flag6 = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); - npc.dontTakeDamage = (flag6 && !CalamityWorld.bossRushActive) || spawnAnimation; + Player player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) + bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + + float enrageScale = 0f; + if (notOcean || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 2f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + 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[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]; @@ -216,7 +233,7 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity = new Vector2(0f, -velocityY); if (calamityGlobalNPC.newAI[3] == 10f) - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoiceRage); + Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, soundChoiceRage); npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); @@ -227,25 +244,22 @@ namespace CalamityMod.NPCs.Leviathan if (npc.ai[0] == 0f) { - npc.TargetClosest(true); float num412 = (sirenAlive && !phase4) ? 3.5f : 7f; float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f; + num412 += 2f * enrageScale; + num413 += 0.05f * enrageScale; + if (expertMode && (!sirenAlive || phase4)) { - num412 += death ? 3.5f : 3.5f * (1f - lifeRatio); - num413 += death ? 0.1f : 0.1f * (1f - lifeRatio); + num412 += death ? 6f * (1f - lifeRatio) : 3.5f * (1f - lifeRatio); + num413 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } - if (CalamityWorld.bossRushActive) - { - num412 *= 1.5f; - num413 *= 1.5f; - } int num414 = 1; - if (npc.Center.X < player.position.X + player.width) + if (vector.X < player.position.X + player.width) num414 = -1; - Vector2 vector40 = npc.Center; + Vector2 vector40 = vector; float num415 = player.Center.X + (num414 * ((sirenAlive && !phase4) ? 1000f : 800f)) - vector40.X; float num416 = player.Center.Y - vector40.Y; float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); @@ -257,36 +271,33 @@ namespace CalamityMod.NPCs.Leviathan { npc.velocity.X += num413; if (npc.velocity.X < 0f && num415 > 0f) - { npc.velocity.X += num413; - } } else if (npc.velocity.X > num415) { npc.velocity.X -= num413; if (npc.velocity.X > 0f && num415 < 0f) - { npc.velocity.X -= num413; - } } + if (npc.velocity.Y < num416) { npc.velocity.Y += num413; if (npc.velocity.Y < 0f && num416 > 0f) - { npc.velocity.Y += num413; - } } else if (npc.velocity.Y > num416) { npc.velocity.Y -= num413; if (npc.velocity.Y > 0f && num416 < 0f) - { npc.velocity.Y -= num413; - } } - npc.ai[1] += 1f; + float playerLocation = vector.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; float phaseTimer = 240f; if (!sirenAlive || phase4) phaseTimer -= 120f * (1f - lifeRatio); @@ -296,7 +307,7 @@ namespace CalamityMod.NPCs.Leviathan npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.target = 255; + npc.TargetClosest(); npc.netUpdate = true; } else @@ -304,40 +315,30 @@ namespace CalamityMod.NPCs.Leviathan if (!player.dead) { npc.ai[2] += 1f; - if (!sirenAlive || death || phase4) + if (!sirenAlive || phase4) npc.ai[2] += 2f; } if (npc.ai[2] >= 75f) { npc.ai[2] = 0f; - vector40 = new Vector2(npc.Center.X, npc.Center.Y + 20f); + vector40 = new Vector2(vector.X, vector.Y + 20f); num415 = player.Center.X - vector40.X; num416 = player.Center.Y - vector40.Y; if (Main.netMode != NetmodeID.MultiplayerClient) { float speed = (sirenAlive && !phase4 && !death) ? 13.5f : 16f; - int dmg = 40; - int projType = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - if (expertMode) - { + if (expertMode) speed = (sirenAlive && !phase4 && !death) ? 14f : 17f; - dmg = 33; - } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - speed = 22f; + speed += 2f * enrageScale; if (!sirenAlive || phase4) - { speed += 3f * (1f - lifeRatio); - dmg += expertMode ? 3 : 4; - } - - if (CalamityWorld.bossRushActive) - speed *= 1.5f; num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = speed / num417; @@ -345,17 +346,20 @@ namespace CalamityMod.NPCs.Leviathan num416 *= num417; vector40.X += num415 * 4f; vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, projType, dmg, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, type, damage, 0f, Main.myPlayer, 0f, 0f); + if (soundDelay <= 0) + { + soundDelay = 120; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarMeteor"), vector); + } } } } } else if (npc.ai[0] == 1f) { - npc.TargetClosest(true); - - Vector2 vector119 = new Vector2(npc.Center.X, npc.position.Y + npc.height * 0.8f); - Vector2 vector120 = npc.Center; + 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); @@ -381,13 +385,13 @@ namespace CalamityMod.NPCs.Leviathan flag103 = true; } - int spawnLimit = (sirenAlive && !phase4) ? 2 : 4; + int spawnLimit = (sirenAlive && !phase4) ? 1 : 3; bool spawnParasea = NPC.CountNPCS(ModContent.NPCType()) < spawnLimit; bool spawnAberration = (!sirenAlive || phase4) && !NPC.AnyNPCs(ModContent.NPCType()); if (flag103 && (spawnParasea || spawnAberration)) { - Main.PlaySound(SoundID.Zombie, (int)npc.Center.X, (int)npc.Center.Y, soundChoice); + Main.PlaySound(SoundID.Zombie, (int)vector.X, (int)vector.Y, soundChoice); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = spawnAberration ? ModContent.NPCType() : ModContent.NPCType(); @@ -399,16 +403,14 @@ namespace CalamityMod.NPCs.Leviathan { float num1063 = (sirenAlive && !phase4) ? 7f : 8f; float num1064 = (sirenAlive && !phase4) ? 0.05f : 0.065f; + num1063 += 2f * enrageScale; + num1064 += 0.04f * enrageScale; + if (expertMode && (!sirenAlive || phase4)) { - num1063 += death ? 4f : 4f * (1f - lifeRatio); - num1064 += death ? 0.03f : 0.03f * (1f - lifeRatio); + num1063 += death ? 7f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + num1064 += death ? 0.05f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio); } - if (CalamityWorld.bossRushActive) - { - num1063 *= 1.5f; - num1064 *= 1.5f; - } vector120 = vector119; num1058 = player.Center.X - vector120.X; @@ -444,29 +446,35 @@ namespace CalamityMod.NPCs.Leviathan else npc.velocity *= 0.9f; - npc.spriteDirection = npc.direction; + float playerLocation = vector.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; - if (npc.ai[2] > ((sirenAlive && !phase4) ? 2f : 3f)) + if (npc.ai[2] > ((sirenAlive && !phase4) ? 2f : 3f)) { npc.ai[0] = (((phase2 || phase3) && !sirenAlive) || phase4) ? 2f : 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } else if (npc.ai[0] == 2f) { - Vector2 distFromPlayer = player.Center - npc.Center; - if (npc.ai[1] > 1f || distFromPlayer.Length() > 2400f) + Vector2 distFromPlayer = player.Center - vector; + float chargeAmt = death ? 2f : 1f; + 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; return; } float chargeDistance = (sirenAlive && !phase4) ? 1100f : 900f; + chargeDistance -= 50f * enrageScale; if (!sirenAlive || phase4) chargeDistance -= 250f * (1f - lifeRatio); @@ -484,56 +492,46 @@ namespace CalamityMod.NPCs.Leviathan Main.dust[num25].velocity -= npc.velocity; } - npc.TargetClosest(true); - if (Math.Abs(npc.position.Y + (npc.height / 2) - (player.position.Y + (player.height / 2))) < 20f) { npc.ai[1] += 1f; npc.ai[2] = 0f; float num1044 = revenge ? 20f : 18f; + num1044 += 2f * enrageScale; if (revenge && (!sirenAlive || phase4)) - num1044 += death ? 6f : 6f * (1f - lifeRatio); + num1044 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1044 += 4f; - - if (CalamityWorld.bossRushActive) - num1044 *= 1.25f; - - Vector2 vector117 = npc.Center; + Vector2 vector117 = vector; float num1045 = player.Center.X - vector117.X; 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.spriteDirection = npc.direction; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarCharge"), npc.Center); + + float playerLocation = vector.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarCharge"), vector); + return; } float num1048 = revenge ? 7.5f : 6.5f; float num1049 = revenge ? 0.12f : 0.11f; + num1048 += 2f * enrageScale; + num1049 += 0.04f * enrageScale; + if (revenge && (!sirenAlive || phase4)) { - num1048 += death ? 6f : 6f * (1f - lifeRatio); - num1049 += death ? 0.1f : 0.1f * (1f - lifeRatio); + num1048 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); + num1049 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1048 += 3f; - num1049 += 0.2f; - } - if (CalamityWorld.bossRushActive) - { - num1048 *= 1.25f; - num1049 *= 1.25f; - } - - if (npc.Center.Y < player.Center.Y) + if (vector.Y < player.Center.Y) npc.velocity.Y += num1049; else npc.velocity.Y -= num1049; @@ -543,9 +541,9 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.Y > num1048) npc.velocity.Y = num1048; - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) + if (Math.Abs(vector.X - player.Center.X) > chargeDistance + 200f) npc.velocity.X += num1049 * npc.direction; - else if (Math.Abs(npc.Center.X - player.Center.X) < chargeDistance) + else if (Math.Abs(vector.X - player.Center.X) < chargeDistance) npc.velocity.X -= num1049 * npc.direction; else npc.velocity.X *= 0.8f; @@ -555,8 +553,10 @@ namespace CalamityMod.NPCs.Leviathan if (npc.velocity.X > num1048) npc.velocity.X = num1048; - npc.spriteDirection = npc.direction; - } + float playerLocation2 = vector.X - player.Center.X; + npc.direction = playerLocation2 < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + } else { if (npc.velocity.X < 0f) @@ -567,37 +567,107 @@ namespace CalamityMod.NPCs.Leviathan npc.spriteDirection = npc.direction; int num1051 = 1; - if (npc.Center.X < player.Center.X) + if (vector.X < player.Center.X) num1051 = -1; - if (npc.direction == num1051 && Math.Abs(npc.Center.X - player.Center.X) > chargeDistance) + if (npc.direction == num1051 && Math.Abs(vector.X - player.Center.X) > chargeDistance) npc.ai[2] = 1f; if (npc.ai[2] != 1f) return; - npc.TargetClosest(true); + float playerLocation = vector.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; - 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 ? 0.81f : MathHelper.Lerp(0.81f, 1f, lifeRatio); - num1052 += death ? 0.1f : 0.1f * (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) { npc.ai[2] = 0f; npc.ai[1] += 1f; + npc.TargetClosest(); } } } } } - public override void HitEffect(int hitDirection, double damage) + // Can only hit the target if within certain distance. + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + 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); + // 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); + // 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); + + 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)); + Vector2 tailHitboxCenter = new Vector2(tailHitbox.X + (tailHitbox.Width / 2), tailHitbox.Y + (tailHitbox.Height / 2)); + + Rectangle targetHitbox = target.Hitbox; + + float mouthDist1 = Vector2.Distance(mouthHitboxCenter, targetHitbox.TopLeft()); + float mouthDist2 = Vector2.Distance(mouthHitboxCenter, targetHitbox.TopRight()); + float mouthDist3 = Vector2.Distance(mouthHitboxCenter, targetHitbox.BottomLeft()); + float mouthDist4 = Vector2.Distance(mouthHitboxCenter, targetHitbox.BottomRight()); + + float minMouthDist = mouthDist1; + if (mouthDist2 < minMouthDist) + minMouthDist = mouthDist2; + if (mouthDist3 < minMouthDist) + minMouthDist = mouthDist3; + if (mouthDist4 < minMouthDist) + minMouthDist = mouthDist4; + + bool insideMouthHitbox = minMouthDist <= 115f; + + float bodyDist1 = Vector2.Distance(bodyHitboxCenter, targetHitbox.TopLeft()); + float bodyDist2 = Vector2.Distance(bodyHitboxCenter, targetHitbox.TopRight()); + float bodyDist3 = Vector2.Distance(bodyHitboxCenter, targetHitbox.BottomLeft()); + float bodyDist4 = Vector2.Distance(bodyHitboxCenter, targetHitbox.BottomRight()); + + float minBodyDist = bodyDist1; + if (bodyDist2 < minBodyDist) + minBodyDist = bodyDist2; + if (bodyDist3 < minBodyDist) + minBodyDist = bodyDist3; + if (bodyDist4 < minBodyDist) + minBodyDist = bodyDist4; + + bool insideBodyHitbox = minBodyDist <= 230f; + + float tailDist1 = Vector2.Distance(tailHitboxCenter, targetHitbox.TopLeft()); + float tailDist2 = Vector2.Distance(tailHitboxCenter, targetHitbox.TopRight()); + float tailDist3 = Vector2.Distance(tailHitboxCenter, targetHitbox.BottomLeft()); + float tailDist4 = Vector2.Distance(tailHitboxCenter, targetHitbox.BottomRight()); + + float minTailDist = tailDist1; + if (tailDist2 < minTailDist) + minTailDist = tailDist2; + if (tailDist3 < minTailDist) + minTailDist = tailDist3; + if (tailDist4 < minTailDist) + minTailDist = tailDist4; + + bool insideTailHitbox = minTailDist <= 115f; + + return insideMouthHitbox || insideBodyHitbox || insideTailHitbox; + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -655,15 +725,17 @@ namespace CalamityMod.NPCs.Leviathan { DropHelper.DropBags(npc); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); + // Legendary drop for Leviathan and Anahita + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedLeviathan, 4, 2, 1); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) { // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -692,12 +764,12 @@ namespace CalamityMod.NPCs.Leviathan // Mark Siren & Levi as dead CalamityWorld.downedLeviathan = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Wet, 240, true); + target.AddBuff(BuffID.Bleeding, 240, true); } public override bool CheckActive() @@ -707,19 +779,11 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) + Texture2D texture = AttackTexture; + if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) { texture = Main.npcTexture[npc.type]; } - else - { - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); - } - int verticalFrameCount = 3; - int horizontalFrameCount = 2; - int height = texture.Height / verticalFrameCount; - int width = texture.Width / horizontalFrameCount; SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; float xOffset = -50f; if (npc.spriteDirection == -1) @@ -727,49 +791,38 @@ namespace CalamityMod.NPCs.Leviathan spriteEffects = SpriteEffects.None; xOffset *= -1f; } - Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(xOffset, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2(width / 2f, height / 2f), npc.scale, spriteEffects, 0f); + 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); return false; } public override void FindFrame(int frameHeight) { - Texture2D texture = Main.npcTexture[npc.type]; - if (npc.ai[0] == 1f || npc.Calamity().newAI[3] < 180f) - { - texture = Main.npcTexture[npc.type]; - } - else - { - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); - } - int horizontalFrameCount = 2; - int verticalFrameCount = 3; - int width = texture.Width / horizontalFrameCount; - int height = texture.Height / verticalFrameCount; - int timeBetweenFrames = 8; + int width = 1011; + int height = 486; if (!initialised) { - counter = verticalFrameCount; - npc.frameCounter = timeBetweenFrames; + counter = 3; + npc.frameCounter = 8D; initialised = true; } - // Ensure width and height are set. - npc.frame.Width = width; - npc.frame.Height = height; - npc.frameCounter++; - if (npc.frameCounter >= timeBetweenFrames) - { - npc.frame.X = counter >= verticalFrameCount ? width + 3 : 0; - if (counter == verticalFrameCount) - npc.frame.Y = 0; - else - npc.frame.Y += height; - npc.frameCounter = 0; - counter++; - } - if (counter == Main.npcFrameCount[npc.type]) + npc.frameCounter += 1D; + if (npc.frameCounter >= 8D) + { + npc.frameCounter = 0D; + counter++; + npc.frame.X = counter >= 3 ? width + 3 : 0; + + if (counter == 3) + npc.frame.Y = 0; + else + npc.frame.Y += height; + } + + if (counter == 6) { counter = 1; npc.frame.Y = 0; @@ -780,7 +833,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png b/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png deleted file mode 100644 index 34c3c55b6a..0000000000 Binary files a/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png and /dev/null differ diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 5714108113..1f35ca75e0 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -34,9 +34,7 @@ namespace CalamityMod.NPCs.Leviathan npc.HitSound = SoundID.NPCHit1; npc.DeathSound = null; npc.rarity = 2; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure"); + music = CalamityMod.Instance.GetMusicFromMusicMod("SirenLure") ?? -1; } public override void SendExtraAI(BinaryWriter writer) @@ -94,7 +92,7 @@ namespace CalamityMod.NPCs.Leviathan 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, 4f + npc.gfxOffY); + 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"); @@ -106,30 +104,32 @@ namespace CalamityMod.NPCs.Leviathan public override float SpawnChance(NPCSpawnInfo spawnInfo) { + if (spawnInfo.player.Calamity().disableAnahitaSpawns) + return 0f; + if (spawnInfo.playerSafe || NPC.AnyNPCs(NPCID.DukeFishron) || NPC.AnyNPCs(npc.type) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || spawnInfo.player.Calamity().ZoneSulphur || - spawnInfo.player.Calamity().oceanLore) + NPC.LunarApocalypseIsUp) { return 0f; } + if (!Main.hardMode) - { return SpawnCondition.OceanMonster.Chance * 0.025f; - } + if (!NPC.downedPlantBoss && !CalamityWorld.downedCalamitas) - { return SpawnCondition.OceanMonster.Chance * 0.1f; - } + return SpawnCondition.OceanMonster.Chance * 0.4f; } public override void NPCLoot() { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, 0.25f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index 2adb5a9d4b..8f882d9ddc 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -22,13 +23,13 @@ namespace CalamityMod.NPCs.Leviathan npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.damage = 50; - npc.width = npc.height = 30; + npc.GetNPCDamage(); + npc.width = npc.height = 30; npc.defense = 8; npc.lifeMax = 650; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.knockBackResist = 0f; npc.HitSound = SoundID.NPCHit1; @@ -39,9 +40,9 @@ namespace CalamityMod.NPCs.Leviathan public override void AI() { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge; float speed = revenge ? 16f : 13f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) speed = 24f; CalamityAI.DungeonSpiritAI(npc, mod, speed, MathHelper.Pi); } @@ -77,7 +78,7 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Wet, 60, true); + player.AddBuff(BuffID.Bleeding, 60, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index e22c9e46af..59e5c088a1 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; @@ -30,13 +31,13 @@ namespace CalamityMod.NPCs.Leviathan public override void SetDefaults() { - npc.damage = 70; - npc.npcSlots = 16f; + npc.GetNPCDamage(); + npc.npcSlots = 16f; npc.width = 100; npc.height = 100; npc.defense = 20; npc.DR_NERD(0.2f); - npc.LifeMaxNERB(27400, 41600, 2600000); + npc.LifeMaxNERB(27400, 41600, 260000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -44,43 +45,11 @@ namespace CalamityMod.NPCs.Leviathan aiType = -1; npc.boss = true; npc.value = Item.buyPrice(0, 15, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BoneJavelin] = false; - npc.buffImmune[BuffID.SoulDrain] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("Siren") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); } @@ -93,7 +62,8 @@ namespace CalamityMod.NPCs.Leviathan writer.Write(npc.localAI[3]); writer.Write(frameUsed); writer.Write(npc.dontTakeDamage); - } + writer.Write(npc.Calamity().newAI[0]); + } public override void ReceiveExtraAI(BinaryReader reader) { @@ -104,19 +74,29 @@ namespace CalamityMod.NPCs.Leviathan npc.localAI[3] = reader.ReadSingle(); frameUsed = reader.ReadInt32(); npc.dontTakeDamage = reader.ReadBoolean(); - } + npc.Calamity().newAI[0] = reader.ReadSingle(); + } - public override void AI() + public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // whoAmI variable CalamityGlobalNPC.siren = npc.whoAmI; - // Light - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.5f, 0.3f); + // Set to false so she doesn't do it constantly + npc.Calamity().canBreakPlayerDefense = false; - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Light + 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(); + + // 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(); // Check for Leviathan bool leviAlive = false; @@ -125,12 +105,35 @@ namespace CalamityMod.NPCs.Leviathan // Variables Player player = Main.player[npc.target]; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool isNotOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); + + float enrageScale = 0f; + if (notOcean || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1.5f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 0.5f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 0.5f; + } + float lifeRatio = npc.life / (float)npc.lifeMax; - float bubbleVelocity = CalamityWorld.bossRushActive ? 16f : death ? 8f : revenge ? 7f : expertMode ? 6f : 5f; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + float bubbleVelocity = death ? 9f : revenge ? 7f : expertMode ? 6f : 5f; + bubbleVelocity += 4f * enrageScale; if (!leviAlive) bubbleVelocity += 2f * (1f - lifeRatio); @@ -144,15 +147,11 @@ namespace CalamityMod.NPCs.Leviathan bool phase4 = lifeRatio < 0.2f; // Spawn Leviathan and change music - if (phase3) + if (npc.life / (float)npc.lifeMax < 0.4f) { if (!spawnedLevi) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("LeviathanAndSiren") ?? MusicID.Boss3; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -183,7 +182,7 @@ namespace CalamityMod.NPCs.Leviathan npc.dontTakeDamage = true; else { - npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; + npc.dontTakeDamage = false; npc.ai[3] = 0f; if (npc.localAI[1] == -1f) @@ -206,14 +205,14 @@ namespace CalamityMod.NPCs.Leviathan } else { - npc.dontTakeDamage = isNotOcean && !CalamityWorld.bossRushActive; + npc.dontTakeDamage = false; int num7 = (int)npc.ai[3] - 1; if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType()) npc.dontTakeDamage = true; } - if (phase3) + if (npc.life / (float)npc.lifeMax < 0.4f) { if (CalamityGlobalNPC.leviathan != -1) { @@ -256,22 +255,16 @@ namespace CalamityMod.NPCs.Leviathan } // Alpha - if (isNotOcean) - { - npc.alpha += 3; - if (npc.alpha >= 150) - npc.alpha = 150; - } - else - { - npc.alpha -= 5; - if (npc.alpha <= 0) - npc.alpha = 0; - } + if (npc.damage != 0) + { + npc.alpha -= 5; + if (npc.alpha <= 0) + npc.alpha = 0; + } // Play sound if (Main.rand.NextBool(300)) - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 35); + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, 35); // Time left if (npc.timeLeft < 1800) @@ -326,7 +319,7 @@ namespace CalamityMod.NPCs.Leviathan // Phase switch if (npc.ai[0] == -1f) { - int random = (((phase2 || death) && expertMode && !leviAlive) || phase4) ? 4 : 3; + int random = ((phase2 && expertMode && !leviAlive) || phase4) ? 4 : 3; int num618; do num618 = Main.rand.Next(random); while (num618 == npc.ai[1] || num618 == 1); @@ -343,6 +336,7 @@ namespace CalamityMod.NPCs.Leviathan else ChargeRotation(player, vector); + npc.TargetClosest(); npc.ai[1] = 0f; npc.ai[2] = 0f; } @@ -350,7 +344,6 @@ namespace CalamityMod.NPCs.Leviathan // Get in position for bubble spawn else if (npc.ai[0] == 0f) { - npc.TargetClosest(true); npc.rotation = npc.velocity.X * 0.02f; npc.spriteDirection = npc.direction; @@ -359,45 +352,54 @@ namespace CalamityMod.NPCs.Leviathan float num1056 = player.position.Y + (player.height / 2) - 200f - vector118.Y; float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); - if (num1057 < 600f) + npc.Calamity().newAI[0] += 1f; + if (num1057 < 600f || npc.Calamity().newAI[0] >= 180f) { npc.ai[0] = 1f; npc.ai[1] = 0f; - npc.netUpdate = true; + npc.Calamity().newAI[0] = 0f; + npc.netUpdate = true; return; } - if (npc.position.Y > player.position.Y - 350f) + float maxVelocityY = death ? 3f : 4f; + float maxVelocityX = death ? 7f : 8f; + maxVelocityY -= enrageScale; + maxVelocityX -= 2f * enrageScale; + + if (npc.position.Y > player.position.Y - 350f) { if (npc.velocity.Y > 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; + 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) { if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.98f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; + 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.velocity.X > 0f) npc.velocity.X *= 0.98f; - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; + 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.velocity.X < 0f) npc.velocity.X *= 0.98f; - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; + npc.velocity.X += death ? 0.12f : 0.1f; + if (npc.velocity.X < -maxVelocityX) + npc.velocity.X = -maxVelocityX; } } @@ -405,8 +407,6 @@ namespace CalamityMod.NPCs.Leviathan else if (npc.ai[0] == 1f) { npc.rotation = npc.velocity.X * 0.02f; - npc.TargetClosest(true); - 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; @@ -425,7 +425,7 @@ namespace CalamityMod.NPCs.Leviathan bool flag103 = false; float num640 = 20f; if (!leviAlive || phase4) - num640 -= 12f * (1f - lifeRatio); + num640 -= death ? 15f * (1f - lifeRatio) : 12f * (1f - lifeRatio); if (npc.ai[1] > num640) { @@ -436,7 +436,7 @@ namespace CalamityMod.NPCs.Leviathan if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 85); + Main.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); @@ -451,45 +451,53 @@ namespace CalamityMod.NPCs.Leviathan if (num1060 > 600f) { - if (npc.position.Y > player.position.Y - 350f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - } - else if (npc.position.Y < player.position.Y - 450f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - 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 -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - } - 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 += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - } - } + float maxVelocityY = death ? 3f : 4f; + float maxVelocityX = death ? 7f : 8f; + maxVelocityY -= enrageScale; + maxVelocityX -= 2f * enrageScale; + + 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; + } + 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.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.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; + } + } else npc.velocity *= 0.9f; npc.spriteDirection = npc.direction; - if (npc.ai[2] > 4f) + float maxBubbleSpawn = death ? 3f : 4f; + if (npc.ai[2] > maxBubbleSpawn) { npc.ai[0] = -1f; npc.ai[1] = 0f; @@ -504,8 +512,11 @@ namespace CalamityMod.NPCs.Leviathan npc.rotation = npc.velocity.X * 0.02f; Vector2 targetVector = player.Center + new Vector2(0f, -350f); - Vector2 vector3 = Vector2.Normalize(targetVector - vector - npc.velocity) * (CalamityWorld.bossRushActive ? 18f : 12f); - float acceleration = CalamityWorld.bossRushActive ? 0.5f : 0.25f; + float velocity = death ? 13.5f : 12f; + velocity += 6f * enrageScale; + 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); @@ -513,24 +524,21 @@ namespace CalamityMod.NPCs.Leviathan 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; if (Main.netMode != NetmodeID.MultiplayerClient && shootProjectiles) { - int projectileDamage = expertMode ? 26 : 32; float projectileVelocity = expertMode ? 3f : 2f; - + projectileVelocity += enrageScale; if (!leviAlive || phase4) - { - projectileDamage += expertMode ? 3 : 4; - projectileVelocity += 2f * (1f - lifeRatio); - } + projectileVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); int totalProjectiles = 8; int projectileDistance = 600; - int projectileType = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); switch ((int)npc.localAI[3]) { case 0: @@ -538,12 +546,12 @@ namespace CalamityMod.NPCs.Leviathan break; case 1: totalProjectiles = 3; - projectileType = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); Main.PlaySound(SoundID.Item30, player.position); break; case 2: totalProjectiles = 6; - projectileType = ModContent.ProjectileType(); + type = ModContent.ProjectileType(); float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.harpNote = soundPitch; Main.PlaySound(SoundID.Item26, player.position); @@ -553,15 +561,16 @@ namespace CalamityMod.NPCs.Leviathan if (npc.localAI[3] > 2f) npc.localAI[3] = 0f; - if (((phase2 || death) && !leviAlive) || phase4) + if ((phase2 && !leviAlive) || phase4) totalProjectiles += totalProjectiles / 2; float radians = MathHelper.TwoPi / totalProjectiles; + 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; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; - Projectile.NewProjectile(spawnVector, velocity, projectileType, projectileDamage, 0f, Main.myPlayer); + Vector2 projVelocity = Vector2.Normalize(player.Center - spawnVector) * projectileVelocity; + Projectile.NewProjectile(spawnVector, projVelocity, type, damage, 0f, Main.myPlayer); } } @@ -573,6 +582,7 @@ namespace CalamityMod.NPCs.Leviathan } float phaseTimer = 300f; + phaseTimer -= 50f * enrageScale; if (!leviAlive || phase4) phaseTimer -= 150f * (1f - lifeRatio); @@ -600,10 +610,11 @@ namespace CalamityMod.NPCs.Leviathan npc.localAI[0] = 0f; // Velocity and rotation - float chargeVelocity = CalamityWorld.bossRushActive ? 31f : (leviAlive && !phase4) ? 21f : 26f; + float chargeVelocity = (leviAlive && !phase4) ? 21f : 26f; + chargeVelocity += 8f * enrageScale; if (revenge) - chargeVelocity += 2f + (death ? 4f : 4f * (1f - lifeRatio)); + 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); @@ -625,6 +636,7 @@ namespace CalamityMod.NPCs.Leviathan // Charge else if (npc.ai[0] == 4f) { + npc.Calamity().canBreakPlayerDefense = true; npc.damage = (int)(npc.defDamage * 1.5); // Spawn dust @@ -680,7 +692,7 @@ namespace CalamityMod.NPCs.Leviathan 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; - float acceleration = CalamityWorld.bossRushActive ? 1f : revenge ? 0.75f : 0.5f; + float acceleration = revenge ? 0.75f : 0.5f; npc.SimpleFlyMovement(vector3, acceleration); // Rotation @@ -769,11 +781,6 @@ namespace CalamityMod.NPCs.Leviathan Leviathan.DropSirenLeviLoot(npc); } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 120, true); - } - public override bool CheckActive() { return false; @@ -782,7 +789,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index f4eb31ce47..dd5b0b8f13 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System.IO; @@ -20,15 +21,15 @@ namespace CalamityMod.NPCs.Leviathan aiType = -1; npc.canGhostHeal = false; npc.noTileCollide = true; - npc.damage = 55; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 100; npc.defense = 10; npc.DR_NERD(0.5f); npc.lifeMax = 650; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 10000; + npc.lifeMax = 1000; } npc.alpha = 255; npc.HitSound = SoundID.NPCHit5; @@ -81,7 +82,7 @@ namespace CalamityMod.NPCs.Leviathan public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) { if (projectile.penetrate == -1 && !projectile.minion) { @@ -112,7 +113,9 @@ namespace CalamityMod.NPCs.Leviathan player.AddBuff(BuffID.Frostburn, 240, true); } - public override void HitEffect(int hitDirection, double damage) + public override bool PreNPCLoot() => false; + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index 7735463328..98d9630126 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 7ba85e8ff2..39bc9c7303 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.lifeMax = 50; if (CalamityWorld.downedCryogen) { - npc.damage = 84; + npc.damage = 60; npc.defense = 10; npc.lifeMax = 1000; } @@ -41,7 +41,6 @@ namespace CalamityMod.NPCs.NormalNPCs banner = npc.type; bannerItem = ModContent.ItemType(); npc.coldDamage = true; - npc.buffImmune[BuffID.Confused] = false; } public override void SendExtraAI(BinaryWriter writer) @@ -126,7 +125,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Frostburn, 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -147,7 +146,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { DropHelper.DropItemChance(npc, ItemID.Leather, 1, 1, 2); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 100); DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCryogen, 3, 1, 1); } } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 7feddec199..b3f815d609 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 38; npc.height = 38; npc.defense = 30; - npc.DR_NERD(0.35f); + npc.DR_NERD(0.25f); npc.lifeMax = CalamityWorld.death ? 30000 : 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; @@ -30,10 +30,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.netAlways = true; npc.dontCountMe = true; banner = ModContent.NPCType(); @@ -51,11 +47,10 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.realLife = (int)npc.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(true); } - npc.velocity.Length(); bool flag = false; if (npc.ai[1] <= 0f) { @@ -145,12 +140,6 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 180, true); - player.AddBuff(BuffID.Electrified, 120, true); - } - public override bool CheckActive() { return false; diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.png b/NPCs/NormalNPCs/ArmoredDiggerBody.png index 2b14139f8a..6f582bdb3e 100644 Binary files a/NPCs/NormalNPCs/ArmoredDiggerBody.png and b/NPCs/NormalNPCs/ArmoredDiggerBody.png differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 79ebf8a079..1f455784a9 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -20,7 +20,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.damage = 90; + npc.Calamity().canBreakPlayerDefense = true; + npc.damage = 90; npc.npcSlots = 10f; npc.width = 54; npc.height = 54; @@ -36,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.netAlways = true; banner = npc.type; bannerItem = ModContent.ItemType(); @@ -51,11 +48,10 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.realLife = (int)npc.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(true); } - npc.velocity.Length(); if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned) @@ -158,7 +154,7 @@ namespace CalamityMod.NPCs.NormalNPCs { flag2 = false; npc.velocity.Y = npc.velocity.Y + 1f; - if ((double)npc.position.Y > (double)((Main.maxTilesY - 200) * 16)) + if ((double)npc.position.Y > Main.rockLayer * 16.0) { npc.velocity.Y = npc.velocity.Y + 1f; num17 = 32f; @@ -389,12 +385,6 @@ namespace CalamityMod.NPCs.NormalNPCs return false; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 240, true); - player.AddBuff(BuffID.Electrified, 180, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.png b/NPCs/NormalNPCs/ArmoredDiggerHead.png index 8d80b2503d..ee6a1bdf46 100644 Binary files a/NPCs/NormalNPCs/ArmoredDiggerHead.png and b/NPCs/NormalNPCs/ArmoredDiggerHead.png differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 2dd4a7fdb8..604131754a 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 34; npc.height = 34; npc.defense = 45; - npc.DR_NERD(0.45f); + npc.DR_NERD(0.35f); npc.lifeMax = CalamityWorld.death ? 30000 : 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; @@ -30,10 +30,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.netAlways = true; npc.dontCountMe = true; banner = ModContent.NPCType(); @@ -51,11 +47,10 @@ namespace CalamityMod.NPCs.NormalNPCs { npc.realLife = (int)npc.ai[3]; } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { npc.TargetClosest(true); } - npc.velocity.Length(); bool flag = false; if (npc.ai[1] <= 0f) { @@ -103,12 +98,6 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 120, true); - player.AddBuff(BuffID.Electrified, 90, true); - } - public override bool CheckActive() { return false; diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.png b/NPCs/NormalNPCs/ArmoredDiggerTail.png index e73630eeab..ce25bd2ffe 100644 Binary files a/NPCs/NormalNPCs/ArmoredDiggerTail.png and b/NPCs/NormalNPCs/ArmoredDiggerTail.png differ diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index 89b768762e..72a085368e 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -29,7 +29,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void HitEffect(int hitDirection, double damage) @@ -58,7 +57,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 120, true); + player.AddBuff(BuffID.Weak, 180, true); } public override void NPCLoot() diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index ac35a6f3c6..676d6adacc 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/BloomSlime.png b/NPCs/NormalNPCs/BloomSlime.png index 7d6669da1d..71e6f267fe 100644 Binary files a/NPCs/NormalNPCs/BloomSlime.png and b/NPCs/NormalNPCs/BloomSlime.png differ diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index f0f138c3cc..ae27dd9ee0 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -14,9 +14,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.aiStyle = -1; + npc.Calamity().canBreakPlayerDefense = true; + npc.aiStyle = -1; aiType = -1; - npc.damage = 150; + npc.damage = 80; npc.width = 40; npc.height = 40; npc.defense = 18; @@ -28,7 +29,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.behindTiles = true; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.JungleTemple.Chance * 0.05f; + return SpawnCondition.JungleTemple.Chance * 0.1f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 49274cd525..9b828a82eb 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -66,7 +66,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.TargetClosest(true); bool flag51 = false; int offsetX = 80; - if (npc.life < npc.lifeMax * 0.33 || (CalamityWorld.death && npc.life < npc.lifeMax * 0.6)) + int projectileDamage = expertMode ? 9 : 12; + if (npc.life < npc.lifeMax * 0.33 || (CalamityWorld.death && npc.life < npc.lifeMax * 0.6)) { num823 = 2f; } @@ -120,7 +121,7 @@ namespace CalamityMod.NPCs.NormalNPCs num830 *= num831; num829 *= 1f + Main.rand.Next(-10, 11) * 0.01f; num830 *= 1f + Main.rand.Next(-10, 11) * 0.01f; - Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), expertMode ? 8 : 11, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } if (npc.ai[1] >= 120f) { @@ -145,7 +146,7 @@ namespace CalamityMod.NPCs.NormalNPCs num830 *= num831; num829 *= 1f + Main.rand.Next(-15, 16) * 0.01f; num830 *= 1f + Main.rand.Next(-15, 16) * 0.01f; - Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), expertMode ? 9 : 12, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } if (npc.ai[1] >= 300f) { @@ -170,7 +171,7 @@ namespace CalamityMod.NPCs.NormalNPCs num845 *= num846; num844 *= 1f + Main.rand.Next(-10, 11) * 0.001f; num845 *= 1f + Main.rand.Next(-10, 11) * 0.001f; - int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, ModContent.ProjectileType(), expertMode ? 11 : 14, 0f, Main.myPlayer, 0f, 0f); + int num848 = Projectile.NewProjectile(vector18.X, vector18.Y, num844, num845, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } if (npc.ai[1] >= 120f) { @@ -195,7 +196,7 @@ namespace CalamityMod.NPCs.NormalNPCs num830 *= num831; num829 *= 1f + Main.rand.Next(-5, 6) * 0.01f; num830 *= 1f + Main.rand.Next(-5, 6) * 0.01f; - int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), expertMode ? 13 : 17, 0f, Main.myPlayer, 0f, 0f); + int num833 = Projectile.NewProjectile(vector18.X, vector18.Y, num829, num830, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer); } if (npc.ai[1] >= 240f) { @@ -295,11 +296,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItem(npc, ItemID.Coral, 1, 3); - DropHelper.DropItem(npc, ItemID.Starfish, 1, 3); - DropHelper.DropItem(npc, ItemID.Seashell, 1, 3); - DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), 0.25f, 0.01f); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); } } } diff --git a/NPCs/NormalNPCs/CosmicElemental.cs b/NPCs/NormalNPCs/CosmicElemental.cs index 5c8e4973b7..67ad59951a 100644 --- a/NPCs/NormalNPCs/CosmicElemental.cs +++ b/NPCs/NormalNPCs/CosmicElemental.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -6,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.NormalNPCs { public class CosmicElemental : ModNPC @@ -30,43 +30,42 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath6; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } - public override void FindFrame(int frameHeight) - { - npc.frameCounter++; - if (npc.frameCounter > 6) - { - npc.frame.Y += frameHeight; - npc.frameCounter = 0; - } - 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; - } - else - { - if (npc.frame.Y >= frameHeight * 6) - npc.frame.Y = 0; - npc.rotation = npc.velocity.X * 0.1f; - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter++; + if (npc.frameCounter > 6) + { + npc.frame.Y += frameHeight; + npc.frameCounter = 0; + } + 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; + } + else + { + 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]; int width = texture.Width; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + SpriteEffects spriteEffects = SpriteEffects.None; + 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); return false; } @@ -82,10 +81,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } player.AddBuff(BuffID.Confused, 180, true); } @@ -106,10 +101,20 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.BoneSword, 10); - DropHelper.DropItemChance(npc, ItemID.Starfury, CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 50); - DropHelper.DropItemChance(npc, ItemID.EnchantedSword, CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 100); - DropHelper.DropItemChance(npc, ItemID.Arkhalis, CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : 1000); + // 10% combined chance to drop any sword. Individual drop rates are: + // Bone Sword: 5% + // Starfury: 2% + // Enchanted Sword: 2% + // Arkhalis: 1% + // Only one sword will ever drop at a time. + if (Main.rand.NextBool(10)) + { + DropHelper.DropItemFromWeightedSet(npc, + DropHelper.WeightStack(ItemID.BoneSword, 5f, 1), + DropHelper.WeightStack(ItemID.Starfury, 2f, 1), + DropHelper.WeightStack(ItemID.EnchantedSword, 2f, 1), + DropHelper.WeightStack(ItemID.Arkhalis, 1f, 1)); + } } } } diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index cbc2623f4f..275d7025b8 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.DesertCave.Chance * 0.0175f; + return SpawnCondition.DesertCave.Chance * 0.025f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index f0d0408b73..7ae78a78d7 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index a29d6d2ed1..105e0c3866 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 8d79eeb493..2290f4035e 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Cavern.Chance * 0.0175f; + return SpawnCondition.Cavern.Chance * 0.025f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 910a452ae1..a2aded5ccf 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Cavern.Chance * 0.0275f; + return SpawnCondition.Cavern.Chance * 0.0325f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index ec639a75dd..c80f035816 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Cavern.Chance * 0.0275f; + return SpawnCondition.Cavern.Chance * 0.025f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 790844b66a..6f489cb649 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Underground.Chance * 0.03f; + return SpawnCondition.Underground.Chance * 0.0325f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index e85e3a7e01..227c74416e 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { if (!detected) - npc.TargetClosest(true); + 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; @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Underground.Chance * 0.0425f; + return SpawnCondition.Underground.Chance * 0.04f; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 107ceb9e89..577d48c3b2 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -34,8 +34,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -66,18 +64,16 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(BuffID.Confused, 120, true); + player.AddBuff(BuffID.Cursed, 60, true); } public override void NPCLoot() { int item = Item.NewItem(npc.Center, npc.Size, ModContent.ItemType(), Main.rand.Next(15, 21), false, 0, false, false); - Main.item[item].color = new Color(250, 50, 50, 255); + 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.DropItemCondition(npc, ModContent.ItemType(), NPC.downedBoss3, 0.01f, 1, 1); } } } diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 143f6375f2..e623d647c6 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -47,7 +46,13 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.Cavern.Chance * 0.08f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } + + public override void HitEffect(int hitDirection, double damage) { // TODO -- This dust was an invalid dust. Replaced with a random dust. int dustType = 91; diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index efd580df12..67a6bedab7 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.NormalNPCs banner = npc.type; bannerItem = ModContent.ItemType(); npc.coldDamage = true; - npc.buffImmune[BuffID.Confused] = false; } public override void AI() @@ -75,12 +74,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.NextBool(3)) - { - player.AddBuff(ModContent.BuffType(), 30, true); - } - } + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 60c5b8402d..308a6c6d61 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -31,8 +31,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -63,7 +61,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.ManaSickness, 120, true); player.AddBuff(BuffID.Weak, 120, true); } diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 2abfd1978f..d34ac6c102 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.Abyss; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -8,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.NormalNPCs { public class Eidolist : ModNPC @@ -28,17 +30,9 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 60; npc.height = 80; npc.lifeMax = 10000; - if (CalamityWorld.death) - { - npc.lifeMax = 13000; - } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 1, 0, 0); - npc.alpha = 50; + npc.Opacity = 0f; npc.noGravity = true; npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit13; @@ -62,8 +56,19 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.4f, 0.5f); - if (npc.justHit) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + 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) { hasBeenHit = true; } @@ -120,7 +125,7 @@ namespace CalamityMod.NPCs.NormalNPCs return; } npc.noTileCollide = true; - float num1446 = 7f; + float num1446 = adultWyrmAlive ? 14f : 7f; float num1447 = 480f; if (npc.localAI[1] == 1f) { @@ -137,12 +142,13 @@ namespace CalamityMod.NPCs.NormalNPCs 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] >= 300f) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= Main.rand.Next(90, 601)) { - npc.localAI[0] = 0f; + 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 = 5f; + 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); @@ -151,7 +157,7 @@ namespace CalamityMod.NPCs.NormalNPCs targetDist = speed / targetDist; targetVec.X *= targetDist; targetVec.Y *= targetDist; - int damage = Main.expertMode ? 30 : 40; + 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); @@ -298,10 +304,26 @@ namespace CalamityMod.NPCs.NormalNPCs { 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); } } - public override void NPCLoot() + public override bool PreNPCLoot() + { + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + return !adultWyrmAlive; + } + + public override void NPCLoot() { if (Main.rand.NextBool(10)) { diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index 6ae21c91e2..35ae98da42 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 1cd38c0b95..365766c901 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Potions; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +25,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.lifeMax = 80; npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; npc.value = Item.buyPrice(0, 0, 0, 80); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -109,7 +108,7 @@ 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) diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 45c387939c..b794a2b37d 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -1,11 +1,9 @@ -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Enemy; -using CalamityMod.World; using Microsoft.Xna.Framework; using System; using System.IO; @@ -16,9 +14,6 @@ namespace CalamityMod.NPCs.NormalNPCs { public class Horse : ModNPC { - private int chargetimer = 0; - private int basespeed = 1; - public override void SetStaticDefaults() { DisplayName.SetDefault("Earth Elemental"); @@ -27,7 +22,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.npcSlots = 3f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 3f; npc.damage = 50; npc.width = 230; npc.height = 230; @@ -36,33 +32,9 @@ namespace CalamityMod.NPCs.NormalNPCs npc.lifeMax = 3800; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 1, 50, 0); + npc.dontTakeDamage = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -71,22 +43,20 @@ namespace CalamityMod.NPCs.NormalNPCs bannerItem = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(chargetimer); - writer.Write(basespeed); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - chargetimer = reader.ReadInt32(); - basespeed = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || - spawnInfo.player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(ModContent.NPCType())) + spawnInfo.player.Calamity().ZoneSunkenSea || NPC.AnyNPCs(npc.type)) { return 0f; } @@ -95,7 +65,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void FindFrame(int frameHeight) { - npc.frameCounter++; + if (npc.ai[0] == 0f) + return; + + npc.frameCounter++; if (npc.frameCounter >= 8) { npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight); @@ -105,10 +78,16 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + // Sandstorm item + DropHelper.DropItem(npc, ModContent.ItemType()); + + // Weapons + float w = DropHelper.BagWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); } public override void HitEffect(int hitDirection, double damage) @@ -120,12 +99,12 @@ namespace CalamityMod.NPCs.NormalNPCs if (npc.life <= 0) { 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.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 - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(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, 31, 0f, 0f, 100, default, 2f); @@ -133,7 +112,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) @@ -150,23 +129,52 @@ namespace CalamityMod.NPCs.NormalNPCs public override bool PreAI() { - if (Main.netMode != NetmodeID.MultiplayerClient) + // Get a target + 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 (npc.ai[0] == 0f) + { + npc.ai[0] = 1f; + npc.dontTakeDamage = false; + } + } + else + npc.TargetClosest(); + + if (npc.ai[0] == 0f) + return false; + + 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.timeLeft > 60) + npc.timeLeft = 60; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] += 1f; if (npc.localAI[0] >= 300f) { npc.localAI[0] = 0f; Main.PlaySound(SoundID.NPCHit43, npc.Center); - npc.TargetClosest(true); + 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 + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)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 + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; + 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; num182 *= num183; @@ -177,12 +185,12 @@ 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 + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + 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 += (float)Main.rand.Next(-40, 41); - num182 += (float)Main.rand.Next(-40, 41); + num180 += Main.rand.Next(-40, 41); + num182 += Main.rand.Next(-40, 41); num180 *= num183; num182 *= num183; Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); @@ -190,33 +198,27 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - if ((double)Math.Abs(npc.velocity.X) > 0.2) - { - npc.spriteDirection = npc.direction; - } - bool expertMode = Main.expertMode; - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; + + 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; direction.Normalize(); - chargetimer += expertMode ? 2 : 1; - if (chargetimer >= (CalamityWorld.death ? 14D : Math.Sqrt(npc.life) * 14D)) - { - if (Main.rand.NextBool(25)) - { - direction.X *= 6f; - direction.Y *= 6f; - npc.velocity = direction; - chargetimer = 0; - } - } - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) > basespeed) - { + npc.ai[1] += Main.expertMode ? 2f : 1f; + if (npc.ai[1] >= 600f) + { + direction *= 6f; + 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)) <= basespeed * 1.15) - { - npc.velocity = direction * basespeed; - } + + 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 8c6b97291f..eae55024b2 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -133,13 +133,8 @@ namespace CalamityMod.NPCs.NormalNPCs 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 = 36; - if (Main.expertMode) - { - num8 = 25; - } int num9 = ProjectileID.FrostBlastHostile; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, 45, 0f, Main.myPlayer, 0f, 0f); Main.projectile[beam].timeLeft = 300; } } @@ -251,11 +246,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.NextBool(3)) - { - player.AddBuff(ModContent.BuffType(), 30, true); - } + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Chilled, 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index 6906c502a4..7c3c9f777a 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -32,27 +32,9 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 60; npc.height = 60; npc.defense = 30; - npc.lifeMax = 11000; + npc.lifeMax = 8250; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.value = Item.buyPrice(0, 0, 50, 0); npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath7; diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 4a1dbd793f..d9178a2d56 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -23,10 +24,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.height = 22; npc.lifeMax = 999; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.noGravity = true; npc.noTileCollide = true; npc.dontTakeDamage = true; @@ -52,15 +49,15 @@ namespace CalamityMod.NPCs.NormalNPCs npc.TargetClosest(true); - float velocity = CalamityWorld.bossRushActive ? 8f : 2f; - float acceleration = CalamityWorld.bossRushActive ? 0.4f : 0.1f; + float velocity = 2f; + float acceleration = 0.1f; if (npc.position.Y > Main.player[npc.target].position.Y - 350f) { if (npc.velocity.Y > 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y *= 0.98f; - npc.velocity.Y = npc.velocity.Y - acceleration; + npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocity) npc.velocity.Y = velocity; @@ -68,30 +65,30 @@ namespace CalamityMod.NPCs.NormalNPCs else if (npc.position.Y < Main.player[npc.target].position.Y - 400f) { if (npc.velocity.Y < 0f) - npc.velocity.Y = npc.velocity.Y * 0.98f; + npc.velocity.Y *= 0.98f; - npc.velocity.Y = npc.velocity.Y + acceleration; + npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocity) npc.velocity.Y = -velocity; } - if (npc.position.X + (float)(npc.width / 2) > Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + 100f) + if (npc.Center.X > Main.player[npc.target].Center.X + 100f) { if (npc.velocity.X > 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; - npc.velocity.X = npc.velocity.X - acceleration; + npc.velocity.X -= acceleration; if (npc.velocity.X > 8f) npc.velocity.X = 8f; } - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - 100f) + if (npc.Center.X < Main.player[npc.target].Center.X - 100f) { if (npc.velocity.X < 0f) - npc.velocity.X = npc.velocity.X * 0.98f; + npc.velocity.X *= 0.98f; - npc.velocity.X = npc.velocity.X + acceleration; + npc.velocity.X += acceleration; if (npc.velocity.X < -8f) npc.velocity.X = -8f; @@ -101,8 +98,8 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.netMode != NetmodeID.MultiplayerClient) { // Fire bolt every 1.5 seconds - npc.localAI[0] += CalamityWorld.bossRushActive ? 2f : 1f; - if (npc.localAI[0] >= (CalamityWorld.death ? 60f : 75f)) + npc.localAI[0] += 1f; + if (npc.localAI[0] >= (CalamityWorld.malice ? 45f : CalamityWorld.death ? 60f : 75f)) { npc.localAI[0] = 0f; @@ -112,10 +109,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 projVector = new Vector2(xDist, yDist); float projLength = projVector.Length(); - float speed = CalamityWorld.bossRushActive ? 18f : 9f; - int damage = 11; - if (CalamityWorld.death) - damage += 1; + float speed = 9f; int type = ModContent.ProjectileType(); projLength = speed / projLength; @@ -134,12 +128,24 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.rand.NextBool(2)) { Main.dust[ruby].scale = 0.5f; - Main.dust[ruby].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[ruby].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - Main.PlaySound(SoundID.Item8, npc.position); - int proj = Projectile.NewProjectile(npcPos, projVector, type, damage, 0f, Main.myPlayer, 0f, 0f); + Main.PlaySound(SoundID.Item8, npc.position); + int damage = npc.GetProjectileDamage(type); + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(9); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(npcPos, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else + Projectile.NewProjectile(npcPos, projVector, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 9b5ec16f19..1b5483f5bb 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,8 +29,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.Daybreak] = true; - npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -81,9 +80,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, 0, 0f, Main.myPlayer); - } + Projectile.NewProjectile(player.Center, Vector2.Zero, ProjectileID.SolarWhipSwordExplosion, 0, 0f, Main.myPlayer); } public override void FindFrame(int frameHeight) @@ -96,10 +93,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) - { + if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneSulphur) return 0f; - } + return SpawnCondition.OceanMonster.Chance * 0.2f; } diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index b28e55aca3..f2712b0592 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -28,14 +28,13 @@ namespace CalamityMod.NPCs.NormalNPCs npc.height = 40; npc.defense = 18; npc.DR_NERD(0.15f); - npc.lifeMax = NPC.downedMoonlord ? 1800 : 135; + 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.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) @@ -411,11 +410,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - } + player.AddBuff(ModContent.BuffType(), 120); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index a0d29f1d89..880a27cbb7 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index e0f8c11c66..7bba946c20 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -26,7 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.height = 22; npc.defense = 20; npc.DR_NERD(0.1f); - npc.lifeMax = NPC.downedMoonlord ? 1600 : 120; + npc.lifeMax = NPC.downedMoonlord ? 1200 : 120; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -35,7 +35,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath36; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) @@ -405,11 +404,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - } + player.AddBuff(ModContent.BuffType(), 120); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 1a237a85a5..e66a369c14 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -48,14 +48,6 @@ namespace CalamityMod.NPCs.NormalNPCs dust.noGravity = true; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120); - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 9d04d86d29..675aa92d54 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -26,8 +26,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 32; npc.height = 32; npc.scale = 1.2f; - npc.defense = 40; - npc.lifeMax = 9000; + npc.defense = 30; + npc.lifeMax = 3000; npc.knockBackResist = 0f; aiType = -1; npc.value = Item.buyPrice(0, 0, 60, 0); @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { - float speed = CalamityWorld.death ? 16f : 12f; + float speed = (CalamityWorld.death || CalamityWorld.malice) ? 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); Dust dust = Main.dust[num822]; @@ -85,25 +85,17 @@ namespace CalamityMod.NPCs.NormalNPCs } if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) { - float num151 = 5f; - int num152 = Main.expertMode ? 53 : 65; - int num153 = ModContent.ProjectileType(); - num149 = num151 / num149; + float num151 = 10f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + num149 = num151 / num149; num147 *= num149; num148 *= num149; - int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); + int num154 = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 39ba86fb80..a07e784202 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -24,8 +24,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 32; npc.height = 32; npc.scale = 1.1f; - npc.defense = 30; - npc.lifeMax = 2100; + npc.defense = 25; + npc.lifeMax = 2000; npc.knockBackResist = 0.1f; aiType = -1; npc.value = Item.buyPrice(0, 0, 40, 0); @@ -57,14 +57,6 @@ namespace CalamityMod.NPCs.NormalNPCs return; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 150); - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 2f985e1030..041f23bcd7 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -55,14 +55,6 @@ namespace CalamityMod.NPCs.NormalNPCs dust.noGravity = true; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 150); - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 6fdfb9a214..b5bd05a9d6 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.aiStyle = 7; aiType = NPCID.Squirrel; npc.knockBackResist = 0.99f; - npc.value = Item.buyPrice(0, 10, 0, 0); + npc.value = Item.buyPrice(0, 2, 0, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; diff --git a/NPCs/NormalNPCs/Pitbull.cs b/NPCs/NormalNPCs/Pitbull.cs index 304f6eef89..b23b78abea 100644 --- a/NPCs/NormalNPCs/Pitbull.cs +++ b/NPCs/NormalNPCs/Pitbull.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -29,7 +30,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath5; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) @@ -63,8 +63,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - int bandageDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 50 : 100; - DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, bandageDropRate, 1, 1); + float bandageDropRate = Main.expertMode ? 0.02f : 0.01f; + DropHelper.DropItemChance(npc, ItemID.AdhesiveBandage, bandageDropRate); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 8); } } } diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.png b/NPCs/NormalNPCs/PlaguedJungleSlime.png deleted file mode 100644 index 9f72a76d2f..0000000000 Binary files a/NPCs/NormalNPCs/PlaguedJungleSlime.png and /dev/null differ diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index ed4f99cf74..7304c27f16 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; @@ -222,7 +223,12 @@ namespace CalamityMod.NPCs.NormalNPCs return true; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 09a6a44ceb..a0232bebe2 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -15,7 +15,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { npc.npcSlots = 2f; - npc.damage = 110; + npc.damage = 70; npc.aiStyle = 39; npc.width = 46; npc.height = 32; @@ -31,7 +31,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noGravity = false; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index a126e8d05c..4d454791a3 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -20,34 +20,17 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - npc.npcSlots = 3f; + 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 = 16000; + npc.lifeMax = 12000; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.lavaImmune = true; npc.value = Item.buyPrice(0, 0, 50, 0); npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ScornDeath"); @@ -176,7 +159,12 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.OverworldHallow.Chance / 4f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.soundDelay == 0) { diff --git a/NPCs/NormalNPCs/SeaUrchin.cs b/NPCs/NormalNPCs/SeaUrchin.cs index c4cc6ec4ce..e1e7e8cc7a 100644 --- a/NPCs/NormalNPCs/SeaUrchin.cs +++ b/NPCs/NormalNPCs/SeaUrchin.cs @@ -29,7 +29,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.behindTiles = true; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void AI() diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 3fa97855bb..b6cca2936c 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -40,43 +40,41 @@ namespace CalamityMod.NPCs.NormalNPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times - if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 60f) { 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 projSpeed = 12f; //speed of projectile + float projSpeed = 12f; 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; Vector2 velocity = new Vector2(targetX, targetY); float targetDist = velocity.Length(); - npc.netUpdate = true; targetDist = projSpeed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - int projDmg = 30; //projectile damage + int projDmg = 30; if (Main.expertMode) { projDmg = 22; } - int projType = ProjectileID.MartianTurretBolt; //projectile ID + int projType = ProjectileID.MartianTurretBolt; if (Main.rand.NextBool(8)) { - projType = ProjectileID.SaucerLaser; //more powerful projectile ID + projType = ProjectileID.SaucerLaser; } npcPos.X += velocity.X; npcPos.Y += velocity.Y; - for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice + for (int num186 = 0; num186 < 2; num186++) { velocity = Main.player[npc.target].Center - npcPos; targetDist = velocity.Length(); targetDist = projSpeed / targetDist; - velocity.X += (float)Main.rand.Next(-20, 21); //projectile spreadX - velocity.Y += (float)Main.rand.Next(-20, 21); //projectile spreadY + velocity.X += Main.rand.Next(-20, 21); + velocity.Y += Main.rand.Next(-20, 21); velocity.X *= targetDist; velocity.Y *= targetDist; Projectile.NewProjectile(npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); @@ -92,23 +90,16 @@ namespace CalamityMod.NPCs.NormalNPCs Player player8 = Main.player[npc.target]; if (npc.target < 0 || npc.target == Main.maxPlayers || player8.dead || !player8.active) { - npc.TargetClosest(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 (npc.ai[0] == 0f) - { - npc.ai[0] = -1f; - } - if (npc.ai[0] == 2f) - { - npc.ai[0] = -2f; - } + npc.ai[0] = -1f; npc.netUpdate = true; } - if (npc.ai[0] == -1f || npc.ai[0] == -2f) + if (npc.ai[0] == -1f) { npc.velocity.Y = npc.velocity.Y - 0.4f; if (npc.timeLeft > 10) @@ -118,14 +109,6 @@ namespace CalamityMod.NPCs.NormalNPCs if (!player8.dead) { npc.timeLeft = 300; - if (npc.ai[0] == -2f) - { - npc.ai[0] = 2f; - } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 0f; - } npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -369,163 +352,6 @@ namespace CalamityMod.NPCs.NormalNPCs return; } } - else if (npc.ai[0] == 1f) - { - npc.velocity *= 0.96f; - float num1603 = 150f; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1603) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.rotation = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] < 40f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * MathHelper.TwoPi), default).Y * 0.2f; - return; - } - if (npc.ai[1] < 80f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * MathHelper.TwoPi), default).Y * 0.3f; - return; - } - if (npc.ai[1] < 120f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * MathHelper.TwoPi), default).Y * 0.4f; - return; - } - npc.rotation = (npc.ai[1] - 120f) / 30f * MathHelper.TwoPi; - return; - } - else if (npc.ai[0] == 2f) - { - float num1605 = 3600f; - float num1606 = 120f; - float num1607 = 60f; - int num1608 = 0; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - int num1609 = num1608; - num1608 = 0; - npc.ai[3] += 1f; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - if (num1608 != num1609) - { - if (num1608 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) - { - 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 projSpeed = 11f; - 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; - Vector2 velocity = new Vector2(targetX, targetY); - float targetDist = velocity.Length(); - npc.netUpdate = true; - targetDist = projSpeed / targetDist; - velocity.X *= targetDist; - velocity.Y *= targetDist; - int projDmg = 50; - if (Main.expertMode) - { - projDmg = 28; - } - int projType = ProjectileID.SaucerLaser; - npcPos.X += velocity.X; - npcPos.Y += velocity.Y; - for (int num186 = 0; num186 < 2; num186++) - { - velocity.X = Main.player[npc.target].Center.X - npcPos.X; - velocity.Y = Main.player[npc.target].Center.Y - npcPos.Y; - targetDist = velocity.Length(); - targetDist = projSpeed / targetDist; - velocity.X += (float)Main.rand.Next(-20, 21); - velocity.Y += (float)Main.rand.Next(-20, 21); - velocity.X *= targetDist; - velocity.Y *= targetDist; - Projectile.NewProjectile(npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Main.PlaySound(SoundID.Item12, npc.position); - } - npc.netUpdate = true; - } - if (npc.ai[3] >= num1605) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else if (num1608 == 0) - { - Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; - vector199.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); - } - else - { - int num1610 = (int)npc.Center.X / 16; - int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1612 = 0; - bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; - if (flag155) - { - num1612 = 1; - } - else - { - while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) - { - int num1613 = num1611 + num1612; - bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; - if (flag156) - { - num1612--; - break; - } - num1612++; - } - } - float num1614 = (float)(num1612 * 16); - float num1615 = 250f; - if (num1614 < num1615) - { - float num1616 = -4f; - if (-num1616 > num1614) - { - num1616 = -num1614; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 8f * npc.ai[2]; - } - npc.rotation = 0f; - } } public override void FindFrame(int frameHeight) @@ -560,11 +386,6 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.Sky.Chance * 0.1f; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } - public override void NPCLoot() { DropHelper.DropItemCondition(npc, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index 4eb682ee86..25890ef067 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -30,7 +30,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath34; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void HitEffect(int hitDirection, double damage) @@ -45,6 +44,10 @@ namespace CalamityMod.NPCs.NormalNPCs { 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); } } diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index b032348043..b99d1cc2a2 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -11,14 +11,14 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetStaticDefaults() { DisplayName.SetDefault("Sun Bat"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[npc.type] = 7; } public override void SetDefaults() { npc.lavaImmune = true; - npc.aiStyle = 14; - aiType = NPCID.Lavabat; + npc.aiStyle = -1; + aiType = -1; npc.damage = 35; npc.width = 26; npc.height = 20; @@ -30,22 +30,28 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath4; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } - public override void FindFrame(int frameHeight) + public override void AI() + { + CalamityGlobalAI.BuffedBatAI(npc, mod); + } + + public override void FindFrame(int frameHeight) { - npc.frameCounter += 0.15f; + if (npc.velocity.X > 0f) + npc.spriteDirection = 1; + if (npc.velocity.X < 0f) + npc.spriteDirection = -1; + + 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; } - public override void AI() - { - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.Calamity().ZoneAbyss || @@ -58,7 +64,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/NPCs/NormalNPCs/SunBat.png b/NPCs/NormalNPCs/SunBat.png index da2aaee53d..6ff96a2516 100644 Binary files a/NPCs/NormalNPCs/SunBat.png and b/NPCs/NormalNPCs/SunBat.png differ diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index cfb9ab90f9..a07e784564 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -215,7 +215,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/NPCs/NormalNPCs/Sunskater.png b/NPCs/NormalNPCs/Sunskater.png index a1ac90a518..3deddfca1f 100644 Binary files a/NPCs/NormalNPCs/Sunskater.png and b/NPCs/NormalNPCs/Sunskater.png differ diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index 034a8ac109..6c3660dc0e 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -21,7 +21,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath2; npc.value = 0f; npc.knockBackResist = 0f; - npc.buffImmune[BuffID.Confused] = false; npc.netAlways = true; npc.aiStyle = 0; } diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 1c3815a642..ebf827fcd5 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; @@ -31,18 +30,10 @@ namespace CalamityMod.NPCs.NormalNPCs npc.defense = 18; npc.DR_NERD(0.05f); npc.lifeMax = 6000; - if (CalamityWorld.downedProvidence) - { - npc.damage = 190; - npc.defense = 60; - npc.lifeMax = 30000; - } npc.knockBackResist = 0.05f; npc.value = Item.buyPrice(0, 1, 50, 0); npc.HitSound = SoundID.NPCHit23; npc.DeathSound = SoundID.NPCDeath39; - npc.buffImmune[20] = true; - npc.buffImmune[44] = true; npc.noGravity = true; npc.noTileCollide = true; npc.rarity = 2; @@ -289,7 +280,12 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.Sky.Chance * 0.1f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -307,7 +303,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 2, 3); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence, 100, 1, 1); DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); } diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index f04a622f9e..3de37e340d 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -1,11 +1,12 @@ -using CalamityMod.Items.Materials; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; using System; using Microsoft.Xna.Framework; +using System.IO; namespace CalamityMod.NPCs.NormalNPCs { @@ -36,7 +37,9 @@ namespace CalamityMod.NPCs.NormalNPCs get => npc.ai[3]; set => npc.ai[3] = value; } + public bool Supercharged => SuperchargeTimer > 0; + public ref float FlyAwayTimer => ref npc.localAI[0]; public const float TotalHorizontalChargeTime = 75f; public override void SetStaticDefaults() @@ -64,31 +67,46 @@ namespace CalamityMod.NPCs.NormalNPCs bannerItem = ModContent.ItemType(); } + public override void SendExtraAI(BinaryWriter writer) => writer.Write(FlyAwayTimer); + + public override void ReceiveExtraAI(BinaryReader reader) => FlyAwayTimer = reader.ReadSingle(); + public override void AI() { npc.TargetClosest(false); Player player = Main.player[npc.target]; - bool farFromPlayer = npc.Distance(player.Center) > 640f; + bool farFromPlayer = npc.Distance(player.Center) > 920f; 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) { npc.TargetClosest(false); player = Main.player[npc.target]; - farFromPlayer = npc.Distance(player.Center) > 640f; + farFromPlayer = npc.Distance(player.Center) > 920f; 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) { - npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * -8f, 0.1f); - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); - npc.noTileCollide = true; + if (FlyAwayTimer > 480) + { + 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)); + FlyAwayTimer++; + } return; } } + FlyAwayTimer = Utils.Clamp(FlyAwayTimer - 3, 0, 180); + npc.noTileCollide = !farFromPlayer; if (Supercharged) @@ -100,8 +118,9 @@ namespace CalamityMod.NPCs.NormalNPCs { if (npc.direction == 0) npc.direction = 1; + Vector2 destination = player.Center + new Vector2(300f * npc.direction, -90f); - npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(destination) * 8f, 0.1f); + npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(destination) * 8f, 0.1f); if (npc.Distance(destination) < 40f) { Time++; @@ -116,13 +135,11 @@ namespace CalamityMod.NPCs.NormalNPCs else { if (HorizontalChargeTime < 25) - { - npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(player.Center) * 8f, 0.1f); - } + npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(player.Center) * 8f, 0.1f); + if (Supercharged && Main.netMode != NetmodeID.MultiplayerClient && HorizontalChargeTime % 30f == 29f) - { - Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.DirectionTo(player.Center) * 6f, ProjectileID.MartianTurretBolt, 14, 0f); - } + Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.MartianTurretBolt, 14, 0f); + HorizontalChargeTime++; if (HorizontalChargeTime > TotalHorizontalChargeTime) { @@ -156,7 +173,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 3f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) return 0f; @@ -182,7 +199,7 @@ namespace CalamityMod.NPCs.NormalNPCs { DropHelper.DropItem(npc, ModContent.ItemType(), 1, 3); DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + 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 0e980fa37f..8aef4b7e2a 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; @@ -48,7 +49,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath14; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) @@ -73,17 +73,21 @@ namespace CalamityMod.NPCs.NormalNPCs 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 (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; } SuperchargeTimer--; } // Jump if there's an obstacle ahead. - if (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; } if (Collision.CanHitLine(player.position, player.width, player.height, npc.position, npc.width, npc.height) && Math.Abs(player.Center.X - npc.Center.X) < PlayerSearchDistance && @@ -93,18 +97,21 @@ namespace CalamityMod.NPCs.NormalNPCs if (npc.direction != direction) { npc.direction = direction; + npc.netSpam = 0; npc.netUpdate = true; } } - else if (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; } if (npc.oldPosition == npc.position) { TimeSpentStuck++; - if (TimeSpentStuck > StuckJumpPromptTime) + if (Main.netMode != NetmodeID.MultiplayerClient && TimeSpentStuck > StuckJumpPromptTime) { npc.velocity.Y = JumpSpeed; TimeSpentStuck = 0f; @@ -112,9 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs } } else - { TimeSpentStuck = 0f; - } npc.velocity.X = MathHelper.Lerp(npc.velocity.X, MaxMovementSpeedX * npc.direction * (Supercharged ? 1.333f : 1f), Supercharged ? 0.025f : 0.015f); Vector4 adjustedVectors = Collision.WalkDownSlope(npc.position, npc.velocity, npc.width, npc.height, NPCGravity); @@ -145,7 +150,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 3f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.0333f : 0.115f) * pylonMult; @@ -173,6 +178,7 @@ namespace CalamityMod.NPCs.NormalNPCs { 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 16d3f2c633..acce509c13 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; @@ -40,6 +41,7 @@ namespace CalamityMod.NPCs.NormalNPCs set => npc.ai[3] = value; } public bool Supercharged => SuperchargeTimer > 0; + public ref float FlyAwayTimer => ref npc.localAI[0]; public const float StunTimeMax = 45f; public const float SearchXOffset = 345f; @@ -73,11 +75,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SendExtraAI(BinaryWriter writer) { writer.Write(StunTime); + writer.Write(FlyAwayTimer); } public override void ReceiveExtraAI(BinaryReader reader) { StunTime = reader.ReadSingle(); + FlyAwayTimer = reader.ReadSingle(); } public override void FindFrame(int frameHeight) @@ -96,25 +100,36 @@ namespace CalamityMod.NPCs.NormalNPCs Player player = Main.player[npc.target]; - bool farFromPlayer = npc.Distance(player.Center) > 640f; + bool farFromPlayer = npc.Distance(player.Center) > 920f; 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) { npc.TargetClosest(false); player = Main.player[npc.target]; - farFromPlayer = npc.Distance(player.Center) > 640f; + farFromPlayer = npc.Distance(player.Center) > 920f; 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) { - npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * -8f, 0.1f); - npc.rotation = npc.rotation.AngleTowards(0f, MathHelper.ToRadians(15f)); - npc.noTileCollide = true; + if (FlyAwayTimer > 150) + { + 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)); + FlyAwayTimer++; + } return; } } + FlyAwayTimer = Utils.Clamp(FlyAwayTimer - 3, 0, 180); + npc.noTileCollide = !farFromPlayer; Lighting.AddLight(npc.Center - Vector2.UnitY * 8f, Color.Lime.ToVector3() * 1.5f); @@ -152,11 +167,11 @@ namespace CalamityMod.NPCs.NormalNPCs AIState == HovercraftAIState.Hover) { Vector2 destination = player.Center + new Vector2(SearchXOffset * SearchDirection, -160f); - npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 8.5f : 6f); + npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 8.5f : 6f); if (AIState == HovercraftAIState.Hover) { destination = player.Center + new Vector2(SearchXOffset * -SearchDirection, -160f); - npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 7f : 5f); + npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 7f : 5f); } npc.rotation = npc.velocity.X / 16f; @@ -223,7 +238,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 3f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.025f : 0.1f) * pylonMult; @@ -257,6 +272,7 @@ namespace CalamityMod.NPCs.NormalNPCs { 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 51dcae7194..d680d7905f 100644 --- a/NPCs/NormalNPCs/WulfrumPylon.cs +++ b/NPCs/NormalNPCs/WulfrumPylon.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using Terraria; @@ -5,6 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; using System.Collections.Generic; +using CalamityMod.World; namespace CalamityMod.NPCs.NormalNPCs { @@ -26,8 +28,8 @@ namespace CalamityMod.NPCs.NormalNPCs ModContent.NPCType(), ModContent.NPCType() }; - public const float ChargeRadiusMax = 200f; - public const float SuperchargeTime = 600f; + public const float ChargeRadiusMax = 495f; + public const float SuperchargeTime = 720f; public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Pylon"); @@ -42,14 +44,13 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 44; npc.height = 44; npc.defense = 4; - npc.lifeMax = 49; + 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; - npc.buffImmune[BuffID.Confused] = false; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -60,8 +61,31 @@ namespace CalamityMod.NPCs.NormalNPCs Player player = Main.player[npc.target]; - if (!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; + for (int i = 0; i < enemiesToSpawn; i++) + { + int tries = 0; + Vector2 spawnPosition; + do + { + spawnPosition = player.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(600f, 1015f) * new Vector2(1.5f, 1f); + if (spawnPosition.Y > player.Center.Y) + spawnPosition.Y = player.Center.Y; + if (tries > 500) + break; + tries++; + } + while (WorldGen.SolidTile(CalamityUtils.ParanoidTileRetrieval((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16))); + + if (tries < 500) + { + int npcToSpawn = Main.rand.NextBool(2) ? ModContent.NPCType() : ModContent.NPCType(); + NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, npcToSpawn); + } + } Charging = true; npc.netUpdate = true; } @@ -71,12 +95,13 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.rand.NextBool(4)) { - float dustCount = MathHelper.TwoPi * ChargeRadius / 5f; + float dustCount = MathHelper.TwoPi * ChargeRadius / 8f; 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.scale = 0.7f; dust.noGravity = true; dust.velocity = npc.velocity; } @@ -91,8 +116,7 @@ namespace CalamityMod.NPCs.NormalNPCs // For some strange reason, the Wulfrum Rover is not counted when it's added to a static list. // What I assume is going on is that it hasn't been loaded yet since it's later alphabetically (Pylon is before Rover). // As a result, they are checked separately. - if (!SuperchargableEnemies.Contains(npcAtIndex.type) && - npcAtIndex.type != ModContent.NPCType()) + if (!SuperchargableEnemies.Contains(npcAtIndex.type) && npcAtIndex.type != ModContent.NPCType()) continue; if (npcAtIndex.ai[3] > 0f) continue; @@ -157,6 +181,7 @@ namespace CalamityMod.NPCs.NormalNPCs { 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 cc3f5d4254..f6d0c8368d 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -43,7 +43,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath14; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } public override void FindFrame(int frameHeight) @@ -94,7 +93,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 3f : 1f; + float pylonMult = NPC.AnyNPCs(ModContent.NPCType()) ? 5.5f : 1f; if (spawnInfo.playerSafe || spawnInfo.player.Calamity().ZoneSulphur) return 0f; return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.135f) * pylonMult; @@ -141,6 +140,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index 8ac0ef9fb2..467bc4aa84 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = ModContent.ItemType(); - npc.buffImmune[BuffID.Confused] = false; } /*public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 3608c3dcc8..9459854e2b 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -34,14 +35,14 @@ namespace CalamityMod.NPCs.OldDuke public override void SetDefaults() { - npc.width = 150; + npc.width = 150; npc.height = 100; npc.aiStyle = -1; aiType = -1; - npc.damage = 200; - npc.defense = 100; + npc.GetNPCDamage(); + npc.defense = 90; npc.DR_NERD(0.5f, null, null, null, true); - npc.LifeMaxNERB(750000, 1000000, 4000000); + npc.LifeMaxNERB(412500, 495000, 400000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -50,32 +51,32 @@ namespace CalamityMod.NPCs.OldDuke npc.npcSlots = 15f; npc.HitSound = SoundID.NPCHit14; npc.DeathSound = SoundID.NPCDeath20; - npc.value = Item.buyPrice(0, 75, 0, 0); + npc.value = Item.buyPrice(0, 70, 0, 0); npc.boss = true; npc.netAlways = true; npc.timeLeft = NPC.activeTime * 30; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BoomerDuke"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("BoomerDuke") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } } public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[0]); + writer.Write(npc.rotation); + writer.Write(npc.spriteDirection); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); + npc.rotation = reader.ReadSingle(); + npc.spriteDirection = reader.ReadInt32(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() @@ -86,7 +87,7 @@ namespace CalamityMod.NPCs.OldDuke public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void FindFrame(int frameHeight) @@ -100,7 +101,7 @@ namespace CalamityMod.NPCs.OldDuke num114 = tired ? 12 : 6; } npc.frameCounter += 1D; - if (npc.frameCounter > (double)num114) + if (npc.frameCounter > num114) { npc.frameCounter = 0D; npc.frame.Y += frameHeight; @@ -121,7 +122,7 @@ namespace CalamityMod.NPCs.OldDuke if (npc.ai[0] == 3f || npc.ai[0] == 8f || npc.ai[0] == 13f || npc.ai[0] == -1f) { int num115 = 120; - if (npc.ai[2] < (float)(num115 - 50) || npc.ai[2] > (float)(num115 - 10)) + if (npc.ai[2] < (num115 - 50) || npc.ai[2] > (num115 - 10)) { npc.frameCounter += 1D; if (npc.frameCounter > 7D) @@ -137,7 +138,7 @@ namespace CalamityMod.NPCs.OldDuke else { npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > (float)(num115 - 40) && npc.ai[2] < (float)(num115 - 15)) + if (npc.ai[2] > (num115 - 40) && npc.ai[2] < (num115 - 15)) { npc.frame.Y = frameHeight * 6; } @@ -146,7 +147,7 @@ namespace CalamityMod.NPCs.OldDuke if (npc.ai[0] == 4f || npc.ai[0] == 9f) { int num116 = 180; - if (npc.ai[2] < (float)(num116 - 60) || npc.ai[2] > (float)(num116 - 20)) + if (npc.ai[2] < (num116 - 60) || npc.ai[2] > (num116 - 20)) { npc.frameCounter += 1D; if (npc.frameCounter > 7D) @@ -162,7 +163,7 @@ namespace CalamityMod.NPCs.OldDuke else { npc.frame.Y = frameHeight * 5; - if (npc.ai[2] > (float)(num116 - 50) && npc.ai[2] < (float)(num116 - 25)) + if (npc.ai[2] > (num116 - 50) && npc.ai[2] < (num116 - 25)) { npc.frame.Y = frameHeight * 6; } @@ -178,7 +179,7 @@ namespace CalamityMod.NPCs.OldDuke spriteEffects = SpriteEffects.FlipHorizontally; } Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(texture2D15.Width / 2), (float)(texture2D15.Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[npc.type] / 2); Color color = lightColor; Color color36 = Color.White; float amount9 = 0f; @@ -194,10 +195,10 @@ namespace CalamityMod.NPCs.OldDuke { color = CalamityGlobalNPC.buffColor(color, 0.5f, 0.7f, 0.5f, 1f); } - else if (npc.ai[0] == 4f && npc.ai[2] > (float)num150) + else if (npc.ai[0] == 4f && npc.ai[2] > num150) { - float num152 = npc.ai[2] - (float)num150; - num152 /= (float)num151; + 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); } @@ -228,10 +229,10 @@ namespace CalamityMod.NPCs.OldDuke Color color38 = color; color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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); } } @@ -249,19 +250,19 @@ namespace CalamityMod.NPCs.OldDuke { int num158 = 60; int num159 = 30; - if (npc.ai[2] > (float)num158) + if (npc.ai[2] > num158) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)((npc.ai[2] - (float)num158) / (float)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] > (float)num150) + if ((npc.ai[0] == 4f || npc.ai[0] == 9f) && npc.ai[2] > num150) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)((npc.ai[2] - (float)num150) / (float)num151 * MathHelper.TwoPi)); + num157 = 1f - (float)Math.Cos((npc.ai[2] - num150) / num151 * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 60f; } @@ -269,7 +270,7 @@ namespace CalamityMod.NPCs.OldDuke if (npc.ai[0] == 12f) { num156 = 6; - num157 = 1f - (float)Math.Cos((double)(npc.ai[2] / 30f * MathHelper.TwoPi)); + num157 = 1f - (float)Math.Cos(npc.ai[2] / 30f * MathHelper.TwoPi); num157 /= 3f; scaleFactor9 = 20f; } @@ -282,9 +283,9 @@ namespace CalamityMod.NPCs.OldDuke color39 = Color.Lerp(color39, color36, amount9); 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, 4f + npc.gfxOffY); + 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); } } @@ -293,8 +294,8 @@ namespace CalamityMod.NPCs.OldDuke 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, 4f + npc.gfxOffY); + 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) @@ -310,8 +311,8 @@ namespace CalamityMod.NPCs.OldDuke if (npc.ai[0] == 4f || npc.ai[0] == 9f) { - float num161 = npc.ai[2] - (float)num150; - num161 /= (float)num151; + float num161 = npc.ai[2] - num150; + num161 /= num151; color36 *= num161; color40 *= num161; } @@ -336,10 +337,10 @@ namespace CalamityMod.NPCs.OldDuke { 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, 4f + npc.gfxOffY); + 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); } @@ -349,9 +350,9 @@ namespace CalamityMod.NPCs.OldDuke color42 = Color.Lerp(color42, color36, amount9); 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, 4f + npc.gfxOffY); + 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); } } @@ -364,16 +365,18 @@ namespace CalamityMod.NPCs.OldDuke public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } public override void NPCLoot() { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Old Duke + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedBoomerDuke); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedBoomerDuke, 6, 3, 2); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedBoomerDuke); @@ -381,7 +384,7 @@ namespace CalamityMod.NPCs.OldDuke if (!Main.expertMode) { // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -400,7 +403,10 @@ namespace CalamityMod.NPCs.OldDuke // Mark Old Duke as dead CalamityWorld.downedBoomerDuke = true; - CalamityMod.UpdateServerBoolean(); + + // Mark first acid rain encounter as true even if he wasn't fought in the acid rain, because it makes sense + CalamityWorld.encounteredOldDuke = true; + CalamityNetcode.SyncWorld(); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -411,10 +417,7 @@ namespace CalamityMod.NPCs.OldDuke public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - player.AddBuff(BuffID.Poisoned, 300, true); - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 480); } public override void HitEffect(int hitDirection, double damage) @@ -422,9 +425,9 @@ namespace CalamityMod.NPCs.OldDuke if (npc.life > 0) { int num211 = 0; - while ((double)num211 < damage / (double)npc.lifeMax * 100.0) + while (num211 < damage / npc.lifeMax * 100.0) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, (float)hitDirection, -1f, 0, default(Color), 1f); + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, hitDirection, -1f, 0, default, 1f); num211++; } } @@ -432,13 +435,13 @@ namespace CalamityMod.NPCs.OldDuke { for (int num212 = 0; num212 < 150; num212++) { - Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.SulfurousSeaAcid, (float)(2 * hitDirection), -2f, 0, default(Color), 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 * (float)npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore"), npc.scale); - Gore.NewGore(npc.Center + Vector2.UnitX * 20f * (float)npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore2"), npc.scale); - Gore.NewGore(npc.Center - Vector2.UnitX * 20f * (float)npc.direction, npc.velocity, mod.GetGoreSlot("Gores/OldDuke/OldDukeGore3"), npc.scale); - Gore.NewGore(npc.Center - Vector2.UnitX * 20f * (float)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 c04ebc6469..250e81f5e2 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -8,6 +8,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; +using CalamityMod.Events; using CalamityMod.World; namespace CalamityMod.NPCs.OldDuke @@ -23,16 +24,17 @@ namespace CalamityMod.NPCs.OldDuke public override void SetDefaults() { + npc.Calamity().canBreakPlayerDefense = true; npc.aiStyle = -1; aiType = -1; npc.width = 44; npc.height = 44; - npc.damage = 180; + npc.GetNPCDamage(); npc.defense = 100; - npc.lifeMax = 8000; - if (CalamityWorld.bossRushActive) + npc.lifeMax = 6000; + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; @@ -41,10 +43,6 @@ namespace CalamityMod.NPCs.OldDuke npc.noGravity = true; npc.dontTakeDamage = true; npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } } public override void SendExtraAI(BinaryWriter writer) @@ -63,6 +61,11 @@ namespace CalamityMod.NPCs.OldDuke public override void AI() { + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { npc.TargetClosest(false); @@ -84,15 +87,27 @@ namespace CalamityMod.NPCs.OldDuke if (npc.alpha < 0) npc.alpha = 0; + // Fly towards Old Duke bool normalAI = npc.ai[3] == 0f; + + // Fly up bool upwardAI = npc.ai[3] < 0f; + + // Fly down bool downwardAI = npc.ai[3] > 0f; - float aiGateValue = normalAI ? 210f : 175f; - float maxVelocity = 18f; + float flyTowardTargetGateValue = malice ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; + float extraTime = malice ? 90f : death ? 100f : revenge ? 105f : expertMode ? 110f : 120f; + float aiGateValue = flyTowardTargetGateValue + extraTime; + if (!normalAI) + aiGateValue -= extraTime * 0.3f; + float explodeIntoGoreGateValue = aiGateValue + extraTime; + float fallDownGateValue = aiGateValue + extraTime * 0.5f; + float maxVelocity = malice ? 25f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; if (npc.ai[0] == 0f) { + // Set velocity to fly towards a specified location on the first frame if (npc.ai[1] == 0f) { if (normalAI) @@ -103,46 +118,50 @@ namespace CalamityMod.NPCs.OldDuke Main.PlaySound(SoundID.NPCDeath19, npc.position); } + // Fly towards a target after a certain time has passed npc.ai[1] += 1f; - if (npc.ai[1] >= 90f) + 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 not set to fly towards Old Duke from the start, accelerate if (!normalAI) { 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; vector17.Normalize(); vector17 *= scaleFactor2; - npc.velocity = (npc.velocity * 24f + vector17) / 25f; + float inertia = malice ? 15f : death ? 18f : revenge ? 20f : expertMode ? 22f : 25f; + npc.velocity = (npc.velocity * (inertia - 1f) + vector17) / inertia; npc.velocity.Normalize(); npc.velocity *= scaleFactor2; } } else if (npc.ai[0] == 1f) { + // Move slower if set to fly upward from the start if (upwardAI) - maxVelocity = 12f; + maxVelocity -= 6f; + // Decrease velocity if moving faster than max if (npc.velocity.Length() > maxVelocity) npc.velocity *= 0.99f; 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] >= aiGateValue + 120f) + if (Collision.SolidCollision(npc.position, npc.width, npc.height) || npc.ai[1] >= explodeIntoGoreGateValue) { if (npc.DeathSound != null) - { Main.PlaySound(npc.DeathSound, npc.position); - } npc.life = 0; npc.HitEffect(0, 10.0); @@ -151,7 +170,8 @@ namespace CalamityMod.NPCs.OldDuke return; } - if (npc.ai[1] >= aiGateValue + 60f) + // Fall down after a certain time has passed + if (npc.ai[1] >= fallDownGateValue) { npc.noGravity = false; npc.velocity.Y += 0.3f; @@ -159,6 +179,11 @@ namespace CalamityMod.NPCs.OldDuke } } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; @@ -181,14 +206,14 @@ namespace CalamityMod.NPCs.OldDuke 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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; @@ -202,10 +227,7 @@ namespace CalamityMod.NPCs.OldDuke public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 180, true); - player.AddBuff(BuffID.Rabies, 180, true); - player.AddBuff(BuffID.Poisoned, 180, true); - player.AddBuff(ModContent.BuffType(), 180); + player.AddBuff(ModContent.BuffType(), 240); } public override bool CheckDead() diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 3aa58a4535..8f9d17ce3f 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Projectiles.Boss; +using CalamityMod.World; using System; using System.IO; using Microsoft.Xna.Framework; @@ -7,7 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Dusts; -using CalamityMod.World; +using CalamityMod.Events; namespace CalamityMod.NPCs.OldDuke { @@ -21,23 +22,20 @@ namespace CalamityMod.NPCs.OldDuke public override void SetDefaults() { + npc.Calamity().canBreakPlayerDefense = true; npc.aiStyle = -1; aiType = -1; - npc.damage = 180; + npc.GetNPCDamage(); npc.width = 40; npc.height = 40; npc.defense = 0; - npc.lifeMax = 5000; - if (CalamityWorld.bossRushActive) + npc.lifeMax = 3750; + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 75000; + npc.lifeMax = 7500; } npc.alpha = 255; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath11; npc.noGravity = true; @@ -58,11 +56,16 @@ namespace CalamityMod.NPCs.OldDuke public override void AI() { - npc.rotation += npc.velocity.X * 0.05f; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + npc.rotation += npc.velocity.X * 0.05f; + if (npc.alpha > 0) - { - npc.alpha -= 5; - } + npc.alpha -= 15; + npc.TargetClosest(false); Player player = Main.player[npc.target]; if (!player.active || player.dead) @@ -72,16 +75,14 @@ namespace CalamityMod.NPCs.OldDuke if (!player.active || player.dead) { if (npc.timeLeft > 10) - { npc.timeLeft = 10; - } + return; } } else if (npc.timeLeft < 600) - { npc.timeLeft = 600; - } + Vector2 vector = player.Center - npc.Center; if (vector.Length() < 40f || npc.ai[3] >= 900f) { @@ -101,9 +102,12 @@ namespace CalamityMod.NPCs.OldDuke return; } - float num1372 = 12f; - if (Main.expertMode || CalamityWorld.bossRushActive) - num1372 += Vector2.Distance(player.Center, npc.Center) * 0.01f; + float num1372 = death ? 14f : revenge ? 13f : 12f; + if (expertMode || malice) + { + float speedUpMult = BossRushEvent.BossRushActive ? 0.02f : CalamityWorld.malice ? 0.015f : 0.01f; + num1372 += Vector2.Distance(player.Center, npc.Center) * speedUpMult; + } 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; @@ -143,7 +147,7 @@ namespace CalamityMod.NPCs.OldDuke npc.velocity.Y = (npc.velocity.Y * 7f + num1374) / 8f; } - float num1247 = 0.5f; + float num1247 = CalamityWorld.malice ? 0.75f : 0.5f; for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++) { if (Main.npc[num1248].active) @@ -167,6 +171,11 @@ namespace CalamityMod.NPCs.OldDuke } } + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); + } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; @@ -175,9 +184,7 @@ namespace CalamityMod.NPCs.OldDuke public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 180, true); - player.AddBuff(BuffID.Poisoned, 180, true); - player.AddBuff(ModContent.BuffType(), 180); + player.AddBuff(ModContent.BuffType(), 240); } public override bool CheckDead() @@ -222,10 +229,10 @@ namespace CalamityMod.NPCs.OldDuke { float velocity = Main.rand.Next(7, 11); Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[proj].timeLeft = 360; } - Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); } return true; diff --git a/NPCs/Other/BrimstoneOrb.cs b/NPCs/Other/BrimstoneOrb.cs new file mode 100644 index 0000000000..bca33658e8 --- /dev/null +++ b/NPCs/Other/BrimstoneOrb.cs @@ -0,0 +1,117 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class BrimstoneOrb : ModNPC + { + 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]; + } + } + public override void SetStaticDefaults() => DisplayName.SetDefault("Brimstone 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.NPCHit5; + npc.DeathSound = SoundID.NPCDeath7; + npc.knockBackResist = 0f; + npc.netAlways = true; + npc.aiStyle = -1; + npc.Calamity().DoesNotGenerateRage = true; + } + + 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; + + if (Main.myPlayer == npc.target) + { + // Disappear if the player no longer has the enchanted weapon. + if (!Owner.Calamity().lecherousOrbEnchant) + { + npc.active = false; + 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; + + 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(); + } + + Time++; + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int i = 0; i < 3; i++) + { + 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; + magic.scale = 1.3f; + magic.noGravity = true; + } + + if (npc.life <= 0) + { + for (int i = 0; i < 15; i++) + { + 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; + magic.scale = Main.rand.NextFloat(1.2f, 1.56f); + magic.noGravity = true; + } + } + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (Main.myPlayer == npc.target) + npc.SyncMotionToServer(); + + return base.StrikeNPC(ref damage, defense, ref knockback, hitDirection, ref crit); + } + + public override void NPCLoot() + { + 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); + } + + public override Color? GetAlpha(Color drawColor) => Color.White * npc.Opacity; + } +} diff --git a/NPCs/Other/BrimstoneOrb.png b/NPCs/Other/BrimstoneOrb.png new file mode 100644 index 0000000000..680009c5da Binary files /dev/null and b/NPCs/Other/BrimstoneOrb.png differ diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs new file mode 100644 index 0000000000..c07ec611f2 --- /dev/null +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -0,0 +1,161 @@ +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + 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; + } + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) => npc.lifeMax = 101010; + + public override void AI() + { + FadeAwayTimer++; + + // 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) + { + FadeAway(); + return; + } + + if (FadeAwayTimer < 15f) + { + DoInitializationAI(); + return; + } + + AttackTarget(); + } + + public void FadeAway() + { + npc.dontTakeDamage = true; + npc.Opacity = Utils.InverseLerp(50f, 0f, FadeAwayTimer, true); + + // Become inactive after fading away completely. + if (npc.Opacity <= 0f) + { + npc.active = false; + npc.netUpdate = true; + } + + // Slow down and fade away. + npc.velocity = Vector2.Lerp(npc.velocity, Vector2.UnitY * npc.Opacity * -2f, 0.125f); + + FadeAwayTimer++; + + if (Main.dedServ) + return; + + // Create some fade dust. + for (int i = 0; i < 3; i++) + { + 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; + magic.noGravity = true; + magic.noLight = true; + } + } + + public void DoInitializationAI() + { + // Create a burst of magic on the first frame. + if (!Main.dedServ && FadeAwayTimer == 1f) + { + for (int i = 0; i < 50; i++) + { + 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; + magic.noGravity = true; + magic.noLight = true; + } + } + + // Rise upward. + 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; + + // Otherwise attempt to move towards the player. + 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); + } + + // Charge. + if (AttackTimer % 120f == 119f) + npc.velocity = npc.SafeDirectionTo(Target.Center) * 23.5f; + + npc.spriteDirection = (npc.velocity.X < 0f).ToDirectionInt(); + } + + public override void FindFrame(int 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; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life <= 0) + Utils.PoofOfSmoke(npc.Center); + } + + public override void NPCLoot() + { + // 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); + } + } + } +} diff --git a/NPCs/Other/CalamitasEnchantDemon.png b/NPCs/Other/CalamitasEnchantDemon.png new file mode 100644 index 0000000000..bd3a5924ca Binary files /dev/null and b/NPCs/Other/CalamitasEnchantDemon.png differ diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs new file mode 100644 index 0000000000..5eba0752ed --- /dev/null +++ b/NPCs/Other/DemonPortal.cs @@ -0,0 +1,129 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class DemonPortal : ModNPC + { + 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; + } + + 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; + + if (Time == 300f) + { + if (Main.myPlayer == npc.target) + ReleaseThings(); + Main.PlaySound(SoundID.DD2_EtherianPortalOpen, npc.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient && Time >= 420f) + { + npc.active = false; + npc.netUpdate = true; + } + + Time++; + } + + public void ReleaseThings() + { + 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); + if (Main.projectile.IndexInRange(demon)) + { + Main.projectile[demon].friendly = friendly; + Main.projectile[demon].hostile = !friendly; + } + } + } + + 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; + if (wouldDie) + { + npc.immortal = true; + + // Enrage demons if hit when already at 1 health. + if (npc.life == 1) + { + int demonType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != demonType || !Main.projectile[i].active || Main.projectile[i].hostile) + continue; + + Main.projectile[i].hostile = true; + Main.projectile[i].friendly = false; + Main.projectile[i].netUpdate = true; + } + } + + npc.life = 1; + damage = 0D; + return false; + } + return true; + } + + public override bool CheckDead() + { + npc.life = 1; + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + spriteBatch.SetBlendState(BlendState.AlphaBlend); + + 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); + + // 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); + + // 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); + + spriteBatch.SetBlendState(BlendState.AlphaBlend); + return false; + } + } +} diff --git a/NPCs/Other/DemonPortal.png b/NPCs/Other/DemonPortal.png new file mode 100644 index 0000000000..1fb1ceee5e Binary files /dev/null and b/NPCs/Other/DemonPortal.png differ diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs new file mode 100644 index 0000000000..bfde229cb5 --- /dev/null +++ b/NPCs/Other/ExhumedHeart.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Other +{ + public class ExhumedHeart : ModNPC + { + 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]; + } + } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exhumed Brimstone Heart"); + 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; + } + + 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; + + Time++; + } + + public override void FindFrame(int 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.A = 127; + return color; + } + } +} diff --git a/NPCs/Other/ExhumedHeart.png b/NPCs/Other/ExhumedHeart.png new file mode 100644 index 0000000000..c597cfe505 Binary files /dev/null and b/NPCs/Other/ExhumedHeart.png differ diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 1c0a4df67d..311c1083bc 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -1,13 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Boss; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { public class PerforatorBodyLarge : ModNPC @@ -19,19 +18,17 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 24; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 60; npc.height = 60; npc.defense = 8; - npc.LifeMaxNERB(2500, 2700, 800000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(2500, 2700, 80000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -40,7 +37,14 @@ namespace CalamityMod.NPCs.Perforator npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -49,64 +53,83 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - // Target + 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); - Player player = Main.player[npc.target]; - - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += Main.rand.Next(shoot); - if (npc.localAI[0] >= Main.rand.Next(1800, 20000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num941 = revenge ? 9f : 8f; - 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; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = ModContent.ProjectileType(); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.NextBool(2)) - { - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 160; - } - npc.netUpdate = true; - } - } - } - if (player.dead) + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) { - npc.TargetClosest(false); + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -119,7 +142,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -158,16 +181,9 @@ namespace CalamityMod.NPCs.Perforator } } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); } } } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 210658a80d..af89fe2c65 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -1,6 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Boss; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -8,6 +8,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { public class PerforatorBodyMedium : ModNPC @@ -19,19 +20,18 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 21; - npc.npcSlots = 5f; - npc.width = 54; - npc.height = 54; + npc.GetNPCDamage(); + npc.npcSlots = 5f; + npc.width = 40; + npc.height = 40; npc.defense = 6; - npc.LifeMaxNERB(2000, 2200, 700000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(160, 180, 7000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -40,73 +40,128 @@ namespace CalamityMod.NPCs.Perforator npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + + npc.Calamity().SplittingWorm = true; + } public override void AI() { + npc.realLife = -1; + // Target 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]; - - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += Main.rand.Next(shoot); - if (npc.localAI[0] >= Main.rand.Next(1500, 12000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num941 = revenge ? 9f : 8f; - 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; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = ModContent.ProjectileType(); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.NextBool(2)) - { - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 160; - } - npc.netUpdate = true; - } - } - } - if (player.dead) - { + if (Main.player[npc.target].dead) npc.TargetClosest(false); + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + 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); + 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); + + 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) + { + 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) + { + npc.type = ModContent.NPCType(); + int whoAmI = npc.whoAmI; + float num25 = npc.life / (float)npc.lifeMax; + float num26 = npc.ai[0]; + int aiTimer = npc.Calamity().AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * num25); + npc.ai[0] = num26; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI; + npc.Calamity().AITimer = aiTimer; + } + 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]; + int aiTimer = npc.Calamity().AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * num27); + npc.ai[1] = num28; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI2; + npc.Calamity().AITimer = aiTimer; + } + + 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); + + num39 = (int)(num39 / 16f) * 16; + num40 = (int)(num40 / 16f) * 16; + vector2.X = (int)(vector2.X / 16f) * 16; + vector2.Y = (int)(vector2.Y / 16f) * 16; + num39 -= vector2.X; + num40 -= vector2.Y; + float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + + 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; + } + catch + { + } + + 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); + num52 = (num52 - num53) / num52; + num39 *= num52; + num40 *= num52; + npc.velocity = Vector2.Zero; + npc.position.X += num39; + npc.position.Y += num40; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -119,7 +174,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -160,13 +215,11 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 120, true); - player.AddBuff(BuffID.Bleeding, 120, true); } } } diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 51c0a46ae3..864ef2991b 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -1,13 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Projectiles.Boss; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { public class PerforatorBodySmall : ModNPC @@ -19,19 +18,17 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 18; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 42; npc.height = 42; npc.defense = 4; - npc.LifeMaxNERB(1250, 1500, 500000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(1250, 1500, 50000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -40,7 +37,14 @@ namespace CalamityMod.NPCs.Perforator npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -49,64 +53,83 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - // Target + 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); - Player player = Main.player[npc.target]; - - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 5 : 4; - npc.localAI[0] += Main.rand.Next(shoot); - if (npc.localAI[0] >= Main.rand.Next(1200, 6000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float num941 = revenge ? 9f : 8f; - 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; - float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - int num945 = expertMode ? 12 : 15; - int num946 = ModContent.ProjectileType(); - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - if (Main.rand.NextBool(2)) - { - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, num945, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num947].timeLeft = 160; - } - npc.netUpdate = true; - } - } - } - if (player.dead) + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) { - npc.TargetClosest(false); + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -119,7 +142,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -158,14 +181,12 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.lifeMax = (int)(npc.lifeMax * 0.85f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 90, true); - player.AddBuff(BuffID.Bleeding, 90, true); } } } diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index 1858f46dfe..8c5199ca74 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -63,15 +63,18 @@ namespace CalamityMod.NPCs.Perforator public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || spawnInfo.player.Calamity().crimsonLore) - { + if (spawnInfo.player.Calamity().disablePerfCystSpawns) return 0f; - } - else if (NPC.downedBoss2 && !CalamityWorld.downedPerforator) - { - return SpawnCondition.Crimson.Chance * 1.5f; - } - return SpawnCondition.Crimson.Chance * (Main.hardMode ? 0.05f : 0.5f); + + bool anyBossElements = NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()); + bool crimson = TileID.Sets.Crimson[spawnInfo.spawnTileType] || spawnInfo.spawnTileType == TileID.Crimtane && spawnInfo.player.ZoneCrimson; + if (spawnInfo.playerSafe || anyBossElements || !crimson) + return 0f; + + if (NPC.downedBoss2 && !CalamityWorld.downedPerforator) + return 1.5f; + + return Main.hardMode ? 0.05f : 0.5f; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index d60bbf6898..9c06df575b 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -1,5 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -8,14 +8,13 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.IO; + namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHeadLarge : ModNPC { - private bool flies = false; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 7 : 15; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 8 : 16; private bool TailSpawned = false; public override void SetStaticDefaults() @@ -25,388 +24,478 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 45; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 70; npc.height = 84; npc.defense = 4; - npc.LifeMaxNERB(2500, 2700, 800000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(2500, 2700, 80000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; - } - public override void AI() + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } + + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 4; 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(); + } + + public override void AI() { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson || malice) + enrageScale += 1f; + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + enrageScale += 1f; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float speed = 12f; - float turnSpeed = 0.1f; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + if (revenge || lifeRatio < (expertMode ? 0.75f : 0.5f)) + npc.Calamity().newAI[0] += 1f; + + float burrowTimeGateValue = death ? 210f : 270f; + 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; if (expertMode) { - speed += death ? 9f : 9f * (1f - lifeRatio); - turnSpeed += death ? 0.08f : 0.08f * (1f - lifeRatio); + float velocityScale = (death ? 0.12f : 0.1f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.12f : 0.1f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (lungeUpward) { speed *= 1.25f; - turnSpeed *= 1.25f; + turnSpeed *= 1.5f; } - if (CalamityWorld.bossRushActive) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + // 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 == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(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, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); Player player = Main.player[npc.target]; npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } - if (!TailSpawned) - { - 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); - } - else - { - 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] = (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); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 400; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - npc.TargetClosest(false); - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.5f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = Math.Abs(num191); - float num197 = Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - 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 = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)Math.Abs(num192) < (double)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; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)Math.Abs(num191) < (double)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; - } - else - { - 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 ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - 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 ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - 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 (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned) + { + 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); + } + else + { + 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].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + 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; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = lungeUpward; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + 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)) + { + 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) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + 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) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + + float num17 = 16f; + if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + 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; + num17 = 32f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType()) + { + Main.npc[a].active = false; + } + } + } + } + + float num18 = speed; + float num19 = turnSpeed; + float burrowDistance = malice ? 500f : 800f; + float burrowTarget = player.Center.Y + burrowDistance; + float lungeTarget = player.Center.Y - 600f; + Vector2 vector3 = npc.Center; + float num20 = player.Center.X; + float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y; + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + 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; + + // Quickly fall back down once above target + if (lungeUpward && npc.Center.Y <= player.Center.Y - 420f) + { + npc.TargetClosest(); + npc.Calamity().newAI[1] = 2f; + } + + // Quickly fall and reset variables once at target's Y position + if (quickFall) + { + npc.velocity.Y += 1f; + if (npc.Center.Y >= player.Center.Y) + { + 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; + } + + if (!flag2) + { + npc.TargetClosest(true); + npc.velocity.Y = npc.velocity.Y + 0.15f; + if (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 (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.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); + float num26 = Math.Abs(num21); + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + 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; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -420,7 +509,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -476,19 +565,9 @@ namespace CalamityMod.NPCs.Perforator DropHelper.DropItem(npc, ItemID.Vertebrae, 2, 4); } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - } - public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } } } } diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 00d4b6cb90..bae751179d 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -1,22 +1,20 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHeadMedium : ModNPC { - private bool flies = false; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 5 : 10; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 6 : 11; - private bool TailSpawned = false; - public override void SetStaticDefaults() { DisplayName.SetDefault("The Perforator"); @@ -24,385 +22,358 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 35; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 58; npc.height = 68; npc.defense = 2; - npc.LifeMaxNERB(2000, 2200, 700000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(160, 180, 7000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; - } - public override void AI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + + npc.Calamity().SplittingWorm = true; + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson || malice) + enrageScale += 1f; + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + enrageScale += 1f; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float speed = 14f; - float turnSpeed = 0.12f; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + float speed = 8f; + float turnSpeed = 0.06f; if (expertMode) { - speed += death ? 9f : 9f * (1f - lifeRatio); - turnSpeed += death ? 0.08f : 0.08f * (1f - lifeRatio); + float velocityScale = (death ? 8f : 7f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.08f : 0.07f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + npc.realLife = -1; - if (CalamityWorld.bossRushActive) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + // 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.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(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, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); 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 (!TailSpawned) - { - 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); - } - else - { - 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].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 200; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (npc.ai[0] == 0f) + { + int totalSegments = death ? 18 : revenge ? 16 : expertMode ? 14 : 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; + } + + // Splitting effect + 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); + } + 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); + } + + 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; + if (num29 < 0) + num29 = 0; + if (num30 > Main.maxTilesX) + num30 = Main.maxTilesX; + if (num31 < 0) + num31 = 0; + if (num32 > Main.maxTilesY) + num32 = Main.maxTilesY; + + // Fly or not + bool flag2 = false; + if (!flag2) + { + for (int num33 = num29; num33 < num30; num33++) + { + 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)) + { + 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) + { + flag2 = true; + if (Main.rand.NextBool(100) && Main.tile[num33, num34].nactive()) + { + WorldGen.KillTile(num33, num34, true, true, false); + } + } + } + } + } + } + if (!flag2) + { + 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++) + { + if (Main.player[num36].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + flag2 = true; + } + + if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { npc.TargetClosest(false); - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.7f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - 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 = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - 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 (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - 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 (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - 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; - } - } - } + flag2 = false; + npc.velocity.Y += 1f; + if (npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y += 1f; + } + 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()) + { + Main.npc[num957].active = false; + } + } + } + } + + // Velocity and acceleration + float num37 = speed; + float num38 = turnSpeed; + + Vector2 vector2 = npc.Center; + float num39 = player.Center.X; + float num40 = player.Center.Y; + + num39 = (int)(num39 / 16f) * 16; + num40 = (int)(num40 / 16f) * 16; + vector2.X = (int)(vector2.X / 16f) * 16; + vector2.Y = (int)(vector2.Y / 16f) * 16; + num39 -= vector2.X; + num40 -= vector2.Y; + float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + + // Prevent new heads from being slowed when they spawn + if (npc.Calamity().newAI[1] < 3f) + { + 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)); + } + + if (!flag2) + { + npc.velocity.Y += 0.11f; + if (npc.velocity.Y > num37) + npc.velocity.Y = num37; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.4) + { + if (npc.velocity.X < 0f) + npc.velocity.X -= num38 * 1.1f; + else + npc.velocity.X += num38 * 1.1f; + } + else if (npc.velocity.Y == num37) + { + 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) + { + if (npc.velocity.X < 0f) + npc.velocity.X += num38 * 0.9f; + else + npc.velocity.X -= num38 * 0.9f; + } + } + else + { + // Sound + if (npc.soundDelay == 0) + { + float num54 = num52 / 40f; + if (num54 < 10f) + num54 = 10f; + if (num54 > 20f) + num54 = 20f; + + npc.soundDelay = (int)num54; + Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1, 1f, 0f); + } + + num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + float num55 = Math.Abs(num39); + float num56 = Math.Abs(num40); + float num57 = num37 / num52; + 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 < 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 (Math.Abs(num40) < num37 * 0.2 && ((npc.velocity.X > 0f && num39 < 0f) || (npc.velocity.X < 0f && num39 > 0f))) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num38 * 2f; + else + npc.velocity.Y -= num38 * 2f; + } + + if (Math.Abs(num39) < num37 * 0.2 && ((npc.velocity.Y > 0f && num40 < 0f) || (npc.velocity.Y < 0f && num40 > 0f))) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num38 * 2f; + else + npc.velocity.X -= num38 * 2f; + } + } + else if (num55 > num56) + { + if (npc.velocity.X < num39) + npc.velocity.X += num38 * 1.1f; + else if (npc.velocity.X > num39) + npc.velocity.X -= num38 * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.5) + { + if (npc.velocity.Y > 0f) + npc.velocity.Y += num38; + else + npc.velocity.Y -= num38; + } + } + else + { + if (npc.velocity.Y < num40) + npc.velocity.Y += num38 * 1.1f; + else if (npc.velocity.Y > num40) + npc.velocity.Y -= num38 * 1.1f; + + if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < num37 * 0.5) + { + if (npc.velocity.X > 0f) + npc.velocity.X += num38; + else + npc.velocity.X -= num38; + } + } + } + + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; + + if (flag2) + { + if (npc.localAI[0] != 1f) + npc.netUpdate = true; + + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + npc.netUpdate = true; + + 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; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -415,7 +386,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -448,7 +419,17 @@ namespace CalamityMod.NPCs.Perforator } } - public override void BossLoot(ref string name, ref int potionType) + public override bool PreNPCLoot() + { + 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())) + return false; + } + return true; + } + + public override void BossLoot(ref string name, ref int potionType) { name = "The Medium Perforator"; potionType = ItemID.HealingPotion; @@ -457,7 +438,7 @@ namespace CalamityMod.NPCs.Perforator public override bool SpecialNPCLoot() { int closestSegmentID = DropHelper.FindClosestWormSegment(npc, - ModContent.NPCType(), + npc.type, ModContent.NPCType(), ModContent.NPCType()); npc.position = Main.npc[closestSegmentID].position; @@ -479,11 +460,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } } } } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 3334a949c3..22421499bb 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -1,408 +1,435 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] public class PerforatorHeadSmall : ModNPC { private const int MsgType = 23; - private bool flies = false; - private int minLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 3 : 6; - private int maxLength = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 4 : 7; - private bool TailSpawned = false; + private bool TailSpawned = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Perforator"); } public override void SetDefaults() { - npc.damage = 30; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 42; npc.height = 62; - npc.LifeMaxNERB(1250, 1500, 500000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(1250, 1500, 50000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override void AI() { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + enrageScale += 1f; + if (!Main.player[npc.target].ZoneCrimson || malice) + enrageScale += 1f; + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + enrageScale += 1f; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - float speed = 16f; - float turnSpeed = 0.14f; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + float speed = 0.15f; + float turnSpeed = 0.1f; if (expertMode) { - speed += death ? 9f : 9f * (1f - lifeRatio); - turnSpeed += death ? 0.08f : 0.08f * (1f - lifeRatio); + float velocityScale = (death ? 0.15f : 0.1f) * enrageScale; + speed += velocityScale * (1f - lifeRatio); + float accelerationScale = (death ? 0.12f : 0.1f) * enrageScale; + turnSpeed += accelerationScale * (1f - lifeRatio); } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - if (CalamityWorld.bossRushActive) - { - speed *= 1.25f; - turnSpeed *= 1.25f; - } + // 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.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(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, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); Player player = Main.player[npc.target]; npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } - if (!TailSpawned) - { - 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); - } - else - { - 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].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; - NetMessage.SendData(MsgType, -1, -1, null, lol, 0f, 0f, 0f, 0); - Previous = lol; - } - TailSpawned = true; - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - bool flag94 = flies; - if (!flag94) - { - for (int num952 = num180; num952 < num181; num952++) - { - for (int num953 = num182; num953 < num183; num953++) - { - if (Main.tile[num952, num953] != null && ((Main.tile[num952, num953].nactive() && (Main.tileSolid[(int)Main.tile[num952, num953].type] || (Main.tileSolidTop[(int)Main.tile[num952, num953].type] && Main.tile[num952, num953].frameY == 0))) || Main.tile[num952, num953].liquid > 64)) - { - Vector2 vector105; - vector105.X = (float)(num952 * 16); - vector105.Y = (float)(num953 * 16); - if (npc.position.X + (float)npc.width > vector105.X && npc.position.X < vector105.X + 16f && npc.position.Y + (float)npc.height > vector105.Y && npc.position.Y < vector105.Y + 16f) - { - flag94 = true; - break; - } - } - } - } - } - if (!flag94) - { - npc.localAI[1] = 1f; - Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = 100; - bool flag95 = true; - if (npc.position.Y > player.position.Y) - { - for (int num955 = 0; num955 < 255; num955++) - { - if (Main.player[num955].active) - { - Rectangle rectangle13 = new Rectangle((int)Main.player[num955].position.X - num954, (int)Main.player[num955].position.Y - num954, num954 * 2, num954 * 2); - if (rectangle12.Intersects(rectangle13)) - { - flag95 = false; - break; - } - } - } - if (flag95) - { - flag94 = true; - } - } - } - else - { - npc.localAI[1] = 0f; - } - if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) - { - npc.TargetClosest(false); - flag94 = false; - npc.velocity.Y = npc.velocity.Y + 0.05f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 0.05f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) - { - for (int num957 = 0; num957 < 200; num957++) - { - if (Main.npc[num957].aiStyle == npc.aiStyle) - { - Main.npc[num957].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 = player.position.X + (float)(player.width / 2); - float num192 = player.position.Y + (float)(player.height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (!flag94) - { - npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + (turnSpeed * 0.9f); - if (npc.velocity.Y > num188) - { - npc.velocity.Y = num188; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.4) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == num188) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - } - else - { - if (!flies && npc.behindTiles && npc.soundDelay == 0) - { - float num195 = num193 / 40f; - if (num195 < 10f) - { - num195 = 10f; - } - if (num195 > 20f) - { - num195 = 20f; - } - npc.soundDelay = (int)num195; - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 1); - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - bool flag21 = false; - if (!flag21) - { - 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 = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - 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 (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - 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 (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - 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 ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; - if (flag94) - { - if (npc.localAI[0] != 1f) - { - npc.netUpdate = true; - } - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - { - npc.netUpdate = true; - } - 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 (Main.netMode != NetmodeID.MultiplayerClient) + { + if (!TailSpawned) + { + 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); + } + else + { + 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].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MsgType, -1, -1, null, lol, 0f, 0f, 0f, 0); + Previous = lol; + } + 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; + if (num12 < 0) + { + num12 = 0; + } + if (num13 > Main.maxTilesX) + { + num13 = Main.maxTilesX; + } + if (num14 < 0) + { + num14 = 0; + } + if (num15 > Main.maxTilesY) + { + num15 = Main.maxTilesY; + } + bool flag2 = false; + if (!flag2) + { + for (int k = num12; k < num13; k++) + { + 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)) + { + 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) + { + flag2 = true; + break; + } + } + } + } + } + if (!flag2) + { + 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) + { + for (int m = 0; m < 255; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2); + if (rectangle.Intersects(rectangle2)) + { + flag3 = false; + break; + } + } + } + if (flag3) + { + flag2 = true; + } + } + } + else + { + npc.localAI[1] = 0f; + } + float num17 = 16f; + if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active) + { + 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; + num17 = 32f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || + Main.npc[a].type == ModContent.NPCType()) + { + Main.npc[a].active = false; + } + } + } + } + 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 = player.position.X + (float)(player.width / 2); + float num21 = player.position.Y + (float)(player.height / 2); + num20 = (float)((int)(num20 / 16f) * 16); + num21 = (float)((int)(num21 / 16f) * 16); + vector3.X = (float)((int)(vector3.X / 16f) * 16); + vector3.Y = (float)((int)(vector3.Y / 16f) * 16); + num20 -= vector3.X; + num21 -= vector3.Y; + 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.velocity.Y = num17; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num17 * 0.4) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num18 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + } + else if (npc.velocity.Y == num17) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 0.9f; + } + } + } + else + { + if (npc.soundDelay == 0) + { + float num24 = num22 / 40f; + if (num24 < 10f) + { + num24 = 10f; + } + if (num24 > 20f) + { + num24 = 20f; + } + npc.soundDelay = (int)num24; + Main.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); + float num26 = Math.Abs(num21); + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num19; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num19; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num19; + } + else if (npc.velocity.Y > num21) + { + 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 < num20) + { + npc.velocity.X = npc.velocity.X + num18; + } + else if (npc.velocity.X > num20) + { + npc.velocity.X = npc.velocity.X - num18; + } + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18 * 2f; + } + else + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18 * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - num18 * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num20) + { + npc.velocity.X = npc.velocity.X + num18 * 1.1f; + } + else if (npc.velocity.X > num20) + { + 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 (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num18; + } + else + { + npc.velocity.Y = npc.velocity.Y - num18; + } + } + } + else + { + if (npc.velocity.Y < num21) + { + npc.velocity.Y = npc.velocity.Y + num18 * 1.1f; + } + else if (npc.velocity.Y > num21) + { + 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 (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num18; + } + else + { + npc.velocity.X = npc.velocity.X - num18; + } + } + } + } + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; + if (flag2) + { + if (npc.localAI[0] != 1f) + { + npc.netUpdate = true; + } + npc.localAI[0] = 1f; + } + else + { + if (npc.localAI[0] != 0f) + { + npc.netUpdate = true; + } + 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; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -415,7 +442,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -472,17 +499,12 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); + npc.lifeMax = (int)(npc.lifeMax * 0.85f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - } } } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index d168264ddd..07a2bd0f20 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -19,8 +20,8 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { [AutoloadBossHead] @@ -38,18 +39,17 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.npcSlots = 18f; - npc.damage = 30; - npc.width = 110; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 18f; + npc.GetNPCDamage(); + npc.width = 110; npc.height = 100; npc.defense = 4; - npc.LifeMaxNERB(3750, 5400, 2700000); + npc.LifeMaxNERB(3750, 5400, 270000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 6, 0, 0); npc.boss = true; @@ -57,11 +57,7 @@ namespace CalamityMod.NPCs.Perforator npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath19; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant"); - else - music = MusicID.Boss2; + music = CalamityMod.Instance.GetMusicFromMusicMod("BloodCoagulant") ?? MusicID.Boss2; bossBag = ModContent.ItemType(); } @@ -77,13 +73,66 @@ namespace CalamityMod.NPCs.Perforator { CalamityGlobalNPC.perfHive = npc.whoAmI; - npc.TargetClosest(true); + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + // Get a target + 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(); + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + // Variables for ichor spore phase + float sporePhaseGateValue = malice ? 450f : 600f; + 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) + { + if (npc.ai[1] < 180f) + npc.ai[1] += 1f; + + npc.damage = 0; + } + Player player = Main.player[npc.target]; - bool isCrimson = player.ZoneCrimson || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Phases based on life percentage + bool phase2 = lifeRatio < 0.7f; + + float enrageScale = 0f; + if ((npc.position.Y / 16f) < Main.worldSurface || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (!Main.player[npc.target].ZoneCrimson || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1f; + } + if (BossRushEvent.BossRushActive) + enrageScale += 1f; + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) { @@ -119,129 +168,19 @@ namespace CalamityMod.NPCs.Perforator if (NPC.AnyNPCs(ModContent.NPCType())) wormsAlive++; - if (largeWormAlive && expertMode) - { - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = isCrimson ? false : true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int shoot = revenge ? 6 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(300, 901) && npc.position.Y + (float)npc.height < player.position.Y && Vector2.Distance(player.Center, npc.Center) > 80f) - { - npc.localAI[0] = 0f; - Main.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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.25f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - - float num179 = 8f; - 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; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = expertMode ? 14 : 18; - int num185 = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - value9.X += num180; - value9.Y += num182; - - for (int num186 = 0; num186 < 20; num186++) - { - num180 = player.position.X + (float)player.width * 0.5f - value9.X; - num182 = player.position.Y + (float)player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-180, 181); - num180 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, -5f, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - npc.rotation = npc.velocity.X * 0.04f; - - if (revenge) - { - if (wormsAlive == 1) - { - Movement(player, 4f, 1f, (CalamityWorld.bossRushActive ? 0.2f : 0.15f), 160f, 300f, 400f, false); - npc.ai[0] = 0f; - } - else - { - if (npc.ai[0] == 1f) - { - if (large || death) - { - Movement(player, 5f, 1.5f, (CalamityWorld.bossRushActive ? 0.195f : 0.13f), 360f, 10f, 50f, true); - } - else if (medium) - { - Movement(player, 6f, 2f, (CalamityWorld.bossRushActive ? 0.18f : 0.12f), 340f, 15f, 50f, true); - } - else if (small) - { - Movement(player, 7f, 2.5f, (CalamityWorld.bossRushActive ? 0.165f : 0.11f), 320f, 20f, 50f, true); - } - else - { - Movement(player, 8f, 3f, (CalamityWorld.bossRushActive ? 0.15f : 0.1f), 300f, 25f, 50f, true); - } - } - else - { - npc.velocity.X += (npc.Center.X <= player.Center.X ? -0.1f : 0.1f); - if (npc.Center.X > player.Center.X + 320f || npc.Center.X < player.Center.X - 320f) - { - npc.ai[0] = 1f; - } - } - } - } - else - { - Movement(player, 4f, 1f, 0.1f, 160f, 300f, 400f, false); - } + npc.dontTakeDamage = largeWormAlive && expertMode; if (npc.ai[3] == 0f && npc.life > 0) - { - npc.ai[3] = (float)npc.lifeMax; - } + npc.ai[3] = npc.lifeMax; + if (npc.life > 0) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int num660 = (int)((double)npc.lifeMax * 0.3); - if ((float)(npc.life + num660) < npc.ai[3]) + int num660 = (int)(npc.lifeMax * 0.3); + if ((npc.life + num660) < npc.ai[3]) { - npc.ai[3] = (float)npc.life; + npc.ai[3] = npc.life; int wormType = ModContent.NPCType(); if (!small) { @@ -257,70 +196,210 @@ namespace CalamityMod.NPCs.Perforator large = true; wormType = ModContent.NPCType(); } - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), wormType); + NPC.NewNPC((int)npc.Center.X, (int)(npc.Center.Y + 800f), wormType, 1); + npc.TargetClosest(); } } } + + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; + + 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) + { + if (npc.ai[2] < sporePhaseGateValue + 300f) + { + if (npc.velocity.Length() > 0.5f) + npc.velocity *= malice ? 0.94f : 0.96f; + else + npc.ai[2] = sporePhaseGateValue + 300f; + } + else + { + npc.ai[2] = 0f; + + Main.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); + 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; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.25f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + int numBlobs = expertMode ? 6 : 3; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + + for (int i = 0; i < numBlobs; i++) + { + Vector2 blobVelocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + blobVelocity.Normalize(); + blobVelocity *= Main.rand.Next(200, 401) * (malice ? 0.02f : 0.01f); + + float sporeVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.5f; + if (blobVelocity.Y < 2f) + blobVelocity.Y = 2f + sporeVelocityYAdd; + + Projectile.NewProjectile(npc.Center, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + } + } + + return; + } + } + } + + // Movement velocities, increased while enraged + float velocityXEnrageIncrease = 0.8f * enrageScale; + float velocityYEnrageIncrease = 0.2f * enrageScale; + + // When firing blobs, float above the target and don't call any other projectile firing or movement code + if (floatAboveToFireBlobs) + { + if (revenge) + { + Movement(player, 9f - velocityXEnrageIncrease, 3f - velocityYEnrageIncrease, 0.3f, 160f, 400f, 500f, false); + npc.ai[0] = 0f; + } + else + Movement(player, 7.5f - velocityXEnrageIncrease, 1.5f - velocityYEnrageIncrease, 0.2f, 160f, 400f, 500f, false); + + return; + } + + 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] = 0f; + Main.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); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.25f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + 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); + 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); + Main.dust[num624].velocity *= 2f; + } + + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + 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 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; + } + } + } + + if (revenge) + { + if (wormsAlive == 1) + { + Movement(player, 4f - velocityXEnrageIncrease, 1f - velocityYEnrageIncrease, 0.15f, 160f, 300f, 400f, false); + npc.ai[0] = 0f; + } + else + { + if (npc.ai[0] == 1f) + { + if (large || death) + Movement(player, 3.5f - velocityXEnrageIncrease, 1f - velocityYEnrageIncrease, death ? 0.15f : 0.13f, 360f, 10f, 50f, true); + else if (medium) + Movement(player, 4.5f - velocityXEnrageIncrease, 1.5f - velocityYEnrageIncrease, death ? 0.14f : 0.12f, 340f, 15f, 50f, true); + else if (small) + Movement(player, 5.5f - velocityXEnrageIncrease, 2f - velocityYEnrageIncrease, death ? 0.13f : 0.11f, 320f, 20f, 50f, true); + else + Movement(player, 6.5f - velocityXEnrageIncrease, 2.5f - velocityYEnrageIncrease, death ? 0.12f : 0.1f, 300f, 25f, 50f, true); + } + else + { + npc.velocity.X += npc.Center.X <= player.Center.X ? -0.1f : 0.1f; + if (npc.Center.X > player.Center.X + 320f || npc.Center.X < player.Center.X - 320f) + npc.ai[0] = 1f; + } + } + } + else + Movement(player, 7f - velocityXEnrageIncrease, 3f - velocityYEnrageIncrease, 0.1f, 160f, 300f, 400f, false); } private void Movement(Player target, float velocityX, float velocityY, float acceleration, float x, float y, float y2, bool charging) { - if (npc.position.Y > target.position.Y - y) //200 + if (npc.position.Y > target.position.Y - y) { if (npc.velocity.Y > 0f) - { npc.velocity.Y *= 0.98f; - } npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocityY) - { npc.velocity.Y = velocityY; - } } - else if (npc.position.Y < target.position.Y - y2) //500 + else if (npc.position.Y < target.position.Y - y2) { if (npc.velocity.Y < 0f) - { npc.velocity.Y *= 0.98f; - } npc.velocity.Y += acceleration; if (npc.velocity.Y < -velocityY) - { npc.velocity.Y = -velocityY; - } } if (npc.Center.X > target.Center.X + x) { if (npc.velocity.X > 0f) - { npc.velocity.X *= 0.98f; - } npc.velocity.X -= acceleration; if (npc.velocity.X > velocityX) - { npc.velocity.X = velocityX; - } } else if (npc.Center.X < target.Center.X - x) { if (npc.velocity.X < 0f) - { npc.velocity.X *= 0.98f; - } npc.velocity.X += acceleration; if (npc.velocity.X < -velocityX) - { npc.velocity.X = -velocityX; - } } if (charging) { if (npc.Center.X <= target.Center.X + x && npc.Center.X >= target.Center.X - x) - { npc.velocity.X += (npc.Center.X <= target.Center.X ? acceleration : -acceleration) * 0.25f; - } } } @@ -335,7 +414,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -358,7 +437,7 @@ 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 * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void BossLoot(ref string name, ref int potionType) @@ -370,9 +449,11 @@ namespace CalamityMod.NPCs.Perforator { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Evil boss tier 2 + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPerforator); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedPerforator, 2, 0, 0); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad }, CalamityWorld.downedPerforator); @@ -387,7 +468,7 @@ namespace CalamityMod.NPCs.Perforator DropHelper.DropItemSpray(npc, ItemID.Ichor, 10, 20); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -412,20 +493,22 @@ namespace CalamityMod.NPCs.Perforator { string key = "Mods.CalamityMod.SkyOreText"; Color messageColor = Color.Cyan; - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 12E-05, .4f, .6f); + CalamityUtils.SpawnOre(ModContent.TileType(), 12E-05, 0.4f, 0.6f, 3, 8); - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + CalamityUtils.DisplayLocalizedText(key, messageColor); + } // Mark The Perforator Hive as dead CalamityWorld.downedPerforator = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) { diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index f3f3eef35d..93b6c1759a 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { public class PerforatorTailLarge : ModNPC @@ -16,19 +18,17 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 18; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 60; npc.height = 78; npc.defense = 12; - npc.LifeMaxNERB(2500, 2700, 800000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(2500, 2700, 80000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -37,7 +37,14 @@ namespace CalamityMod.NPCs.Perforator npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -46,21 +53,83 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -73,7 +142,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -111,16 +180,9 @@ namespace CalamityMod.NPCs.Perforator return false; } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 90, true); - player.AddBuff(BuffID.Bleeding, 90, true); } } } diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index ac8765166e..7b14f71346 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -1,10 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { public class PerforatorTailMedium : ModNPC @@ -16,19 +20,18 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 14; - npc.npcSlots = 5f; - npc.width = 44; - npc.height = 58; + npc.GetNPCDamage(); + npc.npcSlots = 5f; + npc.width = 40; + npc.height = 50; npc.defense = 10; - npc.LifeMaxNERB(2000, 2200, 700000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(160, 180, 7000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -37,30 +40,95 @@ namespace CalamityMod.NPCs.Perforator npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + + npc.Calamity().SplittingWorm = true; + } public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + 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 (Main.player[npc.target].dead) + npc.TargetClosest(false); + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + 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) + { + 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) + { + 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); + } + + 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; + vector2.X = (int)(vector2.X / 16f) * 16; + vector2.Y = (int)(vector2.Y / 16f) * 16; + num39 -= vector2.X; + num40 -= vector2.Y; + float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40); + + 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; + } + catch + { + } + + 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); + num52 = (num52 - num53) / num52; + num39 *= num52; + num40 *= num52; + npc.velocity = Vector2.Zero; + npc.position.X += num39; + npc.position.Y += num40; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -73,7 +141,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -114,13 +182,11 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 60, true); - player.AddBuff(BuffID.Bleeding, 60, true); } } } diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 3ee50e4643..7d980af943 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Perforator { public class PerforatorTailSmall : ModNPC @@ -16,20 +18,17 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - npc.damage = 10; - npc.npcSlots = 5f; + npc.GetNPCDamage(); npc.width = 40; npc.height = 34; npc.defense = 8; - npc.LifeMaxNERB(1250, 1500, 500000); - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); - npc.aiStyle = 6; + npc.LifeMaxNERB(1250, 1500, 50000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - npc.scale = 0.9f; npc.alpha = 255; - npc.buffImmune[ModContent.BuffType()] = false; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -38,7 +37,14 @@ namespace CalamityMod.NPCs.Perforator npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.25f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -47,21 +53,83 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - } + 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); + + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) + { + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + 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); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + 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) + { + 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; + } + catch + { + } + 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; + 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; + + if (num191 < 0f) + npc.spriteDirection = 1; + else if (num191 > 0f) + npc.spriteDirection = -1; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -74,7 +142,7 @@ namespace CalamityMod.NPCs.Perforator 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, 4f + npc.gfxOffY); + 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"); @@ -113,14 +181,12 @@ namespace CalamityMod.NPCs.Perforator public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { - npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.lifeMax = (int)(npc.lifeMax * 0.85f * bossLifeScale); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 60, true); - player.AddBuff(BuffID.Bleeding, 60, true); } } } diff --git a/NPCs/NormalNPCs/PlagueBee.cs b/NPCs/PlagueEnemies/PlagueBee.cs similarity index 85% rename from NPCs/NormalNPCs/PlagueBee.cs rename to NPCs/PlagueEnemies/PlagueBee.cs index 51b21d9229..1771277b48 100644 --- a/NPCs/NormalNPCs/PlagueBee.cs +++ b/NPCs/PlagueEnemies/PlagueBee.cs @@ -8,7 +8,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs +namespace CalamityMod.NPCs.PlagueEnemies { public class PlagueBee : ModNPC { @@ -33,15 +33,8 @@ namespace CalamityMod.NPCs.NormalNPCs animationType = NPCID.Bee; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; npc.noTileCollide = false; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -68,17 +61,17 @@ namespace CalamityMod.NPCs.NormalNPCs 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/NormalNPCs/PlagueBeeGlow"); + texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -90,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -117,7 +110,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) @@ -128,6 +121,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (npc.life <= 0) { + Main.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); diff --git a/NPCs/NormalNPCs/PlagueBee.png b/NPCs/PlagueEnemies/PlagueBee.png similarity index 100% rename from NPCs/NormalNPCs/PlagueBee.png rename to NPCs/PlagueEnemies/PlagueBee.png diff --git a/NPCs/NormalNPCs/PlagueBeeGlow.png b/NPCs/PlagueEnemies/PlagueBeeGlow.png similarity index 100% rename from NPCs/NormalNPCs/PlagueBeeGlow.png rename to NPCs/PlagueEnemies/PlagueBeeGlow.png diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.cs b/NPCs/PlagueEnemies/PlagueBeeLarge.cs similarity index 86% rename from NPCs/NormalNPCs/PlagueBeeLarge.cs rename to NPCs/PlagueEnemies/PlagueBeeLarge.cs index 0ce7d36fcb..d1d391d517 100644 --- a/NPCs/NormalNPCs/PlagueBeeLarge.cs +++ b/NPCs/PlagueEnemies/PlagueBeeLarge.cs @@ -7,7 +7,8 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs + +namespace CalamityMod.NPCs.PlagueEnemies { public class PlagueBeeLarge : ModNPC { @@ -32,15 +33,8 @@ namespace CalamityMod.NPCs.NormalNPCs animationType = NPCID.Bee; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; npc.noTileCollide = false; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; banner = ModContent.NPCType(); bannerItem = ModContent.ItemType(); } @@ -67,17 +61,17 @@ namespace CalamityMod.NPCs.NormalNPCs 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/NormalNPCs/PlagueBeeGlow"); + texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -89,7 +83,7 @@ namespace CalamityMod.NPCs.NormalNPCs 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -127,6 +121,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (npc.life <= 0) { + Main.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); diff --git a/NPCs/NormalNPCs/PlagueBeeLarge.png b/NPCs/PlagueEnemies/PlagueBeeLarge.png similarity index 100% rename from NPCs/NormalNPCs/PlagueBeeLarge.png rename to NPCs/PlagueEnemies/PlagueBeeLarge.png diff --git a/NPCs/NormalNPCs/PlaguedDerpling.cs b/NPCs/PlagueEnemies/PlaguedDerpling.cs similarity index 93% rename from NPCs/NormalNPCs/PlaguedDerpling.cs rename to NPCs/PlagueEnemies/PlaguedDerpling.cs index 58a7850425..1bbcb275e6 100644 --- a/NPCs/NormalNPCs/PlaguedDerpling.cs +++ b/NPCs/PlagueEnemies/PlaguedDerpling.cs @@ -8,7 +8,8 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs + +namespace CalamityMod.NPCs.PlagueEnemies { public class PlaguedDerpling : ModNPC { @@ -31,13 +32,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit22; - npc.DeathSound = SoundID.NPCDeath25; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -164,7 +158,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) @@ -175,6 +169,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (npc.life <= 0) { + Main.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); diff --git a/NPCs/NormalNPCs/PlaguedDerpling.png b/NPCs/PlagueEnemies/PlaguedDerpling.png similarity index 100% rename from NPCs/NormalNPCs/PlaguedDerpling.png rename to NPCs/PlagueEnemies/PlaguedDerpling.png diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.cs b/NPCs/PlagueEnemies/PlaguedFlyingFox.cs similarity index 81% rename from NPCs/NormalNPCs/PlaguedFlyingFox.cs rename to NPCs/PlagueEnemies/PlaguedFlyingFox.cs index 8bcdf74723..10d5c7aa54 100644 --- a/NPCs/NormalNPCs/PlaguedFlyingFox.cs +++ b/NPCs/PlagueEnemies/PlaguedFlyingFox.cs @@ -5,7 +5,8 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs + +namespace CalamityMod.NPCs.PlagueEnemies { public class PlaguedFlyingFox : ModNPC { @@ -29,13 +30,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 10, 0); npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath4; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -51,7 +45,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) @@ -62,6 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (npc.life <= 0) { + Main.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); diff --git a/NPCs/NormalNPCs/PlaguedFlyingFox.png b/NPCs/PlagueEnemies/PlaguedFlyingFox.png similarity index 100% rename from NPCs/NormalNPCs/PlaguedFlyingFox.png rename to NPCs/PlagueEnemies/PlaguedFlyingFox.png diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/PlagueEnemies/PlaguedJungleSlime.cs similarity index 91% rename from NPCs/NormalNPCs/PlaguedJungleSlime.cs rename to NPCs/PlagueEnemies/PlaguedJungleSlime.cs index 22513e92ce..e1d1facfc2 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/PlagueEnemies/PlaguedJungleSlime.cs @@ -8,7 +8,8 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs + +namespace CalamityMod.NPCs.PlagueEnemies { public class PlaguedJungleSlime : ModNPC { @@ -36,13 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs npc.noGravity = false; npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; - npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -120,6 +114,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (npc.life <= 0) { + Main.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); @@ -135,7 +130,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/PlagueEnemies/PlaguedJungleSlime.png b/NPCs/PlagueEnemies/PlaguedJungleSlime.png new file mode 100644 index 0000000000..60fc9c00bc Binary files /dev/null and b/NPCs/PlagueEnemies/PlaguedJungleSlime.png differ diff --git a/NPCs/NormalNPCs/PlaguedTortoise.cs b/NPCs/PlagueEnemies/PlaguedTortoise.cs similarity index 81% rename from NPCs/NormalNPCs/PlaguedTortoise.cs rename to NPCs/PlagueEnemies/PlaguedTortoise.cs index d105b09243..6fb5c503cb 100644 --- a/NPCs/NormalNPCs/PlaguedTortoise.cs +++ b/NPCs/PlagueEnemies/PlaguedTortoise.cs @@ -5,7 +5,8 @@ using CalamityMod.Items.Placeables.Banners; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs + +namespace CalamityMod.NPCs.PlagueEnemies { public class PlaguedTortoise : ModNPC { @@ -28,14 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs animationType = NPCID.GiantTortoise; npc.value = Item.buyPrice(0, 0, 20, 0); npc.HitSound = SoundID.NPCHit24; - npc.DeathSound = SoundID.NPCDeath27; npc.noGravity = false; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -48,6 +42,7 @@ namespace CalamityMod.NPCs.NormalNPCs } if (npc.life <= 0) { + Main.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); @@ -66,7 +61,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void NPCLoot() diff --git a/NPCs/NormalNPCs/PlaguedTortoise.png b/NPCs/PlagueEnemies/PlaguedTortoise.png similarity index 100% rename from NPCs/NormalNPCs/PlaguedTortoise.png rename to NPCs/PlagueEnemies/PlaguedTortoise.png diff --git a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs index 0a5cbe7908..794a72c924 100644 --- a/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs +++ b/NPCs/PlaguebringerGoliath/PbGScreenShaderData.cs @@ -1,4 +1,3 @@ -using CalamityMod.NPCs.Calamitas; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; @@ -16,7 +15,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath private void UpdatePbGIndex() { - int PbGType = ModContent.NPCType(); + int PbGType = ModContent.NPCType(); if (PbGIndex >= 0 && Main.npc[PbGIndex].active && Main.npc[PbGIndex].type == PbGType) { return; diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index 908024d375..e8c7285bad 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,44 +21,38 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - npc.damage = 60; - npc.width = 36; + npc.GetNPCDamage(); + npc.width = 36; npc.height = 30; npc.defense = 15; npc.scale = 0.75f; npc.lifeMax = 300; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.9f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.9f; animationType = NPCID.Bee; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; } public override void AI() { - bool revenge = CalamityWorld.revenge; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.015f, 0.1f, 0f); if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { - npc.TargetClosest(true); + npc.TargetClosest(); } float num = revenge ? 8f : 7f; float num2 = revenge ? 0.2f : 0.15f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) { num *= 1.5f; num2 *= 1.5f; @@ -224,17 +219,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/NormalNPCs/PlagueBeeGlow"); + + texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -246,7 +241,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -256,11 +251,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return false; } - public override bool PreNPCLoot() - { - return false; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 120, true); diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index 359a096b21..5955282814 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,29 +21,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - npc.damage = 65; - npc.width = 36; + npc.GetNPCDamage(); + npc.width = 36; npc.height = 30; npc.defense = 20; npc.lifeMax = 400; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.aiStyle = -1; aiType = -1; - npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.95f; + npc.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.95f; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; } public override void FindFrame(int frameHeight) @@ -85,7 +80,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1259 = Main.player[npc.target].Center.Y - vector145.Y; float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); float num1261 = revenge ? 22f : 20f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) num1261 = 30f; num1260 = num1261 / num1260; @@ -117,17 +112,17 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/NormalNPCs/PlagueBeeGlow"); + texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/PlagueEnemies/PlagueBeeGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -139,7 +134,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -149,11 +144,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return false; } - public override bool PreNPCLoot() - { - return false; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index b902dd5b2a..6e5178b3a5 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,11 +21,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - npc.damage = 90; - npc.width = 22; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 22; npc.height = 22; npc.defense = 10; - npc.lifeMax = CalamityWorld.bossRushActive ? 20000 : 200; + npc.lifeMax = BossRushEvent.BossRushActive ? 3000 : 300; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -33,17 +35,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.noGravity = true; npc.canGhostHeal = false; npc.noTileCollide = true; - npc.buffImmune[BuffID.ShadowFlame] = true; - npc.buffImmune[BuffID.Venom] = true; - npc.buffImmune[BuffID.OnFire] = true; - npc.buffImmune[BuffID.Poisoned] = true; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = 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.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) { float num247 = 0f; @@ -74,7 +70,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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; } - npc.rotation = npc.velocity.ToRotation() + 1.57079637f; + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; if (npc.ai[2] < 90f) { npc.ai[2] += 1f; @@ -113,7 +109,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num761 = v3.ToRotation(); float angle = num761 - num760; angle = MathHelper.WrapAngle(angle); - npc.velocity = npc.velocity.RotatedBy(angle * 0.2, default); + npc.velocity = npc.velocity.RotatedBy(angle * 0.2); } else { @@ -155,14 +151,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -177,7 +173,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -226,12 +222,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return true; } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; - public override void OnHitPlayer(Player player, int damage, bool crit) + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); } diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png index 3d288c7cdf..97db383bdf 100644 Binary files a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png and b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.png differ diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 432e2133e6..5e18cbe21d 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,4 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -14,16 +15,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Mine"); + Main.npcFrameCount[npc.type] = 4; } public override void SetDefaults() { - npc.damage = 0; - npc.npcSlots = 1f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 1f; npc.width = 42; npc.height = 42; npc.defense = 10; - npc.lifeMax = CalamityWorld.bossRushActive ? 10000 : 100; + npc.lifeMax = BossRushEvent.BossRushActive ? 3000 : 300; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -46,7 +49,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void AI() { - Player player = Main.player[npc.target]; + Lighting.AddLight(npc.Center, 0.03f, 0.2f, 0f); + Player player = Main.player[npc.target]; if (!player.active || player.dead) { npc.TargetClosest(false); @@ -76,12 +80,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.dontTakeDamage = npc.ai[3] >= 180f ? false : true; if (npc.ai[3] >= 480f) { - npc.velocity.Y *= 0.985f; - npc.velocity.X *= 0.985f; + npc.velocity *= 0.985f; return; } npc.TargetClosest(true); - float num1372 = CalamityWorld.bossRushActive ? 10f : 7f; + float num1372 = 7f; 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; @@ -120,17 +123,27 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override void FindFrame(int 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; 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 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, 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, 4f + npc.gfxOffY); + 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); @@ -142,12 +155,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return false; } + public override bool PreNPCLoot() => false; + + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 240, true); + } + 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.damage = 200; 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); diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.png b/NPCs/PlaguebringerGoliath/PlagueMine.png index 722fb1b01b..8174e5ae94 100644 Binary files a/NPCs/PlaguebringerGoliath/PlagueMine.png and b/NPCs/PlaguebringerGoliath/PlagueMine.png differ diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index e17e8ad2bb..afaaf34705 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -21,8 +22,8 @@ using System; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.NPCs.PlaguebringerGoliath { [AutoloadBossHead] @@ -48,13 +49,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - npc.damage = 100; - npc.npcSlots = 64f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 64f; npc.width = 198; npc.height = 198; npc.defense = 40; - npc.DR_NERD(0.4f); - npc.LifeMaxNERB(81000, 106500, 3700000); + npc.DR_NERD(0.3f); + npc.LifeMaxNERB(81000, 106500, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -62,36 +64,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath aiType = -1; npc.boss = true; npc.value = Item.buyPrice(0, 25, 0, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("PlaguebringerGoliath") ?? MusicID.Boss3; bossBag = ModContent.ItemType(); } @@ -104,6 +81,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath writer.Write(despawnTimer); writer.Write(chargeDistance); writer.Write(charging); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -115,10 +94,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath despawnTimer = reader.ReadInt32(); chargeDistance = reader.ReadInt32(); charging = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + //drawcode adjustments for the new sprite npc.gfxOffY = charging ? -40 : -50; npc.width = npc.frame.Width / 2; @@ -127,23 +110,47 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - // Mode variables - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; - // Light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.3f, 0.7f, 0f); + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + bool phase5 = lifeRatio < 0.1f; + + // Mode variables + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // 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[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); // Show message - if (!halfLife && ((lifeRatio < 0.5f && expertMode) || death)) + if (!halfLife && phase3 && expertMode) { string key = "Mods.CalamityMod.PlagueBossText"; Color messageColor = Color.Lime; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGNukeWarning"), npc.Center); halfLife = true; } @@ -158,7 +165,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Count nearby players int num1038 = 0; - for (int num1039 = 0; num1039 < 255; num1039++) + for (int num1039 = 0; num1039 < Main.maxPlayers; num1039++) { if (Main.player[num1039].active && !Main.player[num1039].dead && (vectorCenter - Main.player[num1039].Center).Length() < 1000f) num1038++; @@ -166,14 +173,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Defense gain if (expertMode) - { - int num1040 = death ? 20 : (int)(20f * (1f - lifeRatio)); - npc.defense = npc.defDefense + num1040; - } + npc.defense = npc.defDefense + (int)(20f * (1f - lifeRatio)); - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + 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(); Player player = Main.player[npc.target]; @@ -181,21 +189,29 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 distFromPlayer = player.Center - vectorCenter; // Enrage - int enrageScale = 0; - if ((npc.position.Y / 16f) < Main.worldSurface || (npc.position.Y / 16f) > (Main.maxTilesY - 200)) - enrageScale++; - if (!player.ZoneJungle) - enrageScale++; + float enrageScale = death ? 0.5f : 0f; + if (!player.ZoneJungle || malice) + { + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive; + enrageScale += 1.5f; + } - if (CalamityWorld.bossRushActive) - enrageScale = 0; + if (enrageScale > 1.5f) + enrageScale = 1.5f; - bool diagonalDash = revenge && (lifeRatio < 0.8f || death); + if (BossRushEvent.BossRushActive) + enrageScale = 2f; + + if (enraged) + { + npc.Calamity().CurrentlyEnraged = true; + enrageScale = 2.5f; + } + + bool diagonalDash = (revenge && phase2) || malice; 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) @@ -235,6 +251,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath return; } + // Always start in enemy spawning phase + if (calamityGlobalNPC.newAI[3] == 0f) + { + calamityGlobalNPC.newAI[3] = 1f; + npc.ai[0] = 2f; + npc.netUpdate = true; + } + // Phase switch if (npc.ai[0] == -1f) { @@ -244,24 +268,39 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath do num596 = MissileCountdown == 1 ? 4 : Main.rand.Next(4); while (num596 == npc.ai[1] || num596 == 1); - if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) - { - switch (Main.rand.Next(3)) - { - case 0: - chargeDistance = 0; - break; - case 1: - chargeDistance = 400; - break; - case 2: - chargeDistance = -400; - break; - } - } + if (num596 == 0 && diagonalDash && distFromPlayer.Length() < 1800f) + { + do + { + switch (Main.rand.Next(3)) + { + case 0: + chargeDistance = 0; + break; + case 1: + chargeDistance = 400; + break; + case 2: + chargeDistance = -400; + break; + } + } + while (chargeDistance == npc.ai[3]); + + npc.ai[3] = -chargeDistance; + } 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; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); } } @@ -269,34 +308,42 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 0f) { float num1044 = revenge ? 28f : 26f; - if (lifeRatio < 0.66f || death) - num1044 += 2f; - if (lifeRatio < 0.33f || death) - num1044 += 2f; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1044 += 2f; + if (phase2) + num1044 += 1f; + if (phase3) + num1044 += 1f; + if (phase4) + num1044 += 1f; + if (phase5) + num1044 += 1f; - num1044 += 6f * enrageScale; + num1044 += 2f * enrageScale; - int num1043 = 2 + enrageScale; + int num1043 = (int)Math.Ceiling(2f + enrageScale); 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; + + // 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); + return; } // Charge if (npc.ai[1] % 2f == 0f) { - npc.TargetClosest(true); - - float playerLocation = vectorCenter.X - player.Center.X; + float playerLocation = vectorCenter.X - player.Center.X; float num620 = 20f; - num620 += 20 * enrageScale; + num620 += 20f * enrageScale; if (Math.Abs(npc.Center.Y - (player.Center.Y - chargeDistance)) < num620) { @@ -331,15 +378,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.velocity.Y = num1046 * num1047; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - npc.Calamity().newAI[1] = npc.velocity.X; - npc.Calamity().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; - Main.PlaySound(15, (int)npc.position.X, (int)npc.position.Y, 0); + npc.netUpdate = true; + npc.netSpam -= 5; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PBGDash"), npc.Center); return; } @@ -348,23 +398,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1048 = revenge ? 14f : 12f; float num1049 = revenge ? 0.25f : 0.22f; - if (lifeRatio < 0.66f || death) + if (phase2) { num1048 += 1f; num1049 += 0.05f; } - if (lifeRatio < 0.33f || death) + if (phase4) { num1048 += 1f; num1049 += 0.05f; } - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1048 += 2f; - num1049 += 0.1f; - } - num1048 += 3 * enrageScale; - num1049 += 0.5f * enrageScale; + num1048 += 1.5f * enrageScale; + num1049 += 0.25f * enrageScale; if (vectorCenter.Y < (player.Center.Y - chargeDistance)) npc.velocity.Y += num1049; @@ -391,10 +436,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; + npc.netUpdate = true; + npc.netSpam -= 5; } // Slow down after charge @@ -408,26 +451,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.spriteDirection = npc.direction; int num1050 = revenge ? 525 : 550; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num1050 = 300; - else if (CalamityWorld.bossRushActive) - num1050 = 400; - else if (lifeRatio < 0.33f || death) - num1050 = revenge ? 450 : 475; - else if (lifeRatio < 0.66f) + if (phase4) + num1050 = revenge ? 450 : 475; + else if (phase3) num1050 = revenge ? 475 : 500; - num1050 -= 100 * enrageScale; + else if (phase2) + num1050 = revenge ? 500 : 525; + num1050 -= (int)(25f * enrageScale); int num1051 = 1; 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 (enrageScale > 0 && npc.ai[2] == 1f) - npc.velocity *= 0.5f; + npc.velocity *= 0.95f; if (npc.ai[2] != 1f) { @@ -436,61 +476,55 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Velocity fix if PBG slowed if (npc.velocity.Length() < num1044) - npc.velocity = new Vector2(npc.Calamity().newAI[1], npc.Calamity().newAI[2]); + npc.velocity = new Vector2(calamityGlobalNPC.newAI[1], calamityGlobalNPC.newAI[2]); - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] > 90f) + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] > 90f) npc.velocity *= 1.01f; + npc.netUpdate = true; return; } - npc.TargetClosest(true); - - npc.spriteDirection = npc.direction; + float playerLocation = vectorCenter.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.spriteDirection = npc.direction; npc.rotation = npc.velocity.X * 0.02f; charging = false; npc.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; - if (lifeRatio < 0.8f || death) + if (phase2) { npc.velocity *= 0.98f; num1052 += 0.05f; } - if (lifeRatio < 0.6f || death) + if (phase3) { npc.velocity *= 0.98f; num1052 += 0.05f; } - if (lifeRatio < 0.4f || death) + if (phase4) { npc.velocity *= 0.98f; num1052 += 0.05f; } if (enrageScale > 0) - npc.velocity *= 0.7f; + npc.velocity *= 0.95f; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; npc.ai[1] += 1f; - npc.Calamity().newAI[0] = 0f; + calamityGlobalNPC.newAI[0] = 0f; } - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; } } // Move closer if too far away else if (npc.ai[0] == 2f) { - npc.TargetClosest(true); - float playerLocation = vectorCenter.X - player.Center.X; npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; @@ -498,11 +532,22 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1055 = player.position.X + (player.width / 2) - vectorCenter.X; float num1056 = player.position.Y + (player.height / 2) - 200f - vectorCenter.Y; float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056); - if (num1057 < 600f) + + calamityGlobalNPC.newAI[0] += 1f; + if (num1057 < 600f || calamityGlobalNPC.newAI[0] >= 180f) { - npc.ai[0] = (lifeRatio < 0.66f || death) ? 5f : 1f; + npc.ai[0] = (phase3 || malice) ? 5f : 1f; npc.ai[1] = 0f; - npc.netUpdate = true; + calamityGlobalNPC.newAI[0] = 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); + return; } @@ -514,10 +559,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 1f) { charging = false; - - npc.TargetClosest(true); - - Vector2 vector119 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y - 40f); + 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; @@ -525,10 +567,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; npc.ai[1] += num1038 / 2; - if (lifeRatio < 0.75f) - npc.ai[1] += 0.25f; - if (lifeRatio < 0.5f) - npc.ai[1] += 0.25f; + if (phase2) + npc.ai[1] += 0.5f; bool flag103 = false; if (npc.ai[1] > 40f - 12f * enrageScale) @@ -540,7 +580,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (flag103) { - Main.PlaySound(3, (int)npc.position.X, (int)npc.position.Y, 8); + Main.PlaySound(SoundID.NPCHit, (int)npc.position.X, (int)npc.position.Y, 8); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -550,23 +590,22 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else randomAmt = ModContent.NPCType(); - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 2) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - - if (revenge && !NPC.AnyNPCs(ModContent.NPCType())) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (NPC.CountNPCS(ModContent.NPCType()) < 2) { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, randomAmt, 0, 0f, 0f, 0f, 0f, 255); + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, randomAmt); Main.npc[num1062].velocity = player.Center - npc.Center; Main.npc[num1062].velocity.Normalize(); - Main.npc[num1062].velocity *= CalamityWorld.bossRushActive ? 12f : 6f; + Main.npc[num1062].velocity *= 6f; Main.npc[num1062].localAI[0] = 60f; Main.npc[num1062].netUpdate = true; } + + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 2) + NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType()); + + npc.netUpdate = true; } } @@ -586,6 +625,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); } } @@ -593,10 +639,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 5f) { charging = false; - - npc.TargetClosest(true); - - Vector2 vector119 = new Vector2(npc.direction == 1 ? npc.getRect().BottomLeft().X : npc.getRect().BottomRight().X, npc.getRect().Bottom().Y - 40f); + 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; @@ -605,10 +648,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.ai[1] += 1f; npc.ai[1] += num1038 / 2; bool flag103 = false; - if (lifeRatio < 0.25f || death) - npc.ai[1] += 0.25f; - if (lifeRatio < 0.1f || death) - npc.ai[1] += 0.25f; + if (phase4) + npc.ai[1] += 0.5f; + if (phase5) + npc.ai[1] += 0.5f; + + if (npc.ai[1] % 20f == 19f) + npc.netUpdate = true; if (npc.ai[1] > 40f - 12f * enrageScale) { @@ -619,19 +665,35 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (flag103) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 88); if (Main.netMode != NetmodeID.MultiplayerClient) { - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + if (malice) + { + int randomAmt = expertMode ? 2 : 4; + if (Main.rand.Next(randomAmt) == 0) + randomAmt = ModContent.NPCType(); + else + randomAmt = ModContent.NPCType(); - if (revenge && !NPC.AnyNPCs(ModContent.NPCType())) - NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + if (NPC.CountNPCS(ModContent.NPCType()) < 2) + { + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, randomAmt); - float projectileSpeed = revenge ? 6f : 5f; - if (CalamityWorld.bossRushActive) - projectileSpeed *= 2f; + Main.npc[num1062].velocity = player.Center - npc.Center; + Main.npc[num1062].velocity.Normalize(); + Main.npc[num1062].velocity *= 6f; + + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + } + } + + if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < 3) + NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType()); + + float projectileSpeed = (revenge ? 8f : 7f) + enrageScale * 2f; float num1071 = player.position.X + player.width * 0.5f - vector119.X; float num1072 = player.position.Y + player.height * 0.5f - vector119.Y; @@ -643,7 +705,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.CountNPCS(ModContent.NPCType()) < 5) { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, ModContent.NPCType()); Main.npc[num1062].velocity.X = num1071; Main.npc[num1062].velocity.Y = num1072; Main.npc[num1062].netUpdate = true; @@ -667,33 +729,34 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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; + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, $"Sounds/Custom/PlagueSounds/PBGAttackSwitch{Main.rand.Next(1, 3)}"), npc.Center); } } // Stinger phase 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 - 40f); + 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; - int num650 = (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 10 : ((lifeRatio < 0.1f || death) ? 20 : ((lifeRatio < 0.5f) ? 25 : 30)); - num650 -= 5 * enrageScale; + 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) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 42); + Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 42); if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileSpeed = revenge ? 6.5f : 6f; - projectileSpeed += 7 * enrageScale; - - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - projectileSpeed += 10f; - - if (CalamityWorld.bossRushActive) - projectileSpeed *= 1.5f; + projectileSpeed += 2f * enrageScale; float num1071 = player.position.X + player.width * 0.5f - vector121.X; float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; @@ -702,31 +765,31 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1071 *= num1073; num1072 *= num1073; - int num1074 = 40; - int num1075 = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - if (expertMode) - { - num1074 = 32; - int damageBoost = death ? 5 : (int)(6f * (1f - lifeRatio)); - num1074 += damageBoost; + int type = ModContent.ProjectileType(); + switch ((int)npc.ai[2]) + { + case 0: + case 1: + break; + case 2: + case 3: + if (expertMode) + type = ModContent.ProjectileType(); + break; + case 4: + type = ModContent.ProjectileType(); + break; + } - if (Main.rand.NextBool(6)) - { - num1074 += 8; - num1075 = ModContent.ProjectileType(); - } - } - else - { - if (Main.rand.NextBool(9)) - { - num1074 = 50; - num1075 = ModContent.ProjectileType(); - } - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, player.position.Y); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, type, damage, 0f, Main.myPlayer, 0f, player.position.Y); + npc.netUpdate = true; } - } + + npc.ai[2] += 1f; + if (npc.ai[2] > 4f) + npc.ai[2] = 0f; + } Movement(100f, 400f, 500f, player, enrageScale); @@ -738,7 +801,15 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { npc.ai[0] = -1f; npc.ai[1] = 3f; - npc.netUpdate = true; + 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); } } @@ -746,12 +817,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else if (npc.ai[0] == 4f) { float num1044 = revenge ? 28f : 26f; - if (CalamityWorld.bossRushActive) - num1044 = 32f; - num1044 += 6f * enrageScale; + num1044 += 3f * enrageScale; - int num1043 = 2 + enrageScale; + int num1043 = (int)Math.Ceiling(2f + enrageScale); if (npc.ai[1] > (2 * num1043) && npc.ai[1] % 2f == 0f) { MissileCountdown = 0; @@ -759,14 +828,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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); return; } // Charge if (npc.ai[1] % 2f == 0f) { - npc.TargetClosest(true); - float playerLocation = vectorCenter.X - player.Center.X; float num620 = 20f; @@ -776,28 +849,28 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { if (MissileCountdown == 1) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 116); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/PlagueSounds/PBGBarrageLaunch"), npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int speed = revenge ? 6 : 5; - speed += 7 * enrageScale; + float speed = revenge ? 6f : 5f; + speed += 2f * enrageScale; - if (CalamityWorld.bossRushActive) - speed = 12; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - int damage = expertMode ? 48 : 60; - - Vector2 baseVelocity = player.Center - vectorCenter; + Vector2 baseVelocity = player.Center - vectorCenter; baseVelocity.Normalize(); baseVelocity *= speed; - for (int i = 0; i < MissileProjectiles; i++) + int missiles = malice ? 16 : MissileProjectiles; + int spread = malice ? 18 : 24; + for (int i = 0; i < missiles; i++) { - Vector2 spawn = vectorCenter; - spawn.X += i * 27 - (MissileProjectiles * 12); // -96 to 93 - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / MissileProjectiles))); - Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, player.position.Y); + Vector2 spawn = vectorCenter; // Normal = 96, Malice = 144 + spawn.X += i * (int)(spread * 1.125) - (missiles * (spread / 2)); // Normal = -96 to 93, Malice = -144 to 156 + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / missiles))); + Projectile.NewProjectile(spawn, velocity, type, damage, 0f, Main.myPlayer, 0f, player.position.Y); } } } @@ -821,6 +894,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.spriteDirection != 1) npc.rotation += (float)Math.PI; + npc.netUpdate = true; + return; } @@ -829,13 +904,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1048 = revenge ? 16f : 14f; float num1049 = revenge ? 0.2f : 0.18f; - num1048 += 3 * enrageScale; - num1049 += 0.5f * enrageScale; - if (CalamityWorld.bossRushActive) - { - num1048 *= 1.5f; - num1049 *= 1.5f; - } + num1048 += 1.5f * enrageScale; + num1049 += 0.25f * enrageScale; if (vectorCenter.Y < player.Center.Y - 500f) npc.velocity.Y += num1049; @@ -861,11 +931,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = playerLocation < 0 ? 1 : -1; npc.spriteDirection = npc.direction; - - npc.netUpdate = true; - - if (npc.netSpam > 10) - npc.netSpam = 10; } // Slow down after charge @@ -886,7 +951,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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.5f; + npc.velocity *= 0.95f; if (npc.ai[2] != 1f) { @@ -896,69 +961,57 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (npc.velocity.Length() < num1044) npc.velocity.X = num1044 * npc.direction; - npc.Calamity().newAI[0] += 1f; - if (npc.Calamity().newAI[0] > 90f) + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] > 90f) npc.velocity.X *= 1.01f; return; } - npc.TargetClosest(true); - - npc.spriteDirection = npc.direction; - npc.rotation = npc.velocity.X * 0.02f; charging = false; npc.velocity *= 0.9f; float num1052 = revenge ? 0.12f : 0.1f; - if (lifeRatio < 0.5f || death) + if (phase3) { npc.velocity *= 0.9f; num1052 += 0.05f; } - if (lifeRatio < 0.3f || death) + if (phase4) { npc.velocity *= 0.9f; num1052 += 0.05f; } - if (lifeRatio < 0.1f || death) + if (phase5) { npc.velocity *= 0.9f; num1052 += 0.05f; } if (enrageScale > 0) - npc.velocity *= 0.7f; + npc.velocity *= 0.95f; if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num1052) { npc.ai[2] = 0f; npc.ai[1] += 1f; - npc.Calamity().newAI[0] = 0f; + calamityGlobalNPC.newAI[0] = 0f; } - - npc.netUpdate = true; - - 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); - } } - private void Movement(float xPos, float yPos, float yPos2, Player player, int enrageScale) + private void Movement(float xPos, float yPos, float yPos2, Player player, float enrageScale) { - Vector2 acceleration = new Vector2(CalamityWorld.bossRushActive ? 0.15f : 0.1f, CalamityWorld.bossRushActive ? 0.2f : 0.15f); + Vector2 acceleration = new Vector2(0.1f, 0.15f); Vector2 velocity = new Vector2(8f, 5f); float deceleration = 0.98f; - acceleration *= 0.2f * enrageScale + 1f; - velocity *= 0.2f * enrageScale + 1f; - deceleration *= 1f - enrageScale * 0.2f; + acceleration *= 0.1f * enrageScale + 1f; + velocity *= 1f - enrageScale * 0.1f; + if (CalamityWorld.malice) + velocity *= 0.5f; + deceleration *= 1f - enrageScale * 0.1f; if (npc.position.Y > player.position.Y - yPos) { @@ -997,7 +1050,28 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool CheckActive() => canDespawn; - public override void HitEffect(int hitDirection, double damage) + // 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 100f; + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 2; k++) { @@ -1009,8 +1083,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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 = 100; - npc.height = 100; + 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++) @@ -1140,9 +1214,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for PBG + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPlaguebringer); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedPlaguebringer, 4, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor }, CalamityWorld.downedPlaguebringer); @@ -1155,7 +1231,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath DropHelper.DropItemSpray(npc, ItemID.Stinger, 3, 5); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), // Virulence DropHelper.WeightStack(w), @@ -1171,7 +1247,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath ); // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 5); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); @@ -1180,23 +1256,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Mark PBG as dead CalamityWorld.downedPlaguebringer = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(ModContent.BuffType(), 180); - } } } } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index c239471a9a..3677e079a6 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -13,6 +13,8 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Events; + namespace CalamityMod.NPCs.PlaguebringerGoliath { public class PlaguebringerShade : ModNPC @@ -26,44 +28,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - npc.damage = 70; - npc.npcSlots = 8f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 8f; npc.width = 66; npc.height = 66; - npc.defense = 30; + npc.defense = 24; npc.DR_NERD(0.2f); npc.lifeMax = 3000; npc.value = Item.buyPrice(0, 1, 50, 0); - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 200000; + npc.lifeMax = 20000; } npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; animationType = NPCID.QueenBee; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -76,7 +57,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { 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 && !CalamityWorld.bossRushActive) + if (!Main.player[npc.target].ZoneJungle && !BossRushEvent.BossRushActive) { flag113 = true; if (npc.timeLeft > 150) @@ -101,7 +82,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { - npc.TargetClosest(true); + npc.TargetClosest(); } bool dead4 = Main.player[npc.target].dead; if (dead4 && Main.expertMode) @@ -177,10 +158,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { num1044 += 2f; } - if (CalamityWorld.bossRushActive) - { - num1044 *= 1.5f; - } 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; @@ -200,11 +177,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1048 += 1f; num1049 += 0.075f; } - if (CalamityWorld.bossRushActive) - { - num1048 *= 1.5f; - num1049 *= 1.5f; - } 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; @@ -254,7 +226,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.direction = 1; } npc.spriteDirection = npc.direction; - int num1050 = CalamityWorld.bossRushActive ? 400 : 500; + 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)) { @@ -274,7 +246,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.localAI[0] = 0f; npc.velocity *= 0.9f; float num1052 = 0.105f; - if (flag113 || CalamityWorld.bossRushActive) + if (flag113) { npc.velocity *= 0.9f; num1052 += 0.075f; @@ -296,11 +268,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { num1054 = 0.12f; } - if (CalamityWorld.bossRushActive) - { - num1053 *= 1.5f; - num1054 *= 1.5f; - } 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; @@ -392,11 +359,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { float num1063 = 14.5f; float num1064 = 0.105f; - if (CalamityWorld.bossRushActive) - { - num1063 *= 1.5f; - num1064 *= 1.5f; - } 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; @@ -456,11 +418,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1066 = 0.09f; num1065 = 8f; } - if (CalamityWorld.bossRushActive) - { - num1065 *= 1.5f; - num1066 *= 1.5f; - } 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; @@ -488,19 +445,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1073 = num1070 / num1073; num1071 *= num1073; num1072 *= num1073; - int num1074 = 26; - int num1075 = ModContent.ProjectileType(); - if (Main.rand.NextBool(15)) - { - num1074 = 33; - num1075 = ModContent.ProjectileType(); - } - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); + int type = Main.rand.NextBool(15) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + 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)) { - num1066 = CalamityWorld.bossRushActive ? 0.12f : 0.105f; + 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; @@ -613,14 +565,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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; @@ -675,10 +627,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public override bool PreNPCLoot() => !NPC.AnyNPCs(ModContent.NPCType()); //don't drop items in the PBG fight - public override void NPCLoot() { + if (NPC.AnyNPCs(ModContent.NPCType())) + return; + 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); @@ -687,7 +640,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + player.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index bcfec7683e..9015c5b4dd 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -1,5 +1,5 @@ +using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -10,113 +10,117 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Polterghast { - public class PhantomFuckYou : ModNPC - { - private bool start = true; - private int timer = 0; + public class PhantomFuckYou : ModNPC + { + private bool start = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Phantom"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom"); NPCID.Sets.TrailingMode[npc.type] = 1; } - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.width = 30; - npc.height = 30; - npc.noGravity = true; - npc.noTileCollide = true; - npc.damage = 0; - npc.lifeMax = 1500; - npc.dontTakeDamage = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - } + public override void SetDefaults() + { + npc.aiStyle = -1; + aiType = -1; + npc.width = 30; + npc.height = 30; + npc.noGravity = true; + npc.noTileCollide = true; + npc.damage = 0; + npc.lifeMax = 1500; + npc.dontTakeDamage = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(start); - writer.Write(timer); - } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(start); + } - public override void ReceiveExtraAI(BinaryReader reader) - { - start = reader.ReadBoolean(); - timer = reader.ReadInt32(); - } + public override void ReceiveExtraAI(BinaryReader reader) + { + start = reader.ReadBoolean(); + } - public override bool PreAI() - { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + public override bool PreAI() + { + if (start) + { + start = false; - if (start) - { - start = false; + 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); + Main.dust[dust].noGravity = true; + } - for (int num621 = 0; num621 < 5; num621++) - Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 180, 0f, 0f, 100, default, 2f); + 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; + return false; + } - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return false; - } + bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= 420f; // Percent life remaining, Polter float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; + // Scale multiplier based on nearby active tiles + float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; + npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + direction *= 0.05f; + npc.rotation = direction.ToRotation(); - timer++; - if (timer >= 150) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 62 : 75; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X * 0.05f, direction.Y * 0.05f, ModContent.ProjectileType(), damage, 1f, npc.target); - } - - timer = 0; - } + if (!chargePhase) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= 150f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float maxVelocity = 8f * tileEnrageMult; + float acceleration = 1.05f + (tileEnrageMult - 1f) * 0.1f; + Projectile.NewProjectile(npc.Center, direction, type, damage, 1f, npc.target, maxVelocity, acceleration); + } + npc.ai[2] = 0f; + } + } NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; 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; + 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; float SPEEN = 1f - lifeRatio * 2f; if (SPEEN < 0f) SPEEN = 0f; npc.ai[1] += 0.5f + SPEEN; - return false; - } + return false; + } - public override Color? GetAlpha(Color drawColor) - { - return new Color(200, 200, 200, 0); - } + public override Color? GetAlpha(Color drawColor) + { + return new Color(200, 200, 200, 0); + } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() + { + return false; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -140,14 +144,14 @@ namespace CalamityMod.NPCs.Polterghast 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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; diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 0de5edf868..2e03fb5649 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -1,6 +1,5 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -16,8 +15,9 @@ namespace CalamityMod.NPCs.Polterghast public class PolterPhantom : ModNPC { private int despawnTimer = 600; + private bool reachedChargingPoint = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Polterghast"); Main.npcFrameCount[npc.type] = 4; @@ -26,8 +26,9 @@ namespace CalamityMod.NPCs.Polterghast public override void SetDefaults() { - npc.damage = 210; - npc.width = 90; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 90; npc.height = 120; npc.LifeMaxNERB(130000, 150000, 900000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; @@ -35,22 +36,7 @@ namespace CalamityMod.NPCs.Polterghast npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; + npc.Opacity = 0f; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -63,22 +49,35 @@ namespace CalamityMod.NPCs.Polterghast public override void SendExtraAI(BinaryWriter writer) { writer.Write(despawnTimer); - } + writer.Write(reachedChargingPoint); + CalamityGlobalNPC cgn = npc.Calamity(); + writer.Write(cgn.newAI[0]); + writer.Write(cgn.newAI[1]); + writer.Write(cgn.newAI[2]); + writer.Write(cgn.newAI[3]); + } public override void ReceiveExtraAI(BinaryReader reader) { despawnTimer = reader.ReadInt32(); - } + reachedChargingPoint = reader.ReadBoolean(); + CalamityGlobalNPC cgn = npc.Calamity(); + cgn.newAI[0] = reader.ReadSingle(); + cgn.newAI[1] = reader.ReadSingle(); + cgn.newAI[2] = reader.ReadSingle(); + cgn.newAI[3] = reader.ReadSingle(); + } public override void AI() { CalamityGlobalNPC.ghostBossClone = npc.whoAmI; - npc.alpha -= 5; - if (npc.alpha < 50) - npc.alpha = 50; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; - if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) + if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { npc.active = false; npc.netUpdate = true; @@ -87,161 +86,314 @@ namespace CalamityMod.NPCs.Polterghast Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); - npc.TargetClosest(true); + Player player = Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target]; - Vector2 vector = npc.Center; + // Percent life remaining, Polter + float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) - npc.active = false; + 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; + float chargeVelocity = 24f; + float chargeAcceleration = 0.6f; + float chargeDistance = 480f; - bool speedBoost1 = false; + bool speedBoost = false; bool despawnBoost = false; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; if (npc.timeLeft < 1500) npc.timeLeft = 1500; - int[] array2 = new int[4]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - int num; - for (int num733 = 0; num733 < 200; num733 = num + 1) - { - if (Main.npc[num733].active && Main.npc[num733].type == ModContent.NPCType()) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - num732++; - if (num732 > 3) - break; - } - num = num733; - } - num730 /= num732; - num731 /= num732; - - float num734 = 3f; - float num735 = 0.03f; - if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive && Main.player[npc.target].position.Y < Main.worldSurface * 16.0) + float velocity = 3f; + float acceleration = 0.03f; + if (!player.ZoneDungeon && !BossRushEvent.BossRushActive && player.position.Y < Main.worldSurface * 16.0) { despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; + 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; + } - speedBoost1 = true; - num734 += 8f; - num735 = 0.15f; + speedBoost = true; + velocity += 8f; + acceleration = 0.15f; } else despawnTimer++; - if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) + if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) { - num734 = 21f; - num735 = 0.13f; + velocity = 21f; + acceleration = 0.13f; } if (expertMode) { - num734 += revenge ? 5f : 3.5f; - num735 += revenge ? 0.035f : 0.025f; + chargeVelocity += revenge ? 4f : 2f; + velocity += revenge ? 5f : 3.5f; + acceleration += revenge ? 0.035f : 0.025f; } - Vector2 vector91 = new Vector2(num730, num731); - float num736 = Main.player[npc.target].Center.X - vector91.X; - float num737 = Main.player[npc.target].Center.Y - vector91.Y; + // Predictiveness + float chargePredictionAmt = 10f + 20f * (tileEnrageMult - 1f); + Vector2 predictionVector = chargePhase && revenge ? player.velocity * chargePredictionAmt : Vector2.Zero; + Vector2 lookAt = player.Center + predictionVector; + Vector2 rotationVector = lookAt - vector; - if (despawnBoost) - { - num737 *= -1f; - num736 *= -1f; - num734 += 8f; - } + // Rotation + 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; + } + else + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; - float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); - int num739 = 500; - if (speedBoost1) - num739 += 500; - if (expertMode) - num739 += 150; + npc.damage = npc.defDamage; - // Increase speed based on nearby active tiles - num734 *= tileEnrageMult; - num735 *= tileEnrageMult; + if (!chargePhase) + { + // Set this here to avoid despawn issues + reachedChargingPoint = false; - if (num738 >= num739) - { - num738 = num739 / num738; - num736 *= num738; - num737 *= num738; - } + npc.ai[0] = 0f; - num730 += num736; - num731 += num737; - vector91 = new Vector2(vector.X, vector.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + npc.Opacity += 0.02f; + if (npc.Opacity > 0.8f) + npc.Opacity = 0.8f; - if (num738 < num734) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = num734 / num738; - num736 *= num738; - num737 *= num738; - } + float movementLimitX = 0f; + float movementLimitY = 0f; + int numHooks = 4; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + movementLimitX += Main.npc[i].Center.X; + movementLimitY += Main.npc[i].Center.Y; + } + } + movementLimitX /= numHooks; + movementLimitY /= numHooks; - if (npc.velocity.X < num736) - { - npc.velocity.X += num735; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X += num735 * 2f; - } - else if (npc.velocity.X > num736) - { - npc.velocity.X -= num735; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X -= num735 * 2f; - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y += num735; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y += num735 * 2f; - } - else if (npc.velocity.Y > num737) - { - npc.velocity.Y -= num735; - if (npc.velocity.Y > 0f && num737 < 0f) - npc.velocity.Y -= num735 * 2f; - } + Vector2 vector91 = new Vector2(movementLimitX, movementLimitY); + float num736 = player.Center.X - vector91.X; + float num737 = player.Center.Y - vector91.Y; - Vector2 vector92 = new Vector2(vector.X, vector.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(num741, num740) + 1.57f; + if (despawnBoost) + { + num737 *= -1f; + num736 *= -1f; + velocity += 8f; + } - npc.damage = npc.defDamage; + float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + float maxDistanceFromHooks = expertMode ? 650f : 500f; + if (speedBoost || malice) + maxDistanceFromHooks += 250f; + if (death) + maxDistanceFromHooks += maxDistanceFromHooks * 0.1f * (1f - lifeRatio); - if (speedBoost1) - { - npc.damage *= 2; - } + // Increase speed based on nearby active tiles + velocity *= tileEnrageMult; + acceleration *= tileEnrageMult; + + if (death) + { + velocity += velocity * 0.15f * (1f - lifeRatio); + acceleration += acceleration * 0.15f * (1f - lifeRatio); + } + + if (num738 >= maxDistanceFromHooks) + { + num738 = maxDistanceFromHooks / num738; + num736 *= num738; + num737 *= num738; + } + + movementLimitX += num736; + movementLimitY += num737; + vector91 = vector; + num736 = movementLimitX - vector91.X; + num737 = movementLimitY - vector91.Y; + num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + + if (num738 < velocity) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = velocity / num738; + num736 *= num738; + num737 *= num738; + } + + if (npc.velocity.X < num736) + { + npc.velocity.X += acceleration; + if (npc.velocity.X < 0f && num736 > 0f) + npc.velocity.X += acceleration * 2f; + } + else if (npc.velocity.X > num736) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X > 0f && num736 < 0f) + npc.velocity.X -= acceleration * 2f; + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y += acceleration; + if (npc.velocity.Y < 0f && num737 > 0f) + npc.velocity.Y += acceleration * 2f; + } + else if (npc.velocity.Y > num737) + { + npc.velocity.Y -= acceleration; + if (npc.velocity.Y > 0f && num737 < 0f) + npc.velocity.Y -= acceleration * 2f; + } + } + else + { + // Charge + if (npc.Calamity().newAI[3] == 1f) + { + reachedChargingPoint = false; + + npc.Opacity += 0.06f; + if (npc.Opacity > 0.8f) + npc.Opacity = 0.8f; + + if (npc.Calamity().newAI[1] == 0f) + { + npc.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; + npc.Calamity().newAI[1] = 1f; + } + else + { + 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; + + // Reset and either go back to normal or charge again + 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; + + if (npc.ai[1] >= 3f) + { + // Reset and return to normal movement + npc.Calamity().newAI[0] = 0f; + npc.ai[1] = 0f; + } + } + } + } + else + { + // Random location choice + if (npc.ai[0] == 0f) + { + 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]; + else + 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]; + else + 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; + + // Charge location + Vector2 chargeVector = new Vector2(npc.Calamity().newAI[1], npc.Calamity().newAI[2]); + Vector2 chargeLocationVelocity = Vector2.Normalize(chargeVector - vector) * chargeVelocity; + + // Line up a charge + float chargeDistanceGateValue = 32f; + + if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue * 3f) + { + 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; + } + + if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue || reachedChargingPoint) + { + // Emit dust + if (!reachedChargingPoint) + { + Main.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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + } + } + + reachedChargingPoint = true; + 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; + else + npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); + } + } + + npc.netUpdate = true; + + 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); + } } public override Color? GetAlpha(Color drawColor) { - return new Color(200, 150, 255, npc.alpha); + return new Color(200, 150, 255) * npc.Opacity; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -251,8 +403,9 @@ namespace CalamityMod.NPCs.Polterghast 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)); + 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; float amount9 = 0.5f; int num153 = 7; @@ -261,20 +414,49 @@ namespace CalamityMod.NPCs.Polterghast for (int num155 = 1; num155 < num153; num155 += 2) { Color color38 = lightColor; + + if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > 300f) + 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 *= (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, 4f + npc.gfxOffY); + 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); } } + 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((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + 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"); + 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); + Color color43 = color42; + color43 = Color.Lerp(color43, color36, amount9); + 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, vector43, npc.frame, color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; } @@ -293,11 +475,13 @@ namespace CalamityMod.NPCs.Polterghast } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(ModContent.BuffType(), 180, true); + public override bool CheckActive() + { + return false; + } + public override void OnHitPlayer(Player player, int damage, bool crit) + { player.AddBuff(BuffID.MoonLeech, 360, true); } @@ -310,7 +494,7 @@ 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 * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -318,12 +502,12 @@ namespace CalamityMod.NPCs.Polterghast Dust.NewDust(npc.position, npc.width, npc.height, 180, hitDirection, -1f, 0, default, 1f); 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.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 - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(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 < 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); @@ -331,7 +515,7 @@ namespace CalamityMod.NPCs.Polterghast if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 60; num623++) diff --git a/NPCs/Polterghast/PolterPhantomGlow.png b/NPCs/Polterghast/PolterPhantomGlow.png new file mode 100644 index 0000000000..22fc2a8f07 Binary files /dev/null and b/NPCs/Polterghast/PolterPhantomGlow.png differ diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 93a6d7055c..e1f13ad9d5 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -1,11 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -21,18 +21,17 @@ using System; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Polterghast { [AutoloadBossHead] public class Polterghast : ModNPC { private int despawnTimer = 600; - private bool spawnGhost = false; - public static float phase1DR = 0.15f; - public static float phase2DR = 0.2f; - public static float phase3DR = 0.5f; + private const int chargeTelegraphTimerMax = 15; + private int chargeTelegraphTimer = chargeTelegraphTimerMax; + private bool reachedChargingPoint = false; public override void SetStaticDefaults() { @@ -43,15 +42,16 @@ namespace CalamityMod.NPCs.Polterghast public override void SetDefaults() { + npc.Calamity().canBreakPlayerDefense = true; npc.npcSlots = 50f; - npc.damage = 150; - npc.width = 90; + npc.GetNPCDamage(); + npc.width = 90; npc.height = 120; npc.defense = 90; - npc.DR_NERD(0.15f, null, null, null, true); + npc.DR_NERD(0.2f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(412500, 495000, 3250000); + npc.LifeMaxNERB(350000, 420000, 325000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -59,29 +59,10 @@ namespace CalamityMod.NPCs.Polterghast aiType = -1; npc.value = Item.buyPrice(0, 60, 0, 0); npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN"); - else - music = MusicID.Plantera; + music = CalamityMod.Instance.GetMusicFromMusicMod("RUIN") ?? MusicID.Plantera; npc.HitSound = SoundID.NPCHit7; npc.DeathSound = SoundID.NPCDeath39; bossBag = ModContent.ItemType(); @@ -89,23 +70,37 @@ namespace CalamityMod.NPCs.Polterghast public override void SendExtraAI(BinaryWriter writer) { - writer.Write(spawnGhost); writer.Write(despawnTimer); + writer.Write(chargeTelegraphTimer); + writer.Write(reachedChargingPoint); + CalamityGlobalNPC cgn = npc.Calamity(); + writer.Write(cgn.newAI[0]); + writer.Write(cgn.newAI[1]); + writer.Write(cgn.newAI[2]); + writer.Write(cgn.newAI[3]); } public override void ReceiveExtraAI(BinaryReader reader) { - spawnGhost = reader.ReadBoolean(); despawnTimer = reader.ReadInt32(); + chargeTelegraphTimer = reader.ReadInt32(); + reachedChargingPoint = reader.ReadBoolean(); + CalamityGlobalNPC cgn = npc.Calamity(); + cgn.newAI[0] = reader.ReadSingle(); + cgn.newAI[1] = reader.ReadSingle(); + cgn.newAI[2] = reader.ReadSingle(); + cgn.newAI[3] = reader.ReadSingle(); } public override void AI() { + 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); - // whoAmI variable - CalamityGlobalNPC.ghostBoss = npc.whoAmI; + // whoAmI variable + CalamityGlobalNPC.ghostBoss = npc.whoAmI; // Detect clone bool cloneAlive = false; @@ -115,21 +110,51 @@ namespace CalamityMod.NPCs.Polterghast // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Variables Vector2 vector = npc.Center; - bool speedBoost = false; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool speedBoost = false; bool despawnBoost = false; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool phase2 = lifeRatio < (death ? 0.9f : 0.75f); - bool phase3 = lifeRatio < (revenge ? (death ? 0.8f : 0.5f) : 0.33f); - bool phase4 = lifeRatio < (revenge ? (death ? 0.5f : 0.33f) : 0.2f); - bool phase5 = lifeRatio < (revenge ? (death ? 0.25f : 0.1f) : 0.05f); + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + 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); + bool phase4 = lifeRatio < (death ? 0.45f : revenge ? 0.35f : expertMode ? 0.2f : 0.1f); + bool phase5 = lifeRatio < (death ? 0.2f : revenge ? 0.15f : expertMode ? 0.1f : 0.05f); + + // Velocity and acceleration + calamityGlobalNPC.newAI[0] += 1f; + bool chargePhase = calamityGlobalNPC.newAI[0] >= 480f; + int chargeAmt = phase3 ? 3 : phase2 ? 2 : 1; + float chargeVelocity = phase3 ? 24f : phase2 ? 22f : 20f; + float chargeAcceleration = phase3 ? 0.6f : phase2 ? 0.55f : 0.5f; + float chargeDistance = 480f; + 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(); + + // 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(); + } - // Target - npc.TargetClosest(true); 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) { @@ -139,6 +164,23 @@ namespace CalamityMod.NPCs.Polterghast { speedBoost = true; despawnBoost = true; + reachedChargingPoint = false; + chargeTelegraphTimer = chargeTelegraphTimerMax; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + if (cloneAlive) + { + Main.npc[CalamityGlobalNPC.ghostBossClone].ai[0] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].ai[1] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[0] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[1] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[2] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[3] = 0f; + } } } @@ -153,43 +195,24 @@ namespace CalamityMod.NPCs.Polterghast if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - int num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - num729 = 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.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - int[] array2 = new int[4]; - float num730 = 0f; - float num731 = 0f; - int num732 = 0; - for (int num733 = 0; num733 < Main.maxNPCs; num733++) - { - if (Main.npc[num733].active && Main.npc[num733].type == ModContent.NPCType()) - { - num730 += Main.npc[num733].Center.X; - num731 += Main.npc[num733].Center.Y; - array2[num732] = num733; - num732++; - if (num732 > 3) - break; - } - } - num730 /= num732; - num731 /= num732; - - // Velocity and acceleration - bool charging = npc.ai[2] >= 300f; - bool reset = npc.ai[2] >= 600f; - float speedUpDistance = 480f - 360f * (1f - lifeRatio); - bool speedUp = Vector2.Distance(player.Center, npc.Center) > speedUpDistance; // 30 or 40 tile distance - float velocity = 10f; // max should be 21 - float acceleration = 0.05f; // max should be 0.13 - if (!player.ZoneDungeon && !CalamityWorld.bossRushActive && player.position.Y < Main.worldSurface * 16.0) + if (!player.ZoneDungeon && !BossRushEvent.BossRushActive && player.position.Y < Main.worldSurface * 16.0) { despawnTimer--; - if (despawnTimer <= 0) - despawnBoost = true; + if (despawnTimer <= 0) + { + despawnBoost = true; + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + } speedBoost = true; velocity += 5f; @@ -219,13 +242,6 @@ namespace CalamityMod.NPCs.Polterghast velocity += phase2 ? 4.5f : 3.5f; acceleration += phase2 ? 0.03f : 0.025f; } - - npc.ai[2] += 1f; - if (reset) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } } else { @@ -252,52 +268,29 @@ namespace CalamityMod.NPCs.Polterghast acceleration += 0.005f; } } - - npc.ai[2] += 1f; - if (reset) - { - npc.ai[2] = 0f; - npc.netUpdate = true; - } } if (expertMode) { + chargeVelocity += revenge ? 4f : 2f; velocity += revenge ? 5f : 3.5f; acceleration += revenge ? 0.035f : 0.025f; } - // Move faster if inside active tiles - int radius = 2; // 2 tile radius - int diameter = radius * 2; - int npcCenterX = (int)(npc.Center.X / 16f); - int npcCenterY = (int)(npc.Center.Y / 16f); - Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - bool insideTiles = false; - for (int x = area.Left; x < area.Right; x++) - { - for (int y = area.Top; y < area.Bottom; y++) - { - 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]) - insideTiles = true; - } - } - } - // Slow down if close to target and not inside tiles - if (!speedUp && !insideTiles && !charging) + 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; } // Detect active tiles around Polterghast - radius = 20; // 20 tile radius - diameter = radius * 2; - area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); - int nearbyActiveTiles = 0; // 0 to 1600 + int radius = 30; // 30 tile radius + int diameter = radius * 2; + int npcCenterX = (int)(vector.X / 16f); + int npcCenterY = (int)(vector.Y / 16f); + Rectangle area = new Rectangle(npcCenterX - radius, npcCenterY - radius, diameter, diameter); + int nearbyActiveTiles = 0; // 0 to 3600 for (int x = area.Left; x < area.Right; x++) { for (int y = area.Top; y < area.Bottom; y++) @@ -312,128 +305,300 @@ namespace CalamityMod.NPCs.Polterghast // Scale multiplier based on nearby active tiles float tileEnrageMult = 1f; - if (nearbyActiveTiles < 800) - tileEnrageMult += (800 - nearbyActiveTiles) * 0.00075f; // Ranges from 1f to 1.6f + if (nearbyActiveTiles < 1000) + tileEnrageMult += (1000 - nearbyActiveTiles) * 0.00075f; // Ranges from 1f to 1.75f + + if (malice) + tileEnrageMult = 1.75f; + + if (enraged) + tileEnrageMult = 2.25f; + + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && tileEnrageMult >= 1.6f; // Used to inform clone and hooks about number of active tiles nearby npc.ai[3] = tileEnrageMult; // Increase projectile fire rate based on number of nearby active tiles - float projectileFireRateMultiplier = MathHelper.Lerp(1f, 2f, 1f - ((tileEnrageMult - 1f) / 0.6f)); + float amount = 1f - ((tileEnrageMult - 1f) / 0.75f); + if (amount < 0f) + amount = 0f; + float projectileFireRateMultiplier = MathHelper.Lerp(1f, 2f, amount); - // Increase projectile time left based on number of nearby active tiles + // Increase projectile stats based on number of nearby active tiles int baseProjectileTimeLeft = (int)(1200f * tileEnrageMult); + int baseProjectileAmt = (int)(4f * tileEnrageMult); + int baseProjectileSpread = (int)(45f * tileEnrageMult); + float baseProjectileVelocity = 5f * tileEnrageMult; + if (speedBoost) + baseProjectileVelocity *= 1.25f; - // Increase damage of projectiles and contact damage based on number of nearby active tiles - int damageIncrease = 0; - if (nearbyActiveTiles < 400) - damageIncrease += (400 - nearbyActiveTiles) / 20; // Ranges from 0 to 20 + // Predictiveness + float chargePredictionAmt = 10f + 20f * (tileEnrageMult - 1f); + Vector2 predictionVector = chargePhase && revenge ? player.velocity * chargePredictionAmt : Vector2.Zero; + Vector2 lookAt = player.Center + predictionVector; + Vector2 rotationVector = lookAt - vector; - // Set DR based on phase - float dr = phase3 ? phase3DR : phase2 ? phase2DR : phase1DR; - npc.Calamity().DR = dr; - - Vector2 vector91 = new Vector2(num730, num731); - float num736 = player.Center.X - vector91.X; - float num737 = player.Center.Y - vector91.Y; - - if (despawnBoost) - { - num737 *= -1f; - num736 *= -1f; - velocity += 10f; - } - - float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); - int num739 = 500; - if (speedBoost) - num739 += 250; - if (expertMode) - num739 += 150; - - // Increase speed based on nearby active tiles - velocity *= tileEnrageMult; - acceleration *= tileEnrageMult; - - if (num738 >= num739) - { - num738 = num739 / num738; - num736 *= num738; - num737 *= num738; - } - - num730 += num736; - num731 += num737; - vector91 = new Vector2(vector.X, vector.Y); - num736 = num730 - vector91.X; - num737 = num731 - vector91.Y; - num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); - - if (num738 < velocity) - { - num736 = npc.velocity.X; - num737 = npc.velocity.Y; - } - else - { - num738 = velocity / num738; - num736 *= num738; - num737 *= num738; - } - - Vector2 vector92 = new Vector2(vector.X, vector.Y); - float num740 = player.Center.X - vector92.X; - float num741 = player.Center.Y - vector92.Y; - npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; - - if (npc.velocity.X < num736) - { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0f && num736 > 0f) - npc.velocity.X += acceleration * 2f; - } - else if (npc.velocity.X > num736) - { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0f && num736 < 0f) - npc.velocity.X -= acceleration * 2f; - } - if (npc.velocity.Y < num737) - { - npc.velocity.Y += acceleration; - if (npc.velocity.Y < 0f && num737 > 0f) - npc.velocity.Y += acceleration * 2f; - } - else if (npc.velocity.Y > num737) - { - 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 > 800 && !insideTiles && !charging) + // Rotation + if (calamityGlobalNPC.newAI[3] == 0f) { - if (npc.velocity.Length() > velocity) - npc.velocity *= 0.97f; + 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; + } + else + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; + + if (!chargePhase) + { + npc.ai[2] += 1f; + if (reset) + { + npc.ai[2] = 0f; + npc.netUpdate = true; + } + + float movementLimitX = 0f; + float movementLimitY = 0f; + int numHooks = 4; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + movementLimitX += Main.npc[i].Center.X; + movementLimitY += Main.npc[i].Center.Y; + } + } + movementLimitX /= numHooks; + movementLimitY /= numHooks; + + Vector2 vector91 = new Vector2(movementLimitX, movementLimitY); + float num736 = player.Center.X - vector91.X; + float num737 = player.Center.Y - vector91.Y; + + if (despawnBoost) + { + num737 *= -1f; + num736 *= -1f; + velocity += 10f; + } + + float num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + float maxDistanceFromHooks = expertMode ? 650f : 500f; + if (speedBoost || malice) + maxDistanceFromHooks += 250f; + if (death) + maxDistanceFromHooks += maxDistanceFromHooks * 0.1f * (1f - lifeRatio); + + // Increase speed based on nearby active tiles + velocity *= tileEnrageMult; + acceleration *= tileEnrageMult; + + if (death) + { + velocity += velocity * 0.15f * (1f - lifeRatio); + acceleration += acceleration * 0.15f * (1f - lifeRatio); + } + + if (num738 >= maxDistanceFromHooks) + { + num738 = maxDistanceFromHooks / num738; + num736 *= num738; + num737 *= num738; + } + + movementLimitX += num736; + movementLimitY += num737; + num736 = movementLimitX - vector.X; + num737 = movementLimitY - vector.Y; + num738 = (float)Math.Sqrt(num736 * num736 + num737 * num737); + + if (num738 < velocity) + { + num736 = npc.velocity.X; + num737 = npc.velocity.Y; + } + else + { + num738 = velocity / num738; + num736 *= num738; + num737 *= num738; + } + + if (npc.velocity.X < num736) + { + npc.velocity.X += acceleration; + if (npc.velocity.X < 0f && num736 > 0f) + npc.velocity.X += acceleration * 2f; + } + else if (npc.velocity.X > num736) + { + npc.velocity.X -= acceleration; + if (npc.velocity.X > 0f && num736 < 0f) + npc.velocity.X -= acceleration * 2f; + } + if (npc.velocity.Y < num737) + { + npc.velocity.Y += acceleration; + if (npc.velocity.Y < 0f && num737 > 0f) + npc.velocity.Y += acceleration * 2f; + } + else if (npc.velocity.Y > num737) + { + 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 (npc.velocity.Length() > velocity) + npc.velocity *= 0.97f; + } + } + else + { + // Charge + if (calamityGlobalNPC.newAI[3] == 1f) + { + reachedChargingPoint = false; + + if (calamityGlobalNPC.newAI[1] == 0f) + { + npc.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; + calamityGlobalNPC.newAI[1] = 1f; + } + else + { + calamityGlobalNPC.newAI[2] += 1f; + + // Slow down for a few frames + float totalChargeTime = chargeDistance * 4f / chargeVelocity; + float slowDownTime = chargeVelocity; + if (calamityGlobalNPC.newAI[2] >= totalChargeTime - slowDownTime) + npc.velocity *= 0.9f; + + // Reset and either go back to normal or charge again + if (calamityGlobalNPC.newAI[2] >= totalChargeTime) + { + chargeTelegraphTimer = chargeTelegraphTimerMax; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.ai[1] += 1f; + + if (npc.ai[1] >= chargeAmt) + { + // Reset and return to normal movement + calamityGlobalNPC.newAI[0] = 0f; + npc.ai[1] = 0f; + } + else + { + // Get a new target and charge again + npc.TargetClosest(); + } + } + } + } + else + { + // Pick a charging location + // Set charge locations X + if (vector.X >= player.Center.X) + calamityGlobalNPC.newAI[1] = player.Center.X + chargeDistance; + else + calamityGlobalNPC.newAI[1] = player.Center.X - chargeDistance; + + // Set charge locations Y + if (vector.Y >= player.Center.Y) + calamityGlobalNPC.newAI[2] = player.Center.Y + chargeDistance; + else + calamityGlobalNPC.newAI[2] = player.Center.Y - chargeDistance; + + Vector2 chargeVector = new Vector2(calamityGlobalNPC.newAI[1], calamityGlobalNPC.newAI[2]); + Vector2 chargeLocationVelocity = Vector2.Normalize(chargeVector - vector) * chargeVelocity; + Vector2 cloneChargeVector = cloneAlive ? new Vector2(Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[1], Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[2]) : default; + + // If clone is alive and not at proper location then keep trying to line up until it gets into position + float chargeDistanceGateValue = 40f; + bool clonePositionCheck = cloneAlive ? Vector2.Distance(Main.npc[CalamityGlobalNPC.ghostBossClone].Center, cloneChargeVector) <= chargeDistanceGateValue : true; + + // Line up a charge + if (Vector2.Distance(vector, chargeVector) <= chargeDistanceGateValue || reachedChargingPoint) + { + // Emit dust + if (!reachedChargingPoint) + { + Main.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); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + } + } + + reachedChargingPoint = true; + npc.velocity = Vector2.Zero; + npc.Center = chargeVector; + + if (clonePositionCheck) + { + // Pause for 15 frames before actually charging + if (chargeTelegraphTimer > 0) + { + chargeTelegraphTimer--; + } + else + { + // Initiate charge + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 1f; + + // Tell clone to charge + if (cloneAlive) + { + Main.npc[CalamityGlobalNPC.ghostBossClone].ai[0] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[1] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[2] = 0f; + Main.npc[CalamityGlobalNPC.ghostBossClone].Calamity().newAI[3] = 1f; + + // + // CODE TWEAKED BY: OZZATRON + // September 21st, 2020 + // reason: fixing Polter charge MP desync bug + // + // removed Polter syncing the clone's newAI array. The clone now auto syncs its own newAI every frame. + } + } + } + } + else + npc.SimpleFlyMovement(chargeLocationVelocity, chargeAcceleration); + } + + npc.netUpdate = true; + + 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); } if (!phase2 && !phase3) { - npc.damage = npc.defDamage + damageIncrease * 4; + npc.damage = npc.defDamage; npc.defense = npc.defDefense; - if (speedBoost) - { - npc.defense *= 2; - npc.damage *= 2; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !charging) + if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { npc.localAI[1] += expertMode ? 1.5f : 1f; - if (speedBoost || CalamityWorld.bossRushActive) - npc.localAI[1] += 3f; + if (speedBoost) + npc.localAI[1] += 2f; if (npc.localAI[1] >= 90f * projectileFireRateMultiplier) { @@ -448,44 +613,32 @@ namespace CalamityMod.NPCs.Polterghast if (flag47) { - int damage = expertMode ? 48 : 60; int type = ModContent.ProjectileType(); - if (Main.rand.NextBool(3)) { - damage = expertMode ? 60 : 70; npc.localAI[1] = -30f; type = ModContent.ProjectileType(); } - damage += damageIncrease; + int damage = npc.GetProjectileDamage(type); - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - damage *= 2; - - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = (CalamityWorld.bossRushActive ? 7f : 5f) * tileEnrageMult; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; - - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + Vector2 vector93 = vector; + float num743 = player.Center.X - vector93.X; + float num744 = player.Center.Y - vector93.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; + num745 = baseProjectileVelocity / num745; num743 *= num745; num744 *= num745; vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int numProj = 4; - int spread = 45; - float rotation = MathHelper.ToRadians(spread); + float rotation = MathHelper.ToRadians(baseProjectileSpread); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); double startAngle = Math.Atan2(num743, num744) - rotation / 2; - double deltaAngle = rotation / numProj; + double deltaAngle = rotation / baseProjectileAmt; double offsetAngle; - for (int i = 0; i < numProj; i++) + for (int i = 0; i < baseProjectileAmt; i++) { offsetAngle = startAngle + deltaAngle * i; int proj = Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); @@ -494,37 +647,26 @@ namespace CalamityMod.NPCs.Polterghast } else { - int damage = expertMode ? 60 : 70; int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - damage += damageIncrease; - - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - damage *= 2; - - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = (CalamityWorld.bossRushActive ? 14f : 10f) * tileEnrageMult; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; - - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + Vector2 vector93 = vector; + float num743 = player.Center.X - vector93.X; + float num744 = player.Center.Y - vector93.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; + num745 = (baseProjectileVelocity + 5f) / num745; num743 *= num745; num744 *= num745; vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int numProj = 4; - int spread = 60; - float rotation = MathHelper.ToRadians(spread); + float rotation = MathHelper.ToRadians(baseProjectileSpread + 15); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); double startAngle = Math.Atan2(num743, num744) - rotation / 2; - double deltaAngle = rotation / numProj; + double deltaAngle = rotation / baseProjectileAmt; double offsetAngle; - for (int i = 0; i < numProj; i++) + for (int i = 0; i < baseProjectileAmt; i++) { offsetAngle = startAngle + deltaAngle * i; int proj = Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); @@ -538,9 +680,16 @@ namespace CalamityMod.NPCs.Polterghast { if (npc.ai[0] == 0f) { - npc.ai[0] += 1f; + npc.ai[0] = 1f; - Main.PlaySound(SoundID.Item122, npc.position); + // Reset charge attack arrays to prevent problems + 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); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Polt2"), 1f); @@ -561,30 +710,24 @@ 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, 180, 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, 180, 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.damage = (int)(npc.defDamage * 1.2f) + damageIncrease * 4; + npc.damage = (int)(npc.defDamage * 1.2f); npc.defense = (int)(npc.defDefense * 0.8f); - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.defense *= 2; - npc.damage *= 2; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !charging) + if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { npc.localAI[1] += expertMode ? 1.5f : 1f; - if (speedBoost || CalamityWorld.bossRushActive) - npc.localAI[1] += 3f; + if (speedBoost) + npc.localAI[1] += 2f; if (npc.localAI[1] >= 150f * projectileFireRateMultiplier) { @@ -599,39 +742,28 @@ namespace CalamityMod.NPCs.Polterghast if (flag47) { - int damage = expertMode ? 53 : 65; int type = ModContent.ProjectileType(); - if (Main.rand.NextBool(3)) { - damage = expertMode ? 65 : 75; npc.localAI[1] = -30f; type = ModContent.ProjectileType(); } - damage += damageIncrease; + int damage = npc.GetProjectileDamage(type); - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - damage *= 2; - - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = (CalamityWorld.bossRushActive ? 8f : 6f) * tileEnrageMult; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; - - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + Vector2 vector93 = vector; + float num743 = player.Center.X - vector93.X; + float num744 = player.Center.Y - vector93.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; + num745 = (baseProjectileVelocity + 1f) / num745; num743 *= num745; num744 *= num745; vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int numProj = 5; - int spread = 60; - float rotation = MathHelper.ToRadians(spread); + int numProj = baseProjectileAmt + 1; + float rotation = MathHelper.ToRadians(baseProjectileSpread + 15); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); double startAngle = Math.Atan2(num743, num744) - rotation / 2; double deltaAngle = rotation / numProj; @@ -645,32 +777,22 @@ namespace CalamityMod.NPCs.Polterghast } else { - int damage = expertMode ? 65 : 75; int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - damage += damageIncrease; - - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - damage *= 2; - - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = (CalamityWorld.bossRushActive ? 14f : 10f) * tileEnrageMult; - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - num742 *= 2f; - - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + Vector2 vector93 = vector; + float num743 = player.Center.X - vector93.X; + float num744 = player.Center.Y - vector93.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; + num745 = (baseProjectileVelocity + 5f) / num745; num743 *= num745; num744 *= num745; vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int numProj = 5; - int spread = 80; - float rotation = MathHelper.ToRadians(spread); + int numProj = baseProjectileAmt + 1; + float rotation = MathHelper.ToRadians(baseProjectileSpread + 35); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); double startAngle = Math.Atan2(num743, num744) - rotation / 2; double deltaAngle = rotation / numProj; @@ -689,23 +811,33 @@ namespace CalamityMod.NPCs.Polterghast { npc.HitSound = SoundID.NPCHit36; - if (!spawnGhost && expertMode) + if (npc.ai[0] == 1f) { - spawnGhost = true; + npc.ai[0] = 2f; - if (Main.netMode != NetmodeID.MultiplayerClient) + // Reset charge attack arrays to prevent problems + npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType()); - for (int I = 0; I < 3; I++) - { - int spawn = NPC.NewNPC((int)(npc.Center.X + (Math.Sin(I * 120) * 500)), (int)(npc.Center.Y + (Math.Cos(I * 120) * 500)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - NPC npc2 = Main.npc[spawn]; - npc2.ai[0] = I * 120; - } + if (expertMode) + { + 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); + NPC npc2 = Main.npc[spawn]; + npc2.ai[0] = I * 120; + } + } } - Main.PlaySound(SoundID.Item122, npc.position); + Main.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); @@ -726,58 +858,49 @@ 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, 180, 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, 180, 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.damage = (int)(npc.defDamage * 1.4f) + damageIncrease * 4; + npc.damage = (int)(npc.defDamage * 1.4f); npc.defense = (int)(npc.defDefense * 0.5f); - if (speedBoost || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - npc.defense *= 2; - npc.damage *= 2; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 210f * projectileFireRateMultiplier && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) + npc.localAI[1] += 1f; + if (npc.localAI[1] >= 210f * projectileFireRateMultiplier && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - npc.ai[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && !charging) + npc.localAI[1] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { - Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = (CalamityWorld.bossRushActive ? 7f : 5f) * tileEnrageMult; - float num743 = player.position.X + player.width * 0.5f - vector93.X; - float num744 = player.position.Y + player.height * 0.5f - vector93.Y; + Vector2 vector93 = vector; + float num743 = player.Center.X - vector93.X; + float num744 = player.Center.Y - vector93.Y; float num745 = (float)Math.Sqrt(num743 * num743 + num744 * num744); - num745 = num742 / num745; + num745 = baseProjectileVelocity / num745; num743 *= num745; num744 *= num745; vector93.X += num743 * 3f; vector93.Y += num744 * 3f; - int damage = expertMode ? 53 : 65; - damage += damageIncrease; - int numProj = 6; - int spread = 90; - float rotation = MathHelper.ToRadians(spread); + int numProj = baseProjectileAmt + 2; + float rotation = MathHelper.ToRadians(baseProjectileSpread + 45); float baseSpeed = (float)Math.Sqrt(num743 * num743 + num744 * num744); double startAngle = Math.Atan2(num743, num744) - rotation / 2; double deltaAngle = rotation / numProj; double offsetAngle; - int type = ModContent.ProjectileType(); + + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + for (int i = 0; i < numProj; i++) { offsetAngle = startAngle + deltaAngle * i; - if (i == 1 || i == 2) - type = ModContent.ProjectileType(); Projectile.NewProjectile(vector93.X, vector93.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -785,26 +908,23 @@ namespace CalamityMod.NPCs.Polterghast if (phase4) { - npc.localAI[1] += 1f; - if (npc.localAI[1] >= 420f) + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 420f) { - npc.localAI[1] = 0f; + npc.localAI[2] = 0f; - float num757 = 8f; - Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num758 = player.position.X + player.width * 0.5f - vector94.X; - float num759 = Math.Abs(num758 * 0.2f); - float num760 = player.position.Y + player.height * 0.5f - vector94.Y; - if (num760 > 0f) - num759 = 0f; - - num760 -= num759; + float num757 = 6f; + Vector2 vector94 = vector; + float num758 = player.Center.X - vector94.X; + float num760 = player.Center.Y - vector94.Y; float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); num761 = num757 / num761; num758 *= num761; num760 *= num761; + vector94.X += num758 * 3f; + vector94.Y += num760 * 3f; - if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient) + if (NPC.CountNPCS(ModContent.NPCType()) < 2 && Main.netMode != NetmodeID.MultiplayerClient && !charging && !chargePhase) { int num762 = NPC.NewNPC((int)vector.X, (int)vector.Y, ModContent.NPCType()); Main.npc[num762].velocity.X = num758; @@ -818,16 +938,18 @@ namespace CalamityMod.NPCs.Polterghast public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } public override void NPCLoot() { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Polterghast + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedPolterghast); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedPolterghast, 6, 3, 2); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Cyborg }, CalamityWorld.downedPolterghast); @@ -836,13 +958,13 @@ namespace CalamityMod.NPCs.Polterghast { // Materials DropHelper.DropItem(npc, ModContent.ItemType(), 7, 15); - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + DropHelper.DropItem(npc, ModContent.ItemType(), 30, 40); // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -870,22 +992,14 @@ namespace CalamityMod.NPCs.Polterghast sulfSeaBoostMessage = "Mods.CalamityMod.AprilFools2"; // Goddamn boomer duke moments } - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(sulfSeaBoostMessage), sulfSeaBoostColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(sulfSeaBoostMessage), sulfSeaBoostColor); - } - } + CalamityUtils.DisplayLocalizedText(key, messageColor); + CalamityUtils.DisplayLocalizedText(sulfSeaBoostMessage, sulfSeaBoostColor); + } // Mark Polterghast as dead CalamityWorld.downedPolterghast = true; - CalamityMod.UpdateServerBoolean(); - } + CalamityNetcode.SyncWorld(); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -895,7 +1009,7 @@ namespace CalamityMod.NPCs.Polterghast Texture2D texture2D15 = Main.npcTexture[npc.type]; Texture2D texture2D16 = ModContent.GetTexture("CalamityMod/NPCs/Polterghast/PolterghastGlow2"); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(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 = 7; @@ -907,22 +1021,27 @@ namespace CalamityMod.NPCs.Polterghast Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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 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, 4f + npc.gfxOffY); + 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"); + Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); - Color color42 = Color.Lerp(Color.White, Color.Red, 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)); + + 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) { @@ -931,16 +1050,16 @@ namespace CalamityMod.NPCs.Polterghast Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); 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, 4f + npc.gfxOffY); + 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); Color color43 = color42; color43 = Color.Lerp(color43, color36, amount9); color43 = npc.GetAlpha(color43); - color43 *= (float)(num153 - num163) / 15f; + color43 *= (num153 - num163) / 15f; spriteBatch.Draw(texture2D16, vector44, npc.frame, color43, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -954,21 +1073,35 @@ namespace CalamityMod.NPCs.Polterghast public override void FindFrame(int frameHeight) { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool phase2 = npc.life >= npc.lifeMax * (revenge ? (death ? 0.8 : 0.5) : 0.33); + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + 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 = 0D; npc.frame.Y += frameHeight; } - if (npc.life >= npc.lifeMax * (death ? 0.9 : 0.75)) + if (phase3) { - if (npc.frame.Y > frameHeight * 3) - { - npc.frame.Y = 0; - } + if (npc.frame.Y < frameHeight * 8) + { + npc.frame.Y = frameHeight * 8; + } + if (npc.frame.Y > frameHeight * 11) + { + npc.frame.Y = frameHeight * 8; + } } else if (phase2) { @@ -983,22 +1116,15 @@ namespace CalamityMod.NPCs.Polterghast } else { - if (npc.frame.Y < frameHeight * 8) - { - npc.frame.Y = frameHeight * 8; - } - if (npc.frame.Y > frameHeight * 11) - { - npc.frame.Y = frameHeight * 8; - } - } + if (npc.frame.Y > frameHeight * 3) + { + npc.frame.Y = 0; + } + } } public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.MoonLeech, 900, true); } @@ -1011,12 +1137,12 @@ 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 * 0.8f); + 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); + 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); @@ -1037,10 +1163,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, (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, 180, 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 7b38b69da8..4acb4bfdac 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -33,10 +34,6 @@ namespace CalamityMod.NPCs.Polterghast npc.dontTakeDamage = true; npc.noGravity = true; npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.HitSound = SoundID.NPCHit34; npc.DeathSound = SoundID.NPCDeath39; } @@ -65,9 +62,9 @@ namespace CalamityMod.NPCs.Polterghast // Bools bool speedBoost = false; bool despawnBoost = false; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice; // Despawn if Polter is gone if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) @@ -85,18 +82,21 @@ namespace CalamityMod.NPCs.Polterghast despawnBoost = true; } + bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= 420f; + // Percent life remaining, Polter float lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].life / (float)Main.npc[CalamityGlobalNPC.ghostBoss].lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().killTimeRatio_IncreasedAggression; + // Scale multiplier based on nearby active tiles float tileEnrageMult = Main.npc[CalamityGlobalNPC.ghostBoss].ai[3]; - // Increase projectile time left based on number of nearby active tiles - int baseProjectileTimeLeft = (int)(1200f * tileEnrageMult); - // Despawn if (CalamityGlobalNPC.ghostBoss != -1 && !player.ZoneDungeon && - player.position.Y < Main.worldSurface * 16.0 && !CalamityWorld.bossRushActive) + player.position.Y < Main.worldSurface * 16.0 && !BossRushEvent.BossRushActive) { despawnTimer--; if (despawnTimer <= 0) @@ -108,14 +108,20 @@ namespace CalamityMod.NPCs.Polterghast else despawnTimer++; - // Phase 2 - if (lifeRatio < (death ? 0.9f : 0.75f) && lifeRatio >= (revenge ? (death ? 0.8f : 0.5f) : 0.33f)) + // Phase 2 + bool phase3 = lifeRatio < (death ? 0.6f : revenge ? 0.5f : expertMode ? 0.35f : 0.2f); + phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f) && !phase3; + if (phase2) { - phase2 = true; + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); - npc.TargetClosest(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, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + npc.TargetClosest(); - Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); + 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); @@ -123,11 +129,7 @@ namespace CalamityMod.NPCs.Polterghast 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); - num149 = 4f / num149; - num147 *= num149; - num148 *= num149; - - if (num149 > 1200f) + if (chargePhase) { npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -151,32 +153,31 @@ namespace CalamityMod.NPCs.Polterghast if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 20f) { - float num151 = (CalamityWorld.bossRushActive ? 7f : 5f) * tileEnrageMult; - int num152 = expertMode ? 48 : 60; - int num153 = ModContent.ProjectileType(); - num149 = num151 / num149; + float num151 = 10f * tileEnrageMult; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + num149 = num151 / num149; num147 *= num149; num148 *= num149; - int proj = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, num153, num152, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = baseProjectileTimeLeft; + int proj = Projectile.NewProjectile(vector17.X, vector17.Y, num147, num148, type, damage, 0f, Main.myPlayer, 0f, 0f); } } return; } // Phase 1 or 3 - phase2 = false; Movement(phase2, expertMode, revenge, death, speedBoost, despawnBoost, lifeRatio, tileEnrageMult, player); } private void Movement(bool phase2, bool expertMode, bool revenge, bool death, bool speedBoost, bool despawnBoost, float lifeRatio, float tileEnrageMult, Player player) { - if (phase2) + bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= 420f; + + if (phase2) { - 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(num741, num740) + 1.57f; + 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) @@ -192,18 +193,25 @@ namespace CalamityMod.NPCs.Polterghast if (npc.ai[0] == 0f || npc.ai[1] == 0f) npc.localAI[0] = 0f; - float shootBoost = death ? 2f : 2f * (1f - lifeRatio); - npc.localAI[0] -= 1f + shootBoost * tileEnrageMult; - if (expertMode) - npc.localAI[0] -= Vector2.Distance(npc.Center, player.Center) * 0.002f; - if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] >= 300f) - npc.localAI[0] -= 3f; - if (speedBoost) - npc.localAI[0] -= 6f; + if (chargePhase) + { + npc.localAI[0] -= 10f; + } + else + { + float shootBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + npc.localAI[0] -= 1f + shootBoost * tileEnrageMult; + if (expertMode) + npc.localAI[0] -= Vector2.Distance(npc.Center, player.Center) * 0.002f; + if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] >= 300f) + npc.localAI[0] -= 3f; + if (speedBoost) + npc.localAI[0] -= 6f; + } if (!despawnBoost && npc.localAI[0] <= 0f && npc.ai[0] != 0f) { - for (int num763 = 0; num763 < 200; num763++) + 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; @@ -236,7 +244,7 @@ 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) + if (WorldGen.SolidTile(num768, num769) || Main.tile[num768, num769].wall > 0 || chargePhase) { flag50 = true; npc.ai[0] = num768; @@ -253,7 +261,7 @@ namespace CalamityMod.NPCs.Polterghast if (npc.ai[0] > 0f && npc.ai[1] > 0f) { - float velocityBoost = death ? 2f : 2f * (1f - lifeRatio); + float velocityBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); float velocity = (8f + velocityBoost) * tileEnrageMult; if (expertMode) velocity += npc.localAI[1]; @@ -292,9 +300,10 @@ namespace CalamityMod.NPCs.Polterghast public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + Color lightRed = new Color(255, 100, 100, 255); if (Main.npc[CalamityGlobalNPC.ghostBoss].active && !phase2) { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + 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; @@ -316,7 +325,11 @@ namespace CalamityMod.NPCs.Polterghast center.Y += bossCenterY; bossCenterX = Main.npc[CalamityGlobalNPC.ghostBoss].Center.X - center.X; bossCenterY = Main.npc[CalamityGlobalNPC.ghostBoss].Center.Y - center.Y; - Color color2 = new Color(100, 100, 100, 0); + + Color color2 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + 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); @@ -328,7 +341,7 @@ namespace CalamityMod.NPCs.Polterghast 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)); + 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; @@ -340,22 +353,25 @@ namespace CalamityMod.NPCs.Polterghast Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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 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, 4f + npc.gfxOffY); + 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"); Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + if (Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > 300f) + color37 = Color.Lerp(color37, lightRed, MathHelper.Clamp((Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] - 300f) / 120f, 0f, 1f)); + if (CalamityConfig.Instance.Afterimages) { for (int num163 = 1; num163 < num153; num163++) @@ -363,10 +379,10 @@ namespace CalamityMod.NPCs.Polterghast Color color41 = color37; color41 = Color.Lerp(color41, color36, amount9); 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, 4f + npc.gfxOffY); + 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); } } @@ -437,12 +453,6 @@ namespace CalamityMod.NPCs.Polterghast return true; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - player.AddBuff(ModContent.BuffType(), 180, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs index 3925c97af6..e9d3f7166b 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss.cs @@ -15,6 +15,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Events; namespace CalamityMod.NPCs.ProfanedGuardians { @@ -34,14 +35,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetDefaults() { - npc.npcSlots = 20f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 20f; npc.aiStyle = -1; - npc.damage = 140; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 80; - npc.defense = 50; - npc.DR_NERD(0.4f); - npc.LifeMaxNERB(102500, 112500, 1650000); + npc.defense = 40; + npc.DR_NERD(0.3f); + npc.LifeMaxNERB(76875, 84375, 165000); // Old HP - 102500, 112500 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -49,31 +51,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.noTileCollide = true; aiType = -1; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - else - music = MusicID.Boss1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.value = Item.buyPrice(0, 25, 0, 0); + music = CalamityMod.Instance.GetMusicFromMusicMod("Guardians") ?? MusicID.Boss1; + npc.value = Item.buyPrice(0, 15, 0, 0); npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } @@ -104,11 +83,17 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.doughnutBoss = npc.whoAmI; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + Vector2 vectorCenter = npc.Center; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] == 0f) { @@ -116,9 +101,17 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); NPC.NewNPC((int)vectorCenter.X, (int)vectorCenter.Y, ModContent.NPCType()); } - - npc.TargetClosest(false); + + // Get a target + 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(); + Player player = Main.player[npc.target]; + if (!Main.dayTime || !player.active || player.dead) { npc.TargetClosest(false); @@ -150,21 +143,28 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool isHoly = player.ZoneHoly; bool isHell = player.ZoneUnderworldHeight; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; // Become immune over time if target isn't in hell or hallow - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { if (immuneTimer > 0) immuneTimer--; + else + npc.Calamity().CurrentlyEnraged = true; } else immuneTimer = 300; + if (enraged) + npc.Calamity().CurrentlyEnraged = true; + // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0; + npc.dontTakeDamage = immuneTimer <= 0 && !malice; bool flag100 = false; for (int num569 = 0; num569 < Main.maxNPCs; num569++) @@ -187,11 +187,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.spriteDirection = -Math.Sign(npc.velocity.X); } npc.spriteDirection = Math.Sign(npc.velocity.X); - float num1000 = (lifeRatio < 0.75f || death) ? 14f : 16f; + float num1000 = lifeRatio < 0.75f ? 14f : 16f; if (revenge) - { - num1000 *= 1.15f; - } + num1000 *= 0.9f; + if (enraged) + num1000 *= 0.8f; + float num1006 = 0.111111117f * num1000; int num1009 = (npc.ai[0] == 2f) ? 2 : 1; int num1010 = (npc.ai[0] == 2f) ? 80 : 60; @@ -207,9 +208,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } if (Main.netMode != NetmodeID.MultiplayerClient) { - float shootBoost = 2f * (1f - lifeRatio); + float shootBoost = enraged ? 4f : death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); npc.localAI[0] += 1f + shootBoost; - if (npc.localAI[0] >= (CalamityWorld.bossRushActive ? 210f : 240f)) + if (npc.localAI[0] >= 240f && Vector2.Distance(vectorCenter, player.Center) > 160f) { npc.localAI[0] = 0f; @@ -217,10 +218,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians int totalProjectiles = 10; float velocity = 5f; - int damage = expertMode ? 50 : 60; - int projectileType = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); - switch (spearType) + switch (spearType) { case 0: break; @@ -236,11 +237,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians break; } + if (malice) + totalProjectiles *= 2; + float radians = MathHelper.TwoPi / totalProjectiles; for (int i = 0; i < totalProjectiles; i++) { Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); } spearType++; @@ -250,7 +254,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } if (npc.ai[0] == 0f) { - float scaleFactor6 = death ? 16f : 14f; + float scaleFactor6 = enraged ? 24f : malice ? 20f : death ? 17f : revenge ? 16f : expertMode ? 15f : 14f; Vector2 center5 = player.Center; Vector2 vector126 = center5 - vectorCenter; Vector2 vector127 = vector126 - Vector2.UnitY * 300f; @@ -300,7 +304,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.netUpdate = true; Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]); velocity.Normalize(); - velocity *= 10f; + velocity *= enraged ? 18f : malice ? 15f : death ? 13f : revenge ? 12f : expertMode ? 11f : 10f; npc.velocity = velocity; } } @@ -309,15 +313,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (Main.netMode != NetmodeID.MultiplayerClient) { dustTimer--; - if ((lifeRatio < 0.5f || death) && dustTimer <= 0) + if (lifeRatio < 0.5f && dustTimer <= 0) { Main.PlaySound(SoundID.Item20, npc.position); - int damage = expertMode ? 55 : 70; - Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, npc.direction * 2, 4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 2f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (npc.width + 20) / 2f + vectorCenter; + int projectile = Projectile.NewProjectile(vector173, Vector2.Zero, type, damage, 0f, Main.myPlayer, 2f, 0f); Main.projectile[projectile].timeLeft = 120; - Main.projectile[projectile].velocity.X = 0f; - Main.projectile[projectile].velocity.Y = 0f; dustTimer = 3; } } @@ -351,6 +354,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { npc.ai[0] = 0f; npc.ai[1] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } npc.velocity *= 0.98f; @@ -381,14 +385,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -404,7 +408,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -423,7 +427,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void BossLoot(ref string name, ref int potionType) { name = "A Profaned Guardian"; - potionType = ItemID.GreaterHealingPotion; + potionType = ItemID.SuperHealingPotion; } public override void NPCLoot() @@ -432,15 +436,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); - DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedGuardians); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedGuardians, 5, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Wizard }, CalamityWorld.downedGuardians); // Mark the Profaned Guardians as dead CalamityWorld.downedGuardians = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void OnHitPlayer(Player player, int damage, bool crit) @@ -451,7 +454,7 @@ 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 * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index e49436ef05..bc696f885e 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Weapons.Typeless; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -26,14 +27,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetDefaults() { - npc.npcSlots = 3f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 3f; npc.aiStyle = -1; - npc.damage = 110; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 80; npc.defense = 50; - npc.DR_NERD(0.25f); - npc.LifeMaxNERB(40000, 50000, 300000); + npc.DR_NERD(0.4f); + npc.LifeMaxNERB(30000, 37500, 30000); // Old HP - 40000, 50000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -42,30 +44,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.canGhostHeal = false; aiType = -1; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - else - music = MusicID.Boss1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; + music = CalamityMod.Instance.GetMusicFromMusicMod("Guardians") ?? MusicID.Boss1; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } @@ -92,26 +71,37 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void AI() { - npc.TargetClosest(false); + // Get a target + 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(); + Player player = Main.player[npc.target]; + if (npc.timeLeft < 1800) npc.timeLeft = 1800; - bool expertMode = Main.expertMode; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; bool isHoly = player.ZoneHoly; bool isHell = player.ZoneUnderworldHeight; // Become immune over time if target isn't in hell or hallow - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { if (immuneTimer > 0) immuneTimer--; + else + npc.Calamity().CurrentlyEnraged = true; } else immuneTimer = 300; // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0; + npc.dontTakeDamage = immuneTimer <= 0 && !malice; Vector2 vectorCenter = npc.Center; @@ -168,7 +158,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) { - npc.TargetClosest(true); + npc.TargetClosest(); vector96 = new Vector2(npc.Center.X, npc.Center.Y); num784 = player.Center.X - vector96.X; num785 = player.Center.Y - vector96.Y; @@ -201,7 +191,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (npc.localAI[0] >= 420f) { npc.localAI[0] = 0f; - npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { Main.PlaySound(SoundID.Item20, npc.position); @@ -209,11 +198,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians float velocity = 5f; int totalProjectiles = 6; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = expertMode ? 50 : 60; + int type = ModContent.ProjectileType(); + 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, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, vector255, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -242,14 +232,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -265,7 +255,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -294,13 +284,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 240, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 08be31b070..3fd6e5f742 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -26,14 +27,15 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetDefaults() { - npc.npcSlots = 3f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 3f; npc.aiStyle = -1; - npc.damage = 90; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 80; - npc.defense = 35; - npc.DR_NERD(0.05f); - npc.LifeMaxNERB(25000, 35000, 200000); + npc.defense = 30; + npc.DR_NERD(0.2f); + npc.LifeMaxNERB(18750, 26250, 20000); // Old HP - 25000, 35000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -42,30 +44,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians npc.canGhostHeal = false; aiType = -1; npc.boss = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians"); - else - music = MusicID.Boss1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; + music = CalamityMod.Instance.GetMusicFromMusicMod("Guardians") ?? MusicID.Boss1; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } @@ -92,26 +71,37 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void AI() { - npc.TargetClosest(false); + // Get a target + 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(); + Player player = Main.player[npc.target]; + if (npc.timeLeft < 1800) npc.timeLeft = 1800; - bool expertMode = Main.expertMode; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; bool isHoly = player.ZoneHoly; bool isHell = player.ZoneUnderworldHeight; // Become immune over time if target isn't in hell or hallow - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { if (immuneTimer > 0) immuneTimer--; + else + npc.Calamity().CurrentlyEnraged = true; } else immuneTimer = 300; // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0; + npc.dontTakeDamage = immuneTimer <= 0 && !malice; Vector2 vectorCenter = npc.Center; @@ -168,7 +158,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(50)) || Main.rand.NextBool(100))) { - npc.TargetClosest(true); + npc.TargetClosest(); vector96 = new Vector2(npc.Center.X, npc.Center.Y); num784 = player.Center.X - vector96.X; num785 = player.Center.Y - vector96.Y; @@ -201,7 +191,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (npc.localAI[0] >= 600f) { npc.localAI[0] = 0f; - npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { Main.PlaySound(SoundID.Item20, npc.position); @@ -212,7 +201,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, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, npc.target, -32); } } } @@ -242,14 +231,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -266,7 +255,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians 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, 4f + npc.gfxOffY); + 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; @@ -303,13 +292,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.7f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Providence/ProvSky.cs b/NPCs/Providence/ProvSky.cs index ccad77bc33..3d6d53ff69 100644 --- a/NPCs/Providence/ProvSky.cs +++ b/NPCs/Providence/ProvSky.cs @@ -30,9 +30,7 @@ namespace CalamityMod.NPCs.Providence { float x = 0f; if (ProvIndex != -1) - { x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[ProvIndex].Center); - } float spawnAnimationTimer = 180f; float intensityScalar = 0.25f; @@ -41,7 +39,7 @@ namespace CalamityMod.NPCs.Providence return (1f - Utils.SmoothStep(3000f, 6000f, x)) * intensityScalar; } - return 0f; //0.5 + return 0f; } public override Color OnTileColor(Color inColor) diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 693765e465..d7cd033ebc 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -1,15 +1,16 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Providence { + [AutoloadBossHead] public class ProvSpawnDefense : ModNPC { public override void SetStaticDefaults() @@ -21,17 +22,18 @@ namespace CalamityMod.NPCs.Providence public override void SetDefaults() { - npc.npcSlots = 1f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 1f; npc.aiStyle = -1; - npc.damage = 100; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 80; npc.defense = 50; npc.DR_NERD(0.4f); - npc.lifeMax = 25000; - if (CalamityWorld.bossRushActive) + npc.lifeMax = 18750; // Old HP - 25000 + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 300000; + npc.lifeMax = 30000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -39,30 +41,21 @@ namespace CalamityMod.NPCs.Providence npc.noGravity = true; npc.noTileCollide = true; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } - public override void FindFrame(int frameHeight) + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -73,7 +66,6 @@ namespace CalamityMod.NPCs.Providence public override void AI() { CalamityGlobalNPC.holyBossDefender = npc.whoAmI; - bool expertMode = Main.expertMode; Vector2 vectorCenter = npc.Center; Player player = Main.player[npc.target]; npc.TargetClosest(false); @@ -165,14 +157,14 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -188,7 +180,7 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -211,7 +203,7 @@ namespace CalamityMod.NPCs.Providence public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Providence/ProvSpawnDefense_Head_Boss.png b/NPCs/Providence/ProvSpawnDefense_Head_Boss.png new file mode 100644 index 0000000000..1d1bd55b02 Binary files /dev/null and b/NPCs/Providence/ProvSpawnDefense_Head_Boss.png differ diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index c96e2456f8..46f7dab5ba 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -1,15 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Providence { + [AutoloadBossHead] public class ProvSpawnHealer : ModNPC { public override void SetStaticDefaults() @@ -26,12 +26,12 @@ namespace CalamityMod.NPCs.Providence npc.damage = 0; npc.width = 100; npc.height = 80; - npc.defense = 35; - npc.DR_NERD(0.15f); - npc.lifeMax = 40000; - if (CalamityWorld.bossRushActive) + npc.defense = 30; + npc.DR_NERD(0.2f); + npc.lifeMax = 30000; // Old HP - 40000 + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -39,30 +39,21 @@ namespace CalamityMod.NPCs.Providence npc.noGravity = true; npc.noTileCollide = true; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } - public override void FindFrame(int frameHeight) + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -70,99 +61,63 @@ namespace CalamityMod.NPCs.Providence npc.frame.Y = frame * frameHeight; } - public override void AI() - { - CalamityGlobalNPC.holyBossHealer = npc.whoAmI; - bool expertMode = Main.expertMode; - Vector2 vectorCenter = npc.Center; - Player player = Main.player[npc.target]; - npc.TargetClosest(false); - if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; + public override void AI() + { + CalamityGlobalNPC.holyBossHealer = npc.whoAmI; + bool expertMode = Main.expertMode; + Vector2 vectorCenter = npc.Center; + Player player = Main.player[npc.target]; + npc.TargetClosest(false); + if (CalamityGlobalNPC.holyBoss < 0 || !Main.npc[CalamityGlobalNPC.holyBoss].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.dontTakeDamage = Main.npc[CalamityGlobalNPC.holyBoss].dontTakeDamage; - if (Math.Sign(npc.velocity.X) != 0) - { - npc.spriteDirection = -Math.Sign(npc.velocity.X); - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - int num1009 = (npc.ai[0] == 0f) ? 1 : 2; - int num1010 = (npc.ai[0] == 0f) ? 60 : 80; - for (int num1011 = 0; num1011 < 2; num1011++) - { - if (Main.rand.Next(3) < num1009) - { - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = (int)CalamityDusts.ProfanedFire; - } - else - { - dustType = 107; - } - int num1012 = Dust.NewDust(npc.Center - new Vector2((float)num1010), num1010 * 2, num1010 * 2, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); - Main.dust[num1012].noGravity = true; - Main.dust[num1012].velocity *= 0.2f; - Main.dust[num1012].fadeIn = 1f; - } - } - if (npc.ai[0] == 0f) - { - Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); - float num784 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector96.X; - float num785 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector96.Y; - float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - if (num786 > 360f) - { - num786 = 8f / num786; //8f - num784 *= num786; - num785 *= num786; - npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; - return; - } - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f - { - npc.velocity *= 1.05f; //1.05f - } - if (Main.netMode != NetmodeID.MultiplayerClient && ((expertMode && Main.rand.NextBool(2000)) || Main.rand.NextBool(1000))) - { - npc.TargetClosest(true); - vector96 = new Vector2(npc.Center.X, npc.Center.Y); - num784 = player.Center.X - vector96.X; - num785 = player.Center.Y - vector96.Y; - num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); - num786 = 24f / num786; //8f - npc.velocity.X = num784 * num786; - npc.velocity.Y = num785 * num786; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - } - else - { - if (expertMode) - { - Vector2 value4 = player.Center - npc.Center; - value4.Normalize(); - value4 *= 9f; //9f - npc.velocity = (npc.velocity * 99f + value4) / 99f; //100 - } - Vector2 vector97 = new Vector2(npc.Center.X, npc.Center.Y); - float num787 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector97.X; - float num788 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector97.Y; - float num789 = (float)Math.Sqrt((double)(num787 * num787 + num788 * num788)); - if (num789 > 700f || npc.justHit) - { - npc.ai[0] = 0f; - } - } - } + if (Math.Sign(npc.velocity.X) != 0) + { + npc.spriteDirection = -Math.Sign(npc.velocity.X); + } + npc.spriteDirection = Math.Sign(npc.velocity.X); + for (int num1011 = 0; num1011 < 2; num1011++) + { + if (Main.rand.Next(3) < 1) + { + int dustType = Main.rand.Next(2); + if (dustType == 0) + { + dustType = (int)CalamityDusts.ProfanedFire; + } + else + { + dustType = 107; + } + int num1012 = Dust.NewDust(npc.Center - new Vector2(60f), 120, 120, dustType, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 0.5f); + Main.dust[num1012].noGravity = true; + Main.dust[num1012].velocity *= 0.2f; + Main.dust[num1012].fadeIn = 1f; + } + } + Vector2 vector96 = new Vector2(npc.Center.X, npc.Center.Y); + float num784 = Main.npc[CalamityGlobalNPC.holyBoss].Center.X - vector96.X; + float num785 = Main.npc[CalamityGlobalNPC.holyBoss].Center.Y - vector96.Y; + float num786 = (float)Math.Sqrt((double)(num784 * num784 + num785 * num785)); + if (num786 > 360f) + { + num786 = 8f / num786; //8f + num784 *= num786; + num785 *= num786; + npc.velocity.X = (npc.velocity.X * 15f + num784) / 16f; + npc.velocity.Y = (npc.velocity.Y * 15f + num785) / 16f; + return; + } + if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 8f) //8f + { + npc.velocity *= 1.05f; //1.05f + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -187,14 +142,14 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -211,7 +166,7 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + 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; @@ -240,11 +195,6 @@ namespace CalamityMod.NPCs.Providence return true; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/Providence/ProvSpawnHealer_Head_Boss.png b/NPCs/Providence/ProvSpawnHealer_Head_Boss.png new file mode 100644 index 0000000000..c22f6c1bec Binary files /dev/null and b/NPCs/Providence/ProvSpawnHealer_Head_Boss.png differ diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 3793422f8f..14c5c642d6 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -1,16 +1,17 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.Providence { + [AutoloadBossHead] public class ProvSpawnOffense : ModNPC { public int dustTimer = 3; @@ -24,17 +25,18 @@ namespace CalamityMod.NPCs.Providence public override void SetDefaults() { - npc.npcSlots = 1f; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 1f; npc.aiStyle = -1; - npc.damage = 120; - npc.width = 100; + npc.GetNPCDamage(); + npc.width = 100; npc.height = 80; npc.defense = 40; npc.DR_NERD(0.3f); - npc.lifeMax = 42500; - if (CalamityWorld.bossRushActive) + npc.lifeMax = 31875; // Old HP - 42500 + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); @@ -42,30 +44,23 @@ namespace CalamityMod.NPCs.Providence npc.noGravity = true; npc.noTileCollide = true; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } - public override void FindFrame(int frameHeight) + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(dustTimer); + writer.Write(npc.dontTakeDamage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + dustTimer = reader.ReadInt32(); + npc.dontTakeDamage = reader.ReadBoolean(); + } + + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; npc.frameCounter %= Main.npcFrameCount[npc.type]; @@ -76,8 +71,7 @@ namespace CalamityMod.NPCs.Providence public override void AI() { CalamityGlobalNPC.holyBossAttacker = npc.whoAmI; - bool fireDust = (double)npc.life <= (double)npc.lifeMax * 0.5; - bool expertMode = Main.expertMode; + bool fireDust = npc.life <= npc.lifeMax * 0.5; Vector2 vectorCenter = npc.Center; npc.TargetClosest(false); Player player = Main.player[npc.target]; @@ -172,9 +166,10 @@ namespace CalamityMod.NPCs.Providence if (fireDust && dustTimer <= 0) { Main.PlaySound(SoundID.Item20, npc.position); - int damage = expertMode ? 40 : 59; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 2f, 0f); + int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, type, damage, 0f, Main.myPlayer, 2f, 0f); Main.projectile[projectile].timeLeft = 120; Main.projectile[projectile].velocity.X = 0f; Main.projectile[projectile].velocity.Y = 0f; @@ -241,14 +236,14 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -264,7 +259,7 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } diff --git a/NPCs/Providence/ProvSpawnOffense_Head_Boss.png b/NPCs/Providence/ProvSpawnOffense_Head_Boss.png new file mode 100644 index 0000000000..613695110c Binary files /dev/null and b/NPCs/Providence/ProvSpawnOffense_Head_Boss.png differ diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 27af986de7..edcd99f867 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; @@ -8,6 +9,7 @@ using CalamityMod.Items.Dyes; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; using CalamityMod.Items.SummonItems; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; @@ -34,10 +36,29 @@ using Terraria.ModLoader; namespace CalamityMod.NPCs.Providence { - [AutoloadBossHead] - public class Providence : ModNPC - { - private bool text = false; + [AutoloadBossHead] + public class Providence : ModNPC + { + private enum Phase + { + PhaseChange = -1, + HolyBlast = 0, + HolyFire = 1, + FlameCocoon = 2, + MoltenBlobs = 3, + HolyBomb = 4, + SpearCocoon = 5, + Crystal = 6, + Laser = 7 + } + + private float AIState + { + get => npc.ai[0]; + set => npc.ai[0] = value; + } + + private bool text = false; private bool useDefenseFrames = false; private float bossLife; private int biomeType = 0; @@ -49,7 +70,7 @@ namespace CalamityMod.NPCs.Providence internal bool challenge = Main.expertMode/* && Main.netMode == NetmodeID.SinglePlayer*/; //Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. internal bool hasTakenDaytimeDamage = false; - public static float normalDR = 0.35f; + public static float normalDR = 0.3f; public static float cocoonDR = 0.9f; public override void SetStaticDefaults() @@ -69,7 +90,7 @@ namespace CalamityMod.NPCs.Providence npc.DR_NERD(normalDR, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); - npc.LifeMaxNERB(440000, 500000, 12500000); + npc.LifeMaxNERB(330000, 375000, 1250000); // Old HP - 440000, 500000 double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; @@ -78,33 +99,10 @@ namespace CalamityMod.NPCs.Providence npc.value = Item.buyPrice(0, 50, 0, 0); npc.boss = true; npc.Opacity = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; - npc.chaseable = true; - npc.canGhostHeal = false; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme"); - else - music = MusicID.LunarBoss; + music = CalamityMod.Instance.GetMusicFromMusicMod("ProvidenceTheme") ?? MusicID.LunarBoss; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/ProvidenceDeath"); bossBag = ModContent.ItemType(); } @@ -123,6 +121,8 @@ namespace CalamityMod.NPCs.Providence writer.Write(npc.chaseable); writer.Write(npc.canGhostHeal); writer.Write(npc.localAI[2]); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -139,7 +139,9 @@ namespace CalamityMod.NPCs.Providence npc.chaseable = reader.ReadBoolean(); npc.canGhostHeal = reader.ReadBoolean(); npc.localAI[2] = reader.ReadSingle(); - } + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { @@ -151,13 +153,18 @@ namespace CalamityMod.NPCs.Providence // Rotation npc.rotation = npc.velocity.X * 0.004f; - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + 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(); + + // 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(); // Target variable and boss center Player player = Main.player[npc.target]; - Vector2 vector = npc.Center; // Target's current biome bool isHoly = player.ZoneHoly; @@ -173,60 +180,65 @@ namespace CalamityMod.NPCs.Providence // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + // Night bool - bool nightTime = !Main.dayTime; + bool malice = CalamityWorld.malice; + bool nightTime = !Main.dayTime || malice; // Play enrage animation if night starts if (nightTime && calamityGlobalNPC.newAI[3] == spawnAnimationTime) { - npc.ai[0] = 0f; + AIState = (int)Phase.HolyBlast; 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; } // Difficulty bools - bool death = CalamityWorld.death || CalamityWorld.bossRushActive || nightTime; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive || nightTime; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive || nightTime; - bool enraged = npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive); - - // Projectile damage values - bool scaleExpertProjectileDamage = Main.expertMode && !nightTime; - int holyLaserDamage = 100; - int crystalDamage = scaleExpertProjectileDamage ? 57 : 70; - int holySpearDamage = scaleExpertProjectileDamage ? 52 : 65; - int holyBombDamage = scaleExpertProjectileDamage ? 48 : 60; - int moltenBlastDamage = scaleExpertProjectileDamage ? 42 : 55; - int holyFireDamage = scaleExpertProjectileDamage ? 48 : 60; - int holyBlastDamage = scaleExpertProjectileDamage ? 52 : 65; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || nightTime; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || nightTime; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive || nightTime; + bool enraged = npc.Calamity().enraged > 0; // Increase all projectile damage at night - int projectileDamageNight = 100; + int projectileDamageMult = 1; if (nightTime) - { - holyLaserDamage = crystalDamage = holySpearDamage = holyBombDamage = moltenBlastDamage = holyFireDamage = holyBlastDamage = projectileDamageNight; - } + projectileDamageMult = 2; + + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && (nightTime || malice)) || enraged; + + // 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; // Change dust type at night int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; // Phase times - float phaseTime = nightTime ? 240f : 300f; - float crystalPhaseTime = nightTime ? 60f : 120f; + float phaseTime = nightTime ? (240f - 60f * (1f - lifeRatio)) : 300f; + float crystalPhaseTime = nightTime ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; int nightCrystalTime = 210; - float attackDelayAfterCocoon = 90f; + float attackDelayAfterCocoon = phaseTime * 0.3f; // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); - bool phase2 = (lifeRatio < 0.75f || death) && !nightTime; + bool phase2 = lifeRatio < 0.75f && !nightTime; bool delayAttacks = npc.localAI[2] > 0f; // Spear phase - float spearRateIncrease = death ? 1f : 1f * (1f - lifeRatio); + float spearRateIncrease = 1f - lifeRatio; float enragedSpearRateIncrease = 0.5f; float bossRushSpearRateIncrease = 0.25f; float baseSpearRate = 18f; @@ -235,24 +247,38 @@ namespace CalamityMod.NPCs.Providence if (enraged) spearRate += enragedSpearRateIncrease; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) spearRate += bossRushSpearRateIncrease; // Projectile fire rate multiplier double attackRateMult = 1D; - // Distance X needed from target in order to fire holy or molten blasts - float distanceNeededToShoot = revenge ? 360f : 420f; + // Where projectiles are fired from during cocoon phases + Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); - // Inflict Holy Inferno if target is too far away - if (Vector2.Distance(player.Center, vector) > 2800f) + // Cocoon projectile initial velocity + float cocoonProjVelocity = 3f + (death ? 2f * (1f - lifeRatio) : 0f); + + // Distance X needed from target in order to fire holy or molten blasts + float distanceNeededToShoot = death ? 300f : revenge ? 360f : 420f; + + // X distance from target + float distanceX = Math.Abs(vector.X - player.Center.X); + + // Inflict Holy Inferno if target is too far away + float baseDistance = 2800f; + float shorterFlameCocoonDistance = (CalamityWorld.death || nightTime) ? 2200f : CalamityWorld.revenge ? 2400f : Main.expertMode ? 2600f : baseDistance; + float shorterSpearCocoonDistance = (CalamityWorld.death || nightTime) ? 1800f : CalamityWorld.revenge ? 2150f : Main.expertMode ? 2500f : baseDistance; + float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance; + float maxDistance = (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) ? shorterDistance : baseDistance; + if (Vector2.Distance(player.Center, vector) > maxDistance) { - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 2); - } + if (!player.dead && player.active) + player.AddBuff(ModContent.BuffType(), 2); + } - // Count the remaining Guardians, healer especially because it allows the boss to heal - int guardianAmt = 0; + // Count the remaining Guardians, healer especially because it allows the boss to heal + int guardianAmt = 0; bool healerAlive = false; if (CalamityGlobalNPC.holyBossAttacker != -1) { @@ -297,7 +323,7 @@ namespace CalamityMod.NPCs.Providence } // Whether the boss can be homed in on or healed off of - npc.chaseable = normalAttackRate && npc.ai[0] != 2f && npc.ai[0] != 5f && npc.ai[0] != 7f; + npc.chaseable = normalAttackRate && AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon && AIState != (int)Phase.Laser; npc.canGhostHeal = npc.chaseable; // Prevent lag by stopping rain @@ -313,7 +339,7 @@ namespace CalamityMod.NPCs.Providence } // Become immune over time if target isn't in hell or hallow - if (!isHoly && !isHell && !CalamityWorld.bossRushActive) + if (!isHoly && !isHell && !BossRushEvent.BossRushActive) { if (immuneTimer > 0) immuneTimer--; @@ -322,7 +348,7 @@ namespace CalamityMod.NPCs.Providence immuneTimer = 300; // Take damage or not - npc.dontTakeDamage = immuneTimer <= 0; + npc.dontTakeDamage = immuneTimer <= 0 && !malice; // Heal if (healerAlive) @@ -413,20 +439,19 @@ namespace CalamityMod.NPCs.Providence } // Set DR based on current attack phase - npc.Calamity().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f || 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; // Movement - if (npc.ai[0] != 2f && npc.ai[0] != 5f) + if (AIState != (int)Phase.FlameCocoon && AIState != (int)Phase.SpearCocoon) { // Firing holy ray or not - bool firingLaser = npc.ai[0] == 7f; + bool firingLaser = AIState == (int)Phase.Laser; // Change X direction of movement if (flightPath == 0) { - npc.TargetClosest(true); if (vector.X < player.Center.X) { flightPath = 1; @@ -439,9 +464,6 @@ namespace CalamityMod.NPCs.Providence } } - // Get a target - npc.TargetClosest(true); - // Increase speed over time if flying in same direction for too long if (revenge) calamityGlobalNPC.newAI[0] += 1f; @@ -450,27 +472,27 @@ namespace CalamityMod.NPCs.Providence float num851 = 800f; // Increase distance from target when firing molten blasts or holy bombs - bool stayAwayFromTarget = npc.ai[0] == 3f || npc.ai[0] == 4f; + bool stayAwayFromTarget = AIState == (int)Phase.MoltenBlobs || AIState == (int)Phase.HolyBomb; if (stayAwayFromTarget) - num851 += revenge ? 200f : 100f; + num851 += death ? 240f : revenge ? 180f : 120f; // Change X movement path if far enough away from target - float num852 = Math.Abs(vector.X - player.Center.X); - if (vector.X < player.Center.X && flightPath < 0 && num852 > num851) + if (vector.X < player.Center.X && flightPath < 0 && distanceX > num851) flightPath = 0; - if (vector.X > player.Center.X && flightPath > 0 && num852 > num851) + if (vector.X > player.Center.X && flightPath > 0 && distanceX > num851) flightPath = 0; - // Velocity and acceleration - bool increaseSpeed = calamityGlobalNPC.newAI[0] > 150f; - float accelerationBoost = death ? 0.2f : 0.2f * (1f - lifeRatio); - float velocityBoost = death ? 4f : 4f * (1f - lifeRatio); + // Velocity and acceleration + float speedIncreaseTimer = enraged ? 60f : nightTime ? 75f : death ? 120f : 150f; + bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer; + float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); + float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; float velocity = (expertMode ? 16f : 15f) + velocityBoost; - if (CalamityWorld.bossRushActive || nightTime) + if (BossRushEvent.BossRushActive || nightTime || enraged) { - acceleration = 1.3f; - velocity = 20f; + acceleration = 1.5f; + velocity = 25f; } if (firingLaser) { @@ -479,7 +501,7 @@ namespace CalamityMod.NPCs.Providence } else if (increaseSpeed) { - velocity += (calamityGlobalNPC.newAI[0] - 150f) * 0.04f; + velocity += (calamityGlobalNPC.newAI[0] - speedIncreaseTimer) * 0.04f; if (velocity > 30f) velocity = 30f; } @@ -516,721 +538,782 @@ namespace CalamityMod.NPCs.Providence } // Phase switch - if (npc.ai[0] == -1f) + switch ((int)AIState) { - phaseChange++; - if (phaseChange > 14) - phaseChange = 0; + case (int)Phase.PhaseChange: - int phase = 0; - /* 0 = blasts - * 1 = holy fire - * 2 = shell heal - * 3 = molten blobs - * 4 = holy bombs - * 5 = shell spears - * 6 = crystal - * 7 = laser */ + phaseChange++; + if (phaseChange > 14) + phaseChange = 0; - // Holy ray in hallow, Crystal in hell - bool useLaser = (phase2 && biomeType == 1) || CalamityWorld.bossRushActive; - bool useCrystal = (phase2 && biomeType == 2) || CalamityWorld.bossRushActive; + int phase = 0; - // Unique pattern for Death Mode and Boss Rush - if (death) - { - switch (phaseChange) + // Holy ray in hallow, Crystal in hell + bool useLaser = (phase2 && biomeType == 1) || BossRushEvent.BossRushActive; + bool useCrystal = (phase2 && biomeType == 2) || BossRushEvent.BossRushActive; + + // Unique pattern for Death Mode and Boss Rush + if (death) { - case 0: - phase = 3; - break; // 1575 or 1500 - case 1: - phase = 5; - break; // 1875 or 1800 - case 2: - phase = 0; - break; // 2175 or 2100 - case 3: - phase = (useCrystal || nightTime) ? 6 : 3; - break; - case 4: - phase = useCrystal ? 3 : 2; - break; // 600 - case 5: - phase = useCrystal ? 2 : 1; - break; // 900 - case 6: - phase = (useLaser || nightTime) ? 7 : 4; // 1875 or 1800 - if (useLaser || nightTime) - { - npc.TargetClosest(false); - } - break; // 1200 - case 7: - phase = (useLaser || nightTime) ? 4 : 3; - break; // 1500 - case 8: - phase = (useLaser || nightTime) ? 3 : 5; - break; - case 9: - phase = 0; - break; // 2175 or 2100 - case 10: - phase = (useCrystal || nightTime) ? 6 : 2; - break; - case 11: - phase = nightTime ? 2 : 3; - break; // 300 - case 12: - phase = (useLaser || nightTime) ? 7 : 4; // 675 or 600 - if (useLaser || nightTime) - { - npc.TargetClosest(false); - } - break; - case 13: - phase = 5; - break; // 975 or 900 - case 14: - phase = (useLaser || nightTime) ? 4 : 0; - break; // 1275 or 1200 - default: - break; - } - } - else - { - switch (phaseChange) - { - case 0: - phase = 0; - break; // 3375 or 3300 - case 1: - phase = useLaser ? 7 : 1; // 3750 or 3600 - if (useLaser) - { - npc.TargetClosest(false); - } - break; - case 2: - phase = 4; - break; // 4050 or 3900 - case 3: - phase = 3; - break; // 4350 or 4200 - case 4: - phase = 5; - break; // 4650 or 4500 - case 5: - phase = useCrystal ? 6 : 4; - break; - case 6: - phase = 1; - break; // 300 - case 7: - phase = 0; - break; // 600 - case 8: - phase = 3; - break; // 900 - case 9: - phase = 2; - break; // 1500 - case 10: - phase = 4; - break; // 1800 - case 11: - phase = useLaser ? 7 : 0; //2175 or 2100 - if (useLaser) - { - npc.TargetClosest(false); - } - break; - case 12: - phase = 1; - break; // 2475 or 2400 - case 13: - phase = 3; - break; // 2775 or 2700 - case 14: - phase = 5; - break; // 3075 or 3000 - default: - break; - } - } - - // Pick a target - npc.TargetClosest(true); - - // If too far from target, set phase to 0 - if (Math.Abs(vector.X - player.Center.X) > 5600f) - phase = 0; - - // Reset attack delay for laser - if (phase == 7) - npc.localAI[2] = 0f; - - // Reset arrays - npc.ai[0] = phase; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - } - - // Holy blasts - else if (npc.ai[0] == 0f) - { - if (spawnAnimation) - { - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[3] == 0f) - 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); - - 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++) + switch (phaseChange) { - float fade = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity) * CalamityUtils.GetLerpValue(0f, 120f, calamityGlobalNPC.newAI[3], clamped: true); - Color newColor = Main.hslToRgb(calamityGlobalNPC.newAI[3] / 180f, 1f, 0.5f); - - if (!nightTime) - { - newColor.R = 255; - if (biomeType == 2) - newColor.B = 0; - } - else - { - newColor.B = 255; - if (biomeType == 2) - newColor.G = 0; - else - 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); - 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; - Main.dust[dust].velocity += Vector2.UnitY * 3f; - Main.dust[dust].scale = 1.2f; - - if (dust != 6000) - { - Dust dust2 = Dust.CloneDust(dust); - dust2.scale /= 2f; - dust2.fadeIn *= 0.85f; - dust2.color = new Color(255, 255, 0, 255); - } - } - } - - npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); - - calamityGlobalNPC.newAI[3] += 1f; - - if (nightTime && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) - calamityGlobalNPC.newAI[3] += 1f; - - return; - } - - // Attack delay after cocoon phase - if (delayAttacks) - { - npc.localAI[2] -= 1f; - return; - } - - float num852 = Math.Abs(vector.X - player.Center.X); - if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) - { - npc.ai[3] += 1f; - - int shootBoost = death ? 3 : (int)(4f * (1f - lifeRatio)); - int num856 = (expertMode ? 24 : 26) - shootBoost; - if (enraged) - num856 = 20; - - num856 = (int)(num856 * attackRateMult); - - if (npc.ai[3] >= num856) - npc.ai[3] = -num856; - - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - 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); - - float velocityBoost = death ? 2.5f : 2.5f * (1f - lifeRatio); - float num860 = (expertMode ? 10.25f : 9f) + velocityBoost; - if (enraged) - num860 = 12.75f; - - if (revenge) - num860 *= 1.15f; - - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; - - 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; - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) - npc.ai[0] = -1f; - } - - // Holy fire - else if (npc.ai[0] == 1f) - { - // Attack delay after cocoon phase - if (delayAttacks) - { - npc.localAI[2] -= 1f; - return; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - - int shootBoost = death ? 4 : (int)(5f * (1f - lifeRatio)); - int num864 = (expertMode ? 36 : 39) - shootBoost; - if (CalamityWorld.bossRushActive) - num864 = 31; - - num864 = (int)(num864 * attackRateMult); - - if (npc.ai[3] >= num864) - { - npc.ai[3] = 0f; - - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); - - 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(), holyFireDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) - npc.ai[0] = -1f; - } - - // Cocoon flames - else if (npc.ai[0] == 2f) - { - npc.TargetClosest(true); - - if (!targetDead) - { - if (npc.velocity.Length() <= 2f) - npc.velocity = Vector2.Zero; - if (npc.velocity.Length() > 2f) - { - npc.velocity *= 0.9f; - return; - } - } - - float divisor = (expertMode ? 2f : 3f) + (float)Math.Floor(3f * lifeRatio) + (attackRateMult > 1D ? (float)Math.Ceiling(attackRateMult * 1.6) : 0f); - int totalProjectiles = 36; - int chains = 4; - float interval = totalProjectiles / chains * divisor; - double patternInterval = Math.Floor(npc.ai[3] / interval); - float velocity = 3f; - Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (patternInterval % 2 == 0) - { - if (npc.ai[3] % divisor == 0f) - { - bool normalSpread = calamityGlobalNPC.newAI[1] % 2f == 0f; - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -velocity) : Vector2.Normalize(new Vector2(-velocity, -velocity)); - double radians = MathHelper.TwoPi / chains; - Main.PlaySound(SoundID.Item20, npc.position); - for (int i = 0; i < chains; i++) - { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.ai[2])); - - if (!normalSpread) - vector2 *= velocity; - - int projectileType = ModContent.ProjectileType(); - if (Main.rand.NextBool(4) && !death) - projectileType = ModContent.ProjectileType(); - - Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); - } - - // Radial offset - npc.ai[2] += 10f; + case 0: + phase = (int)Phase.MoltenBlobs; + break; + case 1: + phase = (int)Phase.SpearCocoon; + break; + case 2: + phase = (int)Phase.HolyBlast; + break; + case 3: + phase = (useCrystal || nightTime) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; + break; + case 4: + phase = useCrystal ? (int)Phase.MoltenBlobs : (int)Phase.FlameCocoon; + break; + case 5: + phase = useCrystal ? (int)Phase.FlameCocoon : (int)Phase.HolyFire; + break; + case 6: + phase = (useLaser || nightTime) ? (int)Phase.Laser : (int)Phase.HolyBomb; + break; + case 7: + phase = (useLaser || nightTime) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; + break; + case 8: + phase = (useLaser || nightTime) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; + break; + case 9: + phase = (int)Phase.HolyBlast; + break; + case 10: + phase = (useCrystal || nightTime) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; + break; + case 11: + phase = nightTime ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; + break; + case 12: + phase = (useLaser || nightTime) ? (int)Phase.Laser : (int)Phase.HolyBomb; + break; + case 13: + phase = (int)Phase.SpearCocoon; + break; + case 14: + phase = (useLaser || nightTime) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; + break; + default: + break; } } else { - npc.ai[2] = 0f; - - totalProjectiles = 16; - if (npc.ai[3] % (divisor * totalProjectiles) == 0f) + switch (phaseChange) { - calamityGlobalNPC.newAI[1] += 1f; - double radians = MathHelper.TwoPi / totalProjectiles; - Main.PlaySound(SoundID.Item20, npc.position); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = new Vector2(0f, -velocity).RotatedBy(radians * i); - - int projectileType = ModContent.ProjectileType(); - if (Main.rand.NextBool(4) && !death) - projectileType = ModContent.ProjectileType(); - - Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); - } - - Vector2 velocity2 = Vector2.Normalize(player.Center - fireFrom) * velocity; - Projectile.NewProjectile(fireFrom, velocity2, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + case 0: + phase = (int)Phase.HolyBlast; + break; + case 1: + phase = useLaser ? (int)Phase.Laser : (int)Phase.HolyFire; + break; + case 2: + phase = (int)Phase.HolyBomb; + break; + case 3: + phase = (int)Phase.MoltenBlobs; + break; + case 4: + phase = (int)Phase.SpearCocoon; + break; + case 5: + phase = useCrystal ? (int)Phase.Crystal : (int)Phase.HolyBomb; + break; + case 6: + phase = (int)Phase.HolyFire; + break; + case 7: + phase = (int)Phase.HolyBlast; + break; + case 8: + phase = (int)Phase.MoltenBlobs; + break; + case 9: + phase = (int)Phase.FlameCocoon; + break; + case 10: + phase = (int)Phase.HolyBomb; + break; + case 11: + phase = useLaser ? (int)Phase.Laser : (int)Phase.HolyBlast; + break; + case 12: + phase = (int)Phase.HolyFire; + break; + case 13: + phase = (int)Phase.MoltenBlobs; + break; + case 14: + phase = (int)Phase.SpearCocoon; + break; + default: + break; } } - } - if (npc.ai[3] == 0f) - DespawnSpecificProjectiles(); + // If too far from target, set phase to 0 + if (Math.Abs(vector.X - player.Center.X) > 5600f) + phase = (int)Phase.HolyBlast; - // Air is burning text - npc.ai[3] += 1f; - if (npc.ai[3] >= (phaseTime * 1.5f) && !text) - { - text = true; - string key = "Mods.CalamityMod.ProfanedBossText"; - Color messageColor = Color.Orange; + // Reset attack delay for laser + if (phase == (int)Phase.Laser) + npc.localAI[2] = 0f; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + // Reset arrays + AIState = phase; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.netUpdate = true; + break; - // Inflict Icarus Folly - if (npc.ai[3] >= (phaseTime * 2f)) - { - if (Main.netMode != NetmodeID.Server) + case (int)Phase.HolyBlast: + + if (spawnAnimation) { - Player player2 = Main.player[Main.myPlayer]; - bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[3] == 0f) + Projectile.NewProjectile(vector + new Vector2(0f, -80f), Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, biomeType, 0f); - if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f && !inLiquid) + if (calamityGlobalNPC.newAI[3] == 10f && nightTime) + Main.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) { - Main.PlaySound(SoundID.Item20, player2.position); - player2.AddBuff(ModContent.BuffType(), 3000, true); - - for (int num621 = 0; num621 < 40; num621++) + int dustAmt = (int)MathHelper.Lerp(4f, 8f, calamityGlobalNPC.newAI[3] / spawnAnimationTime); + for (int m = 0; m < dustAmt; m++) { - int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) + 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) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + newColor.R = 255; + if (biomeType == 2) + newColor.B = 0; + } + else + { + newColor.B = 255; + if (biomeType == 2) + newColor.G = 0; + else + 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); + 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; + Main.dust[dust].velocity += Vector2.UnitY * 3f; + Main.dust[dust].scale = 1.2f; + + if (dust != 6000) + { + Dust dust2 = Dust.CloneDust(dust); + dust2.scale /= 2f; + dust2.fadeIn *= 0.85f; + dust2.color = new Color(255, 255, 0, 255); } } - - for (int num623 = 0; num623 < 60; num623++) - { - int num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, dustType, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), - player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } } - } - text = false; - npc.ai[0] = -1f; - npc.localAI[2] = attackDelayAfterCocoon; - } - } + npc.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f); - // Molten blasts - else if (npc.ai[0] == 3f) - { - // Attack delay after cocoon phase - if (delayAttacks) - { - npc.localAI[2] -= 1f; - return; - } + calamityGlobalNPC.newAI[3] += 1f; - float num852 = Math.Abs(vector.X - player.Center.X); - if (num852 > distanceNeededToShoot && npc.position.Y < player.position.Y) - { - npc.ai[3] += 1f; + if (nightTime && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) + calamityGlobalNPC.newAI[3] += 1f; - int shootBoost = death ? 3 : (int)(4f * (1f - lifeRatio)); - int num856 = (expertMode ? 24 : 26) - shootBoost; - if (CalamityWorld.bossRushActive) - num856 = 20; - - num856 = (int)(num856 * attackRateMult); - - if (npc.ai[3] >= num856) - npc.ai[3] = -num856; - - if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - 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); - - float shootBoost2 = death ? 2.5f : 2.5f * (1f - lifeRatio); - float num860 = (expertMode ? 10.25f : 9f) + shootBoost2; - if (CalamityWorld.bossRushActive) - num860 = 12.75f; - - if (revenge) - num860 *= 1.15f; - - num859 = num860 / num859; - num857 *= num859; - num858 *= num859; - - 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; - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) - npc.ai[0] = -1f; - } - - // Holy bombs - else if (npc.ai[0] == 4f) - { - // Attack delay after cocoon phase - if (delayAttacks) - { - npc.localAI[2] -= 1f; - return; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - - int shootBoost = death ? 9 : (int)(10f * (1f - lifeRatio)); - int num864 = (expertMode ? 73 : 77) - shootBoost; - if (enraged) - num864 = 63; - - num864 = (int)(num864 * attackRateMult); - - if (npc.ai[3] >= num864) - { - npc.ai[3] = 0f; - - Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); - - 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); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) - npc.ai[0] = -1f; - } - - // Cocoon spears - else if (npc.ai[0] == 5f) - { - npc.TargetClosest(true); - - if (!targetDead) - { - if (npc.velocity.Length() <= 2f) - npc.velocity = Vector2.Zero; - if (npc.velocity.Length() > 2f) - { - npc.velocity *= 0.9f; return; } - } - if (npc.ai[1] == 0f) - DespawnSpecificProjectiles(); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[2] += spearRate; - if (npc.ai[2] >= (float)(baseSpearRate * attackRateMult)) + // Attack delay after cocoon phase + if (delayAttacks) { - npc.ai[2] = 0f; - - Vector2 fireFrom = new Vector2(vector.X, vector.Y + 20f); - - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, fireFrom); - - float velocity = 3f; - int projectileType = ModContent.ProjectileType(); - - if (calamityGlobalNPC.newAI[2] % 2f == 0f) - { - int totalProjectiles = 12; - double radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-calamityGlobalNPC.newAI[1], -velocity)); - - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * velocity; - Projectile.NewProjectile(fireFrom, vector2, projectileType, holySpearDamage, 0f, Main.myPlayer, 0f, 0f); - } - - float radialOffset = MathHelper.Lerp(0.2f, 0.4f, spearRateIncrease); - calamityGlobalNPC.newAI[1] += radialOffset; - } - - calamityGlobalNPC.newAI[2] += 1f; - - velocity = expertMode ? 12f : 10f; - Vector2 velocity2 = Vector2.Normalize(player.Center - fireFrom) * velocity; - Projectile.NewProjectile(fireFrom, velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseTime) - { - npc.ai[0] = -1f; - npc.localAI[2] = attackDelayAfterCocoon; - } - } - - // Crystal - else if (npc.ai[0] == 6f) - { - npc.TargetClosest(true); - - if (!targetDead) - npc.velocity *= 0.9f; - - npc.ai[1] += 1f; - if (npc.ai[1] >= crystalPhaseTime) - { - 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, 0f, 0f); - - if (nightTime) - Main.projectile[proj].timeLeft = nightCrystalTime; + npc.localAI[2] -= 1f; + return; } - if (npc.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) - npc.ai[0] = -1f; - } - } - - // Holy ray - else if (npc.ai[0] == 7f) - { - Vector2 value19 = new Vector2(27f, 59f); - - float rotation = 450f + (guardianAmt * 18); - - npc.ai[2] += 1f; - if (npc.ai[2] < 120f) - { - if (npc.ai[2] >= 40f) + if (distanceX > distanceNeededToShoot && npc.position.Y < player.position.Y) { - int num1220 = 0; - if (npc.ai[2] >= 80f) - num1220 = 1; + npc.ai[3] += 1f; - for (int d = 0; d < 1 + num1220; d++) + int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); + int num856 = (expertMode ? 24 : 26) - shootBoost; + if (enraged) + num856 = 20; + + num856 = (int)(num856 * attackRateMult); + + if (npc.ai[3] >= num856) + npc.ai[3] = -num856; + + if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - float scalar = 1.2f; - if (d % 2 == 1) - scalar = 2.8f; + 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); - 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); - 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)) - { - 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"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.TargetClosest(false); - - Vector2 velocity = player.Center - vector; - velocity.Normalize(); - - float num1225 = -1f; - if (velocity.X < 0f) - num1225 = 1f; - - velocity = velocity.RotatedBy(-(double)num1225 * MathHelper.TwoPi / 6f, default); - Projectile.NewProjectile(vector.X, vector.Y + 32f, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, num1225 * MathHelper.TwoPi / rotation, npc.whoAmI); + float velocityBoost = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); + float num860 = (expertMode ? 10.25f : 9f) + velocityBoost; + if (enraged) + num860 = 12.75f; 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); + num860 *= 1.15f; - npc.ai[3] = (velocity.ToRotation() + MathHelper.TwoPi + MathHelper.Pi) * num1225; - npc.netUpdate = true; + num859 = num860 / num859; + num857 *= num859; + num858 *= num859; + + 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; - npc.ai[1] += 1f; - if (npc.ai[1] >= (revenge ? 235f : 315f)) - npc.ai[0] = -1f; + npc.ai[1] += 1f; + if (npc.ai[1] >= phaseTime) + { + AIState = (int)Phase.PhaseChange; + npc.TargetClosest(); + } + + break; + + case (int)Phase.HolyFire: + + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + 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; + if (BossRushEvent.BossRushActive) + num864 = 31; + + num864 = (int)(num864 * attackRateMult); + + if (npc.ai[3] >= num864) + { + npc.ai[3] = 0f; + + Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); + + float num865 = npc.velocity.Y; + if (num865 < 0f) + num865 = 0f; + + num865 += expertMode ? 4f : 3f; + + if (nightTime) + num865 *= 2f; + + 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) + { + AIState = (int)Phase.PhaseChange; + npc.TargetClosest(); + } + + break; + + case (int)Phase.FlameCocoon: + + if (!targetDead) + { + if (npc.velocity.Length() <= 2f) + npc.velocity = Vector2.Zero; + if (npc.velocity.Length() > 2f) + { + npc.velocity *= 0.9f; + return; + } + } + + float divisor = (expertMode ? 2f : 3f) + (float)Math.Floor(3f * lifeRatio) + (attackRateMult > 1D ? (float)Math.Ceiling(attackRateMult * 1.6) : 0f); + int totalFlameProjectiles = 36; + int chains = 4; + float interval = totalFlameProjectiles / chains * divisor; + 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) + { + Main.PlaySound(SoundID.Item20, npc.Center); + bool normalSpread = calamityGlobalNPC.newAI[1] % 2f == 0f; + double radians = MathHelper.TwoPi / chains; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(cocoonProjVelocity * Math.Sin(angleA) / Math.Sin(angleB)); + 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])); + + int projectileType = ModContent.ProjectileType(); + if (Main.rand.NextBool(healingStarChance) && !death) + projectileType = ModContent.ProjectileType(); + + int dmgAmt = nightTime ? -300 : npc.GetProjectileDamageNoScaling(projectileType); + + Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + } + + // Radial offset + npc.ai[2] += 10f; + } + npc.netUpdate = true; + } + else + { + npc.ai[2] = 0f; + + totalFlameProjectiles = 16; + if (npc.ai[3] % (divisor * totalFlameProjectiles) == 0f) + { + calamityGlobalNPC.newAI[1] += 1f; + double radians = MathHelper.TwoPi / totalFlameProjectiles; + Main.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); + for (int i = 0; i < totalFlameProjectiles; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i); + + int projectileType = ModContent.ProjectileType(); + if (Main.rand.NextBool(healingStarChance) && !death) + projectileType = ModContent.ProjectileType(); + + int dmgAmt = nightTime ? -300 : npc.GetProjectileDamageNoScaling(projectileType); + + Projectile.NewProjectile(fireFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + } + } + } + + // Fire a flame towards every player, with a limit of 5 + // Only fired while the guardians aren't alive or if Providence is at low health + if (npc.ai[3] % 60f == 0f && expertMode && normalAttackRate) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); + + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireFrom) * cocoonProjVelocity * 1.5f; + int type = ModContent.ProjectileType(); + Projectile.NewProjectile(fireFrom, velocity2, type, 0, 0f, Main.myPlayer, 0f, nightTime ? -300 : npc.GetProjectileDamageNoScaling(type)); + } + } + } + + if (npc.ai[3] == 0f) + DespawnSpecificProjectiles(); + + // Air is burning text + npc.ai[3] += 1f; + if (npc.ai[3] >= (phaseTime * 1.5f) && !text) + { + text = true; + string key = "Mods.CalamityMod.ProfanedBossText"; + Color messageColor = Color.Orange; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + + // Inflict Icarus Folly + if (npc.ai[3] >= (phaseTime * 2f)) + { + if (Main.netMode != NetmodeID.Server) + { + Player player2 = Main.player[Main.myPlayer]; + bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; + + if (!player2.dead && player2.active && Vector2.Distance(player2.Center, vector) < 2800f && !inLiquid) + { + Main.PlaySound(SoundID.Item20, player2.position); + player2.AddBuff(ModContent.BuffType(), 3000, true); + + for (int num621 = 0; num621 < 40; num621++) + { + int num622 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + + for (int num623 = 0; num623 < 60; num623++) + { + int num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, dustType, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player2.position.X, player2.position.Y), + player2.width, player2.height, dustType, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + + text = false; + AIState = (int)Phase.PhaseChange; + npc.localAI[2] = attackDelayAfterCocoon; + npc.TargetClosest(); + } + + break; + + case (int)Phase.MoltenBlobs: + + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } + + if (distanceX > distanceNeededToShoot && npc.position.Y < player.position.Y) + { + 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; + if (BossRushEvent.BossRushActive) + num856 = 20; + + num856 = (int)(num856 * attackRateMult); + + if (npc.ai[3] >= num856) + npc.ai[3] = -num856; + + if (npc.ai[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + 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); + + float shootBoost2 = death ? 4f * (1f - lifeRatio) : 2.5f * (1f - lifeRatio); + float num860 = (expertMode ? 10.25f : 9f) + shootBoost2; + if (BossRushEvent.BossRushActive) + num860 = 12.75f; + + if (revenge) + num860 *= 1.15f; + + num859 = num860 / num859; + num857 *= num859; + num858 *= num859; + + 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; + + npc.ai[1] += 1f; + if (npc.ai[1] >= phaseTime) + { + AIState = (int)Phase.PhaseChange; + npc.TargetClosest(); + } + + break; + + case (int)Phase.HolyBomb: + + // Attack delay after cocoon phase + if (delayAttacks) + { + npc.localAI[2] -= 1f; + return; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[3] += 1f; + + int shootBoost = death ? (int)Math.Round(12f * (1f - lifeRatio)) : (int)Math.Round(10f * (1f - lifeRatio)); + int num864 = (expertMode ? 73 : 77) - shootBoost; + if (enraged) + num864 = 63; + + num864 = (int)(num864 * attackRateMult); + + if (npc.ai[3] >= num864) + { + npc.ai[3] = 0f; + + Vector2 vector113 = new Vector2(vector.X, npc.position.Y + npc.height - 14f); + + 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); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= phaseTime) + { + AIState = (int)Phase.PhaseChange; + npc.TargetClosest(); + } + + break; + + case (int)Phase.SpearCocoon: + + if (!targetDead) + { + if (npc.velocity.Length() <= 2f) + npc.velocity = Vector2.Zero; + if (npc.velocity.Length() > 2f) + { + npc.velocity *= 0.9f; + return; + } + } + + 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] = 0f; + + Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, fireFrom); + + int projectileType = ModContent.ProjectileType(); + + if (calamityGlobalNPC.newAI[2] % 2f == 0f) + { + int totalSpearProjectiles = 12; + double radians = MathHelper.TwoPi / totalSpearProjectiles; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-calamityGlobalNPC.newAI[1], -cocoonProjVelocity)); + + for (int i = 0; i < totalSpearProjectiles; i++) + { + Vector2 vector2 = spinningPoint.RotatedBy(radians * i) * cocoonProjVelocity; + Projectile.NewProjectile(fireFrom, vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); + } + + if (spearRateIncrease > 1f) + spearRateIncrease = 1f; + + float radialOffset = MathHelper.Lerp(0.2f, 0.4f, spearRateIncrease); + calamityGlobalNPC.newAI[1] += radialOffset; + } + + calamityGlobalNPC.newAI[2] += 1f; + + cocoonProjVelocity = death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; + Vector2 velocity2 = Vector2.Normalize(player.Center - fireFrom) * cocoonProjVelocity; + Projectile.NewProjectile(fireFrom, velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); + } + } + + npc.ai[3] += 1f; + if (npc.ai[3] >= phaseTime) + { + AIState = (int)Phase.PhaseChange; + npc.localAI[2] = attackDelayAfterCocoon; + npc.TargetClosest(); + } + + break; + + case (int)Phase.Crystal: + + if (!targetDead) + npc.velocity *= 0.9f; + + npc.ai[1] += 1f; + if (npc.ai[1] >= crystalPhaseTime) + { + 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); + + if (nightTime) + Main.projectile[proj].timeLeft = nightCrystalTime; + } + + if (npc.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) + { + AIState = (int)Phase.PhaseChange; + npc.TargetClosest(); + } + } + + break; + + case (int)Phase.Laser: + + Vector2 value19 = new Vector2(27f, 59f); + + float rotation = (nightTime ? 435f : 450f) + (guardianAmt * 18); + + npc.ai[2] += 1f; + if (npc.ai[2] < 120f) + { + if (npc.ai[2] >= 40f) + { + int num1220 = 0; + if (npc.ai[2] >= 80f) + num1220 = 1; + + for (int d = 0; d < 1 + num1220; d++) + { + float scalar = 1.2f; + if (d % 2 == 1) + 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); + 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)) + { + 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"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 velocity = player.Center - vector; + velocity.Normalize(); + + float num1225 = -1f; + if (velocity.X < 0f) + num1225 = 1f; + + // 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); + + // -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); + + 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); + + 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); + } + + npc.netUpdate = true; + } + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= (revenge ? 235f : 315f)) + { + AIState = (int)Phase.PhaseChange; + npc.TargetClosest(); + } + + break; } } + public float CalculateBurnIntensity() + { + float distanceToTarget = Vector2.Distance(Main.player[npc.target].Center, npc.Center); + float aiTimer = npc.ai[3]; + + float baseDistance = 2800f; + float shorterFlameCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; + float shorterSpearCocoonDistance = (CalamityWorld.death || CalamityWorld.malice || !Main.dayTime) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f; + float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance; + + bool guardianAlive = false; + if (CalamityGlobalNPC.holyBossAttacker != -1 && Main.npc[CalamityGlobalNPC.holyBossAttacker].active) + guardianAlive = true; + + if (CalamityGlobalNPC.holyBossDefender != -1 && Main.npc[CalamityGlobalNPC.holyBossDefender].active) + guardianAlive = true; + + if (CalamityGlobalNPC.holyBossHealer != -1 && Main.npc[CalamityGlobalNPC.holyBossHealer].active) + guardianAlive = true; + + float maxDistance = baseDistance; + + // A factor which measures how much of the distance shortening shave-off should be taken into account. + // It is determined based on how much time has elapsed during the attack thus far, specifically for the two cocoon attacks. + // This shave-off does not happen when guardians are present. + float shorterDistanceFade = Utils.InverseLerp(0f, 120f, aiTimer, true); + if (!guardianAlive) + { + maxDistance = baseDistance; + if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) + maxDistance -= shorterDistance * shorterDistanceFade; + } + + float drawFireDistanceStart = maxDistance - 800f; + return Utils.InverseLerp(drawFireDistanceStart, maxDistance, distanceToTarget, true); + } + private void DespawnSpecificProjectiles() { for (int x = 0; x < Main.maxProjectiles; x++) @@ -1254,9 +1337,13 @@ namespace CalamityMod.NPCs.Providence public override void NPCLoot() { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + + // Legendary drop for Providence + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice || !hasTakenDaytimeDamage); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice || !hasTakenDaytimeDamage); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedProvidence, 5, 2, 1); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedProvidence); @@ -1271,7 +1358,7 @@ namespace CalamityMod.NPCs.Providence DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, shouldDrop); // Special drop for defeating her at night - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !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) @@ -1281,7 +1368,7 @@ namespace CalamityMod.NPCs.Providence DropHelper.DropItemSpray(npc, ModContent.ItemType(), 15, 20); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -1292,17 +1379,12 @@ namespace CalamityMod.NPCs.Providence DropHelper.WeightStack(w) ); - // Equipment - DropHelper.DropItemChance(npc, ModContent.ItemType(), 40); - // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); } - if (Main.netMode != NetmodeID.MultiplayerClient) - { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.Top.Y >= (Main.maxTilesY - 240f) * 16f) SpawnLootBox(); - } // If Providence has not been killed, notify players of Uelibloom Ore if (!CalamityWorld.downedProvidence) @@ -1312,19 +1394,11 @@ namespace CalamityMod.NPCs.Providence string key3 = "Mods.CalamityMod.TreeOreText"; Color messageColor3 = Color.LightGreen; - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 15E-05, .4f, .8f); + CalamityUtils.SpawnOre(ModContent.TileType(), 15E-05, 0.4f, 0.8f, 3, 8, TileID.Mud); - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } - } + CalamityUtils.DisplayLocalizedText(key2, messageColor2); + CalamityUtils.DisplayLocalizedText(key3, messageColor3); + } if (challenge) { @@ -1336,14 +1410,14 @@ namespace CalamityMod.NPCs.Providence // Mark Providence as dead CalamityWorld.downedProvidence = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } private void SpawnLootBox() { int tileCenterX = (int)npc.Center.X / 16; int tileCenterY = (int)npc.Center.Y / 16; - int halfBox = npc.width / 2 / 16 + 1; + int halfBox = 5; for (int x = tileCenterX - halfBox; x <= tileCenterX + halfBox; x++) { for (int y = tileCenterY - halfBox; y <= tileCenterY + halfBox; y++) @@ -1367,12 +1441,13 @@ namespace CalamityMod.NPCs.Providence public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - bool nightTime = !Main.dayTime; + bool malice = CalamityWorld.malice; + bool nightTime = !Main.dayTime || malice; string baseTextureString = "CalamityMod/NPCs/Providence/"; string baseGlowTextureString = baseTextureString + "Glowmasks/"; @@ -1381,7 +1456,7 @@ namespace CalamityMod.NPCs.Providence string getTextureGlowString = baseGlowTextureString + "ProvidenceGlow"; string getTextureGlow2String = baseGlowTextureString + "ProvidenceGlow2"; - if (npc.ai[0] == 2f || npc.ai[0] == 5f) + if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) { if (!useDefenseFrames) { @@ -1453,18 +1528,18 @@ namespace CalamityMod.NPCs.Providence 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, 4f + npc.gfxOffY); + 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(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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); - Color color37 = Color.Lerp(Color.White, Main.dayTime ? Color.Yellow : Color.Cyan, 0.5f) * npc.Opacity; - Color color42 = Color.Lerp(Color.White, Main.dayTime ? Color.Violet : Color.BlueViolet, 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 (CalamityConfig.Instance.Afterimages) { @@ -1476,7 +1551,7 @@ namespace CalamityMod.NPCs.Providence color41 *= (num153 - num163) / 15f; 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(textureGlow, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); Color color43 = color42; @@ -1496,7 +1571,7 @@ namespace CalamityMod.NPCs.Providence public override void FindFrame(int frameHeight) //9 total frames { - if (npc.ai[0] == 2f || npc.ai[0] == 5f) + if (AIState == (int)Phase.FlameCocoon || AIState == (int)Phase.SpearCocoon) { if (!useDefenseFrames) { @@ -1584,7 +1659,11 @@ namespace CalamityMod.NPCs.Providence ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType() }; bool allowedClass = projectile.IsSummon() || (!projectile.melee && !projectile.ranged && !projectile.magic && !projectile.thrown && !projectile.Calamity().rogue); @@ -1644,7 +1723,7 @@ namespace CalamityMod.NPCs.Providence 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/ProvidenceHurt"), npc.Center); diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 66052ba09b..5f1d4159f3 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -18,18 +19,14 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.damage = 0; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 150; npc.lifeMax = 100; npc.alpha = 255; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontTakeDamage = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -46,7 +43,9 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { bool provy = CalamityWorld.downedProvidence; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { npc.dontTakeDamage = false; npc.life = 0; @@ -62,26 +61,28 @@ namespace CalamityMod.NPCs.Ravager if (npc.alpha > 0) { - npc.alpha -= 3; + npc.damage = 0; + + npc.alpha -= 5; if (npc.alpha < 0) npc.alpha = 0; } + else + { + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + npc.damage = (int)(npc.defDamage * 1.5); + else + npc.damage = npc.defDamage; + } if (npc.ai[0] == 0f) { - npc.noTileCollide = false; - npc.ai[1] += 1f; - if (npc.ai[1] >= 85f) + if (npc.ai[1] >= 60f) { - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) - npc.damage = 400; - else - npc.damage = Main.expertMode ? 180 : 100; + npc.ai[0] = 1f; + npc.ai[1] = 180f; } - - if (npc.ai[1] >= 180f) - npc.ai[0] = 1f; } else if (npc.ai[0] == 1f) { @@ -89,18 +90,31 @@ namespace CalamityMod.NPCs.Ravager { npc.ai[1] -= 1f; npc.localAI[0] += 1f; - float SpeedY = -10f; - if (CalamityWorld.bossRushActive) - { - SpeedY *= 1.5f; - } - if (npc.localAI[0] % 45f == 0f) + if (npc.localAI[0] % (death ? 45f : 60f) == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = 45; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, SpeedY, ModContent.ProjectileType(), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + float speedY = -12f; + float speedX = 0f; + switch ((int)npc.ai[2]) + { + case 0: + break; + case 1: + speedX = 2f; + break; + case 2: + speedX = -2f; + break; + default: + break; + } + 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); } + npc.ai[2] += 1f; npc.localAI[0] = 0f; npc.netUpdate = true; } @@ -125,7 +139,7 @@ namespace CalamityMod.NPCs.Ravager 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, 4f + npc.gfxOffY); + 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); @@ -137,10 +151,9 @@ namespace CalamityMod.NPCs.Ravager return false; } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 5ae4393fd6..ca552a0409 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -1,9 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; @@ -35,60 +35,34 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.lavaImmune = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.lavaImmune = true; npc.noGravity = true; npc.npcSlots = 20f; npc.aiStyle = -1; - npc.damage = 120; - npc.width = 332; + npc.GetNPCDamage(); + npc.width = 332; npc.height = 214; npc.defense = 55; npc.value = Item.buyPrice(0, 25, 0, 0); - npc.DR_NERD(0.4f); - npc.LifeMaxNERB(42700, 53500, 4600000); - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) + npc.DR_NERD(0.35f); + npc.LifeMaxNERB(42700, 53500, 460000); + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage *= 2; + npc.damage = (int)(npc.damage * 1.5); npc.defense *= 2; - npc.lifeMax *= 7; + npc.lifeMax *= 5; npc.value *= 1.5f; } double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.boss = true; npc.alpha = 255; npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); - else - music = MusicID.Boss4; + music = CalamityMod.Instance.GetMusicFromMusicMod("Ravager") ?? MusicID.Boss4; bossBag = ModContent.ItemType(); } @@ -96,12 +70,16 @@ namespace CalamityMod.NPCs.Ravager { writer.Write(npc.dontTakeDamage); writer.Write(velocityY); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { npc.dontTakeDamage = reader.ReadBoolean(); velocityY = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); } public override void FindFrame(int frameHeight) @@ -114,16 +92,26 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + bool enraged = calamityGlobalNPC.enraged > 0; - // Large fire light - Lighting.AddLight((int)(npc.Center.X - 110f) / 16, (int)(npc.Center.Y - 30f) / 16, 0f, 0.5f, 2f); + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // 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); // Small fire light @@ -144,7 +132,7 @@ namespace CalamityMod.NPCs.Ravager if (npc.target >= 0 && Main.player[npc.target].dead) { - npc.TargetClosest(true); + npc.TargetClosest(); if (Main.player[npc.target].dead) npc.noTileCollide = true; } @@ -183,21 +171,27 @@ namespace CalamityMod.NPCs.Ravager bool immunePhase = headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive; bool finalPhase = !leftClawActive && !rightClawActive && !headActive && !leftLegActive && !rightLegActive && expertMode; - bool enrage = false; - if (player.position.Y + (player.height / 2) > npc.position.Y + (npc.height / 2) + 10f) - enrage = true; - - if (immunePhase) - npc.dontTakeDamage = true; - else - { - npc.dontTakeDamage = false; - if (Main.netMode != NetmodeID.Server) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) - Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); - } - } + if (immunePhase) + { + npc.dontTakeDamage = true; + if (malice) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) + Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + } + } + } + else + { + npc.dontTakeDamage = false; + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) + Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + } + } if (!headActive) { @@ -220,30 +214,6 @@ namespace CalamityMod.NPCs.Ravager rightDustExpr2.velocity.Y -= 4f; } } - - if (!finalPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += enrage ? 6f : 1f; - if (npc.localAI[1] >= 600f) - { - npc.localAI[1] = 0f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - float velocity = CalamityWorld.bossRushActive ? 10f : 7f; - int totalProjectiles = 8; - float radians = MathHelper.TwoPi / totalProjectiles; - int laserDamage = 45; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -velocity).RotatedBy(radians * i); - Projectile.NewProjectile(npc.Center, vector255, ProjectileID.EyeBeam, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } } if (!rightClawActive) @@ -267,23 +237,6 @@ namespace CalamityMod.NPCs.Ravager rightDustExpr2.velocity.X += 4f; } } - - if (!finalPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[2] += enrage ? 2f : 1f; - if (npc.localAI[2] >= 480f) - { - Main.PlaySound(SoundID.Item20, npc.position); - npc.localAI[2] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f); - int damage = 40; - float velocity = CalamityWorld.bossRushActive ? 18f : 12f; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, velocity, 0f, ProjectileID.Fireball, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } } if (!leftClawActive) @@ -306,23 +259,6 @@ namespace CalamityMod.NPCs.Ravager leftDustExpr2.velocity.X -= 4f; } } - - if (!finalPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[3] += enrage ? 2f : 1f; - if (npc.localAI[3] >= 480f) - { - Main.PlaySound(SoundID.Item20, npc.position); - npc.localAI[3] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f); - int damage = 40; - float velocity = CalamityWorld.bossRushActive ? -18f : -12f; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, velocity, 0f, ProjectileID.Fireball, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - } } if (!rightLegActive) @@ -345,22 +281,6 @@ namespace CalamityMod.NPCs.Ravager rightDustExpr2.velocity.Y += 1f; } } - - if (!finalPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= 300f) - { - npc.ai[2] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f); - int damage = 35; - int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, ProjectileID.GreekFire1 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[fire].timeLeft = 180; - } - } - } } if (!leftLegActive) @@ -384,22 +304,6 @@ namespace CalamityMod.NPCs.Ravager leftDustExpr2.velocity.Y += 1f; } } - - if (!finalPhase) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[3] += 1f; - if (npc.ai[3] >= 300f) - { - npc.ai[3] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f); - int damage = 35; - int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, ProjectileID.GreekFire1 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[fire].timeLeft = 180; - } - } - } } if (npc.ai[0] == 0f) @@ -415,43 +319,46 @@ namespace CalamityMod.NPCs.Ravager { if (revenge) { - if (npc.Calamity().newAI[0] % 3f == 0f) + if (calamityGlobalNPC.newAI[0] % 3f == 0f) npc.ai[1] += 1f; - else if (npc.Calamity().newAI[0] % 2f == 0f) + else if (calamityGlobalNPC.newAI[0] % 2f == 0f) npc.ai[1] += 1f; } - if ((!rightClawActive && !leftClawActive) || death || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if ((!rightClawActive && !leftClawActive) || enraged) npc.ai[1] += 1f; - if (!headActive || death || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (!headActive || enraged) npc.ai[1] += 1f; - if ((!rightLegActive && !leftLegActive) || death || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if ((!rightLegActive && !leftLegActive) || enraged) npc.ai[1] += 1f; } - if (npc.ai[1] >= 300f) + float jumpGateValue = 180f; + if (npc.ai[1] >= jumpGateValue) npc.ai[1] = -20f; else if (npc.ai[1] == -1f) { - npc.TargetClosest(true); + npc.TargetClosest(); bool shouldFall = player.position.Y >= npc.Bottom.Y; - float velocityXBoost = death ? 4f : 4f * (1f - lifeRatio); - float velocityX = ((enrage || npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8f : 4f) + velocityXBoost; + float velocityXBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityX = (enraged ? 8f : 4f) + velocityXBoost; velocityY = -16f; float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); if (revenge) { + float multiplier = malice ? 0.003f : 0.0015f; if (distanceBelowTarget > 0f) - npc.Calamity().newAI[1] += 1f + distanceBelowTarget * 0.001f; + calamityGlobalNPC.newAI[1] += 1f + distanceBelowTarget * multiplier; - if (npc.Calamity().newAI[1] > 2f) - npc.Calamity().newAI[1] = 2f; + float speedMultLimit = malice ? 4f : 3f; + if (calamityGlobalNPC.newAI[1] > speedMultLimit) + calamityGlobalNPC.newAI[1] = speedMultLimit; - if (npc.Calamity().newAI[1] > 1f) - velocityY *= npc.Calamity().newAI[1]; + if (calamityGlobalNPC.newAI[1] > 1f) + velocityY *= calamityGlobalNPC.newAI[1]; } if (expertMode && !finalPhase) @@ -460,13 +367,13 @@ namespace CalamityMod.NPCs.Ravager if (shouldFall) velocityY = 1f; - if (npc.Calamity().newAI[0] % 3f == 0f) + if (calamityGlobalNPC.newAI[0] % 3f == 0f) { velocityX *= 2f; if (!shouldFall) velocityY *= 0.5f; } - else if (npc.Calamity().newAI[0] % 2f == 0f) + else if (calamityGlobalNPC.newAI[0] % 2f == 0f) { velocityX *= 1.5f; if (!shouldFall) @@ -477,9 +384,12 @@ namespace CalamityMod.NPCs.Ravager if (finalPhase) { npc.noTileCollide = true; - npc.Calamity().newAI[2] = player.direction; + calamityGlobalNPC.newAI[2] = player.direction; } + float playerLocation = npc.Center.X - player.Center.X; + npc.direction = playerLocation < 0 ? 1 : -1; + npc.velocity.X = velocityX * npc.direction; npc.velocity.Y = velocityY; @@ -505,33 +415,36 @@ namespace CalamityMod.NPCs.Ravager { for (int i = 0; i < Main.maxNPCs; i++) { - 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; - } + 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].netUpdate = true; + } } int spawnDistance = 360; if (!NPC.AnyNPCs(ModContent.NPCType())) { - NPC.NewNPC((int)npc.Center.X - spawnDistance, (int)npc.Center.Y - 10, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X + spawnDistance, (int)npc.Center.Y - 10, ModContent.NPCType()); + NPC.NewNPC((int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); + NPC.NewNPC((int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); } else if (!NPC.AnyNPCs(ModContent.NPCType())) { - NPC.NewNPC((int)npc.Center.X - spawnDistance * 2, (int)npc.Center.Y - 10, ModContent.NPCType()); - NPC.NewNPC((int)npc.Center.X + spawnDistance * 2, (int)npc.Center.Y - 10, ModContent.NPCType()); + float distanceMultiplier = finalPhase ? 2.5f : 2f; + NPC.NewNPC((int)player.Center.X - (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); + NPC.NewNPC((int)player.Center.X + (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); } } } if (revenge) - npc.Calamity().newAI[0] += 1f; + calamityGlobalNPC.newAI[0] += 1f; - npc.Calamity().newAI[1] = 0f; - npc.Calamity().newAI[3] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) { @@ -547,8 +460,6 @@ namespace CalamityMod.NPCs.Ravager } else { - npc.TargetClosest(true); - // Fall through if (!player.dead && expertMode) { @@ -556,16 +467,20 @@ namespace CalamityMod.NPCs.Ravager 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; + + // Prevent falling forever in second phase + if (npc.ai[0] == 2f && npc.velocity.Y > 0f && npc.Top.Y > Main.player[npc.target].Bottom.Y + 16f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.noTileCollide = false; } Vector2 targetVector = player.position; - float aimY = targetVector.Y - 480f; + float aimY = targetVector.Y - 640f; float distanceFromTargetPos = Math.Abs(npc.Top.Y - aimY); - bool inRange = npc.Top.Y <= aimY + 16f && npc.Top.Y >= aimY - 16f; + bool inRange = npc.Top.Y <= aimY + 160f && npc.Top.Y >= aimY - 16f; if (npc.ai[0] == 2f && npc.ai[1] == 0f) { - npc.Calamity().newAI[3] += 1f; + calamityGlobalNPC.newAI[3] += 1f; if (inRange) npc.velocity.Y = 0f; @@ -580,22 +495,24 @@ namespace CalamityMod.NPCs.Ravager npc.velocity.Y = -velocityY; } - float maxOffset = 160f + (death ? 160f : 160f * (1f - lifeRatio)); - float offset = npc.ai[0] == 2f ? maxOffset * npc.Calamity().newAI[2] : 0f; + float maxOffset = death ? 320f * (1f - lifeRatio) : 240f * (1f - lifeRatio); + float offset = npc.ai[0] == 2f ? maxOffset * calamityGlobalNPC.newAI[2] : 0f; // Set offset to 0 if the target stops moving if (Math.Abs(player.velocity.X) < 0.5f) - npc.Calamity().newAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; else - npc.Calamity().newAI[2] = player.direction; + 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 || npc.Calamity().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; + if (npc.ai[0] == 2f) { - float stopBeforeFallTime = npc.Calamity().newAI[2] == 0f ? 15f : 20f; + float stopBeforeFallTime = malice ? 25f : 30f; if (expertMode) - stopBeforeFallTime -= death ? 5f : 5f * (1f - lifeRatio); + stopBeforeFallTime -= death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); if (npc.ai[1] < stopBeforeFallTime) { @@ -604,11 +521,11 @@ namespace CalamityMod.NPCs.Ravager } else { - float fallSpeedBoost = death ? 1.2f : 1.2f * (1f - lifeRatio); - float fallSpeed = 1.2f + fallSpeedBoost; + float fallSpeedBoost = death ? 1.8f * (1f - lifeRatio) : 1.2f * (1f - lifeRatio); + float fallSpeed = (malice ? 1.8f : 1.2f) + fallSpeedBoost; - if (npc.Calamity().newAI[1] > 1f) - fallSpeed *= npc.Calamity().newAI[1]; + if (calamityGlobalNPC.newAI[1] > 1f) + fallSpeed *= calamityGlobalNPC.newAI[1]; npc.velocity.Y += fallSpeed; @@ -621,11 +538,11 @@ namespace CalamityMod.NPCs.Ravager if (npc.Bottom.Y < player.position.Y) { - float fallSpeedBoost = death ? 0.6f : 0.6f * (1f - lifeRatio); - float fallSpeed = 0.6f + fallSpeedBoost; + float fallSpeedBoost = death ? 0.9f * (1f - lifeRatio) : 0.6f * (1f - lifeRatio); + float fallSpeed = (malice ? 0.9f : 0.6f) + fallSpeedBoost; - if (npc.Calamity().newAI[1] > 1f) - fallSpeed *= npc.Calamity().newAI[1]; + if (calamityGlobalNPC.newAI[1] > 1f) + fallSpeed *= calamityGlobalNPC.newAI[1]; npc.velocity.Y += fallSpeed; } @@ -633,36 +550,37 @@ namespace CalamityMod.NPCs.Ravager } else { - float velocityMult = 1.8f; + float velocityMult = malice ? 2f : 1.8f; float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; + float velocityXBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + float velocityX = 8f + velocityXBoost + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; + + if (enraged) + velocityX += 3f; + if (!rightClawActive) + velocityX += 1f; + if (!leftClawActive) + velocityX += 1f; + if (!headActive) + velocityX += 1f; + if (!rightLegActive) + velocityX += 1f; + if (!leftLegActive) + velocityX += 1f; + if (npc.ai[0] == 2f) + { + npc.damage = 0; velocityXChange *= velocityMult; + velocityX *= velocityMult; + } if (npc.direction < 0) npc.velocity.X -= velocityXChange; else if (npc.direction > 0) npc.velocity.X += velocityXChange; - float velocityXBoost = death ? 4f : 4f * (1f - lifeRatio); - float velocityX = 8f + velocityXBoost + Math.Abs(npc.Center.X - player.Center.X) * 0.001f; - - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - velocityX += 3f; - if (!rightClawActive || death) - velocityX += 1f; - if (!leftClawActive || death) - velocityX += 1f; - if (!headActive || death) - velocityX += 1f; - if (!rightLegActive || death) - velocityX += 1f; - if (!leftLegActive || death) - velocityX += 1f; - - if (npc.ai[0] == 2f) - velocityX *= velocityMult; - if (npc.velocity.X < -velocityX) npc.velocity.X = -velocityX; if (npc.velocity.X > velocityX) @@ -675,24 +593,16 @@ namespace CalamityMod.NPCs.Ravager void CustomGravity() { - float gravity = npc.ai[0] == 2f ? 0f : 0.3f; - float maxFallSpeed = npc.ai[0] == 2f ? 24f : 10f; - if (npc.wet) + float gravity = npc.ai[0] == 2f ? 0f : 0.45f; + float maxFallSpeed = npc.ai[0] == 2f ? 24f : 15f; + if (malice) { - if (npc.honeyWet) - { - gravity *= 0.33f; - maxFallSpeed *= 0.4f; - } - else - { - gravity *= 0.66f; - maxFallSpeed *= 0.7f; - } + gravity *= 1.25f; + maxFallSpeed *= 1.25f; } - if (npc.Calamity().newAI[1] > 1f) - maxFallSpeed *= npc.Calamity().newAI[1]; + if (calamityGlobalNPC.newAI[1] > 1f) + maxFallSpeed *= calamityGlobalNPC.newAI[1]; npc.velocity.Y += gravity; if (npc.velocity.Y > maxFallSpeed) @@ -731,7 +641,7 @@ namespace CalamityMod.NPCs.Ravager 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, 0f + 4f + npc.gfxOffY); + 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); @@ -753,7 +663,7 @@ namespace CalamityMod.NPCs.Ravager public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -780,10 +690,6 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 600, true); - } player.AddBuff(ModContent.BuffType(), 300, true); } @@ -797,9 +703,11 @@ namespace CalamityMod.NPCs.Ravager { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + // Legendary drop for Ravager + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedScavenger); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedScavenger, 4, 2, 1); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.WitchDoctor }, CalamityWorld.downedScavenger); @@ -811,7 +719,7 @@ namespace CalamityMod.NPCs.Ravager DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedProvidence); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -830,7 +738,7 @@ namespace CalamityMod.NPCs.Ravager // Mark Ravager as dead CalamityWorld.downedScavenger = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } } } diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 75b6fbe069..55e9e95a87 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,56 +19,34 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.lavaImmune = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.lavaImmune = true; npc.aiStyle = -1; - npc.damage = 80; - npc.width = 80; + npc.GetNPCDamage(); + npc.width = 80; npc.height = 40; npc.defense = 40; - npc.DR_NERD(0.1f); + npc.DR_NERD(0.15f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage = 200; - npc.defense = 120; - npc.lifeMax = 100000; + npc.damage = (int)(npc.damage * 1.5); + npc.defense *= 2; + npc.lifeMax *= 5; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 260000; + npc.lifeMax = 26000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); } public override void AI() @@ -78,7 +57,7 @@ namespace CalamityMod.NPCs.Ravager npc.netUpdate = true; return; } - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; if (npc.timeLeft < 1800) { npc.timeLeft = 1800; @@ -95,31 +74,18 @@ namespace CalamityMod.NPCs.Ravager if (npc.ai[0] == 0f) { npc.noTileCollide = true; - float num659 = 21f; - if (npc.life < npc.lifeMax / 2 || death) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 3 || death) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 5 || death) - { - num659 += 1f; - } - Vector2 vector79 = new Vector2(npc.Center.X, npc.Center.Y); + float num659 = 36f; + 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; - num661 += 50f; - num660 -= 120f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + num660 -= 120f; + num661 += 50f; + float num662 = (float)Math.Sqrt(num660 * num660 + num661 * num661); if (num662 < 12f + num659) { npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; + 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; @@ -134,8 +100,15 @@ namespace CalamityMod.NPCs.Ravager } if (npc.ai[1] >= 60f) { - npc.TargetClosest(true); - if (npc.Center.X + 100f > Main.player[npc.target].Center.X) + // Get a target + 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 (npc.Center.X + 100f > Main.player[npc.target].Center.X) { npc.ai[1] = 0f; npc.ai[0] = 1f; @@ -150,7 +123,7 @@ namespace CalamityMod.NPCs.Ravager 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); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); } } else if (npc.ai[0] == 1f) @@ -174,12 +147,12 @@ namespace CalamityMod.NPCs.Ravager 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)); + 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((double)-(double)npc.velocity.Y, (double)-(double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); } else if (npc.ai[0] == 2f) { @@ -212,8 +185,8 @@ namespace CalamityMod.NPCs.Ravager num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; num668 += 40f; num667 -= 110f; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + float num669 = (float)Math.Sqrt(num667 * num667 + num668 * num668); + if ((num669 > (death ? 900f : 700f) || npc.collideX || npc.collideY) | npc.justHit) { npc.noTileCollide = true; npc.ai[0] = 0f; @@ -227,7 +200,7 @@ namespace CalamityMod.NPCs.Ravager 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)); + float num675 = (float)Math.Sqrt(num673 * num673 + num674 * num674); num675 = num671 / num675; num673 *= num675; num674 *= num675; @@ -263,7 +236,7 @@ namespace CalamityMod.NPCs.Ravager 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(-npc.velocity.Y, -npc.velocity.X); } } @@ -274,11 +247,11 @@ namespace CalamityMod.NPCs.Ravager float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; drawPositionY += 12f; drawPositionX -= 28f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + float rotation = (float)Math.Atan2(drawPositionY, drawPositionX) - MathHelper.PiOver2; bool draw = true; while (draw) { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + float totalDrawDistance = (float)Math.Sqrt(drawPositionX * drawPositionX + drawPositionY * drawPositionY); if (totalDrawDistance < 16f) { draw = false; @@ -297,7 +270,7 @@ namespace CalamityMod.NPCs.Ravager 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((float)ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, (float)ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; @@ -308,17 +281,8 @@ namespace CalamityMod.NPCs.Ravager return false; } - public override bool PreNPCLoot() - { - return false; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } player.AddBuff(ModContent.BuffType(), 180, true); } @@ -327,9 +291,9 @@ namespace CalamityMod.NPCs.Ravager if (npc.life > 0) { int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + while (num285 < damage / 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, hitDirection, -1f, 0, default, 1f); num285++; } } diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index caeafb145c..1d20291d29 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -18,57 +19,34 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.lavaImmune = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.lavaImmune = true; npc.aiStyle = -1; - npc.damage = 88; - npc.width = 80; + npc.GetNPCDamage(); + npc.width = 80; npc.height = 40; npc.defense = 40; - npc.DR_NERD(0.1f); + npc.DR_NERD(0.15f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; - npc.value = Item.buyPrice(0, 0, 0, 0); npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.damage = 200; - npc.defense = 120; - npc.lifeMax = 100000; + npc.damage = (int)(npc.damage * 1.5); + npc.defense *= 2; + npc.lifeMax *= 5; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 260000; + npc.lifeMax = 26000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); } public override void AI() @@ -79,7 +57,7 @@ namespace CalamityMod.NPCs.Ravager npc.netUpdate = true; return; } - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; if (npc.timeLeft < 1800) { npc.timeLeft = 1800; @@ -96,31 +74,18 @@ namespace CalamityMod.NPCs.Ravager if (npc.ai[0] == 0f) { npc.noTileCollide = true; - float num659 = 21f; - if (npc.life < npc.lifeMax / 2 || death) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 3 || death) - { - num659 += 1f; - } - if (npc.life < npc.lifeMax / 5 || death) - { - num659 += 1f; - } + float num659 = 36f; 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; - num661 += 50f; - num660 += 120f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); + num660 += 120f; + num661 += 50f; + float num662 = (float)Math.Sqrt(num660 * num660 + num661 * num661); if (num662 < 12f + num659) { npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - npc.ai[1] += 1f; + 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; @@ -131,12 +96,19 @@ namespace CalamityMod.NPCs.Ravager } if (npc.life < npc.lifeMax / 5 || death) { - npc.ai[1] += 10f; + npc.ai[1] += 5f; } if (npc.ai[1] >= 60f) { - npc.TargetClosest(true); - if (npc.Center.X - 100f < Main.player[npc.target].Center.X) + // Get a target + 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 (npc.Center.X - 100f < Main.player[npc.target].Center.X) { npc.ai[1] = 0f; npc.ai[0] = 1f; @@ -151,7 +123,7 @@ namespace CalamityMod.NPCs.Ravager num662 = num659 / num662; npc.velocity.X = num660 * num662; npc.velocity.Y = num661 * num662; - npc.rotation = (float)Math.Atan2((double)-(double)npc.velocity.Y, (double)-(double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); } } else if (npc.ai[0] == 1f) @@ -162,25 +134,25 @@ namespace CalamityMod.NPCs.Ravager float num663 = 12f; if (npc.life < npc.lifeMax / 2 || death) { - num663 += 4f; + num663 += 2f; } if (npc.life < npc.lifeMax / 3 || death) { - num663 += 4f; + num663 += 2f; } if (npc.life < npc.lifeMax / 5 || death) { - num663 += 10f; + 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; - float num666 = (float)Math.Sqrt((double)(num664 * num664 + num665 * num665)); + 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((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); } else if (npc.ai[0] == 2f) { @@ -213,8 +185,8 @@ namespace CalamityMod.NPCs.Ravager num668 += Main.npc[CalamityGlobalNPC.scavenger].velocity.Y; num668 += 40f; num667 += 110f; - float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + float num669 = (float)Math.Sqrt(num667 * num667 + num668 * num668); + if ((num669 > (death ? 900f : 700f) || npc.collideX || npc.collideY) | npc.justHit) { npc.noTileCollide = true; npc.ai[0] = 0f; @@ -228,7 +200,7 @@ namespace CalamityMod.NPCs.Ravager 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)); + float num675 = (float)Math.Sqrt(num673 * num673 + num674 * num674); num675 = num671 / num675; num673 *= num675; num674 *= num675; @@ -264,7 +236,7 @@ namespace CalamityMod.NPCs.Ravager npc.velocity.Y -= num672 * 2f; } } - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); } } @@ -275,11 +247,11 @@ namespace CalamityMod.NPCs.Ravager float drawPositionY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; drawPositionY += 12f; drawPositionX += 28f; - float rotation = (float)Math.Atan2((double)drawPositionY, (double)drawPositionX) - 1.57f; + float rotation = (float)Math.Atan2(drawPositionY, drawPositionX) - MathHelper.PiOver2; bool draw = true; while (draw) { - float totalDrawDistance = (float)Math.Sqrt((double)(drawPositionX * drawPositionX + drawPositionY * drawPositionY)); + float totalDrawDistance = (float)Math.Sqrt(drawPositionX * drawPositionX + drawPositionY * drawPositionY); if (totalDrawDistance < 16f) { draw = false; @@ -298,7 +270,7 @@ namespace CalamityMod.NPCs.Ravager 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((float)ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, (float)ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); + new Vector2(ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Width * 0.5f, ModContent.GetTexture("CalamityMod/NPCs/Ravager/RavagerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; @@ -309,17 +281,8 @@ namespace CalamityMod.NPCs.Ravager return false; } - public override bool PreNPCLoot() - { - return false; - } - public override void OnHitPlayer(Player player, int damage, bool crit) { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } player.AddBuff(ModContent.BuffType(), 180, true); } @@ -328,9 +291,9 @@ namespace CalamityMod.NPCs.Ravager if (npc.life > 0) { int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + while (num285 < damage / 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, hitDirection, -1f, 0, default, 1f); num285++; } } diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index ce7be0104a..ac44e85e91 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -22,34 +23,11 @@ namespace CalamityMod.NPCs.Ravager npc.damage = 0; npc.width = 80; npc.height = 80; - npc.defense = 50; - npc.DR_NERD(0.1f); + npc.defense = 40; + npc.DR_NERD(0.15f); npc.lifeMax = 32705; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.noTileCollide = true; @@ -57,99 +35,76 @@ namespace CalamityMod.NPCs.Ravager npc.value = Item.buyPrice(0, 0, 0, 0); npc.HitSound = SoundID.NPCHit41; npc.DeathSound = null; - if (CalamityWorld.downedProvidence) + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense = 150; - npc.lifeMax = 260000; + npc.defense *= 2; + npc.lifeMax *= 5; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 450000; + npc.lifeMax = 45000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); } public override void AI() { - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - Player player = Main.player[npc.target]; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool death = CalamityWorld.death || malice; + + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { npc.active = false; npc.netUpdate = true; return; } + if (npc.timeLeft < 1800) - { npc.timeLeft = 1800; - } - float speed = 21f; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float centerX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float centerY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - centerY -= 20f; - centerX += 1f; - float totalSpeed = (float)Math.Sqrt((double)(centerX * centerX + centerY * centerY)); - if (totalSpeed < 20f) - { - npc.rotation = 0f; - npc.velocity.X = centerX; - npc.velocity.Y = centerY; - } - else - { - totalSpeed = speed / totalSpeed; - npc.velocity.X = centerX * totalSpeed; - npc.velocity.Y = centerY * totalSpeed; - npc.rotation = npc.velocity.X * 0.1f; - } + + npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(1f, -20f); + if (npc.alpha > 0) { npc.alpha -= 10; if (npc.alpha < 0) - { npc.alpha = 0; - } - npc.ai[1] = 30f; } + npc.ai[1] += 1f; - int nukeTimer = 450; - if (npc.ai[1] >= (float)nukeTimer) + if (npc.ai[1] >= (death ? 420f : 480f)) { Main.PlaySound(SoundID.Item62, npc.position); - npc.TargetClosest(true); - npc.ai[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float nukeSpeed = 1f; - float playerDistanceX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - float playerDistanceY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; - float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - totalPlayerDistance = nukeSpeed / totalPlayerDistance; - playerDistanceX *= totalPlayerDistance; - playerDistanceY *= totalPlayerDistance; - int nukeDamage = expertMode ? 45 : 60; - int projectileType = ModContent.ProjectileType(); - if (Main.netMode != NetmodeID.MultiplayerClient) + + // Get a target + 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(); + + npc.ai[1] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) { - int nuke = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerDistanceX, playerDistanceY, projectileType, nukeDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + 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); Main.projectile[nuke].velocity.Y = -15f; } } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.life > 0) { diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index c0975bb99f..98ecbe1d8a 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -24,10 +25,6 @@ namespace CalamityMod.NPCs.Ravager npc.lifeMax = 100; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontTakeDamage = true; npc.noGravity = true; npc.noTileCollide = true; @@ -37,7 +34,6 @@ namespace CalamityMod.NPCs.Ravager public override void AI() { - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { npc.dontTakeDamage = false; @@ -46,213 +42,139 @@ namespace CalamityMod.NPCs.Ravager npc.netUpdate = true; return; } - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } + + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool provy = CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive; + if (npc.timeLeft < 1800) - { npc.timeLeft = 1800; - } - float num = 5f; - float num2 = 0.1f; - 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); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) + + // Get a target + 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(); + + // Target variable + Player player = Main.player[npc.target]; + + // 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 num803 = (float)Math.Atan2(num802, num801) + MathHelper.PiOver2; + if (num803 < 0f) + num803 += MathHelper.TwoPi; + else if (num803 > MathHelper.TwoPi) + num803 -= MathHelper.TwoPi; + + float num804 = 0.1f; + if (npc.rotation < num803) + { + if ((num803 - npc.rotation) > MathHelper.Pi) + npc.rotation -= num804; + else + npc.rotation += num804; + } + else if (npc.rotation > num803) + { + if ((npc.rotation - num803) > MathHelper.Pi) + npc.rotation += num804; + else + 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; + + npc.ai[1] += 1f; + bool fireProjectiles = npc.ai[1] >= (malice ? 240f : 480f); + if (fireProjectiles && Vector2.Distance(npc.Center, player.Center) > 80f) { - flag = true; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float projectileVelocity = death ? 8f : 6f; + + if (npc.ai[1] >= 600f) + { + npc.ai[0] += 1f; + npc.ai[1] = 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); + } + } + else + { + 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); + } + } + } } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y += 0.023f; - } - else - { - npc.velocity.Y -= 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X += 0.023f; - } - else - { - npc.velocity.X -= 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X += num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X -= num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y += num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y -= num2; - } - npc.ai[1] += 1f; - int nukeTimer = 720; - if (npc.ai[1] >= (float)nukeTimer) - { - Main.PlaySound(SoundID.Item62, npc.position); - npc.TargetClosest(true); - npc.ai[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y); - float nukeSpeed = 1f; - float playerDistanceX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X; - float playerDistanceY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y; - float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - totalPlayerDistance = nukeSpeed / totalPlayerDistance; - playerDistanceX *= totalPlayerDistance; - playerDistanceY *= totalPlayerDistance; - int nukeDamage = Main.expertMode ? 45 : 60; - int projectileType = ModContent.ProjectileType(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerDistanceX, playerDistanceY, projectileType, nukeDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - npc.localAI[0] += 1f; - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.3 || death) - { - npc.localAI[0] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.1 || death) - { - npc.localAI[0] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.5 || death) - { - npc.localAI[1] += 1f; - } - if ((double)Main.npc[CalamityGlobalNPC.scavenger].life < (double)Main.npc[CalamityGlobalNPC.scavenger].lifeMax * 0.25 || death) - { - npc.localAI[1] += 1f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 900f) - { - 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.Item33, npc.position); - int num8 = 40; - int num9 = ModContent.ProjectileType(); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[1] >= 30f) - { - npc.localAI[1] = 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 = 45; - int num9 = 259; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8 + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - 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); - } - if (num4 > 0f) - { - 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; - } - float num12 = 0.7f; - 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.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - 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.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X *= 1.05f; - } - } - else - { - 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) - { - npc.netUpdate = true; - } - } + + float num823 = 22f; + float num824 = 0.3f; + if (death) + { + num823 += 4f; + num824 += 0.05f; + } + if (provy) + { + num823 *= 1.25f; + num824 *= 1.25f; + } + + 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; + float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num823 / num827; + num825 *= num827; + num826 *= num827; + + if (npc.velocity.X < num825) + { + npc.velocity.X += num824; + if (npc.velocity.X < 0f && num825 > 0f) + npc.velocity.X += num824; + } + else if (npc.velocity.X > num825) + { + npc.velocity.X -= num824; + if (npc.velocity.X > 0f && num825 < 0f) + npc.velocity.X -= num824; + } + if (npc.velocity.Y < num826) + { + npc.velocity.Y += num824; + if (npc.velocity.Y < 0f && num826 > 0f) + npc.velocity.Y += num824; + } + else if (npc.velocity.Y > num826) + { + npc.velocity.Y -= num824; + if (npc.velocity.Y > 0f && num826 < 0f) + npc.velocity.Y -= num824; + } + } public override void HitEffect(int hitDirection, double damage) { @@ -274,14 +196,8 @@ namespace CalamityMod.NPCs.Ravager } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; } } diff --git a/NPCs/Ravager/RavagerHead2.png b/NPCs/Ravager/RavagerHead2.png index 36ad4f6af2..8dd00ee93d 100644 Binary files a/NPCs/Ravager/RavagerHead2.png and b/NPCs/Ravager/RavagerHead2.png differ diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 33f5f05a1c..4cc66e6863 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -26,103 +27,50 @@ namespace CalamityMod.NPCs.Ravager npc.lifeMax = 22010; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.noTileCollide = true; npc.alpha = 255; npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense = 135; - npc.lifeMax = 200000; + npc.defense *= 2; + npc.lifeMax *= 5; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); } public override void AI() { - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - Vector2 center = npc.Center; if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { npc.active = false; npc.netUpdate = true; return; } + if (npc.timeLeft < 1800) - { npc.timeLeft = 1800; - } + if (npc.alpha > 0) { npc.alpha -= 10; if (npc.alpha < 0) - { npc.alpha = 0; - } + npc.ai[1] = 0f; } - if (npc.ai[0] == 0f) - { - float num659 = 21f; - Vector2 vector79 = new Vector2(center.X, center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 88f; - num660 -= 70f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - } - } + + npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(-70f, 88f); } - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } + public override bool CheckActive() => false; public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index c3d8445d1f..0ef017fb54 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -26,103 +27,50 @@ namespace CalamityMod.NPCs.Ravager npc.lifeMax = 22010; npc.knockBackResist = 0f; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Frostburn] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.DryadsWardDebuff] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.noTileCollide = true; npc.alpha = 255; npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - if (CalamityWorld.downedProvidence) + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) { - npc.defense = 135; - npc.lifeMax = 200000; + npc.defense *= 2; + npc.lifeMax *= 5; } - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 400000; + npc.lifeMax = 40000; } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); } public override void AI() { - bool provy = CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive; - Vector2 center = npc.Center; - if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 0f; - } - if (npc.ai[0] == 0f) - { - float num659 = 21f; - Vector2 vector79 = new Vector2(center.X, center.Y); - float num660 = Main.npc[CalamityGlobalNPC.scavenger].Center.X - vector79.X; - float num661 = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - vector79.Y; - num661 += 88f; - num660 += 70f; - float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) - { - npc.rotation = 0f; - npc.velocity.X = num660; - npc.velocity.Y = num661; - } - else - { - num662 = num659 / num662; - npc.velocity.X = num660 * num662; - npc.velocity.Y = num661 * num662; - } - } - } + if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } - public override bool CheckActive() - { - return false; + if (npc.timeLeft < 1800) + npc.timeLeft = 1800; + + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; + + npc.ai[1] = 0f; + } + + npc.Center = Main.npc[CalamityGlobalNPC.scavenger].Center + new Vector2(70f, 88f); } - public override bool PreNPCLoot() - { - return false; - } + public override bool CheckActive() => false; public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 2be41e47b4..09f1be63ce 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -1,7 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,19 +17,18 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { - npc.damage = 0; - npc.width = 60; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 60; npc.height = 300; - npc.DR_NERD(0.5f); - npc.lifeMax = CalamityWorld.downedProvidence ? 35000 : 5000; + npc.defense = 50; + npc.DR_NERD(0.3f); + npc.chaseable = false; + npc.lifeMax = CalamityWorld.downedProvidence ? 22750 : 5000; npc.alpha = 255; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; } @@ -45,34 +44,23 @@ namespace CalamityMod.NPCs.Ravager } if (npc.timeLeft < 1800) - { npc.timeLeft = 1800; - } if (npc.alpha > 0) { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + npc.damage = 0; - if (Math.Abs(npc.velocity.X) > 0.5f) - { - if (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive) - { - npc.damage = 400; - } - else - { - npc.damage = Main.expertMode ? 200 : 120; - } + npc.alpha -= 10; + if (npc.alpha < 0) + npc.alpha = 0; } else { - npc.damage = 0; - } + if (CalamityWorld.downedProvidence && !BossRushEvent.BossRushActive) + npc.damage = (int)(npc.defDamage * 1.5); + else + npc.damage = npc.defDamage; + } if (npc.ai[0] == 0f) { @@ -102,7 +90,7 @@ namespace CalamityMod.NPCs.Ravager } npc.noTileCollide = true; - npc.velocity.X = 12 * npc.direction; + npc.velocity.X = (CalamityWorld.malice ? 15 : 12) * npc.direction; npc.velocity.Y = -28.5f; npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -130,14 +118,18 @@ namespace CalamityMod.NPCs.Ravager } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; 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; } public override void HitEffect(int hitDirection, double damage) @@ -168,7 +160,20 @@ namespace CalamityMod.NPCs.Ravager 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 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); + } + } else { for (int num621 = 0; num621 < 2; num621++) diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 376ef858f0..b0206589a0 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,8 +22,8 @@ namespace CalamityMod.NPCs.Signus { npc.aiStyle = -1; aiType = -1; - npc.damage = 110; - npc.width = 25; + npc.GetNPCDamage(); + npc.width = 25; npc.height = 25; npc.defense = 50; npc.lifeMax = 25; @@ -33,10 +34,6 @@ namespace CalamityMod.NPCs.Signus npc.chaseable = false; npc.canGhostHeal = false; npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.HitSound = SoundID.NPCHit53; npc.DeathSound = SoundID.NPCDeath44; } @@ -81,7 +78,7 @@ namespace CalamityMod.NPCs.Signus bool revenge = CalamityWorld.revenge; float playerDistNormMult = revenge ? 24f : 22f; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive || CalamityWorld.malice) playerDistNormMult = 30f; CalamityAI.DungeonSpiritAI(npc, mod, playerDistNormMult, 0f, true); } @@ -108,14 +105,14 @@ namespace CalamityMod.NPCs.Signus 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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"); @@ -131,7 +128,7 @@ namespace CalamityMod.NPCs.Signus 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -141,17 +138,9 @@ namespace CalamityMod.NPCs.Signus return false; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - } - } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 0; + cooldownSlot = 1; return npc.alpha == 0; } diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index a2404f48ce..c2734c6dd4 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -1,11 +1,12 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; -using CalamityMod.Items.Accessories; +using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Boss; @@ -22,9 +23,6 @@ namespace CalamityMod.NPCs.Signus [AutoloadBossHead] public class Signus : ModNPC { - private int phaseSwitch = 0; - private int chargeSwitch = 0; - private int dustTimer = 3; private int spawnX = 750; private int spawnY = 120; private int lifeToAlpha = 0; @@ -38,98 +36,98 @@ namespace CalamityMod.NPCs.Signus public override void SetDefaults() { - npc.npcSlots = 32f; - npc.damage = 175; - npc.width = 130; + npc.Calamity().canBreakPlayerDefense = true; + npc.npcSlots = 32f; + npc.GetNPCDamage(); + npc.width = 130; npc.height = 130; - npc.defense = 70; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss4; + npc.defense = 60; + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; - npc.LifeMaxNERB(notDoGFight ? 280000 : 70000, notDoGFight ? 445500 : 109500, 2400000); + npc.LifeMaxNERB(notDoGFight ? 224000 : 56000, notDoGFight ? 356400 : 87600, 240000); + + // If fought alone, Signus plays his own theme if (notDoGFight) { npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Signus"); - else - music = MusicID.Boss4; + music = CalamityMod.Instance.GetMusicFromMusicMod("Signus") ?? MusicID.Boss4; } + // If fought as a DoG interlude, keep the DoG music playing + else + 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; aiType = -1; npc.boss = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.StardustMinionBleed] = false; - npc.buffImmune[BuffID.Oiled] = false; - npc.buffImmune[BuffID.BetsysCurse] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; npc.HitSound = SoundID.NPCHit49; npc.DeathSound = SoundID.NPCDeath51; + bossBag = ModContent.ItemType(); } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(phaseSwitch); - writer.Write(chargeSwitch); - writer.Write(dustTimer); writer.Write(spawnX); writer.Write(spawnY); writer.Write(lifeToAlpha); - } + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { - phaseSwitch = reader.ReadInt32(); - chargeSwitch = reader.ReadInt32(); - dustTimer = reader.ReadInt32(); spawnX = reader.ReadInt32(); spawnY = reader.ReadInt32(); lifeToAlpha = reader.ReadInt32(); - } + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.signus = npc.whoAmI; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; Vector2 vectorCenter = npc.Center; double lifeRatio = npc.life / (double)npc.lifeMax; - lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); - bool phase2 = (lifeRatio < 0.75f && expertMode) || death; - bool phase3 = lifeRatio < 0.5f || death; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + lifeToAlpha = (int)(100.0 * (1.0 - lifeRatio)); + int maxCharges = death ? 1 : revenge ? 2 : expertMode ? 3 : 4; + int maxTeleports = (death && lifeRatio < 0.9) ? 1 : revenge ? 2 : expertMode ? 3 : 4; + float inertia = enraged ? 8f : malice ? 9f : death ? 10f : revenge ? 11f : expertMode ? 12f : 14f; + float chargeVelocity = enraged ? 18f : malice ? 16f : death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; + bool phase2 = lifeRatio < 0.75f && expertMode; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.33f; + + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + npc.damage = npc.defDamage; // Get a 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 == 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(); Player player = Main.player[npc.target]; @@ -168,8 +166,8 @@ namespace CalamityMod.NPCs.Signus npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - phaseSwitch = 0; - chargeSwitch = 0; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; spawnY = 120; npc.netUpdate = true; } @@ -179,9 +177,6 @@ namespace CalamityMod.NPCs.Signus else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float num1000 = expertMode ? 11f : 13f; - float num1006 = 0.111111117f * num1000; - if (lifeToAlpha < 50 && npc.ai[0] != 1f) { for (int num1011 = 0; num1011 < 2; num1011++) @@ -209,12 +204,9 @@ namespace CalamityMod.NPCs.Signus if (phase3 || revenge) npc.knockBackResist = 0f; - float speed = expertMode ? 14f : 12f; + float speed = enraged ? 24f : malice ? 20f : revenge ? 15f : expertMode ? 14f : 12f; if (expertMode) - speed += death ? 4f : 4f * (float)(1D - lifeRatio); - - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - speed += 3f; + speed += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); float num795 = player.Center.X - vectorCenter.X; float num796 = player.Center.Y - vectorCenter.Y; @@ -226,22 +218,37 @@ namespace CalamityMod.NPCs.Signus npc.velocity.Y = (npc.velocity.Y * 50f + num796) / 51f; } else - { npc.knockBackResist = 0f; - } - if (npc.ai[0] == 0f) + + 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); + + npc.ai[0] = phase; + npc.ai[1] = 0f; + + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] += 1f; + npc.localAI[1] += enraged ? 2f : malice ? 1.5f : 1f; if (expertMode) - npc.localAI[1] += death ? 2f : 2f * (float)(1D - lifeRatio); + npc.localAI[1] += death ? 3f * (float)(1D - lifeRatio) : 2f * (float)(1D - lifeRatio); if (npc.localAI[1] >= 120f) { npc.localAI[1] = 0f; - npc.TargetClosest(true); + + npc.TargetClosest(); + int num1249 = 0; int num1250; int num1251; @@ -270,10 +277,13 @@ namespace CalamityMod.NPCs.Signus if (num1249 > 100) return; } + npc.ai[0] = 1f; npc.ai[1] = num1250; npc.ai[2] = num1251; + npc.netUpdate = true; + return; } } @@ -288,21 +298,26 @@ namespace CalamityMod.NPCs.Signus Main.dust[dust].fadeIn = 1f; } - npc.alpha += 2; + npc.alpha += malice ? 3 : 2; if (expertMode) - npc.alpha += death ? 2 : (int)(3D * (1D - lifeRatio)); + npc.alpha += death ? (int)Math.Round(4.5D * (1D - lifeRatio)) : (int)Math.Round(3D * (1D - lifeRatio)); if (npc.alpha >= 255) { Main.PlaySound(SoundID.Item8, vectorCenter); + npc.alpha = 255; + npc.position = position; + for (int n = 0; n < 15; n++) { int num39 = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 90, default, 3f); Main.dust[num39].noGravity = true; } + npc.ai[0] = 2f; + npc.netUpdate = true; } } @@ -313,17 +328,16 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient && revenge) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 122); - int num660 = NPC.NewNPC((int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + Main.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) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - int num661 = NPC.NewNPC((int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + + int num661 = NPC.NewNPC((int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - } + 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -343,6 +357,7 @@ namespace CalamityMod.NPCs.Signus Main.dust[num623].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + 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.PurpleCosmolite, 0f, 0f, 100, default, 3f); @@ -357,11 +372,12 @@ namespace CalamityMod.NPCs.Signus Main.dust[num625].velocity *= 2f; } } + npc.ai[3] += 1f; npc.alpha = lifeToAlpha; - if (npc.ai[3] >= 3f) + if (npc.ai[3] >= maxTeleports) { - npc.ai[0] = 3f; + npc.ai[0] = -1f; npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -374,89 +390,95 @@ namespace CalamityMod.NPCs.Signus } else if (npc.ai[0] == 3f) { + 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; - Vector2 vector121 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); - npc.ai[1] += 1f; - float divisor = expertMode ? (death ? 55f : revenge ? 60f : 65f) - (float)Math.Ceiling(30D * (1D - lifeRatio)) : 70f; - - if (npc.ai[1] % divisor == divisor - 1f) + 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; + else + npc.ai[2] = scytheBarrageTime + scytheBarrageCooldown; + + if (npc.ai[2] <= scytheBarrageTime) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num1070 = 15f; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - num1070 += 3f; - } - float num1071 = player.position.X + player.width * 0.5f - vector121.X; - float num1072 = player.position.Y + player.height * 0.5f - vector121.Y; - float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); - num1073 = num1070 / num1073; - num1071 *= num1073; - num1072 *= num1073; - int num1074 = expertMode ? 48 : 60; - int num1075 = ModContent.ProjectileType(); - Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, npc.target + 1); - } + if (npc.ai[1] % divisor == divisor - 1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float num1070 = enraged ? 18f : 15f; + float num1071 = player.Center.X - vectorCenter.X; + float num1072 = player.Center.Y - vectorCenter.Y; + float num1073 = (float)Math.Sqrt(num1071 * num1071 + num1072 * num1072); + num1073 = num1070 / num1073; + 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); + } + } } - if (npc.position.Y > player.position.Y - 200f) //200 + + 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.velocity.Y > 0f) - { npc.velocity.Y *= 0.975f; - } - npc.velocity.Y -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y > 3f) - { - npc.velocity.Y = 3f; - } + + 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 - 400f) //500 + else if (npc.position.Y < player.position.Y - 400f) { if (npc.velocity.Y < 0f) - { npc.velocity.Y *= 0.975f; - } - npc.velocity.Y += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.Y < -3f) - { - npc.velocity.Y = -3f; - } + + 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) + 500f) //100 + + if (vectorCenter.X > player.Center.X + 500f) { if (npc.velocity.X > 0f) - { npc.velocity.X *= 0.98f; - } - npc.velocity.X -= CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X > 8f) - { - npc.velocity.X = 8f; - } + + 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) - 500f) //100 + + if (vectorCenter.X < player.Center.X - 500f) { if (npc.velocity.X < 0f) - { npc.velocity.X *= 0.98f; - } - npc.velocity.X += CalamityWorld.bossRushActive ? 0.15f : 0.1f; - if (npc.velocity.X < -8f) - { - npc.velocity.X = -8f; - } + + npc.velocity.X += death ? 0.12f : 0.1f; + + if (npc.velocity.X < -maxVelocityX) + npc.velocity.X = -maxVelocityX; } - if (npc.ai[1] >= divisor * 5f) + + if (npc.ai[1] >= divisor * 20f) { - npc.ai[0] = 4f; - npc.ai[1] = 0f; + npc.ai[0] = -1f; + npc.ai[1] = 3f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -468,154 +490,147 @@ namespace CalamityMod.NPCs.Signus { for (int x = 0; x < 5; x++) { - int num660 = NPC.NewNPC((int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + int num660 = NPC.NewNPC((int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - int num661 = NPC.NewNPC((int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); + + int num661 = NPC.NewNPC((int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), ModContent.NPCType()); if (Main.netMode == NetmodeID.Server) - { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num661, 0f, 0f, 0f, 0, 0, 0); - } + spawnY -= 60; } spawnY = 120; } } - 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 < -1.57079637f) - { - npc.rotation += 3.14159274f; - } - if (npc.rotation > 1.57079637f) - { - npc.rotation -= 3.14159274f; - } - npc.spriteDirection = Math.Sign(npc.velocity.X); - if (chargeSwitch == 0) //line up the charge - { - float scaleFactor6 = 14f; - if (expertMode) - scaleFactor6 += death ? 6f : 6f * (float)(1D - lifeRatio); - Vector2 center5 = player.Center; - Vector2 vector126 = center5 - vectorCenter; + 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); + + if (calamityGlobalNPC.newAI[0] == 0f) // Line up the charge + { + float velocity = enraged ? 20f : malice ? 18f : revenge ? 16f : expertMode ? 15f : 14f; + if (expertMode) + velocity += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); + + Vector2 vector126 = player.Center - vectorCenter; Vector2 vector127 = vector126 - Vector2.UnitY * 300f; + float num1013 = vector126.Length(); - vector126 = Vector2.Normalize(vector126) * scaleFactor6; - vector127 = Vector2.Normalize(vector127) * scaleFactor6; - bool flag64 = Collision.CanHit(vectorCenter, 1, 1, player.Center, 1, 1); - if (npc.ai[3] >= 120f) - { - flag64 = true; - } + + 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; float num1014 = 8f; - flag64 = flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014; + flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014; if (num1013 > 1400f || !flag64) { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / num1000; - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / num1000; + npc.velocity = (npc.velocity * (inertia - 1f) + vector127) / inertia; + if (!flag64) { npc.ai[3] += 1f; if (npc.ai[3] == 120f) - { npc.netUpdate = true; - } } else - { npc.ai[3] = 0f; - } } else { - chargeSwitch = 1; + calamityGlobalNPC.newAI[0] = 1f; npc.ai[2] = vector126.X; npc.ai[3] = vector126.Y; npc.netUpdate = true; } } - else if (chargeSwitch == 1) //pause before charge + else if (calamityGlobalNPC.newAI[0] == 1f) // Pause before charge { npc.velocity *= 0.8f; + npc.ai[1] += 1f; if (npc.ai[1] >= 5f) { - chargeSwitch = 2; - npc.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 2f; + npc.netUpdate = true; + Vector2 velocity = new Vector2(npc.ai[2], npc.ai[3]); velocity.Normalize(); - velocity *= 10f; + velocity *= chargeVelocity; npc.velocity = velocity; - } + + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } } - else if (chargeSwitch == 2) //charging + else if (calamityGlobalNPC.newAI[0] == 2f) // Charging { - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient) { - dustTimer--; - if (phase2 && dustTimer <= 0) + npc.ai[2] += 1f; + if (phase2 && npc.ai[2] % 3f == 0f) { Main.PlaySound(SoundID.Item73, npc.position); - int damage = expertMode ? 60 : 70; - int projectile = Projectile.NewProjectile((int)vectorCenter.X, (int)vectorCenter.Y, 0f, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - dustTimer = 3; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + int projectile = Projectile.NewProjectile(vectorCenter, Vector2.Zero, type, damage, 0f, Main.myPlayer); } } + npc.ai[1] += 1f; bool flag65 = vectorCenter.Y + 50f > player.Center.Y; if ((npc.ai[1] >= 90f && flag65) || npc.velocity.Length() < 8f) { - chargeSwitch = 3; + calamityGlobalNPC.newAI[0] = 3f; npc.ai[1] = 30f; npc.ai[2] = 0f; - npc.ai[3] = 0f; npc.velocity /= 2f; npc.netUpdate = true; } else { - Vector2 center7 = player.Center; - Vector2 vec2 = center7 - vectorCenter; + Vector2 vec2 = player.Center - vectorCenter; vec2.Normalize(); if (vec2.HasNaNs()) - { vec2 = new Vector2(npc.direction, 0f); - } - npc.velocity = (npc.velocity * (num1000 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1000; + + npc.velocity = (npc.velocity * (inertia - 1f) + vec2 * (npc.velocity.Length() + 0.111111117f * inertia)) / inertia; } } - else if (chargeSwitch == 3) //slow down after charging and reset + else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset { npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) { - phaseSwitch += 1; - if (phaseSwitch >= 3) + npc.TargetClosest(); + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= maxCharges) { - npc.ai[0] = 0f; - npc.ai[1] = 0f; + npc.ai[0] = -1f; + npc.ai[1] = 4f; npc.ai[2] = 0f; npc.ai[3] = 0f; - chargeSwitch = 0; - phaseSwitch = 0; - npc.netUpdate = true; + calamityGlobalNPC.newAI[1] = 0f; } else { - chargeSwitch = 0; npc.ai[1] = 0f; - npc.netUpdate = true; } - } + calamityGlobalNPC.newAI[0] = 0f; + npc.netUpdate = true; + } npc.velocity *= 0.97f; } } @@ -738,38 +753,46 @@ namespace CalamityMod.NPCs.Signus public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } public override void NPCLoot() { - // Only drop items if fought alone - if (CalamityWorld.DoGSecondStageCountdown <= 0) + // Only drop items if fought at full strength + bool fullStrength = !CalamityWorld.downedSentinel3 || CalamityWorld.DoGSecondStageCountdown <= 0; + if (fullStrength) { - // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 2, 3); + DropHelper.DropBags(npc); - // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); - DropHelper.DropItemRIV(npc, ModContent.ItemType(), ModContent.ItemType(), Main.expertMode ? 0.3333f : 0.25f, DropHelper.RareVariantDropRateFloat); + // Legendary drop for Signus + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - //Equipment - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.revenge, 4, 1, 1); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + bool lastSentinelKilled = CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && !CalamityWorld.downedSentinel3; + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); - // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) + if (!Main.expertMode) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - } + // Materials + DropHelper.DropItem(npc, ModContent.ItemType(), true, 2, 3); - // Other - bool lastSentinelKilled = CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2 && !CalamityWorld.downedSentinel3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedSentinel3, 5, 2, 1); + // Weapons + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + + //Equipment (None in Normal) + + // Vanity + 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()); + } + } } // If DoG's fight is active, set the timer precisely for DoG phase 2 to spawn @@ -786,21 +809,21 @@ namespace CalamityMod.NPCs.Signus // Mark DoG fight sentinels as dead CalamityWorld.downedSecondSentinels = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } // Mark Signus as dead - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (fullStrength) { CalamityWorld.downedSentinel3 = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void HitEffect(int hitDirection, double damage) @@ -847,10 +870,6 @@ namespace CalamityMod.NPCs.Signus public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 420, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 300, true); - } } } } diff --git a/NPCs/Signus/SignusBomb.cs b/NPCs/Signus/SignusBomb.cs index f05fa9d320..fcb17a0a24 100644 --- a/NPCs/Signus/SignusBomb.cs +++ b/NPCs/Signus/SignusBomb.cs @@ -1,4 +1,6 @@ using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -19,10 +21,11 @@ namespace CalamityMod.NPCs.Signus public override void SetDefaults() { - npc.damage = 0; - npc.width = 30; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 30; npc.height = 30; - npc.lifeMax = 100; + npc.lifeMax = 4800; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -52,24 +55,35 @@ namespace CalamityMod.NPCs.Signus return; } + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; + 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.TargetClosest(true); + // Get a target + 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(); + Player player = Main.player[npc.target]; + 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.Calamity().newAI[0] += 1f; npc.velocity *= 0.98f; npc.dontTakeDamage = false; - npc.scale = MathHelper.Lerp(1f, 3f, npc.Calamity().newAI[0] / 85f); + npc.scale = MathHelper.Lerp(1f, 3f, npc.Calamity().newAI[0] / 45f); - if (npc.Calamity().newAI[0] >= 85f) + if (npc.Calamity().newAI[0] >= 45f) { CheckDead(); npc.life = 0; @@ -99,7 +113,7 @@ namespace CalamityMod.NPCs.Signus } } - float num1372 = 14f; + float num1372 = death ? 16f : 14f; 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; @@ -146,6 +160,9 @@ namespace CalamityMod.NPCs.Signus public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + if (npc.Calamity().newAI[0] >= 45f) + return false; + SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; @@ -166,25 +183,27 @@ namespace CalamityMod.NPCs.Signus 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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 bool PreNPCLoot() => false; + public override bool CheckDead() { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); + 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 = 300; + 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); diff --git a/NPCs/Signus/SignusSky.cs b/NPCs/Signus/SignusSky.cs index b0f9eb3cad..b0a131fc82 100644 --- a/NPCs/Signus/SignusSky.cs +++ b/NPCs/Signus/SignusSky.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.Signus } float maxIntensity = 0.1f; - if (CalamityWorld.revenge) + if (CalamityWorld.revenge || CalamityWorld.malice) { maxIntensity = 1f - (float)Main.npc[this.SignusIndex].life / (float)Main.npc[this.SignusIndex].lifeMax; } diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 87ce3740b5..7049ec45c8 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] @@ -23,28 +24,24 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.damage = 45; - npc.width = 150; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 150; npc.height = 92; npc.scale = 1.1f; npc.defense = 10; - npc.LifeMaxNERB(4000, 5500, 2200000); + npc.LifeMaxNERB(4650, 6400, 220000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = false; npc.knockBackResist = 0f; animationType = NPCID.KingSlime; npc.value = 0f; npc.alpha = 55; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); } @@ -60,12 +57,24 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive || npc.localAI[1] == 1f; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + Vector2 vector = npc.Center; + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + npc.defense = npc.defDefense; npc.damage = npc.defDamage; if (npc.localAI[1] == 1f) @@ -79,14 +88,18 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = false; // Get a 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 == 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(); Player player = Main.player[npc.target]; if (npc.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (player.dead || !player.active) { @@ -105,9 +118,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; } - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); - if (npc.life <= npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) + if (npc.life / (float)npc.lifeMax <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { Main.PlaySound(SoundID.NPCDeath1, npc.position); Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); @@ -133,19 +146,26 @@ namespace CalamityMod.NPCs.SlimeGod flag100 = false; hyperMode = true; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 1f : 2f; + npc.localAI[0] += enraged ? 6f : flag100 ? 1f : 2f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 600f && Vector2.Distance(player.Center, npc.Center) > 160f) { npc.localAI[0] = 0f; if (expertMode && Main.rand.NextBool(2)) { - float num179 = CalamityWorld.bossRushActive ? 12f : 8f; + float num179 = 8f; 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; @@ -155,8 +175,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = 24; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 3; num186++) @@ -169,12 +189,12 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-60, 61); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } } else { - float num179 = CalamityWorld.bossRushActive ? 12f : 8f; + float num179 = 8f; 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; @@ -184,8 +204,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 4; num186++) @@ -198,7 +218,7 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-60, 61); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -206,9 +226,9 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.ai[0] == 0f) { - npc.TargetClosest(true); npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } else if (npc.ai[0] == 1f) { @@ -218,18 +238,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += flag100 ? 1f : 2f; float num1879 = 60f; - float num1880 = CalamityWorld.bossRushActive ? 12f : 3f; + float num1880 = death ? 3.5f : revenge ? 3f : expertMode ? 2.5f : 2f; if (revenge) { - float moveBoost = death ? 20f : 40f * (1f - npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 4f * (1f - npc.life / (float)npc.lifeMax); + float moveBoost = death ? 80f * (1f - lifeRatio) : 40f * (1f - lifeRatio); + float speedBoost = death ? 8f * (1f - lifeRatio) : 4f * (1f - lifeRatio); num1879 -= moveBoost; num1880 += speedBoost; } @@ -250,6 +271,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.velocity.Y -= num1881; npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; + npc.netUpdate = true; } } else @@ -267,11 +289,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 1f : 2f * (1f - npc.life / (float)npc.lifeMax); + npc.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); } if (npc.ai[2] >= 420f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - switch (Main.rand.Next(3)) + int random = Main.rand.Next(2) + (lifeRatio < 0.75f ? 1 : 0); + switch (random) { case 0: npc.ai[0] = 2f; @@ -279,7 +302,7 @@ namespace CalamityMod.NPCs.SlimeGod case 1: npc.ai[0] = 3f; npc.noTileCollide = true; - npc.velocity.Y = CalamityWorld.bossRushActive ? -12f : -8f; + npc.velocity.Y = death ? -9f : revenge ? -8f : expertMode ? -7f : -6f; break; case 2: npc.ai[0] = 5f; @@ -290,6 +313,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 2f) @@ -301,6 +325,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 3f) @@ -316,7 +341,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.direction = 1; } npc.spriteDirection = npc.direction; - npc.TargetClosest(true); + npc.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; @@ -325,8 +350,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 12f : 8f; - npc.velocity = (npc.velocity * 4f + vector272) / 5f; + vector272 *= death ? 9f : revenge ? 8f : expertMode ? 7f : 6f; + npc.velocity = (npc.velocity * 4f + vector272) / 5f; if (npc.ai[1] > 12f) { npc.ai[1] = 0f; @@ -344,7 +369,7 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= (CalamityWorld.bossRushActive ? 18f : 10f) + distanceSpeedBoost; + vector272 *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } @@ -354,6 +379,7 @@ namespace CalamityMod.NPCs.SlimeGod 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; } if (atTargetPosition || npc.velocity.Y <= 0f) { @@ -365,9 +391,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] = 0f; npc.ai[3] = 0f; if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { npc.ai[0] = 4f; - } + + npc.netUpdate = true; } } else if (npc.ai[2] == 0f) @@ -376,7 +402,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - float velocityLimit = CalamityWorld.bossRushActive ? 20f : 14f; + float velocityLimit = death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; if (npc.velocity.Y > velocityLimit) { npc.velocity.Y = velocityLimit; @@ -405,11 +431,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (value74.Length() > 100f) { value74.Normalize(); - value74 *= (CalamityWorld.bossRushActive ? 20f : 10f) + distanceSpeedBoost; + value74 *= (death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost; } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; @@ -418,7 +445,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += 1f; if (npc.ai[1] > 5f) @@ -453,14 +480,14 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity.Y -= 2f; } - npc.velocity.X = ((CalamityWorld.bossRushActive ? 20f : 10f) + distanceSpeedBoost) * npc.direction; + npc.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * npc.direction; npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f) + distanceSpeedBoost; if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { npc.velocity.X = -velocityLimit; @@ -476,6 +503,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 6f) @@ -500,12 +528,12 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[num244].velocity *= 0.5f; if (bossLife == 0f && npc.life > 0) { - bossLife = (float)npc.lifeMax; + bossLife = npc.lifeMax; } float num644 = 1f; if (npc.life > 0) { - float num659 = (float)npc.life / (float)npc.lifeMax; + float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; if (num659 != npc.scale) @@ -591,12 +619,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 180, true); - } + player.AddBuff(BuffID.Weak, 300, true); + } } } diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 0c2753eb5d..3de06f1d4a 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -1,5 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; @@ -34,33 +34,28 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.damage = 40; - npc.npcSlots = 10f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 10f; npc.width = 44; npc.height = 44; npc.defense = 6; - npc.LifeMaxNERB(4000, 5000, 2500000); + npc.LifeMaxNERB(2000, 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; aiType = -1; - npc.buffImmune[ModContent.BuffType()] = true; - npc.buffImmune[ModContent.BuffType()] = true; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 8, 0, 0); - npc.alpha = 55; + npc.Opacity = 0.8f; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); } @@ -72,6 +67,8 @@ namespace CalamityMod.NPCs.SlimeGod 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]); } public override void ReceiveExtraAI(BinaryReader reader) @@ -82,23 +79,42 @@ namespace CalamityMod.NPCs.SlimeGod 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(); } public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.slimeGod = npc.whoAmI; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - npc.TargetClosest(true); - Player player = Main.player[npc.target]; + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; 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(); + + // 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(); + + Player player = Main.player[npc.target]; + if (Main.netMode != NetmodeID.MultiplayerClient && !slimesSpawned) { slimesSpawned = true; @@ -118,7 +134,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.damage = npc.defDamage; // Enrage based on large slimes - bool phase2 = lifeRatio < 0.4f; + bool phase2 = lifeRatio < 0.4f || malice; bool hyperMode = true; bool purpleSlimeAlive = false; bool redSlimeAlive = false; @@ -132,8 +148,8 @@ namespace CalamityMod.NPCs.SlimeGod else Main.npc[CalamityGlobalNPC.slimeGodPurple].localAI[1] = 0f; - npc.Calamity().newAI[0] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.X; - npc.Calamity().newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; + calamityGlobalNPC.newAI[0] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.X; + calamityGlobalNPC.newAI[1] = Main.npc[CalamityGlobalNPC.slimeGodPurple].Center.Y; purpleSlimeAlive = true; phase2 = lifeRatio < 0.2f; @@ -174,7 +190,7 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.position.Y > Main.worldSurface * 16.0) { - for (int x = 0; x < 200; x++) + for (int x = 0; x < Main.maxNPCs; x++) { if (Main.npc[x].type == ModContent.NPCType() || Main.npc[x].type == ModContent.NPCType() || Main.npc[x].type == ModContent.NPCType() || Main.npc[x].type == ModContent.NPCType()) @@ -203,27 +219,27 @@ namespace CalamityMod.NPCs.SlimeGod else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float ai1 = hyperMode ? 270f : 360f; + float ai1 = malice ? 210f : hyperMode ? 270f : 360f; // Hide inside large slime if (!hyperMode && npc.ai[1] < ai1) { - if (npc.Calamity().newAI[2] == 0f && npc.life > 0) + if (calamityGlobalNPC.newAI[2] == 0f && npc.life > 0) { - npc.Calamity().newAI[2] = npc.lifeMax; + calamityGlobalNPC.newAI[2] = npc.lifeMax; } if (npc.life > 0) { int num660 = (int)(npc.lifeMax * 0.05); - if ((npc.life + num660) < npc.Calamity().newAI[2]) + if ((npc.life + num660) < calamityGlobalNPC.newAI[2]) { - npc.Calamity().newAI[2] = npc.life; - npc.Calamity().newAI[3] = 1f; + 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); } } - if (npc.Calamity().newAI[3] == 1f) + if (calamityGlobalNPC.newAI[3] == 1f) { npc.dontTakeDamage = true; @@ -239,13 +255,23 @@ namespace CalamityMod.NPCs.SlimeGod buffedSlime = 2; } - Vector2 purpleSlimeVector = new Vector2(npc.Calamity().newAI[0], npc.Calamity().newAI[1]); + Vector2 purpleSlimeVector = new Vector2(calamityGlobalNPC.newAI[0], calamityGlobalNPC.newAI[1]); 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; + // Reduce velocity to 0 to avoid spastic movement when inside big slime. + if (Vector2.Distance(npc.Center, goToVector) < 24f) + { + npc.velocity = Vector2.Zero; + + npc.Opacity -= 0.2f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + bool slimeDead = false; if (goToVector == purpleSlimeVector) slimeDead = CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active; @@ -255,8 +281,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (npc.ai[2] >= 600f || slimeDead) { + npc.TargetClosest(); npc.ai[2] = 0f; - npc.Calamity().newAI[3] = 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); for (int i = 0; i < 20; i++) { @@ -281,6 +309,10 @@ namespace CalamityMod.NPCs.SlimeGod return; } + npc.Opacity += 0.2f; + if (npc.Opacity > 0.8f) + npc.Opacity = 0.8f; + buffedSlime = 0; } @@ -298,10 +330,10 @@ namespace CalamityMod.NPCs.SlimeGod npc.rotation = npc.velocity.X * 0.1f; // Set teleport location, turn invisible, spin direction - npc.alpha += 20; - if (npc.alpha >= 255) + npc.Opacity -= 0.2f; + if (npc.Opacity <= 0f) { - npc.alpha = 255; + npc.Opacity = 0f; npc.velocity.Normalize(); int teleportX = player.velocity.X < 0f ? -20 : 20; @@ -321,17 +353,17 @@ namespace CalamityMod.NPCs.SlimeGod npc.rotation = npc.velocity.X * 0.1f; // Teleport to location - if (npc.alpha == 255) + 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; } // Turn visible - npc.alpha -= 20; - if (npc.alpha < 55) + npc.Opacity += 0.2f; + if (npc.Opacity >= 0.8f) { - npc.alpha = 55; + npc.Opacity = 0.8f; npc.localAI[0] = vectorCenter.X - player.Center.X < 0 ? 1f : -1f; npc.localAI[1] = 2f; } @@ -364,20 +396,20 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[3] = 0f; npc.localAI[0] = 0f; npc.localAI[1] = 0f; - float chargeVelocity = death ? 12f : 8f; - npc.velocity = Vector2.Normalize(player.Center - vectorCenter) * chargeVelocity; + float chargeVelocity = death ? 12f : 9f; + npc.velocity = Vector2.Normalize(player.Center + (malice ? player.velocity * 20f : Vector2.Zero) - vectorCenter) * chargeVelocity; + npc.TargetClosest(); return; } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] % 15f == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) + float divisor = enraged ? 5f : malice ? 10f : 15f; + if (npc.ai[1] % divisor == 0f && Vector2.Distance(player.Center, vectorCenter) > 160f) { if (expertMode && Main.rand.NextBool(2)) { float num179 = revenge ? 2f : 3f; - if (CalamityWorld.bossRushActive) - num179 = 12f; 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; @@ -387,17 +419,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = 24; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = ModContent.ProjectileType(); - } - else - { - num185 = ModContent.ProjectileType(); - num184 = 22; - } + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + player.width * 0.5f - value9.X; @@ -406,13 +429,11 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } else { float num179 = revenge ? 6f : 5f; - if (CalamityWorld.bossRushActive) - num179 = 12f; 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; @@ -422,17 +443,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = ModContent.ProjectileType(); - } - else - { - num185 = ModContent.ProjectileType(); - num184 = expertMode ? 16 : 19; - } + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + player.width * 0.5f - value9.X; @@ -441,7 +453,7 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -453,13 +465,11 @@ 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] % (enraged ? 20f : 40f) == 0f) { if (expertMode && Main.rand.NextBool(2)) { float num179 = revenge ? 2f : 3f; - if (CalamityWorld.bossRushActive) - num179 = 12f; 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; @@ -469,17 +479,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = 24; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = ModContent.ProjectileType(); - } - else - { - num185 = ModContent.ProjectileType(); - num184 = 22; - } + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + player.width * 0.5f - value9.X; @@ -488,13 +489,11 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } else { float num179 = revenge ? 6f : 5f; - if (CalamityWorld.bossRushActive) - num179 = 12f; 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; @@ -504,17 +503,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = Main.rand.Next(2); - if (num185 == 0) - { - num185 = ModContent.ProjectileType(); - } - else - { - num185 = ModContent.ProjectileType(); - num184 = expertMode ? 16 : 19; - } + int type = Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 2; num186++) @@ -527,7 +517,7 @@ namespace CalamityMod.NPCs.SlimeGod num182 += Main.rand.Next(-30, 31); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -538,17 +528,17 @@ namespace CalamityMod.NPCs.SlimeGod float num1372 = death ? 14f : revenge ? 11f : expertMode ? 8.5f : 6f; if (phase2) { - num1372 = revenge ? 14f : expertMode ? 12.5f : 11f; + num1372 = revenge ? 18f : expertMode ? 16f : 14f; } - if (CalamityWorld.bossRushActive || player.gravDir == -1f) + if (player.gravDir == -1f) { num1372 = 22f; } - if (npc.Calamity().enraged > 0 || player.gravDir == -1f || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (enraged || player.gravDir == -1f) { num1372 += 8f; } - if (hyperMode) + if (hyperMode || malice) { num1372 *= 1.25f; } @@ -658,12 +648,10 @@ namespace CalamityMod.NPCs.SlimeGod // This loot code is shared with every other Slime God component. public static void DropSlimeGodLoot(NPC npc) { - CalamityMod mod = ModContent.GetInstance(); DropHelper.DropBags(npc); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSlimeGod); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedSlimeGod, 3, 1, 0); CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Dryad, ModContent.NPCType() }, CalamityWorld.downedSlimeGod); @@ -671,7 +659,7 @@ namespace CalamityMod.NPCs.SlimeGod CalamityPlayer mp = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Calamity(); if (!mp.revJamDrop) { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.revenge && !CalamityWorld.downedSlimeGod, 6, 8); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSlimeGod, 6, 8); mp.revJamDrop = true; } @@ -685,13 +673,14 @@ namespace CalamityMod.NPCs.SlimeGod DropHelper.DropItemSpray(npc, ModContent.ItemType(), 30, 45); // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), DropHelper.WeightStack(w), - DropHelper.WeightStack(w) + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) ); // Vanity @@ -702,7 +691,7 @@ namespace CalamityMod.NPCs.SlimeGod // Mark the Slime God as dead CalamityWorld.downedSlimeGod = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } public override void HitEffect(int hitDirection, double damage) @@ -747,12 +736,9 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.VortexDebuff, 180, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 120, true); - player.AddBuff(ModContent.BuffType(), 120); - } - } + player.AddBuff(BuffID.VortexDebuff, 120, true); + player.AddBuff(BuffID.Weak, 120, true); + player.AddBuff(BuffID.Darkness, 120, true); + } } } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index db2eef5a5c..d3c40f9be0 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] @@ -23,17 +24,17 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.damage = 50; - npc.width = 150; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.width = 150; npc.height = 92; npc.scale = 1.1f; npc.defense = 12; - npc.LifeMaxNERB(3500, 4820, 1600000); + npc.LifeMaxNERB(4150, 5700, 160000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; animationType = NPCID.KingSlime; - npc.buffImmune[ModContent.BuffType()] = false; npc.value = 0f; npc.alpha = 55; npc.lavaImmune = false; @@ -41,11 +42,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; npc.aiStyle = -1; aiType = -1; bossBag = ModContent.ItemType(); @@ -63,11 +60,23 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + CalamityGlobalNPC.slimeGodRed = npc.whoAmI; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive || npc.localAI[1] == 1f; - Vector2 vector = npc.Center; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vector = npc.Center; + + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -82,14 +91,18 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = false; // Get a 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 == 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(); Player player = Main.player[npc.target]; if (npc.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (player.dead || !player.active) { @@ -97,7 +110,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - } + npc.netUpdate = true; + } } else if (npc.timeLeft < 1800) npc.timeLeft = 1800; @@ -108,9 +122,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.position.Y = player.Center.Y / 16 * 16f - (npc.height / 2) - 150f; } - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); - if (npc.life <= npc.lifeMax * 0.5 && Main.netMode != NetmodeID.MultiplayerClient && expertMode) + if (npc.life / (float)npc.lifeMax <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { Main.PlaySound(SoundID.NPCDeath1, npc.position); Vector2 spawnAt = vector + new Vector2(0f, npc.height / 2f); @@ -136,6 +150,11 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; flag100 = false; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (npc.localAI[1] != 1f) { @@ -145,9 +164,11 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 1f : 2f; + npc.localAI[0] += enraged ? 6f : flag100 ? 1f : 2f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 450f && Vector2.Distance(player.Center, npc.Center) > 160f) { @@ -155,8 +176,6 @@ namespace CalamityMod.NPCs.SlimeGod if (expertMode && Main.rand.NextBool(2)) { float num179 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 *= 1.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; @@ -166,8 +185,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = 22; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 2; num186++) @@ -180,14 +199,12 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-60, 61); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } } else { float num179 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 *= 1.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; @@ -197,8 +214,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = expertMode ? 16 : 19; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 2; num186++) @@ -211,7 +228,7 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-30, 31); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -219,7 +236,6 @@ namespace CalamityMod.NPCs.SlimeGod if (npc.ai[0] == 0f) { - npc.TargetClosest(true); npc.ai[0] = 1f; npc.ai[1] = 0f; } @@ -231,18 +247,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += 1f; float num1879 = 50f; - float num1880 = CalamityWorld.bossRushActive ? 16f : 4f; + float num1880 = death ? 4.5f : revenge ? 4f : expertMode ? 3.5f : 3f; if (revenge) { - float moveBoost = death ? 15f : 30f * (1f - npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 4f * (1f - npc.life / (float)npc.lifeMax); + float moveBoost = death ? 60f * (1f - lifeRatio) : 30f * (1f - lifeRatio); + float speedBoost = death ? 8f * (1f - lifeRatio) : 4f * (1f - lifeRatio); num1879 -= moveBoost; num1880 += speedBoost; } @@ -263,6 +280,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.velocity.Y -= num1881; npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; + npc.netUpdate = true; } } else @@ -280,11 +298,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 1f : 2f * (1f - npc.life / (float)npc.lifeMax); + npc.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); } if (npc.ai[2] >= 360f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - switch (Main.rand.Next(3)) + int random = Main.rand.Next(2) + (lifeRatio < 0.75f ? 1 : 0); + switch (random) { case 0: npc.ai[0] = 2f; @@ -292,7 +311,7 @@ namespace CalamityMod.NPCs.SlimeGod case 1: npc.ai[0] = 3f; npc.noTileCollide = true; - npc.velocity.Y = CalamityWorld.bossRushActive ? -13f : -9f; + npc.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; break; case 2: npc.ai[0] = 5f; @@ -303,6 +322,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 2f) @@ -313,6 +333,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 3f) @@ -328,7 +349,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.direction = 1; } npc.spriteDirection = npc.direction; - npc.TargetClosest(true); + npc.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; @@ -337,7 +358,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 13f : 9f; + vector272 *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; npc.velocity = (npc.velocity * 4f + vector272) / 5f; if (npc.ai[1] > 12f) { @@ -345,6 +366,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[0] = 3.1f; npc.ai[2] = 0f; npc.velocity = vector272; + npc.netUpdate = true; } } else @@ -353,10 +375,11 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[1] = 0f; npc.ai[2] = 1f; + npc.netUpdate = true; return; } vector272.Normalize(); - vector272 *= (CalamityWorld.bossRushActive ? 20f : 11f) + distanceSpeedBoost; + vector272 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } @@ -366,6 +389,7 @@ namespace CalamityMod.NPCs.SlimeGod 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; } if (atTargetPosition || npc.velocity.Y <= 0f) { @@ -377,9 +401,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] = 0f; npc.ai[3] = 0f; if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { npc.ai[0] = 4f; - } + + npc.netUpdate = true; } } else if (npc.ai[2] == 0f) @@ -388,7 +412,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - float velocityLimit = CalamityWorld.bossRushActive ? 20f : 14f; + float velocityLimit = death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; if (npc.velocity.Y > velocityLimit) { npc.velocity.Y = velocityLimit; @@ -417,11 +441,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (value74.Length() > 100f) { value74.Normalize(); - value74 *= (CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost; + value74 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; @@ -430,7 +455,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += 1f; if (npc.ai[1] > 5f) @@ -465,14 +490,14 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity.Y -= 2f; } - npc.velocity.X = ((CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost) * npc.direction; + npc.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * npc.direction; npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f) + distanceSpeedBoost; if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { npc.velocity.X = -velocityLimit; @@ -488,6 +513,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 6f) @@ -512,12 +538,12 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[num658].velocity *= 0.5f; if (bossLife == 0f && npc.life > 0) { - bossLife = (float)npc.lifeMax; + bossLife = npc.lifeMax; } float num644 = 1f; if (npc.life > 0) { - float num659 = (float)npc.life / (float)npc.lifeMax; + float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; if (num659 != npc.scale) @@ -603,12 +629,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 90, true); - } + player.AddBuff(BuffID.Darkness, 300, true); + } } } diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index d2d5223df3..94e2f8cf41 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] @@ -23,16 +24,16 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.LifeMaxNERB(875, 1205, 800000); + npc.Calamity().canBreakPlayerDefense = true; + npc.LifeMaxNERB(875, 1205, 80000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.damage = 45; - npc.width = 150; + npc.GetNPCDamage(); + npc.width = 150; npc.height = 92; npc.scale = 0.8f; npc.defense = 10; npc.knockBackResist = 0f; - npc.buffImmune[ModContent.BuffType()] = false; animationType = NPCID.KingSlime; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 55; @@ -41,11 +42,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; npc.aiStyle = -1; aiType = -1; bossBag = ModContent.ItemType(); @@ -63,15 +60,25 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - if (CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active) - { - CalamityGlobalNPC.slimeGodRed = npc.whoAmI; - } + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive || npc.localAI[1] == 1f; - Vector2 vector = npc.Center; + if (CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active) + CalamityGlobalNPC.slimeGodRed = npc.whoAmI; + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vector = npc.Center; + + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -86,14 +93,18 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = false; // Get a 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 == 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(); Player player = Main.player[npc.target]; if (npc.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (player.dead || !player.active) { @@ -101,12 +112,13 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - } + npc.netUpdate = true; + } } else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); bool flag100 = false; bool hyperMode = npc.localAI[1] == 1f; @@ -123,6 +135,11 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; flag100 = false; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (npc.localAI[1] != 1f) { @@ -132,9 +149,11 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 0.5f : 1f; + npc.localAI[0] += enraged ? 3f : flag100 ? 0.5f : 1f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 450f && Vector2.Distance(player.Center, npc.Center) > 160f) { @@ -142,8 +161,6 @@ namespace CalamityMod.NPCs.SlimeGod if (expertMode && Main.rand.NextBool(2)) { float num179 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 *= 1.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; @@ -153,8 +170,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = 22; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + (float)player.width * 0.5f - value9.X; @@ -165,13 +182,11 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-30, 31); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } else { float num179 = revenge ? 9f : 8f; - if (CalamityWorld.bossRushActive) - num179 *= 1.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; @@ -181,8 +196,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = expertMode ? 16 : 19; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + (float)player.width * 0.5f - value9.X; @@ -193,16 +208,17 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-20, 21); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + npc.netUpdate = true; + } } if (npc.ai[0] == 0f) { - npc.TargetClosest(true); npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } else if (npc.ai[0] == 1f) { @@ -212,18 +228,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += 1f; float num1879 = 35f; - float num1880 = CalamityWorld.bossRushActive ? 20f : 6f; + float num1880 = death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f; if (revenge) { - float moveBoost = death ? 7f : 7f * (1f - npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 2f * (1f - npc.life / (float)npc.lifeMax); + float moveBoost = death ? 14f * (1f - lifeRatio) : 7f * (1f - lifeRatio); + float speedBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); num1879 -= moveBoost; num1880 += speedBoost; } @@ -239,7 +256,8 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.velocity.Y -= num1881; npc.velocity.X = (num1880 + distanceSpeedBoost) * npc.direction; - } + npc.netUpdate = true; + } } else { @@ -256,11 +274,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += (death ? 0.5f : 0.5f * (1f - npc.life / (float)npc.lifeMax)); + npc.ai[2] += death ? 1f - lifeRatio : 0.5f * (1f - lifeRatio); } if (npc.ai[2] >= 180f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - switch (Main.rand.Next(3)) + int random = Main.rand.Next(2) + (lifeRatio < 0.5f ? 1 : 0); + switch (random) { case 0: npc.ai[0] = 2f; @@ -268,7 +287,7 @@ namespace CalamityMod.NPCs.SlimeGod case 1: npc.ai[0] = 3f; npc.noTileCollide = true; - npc.velocity.Y = CalamityWorld.bossRushActive ? -14f : -10f; + npc.velocity.Y = death ? -11f : revenge ? -10f : expertMode ? -9f : -8f; break; case 2: npc.ai[0] = 5f; @@ -279,6 +298,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 2f) @@ -289,6 +309,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 3f) @@ -304,7 +325,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.direction = 1; } npc.spriteDirection = npc.direction; - npc.TargetClosest(true); + npc.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; @@ -313,7 +334,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 14f : 10f; + vector272 *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; npc.velocity = (npc.velocity * 4f + vector272) / 5f; if (npc.ai[1] > 12f) { @@ -321,6 +342,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[0] = 3.1f; npc.ai[2] = 0f; npc.velocity = vector272; + npc.netUpdate = true; } } else @@ -332,7 +354,7 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= (CalamityWorld.bossRushActive ? 22f : 12f) + distanceSpeedBoost; + vector272 *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } @@ -353,9 +375,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] = 0f; npc.ai[3] = 0f; if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { npc.ai[0] = 4f; - } + + npc.netUpdate = true; } } else if (npc.ai[2] == 0f) @@ -364,7 +386,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - float velocityLimit = CalamityWorld.bossRushActive ? 22f : 16f; + float velocityLimit = death ? 16f : revenge ? 15f : expertMode ? 14f : 13f; if (npc.velocity.Y > velocityLimit) { npc.velocity.Y = velocityLimit; @@ -393,11 +415,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (value74.Length() > 50f) { value74.Normalize(); - value74 *= (CalamityWorld.bossRushActive ? 24f : 12f) + distanceSpeedBoost; + value74 *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; @@ -406,7 +429,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += 1f; if (npc.ai[1] > 5f) @@ -441,14 +464,14 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity.Y -= 2f; } - npc.velocity.X = ((CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost) * npc.direction; + npc.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * npc.direction; npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + float velocityLimit = (death ? 7f : revenge ? 6f : expertMode ? 5f : 4f) + distanceSpeedBoost; if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { npc.velocity.X = -velocityLimit; @@ -464,6 +487,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 6f) @@ -488,12 +512,12 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[num658].velocity *= 0.5f; if (bossLife == 0f && npc.life > 0) { - bossLife = (float)npc.lifeMax; + bossLife = npc.lifeMax; } float num644 = 1f; if (npc.life > 0) { - float num659 = (float)npc.life / (float)npc.lifeMax; + float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; if (num659 != npc.scale) @@ -601,12 +625,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 90, true); - } + player.AddBuff(BuffID.Darkness, 120, true); + } } } diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index bdadee4bc3..27d62a9839 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -8,6 +8,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.SlimeGod { [AutoloadBossHead] @@ -23,18 +24,18 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { - npc.LifeMaxNERB(1000, 1375, 1100000); + npc.Calamity().canBreakPlayerDefense = true; + npc.LifeMaxNERB(1350, 1800, 110000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); - npc.damage = 40; - npc.width = 150; + npc.GetNPCDamage(); + npc.width = 150; npc.height = 92; npc.scale = 0.8f; npc.defense = 8; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - npc.buffImmune[ModContent.BuffType()] = false; animationType = NPCID.KingSlime; npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 55; @@ -43,11 +44,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SlimeGod"); - else - music = MusicID.Boss1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SlimeGod") ?? MusicID.Boss1; bossBag = ModContent.ItemType(); } @@ -63,15 +60,25 @@ namespace CalamityMod.NPCs.SlimeGod public override void AI() { - if (CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active) - { - CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; - } + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive || npc.localAI[1] == 1f; - Vector2 vector = npc.Center; + if (CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active) + CalamityGlobalNPC.slimeGodPurple = npc.whoAmI; + + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || npc.localAI[1] == 1f || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + Vector2 vector = npc.Center; + + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; npc.defense = npc.defDefense; npc.damage = npc.defDamage; @@ -86,14 +93,18 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = false; // Get a 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 == 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(); Player player = Main.player[npc.target]; if (npc.ai[0] != 6f && (player.dead || !player.active)) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (player.dead || !player.active) { @@ -101,12 +112,13 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - } + npc.netUpdate = true; + } } else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * 0.005f; + float distanceSpeedBoost = Vector2.Distance(player.Center, vector) * (malice ? 0.008f : 0.005f); bool flag100 = false; bool hyperMode = npc.localAI[1] == 1f; @@ -123,19 +135,26 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; flag100 = false; } + if (malice) + { + flag100 = false; + hyperMode = true; + } if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] += flag100 ? 0.5f : 1f; + npc.localAI[0] += enraged ? 3f : flag100 ? 0.5f : 1f; if (revenge) npc.localAI[0] += 0.5f; + if (malice) + npc.localAI[0] += 1f; if (npc.localAI[0] >= 600f && Vector2.Distance(player.Center, npc.Center) > 160f) { npc.localAI[0] = 0f; if (expertMode && Main.rand.NextBool(2)) { - float num179 = CalamityWorld.bossRushActive ? 12f : 8f; + float num179 = 8f; 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; @@ -145,8 +164,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = 24; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; num180 = player.position.X + (float)player.width * 0.5f - value9.X; @@ -157,11 +176,11 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-30, 31); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } else { - float num179 = CalamityWorld.bossRushActive ? 12f : 8f; + float num179 = 8f; 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; @@ -171,8 +190,8 @@ namespace CalamityMod.NPCs.SlimeGod num183 = num179 / num183; num180 *= num183; num182 *= num183; - int num184 = expertMode ? 17 : 21; - int num185 = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); value9.X += num180; value9.Y += num182; for (int num186 = 0; num186 < 2; num186++) @@ -185,17 +204,18 @@ namespace CalamityMod.NPCs.SlimeGod num182 += (float)Main.rand.Next(-20, 21); num180 *= num183; num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, type, damage, 0f, Main.myPlayer, 0f, 0f); } - } - } + } + npc.netUpdate = true; + } } if (npc.ai[0] == 0f) { - npc.TargetClosest(true); npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } else if (npc.ai[0] == 1f) { @@ -205,18 +225,19 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += flag100 ? 1f : 2f; float num1879 = 40f; - float num1880 = CalamityWorld.bossRushActive ? 16f : 5f; + float num1880 = death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f; if (revenge) { - float moveBoost = death ? 10f : 10f * (1f - npc.life / (float)npc.lifeMax); - float speedBoost = death ? 2f : 2f * (1f - npc.life / (float)npc.lifeMax); + float moveBoost = death ? 20f * (1f - lifeRatio) : 10f * (1f - lifeRatio); + float speedBoost = death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio); num1879 -= moveBoost; num1880 += speedBoost; } @@ -249,11 +270,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] += 1f; if (revenge) { - npc.ai[2] += death ? 0.5f : 0.5f * (1f - npc.life / (float)npc.lifeMax); + npc.ai[2] += death ? 1f - lifeRatio : 0.5f * (1f - lifeRatio); } if (npc.ai[2] >= 210f && npc.velocity.Y == 0f && Main.netMode != NetmodeID.MultiplayerClient) { - switch (Main.rand.Next(3)) + int random = Main.rand.Next(2) + (lifeRatio < 0.5f ? 1 : 0); + switch (random) { case 0: npc.ai[0] = 2f; @@ -261,7 +283,7 @@ namespace CalamityMod.NPCs.SlimeGod case 1: npc.ai[0] = 3f; npc.noTileCollide = true; - npc.velocity.Y = CalamityWorld.bossRushActive ? -13f : -9f; + npc.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; break; case 2: npc.ai[0] = 5f; @@ -272,6 +294,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 2f) @@ -283,6 +306,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[0] = 1f; npc.ai[1] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 3f) @@ -298,7 +322,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.direction = 1; } npc.spriteDirection = npc.direction; - npc.TargetClosest(true); + npc.TargetClosest(); Vector2 center40 = player.Center; center40.Y -= 350f; Vector2 vector272 = center40 - vector; @@ -307,7 +331,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] += 1f; vector272 = player.Center - vector; vector272.Normalize(); - vector272 *= CalamityWorld.bossRushActive ? 13f : 9f; + vector272 *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; npc.velocity = (npc.velocity * 4f + vector272) / 5f; if (npc.ai[1] > 12f) { @@ -315,6 +339,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[0] = 3.1f; npc.ai[2] = 0f; npc.velocity = vector272; + npc.netUpdate = true; } } else @@ -326,7 +351,7 @@ namespace CalamityMod.NPCs.SlimeGod return; } vector272.Normalize(); - vector272 *= (CalamityWorld.bossRushActive ? 19f : 11f) + distanceSpeedBoost; + vector272 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; npc.velocity = (npc.velocity * 5f + vector272) / 6f; } } @@ -347,9 +372,9 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[2] = 0f; npc.ai[3] = 0f; if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { npc.ai[0] = 4f; - } + + npc.netUpdate = true; } } else if (npc.ai[2] == 0f) @@ -358,7 +383,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.noGravity = true; } npc.velocity.Y += 0.2f; - float velocityLimit = CalamityWorld.bossRushActive ? 22f : 16f; + float velocityLimit = death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; if (npc.velocity.Y > velocityLimit) { npc.velocity.Y = velocityLimit; @@ -387,11 +412,12 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } if (value74.Length() > 50f) { value74.Normalize(); - value74 *= (CalamityWorld.bossRushActive ? 22f : 11f) + distanceSpeedBoost; + value74 *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; } npc.velocity = (npc.velocity * 4f + value74) / 5f; return; @@ -400,7 +426,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (npc.velocity.Y == 0f) { - npc.TargetClosest(true); + npc.TargetClosest(); npc.velocity.X *= 0.8f; npc.ai[1] += 1f; if (npc.ai[1] > 5f) @@ -435,14 +461,14 @@ namespace CalamityMod.NPCs.SlimeGod { npc.velocity.Y -= 2f; } - npc.velocity.X = ((CalamityWorld.bossRushActive ? 20f : 10f) + distanceSpeedBoost) * npc.direction; + npc.velocity.X = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost) * npc.direction; npc.ai[2] += 1f; } } else { npc.velocity.X *= 0.98f; - float velocityLimit = (CalamityWorld.bossRushActive ? 12f : 6f) + distanceSpeedBoost; + float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f) + distanceSpeedBoost; if (npc.direction < 0 && npc.velocity.X > -velocityLimit) { npc.velocity.X = -velocityLimit; @@ -458,6 +484,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.netUpdate = true; } } else if (npc.ai[0] == 6f) @@ -482,12 +509,12 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[num244].velocity *= 0.5f; if (bossLife == 0f && npc.life > 0) { - bossLife = (float)npc.lifeMax; + bossLife = npc.lifeMax; } float num644 = 1f; if (npc.life > 0) { - float num659 = (float)npc.life / (float)npc.lifeMax; + float num659 = lifeRatio; num659 = num659 * 0.5f + 0.75f; num659 *= num644; if (num659 != npc.scale) @@ -591,12 +618,11 @@ namespace CalamityMod.NPCs.SlimeGod public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.85f); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 180, true); - } + player.AddBuff(BuffID.Weak, 120, true); + } } } diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs index 53c8d29f7a..7a7605dbb9 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt.cs @@ -1,4 +1,4 @@ -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -17,14 +17,14 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { npc.aiStyle = 14; - npc.damage = 40; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 30; npc.defense = 6; npc.lifeMax = 180; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.knockBackResist = 0f; animationType = 121; @@ -35,15 +35,11 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.OnFire] = true; } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (Main.netMode != NetmodeID.MultiplayerClient && npc.life <= 0) { @@ -58,7 +54,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 90, true); - } + player.AddBuff(BuffID.Weak, 90, true); + } } } diff --git a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs index 4050e653b9..5d8e7756fe 100644 --- a/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCorrupt2.cs @@ -1,4 +1,4 @@ -using CalamityMod.World; +using CalamityMod.Events; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,14 +16,14 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { npc.aiStyle = 1; - npc.damage = 30; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 30; npc.defense = 4; npc.lifeMax = 90; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 50000; + npc.lifeMax = 5000; } npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.OnFire] = true; } public override void HitEffect(int hitDirection, double damage) @@ -59,7 +58,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 90, true); - } + player.AddBuff(BuffID.Weak, 90, true); + } } } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index fbd905a275..272da43c7e 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -1,4 +1,4 @@ -using CalamityMod.World; +using CalamityMod.Events; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,14 +16,14 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { npc.aiStyle = 1; - npc.damage = 35; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 30; npc.defense = 4; npc.lifeMax = 110; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 100000; + npc.lifeMax = 10000; } npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.OnFire] = true; } public override void HitEffect(int hitDirection, double damage) @@ -54,12 +53,12 @@ namespace CalamityMod.NPCs.SlimeGod public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.Nazar, Main.expertMode ? 50 : 100); + DropHelper.DropItemChance(npc, ItemID.Blindfold, Main.expertMode ? 50 : 100); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 60, true); - } + player.AddBuff(BuffID.Darkness, 90, true); + } } } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index 79e8bbf526..41a8fc097d 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -1,5 +1,5 @@ +using CalamityMod.Events; using CalamityMod.Projectiles.Enemy; -using CalamityMod.World; using Microsoft.Xna.Framework; using System; using Terraria; @@ -21,14 +21,14 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { npc.aiStyle = 1; - npc.damage = 45; - npc.width = 40; + npc.GetNPCDamage(); + npc.width = 40; npc.height = 30; npc.defense = 6; npc.lifeMax = 130; - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) { - npc.lifeMax = 120000; + npc.lifeMax = 12000; } npc.knockBackResist = 0f; animationType = NPCID.CorruptSlime; @@ -39,16 +39,16 @@ namespace CalamityMod.NPCs.SlimeGod npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.buffImmune[BuffID.OnFire] = true; } public override void AI() { if (spikeTimer > 0f) - { spikeTimer -= 1f; - } - if (!npc.wet) + + int type = ModContent.ProjectileType(); + 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; @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.SlimeGod vector4.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.005f; vector4.Normalize(); vector4 *= 4f + (float)Main.rand.Next(-50, 51) * 0.01f; - Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, ModContent.ProjectileType(), 13, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector3.X, vector3.Y, vector4.X, vector4.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); spikeTimer = 30f; } } @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.SlimeGod num14 *= num16; num15 *= num16; spikeTimer = 50f; - Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, ModContent.ProjectileType(), 12, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector3.X, vector3.Y, num14, num15, type, damage, 0f, Main.myPlayer, 0f, 0f); } } } @@ -113,12 +113,12 @@ namespace CalamityMod.NPCs.SlimeGod public override void NPCLoot() { - DropHelper.DropItemChance(npc, ItemID.Nazar, Main.expertMode ? 50 : 100); + DropHelper.DropItemChance(npc, ItemID.Blindfold, Main.expertMode ? 50 : 100); } public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 60, true); - } + player.AddBuff(BuffID.Darkness, 90, true); + } } } diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs deleted file mode 100644 index 55a130d888..0000000000 --- a/NPCs/StormWeaver/StasisProbe.cs +++ /dev/null @@ -1,250 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StasisProbe : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stasis Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 70; - npc.width = 30; - npc.height = 30; - npc.defense = 60; - npc.DR_NERD(0.25f); - npc.lifeMax = 1200; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 25000; - } - npc.knockBackResist = 0.9f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.buffImmune[BuffID.OnFire] = true; - } - - public override void AI() - { - // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; - - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 12f : 9f; - float num2 = revenge ? 0.15f : 0.12f; - 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); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 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)) - { - int num8 = Main.expertMode ? 50 : 60; - int num9 = ProjectileID.PinkLaser; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 200; - } - } - 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); - } - if (num4 > 0f) - { - 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; - } - float num12 = 0.7f; - 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.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - 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.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - 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) - { - npc.netUpdate = true; - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - 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 = 30; - npc.height = 30; - 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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.PurpleCosmolite, 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StasisProbe1"),1f); - CalamityUtils.ExplosionGores(npc.Center, 1); - } - } - - public override bool PreNPCLoot() - { - return false; - } - } -} diff --git a/NPCs/StormWeaver/StasisProbe.png b/NPCs/StormWeaver/StasisProbe.png deleted file mode 100644 index 3788722274..0000000000 Binary files a/NPCs/StormWeaver/StasisProbe.png and /dev/null differ diff --git a/NPCs/StormWeaver/StasisProbeNaked.cs b/NPCs/StormWeaver/StasisProbeNaked.cs deleted file mode 100644 index aeb40c143d..0000000000 --- a/NPCs/StormWeaver/StasisProbeNaked.cs +++ /dev/null @@ -1,250 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.StormWeaver -{ - public class StasisProbeNaked : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stasis Probe"); - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.npcSlots = 10f; - npc.damage = 80; - npc.width = 30; - npc.height = 30; - npc.defense = 30; - npc.lifeMax = 1500; - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 25000; - } - npc.knockBackResist = 0.925f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath19; - npc.buffImmune[BuffID.OnFire] = true; - } - - public override void AI() - { - // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - npc.damage = 0; - - bool revenge = CalamityWorld.revenge; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - float num = revenge ? 14f : 10f; - float num2 = revenge ? 0.18f : 0.15f; - 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); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (npc.justHit) - { - npc.localAI[0] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) - { - 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 ? 50 : 60; - int num9 = ProjectileID.PinkLaser; - int beam = Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].timeLeft = 200; - } - } - 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); - } - if (num4 > 0f) - { - 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; - } - float num12 = 0.7f; - 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.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && npc.velocity.Y < 1.5f) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && npc.velocity.Y > -1.5f) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X *= 1.05f; - } - } - else - { - 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) - { - npc.netUpdate = true; - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override void HitEffect(int hitDirection, double damage) - { - 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 = 30; - npc.height = 30; - 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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.PurpleCosmolite, 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/StasisProbeNaked1"), 1f); - CalamityUtils.ExplosionGores(npc.Center, 1); - } - } - - public override bool PreNPCLoot() - { - return false; - } - } -} diff --git a/NPCs/StormWeaver/StasisProbeNaked.png b/NPCs/StormWeaver/StasisProbeNaked.png deleted file mode 100644 index 2849cf8f50..0000000000 Binary files a/NPCs/StormWeaver/StasisProbeNaked.png and /dev/null differ diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 948cfc5591..b8d40642a5 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -8,8 +9,6 @@ namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBody : ModNPC { - private int spawn = 0; - public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); @@ -17,8 +16,8 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetDefaults() { - npc.damage = 100; - npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 40; npc.height = 40; npc.defense = 0; @@ -26,21 +25,17 @@ namespace CalamityMod.NPCs.StormWeaver global.DR = 0.999999f; global.unbreakableDR = true; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 100000 : 20000, notDoGFight ? 100000 : 20000, 170000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 17000); + + // If fought alone, Storm Weaver plays its own theme if (notDoGFight) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; + // If fought as a DoG interlude, keep the DoG music playing + else + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -54,12 +49,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; npc.chaseable = false; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -68,45 +66,40 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { - if (npc.defense < 99999 && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2)) - npc.defense = 99999; - else - npc.defense = 0; - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + + 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); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag1 = false; - if (npc.ai[1] <= 0f) - { - flag1 = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) - { - flag1 = true; - } - if (flag1) - { - npc.life = 0; - npc.HitEffect(0, 30.0); - npc.checkDead(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -117,16 +110,15 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num935].noLight = true; } } + npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } } + 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); @@ -156,14 +148,11 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -185,7 +174,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) { if (projectile.penetrate == -1 && !projectile.minion) { @@ -196,10 +185,14 @@ namespace CalamityMod.NPCs.StormWeaver projectile.penetrate = 1; } } - } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 90, true); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { @@ -231,25 +224,12 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num624].velocity *= 2f; } } - if (NPC.CountNPCS(ModContent.NPCType()) < 3) - { - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn == 0 && Main.rand.NextBool(15)) - { - spawn = 1; - int num660 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - 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.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index b3cb4bd850..32e0d3414f 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,7 +12,6 @@ namespace CalamityMod.NPCs.StormWeaver { public class StormWeaverBodyNaked : ModNPC { - private int spawn = 14; private int invinceTime = 180; public override void SetStaticDefaults() @@ -22,25 +22,21 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetDefaults() { - npc.damage = 120; - npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 40; npc.height = 40; - npc.lifeMax = 100000; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 900000 : 150000, notDoGFight ? 900000 : 150000, 3500000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + npc.lifeMax = notDoGFight ? 760500 : 126750; + npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 455000); + + // If fought alone, Storm Weaver plays its own theme + if (notDoGFight) + music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; + // If fought as a DoG interlude, keep the DoG music playing else - music = MusicID.Boss3; - if (notDoGFight) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - } + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -55,12 +51,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override void SendExtraAI(BinaryWriter writer) { @@ -81,8 +80,6 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { - bool expertMode = Main.expertMode; - if (invinceTime > 0) { invinceTime--; @@ -97,28 +94,35 @@ namespace CalamityMod.NPCs.StormWeaver 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[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - 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(); - } + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -129,11 +133,10 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num935].noLight = true; } } + 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); @@ -145,6 +148,7 @@ namespace CalamityMod.NPCs.StormWeaver vector18.Y = (int)(vector18.Y / 16f) * 16; 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) { @@ -156,7 +160,8 @@ namespace CalamityMod.NPCs.StormWeaver } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + + npc.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; num193 = (num193 - num194) / num193; @@ -165,14 +170,11 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -193,34 +195,28 @@ namespace CalamityMod.NPCs.StormWeaver for (int num155 = 1; num155 < num153; num155 += 2) { Color color38 = lightColor; - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); - color38.R = 0; - color38.G = newColor; - color38.B = newColor; - } + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); Color color = npc.GetAlpha(lightColor); - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); - color.R = 0; - color.G = newColor; - color.B = newColor; - } + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; @@ -234,7 +230,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 ? 200 : 60; + int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 180 : 90; player.AddBuff(BuffID.Electrified, buffDuration, true); } @@ -250,17 +246,22 @@ namespace CalamityMod.NPCs.StormWeaver public override void HitEffect(int hitDirection, double damage) { - if (npc.life <= 0) + for (int k = 0; k < 3; k++) + Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); + + if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody1"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeBody3"), 1f); + 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -271,6 +272,7 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + 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.PurpleCosmolite, 0f, 0f, 100, default, 3f); @@ -280,26 +282,12 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num624].velocity *= 2f; } } - if (NPC.CountNPCS(ModContent.NPCType()) < 3) - { - spawn--; - if (npc.life > 0 && Main.netMode != NetmodeID.MultiplayerClient && spawn <= 0) - { - spawn = 14; - int num660 = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num660, 0f, 0f, 0f, 0, 0, 0); - } - 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.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 2dc24a65ba..5a511afc44 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -17,8 +18,6 @@ namespace CalamityMod.NPCs.StormWeaver private const float speed = 10f; private const float turnSpeed = 0.3f; private bool tail = false; - private const int minLength = 30; - private const int maxLength = 31; public override void SetStaticDefaults() { @@ -27,8 +26,9 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetDefaults() { - npc.damage = 140; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 74; npc.height = 74; npc.defense = 0; @@ -36,19 +36,15 @@ namespace CalamityMod.NPCs.StormWeaver global.DR = 0.999999f; global.unbreakableDR = true; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 100000 : 20000, notDoGFight ? 100000 : 20000, 170000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 17000); + + // If fought alone, Storm Weaver plays its own theme if (notDoGFight) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - } + music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; + // If fought as a DoG interlude, keep the DoG music playing + else + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -63,11 +59,14 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override void SendExtraAI(BinaryWriter writer) { @@ -81,31 +80,30 @@ namespace CalamityMod.NPCs.StormWeaver public override void AI() { - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - if (npc.defense < 99999 && (CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2)) - { - npc.defense = 99999; - } - else - { - npc.defense = 0; - } - if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) - { + bool enraged = npc.Calamity().enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; + + if (!Main.raining && !BossRushEvent.BossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) CalamityUtils.StartRain(); - } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.alpha != 0) + + 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]; + + // Get a target + 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 (npc.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { @@ -114,20 +112,21 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num935].noLight = true; } } + npc.alpha -= 12; if (npc.alpha < 0) - { npc.alpha = 0; - } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (!tail && npc.ai[0] == 0f) { int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) + int totalLength = death ? 60 : revenge ? 50 : expertMode ? 40 : 30; + for (int num36 = 0; num36 < totalLength; num36++) { int lol; - if (num36 >= 0 && num36 < minLength) + 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); } @@ -136,45 +135,42 @@ namespace CalamityMod.NPCs.StormWeaver 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].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)lol; + Main.npc[lol].ai[2] = npc.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; npc.netUpdate = true; Previous = lol; } tail = true; } - int damage = expertMode ? 62 : 75; if (expertMode) { npc.localAI[0] += 1f; if (npc.localAI[0] >= 360f) { npc.localAI[0] = 0f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; - float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; - Vector2 spawnPos = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(spawnPos, Vector2.Zero, ProjectileID.CultistBossLightningOrb, damage, 0f, Main.myPlayer, 0f, 0f); + float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + 500f : Main.player[npc.target].position.X - 500f; + Vector2 spawnPos = new Vector2(xPos, Main.player[npc.target].position.Y + Main.rand.Next(-500, 501)); + int type = ProjectileID.CultistBossLightningOrb; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(spawnPos, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, 0f); } } if (BoltCountdown == 0) { - BoltCountdown = 600; + BoltCountdown = malice ? 480 : 600; } if (BoltCountdown > 0) { BoltCountdown--; if (BoltCountdown == 0) { - int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) - { - speed2 += 1; - } - float spawnX2 = (float)Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; + int speed2 = enraged ? 10 : revenge ? 8 : 7; + float spawnX2 = Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; float spawnY2 = -1000f + Main.player[npc.target].Center.Y; Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; @@ -185,11 +181,13 @@ namespace CalamityMod.NPCs.StormWeaver { Vector2 source = baseSpawn; source.X += i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / (float)BoltProjectiles))); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / BoltProjectiles))); velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; Vector2 vector94 = Main.player[npc.target].Center - source; - float ai = (float)Main.rand.Next(100); - Projectile.NewProjectile(source, velocity, ProjectileID.CultistBossLightningOrbArc, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + float ai = Main.rand.Next(100); + int type = ProjectileID.CultistBossLightningOrbArc; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(source, velocity, type, damage, 0f, Main.myPlayer, vector94.ToRotation(), ai); } } } @@ -251,10 +249,6 @@ namespace CalamityMod.NPCs.StormWeaver { npc.spriteDirection = 1; } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(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); @@ -300,8 +294,8 @@ namespace CalamityMod.NPCs.StormWeaver } else { - num188 = revenge ? 11f : 10f; - num189 = revenge ? 0.31f : 0.28f; + num188 = enraged ? 15f : malice ? 13f : revenge ? 11f : 10f; + num189 = enraged ? 0.45f : malice ? 0.38f : revenge ? 0.31f : 0.28f; } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -473,7 +467,12 @@ namespace CalamityMod.NPCs.StormWeaver return false; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -525,12 +524,9 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override bool PreNPCLoot() - { - return false; - } + public override bool PreNPCLoot() => false; - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); } diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index 2962df3033..ea90959448 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -1,8 +1,13 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -12,20 +17,24 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.StormWeaver { [AutoloadBossHead] public class StormWeaverHeadNaked : ModNPC { - private const float BoltAngleSpread = 280; + private const float BoltAngleSpread = 280; private const float speed = 13f; private const float turnSpeed = 0.35f; private bool tail = false; - private int minLength = 40; - private int maxLength = 41; private int invinceTime = 180; - public override void SetStaticDefaults() + // Lightning flash variables + public float lightning = 0f; + private float lightningDecay = 1f; + private float lightningSpeed = 0f; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Storm Weaver"); NPCID.Sets.TrailingMode[npc.type] = 1; @@ -33,25 +42,25 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetDefaults() { - npc.damage = 180; - npc.npcSlots = 5f; + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 74; npc.height = 74; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 900000 : 150000, notDoGFight ? 900000 : 150000, 3500000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (notDoGFight) + npc.lifeMax = notDoGFight ? 760500 : 126750; + npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 455000); + + // If fought alone, Storm Weaver plays its own theme + if (notDoGFight) { npc.value = Item.buyPrice(0, 35, 0, 0); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; + music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; } + // If fought as a DoG interlude, keep the DoG music playing + else + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -65,11 +74,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } + bossBag = ModContent.ItemType(); + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override void SendExtraAI(BinaryWriter writer) { @@ -77,7 +90,9 @@ namespace CalamityMod.NPCs.StormWeaver writer.Write(npc.dontTakeDamage); writer.Write(npc.localAI[1]); writer.Write(npc.localAI[2]); - } + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } public override void ReceiveExtraAI(BinaryReader reader) { @@ -85,15 +100,20 @@ namespace CalamityMod.NPCs.StormWeaver npc.dontTakeDamage = reader.ReadBoolean(); npc.localAI[1] = reader.ReadSingle(); npc.localAI[2] = reader.ReadSingle(); - } + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } public override void AI() { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; + bool enraged = calamityGlobalNPC.enraged > 0; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + npc.Calamity().CurrentlyEnraged = (!BossRushEvent.BossRushActive && malice) || enraged; if (invinceTime > 0) { @@ -107,38 +127,40 @@ namespace CalamityMod.NPCs.StormWeaver npc.dontTakeDamage = false; } - if (!Main.raining && !CalamityWorld.bossRushActive && CalamityWorld.DoGSecondStageCountdown <= 0) - { + if (!Main.raining) CalamityUtils.StartRain(); - } - double lifeRatio = npc.life / (double)npc.lifeMax; - int lifePercentage = (int)(100.0 * lifeRatio); - int projectileDamage = expertMode ? 62 : 75; + float lifeRatio = npc.life / (float)npc.lifeMax; - int BoltProjectiles = 2; - if (lifePercentage < 33 || death) - { - BoltProjectiles = 4; - } - else if (lifePercentage < 66) - { - BoltProjectiles = 3; - } + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Start charging at the target + bool phase2 = lifeRatio < 0.7f; + + // Lightning strike flash phase + bool phase3 = lifeRatio < 0.4f; + + // Become weak and cancel the storm + bool phase4 = npc.life / (float)npc.lifeMax < 0.05f; + + 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); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + 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); - } + // 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.alpha != 0) + // 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 (npc.alpha != 0) { for (int num934 = 0; num934 < 2; num934++) { @@ -150,19 +172,18 @@ namespace CalamityMod.NPCs.StormWeaver npc.alpha -= 12; if (npc.alpha < 0) - { npc.alpha = 0; - } if (Main.netMode != NetmodeID.MultiplayerClient) { if (!tail && npc.ai[0] == 0f) { int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) + int totalLength = death ? 60 : revenge ? 50 : expertMode ? 40 : 30; + for (int num36 = 0; num36 < totalLength; num36++) { int lol; - if (num36 >= 0 && num36 < minLength) + 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); } @@ -180,29 +201,37 @@ namespace CalamityMod.NPCs.StormWeaver tail = true; } - if (expertMode) + if (expertMode && !phase4) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) + npc.localAI[0] += enraged ? 2f : malice ? 1.5f : 1f; + if (npc.localAI[0] >= 450f) { npc.localAI[0] = 0f; - npc.TargetClosest(true); npc.netUpdate = true; - float xPos = Main.rand.NextBool(2) ? npc.position.X + 300f : npc.position.X - 300f; - Vector2 spawnPos = new Vector2(xPos, npc.position.Y + Main.rand.Next(-300, 301)); - Projectile.NewProjectile(spawnPos, Vector2.Zero, ProjectileID.CultistBossLightningOrb, projectileDamage, 0f, Main.myPlayer, 0f, 0f); + + int random = Main.rand.Next(250, 501); + float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + random : Main.player[npc.target].position.X - random; + random = Main.rand.Next(250, 501); + float yPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.Y + random : Main.player[npc.target].position.Y - random; + Vector2 spawnPos = new Vector2(xPos, yPos); + + int type = ProjectileID.CultistBossLightningOrb; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(spawnPos, Vector2.Zero, type, damage, 0f, Main.myPlayer); } } } if (Main.player[npc.target].dead && npc.life > 0) { - npc.TargetClosest(false); + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + npc.TargetClosest(false); + npc.velocity.Y = npc.velocity.Y - 10f; if ((double)npc.position.Y < Main.topWorld + 16f) - { npc.velocity.Y = npc.velocity.Y - 10f; - } + if ((double)npc.position.Y < Main.topWorld + 16f) { CalamityWorld.DoGSecondStageCountdown = 0; @@ -213,7 +242,7 @@ namespace CalamityMod.NPCs.StormWeaver netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - for (int num957 = 0; num957 < 200; num957++) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { if (Main.npc[num957].active && (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() @@ -235,7 +264,7 @@ namespace CalamityMod.NPCs.StormWeaver netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - for (int num957 = 0; num957 < 200; num957++) + for (int num957 = 0; num957 < Main.maxNPCs; num957++) { if (Main.npc[num957].type == ModContent.NPCType() || Main.npc[num957].type == ModContent.NPCType() @@ -247,81 +276,77 @@ namespace CalamityMod.NPCs.StormWeaver } 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); - } 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 = revenge ? 13f : 12f; - float num189 = revenge ? 0.31f : 0.28f; + float num188 = enraged ? 17f : malice ? 15f : revenge ? 13f : 12f; + float num189 = enraged ? 0.41f : malice ? 0.36f : revenge ? 0.31f : 0.28f; - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= 400f) + // Start charging at the player when in phase 2 + if (phase2 && !phase4) { - if (npc.localAI[1] == 0f) - npc.localAI[1] = 1f; - - if (calamityGlobalNPC.newAI[0] >= 500f) + calamityGlobalNPC.newAI[0] += 1f; + if (calamityGlobalNPC.newAI[0] >= 400f) { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } + if (npc.localAI[1] == 0f) + npc.localAI[1] = 1f; - if (revenge) - { - if (npc.localAI[1] == 2f) + if (calamityGlobalNPC.newAI[0] >= 500f) { - num188 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.01f * (1f - (float)lifeRatio); - num189 += Vector2.Distance(Main.player[npc.target].Center, npc.Center) * 0.0001f * (1f - (float)lifeRatio); - num188 *= 2f; - num189 *= 0.75f; - - float stopChargeDistance = 800f * npc.localAI[2]; - if (stopChargeDistance < 0) - { - if (npc.Center.X < Main.player[npc.target].Center.X + stopChargeDistance) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - } - else - { - if (npc.Center.X > Main.player[npc.target].Center.X + stopChargeDistance) - { - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - } + npc.TargetClosest(); + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; } - int dustAmt = 5; - for (int num1474 = 0; num1474 < dustAmt; num1474++) + if (revenge) { - 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; + 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 *= 2f; + num189 *= 0.85f; + + float stopChargeDistance = 800f * npc.localAI[2]; + if (stopChargeDistance < 0) + { + if (npc.Center.X < Main.player[npc.target].Center.X + stopChargeDistance) + { + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + else + { + if (npc.Center.X > Main.player[npc.target].Center.X + stopChargeDistance) + { + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + } + + 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 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; + } } } + else if (revenge) + calamityGlobalNPC.newAI[0] += malice ? 4f : death ? 2f : 2f * (0.7f - lifeRatio); } - else if (revenge) - calamityGlobalNPC.newAI[0] += death ? 2f : 2f * (float)(1D - lifeRatio); float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -340,46 +365,72 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (npc.localAI[1] == 1f) + if (phase2 && !phase4) { - npc.localAI[1] = 2f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)Main.player[npc.target].Center.X, (int)Main.player[npc.target].Center.Y); - - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.localAI[1] == 1f) { - int speed2 = revenge ? 8 : 7; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + // Play lightning sound on the target if not in phase 3 + Vector2 soundCenter = Main.player[npc.target].Center; + + // Play lightning sound on all nearby players if in phase 3 + if (phase3) { - speed2 += 1; + 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); + + if (Main.netMode != NetmodeID.Server) + { + // Set how quickly the lightning flash dissipates + lightningDecay = Main.rand.NextFloat() * 0.05f + 0.008f; + + // Set how quickly the lightning flash intensifies + lightningSpeed = Main.rand.NextFloat() * 0.05f + 0.05f; + } + } } - float spawnX2 = Main.rand.Next(2001) - 1000f + Main.player[npc.target].Center.X; - float spawnY2 = -1000f + Main.player[npc.target].Center.Y; - Vector2 baseSpawn = new Vector2(spawnX2, spawnY2); - Vector2 baseVelocity = Main.player[npc.target].Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - for (int i = 0; i < BoltProjectiles; i++) + else + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)soundCenter.X, (int)soundCenter.Y); + + npc.localAI[1] = 2f; + + if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 source = baseSpawn; - source.X += i * 30 - (BoltProjectiles * 15); - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-BoltAngleSpread / 2 + (BoltAngleSpread * i / BoltProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - Vector2 vector94 = Main.player[npc.target].Center - source; - float ai = Main.rand.Next(100); - Projectile.NewProjectile(source, velocity, ProjectileID.CultistBossLightningOrbArc, projectileDamage, 0f, Main.myPlayer, vector94.ToRotation(), ai); + int speed2 = enraged ? 10 : 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; + baseVelocity.Normalize(); + baseVelocity *= speed2; + + for (int i = 0; i < boltProjectiles; i++) + { + Vector2 source = baseSpawn; + 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; + float ai = Main.rand.Next(100); + int type = ProjectileID.CultistBossLightningOrbArc; + 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; + + float chargeDirection = 0; + if (npc.velocity.X < 0f) + chargeDirection = -1f; + else if (npc.velocity.X > 0f) + chargeDirection = 1f; + + npc.localAI[2] = chargeDirection; } - - 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 * (1f - (float)lifeRatio)) * 2f; - - float chargeDirection = 0; - if (npc.velocity.X < 0f) - chargeDirection = -1f; - else if (npc.velocity.X > 0f) - chargeDirection = 1f; - - npc.localAI[2] = chargeDirection; } num191 = (int)(num191 / 16f) * 16; @@ -394,6 +445,7 @@ namespace CalamityMod.NPCs.StormWeaver 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 < num191) @@ -403,10 +455,9 @@ namespace CalamityMod.NPCs.StormWeaver else { if (npc.velocity.X > num191) - { npc.velocity.X = npc.velocity.X - num189; - } } + if (npc.velocity.Y < num192) { npc.velocity.Y = npc.velocity.Y + num189; @@ -414,31 +465,23 @@ namespace CalamityMod.NPCs.StormWeaver else { 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 (npc.velocity.Y > 0f) - { npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } else - { 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 (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } + npc.velocity.X = npc.velocity.X + num189 * 2f; else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } + npc.velocity.X = npc.velocity.X - num189 * 2f; } } else @@ -446,50 +489,70 @@ namespace CalamityMod.NPCs.StormWeaver if (num196 > num197) { 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; 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; + 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; - } else - { 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 ((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; - } else - { 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) + MathHelper.PiOver2; + + if (phase4) + { + // Become weak and stop the storm when in phase 4 + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + CalamityMod.StopRain(); + } + else if (phase3) + { + // Adjust lightning flash variables when in phase 3 + if (Main.netMode != NetmodeID.Server) + { + if (lightningSpeed > 0f) + { + lightning += lightningSpeed; + if (lightning >= 1f) + { + lightning = 1f; + lightningSpeed = 0f; + } + } + else if (lightning > 0f) + lightning -= lightningDecay; + } + + // Start a storm when in third phase + if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu) || calamityGlobalNPC.newAI[1] > 0f) + return; + + CalamityUtils.StartRain(true, true); + calamityGlobalNPC.newAI[1] = 1f; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -508,34 +571,28 @@ namespace CalamityMod.NPCs.StormWeaver for (int num155 = 1; num155 < num153; num155 += 2) { Color color38 = lightColor; - if (npc.Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - byte newColor = (byte)MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); - color38.R = 0; - color38.G = newColor; - color38.B = newColor; - } + + if (npc.Calamity().newAI[0] > 280f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); Color color = npc.GetAlpha(lightColor); - if (npc.Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - byte newColor = (byte)MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); - color.R = 0; - color.G = newColor; - color.B = newColor; - } + + if (npc.Calamity().newAI[0] > 280f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((npc.Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; @@ -549,7 +606,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = npc.Calamity().newAI[0] >= 400f ? 300 : 90; + int buffDuration = npc.Calamity().newAI[0] >= 400f ? 360 : 180; player.AddBuff(BuffID.Electrified, buffDuration, true); } @@ -561,19 +618,20 @@ 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.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); - } + if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeHead1"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeHead2"), 1f); + 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -584,6 +642,7 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + 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.PurpleCosmolite, 0f, 0f, 100, default, 3f); @@ -597,19 +656,18 @@ namespace CalamityMod.NPCs.StormWeaver public override bool CheckDead() { - for (int num569 = 0; num569 < 200; num569++) + for (int num569 = 0; num569 < Main.maxNPCs; num569++) { if (Main.npc[num569].active && (Main.npc[num569].type == ModContent.NPCType() || Main.npc[num569].type == ModContent.NPCType())) - { Main.npc[num569].life = 0; - } } + return true; } public override void BossLoot(ref string name, ref int potionType) { - potionType = ItemID.SuperHealingPotion; + potionType = ModContent.ItemType(); } public override bool SpecialNPCLoot() @@ -624,30 +682,42 @@ namespace CalamityMod.NPCs.StormWeaver public override void NPCLoot() { - // Only drop items if fought alone - if (CalamityWorld.DoGSecondStageCountdown <= 0) + // Only drop items if fought at full strength + bool fullStrength = !CalamityWorld.downedSentinel2 || CalamityWorld.DoGSecondStageCountdown <= 0; + if (fullStrength) { - // Materials - DropHelper.DropItem(npc, ModContent.ItemType(), true, 5, 8); + DropHelper.DropBags(npc); - // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 3 : 4); + // Legendary drop for Storm Weaver + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); - if (Main.rand.NextBool(20)) + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + bool lastSentinelKilled = CalamityWorld.downedSentinel1 && !CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); + + if (!Main.expertMode) { - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItem(npc, ModContent.ItemType()); - } + // Materials + DropHelper.DropItem(npc, ModContent.ItemType(), true, 5, 8); - // Other - bool lastSentinelKilled = CalamityWorld.downedSentinel1 && !CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3; - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, lastSentinelKilled); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedSentinel2, 5, 2, 1); + // Weapons + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 4); + + // Vanity + DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + + // Light pet. + 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()); + } + } } // If DoG's fight is active, set the timer for Signus' phase @@ -664,10 +734,10 @@ namespace CalamityMod.NPCs.StormWeaver } // Mark Storm Weaver as dead - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (fullStrength) { CalamityWorld.downedSentinel2 = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 81d4b11f26..be93b89de6 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -1,6 +1,8 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,28 +18,24 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetDefaults() { - npc.damage = 80; - npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 48; npc.height = 80; npc.defense = 0; - npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; + npc.takenDamageMultiplier = 3f; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 100000 : 20000, notDoGFight ? 100000 : 20000, 170000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + npc.LifeMaxNERB(notDoGFight ? 65000 : 13000, notDoGFight ? 65000 : 13000, 17000); + + // If fought alone, Storm Weaver plays its own theme if (notDoGFight) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - } - double HPBoost = (double)CalamityConfig.Instance.BossHealthBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; + // If fought as a DoG interlude, keep the DoG music playing + else + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -50,12 +48,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit53; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -65,39 +66,39 @@ namespace CalamityMod.NPCs.StormWeaver 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.2f, 0.05f, 0.2f); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + + 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); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - 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(); - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -108,16 +109,15 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num935].noLight = true; } } + npc.alpha -= 42; if (npc.alpha < 0) - { npc.alpha = 0; - } } + 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); @@ -147,14 +147,11 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -164,7 +161,12 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 60, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -201,7 +203,30 @@ namespace CalamityMod.NPCs.StormWeaver } } - public override bool CheckActive() + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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) * 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/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); + + return false; + } + + public override bool CheckActive() { return false; } @@ -214,7 +239,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/StormWeaver/StormWeaverTailGlow.png b/NPCs/StormWeaver/StormWeaverTailGlow.png new file mode 100644 index 0000000000..ca9a5f59b0 Binary files /dev/null and b/NPCs/StormWeaver/StormWeaverTailGlow.png differ diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index 4b3236099e..9cd942593f 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,24 +22,21 @@ namespace CalamityMod.NPCs.StormWeaver public override void SetDefaults() { - npc.damage = 100; - npc.npcSlots = 5f; + npc.GetNPCDamage(); + npc.npcSlots = 5f; npc.width = 48; npc.height = 80; bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel2; - npc.LifeMaxNERB(notDoGFight ? 900000 : 150000, notDoGFight ? 900000 : 150000, 3500000); - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + npc.lifeMax = notDoGFight ? 760500 : 126750; + npc.LifeMaxNERB(npc.lifeMax, npc.lifeMax, 455000); + + // If fought alone, Storm Weaver plays its own theme + if (notDoGFight) + music = CalamityMod.Instance.GetMusicFromMusicMod("Weaver") ?? MusicID.Boss3; + // If fought as a DoG interlude, keep the DoG music playing else - music = MusicID.Boss3; - if (notDoGFight) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Weaver"); - else - music = MusicID.Boss3; - } + music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; @@ -53,12 +51,15 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; - } + + if (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override void SendExtraAI(BinaryWriter writer) { @@ -93,28 +94,35 @@ namespace CalamityMod.NPCs.StormWeaver 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[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - 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(); - } + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) { @@ -125,11 +133,10 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num935].noLight = true; } } + 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); @@ -141,6 +148,7 @@ namespace CalamityMod.NPCs.StormWeaver vector18.Y = (int)(vector18.Y / 16f) * 16; 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) { @@ -152,7 +160,8 @@ namespace CalamityMod.NPCs.StormWeaver } catch { } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; + + npc.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2; num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); int num194 = npc.width; num193 = (num193 - num194) / num193; @@ -161,14 +170,11 @@ namespace CalamityMod.NPCs.StormWeaver npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } @@ -189,34 +195,28 @@ namespace CalamityMod.NPCs.StormWeaver for (int num155 = 1; num155 < num153; num155 += 2) { Color color38 = lightColor; - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); - color38.R = 0; - color38.G = newColor; - color38.B = newColor; - } + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color38 = Color.Lerp(color38, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + color38 = Color.Lerp(color38, color36, amount9); 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); Color color = npc.GetAlpha(lightColor); - if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - byte newColor = (byte)MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f * 255f, 0f, 255f); - color.R = 0; - color.G = newColor; - color.B = newColor; - } + + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[0] > 280f && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice)) + color = Color.Lerp(color, Color.Cyan, MathHelper.Clamp((Main.npc[(int)npc.ai[2]].Calamity().newAI[0] - 280f) / 120f, 0f, 1f)); + spriteBatch.Draw(texture2D15, vector43, npc.frame, color, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; @@ -230,26 +230,27 @@ 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 ? 100 : 30; + 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 < 5; k++) - { + for (int k = 0; k < 3; k++) Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, hitDirection, -1f, 0, default, 1f); - } + if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeTail1"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SWNudeTail2"), 1f); + 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.PurpleCosmolite, 0f, 0f, 100, default, 2f); @@ -260,6 +261,7 @@ namespace CalamityMod.NPCs.StormWeaver Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } + 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.PurpleCosmolite, 0f, 0f, 100, default, 3f); @@ -284,7 +286,7 @@ 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 * 0.85f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index f1d141f0f3..fe6fe9394b 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; @@ -30,10 +31,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.defense = 22; npc.lifeMax = 920; npc.aiStyle = aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit38; npc.DeathSound = SoundID.NPCDeath46; @@ -133,11 +130,9 @@ namespace CalamityMod.NPCs.SulphurousSea } else if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - npc.direction = npc.spriteDirection = (npc.DirectionTo(player.Center).X < 0).ToDirectionInt(); + 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 @@ -197,7 +192,12 @@ namespace CalamityMod.NPCs.SulphurousSea DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index f92862330f..35ba753fd7 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; @@ -29,10 +30,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.defense = 25; npc.lifeMax = 1000; npc.aiStyle = aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 3, 50); npc.HitSound = SoundID.NPCHit42; npc.DeathSound = SoundID.NPCDeath5; @@ -70,7 +67,12 @@ namespace CalamityMod.NPCs.SulphurousSea DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SulphurousSea/Catfish.cs b/NPCs/SulphurousSea/Catfish.cs index 59875b9a5f..100534b6c9 100644 --- a/NPCs/SulphurousSea/Catfish.cs +++ b/NPCs/SulphurousSea/Catfish.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using System.IO; using Terraria; @@ -24,10 +25,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.lifeMax = 120; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 1, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath40; @@ -76,9 +73,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } + player.AddBuff(ModContent.BuffType(), 180); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { diff --git a/NPCs/SulphurousSea/Flounder.cs b/NPCs/SulphurousSea/Flounder.cs index 21304249d3..529296adaa 100644 --- a/NPCs/SulphurousSea/Flounder.cs +++ b/NPCs/SulphurousSea/Flounder.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Potions; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,10 +25,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.lifeMax = 40; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 0, 80); npc.HitSound = SoundID.NPCHit50; npc.DeathSound = SoundID.NPCDeath53; @@ -84,8 +81,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); - } + player.AddBuff(ModContent.BuffType(), 120); + } public override void FindFrame(int frameHeight) { @@ -115,7 +112,7 @@ 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) diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 620e0be1bc..5fa4d702ab 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -16,7 +17,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { - npc.damage = 25; + npc.Calamity().canBreakPlayerDefense = true; + npc.damage = 25; npc.width = 50; npc.height = 36; npc.defense = 30; @@ -28,10 +30,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.value = Item.buyPrice(0, 0, 0, 60); npc.HitSound = SoundID.NPCHit50; npc.DeathSound = SoundID.NPCDeath54; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } banner = npc.type; bannerItem = ModContent.ItemType(); } @@ -90,9 +88,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - } + player.AddBuff(ModContent.BuffType(), 120); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { diff --git a/NPCs/SulphurousSea/Mauler.cs b/NPCs/SulphurousSea/Mauler.cs index 5784f3c8cb..858b238003 100644 --- a/NPCs/SulphurousSea/Mauler.cs +++ b/NPCs/SulphurousSea/Mauler.cs @@ -25,7 +25,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { - npc.noGravity = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.noGravity = true; npc.damage = 135; npc.width = 180; npc.height = 90; @@ -34,10 +35,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.lifeMax = 165000; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath60; @@ -338,15 +335,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Venom, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 180); - player.AddBuff(ModContent.BuffType(), 180, true); - } - } + player.AddBuff(ModContent.BuffType(), 420); + } public override void NPCLoot() { diff --git a/NPCs/SulphurousSea/MicrobialCluster.cs b/NPCs/SulphurousSea/MicrobialCluster.cs index 4136974dd3..c7046b8da1 100644 --- a/NPCs/SulphurousSea/MicrobialCluster.cs +++ b/NPCs/SulphurousSea/MicrobialCluster.cs @@ -23,10 +23,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.height = 24; npc.lifeMax = 5; npc.aiStyle = aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.noTileCollide = false; npc.noGravity = true; npc.HitSound = SoundID.NPCHit1; diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index e7966c8a0e..089b5b9941 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -22,7 +23,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { - npc.noGravity = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.noGravity = true; npc.damage = 50; npc.width = 150; npc.height = 40; @@ -30,10 +32,6 @@ namespace CalamityMod.NPCs.SulphurousSea npc.lifeMax = 200; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.value = Item.buyPrice(0, 0, 3, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath5; @@ -314,9 +312,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } + player.AddBuff(ModContent.BuffType(), 180); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index 9a68f4b1e5..96b1ba525c 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -72,7 +72,7 @@ namespace CalamityMod.NPCs.SunkenSea 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, 0f + 4f + npc.gfxOffY); + 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); diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index a5e9279d71..3de601059d 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -169,7 +169,7 @@ namespace CalamityMod.NPCs.SunkenSea 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, 0f + 4f + npc.gfxOffY); + 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); diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 8f43df710d..249847c733 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.SunkenSea 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, 0f + 4f + npc.gfxOffY); + 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); @@ -155,8 +155,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void NPCLoot() { DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDesertScourge, 0.2f); - float necklaceDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateFloat : 0.01f; - DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, necklaceDropRate); + DropHelper.DropItemChance(npc, ItemID.JellyfishNecklace, 0.01f); } } } diff --git a/NPCs/SunkenSea/GhostBellSmall.cs b/NPCs/SunkenSea/GhostBellSmall.cs index 45cd962756..45bc1f1ada 100644 --- a/NPCs/SunkenSea/GhostBellSmall.cs +++ b/NPCs/SunkenSea/GhostBellSmall.cs @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.SunkenSea 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, 0f + 4f + npc.gfxOffY); + 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); diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index eeada006ed..02728272db 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -37,7 +37,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - npc.lavaImmune = true; + npc.Calamity().canBreakPlayerDefense = true; + npc.lavaImmune = true; npc.npcSlots = 5f; npc.damage = 50; npc.width = 160; @@ -45,10 +46,9 @@ namespace CalamityMod.NPCs.SunkenSea npc.defense = 9999; npc.DR_NERD(0.3f); npc.lifeMax = Main.hardMode ? 7500 : 1250; - npc.buffImmune[ModContent.BuffType()] = false; npc.aiStyle = -1; aiType = -1; - npc.value = Main.hardMode ? Item.buyPrice(0, 10, 0, 0) : Item.buyPrice(0, 1, 0, 0); + 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; @@ -393,7 +393,7 @@ namespace CalamityMod.NPCs.SunkenSea 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, 0f + 4f + npc.gfxOffY); + 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); @@ -428,7 +428,7 @@ namespace CalamityMod.NPCs.SunkenSea // Mark Giant Clam as dead CalamityWorld.downedCLAM = true; CalamityWorld.downedCLAMHardMode = Main.hardMode || CalamityWorld.downedCLAMHardMode; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } } } diff --git a/NPCs/SunkenSea/PrismTurtle.cs b/NPCs/SunkenSea/PrismTurtle.cs index 3cb89292a7..a76e13742d 100644 --- a/NPCs/SunkenSea/PrismTurtle.cs +++ b/NPCs/SunkenSea/PrismTurtle.cs @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.SunkenSea 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, 0f + 4f + npc.gfxOffY); + 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); diff --git a/NPCs/SunkenSea/SeaSerpent1.cs b/NPCs/SunkenSea/SeaSerpent1.cs index a65b0aee2d..f8e1e260ea 100644 --- a/NPCs/SunkenSea/SeaSerpent1.cs +++ b/NPCs/SunkenSea/SeaSerpent1.cs @@ -30,10 +30,6 @@ namespace CalamityMod.NPCs.SunkenSea aiType = -1; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 20, 0); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,9 +43,9 @@ 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); - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { @@ -106,7 +102,7 @@ namespace CalamityMod.NPCs.SunkenSea { npc.alpha = 0; } - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f || !NPC.AnyNPCs(ModContent.NPCType())) + if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f) { npc.active = false; } @@ -290,26 +286,5 @@ namespace CalamityMod.NPCs.SunkenSea Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SeaSerpent/SeaSerpentGore1"), 1f); } } - - public override bool CheckActive() - { - if (npc.timeLeft <= 0 && Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = (int)npc.ai[0]; k > 0; k = (int)Main.npc[k].ai[0]) - { - if (Main.npc[k].active) - { - Main.npc[k].active = false; - if (Main.netMode == NetmodeID.Server) - { - Main.npc[k].life = 0; - Main.npc[k].netSkip = -1; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, k, 0f, 0f, 0f, 0, 0, 0); - } - } - } - } - return true; - } } } diff --git a/NPCs/SunkenSea/SeaSerpent2.cs b/NPCs/SunkenSea/SeaSerpent2.cs index 6534de15c5..dfb605af5c 100644 --- a/NPCs/SunkenSea/SeaSerpent2.cs +++ b/NPCs/SunkenSea/SeaSerpent2.cs @@ -26,10 +26,6 @@ namespace CalamityMod.NPCs.SunkenSea aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -50,37 +46,42 @@ 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); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -110,14 +111,11 @@ namespace CalamityMod.NPCs.SunkenSea npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } diff --git a/NPCs/SunkenSea/SeaSerpent3.cs b/NPCs/SunkenSea/SeaSerpent3.cs index cb4b02cc7d..71386b72ed 100644 --- a/NPCs/SunkenSea/SeaSerpent3.cs +++ b/NPCs/SunkenSea/SeaSerpent3.cs @@ -23,10 +23,6 @@ namespace CalamityMod.NPCs.SunkenSea aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,37 +43,42 @@ 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); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -107,14 +108,11 @@ namespace CalamityMod.NPCs.SunkenSea npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } diff --git a/NPCs/SunkenSea/SeaSerpent4.cs b/NPCs/SunkenSea/SeaSerpent4.cs index faddc7c362..615ae65556 100644 --- a/NPCs/SunkenSea/SeaSerpent4.cs +++ b/NPCs/SunkenSea/SeaSerpent4.cs @@ -23,10 +23,6 @@ namespace CalamityMod.NPCs.SunkenSea aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,37 +43,42 @@ 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); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -107,14 +108,11 @@ namespace CalamityMod.NPCs.SunkenSea npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } diff --git a/NPCs/SunkenSea/SeaSerpent5.cs b/NPCs/SunkenSea/SeaSerpent5.cs index ddb07b0079..7601be4509 100644 --- a/NPCs/SunkenSea/SeaSerpent5.cs +++ b/NPCs/SunkenSea/SeaSerpent5.cs @@ -23,10 +23,6 @@ namespace CalamityMod.NPCs.SunkenSea aiType = -1; //new npc.knockBackResist = 0f; npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; @@ -47,37 +43,42 @@ 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); - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[1]].alpha < 128) + + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (npc.ai[1] <= 0f) + shouldDespawn = true; + 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; + } + + if (Main.npc[(int)npc.ai[1]].alpha < 128) { 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); @@ -107,14 +108,11 @@ namespace CalamityMod.NPCs.SunkenSea npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) - { npc.spriteDirection = -1; - } else if (num191 > 0f) - { npc.spriteDirection = 1; - } } } diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs new file mode 100644 index 0000000000..ed6df8c4bc --- /dev/null +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -0,0 +1,150 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class BrimstoneHeart : ModNPC + { + public PrimitiveTrail ChainDrawer = null; + 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; + } + + public override void SetDefaults() + { + npc.damage = 0; + npc.width = 24; + npc.height = 24; + npc.defense = 0; + npc.LifeMaxNERB(25600, 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(ChainEndpoints.Count); + for (int i = 0; i < ChainEndpoints.Count; i++) + writer.WriteVector2(ChainEndpoints[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + ChainEndpoints.Clear(); + int endpointCount = reader.ReadInt32(); + for (int i = 0; i < endpointCount; i++) + ChainEndpoints.Add(reader.ReadVector2()); + } + + public override void AI() + { + if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + + npc.alpha -= 42; + if (npc.alpha < 0) + npc.alpha = 0; + } + + public float PrimitiveWidthFunction(float completionRatio) + { + 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)); + return baseWidth + pulseWidth; + } + + public Color PrimitiveColorFunction(float completionRatio) + { + float colorInterpolant = MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0f, 0.34f, completionRatio, true) * Utils.InverseLerp(1.07f, 0.66f, completionRatio, true)); + return Color.Lerp(Color.DarkRed * 0.7f, Color.Red, colorInterpolant) * 0.425f; + } + + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + if (ChainDrawer is null) + ChainDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction); + for (int i = 0; i < ChainEndpoints.Count; i++) + { + List points = new List() + { + npc.Center, + ChainEndpoints[i] + npc.DirectionTo(ChainEndpoints[i]) * 25f + }; + ChainDrawer.Draw(points, -Main.screenPosition, 40); + } + + return true; + } + + public void TendrilDestructionEffects(int tendrilIndex) + { + for (int i = 0; i < 70; i++) + { + 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); + } + } + + public override void HitEffect(int hitDirection, double damage) + { + 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); + } + for (int i = 0; i < ChainEndpoints.Count; i++) + TendrilDestructionEffects(i); + } + } + + public override void DrawBehind(int index) + { + Main.instance.DrawCacheNPCsBehindNonSolidTiles.Add(index); + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == ModContent.ProjectileType()) + damage = (int)(damage * 0.66); + } + + public override bool CheckActive() => false; + } +} diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.png b/NPCs/SupremeCalamitas/BrimstoneHeart.png new file mode 100644 index 0000000000..c597cfe505 Binary files /dev/null and b/NPCs/SupremeCalamitas/BrimstoneHeart.png differ diff --git a/NPCs/SupremeCalamitas/HoodedHeadIcon.png b/NPCs/SupremeCalamitas/HoodedHeadIcon.png new file mode 100644 index 0000000000..9fa8485791 Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodedHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodedHeadIconP2.png b/NPCs/SupremeCalamitas/HoodedHeadIconP2.png new file mode 100644 index 0000000000..b58cdcfaad Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodedHeadIconP2.png differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIcon.png b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png new file mode 100644 index 0000000000..6c12e09c8e Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodlessHeadIcon.png differ diff --git a/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png b/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png new file mode 100644 index 0000000000..dc1377a577 Binary files /dev/null and b/NPCs/SupremeCalamitas/HoodlessHeadIconP2.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormArm.cs b/NPCs/SupremeCalamitas/SCalWormArm.cs new file mode 100644 index 0000000000..126860646d --- /dev/null +++ b/NPCs/SupremeCalamitas/SCalWormArm.cs @@ -0,0 +1,217 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.SupremeCalamitas +{ + public class SCalWormArm : ModNPC + { + public class SepulcherArmLimb + { + public Vector2 Center; + public float Rotation; + + public SepulcherArmLimb(Vector2 center, float rotation) + { + Center = center; + Rotation = rotation; + } + + public void SendData(BinaryWriter writer) + { + writer.WritePackedVector2(Center); + writer.Write(Rotation); + } + + public void ReceiveData(BinaryReader reader) + { + Center = reader.ReadPackedVector2(); + Rotation = reader.ReadSingle(); + } + } + + public NPC SegmentToAttachTo => Main.npc[(int)npc.ai[0]]; + public bool CurrentlyMoving + { + get => npc.ai[1] == 1f; + set => npc.ai[1] = value.ToInt(); + } + public Vector2 MoveDestination + { + get => new Vector2(npc.ai[2], npc.ai[3]); + set + { + npc.ai[2] = value.X; + npc.ai[3] = value.Y; + } + } + public ref float Time => ref npc.localAI[0]; + public bool ReelingBack + { + get => npc.localAI[1] == 0f; + set => npc.localAI[1] = 1f - value.ToInt(); + } + public Player Target => Main.player[npc.target]; + public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[4]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sepulcher"); + } + + public override void SetDefaults() + { + 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; + + for (int i = 0; i < Limbs.Length; i++) + 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); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + for (int i = 0; i < Limbs.Length; i++) + Limbs[i].ReceiveData(reader); + 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) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + return; + } + + 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; + UpdateLimbs(); + + if (ReelingBack) + { + npc.rotation -= 0.066f; + if (npc.rotation < -0.55f) + ReelingBack = false; + } + else + { + npc.rotation += 0.029f; + if (npc.rotation > 0.77f) + ReelingBack = true; + } + + Time++; + } + + public void MoveToDestination() + { + 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)) + { + npc.Center = MoveDestination; + MoveDestination = Vector2.Zero; + CurrentlyMoving = false; + npc.netUpdate = true; + } + } + + public void UpdateLimbs() + { + 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; + 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; + } + + 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"); + + 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); + + 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); + + 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); + + return false; + } + + public override void HitEffect(int hitDirection, double damage) + { + 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); + for (int i = 1; i <= 2; i++) + 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); + } + } + + public override bool CheckActive() => false; + + public override bool PreNPCLoot() => false; + + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; + } +} diff --git a/NPCs/SupremeCalamitas/SCalWormArm.png b/NPCs/SupremeCalamitas/SCalWormArm.png new file mode 100644 index 0000000000..b45111f206 Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormArm.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index ea088e97a7..59835db0ec 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -12,8 +12,10 @@ 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 override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Sepulcher"); } @@ -22,18 +24,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.damage = 0; //70 npc.npcSlots = 5f; - npc.width = 20; //28 - npc.height = 20; //28 + npc.width = npc.height = 48; npc.defense = 0; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = -1; //new + npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.scale = 1.2f; @@ -47,13 +44,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; } @@ -76,94 +67,58 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - 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(); - } + bool shouldDie = false; + if (npc.ai[1] <= 0f) + shouldDie = true; + else if (AheadSegment.life <= 0 || !AheadSegment.active || npc.life <= 0) + shouldDie = true; - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) - { - 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); - Main.dust[num935].noGravity = true; - Main.dust[num935].noLight = true; - } - } - npc.alpha -= 42; - if (npc.alpha <= 0) - { - setAlpha = true; - npc.alpha = 0; - } - } - else - { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } + if (shouldDie) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } - 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; - vector18.Y = (int)(vector18.Y / 16f) * 16; - 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) - { - 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; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - 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; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - } + if (AheadSegment.alpha < 128 && !setAlpha) + { + 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); + fire.noGravity = true; + fire.noLight = true; + } + } + npc.alpha -= 42; + if (npc.alpha <= 0) + { + setAlpha = true; + npc.alpha = 0; + } + } + else + npc.alpha = HeadSegment.alpha; + + 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(); + } + } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) { if (projectile.penetrate == -1 && !projectile.minion) { @@ -182,22 +137,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = npc.localAI[3] == 1f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SCalWormBodyAlt") : Main.npcTexture[npc.type]; + 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)); 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, 4f + npc.gfxOffY); + 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.localAI[3] == 1f) - { - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SCalWormBodyAltGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - return false; } @@ -215,29 +162,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas { 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); - for (int num621 = 0; num621 < 5; num621++) + int variant = (int)(npc.localAI[3] / 2f % 2f); + if (variant == 0) { - 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)) + for (int i = 1; i <= 9; i++) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + 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); } } - for (int num623 = 0; num623 < 10; num623++) + else { - 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); - Main.dust[num624].velocity *= 2f; + for (int i = 1; i <= 7; i++) + { + 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); + } } } } diff --git a/NPCs/SupremeCalamitas/SCalWormBody.png b/NPCs/SupremeCalamitas/SCalWormBody.png index 5a37855ad8..5e8b75333e 100644 Binary files a/NPCs/SupremeCalamitas/SCalWormBody.png and b/NPCs/SupremeCalamitas/SCalWormBody.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormBodyAlt.png b/NPCs/SupremeCalamitas/SCalWormBodyAlt.png index 35971e8491..7bddb6f35e 100644 Binary files a/NPCs/SupremeCalamitas/SCalWormBodyAlt.png and b/NPCs/SupremeCalamitas/SCalWormBodyAlt.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormBodyAltGlow.png b/NPCs/SupremeCalamitas/SCalWormBodyAltGlow.png deleted file mode 100644 index 5e4e89bd98..0000000000 Binary files a/NPCs/SupremeCalamitas/SCalWormBodyAltGlow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index 5cf7c8e3b7..913ddad300 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using Microsoft.Xna.Framework; using System.IO; @@ -11,10 +12,14 @@ 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 override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Heart"); + Main.npcFrameCount[npc.type] = 5; } public override void SetDefaults() @@ -23,82 +28,64 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.npcSlots = 5f; npc.width = 20; npc.height = 20; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } + npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - CalamityGlobalNPC global = npc.Calamity(); - global.DR = 0.999999f; - global.unbreakableDR = true; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } + 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.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath13; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; - } + + CalamityGlobalNPC global = npc.Calamity(); + global.DR = 0.999999f; + global.unbreakableDR = true; + } public override void SendExtraAI(BinaryWriter writer) { - writer.Write(npc.localAI[0]); + writer.Write(AttackTimer); writer.Write(setAlpha); } public override void ReceiveExtraAI(BinaryReader reader) { - npc.localAI[0] = reader.ReadSingle(); + AttackTimer = reader.ReadSingle(); setAlpha = reader.ReadBoolean(); } public override void AI() { - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; - bool flag = false; + bool shouldDie = false; if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0 || npc.life <= 0) - { - flag = true; - } - if (flag) + shouldDie = true; + else if (AheadSegment.life <= 0 || !AheadSegment.active || npc.life <= 0) + shouldDie = true; + + if (shouldDie) { npc.life = 0; npc.HitEffect(0, 10.0); npc.checkDead(); } - if (Main.npc[(int)npc.ai[1]].alpha < 128 && !setAlpha) + if (AheadSegment.alpha < 128 && !setAlpha) { if (npc.alpha != 0) { - for (int num934 = 0; num934 < 2; num934++) + for (int i = 0; i < 2; i++) { - 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; + 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; @@ -109,72 +96,42 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } else - { - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } + npc.alpha = HeadSegment.alpha; - if (Main.netMode != NetmodeID.MultiplayerClient) + AttackTimer += CalamityWorld.malice ? 1.5f : 1f; + if (AttackTimer >= 900f) { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 900f) + AttackTimer = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[0] = 0f; - int damage = Main.expertMode ? 150 : 200; + int type = ModContent.ProjectileType(); + 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 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer); } + npc.netUpdate = true; } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); } - 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; - vector18.Y = (int)(vector18.Y / 16f) * 16; - 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 (Main.npc.IndexInRange((int)npc.ai[1])) { - 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; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f; - num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192); - int num194 = npc.width; - num193 = (num193 - num194) / num193; - num191 *= num193; - num192 *= num193; + Vector2 offsetToAheadSegment = AheadSegment.Center - npc.Center; + npc.rotation = offsetToAheadSegment.ToRotation() + MathHelper.PiOver2; npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } + npc.Center = AheadSegment.Center - offsetToAheadSegment.SafeNormalize(Vector2.UnitY) * 34f; + npc.spriteDirection = (offsetToAheadSegment.X > 0f).ToDirectionInt(); } } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) { if (projectile.penetrate == -1 && !projectile.minion) { @@ -187,6 +144,27 @@ 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; + } + + public override void HitEffect(int hitDirection, double damage) + { + if (Main.netMode != NetmodeID.MultiplayerClient && npc.life <= 0) + { + for (int i = 0; i < Main.rand.Next(1, 3 + 1); i++) + { + if (!Main.rand.NextBool(3)) + continue; + + Vector2 soulVelocity = -Vector2.UnitY.RotatedByRandom(0.53f) * Main.rand.NextFloat(2.5f, 4f); + Projectile.NewProjectile(npc.Center, soulVelocity, ModContent.ProjectileType(), 0, 0f); + } + } + } + public override bool CheckActive() { return false; diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.png b/NPCs/SupremeCalamitas/SCalWormBodyWeak.png index 8bc8635d1b..3ab290bdf1 100644 Binary files a/NPCs/SupremeCalamitas/SCalWormBodyWeak.png and b/NPCs/SupremeCalamitas/SCalWormBodyWeak.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormForeArm.png b/NPCs/SupremeCalamitas/SCalWormForeArm.png new file mode 100644 index 0000000000..da24ee8a4f Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormForeArm.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormHand.png b/NPCs/SupremeCalamitas/SCalWormHand.png new file mode 100644 index 0000000000..c28935e9f2 Binary files /dev/null and b/NPCs/SupremeCalamitas/SCalWormHand.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 1c570f4c68..97fa659099 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -27,37 +27,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.damage = 0; //150 npc.npcSlots = 5f; npc.width = 62; //324 - npc.height = 78; //216 + npc.height = 64; //216 npc.defense = 0; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = -1; //new + npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; - npc.scale = 1.2f; - if (Main.expertMode) - { - npc.scale = 1.35f; - } - npc.alpha = 255; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } + 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.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + npc.netAlways = true; } public override void SendExtraAI(BinaryWriter writer) @@ -81,48 +69,66 @@ namespace CalamityMod.NPCs.SupremeCalamitas { CalamityGlobalNPC.SCalWorm = npc.whoAmI; - // Target - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(true); + // Get a target + if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) + npc.TargetClosest(); - Player player = Main.player[npc.target]; + // 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 (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } + if (npc.ai[2] > 0f) + npc.realLife = (int)npc.ai[2]; if (Main.netMode != NetmodeID.MultiplayerClient) { if (!TailSpawned && npc.ai[0] == 0f) { + float rotationalOffset = 0f; int Previous = npc.whoAmI; - for (int num36 = 0; num36 < maxLength; num36++) + for (int i = 0; i < maxLength; i++) { int lol; - if (num36 >= 0 && num36 < minLength && num36 % 2 == 0) + 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); Main.npc[lol].localAI[0] += passedVar; passedVar += 36f; } - else if (num36 >= 0 && num36 < minLength) + 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); - if (npc.localAI[0] % 2 == 0) - { - Main.npc[lol].localAI[3] = 1f; - npc.localAI[0] = 1f; - } - else - { - npc.localAI[0] = 2f; - } - } + 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); - } + + // Create arms. + if (i >= 3 && i % 4 == 0) + { + NPC segment = Main.npc[lol]; + int arm = NPC.NewNPC((int)segment.Center.X, (int)segment.Center.Y, ModContent.NPCType(), lol); + if (Main.npc.IndexInRange(arm)) + { + Main.npc[arm].ai[0] = lol; + Main.npc[arm].direction = 1; + Main.npc[arm].rotation = rotationalOffset; + } + + rotationalOffset += MathHelper.Pi / 6f; + + arm = NPC.NewNPC((int)segment.Center.X, (int)segment.Center.Y, ModContent.NPCType(), lol); + if (Main.npc.IndexInRange(arm)) + { + Main.npc[arm].ai[0] = lol; + Main.npc[arm].direction = -1; + Main.npc[arm].rotation = rotationalOffset + MathHelper.Pi; + } + + rotationalOffset += MathHelper.Pi / 6f; + rotationalOffset = MathHelper.WrapAngle(rotationalOffset); + } + Main.npc[lol].realLife = npc.whoAmI; Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; @@ -137,36 +143,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (Main.player[npc.target].dead || !NPC.AnyNPCs(ModContent.NPCType()) || CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.TargetClosest(false); - npc.alpha += 5; - if (npc.alpha >= 255) - { - npc.alpha = 255; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type == npc.type || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == ModContent.NPCType()) - { - Main.npc[i].active = false; - } - } - } - } - else - { - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } + 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; + } + else + 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); - float num188 = 10f; - float num189 = 0.1f; + float num188 = CalamityWorld.malice ? 12.5f : 10f; + float num189 = CalamityWorld.malice ? 0.125f : 0.1f; float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; @@ -305,20 +298,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); + 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/SCalWormHeadGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - return false; } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) { if (projectile.penetrate == -1 && !projectile.minion) { @@ -338,33 +326,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { - 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); - for (int num621 = 0; num621 < 5; num621++) + if (npc.life <= 0) + { + for (int i = 1; i <= 3; i++) { - 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)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } + 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; + 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); } - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - } + } } } } diff --git a/NPCs/SupremeCalamitas/SCalWormHead.png b/NPCs/SupremeCalamitas/SCalWormHead.png index 8bd5ba6d26..ce918150f1 100644 Binary files a/NPCs/SupremeCalamitas/SCalWormHead.png and b/NPCs/SupremeCalamitas/SCalWormHead.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormHeadGlow.png b/NPCs/SupremeCalamitas/SCalWormHeadGlow.png deleted file mode 100644 index 6b5306839a..0000000000 Binary files a/NPCs/SupremeCalamitas/SCalWormHeadGlow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.cs b/NPCs/SupremeCalamitas/SCalWormHeart.cs deleted file mode 100644 index f9f859796a..0000000000 --- a/NPCs/SupremeCalamitas/SCalWormHeart.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.Projectiles.Rogue; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.SupremeCalamitas -{ - public class SCalWormHeart : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Heart"); - } - - public override void SetDefaults() - { - npc.damage = 0; - npc.width = 24; - npc.height = 24; - npc.defense = 0; - npc.LifeMaxNERB(160000, 180000, 90000); - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.alpha = 255; - npc.noGravity = true; - npc.noTileCollide = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit13; - npc.DeathSound = SoundID.NPCDeath1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - } - - public override void AI() - { - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.alpha -= 42; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == ModContent.ProjectileType()) - { - damage = (int)(damage * 0.66); - } - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - } -} diff --git a/NPCs/SupremeCalamitas/SCalWormHeart.png b/NPCs/SupremeCalamitas/SCalWormHeart.png deleted file mode 100644 index 8bc8635d1b..0000000000 Binary files a/NPCs/SupremeCalamitas/SCalWormHeart.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index 69f76be65e..d0200712e0 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -27,12 +27,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.999999f; global.unbreakableDR = true; - npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; - if (CalamityWorld.death) - { - npc.lifeMax = 2000000; - } - npc.aiStyle = -1; //new + npc.lifeMax = CalamityWorld.revenge ? 345000 : 300000; + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.scale = 1.2f; @@ -46,13 +42,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } npc.dontCountMe = true; } @@ -73,9 +63,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { - if (npc.ai[3] > 0f) + if (npc.ai[2] > 0f) { - npc.realLife = (int)npc.ai[3]; + npc.realLife = (int)npc.ai[2]; } bool flag = false; @@ -169,20 +159,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); + 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/SCalWormTailGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); - - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - return false; } public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (CalamityMod.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) + if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => projectile.type != x)) { if (projectile.penetrate == -1 && !projectile.minion) { @@ -198,32 +183,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void HitEffect(int hitDirection, double damage) { 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); - for (int num621 = 0; num621 < 5; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 10; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 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, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; - } - } + { + for (int i = 1; i <= 2; i++) + { + 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); + } + } } public override bool CheckActive() diff --git a/NPCs/SupremeCalamitas/SCalWormTail.png b/NPCs/SupremeCalamitas/SCalWormTail.png index a8e1ab41e1..283e094283 100644 Binary files a/NPCs/SupremeCalamitas/SCalWormTail.png and b/NPCs/SupremeCalamitas/SCalWormTail.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormTailGlow.png b/NPCs/SupremeCalamitas/SCalWormTailGlow.png deleted file mode 100644 index 2d4265fd16..0000000000 Binary files a/NPCs/SupremeCalamitas/SCalWormTailGlow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index f9952ccbd7..9d706a6e3e 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -1,11 +1,14 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Boss; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System.IO; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -13,11 +16,16 @@ 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 override void SetStaticDefaults() { DisplayName.SetDefault("Soul Seeker"); - NPCID.Sets.TrailingMode[npc.type] = 1; + Main.npcFrameCount[npc.type] = 6; + NPCID.Sets.TrailingMode[npc.type] = 1; } public override void SetDefaults() @@ -30,69 +38,90 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noTileCollide = true; npc.canGhostHeal = false; npc.damage = 0; - npc.defense = 80; - npc.DR_NERD(0.35f); - npc.LifeMaxNERB(Main.expertMode ? 90000 : 50000, 170000); - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; + npc.defense = 60; + npc.DR_NERD(0.25f); + npc.LifeMaxNERB(Main.expertMode ? 24000 : 15000, 28000); + npc.DeathSound = SoundID.DD2_SkeletonDeath; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(timer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + timer = reader.ReadInt32(); + } + + 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; } public override bool PreAI() { - bool expertMode = Main.expertMode; - if (start) - { - 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); - } - npc.ai[1] = npc.ai[0]; - start = false; - } - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - direction *= 9f; - npc.rotation = direction.ToRotation(); - timer++; - if (timer > 180) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damage = expertMode ? 150 : 200; //600 500 - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X, direction.Y, ModContent.ProjectileType(), damage, 1f, npc.target); - } - timer = 0; - } - if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) + // Die if SCal is no longer present. + if (CalamityGlobalNPC.SCal < 0 || !SCal.active) { npc.active = false; npc.netUpdate = true; return false; } - Player player = Main.player[npc.target]; - NPC parent = Main.npc[NPC.FindFirstNPC(ModContent.NPCType())]; - double deg = (double)npc.ai[1]; - double rad = deg * (Math.PI / 180); - double dist = 300; - 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] += 0.5f; //2 + + 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]; + start = false; + } + + // Get a target + 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(); + + npc.spriteDirection = (Target.Center.X < npc.Center.X).ToDirectionInt(); + + timer++; + int shootRate = CalamityWorld.malice ? 120 : 180; + if (timer > shootRate) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC seeker = Main.npc[i]; + if (seeker.type == npc.type) + { + if (seeker == npc) + Main.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); + Vector2 shootVelocity = (Target.Center - EyePosition).SafeNormalize(Vector2.UnitY) * 9f; + Projectile.NewProjectile(EyePosition, shootVelocity, type, damage, 1f, Main.myPlayer); + } + timer = 0; + npc.netUpdate = true; + } + + npc.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * 300f - npc.Size * 0.5f; + RotationalDegreeOffset += 0.5f; return false; } - public override bool PreNPCLoot() - { - return false; - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; return true; @@ -126,13 +155,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); } } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -141,10 +170,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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 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; + int num153 = 2; if (CalamityConfig.Instance.Afterimages) { @@ -155,15 +184,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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)) * npc.scale / 2f; - vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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)) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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"); @@ -177,8 +206,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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)) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + 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); } } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.png b/NPCs/SupremeCalamitas/SoulSeekerSupreme.png index 6de0d63977..cea992e2a7 100644 Binary files a/NPCs/SupremeCalamitas/SoulSeekerSupreme.png and b/NPCs/SupremeCalamitas/SoulSeekerSupreme.png differ diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow.png b/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow.png index b43bd78635..5c481d1bf2 100644 Binary files a/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow.png and b/NPCs/SupremeCalamitas/SoulSeekerSupremeGlow.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index da653c78d0..dd15af36ff 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1,35 +1,52 @@ using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.Tools; +using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Summon; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Furniture.Trophies; namespace CalamityMod.NPCs.SupremeCalamitas { - [AutoloadBossHead] public class SupremeCalamitas : ModNPC { + internal enum FrameAnimationType + { + // The numbering of these values correspond to a frame on the sprite. If this enumeration or the sprite itself + // is updated, these numbers will need to be too. + UpwardDraft = 0, + FasterUpwardDraft = 1, + Casting = 2, + BlastCast = 3, + BlastPunchCast = 4, + OutwardHandCast = 5, + PunchHandCast = 6, + Count = 7 + } + private float bossLife; private float uDieLul = 1f; private float passedVar = 0f; @@ -39,6 +56,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool despawnProj = false; private bool startText = false; private bool startBattle = false; //100% + private bool hasSummonedSepulcher1 = false; //100% private bool startSecondAttack = false; //80% private bool startThirdAttack = false; //60% private bool halfLife = false; //40% @@ -46,6 +64,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool secondStage = false; //20% private bool startFifthAttack = false; //10% private bool gettingTired = false; //8% + private bool hasSummonedSepulcher2 = false; //8% private bool gettingTired2 = false; //6% private bool gettingTired3 = false; //4% private bool gettingTired4 = false; //2% @@ -53,6 +72,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas private bool willCharge = false; private bool canFireSplitingFireball = true; private bool spawnArena = false; + private bool enteredBrothersPhase = false; + private bool hasSummonedBrothers = false; private int giveUpCounter = 1200; private int lootTimer = 0; //900 * 5 = 4500 @@ -65,58 +86,132 @@ namespace CalamityMod.NPCs.SupremeCalamitas private int spawnY = 0; private int spawnYReset = 0; private int spawnYAdd = 0; - private int bulletHellCounter = 0; - private int bulletHellCounter2 = 0; + public int bulletHellCounter = 0; + public int bulletHellCounter2 = 0; + private int attackCastDelay = 0; + private int hitTimer = 0; + private float shieldOpacity = 1f; + private float shieldRotation = 0f; + private float forcefieldOpacity = 1f; + private float forcefieldScale = 1; + private FrameAnimationType FrameType + { + get => (FrameAnimationType)(int)npc.localAI[2]; + set => npc.localAI[2] = (int)value; + } + private bool AttackCloseToBeingOver + { + get + { + int attackLength = 0; + + // First phase. + if (npc.ai[0] == 0f) + { + if (npc.ai[1] == 0f) + attackLength = 300; + if (npc.ai[1] == 2f) + attackLength = 70; + if (npc.ai[1] == 3f) + attackLength = 480; + if (npc.ai[1] == 4f) + attackLength = 300; + } + else + { + if (npc.ai[1] == 0f) + attackLength = 240; + if (npc.ai[1] == 2f) + attackLength = 70; + if (npc.ai[1] == 3f) + attackLength = 300; + if (npc.ai[1] == 4f) + attackLength = 240; + } + return npc.ai[2] >= attackLength - 30f; + } + } + private ref float FrameChangeSpeed => ref npc.localAI[3]; + + private Vector2 cataclysmSpawnPosition; + private Vector2 catastropheSpawnPosition; + private Vector2 initialRitualPosition; private Rectangle safeBox = default; - public static float normalDR = 0.7f; - public static float deathDR = 0.75f; - public static float bossRushDR = 0.6f; - public static float enragedDR = 0.99f; + public static int hoodedHeadIconIndex; + public static int hoodedHeadIconP2Index; + public static int hoodlessHeadIconIndex; + public static int hoodlessHeadIconP2Index; + public static float normalDR = 0.25f; + public static float enragedDR = 0.9999f; + + private static readonly Color textColor = Color.Orange; + private const int sepulcherSpawnCastTime = 75; + private const int brothersSpawnCastTime = 150; + + // TODO: This is cumbersome. Change it to be better in 1.4. + internal static void LoadHeadIcons() + { + string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; + string hoodedIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIconP2"; + string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; + string hoodlessIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIconP2"; + CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); + hoodedHeadIconIndex = ModContent.GetModBossHeadSlot(hoodedIconPath); + + CalamityMod.Instance.AddBossHeadTexture(hoodedIconP2Path, -1); + hoodedHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodedIconP2Path); + + CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); + hoodlessHeadIconIndex = ModContent.GetModBossHeadSlot(hoodlessIconPath); + + CalamityMod.Instance.AddBossHeadTexture(hoodlessIconP2Path, -1); + hoodlessHeadIconP2Index = ModContent.GetModBossHeadSlot(hoodlessIconP2Path); + } public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Main.npcFrameCount[npc.type] = 6; + Main.npcFrameCount[npc.type] = 21; NPCID.Sets.TrailingMode[npc.type] = 1; } public override void SetDefaults() { - npc.damage = 350; - npc.npcSlots = 50f; - npc.width = 120; - npc.height = 120; - npc.defense = 120; - npc.DR_NERD(normalDR, normalDR, deathDR, bossRushDR, true); + npc.Calamity().canBreakPlayerDefense = true; + npc.GetNPCDamage(); + npc.npcSlots = 50f; + npc.width = npc.height = 44; + npc.defense = 100; + npc.DR_NERD(normalDR, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); npc.value = Item.buyPrice(10, 0, 0, 0); - npc.LifeMaxNERB(5000000, 5500000, 2100000); + npc.LifeMaxNERB(1000000, 1150000, 500000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; npc.dontTakeDamage = false; npc.chaseable = true; npc.boss = true; npc.canGhostHeal = false; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCG"); + npc.HitSound = SoundID.NPCHit1; + music = CalamityMod.Instance.GetMusicFromMusicMod("SCG") ?? MusicID.Boss2; + bossBag = ModContent.ItemType(); + } + + public override void BossHeadSlot(ref int index) + { + bool inPhase2 = npc.ai[0] == 3f; + if (!CalamityWorld.downedSCal || BossRushEvent.BossRushActive) + index = inPhase2 ? hoodedHeadIconP2Index : hoodedHeadIconIndex; else - music = MusicID.Boss2; + index = inPhase2 ? hoodlessHeadIconP2Index : hoodlessHeadIconIndex; } public override void SendExtraAI(BinaryWriter writer) @@ -126,12 +221,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(despawnProj); writer.Write(startText); writer.Write(startBattle); + writer.Write(hasSummonedSepulcher1); writer.Write(startSecondAttack); writer.Write(startThirdAttack); writer.Write(startFourthAttack); writer.Write(startFifthAttack); writer.Write(halfLife); writer.Write(secondStage); + writer.Write(hasSummonedSepulcher2); writer.Write(gettingTired); writer.Write(gettingTired2); writer.Write(gettingTired3); @@ -140,6 +237,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(willCharge); writer.Write(canFireSplitingFireball); writer.Write(spawnArena); + writer.Write(hasSummonedBrothers); + writer.Write(enteredBrothersPhase); writer.Write(npc.dontTakeDamage); writer.Write(npc.chaseable); @@ -156,6 +255,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(spawnYAdd); writer.Write(bulletHellCounter); writer.Write(bulletHellCounter2); + writer.Write(hitTimer); + writer.Write(attackCastDelay); + + writer.Write(shieldRotation); + + writer.Write(safeBox.X); + writer.Write(safeBox.Y); + writer.Write(safeBox.Width); + writer.Write(safeBox.Height); } public override void ReceiveExtraAI(BinaryReader reader) @@ -165,12 +273,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas despawnProj = reader.ReadBoolean(); startText = reader.ReadBoolean(); startBattle = reader.ReadBoolean(); + hasSummonedSepulcher1 = reader.ReadBoolean(); startSecondAttack = reader.ReadBoolean(); startThirdAttack = reader.ReadBoolean(); startFourthAttack = reader.ReadBoolean(); startFifthAttack = reader.ReadBoolean(); halfLife = reader.ReadBoolean(); secondStage = reader.ReadBoolean(); + hasSummonedSepulcher2 = reader.ReadBoolean(); gettingTired = reader.ReadBoolean(); gettingTired2 = reader.ReadBoolean(); gettingTired3 = reader.ReadBoolean(); @@ -179,6 +289,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas willCharge = reader.ReadBoolean(); canFireSplitingFireball = reader.ReadBoolean(); spawnArena = reader.ReadBoolean(); + hasSummonedBrothers = reader.ReadBoolean(); + enteredBrothersPhase = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); npc.chaseable = reader.ReadBoolean(); @@ -195,24 +307,40 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnYAdd = reader.ReadInt32(); bulletHellCounter = reader.ReadInt32(); bulletHellCounter2 = reader.ReadInt32(); + hitTimer = reader.ReadInt32(); + attackCastDelay = reader.ReadInt32(); + + shieldRotation = reader.ReadSingle(); + + safeBox = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); } public override void AI() { + #region Resets + + // Use an ordinary upward draft by default. + FrameType = FrameAnimationType.UpwardDraft; + FrameChangeSpeed = 0.15f; + #endregion #region StartUp + CalamityGlobalNPC.SCal = npc.whoAmI; + lootTimer++; - bool wormAlive = false; + bool wormAlive = false; if (CalamityGlobalNPC.SCalWorm != -1) { wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; } + bool cataclysmAlive = false; if (CalamityGlobalNPC.SCalCataclysm != -1) { cataclysmAlive = Main.npc[CalamityGlobalNPC.SCalCataclysm].active; } + bool catastropheAlive = false; if (CalamityGlobalNPC.SCalCatastrophe != -1) { @@ -222,120 +350,151 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.slimeRain) { Main.StopSlimeRain(true); - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } + CalamityMod.StopRain(); - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool enraged = npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive); + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + bool enraged = npc.Calamity().enraged > 0; + + // Projectile damage values + 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 bodyWidth = 44; + int bodyHeight = 42; + int baseBulletHellProjectileGateValue = enraged ? 6 : 8; + Vector2 vectorCenter = npc.Center; // Get a 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 == 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(); Player player = Main.player[npc.target]; if (!startText) { - if (Main.LocalPlayer.Calamity().sCalKillCount == 4) + if (!BossRushEvent.BossRushActive) { - string key = "Mods.CalamityMod.SupremeBossText12"; //kill SCal 4 times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (Main.LocalPlayer.Calamity().sCalKillCount == 1) - { - string key = "Mods.CalamityMod.SupremeBossText11"; //kill SCal once - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (Main.LocalPlayer.Calamity().sCalDeathCount < 51) - { - if (Main.LocalPlayer.Calamity().sCalDeathCount == 50) - { - string key = "Mods.CalamityMod.SupremeBossText15"; //die 50 or more times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (Main.LocalPlayer.Calamity().sCalDeathCount > 19) - { - string key = "Mods.CalamityMod.SupremeBossText14"; //die 20 or more times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (Main.LocalPlayer.Calamity().sCalDeathCount > 4) - { - string key = "Mods.CalamityMod.SupremeBossText13"; //die 5 or more times - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + string key = "Mods.CalamityMod.SCalSummonText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } startText = true; } #endregion - #region ArenaCreation - if (!spawnArena) + #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(); + #endregion + #region Forcefield and Shield Logic + + if (hitTimer > 0) + hitTimer--; + + Vector2 hitboxSize = new Vector2(forcefieldScale * 216f / 1.4142f); + hitboxSize = Vector2.Max(hitboxSize, new Vector2(42, 44)); + 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; + + // Make the shield and forcefield fade away in SCal's acceptance phase. + if (npc.life <= npc.lifeMax * 0.01) { - spawnArena = true; - Vector2 vectorPlayer = new Vector2(player.position.X, player.position.Y); - if (death) + shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); + forcefieldScale = MathHelper.Lerp(forcefieldScale, 0f, 0.08f); + } + + // 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) + { + if (npc.ai[1] != 2f) { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1000f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1000f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1000f); - safeBox.Width = 2000; - safeBox.Height = 2000; - spawnYAdd = 100; + float idealRotation = npc.AngleTo(player.Center); + float angularOffset = Math.Abs(MathHelper.WrapAngle(shieldRotation - idealRotation)); + + if (angularOffset > 0.04f) + { + shieldRotation = shieldRotation.AngleLerp(idealRotation, 0.125f); + shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); + } } else { - safeBox.X = spawnX = spawnXReset = (int)(vectorPlayer.X - 1250f); - spawnX2 = spawnXReset2 = (int)(vectorPlayer.X + 1250f); - safeBox.Y = spawnY = spawnYReset = (int)(vectorPlayer.Y - 1250f); - safeBox.Width = 2500; - safeBox.Height = 2500; - spawnYAdd = 125; + // 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.position += shieldRotation.ToRotationVector2() * 42f; + dust.position += (shieldRotation - MathHelper.PiOver2).ToRotationVector2() * (float)Math.Cos(npc.velocity.ToRotation()) * -4f; + dust.noGravity = true; + dust.velocity = npc.velocity; + dust.color = Color.Red; + dust.scale = MathHelper.Lerp(0.6f, 0.85f, 1f - num6 / 16f); + } } + + // Shrink the force-field since it looks strange when charging. + forcefieldScale = MathHelper.Lerp(forcefieldScale, 0.45f, 0.08f); + shieldOpacity = MathHelper.Lerp(shieldOpacity, 1f, 0.08f); + } + // Make the shield disappear if it is no longer relevant and regenerate the forcefield. + else + { + shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); + forcefieldScale = MathHelper.Lerp(forcefieldScale, 1f, 0.08f); + } + + #endregion + #region ArenaCreation + + // Create the arena on the first frame. This does not run client-side. + // If this is done on the server, a sync must be performed so that the arena box is + // known to the clients. Not doing this results in significant desyncs in regards to things like DR. + if (!spawnArena) + { if (Main.netMode != NetmodeID.MultiplayerClient) { + 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.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.Width = 2500; + safeBox.Height = 2500; + spawnYAdd = 125; + } + int num52 = (int)(safeBox.X + (float)(safeBox.Width / 2)) / 16; int num53 = (int)(safeBox.Y + (float)(safeBox.Height / 2)) / 16; int num54 = safeBox.Width / 2 / 16 + 1; @@ -343,6 +502,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int num56 = num53 - num54; num56 <= num53 + num54; num56++) { + if (!WorldGen.InWorld(num55, num56, 2)) + continue; + 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(); @@ -358,34 +520,33 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } + + if (initialRitualPosition == Vector2.Zero) + { + 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; } } #endregion #region Enrage and DR - if (!player.Hitbox.Intersects(safeBox)) + if ((spawnArena && !player.Hitbox.Intersects(safeBox) || malice)) { - if (uDieLul < 3f) - { - uDieLul *= 1.01f; - } - else if (uDieLul > 3f) - { - uDieLul = 3f; - } - protectionBoost = true; + float projectileVelocityMultCap = !player.Hitbox.Intersects(safeBox) && spawnArena ? 2f : 1.5f; + uDieLul = MathHelper.Clamp(uDieLul * 1.01f, 1f, projectileVelocityMultCap); + protectionBoost = !malice; } else { - if (uDieLul > 1f) - { - uDieLul *= 0.99f; - } - else if (uDieLul < 1f) - { - uDieLul = 1f; - } + uDieLul = MathHelper.Clamp(uDieLul * 0.99f, 1f, 2f); protectionBoost = false; } + 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(); @@ -396,7 +557,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else { - global.DR = CalamityWorld.bossRushActive ? bossRushDR : CalamityWorld.death ? deathDR : normalDR; + global.DR = normalDR; global.unbreakableDR = false; if (startFifthAttack) global.DR *= 1.2f; @@ -407,29 +568,86 @@ namespace CalamityMod.NPCs.SupremeCalamitas { 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; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; + 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; - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; + // Make the town NPC spawn. + if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + } - if (npc.timeLeft > 60) - npc.timeLeft = 60; + npc.active = false; + npc.netUpdate = true; + } + + 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); + brimstoneFire.color = Color.Red; + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); + brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); + brimstoneFire.noGravity = true; + } } } else canDespawn = false; - #endregion - #region FirstAttack - if (bulletHellCounter2 < 900) + #endregion + #region Cast Charge Countdown + if (attackCastDelay > 0) + { + attackCastDelay--; + npc.velocity *= 0.94f; + npc.dontTakeDamage = true; + + // Make a magic effect over time. + for (int i = 0; i < (attackCastDelay == 0 ? 16 : 1); i++) + { + Vector2 dustSpawnPosition = npc.Bottom; + float horizontalSpawnOffset = bodyWidth * Main.rand.NextFloat(0.42f, 0.5f); + if (Main.rand.NextBool(2)) + horizontalSpawnOffset *= -1f; + dustSpawnPosition.X += horizontalSpawnOffset; + + Dust magic = Dust.NewDustPerfect(dustSpawnPosition, 267); + 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; + } + + if ((startBattle && !hasSummonedSepulcher1) || (gettingTired && !hasSummonedSepulcher2)) + DoHeartsSpawningCastAnimation(player, death); + + if (enteredBrothersPhase && !hasSummonedBrothers) + DoBrothersSpawningCastAnimation(bodyWidth, bodyHeight); + + if (attackCastDelay == 0) + { + npc.dontTakeDamage = false; + npc.netUpdate = true; + } + + FrameType = FrameAnimationType.Casting; + return; + } + #endregion + #region FirstAttack + if (bulletHellCounter2 < 900) { despawnProj = true; bulletHellCounter2 += 1; @@ -440,68 +658,62 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { bulletHellCounter += 1; - if (bulletHellCounter > (enraged ? 4 : 6)) - { - bulletHellCounter = 0; - int damage = expertMode ? 200 : 250; //800 500 - if (bulletHellCounter2 < 300) //blasts from above + if (bulletHellCounter >= baseBulletHellProjectileGateValue) + { + bulletHellCounter = 0; + if (bulletHellCounter2 % (baseBulletHellProjectileGateValue * 6) == 0) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; + Projectile.NewProjectile(player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + } + if (bulletHellCounter2 < 300) // Blasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); } - else if (bulletHellCounter2 < 600) //blasts from left and right + else if (bulletHellCounter2 < 600) // Blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); } - else //blasts from above, left, and right + else // Blasts from above, left, and right { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); } } } + FrameType = FrameAnimationType.Casting; return; } else if (!startBattle) { - string key = "Mods.CalamityMod.SupremeBossText3"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + attackCastDelay = sepulcherSpawnCastTime; + for (int i = 0; i < 40; i++) { - Main.NewText(Language.GetTextValue(key), messageColor); + 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; } - else if (Main.netMode == NetmodeID.Server) + + npc.Center = safeBox.TopRight() + new Vector2(-120f, 620f); + + for (int i = 0; i < 40; i++) { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - spawnY += 250; - if (death) - { - spawnY -= 50; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + 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); startBattle = true; } #endregion @@ -517,66 +729,59 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = expertMode ? 150 : 200; //600 400 if (bulletHellCounter2 < 1200) { - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } + if (bulletHellCounter2 % 180 == 0) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) { - if (bulletHellCounter2 % 180 == 0) //blasts from right - { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } + if (bulletHellCounter2 % 180 == 0) // Blasts from right + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); } else if (bulletHellCounter2 > 1500) { - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } + if (bulletHellCounter2 % 180 == 0) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); } bulletHellCounter += 1; - if (bulletHellCounter > (enraged ? 7 : 9)) + if (bulletHellCounter >= baseBulletHellProjectileGateValue + 1) { bulletHellCounter = 0; - if (bulletHellCounter2 < 1200) //blasts from below + if (bulletHellCounter2 % ((baseBulletHellProjectileGateValue + 1) * 6) == 0) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; + Projectile.NewProjectile(player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + } + if (bulletHellCounter2 < 1200) // Blasts from below { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else if (bulletHellCounter2 < 1500) //blasts from left + else if (bulletHellCounter2 < 1500) // Blasts from left { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else //blasts from left and right + else // Blasts from left and right { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } } } + FrameType = FrameAnimationType.Casting; return; } if (!startSecondAttack && (npc.life <= npc.lifeMax * 0.75)) { - string key = "Mods.CalamityMod.SupremeBossText4"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalBH2Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } startSecondAttack = true; return; @@ -594,58 +799,55 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 240 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } + if (bulletHellCounter2 % 180 == 0) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + + if (bulletHellCounter2 % 240 == 0) // Fireblasts from above + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); + bulletHellCounter += 1; - if (bulletHellCounter > (enraged ? 9 : 11)) + if (bulletHellCounter >= baseBulletHellProjectileGateValue + 4) { bulletHellCounter = 0; - if (bulletHellCounter2 < 2100) //blasts from above + if (bulletHellCounter2 % ((baseBulletHellProjectileGateValue + 4) * 6) == 0) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; + Projectile.NewProjectile(player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + } + if (bulletHellCounter2 < 2100) // Blasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else if (bulletHellCounter2 < 2400) //blasts from right + else if (bulletHellCounter2 < 2400) // Blasts from right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else //blasts from left and right + else // Blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } } } + FrameType = FrameAnimationType.Casting; return; } if (!startThirdAttack && (npc.life <= npc.lifeMax * 0.5)) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCL"); - else - music = MusicID.Boss3; - string key = "Mods.CalamityMod.SupremeBossText5"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. + music = CalamityMod.Instance.GetMusicFromMusicMod("SCL") ?? MusicID.Boss3; + + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalBH3Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + if (CalamityWorld.downedSCal) + CalamityUtils.DisplayLocalizedText(key + "2", textColor); } startThirdAttack = true; return; @@ -663,64 +865,62 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) //more clustered attack + if (Main.netMode != NetmodeID.MultiplayerClient) // More clustered attack { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 180 == 0) //blasts from top - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 240 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } + if (bulletHellCounter2 % 180 == 0) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + + if (bulletHellCounter2 % 240 == 0) // Fireblasts from above + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); + int divisor = revenge ? 225 : expertMode ? 450 : 675; - if (bulletHellCounter2 % divisor == 0 && expertMode) //giant homing fireballs + + // TODO: Resprite Brimstone Monsters to be something else. + if (bulletHellCounter2 % divisor == 0 && expertMode) // Giant homing fireballs { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, passedVar); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 1f * uDieLul, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f, passedVar); passedVar += 1f; } + bulletHellCounter += 1; - if (bulletHellCounter > (enraged ? 10 : 12)) + if (bulletHellCounter >= baseBulletHellProjectileGateValue + 6) { bulletHellCounter = 0; - if (bulletHellCounter2 < 3000) //blasts from below + if (bulletHellCounter2 % ((baseBulletHellProjectileGateValue + 6) * 6) == 0) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; + Projectile.NewProjectile(player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + } + if (bulletHellCounter2 < 3000) // Blasts from below { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else if (bulletHellCounter2 < 3300) //blasts from left + else if (bulletHellCounter2 < 3300) // Blasts from left { - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else //blasts from left and right + else // Blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } } } + FrameType = FrameAnimationType.Casting; return; } if (!startFourthAttack && (npc.life <= npc.lifeMax * 0.3)) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCE"); - else - music = MusicID.LunarBoss; - string key = "Mods.CalamityMod.SupremeBossText7"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + // Switch from the Lament section of Stained, Brutal Calamity to the Epiphany section. + music = CalamityMod.Instance.GetMusicFromMusicMod("SCE") ?? MusicID.LunarBoss; + + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalBH4Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } startFourthAttack = true; return; @@ -738,61 +938,60 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = expertMode ? 150 : 200; - if (bulletHellCounter2 % 240 == 0) //blasts from top + if (bulletHellCounter2 % 240 == 0) // Blasts from top + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), gigablastDamage, 0f, Main.myPlayer); + + if (bulletHellCounter2 % 360 == 0) // Fireblasts from above + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), fireblastDamage, 0f, Main.myPlayer); + + if (bulletHellCounter2 % 30 == 0) // Projectiles that move in wave pattern { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 360 == 0) //fireblasts from above - { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - } - if (bulletHellCounter2 % 30 == 0) //projectiles that move in wave pattern - { - int random = Main.rand.Next(-1000, 1001); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + int random = Main.rand.Next(-500, 501); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, ModContent.ProjectileType(), waveDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, ModContent.ProjectileType(), waveDamage, 0f, Main.myPlayer); } + bulletHellCounter += 1; - if (bulletHellCounter > (enraged ? 12 : 14)) + if (bulletHellCounter >= baseBulletHellProjectileGateValue + 8) { bulletHellCounter = 0; - if (bulletHellCounter2 < 3900) //blasts from above + if (bulletHellCounter2 % ((baseBulletHellProjectileGateValue + 8) * 6) == 0) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; + Projectile.NewProjectile(player.position.X + distance, player.position.Y, velocity, 0f, ModContent.ProjectileType(), firstBulletHellblastDamage, 0f, Main.myPlayer); + } + if (bulletHellCounter2 < 3900) // Blasts from above { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else if (bulletHellCounter2 < 4200) //blasts from left and right + else if (bulletHellCounter2 < 4200) // Blasts from left and right { - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } - else //blasts from above, left, and right + else // Blasts from above, left, and right { - Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, ModContent.ProjectileType(), bulletHellblastDamage, 0f, Main.myPlayer); } } } + FrameType = FrameAnimationType.Casting; return; } if (!startFifthAttack && (npc.life <= npc.lifeMax * 0.1)) { - string key = "Mods.CalamityMod.SupremeBossText9"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + string key = "Mods.CalamityMod.SCalBH5Text"; + + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } startFifthAttack = true; return; @@ -803,73 +1002,65 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (gettingTired5) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SCA"); - else - music = MusicID.Eerie; - npc.noGravity = false; + // Switch from the Epiphany section of Stained, Brutal Calamity to the Acceptance section. + music = CalamityMod.Instance.GetMusicFromMusicMod("SCA") ?? MusicID.Eerie; + + 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.98f; + npc.velocity.X *= 0.96f; - float num = player.Center.X - vectorCenter.X; - float num1 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num1, num) - MathHelper.PiOver2; + if (CalamityWorld.downedSCal && !BossRushEvent.BossRushActive) + { + if (giveUpCounter == 720) + { + for (int i = 0; i < 24; i++) + { + 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); + brimstoneFire.fadeIn = 1.25f; + brimstoneFire.noGravity = true; + } - if (CalamityWorld.downedSCal) //after first time you kill her - { - if (giveUpCounter == 900) - { - string key = "Mods.CalamityMod.SupremeBossText27"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - giveUpCounter--; - bool canBeHit = giveUpCounter < 900; - npc.chaseable = canBeHit; - npc.dontTakeDamage = !canBeHit; - return; - } - if (giveUpCounter == 600) - { - string key = "Mods.CalamityMod.SupremeBossText25"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (giveUpCounter == 300) - { - string key = "Mods.CalamityMod.SupremeBossText26"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + npc.active = false; + npc.netUpdate = true; + NPCLoot(); } } + else if (giveUpCounter == 900 && !BossRushEvent.BossRushActive) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText1", textColor); + else if(giveUpCounter == 600 && !BossRushEvent.BossRushActive) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText2", textColor); + else if(giveUpCounter == 300 && !BossRushEvent.BossRushActive) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalAcceptanceText3", textColor); if (giveUpCounter <= 0) { - npc.chaseable = true; - npc.dontTakeDamage = false; + if (BossRushEvent.BossRushActive) + { + 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); + brimstoneFire.color = Color.Red; + brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); + brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); + brimstoneFire.fadeIn = 1.25f; + brimstoneFire.noGravity = true; + } + + npc.active = false; + npc.netUpdate = true; + NPCLoot(); return; } giveUpCounter--; @@ -889,96 +1080,76 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - string key = "Mods.CalamityMod.SupremeBossText24"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalDesparationText4"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } gettingTired5 = true; return; } else if (!gettingTired4 && (npc.life <= npc.lifeMax * 0.02)) { - string key = "Mods.CalamityMod.SupremeBossText23"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalDesparationText3"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } gettingTired4 = true; return; } else if (!gettingTired3 && (npc.life <= npc.lifeMax * 0.04)) { - string key = "Mods.CalamityMod.SupremeBossText22"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalDesparationText2"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } gettingTired3 = true; return; } else if (!gettingTired2 && (npc.life <= npc.lifeMax * 0.06)) { - string key = "Mods.CalamityMod.SupremeBossText21"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalDesparationText1"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } gettingTired2 = true; return; } else if (!gettingTired && (npc.life <= npc.lifeMax * 0.08)) { - string key = "Mods.CalamityMod.SupremeBossText20"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + attackCastDelay = sepulcherSpawnCastTime; + for (int i = 0; i < 40; i++) { - Main.NewText(Language.GetTextValue(key), messageColor); + 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; } - else if (Main.netMode == NetmodeID.Server) + + npc.Center = safeBox.TopRight() + new Vector2(-120f, 620f); + + for (int i = 0; i < 40; i++) { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - spawnY += 250; - if (death) - { - spawnY -= 50; - } - for (int x = 0; x < 5; x++) - { - NPC.NewNPC(spawnX + 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX += spawnXAdd; - NPC.NewNPC(spawnX2 - 50, spawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255); - spawnX2 -= spawnXAdd; - spawnY += spawnYAdd; - } - spawnX = spawnXReset; - spawnX2 = spawnXReset2; - spawnY = spawnYReset; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + 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); gettingTired = true; return; } @@ -1014,32 +1185,26 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region TransformSeekerandBrotherTriggers if (!halfLife && (npc.life <= npc.lifeMax * 0.4)) { - string key = "Mods.CalamityMod.SupremeBossText"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalPhase2Text"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } halfLife = true; } if (npc.life <= npc.lifeMax * 0.2) { - if (secondStage == false) + if (!secondStage) { - string key = "Mods.CalamityMod.SupremeBossText8"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) + if (!BossRushEvent.BossRushActive) { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + string key = "Mods.CalamityMod.SCalSeekerRingText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1052,6 +1217,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Eye.ai[3] = I * 18; } } + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center); secondStage = true; } } @@ -1062,65 +1228,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.life > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) + if (npc.life < npc.lifeMax * 0.45f && !enteredBrothersPhase) { - int num660 = (int)(npc.lifeMax * 0.55); - if ((npc.life + num660) < bossLife) - { - bossLife = npc.life; - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); - string key = "Mods.CalamityMod.SupremeBossText6"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + enteredBrothersPhase = true; + attackCastDelay = brothersSpawnCastTime; + npc.netUpdate = true; } } - #endregion - #region TargetandRotation - 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; - else if (num803 > MathHelper.TwoPi) - num803 -= MathHelper.TwoPi; - - float num804 = 0.1f; - if (npc.rotation < num803) - { - if ((num803 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num804; - else - npc.rotation += num804; - } - else if (npc.rotation > num803) - { - if ((npc.rotation - num803) > MathHelper.Pi) - npc.rotation += num804; - else - 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; #endregion #region FirstStage if (npc.ai[0] == 0f) @@ -1141,10 +1256,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) npc.velocity *= 0.95f; - - float num740 = player.Center.X - vectorCenter.X; - float num741 = player.Center.Y - vectorCenter.Y; - npc.rotation = (float)Math.Atan2(num741, num740) - MathHelper.PiOver2; return; } else @@ -1258,7 +1369,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num824 *= 0.5f; } @@ -1304,83 +1415,133 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.ai[2] >= 300f) { npc.ai[1] = -1f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } 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.rotation = (float)Math.Atan2(num826, num825) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 90f) - { - npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - int num829 = expertMode ? 150 : 200; //600 400 + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 90f) + { + npc.localAI[1] = 0f; - 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; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float num828 = 10f * uDieLul; + 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; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; - int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = ModContent.ProjectileType(); - for (int num186 = 0; num186 < 8; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - float speedBoost = num186 > 3 ? -(num186 - 3) : num186; - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } + int randomShot = Main.rand.Next(6); + if (randomShot == 0 && canFireSplitingFireball) + { + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 15; i++) + { + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f); + magic.color = Color.OrangeRed; + magic.scale = 1.2f; + magic.fadeIn = 0.6f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + 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); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 20; i++) + { + Dust magic = Dust.NewDustPerfect(value9, (int)CalamityDusts.Brimstone); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.3f; + magic.color = Color.Red; + magic.scale = 1.425f; + magic.fadeIn = 0.75f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else + { + canFireSplitingFireball = true; + randomShot = ModContent.ProjectileType(); + Main.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; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float speedBoost = num186 > 3 ? -(num186 - 3) : num186; + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + + for (int i = 0; i < 7; i++) + { + Vector2 magicDustVelocity = new Vector2(num180 + speedBoost, num182 + speedBoost); + magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); + + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = magicDustVelocity; + magic.color = Color.Red; + magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); + magic.fadeIn = 0.67f; + magic.noLight = true; + magic.noGravity = true; + } + + 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; + } + } + } + } + + FrameType = FrameAnimationType.FasterUpwardDraft; } else if (npc.ai[1] == 1f) { - npc.rotation = num803; float num383 = wormAlive ? 26f : 30f; if (npc.life < npc.lifeMax * 0.95) num383 += 1f; @@ -1403,6 +1564,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas { 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); } npc.ai[1] = 2f; @@ -1410,6 +1575,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (npc.ai[1] == 2f) { 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 (!canDespawn) @@ -1422,22 +1590,30 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.velocity.Y = 0f; } } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= 70f) + bool willChargeAgain = npc.ai[3] + 1 < 2; + + if (npc.ai[2] >= 70f) { npc.ai[3] += 1f; npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num803; + npc.TargetClosest(); - if (npc.ai[3] >= 2f) + if (!willChargeAgain) npc.ai[1] = -1f; else npc.ai[1] = 1f; - } - } + } + + if (willChargeAgain && npc.ai[2] > 50f) + { + 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) { float num412 = 32f; @@ -1445,7 +1621,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num413 *= 0.5f; } @@ -1454,7 +1630,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; - 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); @@ -1494,9 +1671,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.ai[2] += 1f; if (npc.ai[2] >= 480f) { - npc.TargetClosest(true); npc.ai[1] = -1f; - npc.target = 255; + npc.TargetClosest(); npc.netUpdate = true; } else @@ -1510,23 +1686,46 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); + + // 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.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.color = Color.OrangeRed; + brimstoneMagic.fadeIn = 1.5f; + brimstoneMagic.noLight = true; + } if (Main.netMode != NetmodeID.MultiplayerClient) { float num418 = 10f * uDieLul; - int num419 = expertMode ? 150 : 200; //600 500 int num420 = ModContent.ProjectileType(); num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num418 / num417; num415 *= num417; num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + vector40.X += num415 * 2f; + vector40.Y += num416 * 2f; + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, hellblastDamage, 0f, Main.myPlayer, 0f, 0f); } } - } - } + } + + 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.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.noLight = true; + } + + FrameType = FrameAnimationType.OutwardHandCast; + } else if (npc.ai[1] == 4f) { int num831 = 1; @@ -1537,8 +1736,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas float num833 = 1.2f; // Reduce acceleration if target is holding a true melee weapon - Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + Item targetSelectedItem = player.HeldItem; + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num833 *= 0.5f; } @@ -1583,16 +1782,33 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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; - npc.rotation = (float)Math.Atan2(num835, num834) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 140f) + int shootRate = wormAlive ? 280 : 140; + npc.localAI[1]++; + FrameChangeSpeed = 0.175f; + FrameType = FrameAnimationType.BlastCast; + + if (npc.localAI[1] > shootRate) + { + 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.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; + + if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.localAI[1] = 0f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); float num837 = 5f * uDieLul; - int num838 = expertMode ? 150 : 200; //600 500 int num839 = ModContent.ProjectileType(); num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); num836 = num837 / num836; @@ -1600,7 +1816,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas num835 *= num836; vector83.X += num834 * 8f; vector83.Y += num835 * 8f; - Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1608,11 +1824,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.ai[2] >= 300f) { npc.ai[1] = -1f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; - } - } - } + } + } + } if (npc.life < npc.lifeMax * 0.4) { @@ -1620,11 +1836,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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) { npc.dontTakeDamage = true; @@ -1643,8 +1861,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.ai[2] = 0f; } - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; if (npc.ai[1] == 100f) { @@ -1658,11 +1874,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); - Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SupremeCalamitasSpawn"), npc.Center); } } - 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); + for (int i = 0; i < 4; i++) + { + 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) { @@ -1802,7 +2023,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num824 *= 0.5f; } @@ -1849,83 +2070,131 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.ai[2] >= 240f) { npc.ai[1] = -1f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; } 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.rotation = (float)Math.Atan2(num826, num825) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 60f) - { - npc.localAI[1] = 0f; - float num828 = 10f * uDieLul; - int num829 = expertMode ? 150 : 200; //600 500 + npc.localAI[1] += wormAlive ? 0.5f : 1f; + if (npc.localAI[1] > 60f) + { + npc.localAI[1] = 0f; - 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; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float num828 = 10f * uDieLul; + 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; + float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; + num183 = num828 / num183; + num180 *= num183; + num182 *= num183; + value9.X += num180; + value9.Y += num182; - int randomShot = Main.rand.Next(6); - if (randomShot == 0 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else if (randomShot == 1 && canFireSplitingFireball) - { - canFireSplitingFireball = false; - randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; - Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - else - { - canFireSplitingFireball = true; - randomShot = ModContent.ProjectileType(); - for (int num186 = 0; num186 < 8; num186++) - { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - float speedBoost = num186 > 3 ? -(num186 - 3) : num186; - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, num829, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } + int randomShot = Main.rand.Next(6); + if (randomShot == 0 && canFireSplitingFireball) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 16; i++) + { + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.2f; + magic.color = Color.OrangeRed; + magic.scale = 1.3f; + magic.fadeIn = 0.6f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else if (randomShot == 1 && canFireSplitingFireball) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); + canFireSplitingFireball = false; + randomShot = ModContent.ProjectileType(); + num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + num827 = num828 / num827; + num825 *= num827; + num826 *= num827; + vector82.X += num825 * 8f; + vector82.Y += num826 * 8f; + + for (int i = 0; i < 24; i++) + { + Dust magic = Dust.NewDustPerfect(value9, (int)CalamityDusts.Brimstone); + magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.6f; + magic.color = Color.Red; + magic.scale = 1.5f; + magic.fadeIn = 0.8f; + magic.noLight = true; + magic.noGravity = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } + else + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), npc.Center); + canFireSplitingFireball = true; + randomShot = ModContent.ProjectileType(); + for (int num186 = 0; num186 < 8; num186++) + { + num180 = player.position.X + player.width * 0.5f - value9.X; + num182 = player.position.Y + player.height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); + float speedBoost = num186 > 3 ? -(num186 - 3) : num186; + num183 = (8f + speedBoost) / num183; + num180 *= num183; + num182 *= num183; + + for (int i = 0; i < 10; i++) + { + Vector2 magicDustVelocity = new Vector2(num180 + speedBoost, num182 + speedBoost); + magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 10f); + + Dust magic = Dust.NewDustPerfect(value9, 264); + magic.velocity = magicDustVelocity; + magic.color = Color.Red; + magic.scale = MathHelper.Lerp(0.975f, 1.7f, i / 10f); + magic.fadeIn = 0.9f; + magic.noLight = true; + magic.noGravity = true; + } + + 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; + } + } + } + } + } else if (npc.ai[1] == 1f) { - npc.rotation = num803; float num383 = wormAlive ? 31f : 35f; if (npc.life < npc.lifeMax * 0.3) num383 += 1f; @@ -1944,7 +2213,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { 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); + } npc.ai[1] = 2f; } @@ -1963,22 +2236,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.velocity.Y = 0f; } } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - if (npc.ai[2] >= 70f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = num803; - if (npc.ai[3] >= 1f) - npc.ai[1] = -1f; - else - npc.ai[1] = 1f; - } - } + bool willChargeAgain = npc.ai[3] + 1 < 1; + + if (npc.ai[2] >= 70f) + { + npc.ai[3] += 1f; + npc.ai[2] = 0f; + npc.TargetClosest(); + + if (!willChargeAgain) + npc.ai[1] = -1f; + else + npc.ai[1] = 1f; + } + + if (willChargeAgain && npc.ai[2] > 50f) + { + 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) { float num412 = 32f; @@ -1986,7 +2268,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num413 *= 0.5f; } @@ -1995,7 +2277,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.position.X + (npc.width / 2) < player.position.X + player.width) num414 = -1; - 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); @@ -2035,9 +2318,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.ai[2] += 1f; if (npc.ai[2] >= 300f) { - npc.TargetClosest(true); npc.ai[1] = -1f; - npc.target = 255; + npc.TargetClosest(); npc.netUpdate = true; } else @@ -2051,11 +2333,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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); - if (Main.netMode != NetmodeID.MultiplayerClient) + // 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.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.color = Color.OrangeRed; + brimstoneMagic.fadeIn = 1.5f; + brimstoneMagic.noLight = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) { float num418 = 10f * uDieLul; - int num419 = expertMode ? 150 : 200; //600 500 int num420 = ModContent.ProjectileType(); num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); num417 = num418 / num417; @@ -2063,11 +2357,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas num416 *= num417; vector40.X += num415 * 4f; vector40.Y += num416 * 4f; - Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, num419, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(vector40.X, vector40.Y, num415, num416, num420, hellblastDamage, 0f, Main.myPlayer, 0f, 0f); } } - } - } + } + + 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.scale = Main.rand.NextFloat(1.25f, 1.35f); + brimstoneMagic.noGravity = true; + brimstoneMagic.noLight = true; + } + + FrameChangeSpeed = 0.245f; + FrameType = FrameAnimationType.PunchHandCast; + } else if (npc.ai[1] == 4f) { int num831 = 1; @@ -2079,7 +2385,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num833 *= 0.5f; } @@ -2124,40 +2430,290 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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; - npc.rotation = (float)Math.Atan2(num835, num834) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += wormAlive ? 0.5f : 1f; - if (npc.localAI[1] > 100f) - { - npc.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num838 = expertMode ? 150 : 200; //600 500 - int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 8f; - vector83.Y += num835 * 8f; - int shot = Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, num838, 0f, Main.myPlayer, 0f, 0f); - } - } + int shootRate = wormAlive ? 200 : 100; + npc.localAI[1]++; + if (npc.ai[2] > 40f && (npc.localAI[1] > shootRate - 18 || npc.localAI[1] <= 15f)) + { + FrameChangeSpeed = 0f; + FrameType = FrameAnimationType.BlastPunchCast; + } - npc.ai[2] += 1f; + if (npc.localAI[1] > shootRate) + { + 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.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; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.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); + num836 = num837 / num836; + num834 *= num836; + num835 *= num836; + vector83.X += num834 * 8f; + vector83.Y += num835 * 8f; + Projectile.NewProjectile(vector83.X, vector83.Y, num834, num835, num839, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + + npc.ai[2] += 1f; if (npc.ai[2] >= 240f) { npc.ai[1] = -1f; - npc.TargetClosest(true); + npc.TargetClosest(); npc.netUpdate = true; - } - } + } + } } } #endregion } + public void DoHeartsSpawningCastAnimation(Player target, bool death) + { + int tempSpawnY = spawnY; + tempSpawnY += 250; + if (death) + tempSpawnY -= 50; + + List heartSpawnPositions = new List(); + for (int i = 0; i < 5; i++) + { + heartSpawnPositions.Add(new Vector2(spawnX + spawnXAdd * i + 50, tempSpawnY + spawnYAdd * i)); + heartSpawnPositions.Add(new Vector2(spawnX2 - spawnXAdd * i - 50, tempSpawnY + spawnYAdd * i)); + } + + float castCompletion = Utils.InverseLerp(sepulcherSpawnCastTime - 25f, 0f, attackCastDelay, true); + 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); + magic.velocity = Vector2.UnitY.RotatedByRandom(0.17f) * -Main.rand.NextFloat(2.7f, 4.1f); + magic.color = Color.OrangeRed; + magic.noLight = true; + magic.fadeIn = 0.6f; + magic.noGravity = true; + + foreach (Vector2 heartSpawnPosition in heartSpawnPositions) + { + Vector2 leftDustPosition = Vector2.CatmullRom(armPosition + Vector2.UnitY * 1000f, armPosition, heartSpawnPosition, heartSpawnPosition + Vector2.UnitY * 1000f, castCompletion); + + Dust castMagicDust = Dust.NewDustPerfect(leftDustPosition, 267); + castMagicDust.scale = 1.67f; + castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); + castMagicDust.fadeIn = 0.67f; + castMagicDust.color = Color.Red; + castMagicDust.noGravity = true; + } + + if (attackCastDelay == 0) + { + string key = "Mods.CalamityMod.SCalStartText"; + if (npc.life <= npc.lifeMax * 0.08) + key = "Mods.CalamityMod.SCalSepulcher2Text"; + + if (!BossRushEvent.BossRushActive) + { + if (CalamityWorld.downedSCal) + key += "Rematch"; + CalamityUtils.DisplayLocalizedText(key, textColor); + } + foreach (Vector2 heartSpawnPosition in heartSpawnPositions) + { + // Make the hearts appear in a burst of flame. + for (int i = 0; i < 20; i++) + { + Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), (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; + } + } + + // And play a fire-like sound effect. + hasSummonedSepulcher1 = true; + hasSummonedSepulcher2 = npc.life <= npc.lifeMax * 0.08; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + List hearts = new List(); + for (int x = 0; x < 5; x++) + { + hearts.Add(NPC.NewNPC(spawnX + 50, tempSpawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255)); + spawnX += spawnXAdd; + + hearts.Add(NPC.NewNPC(spawnX2 - 50, tempSpawnY, ModContent.NPCType(), 0, 0f, 0f, 0f, 0f, 255)); + spawnX2 -= spawnXAdd; + tempSpawnY += spawnYAdd; + } + + ConnectAllBrimstoneHearts(hearts); + + spawnX = spawnXReset; + spawnX2 = spawnXReset2; + spawnY = spawnYReset; + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); + npc.netUpdate = true; + } + + Main.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; + + if (Main.netMode != NetmodeID.MultiplayerClient && catastropheSpawnPosition == Vector2.Zero) + { + 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. + if (attackCastDelay < brothersSpawnCastTime - 45f && attackCastDelay >= 60f) + { + float castCompletion = Utils.InverseLerp(brothersSpawnCastTime - 45f, 60f, attackCastDelay); + + Vector2 leftDustPosition = Vector2.CatmullRom(leftOfCircle + Vector2.UnitY * 1000f, leftOfCircle, catastropheSpawnPosition, catastropheSpawnPosition + Vector2.UnitY * 1000f, castCompletion); + Vector2 rightDustPosition = Vector2.CatmullRom(rightOfCircle + Vector2.UnitY * 1000f, rightOfCircle, cataclysmSpawnPosition, cataclysmSpawnPosition + Vector2.UnitY * 1000f, castCompletion); + + Dust castMagicDust = Dust.NewDustPerfect(leftDustPosition, 267); + castMagicDust.scale = 1.67f; + castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); + castMagicDust.color = Color.Red; + castMagicDust.noGravity = true; + + castMagicDust = Dust.CloneDust(castMagicDust); + castMagicDust.position = rightDustPosition; + } + + // Make some magic effects at where the bros will spawn. + if (attackCastDelay < 60f) + { + float burnPower = Utils.InverseLerp(60f, 20f, attackCastDelay); + if (attackCastDelay == 0f) + burnPower = 4f; + + for (int i = 0; i < MathHelper.Lerp(5, 25, burnPower); i++) + { + Dust fire = Dust.NewDustPerfect(catastropheSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); + fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); + if (attackCastDelay == 0) + { + fire.velocity += Main.rand.NextVector2Circular(4f, 4f); + fire.fadeIn = 1.6f; + } + fire.noGravity = true; + fire.noLight = true; + fire.color = Color.OrangeRed; + fire.scale = 1.4f + fire.velocity.Y * 0.16f; + + fire = Dust.NewDustPerfect(cataclysmSpawnPosition + Main.rand.NextVector2Circular(60f, 60f), 264); + fire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 4f); + if (attackCastDelay == 0) + { + fire.velocity += Main.rand.NextVector2Circular(4f, 4f); + fire.fadeIn = 1.6f; + } + fire.noGravity = true; + fire.noLight = true; + fire.color = Color.OrangeRed; + fire.scale = 1.4f + fire.velocity.Y * 0.16f; + } + } + + // And spawn them. + if (attackCastDelay == 0) + { + if (!BossRushEvent.BossRushActive) + { + string key = "Mods.CalamityMod.SCalBrothersText"; + if (CalamityWorld.downedSCal) + key += "Rematch"; + + CalamityUtils.DisplayLocalizedText(key, textColor); + if (CalamityWorld.downedSCal) + CalamityUtils.DisplayLocalizedText(key + "2", textColor); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, ModContent.NPCType()); + CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, ModContent.NPCType()); + } + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, npc.Center); + hasSummonedBrothers = true; + } + } + + public void ConnectAllBrimstoneHearts(List heartIndices) + { + int heartType = ModContent.NPCType(); + + // Ensure that the hearts go in order based on the arena. + IEnumerable hearts = heartIndices.Select(i => Main.npc[i]); + hearts = hearts.OrderByDescending(heart => Math.Abs(heart.Center.X - safeBox.Left)).ToList(); + + int firstHeartIndex = heartIndices.First(); + int lastHeartIndex = heartIndices.Last(); + + heartIndices = heartIndices.OrderByDescending(heart => Math.Abs(Main.npc[heart].Center.X - safeBox.Left)).ToList(); + + for (int i = 0; i < hearts.Count(); i++) + { + NPC heart = hearts.ElementAt(i); + + Vector2 endpoint = safeBox.TopLeft(); + Vector2 oppositePosition = Vector2.Zero; + + for (int j = 0; j < 2; j++) + { + int tries = 0; + do + { + endpoint.X = heart.Center.X + (j == 0).ToDirectionInt() * Main.rand.NextFloat(75f, 250f); + tries++; + if (tries >= 100) + break; + } + while (Math.Abs(endpoint.X - safeBox.Center.X) > safeBox.Width * 0.48f); + + if (tries >= 100) + endpoint.X = MathHelper.Clamp(endpoint.X, safeBox.Left, safeBox.Right); + + heart.ModNPC().ChainEndpoints.Add(endpoint); + } + + if (Main.rand.NextBool(2)) + { + endpoint.X = heart.Center.X + Main.rand.NextBool(2).ToDirectionInt() * Main.rand.NextFloat(45f, 360f); + endpoint.X = MathHelper.Clamp(endpoint.X, safeBox.Left, safeBox.Right); + heart.ModNPC().ChainEndpoints.Add(endpoint); + } + + heart.netUpdate = true; + } + } + #region Loot public override void BossLoot(ref string name, ref int potionType) { @@ -2167,18 +2723,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas // If SCal is killed too quickly, cancel all drops and chastise the player public override bool SpecialNPCLoot() { - if (lootTimer < 6000) //75 seconds for bullet hells + 25 seconds for normal phases + //75 seconds for bullet hells + 25 seconds for normal phases. + //Does not occur in Boss Rush due to weakened SCal + stronger weapons (rarely occurs with just Cal gear) + if ((lootTimer < 6000) && !BossRushEvent.BossRushActive) { - string key = "Mods.CalamityMod.SupremeBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + if (!BossRushEvent.BossRushActive) + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.SCalFunnyCheatText", textColor); return true; } @@ -2187,43 +2737,49 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void NPCLoot() { - DeathMessage(); + // Create a teleport line effect + Dust.QuickDustLine(npc.Center, initialRitualPosition, 500f, Color.Red); + npc.Center = initialRitualPosition; - // Incrase the player's SCal kill count + // Make the town NPC spawn. + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + + DropHelper.DropBags(npc); + + // Increase the player's SCal kill count if (Main.player[npc.target].Calamity().sCalKillCount < 5) Main.player[npc.target].Calamity().sCalKillCount++; - // Materials - int essenceMin = Main.expertMode ? 30 : 20; + // Legendary drop for SCal + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + + // Materials + int essenceMin = Main.expertMode ? 30 : 20; int essenceMax = Main.expertMode ? 40 : 30; DropHelper.DropItem(npc, ModContent.ItemType(), true, essenceMin, essenceMax); - // Weapons + if (!Main.expertMode) + { + // Weapons. + float w = DropHelper.NormalWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); - // All non-hybrid weapons are listed twice so that the drop rates are actually equal between each unique weapon - DropHelper.DropItemFromSetCondition(npc, true, Main.expertMode, - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Illustrious Knives - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Staff of Blushie - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), // Voidragon - ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), //Temporal Umbrella - ModContent.ItemType(), ModContent.ItemType() - ); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityWorld.revenge); + // Vanity. + 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()); + } + } // Vanity DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); @@ -2232,67 +2788,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Other DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedSCal); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedSCal, 6, 3, 2); - // Mark Supreme Calamitas as dead + // Mark Supreme Calamitas as defeated CalamityWorld.downedSCal = true; - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } #endregion - private void DeathMessage() - { - Color messageColor = Color.Orange; - string key; - - // If the player has never killed SCal before, comment on how many attempts it took - if (Main.player[npc.target].Calamity().sCalKillCount == 0) - { - switch (Main.LocalPlayer.Calamity().sCalDeathCount) - { - case 0: - key = "Mods.CalamityMod.SupremeBossText16"; - break; - case 1: - key = "Mods.CalamityMod.SupremeBossText17"; - break; - case 2: - key = "Mods.CalamityMod.SupremeBossText18"; - break; - case 3: // Three deaths exactly rewards Lul - key = "Mods.CalamityMod.SupremeBossText19"; - DropHelper.DropItem(npc, ModContent.ItemType()); - break; - default: // Four or more deaths: Lul is permanently missed - key = "Mods.CalamityMod.SupremeBossText10"; - break; - } - } - else - { - // If SCal has been killed before, instead comment on her respawning - key = "Mods.CalamityMod.SupremeBossText10"; - } - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == ModContent.ProjectileType()) - { - damage /= 2; - } - } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); } + // Prevent the player from accidentally killing SCal instead of having her turn into a town NPC. + public override bool CheckDead() + { + if (BossRushEvent.BossRushActive) + return true; + + npc.life = 1; + npc.active = true; + npc.dontTakeDamage = true; + npc.netUpdate = true; + return false; + } + public override bool CheckActive() { return canDespawn; @@ -2307,21 +2827,44 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return true; + + 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); } 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; + bool wormAlive = false; + if (CalamityGlobalNPC.SCalWorm != -1) + wormAlive = Main.npc[CalamityGlobalNPC.SCalWorm].active; + 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 (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; + } + else + { + npc.frameCounter += FrameChangeSpeed; + npc.frameCounter %= 6; + npc.frame.Y = (int)npc.frameCounter + (int)FrameType * 6; + } } public override Color? GetAlpha(Color drawColor) { if (willCharge) - return new Color(0, 0, 0, npc.alpha); + return drawColor * npc.Opacity * 0.45f; return null; } @@ -2331,13 +2874,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = npc.ai[0] > 1f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitas2") : 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 = CalamityWorld.downedSCal && !BossRushEvent.BossRushActive ? Main.npcTexture[npc.type] : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasHooded"); + + 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; - if (CalamityConfig.Instance.Afterimages) + 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) { for (int num155 = 1; num155 < num153; num155 += 2) { @@ -2346,41 +2892,135 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + 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, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + vector43 -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); - texture2D15 = npc.ai[0] > 1f ? ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitas2Glow") : ModContent.GetTexture("CalamityMod/NPCs/SupremeCalamitas/SupremeCalamitasGlow"); - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + if (inPhase2) + { + // Make the sprite jitter with rage in phase 2. This does not happen in rematches since it would make little sense logically. + if (!CalamityWorld.downedSCal) + vector43 += Main.rand.NextVector2Circular(0.25f, 0.7f); - if (CalamityConfig.Instance.Afterimages) - { - for (int num163 = 1; num163 < num153; num163++) - { - 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 / Main.npcFrameCount[npc.type]) * npc.scale / 2f; - vector44 += vector11 * npc.scale + new Vector2(0f, 4f + 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); + // And gain a flaming aura. + 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, frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + DrawForcefield(spriteBatch); + DrawShield(spriteBatch); return false; } + public void DrawForcefield(SpriteBatch spriteBatch) + { + spriteBatch.EnterShaderRegion(); + + 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) + 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) + intensity *= 0.6f; + + float lifeRatio = npc.life / (float)npc.lifeMax; + float flickerPower = 0f; + if (lifeRatio < 0.6f) + flickerPower += 0.1f; + if (lifeRatio < 0.3f) + flickerPower += 0.15f; + if (lifeRatio < 0.1f) + flickerPower += 0.2f; + if (lifeRatio < 0.05f) + flickerPower += 0.1f; + float opacity = forcefieldOpacity; + 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)) + intensity = 1.1f; + + Texture2D forcefieldTexture = ModContent.GetTexture("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)) + { + forcefieldColor *= 0.25f; + secondaryForcefieldColor = Color.Lerp(secondaryForcefieldColor, Color.Black, 0.7f); + } + + forcefieldColor *= opacity; + secondaryForcefieldColor *= opacity; + + GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor); + GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor); + GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(intensity); + 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.ExitShaderRegion(); + } + + public void DrawShield(SpriteBatch spriteBatch) + { + float jawRotation = shieldRotation; + float jawRotationOffset = 0f; + + // Have an agape mouth when charging. + if (npc.ai[1] == 2f) + jawRotationOffset -= 0.71f; + + // And a laugh right before the charge. + 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; + Vector2 jawDrawPosition = drawPosition; + SpriteEffects direction = Math.Cos(shieldRotation) > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; + if (direction == SpriteEffects.FlipVertically) + jawDrawPosition += (shieldRotation - MathHelper.PiOver2).ToRotationVector2() * 42f; + else + { + jawDrawPosition += (shieldRotation + MathHelper.PiOver2).ToRotationVector2() * 42f; + jawRotationOffset *= -1f; + } + + spriteBatch.Draw(shieldJawTexture, jawDrawPosition, null, shieldColor, jawRotation + jawRotationOffset, shieldJawTexture.Size() * 0.5f, 1f, direction, 0f); + spriteBatch.Draw(shieldSkullTexture, drawPosition, null, shieldColor, shieldRotation, shieldSkullTexture.Size() * 0.5f, 1f, direction, 0f); + } + public override void HitEffect(int hitDirection, double damage) { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + hitTimer = 35; + 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); @@ -2417,16 +3057,12 @@ 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 * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 600, true); - if (CalamityWorld.revenge) - { - player.AddBuff(ModContent.BuffType(), 600, true); - } } } } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.png b/NPCs/SupremeCalamitas/SupremeCalamitas.png index 0eea683573..1040ac0397 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas.png and b/NPCs/SupremeCalamitas/SupremeCalamitas.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas2.png b/NPCs/SupremeCalamitas/SupremeCalamitas2.png deleted file mode 100644 index 87017c3b28..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas2Glow.png b/NPCs/SupremeCalamitas/SupremeCalamitas2Glow.png deleted file mode 100644 index b7730d4549..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas2Glow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png b/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png deleted file mode 100644 index f09dcde7e3..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitasGlow.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png new file mode 100644 index 0000000000..23b956ca93 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeCalamitasHooded.png differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png b/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png deleted file mode 100644 index 2b3078e2ef..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCalamitas_Head_Boss.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 96afbf5f59..af55c1e4bf 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -1,6 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -14,7 +16,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas [AutoloadBossHead] public class SupremeCataclysm : ModNPC { - private int distanceY = -375; + private const int distanceX = 750; + private int distanceY = -375; public override void SetStaticDefaults() { @@ -29,22 +32,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.npcSlots = 5f; npc.width = 120; npc.height = 120; - npc.defense = 100; - npc.DR_NERD(0.7f, 0.7f, 0.75f, 0.6f, true); + npc.defense = 80; + npc.DR_NERD(0.25f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(1200000, 1500000); + npc.LifeMaxNERB(240000, 276000, 100000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -72,43 +69,57 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { CalamityGlobalNPC.SCalCataclysm = npc.whoAmI; - bool expertMode = Main.expertMode; if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { npc.active = false; npc.netUpdate = true; return; } - npc.TargetClosest(true); - float num676 = 60f; + + float totalLifeRatio = npc.life / (float)npc.lifeMax; + if (CalamityGlobalNPC.SCalCatastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.SCalCatastrophe].active) + totalLifeRatio += Main.npc[CalamityGlobalNPC.SCalCatastrophe].life / (float)Main.npc[CalamityGlobalNPC.SCalCatastrophe].lifeMax; + } + totalLifeRatio *= 0.5f; + + // Get a target + 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(); + + float num676 = 60f; float num677 = 1.5f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num677 *= 0.5f; } - float distanceX = 750f; - if (npc.ai[3] < 750f) - { - npc.ai[3] += 1f; - distanceY += 1; - } - else if (npc.ai[3] < 1500f) - { - npc.ai[3] += 1f; - distanceY -= 1; - } - if (npc.ai[3] >= 1500f) - { - npc.ai[3] = 0f; - } - Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); + int scale = (int)Math.Round(MathHelper.Lerp(2f, 6.5f, 1f - totalLifeRatio)); + if (npc.ai[3] < distanceX) + { + npc.ai[3] += scale; + distanceY += scale; + } + else if (npc.ai[3] < distanceX * 2) + { + npc.ai[3] += scale; + distanceY -= scale; + } + else + npc.ai[3] = 0f; + + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); float num678 = Main.player[npc.target].Center.X - vector83.X + distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y + (float)distanceY; - npc.rotation = 1.57f; + float num679 = Main.player[npc.target].Center.Y - vector83.Y + distanceY; + npc.rotation = MathHelper.PiOver2; float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); num680 = num676 / num680; num678 *= num680; @@ -151,42 +162,39 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[0] >= 120f) { - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f) + float fireRate = CalamityWorld.malice ? 2f : MathHelper.Lerp(1f, 2.5f, 1f - totalLifeRatio); + npc.ai[1] += fireRate; + if (npc.ai[1] >= 60f) { npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = -8f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = ModContent.ProjectileType(); - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneSkullSound"), npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, new Vector2(-8f, 0f), type, damage, 0f, Main.myPlayer); } } - npc.ai[2] += 1f; - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.ai[2] += 2f; - } + fireRate = CalamityWorld.malice ? 3f : MathHelper.Lerp(1f, 4f, 1f - totalLifeRatio); + npc.ai[2] += fireRate; if (npc.ai[2] >= 300f) { npc.ai[2] = 0f; - float num689 = 7f; - int num690 = expertMode ? 150 : 200; //600 500 - Main.PlaySound(SoundID.Item20, npc.position); + float speed = 7f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (Main.netMode != NetmodeID.MultiplayerClient) { - for (i = 0; i < 8; i++) + 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) * num689), (float)(Math.Cos(offsetAngle) * num689), ModContent.ProjectileType(), num690, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), ModContent.ProjectileType(), num690, 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 dust = 0; dust <= 5; dust++) @@ -197,14 +205,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == ModContent.ProjectileType()) - { - damage /= 2; - } - } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); @@ -232,14 +232,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/SupremeCataclysmGlow"); @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -264,17 +264,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas return false; } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index d895ac72bd..3f626975e3 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -1,6 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -14,7 +16,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas [AutoloadBossHead] public class SupremeCatastrophe : ModNPC { - private int distanceY = 375; + private const int distanceX = 750; + private int distanceY = 375; public override void SetStaticDefaults() { @@ -29,24 +32,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.npcSlots = 5f; npc.width = 120; npc.height = 120; - npc.defense = 100; - npc.DR_NERD(0.7f, 0.7f, 0.75f, 0.6f, true); + npc.defense = 80; + npc.DR_NERD(0.25f, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); - npc.LifeMaxNERB(1200000, 1500000); - double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.LifeMaxNERB(240000, 276000, 100000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; } @@ -72,43 +69,57 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void AI() { CalamityGlobalNPC.SCalCatastrophe = npc.whoAmI; - bool expertMode = Main.expertMode; if (CalamityGlobalNPC.SCal < 0 || !Main.npc[CalamityGlobalNPC.SCal].active) { npc.active = false; npc.netUpdate = true; return; } - npc.TargetClosest(true); - float num676 = 60f; + + float totalLifeRatio = npc.life / (float)npc.lifeMax; + if (CalamityGlobalNPC.SCalCataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.SCalCataclysm].active) + totalLifeRatio += Main.npc[CalamityGlobalNPC.SCalCataclysm].life / (float)Main.npc[CalamityGlobalNPC.SCalCataclysm].lifeMax; + } + totalLifeRatio *= 0.5f; + + // Get a target + 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(); + + float num676 = 60f; float num677 = 1.5f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = Main.player[npc.target].inventory[Main.player[npc.target].selectedItem]; - if (targetSelectedItem.melee && (targetSelectedItem.shoot == 0 || CalamityMod.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) + if (targetSelectedItem.melee && (targetSelectedItem.shoot == ProjectileID.None || CalamityLists.trueMeleeProjectileList.Contains(targetSelectedItem.shoot))) { num677 *= 0.5f; } - float distanceX = 750f; - if (npc.ai[3] < 750f) + int scale = (int)Math.Round(MathHelper.Lerp(2f, 6.5f, 1f - totalLifeRatio)); + if (npc.ai[3] < distanceX) { - npc.ai[3] += 1f; - distanceY -= 1; + npc.ai[3] += scale; + distanceY -= scale; } - else if (npc.ai[3] < 1500f) + else if (npc.ai[3] < distanceX * 2) { - npc.ai[3] += 1f; - distanceY += 1; + npc.ai[3] += scale; + distanceY += scale; } - if (npc.ai[3] >= 1500f) - { + else npc.ai[3] = 0f; - } + Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); float num678 = Main.player[npc.target].Center.X - vector83.X - distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y + (float)distanceY; - npc.rotation = 4.71f; + float num679 = Main.player[npc.target].Center.Y - vector83.Y + distanceY; + npc.rotation = MathHelper.PiOver2 * 3f; float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); num680 = num676 / num680; num678 *= num680; @@ -151,42 +162,39 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[0] >= 120f) { - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) + float fireRate = CalamityWorld.malice ? 2f : MathHelper.Lerp(1f, 2.5f, 1f - totalLifeRatio); + npc.ai[1] += fireRate; + if (npc.ai[1] >= 45f) { npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = 4f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = ModContent.ProjectileType(); - if (Main.netMode != NetmodeID.MultiplayerClient) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), npc.Center); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + if (Main.netMode != NetmodeID.MultiplayerClient) { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center, new Vector2(4f, 0f), type, damage, 0f, Main.myPlayer); } } - npc.ai[2] += 1f; - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - npc.ai[2] += 2f; - } - if (npc.ai[2] >= 300f) + fireRate = CalamityWorld.malice ? 3f : MathHelper.Lerp(1f, 4f, 1f - totalLifeRatio); + npc.ai[2] += fireRate; + if (npc.ai[2] >= 300f) { npc.ai[2] = 0f; - float num689 = 7f; - int num690 = expertMode ? 150 : 200; //600 500 - Main.PlaySound(SoundID.Item20, npc.position); + float speed = 7f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneShoot"), npc.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (Main.netMode != NetmodeID.MultiplayerClient) { - for (i = 0; i < 8; i++) + 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) * num689), (float)(Math.Cos(offsetAngle) * num689), ModContent.ProjectileType(), num690, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), ModContent.ProjectileType(), num690, 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 dust = 0; dust <= 5; dust++) @@ -197,14 +205,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == ModContent.ProjectileType()) - { - damage /= 2; - } - } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); @@ -232,14 +232,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); + 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/SupremeCatastropheGlow"); @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas 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, 4f + npc.gfxOffY); + vector44 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -264,17 +264,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas return false; } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; - public override bool PreNPCLoot() - { - return false; - } - - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png b/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png index 16061784b8..ff2f5654aa 100644 Binary files a/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png and b/NPCs/SupremeCalamitas/SupremeCatastrophe_Head_Boss.png differ diff --git a/NPCs/SupremeCalamitas/SupremeShieldBottom.png b/NPCs/SupremeCalamitas/SupremeShieldBottom.png new file mode 100644 index 0000000000..dbcdfc736d Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeShieldBottom.png differ diff --git a/NPCs/SupremeCalamitas/SupremeShieldTop.png b/NPCs/SupremeCalamitas/SupremeShieldTop.png new file mode 100644 index 0000000000..5154a5a348 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremeShieldTop.png differ diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index f042fc5f0c..9f787d9d47 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -144,7 +144,10 @@ namespace CalamityMod.NPCs.TownNPCs public override void SetupShop(Chest shop, ref int nextSlot) { - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + shop.item[nextSlot].SetDefaults(ItemID.WarmthPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; @@ -180,11 +183,9 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = 1000000; //I think this is 5 platinum - nextSlot++; + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); + nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); nextSlot++; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 7d5dd651c0..355a5e0617 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -1,5 +1,7 @@ +using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Typeless; using CalamityMod.World; using System.Collections.Generic; @@ -73,7 +75,7 @@ namespace CalamityMod.NPCs.TownNPCs public override string GetChat() { - if (CalamityWorld.bossRushActive) + if (BossRushEvent.BossRushActive) return "Why are you talking to me right now? Either way, I expect you to turn in a perfect performance!"; if (npc.homeless) @@ -106,18 +108,18 @@ namespace CalamityMod.NPCs.TownNPCs } } - if (CalamityGlobalNPC.AnyBossNPCS()) + if (CalamityUtils.AnyBossNPCS()) return "Nothard/10, if I fight bosses I wanna feel like screaming 'OH YES DADDY!' while I die repeatedly."; IList dialogue = new List(); if (Main.dayTime) { - dialogue.Add("Like I always say, when you're drunk you can tolerate annoying people a lot more easily..."); + dialogue.Add("Like I always say, when you're drunk you can tolerate annoying people a lot easier..."); dialogue.Add("I'm literally balls drunk off my sass right now."); dialogue.Add("I'm either laughing because I'm drunk or because I've lost my mind. Probably both."); dialogue.Add("When I'm drunk I'm way happier...at least until the talking worms start to appear."); - dialogue.Add("I should reprogram the whole game while drunk and send it back to the testers."); + dialogue.Add("I should reprogram the whole game, while drunk, and send it back to the testers."); dialogue.Add("What a great day, might just drink so much that I get poisoned again."); } else @@ -193,10 +195,10 @@ namespace CalamityMod.NPCs.TownNPCs { dialogue.Add("So...you're riding me, huh? That's not weird at all."); dialogue.Add("Are you coming on to me?"); - dialogue.Add("If I was a magical horse, I'd be out in space swirling cocktails, as I watch space worms battle for my enjoyment."); + dialogue.Add("If I was a magical horse, I'd be out in space, swirling cocktails, as I watch space worms battle for my enjoyment."); } - IList donorList = new List(CalamityMod.donatorList); + IList donorList = new List(CalamityLists.donatorList); string[] donors = new string[12]; for (int i = 0; i < 12; i++) { @@ -236,83 +238,96 @@ namespace CalamityMod.NPCs.TownNPCs } } - public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value + public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original alcohol value { - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + shop.item[nextSlot].SetDefaults(ItemID.HeartreachPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ItemID.LifeforcePotion); + int goldCost = NPC.downedMoonlord ? 8 : 4; + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, goldCost, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ItemID.LovePotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 0, 30, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 7, 50, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 7, 50, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 4, 0, 0); nextSlot++; if (NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); nextSlot++; } if (NPC.downedPlantBoss) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 35, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); nextSlot++; } if (CalamityWorld.downedAstrageldon) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 3, 0, 0); nextSlot++; if (Main.bloodMoon) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 15, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 4, 0, 0); nextSlot++; } if (!Main.dayTime) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 6, 0, 0); nextSlot++; } } @@ -320,40 +335,40 @@ namespace CalamityMod.NPCs.TownNPCs if (NPC.downedGolemBoss) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 5, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 2, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 8, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 10, 0, 0); nextSlot++; } shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(2, 0, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 50, 0, 0); nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(3, 0, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(1, 0, 0, 0); nextSlot++; } @@ -374,13 +389,13 @@ namespace CalamityMod.NPCs.TownNPCs public override void TownNPCAttackProj(ref int projType, ref int attackDelay) { - projType = ModContent.ProjectileType(); + projType = ModContent.ProjectileType(); attackDelay = 1; } public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) { - multiplier = 2f; + multiplier = 11.5f; } } } diff --git a/NPCs/TownNPCs/FAP.png b/NPCs/TownNPCs/FAP.png index de58fdb8c2..c29b4bed7f 100644 Binary files a/NPCs/TownNPCs/FAP.png and b/NPCs/TownNPCs/FAP.png differ diff --git a/NPCs/TownNPCs/FAP_Head.png b/NPCs/TownNPCs/FAP_Head.png index cce3f796b8..05a348609d 100644 Binary files a/NPCs/TownNPCs/FAP_Head.png and b/NPCs/TownNPCs/FAP_Head.png differ diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 6ca6b7ac25..31044def25 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -374,6 +374,17 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; + shop.item[nextSlot].SetDefaults(ModContent.ItemType()); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.GillsPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.WaterWalkingPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.FlipperPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; if (CalamityWorld.downedDesertScourge) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index d7b43f5d9b..5beceda8f1 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -20,12 +20,17 @@ namespace CalamityMod.NPCs.TownNPCs public static List PossibleNames = new List() { + // Patron names + "Xplizzy", // <@!98826096237109248> Whitegiraffe#6342 + "Freakish", // <@!750363283520749598> Freakish#0001 + + // Original names "Laura", "Mie", "Bonnie", "Sarah", "Diane", "Kate", "Penelope", "Marisa", "Maribel", "Valerie", "Jessica", "Rowan", "Jessie", "Jade", "Hearn", - "Amber", "Anne", "Indiana", "Xplizzy" + "Amber", "Anne", "Indiana" }; public override void SetStaticDefaults() @@ -207,7 +212,7 @@ namespace CalamityMod.NPCs.TownNPCs case 1: return "Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike?"; } - CalamityMod.UpdateServerBoolean(); + CalamityNetcode.SyncWorld(); } return "Sorry, I got nothing. Perhaps you could reforge something and come back later..."; } @@ -255,7 +260,16 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; shop.item[nextSlot].SetDefaults(ItemID.TigerClimbingGear); nextSlot++; - if (CalamityWorld.downedSlimeGod) + shop.item[nextSlot].SetDefaults(ItemID.InvisibilityPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.NightOwlPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + shop.item[nextSlot].SetDefaults(ItemID.TrapsightPotion); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 1, 0, 0); + nextSlot++; + if (CalamityWorld.downedSlimeGod) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; @@ -278,7 +292,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 60, 0, 0); nextSlot++; } - if (NPC.downedMechBoss1 || NPC.downedMechBoss2 || NPC.downedMechBoss3) + if (NPC.downedMechBossAny) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; @@ -323,7 +337,7 @@ namespace CalamityMod.NPCs.TownNPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(25, 0, 0, 0); nextSlot++; } - if (CalamityWorld.buffedEclipse && !CalamityWorld.dragonScalesBought) + if (CalamityWorld.downedYharon) { shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(40, 0, 0, 0); diff --git a/NPCs/TownNPCs/THIEFAlt.png b/NPCs/TownNPCs/THIEFAlt.png index d458ec794c..96783eefe2 100644 Binary files a/NPCs/TownNPCs/THIEFAlt.png and b/NPCs/TownNPCs/THIEFAlt.png differ diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs new file mode 100644 index 0000000000..219026ada2 --- /dev/null +++ b/NPCs/TownNPCs/WITCH.cs @@ -0,0 +1,152 @@ +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Items; +using CalamityMod.Projectiles.Magic; +using CalamityMod.UI.CalamitasEnchants; +using CalamityMod.World; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +using static Terraria.ModLoader.ModContent; +using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; + +namespace CalamityMod.NPCs.TownNPCs +{ + [AutoloadHead] + public class WITCH : ModNPC + { + public override void SetStaticDefaults() + { + 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; + } + + 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; + + // You should not be able to kill SCal under any typical circumstances. + npc.lifeMax = 1000000; + + npc.defense = 120; + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath6; + npc.knockBackResist = 0.8f; + animationType = NPCID.Wizard; + } + + public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedSCal && !NPC.AnyNPCs(NPCType()); + + public override string TownNPCName() => "Calamitas"; + + public override string GetChat() => "Mrrp is cringe."; + + public override void SetChatButtons(ref string button, ref string button2) => button = "Enchant"; + + public override void OnChatButtonClicked(bool firstButton, ref bool shop) + { + if (firstButton) + { + Main.playerInventory = true; + Main.LocalPlayer.Calamity().newCalamitasInventory = false; + CalamitasEnchantUI.NPCIndex = npc.whoAmI; + CalamitasEnchantUI.CurrentlyViewing = true; + + if (!Main.LocalPlayer.Calamity().GivenBrimstoneLocus) + { + DropHelper.DropItem(npc, ItemType()); + Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; + } + + shop = false; + } + } + + // Make this Town NPC teleport to the Queen statue when triggered. + public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue; + + public override void TownNPCAttackStrength(ref int damage, ref float knockback) + { + damage = 50; + knockback = 10f; + } + + public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) + { + cooldown = 10; + randExtraCooldown = 50; + } + + public override bool PreAI() + { + // Disappear if the SCal boss is active. She's supposed to be the boss. + // 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; + return false; + } + return true; + } + + //public override void TownNPCAttackMagic(ref float auraLightMultiplier) + + public override void TownNPCAttackProj(ref int projType, ref int attackDelay) + { + projType = ProjectileType(); + attackDelay = 1; + } + + public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) + { + multiplier = 2f; + } + + // Explode into red dust on death. + public override void HitEffect(int hitDirection, double damage) + { + 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; + 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); + Main.dust[brimstone].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[brimstone].scale = 0.5f; + Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + + 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); + 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); + Main.dust[fire].velocity *= 2f; + } + } + } + } +} diff --git a/NPCs/TownNPCs/WITCH.png b/NPCs/TownNPCs/WITCH.png new file mode 100644 index 0000000000..7c02e35630 Binary files /dev/null and b/NPCs/TownNPCs/WITCH.png differ diff --git a/NPCs/TownNPCs/WITCH_Head.png b/NPCs/TownNPCs/WITCH_Head.png new file mode 100644 index 0000000000..8869c7a345 Binary files /dev/null and b/NPCs/TownNPCs/WITCH_Head.png differ diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index e5aed4aac6..3106e6a234 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -1,3 +1,5 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -21,13 +23,14 @@ namespace CalamityMod.NPCs.Yharon public override void SetDefaults() { + npc.Calamity().canBreakPlayerDefense = true; npc.aiStyle = -1; aiType = -1; - npc.damage = 100; + npc.GetNPCDamage(); npc.width = 50; npc.height = 50; - npc.defense = 50; - npc.lifeMax = 10000; + npc.lifeMax = 3000; + npc.defense = 20; npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; @@ -39,11 +42,11 @@ namespace CalamityMod.NPCs.Yharon public override void AI() { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; npc.alpha -= 3; if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) { - npc.TargetClosest(true); + npc.TargetClosest(); } if (npc.localAI[1] == 0f) { @@ -163,9 +166,9 @@ namespace CalamityMod.NPCs.Yharon 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 ? 75 : 90; - int num9 = ProjectileID.CultistBossFireBall; - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, num9, num8, 0f, Main.myPlayer, 0f, 0f); + int type = ProjectileID.CultistBossFireBall; + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(vector.X, vector.Y, num4, num5, type, damage, 0f, Main.myPlayer, 0f, 0f); } } int num10 = (int)npc.position.X + npc.width / 2; @@ -238,47 +241,52 @@ namespace CalamityMod.NPCs.Yharon return new Color(255, Main.DiscoG, 53, 0); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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)); - Color color36 = new Color(255, Main.DiscoG, 53, 0); - float amount9 = 0.5f; - int num153 = 10; + 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 = new Color(255, Main.DiscoG, 53, 0); + float amount9 = 0.5f; + int num153 = 10; - if (CalamityConfig.Instance.Afterimages) - { - for (int num155 = 1; num155 < num153; num155 += 2) - { - Color color38 = lightColor; - color38 = Color.Lerp(color38, color36, amount9); - 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - } + if (CalamityConfig.Instance.Afterimages) + { + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = lightColor; + color38 = Color.Lerp(color38, color36, amount9); + 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 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, 4f + 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; - } + return false; + } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; return true; } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 240, true); + } + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; @@ -286,10 +294,5 @@ namespace CalamityMod.NPCs.Yharon int frame = (int)npc.frameCounter; npc.frame.Y = frame * frameHeight; } - - public override bool PreNPCLoot() - { - return false; - } } } diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index a64bd8c3b0..6af9c4baf2 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -1,13 +1,15 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.NPCs.Yharon { - public class DetonatingFlare2 : ModNPC + public class DetonatingFlare2 : ModNPC { float randomSpeed = 0f; @@ -15,23 +17,24 @@ namespace CalamityMod.NPCs.Yharon { DisplayName.SetDefault("Detonating Flame"); Main.npcFrameCount[npc.type] = 5; - NPCID.Sets.TrailingMode[npc.type] = 1; - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override void SetDefaults() { + npc.Calamity().canBreakPlayerDefense = true; npc.aiStyle = -1; aiType = -1; - npc.damage = 220; + npc.GetNPCDamage(); npc.width = 50; npc.height = 50; - npc.defense = 75; - npc.lifeMax = 13000; + npc.lifeMax = 3900; + npc.defense = 26; npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; + npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; npc.alpha = 255; } @@ -39,7 +42,7 @@ namespace CalamityMod.NPCs.Yharon public override void AI() { npc.alpha -= 3; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; if (npc.localAI[3] == 0f) { switch (Main.rand.Next(6)) @@ -74,43 +77,35 @@ namespace CalamityMod.NPCs.Yharon return new Color(255, Main.DiscoG, 53, 0); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - 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 = new Color(255, Main.DiscoG, 53, 0); - float amount9 = 0.5f; - int num153 = 10; - - if (CalamityConfig.Instance.Afterimages) - { - for (int num155 = 1; num155 < num153; num155 += 2) - { - Color color38 = lightColor; - color38 = Color.Lerp(color38, color36, amount9); - 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, SpriteEffects.None, 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, SpriteEffects.None, 0f); - - return false; - } - - public override void OnHitPlayer(Player player, int damage, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (CalamityWorld.revenge) + 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 = new Color(255, Main.DiscoG, 53, 0); + float amount9 = 0.5f; + int num153 = 10; + + if (CalamityConfig.Instance.Afterimages) { - player.AddBuff(ModContent.BuffType(), 300); + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = lightColor; + color38 = Color.Lerp(color38, color36, amount9); + 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.None, 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.None, 0f); + + return false; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -119,6 +114,11 @@ namespace CalamityMod.NPCs.Yharon return true; } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 240, true); + } + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; @@ -126,10 +126,5 @@ namespace CalamityMod.NPCs.Yharon int frame = (int)npc.frameCounter; npc.frame.Y = frame * frameHeight; } - - public override bool PreNPCLoot() - { - return false; - } } } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 99fd7eff6a..be93674baa 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.Items.Accessories.Wings; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; @@ -12,16 +13,18 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; using System.IO; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.Yharon @@ -35,19 +38,17 @@ namespace CalamityMod.NPCs.Yharon private bool enraged = false; private bool protectionBoost = false; private bool moveCloser = false; - private bool phaseOneLoot = true; - private bool dropLoot = false; private bool useTornado = true; - private int healCounter = 0; private int secondPhasePhase = 1; private int teleportLocation = 0; private bool startSecondAI = false; private bool spawnArena = false; private int invincibilityCounter = 0; + private int fastChargeTelegraphTime = 120; - public static float Phase1_DR = 0.24f; - public static float Phase2_DR = 0.26f; - public static float ChargeTelegraph_DR = 0.4f; + private const float ai2GateValue = 0.55f; + + public static float normalDR = 0.22f; public static float EnragedDR = 0.9f; public override void SetStaticDefaults() @@ -59,48 +60,30 @@ namespace CalamityMod.NPCs.Yharon public override void SetDefaults() { + npc.Calamity().canBreakPlayerDefense = true; npc.npcSlots = 50f; - npc.damage = 330; - npc.width = 200; + npc.GetNPCDamage(); + npc.width = 200; npc.height = 200; - npc.defense = 150; - npc.LifeMaxNERB(2275000, 2525000, 3700000); + npc.defense = 90; + npc.LifeMaxNERB(1080625, 1296750, 370000); double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; - npc.value = Item.buyPrice(1, 50, 0, 0); + npc.value = Item.buyPrice(1, 0, 0, 0); npc.boss = true; - - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[ModContent.BuffType()] = false; - npc.buffImmune[ModContent.BuffType()] = false; - - npc.DR_NERD(Phase1_DR, null, null, null, true); + npc.DR_NERD(normalDR, null, null, null, true); CalamityGlobalNPC global = npc.Calamity(); global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); - else - music = MusicID.Boss1; - if (CalamityWorld.buffedEclipse || CalamityWorld.bossRushActive) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); - else - music = MusicID.Boss3; - } + + music = CalamityMod.Instance.GetMusicFromMusicMod("YHARON") ?? MusicID.Boss3; + npc.HitSound = SoundID.NPCHit56; npc.DeathSound = SoundID.NPCDeath60; bossBag = ModContent.ItemType(); @@ -112,16 +95,14 @@ namespace CalamityMod.NPCs.Yharon bb[0] = enraged; bb[1] = protectionBoost; bb[2] = moveCloser; - bb[3] = phaseOneLoot; - bb[4] = dropLoot; - bb[5] = useTornado; - bb[6] = startSecondAI; - bb[7] = npc.dontTakeDamage; + bb[3] = useTornado; + bb[4] = startSecondAI; + bb[5] = npc.dontTakeDamage; writer.Write(bb); - writer.Write(healCounter); writer.Write(secondPhasePhase); writer.Write(teleportLocation); writer.Write(invincibilityCounter); + writer.Write(fastChargeTelegraphTime); writer.WriteVector2(flareDustBulletHellSpawn); writer.Write(safeBox.X); writer.Write(safeBox.Y); @@ -130,6 +111,7 @@ namespace CalamityMod.NPCs.Yharon 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) @@ -138,15 +120,13 @@ namespace CalamityMod.NPCs.Yharon enraged = bb[0]; protectionBoost = bb[1]; moveCloser = bb[2]; - phaseOneLoot = bb[3]; - dropLoot = bb[4]; - useTornado = bb[5]; - startSecondAI = bb[6]; - npc.dontTakeDamage = bb[7]; - healCounter = reader.ReadInt32(); + useTornado = bb[3]; + startSecondAI = bb[4]; + npc.dontTakeDamage = bb[5]; secondPhasePhase = reader.ReadInt32(); teleportLocation = reader.ReadInt32(); invincibilityCounter = reader.ReadInt32(); + fastChargeTelegraphTime = reader.ReadInt32(); flareDustBulletHellSpawn = reader.ReadVector2(); safeBox.X = reader.ReadInt32(); safeBox.Y = reader.ReadInt32(); @@ -155,115 +135,55 @@ namespace CalamityMod.NPCs.Yharon npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); npc.localAI[2] = reader.ReadSingle(); + npc.localAI[3] = reader.ReadSingle(); } public override void AI() { - // Disable loot drop - dropLoot = npc.life <= npc.lifeMax * 0.1; + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - // Stop rain - CalamityMod.StopRain(); + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; + + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression) + lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression; + + // Stop rain + CalamityMod.StopRain(); // Variables - bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; float pie = (float)Math.PI; + Vector2 vectorCenter = npc.Center; + // Start phase 2 or not if (startSecondAI) { - // Despawn and drop phase 1 loot - if (!CalamityWorld.buffedEclipse && !CalamityWorld.bossRushActive) - { - npc.DeathSound = null; - npc.dontTakeDamage = true; - - npc.velocity.Y -= 0.4f; - - if (npc.alpha < 255) - { - npc.alpha += 5; - if (npc.alpha > 255) - npc.alpha = 255; - } - - if (npc.timeLeft > 55) - npc.timeLeft = 55; - - if (npc.timeLeft < 5) - { - /*string key = "Mods.CalamityMod.DargonBossText2"; - Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - }*/ - - startSecondAI = false; - - npc.boss = false; - npc.life = 0; - - if (dropLoot) - npc.NPCLoot(); - - npc.active = false; - npc.netUpdate = true; - } - - return; - } - - if (phaseOneLoot && !CalamityWorld.bossRushActive) - { - npc.boss = false; - - if (dropLoot) - npc.NPCLoot(); - - npc.boss = true; - - npc.Calamity().AITimer = 0; - } - - // Don't drop phase 1 loot - phaseOneLoot = false; - - // Start second AI - Yharon_AI2(expertMode, revenge, death, pie); - + Yharon_AI2(expertMode, revenge, death, malice, pie, lifeRatio, vectorCenter, calamityGlobalNPC); return; } - // Timed DR adjustment - if (CalamityWorld.buffedEclipse) - { - if (npc.Calamity().AITimer < 3600) - npc.Calamity().AITimer = 3600; - } - - // Phase bools - bool phase2Check = death || npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); - bool phase3Check = npc.life <= npc.lifeMax * (death ? 0.6 : (revenge ? 0.5 : (expertMode ? 0.4 : 0.25))); - bool phase4Check = npc.life <= npc.lifeMax * 0.1; + // Phase booleans + float phase2GateValue = revenge ? 0.9f : expertMode ? 0.85f : 0.75f; + 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 isCharging = npc.ai[3] < 20f; // Flare limit int maxFlareCount = 3; // Timer, velocity and acceleration for idle phase before phase switch - int phaseSwitchTimer = expertMode ? 36 : 38; - float acceleration = expertMode ? 0.7f : 0.69f; - float velocity = expertMode ? 11f : 10.8f; + int phaseSwitchTimer = expertMode ? 36 : 40; + float acceleration = expertMode ? 0.75f : 0.7f; + float velocity = expertMode ? 12f : 11f; // Damage immunity if (phase3Change) @@ -273,36 +193,39 @@ namespace CalamityMod.NPCs.Yharon else if (phase1Change) npc.dontTakeDamage = phase2Check; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0) { acceleration = 0.95f; - velocity = 14f; + velocity = 15f; phaseSwitchTimer = 25; + fastChargeTelegraphTime = 60; } else if (phase3Change) { - acceleration = 0.85f; - velocity = 13f; - phaseSwitchTimer = 25; + acceleration = expertMode ? 0.85f : 0.8f; + velocity = expertMode ? 14f : 13f; + phaseSwitchTimer = expertMode ? 25 : 28; + fastChargeTelegraphTime = 100; } - else if (phase2Change && isCharging) + else if (phase2Change) { - acceleration = expertMode ? 0.8f : 0.78f; - velocity = expertMode ? 12.2f : 12f; - phaseSwitchTimer = expertMode ? 36 : 38; + acceleration = expertMode ? 0.8f : 0.75f; + velocity = expertMode ? 13f : 12f; + phaseSwitchTimer = expertMode ? 32 : 36; + fastChargeTelegraphTime = 110; } - else if (isCharging && !phase2Change && !phase3Change) - { + else phaseSwitchTimer = 25; - } // Timers and velocity for charging + float reduceSpeedChargeDistance = 540f; int chargeTime = expertMode ? 40 : 45; float chargeSpeed = expertMode ? 28f : 26f; - float fastChargeVelocityMultiplier = 1.5f; - int fastChargeTelegraphTimer = 120; + float fastChargeVelocityMultiplier = malice ? 2f : 1.5f; + bool playFastChargeRoarSound = npc.localAI[1] == fastChargeTelegraphTime * 0.5f; + bool doFastCharge = npc.localAI[1] > fastChargeTelegraphTime; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0) { chargeTime = 30; chargeSpeed = 40f; @@ -312,7 +235,7 @@ namespace CalamityMod.NPCs.Yharon chargeTime = 35; chargeSpeed = 30f; } - else if (isCharging && phase2Change) + else if (phase2Change) { chargeTime = expertMode ? 38 : 43; @@ -322,8 +245,8 @@ namespace CalamityMod.NPCs.Yharon if (revenge) { - int chargeTimeDecrease = death ? 4 : 2; - float velocityMult = death ? 1.1f : 1.05f; + int chargeTimeDecrease = malice ? 6 : death ? 4 : 2; + float velocityMult = malice ? 1.15f : death ? 1.1f : 1.05f; phaseSwitchTimer -= chargeTimeDecrease; acceleration *= velocityMult; velocity *= velocityMult; @@ -331,40 +254,54 @@ namespace CalamityMod.NPCs.Yharon chargeSpeed *= velocityMult; } - // Phase timers and velocities - int flareBombPhaseTimer = 60; - int flareBombSpawnDivisor = 3; - float flareBombPhaseAcceleration = 0.5f; - float flareBombPhaseVelocity = 10f; + float reduceSpeedFlareBombDistance = 570f; + int flareBombPhaseTimer = malice ? 30 : death ? 40 : 60; + int flareBombSpawnDivisor = flareBombPhaseTimer / 20; + float flareBombPhaseAcceleration = malice ? 1f : death ? 0.92f : 0.8f; + float flareBombPhaseVelocity = malice ? 16f : death ? 14f : 12f; + int fireTornadoPhaseTimer = 90; + int newPhaseTimer = 180; - int flareDustPhaseTimer = 300; - int flareDustPhaseTimer2 = 150; + + float flareDustPhaseScalar = death ? 48f : 60f; + phase2GateValue -= ai2GateValue; // 0.35, 70% HP = 0.7 - 0.55 = 0.15, 0.35 - 0.15 = 0.2 / 0.35 = 0.57, 60% HP = 0.6 - 0.55 = 0.05, 0.35 - 0.05 = 0.3 / 0.35 = 0.85, 80% HP = 0.8 - 0.55 = 0.25, 0.35 - 0.25 = 0.1 / 0.35 = 0.28 + int flareDustPhaseTimerReduction = revenge ? (int)(flareDustPhaseScalar * ((phase2GateValue - (lifeRatio - ai2GateValue)) / phase2GateValue)) : 0; + int flareDustPhaseTimer = (malice ? 210 : death ? 240 : 300) - flareDustPhaseTimerReduction; + int flareDustPhaseTimer2 = (malice ? 105 : death ? 120 : 150) - (flareDustPhaseTimerReduction / 2); + float spinTime = flareDustPhaseTimer / 2; - int flareDustSpawnDivisor = 30; - int flareDustSpawnDivisor2 = 5; - int flareDustSpawnDivisor3 = 12; + + int flareDustSpawnDivisor = flareDustPhaseTimer / 10; + int flareDustSpawnDivisor2 = flareDustPhaseTimer2 / 30; + int flareDustSpawnDivisor3 = flareDustPhaseTimer / 25; + float spinPhaseVelocity = 25f; float spinPhaseRotation = MathHelper.TwoPi * 3 / spinTime; + float increasedIdleTimeAfterBulletHell = -120f; + float teleportPhaseTimer = 30f; - Vector2 vectorCenter = npc.Center; + int spawnPhaseTimer = 75; - int projectileDamage = expertMode ? 75 : 90; // Target - if (npc.target < 0 || npc.target == 255 || 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(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(); + Player player = Main.player[npc.target]; // Despawn if (player.dead || !player.active) { - npc.TargetClosest(true); + npc.TargetClosest(); player = Main.player[npc.target]; if (player.dead || !player.active) { @@ -400,12 +337,12 @@ namespace CalamityMod.NPCs.Yharon enraged = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - safeBox.X = (int)(player.Center.X - (revenge ? 3000f : 3500f)); - safeBox.Y = (int)(player.Center.Y - (revenge ? 9000f : 10500f)); - safeBox.Width = revenge ? 6000 : 7000; - safeBox.Height = revenge ? 18000 : 21000; - Projectile.NewProjectile(player.Center.X + (revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.Center.X - (revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, 0f); + safeBox.X = (int)(player.Center.X - (malice ? 2000f : revenge ? 3000f : 3500f)); + safeBox.Y = (int)(player.Center.Y - 10500f); + safeBox.Width = malice ? 4000 : revenge ? 6000 : 7000; + safeBox.Height = 21000; + Projectile.NewProjectile(player.Center.X + (malice ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(player.Center.X - (malice ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } // Force Yharon to send a sync packet so that the arena gets sent immediately @@ -415,6 +352,7 @@ namespace CalamityMod.NPCs.Yharon else { enraged = !player.Hitbox.Intersects(safeBox); + npc.Calamity().CurrentlyEnraged = enraged; if (enraged) { phaseSwitchTimer = 15; @@ -432,7 +370,7 @@ namespace CalamityMod.NPCs.Yharon // 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; - npc.Calamity().DR = protectionBoost ? EnragedDR : ((chargeTelegraph || bulletHell) ? ChargeTelegraph_DR : Phase1_DR); + calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; if (bulletHell) npc.damage = 0; @@ -523,8 +461,8 @@ namespace CalamityMod.NPCs.Yharon for (int num1469 = 0; num1469 < num1468; num1469++) { 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) + npc.Center; - Vector2 value16 = vector169 - npc.Center; + 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); Main.dust[num1470].noGravity = true; Main.dust[num1470].noLight = true; @@ -549,11 +487,16 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 0f && !player.dead) { if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 value17 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * velocity; - npc.SimpleFlyMovement(vector170, acceleration); + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 distanceFromDestination = destination - vectorCenter; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; int num1471 = Math.Sign(player.Center.X - vectorCenter.X); if (num1471 != 0) @@ -635,11 +578,10 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 5) { - npc.localAI[1] += 1f; - if (npc.localAI[1] == fastChargeTelegraphTimer - 60) + if (playFastChargeRoarSound) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.localAI[1] > fastChargeTelegraphTimer) + if (doFastCharge) { npc.ai[0] = 5f; npc.ai[1] = 0f; @@ -659,6 +601,8 @@ namespace CalamityMod.NPCs.Yharon npc.spriteDirection = -npc.direction; } } + else + npc.localAI[1] += 1f; } npc.netUpdate = true; @@ -677,7 +621,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -685,11 +630,16 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 2f) { if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 value19 = player.Center + new Vector2(npc.ai[1], -400f) - vectorCenter; - Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * flareBombPhaseVelocity; - npc.SimpleFlyMovement(vector172, flareBombPhaseAcceleration); + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 value17 = destination - vectorCenter; + Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; + + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) + npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + else + 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); @@ -699,7 +649,9 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { SpawnDetonatingFlares(fromMouth, player, maxFlareCount, new int[] { ModContent.NPCType() }); - Projectile.NewProjectile(fromMouth, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); } } @@ -720,7 +672,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -745,14 +698,15 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } // Enter new phase else if (npc.ai[0] == 4f) { - npc.velocity *= 0.98f; + npc.velocity *= 0.9f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); if (npc.ai[2] == newPhaseTimer - 60) @@ -765,7 +719,9 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.localAI[1] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -781,7 +737,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } #endregion @@ -791,11 +748,16 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 6f && !player.dead) { if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * velocity; - npc.SimpleFlyMovement(vector175, acceleration); + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 distanceFromDestination = destination - vectorCenter; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) @@ -862,7 +824,7 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 2) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = vectorCenter; if (npc.alpha < 255) { @@ -876,8 +838,7 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) { - teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); + Vector2 center = player.Center + new Vector2(0f, -540f); npcCenter = npc.Center = center; } @@ -916,11 +877,10 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 5) { - npc.localAI[1] += 1f; - if (npc.localAI[1] == fastChargeTelegraphTimer - 60) + if (playFastChargeRoarSound) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.localAI[1] > fastChargeTelegraphTimer) + if (doFastCharge) { npc.ai[0] = 11f; npc.ai[1] = 0f; @@ -940,6 +900,8 @@ namespace CalamityMod.NPCs.Yharon npc.spriteDirection = -npc.direction; } } + else + npc.localAI[1] += 1f; } else if (aiState == 6) { @@ -977,7 +939,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -997,8 +960,30 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { SpawnDetonatingFlares(flareDustBulletHellSpawn, player, maxFlareCount, new int[] { ModContent.NPCType() }); - int totalProjectiles = 38 - (int)(npc.ai[2] / 15f); // 36 for first ring, 18 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, projectileDamage, totalProjectiles, 0f, 0f, false); + 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); + + // Fire a flame towards every player, with a limit of 5 + if (expertMode) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); + + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + } } } @@ -1010,7 +995,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 6f; npc.ai[1] = 0f; npc.ai[2] = increasedIdleTimeAfterBulletHell; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -1032,14 +1018,15 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 6f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } // Enter new phase else if (npc.ai[0] == 10f) { - npc.velocity *= 0.98f; + npc.velocity *= 0.9f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); if (npc.ai[2] == newPhaseTimer - 60) @@ -1052,7 +1039,9 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.localAI[1] = 0f; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -1068,7 +1057,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -1087,7 +1077,9 @@ namespace CalamityMod.NPCs.Yharon Vector2 projectileVelocity = player.Center - fromMouth; projectileVelocity.Normalize(); projectileVelocity *= 0.1f; - Projectile.NewProjectile(fromMouth, projectileVelocity, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1100,7 +1092,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } #endregion @@ -1110,11 +1103,16 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 13f && !player.dead) { if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 value20 = player.Center + new Vector2(npc.ai[1], -200f) - vectorCenter; - Vector2 vector175 = Vector2.Normalize(value20 - npc.velocity) * velocity; - npc.SimpleFlyMovement(vector175, acceleration); + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 distanceFromDestination = destination - vectorCenter; + Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - npc.velocity) * velocity; + + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedChargeDistance) + npc.SimpleFlyMovement(desiredVelocity, acceleration); + else + npc.velocity *= 0.98f; int num1477 = Math.Sign(player.Center.X - vectorCenter.X); if (num1477 != 0) @@ -1184,7 +1182,7 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 2) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = vectorCenter; if (npc.alpha < 255) { @@ -1198,8 +1196,7 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == phaseSwitchTimer + 15f) { - teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = player.Center + new Vector2(-npc.ai[1], teleportLocation); + Vector2 center = player.Center + new Vector2(0f, -540f); npcCenter = npc.Center = center; } @@ -1238,11 +1235,10 @@ namespace CalamityMod.NPCs.Yharon } else if (aiState == 5) { - npc.localAI[1] += 1f; - if (npc.localAI[1] == fastChargeTelegraphTimer - 60) + if (playFastChargeRoarSound) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); - if (npc.localAI[1] > fastChargeTelegraphTimer) + if (doFastCharge) { npc.ai[0] = 18f; npc.ai[1] = 0f; @@ -1262,6 +1258,8 @@ namespace CalamityMod.NPCs.Yharon npc.spriteDirection = -npc.direction; } } + else + npc.localAI[1] += 1f; } else if (aiState == 6) { @@ -1305,7 +1303,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -1331,7 +1330,30 @@ namespace CalamityMod.NPCs.Yharon // Rotate spiral by 7.2 * (300 / 12) = +90 degrees and then back -90 degrees if (Main.netMode != NetmodeID.MultiplayerClient) - DoFlareDustBulletHell(1, flareDustPhaseTimer, projectileDamage, 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) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); + + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; + int type = ModContent.ProjectileType(); + 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); @@ -1343,6 +1365,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.localAI[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -1366,14 +1389,15 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 3f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } // Enter new phase else if (npc.ai[0] == 17f) { - npc.velocity *= 0.98f; + npc.velocity *= 0.9f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); if (npc.ai[2] == newPhaseTimer - 60) @@ -1387,6 +1411,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; + npc.localAI[1] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -1403,7 +1429,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 2f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } @@ -1422,7 +1449,9 @@ namespace CalamityMod.NPCs.Yharon Vector2 projectileVelocity = player.Center - fromMouth; projectileVelocity.Normalize(); projectileVelocity *= 0.1f; - Projectile.NewProjectile(fromMouth, projectileVelocity, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1435,6 +1464,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 1f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -1443,11 +1473,16 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 20f) { if (npc.ai[1] == 0f) - npc.ai[1] = 400 * Math.Sign((vectorCenter - player.Center).X); + npc.ai[1] = Math.Sign((vectorCenter - player.Center).X); - Vector2 value19 = player.Center + new Vector2(npc.ai[1], -400f) - vectorCenter; - Vector2 vector172 = Vector2.Normalize(value19 - npc.velocity) * flareBombPhaseVelocity; - npc.SimpleFlyMovement(vector172, flareBombPhaseAcceleration); + Vector2 destination = player.Center + new Vector2(npc.ai[1], 0); + Vector2 value17 = destination - vectorCenter; + Vector2 vector170 = Vector2.Normalize(value17 - npc.velocity) * flareBombPhaseVelocity; + + if (Vector2.Distance(vectorCenter, destination) > reduceSpeedFlareBombDistance) + npc.SimpleFlyMovement(vector170, flareBombPhaseAcceleration); + else + 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); @@ -1457,7 +1492,9 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { SpawnDetonatingFlares(fromMouth, player, maxFlareCount, new int[] { ModContent.NPCType(), ModContent.NPCType() }); - Projectile.NewProjectile(fromMouth, Vector2.Zero, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.target, 1f); } } @@ -1478,6 +1515,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 13f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); npc.netUpdate = true; } } @@ -1485,11 +1523,14 @@ namespace CalamityMod.NPCs.Yharon } #region AI2 - public void Yharon_AI2(bool expertMode, bool revenge, bool death, float pie) + public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool malice, float pie, float lifeRatio, Vector2 vectorCenter, CalamityGlobalNPC calamityGlobalNPC) { - bool phase2 = death || npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); - bool phase3 = npc.life <= npc.lifeMax * (death ? 0.65 : (revenge ? 0.5 : (expertMode ? 0.4 : 0.25))); - bool phase4 = npc.life <= npc.lifeMax * (death ? 0.3 : 0.2) && revenge; + float phase2GateValue = revenge ? 0.44f : expertMode ? 0.385f : 0.275f; + bool phase2 = death || lifeRatio <= phase2GateValue; + float phase3GateValue = death ? 0.358f : revenge ? 0.275f : expertMode ? 0.22f : 0.138f; + bool phase3 = lifeRatio <= phase3GateValue; + float phase4GateValue = death ? 0.165f : 0.11f; + bool phase4 = lifeRatio <= phase4GateValue && revenge; if (npc.ai[0] != 8f) { @@ -1500,49 +1541,21 @@ namespace CalamityMod.NPCs.Yharon if (!moveCloser) { - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DragonGod"); - else - music = MusicID.LunarBoss; + // When Yharon begins Phase 2, switch music to Roar of the Jungle Dragon. + music = CalamityMod.Instance.GetMusicFromMusicMod("DragonGod") ?? MusicID.LunarBoss; moveCloser = true; string key = "Mods.CalamityMod.FlameText"; Color messageColor = Color.Orange; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + CalamityUtils.DisplayLocalizedText(key, messageColor); } if (invincibilityCounter < 900) { phase2 = phase3 = phase4 = false; - invincibilityCounter += 1; - - int heal = 5; //900 / 5 = 180 - healCounter += 1; - if (healCounter >= heal) - { - healCounter = 0; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - 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; - } - } - } } else { @@ -1570,17 +1583,21 @@ namespace CalamityMod.NPCs.Yharon // Acquire target and determine enrage state if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) { - npc.TargetClosest(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(); + Player targetData = Main.player[npc.target]; // Despawn bool targetDead = false; if (targetData.dead || !targetData.active) { - npc.TargetClosest(true); + npc.TargetClosest(); targetData = Main.player[npc.target]; if (targetData.dead || !targetData.active) { @@ -1608,30 +1625,27 @@ namespace CalamityMod.NPCs.Yharon { protectionBoost = false; npc.damage = npc.defDamage; - - if (secondPhasePhase == 4) - npc.damage = (int)(npc.defDamage * 1.1f); } // Set DR based on protection boost (aka enrage) bool chargeTelegraph = npc.ai[0] < 2f && npc.localAI[1] > 0f; bool bulletHell = npc.ai[0] == 5f; - npc.Calamity().DR = protectionBoost ? EnragedDR : ((chargeTelegraph || bulletHell) ? ChargeTelegraph_DR : Phase2_DR); + calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; if (bulletHell) npc.damage = 0; - int projectileDamage = expertMode ? 110 : 125; - if (secondPhasePhase == 4) - projectileDamage = (int)(projectileDamage * 1.1); - - float phaseSwitchTimer = expertMode ? 30f : 32f; + float reduceSpeedChargeDistance = 500f; + float phaseSwitchTimer = malice ? 28f : expertMode ? 30f : 32f; float acceleration = expertMode ? 0.92f : 0.9f; - float velocity = expertMode ? 13.5f : 13f; + float velocity = expertMode ? 14.5f : 14f; float chargeTime = expertMode ? 32f : 35f; float chargeSpeed = expertMode ? 32f : 30f; - float fastChargeVelocityMultiplier = 1.5f; - int fastChargeTelegraphTimer = secondPhasePhase == 4 ? 60 : 120; + + 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; float fireballBreathTimer = 60f; float fireballBreathPhaseTimer = fireballBreathTimer + 120f; @@ -1645,20 +1659,23 @@ namespace CalamityMod.NPCs.Yharon float splittingFireballBreathYVelocityTimer = 40f; float splittingFireballBreathPhaseTimer = splittingFireballBreathTimer + splittingFireballBreathTimer2 + splittingFireballBreathYVelocityTimer; - float spinPhaseTimer = secondPhasePhase == 4 ? 180f : 240f; + float flareDustPhaseScalar = secondPhasePhase == 4 ? (death ? 54f : 60f) : (death ? 67f : 80f); + int spinPhaseTimerReduction = revenge ? (secondPhasePhase == 4 ? (int)(flareDustPhaseScalar * ((phase4GateValue - lifeRatio) / phase4GateValue)) : (int)(flareDustPhaseScalar * (ai2GateValue - lifeRatio))) : 0; + int spinPhaseTimer = (secondPhasePhase == 4 ? (malice ? 150 : death ? 160 : 180) : (malice ? 180 : death ? 200 : 240)) - spinPhaseTimerReduction; float spinTime = spinPhaseTimer / 2; float spinRotation = MathHelper.TwoPi * 3 / spinTime; float spinPhaseVelocity = 25f; - int flareDustSpawnDivisor = 24; - int flareDustSpawnDivisor3 = 12 + (secondPhasePhase == 4 ? 4 : 0); + int flareDustSpawnDivisor = spinPhaseTimer / 10; + int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); float increasedIdleTimeAfterBulletHell = -120f; - float flareSpawnDecelerationTimer = 90f; - float flareSpawnPhaseTimer = 180f; + float flareSpawnDecelerationTimer = malice ? 60f : death ? 75f : 90f; + int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (ai2GateValue - lifeRatio)) : 0; + float flareSpawnPhaseTimer = (malice ? 120f : death ? 150f : 180f) - flareSpawnPhaseTimerReduction; float teleportPhaseTimer = 45f; - if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) + if (calamityGlobalNPC.enraged > 0) { acceleration = 1.2f; velocity = 18f; @@ -1667,8 +1684,8 @@ namespace CalamityMod.NPCs.Yharon } else if (revenge) { - float chargeTimeDecrease = death ? 4f : 2f; - float velocityMult = death ? 1.1f : 1.05f; + float chargeTimeDecrease = malice ? 6f : death ? 4f : 2f; + float velocityMult = malice ? 1.15f : death ? 1.1f : 1.05f; acceleration *= velocityMult; velocity *= velocityMult; chargeTime -= chargeTimeDecrease; @@ -1689,15 +1706,20 @@ namespace CalamityMod.NPCs.Yharon else if (npc.ai[0] == 1f) { if (npc.ai[2] == 0f) - npc.ai[2] = (npc.Center.X < targetData.Center.X) ? 1 : -1; + npc.ai[2] = (vectorCenter.X < targetData.Center.X) ? 1 : -1; - Vector2 destination = targetData.Center + new Vector2(-npc.ai[2] * 450f, -200f); - Vector2 desiredVelocity = npc.DirectionTo(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); + else + npc.velocity *= 0.98f; + } - int num27 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + int num27 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.direction = npc.spriteDirection = num27; npc.ai[1] += 1f; @@ -1846,7 +1868,7 @@ namespace CalamityMod.NPCs.Yharon if (num28 == 5 && npc.ai[1] < phaseSwitchTimer + teleportPhaseTimer) { - float newRotation = npc.DirectionTo(targetData.Center).ToRotation(); + float newRotation = npc.AngleTo(targetData.Center); float amount = 0.04f; if (npc.spriteDirection == -1) @@ -1855,7 +1877,7 @@ namespace CalamityMod.NPCs.Yharon if (amount != 0f) npc.rotation = npc.rotation.AngleTowards(newRotation, amount); - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = vectorCenter; if (npc.alpha < 255) { @@ -1870,17 +1892,16 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == phaseSwitchTimer + timeBeforeTeleport) { - teleportLocation = Main.rand.NextBool(2) ? (revenge ? 500 : 600) : (revenge ? -500 : -600); - Vector2 center = targetData.Center + new Vector2(-npc.ai[2] * 500f, teleportLocation); + Vector2 center = targetData.Center + new Vector2(0f, -540f); npcCenter = npc.Center = center; } return; } - if (num28 == 7 && npc.localAI[1] <= fastChargeTelegraphTimer) + if (num28 == 7 && doFastChargeTelegraph) { - float newRotation = npc.DirectionTo(targetData.Center).ToRotation(); + float newRotation = npc.AngleTo(targetData.Center); float amount = 0.04f; if (npc.spriteDirection == -1) @@ -1889,10 +1910,11 @@ namespace CalamityMod.NPCs.Yharon if (amount != 0f) npc.rotation = npc.rotation.AngleTowards(newRotation, amount); - npc.localAI[1] += 1f; - if (npc.localAI[1] == fastChargeTelegraphTimer - (secondPhasePhase == 4 ? 30 : 60)) + if (playFastChargeRoarSound) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + npc.localAI[1] += 1f; + return; } @@ -1953,7 +1975,7 @@ namespace CalamityMod.NPCs.Yharon { case 2: //charge { - Vector2 vector = npc.DirectionTo(targetData.Center); + Vector2 vector = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); npc.spriteDirection = (vector.X > 0f) ? 1 : -1; npc.rotation = vector.ToRotation(); @@ -1966,7 +1988,7 @@ namespace CalamityMod.NPCs.Yharon } case 3: //fireballs { - Vector2 vector2 = new Vector2((targetData.Center.X > npc.Center.X) ? 1 : -1, 0f); + Vector2 vector2 = new Vector2((targetData.Center.X > vectorCenter.X) ? 1 : -1, 0f); npc.spriteDirection = (vector2.X > 0f) ? 1 : -1; npc.velocity = vector2 * -2f; @@ -1974,7 +1996,7 @@ namespace CalamityMod.NPCs.Yharon } case 5: //spin move { - Vector2 vector3 = npc.DirectionTo(targetData.Center); + Vector2 vector3 = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); npc.spriteDirection = (vector3.X > 0f) ? 1 : -1; npc.rotation = vector3.ToRotation(); @@ -1982,12 +2004,14 @@ namespace CalamityMod.NPCs.Yharon npc.rotation += pie; npc.velocity = vector3 * spinPhaseVelocity; - + + npc.localAI[3] = Main.rand.Next(2); + break; } case 7: //fast charge { - Vector2 vector = npc.DirectionTo(targetData.Center); + Vector2 vector = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); npc.spriteDirection = (vector.X > 0f) ? 1 : -1; npc.rotation = vector.ToRotation(); @@ -2016,20 +2040,21 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; + npc.TargetClosest(); } } // Fireball spit else if (npc.ai[0] == 3f) { - int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + int num29 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.ai[2] = num29; npc.ai[1] += 1f; if (npc.ai[1] < fireballBreathTimer) { Vector2 vector4 = targetData.Center + new Vector2(num29 * -750f, -300f); - Vector2 value = npc.DirectionTo(vector4) * 16f; + Vector2 value = npc.SafeDirectionTo(vector4) * 16f; if (npc.Distance(vector4) < 16f) npc.Center = vector4; @@ -2042,9 +2067,10 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] == fireballBreathTimer) { - int direction = (targetData.Center.X > npc.Center.X) ? 1 : -1; + 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); } if (npc.ai[1] >= fireballBreathTimer) @@ -2052,14 +2078,16 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] % 10 == 0 && Main.netMode != NetmodeID.MultiplayerClient) { float xOffset = 30f; - Vector2 position = npc.Center + 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; - Projectile.NewProjectile(position, projectileVelocity, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 1f, 0f); + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(position, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); } - if (Math.Abs(targetData.Center.X - npc.Center.X) > 700f && Math.Abs(npc.velocity.X) < chargeSpeed) + 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; } @@ -2068,31 +2096,32 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - } + npc.TargetClosest(); + } } // Splitting fireball breath else if (npc.ai[0] == 4f) { - int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + int num31 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.ai[2] = num31; if (npc.ai[1] < splittingFireballBreathTimer) { Vector2 vector5 = targetData.Center + new Vector2(num31 * -750f, -300f); - Vector2 value2 = npc.DirectionTo(vector5) * splittingFireballBreathPhaseVelocity; + Vector2 value2 = npc.SafeDirectionTo(vector5) * splittingFireballBreathPhaseVelocity; npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); - int direction = (npc.Center.X < targetData.Center.X) ? 1 : -1; + int direction = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.direction = npc.spriteDirection = direction; - if (Vector2.Distance(vector5, npc.Center) < 32f) + if (Vector2.Distance(vector5, vectorCenter) < 32f) npc.ai[1] = splittingFireballBreathTimer - 1f; } else if (npc.ai[1] == splittingFireballBreathTimer) { - Vector2 vector6 = npc.DirectionTo(targetData.Center); + Vector2 vector6 = npc.SafeDirectionTo(targetData.Center, Vector2.UnitX * npc.spriteDirection); vector6.Y *= 0.15f; vector6 = vector6.SafeNormalize(Vector2.UnitX * npc.direction); @@ -2103,18 +2132,21 @@ namespace CalamityMod.NPCs.Yharon npc.rotation += pie; npc.velocity = vector6 * splittingFireballBreathPhaseVelocity; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonFire"), npc.Center); } else { - npc.position.X += npc.DirectionTo(targetData.Center).X * 7f; - npc.position.Y += npc.DirectionTo(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 = npc.Center + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); + Vector2 position = vectorCenter + new Vector2((110f + xOffset) * npc.direction, -20f).RotatedBy(npc.rotation); int num34 = (int)(npc.ai[1] - splittingFireballBreathTimer + 1f); - if (num34 <= splittingFireballBreathTimer2 && num34 % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(position, npc.velocity, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + int type = ModContent.ProjectileType(); + 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); } if (npc.ai[1] > splittingFireballBreathPhaseTimer - splittingFireballBreathYVelocityTimer) @@ -2126,7 +2158,8 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - } + npc.TargetClosest(); + } } // Fireball spin @@ -2150,27 +2183,79 @@ namespace CalamityMod.NPCs.Yharon // For phase 4: Rotate spiral by 18 * (240 / 16) = +135 degrees and then back -135 degrees - if (npc.ai[1] % flareDustSpawnDivisor3 == 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; - DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, totalProjectiles, projectileVelocity, radialOffset, true); + if (npc.localAI[3] == 0f) + { + DoFlareDustBulletHell(1, spinPhaseTimer, npc.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, projectileVelocity, radialOffset, true); + } + else + { + 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); + } + + // Fire a flame towards every player, with a limit of 10 + if (expertMode && npc.ai[2] % (flareDustSpawnDivisor2 * 2) == 0f) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); + + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * (projectileVelocity * 0.7f); + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(flareDustBulletHellSpawn, velocity2, type, npc.GetProjectileDamage(ModContent.ProjectileType()), 0f, Main.myPlayer, 2f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + } } } else { if (npc.ai[1] % flareDustSpawnDivisor == 0f) { - int totalProjectiles = (secondPhasePhase == 2 ? 42 : 38) - (int)(npc.ai[1] / 12f); // 36 for first ring, 18 for last ring - DoFlareDustBulletHell(0, (int)spinPhaseTimer, projectileDamage, totalProjectiles, 0f, 0f, true); + 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); + + // Fire a flame towards every player, with a limit of 10 + if (expertMode) + { + List targets = new List(); + for (int p = 0; p < Main.maxPlayers; p++) + { + if (Main.player[p].active && !Main.player[p].dead) + targets.Add(p); + + if (targets.Count > 4) + break; + } + foreach (int t in targets) + { + Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center + Main.player[t].velocity * 40f - flareDustBulletHellSpawn) * 8f; + int type = ModContent.ProjectileType(); + 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) { useTornado = false; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, 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); } } @@ -2180,6 +2265,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = increasedIdleTimeAfterBulletHell; npc.ai[2] = 0f; npc.localAI[2] = 0f; + npc.TargetClosest(); npc.velocity /= 2f; } } @@ -2190,10 +2276,10 @@ namespace CalamityMod.NPCs.Yharon if (npc.ai[1] == 0f) { Vector2 destination2 = targetData.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * velocity * 1.5f; + Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2) * velocity * 1.5f; npc.SimpleFlyMovement(desiredVelocity2, acceleration * 1.5f); - int num35 = (npc.Center.X < targetData.Center.X) ? 1 : -1; + int num35 = (vectorCenter.X < targetData.Center.X) ? 1 : -1; npc.direction = npc.spriteDirection = num35; npc.ai[2] += 1f; @@ -2225,9 +2311,9 @@ namespace CalamityMod.NPCs.Yharon Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (expertMode) - DoFireRing(300, projectileDamage, 1f); + DoFireRing(300, npc.GetProjectileDamage(ModContent.ProjectileType()), npc.target, 1f); - Vector2 vector7 = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); + Vector2 vector7 = vectorCenter + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 100f * (0.6f + Main.rand.NextFloat() * 0.4f); if (Vector2.Distance(vector7, targetData.Center) > 150f) SpawnDetonatingFlares(vector7, targetData, 6, new int[] { ModContent.NPCType(), ModContent.NPCType() }); @@ -2242,12 +2328,13 @@ namespace CalamityMod.NPCs.Yharon Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, 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(); + } } // Fast charge @@ -2264,13 +2351,14 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - } + npc.TargetClosest(); + } } // Teleport else if (npc.ai[0] == 8f) { - Vector2 npcCenter = npc.Center; + Vector2 npcCenter = vectorCenter; if (npc.alpha < 255) { @@ -2301,7 +2389,7 @@ namespace CalamityMod.NPCs.Yharon npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; - npc.localAI[1] = fastChargeTelegraphTimer + 1f; + npc.localAI[1] = fastChargeTelegraphTime + 1f; npc.netUpdate = true; } } @@ -2309,9 +2397,9 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 9f) { - npc.velocity *= 0.95f; + npc.velocity *= 0.9f; - Vector2 vector = npc.DirectionTo(targetData.Center); + Vector2 vector = npc.SafeDirectionTo(targetData.Center, -Vector2.UnitY); npc.spriteDirection = (vector.X > 0f) ? 1 : -1; npc.rotation = vector.ToRotation(); @@ -2322,7 +2410,7 @@ namespace CalamityMod.NPCs.Yharon { if (secondPhasePhase == 4) { - for (int x = 0; x < 1000; x++) + for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; if (projectile.active) @@ -2350,11 +2438,12 @@ namespace CalamityMod.NPCs.Yharon npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; - npc.netUpdate = true; + npc.TargetClosest(); + npc.netUpdate = true; } } - float num42 = npc.DirectionTo(targetData.Center).ToRotation(); + float num42 = npc.AngleTo(targetData.Center); float num43 = 0.04f; switch ((int)npc.ai[0]) @@ -2443,7 +2532,7 @@ namespace CalamityMod.NPCs.Yharon int npc = NPC.NewNPC((int)origin.X, (int)origin.Y, type, 0, 0f, 0f, 0f, 0f, 255); Main.npc[npc].velocity = target.Center - origin; Main.npc[npc].velocity.Normalize(); - Main.npc[npc].velocity *= CalamityWorld.bossRushActive ? 15f : 10f; + Main.npc[npc].velocity *= 10f; Main.npc[npc].netUpdate = true; } } @@ -2493,17 +2582,17 @@ namespace CalamityMod.NPCs.Yharon #endregion #region Fire Ring - public void DoFireRing(int timeLeft, int damage, float ai1) + public void DoFireRing(int timeLeft, int damage, float ai0, float ai1) { if (Main.netMode != NetmodeID.MultiplayerClient) { - float velocity = 5f; + float velocity = ai1 == 0f ? 10f : 5f; int totalProjectiles = 50; float radians = MathHelper.TwoPi / totalProjectiles; 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, 0f, ai1); + int proj = Projectile.NewProjectile(npc.Center, vector255, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, ai0, ai1); Main.projectile[proj].timeLeft = timeLeft; } } @@ -2527,7 +2616,7 @@ namespace CalamityMod.NPCs.Yharon bool pauseAfterTeleportPhase = startSecondAI && npc.ai[0] == 8f; - bool ai2 = startSecondAI && !phaseOneLoot; + bool ai2 = startSecondAI; SpriteEffects spriteEffects = ai2 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; if (npc.spriteDirection == 1) @@ -2587,7 +2676,7 @@ namespace CalamityMod.NPCs.Yharon 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, 4f + npc.gfxOffY); + vector41 += vector11 * npc.scale + new Vector2(0f, npc.gfxOffY); spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } @@ -2638,28 +2727,28 @@ namespace CalamityMod.NPCs.Yharon 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, 4f + npc.gfxOffY); + 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, 4f + npc.gfxOffY); - spriteBatch.Draw(texture, vector43, npc.frame, (invincible ? invincibleColor : npc.GetAlpha(lightColor)), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + 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) { texture = ModContent.GetTexture("CalamityMod/NPCs/Yharon/YharonGlowOrange"); - Color color40 = Color.Lerp(Color.White, (invincible ? invincibleColor : Color.Orange), 0.5f); + 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"); - Color color43 = Color.Lerp(Color.White, (invincible ? invincibleColor : Color.Chartreuse), 0.5f); + 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"); - Color color45 = Color.Lerp(Color.White, (invincible ? invincibleColor : Color.BlueViolet), 0.5f); + Color color45 = Color.Lerp(Color.White, invincible ? invincibleColor : Color.BlueViolet, 0.5f); Color color46 = invincible ? invincibleColor : Color.BlueViolet; amount9 = 1f; @@ -2714,7 +2803,7 @@ namespace CalamityMod.NPCs.Yharon 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, 4f + npc.gfxOffY); + 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) @@ -2742,7 +2831,7 @@ namespace CalamityMod.NPCs.Yharon 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, 4f + npc.gfxOffY); + 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) @@ -2776,39 +2865,25 @@ namespace CalamityMod.NPCs.Yharon return false; } - #endregion + #endregion - #region Loot - public override bool SpecialNPCLoot() - { - return !dropLoot; - } + #region Loot + public override void NPCLoot() + { + CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, CalamityWorld.downedYharon); - public override void NPCLoot() - { - // If Yharon runs away in phase 1 and the Eclipse isn't buffed yet, notify players of the buffed Solar Eclipse - if (!startSecondAI && !CalamityWorld.buffedEclipse) - { - CalamityWorld.buffedEclipse = true; - CalamityMod.UpdateServerBoolean(); + // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops + DropHelper.DropBags(npc); - string key = "Mods.CalamityMod.DargonBossText"; - Color messageColor = Color.Orange; + // Legendary drops for Yharon + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, CalamityWorld.malice); - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - - // Bags occur in either phase 1 or 2, as they don't contain phase 2 only drops - DropHelper.DropBags(npc); - - // Phase 1 drops: Contained in the bag, so they only drop directly on Normal + // Normal drops: Everything that would otherwise be in the bag if (!Main.expertMode) { // Weapons - float w = DropHelper.DirectWeaponDropRateFloat; + float w = DropHelper.NormalWeaponDropRateFloat; DropHelper.DropEntireWeightedSet(npc, DropHelper.WeightStack(w), DropHelper.WeightStack(w), @@ -2823,49 +2898,37 @@ namespace CalamityMod.NPCs.Yharon // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - } - // These drops only occur in Phase 2 (where you actually kill Yharon) - if (startSecondAI && !phaseOneLoot) - { // Materials - int soulFragMin = Main.expertMode ? 22 : 15; - int soulFragMax = Main.expertMode ? 28 : 22; + int soulFragMin = 15; + int soulFragMax = 22; DropHelper.DropItem(npc, ModContent.ItemType(), true, soulFragMin, soulFragMax); // Equipment DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); - - // Weapons - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode, DropHelper.RareVariantDropRateInt); - DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode, 100); //not affected by defiled and not a leggie - - // Vanity - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); - - // Other - //DropHelper.DropItem(npc, ModContent.ItemType()); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedYharon); - DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedYharon, 6, 3, 2); - - // If Yharon has not been killed yet, notify players of Auric Ore - if (!CalamityWorld.downedYharon) - { - WorldGenerationMethods.SpawnOre(ModContent.TileType(), 2E-05, .6f, .8f); - - string key = "Mods.CalamityMod.AuricOreText"; - Color messageColor = Color.Gold; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - - // Mark Yharon as dead - CalamityWorld.downedYharon = true; - CalamityMod.UpdateServerBoolean(); } - } + + // Vanity + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + + // Other + // DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedYharon); + + // If Yharon has not been killed yet, notify players of Auric Ore + if (!CalamityWorld.downedYharon) + { + CalamityUtils.SpawnOre(ModContent.TileType(), 2E-05, 0.6f, 0.8f, 6, 12); + + string key = "Mods.CalamityMod.AuricOreText"; + Color messageColor = Color.Gold; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + + // Mark Yharon as dead + CalamityWorld.downedYharon = true; + CalamityNetcode.SyncWorld(); + } public override void BossLoot(ref string name, ref int potionType) { @@ -2873,28 +2936,27 @@ namespace CalamityMod.NPCs.Yharon } #endregion - #region Strike NPC - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - // Safeguard if damage would kill phase 1 before phase 2. - if (phaseOneLoot && (damage >= npc.life || (crit && damage * 2 >= npc.life))) - { - float lifeAboveTenPercent = npc.life - npc.lifeMax * 0.1f; - damage = MathHelper.Clamp((float)damage, 0f, lifeAboveTenPercent); - } + #region On Hit Player + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 420, true); + } + #endregion - // Safeguard to prevent damage which would allow skipping phase 2. - if (!startSecondAI && dropLoot) - { - damage = 0; - return false; - } - return true; + #region Projectile Resists + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == ModContent.ProjectileType()) + damage = (int)(damage * 0.85); + if (projectile.type == ModContent.ProjectileType()) + damage = (int)(damage * 0.9); + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + damage = (int)(damage * 0.95); } - #endregion + #endregion - #region HP Bar Cooldown Slot and Stats - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + #region HP Bar Cooldown Slot and Stats + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { scale = 2f; return null; @@ -2909,7 +2971,7 @@ 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 * 0.8f); + npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier()); } #endregion @@ -2933,10 +2995,17 @@ namespace CalamityMod.NPCs.Yharon if (chargeTelegraph) { - bool phase4 = startSecondAI && npc.life <= npc.lifeMax * 0.15 && (CalamityWorld.revenge || CalamityWorld.bossRushActive); + // Percent life remaining + float lifeRatio = npc.life / (float)npc.lifeMax; - int num86 = phase4 ? 60 : 120; - if (npc.localAI[1] < num86 - (phase4 ? 30 : 60) || npc.localAI[1] > num86 - (phase4 ? 10 : 20)) + // Increase aggression if player is taking a long time to kill the boss + if (lifeRatio > npc.Calamity().killTimeRatio_IncreasedAggression) + lifeRatio = npc.Calamity().killTimeRatio_IncreasedAggression; + + 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 || CalamityWorld.malice) ? 0.165f : 0.11f) && (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice); + if (doTelegraphFlightAnimation) { npc.frameCounter += phase4 ? 2D : 1D; if (npc.frameCounter > 5D) @@ -2945,18 +3014,14 @@ namespace CalamityMod.NPCs.Yharon npc.frame.Y += frameHeight; } if (npc.frame.Y >= frameHeight * 5) - { npc.frame.Y = 0; } - } else { npc.frame.Y = frameHeight * 5; - if (npc.localAI[1] > num86 - (phase4 ? 25 : 50) && npc.localAI[1] < num86 - (phase4 ? 12 : 25)) - { + if (doTelegraphRoarAnimation) npc.frame.Y = frameHeight * 6; } - } return; } @@ -3048,7 +3113,7 @@ namespace CalamityMod.NPCs.Yharon } if (npc.life <= 0) { - DoFireRing(150, (Main.expertMode || CalamityWorld.bossRushActive) ? 125 : 150, 0f); + 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; diff --git a/Particles/BaseParticleSet.cs b/Particles/BaseParticleSet.cs new file mode 100644 index 0000000000..f5c48fdf59 --- /dev/null +++ b/Particles/BaseParticleSet.cs @@ -0,0 +1,77 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Particles +{ + public abstract class BaseParticleSet + { + public int LocalTimer { get; internal set; } + public int SetLifetime { get; internal set; } + public int ParticleSpawnRate; + public List Particles = new List(); + public abstract int ParticleLifetime { get; } + public abstract void UpdateBehavior(Particle particle); + public abstract Particle SpawnParticle(); + public abstract Color DetermineParticleColor(float lifetimeCompletion); + public abstract Texture2D ParticleTexture { get; } + public virtual int ParticleFrameVariants => 1; + public virtual Func OrderFunction { get; } = null; + + public BaseParticleSet(int setLifetime, int particleSpawnRate) + { + SetLifetime = setLifetime; + ParticleSpawnRate = particleSpawnRate; + } + + public virtual void Update() + { + // Don't perform any operations on the server. Doing so would be a waste of space as these sets are entirely based on drawcode. + if (Main.netMode == NetmodeID.Server) + return; + + bool closeToDeath = LocalTimer >= SetLifetime - ParticleLifetime && SetLifetime > 0; + if (LocalTimer % ParticleSpawnRate == ParticleSpawnRate - 1 && !closeToDeath) + { + Particle particle = SpawnParticle(); + particle.Lifetime = ParticleLifetime; + particle.Variant = Main.rand.Next(ParticleFrameVariants); + Particles.Add(particle); + } + + // Update and increment the time of all particles. + for (int i = 0; i < Particles.Count; i++) + { + Particles[i].Time++; + UpdateBehavior(Particles[i]); + } + + // Clear all expired particles. + Particles.RemoveAll(particle => particle.Time >= particle.Lifetime); + LocalTimer++; + } + + public virtual void DrawSet(Vector2 basePosition) + { + if (Main.netMode == NetmodeID.Server) + return; + + IEnumerable orderedParticles = Particles; + if (OrderFunction != null) + orderedParticles = orderedParticles.OrderBy(OrderFunction); + + foreach (Particle particle in Particles.OrderBy(p => p.Time)) + { + Vector2 drawPosition = basePosition - Main.screenPosition + particle.RelativeOffset; + Color particleColor = DetermineParticleColor(particle.Time / (float)particle.Lifetime); + Rectangle frame = ParticleTexture.Frame(1, ParticleFrameVariants, 0, particle.Variant); + + Main.spriteBatch.Draw(ParticleTexture, drawPosition, frame, particleColor, 0f, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); + } + } + } +} \ No newline at end of file diff --git a/Particles/EnchantedParticleSet.cs b/Particles/EnchantedParticleSet.cs new file mode 100644 index 0000000000..4feb625237 --- /dev/null +++ b/Particles/EnchantedParticleSet.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ChargingEnergyParticleSet : BaseParticleSet + { + public float InterpolationSpeed; + public float EdgeOffset; + public Color EdgeColor; + public Color CenterColor; + public override int ParticleLifetime => 50; + public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Particles/Light"); + public ChargingEnergyParticleSet(int setLifetime, int particleSpawnRate, Color edgeColor, Color centerColor, float interpolationSpeed, float edgeOffset) : + base(setLifetime, particleSpawnRate) + { + EdgeColor = edgeColor; + CenterColor = centerColor; + InterpolationSpeed = interpolationSpeed; + EdgeOffset = edgeOffset; + } + + public override void UpdateBehavior(Particle particle) + { + float distanceToCenter = particle.RelativeOffset.Length(); + particle.Scale = MathHelper.SmoothStep(0.05f, 0.125f, Utils.InverseLerp(EdgeOffset, 6f, distanceToCenter, true)); + particle.Scale *= Utils.InverseLerp(ParticleLifetime, ParticleLifetime - 10f, particle.Time, true); + + if (distanceToCenter > 4.5f) + particle.RelativeOffset = Vector2.Lerp(particle.RelativeOffset, Vector2.Zero, InterpolationSpeed); + } + + public override Color DetermineParticleColor(float lifetimeCompletion) + { + Color particleColor = Color.Lerp(EdgeColor, CenterColor, Utils.InverseLerp(0f, 0.67f, lifetimeCompletion, true)); + particleColor.A = 50; + + return particleColor; + } + + public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2CircularEdge(1f, 1f) * EdgeOffset, 0.1f); + } +} \ No newline at end of file diff --git a/Particles/FireParticleSet.cs b/Particles/FireParticleSet.cs new file mode 100644 index 0000000000..fd362b1a76 --- /dev/null +++ b/Particles/FireParticleSet.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class FireParticleSet : BaseParticleSet + { + public float SpawnAreaCompactness; + public float RelativePower; + public Color BrightColor; + public Color DarkColor; + public override int ParticleLifetime => 50; + public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Particles/Fire"); + public FireParticleSet(int setLifetime, int particleSpawnRate, Color brightColor, Color darkColor, float spawnAreaCompactness, float relativePower) : + base(setLifetime, particleSpawnRate) + { + BrightColor = brightColor; + DarkColor = darkColor; + SpawnAreaCompactness = spawnAreaCompactness; + RelativePower = relativePower; + } + + public override void UpdateBehavior(Particle particle) + { + particle.Scale += RelativePower * 0.01f; + particle.RelativeOffset.Y -= RelativePower * 3f; + } + + public override Color DetermineParticleColor(float lifetimeCompletion) + { + Color particleColor = Color.Lerp(BrightColor, DarkColor, lifetimeCompletion); + particleColor = Color.Lerp(particleColor, Color.SaddleBrown, Utils.InverseLerp(0.95f, 0.7f, lifetimeCompletion, true)); + particleColor = Color.Lerp(particleColor, Color.White, Utils.InverseLerp(0.1f, 0.25f, lifetimeCompletion, true) * Utils.InverseLerp(0.4f, 0.25f, lifetimeCompletion, true) * 0.7f); + particleColor *= Utils.InverseLerp(0f, 0.15f, lifetimeCompletion, true) * Utils.InverseLerp(1f, 0.8f, lifetimeCompletion, true) * 0.6f; + particleColor.A = 50; + + return particleColor; + } + + public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2Circular(1f, 1f) * SpawnAreaCompactness, 0.06f); + } +} \ No newline at end of file diff --git a/Particles/Particle.cs b/Particles/Particle.cs new file mode 100644 index 0000000000..cf3bac931f --- /dev/null +++ b/Particles/Particle.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Particles +{ + public class Particle + { + public int Time; + public int Lifetime; + public int Variant; + public float Scale; + public Vector2 RelativeOffset; + public Particle(int lifetime, Vector2 relativeOffset, float scale, int variant = 0) + { + Time = 0; + Lifetime = lifetime; + Variant = variant; + Scale = scale; + RelativeOffset = relativeOffset; + } + } +} \ No newline at end of file diff --git a/Particles/ThanatosSmokeParticleSet.cs b/Particles/ThanatosSmokeParticleSet.cs new file mode 100644 index 0000000000..8da8106441 --- /dev/null +++ b/Particles/ThanatosSmokeParticleSet.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class ThanatosSmokeParticleSet : BaseParticleSet + { + public float SpawnAreaCompactness; + public float RelativePower; + public float BaseMoveRotation; + public float MoveRotationOffset; + public override int ParticleLifetime => 50; + public override int ParticleFrameVariants => 3; + public override Texture2D ParticleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/ThanatosVentParticle"); + public ThanatosSmokeParticleSet(int setLifetime, int particleSpawnRate, float baseMoveRotation, float spawnAreaCompactness, float relativePower) : + base(setLifetime, particleSpawnRate) + { + MoveRotationOffset = Main.rand.NextFloat(-0.36f, 0.36f); + BaseMoveRotation = baseMoveRotation; + SpawnAreaCompactness = spawnAreaCompactness; + RelativePower = relativePower; + } + + public override void UpdateBehavior(Particle particle) + { + if (particle.Scale < 1.25f) + particle.Scale += RelativePower * 0.04f; + particle.RelativeOffset -= (BaseMoveRotation + Main.rand.NextFloat(-0.18f, 0.18f)).ToRotationVector2() * RelativePower * 4.5f; + } + + public override Color DetermineParticleColor(float lifetimeCompletion) + { + Color color = Color.DarkRed; + color = Color.Lerp(color, new Color(154, 139, 138), (float)Math.Pow(Utils.InverseLerp(0f, 0.57f, lifetimeCompletion, true), 2D) * 0.5f + 0.5f); + color.A = 92; + + float opacity = Utils.InverseLerp(1f, 0.85f, lifetimeCompletion, true); + return color * opacity; + } + + public override Particle SpawnParticle() => new Particle(ParticleLifetime, Main.rand.NextVector2Circular(1f, 1f) * SpawnAreaCompactness, 0.06f, Main.rand.Next(3)); + } +} \ No newline at end of file diff --git a/Prefixes/RoguePrefix.cs b/Prefixes/RoguePrefix.cs index f88130b594..1b79bd0141 100644 --- a/Prefixes/RoguePrefix.cs +++ b/Prefixes/RoguePrefix.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Weapons.Rogue; using System; using System.Collections.Generic; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Prefixes @@ -64,7 +63,7 @@ namespace CalamityMod.Prefixes ModItem moddedItem = item.modItem; if (moddedItem != null && moddedItem is RogueWeapon rogueWep) { - rogueWep.StealthStrikeDamage = stealthDmgMult; + rogueWep.StealthStrikePrefixBonus = stealthDmgMult; } } @@ -90,21 +89,6 @@ namespace CalamityMod.Prefixes mod.AddPrefix(name, new RoguePrefix(damageMult, useTimeMult, critBonus, shootSpeedMult, stealthDmgMult)); RogueModifiers.Add(mod.GetPrefix(name).Type); } - - public override void ValidateItem(Item item, ref bool invalid) - { - if (item.damage == Math.Round(item.damage * damageMult) && damageMult != 1f) - invalid = true; - if (item.useAnimation == Math.Round(item.useAnimation * useTimeMult) && useTimeMult != 1f) - invalid = true; - // This code is commented out because CanRoll already guarantees that rogue prefixes will never appear on consumable items. - // Setting invalid to true doesn't do anything good. - // It just makes prefixed consumable rogue weapons put TML in an infinite loop looking for an appropriate prefix. - /* - if (item.consumable) - invalid = true; - */ - } } public enum RoguePrefixType : byte diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs index 3abf6c5637..78fe1d662a 100644 --- a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles // Attach to some arbitrary thing/position optionally. (The ai[1] value is a reserved for this in vanilla's Phantasmal Deathray) AttachToSomething(); - // Ensure the the velocity is a unit vector and is not a <0,0> vector. + // 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); Time++; @@ -79,11 +79,9 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void DetermineScale() { - projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * 6f * MaxScale; + projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * ScaleExpandRate * MaxScale; if (projectile.scale > MaxScale) - { projectile.scale = MaxScale; - } } /// @@ -92,7 +90,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles public virtual void AttachToSomething() { } /// - /// Calculates the current laser's length. By default does not collide with tiles. is a generic laser collision method if you want to do that. + /// Calculates the current laser's length. By default does not collide with tiles. is a generic laser collision method if you want to use it. /// /// The laser length as a float. public virtual float DetermineLaserLength() => MaxLaserLength; @@ -115,6 +113,62 @@ namespace CalamityMod.Projectiles.BaseProjectiles Collision.LaserScan(projectile.Center, projectile.velocity, projectile.scale, MaxLaserLength, laserLengthSamplePoints); return laserLengthSamplePoints.Average(); } + + protected internal void DrawBeamWithColor(SpriteBatch spriteBatch, Color beamColor, float scale) + { + // Start texture drawing. + spriteBatch.Draw(LaserBeginTexture, + projectile.Center - Main.screenPosition, + null, + beamColor, + projectile.rotation, + LaserBeginTexture.Size() / 2f, + scale, + SpriteEffects.None, + 0f); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength; + laserBodyLength -= (LaserBeginTexture.Height / 2 + LaserEndTexture.Height) * scale; + Vector2 centerOnLaser = projectile.Center; + centerOnLaser += projectile.velocity * scale * LaserBeginTexture.Height / 2f; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = LaserMiddleTexture.Height * scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + null, + beamColor, + projectile.rotation, + LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, + scale, + SpriteEffects.None, + 0f); + incrementalBodyLength += laserOffset; + centerOnLaser += projectile.velocity * laserOffset; + } + } + + // End texture drawing. + if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) + { + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + spriteBatch.Draw(LaserEndTexture, + laserEndCenter, + null, + beamColor, + projectile.rotation, + LaserEndTexture.Frame(1, 1, 0, 0).Top(), + scale, + SpriteEffects.None, + 0f); + } + } #endregion #region Hook Overrides @@ -134,78 +188,30 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (projectile.velocity == Vector2.Zero) return false; - // Start texture drawing. - spriteBatch.Draw(LaserBeginTexture, - projectile.Center - Main.screenPosition, - null, - LaserOverlayColor, - projectile.rotation, - LaserBeginTexture.Size() / 2f, - projectile.scale, - SpriteEffects.None, - 0f); - - // Prepare things for body drawing. - float laserBodyLength = LaserLength; - laserBodyLength -= (LaserBeginTexture.Height / 2 + LaserEndTexture.Height) * projectile.scale; - Vector2 centerOnLaser = projectile.Center; - centerOnLaser += projectile.velocity * projectile.scale * LaserBeginTexture.Height / 2f; - - // Body drawing. - if (laserBodyLength > 0f) - { - float laserOffset = LaserMiddleTexture.Height * projectile.scale; - float incrementalBodyLength = 0f; - while (incrementalBodyLength + 1f < laserBodyLength) - { - spriteBatch.Draw(LaserMiddleTexture, - centerOnLaser - Main.screenPosition, - null, - LaserOverlayColor, - projectile.rotation, - LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, - projectile.scale, - SpriteEffects.None, - 0f); - incrementalBodyLength += laserOffset; - centerOnLaser += projectile.velocity * laserOffset; - } - } - - // End texture drawing. - if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) - { - Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; - spriteBatch.Draw(LaserEndTexture, - laserEndCenter, - null, - LaserOverlayColor, - projectile.rotation, - LaserEndTexture.Frame(1, 1, 0, 0).Top(), - projectile.scale, - SpriteEffects.None, - 0f); - } + DrawBeamWithColor(spriteBatch, LaserOverlayColor, projectile.scale); return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { if (projHitbox.Intersects(targetHitbox)) return true; - float unused = 69420f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, ref unused); + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, ref _); } - #endregion - #region Virtual Properties - public virtual float Lifetime => 120f; - public virtual float MaxScale => 1f; - public virtual float MaxLaserLength => 2400f; // Be careful with this. Going too high will cause lag. + public override bool ShouldUpdatePosition() => false; + #endregion + + #region Overridable Properties + public abstract float Lifetime { get; } + public abstract float MaxScale { get; } + public abstract float MaxLaserLength { get; } // Be careful with this. Going too high will cause lag. + public abstract Texture2D LaserBeginTexture { get; } + public abstract Texture2D LaserMiddleTexture { get; } + public abstract Texture2D LaserEndTexture { get; } + public virtual float ScaleExpandRate => 4f; public virtual Color LightCastColor => Color.White; public virtual Color LaserOverlayColor => Color.White * 0.9f; - public virtual Texture2D LaserBeginTexture { get; } - public virtual Texture2D LaserMiddleTexture { get; } - public virtual Texture2D LaserEndTexture { get; } #endregion } } diff --git a/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs b/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs new file mode 100644 index 0000000000..abfefd8df3 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseMassiveExplosionProjectile.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +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 virtual bool UsesScreenshake { get; } = false; + public virtual float GetScreenshakePower(float pulseCompletionRatio) => 0f; + + public abstract int Lifetime { get; } + public abstract Color GetCurrentExplosionColor(float pulseCompletionRatio); + + // Use the invisible projectile by default. This can be overridden in child types if desired. + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void AI() + { + if (UsesScreenshake) + { + 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)); + + // Adjust the hitbox. + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(CurrentRadius * projectile.scale), (int)(CurrentRadius * projectile.scale)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + 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(1f - (float)Math.Sqrt(pulseCompletionRatio))) * projectile.Opacity * 0.7f; + DrawData drawData = new DrawData(ModContent.GetTexture("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); + drawData.Draw(spriteBatch); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + return false; + } + } +} diff --git a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs index e766d1ed90..fa3b703f08 100644 --- a/Projectiles/BaseProjectiles/BaseSpearProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSpearProjectile.cs @@ -123,15 +123,12 @@ namespace CalamityMod.Projectiles.BaseProjectiles 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) + - new Vector2(originalVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(originalVelocityDirection); + Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(originalVelocityDirection) + originalVelocityDirection.ToRotationVector2() * (originalVelocitySpeed + TravelSpeed + 40f); 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; - - player.DirectionTo(projectile.Center); } // Kill the hook if the player's item use cycle is almost over and reset the reuseDelay diff --git a/Projectiles/Boss/AbyssBallVolley.cs b/Projectiles/Boss/AbyssBallVolley.cs index e559bfa2b6..0bba79ede6 100644 --- a/Projectiles/Boss/AbyssBallVolley.cs +++ b/Projectiles/Boss/AbyssBallVolley.cs @@ -14,14 +14,16 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 26; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 26; projectile.height = 26; projectile.hostile = true; projectile.penetrate = 1; projectile.alpha = 60; projectile.tileCollide = false; projectile.timeLeft = 240; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index a23b8e4517..da550b14e6 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -14,14 +14,16 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 26; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 26; projectile.height = 26; projectile.hostile = true; projectile.penetrate = 1; projectile.alpha = 60; projectile.tileCollide = false; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -48,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 60) return; - target.AddBuff(BuffID.Cursed, 90); + target.AddBuff(BuffID.Darkness, 120); } } } diff --git a/Projectiles/Boss/AbyssMine.cs b/Projectiles/Boss/AbyssMine.cs index 6373ffd5a8..e84b0b6669 100644 --- a/Projectiles/Boss/AbyssMine.cs +++ b/Projectiles/Boss/AbyssMine.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -8,6 +9,8 @@ namespace CalamityMod.Projectiles.Boss { public class AbyssMine : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/AbyssBallVolley"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyss Mine"); @@ -15,14 +18,16 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 26; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 26; projectile.height = 26; projectile.hostile = true; projectile.alpha = 60; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft = (Main.expertMode || CalamityWorld.bossRushActive) ? 3000 : 2400; - } + projectile.timeLeft = (Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 3000 : 2400; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -45,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss 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 < 30; num621++) + 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, 1.2f); Main.dust[num622].velocity *= 3f; @@ -55,7 +60,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + for (int num623 = 0; num623 < 20; num623++) { 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].velocity *= 5f; @@ -67,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Weak, 120); + target.AddBuff(BuffID.Weak, 240); } } } diff --git a/Projectiles/Boss/AbyssMine.png b/Projectiles/Boss/AbyssMine.png deleted file mode 100644 index fb4efb0594..0000000000 Binary files a/Projectiles/Boss/AbyssMine.png and /dev/null differ diff --git a/Projectiles/Boss/AbyssMine2.cs b/Projectiles/Boss/AbyssMine2.cs index e6533fd0c8..a34223c454 100644 --- a/Projectiles/Boss/AbyssMine2.cs +++ b/Projectiles/Boss/AbyssMine2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -8,6 +9,8 @@ namespace CalamityMod.Projectiles.Boss { public class AbyssMine2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/AbyssBallVolley2"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyss Mine"); @@ -15,14 +18,16 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 26; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 26; projectile.height = 26; projectile.hostile = true; projectile.alpha = 60; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft = (Main.expertMode || CalamityWorld.bossRushActive) ? 3000 : 2400; - } + projectile.timeLeft = (Main.expertMode || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 3000 : 2400; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -47,7 +52,7 @@ namespace CalamityMod.Projectiles.Boss 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 < 30; num621++) + 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, 1.2f); Main.dust[num622].velocity *= 3f; @@ -58,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + for (int num623 = 0; num623 < 20; num623++) { int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.7f); Main.dust[num624].noGravity = true; @@ -71,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Cursed, 90); + target.AddBuff(BuffID.Darkness, 240); } } } diff --git a/Projectiles/Boss/AbyssMine2.png b/Projectiles/Boss/AbyssMine2.png deleted file mode 100644 index cd627fab02..0000000000 Binary files a/Projectiles/Boss/AbyssMine2.png and /dev/null differ diff --git a/Projectiles/Boss/ApolloRocket.png b/Projectiles/Boss/ApolloRocket.png new file mode 100644 index 0000000000..15ee1947dc Binary files /dev/null and b/Projectiles/Boss/ApolloRocket.png differ diff --git a/Projectiles/Boss/ApolloRocketGlow.png b/Projectiles/Boss/ApolloRocketGlow.png new file mode 100644 index 0000000000..7feedaffe8 Binary files /dev/null and b/Projectiles/Boss/ApolloRocketGlow.png differ diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs new file mode 100644 index 0000000000..6808d3dbbc --- /dev/null +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -0,0 +1,228 @@ +using CalamityMod.Events; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresDeathBeamStart : ModProjectile + { + private const int maxFrames = 5; + private int frameDrawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death 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; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameDrawn); + 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(); + } + + public override void AI() + { + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + Vector2? vector78 = null; + + 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()) + { + Vector2 fireFrom = new Vector2(Main.npc[(int)projectile.ai[1]].Center.X - 1f, Main.npc[(int)projectile.ai[1]].Center.Y + 23f) + Vector2.Normalize(projectile.velocity) * 35f; + projectile.position = fireFrom - new Vector2(projectile.width, projectile.height) / 2f; + } + else + projectile.Kill(); + + float num801 = 1f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 600f) + { + projectile.Kill(); + return; + } + + projectile.scale = (float)Math.Sin(projectile.localAI[0] * (float)Math.PI / 600f) * 10f * num801; + if (projectile.scale > num801) + projectile.scale = num801; + + float num804 = projectile.velocity.ToRotation(); + float divisor = malice ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; + num804 += MathHelper.TwoPi / divisor; + projectile.rotation = num804 - MathHelper.PiOver2; + projectile.velocity = num804.ToRotationVector2(); + + float num805 = 3f; //3f + float num806 = projectile.width; + + 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); + float num807 = 0f; + for (int num808 = 0; num808 < array3.Length; num808++) + { + num807 += array3[num808]; + } + 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)) + { + num807 = 2400f; + } + + float amount = 0.5f; + 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 = 107; + 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 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, new Color(0, 255, 255), 1f); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } + + if (Main.rand.NextBool(5)) + { + 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, new Color(0, 255, 255), 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)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; + + Texture2D beamStart = Main.projectileTexture[projectile.type]; + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/AresDeathBeamEnd"); + + float drawLength = projectile.localAI[1]; + Color color = new Color(250, 250, 250, 100); + + if (projectile.localAI[0] % 5f == 0f) + { + frameDrawn++; + if (frameDrawn >= maxFrames) + frameDrawn = 0; + } + + // Draw start of beam + 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); + + // 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; + if (drawLength > 0f) + { + float i = 0f; + int middleFrameDrawn = frameDrawn; + while (i + 1f < drawLength) + { + Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); + + 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); + + middleFrameDrawn++; + if (middleFrameDrawn >= maxFrames) + middleFrameDrawn = 0; + + 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) + rectangle.Y = 0; + } + } + + // 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); + + 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)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + 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)) + { + return true; + } + return false; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresDeathBeamStart.png b/Projectiles/Boss/AresDeathBeamStart.png new file mode 100644 index 0000000000..ff960c8d6a Binary files /dev/null and b/Projectiles/Boss/AresDeathBeamStart.png differ diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs new file mode 100644 index 0000000000..b2d582d96c --- /dev/null +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -0,0 +1,117 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresDeathBeamTelegraph : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public float TelegraphDelay + { + 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 Vector2 OldVelocity; + public const float TelegraphTotalTime = 240f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Death Beam Telegraph"); + } + + 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 = 240; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(OldVelocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + OldVelocity = reader.ReadVector2(); + } + + public override void AI() + { + // Determine the relative opacities for each player based on their distance. + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // Set start of telegraph to the npc center. + 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; + } + + TelegraphDelay++; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TelegraphDelay >= TelegraphTotalTime) + return true; + + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + float yScale = 4f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 4f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(4f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 1.6f); + + Color colorOuter = Color.Lerp(Color.Cyan, Color.LightGreen, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through light green and cyan once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + 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); + + return false; + } + } +} diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs new file mode 100644 index 0000000000..fa00c361f3 --- /dev/null +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -0,0 +1,206 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresGaussNukeProjectile : ModProjectile + { + private const int timeLeft = 180; + + 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; + } + + 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; + cooldownSlot = 1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; + + // Animation + projectile.frameCounter++; + if (projectile.frameCounter >= 10) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 12) + projectile.frame = 0; + + // Rotation + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + + // Spawn effects + if (projectile.localAI[0] == 0f) + { + 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()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2f * angleRandom); + + // Random size + float scale = Main.rand.NextFloat(0.5f, 1.6f); + + // Spawn dust + Dust dust = Dust.NewDustPerfect(projectile.Center, 107, -dustVel, 0, default, scale); + dust.noGravity = true; + } + + // Gauss sparks + if (Main.myPlayer == projectile.owner) + { + int totalProjectiles = CalamityWorld.malice ? 18 : 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + 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)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + 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)(projectile.damage * 0.6), 0f, Main.myPlayer); + } + } + } + + // Light + 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; + + // Set AI to stop homing, start accelerating + float stopHomingDistance = 300f; + if (distanceFromTarget.Length() < stopHomingDistance || projectile.ai[0] == 1f) + { + projectile.ai[0] = 1f; + + if (projectile.velocity.Length() < 24f) + projectile.velocity *= 1.025f; + + return; + } + + // Home in on target + float scaleFactor = projectile.velocity.Length(); + float inertia = 10f; + distanceFromTarget.Normalize(); + distanceFromTarget *= scaleFactor; + projectile.velocity = (projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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; + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + } + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 45f; + } + + public override void Kill(int timeLeft) + { + // Nuke explosion sound + Main.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); + + if (Main.myPlayer == projectile.owner) + { + // Explosion waves + for (int i = 0; i < 7; i++) + { + 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. + explosion.ai[1] = 800f + i * 45f; + explosion.localAI[1] = 0.25f; + explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); + explosion.netUpdate = true; + } + } + } + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresGaussNukeProjectile.png b/Projectiles/Boss/AresGaussNukeProjectile.png new file mode 100644 index 0000000000..ef31e390ff Binary files /dev/null and b/Projectiles/Boss/AresGaussNukeProjectile.png differ diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs new file mode 100644 index 0000000000..4423b22a84 --- /dev/null +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -0,0 +1,38 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresGaussNukeProjectileBoom : BaseMassiveExplosionProjectile + { + public override int Lifetime => 60; + public override bool UsesScreenshake => true; + 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 string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Gauss Explosion"); + + 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; + cooldownSlot = 1; + } + + 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.5f, target.Hitbox); + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => target.Calamity().lastProjectileHit = projectile; + + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(BuffID.OnFire, 480); + } +} diff --git a/Projectiles/Boss/AresGaussNukeProjectileGlow.png b/Projectiles/Boss/AresGaussNukeProjectileGlow.png new file mode 100644 index 0000000000..9af93005df Binary files /dev/null and b/Projectiles/Boss/AresGaussNukeProjectileGlow.png differ diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs new file mode 100644 index 0000000000..3386caf44f --- /dev/null +++ b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs @@ -0,0 +1,104 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresGaussNukeProjectileSpark : ModProjectile + { + private const int timeLeft = 360; + + 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; + } + + public override void SetDefaults() + { + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 15f) + { + projectile.localAI[0] = 15f; + projectile.velocity.Y += 0.1f; + } + + 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); + else + 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); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.OnFire, 180); + } + + 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); + return false; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.png b/Projectiles/Boss/AresGaussNukeProjectileSpark.png new file mode 100644 index 0000000000..7424a71ed9 Binary files /dev/null and b/Projectiles/Boss/AresGaussNukeProjectileSpark.png differ diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs new file mode 100644 index 0000000000..2592d4d098 --- /dev/null +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -0,0 +1,227 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresLaserBeamStart : ModProjectile + { + private const int maxFrames = 5; + private int frameDrawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser 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; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameDrawn); + 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(); + } + + public override void AI() + { + Vector2? vector78 = null; + + 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()) + { + 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; + } + else + projectile.Kill(); + + float num801 = 1f; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 60f) + { + projectile.Kill(); + return; + } + + 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 num805 = 3f; //3f + float num806 = projectile.width; + + 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); + float num807 = 0f; + for (int num808 = 0; num808 < array3.Length; num808++) + { + num807 += array3[num808]; + } + 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)) + { + num807 = 2400f; + } + + float amount = 0.5f; + 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); + for (int i = 0; i < 2; i++) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } + + if (Main.rand.NextBool(5)) + { + 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)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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"); + + float drawLength = projectile.localAI[1]; + Color color = new Color(250, 100, 100, 0); + + if (projectile.localAI[0] % 5f == 0f) + { + frameDrawn++; + if (frameDrawn >= maxFrames) + frameDrawn = 0; + } + + // Draw start of beam + 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); + + // 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; + if (drawLength > 0f) + { + float i = 0f; + int middleFrameDrawn = frameDrawn; + while (i + 1f < drawLength) + { + Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); + + 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); + + middleFrameDrawn++; + if (middleFrameDrawn >= maxFrames) + middleFrameDrawn = 0; + + 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) + rectangle.Y = 0; + } + } + + // 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); + + 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)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + 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)) + { + return true; + } + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresLaserBeamStart.png b/Projectiles/Boss/AresLaserBeamStart.png new file mode 100644 index 0000000000..c8f3f346d7 Binary files /dev/null and b/Projectiles/Boss/AresLaserBeamStart.png differ diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs new file mode 100644 index 0000000000..c3c6fea203 --- /dev/null +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -0,0 +1,85 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresPlasmaBolt : ModProjectile + { + private const int timeLeft = 360; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Bolt"); + 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; + cooldownSlot = 1; + projectile.penetrate = -1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void AI() + { + int fadeOutTime = 15; + int fadeInTime = 3; + 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); + + Lighting.AddLight(projectile.Center, 0f, 0.4f * projectile.Opacity, 0f); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.OnFire, 180); + target.AddBuff(BuffID.CursedInferno, 90); + } + + 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); + return false; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresPlasmaBolt.png b/Projectiles/Boss/AresPlasmaBolt.png new file mode 100644 index 0000000000..90c44f1636 Binary files /dev/null and b/Projectiles/Boss/AresPlasmaBolt.png differ diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs new file mode 100644 index 0000000000..ea79f1db14 --- /dev/null +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -0,0 +1,229 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresPlasmaFireball : ModProjectile + { + private const int timeLeft = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plasma Fireball"); + 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; + cooldownSlot = 1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + 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; + + int fadeInTime = 3; + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); + + Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + projectile.frame = 0; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; + + 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()); + 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; + 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; + + dust = Main.dust[num54]; + dust.velocity *= 2f; + + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Green * 0.5f; + + dust = Main.dust[num54]; + } + 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()); + 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; + Main.dust[num56].noGravity = true; + + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + } + } + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.OnFire, 360); + target.AddBuff(BuffID.CursedInferno, 180); + } + + 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); + 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(); + + Main.PlaySound(SoundID.Item93, projectile.Center); + + if (Main.myPlayer == projectile.owner) + { + // Plasma bolts + int totalProjectiles = CalamityWorld.malice ? 12 : 8; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + 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)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(projectile.Center, velocity2, type, (int)(projectile.damage * 0.8), 0f, Main.myPlayer); + } + } + + for (int num640 = 0; num640 < 200; num640++) + { + float num641 = 16f; + if (num640 < 150) + num641 = 12f; + if (num640 < 100) + num641 = 8f; + if (num640 < 50) + num641 = 4f; + + 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; + + if (num644 == 0f && num645 == 0f) + num644 = 1f; + + float num646 = (float)Math.Sqrt(num644 * num644 + num645 * num645); + num646 = num641 / num646; + num644 *= num646; + num645 *= num646; + + float scale = 1f; + switch ((int)num641) + { + case 4: + scale = 1.2f; + break; + case 8: + scale = 1.1f; + break; + case 12: + scale = 1f; + break; + case 16: + scale = 0.9f; + break; + default: + break; + } + + Dust dust = Main.dust[num643]; + dust.velocity *= 0.5f; + dust.velocity.X = dust.velocity.X + num644; + dust.velocity.Y = dust.velocity.Y + num645; + dust.scale = scale; + dust.noGravity = true; + } + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresPlasmaFireball.png b/Projectiles/Boss/AresPlasmaFireball.png new file mode 100644 index 0000000000..633e28aa10 Binary files /dev/null and b/Projectiles/Boss/AresPlasmaFireball.png differ diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs new file mode 100644 index 0000000000..8103fff1b5 --- /dev/null +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -0,0 +1,244 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresTeslaOrb : ModProjectile + { + public ref float Identity => ref projectile.ai[0]; + public PrimitiveTrail LightningDrawer; + public PrimitiveTrail LightningBackgroundDrawer; + private const int timeLeft = 480; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla Orb"); + 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; + cooldownSlot = 1; + projectile.timeLeft = timeLeft; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + int fadeOutTime = 15; + int fadeInTime = 3; + 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); + + Lighting.AddLight(projectile.Center, 0.1f * projectile.Opacity, 0.25f * projectile.Opacity, 0.25f * projectile.Opacity); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; + + 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()); + 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; + 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; + + dust = Main.dust[num54]; + dust.velocity *= 2f; + + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Cyan * 0.5f; + + dust = Main.dust[num54]; + } + for (int num55 = 0; num55 < 20; num55++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + 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; + Main.dust[num56].noGravity = true; + + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + } + } + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.Electrified, 240); + } + + public Projectile GetOrbToAttachTo() + { + 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) + continue; + + return Main.projectile[i]; + } + return null; + } + + public List DetermineElectricArcPoints(Vector2 start, Vector2 end, int seed) + { + List points = new List(); + + // Determine the base points based on a linear path from the start the end end point. + for (int i = 0; i <= 75; i++) + points.Add(Vector2.Lerp(start, end, i / 73.5f)); + + // Then, add continuous randomness to the positions of various points. + for (int i = 0; i < points.Count; i++) + { + float completionRatio = i / (float)points.Count; + + // Noise offsets should taper off at the ends of the line. + float offsetMuffleFactor = Utils.InverseLerp(0.12f, 0.25f, completionRatio, true) * Utils.InverseLerp(0.88f, 0.75f, completionRatio, true); + + // Give a sense of time for the noise on the vertical axis. This is achieved via a 0-1 constricted sinusoid. + float noiseY = (float)Math.Cos(completionRatio * 17.2f + Main.GlobalTime * 10.7f) * 0.5f + 0.5f; + + float noise = CalamityUtils.PerlinNoise2D(completionRatio, noiseY, 2, seed); + + // Now that the noise value has been computed, convert it to a direction by treating the noise as an angle + // and then converting it into a unit vector. + Vector2 offsetDirection = (noise * MathHelper.Pi * 0.7f).ToRotationVector2(); + + // Then, determine the factor of the offset. This is based on the initial direction (but squashed) and the muffle factor from above. + Vector2 offset = offsetDirection * (float)Math.Pow(offsetDirection.Y, 2D) * offsetMuffleFactor * 25f; + + points[i] += offset; + } + + return points; + } + + internal float WidthFunction(float completionRatio) + { + 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; + } + + internal float BackgroundWidthFunction(float completionRatio) => WidthFunction(completionRatio) * 4f; + + internal Color BackgroundColorFunction(float completionRatio) + { + Color color = Color.CornflowerBlue * projectile.Opacity * 0.4f; + return color; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (LightningDrawer is null) + LightningDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + if (LightningBackgroundDrawer is null) + LightningBackgroundDrawer = new PrimitiveTrail(BackgroundWidthFunction, BackgroundColorFunction, PrimitiveTrail.RigidPointRetreivalFunction); + + Projectile orbToAttachTo = GetOrbToAttachTo(); + if (orbToAttachTo != null) + { + 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); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + + float _ = 0f; + Projectile orbToAttachTo = GetOrbToAttachTo(); + if (orbToAttachTo != null && Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, orbToAttachTo.Center, 8f, ref _)) + return true; + + return false; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/AresTeslaOrb.png b/Projectiles/Boss/AresTeslaOrb.png new file mode 100644 index 0000000000..3b97306c4d Binary files /dev/null and b/Projectiles/Boss/AresTeslaOrb.png differ diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 8e8a1ea3ef..587a98f543 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 50; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 50; projectile.height = 50; projectile.hostile = true; projectile.ignoreWater = true; @@ -28,7 +29,8 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 100; projectile.penetrate = 1; projectile.timeLeft = 485; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -39,27 +41,29 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } + if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); - } + 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.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + + int num103 = Player.FindClosest(projectile.Center, 1, 1); Vector2 vector11 = Main.player[num103].Center - projectile.Center; if (vector11.Length() < 60f) { projectile.Kill(); return; } + projectile.ai[0] += 1f; if (projectile.ai[0] > 15f) { @@ -67,29 +71,31 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } + if (projectile.ai[0] >= 120f) { - projectile.ai[1] += 1f; if (projectile.ai[1] < 120f) { - float scaleFactor2 = projectile.velocity.Length(); + if (projectile.ai[1] < 15f) + projectile.velocity *= 1.02f; + + float scaleFactor2 = projectile.velocity.Length(); vector11.Normalize(); vector11 *= scaleFactor2; projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } - else if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - } + else if (projectile.velocity.Length() < 18f) + projectile.velocity *= 1.01f; + + projectile.ai[1] += 1f; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index cfb5c07228..9cfb695807 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 240; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -38,9 +39,8 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 2) - { projectile.frame = 0; - } + if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; @@ -51,46 +51,40 @@ namespace CalamityMod.Projectiles.Boss 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); + projectile.ai[0] += 1f; if (projectile.ai[0] > 9f) { if (projectile.alpha > 0) - { projectile.alpha -= 5; - } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } - public override bool CanDamage() - { - if (projectile.timeLeft < 85) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 85; public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)((float)projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(projectile.alpha * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, projectile.alpha); } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + if (projectile.timeLeft >= 85) + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 2317658c5b..a495cc4825 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.penetrate = -1; projectile.timeLeft = 600; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -42,25 +43,19 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 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) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } public override Color? GetAlpha(Color lightColor) @@ -70,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 63af867a07..40269dcb88 100644 --- a/Projectiles/Boss/BigFlare.cs +++ b/Projectiles/Boss/BigFlare.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -104,13 +105,13 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 78fe68cb15..daea1676fb 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -104,13 +105,13 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index dd3a42e613..908b1c6c34 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -120,7 +120,6 @@ namespace CalamityMod.Projectiles.Boss Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), damage, 0f, projectile.owner, ai0.ToRotation(), ai); } } - damage = 1; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -143,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 0, texture.Width, texture.Height); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) @@ -153,7 +152,7 @@ namespace CalamityMod.Projectiles.Boss 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 += 16; + rectangle7.Y += texture.Height; if (rectangle7.Y + rectangle7.Height > texture.Height) { rectangle7.Y = 0; diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index 2cabb1a7aa..b5afacd09f 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -1,4 +1,4 @@ -using CalamityMod.World; +using CalamityMod.NPCs.Bumblebirb; using Microsoft.Xna.Framework; using System; using System.IO; @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class BirbAuraFlare : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Aura Flare"); @@ -79,7 +81,6 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; Main.PlaySound(SoundID.DD2_BetsyFireballImpact, (int)projectile.position.X, (int)projectile.position.Y); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) @@ -116,7 +117,8 @@ namespace CalamityMod.Projectiles.Boss float x = num232 * 16; float y = num231 * 16 + 900; Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); - int damage = Main.expertMode ? 75 : 100; + int type = ModContent.ProjectileType(); + int damage = projectile.GetProjectileDamage(ModContent.NPCType()); if (projectile.ai[0] >= 2f) { x += 1000f; @@ -126,7 +128,7 @@ namespace CalamityMod.Projectiles.Boss } laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); laserVelocity.Normalize(); - int num237 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, x, y); + int num237 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); Main.projectile[num237].timeLeft = 900; Main.projectile[num237].netUpdate = true; @@ -137,14 +139,14 @@ namespace CalamityMod.Projectiles.Boss } laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); laserVelocity.Normalize(); - int num238 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, x, y); + int num238 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); Main.projectile[num238].timeLeft = 900; Main.projectile[num238].netUpdate = true; } else { laserVelocity.Normalize(); - int num236 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, x, y); + int num236 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, type, damage, 0f, Main.myPlayer, x, y); Main.projectile[num236].netUpdate = true; } } diff --git a/Projectiles/Boss/BirbAuraFlare.png b/Projectiles/Boss/BirbAuraFlare.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Boss/BirbAuraFlare.png and /dev/null differ diff --git a/Projectiles/Boss/BloodClot.cs b/Projectiles/Boss/BloodClot.cs deleted file mode 100644 index 4eaaae4689..0000000000 --- a/Projectiles/Boss/BloodClot.cs +++ /dev/null @@ -1,41 +0,0 @@ -using CalamityMod.Dusts; -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class BloodClot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Clot"); - } - - public override void SetDefaults() - { - projectile.width = 6; - projectile.height = 6; - projectile.hostile = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.WoodenArrowFriendly; - } - - public override void AI() - { - for (int num468 = 0; num468 < 2; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.25f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Boss/BloodClot.png b/Projectiles/Boss/BloodClot.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Boss/BloodClot.png and /dev/null differ diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 17790e3893..dbd9aad4a7 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -19,23 +19,24 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 12; projectile.hostile = true; projectile.tileCollide = false; - projectile.timeLeft = 300; + projectile.timeLeft = 420; projectile.penetrate = 1; - projectile.aiStyle = 1; - aiType = ProjectileID.WoodenArrowFriendly; } public override void AI() { - if (projectile.timeLeft < 180) - projectile.tileCollide = true; + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + 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); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - } + + projectile.velocity.Y += 0.06f; + projectile.velocity.X *= 0.995f; + } public override void OnHitPlayer(Player target, int damage, bool crit) { diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 1d3edc2464..7ac02074a8 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -2,7 +2,6 @@ using CalamityMod.Dusts; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -18,17 +17,17 @@ namespace CalamityMod.Projectiles.Boss projectile.width = 16; projectile.height = 16; projectile.hostile = true; - projectile.scale = 1.2f; - projectile.penetrate = 6; - projectile.aiStyle = 14; - aiType = ProjectileID.ThornBall; + projectile.penetrate = 1; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { projectile.rotation += 0.12f * projectile.direction; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + + Lighting.AddLight(projectile.Center, 0.25f, 0f, 0f); + for (int num468 = 0; num468 < 2; num468++) { Vector2 dspeed = -projectile.velocity * 0.7f; @@ -36,57 +35,11 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } - - float num1247 = 0.5f; - for (int num1248 = 0; num1248 < Main.maxProjectiles; num1248++) - { - if (Main.projectile[num1248].active) - { - if (num1248 != projectile.whoAmI && Main.projectile[num1248].type == projectile.type) - { - if (Vector2.Distance(projectile.Center, Main.projectile[num1248].Center) < 96f) - { - if (projectile.position.X < Main.projectile[num1248].position.X) - projectile.velocity.X -= num1247; - else - projectile.velocity.X += num1247; - - if (projectile.position.Y < Main.projectile[num1248].position.Y) - projectile.velocity.Y -= num1247; - else - projectile.velocity.Y += num1247; - } - } - } - } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - projectile.velocity *= 0.98f; - } - return false; - } - public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 8bbb9d2785..a9a1b47f3e 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,7 +1,9 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +29,17 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 690; cooldownSlot = 1; - } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } public override void AI() { @@ -48,7 +60,15 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 60) projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); - Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + 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); } public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; @@ -58,16 +78,19 @@ namespace CalamityMod.Projectiles.Boss if (projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 180); - - if (projectile.ai[0] == 0f) - target.AddBuff(ModContent.BuffType(), 120, true); - } + if (projectile.ai[0] == 0f) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); + } + else + target.AddBuff(ModContent.BuffType(), 120); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { lightColor.R = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + 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 d06dabb736..1bded359eb 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Boss { public class BrimstoneFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Fire"); @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.extraUpdates = 3; projectile.timeLeft = 90; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -45,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss int dustType = (int)CalamityDusts.Brimstone; if (Main.rand.NextBool(2)) { - int fire = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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)) { @@ -72,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/BrimstoneFire.png b/Projectiles/Boss/BrimstoneFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Boss/BrimstoneFire.png and /dev/null differ diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index bf53bdbcdb..46652bd2c9 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 50; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 50; projectile.height = 50; projectile.hostile = true; projectile.ignoreWater = true; @@ -29,45 +30,41 @@ namespace CalamityMod.Projectiles.Boss cooldownSlot = 1; } - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 5) - projectile.frame = 0; + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + projectile.frame = 0; 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); - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 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) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - } + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + } - int target = Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[0] += 1f; - if (projectile.ai[0] > 20f) - { - 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; - } - } + 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; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -92,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"), projectile.Center); if (projectile.ai[1] == 0f) { diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 4134292304..717d25ec58 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,7 +21,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 36; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 36; projectile.height = 36; projectile.hostile = true; projectile.ignoreWater = true; @@ -41,9 +43,9 @@ namespace CalamityMod.Projectiles.Boss if (projectile.frame >= 5) projectile.frame = 0; - bool revenge = CalamityWorld.revenge; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 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); @@ -58,19 +60,16 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); } - float turnSpeed = revenge ? 100f : 80f; //100 - float homeSpeed = revenge ? 20f : 15f; //5 + float inertia = revenge ? 80f : 100f; + float homeSpeed = revenge ? 20f : 15f; float minDist = 40f; 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) { - Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); - if (targetVec.HasNaNs()) - targetVec = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + targetVec * homeSpeed) / turnSpeed; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homeSpeed) / inertia; } } else @@ -106,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"), projectile.Center); if (projectile.ai[1] == 0f) { diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index 709c1db06c..071da44ca7 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 40; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 40; projectile.height = 40; projectile.hostile = true; projectile.ignoreWater = true; @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 255; cooldownSlot = 1; - } + } public override void AI() { @@ -43,8 +44,11 @@ namespace CalamityMod.Projectiles.Boss { projectile.frame = 0; } - projectile.alpha += 1; - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.9f / 255f, 0f, 0f); + Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f); + if (projectile.timeLeft < 51) + { + projectile.Opacity -= 0.02f; + } if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; @@ -66,17 +70,25 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { lightColor.R = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } + public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 51; + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (projectile.timeLeft < 51) + return; - if (projectile.ai[0] == 0f) - target.AddBuff(ModContent.BuffType(), 120, true); - } + if (projectile.ai[0] == 0f) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); + } + else + target.AddBuff(ModContent.BuffType(), 120); + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index be51d96d10..370d878206 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -1,9 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class BrimstoneHellblast2 : ModProjectile @@ -16,7 +18,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 40; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 40; projectile.height = 40; projectile.hostile = true; projectile.ignoreWater = true; @@ -30,6 +33,13 @@ namespace CalamityMod.Projectiles.Boss 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.velocity.Length() < (CalamityWorld.malice ? 10f : 8f)) + projectile.velocity *= 1.01f; + } + projectile.frameCounter++; if (projectile.frameCounter >= 10) { @@ -44,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss else projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1440) / 60f), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); + Lighting.AddLight(projectile.Center, 0.9f * projectile.Opacity, 0f, 0f); if (projectile.velocity.X < 0f) { @@ -76,9 +86,14 @@ namespace CalamityMod.Projectiles.Boss if (projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 120, true); - } + if (projectile.ai[0] == 0f) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); + } + else + target.AddBuff(ModContent.BuffType(), 120); + } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index 2df891bf27..859d149824 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -19,18 +19,20 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 34; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 34; projectile.height = 34; projectile.hostile = true; projectile.ignoreWater = true; projectile.penetrate = -1; projectile.timeLeft = 300; projectile.alpha = 255; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { - //Animation + // Animation projectile.frameCounter++; if (projectile.frameCounter > 9) { @@ -38,11 +40,9 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame >= 6) - { projectile.frame = 0; - } - //Fade in + // Fade in if (projectile.alpha > 5) projectile.alpha -= 15; if (projectile.alpha < 5) @@ -53,34 +53,25 @@ namespace CalamityMod.Projectiles.Boss bool flag15 = false; bool flag16 = false; if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { flag15 = true; - } if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { flag15 = true; - } if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { flag16 = true; - } if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { flag16 = true; - } if (flag15 & flag16) - { projectile.Kill(); - } } - //Rotation + // 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.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90f) * projectile.direction; + + projectile.velocity *= 1.01f; + + Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); - projectile.velocity.Y *= 1.01f; - projectile.velocity.X *= 1.01f; - 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); @@ -101,19 +92,17 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { 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, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Boss/BrimstoneLaser.cs b/Projectiles/Boss/BrimstoneLaser.cs deleted file mode 100644 index c3ed3e7129..0000000000 --- a/Projectiles/Boss/BrimstoneLaser.cs +++ /dev/null @@ -1,75 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneLaser : ModProjectile - { - private int splitTimer = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.aiStyle = 1; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.penetrate = -1; - projectile.alpha = 120; - aiType = ProjectileID.DeathLaser; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(splitTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - splitTimer = reader.ReadInt32(); - } - - public override void AI() - { - splitTimer--; - if (splitTimer <= 0) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(20); - 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, perturbedSpeed.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - } - projectile.Kill(); - } - 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.01f; - projectile.velocity.Y *= 1.01f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Boss/BrimstoneLaserSplit.cs b/Projectiles/Boss/BrimstoneLaserSplit.cs deleted file mode 100644 index 6010bc38c3..0000000000 --- a/Projectiles/Boss/BrimstoneLaserSplit.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class BrimstoneLaserSplit : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Homing Laser"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.hostile = true; - projectile.scale = 2f; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = 1; - projectile.timeLeft = 480; - projectile.alpha = 120; - } - - public override void AI() - { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] < 150f && projectile.ai[1] > 90f) - { - 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; - } - else if (projectile.ai[1] >= 150f) - { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f) - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - Lighting.AddLight(projectile.Center, 0.3f, 0f, 0f); - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 50, projectile.alpha); - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 180); - } - } -} diff --git a/Projectiles/Boss/BrimstoneLaserSplit.png b/Projectiles/Boss/BrimstoneLaserSplit.png deleted file mode 100644 index 9b0d2a4f50..0000000000 Binary files a/Projectiles/Boss/BrimstoneLaserSplit.png and /dev/null differ diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 28ddc4a7c7..52e040ffca 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -1,9 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; using System.IO; using Terraria; using Terraria.ModLoader; @@ -21,11 +23,13 @@ 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; @@ -89,18 +93,18 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), projectile.Center); } - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice; - Lighting.AddLight(projectile.Center, 3f, 0f, 0f); + Lighting.AddLight(projectile.Center, 3f * projectile.Opacity, 0f, 0f); - float inertia = (revenge ? 5f : 4.5f) + speedAdd; //100 - float speed = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); //5 + float inertia = (revenge ? 4.5f : 5f) + speedAdd; + float speed = (revenge ? 1.5f : 1.35f) + (speedAdd * 0.25f); float minDist = 160f; if (NPC.AnyNPCs(ModContent.NPCType())) { - inertia *= 0.5f; + inertia *= 1.5f; speed *= 0.5f; } @@ -114,20 +118,14 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.Distance(Main.player[target].Center) > minDist) { - Vector2 targetVec = projectile.DirectionTo(Main.player[target].Center); - if (targetVec.HasNaNs()) - targetVec = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * (inertia - 1f) + targetVec * speed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[target].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } else { - if (projectile.ai[0] != -1f) - { - projectile.ai[0] = -1f; - projectile.netUpdate = true; - } + projectile.ai[0] = Player.FindClosest(projectile.Center, 1, 1); + projectile.netUpdate = true; } if (death) @@ -197,6 +195,12 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(ModContent.BuffType(), 300, true); } + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindProjectiles.Add(index); + drawCacheProjsBehindNPCs.Add(index); + } + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index c16c04b578..642067453c 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -19,7 +20,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 10; projectile.height = 10; projectile.hostile = true; projectile.alpha = 255; @@ -103,7 +105,32 @@ namespace CalamityMod.Projectiles.Boss 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); - for (int num809 = 0; num809 < 2; num809++) + + // Fire brimstone darts along the laser + if (Main.npc[(int)projectile.ai[1]].ai[1] == 210f && projectile.owner == Main.myPlayer) + { + Vector2 velocity = projectile.velocity; + velocity.Normalize(); + float distanceBetweenProjectiles = CalamityWorld.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); + int type = ModContent.ProjectileType(); + 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); + int proj = Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].tileCollide = true; + } + fireFrom += velocity * distanceBetweenProjectiles; + } + } + + for (int num809 = 0; num809 < 2; num809++) { float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; float num811 = (float)Main.rand.NextDouble() * 2f + 2f; @@ -146,7 +173,7 @@ namespace CalamityMod.Projectiles.Boss if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 0, texture2D20.Width, texture2D20.Height); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) @@ -156,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss 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; + rectangle7.Y += texture2D20.Height; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { rectangle7.Y = 0; diff --git a/Projectiles/Boss/BrimstoneTargetRay.cs b/Projectiles/Boss/BrimstoneTargetRay.cs index 4b3c4c25c1..242872bbab 100644 --- a/Projectiles/Boss/BrimstoneTargetRay.cs +++ b/Projectiles/Boss/BrimstoneTargetRay.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class BrimstoneTargetRay : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Target Ray"); @@ -171,11 +173,6 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - } - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index ce420fabfb..bb215aa8c3 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss else projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 1170) / 30f), 0f, 1f); - Lighting.AddLight(projectile.Center, 0.5f, 0f, 0f); + Lighting.AddLight(projectile.Center, 0.5f * projectile.Opacity, 0f, 0f); if (projectile.velocity.X < 0f) projectile.spriteDirection = 1; diff --git a/Projectiles/Boss/BrimstoneWave.png b/Projectiles/Boss/BrimstoneWave.png index 27b1111121..cac79d9d96 100644 Binary files a/Projectiles/Boss/BrimstoneWave.png and b/Projectiles/Boss/BrimstoneWave.png differ diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 7892710b88..f545c4ed4e 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -1,18 +1,15 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DarkEnergyBall : ModProjectile { - private double timeElapsed = 0.0; - private double circleSize = 1.0; - private double circleGrowth = 0.02; - public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Energy"); @@ -23,74 +20,113 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 80; + 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; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(timeElapsed); - writer.Write(circleSize); - writer.Write(circleGrowth); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - timeElapsed = reader.ReadDouble(); - circleSize = reader.ReadDouble(); - circleGrowth = reader.ReadDouble(); - } - public override void AI() { - timeElapsed += 0.02; - projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); - circleSize += circleGrowth; - projectile.frameCounter++; + if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) + projectile.Kill(); + + if (projectile.velocity.Length() < 10f) + projectile.velocity *= 1.05f; + + 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.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 0; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - - Rectangle frame = new Rectangle(0, projectile.frame * Main.projectileTexture[projectile.type].Height, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]); - Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); - - color = Color.Lerp(Color.White, Color.Cyan, 0.5f); - - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); - + 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; + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + + 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); + + } + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 35f && projectile.Opacity == 1f; + } + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.VortexDebuff, 60); + if (projectile.Opacity == 1f) + target.AddBuff(BuffID.VortexDebuff, 60); } public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 0f, 0f); - } + 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.PurpleCosmolite, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + 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.PurpleCosmolite, 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.PurpleCosmolite, 0f, 0f, 100, default, 1f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 2f; + } } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index b48b9510fb..0e9dd95693 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -1,18 +1,16 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DarkEnergyBall2 : ModProjectile { - private bool start = true; - private float startingPosX = 0f; - private float startingPosY = 0f; - private double distance = 0D; + public override string Texture => "CalamityMod/Projectiles/Boss/DarkEnergyBall"; public override void SetStaticDefaults() { @@ -24,86 +22,118 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 80; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 80; projectile.height = 80; projectile.hostile = true; projectile.tileCollide = false; projectile.timeLeft = 600; projectile.penetrate = -1; - cooldownSlot = 1; + projectile.Opacity = 0f; + cooldownSlot = 1; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(start); - writer.Write(startingPosX); - writer.Write(startingPosY); - writer.Write(distance); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - start = reader.ReadBoolean(); - startingPosX = reader.ReadSingle(); - startingPosY = reader.ReadSingle(); - distance = reader.ReadDouble(); - } - public override void AI() { - projectile.frameCounter++; + if (Vector2.Distance(projectile.Center, Main.npc[CalamityGlobalNPC.voidBoss].Center) < 80f) + projectile.Kill(); + + if (projectile.velocity.Length() < 10f) + projectile.velocity *= 1.05f; + + 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.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 0; - } - - if (start) - { - startingPosX = projectile.Center.X; - startingPosY = projectile.Center.Y; - start = false; - } - - double deg = projectile.ai[0]; - double rad = deg * (Math.PI / 180); - distance += projectile.ai[1] == 1f ? 2D : 1D; - 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[0] += 0.5f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - - Rectangle frame = new Rectangle(0, projectile.frame * Main.projectileTexture[projectile.type].Height, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]); - Color color = Color.Lerp(Color.White, Color.Fuchsia, 0.5f); - - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); - - color = Color.Lerp(Color.White, Color.Cyan, 0.5f); - - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/DarkEnergyBallGlow2"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); - + 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; + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + + 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); + + } + + 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 minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 35f && projectile.Opacity == 1f; + } + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.VortexDebuff, 60); + if (projectile.Opacity == 1f) + target.AddBuff(BuffID.VortexDebuff, 60); } public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 90, 0f, 0f); - } - } - } + 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.PurpleCosmolite, 0f, 0f, 100, default, 1.2f); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + 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.PurpleCosmolite, 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.PurpleCosmolite, 0f, 0f, 100, default, 1f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 2f; + } + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } } diff --git a/Projectiles/Boss/DarkEnergyBall2.png b/Projectiles/Boss/DarkEnergyBall2.png deleted file mode 100644 index 813ebf8eb0..0000000000 Binary files a/Projectiles/Boss/DarkEnergyBall2.png and /dev/null differ diff --git a/Projectiles/Boss/DarkOrb.cs b/Projectiles/Boss/DarkOrb.cs index 67272b90c9..0c1c405672 100644 --- a/Projectiles/Boss/DarkOrb.cs +++ b/Projectiles/Boss/DarkOrb.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Boss { public class DarkOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LightningProj"; + private bool start = true; private Vector2 center = Vector2.Zero; private Vector2 velocity = Vector2.Zero; @@ -550,13 +552,11 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(ModContent.BuffType(), 300); //target.AddBuff(ModContent.BuffType(), 300, true); - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 a547eebef0..8bf00ad4ef 100644 --- a/Projectiles/Boss/DestroyerCursedLaser.cs +++ b/Projectiles/Boss/DestroyerCursedLaser.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 600; projectile.scale = 1.8f; projectile.extraUpdates = 2; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 12f) { projectile.velocity *= 1.0025f; } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index e8bc47ef58..51375c0593 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Boss projectile.scale = 1.2f; projectile.timeLeft = 600; projectile.extraUpdates = 2; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 12f) { projectile.velocity *= 1.0025f; } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 75e7b79e7f..13c18ddd2a 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 26; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 26; projectile.height = 26; projectile.hostile = true; projectile.alpha = 100; @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 33); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 33); } if (projectile.timeLeft < 85) @@ -111,7 +112,7 @@ namespace CalamityMod.Projectiles.Boss 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 < 30; num621++) + 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, 1.2f); Main.dust[num622].velocity *= 3f; @@ -121,7 +122,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + for (int num623 = 0; num623 < 20; 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); Main.dust[num624].noGravity = true; @@ -133,7 +134,10 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + if (projectile.timeLeft > 815 || projectile.timeLeft < 85) + return; + + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/DeusRitualDrama.cs b/Projectiles/Boss/DeusRitualDrama.cs index 20f12a90fd..35c1eadd39 100644 --- a/Projectiles/Boss/DeusRitualDrama.cs +++ b/Projectiles/Boss/DeusRitualDrama.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Boss get => projectile.ai[0]; set => projectile.ai[0] = value; } + public bool CreatedWithStarcore => projectile.ai[1] == 1f; public const int TotalSinePeriods = 6; public const int PulseTime = 45; public const int TotalRitualTime = 420; @@ -37,25 +38,28 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = TotalRitualTime; } - public override void AI() - { - Time++; - if (Time == TotalRitualTime - PulseTime) - { - int idx = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y - (int)MaxUpwardRise, ModContent.NPCType(), 1); - if (idx != -1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.BossAwakenMessage(idx); - } - else - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); - } - } - } - } + public override void AI() + { + 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); + if (idx != -1) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstrumDeusSpawn"), projectile.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CalamityUtils.BossAwakenMessage(idx); + } + else + { + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, idx); + } + } + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -107,6 +111,7 @@ namespace CalamityMod.Projectiles.Boss dust.velocity = angle.ToRotationVector2() * 7f; dust.noGravity = true; } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), projectile.Center); } DrawStars(spriteBatch, offset); diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 2a4bac8ce4..4ad7dd6f33 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DoGBeam : ModProjectile @@ -34,14 +35,15 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 1) - { projectile.frame = 0; - } + Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.3f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + + 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] < 120f && projectile.ai[1] > 30f) + if (projectile.ai[1] < 90f && projectile.ai[1] > 30f) { float scaleFactor2 = projectile.velocity.Length(); Vector2 vector11 = Main.player[num103].Center - projectile.Center; @@ -51,16 +53,16 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } - int projectileDamage = Main.expertMode ? 64 : 75; + if (projectile.timeLeft == 950) - projectile.damage = projectileDamage; - if (projectile.timeLeft < 85) + 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 < 85) + if (projectile.timeLeft > 950 || projectile.timeLeft < 30) { return false; } @@ -73,9 +75,9 @@ namespace CalamityMod.Projectiles.Boss { return new Color(0, 0, 0, 0); } - if (projectile.timeLeft < 85) + if (projectile.timeLeft < 30) { - byte b2 = (byte)(projectile.timeLeft * 3); + 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 ff16a68eea..b77e467f51 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -1,3 +1,6 @@ +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -5,13 +8,14 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DoGBeamPortal : ModProjectile { - private int beamTimer = 180; + public bool start = true; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam Portal"); Main.projFrames[projectile.type] = 6; @@ -31,17 +35,55 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { - writer.Write(beamTimer); + writer.Write(start); } public override void ReceiveExtraAI(BinaryReader reader) { - beamTimer = reader.ReadInt32(); + start = reader.ReadBoolean(); } public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.95f, 1.15f); + Player player = Main.player[projectile.owner]; + + if (start) + { + Main.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); + Main.dust[num622].velocity *= 3f; + Main.dust[num622].noGravity = true; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 2f; + } + + projectile.ai[1] = projectile.ai[0]; + start = false; + } + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || malice; + bool revenge = CalamityWorld.revenge || malice; + bool death = CalamityWorld.death || malice; + + Lighting.AddLight(projectile.Center, 0f, 0.95f, 1.15f); + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -49,92 +91,46 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 0; - } - beamTimer--; - if (beamTimer <= 0) - { - Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - if (projectile.owner == Main.myPlayer) + + 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; + + // Don't fire projectiles if Ceaseless Void is entering a new phase + if (projectile.timeLeft > 30) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 240f) { - float speed = 3f; - int seeProjFileforDmg = 0; - if (CalamityWorld.death) + projectile.localAI[0] = 0f; + if (projectile.owner == Main.myPlayer) { - speed = 5f; - } - else if (CalamityWorld.revenge) - { - speed = 4.5f; - } - else if (Main.expertMode) - { - speed = 4f; - } - speed *= projectile.ai[0]; - int totalProjectiles = 8; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 vector255 = new Vector2(0f, -speed).RotatedBy(radians * i); - Projectile.NewProjectile(projectile.Center, vector255, ModContent.ProjectileType(), seeProjFileforDmg, 0f, projectile.owner, 0f, 0f); + Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); + float speed = (malice || death) ? 5f : revenge ? 4.5f : expertMode ? 4f : 3f; + speed *= Main.npc[CalamityGlobalNPC.voidBoss].ai[1]; + int totalProjectiles = 3; + float radians = MathHelper.TwoPi / totalProjectiles; + 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); + } } } - beamTimer = 180; - } - int num103 = Player.FindClosest(projectile.Center, 1, 1); - float scaleFactor2 = projectile.velocity.Length(); - Vector2 vector11 = Main.player[num103].Center - projectile.Center; - if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) - { - projectile.position.X = Main.player[num103].Center.X / 16 * 16f - (projectile.width / 2); - projectile.position.Y = Main.player[num103].Center.Y / 16 * 16f - (projectile.height / 2) - 250f; - projectile.ai[1] = 0f; - beamTimer = 90; - } - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); - 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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - } - if (projectile.timeLeft < 85) - projectile.damage = 0; + } } - public override bool CanHitPlayer(Player target) - { - return false; - } + public override bool CanHitPlayer(Player target) => false; public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (projectile.timeLeft < 30) { - byte b2 = (byte)(projectile.timeLeft * 3); + 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 23dbe65792..503c17a318 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,9 +1,11 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DoGDeath : ModProjectile @@ -13,10 +15,12 @@ namespace CalamityMod.Projectiles.Boss get => projectile.ai[0]; set => projectile.ai[0] = value; } + public Vector2 OldVelocity; public const float TelegraphTotalTime = 75f; public const float TelegraphFadeTime = 15f; public const float TelegraphWidth = 4200f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Death Beam"); @@ -24,7 +28,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 10; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 10; projectile.height = 10; projectile.hostile = true; projectile.ignoreWater = true; @@ -34,12 +39,13 @@ namespace CalamityMod.Projectiles.Boss projectile.extraUpdates = 1; projectile.timeLeft = 300; cooldownSlot = 1; - } + } public override void SendExtraAI(BinaryWriter writer) { writer.WriteVector2(OldVelocity); } + public override void ReceiveExtraAI(BinaryReader reader) { OldVelocity = reader.ReadVector2(); @@ -68,7 +74,7 @@ namespace CalamityMod.Projectiles.Boss // 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; + projectile.velocity = OldVelocity * (CalamityWorld.malice ? 1.25f : 1f); OldVelocity = Vector2.Zero; projectile.netUpdate = true; } @@ -85,11 +91,12 @@ namespace CalamityMod.Projectiles.Boss TelegraphDelay++; } - public override bool CanDamage() => TelegraphDelay > TelegraphTotalTime; + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (TelegraphDelay > TelegraphTotalTime) + target.AddBuff(ModContent.BuffType(), 180); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index f93343d7cc..c43e1b561c 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -19,20 +19,23 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + 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; + } public override void AI() { - if (projectile.localAI[0] == 0f) + if (projectile.localAI[0] == 0f && projectile.ai[1] == 0f) { projectile.localAI[0] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); @@ -45,56 +48,34 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 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, 0.8f); 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(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.ai[1] == 1f) + if (projectile.ai[1] > 0f) { - 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] < 300f) - { - float scaleFactor2 = projectile.velocity.Length(); - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - else if (projectile.velocity.Length() < 24f) - { - projectile.tileCollide = true; - projectile.velocity *= 1.02f; - } - } - } + if (projectile.velocity.Length() < projectile.ai[1]) + projectile.velocity *= projectile.ai[0]; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Frostburn, 300, true); - target.AddBuff(BuffID.Darkness, 300, true); + target.AddBuff(ModContent.BuffType(), 240); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/DoGNebulaShot.cs b/Projectiles/Boss/DoGNebulaShot.cs deleted file mode 100644 index 561983f54e..0000000000 --- a/Projectiles/Boss/DoGNebulaShot.cs +++ /dev/null @@ -1,131 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Boss -{ - public class DoGNebulaShot : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Death Laser"); - } - - public override void SetDefaults() - { - projectile.width = 5; - projectile.height = 5; - projectile.hostile = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.extraUpdates = 4; - projectile.timeLeft = 180; - cooldownSlot = 1; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item12, (int)projectile.Center.X, (int)projectile.Center.Y); - } - bool xIntersects = false; - bool yIntersects = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - xIntersects = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - xIntersects = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - yIntersects = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - yIntersects = true; - } - if (xIntersects && yIntersects) - { - projectile.tileCollide = true; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - float num55 = 50f; - float num56 = 1.5f; - projectile.localAI[0] += num56; - if (projectile.localAI[0] > num55) - { - projectile.localAI[0] = num55; - } - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 100, 255, 0); - } - - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) - { - target.Calamity().lastProjectileHit = projectile; - } - } -} diff --git a/Projectiles/Boss/DoGTeleportRift.cs b/Projectiles/Boss/DoGTeleportRift.cs new file mode 100644 index 0000000000..23b9e7e0af --- /dev/null +++ b/Projectiles/Boss/DoGTeleportRift.cs @@ -0,0 +1,138 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Boss +{ + public class DoGTeleportRift : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rift"); + } + + 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; + } + + public override void AI() + { + if (projectile.ai[0] == -1f) + return; + + if (projectile.timeLeft < 160) + projectile.timeLeft = 160; + + 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); + + 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.velocity.X = 0f; + dust.noGravity = true; + dust.fadeIn = 1f; + 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; + + 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; + Color colorB = baseColor * 0.5f; + colorA *= lerpMult; + colorB *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(3f, 9f) * projectile.Opacity * lerpMult; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, 0f, origin, scale, spriteEffects, 0); + 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.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); + + return false; + } + + public override void Kill(int timeLeft) + { + if (projectile.ai[0] == -1f) + return; + + int dustAmt = 50; + int random = 5; + + for (int j = 0; j < 10; j++) + { + random += j * 2; + int dustAmtSpawned = 0; + int scale = random * 13; + float dustPositionX = projectile.Center.X - (scale / 2); + float dustPositionY = projectile.Center.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) + { + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmolite, 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 += Main.rand.Next(-10, 11); + Main.dust[dust].position.Y += Main.rand.Next(-10, 11); + Main.dust[dust].velocity.X = dustVelocityX; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; + } + } + } + } +} diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index f82bff0d80..31db43e494 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Boss { public class EssenceDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Dust"); @@ -26,12 +28,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.975f; + projectile.velocity *= 0.985f; Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.55f); for (int num468 = 0; num468 < 5; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; } @@ -46,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss 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, 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,10 +57,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, 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(new Vector2(projectile.position.X, projectile.position.Y), 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(); diff --git a/Projectiles/Boss/EssenceDust.png b/Projectiles/Boss/EssenceDust.png deleted file mode 100644 index 59a8c48354..0000000000 Binary files a/Projectiles/Boss/EssenceDust.png and /dev/null differ diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ExoDestroyerBeamStart.cs new file mode 100644 index 0000000000..eed1a3bc8f --- /dev/null +++ b/Projectiles/Boss/ExoDestroyerBeamStart.cs @@ -0,0 +1,262 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ExoDestroyerBeamStart : ModProjectile + { + public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null; + public ref float Time => ref projectile.localAI[0]; + public ref float LengthOfLaser => ref projectile.localAI[1]; + public const int Lifetime = 180; + public const float BeamPosOffset = 16f; + private const int maxFrames = 4; + private int frameDrawn = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("T Hanos Deathray"); + } + + 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; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(frameDrawn); + writer.Write(Time); + writer.Write(LengthOfLaser); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + frameDrawn = reader.ReadInt32(); + Time = reader.ReadSingle(); + LengthOfLaser = reader.ReadSingle(); + } + + public override void AI() + { + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active || ThingToAttachTo.Calamity().newAI[0] != 2f) + { + projectile.Kill(); + return; + } + + // The direction of the host NPC. + Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); + + // Offset to move the beam forward so that it starts inside the NPC's mouth. + float beamStartForwardsOffset = -8f; + + // Set the starting location of the beam to the center of the NPC. + projectile.Center = ThingToAttachTo.Center; + // Add a fixed offset to align with the NPC's spritesheet (?) + projectile.position += hostNPCDirection * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); + // Add the forwards offset, measured in pixels. + projectile.position += hostNPCDirection * beamStartForwardsOffset; + + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } + + float scale = 1f; + projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; + if (projectile.scale > scale) + projectile.scale = scale; + + projectile.rotation = ThingToAttachTo.velocity.ToRotation(); + projectile.velocity = projectile.rotation.ToRotationVector2(); + + projectile.rotation = ThingToAttachTo.velocity.ToRotation() - MathHelper.PiOver2; + + float arraySize = 3f; + Vector2 samplingPoint = projectile.Center; + float[] samples = new float[(int)arraySize]; + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 2400f, samples); + float laserLength = 0f; + for (int i = 0; i < samples.Length; i++) + { + laserLength += samples[i]; + } + laserLength /= arraySize; + + // Fire laser through walls at max length if target cannot be seen + if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) + laserLength = 2400f; + + float amount = 0.5f; + LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); + + // Fire beams along the laser + float divisor = expertMode ? 80f : 160f; + if (ThingToAttachTo.Calamity().newAI[2] % divisor == 0f && projectile.owner == Main.myPlayer) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), ThingToAttachTo.Center); + Vector2 velocity = projectile.velocity; + velocity.Normalize(); + float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f; + Vector2 fireFrom = ThingToAttachTo.Center + velocity * distanceBetweenProjectiles; + int projectileAmt = (int)(LengthOfLaser / distanceBetweenProjectiles); + int type = ModContent.ProjectileType(); + int damage = projectile.GetProjectileDamage(ThingToAttachTo.type); + 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) * 12f; + Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); + } + fireFrom += velocity * distanceBetweenProjectiles; + } + } + + // Spawn dust at the end of the beam + int dustType = (int)CalamityDusts.Brimstone; + Vector2 dustPos = projectile.Center + projectile.velocity * (LengthOfLaser - 14f); + for (int i = 0; i < 2; i++) + { + 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); + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.7f; + } + + if (Main.rand.NextBool(5)) + { + 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.3f, 0.65f, 0.7f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + return false; + + Texture2D beamStart = Main.projectileTexture[projectile.type]; + Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamMiddle"); + Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamEnd"); + + float drawLength = LengthOfLaser; + Color color = new Color(250, 100, 100, 0); + + if (Time % 5 == 0) + { + frameDrawn++; + if (frameDrawn >= maxFrames) + frameDrawn = 0; + } + + // Draw start of beam + 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); + + // 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; + if (drawLength > 0f) + { + float i = 0f; + int middleFrameDrawn = frameDrawn; + while (i + 1f < drawLength) + { + Rectangle rectangle = new Rectangle(0, beamMiddle.Height / maxFrames * middleFrameDrawn, beamMiddle.Width, beamMiddle.Height / maxFrames); + + 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); + + middleFrameDrawn++; + if (middleFrameDrawn >= maxFrames) + middleFrameDrawn = 0; + + 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) + rectangle.Y = 0; + } + } + + // 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); + + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * LengthOfLaser, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + + float collisionPoint = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint)) + return true; + + return false; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 360); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.png b/Projectiles/Boss/ExoDestroyerBeamStart.png new file mode 100644 index 0000000000..a0c3da9735 Binary files /dev/null and b/Projectiles/Boss/ExoDestroyerBeamStart.png differ diff --git a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs b/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs new file mode 100644 index 0000000000..1a120d317a --- /dev/null +++ b/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs @@ -0,0 +1,94 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ExoDestroyerBeamTelegraph : ModProjectile + { + 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 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 const int Lifetime = 180; + public const float TelegraphWidth = 3600f; + public const float BeamPosOffset = 16f; + public override void SetStaticDefaults() => DisplayName.SetDefault("Telegraph"); + + public override void SetDefaults() + { + 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) + { + writer.Write(ConvergenceAngle); + writer.Write(Time); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + ConvergenceAngle = reader.ReadSingle(); + Time = reader.ReadSingle(); + } + + public override void AI() + { + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active || ThingToAttachTo.Calamity().newAI[0] != 2f) + { + projectile.Kill(); + return; + } + + // The direction of the host NPC. + Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); + + // Offset to move the beam forward so that it starts inside the NPC's mouth. + float beamStartForwardsOffset = -8f; + + // Set the starting location of the beam to the center of the NPC. + projectile.Center = ThingToAttachTo.Center; + // Add a fixed offset to align with the NPC's spritesheet (?) + projectile.position += hostNPCDirection * BeamPosOffset + new Vector2(0f, -ThingToAttachTo.gfxOffY); + // Add the forwards offset, measured in pixels. + projectile.position += hostNPCDirection * beamStartForwardsOffset; + + 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"); + + 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); + 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); + return false; + } + } +} diff --git a/Projectiles/Boss/ExoDestroyerLaser.cs b/Projectiles/Boss/ExoDestroyerLaser.cs new file mode 100644 index 0000000000..67996cd690 --- /dev/null +++ b/Projectiles/Boss/ExoDestroyerLaser.cs @@ -0,0 +1,286 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class ExoDestroyerLaser : ModProjectile + { + public float TelegraphDelay + { + 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 Vector2 Destination; + public Vector2 Velocity; + public const float TelegraphTotalTime = 30f; + public const float TelegraphFadeTime = 15f; + public const float TelegraphWidth = 4200f; + public const float LaserVelocity = 12f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("T Hanos Beam"); + 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; + cooldownSlot = 1; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(Destination); + writer.WriteVector2(Velocity); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Destination = reader.ReadVector2(); + Velocity = reader.ReadVector2(); + } + + public override void AI() + { + // 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) + { + projectile.localAI[0] = 1f; + projectile.netUpdate = true; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 8) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + + // If there is no NPC to attach to, run this instead. + 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 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 = 2; + projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); + Velocity = Vector2.Zero; + projectile.netUpdate = true; + } + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + 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); + } + } + else if (Velocity == Vector2.Zero) + { + Velocity = projectile.velocity; + projectile.velocity = Vector2.Zero; + projectile.netUpdate = true; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + 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); + } + } + + TelegraphDelay++; + + return; + } + + // Die if the thing to attach to disappears. + if (ThingToAttachTo is null || !ThingToAttachTo.active) + { + projectile.Kill(); + return; + } + + // If the Ares Laser Cannon is the owner + bool aresLaserIsOwner = ThingToAttachTo.type == ModContent.NPCType(); + + // Fade in after telegraphs have faded. + if (TelegraphDelay > TelegraphTotalTime) + { + 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 = 2; + projectile.velocity = Velocity * (CalamityWorld.malice ? 1.25f : 1f); + Velocity = Vector2.Zero; + projectile.netUpdate = true; + } + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + 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); + } + } + else if (Destination == Vector2.Zero) + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + // Set destination of the laser, the target's center. + Destination = projectile.velocity; + + if (aresLaserIsOwner) + 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; + + // Direction and rotation. + if (projectile.velocity.X < 0f) + { + 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); + } + } + else + { + // Set start of telegraph to the npc center. + projectile.Center = ThingToAttachTo.Center; + + if (aresLaserIsOwner) + 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) + { + 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); + } + } + + TelegraphDelay++; + } + + public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (TelegraphDelay > TelegraphTotalTime) + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + + 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); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam"); + + float yScale = 4f; + if (TelegraphDelay < TelegraphFadeTime) + yScale = MathHelper.Lerp(0f, 4f, TelegraphDelay / 15f); + if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime) + yScale = MathHelper.Lerp(4f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f); + + Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale); + Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f); + Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f); + + Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash. + Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f); + + colorOuter *= 0.7f; + colorInner *= 0.7f; + + 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/ExoDestroyerLaser.png b/Projectiles/Boss/ExoDestroyerLaser.png new file mode 100644 index 0000000000..49cdca1d74 Binary files /dev/null and b/Projectiles/Boss/ExoDestroyerLaser.png differ diff --git a/Projectiles/Boss/Flare.cs b/Projectiles/Boss/Flare.cs index f0795219c9..26c5708967 100644 --- a/Projectiles/Boss/Flare.cs +++ b/Projectiles/Boss/Flare.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -85,13 +86,13 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; Main.PlaySound(SoundID.Item20, projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 00b8164505..79ca404c85 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,12 +13,13 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.hostile = true; projectile.scale = 1.5f; @@ -26,11 +28,11 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 50; projectile.timeLeft = 180; cooldownSlot = 1; - } + } public override void AI() { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; projectile.frameCounter++; if (projectile.frameCounter > 4) @@ -38,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } @@ -58,30 +60,19 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 0; } - if (projectile.timeLeft > 135 && projectile.ai[1] == 1f) + if (projectile.ai[0] == -1f || (projectile.timeLeft > 135 && projectile.ai[1] == 1f)) return; - float num953 = revenge ? 110f : 100f; + float inertia = revenge ? 70f : 77f; float num954 = 40f; - float scaleFactor12 = revenge ? 50f : 40f; - - if (projectile.ai[1] == 1f) - { - num953 *= 0.7f; - scaleFactor12 *= 0.7f; - } - + float scaleFactor12 = revenge ? 35f : 28f; 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) { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[num959].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * scaleFactor12) / inertia; } } else @@ -93,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss } } - if (projectile.timeLeft < 60 || projectile.ai[1] == 1f) + if (projectile.timeLeft < 60) return; float num1247 = 0.5f; @@ -120,47 +111,41 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, 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); + 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.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.Damage(); - for (int num621 = 0; num621 < 3; num621++) + Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + for (int d = 0; d < 2; d++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + 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)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + Main.rand.NextFloat(0.1f, 1f); } } - for (int num623 = 0; num623 < 5; num623++) + for (int d = 0; d < 4; d++) { - 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); - Main.dust[num624].velocity *= 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); + Main.dust[idx].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); + projectile.Damage(); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/FlareBomb.png b/Projectiles/Boss/FlareBomb.png index 24f7e7a2b3..29305cea00 100644 Binary files a/Projectiles/Boss/FlareBomb.png and b/Projectiles/Boss/FlareBomb.png differ diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 14fc375b1b..647dd8a0bb 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class FlareDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/FlareBomb"; + private bool start = true; private float startingPosX = 0f; private float startingPosY = 0f; @@ -18,12 +20,13 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Dust"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.scale = 1.5f; projectile.hostile = true; @@ -32,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 680; cooldownSlot = 1; - } + } public override void SendExtraAI(BinaryWriter writer) { @@ -60,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) projectile.frame = 0; Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); @@ -104,10 +107,7 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[0] += 1f; } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -120,31 +120,27 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, 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); - for (int num621 = 0; num621 < 2; num621++) + Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + for (int d = 0; d < 2; d++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + 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)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + Main.rand.NextFloat(0.1f, 1f); } } - for (int num623 = 0; num623 < 4; num623++) + for (int d = 0; d < 4; d++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 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); + Main.dust[idx].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.damage = Main.expertMode ? 75 : 90; projectile.Damage(); } diff --git a/Projectiles/Boss/FlareDust.png b/Projectiles/Boss/FlareDust.png deleted file mode 100644 index 24f7e7a2b3..0000000000 Binary files a/Projectiles/Boss/FlareDust.png and /dev/null differ diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index ff2ed24cc2..66706446b5 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -10,18 +10,21 @@ namespace CalamityMod.Projectiles.Boss { public class FlareDust2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/FlareBomb"; + private bool start = true; private Vector2 velocity = Vector2.Zero; public override void SetStaticDefaults() { DisplayName.SetDefault("Flare Bomb"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.scale = 1.5f; projectile.hostile = true; @@ -52,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } @@ -113,10 +116,7 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -129,31 +129,28 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item14, projectile.position); - 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); - projectile.Damage(); - for (int num621 = 0; num621 < 2; num621++) + Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + for (int d = 0; d < 2; d++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + 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)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + Main.rand.NextFloat(0.1f, 1f); } } - for (int num623 = 0; num623 < 4; num623++) + for (int d = 0; d < 4; d++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 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); + Main.dust[idx].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); + projectile.Damage(); } public override void OnHitPlayer(Player target, int damage, bool crit) diff --git a/Projectiles/Boss/FlareDust2.png b/Projectiles/Boss/FlareDust2.png deleted file mode 100644 index 24f7e7a2b3..0000000000 Binary files a/Projectiles/Boss/FlareDust2.png and /dev/null differ diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index 1829441a28..9d5f0c0349 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Yharon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -12,12 +13,13 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Flarenado"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 320; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 320; projectile.height = 88; projectile.hostile = true; projectile.tileCollide = false; @@ -40,46 +42,37 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - int num613 = 12; - int num614 = 12; - float num615 = 1f; - int num616 = 320; - int num617 = 88; + float scaleBase = 24f; + float scaleMult = 1f; + float baseWidth = 320f; + float baseHeight = 88f; if (projectile.velocity.X != 0f) { projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); } - projectile.frameCounter++; if (projectile.frameCounter > 2) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - 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.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) { - 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 = (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)) @@ -98,7 +91,6 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) { projectile.ai[0] -= 1f; @@ -108,37 +100,29 @@ namespace CalamityMod.Projectiles.Boss { 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 -= baseHeight * projectile.scale / 2f; + float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * 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, 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) { float num622 = 0.104719758f; 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.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 = projectile.position.X + num624 * (float)-(float)projectile.direction; + projectile.position.X += num624 * -projectile.direction; } - int damage = Main.expertMode ? 85 : 100; if (projectile.timeLeft == 480) - projectile.damage = damage; + projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft > 480) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 480; public override Color? GetAlpha(Color lightColor) { @@ -156,7 +140,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + if (projectile.timeLeft <= 480) + target.AddBuff(ModContent.BuffType(), 300); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/Flarenado.png b/Projectiles/Boss/Flarenado.png index 72814b1f39..0939b73870 100644 Binary files a/Projectiles/Boss/Flarenado.png and b/Projectiles/Boss/Flarenado.png differ diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index cc7d85f7b7..948215fa45 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 300; projectile.Opacity = 0f; projectile.coldDamage = true; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -108,6 +109,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity *= 1.02f; 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); } @@ -116,7 +118,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -127,9 +129,8 @@ namespace CalamityMod.Projectiles.Boss if (projectile.Opacity != 1f) return; - target.AddBuff(BuffID.Frostburn, 240, true); - target.AddBuff(BuffID.Chilled, 120, true); - target.AddBuff(BuffID.Frozen, 30, true); + target.AddBuff(BuffID.Frostburn, 120, true); + target.AddBuff(BuffID.Chilled, 90, true); } } } diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index ef3482c5ef..920b6f84d9 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -80,13 +80,12 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.velocity.X *= 0.5f; - target.velocity.Y *= 0.5f; + target.velocity *= 0.5f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 a2d6712868..ac638c47be 100644 --- a/Projectiles/Boss/HealOrbProv.cs +++ b/Projectiles/Boss/HealOrbProv.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Boss { public class HealOrbProv : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); @@ -23,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.timeLeft = 300; projectile.extraUpdates = 3; - } + } public override void AI() { @@ -37,8 +39,8 @@ namespace CalamityMod.Projectiles.Boss { if (projectile.owner == Main.myPlayer) { - int num492 = -32; - Main.player[num487].HealEffect(num492, false); + 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) { @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss { 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, 127, 0f, 0f, 100, default, 1f); + 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 aff72a6587..db3c29b3be 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class HellfireExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Hellfire Explosion"); @@ -88,7 +90,7 @@ 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, (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; @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/HellfireExplosion.png b/Projectiles/Boss/HellfireExplosion.png deleted file mode 100644 index 68fb6e2672..0000000000 Binary files a/Projectiles/Boss/HellfireExplosion.png and /dev/null differ diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 383f5dfa4a..6cd57878ad 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -19,12 +19,15 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; + 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() { @@ -78,7 +81,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -118,7 +121,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 19c517dd69..4a7a81160d 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -39,9 +39,9 @@ namespace CalamityMod.Projectiles.Boss float[] hue = new float[drawnAmt]; float[] size = new float[drawnAmt]; int totalTime = 210; - float colorChangeAmt = CalamityUtils.GetLerpValue(0f, 60f, projectile.timeLeft, true) * CalamityUtils.GetLerpValue(totalTime, totalTime - 60, projectile.timeLeft, true); - float colorChangeAmt2 = CalamityUtils.GetLerpValue(0f, 60f, projectile.timeLeft, true) * CalamityUtils.GetLerpValue(totalTime, 90f, projectile.timeLeft, true); - colorChangeAmt2 = CalamityUtils.GetLerpValue(0.2f, 0.5f, colorChangeAmt2, 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; float yPosOffset = 60f; diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index abce937794..0b4bb9b9d4 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -18,13 +19,15 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 180; + 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; + } public override void AI() { @@ -44,7 +47,7 @@ namespace CalamityMod.Projectiles.Boss } if (projectile.ai[1] == 0f) { - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + 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); @@ -74,12 +77,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyBlastNight"); + 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); @@ -95,21 +98,22 @@ namespace CalamityMod.Projectiles.Boss double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; - for (i = 0; i < 4; i++) + float velocity = 5f; + int totalProjectiles = (!Main.dayTime || CalamityWorld.malice) ? 5 : 4; + for (int i = 0; i < totalProjectiles; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer, 0f, 0f); } } - Main.PlaySound(SoundID.Item20, projectile.Center); - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - for (int num193 = 0; num193 < 6; num193++) + Main.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); } - for (int num194 = 0; num194 < 60; num194++) + 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); Main.dust[num195].noGravity = true; @@ -122,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 240); } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index d11ae92d40..b61ec81001 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.NPCs.Providence; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.IO; @@ -28,7 +30,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.tileCollide = false; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -78,12 +81,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyBombNight"); + 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); @@ -99,12 +102,12 @@ namespace CalamityMod.Projectiles.Boss 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 ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - for (int num193 = 0; num193 < 3; num193++) + 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); } - for (int num194 = 0; num194 < 30; num194++) + 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); Main.dust[num195].noGravity = true; @@ -117,7 +120,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); + int buffType = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 180); } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index dff476a3e7..cf63756729 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -6,13 +6,15 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.DataStructures; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class HolyBurnOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Orb"); @@ -24,41 +26,39 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.alpha = 255; + projectile.alpha = 255; projectile.penetrate = 1; projectile.timeLeft = 200; - } + } public override void AI() { - if (projectile.ai[0] < 240f) - { - projectile.ai[0] += 1f; + if (projectile.ai[0] == 0f && CalamityWorld.malice) + projectile.velocity *= 1.25f; - if (projectile.timeLeft < 160) - projectile.timeLeft = 160; - } + if (projectile.ai[0] < 240f) + { + projectile.ai[0] += 1f; - if (projectile.velocity.Length() < 16f) - projectile.velocity *= 1.01f; + if (projectile.timeLeft < 160) + projectile.timeLeft = 160; + } - projectile.ai[1] = Player.FindClosest(projectile.Center, projectile.width, projectile.height); - int index = (int)projectile.ai[1]; - Player player = Main.player[index]; - if (player is null) - return; + if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.01f; - float playerDist = Vector2.Distance(player.Center, projectile.Center); + int index = Player.FindClosest(projectile.Center, projectile.width, projectile.height); + Player player = Main.player[index]; + if (player is null || player.Calamity().lol) + return; + + float playerDist = Vector2.Distance(player.Center, projectile.Center); if (playerDist < 50f && !player.dead && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.Bottom.Y && projectile.Bottom.Y > player.position.Y) { - int dmgAmt = Main.expertMode ? -150 : -100; - if (CalamityWorld.death || CalamityWorld.bossRushActive) - dmgAmt = -200; - if (!Main.dayTime) - dmgAmt = -300; - + int dmgAmt = (int)projectile.ai[1]; player.HealEffect(dmgAmt, false); player.statLife += dmgAmt; + player.Calamity().adrenaline = player.Calamity().stressPills ? player.Calamity().adrenaline / 2 : 0; if (player.statLife > player.statLifeMax2) { player.statLife = player.statLifeMax2; @@ -72,45 +72,48 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - float lerpMult = CalamityUtils.GetLerpValue(15f, 30f, projectile.timeLeft, clamped: true) * CalamityUtils.GetLerpValue(240f, 200f, projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTime % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f; + 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; - Texture2D texture = Main.projectileTexture[projectile.type]; - Vector2 drawPos = projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color baseColor = Main.dayTime ? new Color(255, 200, 100, 255) : new Color(100, 200, 255, 255); - baseColor *= 0.5f; - baseColor.A = 0; - Color colorA = baseColor; - Color colorB = baseColor * 0.5f; - colorA *= lerpMult; - colorB *= lerpMult; - Vector2 origin = texture.Size() / 2f; - Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; + 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; + Color colorA = baseColor; + Color colorB = baseColor * 0.5f; + colorA *= lerpMult; + colorB *= lerpMult; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorA, 0f, origin, scale, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2, origin, scale * 0.6f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, 0f, origin, scale * 0.6f, spriteEffects, 0); + float upRight = MathHelper.PiOver4; + float up = MathHelper.PiOver2; + float upLeft = 3f * MathHelper.PiOver4; + float left = MathHelper.Pi; + spriteBatch.Draw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, 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.36f, spriteEffects, 0); - spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f, origin, scale * 0.36f, spriteEffects, 0); + return false; + } - return false; - } - - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item14, projectile.Center); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 50); - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - for (int d = 0; d < 10; d++) + 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); Main.dust[holy].velocity *= 3f; @@ -120,7 +123,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[holy].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int d = 0; d < 15; d++) + for (int d = 0; d < 8; d++) { int fire = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 3f); Main.dust[fire].noGravity = true; @@ -132,8 +135,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 60); - } + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffType, 60); + } } } diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 2708403b29..797ac96611 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -26,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss projectile.aiStyle = 1; projectile.tileCollide = false; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -35,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.alpha -= 5; + projectile.alpha -= (!Main.dayTime || CalamityWorld.malice) ? 10 : 5; if (projectile.alpha <= 0) { projectile.Kill(); @@ -54,12 +56,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFireNight"); + 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); @@ -92,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss 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 ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + 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); @@ -112,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 120); } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index e6e69c59f7..c420fd1e98 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.NPCs.Providence; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.timeLeft = 600; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -45,6 +48,10 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity.X *= 1.05f; } int num103 = Player.FindClosest(projectile.Center, 1, 1); + if (projectile.ai[1] == 0f) + { + projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + } projectile.ai[1] += 1f; if (projectile.ai[1] < 180f && projectile.ai[1] > 60f) { @@ -52,7 +59,8 @@ namespace CalamityMod.Projectiles.Boss Vector2 vector11 = Main.player[num103].Center - projectile.Center; vector11.Normalize(); vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; + float inertia = (!Main.dayTime || CalamityWorld.malice) ? 20f : 25f; + projectile.velocity = (projectile.velocity * (inertia - 1f) + vector11) / inertia; projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } @@ -60,12 +68,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFire2Night"); + 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); @@ -81,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss 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 ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + 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); @@ -101,7 +109,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 120); } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 541ad69c39..95e74412cb 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.NPCs.Providence; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Boss projectile.extraUpdates = 1; projectile.timeLeft = 840; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -41,26 +44,27 @@ namespace CalamityMod.Projectiles.Boss if (projectile.frame > 3) projectile.frame = 0; - float velocityY = projectile.position.Y + projectile.height < player.position.Y ? 1f : 0.25f; - + float velocityYCap = projectile.position.Y + projectile.height < player.position.Y ? 1f : 0.25f; projectile.velocity.Y += 0.01f; - if (projectile.velocity.Y > velocityY) - projectile.velocity.Y = velocityY; + if (projectile.velocity.Y > velocityYCap) + projectile.velocity.Y = velocityYCap; + float velocityX = (!Main.dayTime || CalamityWorld.malice) ? 0.025f : 0.02f; if (projectile.position.X + projectile.width < player.position.X) { if (projectile.velocity.X < 0f) projectile.velocity.X *= 0.99f; - projectile.velocity.X += 0.02f; + projectile.velocity.X += velocityX; } else if (projectile.position.X > player.position.X + player.width) { if (projectile.velocity.X > 0f) projectile.velocity.X *= 0.99f; - projectile.velocity.X -= 0.02f; + projectile.velocity.X -= velocityX; } - if (projectile.velocity.X > 8f || projectile.velocity.X < -8f) + float velocityXCap = (!Main.dayTime || CalamityWorld.malice) ? 10f : 8f; + if (projectile.velocity.X > velocityXCap || projectile.velocity.X < -velocityXCap) projectile.velocity.X *= 0.97f; projectile.rotation = projectile.velocity.X * 0.025f; @@ -68,12 +72,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/HolyFlareNight"); + 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); @@ -89,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss 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 ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + 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); @@ -109,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); + int buffType = ((Main.dayTime && !CalamityWorld.malice) || !NPC.AnyNPCs(ModContent.NPCType())) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 120); } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index a90f4bd63f..7dfc311d8c 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Boss { public class HolyLight : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Light"); @@ -41,20 +43,22 @@ namespace CalamityMod.Projectiles.Boss if (projectile.velocity.Length() < 16f) projectile.velocity *= 1.01f; - projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); - int num487 = (int)projectile.ai[1]; - float num491 = Vector2.Distance(Main.player[num487].Center, projectile.Center); + int index = Player.FindClosest(projectile.position, projectile.width, projectile.height); + Player player = Main.player[index]; + if (player is null) + return; - if (num491 < 50f && !Main.player[num487].dead && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) + float playerDist = Vector2.Distance(player.Center, projectile.Center); + if (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 num492 = expertMode ? 50 : 35; - Main.player[num487].HealEffect(num492, false); - Main.player[num487].statLife += num492; - if (Main.player[num487].statLife > Main.player[num487].statLifeMax2) + int healAmt = (int)projectile.ai[1]; + player.HealEffect(healAmt, false); + player.statLife += healAmt; + if (player.statLife > player.statLifeMax2) { - Main.player[num487].statLife = Main.player[num487].statLifeMax2; + player.statLife = player.statLifeMax2; } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, index, healAmt); projectile.Kill(); } } @@ -62,21 +66,19 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D value = Main.projectileTexture[projectile.type]; - Color baseColor = new Color(100, 255, 100, 255); - Color color33 = baseColor * 0.5f; - color33.A = 0; + Color color33 = new Color(54, 209, 54, 0); 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 = CalamityUtils.GetLerpValue(15f, 30f, projectile.timeLeft, clamped: true) * CalamityUtils.GetLerpValue(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) * CalamityUtils.GetLerpValue(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) @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss 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 < 10; num621++) + 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); Main.dust[num622].velocity *= 3f; @@ -114,7 +116,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + 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); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 7eb1df79a1..085d87a3e8 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -22,7 +23,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.hostile = true; projectile.ignoreWater = true; @@ -30,7 +32,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 200; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -56,19 +59,20 @@ namespace CalamityMod.Projectiles.Boss velocity = projectile.velocity; } + float timeGateValue = (!Main.dayTime || CalamityWorld.malice) ? 420f : 540f; if (projectile.ai[0] == 0f) { projectile.ai[1] += 1f; - float slowGateValue = 90f; + float slowGateValue = (!Main.dayTime || CalamityWorld.malice) ? 60f : 90f; float fastGateValue = 30f; - float minVelocity = 3f; - float maxVelocity = 12f; - float extremeVelocity = 16f; + float minVelocity = (!Main.dayTime || CalamityWorld.malice) ? 4f : 3f; + float maxVelocity = minVelocity * 4f; + float extremeVelocity = maxVelocity * 2f; float deceleration = 0.95f; float acceleration = 1.2f; - if (projectile.localAI[1] > 480f) + if (projectile.localAI[1] >= timeGateValue) { if (projectile.velocity.Length() < extremeVelocity) projectile.velocity *= acceleration; @@ -91,8 +95,8 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = 0.1f; - float amplitude = 2f; + float frequency = (!Main.dayTime || CalamityWorld.malice) ? 0.2f : 0.1f; + float amplitude = (!Main.dayTime || CalamityWorld.malice) ? 4f : 2f; projectile.ai[1] += frequency; @@ -101,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity = velocity + new Vector2(wavyVelocity, wavyVelocity).RotatedBy(MathHelper.ToRadians(velocity.ToRotation())) * amplitude; } - if (projectile.localAI[1] < 540f) + if (projectile.localAI[1] < timeGateValue) { projectile.localAI[1] += 1f; @@ -121,7 +125,7 @@ namespace CalamityMod.Projectiles.Boss int blue = projectile.ai[0] != 0f ? 0 : 125; Color baseColor = new Color(255, green, blue, 255); - if (!Main.dayTime) + if (!Main.dayTime || CalamityWorld.malice) { int red = projectile.ai[0] != 0f ? 100 : 175; green = projectile.ai[0] != 0f ? 255 : 175; @@ -134,7 +138,7 @@ namespace CalamityMod.Projectiles.Boss Color color34 = color33; Vector2 origin5 = value.Size() / 2f; Color color35 = color33 * 0.5f; - float num162 = CalamityUtils.GetLerpValue(15f, 30f, projectile.timeLeft, clamped: true) * CalamityUtils.GetLerpValue(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; @@ -169,8 +173,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 120); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffType, 180); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index c277a0d33f..a7d08fc10b 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -21,36 +21,53 @@ namespace CalamityMod.Projectiles.Boss 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), 0.01f, 0.25f, 0.25f); - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - int num3; - for (int num322 = 0; num322 < 2; num322 = num3 + 1) + 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; + + 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); Main.dust[num323].noGravity = true; Dust dust = Main.dust[num323]; dust.velocity *= 0.3f; - num3 = num322; } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item28, projectile.position); - } - } + + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= 255) + { + projectile.localAI[0] = 0f; + projectile.alpha = 255; + } + } + } public override Color? GetAlpha(Color lightColor) { - return 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 = 10; + int num497 = 5; Main.PlaySound(SoundID.Item27, projectile.position); int num3; for (int num498 = 0; num498 < num497; num498 = num3 + 1) @@ -77,7 +94,6 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(BuffID.Frostburn, 90, true); target.AddBuff(BuffID.Chilled, 60, true); - target.AddBuff(BuffID.Frozen, 30, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index 27a712eebd..4fb3419796 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -15,53 +15,111 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; + projectile.scale = 0.5f; projectile.hostile = true; - projectile.alpha = 50; projectile.penetrate = 1; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } - public override void AI() - { - projectile.velocity *= 0.99f; - } + public override bool CanHitPlayer(Player target) => projectile.ai[0] >= 120f; + + public override void AI() + { + projectile.velocity *= 0.99f; + + if (projectile.localAI[0] == 0f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= 255) + { + projectile.localAI[0] = 0f; + projectile.alpha = 255; + } + } + + 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); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[num624].velocity *= 2f; + } + + projectile.scale = 1f; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(30f * projectile.scale)); + Main.PlaySound(SoundID.Item30, projectile.Center); + } + } + } public override Color? GetAlpha(Color lightColor) { - return 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) { - Lighting.AddLight((int)((projectile.position.X + (projectile.width / 2)) / 16f), (int)((projectile.position.Y + (projectile.height / 2)) / 16f), 0.01f, 0.25f, 0.25f); Main.PlaySound(SoundID.Item27, projectile.position); + float spread = 60f * 0.0174f; double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; int i; + float velocity = 7f; if (projectile.owner == Main.myPlayer) { for (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(), projectile.damage, projectile.knockBack, 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, projectile.knockBack, projectile.owner, 1f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * velocity), (float)(Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * velocity), (float)(-Math.Cos(offsetAngle) * velocity), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); } } - for (int k = 0; k < 3; k++) - { + + 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); - } } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Frostburn, 120, true); - target.AddBuff(BuffID.Chilled, 90, true); - target.AddBuff(ModContent.BuffType(), 60); + if (projectile.ai[0] >= 120f) + { + target.AddBuff(BuffID.Frostburn, 120, true); + target.AddBuff(BuffID.Chilled, 90, true); + target.AddBuff(ModContent.BuffType(), 60); + } } } } diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index a1e388dafc..919add3fe6 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -16,10 +16,11 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 10; + projectile.height = 10; projectile.hostile = true; projectile.penetrate = -1; + projectile.timeLeft = 300; } public override void SendExtraAI(BinaryWriter writer) @@ -36,12 +37,32 @@ namespace CalamityMod.Projectiles.Boss { 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] != 2f) - projectile.aiStyle = 1; - if (projectile.ai[0] == 0f) { - projectile.velocity.Y += 0.2f; + if (projectile.velocity.Length() < projectile.ai[1]) + projectile.velocity *= 1.015f; + + 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); + Main.dust[num323].noGravity = true; + Dust dust = Main.dust[num323]; + dust.velocity *= 0.3f; + } + } + else if (projectile.ai[0] == 1f) + { + 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); + Main.dust[num323].noGravity = true; + Dust dust = Main.dust[num323]; + dust.velocity *= 0.3f; + } } else if (projectile.ai[0] == 2f) { @@ -54,30 +75,30 @@ namespace CalamityMod.Projectiles.Boss } if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.01f; - projectile.alpha -= 50; - if (projectile.alpha <= 0) - { - projectile.localAI[0] = 1f; - projectile.alpha = 0; - } - } - else - { - projectile.scale -= 0.01f; - projectile.alpha += 50; - if (projectile.alpha >= 255) - { - projectile.localAI[0] = 0f; - projectile.alpha = 255; - } - } - } + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= 255) + { + projectile.localAI[0] = 0f; + projectile.alpha = 255; + } + } + } public override Color? GetAlpha(Color lightColor) { - return 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) diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs new file mode 100644 index 0000000000..2ea08d80eb --- /dev/null +++ b/Projectiles/Boss/IchorBlob.cs @@ -0,0 +1,218 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class IchorBlob : ModProjectile + { + 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; + } + + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + 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(); + } + + public override void AI() + { + 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[0] += 10f; + projectile.damage = 0; + } + + // Kill the projectile 26 frames after it stops dealing damage + if (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); + + // Adjust projectile visibility based on the kill timer + projectile.alpha = (int)(100.0 + projectile.localAI[0] * 0.7); + + 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.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 1) + projectile.frame = 0; + } + else + { + // Prevent sliding + projectile.velocity.X = 0f; + + // Do not animate falling frames + projectile.ai[0] = 1f; + + if (projectile.frame < 2) + { + // Set frame to blob and frame counter to 0 + projectile.frame = 2; + projectile.frameCounter = 0; + + // Play squish sound + Main.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(); + 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); + Dust dust = Main.dust[num54]; + 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; + dust.velocity.Y -= 2f; + dust.velocity *= 2f; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.velocity += value4 * Main.rand.NextFloat(); + } + 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); + Dust dust = Main.dust[num56]; + 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; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + } + } + + projectile.rotation = 0f; + + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + 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; + + // Stop falling if water or lava is hit + if (projectile.wet || projectile.lavaWet) + { + projectile.velocity.Y = 0f; + } + else + { + // Fall + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y > 6f) + projectile.velocity.Y = 6f; + } + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = false; + return true; + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool CanHitPlayer(Player target) + { + Rectangle targetHitbox = target.Hitbox; + + Vector2 blobCenter = new Vector2(projectile.Center.X, projectile.Center.Y + 14f); + 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) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 16f && projectile.localAI[1] <= 900f && projectile.localAI[1] > 120f; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.localAI[1] > 900f) + { + 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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color 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) + target.AddBuff(BuffID.Ichor, 240); + } + } +} diff --git a/Projectiles/Boss/IchorBlob.png b/Projectiles/Boss/IchorBlob.png new file mode 100644 index 0000000000..d5292dbe27 Binary files /dev/null and b/Projectiles/Boss/IchorBlob.png differ diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index efaee0c312..0fef693982 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 12; + projectile.height = 12; projectile.hostile = true; projectile.tileCollide = false; projectile.timeLeft = 420; @@ -26,21 +26,19 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.timeLeft < 300) - projectile.tileCollide = true; + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.frameCounter++; + projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + 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); Main.dust[num469].noGravity = true; diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 8aeb0720a9..6026f9b7ed 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Yharon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,15 +10,18 @@ namespace CalamityMod.Projectiles.Boss { public class Infernado : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/Flarenado"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 320; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 320; projectile.height = 88; projectile.hostile = true; projectile.tileCollide = false; @@ -40,46 +44,37 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - int num613 = 18; - int num614 = 18; - float num615 = 1.5f; - int num616 = 320; - int num617 = 88; + float scaleBase = 36f; + float scaleMult = 1.5f; + float baseWidth = 320f; + float baseHeight = 88f; if (projectile.velocity.X != 0f) { projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); } - projectile.frameCounter++; if (projectile.frameCounter > 2) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - 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.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) { - 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 = (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)) @@ -98,7 +93,6 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) { projectile.ai[0] -= 1f; @@ -108,40 +102,31 @@ namespace CalamityMod.Projectiles.Boss { 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 -= baseHeight * projectile.scale / 2f; + float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * 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, 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) { float num622 = 0.104719758f; 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.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 = projectile.position.X + num624 * (float)-(float)projectile.direction; + projectile.position.X += num624 * -projectile.direction; } - int damage = Main.expertMode ? 130 : 150; if (projectile.timeLeft == 600) - projectile.damage = damage; - } + projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft > 600) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 600; - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 53, projectile.alpha); } @@ -157,7 +142,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 420); + if (projectile.timeLeft <= 600) + target.AddBuff(ModContent.BuffType(), 420); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/Infernado.png b/Projectiles/Boss/Infernado.png deleted file mode 100644 index d4d9ea492c..0000000000 Binary files a/Projectiles/Boss/Infernado.png and /dev/null differ diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index 13b5e3550e..2696b09953 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Yharon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,15 +10,18 @@ namespace CalamityMod.Projectiles.Boss { public class Infernado2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/Flarenado"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 12; } public override void SetDefaults() { - projectile.width = 320; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 320; projectile.height = 88; projectile.hostile = true; projectile.tileCollide = false; @@ -40,46 +44,37 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - int num613 = 24; - int num614 = 24; - float num615 = 1.5f; - int num616 = 320; - int num617 = 88; + float scaleBase = 48f; + float scaleMult = 1.5f; + float baseWidth = 320f; + float baseHeight = 88f; if (projectile.velocity.X != 0f) { projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); } - projectile.frameCounter++; if (projectile.frameCounter > 2) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - 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.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) { - 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 = (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)) @@ -98,7 +93,6 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 150; } } - if (projectile.ai[0] > 0f) { projectile.ai[0] -= 1f; @@ -108,40 +102,31 @@ namespace CalamityMod.Projectiles.Boss { 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 -= baseHeight * projectile.scale / 2f; + float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * 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, 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) { float num622 = 0.104719758f; 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.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 = projectile.position.X + num624 * (float)-(float)projectile.direction; + projectile.position.X += num624 * -projectile.direction; } - int damage = Main.expertMode ? 130 : 150; if (projectile.timeLeft == 720) - projectile.damage = damage; - } + projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft > 720) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 720; - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(255, 255, 53, projectile.alpha); } @@ -157,7 +142,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 420); + if (projectile.timeLeft <= 720) + target.AddBuff(ModContent.BuffType(), 420); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/Infernado2.png b/Projectiles/Boss/Infernado2.png deleted file mode 100644 index d4d9ea492c..0000000000 Binary files a/Projectiles/Boss/Infernado2.png and /dev/null differ diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index 652af9bf09..d6c43e35ea 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -1,26 +1,28 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using System.IO; using Terraria; -using Terraria.DataStructures; +using Terraria.Graphics.Shaders; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { public class InfernadoRevenge : ModProjectile { + internal PrimitiveTrail TornadoDrawer; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const int TornadoHeight = 8800; public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; } public override void SetDefaults() { projectile.width = 320; - projectile.height = 88; + projectile.height = 1020; projectile.hostile = true; projectile.tileCollide = false; projectile.ignoreWater = true; @@ -48,105 +50,62 @@ namespace CalamityMod.Projectiles.Boss projectile.netUpdate = true; return; } - int num613 = 35; - int num614 = 35; - float num615 = 3.5f; - int num616 = 320; - int num617 = 88; - if (projectile.velocity.X != 0f) - { - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - 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; - } - 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); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - 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); - 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); - } - if (projectile.ai[0] <= 0f) - { - float num622 = 0.104719758f; - float num623 = (float)projectile.width / 10f; - 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; - return; - } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); + internal Color ColorFunction(float completionRatio) + { + return Color.Lerp(Color.Yellow, Color.Yellow, completionRatio); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), + targetHitbox.Size(), + projectile.Bottom, + projectile.Bottom - Vector2.UnitY * TornadoHeight, + 72, + ref _); } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + 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); + if (TornadoDrawer is null) + 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")); + Vector2[] drawPoints = new Vector2[5]; + Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; + Vector2 downwardOffset = Vector2.UnitY * projectile.height / (drawPoints.Length + 1); + + 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)); + + drawPoints[drawPoints.Length - 1] = bottom; + TornadoDrawer.Draw(drawPoints, -Main.screenPosition, 85); + + Texture2D vortexTexture = ModContent.GetTexture("CalamityMod/Projectiles/Boss/OldDukeVortex"); + for (int i = 0; i < 110; i++) + { + float angle = MathHelper.TwoPi * i / 50f + Main.GlobalTime * MathHelper.TwoPi; + Color drawColor = Color.White * 0.04f; + drawColor.A = 0; + Vector2 drawPosition = bottom + angle.ToRotationVector2() * 4f - Main.screenPosition; + + drawPosition += (angle + Main.GlobalTime * i / 16f).ToRotationVector2() * 6f; + spriteBatch.Draw(vortexTexture, drawPosition, null, drawColor, angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, 0.9f, SpriteEffects.None, 0f); + } + return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0, false); - } + target.AddBuff(ModContent.BuffType(), 420); + } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { diff --git a/Projectiles/Boss/InfernadoRevenge.png b/Projectiles/Boss/InfernadoRevenge.png deleted file mode 100644 index d4d9ea492c..0000000000 Binary files a/Projectiles/Boss/InfernadoRevenge.png and /dev/null differ diff --git a/Projectiles/Boss/JewelProjectile.cs b/Projectiles/Boss/JewelProjectile.cs index ef72f0b9ce..95972426b6 100644 --- a/Projectiles/Boss/JewelProjectile.cs +++ b/Projectiles/Boss/JewelProjectile.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 10; projectile.penetrate = 2; projectile.hostile = true; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 3c210effe3..5796cdf15a 100644 --- a/Projectiles/Boss/LeviathanBomb.cs +++ b/Projectiles/Boss/LeviathanBomb.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 170; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 170; projectile.height = 170; projectile.scale = 0.75f; projectile.hostile = true; @@ -26,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 120; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -46,11 +48,6 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation += 0.1f; if (visible && projectile.alpha > 0) projectile.alpha -= 15; - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LeviathanRoarMeteor"), projectile.Center); - } projectile.localAI[0] += 1f; if (projectile.localAI[0] == 12f) { @@ -74,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss { Main.PlaySound(SoundID.Item14, projectile.position); projectile.Damage(); - for (int num621 = 0; num621 < 20; num621++) + 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); Main.dust[num622].velocity *= 3f; @@ -84,7 +81,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 30; num623++) + 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); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index b79d1986e2..54a381d9bb 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -19,13 +20,15 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 40; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 40; projectile.height = 40; projectile.hostile = true; projectile.penetrate = 1; projectile.timeLeft = 90; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -54,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss projectile.Kill(); } - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + int dustType = (Main.dayTime && !CalamityWorld.malice) ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; if (projectile.ai[1] == 0f) { for (int d = 0; d < 10; d++) @@ -92,12 +95,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/MoltenBlastNight"); + 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); @@ -106,7 +109,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - int blobAmt = Main.rand.Next(5, 10); + int blobAmt = (!Main.dayTime || CalamityWorld.malice) ? 9 : 6; if (projectile.owner == Main.myPlayer) { for (int b = 0; b < blobAmt; b++) @@ -117,12 +120,12 @@ namespace CalamityMod.Projectiles.Boss } Main.PlaySound(SoundID.Item20, projectile.Center); - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; - for (int num193 = 0; num193 < 3; num193++) + 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); } - for (int num194 = 0; num194 < 30; num194++) + for (int num194 = 0; num194 < 20; num194++) { int num195 = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 0, default, 2.5f); Main.dust[num195].noGravity = true; @@ -135,8 +138,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 180); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffType, 240); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index cbab067719..bd115c6f79 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -21,26 +22,27 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 12; projectile.hostile = true; projectile.penetrate = -1; - projectile.timeLeft = 1200; + projectile.timeLeft = 900; projectile.scale = 1.5f; cooldownSlot = 0; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { projectile.velocity.X *= 0.95f; + if (projectile.wet || projectile.lavaWet) { projectile.velocity.Y = 0f; } else { - projectile.velocity.Y = projectile.velocity.Y + 0.1f; + projectile.velocity.Y += 0.1f; if (projectile.velocity.Y > 5f) - { projectile.velocity.Y = 5f; - } } + projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -48,9 +50,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 1) - { projectile.frame = 0; - } } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) @@ -59,23 +59,16 @@ namespace CalamityMod.Projectiles.Boss return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; public override Color? GetAlpha(Color lightColor) { - return Main.dayTime ? 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 ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/MoltenBlobNight"); + 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); @@ -91,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss 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 ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + 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); @@ -111,7 +104,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); target.AddBuff(buffType, 90); } diff --git a/Projectiles/Boss/MushBomb.cs b/Projectiles/Boss/MushBomb.cs index 567f2809bc..aafb1f24b9 100644 --- a/Projectiles/Boss/MushBomb.cs +++ b/Projectiles/Boss/MushBomb.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 480; projectile.aiStyle = 1; aiType = ProjectileID.WoodenArrowFriendly; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.tileCollide = true; } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.3f / 255f); + Lighting.AddLight(projectile.Center, 0f, 0.15f, 0.3f); projectile.velocity.X *= 0.99f; } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 244bfa9449..97e10db02c 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity.Y = CalamityWorld.death ? 6f : 5f; + projectile.velocity.Y = CalamityWorld.malice ? 8f : CalamityWorld.death ? 6f : 5f; projectile.frameCounter++; if (projectile.frameCounter > 4) diff --git a/Projectiles/Boss/Mushmash.cs b/Projectiles/Boss/Mushmash.cs index c18ad09ed6..7c9e8086f8 100644 --- a/Projectiles/Boss/Mushmash.cs +++ b/Projectiles/Boss/Mushmash.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Boss { public class Mushmash : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mushmash"); diff --git a/Projectiles/Boss/Mushmash.png b/Projectiles/Boss/Mushmash.png deleted file mode 100644 index f0ea5c0e2a..0000000000 Binary files a/Projectiles/Boss/Mushmash.png and /dev/null differ diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index e51fb94960..d898d09bd5 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Boss projectile.timeLeft = 300; projectile.alpha = 255; cooldownSlot = 1; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } public override void AI() @@ -50,13 +51,13 @@ namespace CalamityMod.Projectiles.Boss projectile.rotation += projectile.velocity.X * 0.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; + 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 num470 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 1f); - Main.dust[num470].noGravity = true; - Main.dust[num470].velocity *= 0f; + 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) @@ -66,29 +67,28 @@ namespace CalamityMod.Projectiles.Boss int num226 = 8; 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; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 5, vector7.X, vector7.Y, 100, default, 1.2f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + 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; + Main.dust[blood].velocity = dustVel; } - for (int num623 = 0; num623 < 6; num623++) + for (int d = 0; d < 6; d++) { - int num624 = 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[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.SulfurousSeaAcid, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + 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); + Main.dust[acid].velocity *= 2f; + Main.dust[acid].noGravity = true; } } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Poisoned, 180, true); target.AddBuff(ModContent.BuffType(), 180); } @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 6a1a7b01a1..2af9d88ab3 100644 --- a/Projectiles/Boss/OldDukeSummonDrop.cs +++ b/Projectiles/Boss/OldDukeSummonDrop.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class OldDukeSummonDrop : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); @@ -71,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Boss/OldDukeSummonDrop.png b/Projectiles/Boss/OldDukeSummonDrop.png deleted file mode 100644 index f5e4db998f..0000000000 Binary files a/Projectiles/Boss/OldDukeSummonDrop.png and /dev/null differ diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index 37d32ae461..5bb7a66653 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 408; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 408; projectile.height = 408; projectile.scale = 0.004f; projectile.hostile = true; @@ -128,18 +129,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft > 1680 || projectile.timeLeft <= 85) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft <= 1680 && projectile.timeLeft > 85; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -161,7 +155,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 600); + if (projectile.timeLeft <= 1680 && projectile.timeLeft > 85) + target.AddBuff(ModContent.BuffType(), 600); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index 551badccfa..f9e6f4dc0f 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Projectiles.Boss { public class OverlyDramaticDukeSummoner : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/OldDukeVortex"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Old Duke Summoner"); @@ -144,11 +146,15 @@ namespace CalamityMod.Projectiles.Boss }), new Color(175, 75, 255)); return; } + + CalamityUtils.BossAwakenMessage(boomer); + Main.npc[boomer].velocity = Vector2.UnitY * -12f; Main.npc[boomer].alpha = 255; Main.npc[boomer].Calamity().newAI[3] = 1f; // To signal that Old Duke should not deccelerate as it normally would Main.npc[boomer].netUpdate = true; CalamityWorld.triedToSummonOldDuke = true; + CalamityWorld.encounteredOldDuke = true; AcidRainEvent.UpdateInvasion(false); } } diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.png b/Projectiles/Boss/OverlyDramaticDukeSummoner.png deleted file mode 100644 index b61dd72cd0..0000000000 Binary files a/Projectiles/Boss/OverlyDramaticDukeSummoner.png and /dev/null differ diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 4ee028bf2b..ef6668a366 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -17,14 +17,17 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 18; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 18; projectile.height = 18; projectile.hostile = true; - projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -45,46 +48,29 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] >= 30f) - { - projectile.ai[0] = 30f; - projectile.velocity.Y = projectile.velocity.Y + 0.035f; - } - float scaleFactor3 = 22f; - int num189 = Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; - vector20.Normalize(); - vector20 *= scaleFactor3; - int num190 = 80; - projectile.velocity = (projectile.velocity * (num190 - 1) + vector20) / num190; - if (projectile.velocity.Length() < 14f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 14f; - } - if (projectile.timeLeft > 180) - { - projectile.timeLeft = 180; - } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.velocity.Length() < 10f) + projectile.velocity *= 1.01f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { projectile.alpha -= 5; if (projectile.alpha < 30) - { projectile.alpha = 30; - } } + projectile.localAI[1] += 1f; if (projectile.localAI[1] == 24f) { projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - 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); + 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); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; @@ -103,12 +89,12 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item125, projectile.position); - 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 + (projectile.width / 2); + projectile.position.Y = projectile.position.Y + (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 - (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); @@ -117,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 5; num623++) diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index c87d356339..4520f37502 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -17,14 +17,17 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 18; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 18; projectile.height = 18; projectile.hostile = true; - projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -45,46 +48,29 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] >= 30f) - { - projectile.ai[0] = 30f; - projectile.velocity.Y = projectile.velocity.Y + 0.035f; - } - float scaleFactor3 = 25f; - int num189 = (int)Player.FindClosest(projectile.Center, 1, 1); - Vector2 vector20 = Main.player[num189].Center - projectile.Center; - vector20.Normalize(); - vector20 *= scaleFactor3; - int num190 = 90; - projectile.velocity = (projectile.velocity * (float)(num190 - 1) + vector20) / (float)num190; - if (projectile.velocity.Length() < 14f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 14f; - } - if (projectile.timeLeft > 180) - { - projectile.timeLeft = 180; - } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.velocity.Length() < 12f) + projectile.velocity *= 1.01f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { projectile.alpha -= 5; if (projectile.alpha < 30) - { projectile.alpha = 30; - } } + projectile.localAI[1] += 1f; if (projectile.localAI[1] == 24f) { projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - 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); + 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); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; @@ -103,12 +89,12 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item125, projectile.position); - 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 + (projectile.width / 2); + projectile.position.Y = projectile.position.Y + (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 - (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); @@ -117,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 5; num623++) diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index bd7c433b0b..4eab148cd1 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using System.IO; @@ -22,11 +23,11 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.extraUpdates = 2; projectile.penetrate = -1; projectile.timeLeft = 600; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -45,7 +46,9 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + projectile.localAI[0] += 1f; if (projectile.localAI[0] == 6f) { @@ -58,17 +61,21 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num152].noGravity = true; } } + if (projectile.localAI[0] > 9f) { projectile.alpha -= 5; if (projectile.alpha < 30) - { projectile.alpha = 30; - } } } - public override Color? GetAlpha(Color lightColor) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, projectile.alpha); } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index f7354d7961..34f9397844 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using System.IO; @@ -22,11 +23,11 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.extraUpdates = 2; projectile.penetrate = -1; projectile.timeLeft = 600; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -45,7 +46,9 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] = 1f; Main.PlaySound(SoundID.Item20, projectile.position); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + projectile.localAI[0] += 1f; if (projectile.localAI[0] == 6f) { @@ -58,17 +61,21 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num152].noGravity = true; } } + if (projectile.localAI[0] > 9f) { projectile.alpha -= 5; if (projectile.alpha < 30) - { projectile.alpha = 30; - } } } - public override Color? GetAlpha(Color lightColor) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, projectile.alpha); } diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index d7dacfd160..ba24575eef 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,7 +15,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 30; projectile.height = 30; projectile.hostile = true; projectile.penetrate = -1; @@ -24,14 +24,13 @@ namespace CalamityMod.Projectiles.Boss projectile.ignoreWater = true; projectile.timeLeft = 480; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 12f) - { - projectile.velocity *= 1.05f; - } + if (projectile.velocity.Length() < projectile.ai[0]) + projectile.velocity *= projectile.ai[1]; } public override Color? GetAlpha(Color lightColor) @@ -39,15 +38,17 @@ namespace CalamityMod.Projectiles.Boss return new Color(200, 200, 200, projectile.alpha); } - public override void Kill(int timeLeft) + public override bool CanHitPlayer(Player target) => projectile.velocity.Length() >= projectile.ai[0]; + + 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.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 - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + 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); @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 30; num623++) @@ -70,8 +71,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); + if (projectile.velocity.Length() >= projectile.ai[0]) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index ad79d9e30f..20ce067bf7 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class PhantomShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/PhantomHookShot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom Shot"); @@ -20,10 +22,12 @@ namespace CalamityMod.Projectiles.Boss projectile.width = 14; projectile.height = 14; projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 4; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 2; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Boss/PhantomShot.png b/Projectiles/Boss/PhantomShot.png deleted file mode 100644 index 0e94ae8cb8..0000000000 Binary files a/Projectiles/Boss/PhantomShot.png and /dev/null differ diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index a4d8559c89..1dc0296cb1 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class PhantomShot2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/PhantomGhostShot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Potent Phantom Shot"); @@ -20,10 +22,12 @@ namespace CalamityMod.Projectiles.Boss projectile.width = 14; projectile.height = 14; projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.alpha = 255; + projectile.penetrate = 3; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Boss/PhantomShot2.png b/Projectiles/Boss/PhantomShot2.png deleted file mode 100644 index bb6e4a3e19..0000000000 Binary files a/Projectiles/Boss/PhantomShot2.png and /dev/null differ diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index 96a616128f..9ed2a0abd3 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Boss { public class PlagueExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Stinger Explosion"); @@ -71,7 +73,7 @@ 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, 89, 0f, 0f, 100, default, 0.5f); + int num467 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, 0f, 0f, 100, default, 0.5f); Main.dust[num467].noGravity = true; Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; @@ -87,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/PlagueExplosion.png b/Projectiles/Boss/PlagueExplosion.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Boss/PlagueExplosion.png and /dev/null differ diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 9355b50714..7bb58f2f7e 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss int num123 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[0] += 1f; - if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) + if (projectile.ai[0] < 90f && projectile.ai[0] > 30f) { float scaleFactor2 = projectile.velocity.Length(); Vector2 vector17 = Main.player[num123].Center - projectile.Center; diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index dd2f44e3bc..e873aa37ae 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Boss { public class PlagueStingerGoliathV2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/PlagueStingerGoliath"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Exploding Plague Stinger"); @@ -24,7 +26,8 @@ namespace CalamityMod.Projectiles.Boss projectile.extraUpdates = 2; projectile.tileCollide = false; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -46,14 +49,13 @@ namespace CalamityMod.Projectiles.Boss { 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 vector = center - Main.screenPosition; - vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type]) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); + 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(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, - null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); + Main.spriteBatch.Draw(glow, drawPos, null, color, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.png b/Projectiles/Boss/PlagueStingerGoliathV2.png deleted file mode 100644 index b7b40b04b1..0000000000 Binary files a/Projectiles/Boss/PlagueStingerGoliathV2.png and /dev/null differ diff --git a/Projectiles/Boss/PlagueStingerGoliathV2Glow.png b/Projectiles/Boss/PlagueStingerGoliathV2Glow.png deleted file mode 100644 index 8abf1090f1..0000000000 Binary files a/Projectiles/Boss/PlagueStingerGoliathV2Glow.png and /dev/null differ diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index 062f25ed52..0788cf133c 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -19,15 +19,17 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; + 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; + } public override void SendExtraAI(BinaryWriter writer) { @@ -44,23 +46,19 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 210) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - projectile.alpha -= 3; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver4; + + if (projectile.alpha > 0) + projectile.alpha -= 17; + projectile.ai[1] += 1f; if (projectile.ai[1] <= 20f) - { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; - } + projectile.velocity *= 0.95f; else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) - { - projectile.velocity.X *= 1.1f; - projectile.velocity.Y *= 1.1f; - } + projectile.velocity *= 1.1f; else if (projectile.ai[1] == 40f) - { projectile.ai[1] = 0f; - } + projectile.localAI[0] += 1f; if (projectile.localAI[0] == 30f) { @@ -87,15 +85,15 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); } - + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/ProfanedSpear.png b/Projectiles/Boss/ProfanedSpear.png index da7ba8cfd4..9597288aff 100644 Binary files a/Projectiles/Boss/ProfanedSpear.png and b/Projectiles/Boss/ProfanedSpear.png differ diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 5680c48c3d..482e53a910 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -21,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss projectile.width = 160; projectile.height = 160; projectile.ignoreWater = true; - projectile.timeLeft = CalamityWorld.bossRushActive ? 1500 : (CalamityWorld.death ? 2100 : 3600); + projectile.timeLeft = BossRushEvent.BossRushActive ? 1500 : ((CalamityWorld.death || CalamityWorld.malice) ? 2100 : 3600); projectile.alpha = 255; projectile.tileCollide = false; projectile.penetrate = -1; @@ -48,6 +49,8 @@ namespace CalamityMod.Projectiles.Boss 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) @@ -73,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss } if (projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust dust34 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 267, 0f, 0f, 100, Main.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; @@ -81,24 +84,38 @@ namespace CalamityMod.Projectiles.Boss dust34.scale = 0.5f; } + float lifeRatio = projectile.ai[0]; + + // Increment timer projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= (Main.dayTime ? 300f : 30f)) + + // Spawn daytime shards every 300 frames + // Spawn nighttime shards every 30 frames + if (projectile.localAI[0] >= (dayTime ? 300f : 30f)) { - projectile.localAI[0] = 0f; - Main.PlaySound(SoundID.Item109, projectile.position); - projectile.netUpdate = true; - if (projectile.owner == Main.myPlayer) - { - int totalProjectiles = Main.dayTime ? 15 : (projectile.localAI[0] % 60f == 0f ? 15 : 10); - float speedX = Main.dayTime ? -21f : -15f; - float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); - float speedY = -3f; - for (int i = 0; i < totalProjectiles; i++) - { - float x4 = Main.dayTime ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX + speedAdjustment * i, speedY, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, x4, projectile.whoAmI); - } - } + // Spawn shards every 30 frames at night or at 300 frames during day + if (projectile.localAI[0] % 30f == 0f || dayTime) + { + Main.PlaySound(SoundID.Item109, projectile.position); + projectile.netUpdate = true; + if (projectile.owner == Main.myPlayer) + { + 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; + for (int i = 0; i < totalProjectiles; i++) + { + 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); + } + } + + // Reset timer + if (projectile.localAI[0] >= 60f) + projectile.localAI[0] = 0f; + } } } @@ -115,10 +132,10 @@ namespace CalamityMod.Projectiles.Boss 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(6.28318548f * (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 * 1.57079637f; + 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); } diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index d95955e4c7..357096060b 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -16,12 +17,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 34; + 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; } @@ -40,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (!Main.dayTime) + if (!Main.dayTime || CalamityWorld.malice) projectile.extraUpdates = 1; if (projectile.timeLeft < 300) @@ -68,7 +71,7 @@ namespace CalamityMod.Projectiles.Boss else { projectile.velocity.Y *= 1.06f; - float fallSpeed = (CalamityWorld.revenge || CalamityWorld.bossRushActive || !Main.dayTime) ? 3.5f : 3f; + float fallSpeed = (CalamityWorld.revenge || BossRushEvent.BossRushActive || !Main.dayTime || CalamityWorld.malice) ? 3.5f : 3f; if (projectile.velocity.Y > fallSpeed) { projectile.velocity.Y = fallSpeed; diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 820bdb9bcf..6cd9c2ba04 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.NPCs.Providence; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -20,7 +21,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 48; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 48; projectile.height = 48; projectile.hostile = true; projectile.alpha = 255; @@ -44,6 +46,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + bool scissorLasers = CalamityWorld.revenge || !Main.dayTime || BossRushEvent.BossRushActive || CalamityWorld.malice; Vector2? vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) @@ -56,6 +59,8 @@ namespace CalamityMod.Projectiles.Boss 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(); if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) { @@ -64,13 +69,13 @@ namespace CalamityMod.Projectiles.Boss float num801 = 1f; projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 100f : 180f)) + if (projectile.localAI[0] >= (scissorLasers ? 100f : 180f)) { projectile.Kill(); return; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / ((CalamityWorld.revenge || CalamityWorld.bossRushActive) ? 100f : 180f)) * 10f * num801; + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * num801; if (projectile.scale > num801) { projectile.scale = num801; @@ -78,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss float num804 = projectile.velocity.ToRotation(); num804 += projectile.ai[0]; - projectile.rotation = num804 - 1.57079637f; + projectile.rotation = num804 - MathHelper.PiOver2; projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; //3f @@ -105,13 +110,13 @@ namespace CalamityMod.Projectiles.Boss num807 = 2400f; } - int dustType = Main.dayTime ? (int)CalamityDusts.ProfanedFire : (int)CalamityDusts.Nightwither; + 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); for (int num809 = 0; num809 < 2; num809++) { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + 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); @@ -121,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(5)) { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, 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; @@ -138,11 +143,12 @@ namespace CalamityMod.Projectiles.Boss { return false; } - Texture2D texture2D19 = Main.dayTime ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight"); - Texture2D texture2D20 = Main.dayTime ? ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid") : ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight"); - Texture2D texture2D21 = Main.dayTime ? ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd") : ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight"); + 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 - Color color44 = Main.dayTime ? new Color(250, 250, 250, 0) : new Color(175, 175, 250, 0) * 0.9f; + Color color44 = dayTime ? new Color(250, 250, 250, 0) : new Color(175, 175, 250, 0) * 0.9f; 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); @@ -152,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 36 * (projectile.timeLeft / 3 % 4), texture2D20.Width, 36); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) @@ -162,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss 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 += 16; + rectangle7.Y += 36; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { rectangle7.Y = 0; @@ -198,8 +204,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - int buffType = Main.dayTime ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 300); + int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); + target.AddBuff(buffType, 420); } 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 7bbbeeb4f9..dbce83205c 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Boss { public class RavagerFlame : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blue Flame"); @@ -21,15 +23,17 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.alpha = 255; projectile.penetrate = 1; - projectile.timeLeft = 180; + projectile.timeLeft = 300; projectile.aiStyle = 1; - } + projectile.extraUpdates = CalamityWorld.malice ? 2 : 1; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { for (int num468 = 0; num468 < 2; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; } diff --git a/Projectiles/Boss/RavagerFlame.png b/Projectiles/Boss/RavagerFlame.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Boss/RavagerFlame.png and /dev/null differ diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index 93ce2b4b0f..2770a97bb0 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Boss { public class RedLightning : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LightningProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Red Lightning"); @@ -19,7 +21,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 14; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 14; projectile.height = 14; projectile.hostile = true; projectile.alpha = 255; diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index fe11fd9473..fac0313295 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 1200; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -57,18 +58,19 @@ namespace CalamityMod.Projectiles.Boss 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) { int num103 = Player.FindClosest(projectile.Center, 1, 1); - projectile.ai[1] += 1f; - if (projectile.ai[1] <= timeGateValue) + if (projectile.ai[0] <= timeGateValue2) { - if (projectile.ai[1] == timeGateValue) + if (projectile.ai[0] == timeGateValue2) { - Vector2 v4 = Main.player[num103].Center + Main.player[num103].velocity * 20f - 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; @@ -77,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity = Vector2.Normalize(v4) * 18f; } - else if (projectile.ai[1] > timeGateValue - 30f) + else if (projectile.ai[0] > timeGateValue2 - 30f) { if (projectile.velocity.Length() > 2f) projectile.velocity *= 0.9f; @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, Main.projectileTexture[projectile.type], false); return false; } diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs new file mode 100644 index 0000000000..eb6ca69f86 --- /dev/null +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -0,0 +1,78 @@ +using CalamityMod.Dusts; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Skies; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class SCalRitualDrama : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float Time => ref projectile.ai[0]; + public const int PulseTime = 45; + 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; + } + + public override void AI() + { + 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; + + int fireReleaseRate = Time > 150f ? 2 : 1; + for (int i = 0; i < fireReleaseRate; i++) + { + if (Main.rand.NextBool(4)) + { + 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; + brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.5f, 2.8f); + brimstone.noGravity = true; + } + } + + Time++; + } + + public override void Kill(int timeLeft) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + 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); + + Main.LocalPlayer.Calamity().GeneralScreenShakePower = Utils.InverseLerp(3400f, 1560f, Main.LocalPlayer.Distance(projectile.Center), true) * 16f; + + // Generate a dust explosion + float burstDirectionVariance = 3; + float burstSpeed = 14f; + for (int j = 0; j < 16; j++) + { + burstDirectionVariance += j * 2; + for (int k = 0; k < 40; k++) + { + 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; + burstDust.noGravity = true; + } + burstSpeed += 1.8f; + } + } + } +} diff --git a/Projectiles/Boss/SandBlast.cs b/Projectiles/Boss/SandBlast.cs index 62c780ae9a..3a737fe118 100644 --- a/Projectiles/Boss/SandBlast.cs +++ b/Projectiles/Boss/SandBlast.cs @@ -25,7 +25,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = 1; projectile.timeLeft = 600; projectile.alpha = 255; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss } } projectile.ai[1] = 1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 21); } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; projectile.alpha -= 50; @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + 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 c9894eee49..38e835c8eb 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -1,6 +1,5 @@ -using CalamityMod.World; +using CalamityMod.Buffs.StatDebuffs; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -15,15 +14,17 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 32; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 32; projectile.height = 32; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.timeLeft = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 2100 : 1800; - } + projectile.timeLeft = 1800; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { @@ -36,9 +37,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } projectile.velocity *= 0.995f; @@ -59,24 +58,16 @@ namespace CalamityMod.Projectiles.Boss { projectile.alpha -= 30; if (projectile.alpha < 30) - { projectile.alpha = 30; - } } } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft < 180) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 180; public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - } + if (projectile.timeLeft >= 180) + target.AddBuff(ModContent.BuffType(), 240, true); + } } } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs new file mode 100644 index 0000000000..c5f1f60bba --- /dev/null +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -0,0 +1,79 @@ +using CalamityMod.Buffs.StatDebuffs; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class SandPoisonCloudOldDuke : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/SandPoisonCloud"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Toxic Cloud"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.alpha = 255; + 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); + + projectile.frameCounter++; + if (projectile.frameCounter > 9) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + projectile.velocity *= 0.995f; + + if (projectile.timeLeft < 180) + { + projectile.damage = 0; + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + } + } + } + else if (projectile.alpha > 30) + { + projectile.alpha -= 30; + if (projectile.alpha < 30) + projectile.alpha = 30; + } + } + + public override bool CanHitPlayer(Player target) => projectile.timeLeft >= 180; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.timeLeft >= 180) + target.AddBuff(ModContent.BuffType(), 240, true); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/SandTooth.cs b/Projectiles/Boss/SandTooth.cs index 4accbc05e5..0b5a1fc8fe 100644 --- a/Projectiles/Boss/SandTooth.cs +++ b/Projectiles/Boss/SandTooth.cs @@ -20,11 +20,12 @@ namespace CalamityMod.Projectiles.Boss projectile.ignoreWater = true; projectile.penetrate = 1; projectile.timeLeft = 450; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num103 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; if (projectile.ai[1] < 250f && projectile.ai[1] > 60f) { @@ -36,14 +37,7 @@ namespace CalamityMod.Projectiles.Boss projectile.velocity.Normalize(); projectile.velocity *= scaleFactor2; } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) //18 - { - projectile.velocity *= 1.01f; - } - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/SandToothOldDuke.cs b/Projectiles/Boss/SandToothOldDuke.cs new file mode 100644 index 0000000000..fa22b735e0 --- /dev/null +++ b/Projectiles/Boss/SandToothOldDuke.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Boss +{ + public class SandToothOldDuke : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/SandTooth"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sand Tooth"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 450; + cooldownSlot = 1; + 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) + { + 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.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); + return false; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index d5d713b30a..197b1928a2 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,8 +21,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 16; + projectile.height = 16; projectile.hostile = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -43,7 +44,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; + projectile.frameCounter++; if (projectile.frameCounter > 5) { @@ -51,14 +53,30 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 4) - { projectile.frame = 0; - } + projectile.alpha -= 40; if (projectile.alpha < 0) - { projectile.alpha = 0; - } + + 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); + Main.dust[num805].noGravity = true; + } + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (projectile.ai[1] == -1f) + { + if (projectile.velocity.Length() < 18f) + projectile.velocity *= 1.05f; + else + projectile.tileCollide = true; + + return; + } + if (projectile.ai[0] == 0f) { projectile.localAI[0] += 1f; @@ -66,20 +84,18 @@ namespace CalamityMod.Projectiles.Boss { projectile.localAI[0] = 0f; projectile.ai[0] = 1f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); + 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.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) { @@ -88,78 +104,63 @@ namespace CalamityMod.Projectiles.Boss 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.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) { 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; if (vector70.Length() < 20f) { projectile.Kill(); return; } + vector70.Normalize(); vector70 *= 14f; 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) { 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) { 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) { 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) { projectile.velocity.Y = projectile.velocity.Y - num804; if (projectile.velocity.Y > 0f && vector70.Y < 0f) - { projectile.velocity.Y = projectile.velocity.Y - num804; - } } } - 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); - Main.dust[num805].noGravity = true; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; } public override void OnHitPlayer(Player target, int damage, bool crit) @@ -169,12 +170,12 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255, 0, 0, projectile.alpha); + return new Color(255, 50, 50, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -183,8 +184,8 @@ namespace CalamityMod.Projectiles.Boss 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 - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + 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); diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index 7eb944406a..bf0ea05ad3 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -16,24 +17,25 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 44; + 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 = 720; + projectile.timeLeft = 600; } public override void AI() { - bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; - projectile.ai[1] += 1f; - if (projectile.ai[1] > 480) - { + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + + if (projectile.timeLeft < 180) projectile.tileCollide = true; - } + projectile.frameCounter++; if (projectile.frameCounter > 18) { @@ -41,51 +43,34 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame > 4) - { projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - float num953 = revenge ? 75f : 60f; - float scaleFactor12 = revenge ? 15f : 12f; - float num954 = 40f; + + 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; - } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); + 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) > 320f) { - Vector2 vector102 = projectile.DirectionTo(Main.player[num959].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + 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.ai[0] != -1f) { projectile.ai[0] = -1f; @@ -99,8 +84,8 @@ namespace CalamityMod.Projectiles.Boss 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.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++) { @@ -109,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 40; num623++) diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index b299bc960e..e4979333ed 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -16,6 +17,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 28; projectile.tileCollide = false; projectile.ignoreWater = true; + projectile.hostile = true; projectile.timeLeft = 360; projectile.penetrate = -1; } @@ -54,5 +56,10 @@ namespace CalamityMod.Projectiles.Boss } } } - } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + } } diff --git a/Projectiles/Boss/ShaderainHostile.cs b/Projectiles/Boss/ShaderainHostile.cs index ec37178598..4922760741 100644 --- a/Projectiles/Boss/ShaderainHostile.cs +++ b/Projectiles/Boss/ShaderainHostile.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.ignoreWater = true; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { diff --git a/Projectiles/Boss/ShadowflameFireball.cs b/Projectiles/Boss/ShadowflameFireball.cs index 05edeffdc7..0aebe9fd6b 100644 --- a/Projectiles/Boss/ShadowflameFireball.cs +++ b/Projectiles/Boss/ShadowflameFireball.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Boss { public class ShadowflameFireball : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowflame Fireball"); @@ -24,7 +26,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 360; projectile.scale = 1.25f; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { diff --git a/Projectiles/Boss/ShadowflameFireball.png b/Projectiles/Boss/ShadowflameFireball.png deleted file mode 100644 index 5e32565ac9..0000000000 Binary files a/Projectiles/Boss/ShadowflameFireball.png and /dev/null differ diff --git a/Projectiles/Boss/Shadowflamethrower.cs b/Projectiles/Boss/Shadowflamethrower.cs index 8fd05b46d6..cfe5e4d2ba 100644 --- a/Projectiles/Boss/Shadowflamethrower.cs +++ b/Projectiles/Boss/Shadowflamethrower.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Boss { public class Shadowflamethrower : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowflame Breath"); @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.extraUpdates = 3; projectile.timeLeft = 60; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { diff --git a/Projectiles/Boss/Shadowflamethrower.png b/Projectiles/Boss/Shadowflamethrower.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Boss/Shadowflamethrower.png and /dev/null differ diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index b367ebcf9b..9391090f77 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -26,11 +26,12 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.timeLeft = 600; + projectile.timeLeft = 420; projectile.alpha = 100; projectile.penetrate = -1; cooldownSlot = 1; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -48,52 +49,28 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.rotation += 0.5f * (float)projectile.direction; + projectile.rotation += 0.5f * projectile.direction; + if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; Main.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); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; + projectile.ai[0] += 1f; - if (projectile.ai[0] > 180f) + if (projectile.ai[0] >= 150f) { - if (projectile.ai[1] > 0f) + if (projectile.ai[1] > 0f && projectile.ai[0] < 160f) { int num625 = (int)projectile.ai[1] - 1; if (num625 < Main.maxPlayers) { Vector2 value16 = Main.player[num625].Center - projectile.Center; - if (value16.Length() < 200f || counter > 0) - { - counter--; - if (counter <= 0 && projectile.localAI[0] == 2f) - { - projectile.Kill(); - return; - } - if (projectile.localAI[0] < 2f) - { - projectile.localAI[0] = 2f; - float speed = 30f; - Vector2 vector167 = new Vector2(projectile.Center.X + (float)(projectile.direction * 20), projectile.Center.Y + 6f); - float num1373 = Main.player[num625].position.X + (float)Main.player[num625].width * 0.5f - vector167.X; - float num1374 = Main.player[num625].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = speed / num1375; - num1373 *= num1376; - num1374 *= num1376; - projectile.velocity.X = (projectile.velocity.X * 50f + num1373) / 51f; - projectile.velocity.Y = (projectile.velocity.Y * 50f + num1374) / 51f; - counter = 90; - } - } - else - { - projectile.velocity = Vector2.Normalize(value16) * 15f; - } + projectile.velocity = Vector2.Normalize(value16) * 22f; } } } @@ -101,25 +78,18 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft > 515) - { - projectile.localAI[1] += 1f; - byte b2 = (byte)(((int)projectile.localAI[1]) * 3); - byte a2 = (byte)(projectile.alpha * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } return new Color(255, 255, 255, projectile.alpha); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } - public override void OnHitPlayer(Player target, int damage, bool crit) + public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) @@ -132,7 +102,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 10; num623++) diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 214f2b29d9..e32ec24404 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 960; projectile.Opacity = 0f; - } + } public override void SendExtraAI(BinaryWriter writer) { @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Boss/SkyFlare.cs b/Projectiles/Boss/SkyFlare.cs index 457fdc6e5f..e921c7aa24 100644 --- a/Projectiles/Boss/SkyFlare.cs +++ b/Projectiles/Boss/SkyFlare.cs @@ -1,3 +1,4 @@ +using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -27,8 +28,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; + projectile.velocity *= 0.9995f; int addStuff = Main.rand.Next(5); blowTimer += addStuff; if (blowTimer >= 900) @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - bool revenge = CalamityWorld.revenge; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice; Main.PlaySound(SoundID.Item20, projectile.position); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 7a65e48579..f39d157b8c 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -1,12 +1,16 @@ +using CalamityMod.NPCs.Yharon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class SkyFlareRevenge : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/SkyFlare"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sky Flare"); @@ -54,22 +58,24 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item20, projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) { - 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; + 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) { - int num235 = 100; - int num236 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), num235, 4f, Main.myPlayer, 16f, 50f); - Main.projectile[num236].netUpdate = true; + 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; + Main.projectile[nado].netUpdate = true; } } diff --git a/Projectiles/Boss/SkyFlareRevenge.png b/Projectiles/Boss/SkyFlareRevenge.png deleted file mode 100644 index e3b21436ca..0000000000 Binary files a/Projectiles/Boss/SkyFlareRevenge.png and /dev/null differ diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index e2e5736f50..0b7b154d92 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -18,13 +18,15 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 32; + 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) { @@ -39,7 +41,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { projectile.ai[1] += 1f; - if (projectile.ai[1] > 570f) + if (projectile.ai[1] > 1800f) { projectile.localAI[0] += 10f; projectile.damage = 0; @@ -53,26 +55,30 @@ namespace CalamityMod.Projectiles.Boss 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 + (double)projectile.localAI[0] * 0.7); + projectile.alpha = (int)(100.0 + projectile.localAI[0] * 0.7); projectile.rotation += projectile.velocity.X * 0.02f; - projectile.rotation += (float)projectile.direction * 0.002f; + projectile.rotation += projectile.direction * 0.002f; if (projectile.velocity.Length() > 0.5f) projectile.velocity *= 0.98f; } - public override bool CanHitPlayer(Player target) - { - if (projectile.ai[1] > 570f) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.ai[1] <= 1800f && projectile.ai[1] > 120f; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override Color? GetAlpha(Color lightColor) + { + if (projectile.ai[1] > 1800f) + { + 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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - //Changes the texture of the projectile + // Changes the texture of the projectile Texture2D texture = Main.projectileTexture[projectile.type]; switch ((int)projectile.ai[0]) { @@ -87,14 +93,14 @@ namespace CalamityMod.Projectiles.Boss default: break; } - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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) { - target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 120); + if (projectile.ai[1] <= 1800f && projectile.ai[1] > 120f) + target.AddBuff(BuffID.Poisoned, 240); } } } diff --git a/Projectiles/Boss/VileClot.cs b/Projectiles/Boss/VileClot.cs index f7b5d088ef..f4a7c8f51b 100644 --- a/Projectiles/Boss/VileClot.cs +++ b/Projectiles/Boss/VileClot.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.penetrate = -1; projectile.timeLeft = 300; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void AI() { diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index f7b0b3370d..3ebf575324 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.timeLeft = 300; projectile.Opacity = 0f; - } + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -65,6 +66,7 @@ namespace CalamityMod.Projectiles.Boss projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 270) / 30f), 0f, 1f); projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + Lighting.AddLight(projectile.Center, 0f, 0f, 0.5f * projectile.Opacity); } @@ -75,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss lightColor.R = (byte)(255 * projectile.Opacity); lightColor.G = (byte)(255 * projectile.Opacity); lightColor.B = (byte)(255 * projectile.Opacity); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -86,13 +88,5 @@ namespace CalamityMod.Projectiles.Boss Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (projectile.Opacity != 1f) - return; - - target.AddBuff(BuffID.Wet, 240); - } } } diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 6644565178..0fc17a5f0e 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -16,14 +16,16 @@ 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; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 34; + projectile.height = 34; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; @@ -33,6 +35,21 @@ namespace CalamityMod.Projectiles.Boss cooldownSlot = 1; } + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + projectile.rotation += MathHelper.Pi; + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(speedX); @@ -47,10 +64,7 @@ namespace CalamityMod.Projectiles.Boss speedX2 = reader.ReadSingle(); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -85,31 +99,28 @@ namespace CalamityMod.Projectiles.Boss { for (int x = 0; x < 3; x++) { - Projectile.NewProjectile((int)projectile.Center.X, (int)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((int)projectile.Center.X, (int)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; } } - 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 < 2; num193++) + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + for (int d = 0; d < 2; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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 num194 = 0; num194 < 20; num194++) + for (int d = 0; d < 20; d++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 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, 55, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } } diff --git a/Projectiles/Boss/YharonFireball.png b/Projectiles/Boss/YharonFireball.png index 6a4eedebff..53de4ae83f 100644 Binary files a/Projectiles/Boss/YharonFireball.png and b/Projectiles/Boss/YharonFireball.png differ diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index 26cb43809f..7ba7cd8a79 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -10,70 +10,80 @@ namespace CalamityMod.Projectiles.Boss { public class YharonFireball2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/YharonFireball"; + 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; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + 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; + } public override void SendExtraAI(BinaryWriter writer) { 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(); } public override void AI() { - if (projectile.velocity.Y < 0f) + projectile.frameCounter++; + if (projectile.frameCounter > 4) { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; + + if (projectile.velocity.Y < -1f) + { + // 129 frames to get from -50 to -1 projectile.velocity.Y *= 0.97f; } else { - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.Y > 16f) - { + // 85 frames to get from -1 to 16 + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 16f) projectile.velocity.Y = 16f; - } - } - if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 1f; } + projectile.velocity.X *= 0.995f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); } + if (projectile.ai[0] >= 2f) { 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); @@ -82,52 +92,40 @@ namespace CalamityMod.Projectiles.Boss } } - public override bool CanHitPlayer(Player target) - { - if (projectile.velocity.Y < -16f) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.velocity.Y >= -16f; - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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); - 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 < 2; num193++) + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + for (int d = 0; d < 2; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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 num194 = 0; num194 < 20; num194++) + for (int d = 0; d < 20; d++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 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, 55, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } projectile.Damage(); } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + if (projectile.velocity.Y >= -16f) + target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/YharonFireball2.png b/Projectiles/Boss/YharonFireball2.png deleted file mode 100644 index 6a4eedebff..0000000000 Binary files a/Projectiles/Boss/YharonFireball2.png and /dev/null differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 4562cb12cf..a6b5708cd6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,19 +1,16 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; -using CalamityMod.Dusts; +using CalamityMod.Events; +using CalamityMod.Items.Accessories; +using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Healing; -using CalamityMod.Projectiles.Hybrid; -using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Yoyos; -using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; -using CalamityMod.Projectiles.Typeless.FiniteUse; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -22,11 +19,14 @@ using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; using static Terraria.ModLoader.ModContent; +using NanotechProjectile = CalamityMod.Projectiles.Typeless.Nanotech; + namespace CalamityMod.Projectiles { - public class CalamityGlobalProjectile : GlobalProjectile + public class CalamityGlobalProjectile : GlobalProjectile { public override bool InstancePerEntity { @@ -36,147 +36,809 @@ namespace CalamityMod.Projectiles } } - // Class Types - public bool rogue = false; + // Class Types + public bool rogue = false; public bool trueMelee = false; - // Force Class Types - public bool forceMelee = false; + // Force Class Types + public bool forceMelee = false; public bool forceRanged = false; public bool forceMagic = false; - public bool forceMinion = false; - public bool forceRogue = false; - public bool forceTypeless = false; - public bool forceHostile = false; + public bool forceMinion = false; + public bool forceRogue = false; + public bool forceTypeless = false; + public bool forceHostile = false; // Damage Adjusters private bool setDamageValues = true; public float spawnedPlayerMinionDamageValue = 1f; + public float PierceResistHarshness = 0.12f; + public float PierceResistCap = 0.8f; public int spawnedPlayerMinionProjectileDamageValue = 0; public int defDamage = 0; - public int defCrit = 0; + + // Amount of extra updates that are set in SetDefaults. + public int defExtraUpdates = -1; + + // How many times this projectile has pierced. + public int timesPierced = 0; + + // Point-blank shot timer. + public int pointBlankShotDuration = 0; + public const int basePointBlankShotDuration = 12; + + /// + /// Allows hostile Projectiles to deal damage to the player's defense stat, used mostly for hard-hitting bosses. + /// + public bool canBreakPlayerDefense = false; // Rogue Stuff - public bool stealthStrike = false; //Update all existing rogue weapons with this - public bool momentumCapacitatorBoost = false; //Constant acceleration + public bool stealthStrike = false; // Update all existing rogue weapons with this + public bool momentumCapacitatorBoost = false; // Constant acceleration // Iron Heart public int ironHeartDamage = 0; // Counters and Timers - private int counter = 0; - public int stealthStrikeHitCount = 0; + public int stealthStrikeHitCount = 0; - public int lineColor = 0; //Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben + public int lineColor = 0; // Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben public bool extorterBoost = false; - // Organic/Inorganic Boosts - public bool hasOrganicEnemyHitBoost = false; - public bool hasInorganicEnemyHitBoost = false; - public float organicEnemyHitBoost = 0f; - public float inorganicEnemyHitBoost = 0f; - public Action organicEnemyHitEffect = null; - public Action inorganicEnemyHitEffect = null; + // Organic/Inorganic Boosts + public bool hasOrganicEnemyHitBoost = false; + public bool hasInorganicEnemyHitBoost = false; + public float organicEnemyHitBoost = 0f; + public float inorganicEnemyHitBoost = 0f; + public Action organicEnemyHitEffect = null; + public Action inorganicEnemyHitEffect = null; - public bool overridesMinionDamagePrevention = false; + // Dogshit, hacky workarounds for the summon respawning system + public bool RequiresManualResurrection = false; + + public bool overridesMinionDamagePrevention = false; + + public static List MechBossProjectileIDs = new List + { + ProjectileID.DeathLaser, + ProjectileID.PinkLaser, + ProjectileID.BombSkeletronPrime, + ProjectileID.CursedFlameHostile, + ProjectileID.EyeFire, + ProjectileID.EyeLaser, + ProjectileID.Skull, + ProjectileID.SaucerMissile, + ProjectileID.RocketSkeleton, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + }; + + // Boss projectile velocity multiplier in Malice Mode + public bool affectedByMaliceModeVelocityMultiplier = false; + public const float MaliceModeProjectileVelocityMultiplier = 1.25f; + public const float BossRushProjectileVelocityMultiplier = 1.35f; + + // Enchantment variables. + public int ExplosiveEnchantCountdown = 0; + public const int ExplosiveEnchantTime = 2400; #region SetDefaults - public override void SetDefaults(Projectile projectile) - { - if (CalamityMod.trueMeleeProjectileList.Contains(projectile.type)) - trueMelee = true; + public override void SetDefaults(Projectile projectile) + { + if (CalamityLists.trueMeleeProjectileList.Contains(projectile.type)) + trueMelee = true; - switch (projectile.type) - { - case ProjectileID.ShadowBeamHostile: - projectile.timeLeft = 60; + switch (projectile.type) + { + case ProjectileID.Bullet: + case ProjectileID.MeteorShot: + case ProjectileID.BulletHighVelocity: + case ProjectileID.ChlorophyteBullet: + case ProjectileID.CrystalBullet: + case ProjectileID.CursedBullet: + case ProjectileID.ExplosiveBullet: + case ProjectileID.GoldenBullet: + case ProjectileID.IchorBullet: + case ProjectileID.MoonlordBullet: + case ProjectileID.NanoBullet: + case ProjectileID.PartyBullet: + case ProjectileID.VenomBullet: + case ProjectileID.WoodenArrowFriendly: + case ProjectileID.BeeArrow: + case ProjectileID.BoneArrow: + case ProjectileID.ChlorophyteArrow: + case ProjectileID.CursedArrow: + case ProjectileID.FireArrow: + case ProjectileID.FrostArrow: + case ProjectileID.FrostburnArrow: + case ProjectileID.HellfireArrow: + case ProjectileID.HolyArrow: + case ProjectileID.IchorArrow: + case ProjectileID.JestersArrow: + case ProjectileID.MoonlordArrow: + case ProjectileID.PhantasmArrow: + case ProjectileID.ShadowFlameArrow: + case ProjectileID.UnholyArrow: + case ProjectileID.VenomArrow: + case ProjectileID.Hellwing: + case ProjectileID.Flare: + case ProjectileID.BlueFlare: + case ProjectileID.Seed: + case ProjectileID.CrystalDart: + case ProjectileID.CursedDart: + case ProjectileID.PoisonDartBlowgun: + case ProjectileID.SnowBallFriendly: + case ProjectileID.SandBallGun: + case ProjectileID.PearlSandBallGun: + case ProjectileID.CrimsandBallGun: + case ProjectileID.EbonsandBallGun: + case ProjectileID.PainterPaintball: + case ProjectileID.Harpoon: + case ProjectileID.DD2PhoenixBowShot: + case ProjectileID.PulseBolt: + case ProjectileID.Stake: + case ProjectileID.CandyCorn: + case ProjectileID.Blizzard: + case ProjectileID.LostSoulFriendly: + pointBlankShotDuration = basePointBlankShotDuration; break; - case ProjectileID.LostSoulHostile: - projectile.tileCollide = true; - break; - - case ProjectileID.NebulaLaser: + case ProjectileID.FlamingJack: + case ProjectileID.Anchor: + case ProjectileID.Sunfury: + case ProjectileID.FlowerPow: + case ProjectileID.EnchantedBoomerang: + case ProjectileID.IceBoomerang: + case ProjectileID.FruitcakeChakram: projectile.extraUpdates = 1; break; - case ProjectileID.StarWrath: - projectile.penetrate = projectile.maxPenetrate = 1; + case ProjectileID.BlueMoon: + case ProjectileID.Flamarang: + projectile.extraUpdates = 2; break; - case ProjectileID.Retanimini: - case ProjectileID.MiniRetinaLaser: - projectile.localNPCHitCooldown = 10; + case ProjectileID.Arkhalis: + case ProjectileID.ButchersChainsaw: + projectile.scale = 1.5f; + break; + + case ProjectileID.MonkStaffT1: + projectile.scale = 3f; + break; + + case ProjectileID.ShadowBeamHostile: + projectile.timeLeft = 60; + break; + + case ProjectileID.LostSoulHostile: + projectile.tileCollide = true; + break; + + case ProjectileID.NebulaLaser: + projectile.extraUpdates = 1; + break; + + case ProjectileID.StarWrath: + projectile.penetrate = projectile.maxPenetrate = 1; + break; + + case ProjectileID.MonkStaffT2: + projectile.idStaticNPCHitCooldown = 18; + break; + + case ProjectileID.MonkStaffT3: + case ProjectileID.MonkStaffT3_Alt: + projectile.scale = 2f; + break; + + case ProjectileID.Retanimini: + case ProjectileID.MiniRetinaLaser: + case ProjectileID.FlowerPetal: + projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.usesIDStaticNPCImmunity = false; + break; + + case ProjectileID.Spazmamini: + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 12; + break; + + case ProjectileID.WoodYoyo: + case ProjectileID.CorruptYoyo: + case ProjectileID.CrimsonYoyo: + case ProjectileID.JungleYoyo: + case ProjectileID.RedsYoyo: + case ProjectileID.ValkyrieYoyo: + case ProjectileID.Kraken: + case ProjectileID.Rally: + case ProjectileID.Code1: + case ProjectileID.Code2: + case ProjectileID.Valor: + case ProjectileID.Cascade: + case ProjectileID.Chik: + case ProjectileID.FormatC: + case ProjectileID.HelFire: + case ProjectileID.Amarok: + case ProjectileID.Gradient: + case ProjectileID.Yelets: + case ProjectileID.TheEyeOfCthulhu: + case ProjectileID.Terrarian: projectile.usesLocalNPCImmunity = true; - projectile.usesIDStaticNPCImmunity = false; + projectile.localNPCHitCooldown = 10; break; - case ProjectileID.Spazmamini: - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 12; + case ProjectileID.DD2BetsyFireball: + case ProjectileID.DD2BetsyFlameBreath: + case ProjectileID.CultistBossLightningOrbArc: + case ProjectileID.InfernoHostileBlast: + case ProjectileID.RocketSkeleton: + case ProjectileID.SniperBullet: + case ProjectileID.RuneBlast: + case ProjectileID.UnholyTridentHostile: + case ProjectileID.JavelinHostile: + case ProjectileID.FrostWave: + case ProjectileID.Present: + case ProjectileID.FlamingScythe: + case ProjectileID.SaucerDeathray: + case ProjectileID.CannonballHostile: + case ProjectileID.PaladinsHammerHostile: + case ProjectileID.Spike: + case ProjectileID.Sharknado: + case ProjectileID.Cthulunado: + case ProjectileID.PhantasmalSphere: + case ProjectileID.PhantasmalDeathray: + canBreakPlayerDefense = true; break; + + case ProjectileID.Stinger: + case ProjectileID.Shadowflames: + case ProjectileID.DeathLaser: + case ProjectileID.PinkLaser: + case ProjectileID.CursedFlameHostile: + case ProjectileID.EyeFire: + case ProjectileID.EyeLaser: + case ProjectileID.PoisonSeedPlantera: + case ProjectileID.SeedPlantera: + case ProjectileID.Fireball: + case ProjectileID.EyeBeam: + case ProjectileID.InfernoHostileBolt: + case ProjectileID.CultistBossLightningOrb: + case ProjectileID.AncientDoomProjectile: + case ProjectileID.PhantasmalBolt: + case ProjectileID.PhantasmalEye: + affectedByMaliceModeVelocityMultiplier = true; + break; + + case ProjectileID.DemonSickle: + case ProjectileID.BombSkeletronPrime: + case ProjectileID.Skull: + case ProjectileID.SaucerMissile: + case ProjectileID.ThornBall: + case ProjectileID.CultistBossFireBall: + case ProjectileID.CultistBossFireBallClone: + case ProjectileID.CultistBossIceMist: + canBreakPlayerDefense = affectedByMaliceModeVelocityMultiplier = true; + break; + + case ProjectileID.LastPrismLaser: + case ProjectileID.ChargedBlasterLaser: + PierceResistHarshness = 0.06f; + PierceResistCap = 0.4f; + break; + default: - break; + break; + } + + if (projectile.type >= ProjectileID.BlackCounterweight && projectile.type <= ProjectileID.YellowCounterweight) + { + projectile.MaxUpdates = 2; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } // Disable Lunatic Cultist's homing resistance globally ProjectileID.Sets.Homing[projectile.type] = false; - } + } #endregion #region PreAI public override bool PreAI(Projectile projectile) { - if (projectile.type == ProjectileID.Starfury) + if (!Main.player[projectile.owner].ActiveItem().IsAir && !Main.player[projectile.owner].ActiveItem().Calamity().canFirePointBlankShots) + pointBlankShotDuration = 0; + + if (pointBlankShotDuration > 0) + pointBlankShotDuration--; + + if (projectile.minion && ExplosiveEnchantCountdown > 0) { - if (projectile.timeLeft > 45) - projectile.timeLeft = 45; + ExplosiveEnchantCountdown--; + if (defDamage == 0) + defDamage = projectile.damage; + projectile.damage = (int)(defDamage * MathHelper.SmoothStep(1f, 1.6f, 1f - ExplosiveEnchantCountdown / (float)ExplosiveEnchantTime)); - if (projectile.ai[1] == 0f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + // Make fizzle sounds and fire dust to indicate the impending explosion. + if (ExplosiveEnchantCountdown <= 300) { - projectile.ai[1] = 1f; - projectile.netUpdate = true; + if (Main.rand.NextBool(24)) + Main.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)); + fire.scale = Main.rand.NextFloat(1.4f, 1.65f); + fire.fadeIn = 0.5f; + fire.noGravity = true; } - if (projectile.soundDelay == 0) + if (ExplosiveEnchantCountdown % 40 == 39 && Main.rand.NextBool(12)) + { + int damage = (int)(Main.player[projectile.owner].MinionDamage() * 2000); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); + } + + if (ExplosiveEnchantCountdown <= 0) { - projectile.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(SoundID.Item9, projectile.position); + Main.PlaySound(SoundID.DD2_KoboldExplosion, projectile.Center); + if (Main.myPlayer == projectile.owner) + { + if (projectile.minionSlots > 0f) + { + int damage = (int)(Main.player[projectile.owner].MinionDamage() * 6000); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), damage, 0f, projectile.owner); + } + projectile.Kill(); + } } + } - if (projectile.localAI[0] == 0f) - projectile.localAI[0] = 1f; + if (RequiresManualResurrection) + { + // Reactivate the projectile the instant it's created. This is dirty as fuck, but + // I can't find the offending Kill call in the frankly enormous codebase that causes this unusual instant-death behavior. + projectile.active = true; + projectile.timeLeft = 90000; + RequiresManualResurrection = false; + } - projectile.alpha += (int)(25f * projectile.localAI[0]); - if (projectile.alpha > 200) - { - projectile.alpha = 200; - projectile.localAI[0] = -1f; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 1f; - } + if (projectile.type == ProjectileID.Starfury) + { + if (projectile.timeLeft > 45) + projectile.timeLeft = 45; - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; + if (projectile.ai[1] == 0f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[1] = 1f; + projectile.netUpdate = true; + } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + Main.PlaySound(SoundID.Item9, projectile.position); + } - if (Main.rand.NextBool(10)) - Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + if (projectile.localAI[0] == 0f) + projectile.localAI[0] = 1f; - 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); - } - return false; + projectile.alpha += (int)(25f * projectile.localAI[0]); + if (projectile.alpha > 200) + { + projectile.alpha = 200; + projectile.localAI[0] = -1f; + } + if (projectile.alpha < 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 1f; + } + + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * projectile.direction; + + if (projectile.ai[1] == 1f) + { + projectile.light = 0.9f; + + if (Main.rand.NextBool(10)) + Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 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); + } + + return false; + } + + if (projectile.type == ProjectileID.NurseSyringeHeal) + { + ref float initialSpeed = ref projectile.localAI[1]; + if (initialSpeed == 0f) + initialSpeed = projectile.velocity.Length(); + + bool invalidHealTarget = !Main.npc.IndexInRange((int)projectile.ai[0]) || !Main.npc[(int)projectile.ai[0]].active || !Main.npc[(int)projectile.ai[0]].townNPC; + if (invalidHealTarget) + { + projectile.Kill(); + return false; + } + + NPC npcToHeal = Main.npc[(int)projectile.ai[0]]; + + // If the needle is not colliding with the target, attempt to move towards it while falling. + if (!projectile.WithinRange(npcToHeal.Center, initialSpeed) && !projectile.Hitbox.Intersects(npcToHeal.Hitbox)) + { + Vector2 flySpeed = projectile.SafeDirectionTo(npcToHeal.Center) * initialSpeed; + + // Prevent the needle from ever violating its gravity. + if (flySpeed.Y < projectile.velocity.Y) + flySpeed.Y = projectile.velocity.Y; + + flySpeed.Y++; + + projectile.velocity = Vector2.Lerp(projectile.velocity, flySpeed, 0.04f); + projectile.rotation += projectile.velocity.X * 0.05f; + return false; + } + + // Otherwise, die immediately and heal the target. + projectile.Kill(); + + int healAmount = npcToHeal.lifeMax - npcToHeal.life; + int maxHealAmount = 20; + + // If the target has more than 250 max life, incorporate their total life into the max amount to heal. + // This is done so that more powerful NPCs, such as Cirrus, do not take an eternity to receive meaningful healing benefits + // from the Nurse. + if (npcToHeal.lifeMax > 250) + maxHealAmount = (int)Math.Max(maxHealAmount, npcToHeal.lifeMax * 0.05f); + + if (healAmount > maxHealAmount) + healAmount = maxHealAmount; + + if (healAmount > 0) + { + npcToHeal.life += healAmount; + npcToHeal.HealEffect(healAmount, true); + return false; + } + + return false; } - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + if (adultWyrmAlive || (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses)) + { + if (projectile.type == ProjectileID.CultistBossFireBallClone) + { + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item34, projectile.position); + } + else if (projectile.ai[1] == 1f && Main.netMode != NetmodeID.MultiplayerClient) + { + int num13 = -1; + float num14 = 2000f; + for (int num15 = 0; num15 < Main.maxPlayers; num15++) + { + if (Main.player[num15].active && !Main.player[num15].dead) + { + Vector2 center2 = Main.player[num15].Center; + float num16 = Vector2.Distance(center2, projectile.Center); + if ((num16 < num14 || num13 == -1) && Collision.CanHit(projectile.Center, 1, 1, center2, 1, 1)) + { + num14 = num16; + num13 = num15; + } + } + } + + if (num14 < 20f) + { + projectile.Kill(); + return false; + } + + if (num13 != -1) + { + projectile.ai[1] = 21f; + projectile.ai[0] = num13; + projectile.netUpdate = true; + } + } + else if (projectile.ai[1] > 20f && projectile.ai[1] < 200f) + { + projectile.ai[1] += 1f; + int num17 = (int)projectile.ai[0]; + if (!Main.player[num17].active || Main.player[num17].dead) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + float num18 = projectile.velocity.ToRotation(); + Vector2 vector2 = Main.player[num17].Center - projectile.Center; + if (vector2.Length() < 20f) + { + projectile.Kill(); + return false; + } + + float targetAngle2 = vector2.ToRotation(); + if (vector2 == Vector2.Zero) + targetAngle2 = num18; + + float num19 = num18.AngleLerp(targetAngle2, 0.01f); + projectile.velocity = new Vector2(projectile.velocity.Length(), 0f).RotatedBy(num19); + } + } + + if (projectile.ai[1] >= 1f && projectile.ai[1] < 20f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == 20f) + projectile.ai[1] = 1f; + } + + projectile.alpha -= 40; + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.spriteDirection = projectile.direction; + + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame >= 4) + projectile.frame = 0; + } + + if (Main.rand.Next(4) == 0) + { + Vector2 value4 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(projectile.velocity.ToRotation()); + int num23 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100); + Main.dust[num23].velocity *= 0.1f; + Main.dust[num23].position = projectile.Center + value4 * projectile.width / 2f; + Main.dust[num23].fadeIn = 0.9f; + } + + if (Main.rand.Next(32) == 0) + { + Vector2 value5 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(projectile.velocity.ToRotation()); + int num25 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 155, default, 0.8f); + Main.dust[num25].velocity *= 0.3f; + Main.dust[num25].position = projectile.Center + value5 * projectile.width / 2f; + if (Main.rand.Next(2) == 0) + Main.dust[num25].fadeIn = 1.4f; + } + + if (Main.rand.Next(2) == 0) + { + Vector2 value6 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy(projectile.velocity.ToRotation()); + int num27 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 27, 0f, 0f, 0, default, 1.2f); + Main.dust[num27].velocity *= 0.3f; + Main.dust[num27].noGravity = true; + Main.dust[num27].position = projectile.Center + value6 * projectile.width / 2f; + if (Main.rand.Next(2) == 0) + Main.dust[num27].fadeIn = 1.4f; + } + + return false; + } + else if (projectile.type == ProjectileID.CultistBossIceMist) + { + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item120, projectile.position); + } + + projectile.ai[0] += 1f; + + // Main projectile + float duration = 300f; + if (projectile.ai[1] == 1f) + { + if (projectile.ai[0] >= duration - 20f) + projectile.alpha += 10; + else + projectile.alpha -= 10; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + + if (projectile.ai[0] >= duration) + { + projectile.Kill(); + return false; + } + + int num103 = Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + + if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector50 = projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); + } + + projectile.rotation += (float)Math.PI / 30f; + + return false; + } + + // Split projectiles + projectile.position -= projectile.velocity; + + if (projectile.ai[0] >= duration - 260f) + projectile.alpha += 3; + else + projectile.alpha -= 40; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + + if (projectile.ai[0] >= duration - 255f) + { + projectile.Kill(); + return false; + } + + Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); + float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); + Vector2 spinningpoint13 = value39 * scaleFactor3; + + for (int num724 = 0; num724 < 6; num724++) + { + Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * ((float)Math.PI * 2f) / 6f); + int num726 = Dust.NewDust(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[num726].noGravity = true; + } + + return false; + } + else if (projectile.type == ProjectileID.CultistBossLightningOrbArc) + { + projectile.frameCounter++; + if (projectile.velocity == Vector2.Zero) + { + if (projectile.frameCounter >= projectile.extraUpdates * 2) + { + projectile.frameCounter = 0; + bool flag30 = true; + for (int num742 = 1; num742 < projectile.oldPos.Length; num742++) + { + if (projectile.oldPos[num742] != projectile.oldPos[0]) + flag30 = false; + } + + if (flag30) + { + projectile.Kill(); + return false; + } + } + } + else + { + if (projectile.frameCounter < projectile.extraUpdates * 2) + return false; + + projectile.frameCounter = 0; + float num748 = projectile.velocity.Length(); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]); + int num749 = 0; + Vector2 spinningpoint14 = -Vector2.UnitY; + while (true) + { + int num750 = unifiedRandom.Next(); + projectile.ai[1] = num750; + num750 %= 100; + float f = (float)num750 / 100f * ((float)Math.PI * 2f); + Vector2 vector55 = f.ToRotationVector2(); + if (vector55.Y > 0f) + { + vector55.Y *= -1f; + } + + bool flag31 = false; + if (vector55.Y > -0.02f) + { + flag31 = true; + } + if (vector55.X * (float)(projectile.extraUpdates + 1) * 2f * num748 + projectile.localAI[0] > 40f) + { + flag31 = true; + } + if (vector55.X * (float)(projectile.extraUpdates + 1) * 2f * num748 + projectile.localAI[0] < -40f) + { + flag31 = true; + } + + if (flag31) + { + if (num749++ >= 100) + { + projectile.velocity = Vector2.Zero; + projectile.localAI[1] = 1f; + break; + } + continue; + } + + spinningpoint14 = vector55; + + break; + } + + if (projectile.velocity != Vector2.Zero) + { + projectile.localAI[0] += spinningpoint14.X * (float)(projectile.extraUpdates + 1) * 2f * num748; + projectile.velocity = spinningpoint14.RotatedBy(projectile.ai[0] + (float)Math.PI / 2f) * num748; + projectile.rotation = projectile.velocity.ToRotation() + (float)Math.PI / 2f; + } + } + + return false; + } + } + + if (CalamityWorld.revenge || BossRushEvent.BossRushActive || CalamityWorld.malice) { - if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) + if (projectile.type == ProjectileID.DemonSickle && CalamityPlayer.areThereAnyDamnBosses) + { + if (projectile.ai[0] == 0f) + Main.PlaySound(SoundID.Item8, projectile.position); + + projectile.rotation += projectile.direction * 0.8f; + + projectile.ai[0] += 1f; + if (projectile.velocity.Length() < projectile.ai[1]) + { + if (!(projectile.ai[0] < 30f)) + { + if (projectile.ai[0] < 100f) + projectile.velocity *= 1.06f; + else + projectile.ai[0] = 200f; + } + } + + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100); + Main.dust[dust].noGravity = true; + } + + return false; + } + + else if (projectile.type == ProjectileID.EyeLaser && projectile.ai[0] == 1f) { projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; @@ -201,6 +863,20 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) { + if (defDamage == 0) + { + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + if (!NPC.downedMechBossAny) + projectile.damage = (int)(projectile.damage * 0.8); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + projectile.damage = (int)(projectile.damage * 0.9); + } + + defDamage = projectile.damage; + } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, 0f, 0f); @@ -216,196 +892,448 @@ namespace CalamityMod.Projectiles projectile.localAI[1] = 1f; } - if (projectile.velocity.Length() < 18f) + if (projectile.velocity.Length() < 12f) projectile.velocity *= 1.0025f; return false; } - else if (projectile.type == ProjectileID.PoisonSeedPlantera) - { - projectile.frameCounter++; - if (projectile.frameCounter > 1) - { - projectile.frameCounter = 0; - projectile.frame++; + else if (projectile.type == ProjectileID.PoisonSeedPlantera) + { + projectile.frameCounter++; + if (projectile.frameCounter > 1) + { + projectile.frameCounter = 0; + projectile.frame++; - if (projectile.frame > 1) - projectile.frame = 0; - } + if (projectile.frame > 1) + projectile.frame = 0; + } - if (projectile.ai[1] == 0f) - { - projectile.ai[1] = 1f; - Main.PlaySound(SoundID.Item17, projectile.position); - } + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(SoundID.Item17, projectile.position); + } - 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; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 35f) - { - projectile.ai[0] = 35f; - projectile.velocity.Y += 0.01f; - } + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 120f) + { + projectile.ai[0] = 120f; - projectile.tileCollide = false; + if (projectile.velocity.Length() < 18f) + projectile.velocity *= 1.01f; + } - if (projectile.timeLeft > 300) - projectile.timeLeft = 300; + projectile.tileCollide = false; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + if (projectile.timeLeft > 600) + projectile.timeLeft = 600; - if (projectile.velocity.Y > 16f) - projectile.velocity.Y = 16f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; - return false; - } + return false; + } - // Phase 1 sharknado - else if (projectile.type == ProjectileID.SharknadoBolt) - { - if (projectile.ai[1] < 0f) - { - float num623 = 0.209439516f; - float num624 = -2f; - float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; + else if (projectile.type == ProjectileID.ThornBall) + { + if (projectile.alpha > 0) + { + projectile.alpha -= 30; + if (projectile.alpha < 0) + projectile.alpha = 0; + } - projectile.velocity.Y -= num625; + int num147 = Player.FindClosest(projectile.Center, 1, 1); + float num146 = 7.5f * projectile.ai[1] + Vector2.Distance(Main.player[num147].Center, projectile.Center) * 0.01f; + Vector2 vector12 = Main.player[num147].Center - projectile.Center; + vector12.Normalize(); + vector12 *= num146; + int num148 = 200; + projectile.velocity.X = (projectile.velocity.X * (num148 - 1) + vector12.X) / num148; - projectile.ai[0] += 1f; + if (projectile.velocity.Length() > 16f) + { + projectile.velocity.Normalize(); + projectile.velocity *= 16f; + } - num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 15f) + { + 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.Kill(); + } + projectile.velocity.Y += 0.1f; + } - projectile.velocity.Y += num625; + projectile.rotation += projectile.velocity.X * 0.05f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 10f) - { - projectile.alpha -= 5; - if (projectile.alpha < 100) - projectile.alpha = 100; + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; - } - return false; - } - } + return false; + } - // Large cthulhunadoes - else if (projectile.type == ProjectileID.Cthulunado) - { - int num606 = 16; - int num607 = 16; - float num608 = 2f; - int num609 = 150; - int num610 = 42; + // Phase 1 sharknado + else if (projectile.type == ProjectileID.SharknadoBolt) + { + if (projectile.ai[1] < 0f) + { + float num623 = 0.209439516f; + float num624 = -2f; + float num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; - if (projectile.velocity.X != 0f) - projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + projectile.velocity.Y -= num625; - int num3 = projectile.frameCounter; - projectile.frameCounter = num3 + 1; - if (projectile.frameCounter > 2) - { - num3 = projectile.frame; - projectile.frame = num3 + 1; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - projectile.frame = 0; + projectile.ai[0] += 1f; - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - projectile.netUpdate = true; - } + num625 = (float)(Math.Cos(num623 * projectile.ai[0]) - 0.5) * num624; - if (projectile.ai[1] != -1f) - { - projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); - projectile.width = (int)(num609 * projectile.scale); - projectile.height = (int)(num610 * projectile.scale); - } + projectile.velocity.Y += num625; - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - projectile.alpha = 60; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + projectile.alpha -= 5; + if (projectile.alpha < 100) + projectile.alpha = 100; - if (projectile.alpha < 100) - projectile.alpha = 100; - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - projectile.alpha = 150; - } + projectile.rotation += projectile.velocity.X * 0.1f; + projectile.frame = (int)(projectile.localAI[0] / 3f) % 3; + } - if (projectile.ai[0] > 0f) - projectile.ai[0] -= 1f; + return false; + } + } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; + else if (projectile.type == ProjectileID.Sharknado) + { + projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); + } - Vector2 center = projectile.Center; - center.Y -= num610 * projectile.scale / 2f; + // Larger cthulhunadoes + else if (projectile.type == ProjectileID.Cthulunado) + { + projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); - float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); - center.Y -= num610 * num611 / 2f; - center.Y += 2f; + int num606 = 16; + int num607 = 16; + float num608 = 2f; + int num609 = 150; + int num610 = 42; - 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.velocity.X != 0f) + projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); - if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) - { - int num614 = NPC.NewNPC((int)center.X, (int)center.Y, NPCID.Sharkron2, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num614].velocity = projectile.velocity; - Main.npc[num614].scale = 1.5f; - Main.npc[num614].netUpdate = true; - Main.npc[num614].ai[2] = projectile.width; - Main.npc[num614].ai[3] = -1.5f; - } - } + int num3 = projectile.frameCounter; + projectile.frameCounter = num3 + 1; + if (projectile.frameCounter > 2) + { + num3 = projectile.frame; + projectile.frame = num3 + 1; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + projectile.frame = 0; - if (projectile.ai[0] <= 0f) - { - float num615 = 0.104719758f; - float num616 = projectile.width / 5f * 2.5f; - float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); + projectile.width = (int)(num609 * projectile.scale); + projectile.height = (int)(num610 * projectile.scale); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + projectile.netUpdate = true; + } - projectile.position.X -= num617 * -projectile.direction; + if (projectile.ai[1] != -1f) + { + projectile.scale = (num606 + num607 - projectile.ai[1]) * num608 / (num607 + num606); + projectile.width = (int)(num609 * projectile.scale); + projectile.height = (int)(num610 * projectile.scale); + } - projectile.ai[0] -= 1f; + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + projectile.alpha = 60; + if (projectile.alpha < 100) + projectile.alpha = 100; + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + projectile.alpha = 150; + } - num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; - projectile.position.X += num617 * -projectile.direction; - } - return false; - } + if (projectile.ai[0] > 0f) + projectile.ai[0] -= 1f; + + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + + Vector2 center = projectile.Center; + center.Y -= num610 * projectile.scale / 2f; + + float num611 = (num606 + num607 - projectile.ai[1] + 1f) * num608 / (num607 + num606); + center.Y -= num610 * num611 / 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); + + if ((int)projectile.ai[1] % 3 == 0 && projectile.ai[1] != 0f) + { + int num614 = NPC.NewNPC((int)center.X, (int)center.Y, NPCID.Sharkron2); + Main.npc[num614].velocity = projectile.velocity; + Main.npc[num614].scale = 1.5f; + Main.npc[num614].netUpdate = true; + Main.npc[num614].ai[2] = projectile.width; + Main.npc[num614].ai[3] = -1.5f; + } + } + + if (projectile.ai[0] <= 0f) + { + float num615 = 0.104719758f; + float num616 = projectile.width / 5f * 2.5f; + float num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + + projectile.position.X -= num617 * -projectile.direction; + + projectile.ai[0] -= 1f; + + num617 = (float)(Math.Cos(num615 * -(double)projectile.ai[0]) - 0.5) * num616; + projectile.position.X += num617 * -projectile.direction; + } + + return false; + } + + else if (projectile.type == ProjectileID.CultistBossLightningOrb) + { + if (NPC.AnyNPCs(NPCID.CultistBoss)) + { + if (projectile.localAI[1] == 0f) + { + Main.PlaySound(SoundID.Item121, projectile.position); + projectile.localAI[1] = 1f; + } + + if (projectile.ai[0] < 180f) + { + projectile.alpha -= 5; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + else + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + projectile.Kill(); + return false; + } + } + + ref float reference = ref projectile.ai[0]; + ref float reference46 = ref reference; + float num15 = reference; + reference46 = num15 + 1f; + + if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 180f && Main.netMode != NetmodeID.MultiplayerClient) + { + int[] array6 = new int[5]; + Vector2[] array7 = new Vector2[5]; + int num731 = 0; + float num732 = 2000f; + + for (int num733 = 0; num733 < 255; num733++) + { + if (!Main.player[num733].active || Main.player[num733].dead) + continue; + + Vector2 center9 = Main.player[num733].Center; + float num734 = Vector2.Distance(center9, projectile.Center); + if (num734 < num732 && Collision.CanHit(projectile.Center, 1, 1, center9, 1, 1)) + { + array6[num731] = num733; + array7[num731] = center9; + int num34 = num731 + 1; + num731 = num34; + if (num34 >= array7.Length) + break; + } + } + + for (int num735 = 0; num735 < num731; num735++) + { + Vector2 vector52 = array7[num735] + Main.player[array6[num735]].velocity * 40f - projectile.Center; + float ai = Main.rand.Next(100); + Vector2 vector53 = Vector2.Normalize(vector52.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(projectile.Center, vector53, 466, projectile.damage, 0f, Main.myPlayer, vector52.ToRotation(), ai); + } + } + + Lighting.AddLight(projectile.Center, 0.4f, 0.85f, 0.9f); + + if (++projectile.frameCounter >= 4) + { + projectile.frameCounter = 0; + if (++projectile.frame >= Main.projFrames[projectile.type]) + projectile.frame = 0; + } + + if (projectile.alpha >= 150 || !(projectile.ai[0] < 180f)) + return false; + + for (int num736 = 0; num736 < 1; num736++) + { + float num737 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num737 < -0.5f) + num737 = -0.5f; + if (num737 > 0.5f) + num737 = 0.5f; + + Vector2 value40 = new Vector2(-projectile.width * 0.2f * projectile.scale, 0f).RotatedBy(num737 * ((float)Math.PI * 2f)).RotatedBy(projectile.velocity.ToRotation()); + int num738 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[num738].position = projectile.Center + value40; + Main.dust[num738].velocity = Vector2.Normalize(Main.dust[num738].position - projectile.Center) * 2f; + Main.dust[num738].noGravity = true; + } + + for (int num739 = 0; num739 < 1; num739++) + { + float num740 = (float)Main.rand.NextDouble() * 1f - 0.5f; + if (num740 < -0.5f) + num740 = -0.5f; + if (num740 > 0.5f) + num740 = 0.5f; + + Vector2 value41 = new Vector2(-projectile.width * 0.6f * projectile.scale, 0f).RotatedBy(num740 * ((float)Math.PI * 2f)).RotatedBy(projectile.velocity.ToRotation()); + int num741 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 226, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 0.7f); + Main.dust[num741].velocity = Vector2.Zero; + Main.dust[num741].position = projectile.Center + value41; + Main.dust[num741].noGravity = true; + } + + return false; + } + } + + else if (projectile.type == ProjectileID.CultistBossIceMist) + { + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item120, projectile.position); + } + + projectile.ai[0] += 1f; + + // Main projectile + float duration = 300f; + if (projectile.ai[1] == 1f) + { + if (projectile.ai[0] >= duration - 20f) + projectile.alpha += 10; + else + projectile.alpha -= 10; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + + if (projectile.ai[0] >= duration) + { + projectile.Kill(); + return false; + } + + int num103 = Player.FindClosest(projectile.Center, 1, 1); + Vector2 vector11 = Main.player[num103].Center - projectile.Center; + float scaleFactor2 = projectile.velocity.Length(); + vector11.Normalize(); + vector11 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 15f + vector11) / 16f; + projectile.velocity.Normalize(); + projectile.velocity *= scaleFactor2; + + if (projectile.ai[0] % 60f == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector50 = projectile.rotation.ToRotationVector2(); + Projectile.NewProjectile(projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); + } + + projectile.rotation += (float)Math.PI / 30f; + + Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + + return false; + } + + // Split projectiles + projectile.position -= projectile.velocity; + + if (projectile.ai[0] >= duration - 260f) + projectile.alpha += 3; + else + projectile.alpha -= 40; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + + if (projectile.ai[0] >= duration - 255f) + { + projectile.Kill(); + return false; + } + + Vector2 value39 = new Vector2(0f, -720f).RotatedBy(projectile.velocity.ToRotation()); + float scaleFactor3 = projectile.ai[0] % (duration - 255f) / (duration - 255f); + Vector2 spinningpoint13 = value39 * scaleFactor3; + + for (int num724 = 0; num724 < 6; num724++) + { + Vector2 vector51 = projectile.Center + spinningpoint13.RotatedBy(num724 * ((float)Math.PI * 2f) / 6f); + + Lighting.AddLight(vector51, 0.3f, 0.75f, 0.9f); + + for (int num725 = 0; num725 < 2; num725++) + { + int num726 = Dust.NewDust(vector51 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent); + Main.dust[num726].noGravity = true; + } + } + + return false; + } // Change the stupid homing eyes else if (projectile.type == ProjectileID.PhantasmalEye) { projectile.alpha -= 40; if (projectile.alpha < 0) - { projectile.alpha = 0; - } + if (projectile.ai[0] == 0f) { projectile.localAI[0] += 1f; @@ -416,17 +1344,15 @@ namespace CalamityMod.Projectiles projectile.ai[1] = 0f - projectile.ai[1]; projectile.netUpdate = true; } + projectile.velocity.X = projectile.velocity.RotatedBy(projectile.ai[1]).X; projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); projectile.velocity.Y -= 0.08f; + if (projectile.velocity.Y > 0f) - { projectile.velocity.Y -= 0.2f; - } if (projectile.velocity.Y < -7f) - { projectile.velocity.Y = -7f; - } } else if (projectile.ai[0] == 1f) { @@ -438,63 +1364,55 @@ namespace CalamityMod.Projectiles projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); projectile.netUpdate = true; } + projectile.velocity.X = projectile.velocity.RotatedBy(projectile.ai[1]).X; projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); projectile.velocity.Y -= 0.08f; + if (projectile.velocity.Y > 0f) - { projectile.velocity.Y -= 0.2f; - } if (projectile.velocity.Y < -7f) - { projectile.velocity.Y = -7f; - } } else if (projectile.ai[0] == 2f) { projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 60f) + if (projectile.localAI[0] >= 45f) { projectile.localAI[0] = 0f; projectile.ai[0] = 3f; projectile.netUpdate = true; } + Vector2 value23 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; value23.Normalize(); value23 *= 12f; value23 = Vector2.Lerp(projectile.velocity, value23, 0.6f); + float num675 = 0.4f; if (projectile.velocity.X < value23.X) { projectile.velocity.X += num675; if (projectile.velocity.X < 0f && value23.X > 0f) - { projectile.velocity.X += num675; - } } else if (projectile.velocity.X > value23.X) { projectile.velocity.X -= num675; if (projectile.velocity.X > 0f && value23.X < 0f) - { projectile.velocity.X -= num675; - } } if (projectile.velocity.Y < value23.Y) { projectile.velocity.Y += num675; if (projectile.velocity.Y < 0f && value23.Y > 0f) - { projectile.velocity.Y += num675; - } } else if (projectile.velocity.Y > value23.Y) { projectile.velocity.Y -= num675; if (projectile.velocity.Y > 0f && value23.Y < 0f) - { projectile.velocity.Y -= num675; - } } } else if (projectile.ai[0] == 3f) @@ -505,38 +1423,42 @@ namespace CalamityMod.Projectiles projectile.Kill(); return false; } - if (projectile.velocity.Length() < 18f) + + float velocityLimit = ((CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 28f : 24f) / MathHelper.Clamp(lineColor * 0.75f, 1f, 3f); + if (projectile.velocity.Length() < velocityLimit) projectile.velocity *= 1.01f; } + if (projectile.alpha < 40) { int num676 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 229, (0f - projectile.velocity.X) / 3f, (0f - projectile.velocity.Y) / 3f, 150, Color.Transparent, 1.2f); Main.dust[num676].noGravity = true; } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + return false; } // Moon Lord big eye spheres else if (projectile.type == ProjectileID.PhantasmalSphere && Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHand) { - if (projectile.velocity.Length() < 8f) - projectile.velocity *= 1.005f; + float velocityLimit = (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.malice) ? 14f : 12f; + if (projectile.velocity.Length() < velocityLimit) + projectile.velocity *= 1.0075f; return true; } - // Moon Lord Deathray - else if (projectile.type == ProjectileID.PhantasmalDeathray) - { + // Moon Lord Deathray + else if (projectile.type == ProjectileID.PhantasmalDeathray) + { if (Main.npc[(int)projectile.ai[1]].type == NPCID.MoonLordHead) { Vector2? vector78 = null; if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { projectile.velocity = -Vector2.UnitY; - } if (Main.npc[(int)projectile.ai[1]].active) { @@ -546,14 +1468,10 @@ namespace CalamityMod.Projectiles } if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { projectile.velocity = -Vector2.UnitY; - } if (projectile.localAI[0] == 0f) - { Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 104, 1f, 0f); - } float num801 = 1f; projectile.localAI[0] += 1f; @@ -563,15 +1481,13 @@ namespace CalamityMod.Projectiles return false; } - projectile.scale = (float)Math.Sin(projectile.localAI[0] * 3.14159274f / 180f) * 10f * num801; + projectile.scale = (float)Math.Sin(projectile.localAI[0] * MathHelper.Pi / 180f) * 10f * num801; if (projectile.scale > num801) - { projectile.scale = num801; - } float num804 = projectile.velocity.ToRotation(); num804 += projectile.ai[0]; - projectile.rotation = num804 - 1.57079637f; + projectile.rotation = num804 - MathHelper.PiOver2; projectile.velocity = num804.ToRotationVector2(); float num805 = 3f; @@ -603,10 +1519,11 @@ namespace CalamityMod.Projectiles float amount = 0.5f; projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); + Vector2 vector79 = projectile.Center + projectile.velocity * (projectile.localAI[1] - 14f); for (int num809 = 0; num809 < 2; num809 = num3 + 1) { - float num810 = projectile.velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f; + 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, 229, vector80.X, vector80.Y, 0, default, 1f); @@ -614,159 +1531,211 @@ namespace CalamityMod.Projectiles Main.dust[num812].scale = 1.7f; num3 = num809; } + if (Main.rand.Next(5) == 0) { - Vector2 value29 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; + Vector2 value29 = projectile.velocity.RotatedBy(MathHelper.PiOver2) * ((float)Main.rand.NextDouble() - 0.5f) * projectile.width; int num813 = Dust.NewDust(vector79 + value29 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default, 1.5f); Dust dust = Main.dust[num813]; dust.velocity *= 0.5f; Main.dust[num813].velocity.Y = -Math.Abs(Main.dust[num813].velocity.Y); } + 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)); return false; } + } + } + + if (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses) + { + if (projectile.type == ProjectileID.Sharknado || projectile.type == ProjectileID.Cthulunado) + { + int num520 = 10; + int num521 = 15; + float num522 = 1f; + int num523 = 150; + int num524 = 42; + if (projectile.type == ProjectileID.Cthulunado) + { + num520 = 16; + num521 = 16; + num522 = 1.5f; + } + if (projectile.velocity.X != 0f) + { + projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); + } + projectile.frameCounter++; + if (projectile.frameCounter > 2) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 6) + { + projectile.frame = 0; + } + if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) + { + projectile.localAI[0] = 1f; + projectile.position.X += projectile.width / 2; + projectile.position.Y += projectile.height / 2; + projectile.scale = (num520 + num521 - projectile.ai[1]) * num522 / (num521 + num520); + projectile.width = (int)(num523 * projectile.scale); + projectile.height = (int)(num524 * projectile.scale); + projectile.position.X -= projectile.width / 2; + projectile.position.Y -= projectile.height / 2; + projectile.netUpdate = true; + } + if (projectile.ai[1] != -1f) + { + projectile.scale = (num520 + num521 - projectile.ai[1]) * num522 / (num521 + num520); + projectile.width = (int)(num523 * projectile.scale); + projectile.height = (int)(num524 * projectile.scale); + } + if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.alpha -= 30; + if (projectile.alpha < 60) + { + projectile.alpha = 60; + } + if (projectile.type == ProjectileID.Cthulunado && projectile.alpha < 100) + { + projectile.alpha = 100; + } + } + else + { + projectile.alpha += 30; + if (projectile.alpha > 150) + { + projectile.alpha = 150; + } + } + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + } + if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) + { + projectile.netUpdate = true; + Vector2 center2 = projectile.Center; + center2.Y -= num524 * projectile.scale / 2f; + float num525 = (num520 + num521 - projectile.ai[1] + 1f) * num522 / (num521 + num520); + center2.Y -= num524 * num525 / 2f; + center2.Y += 2f; + Projectile.NewProjectile(center2, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); + } + if (projectile.ai[0] <= 0f) + { + float num529 = (float)Math.PI / 30f; + float num530 = projectile.width / 5f; + if (projectile.type == ProjectileID.Cthulunado) + { + num530 *= 2f; + } + float num531 = (float)(Math.Cos(num529 * (-projectile.ai[0])) - 0.5) * num530; + projectile.position.X -= num531 * (-projectile.direction); + projectile.ai[0] -= 1f; + num531 = (float)(Math.Cos(num529 * (-projectile.ai[0])) - 0.5) * num530; + projectile.position.X += num531 * (-projectile.direction); + } + + return false; } } - if (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses) - { - if (projectile.type == ProjectileID.Sharknado || projectile.type == ProjectileID.Cthulunado) - { - int num520 = 10; - int num521 = 15; - float num522 = 1f; - int num523 = 150; - int num524 = 42; - if (projectile.type == ProjectileID.Cthulunado) - { - num520 = 16; - num521 = 16; - num522 = 1.5f; - } - if (projectile.velocity.X != 0f) - { - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - } - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 6) - { - projectile.frame = 0; - } - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.scale = ((float)(num520 + num521) - projectile.ai[1]) * num522 / (float)(num521 + num520); - projectile.width = (int)((float)num523 * projectile.scale); - projectile.height = (int)((float)num524 * projectile.scale); - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - projectile.netUpdate = true; - } - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num520 + num521) - projectile.ai[1]) * num522 / (float)(num521 + num520); - projectile.width = (int)((float)num523 * projectile.scale); - projectile.height = (int)((float)num524 * projectile.scale); - } - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < 60) - { - projectile.alpha = 60; - } - if (projectile.type == ProjectileID.Cthulunado && projectile.alpha < 100) - { - projectile.alpha = 100; - } - } - else - { - projectile.alpha += 30; - if (projectile.alpha > 150) - { - projectile.alpha = 150; - } - } - if (projectile.ai[0] > 0f) - { - projectile.ai[0] -= 1f; - } - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center2 = projectile.Center; - center2.Y -= (float)num524 * projectile.scale / 2f; - float num525 = ((float)(num520 + num521) - projectile.ai[1] + 1f) * num522 / (float)(num521 + num520); - center2.Y -= (float)num524 * num525 / 2f; - center2.Y += 2f; - Projectile.NewProjectile(center2, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - } - if (projectile.ai[0] <= 0f) - { - float num529 = (float)Math.PI / 30f; - float num530 = (float)projectile.width / 5f; - if (projectile.type == ProjectileID.Cthulunado) - { - num530 *= 2f; - } - float num531 = (float)(Math.Cos(num529 * (-projectile.ai[0])) - 0.5) * num530; - projectile.position.X -= num531 * (float)(-projectile.direction); - projectile.ai[0] -= 1f; - num531 = (float)(Math.Cos(num529 * (-projectile.ai[0])) - 0.5) * num530; - projectile.position.X += num531 * (float)(-projectile.direction); - } - - return false; - } - } - - return true; + return true; } #endregion #region AI public override void AI(Projectile projectile) { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); - if (defDamage == 0) - defDamage = projectile.damage; + if (defDamage == 0) + { + if (projectile.hostile) + { + if (CalamityPlayer.areThereAnyDamnBosses && affectedByMaliceModeVelocityMultiplier && (CalamityWorld.malice || BossRushEvent.BossRushActive)) + projectile.velocity *= BossRushEvent.BossRushActive ? BossRushProjectileVelocityMultiplier : MaliceModeProjectileVelocityMultiplier; - if (NPC.downedMoonlord) + // Reduce Nail damage from Nailheads because they're stupid + if (projectile.type == ProjectileID.Nail && Main.expertMode) + projectile.damage /= 2; + + if ((CalamityLists.hardModeNerfList.Contains(projectile.type) && Main.hardMode && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon) || projectile.type == ProjectileID.JavelinHostile) + { + projectile.damage = (int)(projectile.damage * 0.65); + } + + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + if (!NPC.downedMechBossAny) + { + if (MechBossProjectileIDs.Contains(projectile.type)) + { + if (CalamityUtils.AnyBossNPCS(true)) + projectile.damage = (int)(projectile.damage * 0.8); + } + } + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + { + if (MechBossProjectileIDs.Contains(projectile.type)) + { + if (CalamityUtils.AnyBossNPCS(true)) + projectile.damage = (int)(projectile.damage * 0.9); + } + } + } + } + else + { + if (modPlayer.camper && !player.StandingStill()) + projectile.damage = (int)(projectile.damage * 0.1); + } + + defDamage = projectile.damage; + } + + // Setting this in SetDefaults didn't work + switch (projectile.type) + { + case ProjectileID.Bee: + case ProjectileID.Wasp: + case ProjectileID.TinyEater: + case ProjectileID.GiantBee: + case ProjectileID.Bat: + projectile.extraUpdates = 1; + break; + } + + if (NPC.downedMoonlord) { - if (CalamityMod.dungeonProjectileBuffList.Contains(projectile.type)) + if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) { - //Prevents them being buffed in Skeletron, Skeletron Prime, or Golem fights + //Prevents them being buffed in Skeletron, Skeletron Prime, or Golem fights if (((projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] == 1f) || (NPC.golemBoss > 0 && (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast))) { projectile.damage = defDamage; } else - projectile.damage = defDamage + 60; + projectile.damage = defDamage + 30; } } - - if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon)) + + if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { - if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) - projectile.damage = defDamage + 70; - } - else if (CalamityWorld.buffedEclipse && Main.eclipse) - { - if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) - projectile.damage = defDamage + 100; + if (CalamityLists.eventProjectileBuffList.Contains(projectile.type)) + projectile.damage = defDamage + 15; } // Iron Heart damage variable will scale with projectile.damage @@ -792,13 +1761,13 @@ namespace CalamityMod.Projectiles projectile.damage = damage2; } } - SKIP_CALAMITY: + SKIP_CALAMITY: - // If rogue projectiles are not internally throwing while in-flight, they can never critically strike. - if (rogue) - projectile.thrown = true; + // If rogue projectiles are not internally throwing while in-flight, they can never critically strike. + if (rogue) + projectile.thrown = true; - if (forceMelee) + if (forceMelee) { projectile.hostile = false; projectile.friendly = true; @@ -806,8 +1775,8 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = false; projectile.minion = false; - projectile.thrown = false; - rogue = false; + projectile.thrown = false; + rogue = false; } else if (forceRanged) { @@ -817,8 +1786,8 @@ namespace CalamityMod.Projectiles projectile.ranged = true; projectile.magic = false; projectile.minion = false; - projectile.thrown = false; - rogue = false; + projectile.thrown = false; + rogue = false; } else if (forceMagic) { @@ -828,8 +1797,8 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = true; projectile.minion = false; - projectile.thrown = false; - rogue = false; + projectile.thrown = false; + rogue = false; } else if (forceMinion) { @@ -839,32 +1808,32 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = false; projectile.minion = true; - projectile.thrown = false; - rogue = false; + projectile.thrown = false; + rogue = false; } - else if (forceRogue) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - projectile.thrown = true; - rogue = true; - } - else if (forceTypeless) - { - projectile.hostile = false; - projectile.friendly = true; - projectile.melee = false; - projectile.ranged = false; - projectile.magic = false; - projectile.minion = false; - projectile.thrown = false; - rogue = false; - } - else if (forceHostile) + else if (forceRogue) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + projectile.thrown = true; + rogue = true; + } + else if (forceTypeless) + { + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + projectile.minion = false; + projectile.thrown = false; + rogue = false; + } + else if (forceHostile) { projectile.hostile = true; projectile.friendly = false; @@ -872,7 +1841,7 @@ namespace CalamityMod.Projectiles projectile.ranged = false; projectile.magic = false; projectile.minion = false; - projectile.thrown = false; + projectile.thrown = false; rogue = false; } @@ -890,1091 +1859,373 @@ namespace CalamityMod.Projectiles else if (projectile.type == ProjectileID.SoulDrain) projectile.magic = true; - if (modPlayer.etherealExtorter) - { - if (CalamityMod.spikyBallProjList.Contains(projectile.type) && !extorterBoost && Main.moonPhase == 2) //third quarter - { - projectile.timeLeft += 300; - extorterBoost = true; - } - if (CalamityMod.javelinProjList.Contains(projectile.type) && !extorterBoost && player.ZoneCrimson) - { - projectile.knockBack *= 2; - extorterBoost = true; - } - } + if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings + { + Vector2 center = projectile.Center; + float maxDistance = 460f; + bool homeIn = false; - if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings - { - Vector2 center = projectile.Center; - float maxDistance = 460f; - bool homeIn = false; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (Main.npc[i].height / 2); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float extraDistance = (float)(Main.npc[i].width / 2) + (Main.npc[i].height / 2); + bool canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); - bool canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) - { - center = Main.npc[i].Center; - homeIn = true; - break; - } - } - } - - if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 15f) / (21f); - } - } + if (homeIn) + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 15f) / 21f; + } + } if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) - { - if (modPlayer.eQuiver && projectile.ranged && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) - { - if (Main.rand.Next(200) > 198) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - if (projectile.owner == Main.myPlayer) - { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(startAngle) * 8f), (float)(Math.Cos(startAngle) * 8f), projectile.type, (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(startAngle) * 8f), (float)(-Math.Cos(startAngle) * 8f), projectile.type, (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[projectile1].ranged = false; - Main.projectile[projectile2].ranged = false; - Main.projectile[projectile1].timeLeft = 60; - Main.projectile[projectile2].timeLeft = 60; - Main.projectile[projectile1].noDropItem = true; - Main.projectile[projectile2].noDropItem = true; - } - } - } + { + if (modPlayer.fungalSymbiote && trueMelee) + { + if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 15) + { + //Note: these don't count as true melee anymore but its useful code to keep around + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType() || projectile.type == ProjectileID.SolarWhipSword) + { + Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + { + vector24.X = player.bodyFrame.Width - vector24.X; + } + if (player.gravDir != 1f) + { + vector24.Y = player.bodyFrame.Height - vector24.Y; + } + vector24 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; + Vector2 newCenter = player.RotatedRelativePoint(player.position + vector24, true) + projectile.velocity; + Projectile.NewProjectile(newCenter, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); + } + else + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.Mushroom, (int)(projectile.damage * 0.15), 0f, projectile.owner); + } + } + } + } - counter++; - if (modPlayer.fungalSymbiote && trueMelee) - { - if (counter % 6 == 0) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.Mushroom] < 30) + if (rogue) + { + if (modPlayer.nanotech) + { + if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) + { + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(60 * player.RogueDamage()), 0f, projectile.owner); + } + } + } + else if (modPlayer.moonCrown) + { + if (Main.player[projectile.owner].miscCounter % 120 == 0 && projectile.FinalExtraUpdate()) { - //Note: these don't count as true melee anymore but its useful code to keep around - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || - projectile.type == ProjectileType() || projectile.type == ProjectileID.SolarWhipSword) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) { - Vector2 vector24 = Main.OffsetsPlayerOnhand[Main.player[projectile.owner].bodyFrame.Y / 56] * 2f; - if (player.direction != 1) - { - vector24.X = player.bodyFrame.Width - vector24.X; - } - if (player.gravDir != 1f) - { - vector24.Y = player.bodyFrame.Height - vector24.Y; - } - vector24 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f; - Vector2 newCenter = player.RotatedRelativePoint(player.position + vector24, true) + projectile.velocity; - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ProjectileID.Mushroom, - (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - } - else - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileID.Mushroom, - (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(45 * player.RogueDamage()), 0f, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceTypeless = true; } } - } - } + } - if (rogue) - { - if (modPlayer.nanotech && rogue && projectile.type != ProjectileType() && projectile.type != ProjectileType()) - { - if (counter % 30 == 0) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 25) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), - (int)(projectile.damage * 0.1), 0f, projectile.owner, 0f, 0f); + if (modPlayer.dragonScales) + { + if (Main.player[projectile.owner].miscCounter % 50 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 5) + { + int proj = Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), + (int)(80 * player.RogueDamage()), 0f, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceTypeless = true; } - } - } - // Moon Crown gets overridden by Nanotech - else if (modPlayer.moonCrown) - { - //Summon moon sigils infrequently - if (Main.rand.NextBool(300) && projectile.type != ProjectileType() && projectile.type != ProjectileType()) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.2), 0, projectile.owner); - } - } - if (modPlayer.dragonScales && projectile.type != ProjectileType() && projectile.type != ProjectileType()) - { - if (counter % 50 == 0) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileType()] < 15) - { - //spawn a dust that does 1/5th of the original damage - int projectileID = Projectile.NewProjectile(projectile.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi), ProjectileType(), - (int)(projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f); - } - } - } + } + } - if (modPlayer.daedalusSplit) - { - if (counter % 30 == 0) - { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.CrystalShard] < 30) - { - for (int i = 0; i < 2; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.CrystalShard, (int)(projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); - Main.projectile[shard].Calamity().forceTypeless = true; - } - } - } - } - //will always be friendly and rogue if it has this boost - if (modPlayer.momentumCapacitor && momentumCapacitatorBoost) - { - if (projectile.velocity.Length() < 26f) - projectile.velocity *= 1.05f; - } + if (modPlayer.daedalusSplit) + { + if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) + { + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.CrystalShard] < 30) + { + for (int i = 0; i < 2; i++) + { + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.CrystalShard, CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceTypeless = true; + } + } + } + } - if (player.meleeEnchant > 0 && !projectile.noEnchantments) - { - switch (player.meleeEnchant) - { - case 1: - if (Main.rand.NextBool(3)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 171, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].noGravity = true; - Main.dust[index].fadeIn = 1.5f; - Main.dust[index].velocity *= 0.25f; - } - if (Main.rand.NextBool(3)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 171, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].noGravity = true; - Main.dust[index].fadeIn = 1.5f; - Main.dust[index].velocity *= 0.25f; - } - break; - case 2: - if (Main.rand.NextBool(2)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity *= 0.7f; - Main.dust[index].velocity.Y -= 0.5f; - } - break; - case 3: - if (Main.rand.NextBool(2)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity *= 0.7f; - Main.dust[index].velocity.Y -= 0.5f; - } - break; - case 4: - if (Main.rand.NextBool(2)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 57, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 1.1f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity.X /= 2f; - Main.dust[index].velocity.Y /= 2f; - } - break; - case 5: - if (Main.rand.NextBool(2)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].velocity.X += projectile.direction; - Main.dust[index].velocity.Y += 0.2f; - Main.dust[index].noGravity = true; - } - break; - case 6: - if (Main.rand.NextBool(2)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].velocity.X += projectile.direction; - Main.dust[index].velocity.Y += 0.2f; - Main.dust[index].noGravity = true; - } - break; - case 8: - if (Main.rand.NextBool(4)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 46, 0.0f, 0.0f, 100, new Color(), 1f); - Main.dust[index].noGravity = true; - Main.dust[index].fadeIn = 1.5f; - Main.dust[index].velocity *= 0.25f; - } - break; - default: - break; - } - } - } + // Will always be friendly and rogue if it has this boost + if (modPlayer.momentumCapacitor && momentumCapacitatorBoost) + { + if (projectile.velocity.Length() < 26f) + projectile.velocity *= 1.05f; + } - if (modPlayer.theBee && projectile.owner == Main.myPlayer && projectile.damage > 0 && player.statLife >= player.statLifeMax2) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); - Main.dust[dust].noGravity = true; - } - } + if (player.meleeEnchant > 0 && !projectile.noEnchantments) + { + switch (player.meleeEnchant) + { + case 1: + if (Main.rand.NextBool(3)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 171, 0.0f, 0.0f, 100, new Color(), 1f); + Main.dust[index].noGravity = true; + Main.dust[index].fadeIn = 1.5f; + Main.dust[index].velocity *= 0.25f; + } + if (Main.rand.NextBool(3)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 171, 0.0f, 0.0f, 100, new Color(), 1f); + Main.dust[index].noGravity = true; + Main.dust[index].fadeIn = 1.5f; + Main.dust[index].velocity *= 0.25f; + } + break; + case 2: + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); + Main.dust[index].noGravity = true; + Main.dust[index].velocity *= 0.7f; + Main.dust[index].velocity.Y -= 0.5f; + } + break; + case 3: + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 2.5f); + Main.dust[index].noGravity = true; + Main.dust[index].velocity *= 0.7f; + Main.dust[index].velocity.Y -= 0.5f; + } + break; + case 4: + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 57, projectile.velocity.X * 0.2f + (projectile.direction * 3), projectile.velocity.Y * 0.2f, 100, new Color(), 1.1f); + Main.dust[index].noGravity = true; + Main.dust[index].velocity.X /= 2f; + Main.dust[index].velocity.Y /= 2f; + } + break; + case 5: + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 169, 0.0f, 0.0f, 100, new Color(), 1f); + Main.dust[index].velocity.X += projectile.direction; + Main.dust[index].velocity.Y += 0.2f; + Main.dust[index].noGravity = true; + } + break; + case 6: + if (Main.rand.NextBool(2)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 135, 0.0f, 0.0f, 100, new Color(), 1f); + Main.dust[index].velocity.X += projectile.direction; + Main.dust[index].velocity.Y += 0.2f; + Main.dust[index].noGravity = true; + } + break; + case 8: + if (Main.rand.NextBool(4)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, 46, 0.0f, 0.0f, 100, new Color(), 1f); + Main.dust[index].noGravity = true; + Main.dust[index].fadeIn = 1.5f; + Main.dust[index].velocity *= 0.25f; + } + break; + default: + break; + } + } + } - if (modPlayer.providenceLore && projectile.owner == Main.myPlayer && projectile.damage > 0 && - (projectile.melee || projectile.ranged || projectile.magic || projectile.thrown || rogue)) - { - if (Main.rand.NextBool(5)) - { - int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].noLight = true; - } - } + if (modPlayer.theBee && projectile.owner == Main.myPlayer && projectile.damage > 0 && player.statLife >= player.statLifeMax2) + { + if (Main.rand.NextBool(5)) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); + Main.dust[dust].noGravity = true; + } + } - if (!projectile.melee && player.meleeEnchant > 0 && !projectile.noEnchantments) - { - if (player.meleeEnchant == 7) //flask of party affects all types of weapons - { - Vector2 velocity = projectile.velocity; - if (velocity.Length() > 4.0) - velocity *= 4f / velocity.Length(); - if (Main.rand.NextBool(20)) - { - int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(139, 143), velocity.X, velocity.Y, 0, new Color(), 1.2f); - Main.dust[index].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); - Main.dust[index].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); - Main.dust[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; - Main.dust[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; - Main.dust[index].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.01); - } - if (Main.rand.NextBool(40)) - { - int Type = Main.rand.Next(276, 283); - int index = Gore.NewGore(projectile.position, velocity, Type, 1f); - Main.gore[index].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); - Main.gore[index].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); - Main.gore[index].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.01); - Main.gore[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; - Main.gore[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; - } - } - } - } - } + if (!projectile.melee && player.meleeEnchant > 0 && !projectile.noEnchantments) + { + if (player.meleeEnchant == 7) //flask of party affects all types of weapons + { + Vector2 velocity = projectile.velocity; + if (velocity.Length() > 4.0) + velocity *= 4f / velocity.Length(); + if (Main.rand.NextBool(20)) + { + int index = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.Next(139, 143), velocity.X, velocity.Y, 0, new Color(), 1.2f); + Main.dust[index].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.dust[index].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.dust[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; + Main.dust[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; + Main.dust[index].scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.01); + } + if (Main.rand.NextBool(40)) + { + int Type = Main.rand.Next(276, 283); + int index = Gore.NewGore(projectile.position, velocity, Type, 1f); + Main.gore[index].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.gore[index].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.01); + Main.gore[index].scale *= (float)(1.0 + Main.rand.Next(-20, 21) * 0.01); + Main.gore[index].velocity.X += Main.rand.Next(-50, 51) * 0.05f; + Main.gore[index].velocity.Y += Main.rand.Next(-50, 51) * 0.05f; + } + } + } + } + } #endregion #region PostAI public override void PostAI(Projectile projectile) { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); - // Set crit here to avoid issues with projectiles that change class types in PreAI and AI - if (defCrit == 0 && !projectile.npcProj && !projectile.trap && Main.myPlayer == projectile.owner) - { - if (projectile.melee) - defCrit = modPlayer.critStats[0]; - else if (projectile.ranged) - defCrit = modPlayer.critStats[1]; - else if (projectile.magic) - defCrit = modPlayer.critStats[2]; - else if (rogue) - defCrit = modPlayer.critStats[3]; - else if (projectile.IsSummon()) - defCrit = 4; - else if (player.ActiveItem().crit > 0) - defCrit = player.ActiveItem().crit; - } + // optimization to remove conversion X/Y loop for irrelevant projectiles + bool isConversionProjectile = projectile.type == ProjectileID.PurificationPowder + || projectile.type == ProjectileID.PureSpray + || projectile.type == ProjectileID.CorruptSpray + || projectile.type == ProjectileID.CrimsonSpray + || projectile.type == ProjectileID.HallowSpray; + if (!isConversionProjectile) + return; - if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) - { - int x = (int)(projectile.Center.X / 16f); - int y = (int)(projectile.Center.Y / 16f); - for (int i = x - 1; i <= x + 1; i++) - { - for (int j = y - 1; j <= y + 1; j++) - { - if (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); - } - //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson - if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); - } - if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); - } - if (projectile.type == ProjectileID.HallowSpray) - { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } - } - } - #endregion - - #region ModifyHitNPC - public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - // Super dummies have nearly 10 million max HP (which is used in damage calculations). - // This can very easily cause damage numbers that are unrealistic for the weapon. - // As a result, they are omitted in this code. - if (!target.boss && target.type != NPCType()) - { - if (target.Inorganic() && hasInorganicEnemyHitBoost) - { - damage += (int)(target.lifeMax * inorganicEnemyHitBoost); - inorganicEnemyHitEffect?.Invoke(target); - } - if (target.Organic() && hasOrganicEnemyHitBoost) - { - damage += (int)(target.lifeMax * organicEnemyHitBoost); - organicEnemyHitEffect?.Invoke(target); - } - } - - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) - { - int critMax = 100; - int critChance = (int)MathHelper.Clamp(defCrit, 1, critMax); - crit = Main.rand.Next(1, critMax + 1) <= critChance; - - if ((uint)(projectile.type - ProjectileID.DD2LightningAuraT1) <= 2u) - { - if (player.setMonkT3) - crit = Main.rand.NextBool(4); - else if (player.setMonkT2) - crit = Main.rand.NextBool(6); - } - - if (rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) - crit = true; - - //Following things need to be done in here. If done in the projectile file, it's overridden by the thing above - if (projectile.type == ProjectileType() && projectile.ai[0] == 1f) - crit = true; - - if (projectile.type == ProjectileType()) - { - double damageMult = 1D; - if (crit) - { - damageMult += 0.25; - } - if (target.Inorganic()) - { - damageMult += 0.1; - } - damage = (int)(damage * damageMult); - } - - if (projectile.type == ProjectileType()) - { - damage = (int)(damage * 1.2); - if (!crit) - crit = Main.rand.NextBool(10); - } - - if (projectile.type == ProjectileType()) - { - if (crit) - { - damage = (int)(damage * 1.25); - knockback *= 1.25f; - } - } - } - } - #endregion - - #region OnHitNPC - public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit) - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && projectile.friendly) + if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) { - if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - target.immune[projectile.owner] = 10; - } + int x = (int)(projectile.Center.X / 16f); + int y = (int)(projectile.Center.Y / 16f); - //flask of party affects all types of weapons, !projectile.melee is to prevent double flask effects - if (!projectile.melee && player.meleeEnchant == 7) - Projectile.NewProjectile(target.Center, target.velocity, ProjectileID.ConfettiMelee, 0, 0f, projectile.owner, 0f, 0f); + bool isPowder = projectile.type == ProjectileID.PurificationPowder; + /* || projectile.type == ProjectileID.VilePowder || projectile.type == ProjectileID.ViciousPowder */ - if (rogue && stealthStrike && modPlayer.dragonScales && CalamityUtils.CountProjectiles(ProjectileType()) < 2) + for (int i = x - 1; i <= x + 1; i++) { - int projTileX = (int)(projectile.Center.X / 16f); - int projTileY = (int)(projectile.Center.Y / 16f); - int distance = 100; - if (projTileX < 10) + for (int j = y - 1; j <= y + 1; j++) { - projTileX = 10; - } - if (projTileX > Main.maxTilesX - 10) - { - projTileX = Main.maxTilesX - 10; - } - if (projTileY < 10) - { - projTileY = 10; - } - if (projTileY > Main.maxTilesY - distance - 10) - { - projTileY = Main.maxTilesY - distance - 10; - } - 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 (projectile.type == ProjectileID.PureSpray || projectile.type == ProjectileID.PurificationPowder) { - projTileX = x; - break; + AstralBiome.ConvertFromAstral(i, j, ConvertType.Pure, !isPowder); } - } - int projectileIndex = Projectile.NewProjectile(projTileX * 16 + 8, projTileY * 16 - 24, 0f, 0f, ProjectileType(), 420, 15f, Main.myPlayer, 16f, 16f); - Main.projectile[projectileIndex].Calamity().forceRogue = true; - Main.projectile[projectileIndex].netUpdate = true; - Main.projectile[projectileIndex].localNPCHitCooldown = 1; - } - - // Spectre Damage set and Nebula set work on enemies which are "immune to lifesteal" - if (!target.canGhostHeal) - { - if (player.ghostHurt) - { - projectile.ghostHurt(damage, target.Center); - } - - if (player.setNebula && player.nebulaCD == 0 && Main.rand.Next(3) == 0) - { - player.nebulaCD = 30; - int boosterType = Utils.SelectRandom(Main.rand, new int[] - { - ItemID.NebulaPickup1, - ItemID.NebulaPickup2, - ItemID.NebulaPickup3 - }); - int nebulaBooster = Item.NewItem(target.Center, target.Size, boosterType, 1, false, 0, false, false); - Main.item[nebulaBooster].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; - Main.item[nebulaBooster].velocity.X = Main.rand.Next(10, 31) * 0.2f * projectile.direction; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.SyncItem, -1, -1, null, nebulaBooster, 0f, 0f, 0f, 0, 0, 0); - } - } - } - - if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType() && !player.moonLeech) - { - // Increases the degree to which Spectre Healing set contributes to the lifesteal cap - if (player.ghostHeal) - { - float cooldownMult = 0.1f; - cooldownMult -= projectile.numHits * 0.025f; - if (cooldownMult < 0f) - cooldownMult = 0f; - - float cooldown = damage * cooldownMult; - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } - - // Increases the degree to which Vampire Knives contribute to the lifesteal cap - if (projectile.type == ProjectileID.VampireKnife) - { - float cooldown = damage * 0.075f; - if (cooldown < 0f) - cooldown = 0f; - - Main.player[Main.myPlayer].lifeSteal -= cooldown; - } - - if (modPlayer.vampiricTalisman && rogue && crit) - { - float heal = MathHelper.Clamp(damage * 0.015f, 0f, 6f); - if ((int)heal > 0) - { - SpawnLifeStealProjectile(projectile, player, heal, ProjectileID.VampireHeal, 1200f, 2f); - } - } - - if ((modPlayer.bloodyGlove || modPlayer.electricianGlove) && rogue && stealthStrike) - { - player.statLife += 1; - player.HealEffect(1); - } - - bool otherHealTypes = modPlayer.auricSet || modPlayer.silvaSet || modPlayer.godSlayerMage || modPlayer.tarraMage || modPlayer.ataxiaMage; - - if (projectile.magic && player.ActiveItem().magic) - { - if (modPlayer.manaOverloader && otherHealTypes) - { - if (Main.rand.NextBool(2)) - { - float healMult = 0.2f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); - goto OTHEREFFECTS; - } - } - } - - if (modPlayer.auricSet) - { - float healMult = 0.05f; - healMult -= projectile.numHits * 0.025f; - float heal = projectile.damage * healMult; - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 3f); - } - else if (modPlayer.silvaSet) - { - float healMult = 0.03f; - healMult -= projectile.numHits * 0.015f; - float heal = projectile.damage * healMult; - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 3f); - } - else if (projectile.magic && player.ActiveItem().magic) - { - if (modPlayer.manaOverloader) - { - float healMult = 0.2f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); - } - if (modPlayer.godSlayerMage) - { - float healMult = 0.06f; - healMult -= projectile.numHits * 0.015f; - float heal = projectile.damage * healMult; - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); - } - else if (modPlayer.tarraMage) - { - if (modPlayer.tarraMageHealCooldown <= 0) - { - modPlayer.tarraMageHealCooldown = 90; - - float healMult = 0.1f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult; - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - Main.player[Main.myPlayer].lifeSteal -= heal * 6f; - int healAmount = (int)heal; - player.statLife += healAmount; - player.HealEffect(healAmount); - - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; - } - } - else if (modPlayer.ataxiaMage) - { - float healMult = 0.1f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult; - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); - } - else if (modPlayer.manaOverloader) - { - float healMult = 0.2f; - healMult -= projectile.numHits * 0.05f; - float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); - - if (heal > 50) - heal = 50; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto OTHEREFFECTS; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); - } - } - } - - OTHEREFFECTS: - - if (modPlayer.alchFlask && - (projectile.magic || rogue || projectile.melee || projectile.IsSummon() || projectile.ranged) && - player.ownedProjectileCounts[ProjectileType()] < 6) - { - int plague = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30), 0f, projectile.owner, 0f, 0f); - Main.projectile[plague].Calamity().forceTypeless = true; - } - - if (modPlayer.reaverBlast && projectile.melee) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 30), 0f, projectile.owner, 0f, 0f); - } - - if (projectile.magic) - { - if (modPlayer.silvaMage && projectile.penetrate == 1 && Main.rand.Next(0, 100) >= 97) - { - Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 103); - ExpandHitboxBy(projectile, 96); - for (int d = 0; d < 3; d++) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 157, 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, 157, 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, 157, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.5f); - Main.dust[explode].velocity *= 2f; - Main.dust[explode].noGravity = true; - } - projectile.damage *= modPlayer.auricSet ? 7 : 4; - projectile.localNPCHitCooldown = 10; - projectile.usesLocalNPCImmunity = true; - projectile.Damage(); - } - - if (modPlayer.reaverBurst) - { - int projAmt = Main.rand.Next(2, 5); - for (int i = 0; i < projAmt; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int proj = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 15), 0f, projectile.owner, 0f, 0f); - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; - } - } - else if (modPlayer.ataxiaMage && modPlayer.ataxiaDmg <= 0) - { - SpawnOrb(projectile, (int)(projectile.damage * 0.625), ProjectileType(), 800f, 20f); - int cooldown = (int)(projectile.damage * 0.5f); - modPlayer.ataxiaDmg += cooldown; - } - else if (modPlayer.godSlayerMage && modPlayer.godSlayerDmg <= 0) - { - SpawnOrb(projectile, (int)(projectile.damage * (modPlayer.auricSet ? 1 : 0.75)), ProjectileType(), 800f, 20f); - int cooldown = (int)(projectile.damage * 0.5f); - modPlayer.godSlayerDmg += cooldown; - } - } - if (projectile.melee) - { - if (modPlayer.ataxiaGeyser && player.ownedProjectileCounts[ProjectileType()] < 3) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 35), 0f, projectile.owner, 0f, 0f); - } - } - if (rogue) - { - if (modPlayer.xerocSet && modPlayer.xerocDmg <= 0 && player.ownedProjectileCounts[ProjectileType()] < 3 && player.ownedProjectileCounts[ProjectileType()] < 3) - { - int cooldown = (int)(projectile.damage * 0.5f); - switch (Main.rand.Next(5)) - { - case 0: - - SpawnOrb(projectile, (int)(projectile.damage * 0.8), ProjectileType(), 800f, Main.rand.Next(15, 30)); - modPlayer.xerocDmg += cooldown; - - break; - - case 1: - - SpawnOrb(projectile, (int)(projectile.damage * 0.625), ProjectileType(), 800f, 30f); - modPlayer.xerocDmg += cooldown; - - if (target.canGhostHeal && Main.player[Main.myPlayer].lifeSteal > 0f) - { - float healMult = 0.06f; - healMult -= projectile.numHits * 0.015f; - float heal = projectile.damage * healMult; - - if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) - goto SKIPXEROC; - - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); - } - - break; - - case 2: - - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 40), 0f, projectile.owner, 0f, 0f); - - break; - - case 3: - - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 40), 0f, projectile.owner, 0f, 0f); - - break; - - case 4: - - SpawnOrb(projectile, (int)(projectile.damage * 0.6), ProjectileType(), 800f, 15f); - modPlayer.xerocDmg += cooldown; - - break; - - default: - break; - } - } - - SKIPXEROC: - - if (modPlayer.featherCrown && stealthStrike && modPlayer.featherCrownCooldown <= 0 && stealthStrikeHitCount < 5) - { - for (int i = 0; i < 6; i++) + //commented out for Terraria 1.4 when vile/vicious powder spread corruption/crimson + if (projectile.type == ProjectileID.CorruptSpray)// || projectile.type == ProjectileID.VilePowder) { - Vector2 source = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - float speedX = (target.Center.X - source.X) / 30f; - float speedY = (target.Center.Y - source.Y) * 8; - Vector2 velocity = new Vector2(speedX, speedY); - int dmg = (int)(15 + (projectile.damage * 0.05f)); - int feather = Projectile.NewProjectile(source, velocity, ProjectileType(), dmg, 3f, projectile.owner); - Main.projectile[feather].Calamity().forceRogue = true; - modPlayer.featherCrownCooldown = 15; + AstralBiome.ConvertFromAstral(i, j, ConvertType.Corrupt, !isPowder); } - } - - if (modPlayer.moonCrown && stealthStrike && modPlayer.moonCrownCooldown <= 0 && stealthStrikeHitCount < 5) - { - for (int i = 0; i < 6; i++) + if (projectile.type == ProjectileID.CrimsonSpray)// || projectile.type == ProjectileID.ViciousPowder) { - Vector2 source = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (target.Center - source) / 10f; - int dmg = (int)(150 + (projectile.damage * 0.05f)); - int flare = Projectile.NewProjectile(source, velocity, ProjectileID.LunarFlare, dmg, 3, projectile.owner); - Main.projectile[flare].Calamity().forceRogue = true; - modPlayer.moonCrownCooldown = 15; + AstralBiome.ConvertFromAstral(i, j, ConvertType.Crimson, !isPowder); } - } - - if (modPlayer.nanotech && stealthStrike && modPlayer.nanoFlareCooldown <= 0 && stealthStrikeHitCount < 5) - { - for (int i = 0; i < 6; i++) + if (projectile.type == ProjectileID.HallowSpray) { - Vector2 source = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (target.Center - source) / 40f; - int dmg = (int)(1000 + (projectile.damage * 0.05f)); - int flare = Projectile.NewProjectile(source, velocity, ProjectileType(),dmg, 3f, projectile.owner); - Main.projectile[flare].Calamity().rogue = true; - modPlayer.nanoFlareCooldown = 15; - } - } - - if (modPlayer.forbiddenCirclet && stealthStrike && modPlayer.forbiddenCooldown <= 0 && stealthStrikeHitCount < 5) - { - for (int index2 = 0; index2 < 6; index2++) - { - float xVector = Main.rand.Next(-35, 36) * 0.02f; - float yVector = Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - int dmg = (int)(75 + (projectile.damage * 0.05f)); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, xVector, yVector, ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); - modPlayer.forbiddenCooldown = 15; - } - } - - if (modPlayer.titanHeartSet && stealthStrike && modPlayer.titanCooldown <= 0 && stealthStrikeHitCount < 5) - { - int dmg = (int)(85 + (projectile.damage * 0.05f)); - int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[boom].Calamity().forceRogue = true; - Main.PlaySound(SoundID.Item14, projectile.position); - 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); - Main.dust[d].noGravity = true; - Main.dust[d].position = projectile.Center; - } - modPlayer.titanCooldown = 15; - } - - if (modPlayer.corrosiveSpine && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && stealthStrikeHitCount < 5) - { - for (int i = 0; i < 3; i++) - { - if (Main.rand.NextBool(2)) - { - int type = -1; - switch (Main.rand.Next(15)) - { - case 0: - type = ProjectileType(); - break; - case 1: - type = ProjectileType(); - break; - case 2: - type = ProjectileType(); - break; - } - // Should never happen, but just in case- - if (type != -1) - { - float speed = Main.rand.NextFloat(5f, 11f); - Projectile.NewProjectile(target.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, - type, (int)(projectile.damage * 0.6), projectile.knockBack, player.whoAmI); - } - } - } - target.AddBuff(BuffID.Venom, 240); - } - - if (modPlayer.shadow && modPlayer.shadowPotCooldown <= 0 && stealthStrikeHitCount < 5) - { - if (CalamityMod.javelinProjList.Contains(projectile.type)) - { - int randrot = Main.rand.Next(-30, 391); - Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); - Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f); - modPlayer.shadowPotCooldown = 30; - } - if (CalamityMod.spikyBallProjList.Contains(projectile.type)) - { - int scythe = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 1f, 0f); - Main.projectile[scythe].usesLocalNPCImmunity = true; - Main.projectile[scythe].localNPCHitCooldown = 10; - Main.projectile[scythe].penetrate = 2; - modPlayer.shadowPotCooldown = 30; - } - if (CalamityMod.daggerProjList.Contains(projectile.type)) - { - Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); - shardVelocity.Normalize(); - shardVelocity *= 5f; - int shard = Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 60), 0f, projectile.owner); - Main.projectile[shard].timeLeft = 150; - modPlayer.shadowPotCooldown = 30; - } - if (CalamityMod.boomerangProjList.Contains(projectile.type)) - { - int spiritDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 60); - Projectile ghost = SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); - ghost.Calamity().forceRogue = true; - ghost.penetrate = 1; - modPlayer.shadowPotCooldown = 30; - } - if (CalamityMod.flaskBombProjList.Contains(projectile.type)) - { - int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); - Main.projectile[blackhole].Center = projectile.Center; - modPlayer.shadowPotCooldown = 30; - } - } - } - if (projectile.IsSummon()) - { - if (modPlayer.pArtifact && !modPlayer.profanedCrystal) - { - target.AddBuff(BuffType(), 300); - } - if (modPlayer.profanedCrystalBuffs) - { - target.AddBuff(Main.dayTime ? BuffType() : BuffType(), 600); - } - - if (modPlayer.tearMinions) - { - target.AddBuff(BuffType(), 60); - } - - if (modPlayer.shadowMinions) - { - target.AddBuff(BuffID.ShadowFlame, 300); - } - - if (modPlayer.voltaicJelly) - { - //100% chance for Star Tainted Generator or Nucleogenesis - //20% chance for Voltaic Jelly - if (Main.rand.NextBool(modPlayer.starTaintedGenerator ? 1 : 5)) - { - target.AddBuff(BuffID.Electrified, 60); - } - } - - if (modPlayer.starTaintedGenerator) - { - target.AddBuff(BuffType(), 180); - target.AddBuff(BuffType(), 180); - } - - // Fearmonger set's colossal life regeneration - if(modPlayer.fearmongerSet) - { - modPlayer.fearmongerRegenFrames += 20; - if (modPlayer.fearmongerRegenFrames > 180) - modPlayer.fearmongerRegenFrames = 180; - } - - if (modPlayer.godSlayerSummon && modPlayer.godSlayerDmg <= 0) - { - SpawnOrb(projectile, projectile.damage, ProjectileType(), 800f, 15f, true); - int cooldown = (int)(projectile.damage * 0.5f); - modPlayer.godSlayerDmg += cooldown; - } - - //Priorities: Nucleogenesis => Starbuster Core => Nuclear Rod => Jelly-Charged Battery - List summonExceptionList = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - - if (summonExceptionList.TrueForAll(x => projectile.type != x)) - { - if (modPlayer.jellyDmg <= 0) - { - if (modPlayer.nucleogenesis) - { - if (Main.rand.NextBool(4)) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 90), projectile.knockBack * 0.25f, projectile.owner); - modPlayer.jellyDmg = 25f; - } - } - else if (modPlayer.starbusterCore) - { - if (Main.rand.NextBool(3)) - { - int cap = modPlayer.starTaintedGenerator ? 75 : 60; - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), - CalamityUtils.DamageSoftCap(projectile.damage * 0.5, cap), 3f, projectile.owner); - modPlayer.jellyDmg = 20f; - } - } - else if (modPlayer.nuclearRod) - { - if (Main.rand.NextBool(3)) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), - CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 40), 0f, projectile.owner); - modPlayer.jellyDmg = 20f; - } - } - else if (modPlayer.jellyChargedBattery) - { - SpawnOrb(projectile, (int)(projectile.damage * 0.525), ProjectileType(), 800f, 15f); - int cooldown = (int)(projectile.damage * 0.5f); - modPlayer.jellyDmg += cooldown; - } - } - - if (modPlayer.hallowedPower) - { - if (Main.rand.NextBool(3) && modPlayer.hallowedRuneCooldown <= 0) - { - modPlayer.hallowedRuneCooldown = 60; - Vector2 spawnPosition = target.Center - new Vector2(0f, 920f).RotatedByRandom(0.3f); - float speed = Main.rand.NextFloat(17f, 23f); - Projectile.NewProjectile(spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * speed, - ProjectileType(), projectile.damage / 3, 3f, projectile.owner); - } - } - } - } - - if (projectile.ranged) - { - if (modPlayer.tarraRanged && Main.rand.Next(0, 100) >= 88 && player.ownedProjectileCounts[ProjectileType()] <= 20 && (projectile.timeLeft <= 2 || projectile.penetrate <= 1)) - { - int projAmt = Main.rand.Next(2, 4); - for (int projCount = 0; projCount < projAmt; projCount++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.33, 65), 0f, projectile.owner, 0f, 0f); + AstralBiome.ConvertFromAstral(i, j, ConvertType.Hallow); } + NetMessage.SendTileRange(-1, i, j, 1, 1); } } } } #endregion + #region Grappling Hooks + public override void GrapplePullSpeed(Projectile projectile, Player player, ref float speed) + { + if (player.Calamity().reaverSpeed) + speed *= 1.1f; + } + + public override void GrappleRetreatSpeed(Projectile projectile, Player player, ref float speed) + { + if (player.Calamity().reaverSpeed) + speed *= 1.1f; + } + #endregion + + #region ModifyHitNPC + public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + if (modPlayer.rottenDogTooth && projectile.Calamity().stealthStrike) + target.AddBuff(BuffType(), RottenDogtooth.ArmorCrunchDebuffTime); + + // Super dummies have nearly 10 million max HP (which is used in damage calculations). + // This can very easily cause damage numbers that are unrealistic for the weapon. + // As a result, they are omitted in this code. + + List ignoreTheseBitches = new List() + { + NPCType(), + NPCID.TheDestroyerBody, //why aren't these bosses + NPCID.TheDestroyerTail + }; + if (!target.boss && ignoreTheseBitches.TrueForAll(x => target.type != x)) + { + if (target.Inorganic() && hasInorganicEnemyHitBoost) + { + damage += (int)(target.lifeMax * inorganicEnemyHitBoost); + inorganicEnemyHitEffect?.Invoke(target); + } + if (target.Organic() && hasOrganicEnemyHitBoost) + { + damage += (int)(target.lifeMax * organicEnemyHitBoost); + organicEnemyHitEffect?.Invoke(target); + } + } + + if (modPlayer.flamingItemEnchant && !projectile.minion) + target.AddBuff(BuffType(), 420); + + if (modPlayer.farProximityRewardEnchant) + { + float proximityDamageInterpolant = Utils.InverseLerp(250f, 2400f, target.Distance(player.Center), true); + float proximityDamageFactor = MathHelper.SmoothStep(0.7f, 1.45f, proximityDamageInterpolant); + damage = (int)Math.Ceiling(damage * proximityDamageFactor); + } + + if (modPlayer.closeProximityRewardEnchant) + { + float proximityDamageInterpolant = Utils.InverseLerp(400f, 175f, target.Distance(player.Center), true); + float proximityDamageFactor = MathHelper.SmoothStep(0.75f, 1.75f, proximityDamageInterpolant); + damage = (int)Math.Ceiling(damage * proximityDamageFactor); + } + + if (!projectile.npcProj && !projectile.trap && rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) + crit = true; + } + #endregion + #region CanDamage public override bool CanDamage(Projectile projectile) { @@ -2003,8 +2254,13 @@ namespace CalamityMod.Projectiles if (Main.player[Main.myPlayer].Calamity().trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); - if (Main.player[Main.myPlayer].Calamity().omniscience && projectile.hostile) - return Color.Coral; + if (Main.LocalPlayer.Calamity().omniscience && projectile.hostile && projectile.damage > 0 && projectile.alpha < 255) + { + if (projectile.modProjectile is null || projectile.modProjectile != null && projectile.modProjectile.CanHitPlayer(Main.LocalPlayer) && projectile.modProjectile.CanDamage()) + { + return Color.Coral; + } + } if (projectile.type == ProjectileID.PinkLaser) { @@ -2014,162 +2270,106 @@ namespace CalamityMod.Projectiles return Color.Transparent; } + if (projectile.type == ProjectileID.SeedPlantera || projectile.type == ProjectileID.PoisonSeedPlantera || + projectile.type == ProjectileID.ThornBall || projectile.type == ProjectileID.CultistBossFireBallClone || + projectile.type == ProjectileID.AncientDoomProjectile) + { + if (projectile.timeLeft < 85) + { + 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 null; } public override bool PreDraw(Projectile projectile, SpriteBatch spriteBatch, Color lightColor) { - if (Main.player[Main.myPlayer].Calamity().trippy) + if (Main.player[Main.myPlayer].Calamity().trippy) { Texture2D texture = Main.projectileTexture[projectile.type]; + SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) - { spriteEffects = SpriteEffects.FlipHorizontally; - } + Vector2 vector11 = new Vector2(texture.Width / 2, texture.Height / Main.projFrames[projectile.type] / 2); Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); Color alpha15 = projectile.GetAlpha(color9); + for (int num213 = 0; num213 < 4; num213++) { Vector2 position9 = projectile.position; float num214 = Math.Abs(projectile.Center.X - Main.player[Main.myPlayer].Center.X); float num215 = Math.Abs(projectile.Center.Y - Main.player[Main.myPlayer].Center.Y); + if (num213 == 0 || num213 == 2) - { position9.X = Main.player[Main.myPlayer].Center.X + num214; - } else - { position9.X = Main.player[Main.myPlayer].Center.X - num214; - } + position9.X -= projectile.width / 2; + if (num213 == 0 || num213 == 1) - { position9.Y = Main.player[Main.myPlayer].Center.Y + num215; - } else - { position9.Y = Main.player[Main.myPlayer].Center.Y - num215; - } + int frames = texture.Height / Main.projFrames[projectile.type]; int y = frames * projectile.frame; position9.Y -= projectile.height / 2; + Main.spriteBatch.Draw(texture, new Vector2(position9.X - Main.screenPosition.X + (projectile.width / 2) - texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + projectile.height - texture.Height * projectile.scale / Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } } + return true; } - - public static void DrawCenteredAndAfterimage(Projectile projectile, Color lightColor, int trailingMode, int afterimageCounter, Texture2D texture = null, bool drawCentered = true) - { - if (texture is null) - 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; - - Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - Vector2 origin = rectangle.Size() / 2f; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - if (CalamityConfig.Instance.Afterimages) - { - Vector2 centerOffset = drawCentered ? projectile.Size / 2f : Vector2.Zero; - switch (trailingMode) - { - case 0: - for (int i = 0; i < projectile.oldPos.Length; i++) - { - Vector2 drawPos = projectile.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((projectile.oldPos.Length - i) / projectile.oldPos.Length); - Main.spriteBatch.Draw(texture, drawPos, rectangle, color, rotation, origin, scale, spriteEffects, 0f); - } - break; - - case 1: - Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16)); - int whyIsThisAlwaysEight = 8; - int k = 1; - while (k < whyIsThisAlwaysEight) - { - Color color26 = color25; - color26 = projectile.GetAlpha(color26); - float num164 = whyIsThisAlwaysEight - k; - color26 *= num164 / (ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f); - Main.spriteBatch.Draw(texture, projectile.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, color26, rotation, origin, scale, spriteEffects, 0f); - k += afterimageCounter; - } - break; - - default: - break; - } - } - - // Draw the projectile itself - Vector2 startPos = drawCentered ? projectile.Center : projectile.position; - Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), rectangle, projectile.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); - } #endregion #region Kill public override void Kill(Projectile projectile, int timeLeft) { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) { - if (modPlayer.providenceLore && projectile.friendly && projectile.damage > 0 && (projectile.melee || projectile.ranged || projectile.magic || rogue)) - { - Main.PlaySound(SoundID.Item20, projectile.Center); - for (int dustIndex = 0; dustIndex < 3; dustIndex++) - { - int fire = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 1f); - Main.dust[fire].noGravity = true; - } - } - if (rogue) { - if (modPlayer.etherealExtorter && Main.rand.Next(0, 100) >= 95) + if (modPlayer.etherealExtorter && Main.player[projectile.owner].ownedProjectileCounts[ProjectileType()] < 5) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int soul = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); - Main.projectile[soul].tileCollide = false; - } + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int soul = Projectile.NewProjectile(projectile.Center, velocity, ProjectileType(), (int)(25 * player.RogueDamage()), 0f, projectile.owner); + Main.projectile[soul].tileCollide = false; + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].Calamity().forceTypeless = true; + } } - if (modPlayer.scuttlersJewel && CalamityMod.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) - { - float dmgMult = 1f; - if (projectile.type == ProjectileType()) - dmgMult = 0.5f; - int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(projectile.damage * 0.5f * dmgMult), projectile.knockBack, projectile.owner); - Main.projectile[spike].frame = 4; + if (modPlayer.scuttlersJewel && CalamityLists.javelinProjList.Contains(projectile.type) && Main.rand.NextBool(3)) + { + int spike = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), (int)(15 * player.RogueDamage()), projectile.knockBack, projectile.owner); + Main.projectile[spike].frame = 4; + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].Calamity().forceTypeless = true; } } - if (projectile.type == ProjectileID.UnholyWater) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); - } - if (projectile.type == ProjectileID.BloodWater) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); - } - if (projectile.type == ProjectileID.HolyWater) - { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); - } + if (projectile.type == ProjectileID.UnholyWater) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 1f); + + if (projectile.type == ProjectileID.BloodWater) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 2f); + + if (projectile.type == ProjectileID.HolyWater) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, 3f); } } #endregion @@ -2186,213 +2386,229 @@ namespace CalamityMod.Projectiles #endregion #region LifeSteal - public static bool CanSpawnLifeStealProjectile(Projectile projectile, float healMultiplier, float healAmount) - { - if (healMultiplier <= 0f || (int)healAmount <= 0) - return false; - - return true; - } - - public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) - { - if (Main.player[Main.myPlayer].moonLeech) - return; - Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; - float lowestHealthCheck = 0f; - int healTarget = projectile.owner; - 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)) - { - float playerDist = Vector2.Distance(projectile.Center, otherPlayer.Center); - if (playerDist < distanceRequired && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) - { - lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; - healTarget = i; - } - } - } - Projectile.NewProjectile(projectile.Center, Vector2.Zero, healProjectileType, 0, 0f, projectile.owner, healTarget, healAmount); - } - #endregion - - #region AI Shortcuts - public static Projectile SpawnOrb(Projectile projectile, int damage, int projType, float distanceRequired, float speedMult, bool gsPhantom = false) + public static bool CanSpawnLifeStealProjectile(float healMultiplier, float healAmount) { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + if (healMultiplier <= 0f || (int)healAmount <= 0) + return false; - float ai1 = Main.rand.NextFloat() + 0.5f; - int[] array = new int[Main.maxNPCs]; - int targetArrayA = 0; - int targetArrayB = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) - { - float enemyDist = Vector2.Distance(projectile.Center, npc.Center); - if (enemyDist < distanceRequired) - { - if (Collision.CanHit(projectile.position, 1, 1, npc.position, npc.width, npc.height) && enemyDist > 50f) - { - array[targetArrayB] = i; - targetArrayB++; - } - else if (targetArrayB == 0) - { - array[targetArrayA] = i; - targetArrayA++; - } - } - } - } - if (targetArrayA == 0 && targetArrayB == 0) - { - return Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner); - } - int target = targetArrayB <= 0 ? array[Main.rand.Next(targetArrayA)] : array[Main.rand.Next(targetArrayB)]; - Vector2 velocity = CalamityUtils.RandomVelocity(100f, speedMult, speedMult, 1f); - Projectile orb = Projectile.NewProjectileDirect(projectile.Center, velocity, projType, damage, 0f, projectile.owner, gsPhantom ? 0f : target, gsPhantom ? ai1 : 0f); - return orb; - } + return true; + } - public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) - { - Vector2 center = projectile.Center; - float maxDistance = distanceRequired; - bool homeIn = false; + public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier) + { + if (Main.player[Main.myPlayer].moonLeech) + return; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + Main.player[Main.myPlayer].lifeSteal -= healAmount * cooldownMultiplier; - bool canHit = true; - if (extraDistance < maxDistance && !ignoreTiles) - canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); - - if (Vector2.Distance(Main.npc[i].Center, projectile.Center) < (maxDistance + extraDistance) && canHit) - { - center = Main.npc[i].Center; - homeIn = true; - break; - } - } - } - - if (!projectile.friendly) + float lowestHealthCheck = 0f; + int healTarget = projectile.owner; + for (int i = 0; i < Main.maxPlayers; i++) { - homeIn = false; + Player otherPlayer = Main.player[i]; + if (otherPlayer.active && !otherPlayer.dead && ((!player.hostile && !otherPlayer.hostile) || player.team == otherPlayer.team)) + { + float playerDist = Vector2.Distance(projectile.Center, otherPlayer.Center); + if (playerDist < distanceRequired && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + { + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + healTarget = i; + } + } } - if (homeIn) + Projectile.NewProjectile(projectile.Center, Vector2.Zero, healProjectileType, 0, 0f, projectile.owner, healTarget, healAmount); + } + #endregion + + // TODO -- this entire region needs to go to Projectile Utilities + #region AI Shortcuts + public static Projectile SpawnOrb(Projectile projectile, int damage, int projType, float distanceRequired, float speedMult, bool gsPhantom = false) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + float ai1 = Main.rand.NextFloat() + 0.5f; + int[] array = new int[Main.maxNPCs]; + int targetArrayA = 0; + int targetArrayB = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float enemyDist = Vector2.Distance(projectile.Center, npc.Center); + if (enemyDist < distanceRequired) + { + if (Collision.CanHit(projectile.position, 1, 1, npc.position, npc.width, npc.height) && enemyDist > 50f) + { + array[targetArrayB] = i; + targetArrayB++; + } + else if (targetArrayB == 0) + { + array[targetArrayA] = i; + targetArrayA++; + } + } + } + } + if (targetArrayA == 0 && targetArrayB == 0) + { + return Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner); + } + int target = targetArrayB <= 0 ? array[Main.rand.Next(targetArrayA)] : array[Main.rand.Next(targetArrayB)]; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, speedMult, speedMult, 1f); + Projectile orb = Projectile.NewProjectileDirect(projectile.Center, velocity, projType, damage, 0f, projectile.owner, gsPhantom ? 0f : target, gsPhantom ? ai1 : 0f); + return orb; + } + + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float N) + { + if (!projectile.friendly) + return; + + // Set amount of extra updates. + if (projectile.Calamity().defExtraUpdates == -1) + projectile.Calamity().defExtraUpdates = projectile.extraUpdates; + + Vector2 destination = projectile.Center; + float maxDistance = distanceRequired; + bool locatedTarget = false; + + // Find a target. + for (int i = 0; i < Main.maxNPCs; i++) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + if (!Main.npc[i].CanBeChasedBy(projectile, false) || !projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance)) + continue; + + if (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + destination = Main.npc[i].Center; + locatedTarget = true; + break; + } + } + + if (locatedTarget) + { + // Increase amount of extra updates to greatly increase homing velocity. + projectile.extraUpdates = projectile.Calamity().defExtraUpdates + 1; + + // Home in on the target. + Vector2 homeDirection = (destination - projectile.Center).SafeNormalize(Vector2.UnitY); + projectile.velocity = (projectile.velocity * N + homeDirection * homingVelocity) / (N + 1f); + } + else { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * N + homeInVector * homingVelocity) / (N + 1f); + // Set amount of extra updates to default amount. + projectile.extraUpdates = projectile.Calamity().defExtraUpdates; } - } + } - public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D, bool attackMultiple = false) - { - float maxDistance = distanceRequired; - bool homeIn = false; - int[] targetArray = new int[maxTargets]; - int targetArrayIndex = 0; + public static void MagnetSphereHitscan(Projectile projectile, float distanceRequired, float homingVelocity, float projectileTimer, int maxTargets, int spawnedProjectile, double damageMult = 1D, bool attackMultiple = false) + { + float maxDistance = distanceRequired; + bool homeIn = false; + int[] targetArray = new int[maxTargets]; + int targetArrayIndex = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(projectile, false)) - { - float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); - bool canHit = true; - if (extraDistance < maxDistance) - canHit = Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1); + bool canHit = true; + if (extraDistance < maxDistance) + canHit = 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 (targetArrayIndex < maxTargets) - { - targetArray[targetArrayIndex] = i; - targetArrayIndex++; - homeIn = true; - } - else - break; - } - } - } + if (projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance) && canHit) + { + if (targetArrayIndex < maxTargets) + { + targetArray[targetArrayIndex] = i; + targetArrayIndex++; + homeIn = true; + } + else + break; + } + } + } - if (homeIn) - { - int randomTarget = Main.rand.Next(targetArrayIndex); - randomTarget = targetArray[randomTarget]; + if (homeIn) + { + int randomTarget = Main.rand.Next(targetArrayIndex); + randomTarget = targetArray[randomTarget]; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > projectileTimer) - { - projectile.localAI[0] = 0f; - Vector2 value = projectile.Center + projectile.velocity * 4f; - Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - value) * homingVelocity; + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > projectileTimer) + { + projectile.localAI[0] = 0f; + Vector2 spawnPos = projectile.Center + projectile.velocity * 4f; + Vector2 velocity = Vector2.Normalize(Main.npc[randomTarget].Center - spawnPos) * homingVelocity; - if (attackMultiple) - { - for (int i = 0; i < targetArrayIndex; i++) - { - velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - value) * homingVelocity; + if (attackMultiple) + { + for (int i = 0; i < targetArrayIndex; i++) + { + velocity = Vector2.Normalize(Main.npc[targetArray[i]].Center - spawnPos) * homingVelocity; - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(value.X, value.Y, velocity.X, velocity.Y, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); - if (projectile.type == ProjectileType() && projectile.Calamity().rogue) - Main.projectile[projectile2].Calamity().forceRogue = true; - } - } + if (projectile.type == ProjectileType()) + if (projectile2.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile2].Calamity().forceRogue = true; + } + } - return; - } + return; + } - if (projectile.type == ProjectileType()) - { - velocity.Y += Main.rand.Next(-30, 31) * 0.05f; - velocity.X += Main.rand.Next(-30, 31) * 0.05f; - } + if (projectile.type == ProjectileType()) + { + velocity.Y += Main.rand.Next(-30, 31) * 0.05f; + velocity.X += Main.rand.Next(-30, 31) * 0.05f; + } - if (projectile.owner == Main.myPlayer) - { - int projectile2 = Projectile.NewProjectile(value.X, value.Y, velocity.X, velocity.Y, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); + if (projectile.owner == Main.myPlayer) + { + int projectile2 = Projectile.NewProjectile(spawnPos, velocity, spawnedProjectile, (int)(projectile.damage * damageMult), projectile.knockBack, projectile.owner, 0f, 0f); - if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || - projectile.type == ProjectileType() || projectile.type == ProjectileType()) - Main.projectile[projectile2].Calamity().forceMelee = true; - } - } - } - } + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType() || projectile.type == ProjectileType()) + if (projectile2.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile2].Calamity().forceMelee = true; - public static void ExpandHitboxBy(Projectile projectile, int width, int height) - { - projectile.position = projectile.Center; - projectile.width = width; - projectile.height = height; - projectile.position -= projectile.Size * 0.5f; - } - public static void ExpandHitboxBy(Projectile projectile, int newSize) - { - ExpandHitboxBy(projectile, newSize, newSize); - } - public static void ExpandHitboxBy(Projectile projectile, float expandRatio) - { - ExpandHitboxBy(projectile, (int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); - } - #endregion - } + if (projectile.type == ProjectileType()) + if (projectile2.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectile2].Calamity().forceRogue = true; + } + } + } + } + + public static void ExpandHitboxBy(Projectile projectile, int width, int height) + { + projectile.position = projectile.Center; + projectile.width = width; + projectile.height = height; + projectile.position -= projectile.Size * 0.5f; + } + + public static void ExpandHitboxBy(Projectile projectile, int newSize) + { + ExpandHitboxBy(projectile, newSize, newSize); + } + + public static void ExpandHitboxBy(Projectile projectile, float expandRatio) + { + ExpandHitboxBy(projectile, (int)(projectile.width * expandRatio), (int)(projectile.height * expandRatio)); + } + #endregion + } } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs index b861048863..27c59a60ee 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class FrequencyManipulatorEnergy : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; @@ -27,7 +29,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.height = 8; projectile.friendly = true; projectile.Calamity().rogue = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = Lifetime; projectile.extraUpdates = 1; } @@ -42,7 +45,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { 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.DirectionTo(potentialTarget.Center) * oldSpeed) / (inertia + 1f); + projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * oldSpeed) / (inertia + 1f); projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * oldSpeed; } } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.png b/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.png deleted file mode 100644 index 272321a620..0000000000 Binary files a/Projectiles/DraedonsArsenal/FrequencyManipulatorEnergy.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs index 4c8cdd178f..270b2eda5d 100644 --- a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs +++ b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.cs @@ -5,111 +5,117 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { - public class FrequencyManipulatorProjectile : ModProjectile - { - public float Time - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } - public const int TotalSpins = 2; - public const float SpinTime = 60f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Frequency Manipulator"); - } + public class FrequencyManipulatorProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/FrequencyManipulator"; - public override void SetDefaults() - { - projectile.width = 34; - projectile.height = 34; - projectile.friendly = true; - projectile.timeLeft = 180; - projectile.penetrate = 4; - projectile.extraUpdates = 1; - projectile.Calamity().rogue = true; - } + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int TotalSpins = 2; + public const float SpinTime = 30f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frequency Manipulator"); + } - public override void AI() - { - Lighting.AddLight(projectile.Center, Color.Purple.ToVector3()); + 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; + } - Time++; - 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; - ManipulatePlayerItemValues(player); - } - else if (Time == SpinTime + 1f) - { - RingDustEffect(player.itemLocation, 1f, 1f, 5f, 2f); - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * player.ActiveItem().shootSpeed; - } - } + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.Purple.ToVector3()); - public void ManipulatePlayerItemValues(Player player) - { - player.direction = projectile.direction; - player.heldProj = projectile.whoAmI; - player.itemRotation = projectile.rotation; - player.itemTime = player.itemAnimation; - } + Time++; + 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; + ManipulatePlayerItemValues(player); + } + else if (Time == SpinTime + 1f) + { + projectile.tileCollide = true; + RingDustEffect(player.itemLocation, 1f, 1f, 5f, 2f); + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * player.ActiveItem().shootSpeed; + } + } - public void RingDustEffect(Vector2 spawnPosition, float scale, float fadeIn, float ringSpeed, float secondaryRingSpeedMultiplier) - { - if (Main.dedServ) - return; - for (int i = 0; i < 36; i++) - { - float angle = MathHelper.TwoPi * i / 36f; - Dust dust = Dust.NewDustPerfect(spawnPosition, 234); - dust.scale = scale; - dust.fadeIn = scale; - dust.velocity = angle.ToRotationVector2() * ringSpeed; + public void ManipulatePlayerItemValues(Player player) + { + player.direction = projectile.direction; + player.heldProj = projectile.whoAmI; + player.itemRotation = projectile.rotation; + player.itemTime = player.itemAnimation; + } - dust = Dust.NewDustPerfect(spawnPosition, 173); - dust.scale = scale; - dust.fadeIn = scale; - dust.velocity = angle.ToRotationVector2() * ringSpeed * secondaryRingSpeedMultiplier; - } - } + public void RingDustEffect(Vector2 spawnPosition, float scale, float fadeIn, float ringSpeed, float secondaryRingSpeedMultiplier) + { + if (Main.dedServ) + return; + for (int i = 0; i < 36; i++) + { + float angle = MathHelper.TwoPi * i / 36f; + Dust dust = Dust.NewDustPerfect(spawnPosition, 234); + dust.scale = scale; + dust.fadeIn = scale; + dust.velocity = angle.ToRotationVector2() * ringSpeed; - public void OnHitEffects() - { - if (Main.myPlayer != projectile.owner) - return; - // Explode if the projectile is a stealth strike projectile. - int totalEnergyParticlesToSpawn = 4; - if (projectile.Calamity().stealthStrike) - { - Main.PlaySound(SoundID.Item14, projectile.Center); - totalEnergyParticlesToSpawn = 4; - RingDustEffect(projectile.Center, 1.6f, 1.4f, 7f, 2.6f); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, 160); + dust = Dust.NewDustPerfect(spawnPosition, 173); + dust.scale = scale; + dust.fadeIn = scale; + dust.velocity = angle.ToRotationVector2() * ringSpeed * secondaryRingSpeedMultiplier; + } + } + + public void OnHitEffects() + { + if (Main.myPlayer != projectile.owner) + return; + // Explode if the projectile is a stealth strike projectile. + int totalEnergyParticlesToSpawn = 4; + if (projectile.Calamity().stealthStrike) + { + Main.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(); 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); - } - } + 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); + } + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - OnHitEffects(); - } - public override bool OnTileCollide(Vector2 oldVelocity) - { - OnHitEffects(); - return true; - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + OnHitEffects(); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + OnHitEffects(); + return true; + } + } } diff --git a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.png b/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.png deleted file mode 100644 index e99257dcc2..0000000000 Binary files a/Projectiles/DraedonsArsenal/FrequencyManipulatorProjectile.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs index a3b25915a7..644ce5e7f8 100644 --- a/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs +++ b/Projectiles/DraedonsArsenal/GalvanizingGlaiveProjectile.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.ownerHitCheck = true; projectile.hide = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 6; projectile.alpha = 255; } @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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/DraedonsArsenal/GalvanizingLightning"), start, end, new Vector2(0.2f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + Utils.DrawLaser(spriteBatch, ModContent.GetTexture("CalamityMod/Projectiles/LightningProj"), start, end, new Vector2(0.2f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } diff --git a/Projectiles/DraedonsArsenal/GalvanizingLightning.png b/Projectiles/DraedonsArsenal/GalvanizingLightning.png deleted file mode 100644 index d238f920e6..0000000000 Binary files a/Projectiles/DraedonsArsenal/GalvanizingLightning.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs index 8b832590d2..e03bec6fec 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs @@ -1,3 +1,5 @@ +using CalamityMod.Items; +using CalamityMod.Items.Weapons.DraedonsArsenal; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using System; @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { Player player = Main.player[projectile.owner]; - float num = 1.57079637f; + float num = MathHelper.PiOver2; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.type == ModContent.ProjectileType()) { @@ -41,14 +43,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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; - bool flag = false; + bool shootThisFrame = false; if (projectile.ai[1] >= fireRate) { projectile.ai[1] = 0f; - flag = true; + shootThisFrame = true; } + if (projectile.soundDelay <= 0) { projectile.soundDelay = fireRate * 6; @@ -59,27 +63,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal gatlingLaserLoop = Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireLoop"), (int)projectile.position.X, (int)projectile.position.Y); } } - if (flag && Main.myPlayer == projectile.owner && fireLasers) + if (shootThisFrame && Main.myPlayer == projectile.owner && fireLasers) { Item gatling = player.ActiveItem(); - int weaponDamage2 = player.GetWeaponDamage(gatling); - bool flag2 = player.channel && !player.noItems && !player.CCed; + + // This grabs the weapon's current damage, taking current charge level into account. + int currentDamage = player.GetWeaponDamage(gatling); + + bool stillInUse = player.channel && !player.noItems && !player.CCed; // This both checks if the player has sufficient mana and consumes it if they do. // If this is false, the Gatling Laser stops functioning. - bool hasMana = player.CheckMana(gatling.mana, true, false); + bool hasMana = player.CheckMana(gatling, -1, true, false); - if (flag2 && hasMana) + // Checks if the Gatling Laser has sufficient charge to fire. If this is false, it stops functioning. + CalamityGlobalItem modItem = gatling.Calamity(); + bool hasCharge = modItem.Charge >= GatlingLaser.HoldoutChargeUse; + + if (stillInUse && hasMana && hasCharge) { - // Attempt to use power from the held item. - if (player.ActiveItem().type >= ItemID.Count && - player.ActiveItem().Calamity().Chargeable && - player.ActiveItem().Calamity().CurrentCharge > 0 && - Main.rand.NextBool((int)(120 / (float)fireRate))) - { - player.ActiveItem().Calamity().CurrentCharge--; - } - float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value2 = vector; Vector2 value3 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value2; @@ -102,7 +104,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float velocity = 3f; value2 = projectile.Center; Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * velocity; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914); + + double spread = Math.PI / 32D; + spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 2D * spread - spread); + if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) { spinningpoint = -Vector2.UnitY; @@ -116,7 +121,10 @@ 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 - Projectile.NewProjectile(value2.X, value2.Y, SpeedX, SpeedY, type, weaponDamage2, projectile.knockBack, projectile.owner, ai0, 0f); + + // 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); } else { @@ -124,7 +132,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal gatlingLaserLoop.Stop(); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/GatlingLaserFireEnd"), (int)projectile.position.X, (int)projectile.position.Y); - projectile.Kill(); } } diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs index 83c36e2a8b..e232c51a4b 100644 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class GatlingLaserShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust = 182; public override void SetStaticDefaults() diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.png b/Projectiles/DraedonsArsenal/GatlingLaserShot.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/DraedonsArsenal/GatlingLaserShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GaussEnergy.cs b/Projectiles/DraedonsArsenal/GaussEnergy.cs index a21d2ca03d..9971fc503d 100644 --- a/Projectiles/DraedonsArsenal/GaussEnergy.cs +++ b/Projectiles/DraedonsArsenal/GaussEnergy.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class GaussEnergy : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Gauss Energy"); diff --git a/Projectiles/DraedonsArsenal/GaussEnergy.png b/Projectiles/DraedonsArsenal/GaussEnergy.png deleted file mode 100644 index 7b8c60b2b8..0000000000 Binary files a/Projectiles/DraedonsArsenal/GaussEnergy.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GaussFlux.cs b/Projectiles/DraedonsArsenal/GaussFlux.cs index 6c5c2ac096..2fce06a109 100644 --- a/Projectiles/DraedonsArsenal/GaussFlux.cs +++ b/Projectiles/DraedonsArsenal/GaussFlux.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class GaussFlux : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; @@ -30,8 +32,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.melee = true; projectile.penetrate = -1; projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 14; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/DraedonsArsenal/GaussFlux.png b/Projectiles/DraedonsArsenal/GaussFlux.png deleted file mode 100644 index 272321a620..0000000000 Binary files a/Projectiles/DraedonsArsenal/GaussFlux.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.cs b/Projectiles/DraedonsArsenal/GaussPistolShot.cs index 06ddbb9a08..4158f915aa 100644 --- a/Projectiles/DraedonsArsenal/GaussPistolShot.cs +++ b/Projectiles/DraedonsArsenal/GaussPistolShot.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class GaussPistolShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; @@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public const float MinEnergyParticleSpeed = 0.25f; public const float MaxEnergyParticleSpeed = 4f; public const float EnergyChargeRadiusRatio = 1.45f; - public const float ChargeTime = 60f; + public const float ChargeTime = 30f; public override void SetStaticDefaults() { DisplayName.SetDefault("Gauss Shot"); diff --git a/Projectiles/DraedonsArsenal/GaussPistolShot.png b/Projectiles/DraedonsArsenal/GaussPistolShot.png deleted file mode 100644 index 272321a620..0000000000 Binary files a/Projectiles/DraedonsArsenal/GaussPistolShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs index 063519ea10..739fac4046 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleBlast.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleBlast.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class GaussRifleBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; @@ -20,18 +22,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { - projectile.width = projectile.height = 60; + projectile.width = projectile.height = 40; projectile.friendly = true; projectile.ranged = true; - projectile.penetrate = 1; projectile.timeLeft = 300; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; } public override void AI() { Time++; + projectile.tileCollide = Time > 3f; if (!Main.dedServ) { // Idle dust. @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(projectile.Center, 263); dust.velocity = angle.ToRotationVector2().RotatedByRandom(0.25f) * Main.rand.NextFloat(6f, 8f); dust.noGravity = true; - dust.scale = 2.1f; + dust.scale = 1.6f; } } // Ring dust. @@ -54,10 +54,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * radius, 226); dust.velocity = Vector2.Zero; dust.noGravity = true; - dust.scale = 2f; + dust.scale = 1.5f; } } } + public override void Kill(int timeLeft) { if (Main.myPlayer == projectile.owner) diff --git a/Projectiles/DraedonsArsenal/GaussRifleBlast.png b/Projectiles/DraedonsArsenal/GaussRifleBlast.png deleted file mode 100644 index d819c1bdce..0000000000 Binary files a/Projectiles/DraedonsArsenal/GaussRifleBlast.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs index fa749b237d..6fad3ee233 100644 --- a/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs +++ b/Projectiles/DraedonsArsenal/GaussRifleExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class GaussRifleExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; @@ -22,10 +24,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.width = projectile.height = 500; projectile.friendly = true; projectile.ranged = true; - projectile.penetrate = 1; - projectile.timeLeft = 60; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 20; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 12; } public override void AI() @@ -41,7 +44,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.velocity = dust.velocity.RotatedByRandom(0.4f); dust.velocity = dust.velocity.RotatedBy(Time / 60f * MathHelper.ToRadians(720f)); dust.velocity *= Main.rand.NextFloat(20f, 50f); - dust.scale = Main.rand.NextFloat(1.7f, 2.1f); + dust.scale = Main.rand.NextFloat(1.2f, 1.6f); dust.noGravity = true; } } diff --git a/Projectiles/DraedonsArsenal/GaussRifleExplosion.png b/Projectiles/DraedonsArsenal/GaussRifleExplosion.png deleted file mode 100644 index d819c1bdce..0000000000 Binary files a/Projectiles/DraedonsArsenal/GaussRifleExplosion.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs index e805248d22..02b81cda59 100644 --- a/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs +++ b/Projectiles/DraedonsArsenal/HydraulicVoltCrasherProjectile.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,7 +10,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class HydraulicVoltCrasherProjectile : ModProjectile { - private int chargeCooldown = 0; + private int chargeCooldown = 0; public override void SetStaticDefaults() { @@ -18,15 +21,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetDefaults() { projectile.width = 56; - projectile.height = 26; + projectile.height = 56; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; projectile.hide = true; projectile.ownerHitCheck = true; projectile.melee = true; - projectile.scale = 1.1f; + projectile.scale = 1.75f; } + public override void AI() { projectile.timeLeft = 60; @@ -39,9 +43,9 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.frame = 0; } } - // Decrement charge cooldown - if (chargeCooldown > 0) - chargeCooldown = 0; + // Decrement charge cooldown + if (chargeCooldown > 0) + chargeCooldown = 0; // Play idle sounds every so often. if (projectile.soundDelay <= 0) { @@ -50,19 +54,26 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } Player player = Main.player[projectile.owner]; Vector2 center = player.RotatedRelativePoint(player.MountedCenter); + if (Main.myPlayer == player.whoAmI) { - if (player.channel) + // Get the projectile owner's held item. If it's not a modded item, stop now to prevent weird errors. + Item heldItem = player.ActiveItem(); + if (heldItem.type < ItemID.Count) { - // Attempt to use power from the held item. - if (player.ActiveItem().type >= ItemID.Count && - player.ActiveItem().Calamity().Chargeable && - player.ActiveItem().Calamity().CurrentCharge > 0 && - Main.rand.NextBool(50)) - { - player.ActiveItem().Calamity().CurrentCharge--; - } + 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); + + // 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(); + if (player.channel && modItem.Charge >= HydraulicVoltCrasher.HoldoutChargeUse) + { + modItem.Charge -= HydraulicVoltCrasher.HoldoutChargeUse; + float speed = player.inventory[player.selectedItem].shootSpeed * projectile.scale; Vector2 toPointTo = Main.MouseWorld; if (player.gravDir == -1f) @@ -93,8 +104,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Main.rand.NextBool(5)) { - Vector2 spawnPosition = projectile.Center; - spawnPosition += projectile.Size.RotatedBy(projectile.velocity.ToRotation() - MathHelper.ToRadians(25f)) * 0.65f * projectile.scale; + Vector2 spawnPosition = projectile.velocity; + spawnPosition.Normalize(); + 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 += player.velocity * 0.4f; @@ -103,17 +116,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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); - if (chargeCooldown > 0) - return; - chargeCooldown = 60; + if (chargeCooldown > 0) + return; + chargeCooldown = 60; TryToSuperchargeNPC(target); for (int i = 0; i < Main.npc.Length; i++) { if (i != target.whoAmI && - target.CanBeChasedBy(projectile, false) && + Main.npc[i].CanBeChasedBy(projectile, false) && Main.npc[i].Distance(target.Center) < 240f) { if (TryToSuperchargeNPC(Main.npc[i])) @@ -130,6 +144,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } + public bool TryToSuperchargeNPC(NPC npc) { // Prevent supercharging an enemy twice. @@ -145,12 +160,25 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), - (int)(projectile.damage * 0.35), + (int)(projectile.damage * 0.8), 0f, projectile.owner, 0f, npc.whoAmI); return true; } + + 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; + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + return false; + } } } diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.cs b/Projectiles/DraedonsArsenal/LaserRifleShot.cs index a4e23a5fdf..3693f21563 100644 --- a/Projectiles/DraedonsArsenal/LaserRifleShot.cs +++ b/Projectiles/DraedonsArsenal/LaserRifleShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class LaserRifleShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust = 127; public override void SetStaticDefaults() diff --git a/Projectiles/DraedonsArsenal/LaserRifleShot.png b/Projectiles/DraedonsArsenal/LaserRifleShot.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/DraedonsArsenal/LaserRifleShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs index 04b86f9f7e..e2116c5ca5 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerLaser.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerLaser.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class MountedScannerLaser : BaseLaserbeamProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int OwnerIndex { get => Projectile.GetByUUID(projectile.owner, projectile.ai[1]); diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index 8e1fb15626..7aa8217b05 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -110,12 +110,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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) { Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(target.Center), + projectile.SafeDirectionTo(target.Center, Vector2.UnitY), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, diff --git a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs index be15c6b92f..b79472f354 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerBeam.cs @@ -36,9 +36,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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.DirectionTo(potentialTarget.Center) * 24f) / 8f; - } + projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(potentialTarget.Center, -Vector2.UnitY) * 24f) / 8f; + projectile.frameCounter++; } diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs index 1ac0956c06..165fcecad2 100644 --- a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs +++ b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.cs @@ -4,7 +4,11 @@ using CalamityMod.Items.Weapons.DraedonsArsenal; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -12,6 +16,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class PhaseslayerProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/Phaseslayer"; + // The "average" or "expected" swing speed which the sword's damage balance is based off of. // This is rotation EVERY FRAME. The "average" swing speed is 360 degrees in one second, aka pi/30 radians per frame. public const float StandardSwingSpeed = MathHelper.Pi / 30f; @@ -19,9 +25,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // How quickly the sword's damage updates to reflect its current speed. Higher values make it change damage more quickly. public const float DamageUpdateResponsiveness = 0.08f; - // When the accumuluated "charge exhaustion" meter reaches this value, the Phaseslayer item loses one point of charge. - public const float ChargeLossBreakpoint = 180f; - public const int SwordBeamCooldown = 15; public const float SwordBeamDamageMultiplier = 0.15f; private const float MaximumMouseRange = 360f; @@ -32,8 +35,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal get { CalamityGlobalItem swordItem = Main.player[projectile.owner].ActiveItem().Calamity(); - float chargeRatio = swordItem.CurrentCharge / (float)swordItem.ChargeMax; - return chargeRatio < Phaseslayer.SizeChargeThreshold; + return swordItem.ChargeRatio < Phaseslayer.SizeChargeThreshold; } } @@ -44,20 +46,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal set => projectile.ai[0] = value; } - // ai[1] wrapper. Stores an accumulating "charge exhaustion" meter. When it reaches the limit, a charge point is lost. - public float ChargeLossProgress + // ai[1] wrapper. Stores the sword's vanishing timer. + public float FadeoutTime { get => projectile.ai[1]; set => projectile.ai[1] = value; } - // localAI[0] wrapper - public float FadeoutTime - { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; - } - public int BladeFrameX => IsSmall ? 1 : projectile.frame / 7; public int BladeFrameY => IsSmall ? projectile.frame % 3 : projectile.frame % 7; @@ -65,7 +60,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { DisplayName.SetDefault("Phaseslayer"); ProjectileID.Sets.TrailingMode[projectile.type] = 2; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 13; } public override void SetDefaults() @@ -82,9 +77,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.localNPCHitCooldown = 7; } + // 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 AI() { 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; @@ -97,15 +100,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.soundDelay = SwordBeamCooldown; } - ManipulatePlayer(player); + ManipulatePlayer(player, modItem); + bool wasBig = !IsSmall; - UpdateCharge(player); bool justShrunk = IsSmall && wasBig; if (justShrunk) OnShrinkEffects(); - AdjustDamageBasedOnRotation(player, deltaAngle); + + AdjustCurrentDamage(player, deltaAngle); ManipulateFrames(); - HandleSwordBeams(player, deltaAngle); + HandleSwordBeams(player, modItem, deltaAngle); + + // Because sword beams (or just holding the sword while it's fizzling) can take energy even when the sword's at zero energy, + // this is here to ensure the sword item's charge never goes below zero. + if (modItem.Charge < 0f) + modItem.Charge = 0f; + HandleFadeout(); } @@ -114,13 +124,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal damage -= target.defense / 4; } - private void ManipulatePlayer(Player player) + private void ManipulatePlayer(Player player, CalamityGlobalItem modItem) { if (Main.myPlayer == player.whoAmI) { // In addition to typical channel cancellation criteria, the sword fizzles out if it runs out of charge. Item playerItem = player.ActiveItem(); - bool hasCharge = playerItem.Calamity().CurrentCharge > 0; + bool hasCharge = modItem.Charge > 0f; 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). @@ -132,7 +142,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float aimResponsiveness = 0.035f + 0.3f * (float)Math.Pow(distRatio, 1D/3); // Update the sword's angle with the responsiveness determined by mouse position. - projectile.rotation = projectile.rotation.AngleLerp(player.AngleTo(Main.MouseWorld), aimResponsiveness); + // 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) + { + projectile.netUpdate = true; + projectile.netSpam = 0; // You cannot stop Phaseslayer from sending packets. + } + projectile.rotation = newRotation; } // If the player is not wielding the sword, determine whether it should fade out or instantly vanish. @@ -145,39 +162,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal else projectile.Kill(); } - - projectile.Center = player.MountedCenter + projectile.rotation.ToRotationVector2() * ProjCenterOffset; } + // This line ensures the sword stays glued to the player, even for other players in multiplayer. + 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); - player.heldProj = projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; player.itemRotation = projectile.rotation * projectile.direction; } - private void UpdateCharge(Player player) - { - // Having the sword active at all costs some energy. - ChargeLossProgress += 1f; - - // If charge is due to be lost, reset the accumuluated charge exhaustion and update the player's held item. - if (ChargeLossProgress > ChargeLossBreakpoint) - { - ChargeLossProgress -= ChargeLossBreakpoint; - - if (Main.myPlayer == projectile.owner) - { - if (Main.mouseItem.active) - Main.mouseItem.Calamity().CurrentCharge--; - else - player.HeldItem.Calamity().CurrentCharge--; - } - } - } - private void OnShrinkEffects() { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/MechGaussRifle"), projectile.Center); @@ -194,7 +191,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - private void AdjustDamageBasedOnRotation(Player player, float deltaAngle) + private void AdjustCurrentDamage(Player player, float deltaAngle) { // Update the rolling "blade angular momentum" average by gently lerping in the newest data point. AngularDamageFactor = MathHelper.Lerp(AngularDamageFactor, deltaAngle, DamageUpdateResponsiveness); @@ -207,8 +204,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // 4x expected speed gives you 171.7% damage. // 5x expected speed gives you 187.0% damage. float speedDamageScalar = 0.166f + (float)Math.Log(AngularDamageFactor / StandardSwingSpeed + 1.5f, 3f); - float statDamageScalar = player.MeleeDamage() * (IsSmall ? Phaseslayer.SmallDamageMultiplier : 1f); - projectile.damage = (int)(Phaseslayer.Damage * speedDamageScalar * statDamageScalar); + + // 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); } private void ManipulateFrames() @@ -242,17 +242,19 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - private void HandleSwordBeams(Player player, float deltaAngle) + 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) { // Sword beams cost a noticeable amount of energy, but deal the blade's current damage. Swing harder to get more damage! - ChargeLossProgress += 30f; 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); + + // Actually consume energy to fire the sword beam. + modItem.Charge -= Phaseslayer.SwordBeamChargeUse; } // The sound delay doubles as the sword beam's cooldown. @@ -271,6 +273,28 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } + 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; + 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; + deltaAngle = Math.Abs(rotationAdjusted - oldRotationAdjusted); + + if (deltaAngle < 0.04f) + opacity = 0f; + + return Color.Lerp(Color.Red, Color.PaleVioletRed * completionRatio, MathHelper.Clamp(completionRatio * 0.8f, 0f, 1f)) * opacity; + } + + internal float WidthFunction(float completionRatio) => (IsSmall ? 101f : 127f) * (1f - completionRatio); + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D bladeTexture = ModContent.GetTexture("CalamityMod/Projectiles/DraedonsArsenal/PhaseslayerBlade"); @@ -280,19 +304,35 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 bladeOffset = projectile.rotation.ToRotationVector2() * (IsSmall ? 90f : 132f) * projectile.scale; Vector2 origin = bladeTexture.Size() * 0.5f; origin /= IsSmall ? new Vector2(1f, 3f) : new Vector2(3f, 7f); + Rectangle frame = IsSmall ? bladeTexture.Frame(1, 3, 0, BladeFrameY) : bladeTexture.Frame(3, 7, BladeFrameX, BladeFrameY); - // TODO: Update this afterimage drawcode to be more cool. - for (int i = 1; i < projectile.oldRot.Length; i++) - { - float angleDelta = MathHelper.Clamp(projectile.rotation - projectile.oldRot[i], -0.26f, 0.26f); - float angle = projectile.rotation + angleDelta; - angle += MathHelper.PiOver2; - Color color = Color.White * (float)Math.Pow(1f - i / (float)projectile.oldRot.Length, 3f); - Rectangle afterimageFrame = IsSmall ? bladeTexture.Frame(1, 3, 0, 2) : bladeTexture.Frame(3, 7, 2, 6); - spriteBatch.Draw(bladeTexture, projectile.Center + bladeOffset - Main.screenPosition, afterimageFrame, color, angle, origin, projectile.scale, SpriteEffects.None, 0f); - } + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]); + GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/SwordSlashTexture")); + + Player player = Main.player[projectile.owner]; + List positions = new List(); + + float swingAngularDirection = Math.Sign(projectile.rotation - projectile.oldRot[1]); + projectile.oldRot[0] += swingAngularDirection * 0.1f; + for (int i = 0; i < projectile.oldPos.Length; i++) + { + if (projectile.oldPos[i] == Vector2.Zero) + continue; + + // Skip over any very points going in the wrong direction, to prevent "nets" from the primitive. + if (i > 1 && Math.Sign(projectile.oldRot[i - 1] - projectile.oldRot[i]) != swingAngularDirection) + continue; + + Vector2 position = projectile.position + projectile.oldRot[i].ToRotationVector2() * (IsSmall ? 90f : 132f) * projectile.scale; + + positions.Add(position); + } + projectile.oldRot[0] -= swingAngularDirection * 0.1f; + + TrailDrawer.Draw(positions, projectile.Size * 0.5f - 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); diff --git a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.png b/Projectiles/DraedonsArsenal/PhaseslayerProjectile.png deleted file mode 100644 index 53f9fb432a..0000000000 Binary files a/Projectiles/DraedonsArsenal/PhaseslayerProjectile.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs index 43999de22b..0dfc2fc5fb 100644 --- a/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs +++ b/Projectiles/DraedonsArsenal/PlasmaCasterShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class PlasmaCasterShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust1 = 107; //160 private int dust2 = 110; //187 @@ -23,7 +25,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.friendly = true; projectile.magic = true; projectile.penetrate = 1; - projectile.extraUpdates = 5; + projectile.extraUpdates = 6; projectile.timeLeft = 600; } @@ -103,7 +105,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void Kill(int timeLeft) { - int height = 60; + int height = 90; projectile.position = projectile.Center; projectile.width = projectile.height = height; projectile.Center = projectile.position; diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs index ebdccbf200..f0584eb66b 100644 --- a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs +++ b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.cs @@ -7,13 +7,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class PlasmaGrenadeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/PlasmaGrenade"; + + private static readonly float Gravity = 0.09f; + public float Time { get => projectile.ai[0]; set => projectile.ai[0] = value; } - public const float FallAcceleration = 0.15f; - public const float MaxFallSpeed = 12f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Plasma Grenade"); @@ -25,7 +28,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.height = 28; projectile.friendly = true; projectile.penetrate = 1; - projectile.timeLeft = 180; + projectile.timeLeft = 300; + projectile.MaxUpdates = 2; projectile.Calamity().rogue = true; } @@ -33,27 +37,28 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; Vector2 projectileTop = projectile.Center + new Vector2(0f, projectile.height * -0.5f).RotatedBy(projectile.rotation); - if (projectile.velocity.Y < MaxFallSpeed && Time > 30f) - { - projectile.velocity.Y += 0.5f; - } + + if (Time > 10f) + 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; + dust.velocity += projectile.velocity * 0.25f; dust.scale = Main.rand.NextFloat(0.95f, 1.3f); } Time++; } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage += target.defense / 4; - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage += target.defense / 4; + } 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) { if (Main.myPlayer == projectile.owner) diff --git a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.png b/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.png deleted file mode 100644 index f00d0b133f..0000000000 Binary files a/Projectiles/DraedonsArsenal/PlasmaGrenadeProjectile.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 68d31b2395..cba32c5bc6 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.minion = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 24; + projectile.localNPCHitCooldown = 12; } public override void AI() @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.localAI[0] = 1f; } GrantBuffs(player); - NPC potentialTarget = projectile.Center.MinionHoming(900f, player); + NPC potentialTarget = projectile.Center.MinionHoming(1400f, player); if (potentialTarget is null) { PlayerMovement(player); @@ -63,13 +63,14 @@ namespace CalamityMod.Projectiles.DraedonsArsenal else { NPCMovement(potentialTarget); - if (Time % 90f < 60f) + if (Time % 60f < 35f) { RepelMovement(); } } Time++; } + public void Initialize(Player player) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); @@ -82,6 +83,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.noGravity = true; } } + // While this projectile cannot attack, the projectiles it shoots derive from the damage. public void AdjustDamage(Player player) { @@ -93,6 +95,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.damage = trueDamage; } } + public void GrantBuffs(Player player) { bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); @@ -109,13 +112,15 @@ 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.DirectionTo(destination) * 10f) / 5f; + 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++) @@ -131,25 +136,26 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } - if (Time % 90f < 40f) + if (Time % 60f < 20f) { float offsetAngle = AngularOffset * 0.5f + (!North).ToInt() * MathHelper.Pi; Vector2 destination = npc.Center + Vector2.UnitY.RotatedBy(offsetAngle) * 180f; - projectile.velocity = (projectile.velocity * 4f + projectile.DirectionTo(destination) * 10f) / 5f; - projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * 23f; + 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 % 90f < 60f) + else if (Time % 60f < 35f) { projectile.velocity *= 0.96f; projectile.rotation += 0.05f; } - else if (Time % 90f == 60f) + else if (Time % 60f == 35f) { - projectile.velocity = projectile.DirectionTo(npc.Center) * 26f; + projectile.velocity = projectile.SafeDirectionTo(npc.Center, -Vector2.UnitY) * 29f; projectile.rotation = projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } } + public void RepelMovement() { // This does not incorporate attraction on purpose. Doing so causes the minions to very easily become distracted. @@ -173,9 +179,10 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, 1, 2); + CalamityUtils.DrawAfterimagesCentered(projectile, 1, lightColor, 2); return false; } } diff --git a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs index d8209e7b8f..820a4a8edd 100644 --- a/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs +++ b/Projectiles/DraedonsArsenal/PulseDragonProjectile.cs @@ -1,3 +1,4 @@ +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -19,22 +20,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.timeLeft = ReelbackTime; } } + + public Player Owner => Main.player[projectile.owner]; public float Outwardness => OutwardnessMax * (float)Math.Sin(projectile.timeLeft / (float)Lifetime * MathHelper.Pi); - public float InitialRotation - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } - public float OutwardnessMax - { - get => projectile.ai[1]; - set => projectile.ai[1] = value; - } - public float SwingDirection - { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; - } + 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; @@ -55,7 +46,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.timeLeft = Lifetime; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - projectile.tileCollide = true; + projectile.tileCollide = false; + projectile.extraUpdates = 1; projectile.Calamity().hasInorganicEnemyHitBoost = true; projectile.Calamity().inorganicEnemyHitBoost = 0.003f; } @@ -72,17 +64,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { - Player player = Main.player[projectile.owner]; - projectile.rotation = projectile.AngleTo(player.Center) - MathHelper.PiOver2; - if (player.dead) + projectile.rotation = projectile.AngleTo(Owner.Center) - MathHelper.PiOver2; + if (Owner.dead) { projectile.Kill(); return; } - projectile.direction = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); + projectile.direction = (Owner.Center.X - projectile.Center.X > 0).ToDirectionInt(); projectile.spriteDirection = projectile.direction; - ManipulatePlayer(player); + + ManipulateOwnerFields(); if (projectile.timeLeft >= Lifetime - ChargeTime) { @@ -93,31 +85,30 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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), player.velocity.SafeNormalize(Vector2.Zero)) > 0.45f) + if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), Owner.velocity.SafeNormalize(Vector2.Zero)) > 0.45f) { - projectile.velocity += player.velocity; + projectile.velocity += Owner.velocity; } - projectile.tileCollide = true; } else { - projectile.velocity = projectile.DirectionTo(player.Center) * 43f; + projectile.velocity = projectile.SafeDirectionTo(Owner.Center, Vector2.UnitX * Owner.direction) * 43f; projectile.timeLeft = ReelbackTime; - if (projectile.Distance(player.Center) < 45f) + if (projectile.WithinRange(Owner.Center, 45f)) projectile.Kill(); } GenerateIdleDust(); - if (projectile.timeLeft % 3 == 2 && projectile.Distance(player.Center) > 40f) + if (projectile.timeLeft % 3 == 2 && projectile.Distance(Owner.Center) > 40f) SpawnElectricFields(); } - public void ManipulatePlayer(Player player) + public void ManipulateOwnerFields() { - player.itemAnimation = 4; - player.itemTime = 4; - player.ChangeDir(-projectile.direction); - player.itemRotation = projectile.rotation + (projectile.spriteDirection == -1).ToInt() * MathHelper.TwoPi; + Owner.itemAnimation = 4; + Owner.itemTime = 4; + Owner.ChangeDir(-projectile.direction); + Owner.itemRotation = projectile.rotation + (projectile.spriteDirection == -1).ToInt() * MathHelper.TwoPi; } public void GenerateIdleDust() @@ -137,20 +128,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (Main.myPlayer != projectile.owner) return; Projectile field = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ProjectileID.Electrosphere, projectile.damage, projectile.knockBack, projectile.owner); - field.Calamity().forceMelee = true; - field.usesLocalNPCImmunity = true; - field.localNPCHitCooldown = 3; - field.timeLeft = 12; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - projectile.tileCollide = false; - projectile.velocity = Vector2.Zero; - ReelingBack = true; - projectile.netUpdate = true; - return false; + if (field.whoAmI.WithinBounds(Main.maxProjectiles)) + { + field.Calamity().forceMelee = true; + field.usesLocalNPCImmunity = true; + field.localNPCHitCooldown = 3; + field.timeLeft = 12; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -172,10 +156,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Vector2 offset = Vector2.UnitX * -SwingDirection; offset *= Outwardness * (float)Math.Sin(i / 20f * MathHelper.Pi); - offset *= Utils.InverseLerp(0f, 300f, player.Distance(Vector2.Lerp(mountedCenter, projectile.Center, i / 20f) + offset), true); + 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); + BezierCurve bezierCurve = new BezierCurve(bezierPoints.ToArray()); int totalChains = (int)(projectile.Distance(mountedCenter) / chainTexture.Height); totalChains = (int)MathHelper.Clamp(totalChains, 40f, 1000f); diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.cs b/Projectiles/DraedonsArsenal/PulsePistolShot.cs index ed5bfa6f01..b2eea27c1d 100644 --- a/Projectiles/DraedonsArsenal/PulsePistolShot.cs +++ b/Projectiles/DraedonsArsenal/PulsePistolShot.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class PulsePistolShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC Target { get => Main.npc[(int)projectile.ai[0]]; diff --git a/Projectiles/DraedonsArsenal/PulsePistolShot.png b/Projectiles/DraedonsArsenal/PulsePistolShot.png deleted file mode 100644 index 272321a620..0000000000 Binary files a/Projectiles/DraedonsArsenal/PulsePistolShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.cs b/Projectiles/DraedonsArsenal/PulseRifleShot.cs index 05096de065..d1412009e6 100644 --- a/Projectiles/DraedonsArsenal/PulseRifleShot.cs +++ b/Projectiles/DraedonsArsenal/PulseRifleShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class PulseRifleShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust1 = 27; //purple private int dust2 = 173; //shortlived purple private int dust3 = 234; //cyan and pink @@ -83,45 +85,29 @@ namespace CalamityMod.Projectiles.DraedonsArsenal PulseBurst(4f, 5f); } + 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) { hasHit = true; - Vector2 vector35 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num474 = 600f; - int alreadyTargetedNPCType = 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) - { - float num476 = Main.npc[i].position.X + (Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (Main.npc[i].height / 2); - - float num478 = Math.Abs(projectile.position.X + (projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; - - float num484 = num476 - vector35.X; - float num485 = num477 - vector35.Y; - float num486 = (float)Math.Sqrt(num484 * num484 + num485 * num485); - - num486 = 2f / num486; - num484 *= num486; - num485 *= num486; - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num484, num485, projectile.type, projectile.damage / 2, 0f, projectile.owner, target.whoAmI, projectile.ai[1] + 1f); - break; - } - } + 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; } } } @@ -129,9 +115,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (!target.boss) { if (target.Inorganic()) - { damage += target.lifeMax / 250; - } } } diff --git a/Projectiles/DraedonsArsenal/PulseRifleShot.png b/Projectiles/DraedonsArsenal/PulseRifleShot.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/DraedonsArsenal/PulseRifleShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index 894391f217..e01f1347e2 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { DisplayName.SetDefault("Pulse Turret"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -23,7 +22,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.tileCollide = true; projectile.sentry = true; projectile.timeLeft = Projectile.SentryLifeTime; - projectile.timeLeft *= 5; projectile.penetrate = -1; } @@ -93,7 +91,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal for (int i = -1; i <= 1; i += 2) { Projectile.NewProjectile(shootPosition, - Vector2.Normalize(potentialTarget.Center - shootPosition).RotatedBy(i * MathHelper.ToRadians(28f)) * 7f, + (potentialTarget.Center - shootPosition).SafeNormalize(Vector2.UnitY).RotatedBy(i * MathHelper.ToRadians(28f)) * 7f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, @@ -102,15 +100,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 1f); } } + if (!Main.dedServ) { for (int i = 0; i < 12; i++) - { Dust.NewDustPerfect(shootPosition, 173).scale = Main.rand.NextFloat(1.4f, 1.8f); - } } + projectile.ai[1] = 15f; - projectile.localAI[0] = Math.Sign(projectile.DirectionTo(potentialTarget.Center).X); + projectile.localAI[0] = Math.Sign(projectile.SafeDirectionTo(potentialTarget.Center).X); } } } diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.cs b/Projectiles/DraedonsArsenal/PulseTurretShot.cs index 21324b7336..88f051de21 100644 --- a/Projectiles/DraedonsArsenal/PulseTurretShot.cs +++ b/Projectiles/DraedonsArsenal/PulseTurretShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class PulseTurretShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const int SpiralPrecision = 36; public const int SpiralRings = 6; public override void SetStaticDefaults() @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { float speed = projectile.velocity.Length(); float inertia = MathHelper.Lerp(18f, 6f, 1f - projectile.timeLeft / 300f); - projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); + projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(potentialTarget.Center) * speed) / (inertia + 1f); projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX) * speed; } } @@ -69,7 +71,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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.DirectionTo(dust.position) * 2.4f; + dust.velocity = projectile.SafeDirectionTo(dust.position) * 2.4f; dust.scale = 1.6f; dust.noGravity = true; diff --git a/Projectiles/DraedonsArsenal/PulseTurretShot.png b/Projectiles/DraedonsArsenal/PulseTurretShot.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/DraedonsArsenal/PulseTurretShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index 2606621cc6..fe04b4d994 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -13,13 +13,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public bool SufferingFromSeparationAnxiety = false; public Vector2 OldCenter; public Vector2 Destination; + public float Time { get => projectile.ai[0]; set => projectile.ai[0] = value; } + public float EyeOutwardness = 1f; public float EyeRotation = 0f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Snake Eyes"); @@ -89,7 +92,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } NPCMovement(potentialTarget); } - if (!SufferingFromSeparationAnxiety && projectile.Distance(player.Center) > (potentialTarget is null ? 360f : 1500f)) + if (!SufferingFromSeparationAnxiety && projectile.Distance(player.Center) > (potentialTarget is null ? 360f : 1800f)) { SufferingFromSeparationAnxiety = true; projectile.netUpdate = true; @@ -105,6 +108,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } Time++; } + public void Initialize(Player player) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); @@ -118,6 +122,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal dust.noGravity = true; } } + // While this projectile cannot attack, the projectiles it shoots derive from the damage. public void AdjustDamage(Player player) { @@ -129,6 +134,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.damage = trueDamage; } } + public void GrantBuffs(Player player) { bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); @@ -145,6 +151,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } + public void PlayerMovement(Player player) { projectile.velocity = Vector2.Zero; @@ -170,6 +177,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } EyeOutwardness = MathHelper.Lerp(EyeOutwardness, 0f, 0.15f); } + public void NPCMovement(NPC npc) { projectile.velocity = Vector2.Zero; @@ -193,12 +201,16 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { if (projectile.ai[1] > 0 && Main.myPlayer == projectile.owner) { - Projectile laser = Projectile.NewProjectileDirect(projectile.Center + Utils.Vector2FromElipse(EyeRotation.ToRotationVector2(), projectile.Size * 0.5f * EyeOutwardness), - projectile.DirectionTo(npc.Center) * 4f, ProjectileID.UFOLaser, projectile.damage, projectile.knockBack, projectile.owner); - laser.timeLeft *= 2; - laser.tileCollide = false; - laser.netUpdate = true; - laser.Calamity().forceMinion = true; + 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; + Main.projectile[laser].tileCollide = false; + Main.projectile[laser].netUpdate = true; + Main.projectile[laser].Calamity().forceMinion = true; + } } projectile.ai[1]++; OldCenter = projectile.Center; @@ -210,6 +222,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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++) @@ -238,10 +251,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } + public override bool CanDamage() => false; + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, Color.White, 0, ProjectileID.Sets.TrailCacheLength[projectile.type]); + 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); spriteBatch.Draw(eyeTexture, diff --git a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs index 2bd5273683..3cafa57c5c 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerAcid.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class StarSwallowerAcid : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + public const float Gravity = 0.25f; public override void SetStaticDefaults() { @@ -72,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127) * projectile.Opacity, ProjectileID.Sets.TrailingMode[projectile.type], 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 76e76f03c7..648aaa1eb4 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -16,11 +16,13 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public float AcidShootTimer = 0f; public float AcidShootCooldown = 0f; public float FallThroughYPoint = 0f; + public bool ReleasingAcid { get => projectile.ai[0] != 0f; set => projectile.ai[0] = value.ToInt(); } + public override void SetStaticDefaults() { DisplayName.SetDefault("Pet Froge"); @@ -49,6 +51,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal writer.Write(AcidShootTimer); writer.Write(AcidShootCooldown); } + public override void ReceiveExtraAI(BinaryReader reader) { HopCooldown = reader.ReadSingle(); @@ -156,8 +159,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal player.MinionDamage()); projectile.damage = newDamage; } - } + public void HandleHop(Vector2 targetPosition) { if (HopCooldown <= 0f && projectile.oldPosition.Y == projectile.position.Y) @@ -179,6 +182,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal HopCooldown--; } } + 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. @@ -218,7 +222,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal minimumFrame = 7; maximumFrame = 11; float inertia = 30f; - projectile.velocity = (projectile.velocity * (inertia - 1) + projectile.DirectionTo(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) @@ -226,6 +230,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal HandleHop(player.Center); } } + public void NPCTargetingAI(NPC potentialTarget) { HandleHop(potentialTarget.Center); @@ -240,19 +245,11 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Main.myPlayer == projectile.owner) { Vector2 spawnPosition = projectile.Center + Vector2.UnitX * 8f * projectile.spriteDirection; - - float shootSpeed = 14f; - float gravity = -StarSwallowerAcid.Gravity; - float distance = Vector2.Distance(spawnPosition, potentialTarget.Center); - float angle = 0.5f * (float)Math.Asin(MathHelper.Clamp(gravity * distance / (float)Math.Pow(shootSpeed, 2), -1f, 1f)); - - Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.015f); - velocity.X *= (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); - projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); + Vector2 fireVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(spawnPosition, potentialTarget.Center, StarSwallowerAcid.Gravity, 14f); Projectile.NewProjectile(spawnPosition, - velocity, + fireVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, @@ -270,6 +267,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal AcidShootCooldown--; projectile.velocity.X *= 0.8f; } + public void ManipulateFrames(int minimumFrame, int maximumFrame) { if (projectile.frame < minimumFrame) @@ -303,12 +301,15 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 0f); return false; } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { fallThrough = projectile.Bottom.Y < FallThroughYPoint - 120f; return base.TileCollideStyle(ref width, ref height, ref fallThrough); } + public override bool CanDamage() => false; } } diff --git a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs index 643d4d0687..20bdea949d 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneLightning.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneLightning.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class SystemBaneLightning : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LightningProj"; + public int ElectrocutionTarget { get => (int)projectile.ai[0]; @@ -33,7 +35,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.height = 22; projectile.friendly = true; projectile.Calamity().rogue = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.extraUpdates = 1; projectile.tileCollide = false; projectile.timeLeft = 40 * (projectile.extraUpdates + 1); diff --git a/Projectiles/DraedonsArsenal/SystemBaneLightning.png b/Projectiles/DraedonsArsenal/SystemBaneLightning.png deleted file mode 100644 index 731061f423..0000000000 Binary files a/Projectiles/DraedonsArsenal/SystemBaneLightning.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs index 95d17ec634..5379190720 100644 --- a/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs +++ b/Projectiles/DraedonsArsenal/SystemBaneProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class SystemBaneProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/SystemBane"; + public SoundEffectInstance ShittyMicrowaveMemeSound = null; public float Time { @@ -28,7 +30,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.width = 36; projectile.height = 36; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 16; projectile.tileCollide = true; @@ -59,7 +62,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { NPC potentialTarget = projectile.Center.ClosestNPCAt(900f); if (potentialTarget != null) - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 15f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center) * 15f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } // Sometimes generate lightning from the outside of the energy field if the projectile was spawned by a stealth strike. @@ -101,7 +104,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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/DraedonsArsenal/SystemBaneLightning"); + Texture2D lightningTexture = ModContent.GetTexture("CalamityMod/Projectiles/LightningProj"); for (int i = 0; i < totalCirclePoints; i++) { float angle = MathHelper.TwoPi * i / totalCirclePoints; diff --git a/Projectiles/DraedonsArsenal/SystemBaneProjectile.png b/Projectiles/DraedonsArsenal/SystemBaneProjectile.png deleted file mode 100644 index eac9266260..0000000000 Binary files a/Projectiles/DraedonsArsenal/SystemBaneProjectile.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/TaserHook.cs b/Projectiles/DraedonsArsenal/TaserHook.cs index 10a380270f..c81d074aca 100644 --- a/Projectiles/DraedonsArsenal/TaserHook.cs +++ b/Projectiles/DraedonsArsenal/TaserHook.cs @@ -16,22 +16,27 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Electrocuting, ReelingBack } + public TaserAIState AIState { get => (TaserAIState)(int)projectile.ai[0]; set => projectile.ai[0] = (int)value; } + public float Time { get => projectile.ai[1]; set => projectile.ai[1] = value; } + public int ElectrocutionTarget { get => (int)projectile.localAI[0]; set => projectile.localAI[0] = value; } - public const float ReelbackSpeed = 7f; + + public const float ReelbackSpeed = 15f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Taser"); @@ -79,7 +84,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal return; } projectile.tileCollide = false; - projectile.velocity = projectile.DirectionTo(player.Center) * ReelbackSpeed; + projectile.velocity = projectile.SafeDirectionTo(player.Center) * ReelbackSpeed; break; } @@ -131,9 +136,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(target.Center + angle.ToRotationVector2() * 10f, 226); dust.velocity = Vector2.Zero; if (Main.rand.NextBool(6)) - { - dust.velocity = target.DirectionTo(dust.position) * 4.5f; - } + dust.velocity = target.SafeDirectionTo(dust.position) * 4.5f; + dust.noGravity = true; } } diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs index c7ea8fa382..954725406c 100644 --- a/Projectiles/DraedonsArsenal/TeslaCannonShot.cs +++ b/Projectiles/DraedonsArsenal/TeslaCannonShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class TeslaCannonShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int[] dustArray = new int[7] { 56, 111, 137, 160, 206, 229, 226 }; private int arcs = 0; @@ -102,30 +104,17 @@ namespace CalamityMod.Projectiles.DraedonsArsenal 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) { - float num476 = Main.npc[i].position.X + (Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (Main.npc[i].height / 2); + 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); - float num478 = Math.Abs(projectile.position.X + (projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (projectile.height / 2) - num477); - if (num478 < num474) - { - num474 = num478; + projectile.ai[1] = 60f; - float num484 = num476 - vector35.X; - float num485 = num477 - vector35.Y; - float num486 = (float)Math.Sqrt(num484 * num484 + num485 * num485); - - num486 = 2f / num486; - num484 *= num486; - num485 *= num486; - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num484, num485, projectile.type, projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, -1f); - - projectile.ai[1] = 60f; - - arcs++; - } + arcs++; + break; } } } diff --git a/Projectiles/DraedonsArsenal/TeslaCannonShot.png b/Projectiles/DraedonsArsenal/TeslaCannonShot.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/DraedonsArsenal/TeslaCannonShot.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs index ce3a054a15..7513d554c2 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskLaser.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class TrackingDiskLaser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.localAI[0]; diff --git a/Projectiles/DraedonsArsenal/TrackingDiskLaser.png b/Projectiles/DraedonsArsenal/TrackingDiskLaser.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/DraedonsArsenal/TrackingDiskLaser.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs index a831cd502c..c74b537ccb 100644 --- a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs +++ b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.cs @@ -13,21 +13,26 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class TrackingDiskProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/TrackingDisk"; + public bool ReturningToPlayer { get => projectile.ai[0] == 1f; set => projectile.ai[0] = value.ToInt(); } + public float Time { get => projectile.ai[1]; set => projectile.ai[1] = value; } + public const int LaserFireRate = 20; public const int MaxLaserCountPerShot = 4; // This only applies to stealth strikes. public const float MaxTargetSearchDistance = 480f; public const float ReturnAcceleration = 0.15f; public const float ReturnMaxSpeed = 12f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tracking Disk"); @@ -74,7 +79,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.velocity.Y += Math.Sign(idealVelocity.Y - projectile.velocity.Y) * ReturnAcceleration; if (Time % LaserFireRate == 0f) - AttemptToFireLasers((int)(projectile.damage * 0.4)); + AttemptToFireLasers((int)(projectile.damage * 0.25)); if (Main.myPlayer == projectile.owner) { @@ -102,7 +107,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal if (targetCount >= MaxLaserCountPerShot) break; Projectile laser = Projectile.NewProjectileDirect(projectile.Center, - projectile.DirectionTo(target.Center) * 4f, + projectile.SafeDirectionTo(target.Center) * 4f, ModContent.ProjectileType(), damage, projectile.knockBack, @@ -118,7 +123,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetSearchDistance); if (potentialTarget != null) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(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); } } } @@ -142,7 +147,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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/TrackingDiskProjectile.png b/Projectiles/DraedonsArsenal/TrackingDiskProjectile.png deleted file mode 100644 index 4ddea6ac7d..0000000000 Binary files a/Projectiles/DraedonsArsenal/TrackingDiskProjectile.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/UnstableMatter.cs b/Projectiles/DraedonsArsenal/UnstableMatter.cs index cd00de0eaa..59e15d27cb 100644 --- a/Projectiles/DraedonsArsenal/UnstableMatter.cs +++ b/Projectiles/DraedonsArsenal/UnstableMatter.cs @@ -7,16 +7,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class UnstableMatter : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool HasCollidedWithATile { get => projectile.ai[0] == 1f; set => projectile.ai[0] = value.ToInt(); } + public float Time { get => projectile.ai[1]; set => projectile.ai[1] = value; } + public override void SetStaticDefaults() { DisplayName.SetDefault("Unstable Matter"); @@ -29,8 +33,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.friendly = true; projectile.ranged = true; projectile.tileCollide = true; - projectile.penetrate = 1; - projectile.timeLeft = 360; + projectile.penetrate = -1; + projectile.timeLeft = 480; } public override void AI() @@ -61,13 +65,18 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(projectile.Center, 107); dust.velocity = Main.rand.NextVector2CircularEdge(speed, speed) - projectile.velocity; dust.fadeIn = persistence; - dust.scale = 1.2f; + dust.scale = 0.9f; dust.noGravity = true; } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { + if (!HasCollidedWithATile) + damage /= 3; + else if (projectile.penetrate == -1) + projectile.penetrate = 1; + damage += target.defense / 3; } @@ -81,7 +90,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // And bounce off the tile. Or towards a nearby enemy, if there is one. NPC potentialTarget = projectile.Center.ClosestNPCAt(700f, false); if (potentialTarget != null) - projectile.velocity = projectile.DirectionTo(potentialTarget.Center); + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center); else { if (projectile.velocity.X != oldVelocity.X) @@ -97,7 +106,5 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } return true; } - - public override bool CanDamage() => HasCollidedWithATile; } } diff --git a/Projectiles/DraedonsArsenal/UnstableMatter.png b/Projectiles/DraedonsArsenal/UnstableMatter.png deleted file mode 100644 index 131ea79b1d..0000000000 Binary files a/Projectiles/DraedonsArsenal/UnstableMatter.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/VoltageStream.cs b/Projectiles/DraedonsArsenal/VoltageStream.cs index 76cab78f27..a3d39e2e4a 100644 --- a/Projectiles/DraedonsArsenal/VoltageStream.cs +++ b/Projectiles/DraedonsArsenal/VoltageStream.cs @@ -9,16 +9,20 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class VoltageStream : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { 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; } + public override void SetStaticDefaults() { DisplayName.SetDefault("Voltage Stream"); @@ -76,9 +80,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Dust dust = Dust.NewDustPerfect(Target.Center + angle.ToRotationVector2() * radius, 226); dust.velocity = Vector2.Zero; if (Main.rand.NextBool(6)) - { - dust.velocity = Target.DirectionTo(dust.position) * 4.5f; - } + dust.velocity = Target.SafeDirectionTo(dust.position) * 4.5f; + dust.noGravity = true; } } @@ -111,9 +114,5 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { projectile.damage = (int)(projectile.damage * 0.75); } - - public override void Kill(int timeLeft) - { - } } } diff --git a/Projectiles/DraedonsArsenal/VoltageStream.png b/Projectiles/DraedonsArsenal/VoltageStream.png deleted file mode 100644 index 272321a620..0000000000 Binary files a/Projectiles/DraedonsArsenal/VoltageStream.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/WavePounderBoom.cs b/Projectiles/DraedonsArsenal/WavePounderBoom.cs index c022f174e2..91f469061c 100644 --- a/Projectiles/DraedonsArsenal/WavePounderBoom.cs +++ b/Projectiles/DraedonsArsenal/WavePounderBoom.cs @@ -1,128 +1,29 @@ -using CalamityMod.World; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { - public struct ScreenShakeSpot + public class WavePounderBoom : BaseMassiveExplosionProjectile { - public float ScreenShakePower; - public Vector2 Position; - public ScreenShakeSpot(float screenShakePower, Vector2 position) - { - ScreenShakePower = screenShakePower; - Position = position; - } - } - public class WavePounderBoom : ModProjectile - { - public ScreenShakeSpot CurrentSpot; - public float Radius - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } - public float MaxRadius - { - get => projectile.ai[1]; - set => projectile.ai[1] = value; - } - public float InterpolationStep - { - get => projectile.localAI[1]; - set => projectile.localAI[1] = value; - } - public const int Lifetime = 60; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Explosion"); - ProjectileID.Sets.NeedsUUID[projectile.type] = true; - } + public override int Lifetime => 60; + 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 = 2; - projectile.height = 2; + projectile.width = projectile.height = 2; projectile.friendly = true; - projectile.Calamity().rogue = true; projectile.tileCollide = false; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.timeLeft = Lifetime; + projectile.Calamity().rogue = true; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); - writer.Write(CurrentSpot.ScreenShakePower); - writer.WriteVector2(CurrentSpot.Position); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); - CurrentSpot = new ScreenShakeSpot(reader.ReadInt32(), reader.ReadVector2()); - } - - public override void AI() - { - if (projectile.Calamity().stealthStrike) - { - if (projectile.localAI[0] == 0f) - { - CurrentSpot = new ScreenShakeSpot(0, projectile.Center); - projectile.localAI[0] = 1f; - } - CurrentSpot.ScreenShakePower = (float)Math.Sin(MathHelper.Pi * projectile.timeLeft / Lifetime) * 16f; - CurrentSpot.Position = projectile.Center; - CalamityWorld.ScreenShakeSpots[Projectile.GetByUUID(projectile.owner, projectile.whoAmI)] = CurrentSpot; - } - - Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); - Radius = MathHelper.Lerp(Radius, MaxRadius, 0.25f); - projectile.scale = MathHelper.Lerp(1.2f, 5f, Utils.InverseLerp(Lifetime, 0f, projectile.timeLeft, true)); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(Radius * projectile.scale), (int)(Radius * projectile.scale)); - } - public override void Kill(int timeLeft) - { - if (projectile.Calamity().stealthStrike) - CalamityWorld.ScreenShakeSpots.Remove(Projectile.GetByUUID(projectile.owner, projectile.whoAmI)); // Remove the explosion associated with this projectile's UUID. - } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix); - - float pulseCompletionRatio = Utils.InverseLerp(Lifetime, 0f, projectile.timeLeft, true); - Vector2 scale = new Vector2(1.5f, 1f); - DrawData drawData = new DrawData(ModContent.GetTexture("Terraria/Misc/Perlin"), - projectile.Center - Main.screenPosition + projectile.Size * scale * 0.5f, - new Rectangle(0, 0, projectile.width, projectile.height), - new Color(new Vector4(1f - (float)Math.Sqrt(pulseCompletionRatio))) * 0.7f * projectile.Opacity, - projectile.rotation, - projectile.Size, - scale, - SpriteEffects.None, 0); - - Color pulseColor = Color.Lerp(Color.Yellow * 1.6f, Color.White, MathHelper.Clamp(pulseCompletionRatio * 2.2f, 0f, 1f)); - GameShaders.Misc["ForceField"].UseColor(pulseColor); - GameShaders.Misc["ForceField"].Apply(drawData); - drawData.Draw(spriteBatch); - - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - return false; - } + public override void PostAI() => Lighting.AddLight(projectile.Center, 0.2f, 0.1f, 0f); } } diff --git a/Projectiles/DraedonsArsenal/WavePounderBoom.png b/Projectiles/DraedonsArsenal/WavePounderBoom.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/DraedonsArsenal/WavePounderBoom.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs index e73af1bb9d..0e6b376d8d 100644 --- a/Projectiles/DraedonsArsenal/WavePounderProjectile.cs +++ b/Projectiles/DraedonsArsenal/WavePounderProjectile.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public class WavePounderProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/DraedonsArsenal/WavePounder"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Wave Pounder"); @@ -66,11 +68,14 @@ 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); - explosion.ai[1] = Main.rand.NextFloat(320f, 870f) + i * 45f; // Randomize the maximum radius. - explosion.localAI[1] = Main.rand.NextFloat(0.08f, 0.25f); // And the interpolation step. - explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); - explosion.Calamity().stealthStrike = true; - explosion.netUpdate = true; + if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) + { + explosion.ai[1] = Main.rand.NextFloat(320f, 870f) + i * 45f; // Randomize the maximum radius. + explosion.localAI[1] = Main.rand.NextFloat(0.08f, 0.25f); // And the interpolation step. + explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); + explosion.Calamity().stealthStrike = true; + explosion.netUpdate = true; + } } } } diff --git a/Projectiles/DraedonsArsenal/WavePounderProjectile.png b/Projectiles/DraedonsArsenal/WavePounderProjectile.png deleted file mode 100644 index 421b47c462..0000000000 Binary files a/Projectiles/DraedonsArsenal/WavePounderProjectile.png and /dev/null differ diff --git a/Projectiles/Enemy/BelchingCoralSpike.cs b/Projectiles/Enemy/BelchingCoralSpike.cs index 45b275bbfa..d3d827ddca 100644 --- a/Projectiles/Enemy/BelchingCoralSpike.cs +++ b/Projectiles/Enemy/BelchingCoralSpike.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/CrabBoulder.cs b/Projectiles/Enemy/CrabBoulder.cs index 5d18ac21a0..0a3d6d1b45 100644 --- a/Projectiles/Enemy/CrabBoulder.cs +++ b/Projectiles/Enemy/CrabBoulder.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs index a61e2a6847..6be4f2ca40 100644 --- a/Projectiles/Enemy/CragmawBeam.cs +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -1,10 +1,10 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.ID; using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -203,9 +203,9 @@ namespace CalamityMod.Projectiles.Enemy } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Electrified, 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } } diff --git a/Projectiles/Enemy/CragmawBubble.cs b/Projectiles/Enemy/CragmawBubble.cs index 190324aaea..2e1eafd8ec 100644 --- a/Projectiles/Enemy/CragmawBubble.cs +++ b/Projectiles/Enemy/CragmawBubble.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Enemy { public class CragmawBubble : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Bubble"); diff --git a/Projectiles/Enemy/CragmawBubble.png b/Projectiles/Enemy/CragmawBubble.png deleted file mode 100644 index 3bb08e0246..0000000000 Binary files a/Projectiles/Enemy/CragmawBubble.png and /dev/null differ diff --git a/Projectiles/Enemy/CragmawVibeCheckChain.cs b/Projectiles/Enemy/CragmawVibeCheckChain.cs index 8aca72cbba..0f194414d8 100644 --- a/Projectiles/Enemy/CragmawVibeCheckChain.cs +++ b/Projectiles/Enemy/CragmawVibeCheckChain.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Projectiles.Enemy projectile.rotation = (Main.npc[(int)projectile.ai[0]].Top - projectile.Center + offsetDrawVector).ToRotation() + MathHelper.PiOver2; if (projectile.localAI[0] == 0f) { - projectile.velocity = (projectile.velocity * 10f + projectile.DirectionTo(Main.player[toTarget].Center) * 9f) / 11f; + projectile.velocity = (projectile.velocity * 10f + projectile.SafeDirectionTo(Main.player[toTarget].Center) * 9f) / 11f; if (projectile.timeLeft <= 180f) { projectile.localAI[0] = 1f; projectile.netUpdate = true; } - if (projectile.Distance(Main.player[toTarget].Center) < 16f) + if (projectile.WithinRange(Main.player[toTarget].Center, 16f)) { projectile.localAI[0] = 1f; ReelingPlayer = true; @@ -64,17 +64,13 @@ namespace CalamityMod.Projectiles.Enemy else { if (ReelingPlayer) - { Main.player[toTarget].Center = projectile.Center; - } + if (Main.player[toTarget].dead) - { ReelingPlayer = false; - } - if (projectile.Distance(Main.npc[(int)projectile.ai[0]].Center) > 6f) - { - projectile.velocity = (projectile.velocity * 16f + projectile.DirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 19f) / 17f; - } + + if (!projectile.WithinRange(Main.npc[(int)projectile.ai[0]].Center, 6f)) + projectile.velocity = (projectile.velocity * 16f + projectile.SafeDirectionTo(Main.npc[(int)projectile.ai[0]].Center) * 19f) / 17f; } } diff --git a/Projectiles/Enemy/CrimsonSpike.cs b/Projectiles/Enemy/CrimsonSpike.cs index 5fca704356..16c948f9f8 100644 --- a/Projectiles/Enemy/CrimsonSpike.cs +++ b/Projectiles/Enemy/CrimsonSpike.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Cursed, 60); + target.AddBuff(BuffID.Darkness, 90); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/DraedonLaser.cs b/Projectiles/Enemy/DraedonLaser.cs index 735763c9ca..3c586a3628 100644 --- a/Projectiles/Enemy/DraedonLaser.cs +++ b/Projectiles/Enemy/DraedonLaser.cs @@ -2,21 +2,24 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Enemy { public class DraedonLaser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + + // The DrawBeam method relies on localAI[0] for its calculations. A different parameter won't work. public float TrailLength { - get => projectile.ai[0]; - set => projectile.ai[0] = value; + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; } public const int MaxTrailPoints = 50; public override void SetStaticDefaults() { - DisplayName.SetDefault("Laser"); + DisplayName.SetDefault("Lab Turret Laser"); } public override void SetDefaults() @@ -24,7 +27,7 @@ namespace CalamityMod.Projectiles.Enemy projectile.width = 6; projectile.height = 6; projectile.hostile = true; - projectile.tileCollide = false; + projectile.tileCollide = true; projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = 1; @@ -36,7 +39,11 @@ namespace CalamityMod.Projectiles.Enemy { if (projectile.localAI[0] == 0f) { - Main.PlaySound(SoundID.Item12, (int)projectile.Center.X, (int)projectile.Center.Y); + // 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); + if (sound != null) + sound.Volume *= 0.35f; + projectile.localAI[0] = 1f; } projectile.alpha = (int)(Math.Sin(projectile.timeLeft / 240f * MathHelper.Pi) * 1.6f * 255f); @@ -51,32 +58,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) - { - Texture2D texture = ModContent.GetTexture(Texture); - float adjustedXOrigin = (texture.Width - projectile.width) * 0.5f + projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle roughScreenBounds = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - // Only draw when within the bounds of the screen for performance reasons. - if (projectile.Hitbox.Intersects(roughScreenBounds)) - { - Vector2 drawPosition = new Vector2(projectile.position.X + adjustedXOrigin, projectile.position.Y + projectile.height / 2) - Main.screenPosition; - drawPosition += Vector2.UnitY * projectile.gfxOffY; - for (int i = 1; i <= (int)TrailLength; i++) - { - Vector2 drawOffset = Vector2.Normalize(projectile.velocity) * i * 1.5f; - Color drawColor = projectile.GetAlpha(lightColor); // The parameter doesn't really matter. The lightColor parameter in GetAlpha is ignored in this case. - drawColor.A = (byte)(255 - projectile.alpha); - drawColor *= (MaxTrailPoints - i) / (float)MaxTrailPoints; - float scale = MathHelper.Lerp(0.45f, 1f, 1f - i / TrailLength) * projectile.scale; - spriteBatch.Draw(texture, drawPosition - drawOffset, null, drawColor, projectile.rotation, new Vector2(adjustedXOrigin, projectile.height * 0.5f), scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(MaxTrailPoints, 1.5f, lightColor); } } diff --git a/Projectiles/Enemy/DraedonLaser.png b/Projectiles/Enemy/DraedonLaser.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Enemy/DraedonLaser.png and /dev/null differ diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index d1d35e7c7f..f18ff4cc8a 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.width = 32; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.width = 32; projectile.height = 32; projectile.hostile = true; projectile.penetrate = 3; diff --git a/Projectiles/Enemy/FlakAcid.cs b/Projectiles/Enemy/FlakAcid.cs index 5abc682b56..c21ac0fd3f 100644 --- a/Projectiles/Enemy/FlakAcid.cs +++ b/Projectiles/Enemy/FlakAcid.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 87073736b7..9378955fb3 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -6,6 +7,8 @@ namespace CalamityMod.Projectiles.Enemy { public class FlameBurstHostile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float count = 0; public override void SetStaticDefaults() @@ -84,7 +87,12 @@ namespace CalamityMod.Projectiles.Enemy } } - public override void Kill(int timeLeft) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { diff --git a/Projectiles/Enemy/FlameBurstHostile.png b/Projectiles/Enemy/FlameBurstHostile.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Enemy/FlameBurstHostile.png and /dev/null differ diff --git a/Projectiles/Enemy/GammaAcid.cs b/Projectiles/Enemy/GammaAcid.cs index cf04973c26..187ecac66e 100644 --- a/Projectiles/Enemy/GammaAcid.cs +++ b/Projectiles/Enemy/GammaAcid.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Enemy { public class GammaAcid : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/FlakAcid"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/GammaAcid.png b/Projectiles/Enemy/GammaAcid.png deleted file mode 100644 index 80d124f58d..0000000000 Binary files a/Projectiles/Enemy/GammaAcid.png and /dev/null differ diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index 48cb0dd6f9..b42f69b30a 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -1,16 +1,18 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.ID; using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy { public class GammaBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/CragmawBeam"; + // How long this laser can exist before it is deleted. public const int TrueTimeLeft = 180; @@ -206,9 +208,9 @@ namespace CalamityMod.Projectiles.Enemy } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Electrified, 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } } diff --git a/Projectiles/Enemy/GammaBeam.png b/Projectiles/Enemy/GammaBeam.png deleted file mode 100644 index 1e24eea3ca..0000000000 Binary files a/Projectiles/Enemy/GammaBeam.png and /dev/null differ diff --git a/Projectiles/Enemy/HorsWaterBlast.cs b/Projectiles/Enemy/HorsWaterBlast.cs index a23aaa5cc1..56520e7fe9 100644 --- a/Projectiles/Enemy/HorsWaterBlast.cs +++ b/Projectiles/Enemy/HorsWaterBlast.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Enemy { public class HorsWaterBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Water"); diff --git a/Projectiles/Enemy/HorsWaterBlast.png b/Projectiles/Enemy/HorsWaterBlast.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Enemy/HorsWaterBlast.png and /dev/null differ diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 404587d035..b244786920 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -84,8 +84,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); projectile.Kill(); } } diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index b959629ee3..37cc8d4d20 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -65,8 +65,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs index 8bf7f57d92..cde0aa66e1 100644 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ b/Projectiles/Enemy/InkPoisonCloud2.cs @@ -65,8 +65,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs index 2950babbc5..5456625367 100644 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ b/Projectiles/Enemy/InkPoisonCloud3.cs @@ -65,8 +65,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index 29fe90f655..7e328061a3 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - projectile.knockBack = 3f; + projectile.Calamity().canBreakPlayerDefense = true; + projectile.knockBack = 3f; projectile.width = 72; projectile.height = 30; projectile.hostile = true; @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Enemy/NuclearBulletLarge.cs b/Projectiles/Enemy/NuclearBulletLarge.cs index fdf3d549d9..341228dfc2 100644 --- a/Projectiles/Enemy/NuclearBulletLarge.cs +++ b/Projectiles/Enemy/NuclearBulletLarge.cs @@ -1,5 +1,5 @@ using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; using Terraria.ModLoader; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override void Kill(int timeLeft) { diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs index 71ab545c3c..3a2d7b8606 100644 --- a/Projectiles/Enemy/NuclearBulletMedium.cs +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -1,5 +1,5 @@ using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using System; using Terraria; @@ -40,9 +40,8 @@ namespace CalamityMod.Projectiles.Enemy Player player = Main.player[(int)projectile.ai[1]]; float inertia = 10f; if (projectile.Distance(player.Center) > 70f) - { - projectile.velocity = (projectile.velocity * inertia + projectile.DirectionTo(player.Center) * 18.5f) / (inertia + 1f); - } + projectile.velocity = (projectile.velocity * inertia + projectile.SafeDirectionTo(player.Center) * 18.5f) / (inertia + 1f); + projectile.tileCollide = true; } else @@ -52,7 +51,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) { diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs index aab0150aad..f2d030ddec 100644 --- a/Projectiles/Enemy/NuclearToadGoo.cs +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) { diff --git a/Projectiles/Enemy/OrthoceraStream.cs b/Projectiles/Enemy/OrthoceraStream.cs index 919ecb6881..5586125397 100644 --- a/Projectiles/Enemy/OrthoceraStream.cs +++ b/Projectiles/Enemy/OrthoceraStream.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Enemy { public class OrthoceraStream : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Stream"); diff --git a/Projectiles/Enemy/OrthoceraStream.png b/Projectiles/Enemy/OrthoceraStream.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Enemy/OrthoceraStream.png and /dev/null differ diff --git a/Projectiles/Enemy/PearlRain.cs b/Projectiles/Enemy/PearlRain.cs index ad0959721b..54a9ba18b6 100644 --- a/Projectiles/Enemy/PearlRain.cs +++ b/Projectiles/Enemy/PearlRain.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Enemy { public class PearlRain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/PearlBurst"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Pearl Rain"); diff --git a/Projectiles/Enemy/PearlRain.png b/Projectiles/Enemy/PearlRain.png deleted file mode 100644 index 075c983ece..0000000000 Binary files a/Projectiles/Enemy/PearlRain.png and /dev/null differ diff --git a/Projectiles/Enemy/PufferExplosion.cs b/Projectiles/Enemy/PufferExplosion.cs index 01606b0e4b..1447a389a3 100644 --- a/Projectiles/Enemy/PufferExplosion.cs +++ b/Projectiles/Enemy/PufferExplosion.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Enemy { public class PufferExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Enemy/PufferExplosion.png b/Projectiles/Enemy/PufferExplosion.png deleted file mode 100644 index a39b10f8a7..0000000000 Binary files a/Projectiles/Enemy/PufferExplosion.png and /dev/null differ diff --git a/Projectiles/Enemy/StormMarkHostile.cs b/Projectiles/Enemy/StormMarkHostile.cs index 7cad2705ee..d02d897805 100644 --- a/Projectiles/Enemy/StormMarkHostile.cs +++ b/Projectiles/Enemy/StormMarkHostile.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Enemy { public class StormMarkHostile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); diff --git a/Projectiles/Enemy/StormMarkHostile.png b/Projectiles/Enemy/StormMarkHostile.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Enemy/StormMarkHostile.png and /dev/null differ diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index b1790cb1b5..c886df086b 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -103,8 +104,8 @@ namespace CalamityMod.Projectiles.Enemy { return; } - target.AddBuff(BuffID.Venom, 120); - projectile.Kill(); + target.AddBuff(ModContent.BuffType(), 120); + projectile.Kill(); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index 62fd008508..ed4519027d 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using System; using Terraria; using Terraria.ID; @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index 2bc4b6be9a..d82852ebf4 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Enemy { public class TornadoHostile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index f4feb53ef0..6449e63664 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -79,32 +79,18 @@ namespace CalamityMod.Projectiles.Enemy } } - public override bool CanHitPlayer(Player target) - { - if (projectile.timeLeft < 40) - { - return false; - } - return true; - } + public override bool CanHitPlayer(Player target) => projectile.timeLeft > 40; public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.Poisoned, 120); } - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft < 40) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft > 40; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.Poisoned, 120); } } } diff --git a/Projectiles/Environment/AcidDrop.cs b/Projectiles/Environment/AcidDrop.cs index f9f48291f3..23c0d34b99 100644 --- a/Projectiles/Environment/AcidDrop.cs +++ b/Projectiles/Environment/AcidDrop.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Environment public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 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 1394d3dc25..f7f54e628d 100644 --- a/Projectiles/Environment/BrimstoneGeyser.cs +++ b/Projectiles/Environment/BrimstoneGeyser.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Environment { public class BrimstoneGeyser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dustType = (int)CalamityDusts.Brimstone; public override void SetStaticDefaults() { diff --git a/Projectiles/Environment/BrimstoneGeyser.png b/Projectiles/Environment/BrimstoneGeyser.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Environment/BrimstoneGeyser.png and /dev/null differ diff --git a/Projectiles/Environment/GeyserTelegraph.cs b/Projectiles/Environment/GeyserTelegraph.cs index 96437ff661..987361eb1a 100644 --- a/Projectiles/Environment/GeyserTelegraph.cs +++ b/Projectiles/Environment/GeyserTelegraph.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Environment { public class GeyserTelegraph : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private bool initialized = false; public override void SetStaticDefaults() { @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Environment public override void AI() { - if (!initialized) + if (!initialized && Main.myPlayer != projectile.owner) { int projectileType = ModContent.ProjectileType(); float randomVelocity = Main.rand.NextFloat() + 0.5f; @@ -36,6 +38,9 @@ namespace CalamityMod.Projectiles.Environment public override void Kill(int timeLeft) { + if (Main.myPlayer != projectile.owner) + return; + int projectileType = ProjectileID.GeyserTrap; if (projectile.ai[0] == 1f) { diff --git a/Projectiles/Environment/GeyserTelegraph.png b/Projectiles/Environment/GeyserTelegraph.png deleted file mode 100644 index ee4239cbf9..0000000000 Binary files a/Projectiles/Environment/GeyserTelegraph.png and /dev/null differ diff --git a/Projectiles/Environment/HotSteam.cs b/Projectiles/Environment/HotSteam.cs index 09143d06b0..78fd9df3b8 100644 --- a/Projectiles/Environment/HotSteam.cs +++ b/Projectiles/Environment/HotSteam.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Environment { public class HotSteam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Steam"); diff --git a/Projectiles/Environment/LightningMark.cs b/Projectiles/Environment/LightningMark.cs index 4d6e303065..26aa22600a 100644 --- a/Projectiles/Environment/LightningMark.cs +++ b/Projectiles/Environment/LightningMark.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Environment { public class LightningMark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning Mark"); @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.Environment Vector2 fireFrom = new Vector2(projectile.Center.X, projectile.Center.Y - 900f); int tries = 0; - while (Framing.GetTileSafely((int)(fireFrom.X / 16f), (int)(fireFrom.Y / 16f)).active()) + while (CalamityUtils.ParanoidTileRetrieval((int)(fireFrom.X / 16f), (int)(fireFrom.Y / 16f)).active()) { fireFrom.Y += 16f; @@ -40,17 +42,20 @@ namespace CalamityMod.Projectiles.Environment return; } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)projectile.Center.X, (int)projectile.Center.Y); + Main.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.X, fireFrom.Y, velocity.X, velocity.Y, ProjectileID.CultistBossLightningOrbArc, damage, 0f, projectile.owner, ai0.ToRotation(), ai); - Main.projectile[proj].extraUpdates += 11; - Main.projectile[proj].friendly = true; - Main.projectile[proj].Calamity().lineColor = 1; + 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; + Main.projectile[proj].friendly = true; + Main.projectile[proj].Calamity().lineColor = 1; + } } } else if (projectile.velocity.Y == 0f) @@ -93,9 +98,6 @@ namespace CalamityMod.Projectiles.Environment return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Environment/LightningMark.png b/Projectiles/Environment/LightningMark.png deleted file mode 100644 index ee4239cbf9..0000000000 Binary files a/Projectiles/Environment/LightningMark.png and /dev/null differ diff --git a/Projectiles/Environment/SmokeTelegraph.cs b/Projectiles/Environment/SmokeTelegraph.cs index ac7af10c43..cad442541f 100644 --- a/Projectiles/Environment/SmokeTelegraph.cs +++ b/Projectiles/Environment/SmokeTelegraph.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Environment { public class SmokeTelegraph : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dustType = 31; public override void SetStaticDefaults() { diff --git a/Projectiles/Environment/SmokeTelegraph.png b/Projectiles/Environment/SmokeTelegraph.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Environment/SmokeTelegraph.png and /dev/null differ diff --git a/Projectiles/Healing/AtaxiaHealOrb.cs b/Projectiles/Healing/AtaxiaHealOrb.cs index f886f3a334..1a13723cd4 100644 --- a/Projectiles/Healing/AtaxiaHealOrb.cs +++ b/Projectiles/Healing/AtaxiaHealOrb.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class AtaxiaHealOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ataxia Heal Orb"); diff --git a/Projectiles/Healing/AtaxiaHealOrb.png b/Projectiles/Healing/AtaxiaHealOrb.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/AtaxiaHealOrb.png and /dev/null differ diff --git a/Projectiles/Healing/BurntSiennaProj.cs b/Projectiles/Healing/BurntSiennaProj.cs index c6c3346e9d..22c1e81856 100644 --- a/Projectiles/Healing/BurntSiennaProj.cs +++ b/Projectiles/Healing/BurntSiennaProj.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class BurntSiennaProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sienna"); @@ -23,8 +25,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 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); diff --git a/Projectiles/Healing/BurntSiennaProj.png b/Projectiles/Healing/BurntSiennaProj.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/BurntSiennaProj.png and /dev/null differ diff --git a/Projectiles/Healing/CactusHealOrb.cs b/Projectiles/Healing/CactusHealOrb.cs index 654c25a857..72dbf6c96e 100644 --- a/Projectiles/Healing/CactusHealOrb.cs +++ b/Projectiles/Healing/CactusHealOrb.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class CactusHealOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Healing { projectile.velocity.Y *= 0.98f; - projectile.HealingProjectile(25, projectile.owner, 12f, 15f); + projectile.HealingProjectile(15, projectile.owner, 12f, 15f); 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; diff --git a/Projectiles/Healing/CactusHealOrb.png b/Projectiles/Healing/CactusHealOrb.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Healing/CactusHealOrb.png and /dev/null differ diff --git a/Projectiles/Healing/DemonHeal.cs b/Projectiles/Healing/DemonHeal.cs new file mode 100644 index 0000000000..fcff05e107 --- /dev/null +++ b/Projectiles/Healing/DemonHeal.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + public class DemonHeal : ModProjectile + { + 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; + } + + public override void AI() + { + projectile.HealingProjectile(10, projectile.owner, 20f, 20f, true, 640); + + 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; + fire.noGravity = true; + } + } +} diff --git a/Projectiles/Healing/EarthHealOrb.cs b/Projectiles/Healing/EarthHealOrb.cs index 6c936348f5..24e2d86347 100644 --- a/Projectiles/Healing/EarthHealOrb.cs +++ b/Projectiles/Healing/EarthHealOrb.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class EarthHealOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); diff --git a/Projectiles/Healing/EarthHealOrb.png b/Projectiles/Healing/EarthHealOrb.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/EarthHealOrb.png and /dev/null differ diff --git a/Projectiles/Healing/Exoheal.cs b/Projectiles/Healing/Exoheal.cs index bcbfbf33d0..b6f8f262cb 100644 --- a/Projectiles/Healing/Exoheal.cs +++ b/Projectiles/Healing/Exoheal.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class Exoheal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); diff --git a/Projectiles/Healing/Exoheal.png b/Projectiles/Healing/Exoheal.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/Exoheal.png and /dev/null differ diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 27c265d86a..4da5e95022 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class FungalHeal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); diff --git a/Projectiles/Healing/FungalHeal.png b/Projectiles/Healing/FungalHeal.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Healing/FungalHeal.png and /dev/null differ diff --git a/Projectiles/Healing/GodSlayerHealOrb.cs b/Projectiles/Healing/GodSlayerHealOrb.cs index bb6d057f40..1843faeb77 100644 --- a/Projectiles/Healing/GodSlayerHealOrb.cs +++ b/Projectiles/Healing/GodSlayerHealOrb.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class GodSlayerHealOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Heal Orb"); diff --git a/Projectiles/Healing/GodSlayerHealOrb.png b/Projectiles/Healing/GodSlayerHealOrb.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/GodSlayerHealOrb.png and /dev/null differ diff --git a/Projectiles/Healing/ManaOverloaderHealOrb.cs b/Projectiles/Healing/ManaOverloaderHealOrb.cs index bfd57807c9..5b3416ed3e 100644 --- a/Projectiles/Healing/ManaOverloaderHealOrb.cs +++ b/Projectiles/Healing/ManaOverloaderHealOrb.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class ManaOverloaderHealOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mana Overloader Heal Orb"); diff --git a/Projectiles/Healing/ManaOverloaderHealOrb.png b/Projectiles/Healing/ManaOverloaderHealOrb.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/ManaOverloaderHealOrb.png and /dev/null differ diff --git a/Projectiles/Healing/PhantomicHeart.cs b/Projectiles/Healing/PhantomicHeart.cs new file mode 100644 index 0000000000..2f92d5ab33 --- /dev/null +++ b/Projectiles/Healing/PhantomicHeart.cs @@ -0,0 +1,98 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Healing +{ + class PhantomicHeart : ModProjectile + { + private int floatTimer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantomic Heart"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(floatTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + floatTimer = reader.ReadInt32(); + } + + public override void AI() + { + if (floatTimer >= 10) + { + projectile.velocity.Y *= 0.99f; + } + else + { + projectile.velocity.Y *= 1.01f; + } + if (floatTimer >= 20) + floatTimer = 0; + else + floatTimer++; + + 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)); + } + + 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 (player.whoAmI == Main.myPlayer) + { + CalamityPlayer calPlayer = player.Calamity(); + calPlayer.phantomicHeartRegen = 720; + projectile.Kill(); + } + } + 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.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame % 2 == 0) + projectile.netUpdate = true; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Healing/PhantomicHeart.png b/Projectiles/Healing/PhantomicHeart.png new file mode 100644 index 0000000000..72436358aa Binary files /dev/null and b/Projectiles/Healing/PhantomicHeart.png differ diff --git a/Projectiles/Healing/PhoenixHeal.cs b/Projectiles/Healing/PhoenixHeal.cs index 0434f84892..f4da16f6d4 100644 --- a/Projectiles/Healing/PhoenixHeal.cs +++ b/Projectiles/Healing/PhoenixHeal.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class PhoenixHeal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); diff --git a/Projectiles/Healing/PhoenixHeal.png b/Projectiles/Healing/PhoenixHeal.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/PhoenixHeal.png and /dev/null differ diff --git a/Projectiles/Healing/RainHeal.cs b/Projectiles/Healing/RainHeal.cs index 329c8fdb07..3a4669b204 100644 --- a/Projectiles/Healing/RainHeal.cs +++ b/Projectiles/Healing/RainHeal.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class RainHeal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); @@ -23,9 +25,13 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; - projectile.HealingProjectile(8, projectile.owner, 12f, 15f, false); + if (projectile.timeLeft < 165) + { + if (projectile.timeLeft > 150) + projectile.velocity *= 0.9f; + else + projectile.HealingProjectile(8, projectile.owner, 12f, 15f, false); + } float num498 = projectile.velocity.X * 0.2f; float num499 = -(projectile.velocity.Y * 0.2f); diff --git a/Projectiles/Healing/RainHeal.png b/Projectiles/Healing/RainHeal.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/RainHeal.png and /dev/null differ diff --git a/Projectiles/Healing/ReaverHealOrb.cs b/Projectiles/Healing/ReaverHealOrb.cs new file mode 100644 index 0000000000..55f2e8dc23 --- /dev/null +++ b/Projectiles/Healing/ReaverHealOrb.cs @@ -0,0 +1,35 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Healing +{ + public class ReaverHealOrb : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Heal Orb"); + } + + 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; + } + + 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); + Dust dust = Main.dust[dusty]; + dust.noGravity = true; + 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 7d0b933b52..41f7ab45ea 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class RoyalHeal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); diff --git a/Projectiles/Healing/RoyalHeal.png b/Projectiles/Healing/RoyalHeal.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Healing/RoyalHeal.png and /dev/null differ diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index 0f8802326f..1f838638d6 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Healing { public class ShinobiHealOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blue Healing Orb"); diff --git a/Projectiles/Healing/ShinobiHealOrb.png b/Projectiles/Healing/ShinobiHealOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Healing/ShinobiHealOrb.png and /dev/null differ diff --git a/Projectiles/Healing/TerracottaProj.cs b/Projectiles/Healing/TerracottaProj.cs index e9fdc8ca58..25e4c0c8ec 100644 --- a/Projectiles/Healing/TerracottaProj.cs +++ b/Projectiles/Healing/TerracottaProj.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class TerracottaProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Terra"); @@ -23,8 +25,7 @@ namespace CalamityMod.Projectiles.Healing public override void AI() { - projectile.velocity.X *= 0.95f; - projectile.velocity.Y *= 0.95f; + projectile.velocity *= 0.99f; projectile.HealingProjectile(9, (int)projectile.ai[0], 8f, 15f, false, 300); float num498 = projectile.velocity.X * 0.2f; diff --git a/Projectiles/Healing/TerracottaProj.png b/Projectiles/Healing/TerracottaProj.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Healing/TerracottaProj.png and /dev/null differ diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index cf1d9d6fbc..78b8539890 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Healing { public class TransfusionTrail : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heal"); diff --git a/Projectiles/Healing/TransfusionTrail.png b/Projectiles/Healing/TransfusionTrail.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Healing/TransfusionTrail.png and /dev/null differ diff --git a/Projectiles/Hybrid/AccretionDisk2.cs b/Projectiles/Hybrid/AccretionDisk2.cs deleted file mode 100644 index ceefab5125..0000000000 --- a/Projectiles/Hybrid/AccretionDisk2.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class AccretionDisk2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Accretion Disk"); - 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.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = ProjectileID.WoodenBoomerang; - projectile.Calamity().rogue = true; - } - - public override void AI() - { - if (Main.rand.NextBool(10)) - { - int num250 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 66, (float)(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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/AccretionDisk2.png b/Projectiles/Hybrid/AccretionDisk2.png deleted file mode 100644 index e131c1a252..0000000000 Binary files a/Projectiles/Hybrid/AccretionDisk2.png and /dev/null differ diff --git a/Projectiles/Hybrid/AccretionDiskProj.cs b/Projectiles/Hybrid/AccretionDiskProj.cs deleted file mode 100644 index 9416c3c306..0000000000 --- a/Projectiles/Hybrid/AccretionDiskProj.cs +++ /dev/null @@ -1,123 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class AccretionDiskProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Elemental Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 56; - projectile.height = 56; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 400; - aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; - } - - public override void AI() - { - if (Main.rand.NextBool(3)) - { - 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 *= 0f; - } - - Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); - - float maxDistance = 300f; - bool homeIn = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - 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); - - if (Vector2.Distance(npc.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) - { - homeIn = true; - break; - } - } - } - - if (!projectile.friendly) - { - homeIn = false; - } - - if (homeIn) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] % 10f == 0f && Main.rand.NextBool(5)) - { - int splitProj = ModContent.ProjectileType(); - 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 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); - Main.projectile[disk].Calamity().forceMelee = projectile.melee; - Main.projectile[disk].Calamity().forceRogue = projectile.Calamity().rogue; - 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); - Main.projectile[disk2].Calamity().forceMelee = projectile.melee; - Main.projectile[disk2].Calamity().forceRogue = projectile.Calamity().rogue; - } - } - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/AccretionDiskProj.png b/Projectiles/Hybrid/AccretionDiskProj.png deleted file mode 100644 index e131c1a252..0000000000 Binary files a/Projectiles/Hybrid/AccretionDiskProj.png and /dev/null differ diff --git a/Projectiles/Hybrid/AetherBeam.cs b/Projectiles/Hybrid/AetherBeam.cs index e945b3dcff..abe45ed0d7 100644 --- a/Projectiles/Hybrid/AetherBeam.cs +++ b/Projectiles/Hybrid/AetherBeam.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Hybrid { public class AetherBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + private bool split = true; public override void SetStaticDefaults() @@ -35,79 +37,42 @@ namespace CalamityMod.Projectiles.Hybrid projectile.magic = false; projectile.ranged = true; } + if (projectile.ai[1] == 1f) { split = false; projectile.tileCollide = false; projectile.ai[1] = 0f; } + projectile.damage += projectile.Calamity().defDamage / 200; + 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); + float num55 = 100f; - float num56 = 2f; //3 + float num56 = 2f; if (projectile.ai[1] == 0f) { 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(); - } } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 50, 200, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 200, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 2f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 2f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Hybrid/AetherBeam.png b/Projectiles/Hybrid/AetherBeam.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Hybrid/AetherBeam.png and /dev/null differ diff --git a/Projectiles/Hybrid/CorpusAvertorClone.cs b/Projectiles/Hybrid/CorpusAvertorClone.cs deleted file mode 100644 index 13776d6916..0000000000 --- a/Projectiles/Hybrid/CorpusAvertorClone.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class CorpusAvertorClone : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - 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.penetrate = 1; - projectile.timeLeft = 180; - projectile.melee = true; - projectile.tileCollide = false; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; - - projectile.velocity.X *= 1.005f; - projectile.velocity.Y *= 1.005f; - - switch ((int)projectile.ai[0]) - { - case 20: - projectile.scale = 0.7f; - break; - case 40: - projectile.scale = 0.8f; - break; - case 60: - projectile.scale = 0.9f; - break; - default: - break; - } - projectile.width = projectile.height = (int)(24f * projectile.scale); - - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 16f, 20f); - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - return new Color((int)(150f * ((float)projectile.timeLeft / 85f)), 0, 0, projectile.timeLeft / 5 * 3); - } - return new Color(150, 0, 0, 50); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - return; - - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - } -} diff --git a/Projectiles/Hybrid/CorpusAvertorClone.png b/Projectiles/Hybrid/CorpusAvertorClone.png deleted file mode 100644 index 1d32c48c94..0000000000 Binary files a/Projectiles/Hybrid/CorpusAvertorClone.png and /dev/null differ diff --git a/Projectiles/Hybrid/CorpusAvertorProj.cs b/Projectiles/Hybrid/CorpusAvertorProj.cs deleted file mode 100644 index ffc580247e..0000000000 --- a/Projectiles/Hybrid/CorpusAvertorProj.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class CorpusAvertorProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Corpus Avertor"); - 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.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - 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] < 61f) - { - 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 - velocity *= mult; - - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), - (int)(projectile.damage * mult), projectile.knockBack * mult, projectile.owner, projectile.ai[0], projectile.melee ? 0f : 1f); - } - } - else - { - projectile.velocity.X *= 1.01f; - projectile.velocity.Y *= 1.01f; - - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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) - { - if (projectile.ai[0] >= 61f) - { - int scale = (int)((projectile.ai[0] - 60f) * 4.25f); - return new Color(scale, 0, 0, 50); - } - return new Color(0, 0, 0, 50); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - return; - - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - float heal = (float)damage * 0.05f; - if ((int)heal == 0) - return; - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 1.5f); - } - } -} diff --git a/Projectiles/Hybrid/CorpusAvertorProj.png b/Projectiles/Hybrid/CorpusAvertorProj.png deleted file mode 100644 index 1d32c48c94..0000000000 Binary files a/Projectiles/Hybrid/CorpusAvertorProj.png and /dev/null differ diff --git a/Projectiles/Hybrid/EmpyreanKnife.cs b/Projectiles/Hybrid/EmpyreanKnife.cs deleted file mode 100644 index ddd8abd06d..0000000000 --- a/Projectiles/Hybrid/EmpyreanKnife.cs +++ /dev/null @@ -1,135 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class EmpyreanKnife : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - 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.timeLeft = 300; - projectile.melee = true; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - 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; - } - } - if (projectile.ai[0] < 75f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - } - else - { - projectile.rotation += 0.5f; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 15f, 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); - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - 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; - } - } - return false; - } - - 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, 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; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - float healAmt = (float)damage * 0.005f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - float healAmt = (float)damage * 0.005f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/EradicatorProjectile.cs b/Projectiles/Hybrid/EradicatorProjectile.cs deleted file mode 100644 index 89990120da..0000000000 --- a/Projectiles/Hybrid/EradicatorProjectile.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class EradicatorProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Eradicator"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 58; - projectile.height = 58; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; - aiType = ProjectileID.WoodenBoomerang; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 8f, 6, ModContent.ProjectileType(), 1D, true); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 origin = new Vector2(31f, 29f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Hybrid/EradicatorProjectileGlow"), 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(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 600); - target.AddBuff(BuffID.Frostburn, 600); - } - } -} diff --git a/Projectiles/Hybrid/EradicatorProjectile.png b/Projectiles/Hybrid/EradicatorProjectile.png deleted file mode 100644 index e028ca0e83..0000000000 Binary files a/Projectiles/Hybrid/EradicatorProjectile.png and /dev/null differ diff --git a/Projectiles/Hybrid/EradicatorProjectileGlow.png b/Projectiles/Hybrid/EradicatorProjectileGlow.png deleted file mode 100644 index 152b9ce5ae..0000000000 Binary files a/Projectiles/Hybrid/EradicatorProjectileGlow.png and /dev/null differ diff --git a/Projectiles/Hybrid/FlameScytheProjectile.cs b/Projectiles/Hybrid/FlameScytheProjectile.cs deleted file mode 100644 index b2426aba4d..0000000000 --- a/Projectiles/Hybrid/FlameScytheProjectile.cs +++ /dev/null @@ -1,80 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class FlameScytheProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Scythe"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.extraUpdates = 1; - projectile.timeLeft = 600; - projectile.alpha = 55; - aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; - } - - public override void AI() - { - 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 + (float)(projectile.width / 2) + projectile.velocity.X, projectile.position.Y + (float)(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; - } - } - - 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); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int proj = 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 (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - if (projectile.owner == Main.myPlayer) - { - int proj = 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 (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - } -} diff --git a/Projectiles/Hybrid/FlameScytheProjectile.png b/Projectiles/Hybrid/FlameScytheProjectile.png deleted file mode 100644 index 2fb615a053..0000000000 Binary files a/Projectiles/Hybrid/FlameScytheProjectile.png and /dev/null differ diff --git a/Projectiles/Hybrid/GalaxySmasherHammer.cs b/Projectiles/Hybrid/GalaxySmasherHammer.cs deleted file mode 100644 index 6bf63941db..0000000000 --- a/Projectiles/Hybrid/GalaxySmasherHammer.cs +++ /dev/null @@ -1,257 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class GalaxySmasherHammer : ModProjectile - { - private static float RotationIncrement = 0.22f; - private static int Lifetime = 240; - private static float ReboundTime = 26f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Galaxy Smasher"); - 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.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; - } - - public override void AI() - { - drawOffsetX = -12; - drawOriginOffsetY = -5; - drawOriginOffsetX = 0; - - // Produces violet dust constantly while in flight. This lights the hammer. - int numDust = 2; - for (int i = 0; i < numDust; ++i) - { - 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); - 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) - { - projectile.soundDelay = 8; - Main.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) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float returnSpeed = GalaxySmasherMelee.Speed; - float acceleration = 3.2f; - 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 dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - 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(); - } - - // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; - return; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // Some dust gets produced on impact. - int dustSets = Main.rand.Next(5, 8); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustSets; ++i) - { - // Bigger, flying orb dust - float scaleOrb = 1.2f + Main.rand.NextFloat(1f); - int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); - Main.dust[orb].noGravity = true; - Main.dust[orb].velocity *= 4f; - Main.dust[orb].scale = scaleOrb; - - // Add six sparkles per flying orb - for (int j = 0; j < 6; ++j) - { - float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); - int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); - Main.dust[sparkle].noGravity = true; - float dustSpeed = Main.rand.NextFloat(10f, 18f); - Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; - Main.dust[sparkle].scale = scaleSparkle; - } - } - - // Makes an explosion sound. - Main.PlaySound(SoundID.Item14, projectile.position); - - // Applies God Slayer Inferno on contact. - target.AddBuff(ModContent.BuffType(), 480); - - // Three death lasers (aka "Nebula Shots") swarm the target. - int laserID = ModContent.ProjectileType(); - int laserDamage = (int)(0.2f * projectile.damage); - float laserKB = 2.5f; - int numLasers = 3; - for (int i = 0; i < numLasers; ++i) - { - float startDist = Main.rand.NextFloat(260f, 270f); - Vector2 startDir = Main.rand.NextVector2Unit(); - Vector2 startPoint = target.Center + (startDir * startDist); - - float laserSpeed = Main.rand.NextFloat(15f, 18f); - Vector2 velocity = startDir * (-laserSpeed); - - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 30; - } - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - // Some dust gets produced on impact. - int dustSets = Main.rand.Next(5, 8); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustSets; ++i) - { - // Bigger, flying orb dust - float scaleOrb = 1.2f + Main.rand.NextFloat(1f); - int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); - Main.dust[orb].noGravity = true; - Main.dust[orb].velocity *= 4f; - Main.dust[orb].scale = scaleOrb; - - // Add six sparkles per flying orb - for (int j = 0; j < 6; ++j) - { - float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); - int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); - Main.dust[sparkle].noGravity = true; - float dustSpeed = Main.rand.NextFloat(10f, 18f); - Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; - Main.dust[sparkle].scale = scaleSparkle; - } - } - - // Makes an explosion sound. - Main.PlaySound(SoundID.Item14, projectile.position); - - // Applies God Slayer Inferno on contact. - target.AddBuff(ModContent.BuffType(), 480); - - // Three death lasers (aka "Nebula Shots") swarm the target. - int laserID = ModContent.ProjectileType(); - int laserDamage = (int)(0.2f * projectile.damage); - float laserKB = 2.5f; - int numLasers = 3; - for (int i = 0; i < numLasers; ++i) - { - float startDist = Main.rand.NextFloat(260f, 270f); - Vector2 startDir = Main.rand.NextVector2Unit(); - Vector2 startPoint = target.Center + (startDir * startDist); - - float laserSpeed = Main.rand.NextFloat(15f, 18f); - Vector2 velocity = startDir * (-laserSpeed); - - // NebulaShot projectile adjusts its own damage type based on ai[0] - if (projectile.owner == Main.myPlayer) - { - float damageType = projectile.melee ? 1f : 2f; - int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner, damageType, 0f); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 30; - } - } - } - } -} diff --git a/Projectiles/Hybrid/GalaxySmasherHammer.png b/Projectiles/Hybrid/GalaxySmasherHammer.png deleted file mode 100644 index 9b40695ec7..0000000000 Binary files a/Projectiles/Hybrid/GalaxySmasherHammer.png and /dev/null differ diff --git a/Projectiles/Hybrid/IllustriousKnife.cs b/Projectiles/Hybrid/IllustriousKnife.cs deleted file mode 100644 index af48e7b922..0000000000 --- a/Projectiles/Hybrid/IllustriousKnife.cs +++ /dev/null @@ -1,105 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Healing; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class IllustriousKnife : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - 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 = 1; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } - - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 240f) - { - projectile.alpha += 4; - projectile.damage = (int)((double)projectile.damage * 0.95); - projectile.knockBack = (float)(int)((double)projectile.knockBack * 0.95); - } - if (projectile.ai[0] < 240f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - else - { - projectile.rotation += 0.5f; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 35f, 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); - } - } - - 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); - Main.dust[num304].noGravity = true; - Main.dust[num304].velocity *= 1.2f; - Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - if (target.type == NPCID.TargetDummy) - { - return; - } - float healAmt = (float)damage * 0.015f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600); - float healAmt = (float)damage * 0.015f; - if ((int)healAmt == 0) - { - return; - } - if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { - return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/KelvinCatalystBoomerang.cs b/Projectiles/Hybrid/KelvinCatalystBoomerang.cs deleted file mode 100644 index 529d3089a2..0000000000 --- a/Projectiles/Hybrid/KelvinCatalystBoomerang.cs +++ /dev/null @@ -1,198 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class KelvinCatalystBoomerang : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Kelvin Catalyst"); - 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.penetrate = -1; - projectile.extraUpdates = 1; - projectile.melee = true; - projectile.coldDamage = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - projectile.localAI[0] = reader.ReadSingle(); - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, Main.DiscoR * 0.3f / 255f, Main.DiscoR * 0.4f / 255f, Main.DiscoR * 0.5f / 255f); - - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 75f) - { - projectile.ai[0] = 1f; - projectile.localAI[0] = 0f; - projectile.width = projectile.height = 60; - projectile.tileCollide = false; - projectile.netUpdate = true; - } - } - else - { - float num42 = 20f; - float num43 = 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; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - - if (num46 > 3000f) - projectile.Kill(); - - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - - 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; - } - 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.Y < num45) - { - 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) - { - 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) - { - 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(); - } - } - - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default, 1f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - - projectile.rotation += 0.25f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.ai[0] = 1f; - projectile.localAI[0] = 0f; - projectile.width = projectile.height = 60; - 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - 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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 6, 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 / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(SoundID.Item30, projectile.position); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Frostburn, 240); - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 25) - { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - 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(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 4f), (float)(Math.Cos(offsetAngle) * 4f), - ModContent.ProjectileType(), projectile.damage / 6, 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 / 6, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } - Main.PlaySound(SoundID.Item30, projectile.position); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/KelvinCatalystBoomerang.png b/Projectiles/Hybrid/KelvinCatalystBoomerang.png deleted file mode 100644 index 86a074d801..0000000000 Binary files a/Projectiles/Hybrid/KelvinCatalystBoomerang.png and /dev/null differ diff --git a/Projectiles/Hybrid/MangroveChakramProjectile.cs b/Projectiles/Hybrid/MangroveChakramProjectile.cs deleted file mode 100644 index a11bbb4c5e..0000000000 --- a/Projectiles/Hybrid/MangroveChakramProjectile.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class MangroveChakramProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chakram"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 600; - aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; - } - - public override void AI() - { - 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); - } - } - - 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); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; - target.AddBuff(BuffID.CursedInferno, 120); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} diff --git a/Projectiles/Hybrid/MangroveChakramProjectile.png b/Projectiles/Hybrid/MangroveChakramProjectile.png deleted file mode 100644 index 5e0ab11e47..0000000000 Binary files a/Projectiles/Hybrid/MangroveChakramProjectile.png and /dev/null differ diff --git a/Projectiles/Hybrid/NanoblackMain.cs b/Projectiles/Hybrid/NanoblackMain.cs deleted file mode 100644 index 8bab65c856..0000000000 --- a/Projectiles/Hybrid/NanoblackMain.cs +++ /dev/null @@ -1,166 +0,0 @@ -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class NanoblackMain : ModProjectile - { - private static float RotationIncrement = 0.22f; - private static int Lifetime = 240; - private static float ReboundTime = 50f; - private static int MinBladeTimer = 13; - private static int MaxBladeTimer = 18; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Reaper"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - 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 = 2; - } - - public override void AI() - { - drawOffsetX = -11; - drawOriginOffsetY = -4; - drawOriginOffsetX = 0; - - // Initialize the frame counter and random blade delay on the very first frame. - if (projectile.timeLeft == Lifetime) - projectile.ai[1] = GetBladeDelay(); - - // Produces electricity and green firework sparks constantly while in flight. - if (Main.rand.NextBool(3)) - { - 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); - Main.dust[idx].noGravity = true; - 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; - - // On the frame the scythe begins returning, send a net update. - 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) - { - float returnSpeed = NanoblackReaperMelee.Speed; - float acceleration = 2.4f; - 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 dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - if (dist > 3000f) - projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - 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(); - } - - // Create nanoblack energy blades at a somewhat-random rate while in flight. - if (projectile.ai[1] <= 0f) - { - SpawnEnergyBlade(); - projectile.ai[1] = GetBladeDelay(); - } - - // Rotate the scythe as it flies. - float spin = (projectile.direction <= 0) ? -1f : 1f; - projectile.rotation += spin * RotationIncrement; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - private int GetBladeDelay() - { - return Main.rand.Next(MinBladeTimer, MaxBladeTimer + 1); - } - - private void SpawnEnergyBlade() - { - int bladeID = ModContent.ProjectileType(); - int bladeDamage = projectile.damage / 5; - float bladeKB = 3f; - 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) - { - int proj = Projectile.NewProjectile(pos, Vector2.Zero, bladeID, bladeDamage, bladeKB, projectile.owner, 0f, spin); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } - } - } -} diff --git a/Projectiles/Hybrid/NanoblackMain.png b/Projectiles/Hybrid/NanoblackMain.png deleted file mode 100644 index a4de09bee1..0000000000 Binary files a/Projectiles/Hybrid/NanoblackMain.png and /dev/null differ diff --git a/Projectiles/Hybrid/NanoblackSplit.cs b/Projectiles/Hybrid/NanoblackSplit.cs deleted file mode 100644 index 61fb2a7bae..0000000000 --- a/Projectiles/Hybrid/NanoblackSplit.cs +++ /dev/null @@ -1,212 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class NanoblackSplit : ModProjectile - { - private static int SpriteWidth = 52; - private static int Lifetime = 90; - private static float MaxRotationSpeed = 0.25f; - private static float MaxSpeed = 22f; - - private static float HomingStartRange = 600f; - private static float HomingBreakRange = 1000f; - private static float HomingBonusRangeCap = 200f; - private static float BaseHomingFactor = 1.6f; - private static float MaxHomingFactor = 6.6f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Nanoblack Blade"); - 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; - } - - // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target - // ai[1] = Current spin speed. Negative speeds are also allowed. - public override void AI() - { - drawOffsetX = -10; - drawOriginOffsetY = 0; - drawOriginOffsetX = 0; - - // 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) - 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 spinReduction = 0.0166f * currentSpin; - projectile.ai[1] -= spinReduction; - - // If about to disappear, shrink by 8% every frame - if (projectile.timeLeft < 15) - projectile.scale *= 0.92f; - - // Search for and home in on nearby targets - HomingAI(); - } - - private void HomingAI() - { - // If we don't currently have a target, go try and get one! - 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; - - // If we don't have a target, then just slow down a bit. - if (targetID < 0) - { - 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 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; - return; - } - - // Adds a multiple of the towards-target vector to its velocity every frame. - float homingFactor = CalcHomingFactor(dist); - Vector2 posDiff = target.Center - projectile.Center; - posDiff = posDiff.SafeNormalize(Vector2.Zero); - posDiff *= homingFactor; - Vector2 newVelocity = projectile.velocity += posDiff; - - // Caps speed to make sure it doesn't go too fast. - if (newVelocity.Length() >= MaxSpeed) - { - newVelocity = newVelocity.SafeNormalize(Vector2.Zero); - newVelocity *= MaxSpeed; - } - - projectile.velocity = newVelocity; - } - - // Returns the ID of the NPC to be targeted by this energy blade. - // It chooses the closest target which can be chased, ignoring invulnerable NPCs. - // Nanoblack Blades prefer to target bosses whenever possible. - private int AcquireTarget() - { - bool bossFound = false; - int target = -1; - float minDist = HomingStartRange; - for (int i = 0; i < 200; ++i) - { - NPC npc = Main.npc[i]; - if (!npc.active || npc.type == NPCID.TargetDummy) - continue; - - // If we've found a valid boss target, ignore ALL targets which aren't bosses. - if (bossFound && !npc.boss) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - 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) - { - // If this target within range is a boss, set the boss found flag. - if (npc.boss) - bossFound = true; - minDist = distToNPC; - target = i; - } - } - } - return target; - } - - // Energy blades home even more aggressively if they are very close to their target. - private float CalcHomingFactor(float dist) - { - float baseFactor = BaseHomingFactor; - float bonus = (MaxHomingFactor - BaseHomingFactor) * (1f - dist / HomingBonusRangeCap); - if (bonus < 0f) - bonus = 0f; - return baseFactor + bonus; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - // Draws the energy blade's glowmask. - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) - { - float fWidthOverTwo = SpriteWidth / 2f; - float fHeightOverTwo = projectile.height / 2f; - - // Make sure the glowmask matches the blade's own orientation - SpriteEffects eff = SpriteEffects.None; - if (projectile.spriteDirection == -1) - eff = SpriteEffects.FlipHorizontally; - Vector2 origin = new Vector2(fWidthOverTwo, fHeightOverTwo); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Hybrid/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. - public override void Kill(int timeLeft) - { - SpawnDust(); - } - - // Spawns a small bit of Luminite themed dust. - private void SpawnDust() - { - int dustCount = Main.rand.Next(3, 6); - 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); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - Main.dust[idx].scale = scale; - } - } - } -} diff --git a/Projectiles/Hybrid/OPHammer.cs b/Projectiles/Hybrid/OPHammer.cs deleted file mode 100644 index b262e027f2..0000000000 --- a/Projectiles/Hybrid/OPHammer.cs +++ /dev/null @@ -1,147 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class OPHammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - 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.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 2; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - 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; - float num46 = (float)Math.Sqrt((double)(num44 * num44 + num45 * num45)); - if (num46 > 3000f) - { - projectile.Kill(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - 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; - } - } - 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.Y < num45) - { - 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) - { - 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) - { - 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.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - if (projectile.owner == Main.myPlayer) - { - int proj = 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 (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 300); - if (projectile.owner == Main.myPlayer) - { - int proj = 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 (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/OPHammer.png b/Projectiles/Hybrid/OPHammer.png deleted file mode 100644 index b527ef88b6..0000000000 Binary files a/Projectiles/Hybrid/OPHammer.png and /dev/null differ diff --git a/Projectiles/Hybrid/PwnagehammerProj.png b/Projectiles/Hybrid/PwnagehammerProj.png deleted file mode 100644 index 7a6cb7bc22..0000000000 Binary files a/Projectiles/Hybrid/PwnagehammerProj.png and /dev/null differ diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosMini.cs b/Projectiles/Hybrid/ScourgeoftheCosmosMini.cs deleted file mode 100644 index cc1587a8a1..0000000000 --- a/Projectiles/Hybrid/ScourgeoftheCosmosMini.cs +++ /dev/null @@ -1,175 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class ScourgeoftheCosmosMini : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge Mini"); - Main.projFrames[projectile.type] = 2; - } - - public override void SetDefaults() - { - projectile.width = 16; - projectile.height = 16; - projectile.friendly = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - projectile.melee = true; - projectile.extraUpdates = 3; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - if (projectile.alpha > 0) - { - projectile.alpha -= 50; - } - else - { - projectile.extraUpdates = 0; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.frameCounter++; - if (projectile.frameCounter >= 6) - { - projectile.frame++; - projectile.frameCounter = 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 * (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.velocity *= 0f; - dust.scale = 0.5f; - } - 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] = 30f; - for (int num376 = 0; num376 < Main.maxNPCs; num376++) - { - if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) - { - 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)) - { - num375 = num379; - num373 = num377; - num374 = num378; - flag10 = true; - } - } - } - } - 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; - } - 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); - 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) - { - 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) - { - 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) - { - 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) - { - projectile.velocity.Y = projectile.velocity.Y - num381; - if (projectile.velocity.Y > 0f && num383 < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - 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; - } - } - 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; - Vector2 origin = new Vector2(9f, 10f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Hybrid/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/Hybrid/ScourgeoftheCosmosProj.cs b/Projectiles/Hybrid/ScourgeoftheCosmosProj.cs deleted file mode 100644 index fec3401f15..0000000000 --- a/Projectiles/Hybrid/ScourgeoftheCosmosProj.cs +++ /dev/null @@ -1,178 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class ScourgeoftheCosmosProj : ModProjectile - { - private int bounce = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cosmic Scourge"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.alpha = 255; - projectile.friendly = true; - projectile.melee = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.extraUpdates = 1; - } - - public override void AI() - { - if (projectile.ai[1] == 1f) - { - projectile.melee = false; - projectile.Calamity().rogue = true; - } - 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 * (float)num20; - float num22 = projectile.velocity.Y / 4f * (float)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((double)projectile.velocity.Y, (double)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; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - bounce--; - if (bounce <= 0) - { - 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) - { - int num626 = 1; - if (Main.rand.NextBool(10)) - { - num626++; - } - int num3; - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - return false; - } - - public override void Kill(int timeLeft) - { - Main.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); - Dust dust = Main.dust[num623]; - dust.scale *= 1.1f; - Main.dust[num623].noGravity = true; - num3 = num622; - } - 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); - Dust dust = Main.dust[num625]; - dust.velocity *= 2.5f; - dust = Main.dust[num625]; - dust.scale *= 0.8f; - Main.dust[num625].noGravity = true; - num3 = num624; - } - if (projectile.owner == Main.myPlayer) - { - int num626 = 3; - if (Main.rand.NextBool(10)) - { - num626++; - } - for (int num627 = 0; num627 < num626; num627 = num3 + 1) - { - float num628 = (float)Main.rand.Next(-35, 36) * 0.02f; - float num629 = (float)Main.rand.Next(-35, 36) * 0.02f; - num628 *= 10f; - num629 *= 10f; - if (!projectile.melee) - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 1f); - } - else - { - Projectile.NewProjectile(projectile.position.X, projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); - } - num3 = num627; - } - } - } - } -} diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosProj.png b/Projectiles/Hybrid/ScourgeoftheCosmosProj.png deleted file mode 100644 index 2bfdfe1cbf..0000000000 Binary files a/Projectiles/Hybrid/ScourgeoftheCosmosProj.png and /dev/null differ diff --git a/Projectiles/Hybrid/SeashellBoomerangProjectile.png b/Projectiles/Hybrid/SeashellBoomerangProjectile.png deleted file mode 100644 index 4e0fba13e0..0000000000 Binary files a/Projectiles/Hybrid/SeashellBoomerangProjectile.png and /dev/null differ diff --git a/Projectiles/Hybrid/StellarContemptHammer.cs b/Projectiles/Hybrid/StellarContemptHammer.cs deleted file mode 100644 index 0eef764290..0000000000 --- a/Projectiles/Hybrid/StellarContemptHammer.cs +++ /dev/null @@ -1,259 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid -{ - public class StellarContemptHammer : ModProjectile - { - private static float RotationIncrement = 0.22f; - private static int Lifetime = 240; - private static float ReboundTime = 26f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Stellar Contempt"); - 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.ignoreWater = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = Lifetime; - } - - public override void AI() - { - drawOffsetX = -11; - drawOriginOffsetY = -10; - drawOriginOffsetX = 0; - - Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0.6f); - - // The hammer makes sound while flying. - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.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) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= ReboundTime) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float returnSpeed = StellarContemptMelee.Speed; - float acceleration = 3.2f; - 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 dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - if (dist > 3000f) - projectile.Kill(); - - dist = returnSpeed / dist; - xDist *= dist; - yDist *= dist; - - // Home back in on the player. - if (projectile.velocity.X < xDist) - { - projectile.velocity.X = projectile.velocity.X + acceleration; - if (projectile.velocity.X < 0f && xDist > 0f) - projectile.velocity.X += acceleration; - } - else if (projectile.velocity.X > xDist) - { - projectile.velocity.X = projectile.velocity.X - acceleration; - if (projectile.velocity.X > 0f && xDist < 0f) - projectile.velocity.X -= acceleration; - } - if (projectile.velocity.Y < yDist) - { - projectile.velocity.Y = projectile.velocity.Y + acceleration; - if (projectile.velocity.Y < 0f && yDist > 0f) - projectile.velocity.Y += acceleration; - } - else if (projectile.velocity.Y > yDist) - { - 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(); - } - - // Rotate the hammer as it flies. - projectile.rotation += RotationIncrement; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - // Some dust gets produced on impact. - int dustCount = Main.rand.Next(20, 24); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustCount; ++i) - { - int dustType = 229; - float scale = 0.8f + Main.rand.NextFloat(1.1f); - int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - Main.dust[idx].scale = scale; - } - - // Applies Nightwither on contact at night. - if (!Main.dayTime) - target.AddBuff(ModContent.BuffType(), 480); - - // Do not drop lunar flares on dummies. - if (target.type == NPCID.TargetDummy) - return; - - // 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; - - int numFlares = 2; - int flareDamage = (int)(0.3f * projectile.damage); - float flareKB = 4f; - for (int i = 0; i < numFlares; ++i) - { - float flareSpeed = Main.rand.NextFloat(8f, 11f); - - // Flares never come from straight up, there is always at least an 80 pixel horizontal offset - float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); - float yDist = Main.rand.NextFloat(1200f, 1440f); - Vector2 startPoint = target.Center + new Vector2(xDist, -yDist); - - // The flare is somewhat inaccurate based on the size of the target. - float xVariance = target.width / 4f; - if (xVariance < 8f) - xVariance = 8f; - float yVariance = target.height / 4f; - if (yVariance < 8f) - yVariance = 8f; - float xOffset = Main.rand.NextFloat(-xVariance, xVariance); - float yOffset = Main.rand.NextFloat(-yVariance, yVariance); - Vector2 offsetTarget = target.Center + new Vector2(xOffset, yOffset); - - // Finalize the velocity vector and make sure it's going at the right speed. - Vector2 velocity = offsetTarget - startPoint; - velocity.Normalize(); - velocity *= flareSpeed; - - float AI1 = (float)Main.rand.Next(3); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } - } - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - // Some dust gets produced on impact. - int dustCount = Main.rand.Next(20, 24); - int dustRadius = 6; - Vector2 corner = new Vector2(target.Center.X - (float)dustRadius, target.Center.Y - (float)dustRadius); - for (int i = 0; i < dustCount; ++i) - { - int dustType = 229; - float scale = 0.8f + Main.rand.NextFloat(1.1f); - int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - Main.dust[idx].scale = scale; - } - - // Applies Nightwither on contact at night. - if (!Main.dayTime) - target.AddBuff(ModContent.BuffType(), 480); - - // 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; - - int numFlares = 2; - int flareDamage = (int)(0.3f * projectile.damage); - float flareKB = 4f; - for (int i = 0; i < numFlares; ++i) - { - float flareSpeed = Main.rand.NextFloat(8f, 11f); - - // Flares never come from straight up, there is always at least an 80 pixel horizontal offset - float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); - float yDist = Main.rand.NextFloat(1200f, 1440f); - Vector2 startPoint = target.Center + new Vector2(xDist, -yDist); - - // The flare is somewhat inaccurate based on the size of the target. - float xVariance = target.width / 4f; - if (xVariance < 8f) - xVariance = 8f; - float yVariance = target.height / 4f; - if (yVariance < 8f) - yVariance = 8f; - float xOffset = Main.rand.NextFloat(-xVariance, xVariance); - float yOffset = Main.rand.NextFloat(-yVariance, yVariance); - Vector2 offsetTarget = target.Center + new Vector2(xOffset, yOffset); - - // Finalize the velocity vector and make sure it's going at the right speed. - Vector2 velocity = offsetTarget - startPoint; - velocity.Normalize(); - velocity *= flareSpeed; - - float AI1 = (float)Main.rand.Next(3); - if (projectile.owner == Main.myPlayer) - { - int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); - CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); - if (projectile.melee) - cgp.forceMelee = true; - else - cgp.forceRogue = true; - } - } - } - } -} diff --git a/Projectiles/Hybrid/StellarContemptHammer.png b/Projectiles/Hybrid/StellarContemptHammer.png deleted file mode 100644 index d77b953151..0000000000 Binary files a/Projectiles/Hybrid/StellarContemptHammer.png and /dev/null differ diff --git a/Projectiles/Hybrid/TerraDiskProjectile.cs b/Projectiles/Hybrid/TerraDiskProjectile.cs deleted file mode 100644 index 1c1320a3ed..0000000000 --- a/Projectiles/Hybrid/TerraDiskProjectile.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class TerraDiskProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Disk"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; - } - - public override void SetDefaults() - { - projectile.width = 46; - projectile.height = 46; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 180; - aiType = ProjectileID.WoodenBoomerang; - } - - public override void AI() - { - 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); - } - int[] array = new int[20]; - int num428 = 0; - float num429 = 300f; - bool flag14 = false; - for (int num430 = 0; num430 < 200; num430++) - { - if (Main.npc[num430].CanBeChasedBy(projectile, false)) - { - float num431 = Main.npc[num430].position.X + (float)(Main.npc[num430].width / 2); - float num432 = Main.npc[num430].position.Y + (float)(Main.npc[num430].height / 2); - float num433 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num431) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num432); - if (num433 < num429 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num430].Center, 1, 1)) - { - if (num428 < 20) - { - array[num428] = num430; - num428++; - } - flag14 = true; - } - } - } - if (flag14) - { - int num434 = Main.rand.Next(num428); - num434 = array[num434]; - float num435 = Main.npc[num434].position.X + (float)(Main.npc[num434].width / 2); - float num436 = Main.npc[num434].position.Y + (float)(Main.npc[num434].height / 2); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 8f) - { - projectile.localAI[0] = 0f; - float num437 = 6f; - Vector2 value10 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - value10 += projectile.velocity * 4f; - float num438 = num435 - value10.X; - float num439 = num436 - value10.Y; - float num440 = (float)Math.Sqrt((double)(num438 * num438 + num439 * num439)); - num440 = num437 / num440; - if (Main.rand.NextBool(5)) - { - if (projectile.owner == Main.myPlayer) - { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - int i; - for (i = 0; i < 3; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj = 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); - if (projectile.melee) - Main.projectile[proj].Calamity().forceMelee = true; - else - Main.projectile[proj].Calamity().forceRogue = true; - int proj2 = 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, projectile.owner, 0f, 0f); - if (projectile.melee) - Main.projectile[proj2].Calamity().forceMelee = true; - else - Main.projectile[proj2].Calamity().forceRogue = true; - } - } - } - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/TerraDiskProjectile.png b/Projectiles/Hybrid/TerraDiskProjectile.png deleted file mode 100644 index 32b39a6f1e..0000000000 Binary files a/Projectiles/Hybrid/TerraDiskProjectile.png and /dev/null differ diff --git a/Projectiles/Hybrid/TerraDiskProjectile2.cs b/Projectiles/Hybrid/TerraDiskProjectile2.cs deleted file mode 100644 index 7bcd55d058..0000000000 --- a/Projectiles/Hybrid/TerraDiskProjectile2.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class TerraDiskProjectile2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra Disk"); - 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.friendly = true; - projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 60; - aiType = ProjectileID.WoodenBoomerang; - } - - public override void AI() - { - 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); - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - } -} diff --git a/Projectiles/Hybrid/TriactisOPHammer.cs b/Projectiles/Hybrid/TriactisOPHammer.cs deleted file mode 100644 index 1c0dae274f..0000000000 --- a/Projectiles/Hybrid/TriactisOPHammer.cs +++ /dev/null @@ -1,175 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Hybrid -{ - public class TriactisOPHammer : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - 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.tileCollide = false; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.melee = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 30f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 20f; - float num43 = 5f; - 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(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - 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; - } - } - 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.Y < num45) - { - 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) - { - 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) - { - 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.rotation += 0.5f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); - } - - 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)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - 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)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Hybrid/TriactisOPHammer.png b/Projectiles/Hybrid/TriactisOPHammer.png deleted file mode 100644 index 3f86fa3c6d..0000000000 Binary files a/Projectiles/Hybrid/TriactisOPHammer.png and /dev/null differ diff --git a/Projectiles/InvisibleProj.png b/Projectiles/InvisibleProj.png new file mode 100644 index 0000000000..40400cbedd Binary files /dev/null and b/Projectiles/InvisibleProj.png differ diff --git a/Projectiles/Boss/DoGNebulaShot.png b/Projectiles/LaserProj.png similarity index 100% rename from Projectiles/Boss/DoGNebulaShot.png rename to Projectiles/LaserProj.png diff --git a/Projectiles/Boss/DarkOrb.png b/Projectiles/LightningProj.png similarity index 100% rename from Projectiles/Boss/DarkOrb.png rename to Projectiles/LightningProj.png diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 7c257e8a44..208c9e6bc6 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class AbyssBall : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/AbyssBallVolley"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Abyss Ball"); diff --git a/Projectiles/Magic/AbyssBall.png b/Projectiles/Magic/AbyssBall.png deleted file mode 100644 index fb4efb0594..0000000000 Binary files a/Projectiles/Magic/AbyssBall.png and /dev/null differ diff --git a/Projectiles/Magic/AcidGunStream.cs b/Projectiles/Magic/AcidGunStream.cs index f39de0662b..7a955893a2 100644 --- a/Projectiles/Magic/AcidGunStream.cs +++ b/Projectiles/Magic/AcidGunStream.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class AcidGunStream : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Stream"); diff --git a/Projectiles/Magic/AcidGunStream.png b/Projectiles/Magic/AcidGunStream.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Magic/AcidGunStream.png and /dev/null differ diff --git a/Projectiles/Magic/AcidicSaxBubble.png b/Projectiles/Magic/AcidicSaxBubble.png index 2f086a2917..70d3753d89 100644 Binary files a/Projectiles/Magic/AcidicSaxBubble.png and b/Projectiles/Magic/AcidicSaxBubble.png differ diff --git a/Projectiles/Magic/Ancient.cs b/Projectiles/Magic/Ancient.cs index baaea73836..04e1483107 100644 --- a/Projectiles/Magic/Ancient.cs +++ b/Projectiles/Magic/Ancient.cs @@ -1,112 +1,127 @@ +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class Ancient : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient"); - } + public class Ancient : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 32; - projectile.height = 32; - 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 = 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; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.6f, 0.5f, 0f); - if (projectile.timeLeft % 30 == 0) + public override void AI() + { + 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) + { + 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]); + } + } + } + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; + projectile.frameCounter++; + if (projectile.frameCounter > 3) { - int numProj = 2; - int randomSpread = Main.rand.Next(3, 19); - float rotation = MathHelper.ToRadians(randomSpread); - 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, perturbedSpeed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - } - } + projectile.frame++; + projectile.frameCounter = 0; } - if (projectile.timeLeft > 151) + if (projectile.frame >= Main.projFrames[projectile.type]) { - projectile.timeLeft = 151; + projectile.frame = 0; } - if (projectile.ai[0] > 4f) - { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - 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); - Dust dust = Main.dust[num299]; - if (Main.rand.NextBool(2)) - { - dust.noGravity = true; - dust.scale *= 2f; - dust.velocity.X *= 6f; - dust.velocity.Y *= 6f; - } - else - { - dust.scale *= 1.5f; - } - dust.velocity.X *= 3f; - dust.velocity.Y *= 3f; - dust.scale *= num296; - } - 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); - Dust dust = Main.dust[num299]; - if (Main.rand.NextBool(3)) - { - dust.noGravity = true; - dust.scale *= 4f; - dust.velocity.X *= 4f; - dust.velocity.Y *= 4f; - } - else - { - dust.scale *= 2.5f; - } - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - dust.scale *= num296; - } - } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } + 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); + Dust dust = Main.dust[idx]; + if (Main.rand.NextBool(2)) + { + dust.noGravity = true; + dust.scale *= 2f; + dust.velocity.X *= 3f; + dust.velocity.Y *= 3f; + } + else + { + dust.scale *= 1.25f; + } + 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); + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 1.5f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 1.1f; + } + dust.velocity.X *= 1.5f; + dust.velocity.Y *= 1.5f; + } + 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); + + // Dust effects + 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) + { + 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; + float distToCenter = dustVelocity.Length(); + dustVelocity.Normalize(); + dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); + dustVelocity *= distToCenter * 0.04f; + Main.dust[dustIndex].velocity = dustVelocity; + } + } + return false; + } + } } diff --git a/Projectiles/Magic/Ancient.png b/Projectiles/Magic/Ancient.png index 2f776c6c06..687740685f 100644 Binary files a/Projectiles/Magic/Ancient.png and b/Projectiles/Magic/Ancient.png differ diff --git a/Projectiles/Magic/Ancient2.cs b/Projectiles/Magic/Ancient2.cs index dcba2cd1e3..1da2c20e4c 100644 --- a/Projectiles/Magic/Ancient2.cs +++ b/Projectiles/Magic/Ancient2.cs @@ -1,93 +1,122 @@ +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class Ancient2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ancient"); - } + public class Ancient2 : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/Ancient"; - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.magic = true; - projectile.penetrate = 4; - projectile.extraUpdates = 12; - projectile.timeLeft = 30; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ancient"); + Main.projFrames[projectile.type] = 6; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.3f, 0.25f, 0f); - if (projectile.timeLeft > 30) + 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; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.3f, 0.25f, 0f); + projectile.frameCounter++; + if (projectile.frameCounter > 3) { - projectile.timeLeft = 30; + projectile.frame++; + projectile.frameCounter = 0; } - if (projectile.ai[0] > 7f) + if (projectile.frame >= Main.projFrames[projectile.type]) { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - 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); - Dust dust = Main.dust[num299]; - if (Main.rand.NextBool(2)) - { - dust.noGravity = true; - dust.scale *= 1.5f; - dust.velocity.X *= 3f; - dust.velocity.Y *= 3f; - } - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - dust.scale *= num296; - } - 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); - Dust dust = Main.dust[num299]; - if (Main.rand.NextBool(3)) - { - dust.noGravity = true; - dust.scale *= 3f; - dust.velocity.X *= 2f; - dust.velocity.Y *= 2f; - } - else - { - dust.scale *= 2f; - } - dust.velocity.X *= 1.2f; - dust.velocity.Y *= 1.2f; - dust.scale *= num296; - } + projectile.frame = 0; } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } + 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); + Dust dust = Main.dust[idx]; + if (Main.rand.NextBool(2)) + { + dust.noGravity = true; + dust.scale *= 2f; + dust.velocity.X *= 2f; + dust.velocity.Y *= 2f; + } + else + { + dust.scale *= 1.25f; + } + 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); + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 2.5f; + dust.velocity.X *= 1.5f; + dust.velocity.Y *= 1.5f; + } + else + { + dust.scale *= 1.5f; + } + dust.velocity.X *= 1.1f; + dust.velocity.Y *= 1.1f; + } + 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; + 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) + spriteEffects = SpriteEffects.FlipHorizontally; + + 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); + + for (int i = 0; i < 20; i++) + { + // Dust + Vector2 dustPos = dustCircle.RandomPointInCircle(); + 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; + float distToCenter = dustVelocity.Length(); + dustVelocity.Normalize(); + dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); + dustVelocity *= distToCenter * 0.04f; + Main.dust[dustIndex].velocity = dustVelocity; + } + } + return false; + } + } } diff --git a/Projectiles/Magic/ApothChloro.cs b/Projectiles/Magic/ApothChloro.cs deleted file mode 100644 index 7a7a88882a..0000000000 --- a/Projectiles/Magic/ApothChloro.cs +++ /dev/null @@ -1,122 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ApothChloro : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rays of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.alpha = 70; - projectile.timeLeft = 120; - projectile.penetrate = 1; - projectile.hostile = false; - projectile.friendly = true; - projectile.magic = true; - projectile.light = 0.5f; - projectile.extraUpdates = 1; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); - for (int i = 0; i < 5; i++) - { - Dust dust4 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 242, projectile.velocity.X, projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= projectile.velocity / 5f * (float)i; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; - } - float num1 = (float)(projectile.position.X - projectile.velocity.X / 10.0 * 9.0); - float num2 = (float)(projectile.position.Y - projectile.velocity.Y / 10.0 * 9.0); - float num3 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); - float num4 = projectile.localAI[0]; - if (num4 == 0f) - { - projectile.localAI[0] = num3; - num4 = num3; - } - if (projectile.alpha > 0) - projectile.alpha = projectile.alpha - 25; - if (projectile.alpha < 0) - projectile.alpha = 0; - float num5 = (float)projectile.position.X; - float num6 = (float)projectile.position.Y; - float num7 = 300f; - bool flag2 = false; - int num8 = 0; - float num9; - if (projectile.ai[1] == 0f) - { - for (int index = 0; index < Main.maxNPCs; ++index) - { - if (Main.npc[index].CanBeChasedBy((object)this, false) && ((double)projectile.ai[1] == 0.0 || (double)projectile.ai[1] == (double)(index + 1))) - { - num1 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2); - num2 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); - num9 = Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - num1) + Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - num2); - if ((double)num9 < (double)num7 && Collision.CanHit(new Vector2((float)projectile.position.X + (float)(projectile.width / 2), (float)projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height)) - { - num7 = num9; - num5 = num1; - num6 = num2; - flag2 = true; - num8 = index; - } - } - } - if (flag2) - projectile.ai[1] = (float)(num8 + 1); - flag2 = false; - } - if (projectile.ai[1] > 0f) - { - int index = (int)((double)projectile.ai[1] - 1.0); - if (Main.npc[index].active && Main.npc[index].CanBeChasedBy((object)this, true) && !Main.npc[index].dontTakeDamage) - { - if ((double)Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - ((float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2))) + (double)Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - ((float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2))) < 3000.0) - { - flag2 = true; - num5 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2); - num6 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2); - } - } - else - projectile.ai[1] = 0.0f; - } - if (!projectile.friendly) - flag2 = false; - if (flag2) - { - double num15 = (double)num4; - Vector2 vector2 = new Vector2((float)(projectile.position.X + (double)projectile.width * 0.5), (float)(projectile.position.Y + (double)projectile.height * 0.5)); - num2 = num5 - (float)vector2.X; - num9 = num6 - (float)vector2.Y; - double num10 = Math.Sqrt((double)num2 * (double)num2 + (double)num9 * (double)num9); - float num11 = (float)(num15 / num10); - float num12 = num2 * num11; - float num13 = num9 * num11; - int num14 = 8; - projectile.velocity.X = (float)((projectile.velocity.X * (double)(num14 - 1) + (double)num12) / (double)num14); - projectile.velocity.Y = (float)((projectile.velocity.Y * (double)(num14 - 1) + (double)num13) / (double)num14); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600, true); - target.AddBuff(ModContent.BuffType(), 600, true); - } - } -} diff --git a/Projectiles/Magic/ApothChloro.png b/Projectiles/Magic/ApothChloro.png deleted file mode 100644 index a17ddc8d5d..0000000000 Binary files a/Projectiles/Magic/ApothChloro.png and /dev/null differ diff --git a/Projectiles/Magic/ApothJaws.cs b/Projectiles/Magic/ApothJaws.cs deleted file mode 100644 index 626ff7a2b2..0000000000 --- a/Projectiles/Magic/ApothJaws.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ApothJaws : ModProjectile - { - private const float degrees = (float)(Math.PI / 180) * 2; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jaws of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 144; - projectile.height = 72; - projectile.alpha = 70; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.light = 1.5f; - } - - public override void AI() - { - if (projectile.timeLeft % 8 == 0) - { - double angle = (double)Main.rand.Next(360) * Math.PI / 180; - float offsetX = projectile.position.X + (float)Main.rand.Next((int)projectile.width); - float offsetY = projectile.position.Y + (float)Main.rand.Next((int)projectile.height); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(offsetX, offsetY, 14 * (float)Math.Cos(angle), 14 * (float)Math.Sin(angle), ModContent.ProjectileType(), projectile.damage, projectile.knockBack / 2, projectile.owner); - } - } - if (projectile.timeLeft < 30) - projectile.alpha = projectile.alpha + 6; - else if (projectile.timeLeft < 210) - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; - } - else if (projectile.timeLeft < 240) - { - if (projectile.ai[1] == 0) - projectile.rotation += 1.3f * degrees; - else - projectile.rotation -= 1.3f * degrees; - } - else if (projectile.timeLeft == 240) - { - if (projectile.ai[1] == 0) - projectile.rotation = projectile.ai[0] - 30 * degrees; - else - { - projectile.rotation = projectile.ai[0] + 30 * degrees + (float)Math.PI; - projectile.spriteDirection = -1; - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600, true); - target.AddBuff(ModContent.BuffType(), 600, true); - target.AddBuff(ModContent.BuffType(), 600, true); - if (Main.rand.NextBool(30)) - { - target.AddBuff(ModContent.BuffType(), 120, true); - } - } - } -} diff --git a/Projectiles/Magic/ApothJaws.png b/Projectiles/Magic/ApothJaws.png deleted file mode 100644 index 84d2046947..0000000000 Binary files a/Projectiles/Magic/ApothJaws.png and /dev/null differ diff --git a/Projectiles/Magic/ApothMark.cs b/Projectiles/Magic/ApothMark.cs deleted file mode 100644 index 31dc4a1dfb..0000000000 --- a/Projectiles/Magic/ApothMark.cs +++ /dev/null @@ -1,73 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using System; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class ApothMark : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Jaws of Annihilation"); - } - - public override void SetDefaults() - { - projectile.width = 123; - projectile.height = 105; - projectile.alpha = 70; - projectile.timeLeft = 240; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - projectile.friendly = true; - projectile.magic = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.light = 1.5f; - } - - public override void AI() - { - if (projectile.timeLeft < 30) - projectile.alpha = projectile.alpha + 6; - else if (projectile.timeLeft < 210) - { - projectile.velocity.X *= 0.9f; - projectile.velocity.Y *= 0.9f; - } - else if (projectile.timeLeft == 240) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - double offsetHyp = Math.Sqrt(48 * 48 + 38 * 38); - double offsetRotation = Math.Atan2(-38, 48) + (double)projectile.rotation; - double offsetX = offsetHyp * Math.Cos(offsetRotation); - double offsetY = offsetHyp * Math.Sin(offsetRotation); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X + (float)offsetX, projectile.Center.Y + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.rotation, 0f); - } - offsetRotation = Math.Atan2(38, 48) + (double)projectile.rotation; - offsetX = offsetHyp * Math.Cos(offsetRotation); - offsetY = offsetHyp * Math.Sin(offsetRotation); - - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.position.X + projectile.width / 2 + (float)offsetX, projectile.position.Y + projectile.height / 2 + (float)offsetY, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, projectile.rotation, 1f); - } - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 600, true); - target.AddBuff(ModContent.BuffType(), 600, true); - target.AddBuff(ModContent.BuffType(), 600, true); - if (Main.rand.NextBool(30)) - { - target.AddBuff(ModContent.BuffType(), 120, true); - } - } - } -} diff --git a/Projectiles/Magic/ApothMark.png b/Projectiles/Magic/ApothMark.png deleted file mode 100644 index 41f8b01b7a..0000000000 Binary files a/Projectiles/Magic/ApothMark.png and /dev/null differ diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs new file mode 100644 index 0000000000..0b27b1b7fe --- /dev/null +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -0,0 +1,100 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class ApotheosisEnergy : ModProjectile + { + internal PrimitiveTrail TrailDrawer = null; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Apotheosis Energy"); + 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; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.Cyan.ToVector3() * projectile.Opacity); + + // Fade-effects. + if (projectile.timeLeft < 40f) + projectile.Opacity = Utils.InverseLerp(0f, 40f, projectile.timeLeft, true); + else + projectile.alpha = Utils.Clamp(projectile.alpha - 30, 0, 255); + + NPC potentialTarget = projectile.Center.ClosestNPCAt(5900f); + if (potentialTarget != null) + { + 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(); + } + } + + internal Color ColorFunction(float completionRatio) + { + Color baseColor = Color.Cyan; + if (completionRatio > 0.66f) + baseColor = Color.Lerp(baseColor, Color.Fuchsia, (completionRatio - 0.66f) / 0.33f); + else + { + float whiteFade = (float)Math.Sin(Utils.InverseLerp(0.0f, 0.2f, completionRatio, true) * MathHelper.Pi + Main.GlobalTime * 3f) * 0.45f; + baseColor = Color.Lerp(baseColor, Color.White, whiteFade); + } + + Color colorToUse = baseColor; + if (completionRatio > 0.5f) + colorToUse = Color.Lerp(baseColor, Color.Transparent, 1f - completionRatio / 0.5f); + return colorToUse * projectile.Opacity; + } + + internal float WidthFunction(float completionRatio) + { + float width; + float maxWidthOutwardness = 6f; + if (completionRatio < 0.2f) + 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; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + for (int i = 0; i < projectile.oldPos.Length; i++) + { + if (Collision.CheckAABBvAABBCollision(projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + return true; + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction); + + TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f - Main.screenPosition, 85); + return false; + } + } +} diff --git a/Projectiles/Magic/Ancient2.png b/Projectiles/Magic/ApotheosisEnergy.png similarity index 100% rename from Projectiles/Magic/Ancient2.png rename to Projectiles/Magic/ApotheosisEnergy.png diff --git a/Projectiles/Magic/ApotheosisJaw.png b/Projectiles/Magic/ApotheosisJaw.png new file mode 100644 index 0000000000..ccf7b18279 Binary files /dev/null and b/Projectiles/Magic/ApotheosisJaw.png differ diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs new file mode 100644 index 0000000000..dd7c1fa2ec --- /dev/null +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -0,0 +1,363 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ApotheosisWorm : ModProjectile + { + internal class Segment + { + // Doing a typical byte seems to cause the thing to flicker when doing super fast fades. + // This is most likely due to under/overflows. + internal short Alpha; + internal float Rotation; + internal Vector2 Center; + internal void WriteTo(BinaryWriter writer) + { + writer.Write(Alpha); + writer.Write(Rotation); + writer.WritePackedVector2(Center); + } + + internal void ReadFrom(BinaryReader reader) + { + Alpha = reader.ReadInt16(); + Rotation = reader.ReadSingle(); + Center = reader.ReadPackedVector2(); + } + + internal Segment(byte alpha, float rotation, Vector2 center) + { + Alpha = alpha; + Rotation = rotation; + Center = center; + } + } + + 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]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + } + + 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; + } + + // Be VERY careful with the projectile's netcode, and use syncs very sparingly. + // Syncing will use a lot more bytes than usual. + + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < Segments.Length; i++) + { + Segments[i].WriteTo(writer); + } + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + for (int i = 0; i < Segments.Length; i++) + { + Segments[i].ReadFrom(reader); + } + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + // Initialization. + if (projectile.localAI[0] == 0f) + { + PortalPosition = projectile.Center + projectile.velocity * 7f; + if (Main.myPlayer == projectile.owner) + InitializeSegments(); + projectile.localAI[0] = 1f; + } + + // Head fade-in effects. + 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); + + // Update all segments of the devourer every frame. + for (int i = 0; i < Segments.Length; i++) + UpdateSegment(i); + + Time++; + + // Reset the jaw's rotation slowly over time. + JawRotation = MathHelper.Lerp(JawRotation, 0f, 0.08f); + + 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; + for (int i = 0; i < Segments.Length; i++) + { + Segments[i] = new Segment(255, projectile.rotation, projectile.Center + directionToMouse / Segments.Length * i * 900f); + } + 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; + Vector2 offsetToAheadSegment = aheadSegmentCenter - Segments[segmentIndex].Center; + + // Individual segment fade effects depending on time. + if (projectile.timeLeft <= 60) + { + 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; + if (Segments[segmentIndex].Alpha > 255) + Segments[segmentIndex].Alpha = 255; + } + } + + if (Time <= 90f) + { + int visibleSegmentIndex = (int)MathHelper.Lerp(0f, Segments.Length, Utils.InverseLerp(15f, 70f, Time, true)); + if (segmentIndex < visibleSegmentIndex) + { + Segments[segmentIndex].Alpha -= 17; + if (Segments[segmentIndex].Alpha < 0) + Segments[segmentIndex].Alpha = 0; + } + } + + // This variant of segment attachment incorporates rotation. + // 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 and mechworm use for their segmenting. + if (aheadSegmentRotation != Segments[segmentIndex].Rotation) + { + float offsetAngle = MathHelper.WrapAngle(aheadSegmentRotation - Segments[segmentIndex].Rotation); + offsetToAheadSegment = offsetToAheadSegment.RotatedBy(offsetAngle * 0.075f); + } + Segments[segmentIndex].Rotation = offsetToAheadSegment.ToRotation() + MathHelper.PiOver2; + if (offsetToAheadSegment != Vector2.Zero) + Segments[segmentIndex].Center = aheadSegmentCenter - offsetToAheadSegment.SafeNormalize(Vector2.Zero) * 70f; + } + + internal void AttackTarget(NPC target) + { + if (Time >= 40f && projectile.alpha == 0 && Main.rand.NextBool(8)) + { + 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); + } + + if (Main.rand.NextBool(10)) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), projectile.Center); + } + + float idealFlyAcceleration = 0.18f; + + Vector2 destination = target.Center; + float distanceFromDestination = projectile.Distance(destination); + + // Get a swerve effect if somewhat far from the target. + if (projectile.Distance(destination) > 725f) + { + destination += (Time % 30f / 30f * MathHelper.TwoPi).ToRotationVector2() * 145f; + distanceFromDestination = projectile.Distance(destination); + idealFlyAcceleration *= 2.5f; + } + + // Charge if the target is far away. + if (distanceFromDestination > 1500f && Time > 45f) + idealFlyAcceleration = MathHelper.Min(6f, FlyAcceleration + 1f); + + FlyAcceleration = MathHelper.Lerp(FlyAcceleration, idealFlyAcceleration, 0.3f); + + 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(); + if (speed < 23f) + speed += 0.08f; + + if (speed > 32f) + speed -= 0.08f; + + // Go faster if the line of sight is aiming closely at the target. + if (directionToTargetOrthogonality < 0.85f && directionToTargetOrthogonality > 0.5f) + speed += 6f; + + // And go slower otherwise so that the devourer can angle towards the target more accurately. + if (directionToTargetOrthogonality < 0.5f && directionToTargetOrthogonality > -0.7f) + speed -= 10f; + + speed = MathHelper.Clamp(speed, 16f, 34f); + + projectile.velocity = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), FlyAcceleration).ToRotationVector2() * speed; + } + + // Open jaws when near the target, and snap when really close. + if (distanceFromDestination < 200f) + JawRotation = MathHelper.Lerp(JawRotation, MathHelper.ToRadians(-34f), 0.4f); + else if (distanceFromDestination < 480f) + JawRotation = MathHelper.Lerp(JawRotation, MathHelper.ToRadians(15f), 0.24f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600, true); + target.AddBuff(ModContent.BuffType(), 600, true); + target.AddBuff(ModContent.BuffType(), 600, true); + if (Main.rand.NextBool(30)) + { + target.AddBuff(ModContent.BuffType(), 120, true); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + 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 jawTexture = ModContent.GetTexture("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"); + + // Not white to differentiate itself slightly from regular DoG when fighting Boss Rush. + Color baseColor = Color.Lerp(Color.White, Color.Fuchsia, 0.15f); + + for (int i = 0; i < Segments.Length; i++) + { + 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); + } + + // Jaw drawing. + for (int i = -1; i <= 1; i += 2) + { + float jawBaseOffset = 42f; + SpriteEffects jawSpriteEffect = SpriteEffects.None; + if (i == 1) + jawSpriteEffect |= SpriteEffects.FlipHorizontally; + + // 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); + + 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. + // This is extremely similar to the portal created when DoG teleports. + if (Time < 60f) + { + 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"); + Vector2 drawPos = PortalPosition - Main.screenPosition; + baseColor = new Color(150, 100, 255, 255) * projectile.Opacity; + baseColor *= 0.5f; + baseColor.A = 0; + Color colorA = baseColor; + Color colorB = baseColor * 0.5f; + colorA *= currentFade; + colorB *= currentFade; + Vector2 origin = texture.Size() / 2f; + 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); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2, origin, scale * 0.8f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, 0f, origin, scale * 0.8f, SpriteEffects.None, 0); + + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2 + Main.GlobalTime * 3f * 0.25f, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, Main.GlobalTime * 3f * 0.25f, origin, scale, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2 + Main.GlobalTime * 3f * 0.5f, origin, scale * 0.8f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, Main.GlobalTime * 3f * 0.5f, origin, scale * 0.8f, SpriteEffects.None, 0); + + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4, origin, scale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f, origin, scale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4, origin, scale * 0.4f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f, origin, scale * 0.4f, SpriteEffects.None, 0); + + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 + Main.GlobalTime * 3f * 0.75f, origin, scale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f + Main.GlobalTime * 3f * 0.75f, origin, scale * 0.6f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 + Main.GlobalTime * 3f, origin, scale * 0.4f, SpriteEffects.None, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f + Main.GlobalTime * 3f, origin, scale * 0.4f, SpriteEffects.None, 0); + + } + + // Head drawing. + 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())) + return true; + + for (int i = 0; i < Segments.Length; i++) + { + if (Collision.CheckAABBvAABBCollision(Segments[i].Center - projHitbox.Size() * 0.5f, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + return true; + } + return false; + } + } +} diff --git a/Projectiles/Magic/ApotheosisWorm.png b/Projectiles/Magic/ApotheosisWorm.png new file mode 100644 index 0000000000..31edfc75c7 Binary files /dev/null and b/Projectiles/Magic/ApotheosisWorm.png differ diff --git a/Projectiles/Magic/AquamarineBolt.cs b/Projectiles/Magic/AquamarineBolt.cs index e683df01cd..99fb0719c4 100644 --- a/Projectiles/Magic/AquamarineBolt.cs +++ b/Projectiles/Magic/AquamarineBolt.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 06f1f6b190..74d002bafa 100644 --- a/Projectiles/Magic/ArcticBearPawProj.cs +++ b/Projectiles/Magic/ArcticBearPawProj.cs @@ -10,8 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetDefaults() { - projectile.width = 44; - projectile.height = 44; + projectile.width = projectile.height = 40; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; projectile.friendly = true; diff --git a/Projectiles/Magic/ArcticBearPawProj.png b/Projectiles/Magic/ArcticBearPawProj.png index d2c9c04e1c..9214ad4c8e 100644 Binary files a/Projectiles/Magic/ArcticBearPawProj.png and b/Projectiles/Magic/ArcticBearPawProj.png differ diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 9b9b6d8fae..19ae131992 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 d57eabad06..794b527a62 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Magic default: break; } - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Magic/AstralCrystal.cs b/Projectiles/Magic/AstralCrystal.cs index 9f2b8e3ce2..2f6502238c 100644 --- a/Projectiles/Magic/AstralCrystal.cs +++ b/Projectiles/Magic/AstralCrystal.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Magic { public class AstralCrystal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/AstralFlame"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal"); @@ -67,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/AstralCrystal.png b/Projectiles/Magic/AstralCrystal.png deleted file mode 100644 index e143f3f1a5..0000000000 Binary files a/Projectiles/Magic/AstralCrystal.png and /dev/null differ diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs index 4ed5b81000..3e6fefb159 100644 --- a/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs +++ b/Projectiles/Magic/AstralCrystalInvisibleExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class AstralCrystalInvisibleExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.width = 20; diff --git a/Projectiles/Magic/AstralCrystalInvisibleExplosion.png b/Projectiles/Magic/AstralCrystalInvisibleExplosion.png deleted file mode 100644 index f87b15108f..0000000000 Binary files a/Projectiles/Magic/AstralCrystalInvisibleExplosion.png and /dev/null differ diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index 6d1f5337c2..bf44d3c778 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Magic { public class AstralStarMagic : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Typeless/AstralStar"; + private int noTileHitCounter = 120; public override void SetStaticDefaults() @@ -29,7 +31,8 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 50; projectile.penetrate = 1; projectile.tileCollide = false; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -97,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/AstralStarMagic.png b/Projectiles/Magic/AstralStarMagic.png deleted file mode 100644 index dd1ff7e882..0000000000 Binary files a/Projectiles/Magic/AstralStarMagic.png and /dev/null differ diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index 332e5899c2..d8e3d983e0 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.penetrate = 1; projectile.magic = true; - projectile.tileCollide = true; projectile.timeLeft = 240; } @@ -35,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation = projectile.velocity.ToRotation(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 250f, 13f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 25f); } public override void Kill(int timeLeft) @@ -55,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 8702e8bb35..417aab221b 100644 --- a/Projectiles/Magic/AtlantisSpear.cs +++ b/Projectiles/Magic/AtlantisSpear.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.magic = true; + projectile.ignoreWater = true; + projectile.magic = true; aiType = ProjectileID.CrystalVileShardHead; } diff --git a/Projectiles/Magic/AtlantisSpear2.cs b/Projectiles/Magic/AtlantisSpear2.cs index 1939696977..7db196bcd0 100644 --- a/Projectiles/Magic/AtlantisSpear2.cs +++ b/Projectiles/Magic/AtlantisSpear2.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.magic = true; + projectile.ignoreWater = true; + projectile.magic = true; aiType = ProjectileID.CrystalVileShardShaft; } diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index 38887a0bda..74852ff6a9 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class AuroraAustralis : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private static float CosFrequency = 0.05f; private static float CosAmplitude = 0.008f; public int[] dustTypes = new int[] @@ -28,6 +30,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.timeLeft = 300; projectile.magic = true; projectile.alpha = 255; diff --git a/Projectiles/Magic/AuroraAustralis.png b/Projectiles/Magic/AuroraAustralis.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Magic/AuroraAustralis.png and /dev/null differ diff --git a/Projectiles/Magic/BeamStar.cs b/Projectiles/Magic/BeamStar.cs new file mode 100644 index 0000000000..08746a6162 --- /dev/null +++ b/Projectiles/Magic/BeamStar.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class BeamStar : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() + { + Time++; + + if (Time < 45f) + projectile.velocity = projectile.velocity.RotatedBy((projectile.identity % 4 - 2) / 2f * 0.016f) * 1.004f; + else + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(800f, false); + if (potentialTarget != null) + { + 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); + } + } + + 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; + 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; + stardust.scale += Main.rand.NextFloat(0.3f, 1.1f); + stardust.noGravity = true; + stardust.velocity *= 0.1f; + } + } + + 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++) + { + 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); + return false; + } + + public override void Kill(int timeLeft) + { + 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); + } + } + } +} diff --git a/Projectiles/Magic/BeamStar.png b/Projectiles/Magic/BeamStar.png new file mode 100644 index 0000000000..741535f961 Binary files /dev/null and b/Projectiles/Magic/BeamStar.png differ diff --git a/Projectiles/Magic/BeamingBolt2.cs b/Projectiles/Magic/BeamingBolt2.cs index f5a6d529da..c5fd72da18 100644 --- a/Projectiles/Magic/BeamingBolt2.cs +++ b/Projectiles/Magic/BeamingBolt2.cs @@ -17,13 +17,14 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 14; projectile.height = 14; projectile.friendly = true; - projectile.alpha = 0; projectile.timeLeft = 120; projectile.penetrate = 1; projectile.magic = true; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + 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) @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)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, @@ -44,7 +45,8 @@ namespace CalamityMod.Projectiles.Magic }); Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, randomDust, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); + if (projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/BeastScythe.cs b/Projectiles/Magic/BeastScythe.cs index f35e05d828..7e41d059b2 100644 --- a/Projectiles/Magic/BeastScythe.cs +++ b/Projectiles/Magic/BeastScythe.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Magic { projectile.velocity *= 1.001f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } } @@ -148,7 +148,7 @@ namespace CalamityMod.Projectiles.Magic } else { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 300); } } @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 5aa7d47319..b1db3361d6 100644 --- a/Projectiles/Magic/BigBeamofDeath.cs +++ b/Projectiles/Magic/BigBeamofDeath.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class BigBeamofDeath : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Big Beam of Death"); @@ -17,8 +19,8 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.magic = true; projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 100; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 100; projectile.penetrate = -1; projectile.extraUpdates = 100; projectile.timeLeft = 80; diff --git a/Projectiles/Magic/BigBeamofDeath.png b/Projectiles/Magic/BigBeamofDeath.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Magic/BigBeamofDeath.png and /dev/null differ diff --git a/Projectiles/Magic/BigBeamofDeath2.cs b/Projectiles/Magic/BigBeamofDeath2.cs index 6eef268817..846979c023 100644 --- a/Projectiles/Magic/BigBeamofDeath2.cs +++ b/Projectiles/Magic/BigBeamofDeath2.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class BigBeamofDeath2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Big Beam of Death"); @@ -17,24 +19,20 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.magic = true; projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 100; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 100; projectile.penetrate = -1; projectile.extraUpdates = 100; projectile.timeLeft = 80; } - public override void AI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - 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; - } + public override void AI() + { + 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.png b/Projectiles/Magic/BigBeamofDeath2.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Magic/BigBeamofDeath2.png and /dev/null differ diff --git a/Projectiles/Magic/BlindingLight.cs b/Projectiles/Magic/BlindingLight.cs index 1e1581e782..ea00fb0e3f 100644 --- a/Projectiles/Magic/BlindingLight.cs +++ b/Projectiles/Magic/BlindingLight.cs @@ -8,9 +8,11 @@ namespace CalamityMod.Projectiles.Magic { public class BlindingLight : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const float Radius = 1400f; private const int Lifetime = 45; - + public override void SetStaticDefaults() { DisplayName.SetDefault("Blinding Light"); @@ -60,17 +62,20 @@ namespace CalamityMod.Projectiles.Magic 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 (projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. + if (Main.netMode != NetmodeID.Server && projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. { - if (Main.netMode != NetmodeID.Server && !Filters.Scene["CalamityMod:LightBurst"].IsActive()) - { + if (!Filters.Scene["CalamityMod:LightBurst"].IsActive()) Filters.Scene.Activate("CalamityMod:LightBurst", projectile.Center).GetShader().UseTargetPosition(projectile.Center).UseProgress(0f); - } + Filters.Scene["CalamityMod:LightBurst"].GetShader().UseProgress(progress); } } - public override void Kill(int timeLeft) => Filters.Scene.Deactivate("CalamityMod:LightBurst"); + public override void Kill(int timeLeft) + { + if (Main.netMode != NetmodeID.Server) + Filters.Scene.Deactivate("CalamityMod:LightBurst"); + } private void ConsumeNearbyBlades() { @@ -94,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic private void DivideDamageAmongstTargets() { int numTargets = 0; - for(int i = 0; i < Main.maxNPCs; ++i) + for (int i = 0; i < Main.maxNPCs; ++i) { NPC npc = Main.npc[i]; if (npc is null || !npc.active || npc.friendly || npc.dontTakeDamage || npc.immortal) diff --git a/Projectiles/Magic/BlindingLight.png b/Projectiles/Magic/BlindingLight.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Magic/BlindingLight.png and /dev/null differ diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 9d1e71845d..ac8f88ce03 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class BloodBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Magic/BloodBlast.png b/Projectiles/Magic/BloodBlast.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Magic/BloodBlast.png and /dev/null differ diff --git a/Projectiles/Magic/BloodBolt.cs b/Projectiles/Magic/BloodBolt.cs deleted file mode 100644 index ff515b4f02..0000000000 --- a/Projectiles/Magic/BloodBolt.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BloodBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } - } - } -} diff --git a/Projectiles/Magic/BloodBolt.png b/Projectiles/Magic/BloodBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/BloodBolt.png and /dev/null differ diff --git a/Projectiles/Magic/BloodOrb.cs b/Projectiles/Magic/BloodOrb.cs deleted file mode 100644 index 356ae37894..0000000000 --- a/Projectiles/Magic/BloodOrb.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class BloodOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blood Orb"); - } - - 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; - } - - public override void AI() - { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); - } - } -} diff --git a/Projectiles/Magic/BloodOrb.png b/Projectiles/Magic/BloodOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/BloodOrb.png and /dev/null differ diff --git a/Projectiles/Magic/BloodRay.cs b/Projectiles/Magic/BloodRay.cs index 45cc4ba436..e287b7f77c 100644 --- a/Projectiles/Magic/BloodRay.cs +++ b/Projectiles/Magic/BloodRay.cs @@ -1,11 +1,18 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class BloodRay : ModProjectile { + public const int Lifetime = 150; + public const float MaxExponentialDamageBoost = 4f; + 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 override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Ray"); @@ -17,31 +24,36 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; + projectile.ignoreWater = true; + projectile.penetrate = 10; projectile.extraUpdates = 100; - projectile.timeLeft = 150; + projectile.timeLeft = Lifetime; } public override void AI() { - 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.6), projectile.knockBack, projectile.owner, 0f, 0f); - } + // Just doing damage = (int)(damage * scalar) wouldn't work here. + // The exponential base would be too small for a weapon like this, and the + // cast (which removes the fractional part) would overtake any increases before the damage can rise. + if (InitialDamage == 0f) + { + InitialDamage = projectile.damage; + projectile.netUpdate = true; + } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Time++; + projectile.damage = (int)(InitialDamage * Math.Pow(ExponentialDamageBoost, Time)); + + if (Time >= 12f) { - for (int num447 = 0; num447 < 2; num447++) + for (int i = 0; i < 2; i++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + int dustType = Main.rand.NextBool(4) ? 182 : (int)CalamityDusts.Brimstone; + 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; + crimtameMagic.velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/BloodRay.png b/Projectiles/Magic/BloodRay.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/BloodRay.png and /dev/null differ diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index b5cd85edb6..8e62069c6d 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -22,41 +22,35 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.ignoreWater = true; projectile.magic = true; - } + projectile.timeLeft = 120; + } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + + public override void AI() { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; - if (projectile.localAI[0] == 0f) - { - projectile.scale += 0.005f; - } + projectile.velocity *= 0.99f; + + projectile.scale += 0.005f; + 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(); float num744 = v2.ToRotation(); - double num745 = (double)(num744 - num743); - if (num745 > 3.1415926535897931) - { - num745 -= 6.2831853071795862; - } - if (num745 < -3.1415926535897931) - { - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.myPlayer == projectile.owner && projectile.timeLeft > 120) - { - projectile.timeLeft = 120; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 150f, 8f, 20f); + double num745 = num744 - num743; + if (num745 > MathHelper.Pi) + num745 -= MathHelper.TwoPi; + if (num745 < -MathHelper.Pi) + num745 += MathHelper.TwoPi; + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + + if (projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 400f, 8f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/BlushieStaffProj.cs b/Projectiles/Magic/BlushieStaffProj.cs index 5fdfd3d307..4584a1e29a 100644 --- a/Projectiles/Magic/BlushieStaffProj.cs +++ b/Projectiles/Magic/BlushieStaffProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class BlushieStaffProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int xRange = 600; private const int yRange = 320; @@ -24,7 +26,9 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.ignoreWater = true; projectile.magic = true; - } + projectile.Calamity().PierceResistHarshness = 0.06f; + projectile.Calamity().PierceResistCap = 0.4f; + } public override void AI() { @@ -42,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic player.itemAnimation = 2; projectile.ai[0] += 1f; - projectile.damage = (int)((projectile.ai[0] - 120f) * 4.5f); + projectile.damage = (int)(projectile.ai[0] - 120f); // Max damage = 3480 if (projectile.damage >= 100 && Main.myPlayer == projectile.owner) { if (player.statMana <= 0 && player.manaFlower) diff --git a/Projectiles/Magic/BlushieStaffProj.png b/Projectiles/Magic/BlushieStaffProj.png deleted file mode 100644 index c6616b4227..0000000000 Binary files a/Projectiles/Magic/BlushieStaffProj.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneBeam.cs b/Projectiles/Magic/BrimstoneBeam.cs index af28d92c43..6a2f24ef45 100644 --- a/Projectiles/Magic/BrimstoneBeam.cs +++ b/Projectiles/Magic/BrimstoneBeam.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -36,34 +38,21 @@ namespace CalamityMod.Projectiles.Magic } } - public override void AI() - { - if (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) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - 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; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 9f) + { + 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; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/BrimstoneBeam.png b/Projectiles/Magic/BrimstoneBeam.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Magic/BrimstoneBeam.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneBeam2.cs b/Projectiles/Magic/BrimstoneBeam2.cs index 3abfde2659..535a84f19e 100644 --- a/Projectiles/Magic/BrimstoneBeam2.cs +++ b/Projectiles/Magic/BrimstoneBeam2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -36,34 +38,17 @@ namespace CalamityMod.Projectiles.Magic } } - public override void AI() - { - if (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) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - 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; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } + public override void AI() + { + 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; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/BrimstoneBeam2.png b/Projectiles/Magic/BrimstoneBeam2.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Magic/BrimstoneBeam2.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneBeam3.cs b/Projectiles/Magic/BrimstoneBeam3.cs index bd9aa8ddd4..9fb0419746 100644 --- a/Projectiles/Magic/BrimstoneBeam3.cs +++ b/Projectiles/Magic/BrimstoneBeam3.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam3 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -36,34 +38,17 @@ namespace CalamityMod.Projectiles.Magic } } - public override void AI() - { - if (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) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - 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; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } + public override void AI() + { + 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; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/BrimstoneBeam3.png b/Projectiles/Magic/BrimstoneBeam3.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Magic/BrimstoneBeam3.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneBeam4.cs b/Projectiles/Magic/BrimstoneBeam4.cs index a81fe645c5..844fc123c3 100644 --- a/Projectiles/Magic/BrimstoneBeam4.cs +++ b/Projectiles/Magic/BrimstoneBeam4.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam4 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -36,34 +38,17 @@ namespace CalamityMod.Projectiles.Magic } } - public override void AI() - { - if (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) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - 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; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } + public override void AI() + { + 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; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/BrimstoneBeam4.png b/Projectiles/Magic/BrimstoneBeam4.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Magic/BrimstoneBeam4.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneBeam5.cs b/Projectiles/Magic/BrimstoneBeam5.cs index f91b48980e..b6d4bb5db7 100644 --- a/Projectiles/Magic/BrimstoneBeam5.cs +++ b/Projectiles/Magic/BrimstoneBeam5.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneBeam5 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -22,34 +24,17 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 30; } - public override void AI() - { - if (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) - { - projectile.position.Y = projectile.position.Y + projectile.velocity.Y; - projectile.velocity.Y = -projectile.velocity.Y; - } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 1; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - 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; - Main.dust[num448].velocity *= 0.1f; - Main.dust[num448].noGravity = true; - } - } - } + public override void AI() + { + 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; + Main.dust[num448].velocity *= 0.1f; + Main.dust[num448].noGravity = true; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/BrimstoneBeam5.png b/Projectiles/Magic/BrimstoneBeam5.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Magic/BrimstoneBeam5.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneFireball.cs b/Projectiles/Magic/BrimstoneFireball.cs index 108b2259c1..61eab1f49a 100644 --- a/Projectiles/Magic/BrimstoneFireball.cs +++ b/Projectiles/Magic/BrimstoneFireball.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index 7c434089d7..d40e30fc45 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneHellfireballFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellfireball"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hellfire"); @@ -83,7 +85,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.png b/Projectiles/Magic/BrimstoneHellfireballFriendly.png deleted file mode 100644 index 71720f8c11..0000000000 Binary files a/Projectiles/Magic/BrimstoneHellfireballFriendly.png and /dev/null differ diff --git a/Projectiles/Magic/BrimstoneHomer.cs b/Projectiles/Magic/BrimstoneHomer.cs index 6adb605ff9..22f7fd7817 100644 --- a/Projectiles/Magic/BrimstoneHomer.cs +++ b/Projectiles/Magic/BrimstoneHomer.cs @@ -24,14 +24,17 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 180; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { 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); Main.dust[brimstone].noGravity = true; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 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 02c463fd8f..03dc2a9721 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class BrimstoneTentacle : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tentacle"); diff --git a/Projectiles/Magic/BrimstoneTentacle.png b/Projectiles/Magic/BrimstoneTentacle.png deleted file mode 100644 index 84f7b0870b..0000000000 Binary files a/Projectiles/Magic/BrimstoneTentacle.png and /dev/null differ diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index aa14130c26..4b81df408c 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/Climax2.cs index 1eedb8acfa..8832edf931 100644 --- a/Projectiles/Magic/Climax2.cs +++ b/Projectiles/Magic/Climax2.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 38; projectile.height = 38; projectile.friendly = true; - projectile.light = 0.5f; + projectile.ignoreWater = true; + projectile.light = 0.5f; projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 420; @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 8f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Climax2.png b/Projectiles/Magic/Climax2.png index 09d7a242e3..a57b8947ca 100644 Binary files a/Projectiles/Magic/Climax2.png and b/Projectiles/Magic/Climax2.png differ diff --git a/Projectiles/Magic/ClimaxBeam.cs b/Projectiles/Magic/ClimaxBeam.cs index 12b872eb5f..61bf9854be 100644 --- a/Projectiles/Magic/ClimaxBeam.cs +++ b/Projectiles/Magic/ClimaxBeam.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class ClimaxBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.timeLeft = 90; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/ClimaxBeam.png b/Projectiles/Magic/ClimaxBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/ClimaxBeam.png and /dev/null differ diff --git a/Projectiles/Magic/ClimaxProj.cs b/Projectiles/Magic/ClimaxProj.cs index fc81a69681..58a5ab7cac 100644 --- a/Projectiles/Magic/ClimaxProj.cs +++ b/Projectiles/Magic/ClimaxProj.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 150; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -49,8 +50,8 @@ namespace CalamityMod.Projectiles.Magic } } - if (projectile.timeLeft % 2 == projectile.ai[0]) - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); + if (projectile.timeLeft % 4 == projectile.ai[0]) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/ClimaxProj.png b/Projectiles/Magic/ClimaxProj.png index 09d7a242e3..a57b8947ca 100644 Binary files a/Projectiles/Magic/ClimaxProj.png and b/Projectiles/Magic/ClimaxProj.png differ diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 3cd1698c27..3e75501fcc 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class CosmicTentacle : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tentacle"); diff --git a/Projectiles/Magic/CosmicTentacle.png b/Projectiles/Magic/CosmicTentacle.png deleted file mode 100644 index 84f7b0870b..0000000000 Binary files a/Projectiles/Magic/CosmicTentacle.png and /dev/null differ diff --git a/Projectiles/Magic/Crescent.cs b/Projectiles/Magic/Crescent.cs index bbf98cea75..5205767607 100644 --- a/Projectiles/Magic/Crescent.cs +++ b/Projectiles/Magic/Crescent.cs @@ -38,7 +38,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Projectile parent = Main.projectile[(int)projectile.ai[0]]; - if (!parent.active) projectile.Kill(); + if (!parent.active) + projectile.Kill(); projectile.rotation += 0.7f; @@ -46,8 +47,9 @@ namespace CalamityMod.Projectiles.Magic if (projectile.ai[1] > 20) { - projectile.velocity += projectile.DirectionTo(parent.Center) * 2.5f; - if (projectile.Distance(parent.Center) < 75f) projectile.active = false; + 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 57f618517b..e217cfe783 100644 --- a/Projectiles/Magic/CryoBlast.cs +++ b/Projectiles/Magic/CryoBlast.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,12 +8,12 @@ namespace CalamityMod.Projectiles.Magic { public class CryoBlast : ModProjectile { - public override void SetStaticDefaults() + private const float Spread = 0.15f; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -22,41 +21,50 @@ namespace CalamityMod.Projectiles.Magic projectile.width = projectile.height = 35; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 4; - projectile.timeLeft = 600; + projectile.penetrate = 3; + projectile.timeLeft = 90; projectile.coldDamage = true; + projectile.ignoreWater = true; + projectile.alpha = 255; } public override void AI() { - if (projectile.scale <= 3.6f) + if (projectile.scale <= 2.5f) { - projectile.scale *= 1.01f; - projectile.position = projectile.Center; - projectile.width = (int)(35f * projectile.scale); - projectile.height = (int)(35f * projectile.scale); - projectile.Center = projectile.position; + projectile.scale *= 1.02f; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(35f * projectile.scale)); } + else if (projectile.ai[0] < 2f) + { + projectile.ai[0] += 1f; - if (projectile.timeLeft < 53) - projectile.alpha += 5; + // 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.Kill(); + } projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - if (projectile.frameCounter++ % 4 == 3) + projectile.frameCounter++; + if (projectile.frameCounter > 4) { projectile.frame++; + projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) - { projectile.frame = 0; - } Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) + 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); Main.dust[ice].noGravity = true; @@ -67,18 +75,54 @@ namespace CalamityMod.Projectiles.Magic } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.timeLeft > 599) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if ((projectile.timeLeft > 596 && projectile.ai[0] == 0f) || (projectile.timeLeft > 599 && projectile.ai[0] > 0f)) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - 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; + 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) + spriteEffects = SpriteEffects.FlipHorizontally; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + 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); + 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); + Main.dust[index2].noGravity = true; + Main.dust[index2].velocity *= 1.5f; + } + if (projectile.owner == Main.myPlayer) + { + 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)); + while (shardVel.X == 0f && shardVel.Y == 0f) + { + shardVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + } + 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); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 360); } } diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index 2e634b91eb..19d4f71cf9 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Projectiles.Magic { public class DarkSparkBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/YharimsCrystalBeam"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -29,7 +31,9 @@ namespace CalamityMod.Projectiles.Magic 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) { @@ -44,88 +48,89 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Vector2? vector71 = null; + 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()) { projectile.Kill(); return; } - float num810 = (float)(int)projectile.ai[0] - 2.5f; + + 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 = num810 * 0.5235988f; + float num811; Vector2 value37 = Vector2.Zero; - float num812; //0 to 1 - float y; //6 to 20 - float num813; //1.75 to 20 - float scaleFactor6; //-22 to -2 + float num812; + float y; + float laserRotationSpeed; + float scaleFactor6; Color color = new Color(1, 1, 1, 127); projectile.Opacity = 1f; + if (projectile2.ai[0] < 720f) { - num812 = 0f + projectile2.ai[0] / 1440f; //0 to 0.5 + num812 = projectile2.ai[0] / 1440f; y = 6f + projectile2.ai[0] / 720f * 7f; if (projectile2.ai[0] > 360f) { int colorValue = (int)((0.01f + ((projectile2.ai[0] - 360f) / 360f * 2.55f)) * 100f); color = new Color(colorValue, colorValue, colorValue, 127); } + if (projectile2.ai[0] < 480f) - { - num813 = 1.75f/* + 4f * (projectile2.ai[0] / 120f)*/; //20 to 16 - } + laserRotationSpeed = 1.75f; else - { - num813 = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); //7.99 to 3.01 - } + laserRotationSpeed = 3f + 5f * ((projectile2.ai[0] - 480f) / 240f); + scaleFactor6 = -2f - projectile2.ai[0] / 720f * 5f; } else { float colorLimit = projectile2.ai[0] - 720f; if (colorLimit > 255f) - { colorLimit = 255f; - } + 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); //red + color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); break; case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange + color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); break; case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow + color = new Color(255, 255, 255 - (int)colorLimit, 127); break; case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green + color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); break; case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue + color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); break; case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo + color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); break; case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet + color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); break; } - num812 = 0.5f; //0f, inverted - num813 = 10.875f; //1.75f, inverted - y = 13f; //6f, inverted - scaleFactor6 = -7f; //-2, inverted + + num812 = 0.5f; + laserRotationSpeed = 10.875f; + y = 13f; + scaleFactor6 = -7f; } - float num814 = (projectile2.ai[0] + num810 * num813) / (num813 * 6f) * 6.28318548f; - num811 = Vector2.UnitY.RotatedBy((double)num814, default).Y * 0.5235988f * num812; - value37 = (Vector2.UnitY.RotatedBy((double)num814, default) * new Vector2(4f, y)).RotatedBy((double)projectile2.velocity.ToRotation(), default); + + 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((double)num811, default); + projectile.velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num811); projectile.scale = 1.5f * (1.5f - num812); // Takes 360 frames to reach normal damage @@ -135,47 +140,42 @@ namespace CalamityMod.Projectiles.Magic 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 (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) - { projectile.velocity = -Vector2.UnitY; - } + float num818 = projectile.velocity.ToRotation(); - projectile.rotation = num818 - 1.57079637f; + projectile.rotation = num818 - MathHelper.PiOver2; projectile.velocity = num818.ToRotationVector2(); + float num819 = 2f; float num820 = 0f; 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); 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) { - //color.A = 0; 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) * 1.57079637f; + 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((double)num844) * num845, (float)Math.Sin((double)num844) * num845); - int num846 = Dust.NewDust(vector80, 0, 0, 267, vector81.X, vector81.Y, 0, color, 3.3f); //267 + 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) @@ -193,33 +193,32 @@ namespace CalamityMod.Projectiles.Magic } Main.dust[num846].color = color; } + if (Main.rand.NextBool(5)) { - Vector2 value42 = projectile.velocity.RotatedBy(1.5707963705062866, default) * ((float)Main.rand.NextDouble() - 0.5f) * (float)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; Main.dust[num847].velocity.Y = -Math.Abs(Main.dust[num847].velocity.Y); } + DelegateMethods.v3_1 = color.ToVector3() * 0.3f; - float value43 = 0.1f * (float)Math.Sin((double)(Main.GlobalTime * 20f)); - Vector2 size = new Vector2(projectile.velocity.Length() * projectile.localAI[1], (float)projectile.width * projectile.scale); + 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(); if (Main.netMode != NetmodeID.Server) - { - ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy((double)num848, default), color, size, RippleShape.Square, num848); - } - Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); - return; + ((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)); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { 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]]; @@ -242,30 +241,30 @@ namespace CalamityMod.Projectiles.Magic 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); //red + color = new Color(255, 255 - (int)colorLimit, 255 - (int)colorLimit, 127); break; case 1: - color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); //orange + color = new Color(255, 255 - (int)(colorLimit * 0.3529412f), 255 - (int)colorLimit, 127); break; case 2: - color = new Color(255, 255, 255 - (int)colorLimit, 127); //yellow + color = new Color(255, 255, 255 - (int)colorLimit, 127); break; case 3: - color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); //green + color = new Color(255 - (int)colorLimit, 255 - (int)(colorLimit * 0.5f), 255 - (int)colorLimit, 127); break; case 4: - color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); //blue + color = new Color(255 - (int)colorLimit, 255 - (int)colorLimit, 255, 127); break; case 5: - color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); //indigo + color = new Color(255 - (int)(colorLimit * 0.7058824f), 255 - (int)colorLimit, 255 - (int)(colorLimit * 0.4901961), 127); break; case 6: - color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); //violet + color = new Color(255 - (int)(colorLimit * 0.0666667f), 255 - (int)(colorLimit * 0.4901961), 255 - (int)(colorLimit * 0.0666667f), 127); break; } } + Color value25 = color; - //value25.A = 0; Vector2 value26 = projectile.Center.Floor(); value26 += projectile.velocity * projectile.scale * 10.5f; num228 -= projectile.scale * 14.5f * projectile.scale; @@ -273,7 +272,7 @@ namespace CalamityMod.Projectiles.Magic DelegateMethods.f_1 = 1f; DelegateMethods.c_1 = value25 * 0.75f * projectile.Opacity; Vector2 projPos = projectile.oldPos[0]; - projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + 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)); @@ -284,20 +283,18 @@ namespace CalamityMod.Projectiles.Magic { 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)); + 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) { if (projHitbox.Intersects(targetHitbox)) - { 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)) - { return true; - } + return false; } } diff --git a/Projectiles/Magic/DarkSparkBeam.png b/Projectiles/Magic/DarkSparkBeam.png deleted file mode 100644 index 4bcb09bbf2..0000000000 Binary files a/Projectiles/Magic/DarkSparkBeam.png and /dev/null differ diff --git a/Projectiles/Magic/DarkSparkPrism.cs b/Projectiles/Magic/DarkSparkPrism.cs index b23e0c9d86..009b32ccca 100644 --- a/Projectiles/Magic/DarkSparkPrism.cs +++ b/Projectiles/Magic/DarkSparkPrism.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public class DarkSparkPrism : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Magic/DarkSpark"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal"); @@ -43,93 +45,87 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Player player = Main.player[projectile.owner]; + float num = 0f; if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + num = MathHelper.Pi; + + Vector2 vector = player.RotatedRelativePoint(player.MountedCenter); + float num26 = 30f; if (projectile.ai[0] > 360f) - { num26 = 15f; - } if (projectile.ai[0] > 480f) - { num26 = 5f; - } + projectile.damage = (int)(player.ActiveItem().damage * player.MagicDamage()); + projectile.ai[0] += 1f; projectile.ai[1] += 1f; + if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; projectile.localAI[1] = 255f; } + if (projectile.localAI[1] > 0f) - { projectile.localAI[1] -= 1f; - } + bool flag9 = false; if (projectile.ai[0] % num26 == 0f) - { flag9 = true; - } + int num27 = 10; bool flag10 = false; if (projectile.ai[0] % num26 == 0f) - { flag10 = true; - } + if (projectile.ai[1] >= 1f) { projectile.ai[1] = 0f; flag10 = true; + if (Main.myPlayer == projectile.owner) { float scaleFactor5 = player.ActiveItem().shootSpeed * projectile.scale; Vector2 value12 = vector; - Vector2 value13 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value12; + Vector2 value13 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - value12; if (player.gravDir == -1f) - { - value13.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value12.Y; - } + value13.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - value12.Y; + Vector2 vector11 = Vector2.Normalize(value13); 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 *= scaleFactor5; if (vector11.X != projectile.velocity.X || vector11.Y != projectile.velocity.Y) - { projectile.netUpdate = true; - } + projectile.velocity = vector11; } } + projectile.frameCounter++; int num28 = (projectile.ai[0] < 480f) ? 3 : 1; if (projectile.frameCounter >= num28) { projectile.frameCounter = 0; if (++projectile.frame >= 4) - { projectile.frame = 0; - } } if (projectile.soundDelay <= 0) { projectile.soundDelay = num27; projectile.soundDelay *= 2; if (projectile.ai[0] != 1f) - { Main.PlaySound(SoundID.Item15, projectile.position); - } } + if (flag10 && Main.myPlayer == projectile.owner) { - bool flag11 = !flag9 || player.CheckMana(player.ActiveItem().mana, true, false); + bool flag11 = !flag9 || player.CheckMana(player.ActiveItem(), -1, true, false); bool flag12 = player.channel && flag11 && !player.noItems && !player.CCed; if (flag12) { @@ -138,22 +134,19 @@ namespace CalamityMod.Projectiles.Magic 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; for (int l = 0; l < 7; l++) - { - Projectile.NewProjectile(center3.X, center3.Y, vector12.X, vector12.Y, ModContent.ProjectileType(), num29, projectile.knockBack, projectile.owner, (float)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; } } else - { projectile.Kill(); - } } + projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; projectile.rotation = projectile.velocity.ToRotation() + num; projectile.spriteDirection = projectile.direction; @@ -162,7 +155,7 @@ namespace CalamityMod.Projectiles.Magic 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(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Magic/DarkSparkPrism.png b/Projectiles/Magic/DarkSparkPrism.png deleted file mode 100644 index b082a2a1f4..0000000000 Binary files a/Projectiles/Magic/DarkSparkPrism.png and /dev/null differ diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs index d1182f6a79..635a963990 100644 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ b/Projectiles/Magic/DivineRetributionSpear.cs @@ -52,16 +52,12 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 600f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 9f, 20f); } else { @@ -74,7 +70,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -87,7 +83,7 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { projectile.position = projectile.Center; - projectile.width = projectile.height = 64; + 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; diff --git a/Projectiles/Magic/DustProjectile.cs b/Projectiles/Magic/DustProjectile.cs index 23cab8e791..17035c4fec 100644 --- a/Projectiles/Magic/DustProjectile.cs +++ b/Projectiles/Magic/DustProjectile.cs @@ -1,102 +1,97 @@ +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class DustProjectile : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Dust"); - } + public class DustProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dust"); + Main.projFrames[projectile.type] = 6; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + } - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 50; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.magic = true; - projectile.penetrate = -1; - projectile.extraUpdates = 3; - projectile.timeLeft = 160; - } + 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; + } - public override void AI() - { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.4f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - if (projectile.timeLeft > 60) + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.4f, 0.01f); + projectile.frameCounter++; + if (projectile.frameCounter > 6) { - projectile.timeLeft = 60; + projectile.frame++; + projectile.frameCounter = 0; } - if (projectile.ai[0] > 7f) + if (projectile.frame >= Main.projFrames[projectile.type]) { - float num296 = 1f; - if (projectile.ai[0] == 8f) - { - num296 = 0.25f; - } - else if (projectile.ai[0] == 9f) - { - num296 = 0.5f; - } - else if (projectile.ai[0] == 10f) - { - num296 = 0.75f; - } - 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); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 4f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 1.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } - 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); - if (Main.rand.NextBool(3)) - { - Main.dust[num299].noGravity = true; - Main.dust[num299].scale *= 5f; - Dust expr_DBEF_cp_0 = Main.dust[num299]; - expr_DBEF_cp_0.velocity.X *= 2f; - Dust expr_DC0F_cp_0 = Main.dust[num299]; - expr_DC0F_cp_0.velocity.Y *= 2f; - } - else - { - Main.dust[num299].scale *= 2.5f; - } - Dust expr_DC74_cp_0 = Main.dust[num299]; - expr_DC74_cp_0.velocity.X *= 1.2f; - Dust expr_DC94_cp_0 = Main.dust[num299]; - expr_DC94_cp_0.velocity.Y *= 1.2f; - Main.dust[num299].scale *= num296; - } + projectile.frame = 0; } - else - { - projectile.ai[0] += 1f; - } - projectile.rotation += 0.3f * (float)projectile.direction; - } - } + 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); + Dust dust = Main.dust[idx]; + if (Main.rand.NextBool(3)) + { + dust.noGravity = true; + dust.scale *= 2f; + dust.velocity.X *= 3f; + dust.velocity.Y *= 3f; + } + 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); + } + + 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); + + // Dust effects + 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) + { + 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; + float distToCenter = dustVelocity.Length(); + dustVelocity.Normalize(); + dustVelocity = dustVelocity.RotatedBy(MathHelper.ToRadians(-90f)); + dustVelocity *= distToCenter * 0.04f; + Main.dust[dustIndex].velocity = dustVelocity; + } + } + return false; + } + } } diff --git a/Projectiles/Magic/DustProjectile.png b/Projectiles/Magic/DustProjectile.png index 77e7330592..509937c4cd 100644 Binary files a/Projectiles/Magic/DustProjectile.png and b/Projectiles/Magic/DustProjectile.png differ diff --git a/Projectiles/Magic/EelDrop.cs b/Projectiles/Magic/EelDrop.cs index 343379a522..b19a8c78ff 100644 --- a/Projectiles/Magic/EelDrop.cs +++ b/Projectiles/Magic/EelDrop.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class EelDrop : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); @@ -26,10 +28,12 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = false; projectile.timeLeft = 240; } + public override void AI() { projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } + public override bool OnTileCollide(Vector2 oldVelocity) { // Water drip @@ -61,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Magic/EelDrop.png b/Projectiles/Magic/EelDrop.png deleted file mode 100644 index f5e4db998f..0000000000 Binary files a/Projectiles/Magic/EelDrop.png and /dev/null differ diff --git a/Projectiles/Magic/EidolicWailSoundwave.cs b/Projectiles/Magic/EidolicWailSoundwave.cs index f071e356a9..e5b0f97d40 100644 --- a/Projectiles/Magic/EidolicWailSoundwave.cs +++ b/Projectiles/Magic/EidolicWailSoundwave.cs @@ -27,12 +27,20 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 8; projectile.timeLeft = 450; - } + projectile.Calamity().PierceResistHarshness = 0.06f; + projectile.Calamity().PierceResistCap = 0.4f; + } public override void AI() { + if (projectile.ai[0] == 0f) + { + if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.02f; + } + if (projectile.localAI[0] < 1f) { projectile.localAI[0] += 0.005f; //200 to reach full size and max power @@ -63,14 +71,18 @@ namespace CalamityMod.Projectiles.Magic public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage = (int)((double)damage * (double)projectile.localAI[0]); + damage = (int)(damage * projectile.localAI[0]); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 600); - projectile.velocity *= 0.975f; - } + + if (projectile.velocity.Length() > 3f) + projectile.velocity *= 0.9f; + + projectile.ai[0] = 1f; + } public override Color? GetAlpha(Color lightColor) { @@ -85,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 d79d073875..c1aff61edd 100644 --- a/Projectiles/Magic/EldritchTentacle.cs +++ b/Projectiles/Magic/EldritchTentacle.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class EldritchTentacle : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tentacle"); diff --git a/Projectiles/Magic/EldritchTentacle.png b/Projectiles/Magic/EldritchTentacle.png deleted file mode 100644 index 84f7b0870b..0000000000 Binary files a/Projectiles/Magic/EldritchTentacle.png and /dev/null differ diff --git a/Projectiles/Magic/ElementBolt.cs b/Projectiles/Magic/ElementBolt.cs index e5c22c235f..7f88a1a055 100644 --- a/Projectiles/Magic/ElementBolt.cs +++ b/Projectiles/Magic/ElementBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class ElementBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.timeLeft = 30; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/ElementBolt.png b/Projectiles/Magic/ElementBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/ElementBolt.png and /dev/null differ diff --git a/Projectiles/Magic/ElementBolt2.cs b/Projectiles/Magic/ElementBolt2.cs index 9a155cdd78..85964c68ac 100644 --- a/Projectiles/Magic/ElementBolt2.cs +++ b/Projectiles/Magic/ElementBolt2.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class ElementBolt2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.timeLeft = 15; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/ElementBolt2.png b/Projectiles/Magic/ElementBolt2.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/ElementBolt2.png and /dev/null differ diff --git a/Projectiles/Magic/ElementOrb.cs b/Projectiles/Magic/ElementOrb.cs index b1e0a7d19b..53a5b58350 100644 --- a/Projectiles/Magic/ElementOrb.cs +++ b/Projectiles/Magic/ElementOrb.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Magic { public class ElementOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 30; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/ElementOrb.png b/Projectiles/Magic/ElementOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/ElementOrb.png and /dev/null differ diff --git a/Projectiles/Magic/ElementOrb2.cs b/Projectiles/Magic/ElementOrb2.cs index f57e76a5f6..d123f573b1 100644 --- a/Projectiles/Magic/ElementOrb2.cs +++ b/Projectiles/Magic/ElementOrb2.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Magic { public class ElementOrb2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 30; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/ElementOrb2.png b/Projectiles/Magic/ElementOrb2.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/ElementOrb2.png and /dev/null differ diff --git a/Projectiles/Magic/ElementTentacle.cs b/Projectiles/Magic/ElementTentacle.cs index e7c808b252..03745d0183 100644 --- a/Projectiles/Magic/ElementTentacle.cs +++ b/Projectiles/Magic/ElementTentacle.cs @@ -3,11 +3,14 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class ElementTentacle : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tentacle"); @@ -94,7 +97,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Magic/ElementTentacle.png b/Projectiles/Magic/ElementTentacle.png deleted file mode 100644 index 84f7b0870b..0000000000 Binary files a/Projectiles/Magic/ElementTentacle.png and /dev/null differ diff --git a/Projectiles/Magic/ElementalRayBeam.cs b/Projectiles/Magic/ElementalRayBeam.cs index 12433c8b39..841862f3c8 100644 --- a/Projectiles/Magic/ElementalRayBeam.cs +++ b/Projectiles/Magic/ElementalRayBeam.cs @@ -2,11 +2,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class ElementalRayBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); @@ -21,7 +24,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = 10; projectile.extraUpdates = 100; projectile.timeLeft = 180; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -51,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Magic/ElementalRayBeam.png b/Projectiles/Magic/ElementalRayBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/ElementalRayBeam.png and /dev/null differ diff --git a/Projectiles/Magic/EnormousConsumingVortex.cs b/Projectiles/Magic/EnormousConsumingVortex.cs index 6abcb381e3..94556fafce 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; + namespace CalamityMod.Projectiles.Magic { public class EnormousConsumingVortex : ModProjectile @@ -14,15 +15,19 @@ namespace CalamityMod.Projectiles.Magic get => projectile.ai[0]; set => projectile.ai[0] = value; } + public float IdealScale { - get => projectile.localAI[0]; - set => projectile.localAI[0] = value; + get => projectile.ai[1]; + set => projectile.ai[1] = value; } - public const int TentacleSpawnRate = 30; + + public const int TentacleSpawnRate = 20; public const int PulseInterval = 18; public const float PulseHitboxExpandRatio = 2.5f; public const float RadialOffsetVarianceFactor = 0.1f; + public const float StartingScale = 0.0004f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); @@ -36,29 +41,23 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.scale = 0.0004f; + projectile.scale = StartingScale; projectile.timeLeft = 540; projectile.tileCollide = false; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 17; + projectile.localNPCHitCooldown = 8; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(IdealScale); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - IdealScale = reader.ReadSingle(); - } + // 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 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(0.0004f, IdealScale, Utils.InverseLerp(0f, 30f, Time, true)); // Expand completely after 30 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) @@ -68,7 +67,7 @@ namespace CalamityMod.Projectiles.Magic } // Target enemy if possible and idly spawn tentacles. - if (Time < 300) + if (Time < 150) { TargetingMovement(); if (Time % TentacleSpawnRate == TentacleSpawnRate - 1 && Main.myPlayer == projectile.owner) @@ -77,7 +76,7 @@ namespace CalamityMod.Projectiles.Magic } } // Slow down and pulse frequently. - else if (Time < 480) + else if (Time < 220) { projectile.velocity *= 0.96f; if (Time % PulseInterval == 0f) @@ -85,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic PulseEffect(); } } - else if (Time == 520f) + else if (Time >= 240) { ExplodeEffect(); projectile.Kill(); @@ -93,29 +92,33 @@ namespace CalamityMod.Projectiles.Magic CalamityGlobalProjectile.ExpandHitboxBy(projectile, (int)(projectile.scale * 62)); Time++; } + public void ProduceSubsumingHentai() { + 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, - Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 13f), - ModContent.ProjectileType(), - (int)(projectile.damage * 0.6), - projectile.knockBack * 0.6f, - projectile.owner, - xStartingAcceleration, - yStartingAcceleration); + Projectile subsumingHentai = Projectile.NewProjectileDirect( + projectile.Center, + Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(9f, 13f), + ModContent.ProjectileType(), + tentacleDamage, + projectile.knockBack * 0.5f, + projectile.owner, + xStartingAcceleration, + yStartingAcceleration + ); + subsumingHentai.tileCollide = false; } public void TargetingMovement() { - NPC potentialTarget = projectile.Center.ClosestNPCAt(1500f, true, true); + NPC potentialTarget = projectile.Center.ClosestNPCAt(600f, true, true); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 5f + projectile.DirectionTo(potentialTarget.Center) * 7f) / 6f; - } + projectile.velocity = (projectile.velocity * 5f + projectile.SafeDirectionTo(potentialTarget.Center) * 7f) / 6f; } + public void PulseEffect() { CalamityGlobalProjectile.ExpandHitboxBy(projectile, PulseHitboxExpandRatio); @@ -137,6 +140,7 @@ namespace CalamityMod.Projectiles.Magic } CalamityGlobalProjectile.ExpandHitboxBy(projectile, 1f / PulseHitboxExpandRatio); } + public void ExplodeEffect() { Main.PlaySound(SoundID.Zombie, projectile.Center, 104); @@ -153,25 +157,30 @@ namespace CalamityMod.Projectiles.Magic } if (Main.myPlayer == projectile.owner) { + 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.DirectionTo(closestTarget.Center).RotatedByRandom(0.4f); + velocity = projectile.SafeDirectionTo(closestTarget.Center, -Vector2.UnitY).RotatedByRandom(0.4f); + velocity *= Main.rand.NextFloat(3f, 5f); + Projectile.NewProjectileDirect(projectile.Center, - velocity, - ModContent.ProjectileType(), - (int)(projectile.damage * 0.7), - projectile.knockBack, - projectile.owner, - 0f, - Main.rand.NextFloat(0.5f, 1.8f)); + velocity, + ModContent.ProjectileType(), + vortexDamage, + projectile.knockBack, + projectile.owner, + 0f, + Main.rand.NextFloat(0.5f, 1.8f)); } } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { int vortexesToDraw = 27; diff --git a/Projectiles/Magic/EternityBook.cs b/Projectiles/Magic/EternityBook.cs index 61b77e0ceb..ab373b7042 100644 --- a/Projectiles/Magic/EternityBook.cs +++ b/Projectiles/Magic/EternityBook.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic Time++; // Summon a bunch of cool things the moment the book is created, assuming an NPC is near the mouse position. - if (Time == 1f) + if (Main.myPlayer == projectile.owner && Time == 1f) { NPC target = Main.MouseWorld.ClosestNPCAt(4400f, true, true); diff --git a/Projectiles/Magic/EternityCircle.cs b/Projectiles/Magic/EternityCircle.cs index ba6cb79052..c88d994190 100644 --- a/Projectiles/Magic/EternityCircle.cs +++ b/Projectiles/Magic/EternityCircle.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class EternityCircle : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int TargetNPCIndex { get => (int)projectile.ai[0]; @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic get => (int)projectile.localAI[1]; set => projectile.localAI[1] = value; } - public const float TargetOffsetRadius = 595f; + public const float TargetOffsetRadius = 490f; public const float SinusoidalOffsetAngleIncrement = 0.54f; public static readonly float SinusoidalPositionAngleIncrement = MathHelper.ToRadians(3.5f); public override void SetStaticDefaults() diff --git a/Projectiles/Magic/EternityCircle.png b/Projectiles/Magic/EternityCircle.png deleted file mode 100644 index 5a928deac0..0000000000 Binary files a/Projectiles/Magic/EternityCircle.png and /dev/null differ diff --git a/Projectiles/Magic/EternityCrystal.cs b/Projectiles/Magic/EternityCrystal.cs index 18d8d23858..d42866dc1c 100644 --- a/Projectiles/Magic/EternityCrystal.cs +++ b/Projectiles/Magic/EternityCrystal.cs @@ -90,9 +90,10 @@ namespace CalamityMod.Projectiles.Magic projectile.localAI[0] += 1f; if (projectile.timeLeft == 1 && !Collapsing) { - projectile.velocity = projectile.DirectionTo(target.Center) * 2f; + projectile.velocity = projectile.SafeDirectionTo(target.Center) * 2f; projectile.timeLeft = InwardCollapseTime; Collapsing = true; + projectile.netUpdate = true; } SpinAngle -= MathHelper.ToRadians(DegreesToSpin); diff --git a/Projectiles/Magic/EternityHex.cs b/Projectiles/Magic/EternityHex.cs index 530ca5480d..91ca33bd9f 100644 --- a/Projectiles/Magic/EternityHex.cs +++ b/Projectiles/Magic/EternityHex.cs @@ -1,13 +1,19 @@ using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class EternityHex : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + internal PrimitiveTrail LemniscateDrawer = null; public int TargetNPCIndex { get => (int)projectile.ai[0]; @@ -34,6 +40,8 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Eternity"); + ProjectileID.Sets.TrailingMode[projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 63; } public override void SetDefaults() @@ -44,6 +52,7 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 1; projectile.alpha = 255; } + public override void AI() { Player player = Main.player[projectile.owner]; @@ -97,13 +106,16 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 3; i++) { LemniscateAngle += MathHelper.TwoPi / 200f; - DrawLemniscate(target); + DetermineLemniscatePosition(target); } + if (Time < Lifetime * projectile.MaxUpdates) { 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); + // Spawn a bunch of swirling dust and do damage. if (random <= effectRate) SpawnSwirlingDust(target); @@ -140,6 +152,7 @@ namespace CalamityMod.Projectiles.Magic projectile.Kill(); } } + public void DeathDust() { for (int i = 0; i < 44; i++) @@ -149,7 +162,8 @@ namespace CalamityMod.Projectiles.Magic dust.noGravity = true; } } - public void DrawLemniscate(NPC target) + + public void DetermineLemniscatePosition(NPC target) { // This value causes the lemniscate to smoothen out and look better. float scale = 2f / (3f - (float)Math.Cos(2 * LemniscateAngle)); @@ -158,16 +172,8 @@ namespace CalamityMod.Projectiles.Magic Vector2 lemniscateOffset = scale * new Vector2((float)Math.Cos(LemniscateAngle), (float)Math.Sin(2f * LemniscateAngle) / 2f); projectile.Center = target.Center + lemniscateOffset * outwardMultiplier; - - // This part isn't actually throughout the projectile's lifetime because of extra updates. - float completionValue = Utils.InverseLerp(0f, Lifetime, Time, true); - Color dustColor = Color.Lerp(new Color(245, 112, 218), new Color(28, 13, 118), completionValue); - - Dust dust = Dust.NewDustDirect(projectile.Center, 0, 0, Eternity.DustID, newColor: dustColor); - dust.velocity = Vector2.Zero; - dust.scale = MathHelper.Lerp(0.8f, 1.5f, completionValue); - dust.noGravity = true; } + public void ChooseNewTarget(NPC newTarget) { TargetNPCIndex = newTarget.whoAmI; @@ -178,7 +184,7 @@ namespace CalamityMod.Projectiles.Magic Projectile proj = Main.projectile[i]; if (!proj.active) continue; - if (proj.whoAmI != projectile.whoAmI) + if (proj.owner != projectile.owner) continue; if (proj.type != ModContent.ProjectileType() && proj.type != ModContent.ProjectileType()) continue; @@ -187,24 +193,55 @@ namespace CalamityMod.Projectiles.Magic DeathDust(); } } + public void SpawnSwirlingDust(NPC target) { - for (int i = 0; i < 12; i++) + for (int i = 0; i < 3; i++) { float randomAngle = Main.rand.NextFloat() * MathHelper.TwoPi; float outwardnessFactor = Main.rand.NextFloat(); Vector2 spawnPosition = target.Center + randomAngle.ToRotationVector2() * MathHelper.Lerp(70f, EternityCircle.TargetOffsetRadius - 60f, outwardnessFactor); Vector2 velocity = (randomAngle - 3f * MathHelper.Pi / 8f).ToRotationVector2() * (10f + 9f * Main.rand.NextFloat() + 4f * outwardnessFactor); - Dust swirlingDust = Dust.NewDustPerfect(spawnPosition, Eternity.DustID, new Vector2?(velocity), 0, Main.rand.NextBool(3) ? Eternity.BlueColor : Eternity.PinkColor, 1.4f); - swirlingDust.scale = 0.8f; - swirlingDust.fadeIn = 0.95f + outwardnessFactor * 0.3f; + Dust swirlingDust = Dust.NewDustPerfect(spawnPosition, 267, new Vector2?(velocity), 0, Main.rand.NextBool(3) ? Eternity.BlueColor : Eternity.PinkColor, 1.4f); + swirlingDust.scale = 1.2f; + swirlingDust.fadeIn = 0.25f + outwardnessFactor * 0.1f; swirlingDust.noGravity = true; } } + // 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); } - } -} \ No newline at end of file + + public Color PrimitiveColorFunction(float completionRatio) + { + float leftoverTimeScale = (float)Math.Sin(Main.GlobalTime * 4f) * 0.5f + 0.5f; + leftoverTimeScale *= 0.5f; + + 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 fadeToMagenta = MathHelper.SmoothStep(0f, 1f, (float)Math.Pow(completionRatio, 0.6D)); + + return Color.Lerp(headColor, tailColor, fadeToMagenta) * opacity; + } + + public float PrimitiveWidthFunction(float completionRatio) + { + float widthInterpolant = Utils.InverseLerp(0f, 0.12f, completionRatio, true); + return MathHelper.SmoothStep(1f, 10f, widthInterpolant); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + } +} diff --git a/Projectiles/Magic/EternityHex.png b/Projectiles/Magic/EternityHex.png deleted file mode 100644 index c6616b4227..0000000000 Binary files a/Projectiles/Magic/EternityHex.png and /dev/null differ diff --git a/Projectiles/Magic/EternityHoming.cs b/Projectiles/Magic/EternityHoming.cs index a921663807..3863480df1 100644 --- a/Projectiles/Magic/EternityHoming.cs +++ b/Projectiles/Magic/EternityHoming.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class EternityHoming : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eternity"); @@ -27,37 +29,26 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - NPC target = null; - float distance = 4400f; - for (int index = 0; index < Main.npc.Length; index++) - { - if (Main.npc[index].CanBeChasedBy(null, false)) - { - if (Main.npc[index].boss && Vector2.Distance(projectile.Center, Main.npc[index].Center) <= 4400f) - { - target = Main.npc[index]; - break; - } - if (Vector2.Distance(projectile.Center, Main.npc[index].Center) < distance) - { - distance = Vector2.Distance(projectile.Center, Main.npc[index].Center); - target = Main.npc[index]; - } - } - } + NPC target = projectile.Center.ClosestNPCAt(3000f); if (target != null) - { - projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(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]); - float radius = 10f; + float radius = 4f; Vector2 offset = angle.ToRotationVector2() * pulse * radius; - Dust dust = Dust.NewDustPerfect(projectile.Center + offset, Eternity.DustID, Vector2.Zero, 0, Eternity.BlueColor); + + 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, Eternity.DustID, Vector2.Zero, 0, Eternity.BlueColor); + dust = Dust.NewDustPerfect(projectile.Center - offset, 264, Vector2.Zero); + dust.color = Eternity.PinkColor; + dust.scale = 1.4f; + dust.noLight = true; dust.noGravity = true; } } diff --git a/Projectiles/Magic/EternityHoming.png b/Projectiles/Magic/EternityHoming.png deleted file mode 100644 index c6616b4227..0000000000 Binary files a/Projectiles/Magic/EternityHoming.png and /dev/null differ diff --git a/Projectiles/Magic/EventHorizonBlackhole.cs b/Projectiles/Magic/EventHorizonBlackhole.cs index 75c6ed0500..f4cffde291 100644 --- a/Projectiles/Magic/EventHorizonBlackhole.cs +++ b/Projectiles/Magic/EventHorizonBlackhole.cs @@ -1,3 +1,5 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,18 +21,21 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 40; projectile.height = 40; projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft = 60; + projectile.penetrate = 3; + projectile.timeLeft = 90; projectile.magic = true; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 12; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 60; + + public override void AI() { if (projectile.frame == 8) return; + // Update animation projectile.frameCounter++; if (projectile.frameCounter > 5) @@ -38,6 +43,7 @@ namespace CalamityMod.Projectiles.Magic projectile.frame++; projectile.frameCounter = 0; } + if (projectile.timeLeft > 15) { if (projectile.frame >= 4) @@ -56,5 +62,11 @@ namespace CalamityMod.Projectiles.Magic { target.AddBuff(BuffID.Daybreak, 300); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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 1b6fa190c2..5b030cb318 100644 --- a/Projectiles/Magic/EventHorizonStar.cs +++ b/Projectiles/Magic/EventHorizonStar.cs @@ -87,10 +87,10 @@ namespace CalamityMod.Projectiles.Magic if (projectile.localAI[0] >= 100) { Vector2 center = projectile.Center; - float homingRange = 800f; + float homingRange = 250f; bool homeIn = false; - float N = 30f; - float homingVelocity = 20f; + float inertia = 25f; + float homingSpeed = 23f; for (int i = 0; i < Main.maxNPCs; i++) { @@ -110,11 +110,9 @@ namespace CalamityMod.Projectiles.Magic if (homeIn) { projectile.extraUpdates = 1; - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 homeInVector = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * N + homeInVector * homingVelocity) / (N + 1f); + projectile.velocity = (projectile.velocity * inertia + homeInVector * homingSpeed) / (inertia + 1f); } else projectile.extraUpdates = 0; @@ -129,7 +127,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index 55243a5a1d..74fd8e7ccf 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class EvergladeSprayProjectile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spray"); diff --git a/Projectiles/Magic/EvergladeSprayProjectile.png b/Projectiles/Magic/EvergladeSprayProjectile.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Magic/EvergladeSprayProjectile.png and /dev/null differ diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index 8139dc9f72..99420e8491 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -1,38 +1,114 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class FabBolt : ModProjectile { + internal PrimitiveTrail TrailDrawer; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public bool FadingOut + { + 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; } public override void SetDefaults() { projectile.width = 4; projectile.height = 4; - projectile.extraUpdates = 100; projectile.friendly = true; - projectile.timeLeft = 45; + projectile.extraUpdates = 2; + projectile.penetrate = 12; + projectile.timeLeft = 90 * projectile.extraUpdates; projectile.magic = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 0; } public override void AI() { - if (projectile.timeLeft % 2f == 0f) + if (FadingOut) + { + 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(); + + // Emit light. + 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; + } + + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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, 120, projectile.oldRot); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!FadingOut && projectile.penetrate < 2) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].noGravity = true; - Main.dust[num448].noLight = true; - Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } + FadingOut = true; + projectile.velocity *= 0.1f; + projectile.extraUpdates = 0; + projectile.netUpdate = true; + } } - } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (!FadingOut) + { + FadingOut = true; + projectile.velocity *= 0.1f; + projectile.extraUpdates = 0; + projectile.netUpdate = true; + } + return false; + } + + public override bool CanDamage() + { + if (FadingOut) + return false; + return base.CanDamage(); + } + } } diff --git a/Projectiles/Magic/FabBolt.png b/Projectiles/Magic/FabBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/FabBolt.png and /dev/null differ diff --git a/Projectiles/Magic/FabOrb.cs b/Projectiles/Magic/FabOrb.cs deleted file mode 100644 index 140dacc724..0000000000 --- a/Projectiles/Magic/FabOrb.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class FabOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - 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.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType(), 1D, true); - } - } -} diff --git a/Projectiles/Magic/FabOrb.png b/Projectiles/Magic/FabOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/FabOrb.png and /dev/null differ diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 106332c811..137015fad6 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -1,13 +1,22 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class FabRay : ModProjectile { + internal PrimitiveTrail TrailDrawer; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 54; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() @@ -16,35 +25,71 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 20; - projectile.extraUpdates = 100; - projectile.timeLeft = 600; + projectile.ignoreWater = true; + projectile.penetrate = 70; + projectile.extraUpdates = 3; + projectile.timeLeft = 60 * projectile.extraUpdates; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; + projectile.localNPCHitCooldown = 10; } 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) + 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) { - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + 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); + } + + for (int i = 0; i < projectile.oldPos.Length / 4; i += 3) + { + 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); + break; + } + } } - if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) - { - Vector2 source = projectile.position; - int pink = Dust.NewDust(source, 1, 1, 234, 0f, 0f, 0, default, 1.25f); - Main.dust[pink].noGravity = true; - Main.dust[pink].noLight = true; - Main.dust[pink].position = source; - Main.dust[pink].scale = Main.rand.Next(70, 110) * 0.013f; - Main.dust[pink].velocity *= 0.1f; - } + // Emit light. + Lighting.AddLight(projectile.Center, Vector3.One * projectile.Opacity * 0.7f); } - public override bool OnTileCollide(Vector2 oldVelocity) + 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; + 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; + } + + 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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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, 76); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; if (projectile.penetrate <= 0) diff --git a/Projectiles/Magic/FabRay.png b/Projectiles/Magic/FabRay.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/FabRay.png and /dev/null differ diff --git a/Projectiles/Magic/FatesRevealFlame.cs b/Projectiles/Magic/FatesRevealFlame.cs index 23548918c4..99c3278896 100644 --- a/Projectiles/Magic/FatesRevealFlame.cs +++ b/Projectiles/Magic/FatesRevealFlame.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Fireball"); + DisplayName.SetDefault("Fate's Reveal"); Main.projFrames[projectile.type] = 4; } @@ -88,15 +88,15 @@ namespace CalamityMod.Projectiles.Magic projectile.position = projectile.Center; projectile.width = projectile.height = 180; projectile.Center = projectile.position; - projectile.damage = 800; + // 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)]; dust13.noGravity = true; if (dust13.position != projectile.Center) - { - dust13.velocity = projectile.DirectionTo(dust13.position) * 3f; - } + dust13.velocity = projectile.SafeDirectionTo(dust13.position) * 3f; + num3 = num955; } } @@ -104,12 +104,8 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.Distance(Main.player[projectile.owner].Center) > num950) { - Vector2 vector118 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector118.HasNaNs()) - { - vector118 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num949 - 1f) + vector118 * scaleFactor11) / num949; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (num949 - 1f) + moveDirection * scaleFactor11) / num949; } } else @@ -133,17 +129,19 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { + Main.PlaySound(SoundID.Item14, projectile.Center); + projectile.position = projectile.Center; - projectile.width = projectile.height = 192; + 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 = 10; - projectile.damage *= 3; + projectile.localNPCHitCooldown = -1; projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.Center); + + // Dust code int num3; for (int num122 = 0; num122 < 3; num122 = num3 + 1) { diff --git a/Projectiles/Magic/FlameBeamTip.png b/Projectiles/Magic/FlameBeamTip.png index d5a672aac7..129d223259 100644 Binary files a/Projectiles/Magic/FlameBeamTip.png and b/Projectiles/Magic/FlameBeamTip.png differ diff --git a/Projectiles/Magic/FlameBeamTip2.cs b/Projectiles/Magic/FlameBeamTip2.cs index 5c67f54258..06476ad3d5 100644 --- a/Projectiles/Magic/FlameBeamTip2.cs +++ b/Projectiles/Magic/FlameBeamTip2.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; + projectile.width = projectile.height = 40; projectile.aiStyle = 4; projectile.friendly = true; projectile.alpha = 255; diff --git a/Projectiles/Magic/FlameBeamTip2.png b/Projectiles/Magic/FlameBeamTip2.png index d5a672aac7..fa52bec9ea 100644 Binary files a/Projectiles/Magic/FlameBeamTip2.png and b/Projectiles/Magic/FlameBeamTip2.png differ diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index f8063b51ee..4523f665ed 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/ForbiddenAxeBlade.cs b/Projectiles/Magic/ForbiddenAxeBlade.cs index 4b1268f76f..aa3ff8c279 100644 --- a/Projectiles/Magic/ForbiddenAxeBlade.cs +++ b/Projectiles/Magic/ForbiddenAxeBlade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic else if (projectile.ai[1] > 20f && projectile.ai[1] <= 39f) { projectile.velocity *= 1.25f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 10f, 20f); } else if (projectile.ai[1] == 40f) { @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 e770146004..ca1c0b7bf8 100644 --- a/Projectiles/Magic/ForbiddenSunProjectile.cs +++ b/Projectiles/Magic/ForbiddenSunProjectile.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class ForbiddenSunProjectile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/ChaosFlameSmall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sun"); diff --git a/Projectiles/Magic/ForbiddenSunProjectile.png b/Projectiles/Magic/ForbiddenSunProjectile.png deleted file mode 100644 index 5a1fe37e31..0000000000 Binary files a/Projectiles/Magic/ForbiddenSunProjectile.png and /dev/null differ diff --git a/Projectiles/Magic/ForbiddenSunburst.cs b/Projectiles/Magic/ForbiddenSunburst.cs index 73600c0ddf..ebec80f8ae 100644 --- a/Projectiles/Magic/ForbiddenSunburst.cs +++ b/Projectiles/Magic/ForbiddenSunburst.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class ForbiddenSunburst : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private static float ExplosionRadius = 190.0f; public override void SetStaticDefaults() diff --git a/Projectiles/Magic/ForbiddenSunburst.png b/Projectiles/Magic/ForbiddenSunburst.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Magic/ForbiddenSunburst.png and /dev/null differ diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index e9e5fc4756..782b92609b 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index 8dc84cbcdf..093b3619cd 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/GammaLaser.cs b/Projectiles/Magic/GammaLaser.cs index b8fd95d0ba..10bf0d52d9 100644 --- a/Projectiles/Magic/GammaLaser.cs +++ b/Projectiles/Magic/GammaLaser.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 9d634abeb2..433c3a069a 100644 --- a/Projectiles/Magic/GhastlyBlast.cs +++ b/Projectiles/Magic/GhastlyBlast.cs @@ -9,9 +9,13 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlyBlast : ModProjectile { + private const float DriftVelocity = 10f; + private const float FramesBeforeSlowing = 8f; + private const float MaximumWaitFrames = 360f; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Blast"); + DisplayName.SetDefault("Ghast Blast"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -23,58 +27,63 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 6; - projectile.extraUpdates = 1; + projectile.extraUpdates = 2; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 12; } public override void AI() { projectile.ai[0] += 1f; - int num1013 = 0; - if (projectile.velocity.Length() <= 8f) //4 - { - num1013 = 1; - } + 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; - } - if (num1013 == 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; + + // Dust, randomly if (Main.rand.NextBool(3)) { if (Main.rand.NextBool(2)) { - Vector2 vector140 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + 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)]; dust28.noGravity = true; - dust28.position = projectile.Center - vector140 * (float)Main.rand.Next(10, 21); - dust28.velocity = vector140.RotatedBy(1.5707963705062866, default) * 6f; + 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; dust28.customData = projectile; } else { - Vector2 vector141 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + 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)]; dust29.noGravity = true; dust29.position = projectile.Center - vector141 * 30f; - dust29.velocity = vector141.RotatedBy(-1.5707963705062866, default) * 3f; + dust29.velocity = vector141.RotatedBy(-MathHelper.PiOver2) * 3f; dust29.scale = 0.5f + Main.rand.NextFloat(); dust29.fadeIn = 0.5f; dust29.customData = projectile; } } - if (projectile.ai[0] >= 30f) + + // Grow and slow down + if (projectile.ai[0] >= FramesBeforeSlowing * projectile.MaxUpdates) { - projectile.velocity *= 0.98f; + projectile.velocity *= 0.977f; projectile.scale += 0.00744680827f; if (projectile.scale > 1.2f) { @@ -82,33 +91,40 @@ namespace CalamityMod.Projectiles.Magic } projectile.rotation -= 0.0174532924f; } - if (projectile.velocity.Length() < 8.2f) //4.1 + + // Set velocity to the drift velocity exactly after slowing down enough and reset the time counter. + float speed = projectile.velocity.Length(); + if (speed < 1.02f * DriftVelocity) { - projectile.velocity.Normalize(); - projectile.velocity *= 4f; + projectile.velocity *= DriftVelocity / speed; projectile.ai[0] = 0f; } } - else if (num1013 == 1) + + // Either moving at or below drift velocity, or currently homing. Either case runs this AI path. + else { + // Spin at the exact same rate anyway projectile.rotation -= 0.104719758f; + + // Excessively complicated dust int num3; for (int num1014 = 0; num1014 < 1; num1014 = num3 + 1) { if (Main.rand.NextBool(2)) { - Vector2 vector142 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + 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)]; dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; + 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(6.2831854820251465); + vector142 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); dust30.noGravity = true; - dust30.position = projectile.Center - vector142 * (float)Main.rand.Next(10, 21); - dust30.velocity = vector142.RotatedBy(1.5707963705062866, default) * 6f; + 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; @@ -116,24 +132,29 @@ namespace CalamityMod.Projectiles.Magic } else { - Vector2 vector143 = Vector2.UnitY.RotatedByRandom(6.2831854820251465); + 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)]; dust31.noGravity = true; - dust31.position = projectile.Center - vector143 * (float)Main.rand.Next(20, 31); - dust31.velocity = vector143.RotatedBy(-1.5707963705062866, default) * 5f; + 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; dust31.customData = projectile; } num3 = num1014; } + + // Every so many frames, spawn a sub blast. if (projectile.ai[0] % 30f == 0f && projectile.ai[0] < 241f && Main.myPlayer == projectile.owner) { - Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector144.X, vector144.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, (float)projectile.whoAmI); + 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); } + + // Undocumented, unrefactored homing. Will not home through walls. + // Apparently has two different homing distances. Vector2 vector145 = projectile.Center; - float num1015 = 800f; + float num1015 = 500f; bool flag59 = false; int num1016 = 0; if (projectile.ai[1] == 0f) @@ -182,24 +203,27 @@ namespace CalamityMod.Projectiles.Magic } if (flag59 && projectile.localAI[0] >= 60f) { - float num1019 = 24f; //14 - int num1020 = 8; + 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); - 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; + 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; } } + + // If the projectile is solid enough, add light. if (projectile.alpha < 150) { Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.1f); } - if (projectile.ai[0] >= 600f) + + if (projectile.ai[0] >= MaximumWaitFrames * projectile.MaxUpdates) { projectile.Kill(); } @@ -207,7 +231,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -229,17 +253,17 @@ namespace CalamityMod.Projectiles.Magic 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(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + 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); Dust dust = Main.dust[num98]; - dust.position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)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(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + 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; @@ -249,7 +273,7 @@ namespace CalamityMod.Projectiles.Magic { 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(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)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; } @@ -257,7 +281,7 @@ namespace CalamityMod.Projectiles.Magic { 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(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default) * (float)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; } @@ -265,13 +289,13 @@ namespace CalamityMod.Projectiles.Magic { for (int num105 = 0; num105 < Main.maxProjectiles; num105++) { - if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == (float)projectile.whoAmI) + if (Main.projectile[num105].active && Main.projectile[num105].type == ModContent.ProjectileType() && Main.projectile[num105].ai[1] == projectile.whoAmI) { Main.projectile[num105].Kill(); } } - int num106 = Main.rand.Next(5, 9); - int num107 = Main.rand.Next(5, 9); + int num106 = 5; + int num107 = 5; int num108 = Utils.SelectRandom(Main.rand, new int[] { 60, @@ -281,34 +305,34 @@ namespace CalamityMod.Projectiles.Magic for (int num110 = 0; num110 < num106; num110++) { Vector2 vector4 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Vector2 vector5 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); while (vector5.X == 0f && vector5.Y == 0f) { - vector5 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector5 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } vector5.Normalize(); if (vector5.Y > 0.2f) { vector5.Y *= -1f; } - vector5 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(vector4.X, vector4.Y, vector5.X, vector5.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num108, 0f); + 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); } for (int num111 = 0; num111 < num107; num111++) { Vector2 vector6 = projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f); - Vector2 vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Vector2 vector7 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); while (vector7.X == 0f && vector7.Y == 0f) { - vector7 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector7 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } vector7.Normalize(); if (vector7.Y > 0.4f) { vector7.Y *= -1f; } - vector7 *= (float)Main.rand.Next(40, 81) * 0.1f; - Projectile.NewProjectile(vector6.X, vector6.Y, vector7.X, vector7.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.8f, projectile.owner, (float)num109, 0f); + 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); } } } diff --git a/Projectiles/Magic/GhastlyExplosion.cs b/Projectiles/Magic/GhastlyExplosion.cs index f5ceb28200..239b20c747 100644 --- a/Projectiles/Magic/GhastlyExplosion.cs +++ b/Projectiles/Magic/GhastlyExplosion.cs @@ -7,9 +7,11 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlyExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Explosion"); + DisplayName.SetDefault("Ghastly Explosion"); } public override void SetDefaults() @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic } if (Main.myPlayer == projectile.owner) { - int num118 = Main.rand.Next(3, 6); + int num118 = 3; for (int num119 = 0; num119 < num118; num119 = num3 + 1) { Vector2 vector8 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); @@ -83,7 +85,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.9), 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/GhastlyExplosion.png b/Projectiles/Magic/GhastlyExplosion.png deleted file mode 100644 index 0d9b842a7f..0000000000 Binary files a/Projectiles/Magic/GhastlyExplosion.png and /dev/null differ diff --git a/Projectiles/Magic/GhastlyExplosionShard.cs b/Projectiles/Magic/GhastlyExplosionShard.cs index 5b13254d52..bc39226c3b 100644 --- a/Projectiles/Magic/GhastlyExplosionShard.cs +++ b/Projectiles/Magic/GhastlyExplosionShard.cs @@ -5,9 +5,11 @@ namespace CalamityMod.Projectiles.Magic { public class GhastlyExplosionShard : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Explosion"); + DisplayName.SetDefault("Ghastly Fragment"); } public override void SetDefaults() @@ -16,25 +18,28 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 8; projectile.friendly = true; projectile.alpha = 255; + projectile.timeLeft = 80; projectile.penetrate = 1; projectile.magic = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 50 && target.CanBeChasedBy(projectile); + + public override void AI() { int num332 = (int)projectile.ai[0]; + projectile.ai[1] += 1f; - float num333 = (60f - projectile.ai[1]) / 60f; - if (projectile.ai[1] > 40f) - { + float num333 = (120f - projectile.ai[1]) / 120f; + if (projectile.ai[1] > 80f) projectile.Kill(); - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; + + projectile.velocity.Y += 0.2f; if (projectile.velocity.Y > 18f) - { projectile.velocity.Y = 18f; - } - projectile.velocity.X = projectile.velocity.X * 0.98f; + + projectile.velocity.X *= 0.98f; + int num3; for (int num334 = 0; num334 < 2; num334 = num3 + 1) { @@ -47,6 +52,7 @@ namespace CalamityMod.Projectiles.Magic dust.scale *= num333; num3 = num334; } + 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); @@ -59,7 +65,10 @@ namespace CalamityMod.Projectiles.Magic dust.scale *= num333; num3 = num336; } - } + + if (projectile.timeLeft < 50) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + } public override void Kill(int timeLeft) { @@ -68,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic { 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 + (float)Main.rand.Next(-10, 11) * 0.01f; + 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; diff --git a/Projectiles/Magic/GhastlyExplosionShard.png b/Projectiles/Magic/GhastlyExplosionShard.png deleted file mode 100644 index 0d9b842a7f..0000000000 Binary files a/Projectiles/Magic/GhastlyExplosionShard.png and /dev/null differ diff --git a/Projectiles/Magic/GhastlySubBlast.cs b/Projectiles/Magic/GhastlySubBlast.cs index 0636f7a965..fb02effb27 100644 --- a/Projectiles/Magic/GhastlySubBlast.cs +++ b/Projectiles/Magic/GhastlySubBlast.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Blast"); + DisplayName.SetDefault("Ghast Blast"); } public override void SetDefaults() @@ -18,10 +18,11 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft = 420; + projectile.ignoreWater = true; + projectile.timeLeft = 420; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 8; } public override void AI() @@ -43,10 +44,7 @@ namespace CalamityMod.Projectiles.Magic } projectile.timeLeft = 2; } - float[] npcArray = projectile.ai; - int npcChase = 0; - float num73 = npcArray[npcChase]; - npcArray[npcChase] = num73 + 1f; + projectile.ai[0] += 1f; if (projectile.ai[0] < num1025) { bool flag62 = true; @@ -97,10 +95,9 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { projectile.ai[0] = 60f; - int num3; - for (int num114 = 0; num114 < 10; num114 = num3 + 1) + for (int num114 = 0; num114 < 10; num114++) { - 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(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; @@ -108,7 +105,6 @@ namespace CalamityMod.Projectiles.Magic dust.velocity *= 1.25f; dust = Main.dust[num115]; dust.velocity -= projectile.oldVelocity / 10f; - num3 = num114; } } } diff --git a/Projectiles/Magic/GhastlyVisageProj.cs b/Projectiles/Magic/GhastlyVisageProj.cs index 00386b307a..41d04f9249 100644 --- a/Projectiles/Magic/GhastlyVisageProj.cs +++ b/Projectiles/Magic/GhastlyVisageProj.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Visage"); + DisplayName.SetDefault("Ghastly Visage"); Main.projFrames[projectile.type] = 4; } @@ -28,13 +28,13 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.65f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.1f / 255f); + 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) { - num = 3.14159274f; + num = MathHelper.Pi; } projectile.frameCounter++; if (projectile.frameCounter > 4) @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Magic if (flag15 && Main.myPlayer == projectile.owner) { int num42 = ModContent.ProjectileType(); - float scaleFactor11 = 6f; + float coreVelocity = 11.5f; int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback2 = player.ActiveItem().knockBack; if (flag16) @@ -169,7 +169,7 @@ namespace CalamityMod.Projectiles.Magic projectile.netUpdate = true; } projectile.velocity = value19 * 0.55f; - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); + Vector2 vector20 = Vector2.Normalize(projectile.velocity) * coreVelocity; if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) { vector20 = -Vector2.UnitY; diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 44e0aa1684..5f9aa73c12 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.alpha = 0; projectile.timeLeft = 250; projectile.penetrate = 1; projectile.magic = true; @@ -24,9 +23,8 @@ namespace CalamityMod.Projectiles.Magic 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.985f; - projectile.velocity.Y *= 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[] diff --git a/Projectiles/Magic/GleamingBolt2.cs b/Projectiles/Magic/GleamingBolt2.cs index a8d0633ee3..3c2e79cc99 100644 --- a/Projectiles/Magic/GleamingBolt2.cs +++ b/Projectiles/Magic/GleamingBolt2.cs @@ -16,17 +16,22 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 14; projectile.height = 14; projectile.friendly = true; - projectile.alpha = 0; projectile.timeLeft = 120; projectile.penetrate = 1; projectile.magic = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); + + public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + else + projectile.velocity *= 0.985f; + int randomDust = Utils.SelectRandom(Main.rand, new int[] { 64, diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs index 7c2308e3e9..07156b0a76 100644 --- a/Projectiles/Magic/GraniteEnergy.cs +++ b/Projectiles/Magic/GraniteEnergy.cs @@ -17,18 +17,20 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 12; projectile.friendly = true; projectile.penetrate = 1; - projectile.tileCollide = true; projectile.magic = true; projectile.timeLeft = 90; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 60 && target.CanBeChasedBy(projectile); + + 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(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); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 22f, 20f); + if (projectile.timeLeft < 60) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } } } diff --git a/Projectiles/Magic/HadopelagicEcho2.cs b/Projectiles/Magic/HadopelagicEcho2.cs index 44ba8e87b2..7a1cf33ad1 100644 --- a/Projectiles/Magic/HadopelagicEcho2.cs +++ b/Projectiles/Magic/HadopelagicEcho2.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class HadopelagicEcho2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/EidolicWailSoundwave"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Echo"); @@ -37,52 +39,13 @@ namespace CalamityMod.Projectiles.Magic { projectile.width = (int)(36f * projectile.scale); projectile.height = (int)(36f * projectile.scale); + if (projectile.alpha > 100) - { projectile.alpha -= 25; - } if (projectile.alpha < 100) projectile.alpha = 100; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - if (projectile.ai[0] == 1f) - { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; - - for (int num475 = 0; num475 < Main.projectile.Length; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - - if (flag17) - { - float num483 = 8f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -95,15 +58,15 @@ namespace CalamityMod.Projectiles.Magic if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HadopelagicEcho2.png b/Projectiles/Magic/HadopelagicEcho2.png deleted file mode 100644 index e3d171c010..0000000000 Binary files a/Projectiles/Magic/HadopelagicEcho2.png and /dev/null differ diff --git a/Projectiles/Magic/HadopelagicEchoSoundwave.cs b/Projectiles/Magic/HadopelagicEchoSoundwave.cs index 9d0a35464b..57c09aec8e 100644 --- a/Projectiles/Magic/HadopelagicEchoSoundwave.cs +++ b/Projectiles/Magic/HadopelagicEchoSoundwave.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class HadopelagicEchoSoundwave : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/EidolicWailSoundwave"; + private int echoCooldown = 0; private bool playedSound = false; private static int penetrationAmt = 50; @@ -31,9 +33,11 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = penetrationAmt; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; + projectile.localNPCHitCooldown = 8; projectile.timeLeft = 450; - } + projectile.Calamity().PierceResistHarshness = 0.06f; + projectile.Calamity().PierceResistCap = 0.4f; + } public override void AI() { @@ -45,6 +49,7 @@ namespace CalamityMod.Projectiles.Magic playedSound = true; } } + if (projectile.localAI[0] < 1f) { projectile.localAI[0] += 0.05f; @@ -61,30 +66,28 @@ namespace CalamityMod.Projectiles.Magic if (echoCooldown > 0) echoCooldown--; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)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.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)(((double)damage * (double)projectile.localAI[0]) * (0.5D + (0.5D / (double)projectile.penetrate))); + damage = (int)((double)damage * projectile.localAI[0] * (0.5D + (0.5D / projectile.penetrate))); } public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) { - damage = (int)(((double)damage * (double)projectile.localAI[0]) * (0.5D + (0.5D / (double)projectile.penetrate))); + damage = (int)((double)damage * projectile.localAI[0] * (0.5D + (0.5D / projectile.penetrate))); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -112,7 +115,7 @@ namespace CalamityMod.Projectiles.Magic if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner, 0f, 0f); + Projectile.NewProjectile(startPoint, velocity, echoID, echoDamage, echoKB, projectile.owner); } } } @@ -131,7 +134,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/HadopelagicEchoSoundwave.png b/Projectiles/Magic/HadopelagicEchoSoundwave.png deleted file mode 100644 index e3d171c010..0000000000 Binary files a/Projectiles/Magic/HadopelagicEchoSoundwave.png and /dev/null differ diff --git a/Projectiles/Magic/HeliumFlashBlast.cs b/Projectiles/Magic/HeliumFlashBlast.cs index b7964ece9c..32e2f60fa5 100644 --- a/Projectiles/Magic/HeliumFlashBlast.cs +++ b/Projectiles/Magic/HeliumFlashBlast.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class HeliumFlashBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private static int Lifetime = 40; private static float ExplosionRadius = 210.0f; private static float StartDustQuantity = 36f; @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = Lifetime; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 8; } // localAI[0] = frame counter diff --git a/Projectiles/Magic/HeliumFlashBlast.png b/Projectiles/Magic/HeliumFlashBlast.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Magic/HeliumFlashBlast.png and /dev/null differ diff --git a/Projectiles/Magic/HellfireExplosionFriendly.cs b/Projectiles/Magic/HellfireExplosionFriendly.cs index 5d93265066..b205665aa0 100644 --- a/Projectiles/Magic/HellfireExplosionFriendly.cs +++ b/Projectiles/Magic/HellfireExplosionFriendly.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class HellfireExplosionFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Magic/HellfireExplosionFriendly.png b/Projectiles/Magic/HellfireExplosionFriendly.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Magic/HellfireExplosionFriendly.png and /dev/null differ diff --git a/Projectiles/Magic/HellwingPillar.cs b/Projectiles/Magic/HellwingPillar.cs index 0ebaa25551..8aa2d6c872 100644 --- a/Projectiles/Magic/HellwingPillar.cs +++ b/Projectiles/Magic/HellwingPillar.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 new file mode 100644 index 0000000000..89a71ba3fd --- /dev/null +++ b/Projectiles/Magic/HeresyProj.cs @@ -0,0 +1,130 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.Projectiles.Magic +{ + public class HeresyProj : ModProjectile + { + 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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Heresy"); + 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; + } + + public override void AI() + { + 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(); + return; + } + + if (AttackTimer >= Main.rand.Next(20, 28) - (int)MathHelper.Lerp(0f, 16f, Utils.InverseLerp(0f, 120f, Time, true))) + 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.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + projectile.frameCounter = 0; + } + + AdjustPlayerValues(); + projectile.timeLeft = 2; + AttackTimer++; + Time++; + } + + public void ReleaseThings() + { + Main.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(); + return; + } + WeightedRandom typeDecider = new WeightedRandom(); + + typeDecider.Add(ModContent.ProjectileType(), 1.5f); + + // Make souls appear more frequently (aka with a higher weight) the more "intense" the shots should be. + typeDecider.Add(ModContent.ProjectileType(), ShootIntensity * 0.75f); + typeDecider.Add(ModContent.ProjectileType(), ShootIntensity * 0.4f); + typeDecider.Add(ModContent.ProjectileType(), ShootIntensity * 0.2f); + + 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); + + AttackTimer = 0f; + projectile.netUpdate = true; + } + + public void AdjustPlayerValues() + { + projectile.spriteDirection = projectile.direction = Owner.direction; + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + 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); + 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); + glowColor.A = 0; + + // 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 - Main.screenPosition; + spriteBatch.Draw(bookTexture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Magic/HeresyProj.png b/Projectiles/Magic/HeresyProj.png new file mode 100644 index 0000000000..ca66b0eb6f Binary files /dev/null and b/Projectiles/Magic/HeresyProj.png differ diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index 97df80133e..3c1a92c09d 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class HolyLaser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); @@ -21,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 100; projectile.timeLeft = 180; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 30; } public override void AI() @@ -51,8 +53,9 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.owner == Main.myPlayer) { - int proj = 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); - Main.projectile[proj].Calamity().forceMagic = true; + 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/HolyLaser.png b/Projectiles/Magic/HolyLaser.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/HolyLaser.png and /dev/null differ diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index 016ab4e72c..19bf85a147 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class IceBarrageMain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int pwidth = 58; private int pheight = 58; public override void SetStaticDefaults() @@ -154,9 +156,12 @@ namespace CalamityMod.Projectiles.Magic { 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)); - Main.projectile[ice].timeLeft = 600; - Main.projectile[ice].melee = false; - Main.projectile[ice].Calamity().forceMagic = true; + if (ice.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ice].timeLeft = 600; + Main.projectile[ice].melee = false; + Main.projectile[ice].Calamity().forceMagic = true; + } projectile.ai[1] = 0f; } } @@ -171,8 +176,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 900); - target.AddBuff(ModContent.BuffType(), 900); + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Magic/IceBarrageMain.png b/Projectiles/Magic/IceBarrageMain.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/IceBarrageMain.png and /dev/null differ diff --git a/Projectiles/Magic/IceCluster.cs b/Projectiles/Magic/IceCluster.cs index ab34bb945e..ca39a0af34 100644 --- a/Projectiles/Magic/IceCluster.cs +++ b/Projectiles/Magic/IceCluster.cs @@ -28,99 +28,54 @@ namespace CalamityMod.Projectiles.Magic projectile.coldDamage = true; } - public override void AI() - { - projectile.rotation += 0.5f; - if (projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - Main.PlaySound(SoundID.Item120, projectile.position); - } - projectile.ai[0] += 1f; - if (projectile.ai[1] == 1f) - { - if (projectile.ai[0] >= 130f) - { - projectile.alpha += 10; - } - else - { - projectile.alpha -= 10; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - if (projectile.ai[0] >= 150f) - { - return; - } - if (projectile.ai[0] % 30f == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector80 = projectile.rotation.ToRotationVector2(); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); - } - else - { - if (projectile.ai[0] >= 40f) - { - projectile.alpha += 3; - } - else - { - projectile.alpha -= 40; - } - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - if (projectile.ai[0] >= 45f) - { - return; - } - Vector2 value47 = new Vector2(0f, -720f).RotatedBy((double)projectile.velocity.ToRotation(), default); - float scaleFactor8 = projectile.ai[0] % 45f / 45f; - Vector2 spinningpoint = value47 * scaleFactor8; - for (int num844 = 0; num844 < 6; num844++) - { - Vector2 vector81 = projectile.Center + spinningpoint.RotatedBy((double)((float)num844 * 6.28318548f / 6f), default); - Lighting.AddLight(vector81, 0.3f, 0.75f, 0.9f); - for (int num845 = 0; num845 < 2; num845++) - { - int num846 = Dust.NewDust(vector81 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent, 1f); - Main.dust[num846].noGravity = true; - } - } - } - } + public override void AI() + { + projectile.rotation += 0.5f; + + if (projectile.localAI[1] == 0f) + { + projectile.localAI[1] = 1f; + Main.PlaySound(SoundID.Item120, projectile.position); + } + + projectile.ai[0] += 1f; + if (projectile.ai[1] == 1f) + { + 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); + } + + Lighting.AddLight(projectile.Center, 0.3f, 0.75f, 0.9f); + } + + if (projectile.ai[0] >= 90f) + projectile.alpha += 25; + else + projectile.alpha -= 15; + + if (projectile.alpha < 0) + projectile.alpha = 0; + if (projectile.alpha > 255) + projectile.alpha = 255; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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.AddBuff(ModContent.BuffType(), 120); - if (target.type == NPCID.TargetDummy) - return; + + target.AddBuff(ModContent.BuffType(), 60); + Vector2 vector80 = projectile.rotation.ToRotationVector2(); if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector80.X, vector80.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + 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 5ed2964f46..d9e96126e3 100644 --- a/Projectiles/Magic/IceSpike.cs +++ b/Projectiles/Magic/IceSpike.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class IceSpike : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/IceRain"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spike"); @@ -19,7 +21,6 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.penetrate = 1; projectile.magic = true; - projectile.tileCollide = true; projectile.timeLeft = 240; projectile.coldDamage = true; } @@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Magic 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, false, 400f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 10f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Magic/IceSpike.png b/Projectiles/Magic/IceSpike.png deleted file mode 100644 index 14ddad107b..0000000000 Binary files a/Projectiles/Magic/IceSpike.png and /dev/null differ diff --git a/Projectiles/Magic/InfernadoFriendly.cs b/Projectiles/Magic/InfernadoFriendly.cs index bb3b9ea766..8118335fa3 100644 --- a/Projectiles/Magic/InfernadoFriendly.cs +++ b/Projectiles/Magic/InfernadoFriendly.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Infernado"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 12; } public override void SetDefaults() @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 500; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; projectile.magic = true; } @@ -34,11 +34,11 @@ namespace CalamityMod.Projectiles.Magic if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) intersectingSomething = true; - int num613 = 22; - int num614 = 22; - float num615 = 2.5f; - int num616 = 320; - int num617 = 88; + float scaleBase = 44f; + float scaleMult = 2.5f; + float baseWidth = 320f; + float baseHeight = 88f; + 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); @@ -53,27 +53,22 @@ namespace CalamityMod.Projectiles.Magic projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 6) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } 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.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) { - 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 = (scaleBase - projectile.ai[1]) * scaleMult / scaleBase; + projectile.width = (int)(baseWidth * projectile.scale); + projectile.height = (int)(baseHeight * projectile.scale); } if (!intersectingSomething) { @@ -99,11 +94,21 @@ namespace CalamityMod.Projectiles.Magic { 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 -= baseHeight * projectile.scale / 2f; + float num618 = (scaleBase - projectile.ai[1] + 1f) * scaleMult / scaleBase; + center.Y -= baseHeight * 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 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; + } } if (projectile.ai[0] <= 0f) { @@ -111,10 +116,10 @@ namespace CalamityMod.Projectiles.Magic 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.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 = projectile.position.X + num624 * (float)-(float)projectile.direction; + projectile.position.X += num624 * -projectile.direction; return; } } diff --git a/Projectiles/Magic/InfernadoFriendly.png b/Projectiles/Magic/InfernadoFriendly.png index d4d9ea492c..769e18070c 100644 Binary files a/Projectiles/Magic/InfernadoFriendly.png and b/Projectiles/Magic/InfernadoFriendly.png differ diff --git a/Projectiles/Magic/InfernadoMarkFriendly.cs b/Projectiles/Magic/InfernadoMarkFriendly.cs index 9955f7dc44..65af55a354 100644 --- a/Projectiles/Magic/InfernadoMarkFriendly.cs +++ b/Projectiles/Magic/InfernadoMarkFriendly.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class InfernadoMarkFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); diff --git a/Projectiles/Magic/InfernadoMarkFriendly.png b/Projectiles/Magic/InfernadoMarkFriendly.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Magic/InfernadoMarkFriendly.png and /dev/null differ diff --git a/Projectiles/Magic/InfernalBlade2.cs b/Projectiles/Magic/InfernalBlade2.cs index 22530b77c6..841b05c265 100644 --- a/Projectiles/Magic/InfernalBlade2.cs +++ b/Projectiles/Magic/InfernalBlade2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class InfernalBlade2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/InfernalBlade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); diff --git a/Projectiles/Magic/InfernalBlade2.png b/Projectiles/Magic/InfernalBlade2.png deleted file mode 100644 index 1dd394dfcb..0000000000 Binary files a/Projectiles/Magic/InfernalBlade2.png and /dev/null differ diff --git a/Projectiles/Magic/IonBlast.cs b/Projectiles/Magic/IonBlast.cs index 8215cd5cb6..32412ec0de 100644 --- a/Projectiles/Magic/IonBlast.cs +++ b/Projectiles/Magic/IonBlast.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/KeelhaulGeyserBottom.cs b/Projectiles/Magic/KeelhaulGeyserBottom.cs index 0cd9ab5d5f..0c26061c70 100644 --- a/Projectiles/Magic/KeelhaulGeyserBottom.cs +++ b/Projectiles/Magic/KeelhaulGeyserBottom.cs @@ -19,10 +19,10 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; projectile.magic = true; projectile.penetrate = -1; - projectile.timeLeft = 360; + projectile.timeLeft = 180; projectile.alpha = 90; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 20; } public override void AI() @@ -34,9 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } } } } diff --git a/Projectiles/Magic/KeelhaulGeyserTop.cs b/Projectiles/Magic/KeelhaulGeyserTop.cs index 43e9326ec2..ae6783388f 100644 --- a/Projectiles/Magic/KeelhaulGeyserTop.cs +++ b/Projectiles/Magic/KeelhaulGeyserTop.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; projectile.magic = true; projectile.penetrate = -1; - projectile.timeLeft = 360; + projectile.timeLeft = 180; projectile.alpha = 90; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; @@ -34,9 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } } } } diff --git a/Projectiles/Magic/LightBallExplosion.cs b/Projectiles/Magic/LightBallExplosion.cs index c425dc446a..11af6c22cc 100644 --- a/Projectiles/Magic/LightBallExplosion.cs +++ b/Projectiles/Magic/LightBallExplosion.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Magic { public class LightBallExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -18,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 6; } } } diff --git a/Projectiles/Magic/LightBallExplosion.png b/Projectiles/Magic/LightBallExplosion.png deleted file mode 100644 index 3ccaea528f..0000000000 Binary files a/Projectiles/Magic/LightBallExplosion.png and /dev/null differ diff --git a/Projectiles/Magic/LightBead.cs b/Projectiles/Magic/LightBead.cs index 19dc99e163..f3e752388b 100644 --- a/Projectiles/Magic/LightBead.cs +++ b/Projectiles/Magic/LightBead.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class LightBead : ModProjectile @@ -27,13 +28,14 @@ namespace CalamityMod.Projectiles.Magic 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(3)) + if (Main.rand.NextBool(5)) { - int num300 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 0, default, 1f); - Main.dust[num300].noGravity = true; - Main.dust[num300].velocity *= 0.5f; - Main.dust[num300].scale *= 0.9f; + 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) { projectile.scale -= 0.05f; @@ -44,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic return; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 18f, 10f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 15f, 15f); } public override Color? GetAlpha(Color lightColor) @@ -54,10 +56,9 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - for (int k = 0; k < 6; k++) - { + 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); - } + int beadAmt = Main.rand.Next(2, 3); if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Magic/LightBeadSplit.cs b/Projectiles/Magic/LightBeadSplit.cs index 27905807ff..bb9b8e25bd 100644 --- a/Projectiles/Magic/LightBeadSplit.cs +++ b/Projectiles/Magic/LightBeadSplit.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Magic { public class LightBeadSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/LightBead"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Light Bead"); @@ -26,7 +28,6 @@ namespace CalamityMod.Projectiles.Magic 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) diff --git a/Projectiles/Magic/LightBeadSplit.png b/Projectiles/Magic/LightBeadSplit.png deleted file mode 100644 index 3ff61e7647..0000000000 Binary files a/Projectiles/Magic/LightBeadSplit.png and /dev/null differ diff --git a/Projectiles/Magic/LightBlade.cs b/Projectiles/Magic/LightBlade.cs index cd69b4018c..d6c225ead4 100644 --- a/Projectiles/Magic/LightBlade.cs +++ b/Projectiles/Magic/LightBlade.cs @@ -70,13 +70,13 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[1] = 0f; else { - Vector2 homingVec = projectile.DirectionTo(paired.Center) * projectile.ai[0]; + 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, 1000f, 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(); diff --git a/Projectiles/Magic/LightningArc.cs b/Projectiles/Magic/LightningArc.cs index f657f594c3..bf595d3c6a 100644 --- a/Projectiles/Magic/LightningArc.cs +++ b/Projectiles/Magic/LightningArc.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class LightningArc : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning Arc"); diff --git a/Projectiles/Magic/LightningArc.png b/Projectiles/Magic/LightningArc.png deleted file mode 100644 index 62237c6022..0000000000 Binary files a/Projectiles/Magic/LightningArc.png and /dev/null differ diff --git a/Projectiles/Magic/LiquidBlade.cs b/Projectiles/Magic/LiquidBlade.cs index bcc8f79caa..528586de9f 100644 --- a/Projectiles/Magic/LiquidBlade.cs +++ b/Projectiles/Magic/LiquidBlade.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class LiquidBlade : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/InfernalBlade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); @@ -21,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; projectile.ignoreWater = true; projectile.tileCollide = true; projectile.timeLeft = 180; diff --git a/Projectiles/Magic/LiquidBlade.png b/Projectiles/Magic/LiquidBlade.png deleted file mode 100644 index 1dd394dfcb..0000000000 Binary files a/Projectiles/Magic/LiquidBlade.png and /dev/null differ diff --git a/Projectiles/Magic/LiquidBlade2.cs b/Projectiles/Magic/LiquidBlade2.cs index a3e7f5672c..f3f28a1b61 100644 --- a/Projectiles/Magic/LiquidBlade2.cs +++ b/Projectiles/Magic/LiquidBlade2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class LiquidBlade2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/LightBlade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); @@ -20,7 +22,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 3; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.timeLeft = 180; diff --git a/Projectiles/Magic/LiquidBlade2.png b/Projectiles/Magic/LiquidBlade2.png deleted file mode 100644 index c216615a26..0000000000 Binary files a/Projectiles/Magic/LiquidBlade2.png and /dev/null differ diff --git a/Projectiles/Magic/LuxorsGiftMagic.cs b/Projectiles/Magic/LuxorsGiftMagic.cs index 7b8b3cd489..4ae57912f7 100644 --- a/Projectiles/Magic/LuxorsGiftMagic.cs +++ b/Projectiles/Magic/LuxorsGiftMagic.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/LuxorsGiftMagic.png b/Projectiles/Magic/LuxorsGiftMagic.png index 490eb24528..3c066fade0 100644 Binary files a/Projectiles/Magic/LuxorsGiftMagic.png and b/Projectiles/Magic/LuxorsGiftMagic.png differ diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index 4f67a37f6f..013a28eecf 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail"); + DisplayName.SetDefault("Mad Alchemist's Prismatic Cocktail"); } public override void SetDefaults() @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.OnFire, 300); target.AddBuff(BuffID.CursedInferno, 180); @@ -53,24 +53,28 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item107, projectile.position); + 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); - int height = 120; - float num51 = 1.8f; - float num52 = 2.5f; - Vector2 value3 = (0f - 1.57079637f).ToRotationVector2(); - Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; - Main.PlaySound(SoundID.Item20, projectile.Center); + + // This previously did double damage. It now does half damage. + int blastWidth = 120; projectile.position = projectile.Center; - projectile.width = projectile.height = height; + projectile.width = projectile.height = blastWidth; projectile.Center = projectile.position; projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage *= 2; + 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; int num3; for (int num53 = 0; num53 < 40; num53 = num3 + 1) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index 801fa20a18..10d5271901 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Blue"); + DisplayName.SetDefault("Mad Alchemist's Blue Cocktail"); } public override void SetDefaults() @@ -43,15 +43,17 @@ namespace CalamityMod.Projectiles.Magic 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); - int num220 = Main.rand.Next(20, 31); + + int numClouds = 9; + int cloudDamage = projectile.damage / 2; if (projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < num220; num221++) + for (int i = 0; i < numClouds; 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(), projectile.damage / 4, 0f, projectile.owner, 0f, (float)Main.rand.Next(-45, 1)); + 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)); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs index 7e75163b43..430cf3dfc4 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGasCloud.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Gas Cloud"); + DisplayName.SetDefault("Mad Alchemist's Gas"); } public override void SetDefaults() @@ -19,8 +19,10 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + + // Only one gas cloud can hit at once. + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 9; } public override void AI() @@ -39,41 +41,6 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation += projectile.velocity.X * 0.1f; projectile.rotation += (float)projectile.direction * 0.003f; projectile.velocity *= 0.96f; - - Rectangle cloudHitbox = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height); - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile otherProj = Main.projectile[i]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || i == projectile.whoAmI) - continue; - - if (otherProj.type == projectile.type) - { - Rectangle otherProjHitbox = new Rectangle((int)otherProj.position.X, (int)otherProj.position.Y, otherProj.width, otherProj.height); - if (cloudHitbox.Intersects(otherProjHitbox)) - { - Vector2 projDistance = otherProj.Center - projectile.Center; - if (projDistance.X == 0f && projDistance.Y == 0f) - { - if (i < projectile.whoAmI) - { - projDistance.X = -1f; - projDistance.Y = 1f; - } - else - { - projDistance.X = 1f; - projDistance.Y = -1f; - } - } - projDistance.Normalize(); - projDistance *= 0.005f; - projectile.velocity -= projDistance; - otherProj.velocity += projDistance; - } - } - } } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index dc1add9ccf..e377c16256 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Green"); + DisplayName.SetDefault("Mad Alchemist's Green Cocktail"); } public override void SetDefaults() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic 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); - for (int num118 = 0; num118 < 3; num118++) + 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); diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 7188ea80f2..66b80887fe 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Purple"); + DisplayName.SetDefault("Mad Alchemist's Purple Cocktail"); } public override void SetDefaults() @@ -43,14 +43,17 @@ namespace CalamityMod.Projectiles.Magic 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); + + int numShrapnel = 4; + int shrapnelDamage = projectile.damage / 3; if (projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < 4; num221++) + 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(), projectile.damage / 3, 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 b7946e54e1..f21c8764b8 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Mad Alchemist's Cocktail Red"); + DisplayName.SetDefault("Mad Alchemist's Red Cocktail"); } public override void SetDefaults() @@ -40,25 +40,30 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - int height = 480; + 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); + + // 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(); + + // 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; - Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 20, 2f, 0f); - 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); - 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 *= 3; - projectile.Damage(); int num3; for (int num53 = 0; num53 < 60; num53 = num3 + 1) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs index 0cd115e19d..258fa2ba58 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class MadAlchemistsCocktailShrapnel : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shrapnel"); @@ -22,7 +24,9 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 1; } - public override void AI() + 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; @@ -46,7 +50,8 @@ namespace CalamityMod.Projectiles.Magic 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; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 12f, 20f); + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 12f, 20f); } } } diff --git a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.png b/Projectiles/Magic/MadAlchemistsCocktailShrapnel.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Magic/MadAlchemistsCocktailShrapnel.png and /dev/null differ diff --git a/Projectiles/Magic/MagicNebulaShot.cs b/Projectiles/Magic/MagicNebulaShot.cs index 1c8431dcac..1f577d71d8 100644 --- a/Projectiles/Magic/MagicNebulaShot.cs +++ b/Projectiles/Magic/MagicNebulaShot.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public class MagicNebulaShot : BaseLaserbeamProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private Color startingColor = new Color(119, 210, 255); private Color secondColor = new Color(247, 119, 255); public override float MaxScale => 0.7f; @@ -33,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic projectile.magic = true; projectile.penetrate = -1; projectile.alpha = 255; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 8; projectile.usesLocalNPCImmunity = true; } diff --git a/Projectiles/Magic/MagicNebulaShot.png b/Projectiles/Magic/MagicNebulaShot.png deleted file mode 100644 index ef1edb7c71..0000000000 Binary files a/Projectiles/Magic/MagicNebulaShot.png and /dev/null differ diff --git a/Projectiles/Magic/MagnaBlast.cs b/Projectiles/Magic/MagnaBlast.cs index 6f12b10dac..6b3d2d79ad 100644 --- a/Projectiles/Magic/MagnaBlast.cs +++ b/Projectiles/Magic/MagnaBlast.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class MagnaBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Magic/MagnaBlast.png b/Projectiles/Magic/MagnaBlast.png deleted file mode 100644 index 4a5f92eb8f..0000000000 Binary files a/Projectiles/Magic/MagnaBlast.png and /dev/null differ diff --git a/Projectiles/Magic/MagneticBeam.cs b/Projectiles/Magic/MagneticBeam.cs index 453164ab0d..8244fc3197 100644 --- a/Projectiles/Magic/MagneticBeam.cs +++ b/Projectiles/Magic/MagneticBeam.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class MagneticBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.timeLeft = 90; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/MagneticBeam.png b/Projectiles/Magic/MagneticBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/MagneticBeam.png and /dev/null differ diff --git a/Projectiles/Magic/MagneticOrb.cs b/Projectiles/Magic/MagneticOrb.cs index 86f9056fe1..924084c01b 100644 --- a/Projectiles/Magic/MagneticOrb.cs +++ b/Projectiles/Magic/MagneticOrb.cs @@ -3,10 +3,14 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { public class MagneticOrb : ModProjectile { + private const int Lifetime = 120; + private const float FramesPerBeam = 12f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Magnetic Orb"); @@ -18,17 +22,25 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 38; projectile.height = 38; projectile.friendly = true; - projectile.light = 0.5f; projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.timeLeft = 150; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.timeLeft = 120; projectile.magic = true; } + public override bool CanDamage() => false; + public override void AI() { - projectile.velocity *= 0.96f; + // Drift to a stop after being launched + 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); + + // What in the hell does this code do if (projectile.velocity.X > 0f) { projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; @@ -38,6 +50,7 @@ namespace CalamityMod.Projectiles.Magic projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; } + // Update animation projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -49,7 +62,7 @@ namespace CalamityMod.Projectiles.Magic } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 400f, 8f, 4f, 2, ModContent.ProjectileType(), 1D, true); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 8f, FramesPerBeam, 1, ModContent.ProjectileType(), 1D, true); } public override Color? GetAlpha(Color lightColor) @@ -70,7 +83,5 @@ namespace CalamityMod.Projectiles.Magic 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 bool CanDamage() => false; } } diff --git a/Projectiles/Magic/MagneticOrb.png b/Projectiles/Magic/MagneticOrb.png index 526f873f90..d274e28227 100644 Binary files a/Projectiles/Magic/MagneticOrb.png and b/Projectiles/Magic/MagneticOrb.png differ diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs index 91a963a290..132b7a79af 100644 --- a/Projectiles/Magic/MagnusBeam.cs +++ b/Projectiles/Magic/MagnusBeam.cs @@ -204,10 +204,9 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) - { + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; - } + Player player = Main.player[projectile.owner]; player.statLife += 1; player.statMana += 25; diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index 86627663b3..f9f274534c 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.alpha = 0; projectile.penetrate = 1; projectile.timeLeft = 180; projectile.magic = true; @@ -24,9 +23,8 @@ namespace CalamityMod.Projectiles.Magic 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.985f; - projectile.velocity.Y *= 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, @@ -51,8 +49,8 @@ namespace CalamityMod.Projectiles.Magic 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, 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.5), 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.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); diff --git a/Projectiles/Magic/ManaBoltSmall.cs b/Projectiles/Magic/ManaBoltSmall.cs index 435e130b22..4ab8bc09a8 100644 --- a/Projectiles/Magic/ManaBoltSmall.cs +++ b/Projectiles/Magic/ManaBoltSmall.cs @@ -17,17 +17,22 @@ namespace CalamityMod.Projectiles.Magic projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.alpha = 0; projectile.penetrate = 1; projectile.timeLeft = 60; projectile.magic = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 40 && target.CanBeChasedBy(projectile); + + 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; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.timeLeft < 40) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 450f, 6f, 20f); + else + 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); } diff --git a/Projectiles/Magic/ManaBoltSmall2.cs b/Projectiles/Magic/ManaBoltSmall2.cs index 8a01866544..dd3a502460 100644 --- a/Projectiles/Magic/ManaBoltSmall2.cs +++ b/Projectiles/Magic/ManaBoltSmall2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class ManaBoltSmall2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/ManaBoltSmall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Magic/ManaBoltSmall2.png b/Projectiles/Magic/ManaBoltSmall2.png deleted file mode 100644 index 9fb9bb7677..0000000000 Binary files a/Projectiles/Magic/ManaBoltSmall2.png and /dev/null differ diff --git a/Projectiles/Magic/ManaMonster.cs b/Projectiles/Magic/ManaMonster.cs new file mode 100644 index 0000000000..8b82332280 --- /dev/null +++ b/Projectiles/Magic/ManaMonster.cs @@ -0,0 +1,103 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ManaMonster : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() + { + if (Time < NPCAttackTime) + { + projectile.Opacity = Utils.InverseLerp(0f, 30f, Time, true); + if (projectile.velocity.Length() < 27f) + projectile.velocity *= 1.05f; + } + else + { + // Make an alert sound to indicate that the monster has become enraged and will now attack its caster. + 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); + CreateTransitionBurstDust(); + } + + if (Time < NPCAttackTime + PlayerAttackRedirectTime) + { + 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; + } + else if (projectile.velocity.Length() < 35f) + projectile.velocity *= 1.04f; + + // Fade out. + projectile.Opacity = Utils.InverseLerp(0f, 15f, projectile.timeLeft, true); + } + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + Time++; + } + + public void CreateTransitionBurstDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 75; i++) + { + 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); + brimstone.fadeIn = 0.4f; + brimstone.noGravity = true; + } + } + + // 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 PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Magic/ManaMonster.png b/Projectiles/Magic/ManaMonster.png new file mode 100644 index 0000000000..9b98b7bad0 Binary files /dev/null and b/Projectiles/Magic/ManaMonster.png differ diff --git a/Projectiles/Magic/MelterNote1.cs b/Projectiles/Magic/MelterNote1.cs index 661f494e19..b7888c4edd 100644 --- a/Projectiles/Magic/MelterNote1.cs +++ b/Projectiles/Magic/MelterNote1.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 24; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 600; + projectile.penetrate = 2; + projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; projectile.tileCollide = false; @@ -25,23 +25,19 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + projectile.velocity *= 0.985f; + if (projectile.localAI[0] == 0f) { projectile.scale += 0.02f; if (projectile.scale >= 1.25f) - { projectile.localAI[0] = 1f; - } } else if (projectile.localAI[0] == 1f) { 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 6da02af0a4..c877cde6fd 100644 --- a/Projectiles/Magic/MelterNote2.cs +++ b/Projectiles/Magic/MelterNote2.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 24; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; - projectile.timeLeft = 600; + projectile.penetrate = 2; + projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 7; projectile.tileCollide = false; @@ -25,23 +25,19 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; + projectile.velocity *= 0.99f; + if (projectile.localAI[0] == 0f) { projectile.scale += 0.02f; if (projectile.scale >= 1.25f) - { projectile.localAI[0] = 1f; - } } else if (projectile.localAI[0] == 1f) { projectile.scale -= 0.02f; if (projectile.scale <= 0.75f) - { projectile.localAI[0] = 0f; - } } } diff --git a/Projectiles/Magic/MiasmaGas.cs b/Projectiles/Magic/MiasmaGas.cs index 29fb35f4ee..d579a02009 100644 --- a/Projectiles/Magic/MiasmaGas.cs +++ b/Projectiles/Magic/MiasmaGas.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 28; projectile.friendly = true; projectile.ignoreWater = true; - projectile.timeLeft = 300; + projectile.timeLeft = 240; projectile.penetrate = 10; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/NebulaElementalBeam.cs b/Projectiles/Magic/NebulaElementalBeam.cs new file mode 100644 index 0000000000..86b396809b --- /dev/null +++ b/Projectiles/Magic/NebulaElementalBeam.cs @@ -0,0 +1,66 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class NebulaElementalBeam : BaseLaserbeamProjectile + { + public override float MaxScale => 1.4f; + 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 const float UniversalAngularSpeed = MathHelper.Pi / 400f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + 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; + } + + public override void ExtraBehavior() + { + RotationalSpeed = UniversalAngularSpeed; + // Generate a burst of bubble-like nebula dust. + if (!Main.dedServ && Time == 5f) + { + int totalBubbles = 24; + for (int i = 0; i < totalBubbles; i++) + { + Dust nebulaBubble = Dust.NewDustPerfect(projectile.Center, 242); + nebulaBubble.velocity = Main.rand.NextVector2Circular(6f, 6f); + nebulaBubble.scale = Main.rand.NextFloat(2f, 3f); + nebulaBubble.noGravity = true; + } + } + } + + 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); + return false; + } + } +} diff --git a/Projectiles/Boss/BrimstoneTargetRay.png b/Projectiles/Magic/NebulaElementalBeam.png similarity index 100% rename from Projectiles/Boss/BrimstoneTargetRay.png rename to Projectiles/Magic/NebulaElementalBeam.png diff --git a/Projectiles/Magic/NightBolt.cs b/Projectiles/Magic/NightBolt.cs index c40e79b84f..b55dd36601 100644 --- a/Projectiles/Magic/NightBolt.cs +++ b/Projectiles/Magic/NightBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class NightBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -14,11 +16,12 @@ namespace CalamityMod.Projectiles.Magic { projectile.width = 4; projectile.height = 4; - projectile.extraUpdates = 100; + projectile.extraUpdates = 20; projectile.friendly = true; projectile.timeLeft = 30; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/NightBolt.png b/Projectiles/Magic/NightBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/NightBolt.png and /dev/null differ diff --git a/Projectiles/Magic/NightOrb.cs b/Projectiles/Magic/NightOrb.cs index a88208e905..c637119196 100644 --- a/Projectiles/Magic/NightOrb.cs +++ b/Projectiles/Magic/NightOrb.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Magic { public class NightOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Magic projectile.penetrate = -1; projectile.timeLeft = 30; projectile.magic = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Magic/NightOrb.png b/Projectiles/Magic/NightOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/NightOrb.png and /dev/null differ diff --git a/Projectiles/Magic/NightsRayBeam.cs b/Projectiles/Magic/NightsRayBeam.cs index bfcfe17a55..b9ca198c46 100644 --- a/Projectiles/Magic/NightsRayBeam.cs +++ b/Projectiles/Magic/NightsRayBeam.cs @@ -5,6 +5,13 @@ namespace CalamityMod.Projectiles.Magic { public class NightsRayBeam : ModProjectile { + public ref float Time => ref projectile.ai[0]; + public bool HasFiredSideBeams + { + get => projectile.ai[1] == 1f; + set => projectile.ai[1] = value.ToInt(); + } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); @@ -16,31 +23,41 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; + projectile.ignoreWater = true; + projectile.penetrate = 10; projectile.extraUpdates = 100; projectile.timeLeft = 150; } public override void AI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 29f && projectile.owner == Main.myPlayer) + if (!HasFiredSideBeams && projectile.owner == Main.myPlayer) { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.6), projectile.knockBack, projectile.owner, 0f, 0f); + NPC potentialTarget = projectile.Center.ClosestNPCAt(5480f, false); + if (potentialTarget != null) + { + Vector2 baseSpawnPositionOffset = Main.rand.NextVector2CircularEdge(40f, 40f); + for (int i = 0; i < 4; i++) + { + Vector2 spawnPosition = potentialTarget.Center + baseSpawnPositionOffset.RotatedBy(MathHelper.TwoPi * i / 4f); + Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner); + } + HasFiredSideBeams = true; + projectile.netUpdate = true; + } } - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) + Time++; + if (Time >= 10f) { - for (int num447 = 0; num447 < 3; num447++) + for (int i = 0; i < 2; i++) { - 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; - Main.dust[num448].velocity *= 0.1f; + 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); + corruptMagic.noGravity = true; + corruptMagic.velocity *= 0.1f; } } } diff --git a/Projectiles/Magic/NightsRayBeam.png b/Projectiles/Magic/NightsRayBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/NightsRayBeam.png and /dev/null differ diff --git a/Projectiles/Magic/NuclearFuryProjectile.cs b/Projectiles/Magic/NuclearFuryProjectile.cs index 128fd4c314..df22d82964 100644 --- a/Projectiles/Magic/NuclearFuryProjectile.cs +++ b/Projectiles/Magic/NuclearFuryProjectile.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Nuclear Fury"); - Main.projFrames[projectile.type] = 3; ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -51,14 +50,12 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha -= 5; if (projectile.alpha < 50) projectile.alpha = 50; - projectile.rotation += projectile.velocity.X * 0.1f; - projectile.frame = (int)(projectile.localAI[1] / 3f) % 3; 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; int num1 = -1; - Vector2 vector2 = projectile.Center; - float num2 = 500f; - Vector2 value = new Vector2(0.5f); + Vector2 targetVec = projectile.Center; + float maxDistance = 500f; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; @@ -70,12 +67,17 @@ namespace CalamityMod.Projectiles.Magic NPC npc = Main.npc[index]; if (npc.CanBeChasedBy(projectile, false) && (projectile.ai[0] == 0f || projectile.ai[0] == (index + 1f))) { - Vector2 center = npc.position + npc.Size * value; - float num3 = Vector2.Distance(center, vector2); - if (num3 < num2 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + 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); + + float npcDist = Vector2.Distance(npc.Center, targetVec); + if (npcDist < (maxDistance + extraDistance) && canHit) { - num2 = num3; - vector2 = center; + maxDistance = npcDist; + targetVec = npc.Center; num1 = index; } } @@ -97,7 +99,7 @@ namespace CalamityMod.Projectiles.Magic if ((Math.Abs(projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f) { flag = true; - vector2 = Main.npc[index].Center; + targetVec = Main.npc[index].Center; } } else @@ -109,7 +111,7 @@ namespace CalamityMod.Projectiles.Magic } if (flag) { - double num3 = (double)(vector2 - 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) @@ -134,7 +136,7 @@ namespace CalamityMod.Projectiles.Magic public override Color? GetAlpha(Color lightColor) { - return new Color(0, 0, 200, 0); + return new Color(200, 200, 200, 200); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -154,7 +156,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/NuclearFuryProjectile.png b/Projectiles/Magic/NuclearFuryProjectile.png index 5bd9c6a382..927eb3adce 100644 Binary files a/Projectiles/Magic/NuclearFuryProjectile.png and b/Projectiles/Magic/NuclearFuryProjectile.png differ diff --git a/Projectiles/Magic/ParticleBeamofDoom.cs b/Projectiles/Magic/ParticleBeamofDoom.cs index ba6f47b6c3..3acda19dad 100644 --- a/Projectiles/Magic/ParticleBeamofDoom.cs +++ b/Projectiles/Magic/ParticleBeamofDoom.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class ParticleBeamofDoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Doom"); diff --git a/Projectiles/Magic/ParticleBeamofDoom.png b/Projectiles/Magic/ParticleBeamofDoom.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Magic/ParticleBeamofDoom.png and /dev/null differ diff --git a/Projectiles/Magic/PartySparkle.cs b/Projectiles/Magic/PartySparkle.cs new file mode 100644 index 0000000000..58be299f5d --- /dev/null +++ b/Projectiles/Magic/PartySparkle.cs @@ -0,0 +1,120 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class PartySparkle : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float ColorSpectrumHue + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public const int Lifetime = 90; + public const int FadeinTime = 18; + public const int FadeoutTime = 18; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pretty Sparkle"); + } + + 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; + } + + public override void AI() + { + if (Time == 1f) + { + 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; + } + Time++; + + projectile.velocity *= 0.96f; + + 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); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D sparkleTexture = ModContent.GetTexture(Texture); + + 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)); + + Color orthogonalsparkleColor = Color.Lerp(sparkleColor, Color.White, 0.5f) * 0.5f; + + 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; + + spriteBatch.Draw(sparkleTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + null, + sparkleColor, + MathHelper.PiOver2 + projectile.rotation, + origin, + orthogonalsparkleScale, + SpriteEffects.None, + 0f); + spriteBatch.Draw(sparkleTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + null, + sparkleColor, + projectile.rotation, + origin, + sparkleScale, + SpriteEffects.None, + 0f); + spriteBatch.Draw(sparkleTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + null, + orthogonalsparkleColor, + MathHelper.PiOver2 + projectile.rotation, + origin, + orthogonalsparkleScale * 0.6f, + SpriteEffects.None, + 0f); + spriteBatch.Draw(sparkleTexture, + projectile.Center - Main.screenPosition + Vector2.UnitY * projectile.gfxOffY, + null, + orthogonalsparkleColor, + projectile.rotation, + origin, + sparkleScale * 0.6f, + SpriteEffects.None, + 0f); + return false; + } + } +} diff --git a/Projectiles/Boss/HolyBurnOrb.png b/Projectiles/Magic/PartySparkle.png similarity index 100% rename from Projectiles/Boss/HolyBurnOrb.png rename to Projectiles/Magic/PartySparkle.png diff --git a/Projectiles/Magic/PhantasmalFuryProj.cs b/Projectiles/Magic/PhantasmalFuryProj.cs index 14b2a4819d..93bf1dd04b 100644 --- a/Projectiles/Magic/PhantasmalFuryProj.cs +++ b/Projectiles/Magic/PhantasmalFuryProj.cs @@ -36,17 +36,16 @@ namespace CalamityMod.Projectiles.Magic projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) - { projectile.frame = 0; - } + if (projectile.timeLeft % 10 == 0) { 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, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } - 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, 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); @@ -54,7 +53,9 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; } + projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } @@ -74,15 +75,15 @@ namespace CalamityMod.Projectiles.Magic 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); + 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) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 48bfdad725..b60d0e5070 100644 --- a/Projectiles/Magic/Phantom.cs +++ b/Projectiles/Magic/Phantom.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num458].noGravity = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 30f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } } } diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 231dd0d669..8ccac7242a 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Magic { public override void SetStaticDefaults() { - DisplayName.SetDefault("Fang"); + DisplayName.SetDefault("Plague Fang"); } public override void SetDefaults() @@ -21,10 +21,10 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.magic = true; projectile.alpha = 255; - projectile.penetrate = 9; + projectile.penetrate = 6; projectile.timeLeft = 300; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/PlasmaBolt.cs b/Projectiles/Magic/PlasmaBolt.cs index e79c64fafe..56d5baf30e 100644 --- a/Projectiles/Magic/PlasmaBolt.cs +++ b/Projectiles/Magic/PlasmaBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Magic/PlasmaBolt.png b/Projectiles/Magic/PlasmaBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/PlasmaBolt.png and /dev/null differ diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index 4fe4328338..ddfe384077 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaRay : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); diff --git a/Projectiles/Magic/PlasmaRay.png b/Projectiles/Magic/PlasmaRay.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/PlasmaRay.png and /dev/null differ diff --git a/Projectiles/Magic/PlasmaRay2.cs b/Projectiles/Magic/PlasmaRay2.cs index 37ab35b144..211c944a6d 100644 --- a/Projectiles/Magic/PlasmaRay2.cs +++ b/Projectiles/Magic/PlasmaRay2.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaRay2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); diff --git a/Projectiles/Magic/PlasmaRay2.png b/Projectiles/Magic/PlasmaRay2.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/PlasmaRay2.png and /dev/null differ diff --git a/Projectiles/Magic/PlasmaShot.cs b/Projectiles/Magic/PlasmaShot.cs index 0b20c5cdfa..604d6ca0bf 100644 --- a/Projectiles/Magic/PlasmaShot.cs +++ b/Projectiles/Magic/PlasmaShot.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class PlasmaShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shot"); diff --git a/Projectiles/Magic/PlasmaShot.png b/Projectiles/Magic/PlasmaShot.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Magic/PlasmaShot.png and /dev/null differ diff --git a/Projectiles/Magic/PoseidonTyphoon.cs b/Projectiles/Magic/PoseidonTyphoon.cs index a9aaba8fda..faa8f40130 100644 --- a/Projectiles/Magic/PoseidonTyphoon.cs +++ b/Projectiles/Magic/PoseidonTyphoon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic { projectile.rotation += projectile.velocity.X * 0.05f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 6f, 30f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 6f, 30f); } public override void Kill(int timeLeft) @@ -48,7 +48,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Magic/PurgeLaser.cs b/Projectiles/Magic/PurgeLaser.cs index 4f8cf505d6..52520b9204 100644 --- a/Projectiles/Magic/PurgeLaser.cs +++ b/Projectiles/Magic/PurgeLaser.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class PurgeLaser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); @@ -54,52 +56,18 @@ namespace CalamityMod.Projectiles.Magic } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 255, 100, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) + int dustAmt = Main.rand.Next(3, 7); + for (int d = 0; d < dustAmt; d++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int nano = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 107, 0f, 0f, 100, default, 2.1f); + Main.dust[nano].velocity *= 2f; + Main.dust[nano].noGravity = true; } } } diff --git a/Projectiles/Magic/PurgeLaser.png b/Projectiles/Magic/PurgeLaser.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Magic/PurgeLaser.png and /dev/null differ diff --git a/Projectiles/Magic/PurgeProj.cs b/Projectiles/Magic/PurgeProj.cs index 7e74f57e6a..e0d68f4db5 100644 --- a/Projectiles/Magic/PurgeProj.cs +++ b/Projectiles/Magic/PurgeProj.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -10,12 +11,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Purge"); + Main.projFrames[projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 64; + projectile.width = 64; + projectile.height = 34; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; @@ -26,8 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.type == ModContent.ProjectileType()) { projectile.ai[0] += 1f; @@ -60,11 +61,12 @@ namespace CalamityMod.Projectiles.Magic { Main.PlaySound(SoundID.Item91, projectile.position); } + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; } if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) { Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); Vector2 value = projectile.Center + vector2; for (int i = 0; i < 2; i++) { @@ -77,40 +79,40 @@ namespace CalamityMod.Projectiles.Magic if (flag && Main.myPlayer == projectile.owner) { int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed; if (flag2) { - float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + float speed = player.ActiveItem().shootSpeed * projectile.scale; + Vector2 spawnPos = playerPos; + Vector2 direction = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - spawnPos; if (player.gravDir == -1f) { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + direction.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - spawnPos.Y; } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + Vector2 velocity = Vector2.Normalize(direction); + if (float.IsNaN(velocity.X) || float.IsNaN(velocity.Y)) { - vector3 = -Vector2.UnitY; + velocity = -Vector2.UnitY; } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + velocity *= speed; + if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y) { projectile.netUpdate = true; } - projectile.velocity = vector3; - int num6 = ModContent.ProjectileType(); - float scaleFactor2 = 14f; - int num7 = 7; + projectile.velocity = velocity; + int projType = ModContent.ProjectileType(); + float velocityMult = 14f; + float randNum = 7f; for (int j = 0; j < 3; j++) { - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); + spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); + 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(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(spawnPos, spinningpoint, projType, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); } } else @@ -119,8 +121,8 @@ namespace CalamityMod.Projectiles.Magic } } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + Vector2.UnitX * 8f; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); @@ -129,5 +131,9 @@ namespace CalamityMod.Projectiles.Magic player.itemAnimation = 2; 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; } } diff --git a/Projectiles/Magic/PurgeProj.png b/Projectiles/Magic/PurgeProj.png index 21af608050..6d8a7333c5 100644 Binary files a/Projectiles/Magic/PurgeProj.png and b/Projectiles/Magic/PurgeProj.png differ diff --git a/Projectiles/Magic/RainbowComet.cs b/Projectiles/Magic/RainbowComet.cs new file mode 100644 index 0000000000..3e244cfc67 --- /dev/null +++ b/Projectiles/Magic/RainbowComet.cs @@ -0,0 +1,99 @@ +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class RainbowComet : ModProjectile + { + 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; + } + + 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; + } + + 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.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); + 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, + cometTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + return false; + } + public override void Kill(int timeLeft) + { + 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); + } + + // And release a bunch of rockets. + for (int i = 0; i < (int)RainbowRocket.PartyCannonExplosionType.Count; i++) + { + 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); + rocket.ai[1] = i; + } + } + + if (!Main.dedServ) + { + for (int i = 0; i < 80; i++) + { + 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); + } + } + } +} diff --git a/Projectiles/Magic/RainbowComet.png b/Projectiles/Magic/RainbowComet.png new file mode 100644 index 0000000000..b713356be9 Binary files /dev/null and b/Projectiles/Magic/RainbowComet.png differ diff --git a/Projectiles/Magic/RainbowPartyCannonProjectile.cs b/Projectiles/Magic/RainbowPartyCannonProjectile.cs new file mode 100644 index 0000000000..da42c6a936 --- /dev/null +++ b/Projectiles/Magic/RainbowPartyCannonProjectile.cs @@ -0,0 +1,108 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class RainbowPartyCannonProjectile : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref projectile.ai[0]; + public const float ChargeDelay = 60f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Party Cannon"); + } + + public override void SetDefaults() + { + projectile.width = 92; + projectile.height = 66; + projectile.penetrate = -1; + projectile.magic = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + } + + public override void AI() + { + Item heldItem = Owner.ActiveItem(); + projectile.damage = (int)((heldItem?.damage ?? 0) * Owner.MagicDamage()); + + UpdatePlayerVisuals(Owner.Center); + + bool stillUsingCannon = Owner.channel && !Owner.noItems && !Owner.CCed; + if (!stillUsingCannon) + { + projectile.Kill(); + return; + } + + if (Time > ChargeDelay && Time % heldItem.useTime == 0) + { + ConsumeManaAndFireProjectile(heldItem); + } + else if (Time <= ChargeDelay && !Main.dedServ) + { + 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)); + } + } + + Time++; + + // Forces the cannon to disappear immediately if anything goes wrong. + projectile.timeLeft = 2; + } + + public void ConsumeManaAndFireProjectile(Item heldItem) + { + if (Owner.whoAmI != Main.myPlayer) + return; + + if (!Owner.CheckMana(heldItem.mana, true)) + { + projectile.Kill(); + return; + } + + Main.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; + + 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; + + // 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); + + 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.itemTime = 2; + Owner.itemAnimation = 2; + + 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/RainbowPartyCannonProjectile.png b/Projectiles/Magic/RainbowPartyCannonProjectile.png new file mode 100644 index 0000000000..59c2f21ef9 Binary files /dev/null and b/Projectiles/Magic/RainbowPartyCannonProjectile.png differ diff --git a/Projectiles/Magic/RainbowRocket.cs b/Projectiles/Magic/RainbowRocket.cs new file mode 100644 index 0000000000..6b2b51ff60 --- /dev/null +++ b/Projectiles/Magic/RainbowRocket.cs @@ -0,0 +1,702 @@ +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class RainbowRocket : ModProjectile + { + public enum PartyCannonExplosionType + { + Pink = 0, + Orange = 1, + Yellow = 2, + White = 3, + SkyBlue = 4, + Purple = 5, + PalePink = 6, + Count = 7 + } + + internal PrimitiveTrail TrailDrawer = null; + public ref float Time => ref projectile.ai[0]; + public PartyCannonExplosionType RocketType + { + get => (PartyCannonExplosionType)(int)projectile.ai[1]; + set => projectile.ai[1] = (int)value; + } + public const float SwerveAngle = 0.02f; + public const float SwerveAngleOffsetMax = 0.04f; + public const float SwerveTime = 60f; + public const float HomingAcceleration = 0.4f; + 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; + } + + public override void SetDefaults() + { + projectile.width = 28; + projectile.height = 52; + + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + projectile.magic = true; + } + + #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()); + + projectile.tileCollide = Time > 60f; + + projectile.frameCounter++; + if (projectile.frameCounter % 4 == 3) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + + 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; + } + + private void DoMovement_IdleSwerveFly() + { + float swerveAngleOffset = MathHelper.Lerp(-SwerveAngleOffsetMax, SwerveAngleOffsetMax, (float)RocketType / ((float)PartyCannonExplosionType.Count)); + 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); + + if (Vector2.Dot(projectile.velocity.SafeNormalize(Vector2.Zero), projectile.SafeDirectionTo(target.Center)) < 0.75f) + projectile.velocity *= 0.75f; + } + #endregion + + #region Draw Effects + + internal Color GetRocketColor() + { + switch (RocketType) + { + case PartyCannonExplosionType.Pink: + return Color.Pink; + case PartyCannonExplosionType.Orange: + return Color.Orange; + case PartyCannonExplosionType.Yellow: + return Color.LightGoldenrodYellow * 0.8f; + case PartyCannonExplosionType.White: + return Color.LightGray; + case PartyCannonExplosionType.SkyBlue: + return Color.LightSkyBlue; + case PartyCannonExplosionType.Purple: + return Color.Magenta; + case PartyCannonExplosionType.PalePink: + return Color.Pink * 0.77f; + } + return Color.White; + } + + 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; + } + + internal float WidthFunction(float completionRatio) + { + float width; + float maxWidthOutwardness = 8f; + if (completionRatio < 0.1f) + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + + Texture2D rocketTexture = ModContent.GetTexture(Texture); + spriteBatch.Draw(rocketTexture, + projectile.Center - Main.screenPosition, + rocketTexture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame), + GetRocketColor(), + projectile.rotation, + rocketTexture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + return false; + } + #endregion + + #region Kill Effects + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + 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); + spawnVelocity = spawnVelocity.RotatedBy(offsetAngle); + spawnVelocity *= Main.rand.NextFloat(12f, 18f); + Projectile.NewProjectile(spawnPosition, spawnVelocity, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + } + } + } + + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 350); + projectile.Damage(); + + Main.PlaySound(SoundID.Item14, projectile.Center); + + // There's no need to spawn dust from the server. + if (Main.dedServ) + return; + + switch (RocketType) + { + case PartyCannonExplosionType.Pink: + PinkMarkExplosionDust(); + break; + case PartyCannonExplosionType.Orange: + OrangeMarkExplosionDust(); + break; + case PartyCannonExplosionType.Yellow: + YellowMarkExplosionDust(); + break; + case PartyCannonExplosionType.White: + WhiteMarkExplosionDust(); + break; + case PartyCannonExplosionType.SkyBlue: + SkyBlueMarkExplosionDust(); + break; + case PartyCannonExplosionType.Purple: + PurpleMarkExplosionDust(); + break; + case PartyCannonExplosionType.PalePink: + PalePinkMarkExplosionDust(); + break; + } + } + #endregion + + #region Pink Mark + public void PinkMarkExplosionDust() + { + // Spawn the main balloon. + 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); + + 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); + } + public void BalloonExplosionDust(Vector2 center, float petalBurstSpeed, Color balloonColor, float absoluteOffsetAngle = 0) + { + float explosionOffsetAngle = Main.rand.NextFloat(-0.3f, 0.3f) + absoluteOffsetAngle; + + // Draw the balloon as a petal. + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(4f)) + { + Vector2 initialUnitVector = angle.ToRotationVector2(); + float unitMultiplier = 2f + (1f + (float)Math.Cos(MathHelper.Pi + angle)); // This value is used to "squash" the circle to make it into a petal shape. + Vector2 velocity = initialUnitVector * unitMultiplier; + velocity.X *= 0.5f; + velocity = velocity.SafeNormalize(Vector2.Zero); // Turn the petal velocity into a unit vector again to make future speed calculations easier. + velocity = velocity.RotatedBy(MathHelper.PiOver2); // Flip the petal velocity. It's tilted to the side normally. + velocity = velocity.RotatedBy(explosionOffsetAngle); // Account for the explosion offset angle that was determined at the start. + + Dust dust = Dust.NewDustPerfect(center, 261); + dust.velocity = velocity * petalBurstSpeed; + dust.noGravity = true; + dust.color = balloonColor; + dust.fadeIn = 1.5f; + } + + // Draw the string below the petal, giving it the appearance of a balloon. + StringExplosionDust(center, petalBurstSpeed, explosionOffsetAngle); + } + public void StringExplosionDust(Vector2 center, float petalBurstSpeed, float offsetAngle) + { + int evaluationPoints = 40; + + // When mapped out, these points give a rough string, which when used with a bezier curve, can be smoothened out to make it look like a real string. + Vector2[] bezierControlPoints = new Vector2[] + { + new Vector2(0f, 40f), + new Vector2(20f, 76f), + new Vector2(-16f, 108f), + new Vector2(-20f, 146f), + new Vector2(-14f, 180f), + new Vector2(10f, 214f) + }; + BezierCurve bezierCurve = new BezierCurve(bezierControlPoints); + for (int i = 0; i < evaluationPoints; i++) + { + Dust dust = Dust.NewDustPerfect(center, 261); + dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints).RotatedBy(offsetAngle) + Vector2.UnitY * petalBurstSpeed * 2f; + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.color = Color.White; + dust.fadeIn = 1.5f; + } + } + #endregion + + #region Orange Mark + public void OrangeMarkExplosionDust() + { + // Spawn the main apple. + 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); + + 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); + } + public void AppleExplosionDust(Vector2 center, float appleBurstSpeed, float offsetAngle = 0f) + { + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(4f)) + { + Vector2 initialUnitVector = angle.ToRotationVector2(); + float cosineValue = (float)Math.Cos(angle); + + Vector2 velocity = initialUnitVector; + + velocity = velocity.SafeNormalize(Vector2.Zero); // Turn the petal velocity into a unit vector again to make future speed calculations easier. + velocity.X *= 1.333f; + + // Squash the circle to the shape of an apple. + if (Math.Abs(cosineValue) < 0.35f) + { + velocity.Y *= MathHelper.Lerp(0.9f, 1f, Math.Abs(cosineValue) / 0.35f); + + // Squash the upper part slightly more than the lower part. + if (Math.Sign(cosineValue) == 1f) + { + velocity.Y *= 0.85f; + } + } + + velocity = velocity.RotatedBy(offsetAngle); // Account for the explosion offset angle that was determined at the start. + + Dust dust = Dust.NewDustPerfect(center, 261); + dust.velocity = velocity * appleBurstSpeed; + dust.noGravity = true; + dust.color = Color.Orange; + dust.fadeIn = 1.5f; + } + AppleLeafExplosionDust(center + new Vector2(0f, -54).RotatedBy(offsetAngle), offsetAngle); + } + public void AppleLeafExplosionDust(Vector2 center, float offsetAngle) + { + int evaluationPoints = 40; + + // When mapped out, these points give a rough apple stem shape. + Vector2[] bezierControlPoints = new Vector2[] + { + new Vector2(0f, 0f), + new Vector2(-20f, -26f), + new Vector2(-26f, -46f), + new Vector2(-30f, -60f), + new Vector2(-24f, -70f), + new Vector2(-10f, -40f), + new Vector2(0f, 0f), + }; + BezierCurve bezierCurve = new BezierCurve(bezierControlPoints); + for (int i = 0; i < evaluationPoints; i++) + { + Dust dust = Dust.NewDustPerfect(center, 261); + dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints).RotatedBy(offsetAngle); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.color = Color.Brown; + dust.fadeIn = 1.5f; + } + } + #endregion + + #region Yellow Mark + public void YellowMarkExplosionDust() + { + // Spawn three butterflies. + 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)); + + 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)); + } + public void ButterflyExplosionDust(Vector2 center, float butterflyBurstSpeed, float offsetAngle = 0f) + { + int petalCount = 4; + // Draw the butterfly as a petal with 4 sides. + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(4f)) + { + Vector2 initialUnitVector = angle.ToRotationVector2(); + float unitMultiplier = 2f + (1f + (float)Math.Cos(angle * petalCount)); // This value is used to "squash" the circle to make it into a petal shape. + Vector2 velocity = initialUnitVector * unitMultiplier; + velocity = velocity.RotatedBy(MathHelper.PiOver4 + MathHelper.PiOver2); // Tilt the vector to make it look like an actual butterfly. + velocity = velocity.RotatedBy(offsetAngle); + velocity *= 0.25f; // Normalization removes the spaces that make the vector petal-like and not circular, so multiplication must be utilized instead. + + Dust dust = Dust.NewDustPerfect(center, 262); + dust.velocity = velocity * butterflyBurstSpeed; + dust.noGravity = true; + dust.color = Color.Pink; + dust.fadeIn = 1.5f; + } + ButterflyAntennaExplosionDust(center + new Vector2(0f, -74f).RotatedBy(offsetAngle), offsetAngle); + } + public void ButterflyAntennaExplosionDust(Vector2 center, float offsetAngle = 0f) + { + int evaluationPoints = 40; + + // When mapped out, these points give a rough apple stem shape. + Vector2[] bezierControlPoints = new Vector2[] + { + new Vector2(0f, 60f), + new Vector2(0f, 30f), + new Vector2(10f, -28f), + new Vector2(20f, -42f), + new Vector2(30f, -48f), + new Vector2(42f, -40f), + new Vector2(50f, -30f), + new Vector2(52f, -24f), + }; + BezierCurve bezierCurve = new BezierCurve(bezierControlPoints); + for (int i = 0; i < evaluationPoints; i++) + { + Dust dust = Dust.NewDustPerfect(center, 263); + dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints).RotatedBy(offsetAngle); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.color = Color.SkyBlue; + dust.fadeIn = 1.5f; + + dust = Dust.CloneDust(dust); + dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints).RotatedBy(offsetAngle) * new Vector2(-1f, 1f); + } + } + #endregion + + #region White Mark + public void WhiteMarkExplosionDust() + { + // Spawn three diamonds. + 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)); + + 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)); + } + public void DiamondExplosionDust(Vector2 center, float diamondBurstSpeed, float offsetAngle = 0f) + { + int dustCount = 80; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingVelocity = Vector2.Zero; + Vector2 endingVelocity = Vector2.Zero; + + switch (i / (dustCount / 4)) + { + case 0: + startingVelocity = Vector2.UnitY; + endingVelocity = Vector2.UnitX; + break; + case 1: + startingVelocity = Vector2.UnitX; + endingVelocity = -Vector2.UnitY; + break; + case 2: + startingVelocity = -Vector2.UnitY; + endingVelocity = -Vector2.UnitX; + break; + case 3: + startingVelocity = -Vector2.UnitX; + endingVelocity = Vector2.UnitY; + break; + } + Vector2 velocity = Vector2.Lerp(startingVelocity, endingVelocity, i / (dustCount / 4f) % 1f); + velocity = velocity.RotatedBy(offsetAngle); + velocity *= diamondBurstSpeed; + velocity.X *= 0.667f; + + Dust dust = Dust.NewDustPerfect(center, 263); + dust.position = center; + dust.velocity = velocity; + dust.noGravity = true; + dust.color = Color.LightSteelBlue; + dust.fadeIn = 1.5f; + } + } + #endregion + + #region Sky Blue Mark + public void SkyBlueMarkExplosionDust() + { + RainbowBoltExplosionDust(projectile.Center, Main.rand.NextFloat(-0.2f, 0.2f)); + } + public void RainbowBoltExplosionDust(Vector2 center, float offsetAngle = 0f) + { + // Spawn several clouds. + for (int i = 0; i < 5; i++) + { + CloudExplosionDust(center, offsetAngle); + } + LightningExplosionDust(center, offsetAngle); + } + public void CloudExplosionDust(Vector2 center, float offsetAngle = 0f) + { + center += Main.rand.NextVector2CircularEdge(40f, 40f); + Vector2 offset = Main.rand.NextVector2Square(0.9f, 1.15f); + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(2f)) + { + Vector2 initialUnitVector = angle.ToRotationVector2(); + Vector2 spawnOffset = initialUnitVector.RotatedBy(offsetAngle); + spawnOffset = spawnOffset.RotatedByRandom(0.4f); + spawnOffset *= new Vector2(54f, 36f) * offset; + + spawnOffset -= Vector2.UnitY.RotatedBy(offsetAngle) * 90f; + + Dust dust = Dust.NewDustPerfect(center + spawnOffset, 263); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.scale = 2.7f; + dust.fadeIn = 1.5f; + } + } + public void LightningExplosionDust(Vector2 center, float offsetAngle = 0f) + { + int evaluationPoints = 65; + + // When mapped out, these points give a rough (but slightly weird) lightning bolt. + Vector2[] controlPoints = new Vector2[] + { + new Vector2(-38f, -64f), + new Vector2(-42f, -44f), + new Vector2(-26f, -28f), + new Vector2(-24f, -10f), + new Vector2(-34f, -4f), + new Vector2(-48f, -10f), + new Vector2(-40f, 12f), + new Vector2(-30f, 30f), + new Vector2(-20f, 48f), + new Vector2(-8f, 28f), + new Vector2(2f, 6f), + new Vector2(-8f, -4f), + new Vector2(4f, -16f), + new Vector2(8f, -36f), + new Vector2(12f, -56f), + new Vector2(-38f, -64f) + }; + for (int i = 0; i < evaluationPoints; i++) + { + int currentIndex = (int)(i / (float)evaluationPoints * controlPoints.Length); + Vector2 currentPosition = controlPoints[currentIndex]; + Vector2 nextPosition = controlPoints[(currentIndex + 1) % controlPoints.Length]; + + Dust dust = Dust.NewDustPerfect(center, 263); + dust.position = center + Vector2.Lerp(currentPosition, nextPosition, i / (float)evaluationPoints * controlPoints.Length % 0.999f).RotatedBy(offsetAngle) * 2f; + dust.position += Vector2.UnitY.RotatedBy(offsetAngle) * 138f; + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.color = Main.hslToRgb(i / (float)evaluationPoints * 3f % 1f, 0.6f, 0.7f); + dust.scale = 1.4f; + dust.fadeIn = 1.5f; + } + + center += Main.rand.NextVector2CircularEdge(120f, 120f); + Vector2 offset = Main.rand.NextVector2Square(0.9f, 1.15f); + for (float angle = 0f; angle <= MathHelper.TwoPi; angle += MathHelper.ToRadians(2f)) + { + Vector2 initialUnitVector = angle.ToRotationVector2(); + Vector2 spawnOffset = initialUnitVector.RotatedBy(offsetAngle); + spawnOffset = spawnOffset.RotatedByRandom(0.4f); + spawnOffset *= new Vector2(130f, 84f) * offset; + + spawnOffset += Vector2.UnitY.RotatedBy(offsetAngle) * 30f; + + Dust dust = Dust.NewDustPerfect(center + spawnOffset, 263); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.scale = 4f; + dust.fadeIn = 1.5f; + } + } + #endregion + + #region Purple Mark + public void PurpleMarkExplosionDust() + { + 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)); + } + } + public void TwilightStarExplosionDust(Vector2 center, float petalBurstSpeed, Color starColor, float absoluteOffsetAngle = 0f) + { + int pointsOnStar = 6; + for (int i = 0; i < pointsOnStar; i++) + { + float angle = MathHelper.Pi * 1.5f - i * MathHelper.TwoPi / pointsOnStar; + float nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / pointsOnStar; + Vector2 start = angle.ToRotationVector2(); + Vector2 end = nextAngle.ToRotationVector2(); + int pointsOnStarSegment = 35; + for (int j = 0; j < pointsOnStarSegment; j++) + { + Dust dust = Dust.NewDustPerfect(center, 263); + dust.scale = 1.8f; + dust.velocity = Vector2.Lerp(start, end, j / (float)pointsOnStarSegment) * petalBurstSpeed; + dust.velocity.X *= 0.7f; + dust.velocity = dust.velocity.RotatedBy(absoluteOffsetAngle); + dust.fadeIn = 1.5f; + dust.color = starColor; + dust.noGravity = true; + } + } + } + #endregion + + #region Pale Pink Mark + public void PalePinkMarkExplosionDust() + { + StarlightMarkExplosionDust(projectile.Center); + StarlightStarExplosionDust(projectile.Center + new Vector2(16f, 36f), 2f); + } + public void StarlightMarkExplosionDust(Vector2 center) + { + int evaluationPoints = 60; + + // When mapped out, these points give a rough swerving stream shape. + Vector2[] bezierControlPoints = new Vector2[] + { + new Vector2(-38f, -58f), + new Vector2(-22f, -34f), + new Vector2(-10f, -22f), + new Vector2(6f, -11f), + new Vector2(13f, 1f), + new Vector2(-20f, 11f), + new Vector2(16f, 11f), + new Vector2(26f, 6f), + new Vector2(24f, -11f), + new Vector2(8f, -28f), + new Vector2(-10f, -39f), + new Vector2(-38f, -58f) + }; + BezierCurve bezierCurve = new BezierCurve(bezierControlPoints); + + for (int i = 0; i < evaluationPoints; i++) + { + Dust dust = Dust.NewDustPerfect(center, 263); + dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints) * new Vector2(3f, 1.7f); + dust.velocity = Vector2.Zero; + dust.color = i >= evaluationPoints / 2 ? Color.Cyan : Color.SkyBlue; + dust.fadeIn = 1.5f; + dust.scale = 1.4f; + dust.noGravity = true; + + dust = Dust.CloneDust(dust); + dust.position = center + bezierCurve.Evaluate(i / (float)evaluationPoints) * new Vector2(1f, -1f) + new Vector2(30f, -12f); + } + } + public void StarlightStarExplosionDust(Vector2 center, float starBurstSpeed) + { + int dustCount = 60; + for (int i = 0; i < dustCount; i++) + { + Vector2 startingVelocity = Vector2.Zero; + Vector2 endingVelocity = Vector2.Zero; + + switch (i / (dustCount / 4)) + { + case 0: + startingVelocity = Vector2.UnitY; + endingVelocity = Vector2.UnitX; + break; + case 1: + startingVelocity = Vector2.UnitX; + endingVelocity = -Vector2.UnitY; + break; + case 2: + startingVelocity = -Vector2.UnitY; + endingVelocity = -Vector2.UnitX; + break; + case 3: + startingVelocity = -Vector2.UnitX; + endingVelocity = Vector2.UnitY; + break; + } + Vector2 velocity = Vector2.Lerp(startingVelocity, endingVelocity, i / (dustCount / 4f) % 1f); + velocity *= starBurstSpeed; + velocity.X *= 0.75f; + + Dust dust = Dust.NewDustPerfect(center, 263); + dust.position = center; + dust.velocity = velocity; + dust.noGravity = true; + dust.color = Color.Purple; + dust.fadeIn = 1.5f; + + dust = Dust.CloneDust(dust); + dust.velocity = dust.velocity.RotatedBy(MathHelper.PiOver4); + dust.color = Color.White; + } + } + #endregion + } +} diff --git a/Projectiles/Magic/RainbowRocket.png b/Projectiles/Magic/RainbowRocket.png new file mode 100644 index 0000000000..7ff99fa614 Binary files /dev/null and b/Projectiles/Magic/RainbowRocket.png differ diff --git a/Projectiles/Magic/RedirectingFire.cs b/Projectiles/Magic/RedirectingFire.cs new file mode 100644 index 0000000000..d738f7a43a --- /dev/null +++ b/Projectiles/Magic/RedirectingFire.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +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 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; + } + + public override void AI() + { + if (Time >= 18f) + { + 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; + } + EmitDust(); + Time++; + } + + public void HomeInOnTarget(NPC target) + { + 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; + } + + 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 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.color = dustColor; + dust.noGravity = true; + dust.noLight = true; + return dust; + } + + public void EmitDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 5; i++) + { + Dust dust = CreateDustInstance(); + dust.velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2(); + dust.position += projectile.velocity; + dust.scale = MathHelper.Lerp(1f, 1.5f, BurstIntensity) * Main.rand.NextFloat(0.7f, 1.3f); + } + } + + public override void Kill(int timeLeft) + { + // Emit some fire sounds. + Main.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); + 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); + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Magic/RedirectingGildedSoul.cs b/Projectiles/Magic/RedirectingGildedSoul.cs new file mode 100644 index 0000000000..d54269ddb3 --- /dev/null +++ b/Projectiles/Magic/RedirectingGildedSoul.cs @@ -0,0 +1,87 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Gilded Soul"); + 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; + } + + 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 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; + } + + 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; + for (int i = 0; i < 4; i++) + { + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + } + + return false; + } + + 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); + + // As well as an "extinguished" sound. + Main.PlaySound(SoundID.NPCDeath55, projectile.Center); + + // Make a ghost sound and explode into ectoplasmic energy. + if (Main.dedServ) + return; + + for (int i = 0; i < 45; i++) + { + 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.scale = MathHelper.Lerp(1f, 1.6f, BurstIntensity); + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Magic/RedirectingGildedSoul.png b/Projectiles/Magic/RedirectingGildedSoul.png new file mode 100644 index 0000000000..ecffa8c8a3 Binary files /dev/null and b/Projectiles/Magic/RedirectingGildedSoul.png differ diff --git a/Projectiles/Magic/RedirectingLostSoul.cs b/Projectiles/Magic/RedirectingLostSoul.cs new file mode 100644 index 0000000000..d11a8cf8a8 --- /dev/null +++ b/Projectiles/Magic/RedirectingLostSoul.cs @@ -0,0 +1,81 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul"); + 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; + } + + 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 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; + } + + 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); + + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + + return false; + } + + 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); + + // Make a ghost sound and explode into ectoplasmic energy. + if (Main.dedServ) + return; + + for (int i = 0; i < 45; i++) + { + 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.scale = MathHelper.Lerp(1f, 1.6f, BurstIntensity); + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Magic/RedirectingLostSoul.png b/Projectiles/Magic/RedirectingLostSoul.png new file mode 100644 index 0000000000..f02bca1221 Binary files /dev/null and b/Projectiles/Magic/RedirectingLostSoul.png differ diff --git a/Projectiles/Magic/RedirectingVengefulSoul.cs b/Projectiles/Magic/RedirectingVengefulSoul.cs new file mode 100644 index 0000000000..fd9ce2250c --- /dev/null +++ b/Projectiles/Magic/RedirectingVengefulSoul.cs @@ -0,0 +1,126 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul"); + 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; + } + + public override void AI() => DoSoulAI(projectile, ref Time, 2f); + + public static void DoSoulAI(Projectile projectile, ref float time, float soulPower) + { + if (time >= 20f) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1250f, false); + if (potentialTarget != null) + HomeInOnTarget(projectile, potentialTarget, time); + + float accelerationFactor = MathHelper.SmoothStep(1.03f, 1.015f, Utils.InverseLerp(6f, 24f, projectile.velocity.Length(), true)); + if (projectile.velocity.Length() < 21f + soulPower * 2f) + projectile.velocity *= accelerationFactor; + } + projectile.Opacity = Utils.InverseLerp(0f, 15f, time, true); + projectile.frameCounter++; + if (projectile.frameCounter % 5f == 4f) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + + projectile.rotation = projectile.velocity.ToRotation(); + projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + if (projectile.spriteDirection == -1) + projectile.rotation += MathHelper.Pi; + + time++; + } + + public static void HomeInOnTarget(Projectile projectile, NPC target, float time) + { + 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 + projectile.SafeDirectionTo(target.Center) * 3f).SafeNormalize(Vector2.UnitY) * oldSpeed; + } + + public override Color? GetAlpha(Color lightColor) + { + 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; + } + + 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); + for (int i = 0; i < 4; i++) + { + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + } + + return false; + } + + 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); + + // Make a ghost sound and explode into ectoplasmic energy. + if (Main.dedServ) + return; + + for (int i = 0; i < 45; i++) + { + 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.scale = MathHelper.Lerp(1.2f, 1.9f, BurstIntensity); + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + + ectoplasm = Dust.NewDustPerfect(projectile.Center, 264); + ectoplasm.velocity = (MathHelper.TwoPi * i / 45f).ToRotationVector2() * 6f; + 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/RedirectingVengefulSoul.png b/Projectiles/Magic/RedirectingVengefulSoul.png new file mode 100644 index 0000000000..3e0e4507b7 Binary files /dev/null and b/Projectiles/Magic/RedirectingVengefulSoul.png differ diff --git a/Projectiles/Magic/RougeSlashLarge.cs b/Projectiles/Magic/RougeSlashLarge.cs index c59f932ab1..3908dbef0d 100644 --- a/Projectiles/Magic/RougeSlashLarge.cs +++ b/Projectiles/Magic/RougeSlashLarge.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.ignoreWater = true; projectile.magic = true; - projectile.penetrate = 5; + projectile.penetrate = 3; projectile.alpha = 255; projectile.timeLeft = 300; } @@ -32,36 +32,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(projectile.Center, 0.75f, 0f, 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.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.alpha > 0) + projectile.alpha -= 17; + projectile.localAI[1] += 1f; if (projectile.localAI[1] == 12f) { projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - 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); + 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); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; @@ -80,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 b20d87f399..6e3c4ac021 100644 --- a/Projectiles/Magic/RougeSlashMedium.cs +++ b/Projectiles/Magic/RougeSlashMedium.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.ignoreWater = true; projectile.magic = true; - projectile.penetrate = 5; + projectile.penetrate = 2; projectile.alpha = 255; projectile.timeLeft = 300; } @@ -32,36 +32,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(projectile.Center, 0.75f, 0f, 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.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.alpha > 0) + projectile.alpha -= 17; + + projectile.localAI[1] += 1f; if (projectile.localAI[1] == 12f) { projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - 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); + 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); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; @@ -80,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 40381f5745..5d61c1bb18 100644 --- a/Projectiles/Magic/RougeSlashSmall.cs +++ b/Projectiles/Magic/RougeSlashSmall.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.ignoreWater = true; projectile.magic = true; - projectile.penetrate = 5; + projectile.penetrate = 1; projectile.alpha = 255; projectile.timeLeft = 300; } @@ -32,36 +32,21 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(projectile.Center, 0.75f, 0f, 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.alpha = 255; - projectile.localAI[0] = 1f; - } - } - else if (projectile.localAI[0] == 1f) - { - projectile.scale += 0.01f; - projectile.alpha -= 15; - if (projectile.alpha <= 0) - { - projectile.alpha = 0; - projectile.localAI[0] = 0f; - } - } - projectile.localAI[1] += 1f; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + if (projectile.alpha > 0) + projectile.alpha -= 17; + + projectile.localAI[1] += 1f; if (projectile.localAI[1] == 12f) { projectile.localAI[1] = 0f; for (int l = 0; l < 12; l++) { - 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); + 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); Main.dust[num9].scale = 1.1f; Main.dust[num9].noGravity = true; @@ -80,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SHPExplosion.cs b/Projectiles/Magic/SHPExplosion.cs index 4b7c1646a1..e0839848d4 100644 --- a/Projectiles/Magic/SHPExplosion.cs +++ b/Projectiles/Magic/SHPExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class SHPExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Magic/SHPExplosion.png b/Projectiles/Magic/SHPExplosion.png deleted file mode 100644 index 3cb685553d..0000000000 Binary files a/Projectiles/Magic/SHPExplosion.png and /dev/null differ diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index af8553ca67..256a339cba 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class SHPL : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); @@ -55,65 +57,24 @@ namespace CalamityMod.Projectiles.Magic } } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) + int dustAmt = Main.rand.Next(3, 7); + for (int d = 0; d < dustAmt; d++) { - int randomDust = Main.rand.Next(3); - if (randomDust == 0) - { - randomDust = 246; - } - else if (randomDust == 1) - { - randomDust = 73; - } - else - { - randomDust = 187; - } - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, randomDust, 0f, 0f, 100, default, 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 246, + 73, + 187 + }); + 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/SHPL.png b/Projectiles/Magic/SHPL.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Magic/SHPL.png and /dev/null differ diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 536dcf5ad5..cd58f02b41 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -89,10 +89,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) - { + + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; - } + Player player = Main.player[projectile.owner]; player.statLife += 1; player.HealEffect(1); @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 937b9a9b5d..6366ab6f4c 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Magic { public class SeethingDischargeBrimstoneBarrage : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneBarrage"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone"); @@ -56,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.png b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.png deleted file mode 100644 index 7664f14d4e..0000000000 Binary files a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.png and /dev/null differ diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index 37e3b42014..7fde79c1bc 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -10,6 +10,9 @@ namespace CalamityMod.Projectiles.Magic { public class SeethingDischargeBrimstoneHellblast : ModProjectile { + private bool initialized = false; + public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellblast"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hellblast"); @@ -33,6 +36,16 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + if (!initialized) + { + if (projectile.npcProj) + { + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.penetrate = 10; + } + initialized = true; + } projectile.frameCounter++; if (projectile.frameCounter >= 10) { @@ -71,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.png b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.png deleted file mode 100644 index dd8e4e8aa4..0000000000 Binary files a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.png and /dev/null differ diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs index 7dd735cb8c..5bc40ff9c6 100644 --- a/Projectiles/Magic/ShadeNimbus.cs +++ b/Projectiles/Magic/ShadeNimbus.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Magic { public class ShadeNimbus : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); diff --git a/Projectiles/Magic/ShadeNimbus.png b/Projectiles/Magic/ShadeNimbus.png deleted file mode 100644 index 234d306f54..0000000000 Binary files a/Projectiles/Magic/ShadeNimbus.png and /dev/null differ diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index cc755143c4..47a2db00fe 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -27,8 +27,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Lighting.AddLight(projectile.Center, 0.15f, 0f, 0.15f); + projectile.rotation += projectile.velocity.X * 0.2f; - projectile.ai[1] += 1f; + 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); @@ -36,11 +37,14 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num300].velocity *= 0.2f; Main.dust[num300].scale *= 0.8f; } + projectile.velocity *= 0.99f; - if (projectile.ai[1] > 90f) + + projectile.ai[1] += 1f; + if (projectile.ai[1] > 90f) { projectile.scale -= 0.05f; - if ((double)projectile.scale <= 0.2) + if (projectile.scale <= 0.2) { projectile.scale = 0.2f; projectile.Kill(); @@ -50,12 +54,21 @@ namespace CalamityMod.Projectiles.Magic } } - public override void Kill(int timeLeft) + 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; + + return false; + } + + 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); - } } 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 ee94a7cf7d..180c13b562 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class Shaderain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/ShaderainHostile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Rain"); diff --git a/Projectiles/Magic/Shaderain.png b/Projectiles/Magic/Shaderain.png deleted file mode 100644 index 56fa0aa8a6..0000000000 Binary files a/Projectiles/Magic/Shaderain.png and /dev/null differ diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index b3ac1cf886..2c64a9c432 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class Shadowbolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -18,16 +20,17 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; + projectile.ignoreWater = true; + projectile.penetrate = 6; projectile.extraUpdates = 100; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 10; } public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)(projectile.damage * 1.25); + projectile.damage = (int)(projectile.damage * 1.15); projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -35,7 +38,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -48,14 +50,10 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (target.type == NPCID.TargetDummy) - { - return; - } - projectile.damage = (int)((double)projectile.damage * 1.1); - } + 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); + } public override void AI() { diff --git a/Projectiles/Magic/Shadowbolt.png b/Projectiles/Magic/Shadowbolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/Shadowbolt.png and /dev/null differ diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index 2b842424c7..92e65748bb 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SirensSongNote.cs b/Projectiles/Magic/SirensSongNote.cs index ad10ad81b1..b671eb022c 100644 --- a/Projectiles/Magic/SirensSongNote.cs +++ b/Projectiles/Magic/SirensSongNote.cs @@ -30,48 +30,44 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { if (projectile.velocity.Length() > 4f) - { projectile.velocity *= 0.985f; - } + if (projectile.localAI[0] == 0f) { projectile.scale += 0.02f; if (projectile.scale >= 1.25f) - { projectile.localAI[0] = 1f; - } } else if (projectile.localAI[0] == 1f) { projectile.scale -= 0.02f; if (projectile.scale <= 0.75f) - { projectile.localAI[0] = 0f; - } } + if (projectile.ai[1] == 0f) { projectile.ai[1] = 1f; Main.harpNote = projectile.ai[0]; Main.PlaySound(SoundID.Item26, projectile.position); } + Lighting.AddLight(projectile.Center, 0f, 0f, 1.2f); + if (projectile.velocity.X > 0f) - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); else - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)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.Y != oldVelocity.Y) - { projectile.velocity.Y = -oldVelocity.Y; - } + return false; } @@ -80,15 +76,15 @@ namespace CalamityMod.Projectiles.Magic if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(50f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(50f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 50); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SlitheringEelBody.png b/Projectiles/Magic/SlitheringEelBody.png new file mode 100644 index 0000000000..0ceb4bf20e Binary files /dev/null and b/Projectiles/Magic/SlitheringEelBody.png differ diff --git a/Projectiles/Magic/SlitheringEelBody2.png b/Projectiles/Magic/SlitheringEelBody2.png new file mode 100644 index 0000000000..9ca8b31166 Binary files /dev/null and b/Projectiles/Magic/SlitheringEelBody2.png differ diff --git a/Projectiles/Magic/SlitheringEelProjectile.cs b/Projectiles/Magic/SlitheringEelProjectile.cs index b489a2cf15..52ee1e6edc 100644 --- a/Projectiles/Magic/SlitheringEelProjectile.cs +++ b/Projectiles/Magic/SlitheringEelProjectile.cs @@ -10,10 +10,22 @@ namespace CalamityMod.Projectiles.Magic { public class SlitheringEelProjectile : ModProjectile { + public struct EelSegment + { + public Vector2 CurrentPosition; + public float Rotation; + public EelSegment(Vector2 position, float rotation) + { + CurrentPosition = position; + Rotation = rotation; + } + } + + public EelSegment[] Segments = new EelSegment[10]; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eel"); - Main.projFrames[projectile.type] = 4; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -28,66 +40,115 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 360; - projectile.alpha = 0; + projectile.Opacity = 0f; } public override void AI() { - if (projectile.frameCounter++ % 8f == 7f) - { - projectile.frame++; - } - if (projectile.frame >= Main.projFrames[projectile.type]) - { - projectile.frame = 0; - } projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = (projectile.spriteDirection * projectile.velocity).ToRotation(); - if (projectile.ai[0] >= 3f) + projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.numHits >= 3f) { projectile.alpha += 5; if (projectile.alpha >= 255) - { projectile.Kill(); - } } + else + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.1f, 0f, 1f); + 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); } + 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; + + // Connect all segments to each-other and calculate their rotations. + for (int i = 0; i < Segments.Length; i++) + { + Vector2 offsetToDestination = aheadPosition - Segments[i].CurrentPosition; + + // This variant of segment attachment incorporates rotation. + // 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) + { + float offsetAngle = MathHelper.WrapAngle(aheadRotation - projectile.rotation) * 0.03f; + offsetToDestination = offsetToDestination.RotatedBy(offsetAngle); + } + Segments[i].Rotation = (aheadPosition - Segments[i].CurrentPosition).ToRotation(); + Segments[i].CurrentPosition = aheadPosition - offsetToDestination.SafeNormalize(Vector2.UnitY) * 13f; + + // Adjust the ahead positions before interating further. + aheadPosition = Segments[i].CurrentPosition; + aheadRotation = Segments[i].Rotation; } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 1); + 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"); + + Vector2 drawPosition; + lightColor = new Color(255, 255, 255, 127); + for (int i = 0; i < Segments.Length; i++) + { + Texture2D textureToUse = i % 2 == 1 ? bodyTexture2 : bodyTexture; + + // Use the tail texture for the last segment. + if (i == Segments.Length - 1) + 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); + } + + 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; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + for (int i = 0; i < Segments.Length; i++) + { + if (targetHitbox.Intersects(Utils.CenteredRectangle(Segments[i].CurrentPosition, Vector2.One * 12f))) + return true; + } + return null; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.ai[0]++; target.AddBuff(BuffID.Venom, 180); target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPvp(Player target, int damage, bool crit) { - projectile.ai[0]++; target.AddBuff(BuffID.Venom, 180); target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) { - for (int dust = 0; dust <= 22; dust++) - { + for (int i = 0; i < 23; i++) Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f); - } } } } diff --git a/Projectiles/Magic/SlitheringEelProjectile.png b/Projectiles/Magic/SlitheringEelProjectile.png index f7ccfeee32..fa25c2a990 100644 Binary files a/Projectiles/Magic/SlitheringEelProjectile.png and b/Projectiles/Magic/SlitheringEelProjectile.png differ diff --git a/Projectiles/Magic/SlitheringEelTail.png b/Projectiles/Magic/SlitheringEelTail.png new file mode 100644 index 0000000000..fbdcd3a789 Binary files /dev/null and b/Projectiles/Magic/SlitheringEelTail.png differ diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index 3ba1d52021..1a2df63425 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 60); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index a7ce271023..c6f7c5e7ac 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index b2aac58b0c..1c0bc2704e 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class SolarBeam2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -31,7 +33,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -67,8 +68,9 @@ namespace CalamityMod.Projectiles.Magic target.immune[projectile.owner] = 4; if (projectile.owner == Main.myPlayer) { - int proj = 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); - Main.projectile[proj].Calamity().forceMagic = true; + 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/SolarBeam2.png b/Projectiles/Magic/SolarBeam2.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/SolarBeam2.png and /dev/null differ diff --git a/Projectiles/Magic/SolarElementalBeam.cs b/Projectiles/Magic/SolarElementalBeam.cs new file mode 100644 index 0000000000..bce85a1d74 --- /dev/null +++ b/Projectiles/Magic/SolarElementalBeam.cs @@ -0,0 +1,80 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SolarElementalBeam : BaseLaserbeamProjectile + { + public override float MaxScale => 1f; + 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 void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + 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; + } + + public override void ExtraBehavior() + { + // Generate a star-like burst of solar fire dust. + if (!Main.dedServ && Time == 5f) + { + int starPoints = 8; + for (int i = 0; i < starPoints; i++) + { + float angle = MathHelper.TwoPi * i / starPoints; + for (int j = 0; j < 12; j++) + { + float starSpeed = MathHelper.Lerp(2f, 10f, j / 12f); + 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); + fire.velocity = angle.ToRotationVector2() * starSpeed; + fire.color = dustColor; + fire.scale = dustScale; + fire.noGravity = true; + } + } + } + } + + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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)); + Main.projectile[boom].Calamity().forceMagic = true; + } + } +} diff --git a/Projectiles/Boss/HealOrbProv.png b/Projectiles/Magic/SolarElementalBeam.png similarity index 100% rename from Projectiles/Boss/HealOrbProv.png rename to Projectiles/Magic/SolarElementalBeam.png diff --git a/Projectiles/Magic/SoulPiercerBeam.cs b/Projectiles/Magic/SoulPiercerBeam.cs index 04b790a956..28c5c238ee 100644 --- a/Projectiles/Magic/SoulPiercerBeam.cs +++ b/Projectiles/Magic/SoulPiercerBeam.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class SoulPiercerBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Piercer"); @@ -17,47 +19,36 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.extraUpdates = 100; projectile.timeLeft = 240; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() { 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; - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num448].velocity *= 0.2f; - } - } + if (projectile.localAI[0] > 9f) + { + 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; + Main.dust[num448].velocity *= 0.2f; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { for (int x = 0; x < 3; x++) { - float xPos = projectile.ai[0] > 0 ? projectile.position.X + 500 : projectile.position.X - 500; - Vector2 vector2 = new Vector2(xPos, projectile.position.Y + Main.rand.Next(-500, 501)); - float num80 = xPos; - float speedX = (float)target.position.X - vector2.X; - float speedY = (float)target.position.Y - vector2.Y; - float dir = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY)); - dir = 10 / num80; - speedX *= dir * 150; - speedY *= dir * 150; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, projectile.owner); + 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/SoulPiercerBeam.png b/Projectiles/Magic/SoulPiercerBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/SoulPiercerBeam.png and /dev/null differ diff --git a/Projectiles/Magic/SoulPiercerBolt.cs b/Projectiles/Magic/SoulPiercerBolt.cs index 0af21367ae..7bf3fa417e 100644 --- a/Projectiles/Magic/SoulPiercerBolt.cs +++ b/Projectiles/Magic/SoulPiercerBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class SoulPiercerBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Piercer"); @@ -16,24 +18,22 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.extraUpdates = 100; projectile.friendly = true; - projectile.timeLeft = 180; + projectile.ignoreWater = true; + projectile.timeLeft = 180; projectile.penetrate = -1; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } - public override void AI() - { - for (int num447 = 0; num447 < 4; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 173, 0f, 0f, 0, default, 0.5f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num448].velocity *= 0.2f; - } - } + public override void AI() + { + 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; + Main.dust[num448].velocity *= 0.2f; + } } } diff --git a/Projectiles/Magic/SoulPiercerBolt.png b/Projectiles/Magic/SoulPiercerBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/SoulPiercerBolt.png and /dev/null differ diff --git a/Projectiles/Magic/SparkInfernal.cs b/Projectiles/Magic/SparkInfernal.cs index e39041825e..b94a0160a2 100644 --- a/Projectiles/Magic/SparkInfernal.cs +++ b/Projectiles/Magic/SparkInfernal.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class SparkInfernal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spark"); diff --git a/Projectiles/Magic/SparkInfernal.png b/Projectiles/Magic/SparkInfernal.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Magic/SparkInfernal.png and /dev/null differ diff --git a/Projectiles/Magic/SparklingBeam.cs b/Projectiles/Magic/SparklingBeam.cs index cd46efefb5..e26f49cc93 100644 --- a/Projectiles/Magic/SparklingBeam.cs +++ b/Projectiles/Magic/SparklingBeam.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; using CalamityMod.Projectiles.Ranged; using CalamityMod.Items.Fishing.SunkenSeaCatches; using Terraria.ID; +using System.Linq; namespace CalamityMod.Projectiles.Magic { @@ -54,6 +55,8 @@ namespace CalamityMod.Projectiles.Magic 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) @@ -111,15 +114,16 @@ namespace CalamityMod.Projectiles.Magic if (target.life <= 0) { Player player = Main.player[projectile.owner]; - int shardDamage = (int)((SparklingEmpress.BaseDamage / 5) * player.MagicDamage()); + int shardDamage = projectile.damage / 5; int shardAmt = Main.rand.Next(2, 4); 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, 0f, 0f); - Main.projectile[shard].Calamity().forceMagic = true; + int shard = Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, projectile.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceMagic = true; } } } @@ -213,15 +217,9 @@ namespace CalamityMod.Projectiles.Magic */ private void SetLaserPosition(Player player) { - for (Distance = MOVE_DISTANCE; Distance <= 2200f; Distance += 5f) - { - var start = player.Center + projectile.velocity * Distance; - if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1)) - { - Distance -= 5f; - break; - } - } + 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); } private void ChargeLaser(Player player) @@ -233,7 +231,7 @@ namespace CalamityMod.Projectiles.Magic } else { // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore - if (Main.time % 10 < 1 && !player.CheckMana(player.ActiveItem().mana, true)) + if (Main.player[projectile.owner].miscCounter % 10 == 0 && !player.CheckMana(player.ActiveItem(), -1, true)) { projectile.Kill(); } diff --git a/Projectiles/Magic/Starblast.cs b/Projectiles/Magic/Starblast.cs index 1aebb67f06..74d50123f3 100644 --- a/Projectiles/Magic/Starblast.cs +++ b/Projectiles/Magic/Starblast.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/StardustElementalBeam.cs b/Projectiles/Magic/StardustElementalBeam.cs new file mode 100644 index 0000000000..7fe2f9350d --- /dev/null +++ b/Projectiles/Magic/StardustElementalBeam.cs @@ -0,0 +1,85 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class StardustElementalBeam : BaseLaserbeamProjectile + { + public override float MaxScale => 0.85f; + 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 void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + 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; + } + + public override void ExtraBehavior() + { + // Generate 2 stars from the side. + if (Main.myPlayer == projectile.owner && Time == 5f) + { + int type = ModContent.ProjectileType(); + + 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); + } + } + } + + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Inflict the celled debuff for 3 seconds. + target.AddBuff(BuffID.StardustMinionBleed, 180); + + if (!Main.rand.NextBool(7)) + return; + + 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); + 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); + } + } + } +} diff --git a/Projectiles/DraedonsArsenal/MountedScannerLaser.png b/Projectiles/Magic/StardustElementalBeam.png similarity index 100% rename from Projectiles/DraedonsArsenal/MountedScannerLaser.png rename to Projectiles/Magic/StardustElementalBeam.png diff --git a/Projectiles/Magic/StickyFeather.cs b/Projectiles/Magic/StickyFeather.cs index 7f8eedd116..957bce5890 100644 --- a/Projectiles/Magic/StickyFeather.cs +++ b/Projectiles/Magic/StickyFeather.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 07e0488fad..07d03804aa 100644 --- a/Projectiles/Magic/StratusSphereProj.cs +++ b/Projectiles/Magic/StratusSphereProj.cs @@ -54,20 +54,22 @@ namespace CalamityMod.Projectiles.Magic { projectile.velocity.X = projectile.velocity.X * 10 / 11; projectile.velocity.Y = projectile.velocity.Y * 10 / 11; - if (roundsGone <= 4) projectile.ai[1]++; + if (roundsGone <= 4) + 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.DirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); - } + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(targetDir) * 12f, ModContent.ProjectileType(), projectile.damage / 2, 0.4f, projectile.owner, projectile.whoAmI); + if (projectile.ai[1] > 46) { 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++; diff --git a/Projectiles/Magic/SubsumingTentacle.cs b/Projectiles/Magic/SubsumingTentacle.cs index 3374d189ea..9db12b3595 100644 --- a/Projectiles/Magic/SubsumingTentacle.cs +++ b/Projectiles/Magic/SubsumingTentacle.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic { ArcingMovement(); } - projectile.scale -= closestTarget == null ? 0.007f : 0.004f; + projectile.scale -= closestTarget is null ? 0.007f : 0.004f; if (projectile.scale <= 0.05f) { projectile.Kill(); diff --git a/Projectiles/Magic/T1000Laser.cs b/Projectiles/Magic/T1000Laser.cs index abdecd9dc4..7220a303a6 100644 --- a/Projectiles/Magic/T1000Laser.cs +++ b/Projectiles/Magic/T1000Laser.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class T1000Laser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); @@ -54,52 +56,18 @@ namespace CalamityMod.Projectiles.Magic } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) + int dustAmt = Main.rand.Next(3, 7); + for (int d = 0; d < dustAmt; d++) { - int num214 = 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[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + 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/Magic/T1000Laser.png b/Projectiles/Magic/T1000Laser.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Magic/T1000Laser.png and /dev/null differ diff --git a/Projectiles/Magic/T1000Proj.cs b/Projectiles/Magic/T1000Proj.cs index 94d68ec45c..caebb2cf30 100644 --- a/Projectiles/Magic/T1000Proj.cs +++ b/Projectiles/Magic/T1000Proj.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -10,12 +11,13 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("T1000"); + Main.projFrames[projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 34; - projectile.height = 80; + projectile.width = 80; + projectile.height = 34; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; @@ -26,8 +28,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { Player player = Main.player[projectile.owner]; - float num = 1.57079637f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.type == ModContent.ProjectileType()) { projectile.ai[0] += 1f; @@ -60,11 +61,12 @@ namespace CalamityMod.Projectiles.Magic { Main.PlaySound(SoundID.Item91, projectile.position); } + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; } if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) { Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); Vector2 value = projectile.Center + vector2; for (int i = 0; i < 2; i++) { @@ -77,40 +79,31 @@ namespace CalamityMod.Projectiles.Magic if (flag && Main.myPlayer == projectile.owner) { int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && player.CheckMana(player.ActiveItem(), -1, true, false) && !player.noItems && !player.CCed; if (flag2) { - float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; - if (player.gravDir == -1f) - { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; - } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) - { - vector3 = -Vector2.UnitY; - } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) - { + float speed = player.ActiveItem().shootSpeed * projectile.scale; + Vector2 spawnPos = playerPos + projectile.velocity * 0.75f; + Vector2 velocity = (Main.MouseWorld - projectile.Center).SafeNormalize(-Vector2.UnitY) * speed; + if (projectile.WithinRange(Main.MouseWorld, 50f)) + velocity = projectile.velocity; + if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y) projectile.netUpdate = true; - } - projectile.velocity = vector3; - int num6 = ModContent.ProjectileType(); - float scaleFactor2 = 14f; - int num7 = 7; + + projectile.velocity = velocity; + int projType = ModContent.ProjectileType(); + float velocityMult = 14f; + float randNum = 4f; for (int j = 0; j < 4; j++) { - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); + spawnPos += new Vector2(Main.rand.NextFloat(-randNum, randNum), Main.rand.NextFloat(-randNum, randNum)); + 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(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(spawnPos, spinningpoint, projType, weaponDamage2, projectile.knockBack, projectile.owner, 0f, 0f); } } else @@ -119,15 +112,19 @@ namespace CalamityMod.Projectiles.Magic } } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.SafeNormalize(Vector2.UnitX * player.direction) * 6f; 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 = (projectile.velocity * projectile.direction).ToRotation(); } + + public override bool CanDamage() => false; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.ai[0] > 0f; } } diff --git a/Projectiles/Magic/T1000Proj.png b/Projectiles/Magic/T1000Proj.png index 755334ced5..eab34e41f5 100644 Binary files a/Projectiles/Magic/T1000Proj.png and b/Projectiles/Magic/T1000Proj.png differ diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index 7f800657a4..e568836df2 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -48,14 +48,14 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num102].noGravity = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 500f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 8f, 20f); projectile.rotation += 0.3f * (float)projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/TerraBeam.cs b/Projectiles/Magic/TerraBeam.cs index b5e9dbd158..6c3b4bbba7 100644 --- a/Projectiles/Magic/TerraBeam.cs +++ b/Projectiles/Magic/TerraBeam.cs @@ -1,53 +1,118 @@ +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { - public class TerraBeam : ModProjectile + public class TerraBeam : BaseLaserbeamProjectile { + public override float MaxScale => 1f; + 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 ref float ShardCooldown => ref projectile.ai[1]; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() { - DisplayName.SetDefault("Bolt"); + DisplayName.SetDefault("Beam"); } public override void SetDefaults() { - projectile.width = 4; - projectile.height = 4; + projectile.width = projectile.height = 20; projectile.friendly = true; projectile.magic = true; + projectile.ignoreWater = true; projectile.penetrate = 10; - projectile.extraUpdates = 100; - projectile.timeLeft = 150; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.tileCollide = false; + projectile.timeLeft = (int)Lifetime; } - public override void AI() - { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 21f && projectile.owner == Main.myPlayer) - { - projectile.localAI[1] = 0f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.7), projectile.knockBack, projectile.owner, 0f, 0f); - } - - projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 9f) - { - for (int num447 = 0; num447 < 3; num447++) + public override void ExtraBehavior() + { + // Generate a star-like and circular burst of terra dust. + if (!Main.dedServ && Time == 5f) + { + int starPoints = 6; + for (int i = 0; i < starPoints; i++) { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } + float angle = MathHelper.TwoPi * i / starPoints; + for (int j = 0; j < 12; j++) + { + float starSpeed = MathHelper.Lerp(1f, 7f, j / 12f); + 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); + terraMagic.velocity = angle.ToRotationVector2() * starSpeed; + terraMagic.color = dustColor; + terraMagic.scale = dustScale; + terraMagic.noGravity = true; + } + } + + int ovalPoints = 42; + for (int i = 0; i < ovalPoints; i++) + { + float angle = MathHelper.TwoPi * i / ovalPoints; + Dust terraMagic = Dust.NewDustPerfect(projectile.Center, 107); + terraMagic.velocity = angle.ToRotationVector2() * 6f; + terraMagic.scale = 1.1f; + terraMagic.noGravity = true; + } } + + if (ShardCooldown > 0f) + ShardCooldown--; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (ShardCooldown > 0f) + return; + + // 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); + + int totalShards = (int)MathHelper.Lerp(1, 4, MathHelper.Clamp(lengthFromStart / MaxLaserLength * 1.4f, 0f, 1f)); + int shardType = ModContent.ProjectileType(); + int shardDamage = (int)(damage * 0.6); + for (int i = 0; i < totalShards; i++) + { + int tries = 0; + Vector2 spawnOffset; + do + { + spawnOffset = Main.rand.NextVector2CircularEdge(target.width * 0.5f + 40f, target.height * 0.5f + 40f); + tries++; + } + while (Collision.SolidCollision((target.Center + spawnOffset).ToTileCoordinates().ToVector2(), 4, 4) && tries < 10); + + Projectile.NewProjectile(target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), shardType, shardDamage, knockback); + } + + ShardCooldown = 3f; + projectile.netUpdate = true; } - } + } } diff --git a/Projectiles/Magic/TerraBeam.png b/Projectiles/Magic/TerraBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/TerraBeam.png and /dev/null differ diff --git a/Projectiles/Magic/TerraBolt.cs b/Projectiles/Magic/TerraBolt.cs deleted file mode 100644 index b724da7432..0000000000 --- a/Projectiles/Magic/TerraBolt.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class TerraBolt : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 30; - projectile.magic = true; - } - - public override void AI() - { - 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.7), projectile.knockBack, projectile.owner, 0f, 0f); - } - - for (int num447 = 0; num447 < 2; num447++) - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } -} diff --git a/Projectiles/Magic/TerraBolt.png b/Projectiles/Magic/TerraBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/TerraBolt.png and /dev/null differ diff --git a/Projectiles/Magic/TerraBolt2.cs b/Projectiles/Magic/TerraBolt2.cs deleted file mode 100644 index 99efba297b..0000000000 --- a/Projectiles/Magic/TerraBolt2.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class TerraBolt2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.extraUpdates = 100; - projectile.friendly = true; - projectile.timeLeft = 15; - projectile.magic = true; - } - - public override void AI() - { - Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 107, 0f, 0f, 0, default, 1.25f); - Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } -} diff --git a/Projectiles/Magic/TerraBolt2.png b/Projectiles/Magic/TerraBolt2.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/TerraBolt2.png and /dev/null differ diff --git a/Projectiles/Magic/TerraOrb.cs b/Projectiles/Magic/TerraOrb.cs deleted file mode 100644 index fa0a9f5614..0000000000 --- a/Projectiles/Magic/TerraOrb.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class TerraOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - 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; - } - - public override void AI() - { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } -} diff --git a/Projectiles/Magic/TerraOrb.png b/Projectiles/Magic/TerraOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/TerraOrb.png and /dev/null differ diff --git a/Projectiles/Magic/TerraOrb2.cs b/Projectiles/Magic/TerraOrb2.cs deleted file mode 100644 index e116c948f6..0000000000 --- a/Projectiles/Magic/TerraOrb2.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class TerraOrb2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bolt"); - } - - 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; - } - - public override void AI() - { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 18f, 5, ModContent.ProjectileType()); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; - } - } -} diff --git a/Projectiles/Magic/TerraOrb2.png b/Projectiles/Magic/TerraOrb2.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/TerraOrb2.png and /dev/null differ diff --git a/Projectiles/Magic/TerraShard.cs b/Projectiles/Magic/TerraShard.cs new file mode 100644 index 0000000000..cad86ae092 --- /dev/null +++ b/Projectiles/Magic/TerraShard.cs @@ -0,0 +1,35 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class TerraShard : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shard"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 20; + projectile.friendly = true; + projectile.timeLeft = 60; + projectile.penetrate = 1; + projectile.magic = true; + 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); + terraMagic.scale = 0.42f; + terraMagic.velocity *= 0.1f; + } + + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 500f, 15f, 20f); + } + } +} diff --git a/Projectiles/DraedonsArsenal/PlasmaCasterShot.png b/Projectiles/Magic/TerraShard.png similarity index 100% rename from Projectiles/DraedonsArsenal/PlasmaCasterShot.png rename to Projectiles/Magic/TerraShard.png diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs index b72603d63b..2ba4ed5531 100644 --- a/Projectiles/Magic/ThunderstormShot.cs +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class ThunderstormShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shot"); @@ -47,26 +49,12 @@ namespace CalamityMod.Projectiles.Magic public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item125, projectile.position); + Main.PlaySound(SoundID.Item125, projectile.Center); for (int n = 0; n < 5; n++) { - float x = projectile.position.X + (float)Main.rand.Next(-200, 200); - float y = projectile.position.Y - 1500f; - Vector2 vector = new Vector2(x, y); - float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; - float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + CalamityUtils.ProjectileRain(projectile.Center, 200f, 100f, 1500f, 1500f, 29f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } - 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 36); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -88,6 +76,8 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num228].noLight = true; Main.dust[num228].velocity = vector7; } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; projectile.Damage(); } } diff --git a/Projectiles/Magic/ThunderstormShot.png b/Projectiles/Magic/ThunderstormShot.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Magic/ThunderstormShot.png and /dev/null differ diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs index aae6878bd8..10abae89a6 100644 --- a/Projectiles/Magic/ThunderstormShotSplit.cs +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class ThunderstormShotSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shot"); diff --git a/Projectiles/Magic/ThunderstormShotSplit.png b/Projectiles/Magic/ThunderstormShotSplit.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/ThunderstormShotSplit.png and /dev/null differ diff --git a/Projectiles/Magic/TradewindsProjectile.cs b/Projectiles/Magic/TradewindsProjectile.cs index c26db1b84d..52258a4191 100644 --- a/Projectiles/Magic/TradewindsProjectile.cs +++ b/Projectiles/Magic/TradewindsProjectile.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -66,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f4e0ba55c3..65db139c17 100644 --- a/Projectiles/Magic/TridentIcicle.cs +++ b/Projectiles/Magic/TridentIcicle.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 60); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 15114de365..83043cc6f7 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -21,34 +21,28 @@ namespace CalamityMod.Projectiles.Magic projectile.alpha = 255; projectile.ignoreWater = true; projectile.magic = true; - } + projectile.timeLeft = 30; + } public override void AI() { - projectile.velocity.X *= 0.975f; - projectile.velocity.Y *= 0.975f; + projectile.velocity *= 0.975f; + 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(); float num744 = v2.ToRotation(); - double num745 = (double)(num744 - num743); - if (num745 > 3.1415926535897931) - { - num745 -= 6.2831853071795862; - } - if (num745 < -3.1415926535897931) - { - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.myPlayer == projectile.owner && projectile.timeLeft > 30) - projectile.timeLeft = 30; + double num745 = num744 - num743; + if (num745 > MathHelper.Pi) + num745 -= MathHelper.TwoPi; + if (num745 < -MathHelper.Pi) + num745 -= -MathHelper.TwoPi; + + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void Kill(int timeLeft) @@ -64,10 +58,8 @@ namespace CalamityMod.Projectiles.Magic } if (projectile.owner == Main.myPlayer) { - for (int numBubbles = 0; numBubbles <= Main.rand.Next(3, 7); 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, 0f, 0f); - } + 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); } } } diff --git a/Projectiles/Magic/UndinesRetributionSpear.cs b/Projectiles/Magic/UndinesRetributionSpear.cs index 43d6531e12..fa231485eb 100644 --- a/Projectiles/Magic/UndinesRetributionSpear.cs +++ b/Projectiles/Magic/UndinesRetributionSpear.cs @@ -61,16 +61,12 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 600f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 9f, 20f); } else { @@ -83,7 +79,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index c8ec08d181..13cbec3ff3 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class ValkyrieRayStaff : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Magic/ValkyrieRay"; + private const float AimResponsiveness = 0.66f; public override void SetStaticDefaults() diff --git a/Projectiles/Magic/ValkyrieRayStaff.png b/Projectiles/Magic/ValkyrieRayStaff.png deleted file mode 100644 index 18ec195aa0..0000000000 Binary files a/Projectiles/Magic/ValkyrieRayStaff.png and /dev/null differ diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 0f9f39ab4b..0f7433da39 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -1,3 +1,6 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,6 +12,8 @@ namespace CalamityMod.Projectiles.Magic { public class Vehemence : ModProjectile { + public ref float Time => ref projectile.ai[0]; + public Player Owner => Main.player[projectile.owner]; public override void SetStaticDefaults() { DisplayName.SetDefault("Vehemence"); @@ -18,8 +23,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; + projectile.width = projectile.height = 32; projectile.friendly = true; projectile.ignoreWater = true; projectile.penetrate = 1; @@ -31,54 +35,103 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.45f); - for (int num457 = 0; num457 < 2; num457++) + Lighting.AddLight(projectile.Center, Color.DarkRed.ToVector3()); + + if (Time == 0f) + GenerateInitialBurstDust(); + + GenerateHelicalDust(); + Time++; + } + + private void GenerateInitialBurstDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 40; i++) { - int num458 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 65, 0f, 0f, 100, default, 2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.15f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; + float angle = MathHelper.TwoPi * i / 40f; + + 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; + brimstoneMagic.noGravity = true; + } + } + + private void GenerateHelicalDust() + { + if (Main.dedServ) + return; + + // Helical brimstone dust from the back of the projectile. + 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); + + Dust brimstoneMagic = Dust.NewDustPerfect(projectile.Center + spawnOffset, (int)CalamityDusts.Brimstone); + brimstoneMagic.velocity = Vector2.Zero; + brimstoneMagic.scale = 1.1f; + brimstoneMagic.noGravity = true; } } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item74, projectile.position); - for (int j = 0; j <= 25; j++) + if (Main.myPlayer == projectile.owner) { - int num459 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 65, 0f, 0f, 100, default, 1f); - Main.dust[num459].noGravity = true; - Main.dust[num459].velocity *= 0.1f; + int damage = (int)(Vehemenc.VehemenceSkullDamage * Owner.MagicDamage()); + for (int i = 0; i < 18; i++) + Projectile.NewProjectile(projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner); + } + + if (!Main.dedServ) + { + for (int i = 0; i < 20; i++) + { + 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; + + Dust blood = Dust.NewDustPerfect(spawnPosition, DustID.Blood); + blood.velocity = shootVelocity; + blood.scale = MathHelper.Lerp(1.7f, 0.85f, i / 20f); + } + } + for (int i = 0; i < 60; i++) + { + 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; + } } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - double lifeAmount = (double)target.life; - double lifeMax = (double)target.lifeMax; - double damageMult = lifeAmount / lifeMax * 7; - damage = (int)Math.Pow(damage, damageMult); - if (damage > 1000000) - { - damage = 1000000; - } + double lifeAmount = target.life; + double lifeMax = target.lifeMax; + double damageExponent = lifeAmount / lifeMax * 7; + damage = (int)Math.Pow(damage, damageExponent); + if (damage > 200000) + damage = 200000; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (target.life == target.lifeMax) - { - target.AddBuff(BuffID.ShadowFlame, 12000); - target.AddBuff(BuffID.Ichor, 12000); - target.AddBuff(BuffID.Frostburn, 12000); - target.AddBuff(BuffID.OnFire, 12000); - target.AddBuff(BuffID.Poisoned, 12000); - } + target.AddBuff(ModContent.BuffType(), 18000); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/Vehemence.png b/Projectiles/Magic/Vehemence.png index 940cd6a110..14fc508850 100644 Binary files a/Projectiles/Magic/Vehemence.png and b/Projectiles/Magic/Vehemence.png differ diff --git a/Projectiles/Magic/VehemenceHoldout.cs b/Projectiles/Magic/VehemenceHoldout.cs new file mode 100644 index 0000000000..f5cbe5d1a2 --- /dev/null +++ b/Projectiles/Magic/VehemenceHoldout.cs @@ -0,0 +1,95 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VehemenceHoldout : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public ref float Time => ref projectile.ai[0]; + + public const int ChargeTime = 90; + public override string Texture => "CalamityMod/Items/Weapons/Magic/Vehemenc"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Vehemence"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 114; + projectile.friendly = false; + projectile.magic = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = ChargeTime + 1; + } + + public override void AI() + { + UpdatePlayerVisuals(); + if (Time == ChargeTime) + ShootBolt(); + else if (Time < ChargeTime) + CreateChargeDust(); + + Time++; + + if (Main.mouseLeftRelease && Time >= 5f && Time < ChargeTime) + projectile.Kill(); + } + + private void UpdatePlayerVisuals() + { + projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + + 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.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.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = projectile.rotation * projectile.direction; + + projectile.rotation += MathHelper.PiOver4; + if (projectile.spriteDirection == -1) + projectile.rotation += MathHelper.PiOver2; + } + + private void ShootBolt() + { + if (Main.myPlayer != projectile.owner) + return; + + Item heldItem = Owner.ActiveItem(); + Vector2 shootVelocity = (Main.MouseWorld - projectile.Center).SafeNormalize(Vector2.UnitX * projectile.direction) * heldItem.shootSpeed; + Projectile.NewProjectile(projectile.Center, shootVelocity, ModContent.ProjectileType(), (int)(Owner.MagicDamage() * heldItem.damage), heldItem.knockBack, projectile.owner); + } + + private void CreateChargeDust() + { + if (Main.dedServ) + return; + + 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; + brimstoneMagic.velocity.Y -= 2f; + brimstoneMagic.scale = 1.2f; + brimstoneMagic.noGravity = true; + } + } + } +} diff --git a/Projectiles/Magic/VehemenceSkull.cs b/Projectiles/Magic/VehemenceSkull.cs new file mode 100644 index 0000000000..c67b98462e --- /dev/null +++ b/Projectiles/Magic/VehemenceSkull.cs @@ -0,0 +1,63 @@ +using CalamityMod.Buffs.DamageOverTime; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class VehemenceSkull : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Skull"); + 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.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.magic = true; + } + + public override void AI() + { + Time++; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + + if (projectile.ai[0] < 125) // 155 - frameCounter tick * number of disippation frames. + { + if (projectile.frame >= 4) + projectile.frame = 0; + } + + else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + projectile.Kill(); + + projectile.velocity *= 0.98f; + if (projectile.alpha > 110) + { + projectile.alpha -= 30; + if (projectile.alpha < 70) + projectile.alpha = 70; + } + + if (Math.Abs(projectile.velocity.X) > 0.1f) + projectile.spriteDirection = -projectile.direction; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); + } +} diff --git a/Projectiles/Magic/VehemenceSkull.png b/Projectiles/Magic/VehemenceSkull.png new file mode 100644 index 0000000000..249fa3f6fe Binary files /dev/null and b/Projectiles/Magic/VehemenceSkull.png differ diff --git a/Projectiles/Magic/VenusianBolt.cs b/Projectiles/Magic/VenusianBolt.cs index 3d0c7dcacb..882536be77 100644 --- a/Projectiles/Magic/VenusianBolt.cs +++ b/Projectiles/Magic/VenusianBolt.cs @@ -60,29 +60,29 @@ namespace CalamityMod.Projectiles.Magic { int explosionDamage = projectile.damage; float explosionKB = 6f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), explosionDamage, explosionKB, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, explosionKB, projectile.owner); - int cinderDamage = (int)(projectile.damage * 0.75f); + int cinderDamage = (int)(projectile.damage * 0.75); float cinderKB = 0f; Vector2 cinderPos = projectile.oldPosition + 0.5f * projectile.Size; int numCinders = Main.rand.Next(7, 10); for (int i = 0; i < numCinders; i++) { - Vector2 cinderVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + Vector2 cinderVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); while (cinderVel.X == 0f && cinderVel.Y == 0f) { - cinderVel = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + cinderVel = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); } cinderVel.Normalize(); - cinderVel *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, projectile.owner, 0f, 0f); + cinderVel *= Main.rand.Next(70, 101) * 0.1f; + Projectile.NewProjectile(cinderPos, cinderVel, ModContent.ProjectileType(), cinderDamage, cinderKB, projectile.owner); } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 411388254f..b583cfc1b3 100644 --- a/Projectiles/Magic/VenusianExplosion.cs +++ b/Projectiles/Magic/VenusianExplosion.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class VenusianExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 120; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/VenusianExplosion.png b/Projectiles/Magic/VenusianExplosion.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Magic/VenusianExplosion.png and /dev/null differ diff --git a/Projectiles/Magic/VenusianFlame.cs b/Projectiles/Magic/VenusianFlame.cs index e7b70c8a49..28aa1944b6 100644 --- a/Projectiles/Magic/VenusianFlame.cs +++ b/Projectiles/Magic/VenusianFlame.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 9816e09feb..5dd19647a7 100644 --- a/Projectiles/Magic/VisceraBeam.cs +++ b/Projectiles/Magic/VisceraBeam.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class VisceraBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float healAmt = 1f; public override void SetStaticDefaults() @@ -20,7 +22,8 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 6; + projectile.ignoreWater = true; + projectile.penetrate = 9; projectile.extraUpdates = 100; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; @@ -29,7 +32,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - healAmt *= 1.4f; + healAmt *= 1.25f; projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -37,7 +40,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -52,11 +54,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) - { + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; - } - healAmt *= 1.4f; + + healAmt *= 1.25f; Player player = Main.player[projectile.owner]; player.statLife += (int)healAmt; player.HealEffect((int)healAmt); diff --git a/Projectiles/Magic/VisceraBeam.png b/Projectiles/Magic/VisceraBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/VisceraBeam.png and /dev/null differ diff --git a/Projectiles/Magic/VitriolicViperFang.cs b/Projectiles/Magic/VitriolicViperFang.cs index 198aada41d..1bb635035f 100644 --- a/Projectiles/Magic/VitriolicViperFang.cs +++ b/Projectiles/Magic/VitriolicViperFang.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Magic } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index f58366c6eb..1740cbe949 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -1,4 +1,3 @@ -using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using System; using Terraria; @@ -6,146 +5,136 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class VividBeam : ModProjectile - { - private bool counter = true; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Beam"); - } + public class VividBeam : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetDefaults() - { - projectile.width = 4; - projectile.height = 4; - projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 1; - projectile.extraUpdates = 100; - projectile.timeLeft = 240; - } + private bool initialized = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } - public override void AI() - { - Vector2 value7 = new Vector2(5f, 10f); - projectile.ai[0] += 1f; - if (projectile.ai[0] == 48f) - { - 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); - Main.dust[num42].scale = 0.75f; - Main.dust[num42].noGravity = true; - Main.dust[num42].position = projectile.Center + value8; - Main.dust[num42].velocity = projectile.velocity; - } - } - 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); - 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; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; - Main.dust[num448].velocity *= 0.1f; + 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; + } + + public override void AI() + { + if (!initialized) + { + initialized = true; + float dustAmt = 16f; + int d = 0; + while ((float)d < dustAmt) + { + 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); + 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; + d++; } - } + } - if (counter) - { - counter = false; - 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); - 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; - num99++; - } - } - } + float pi = MathHelper.Pi; + projectile.ai[0] += 1f; + if (projectile.ai[0] == 48f) + { + 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); + Main.dust[i].scale = 0.75f; + Main.dust[i].noGravity = true; + Main.dust[i].position = projectile.Center + offset; + Main.dust[i].velocity = projectile.velocity; + } + } + 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); + 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; + Main.dust[i].scale = Main.rand.NextFloat(0.91f, 1.417f); + Main.dust[i].velocity *= 0.1f; + } + } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.owner == Main.myPlayer) - { + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.owner == Main.myPlayer) + { SummonLasers(); } return true; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.owner == Main.myPlayer) + { SummonLasers(); } target.ExoDebuffs(); - } + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - if (projectile.owner == Main.myPlayer) - { + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (projectile.owner == Main.myPlayer) + { SummonLasers(); } target.ExoDebuffs(); - } + } private void SummonLasers() { - if (projectile.ai[1] == 0f) + switch (projectile.ai[1]) { - float xStart = projectile.position.X + (float)Main.rand.Next(-400, 400); - float yStart = projectile.position.Y - (float)Main.rand.Next(500, 800); - Vector2 startPos = new Vector2(xStart, yStart); - Vector2 velocity = projectile.Center - startPos; - velocity.X += (float)Main.rand.Next(-100, 101); - float speed = 6f; - float targetDist = velocity.Length(); - targetDist = speed / targetDist; - velocity.X *= targetDist; - velocity.Y *= targetDist; - int num19 = Projectile.NewProjectile(startPos, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.7f), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[num19].ai[1] = projectile.position.Y; - } - if (projectile.ai[1] == 1f) - { - int boom = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 2f), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[boom].Calamity().forceMagic = true; - } - if (projectile.ai[1] == 2f) - { - float spread = 30f * 0.01f * MathHelper.PiOver2; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - if (projectile.owner == Main.myPlayer) - { + case 0f: + 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); + break; + + case 2f: + float spread = 30f * 0.01f * MathHelper.PiOver2; + 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, 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); + 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/VividBeam.png b/Projectiles/Magic/VividBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/VividBeam.png and /dev/null differ diff --git a/Projectiles/Magic/VividBolt.cs b/Projectiles/Magic/VividBolt.cs index 1fa5ae52b2..c055ab2e39 100644 --- a/Projectiles/Magic/VividBolt.cs +++ b/Projectiles/Magic/VividBolt.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Magic { public class VividBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.timeLeft = 30; projectile.magic = true; - projectile.usesLocalNPCImmunity = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; } diff --git a/Projectiles/Magic/VividBolt.png b/Projectiles/Magic/VividBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/VividBolt.png and /dev/null differ diff --git a/Projectiles/Magic/VividClarityBeam.cs b/Projectiles/Magic/VividClarityBeam.cs index 614d4279b8..8a78bd504c 100644 --- a/Projectiles/Magic/VividClarityBeam.cs +++ b/Projectiles/Magic/VividClarityBeam.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Magic { public class VividClarityBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); @@ -18,11 +20,12 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.friendly = true; projectile.magic = true; - projectile.penetrate = 10; + projectile.ignoreWater = true; + projectile.penetrate = 10; projectile.extraUpdates = 100; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -80,7 +83,6 @@ namespace CalamityMod.Projectiles.Magic } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -96,10 +98,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.ExoDebuffs(); - if (target.type == NPCID.TargetDummy) - { - return; - } projectile.damage = (int)(projectile.damage * 1.1); } diff --git a/Projectiles/Magic/VividClarityBeam.png b/Projectiles/Magic/VividClarityBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/VividClarityBeam.png and /dev/null differ diff --git a/Projectiles/Magic/VividExplosion.cs b/Projectiles/Magic/VividExplosion.cs new file mode 100644 index 0000000000..f866766454 --- /dev/null +++ b/Projectiles/Magic/VividExplosion.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class VividExplosion : ModProjectile + { + private const float radius = 204.5f; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + 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; + } + + public override void AI() + { + + 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); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 107, + 234, + 269 + }); + 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.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) + { + 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) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.ExoDebuffs(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.ExoDebuffs(); + } + } +} diff --git a/Projectiles/Magic/VividLaser2.cs b/Projectiles/Magic/VividLaser2.cs index 3db215c1c7..f32d60db75 100644 --- a/Projectiles/Magic/VividLaser2.cs +++ b/Projectiles/Magic/VividLaser2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class VividLaser2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Vivid Bolt"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 10; projectile.friendly = true; projectile.alpha = 255; - projectile.timeLeft = 120; + projectile.ignoreWater = true; + projectile.timeLeft = 120; projectile.penetrate = 1; projectile.magic = true; } @@ -41,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ai[0] = 1f; if (projectile.ai[0] >= 1f) - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 30f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 400f, 12f, 20f); } public override void Kill(int timeLeft) @@ -68,19 +71,9 @@ namespace CalamityMod.Projectiles.Magic target.ExoDebuffs(); } - // Cannot deal damage for the first several frames of existence. - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft >= 110) - { - return false; - } - return null; - } + // Cannot deal damage for the first several frames of existence. + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 110; - public override bool CanHitPvp(Player target) - { - return projectile.timeLeft < 110; - } + public override bool CanHitPvp(Player target) => projectile.timeLeft < 110; } } diff --git a/Projectiles/Magic/VividLaser2.png b/Projectiles/Magic/VividLaser2.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Magic/VividLaser2.png and /dev/null differ diff --git a/Projectiles/Magic/VividOrb.cs b/Projectiles/Magic/VividOrb.cs index e9e1607184..51061119a2 100644 --- a/Projectiles/Magic/VividOrb.cs +++ b/Projectiles/Magic/VividOrb.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Magic { public class VividOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -18,12 +20,13 @@ namespace CalamityMod.Projectiles.Magic projectile.timeLeft = 60; projectile.magic = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - } + projectile.localNPCHitCooldown = 10; + 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(), 1D, true); } } } diff --git a/Projectiles/Magic/VividOrb.png b/Projectiles/Magic/VividOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Magic/VividOrb.png and /dev/null differ diff --git a/Projectiles/Magic/Vortex.cs b/Projectiles/Magic/Vortex.cs index b78aa9ace8..da2719ecd8 100644 --- a/Projectiles/Magic/Vortex.cs +++ b/Projectiles/Magic/Vortex.cs @@ -22,10 +22,12 @@ namespace CalamityMod.Projectiles.Magic get => (int)projectile.ai[0]; set => projectile.ai[0] = value; } + public const float AngularMovementSpeed = 0.1f; public const float Acceleration = 0.0025f; public const float TargetCheckInterval = 30f; - public const float MaximumTargetDistance = 1200f; + public const float MaximumTargetDistance = 600f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Subsuming Vortex"); @@ -45,8 +47,6 @@ namespace CalamityMod.Projectiles.Magic projectile.extraUpdates = 4; projectile.timeLeft = 115 * projectile.extraUpdates; projectile.ignoreWater = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; } public override void AI() @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 new file mode 100644 index 0000000000..5a94a1d25a --- /dev/null +++ b/Projectiles/Magic/VortexElementalBeam.cs @@ -0,0 +1,182 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.Projectiles.Magic +{ + public class VortexElementalBeam : ModProjectile + { + public const int Lifetime = 30; + public const float LightningTurnRandomnessFactor = 1.7f; + 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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Lightning"); + 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; + + // 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) + { + projectile.velocity /= projectile.extraUpdates; + } + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(AccumulatedXMovementSpeeds); + + public override void ReceiveExtraAI(BinaryReader reader) => AccumulatedXMovementSpeeds = reader.ReadSingle(); + + public override void AI() + { + // frameCounter in this context is really just an arbitrary timer + // which allows random turning to occur. + projectile.frameCounter++; + + 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) + { + projectile.frameCounter = 0; + + float originalSpeed = MathHelper.Min(6f, projectile.velocity.Length()); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)BaseTurnAngleRatio); + int turnTries = 0; + Vector2 newBaseDirection = -Vector2.UnitY; + Vector2 potentialBaseDirection; + + do + { + BaseTurnAngleRatio = unifiedRandom.Next() % 100; + potentialBaseDirection = (BaseTurnAngleRatio / 100f * MathHelper.TwoPi).ToRotationVector2(); + + // Ensure that the new potential direction base is always moving upwards (this is supposed to be somewhat similar to a -UnitY + RotatedBy). + potentialBaseDirection.Y = -Math.Abs(potentialBaseDirection.Y); + + bool canChangeLightningDirection = true; + + // Potential directions with very little Y speed should not be considered, because this + // consequentially means that the X speed would be quite large. + if (potentialBaseDirection.Y > -0.02f) + canChangeLightningDirection = false; + + // 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) + { + canChangeLightningDirection = false; + } + + // If the above checks were all passed, redefine the base direction of the lightning. + if (canChangeLightningDirection) + newBaseDirection = potentialBaseDirection; + + turnTries++; + } + while (turnTries < 100); + + 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; + } + } + } + + #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; + 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; + DelegateMethods.c_1 = Color.DarkCyan * 0.85f; + } + else if (i == 1) + { + lightningScale = new Vector2(projectile.scale) * 0.4f; + DelegateMethods.c_1 = Color.Cyan * 0.85f; + } + else + { + 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--) + { + 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; + Utils.DrawLaser(spriteBatch, lightningSegmentTexture, start, end, lightningScale, DelegateMethods.LightningLaserDraw); + } + } + } + return false; + } + #endregion + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 180); + + 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) + 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; + + Dust electricity = Dust.NewDustPerfect(dustSpawnPosition, Main.rand.NextBool(2) ? 226 : 229); + electricity.velocity = Vector2.Zero; + electricity.scale = Main.rand.NextFloat(1.1f, 1.18f); + electricity.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Boss/RedLightning.png b/Projectiles/Magic/VortexElementalBeam.png similarity index 100% rename from Projectiles/Boss/RedLightning.png rename to Projectiles/Magic/VortexElementalBeam.png diff --git a/Projectiles/Magic/WaterLeechProj.cs b/Projectiles/Magic/WaterLeechProj.cs index a60506e4b0..f64ff24f59 100644 --- a/Projectiles/Magic/WaterLeechProj.cs +++ b/Projectiles/Magic/WaterLeechProj.cs @@ -5,11 +5,14 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; namespace CalamityMod.Projectiles.Magic { public class WaterLeechProj : ModProjectile { + public override string Texture => "CalamityMod/NPCs/AcidRain/WaterLeech"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Leech"); @@ -92,12 +95,12 @@ namespace CalamityMod.Projectiles.Magic if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Magic/WaterLeechProjGlow"), 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.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); } public override void Kill(int timeLeft) { - Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 1, 0.5f, 0f); + Main.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); diff --git a/Projectiles/Magic/WaterLeechProj.png b/Projectiles/Magic/WaterLeechProj.png deleted file mode 100644 index 17bc7c88b0..0000000000 Binary files a/Projectiles/Magic/WaterLeechProj.png and /dev/null differ diff --git a/Projectiles/Magic/WaterLeechProjGlow.png b/Projectiles/Magic/WaterLeechProjGlow.png deleted file mode 100644 index 48aaa585d2..0000000000 Binary files a/Projectiles/Magic/WaterLeechProjGlow.png and /dev/null differ diff --git a/Projectiles/Magic/WaterStream.cs b/Projectiles/Magic/WaterStream.cs index 5cd0e7b1cb..bfa31fb1b5 100644 --- a/Projectiles/Magic/WaterStream.cs +++ b/Projectiles/Magic/WaterStream.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class WaterStream : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Stream"); diff --git a/Projectiles/Magic/WaterStream.png b/Projectiles/Magic/WaterStream.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Magic/WaterStream.png and /dev/null differ diff --git a/Projectiles/Magic/WaterStream2.cs b/Projectiles/Magic/WaterStream2.cs index 4b783cc1e4..de5cd3f3d4 100644 --- a/Projectiles/Magic/WaterStream2.cs +++ b/Projectiles/Magic/WaterStream2.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Magic { public class WaterStream2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Stream"); diff --git a/Projectiles/Magic/WaterStream2.png b/Projectiles/Magic/WaterStream2.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Magic/WaterStream2.png and /dev/null differ diff --git a/Projectiles/Magic/WulfrumBolt.cs b/Projectiles/Magic/WulfrumBolt.cs index 38ab58428c..c06793c1bc 100644 --- a/Projectiles/Magic/WulfrumBolt.cs +++ b/Projectiles/Magic/WulfrumBolt.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Magic { public class WulfrumBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Magic/WulfrumBolt.png b/Projectiles/Magic/WulfrumBolt.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Magic/WulfrumBolt.png and /dev/null differ diff --git a/Projectiles/Magic/WyvernFeatherGreen.cs b/Projectiles/Magic/WyvernFeatherGreen.cs index 5751d5b4a6..fca16747e0 100644 --- a/Projectiles/Magic/WyvernFeatherGreen.cs +++ b/Projectiles/Magic/WyvernFeatherGreen.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 7d03591928..d533c14268 100644 --- a/Projectiles/Magic/WyvernFeatherPink.cs +++ b/Projectiles/Magic/WyvernFeatherPink.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 4aad1f99f5..55f3788c84 100644 --- a/Projectiles/Magic/WyvernFeatherPurple.cs +++ b/Projectiles/Magic/WyvernFeatherPurple.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Magic public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 6ad7f332a8..51ecb8c15f 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -52,8 +52,10 @@ namespace CalamityMod.Projectiles.Magic // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } + 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(); diff --git a/Projectiles/Magic/YharimsCrystalPrism.cs b/Projectiles/Magic/YharimsCrystalPrism.cs index db2e0a8e26..7447510c99 100644 --- a/Projectiles/Magic/YharimsCrystalPrism.cs +++ b/Projectiles/Magic/YharimsCrystalPrism.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Projectiles.Magic projectile.ignoreWater = true; } + // TODO -- Make property wrappers for these variables instead of needing to explain them. // ai[0] is a frame counter. ai[1] is the next frame mana will be consumed. // localAI[0] is the number of frames between mana consumptions. public override void AI() @@ -81,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic UpdateAim(rrp, speedTimesScale); // CheckMana returns true if the mana cost can be paid. If mana isn't consumed this frame, the CheckMana short-circuits out of being evaluated. - bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem().mana, true, false); + bool allowContinuedUse = !ShouldConsumeMana() || player.CheckMana(player.ActiveItem(), -1, true, false); bool crystalStillInUse = player.channel && allowContinuedUse && !player.noItems && !player.CCed; // The beams are only projected once (on frame 1). diff --git a/Projectiles/Magic/YharimsCrystalPrism.png b/Projectiles/Magic/YharimsCrystalPrism.png index 61704a1869..5f1cb919f3 100644 Binary files a/Projectiles/Magic/YharimsCrystalPrism.png and b/Projectiles/Magic/YharimsCrystalPrism.png differ diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index a3072f0fdf..92d09a151d 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class AegisBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aegis Blast"); @@ -21,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = false; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 90; + projectile.timeLeft = 60; projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -92,5 +94,10 @@ namespace CalamityMod.Projectiles.Melee num462++; } } - } + + 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); + } + } } diff --git a/Projectiles/Melee/AegisBlast.png b/Projectiles/Melee/AegisBlast.png deleted file mode 100644 index 6330fa4b05..0000000000 Binary files a/Projectiles/Melee/AegisBlast.png and /dev/null differ diff --git a/Projectiles/Melee/AegisBlast2.cs b/Projectiles/Melee/AegisBlast2.cs index 064fc76c7d..5eca076486 100644 --- a/Projectiles/Melee/AegisBlast2.cs +++ b/Projectiles/Melee/AegisBlast2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class AegisBlast2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aegis Blast"); diff --git a/Projectiles/Melee/AegisBlast2.png b/Projectiles/Melee/AegisBlast2.png deleted file mode 100644 index 872a2b413d..0000000000 Binary files a/Projectiles/Melee/AegisBlast2.png and /dev/null differ diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index 3cc4d00770..43af8f7713 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class AegisFlame : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aegis Flame"); @@ -89,13 +91,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Melee/AegisFlame.png b/Projectiles/Melee/AegisFlame.png deleted file mode 100644 index ee4239cbf9..0000000000 Binary files a/Projectiles/Melee/AegisFlame.png and /dev/null differ diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs index 83270509ba..5b019aba3b 100644 --- a/Projectiles/Melee/AftershockRock.cs +++ b/Projectiles/Melee/AftershockRock.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Melee projectile.aiStyle = 14; projectile.friendly = true; projectile.penetrate = 6; + projectile.extraUpdates = 1; projectile.melee = true; projectile.ignoreWater = true; aiType = ProjectileID.BoulderStaffOfEarth; diff --git a/Projectiles/Melee/AmidiasWhirlpool.cs b/Projectiles/Melee/AmidiasWhirlpool.cs index 6dc23c828d..b197c6f61c 100644 --- a/Projectiles/Melee/AmidiasWhirlpool.cs +++ b/Projectiles/Melee/AmidiasWhirlpool.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee int num3; projectile.rotation -= 0.104719758f; Vector2 vector145 = projectile.Center; - float num1015 = 300f; + float num1015 = 100f; bool flag59 = false; int num1016 = 0; if (projectile.ai[1] == 0f) diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs index f72f599121..8aae7b63eb 100644 --- a/Projectiles/Melee/AquaStream.cs +++ b/Projectiles/Melee/AquaStream.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class AquaStream : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aqua Stream"); diff --git a/Projectiles/Melee/AquaStream.png b/Projectiles/Melee/AquaStream.png deleted file mode 100644 index 20a538ba9f..0000000000 Binary files a/Projectiles/Melee/AquaStream.png and /dev/null differ diff --git a/Projectiles/Melee/AstralScytheProjectile.cs b/Projectiles/Melee/AstralScytheProjectile.cs index 7e8ba21c1a..cef90409d8 100644 --- a/Projectiles/Melee/AstralScytheProjectile.cs +++ b/Projectiles/Melee/AstralScytheProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class AstralScytheProjectile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/MantisRing"; + private int tileCounter = 5; public override void SetStaticDefaults() @@ -78,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/AstralScytheProjectile.png b/Projectiles/Melee/AstralScytheProjectile.png deleted file mode 100644 index 81c2a2a657..0000000000 Binary files a/Projectiles/Melee/AstralScytheProjectile.png and /dev/null differ diff --git a/Projectiles/Melee/AtaraxiaMain.cs b/Projectiles/Melee/AtaraxiaMain.cs index cb4852d734..eabda15238 100644 --- a/Projectiles/Melee/AtaraxiaMain.cs +++ b/Projectiles/Melee/AtaraxiaMain.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 12; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.extraUpdates = 2; projectile.timeLeft = 180; } diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index 0a16d89367..97f72d2132 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 8; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.extraUpdates = 2; projectile.timeLeft = 180; } @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { projVec = projVec.RotatedBy(angleVariance); if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer, 0.0f, 0.0f); + Projectile.NewProjectile(projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/AtaraxiaSplit.cs b/Projectiles/Melee/AtaraxiaSplit.cs index f358d451b1..0771c80dd0 100644 --- a/Projectiles/Melee/AtaraxiaSplit.cs +++ b/Projectiles/Melee/AtaraxiaSplit.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; - projectile.timeLeft = 50; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 6; + projectile.timeLeft = 25; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.alpha = 0; diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index ce4a78deaa..68471149f0 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.melee = true; projectile.penetrate = 1; + projectile.extraUpdates = 1; projectile.timeLeft = 300; projectile.alpha = 255; projectile.tileCollide = false; @@ -44,62 +45,69 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 0; } - 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; - vector17.Normalize(); - vector17 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector17) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } + if (projectile.ai[0] >= 0f && projectile.ai[0] < 200f) + { + 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); + 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; + } + else + { + float num559 = 1000f; + int num3; + for (int num560 = 0; num560 < 200; num560 = num3 + 1) + { + 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)) + { + num559 = num563; + projectile.ai[0] = (float)num560; + } + } + num3 = num560; + } + } - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.02f; - } + if (projectile.velocity.X < 0f) + { + 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); + } - if (projectile.velocity.X < 0f) - { - 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); - } + 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; + 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; + Dust expr_7A65_cp_0_cp_0 = Main.dust[num158]; + expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; + } - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlaySound(SoundID.Item8, projectile.position); - for (int num124 = 0; num124 < 10; num124++) - { - int num125 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 5 : 6, projectile.velocity.X, projectile.velocity.Y, 0, default, 2f); - Main.dust[num125].noGravity = true; - Main.dust[num125].velocity = projectile.Center - Main.dust[num125].position; - Main.dust[num125].velocity.Normalize(); - Main.dust[num125].velocity *= -5f; - Main.dust[num125].velocity += projectile.velocity / 2f; - } - } - else - { - 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; - 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; - Dust expr_7A65_cp_0_cp_0 = Main.dust[num158]; - expr_7A65_cp_0_cp_0.velocity.Y *= 0.3f; - } - } + return; + } + + projectile.Kill(); } public override Color? GetAlpha(Color lightColor) @@ -109,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -123,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 10; num623++) @@ -144,8 +152,8 @@ namespace CalamityMod.Projectiles.Melee 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, (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); + 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/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index 41eecddba0..7cdd4761db 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class BansheeHookBoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Boom"); @@ -21,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 6; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BansheeHookBoom.png b/Projectiles/Melee/BansheeHookBoom.png deleted file mode 100644 index 59a8c48354..0000000000 Binary files a/Projectiles/Melee/BansheeHookBoom.png and /dev/null differ diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index 31e5a2e40b..70618dc5ed 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -15,17 +15,20 @@ namespace CalamityMod.Projectiles.Melee { projectile.width = 38; projectile.height = 38; + projectile.aiStyle = 18; + aiType = ProjectileID.DeathSickle; + projectile.alpha = 100; projectile.friendly = true; projectile.melee = true; projectile.tileCollide = false; - projectile.penetrate = 5; - projectile.timeLeft = 180; projectile.ignoreWater = true; - aiType = ProjectileID.DeathSickle; + + projectile.penetrate = -1; + projectile.timeLeft = 90; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = -1; } public override void AI() diff --git a/Projectiles/Melee/BiomeOrb.cs b/Projectiles/Melee/BiomeOrb.cs index f24ae23333..1575ade4b2 100644 --- a/Projectiles/Melee/BiomeOrb.cs +++ b/Projectiles/Melee/BiomeOrb.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -165,45 +165,46 @@ namespace CalamityMod.Projectiles.Melee bool glow = player.ZoneGlowshroom; bool hell = player.ZoneUnderworldHeight; bool holy = player.ZoneHoly; + int debuffTime = 90; if (astral) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime); } else if (jungle) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.Venom, debuffTime); } else if (snow) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime / 3); } else if (beach) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime); } else if (dungeon) { - target.AddBuff(BuffID.Frostburn, 180); + target.AddBuff(BuffID.Frostburn, debuffTime); } else if (desert) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime); } else if (glow) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime / 3); } else if (hell) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime); } else if (holy) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime); } else { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), debuffTime); } } } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 7cfd182482..4cf5a2ce78 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 500f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 8f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 3b51e2f227..4e04f7104e 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class Blood : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blood"); @@ -16,11 +18,13 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 4; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 2; + projectile.penetrate = 1; projectile.timeLeft = 180; } - public override void AI() + 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) @@ -33,7 +37,8 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 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) @@ -41,8 +46,10 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[projectile.owner]; if (player.moonLeech) return; - player.statLife += 5; - player.HealEffect(5); + + int healAmt = 2; + player.statLife += healAmt; + player.HealEffect(healAmt); } } } diff --git a/Projectiles/Melee/Blood.png b/Projectiles/Melee/Blood.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/Blood.png and /dev/null differ diff --git a/Projectiles/Melee/Blood2.cs b/Projectiles/Melee/Blood2.cs index 3fe2db10ca..f55ebc98ae 100644 --- a/Projectiles/Melee/Blood2.cs +++ b/Projectiles/Melee/Blood2.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class Blood2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blood"); @@ -16,11 +18,13 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 4; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 2; + projectile.penetrate = 1; projectile.timeLeft = 150; } - public override void AI() + 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) @@ -33,7 +37,8 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 6f, 20f); + if (projectile.timeLeft < 120) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); } } } diff --git a/Projectiles/Melee/Blood2.png b/Projectiles/Melee/Blood2.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/Blood2.png and /dev/null differ diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index b32f471883..223bebbf57 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -45,14 +46,21 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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.AddBuff(BuffID.Ichor, 60); + target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffID.Ichor, 60); } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Ichor, 60); + target.AddBuff(ModContent.BuffType(), 60); + } } } diff --git a/Projectiles/Melee/BlueAura.cs b/Projectiles/Melee/BlueAura.cs index ca5067e899..51f745879f 100644 --- a/Projectiles/Melee/BlueAura.cs +++ b/Projectiles/Melee/BlueAura.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class BlueAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blue Aura"); @@ -19,6 +21,8 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.penetrate = -1; projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BlueAura.png b/Projectiles/Melee/BlueAura.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Melee/BlueAura.png and /dev/null differ diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 704f138600..6020ec3daa 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -110,14 +110,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 240); } - public override bool? CanHitNPC(NPC target) - { - if (projectile.ai[0] == 1f) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC 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 2d71c0334a..572b5c03eb 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class Brimblast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimblast"); @@ -80,16 +82,9 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Melee/Brimblast.png b/Projectiles/Melee/Brimblast.png deleted file mode 100644 index 72774ce49d..0000000000 Binary files a/Projectiles/Melee/Brimblast.png and /dev/null differ diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index 4f9e18ae7b..2df66b4e13 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class BrimlanceHellfireExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -25,9 +27,9 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 60; projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.png b/Projectiles/Melee/BrimlanceHellfireExplosion.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Melee/BrimlanceHellfireExplosion.png and /dev/null differ diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index 88524b0e3a..7d1bad3b9c 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class BrimlanceStandingFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); @@ -90,16 +92,9 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.immune[projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Melee/BrimlanceStandingFire.png b/Projectiles/Melee/BrimlanceStandingFire.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Melee/BrimlanceStandingFire.png and /dev/null differ diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index da227fae26..5b3b4c17a1 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -29,11 +29,14 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 120; } - public override void AI() + 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); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 15f, 20f); + 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); Main.dust[num458].noGravity = true; @@ -51,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 115) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index 549e560076..401d4e76c0 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index d206aae700..b599a16e14 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class BrimstoneBoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Boom"); @@ -20,35 +22,15 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.tileCollide = false; projectile.melee = true; - projectile.penetrate = -1; - projectile.timeLeft = 10; - } + projectile.penetrate = -1; + projectile.timeLeft = 5; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); float num461 = 25f; if (projectile.ai[0] > 180f) { @@ -62,12 +44,12 @@ namespace CalamityMod.Projectiles.Melee num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float num463 = Main.rand.Next(-10, 11); + float num464 = Main.rand.Next(-10, 11); + float num465 = Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; @@ -76,13 +58,18 @@ namespace CalamityMod.Projectiles.Melee 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); + expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; } } - } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + } + } } diff --git a/Projectiles/Melee/BrimstoneBoom.png b/Projectiles/Melee/BrimstoneBoom.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Melee/BrimstoneBoom.png and /dev/null differ diff --git a/Projectiles/Boss/BrimstoneLaser.png b/Projectiles/Melee/BrimstoneLaser.png similarity index 100% rename from Projectiles/Boss/BrimstoneLaser.png rename to Projectiles/Melee/BrimstoneLaser.png diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index 762fa42ec5..f03f349cf2 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class BrimstoneLaserFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/BrimstoneLaser"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.png b/Projectiles/Melee/BrimstoneLaserFriendly.png deleted file mode 100644 index fc59a4cd75..0000000000 Binary files a/Projectiles/Melee/BrimstoneLaserFriendly.png and /dev/null differ diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.cs b/Projectiles/Melee/BrimstoneSwordExplosion.cs index 7dacf6d46b..ab9abae346 100644 --- a/Projectiles/Melee/BrimstoneSwordExplosion.cs +++ b/Projectiles/Melee/BrimstoneSwordExplosion.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class BrimstoneSwordExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Melee/BrimstoneSwordExplosion.png b/Projectiles/Melee/BrimstoneSwordExplosion.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Melee/BrimstoneSwordExplosion.png and /dev/null differ diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index bb3c922edf..5045a576e4 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -21,12 +21,12 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.ignoreWater = true; projectile.melee = true; - projectile.penetrate = 2; + projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 8; + } public override void AI() { @@ -35,10 +35,6 @@ namespace CalamityMod.Projectiles.Melee float num615 = 1.5f; int num616 = 150; int num617 = 42; - if (Main.rand.NextBool(15)) - { - 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 (projectile.velocity.X != 0f) { projectile.direction = projectile.spriteDirection = -Math.Sign(projectile.velocity.X); @@ -99,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee 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, 10f, 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) { diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 0ac830dfc2..ea7f33242a 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.Melee break; } } - int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), projectile.damage, 6f, Main.myPlayer, 16f, 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/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index 409f95b045..c9ac2cc469 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.penetrate = 1; + projectile.extraUpdates = 2; projectile.timeLeft = 180; projectile.ignoreWater = true; } @@ -74,32 +75,11 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = num58; } projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; - if (Main.rand.NextBool(36)) - { - 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; - } - if (projectile.ai[1] == 1f) - { - projectile.light = 0.9f; - if (Main.rand.NextBool(30)) - { - 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(60)) - { - Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, 150, default, 2f); - } - } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f); } public override void Kill(int timeLeft) { - Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 20); - for (int k = 0; k < 10; k++) + for (int k = 0; k < 5; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, 0f, 0f); } @@ -115,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 175) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 42242bc02f..40b8bd768d 100644 --- a/Projectiles/Melee/CalamityAura.cs +++ b/Projectiles/Melee/CalamityAura.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class CalamityAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aura"); diff --git a/Projectiles/Melee/CalamityAura.png b/Projectiles/Melee/CalamityAura.png deleted file mode 100644 index a92710aa78..0000000000 Binary files a/Projectiles/Melee/CalamityAura.png and /dev/null differ diff --git a/Projectiles/Melee/CalamityAuraType2.cs b/Projectiles/Melee/CalamityAuraType2.cs index abaaa68790..bc6fbfd2e2 100644 --- a/Projectiles/Melee/CalamityAuraType2.cs +++ b/Projectiles/Melee/CalamityAuraType2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class CalamityAuraType2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aura"); diff --git a/Projectiles/Melee/CalamityAuraType2.png b/Projectiles/Melee/CalamityAuraType2.png deleted file mode 100644 index 12072157f8..0000000000 Binary files a/Projectiles/Melee/CalamityAuraType2.png and /dev/null differ diff --git a/Projectiles/Melee/CalamityAuraType3.cs b/Projectiles/Melee/CalamityAuraType3.cs index 44fd90d960..0dbb3485cd 100644 --- a/Projectiles/Melee/CalamityAuraType3.cs +++ b/Projectiles/Melee/CalamityAuraType3.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class CalamityAuraType3 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aura"); diff --git a/Projectiles/Melee/CalamityAuraType3.png b/Projectiles/Melee/CalamityAuraType3.png deleted file mode 100644 index c2f75036f7..0000000000 Binary files a/Projectiles/Melee/CalamityAuraType3.png and /dev/null differ diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index 9d9fe2dc87..102e48382b 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -176,15 +176,12 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.rarity < 2) - { + if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) + target.AddBuff(ModContent.BuffType(), 120); + else target.AddBuff(ModContent.BuffType(), 60); - } - else if (projectile.ai[1] >= 45f && (projectile.ai[0] != 1f || projectile.ai[0] != 2f)) - { - target.AddBuff(ModContent.BuffType(), 30); - } - projectile.ai[0] = 1f; + + projectile.ai[0] = 1f; projectile.netUpdate = true; Main.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 51ed40cdf6..cafe691996 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -34,19 +34,14 @@ namespace CalamityMod.Projectiles.Melee if (projectile.Calamity().lineColor == 2) tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/CometQuasherMeteor3"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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); - 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); + 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); for (int index1 = 0; index1 < 32; ++index1) diff --git a/Projectiles/Melee/CosmicBolt.cs b/Projectiles/Melee/CosmicBolt.cs index 2704b53356..7609b35b86 100644 --- a/Projectiles/Melee/CosmicBolt.cs +++ b/Projectiles/Melee/CosmicBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -25,19 +27,19 @@ namespace CalamityMod.Projectiles.Melee projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { - for (int num441 = 0; num441 < 2; num441++) + for (int i = 0; i < 2; i++) { - Vector2 vector30 = projectile.position; - vector30 -= projectile.velocity * ((float)num441 * 0.25f); + Vector2 spawnPos = projectile.position; + spawnPos -= projectile.velocity * ((float)i * 0.25f); projectile.alpha = 255; - int num442 = Dust.NewDust(vector30, 1, 1, 107, 0f, 0f, 0, default, 1.3f); - Main.dust[num442].position = vector30; - Dust expr_13A3E_cp_0 = Main.dust[num442]; - expr_13A3E_cp_0.position.X += (float)(projectile.width / 2); - Dust expr_13A62_cp_0 = Main.dust[num442]; - expr_13A62_cp_0.position.Y += (float)(projectile.height / 2); - Main.dust[num442].scale = (float)Main.rand.Next(70, 110) * 0.007f; - Main.dust[num442].velocity *= 0.2f; + 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.scale = Main.rand.NextFloat(0.49f, 0.763f); + dust.velocity *= 0.2f; + dust.noGravity = true; } } } diff --git a/Projectiles/Melee/CosmicBolt.png b/Projectiles/Melee/CosmicBolt.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/CosmicBolt.png and /dev/null differ diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index a0d774fab2..91aac35c75 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -28,9 +28,11 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 6; projectile.coldDamage = true; + projectile.extraUpdates = 1; } + public override Color SpecialDrawColor => new Color(150, 255, 255); public override int ExudeDustType => 67; public override int WhipDustType => 187; @@ -102,10 +104,7 @@ namespace CalamityMod.Projectiles.Melee Player player = Main.player[projectile.owner]; target.AddBuff(BuffID.Frostburn, 300); target.AddBuff(ModContent.BuffType(), 300); - if (Main.rand.NextBool(3)) - { - target.AddBuff(ModContent.BuffType(), 120); - } + target.AddBuff(ModContent.BuffType(), 120); 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); diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 08a07c3e6d..fb35a5f95f 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 6; projectile.coldDamage = true; } diff --git a/Projectiles/Melee/CosmicOrb.cs b/Projectiles/Melee/CosmicOrb.cs index 974574a0fc..69593741e6 100644 --- a/Projectiles/Melee/CosmicOrb.cs +++ b/Projectiles/Melee/CosmicOrb.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -52,40 +52,37 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 500f, 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); - Vector2 arg_6751_0 = projectile.Center; - int num3; - for (int num191 = 0; num191 < 10; num191 = num3 + 1) + for (int i = 0; i < 10; i++) { 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; - if (num191 < 30) + 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; + if (i < 30) { - dust20.velocity = value8 * dust20.velocity.Length(); + dust.velocity = offset * dust.velocity.Length(); } else { - dust20.velocity = value8 * (float)Main.rand.Next(45, 91) / 10f; + dust.velocity = offset * Main.rand.NextFloat(4.5f, 9f); } - dust20.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust20.color = Color.Lerp(dust20.color, Color.White, 0.3f); - dust20.noGravity = true; - dust20.scale = 0.7f; - num3 = num191; + dust.color = Main.hslToRgb(0.95f, 0.41f + Main.rand.NextFloat() * 0.2f, 0.93f); + dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + dust.noGravity = true; + dust.scale = 0.7f; } } public override Color? GetAlpha(Color lightColor) { - return new Color(0, 255 - projectile.alpha, 0, 0); + return new Color(200 - projectile.alpha, 200 - projectile.alpha, 200 - projectile.alpha, 200 - projectile.alpha); } } } diff --git a/Projectiles/Melee/CosmicOrb.png b/Projectiles/Melee/CosmicOrb.png index bb4835e1b2..70fb8063aa 100644 Binary files a/Projectiles/Melee/CosmicOrb.png and b/Projectiles/Melee/CosmicOrb.png differ diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs index 30dee538fd..5c69f79a4d 100644 --- a/Projectiles/Melee/CosmicShivBall.cs +++ b/Projectiles/Melee/CosmicShivBall.cs @@ -10,8 +10,10 @@ namespace CalamityMod.Projectiles.Melee { public class CosmicShivBall : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public NPC target = null; - public const float maxDistanceToTarget = 900f; + public const float maxDistanceToTarget = 300f; public bool initialized = false; public float startingVelocityY = 0f; public float randomAngleDelta = 0f; @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.timeLeft = 220; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 8; } public override void AI() { @@ -89,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); } target.AddBuff(ModContent.BuffType(), 360); - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(BuffID.Frostburn, 360); target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(ModContent.BuffType(), 240); diff --git a/Projectiles/Melee/CosmicShivBall.png b/Projectiles/Melee/CosmicShivBall.png deleted file mode 100644 index 93956222b2..0000000000 Binary files a/Projectiles/Melee/CosmicShivBall.png and /dev/null differ diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 62ff9f2b58..1be2131673 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -1,6 +1,7 @@ using System; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee 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(), 180); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.Frostburn, 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs index 8e48d96497..b47fd05e52 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -26,8 +26,9 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 8; } + public override Color SpecialDrawColor => default; public override int ExudeDustType => 176; public override int WhipDustType => 176; @@ -38,6 +39,7 @@ namespace CalamityMod.Projectiles.Melee public override int BodyType2SectionHeight => 18; public override int TailStartY => 108; public override int TailHeight => 50; + public override void ExtraBehavior() { Player player = Main.player[projectile.owner]; @@ -56,7 +58,8 @@ namespace CalamityMod.Projectiles.Melee } 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; - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); + 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; } } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index e7e46a8137..39a122929b 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class CrescentMoonProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/Crescent"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crescent Moon"); @@ -46,12 +48,12 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 460f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/CrescentMoonProj.png b/Projectiles/Melee/CrescentMoonProj.png deleted file mode 100644 index 6d0844d54a..0000000000 Binary files a/Projectiles/Melee/CrescentMoonProj.png and /dev/null differ diff --git a/Projectiles/Melee/CrystalDust.cs b/Projectiles/Melee/CrystalDust.cs index 4d7f87d89e..3e39712389 100644 --- a/Projectiles/Melee/CrystalDust.cs +++ b/Projectiles/Melee/CrystalDust.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class CrystalDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); diff --git a/Projectiles/Melee/CrystalDust.png b/Projectiles/Melee/CrystalDust.png deleted file mode 100644 index 59a8c48354..0000000000 Binary files a/Projectiles/Melee/CrystalDust.png and /dev/null differ diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index b4b754ec2a..af343a5bf9 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class CrystylCrusherRay : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/YharimsCrystalBeam"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystyl Crusher Ray"); @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee projectile.hide = true; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -144,16 +146,7 @@ namespace CalamityMod.Projectiles.Melee */ private void SetLaserPosition(Player player) { - Vector2 maxLength = Main.MouseWorld - Main.player[projectile.owner].Center; - for (Distance = MOVE_DISTANCE; Distance <= maxLength.Length(); Distance += 5f) - { - var start = player.Center + projectile.velocity * Distance; - if (!Collision.CanHit(player.Center, 1, 1, start, 1, 1)) - { - Distance -= 5f; - break; - } - } + Distance = MathHelper.Max(Main.player[projectile.owner].Distance(Main.MouseWorld) - 20f, MOVE_DISTANCE + 5f); } private void ChargeLaser(Player player) diff --git a/Projectiles/Melee/CrystylCrusherRay.png b/Projectiles/Melee/CrystylCrusherRay.png deleted file mode 100644 index 4bcb09bbf2..0000000000 Binary files a/Projectiles/Melee/CrystylCrusherRay.png and /dev/null differ diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index 4d77446134..8bdec6829a 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class Cyclone : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public int dustvortex = 0; public override void SetStaticDefaults() { @@ -104,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Cyclone.png b/Projectiles/Melee/Cyclone.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Melee/Cyclone.png and /dev/null differ diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 157b1c9a72..5b8ee96f4c 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.tileCollide = false; projectile.melee = true; - aiType = ProjectileID.CrystalVileShardHead; + projectile.ignoreWater = true; + aiType = ProjectileID.CrystalVileShardHead; } public override void AI() @@ -90,7 +91,13 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) { - if (!Main.player[projectile.owner].immune) + bool isImmune = false; + for (int j = 0; j < Main.player[projectile.owner].hurtCooldowns.Length; j++) + { + if (Main.player[projectile.owner].hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) { Main.player[projectile.owner].immune = true; Main.player[projectile.owner].immuneTime = 5; diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index 73a8f21372..6c350a5a04 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class DNA2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/DNA"; + public override void SetStaticDefaults() { DisplayName.SetDefault("DNA"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.tileCollide = false; projectile.melee = true; - aiType = ProjectileID.CrystalVileShardShaft; + projectile.ignoreWater = true; + aiType = ProjectileID.CrystalVileShardShaft; } public override void AI() @@ -77,7 +80,13 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == projectile.owner && !CalamityPlayer.areThereAnyDamnBosses) { - if (!Main.player[projectile.owner].immune) + bool isImmune = false; + for (int j = 0; j < Main.player[projectile.owner].hurtCooldowns.Length; j++) + { + if (Main.player[projectile.owner].hurtCooldowns[j] > 0) + isImmune = true; + } + if (!isImmune) { Main.player[projectile.owner].immune = true; Main.player[projectile.owner].immuneTime = 5; diff --git a/Projectiles/Melee/DNA2.png b/Projectiles/Melee/DNA2.png deleted file mode 100644 index c983a54f5a..0000000000 Binary files a/Projectiles/Melee/DNA2.png and /dev/null differ diff --git a/Projectiles/Melee/Dark.cs b/Projectiles/Melee/Dark.cs index 3e25dbb8d9..2474350bf5 100644 --- a/Projectiles/Melee/Dark.cs +++ b/Projectiles/Melee/Dark.cs @@ -6,7 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class Dark : ModProjectile { - private int speedTimer = 120; + private const int speedTimerMax = 60; + private int speedTimer = speedTimerMax; public override void SetStaticDefaults() { @@ -31,25 +32,16 @@ namespace CalamityMod.Projectiles.Melee { projectile.rotation += 0.5f; speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 10f; - projectile.velocity.Y = 0f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = -10f; - projectile.velocity.Y = 0f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } + if (speedTimer <= 0) + { + speedTimer = speedTimerMax; + projectile.velocity *= -1f; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index 791587b2fb..12e84cb99e 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -32,10 +32,8 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.2f / 255f, 0f, (255 - projectile.alpha) * 0.6f / 255f); - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 12f) - { + if (projectile.velocity.Length() < 12f) projectile.velocity *= 1.1f; - } } public override Color? GetAlpha(Color lightColor) @@ -43,15 +41,15 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -72,8 +70,8 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.5), projectile.knockBack * 0.15f, Main.myPlayer, 0f, 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); } } } diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index 4b458f3825..12f6d598ae 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 60); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index f338660fc8..e2288059e5 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -24,13 +24,11 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.penetrate = -1; + projectile.penetrate = 1; projectile.extraUpdates = 5; projectile.tileCollide = false; projectile.melee = true; projectile.alpha = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; projectile.timeLeft = 300; } @@ -42,65 +40,23 @@ namespace CalamityMod.Projectiles.Melee (int)CalamityDusts.Brimstone, 172 }); + if (projectile.position.HasNaNs()) { 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; dust.velocity = Vector2.Zero; dust.noGravity = true; + if (tileCheck) - { dust.noLight = true; - } - if (projectile.ai[1] == -1f) - { - projectile.ai[0] += 1f; - projectile.velocity = Vector2.Zero; - 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; - } - if (projectile.ai[0] >= projectile.MaxUpdates * 3) - { - projectile.Kill(); - } - return; - } - else - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45); - if (projectile.numUpdates == 0) - { - int targetIndex = -1; - float detectRange = 60f; - for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) - { - NPC npc = Main.npc[npcIndex]; - if (npc.CanBeChasedBy(projectile, false)) - { - float npcDist = projectile.Distance(npc.Center); - if (npcDist < detectRange && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) - { - detectRange = npcDist; - targetIndex = npcIndex; - } - } - } - if (targetIndex != -1) - { - projectile.ai[0] = 0f; - projectile.ai[1] = -1f; - projectile.netUpdate = true; - } - } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.ToRadians(45); } public override void Kill(int timeLeft) @@ -147,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -155,8 +111,7 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(BuffID.ShadowFlame, 300); target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 120); - projectile.Kill(); + target.AddBuff(BuffID.Frostburn, 300); } } } diff --git a/Projectiles/Melee/DepthOrb2.cs b/Projectiles/Melee/DepthOrb2.cs index 856ff6d7e7..b07f379930 100644 --- a/Projectiles/Melee/DepthOrb2.cs +++ b/Projectiles/Melee/DepthOrb2.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class DepthOrb2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/DepthOrb"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -36,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 18f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -83,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; projectile.Damage(); } diff --git a/Projectiles/Melee/DepthOrb2.png b/Projectiles/Melee/DepthOrb2.png deleted file mode 100644 index f56704ee79..0000000000 Binary files a/Projectiles/Melee/DepthOrb2.png and /dev/null differ diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index d479e4abb6..399b6f4361 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DevilsSunriseProj.cs b/Projectiles/Melee/DevilsSunriseProj.cs index f3123d482c..6f943b40c1 100644 --- a/Projectiles/Melee/DevilsSunriseProj.cs +++ b/Projectiles/Melee/DevilsSunriseProj.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Melee public class DevilsSunriseProj : ModProjectile { private int red; - private int greenAndBlue = 100; + private const int greenAndBlue = 100; public override void SetStaticDefaults() { diff --git a/Projectiles/Melee/DivineHatchetBoomerang.cs b/Projectiles/Melee/DivineHatchetBoomerang.cs index 2007d73e90..ff43a0d0d5 100644 --- a/Projectiles/Melee/DivineHatchetBoomerang.cs +++ b/Projectiles/Melee/DivineHatchetBoomerang.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Melee { public class DivineHatchetBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Melee/DivineHatchet"; + private bool hasHitEnemy = false; private static int Lifetime = 300; private static int ReboundTime = 100; @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 60; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = 3; + projectile.penetrate = 4; projectile.timeLeft = Lifetime; projectile.melee = true; projectile.extraUpdates = 1; @@ -146,7 +148,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/DivineHatchetBoomerang.png b/Projectiles/Melee/DivineHatchetBoomerang.png deleted file mode 100644 index 991e07cd78..0000000000 Binary files a/Projectiles/Melee/DivineHatchetBoomerang.png and /dev/null differ diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index 8f23a2cb49..96bb15a463 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/DracoBeam2.cs b/Projectiles/Melee/DracoBeam2.cs index 1edd0cf2c6..ff88917a08 100644 --- a/Projectiles/Melee/DracoBeam2.cs +++ b/Projectiles/Melee/DracoBeam2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class DracoBeam2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/DracoBeam"; + private int start = 60; private int speedTimer = 120; @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 240; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -62,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 235) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/DracoBeam2.png b/Projectiles/Melee/DracoBeam2.png deleted file mode 100644 index 1c7c1cf3c6..0000000000 Binary files a/Projectiles/Melee/DracoBeam2.png and /dev/null differ diff --git a/Projectiles/Melee/DraconicSpark.cs b/Projectiles/Melee/DraconicSpark.cs index 7535d8064c..071400b4ab 100644 --- a/Projectiles/Melee/DraconicSpark.cs +++ b/Projectiles/Melee/DraconicSpark.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class DraconicSpark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static int Lifetime = 120; public static float MaxHomingRange = 600f; public static float HomingVelocity = 20f; diff --git a/Projectiles/Melee/DraconicSpark.png b/Projectiles/Melee/DraconicSpark.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Melee/DraconicSpark.png and /dev/null differ diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index a335681163..b65387990b 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -138,6 +138,10 @@ namespace CalamityMod.Projectiles.Melee 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)) + return; + // Inflicts Daybroken, Abyssal Flames and Holy Flames for 8 seconds on-hit target.AddBuff(BuffID.Daybreak, 480); target.AddBuff(ModContent.BuffType(), 480); @@ -146,16 +150,16 @@ namespace CalamityMod.Projectiles.Melee projectile.ai[0] = 1f; projectile.netUpdate = true; - // No petals or waterfalls when hitting dummies. - if (target.type == NPCID.TargetDummy) - return; - PetalStorm(target.Center); Waterfalls(target.Center); } 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)) + return; + // Inflicts Abyssal Flames and Holy Flames for 8 seconds on-hit target.AddBuff(ModContent.BuffType(), 480); target.AddBuff(ModContent.BuffType(), 480); @@ -182,10 +186,13 @@ namespace CalamityMod.Projectiles.Melee { 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); - petal.rotation = angle; - petal.Calamity().forceMelee = true; - petal.usesLocalNPCImmunity = true; - petal.localNPCHitCooldown = -1; + if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) + { + petal.Calamity().forceMelee = true; + petal.rotation = angle; + petal.usesLocalNPCImmunity = true; + petal.localNPCHitCooldown = -1; + } } } } diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs new file mode 100644 index 0000000000..2635b5f79b --- /dev/null +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -0,0 +1,107 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DragonRageFireball : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Rogue/DragonShit"; + public NPC target; + private int lifeTime = 420; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fire"); + 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; + } + + public override void AI() + { + if (projectile.ai[0] == 0f) + { + 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) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.velocity *= 1.01f; + + 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; + } + } + + 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); + return false; + } + + public override void Kill(int timeLeft) + { + Main.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); + Main.dust[idx].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int d = 0; d < 8; d++) + { + 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); + Main.dust[idx].velocity *= 2f; + } + 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) + { + target.AddBuff(BuffID.Daybreak, 120); + } + } +} diff --git a/Projectiles/Melee/DragonRageProj.cs b/Projectiles/Melee/DragonRageProj.cs deleted file mode 100644 index b38af4fda1..0000000000 --- a/Projectiles/Melee/DragonRageProj.cs +++ /dev/null @@ -1,96 +0,0 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DragonRageProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rage"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 15; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 70; - projectile.height = 70; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.melee = true; - projectile.penetrate = 1; - projectile.extraUpdates = 3; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.localAI[0] == 0f) - { - Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); - projectile.localAI[0] += 1f; - } - if (projectile.localAI[1] <= 60f) - { - projectile.localAI[1] += 1f; - projectile.tileCollide = false; - } - Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - if (projectile.owner == Main.myPlayer) - { - Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - explosion.Calamity().forceMelee = true; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - if (projectile.timeLeft > 115) - return false; - - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - - 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 = 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 < 6; num621++) - { - 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)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 9; num623++) - { - 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); - Main.dust[num624].velocity *= 2f; - } - CalamityUtils.ExplosionGores(projectile.Center, 3); - } - } -} diff --git a/Projectiles/Melee/DragonRageProj.png b/Projectiles/Melee/DragonRageProj.png deleted file mode 100644 index 3961db41df..0000000000 Binary files a/Projectiles/Melee/DragonRageProj.png and /dev/null differ diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs new file mode 100644 index 0000000000..57c21c93f0 --- /dev/null +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -0,0 +1,268 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DragonRageStaff : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Rage"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 158; + projectile.scale = 2.2f; + 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; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + float spinCycleTime = 50f; + + // If the player is dead, destroy the projectile + if (player.dead || !player.channel) + { + projectile.Kill(); + player.reuseDelay = 2; + return; + } + + int direction = Math.Sign(projectile.velocity.X); + projectile.velocity = new Vector2(direction, 0f); + + // Initial Rotation + if (projectile.ai[0] == 0f) + { + projectile.rotation = new Vector2(direction, -player.gravDir).ToRotation() + MathHelper.ToRadians(135f); + if (projectile.velocity.X < 0f) + { + projectile.rotation -= MathHelper.PiOver2; + } + } + + 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) + { + player.ChangeDir(expectedDirection); + projectile.velocity = Vector2.UnitX * expectedDirection; + projectile.rotation -= MathHelper.Pi; + projectile.netUpdate = true; + } + SpawnDust(player, direction); + PositionAndRotation(player); + VisibilityAndLight(); + } + + 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; + Vector2 vector2 = num12.ToRotationVector2(); + 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; + } + for (int j = 0; j < 4; j++) + { + float dustVelMult = 1f; + float dustVelMult2 = 1f; + switch (j) + { + case 1: + dustVelMult2 = -1f; + break; + case 2: + dustVelMult2 = 1.25f; + dustVelMult = 0.5f; + break; + case 3: + dustVelMult2 = -1.25f; + dustVelMult = 0.5f; + break; + } + 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.velocity = value4 * (4f + 4f * Main.rand.NextFloat()) * dustVelMult2 * dustVelMult; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 0.5f; + if (Main.rand.NextBool(4)) + { + dust.noGravity = false; + } + } + } + } + + private void PositionAndRotation(Player player) + { + 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; + player.itemTime = player.itemAnimation = 2; + 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) + { + projectile.alpha = 0; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Daybreak, 360); + OnHitEffects(target.Center); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(target.Center); + } + + private void OnHitEffects(Vector2 position) + { + if (projectile.owner == Main.myPlayer) + { + CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); + modPlayer.dragonRageHits++; + if (modPlayer.dragonRageHits > 10) + { + SpawnFireballs(); + 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); + Main.projectile[proj].Calamity().forceMelee = true; + } + } + + private void SpawnFireballs() + { + // 10 to 15 fireballs + int fireballAmt = Main.rand.Next(10, 16); + for (int i = 0; i < fireballAmt; i++) + { + float angleStep = MathHelper.TwoPi / fireballAmt; + float speed = 20f; + 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); + } + } + + 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) + { + 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)) + { + if (npc.noTileCollide || !projectile.ownerHitCheck || projectile.CanHit(npc)) + { + bool canHit; + Rectangle rect = npc.Hitbox; + if (npc.type == NPCID.SolarCrawltipedeTail) + { + int offset = 8; + rect.X -= offset; + rect.Y -= offset; + rect.Width += offset * 2; + rect.Height += offset * 2; + canHit = projectile.Colliding(myRect, rect); + } + else + { + canHit = projectile.Colliding(myRect, rect); + } + if (canHit) + { + hitDirection = (player.Center.X < npc.Center.X) ? 1 : -1; + } + } + } + } + } + } + + public override void CutTiles() + { + float num5 = 60f; + 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)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + 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)) + { + return true; + } + return false; + } + + 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); + Rectangle rectangle = new Rectangle(0, 0, tex.Width, tex.Height); + Vector2 origin = tex.Size() / 2f; + SpriteEffects spriteEffects = SpriteEffects.None; + 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); + return false; + } + } +} diff --git a/Projectiles/Melee/DragonRageStaff.png b/Projectiles/Melee/DragonRageStaff.png new file mode 100644 index 0000000000..38100f5016 Binary files /dev/null and b/Projectiles/Melee/DragonRageStaff.png differ diff --git a/Projectiles/Melee/Earth2.cs b/Projectiles/Melee/Earth2.cs index cb7f58421f..5e4ec106df 100644 --- a/Projectiles/Melee/Earth2.cs +++ b/Projectiles/Melee/Earth2.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(BuffID.Frostburn, 360); } } } diff --git a/Projectiles/Melee/Earth4.cs b/Projectiles/Melee/Earth4.cs index eaae96d583..72f22c834f 100644 --- a/Projectiles/Melee/Earth4.cs +++ b/Projectiles/Melee/Earth4.cs @@ -96,16 +96,18 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { Main.PlaySound(SoundID.Item4, (int)projectile.position.X, (int)projectile.position.Y); - float healAmt = (float)damage * 0.075f; + + float healAmt = damage * 0.075f; if ((int)healAmt == 0) - { return; - } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } } } diff --git a/Projectiles/Melee/ElementBall.cs b/Projectiles/Melee/ElementBall.cs index efd8cdc27e..b80d498d93 100644 --- a/Projectiles/Melee/ElementBall.cs +++ b/Projectiles/Melee/ElementBall.cs @@ -2,11 +2,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class ElementBall : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ball"); @@ -30,13 +33,13 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num250].noGravity = true; Main.dust[num250].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 25f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/ElementBall.png b/Projectiles/Melee/ElementBall.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/ElementBall.png and /dev/null differ diff --git a/Projectiles/Melee/ElementBallShiv.cs b/Projectiles/Melee/ElementBallShiv.cs index f808dd0b00..02413d534e 100644 --- a/Projectiles/Melee/ElementBallShiv.cs +++ b/Projectiles/Melee/ElementBallShiv.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[rainbow].noGravity = true; Main.dust[rainbow].velocity = Vector2.Zero; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 36f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee { OnHitEffects(target.Center); target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee { OnHitEffects(target.Center); target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index af0aef280b..2d7dd4f8ad 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -135,12 +135,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > minDist) { - Vector2 vecToPlayer = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vecToPlayer.HasNaNs()) - { - vecToPlayer = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (inertia - 1f) + vecToPlayer * homingSpeed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; } } else @@ -156,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee case 4: // Green, home in on enemies color = new Color(0, 255, 0, alpha); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 6f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 6f, 20f); break; @@ -338,7 +334,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 1195) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs new file mode 100644 index 0000000000..d912c25de9 --- /dev/null +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -0,0 +1,116 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EmpyreanKnife : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Empyrean Knife"); + 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; + } + + public override void AI() + { + 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; + } + if (projectile.ai[0] < 75f) + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + else + { + projectile.rotation += 0.5f; + } + 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); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + 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; + } + return false; + } + + 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, 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; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float healAmt = damage * 0.005f; + if ((int)healAmt == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 3f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + float healAmt = damage * 0.005f; + if ((int)healAmt == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + 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); + return false; + } + } +} diff --git a/Projectiles/Hybrid/EmpyreanKnife.png b/Projectiles/Melee/EmpyreanKnife.png similarity index 100% rename from Projectiles/Hybrid/EmpyreanKnife.png rename to Projectiles/Melee/EmpyreanKnife.png diff --git a/Projectiles/Melee/EonBeam.cs b/Projectiles/Melee/EonBeam.cs index 089557862f..b08a44a6ac 100644 --- a/Projectiles/Melee/EonBeam.cs +++ b/Projectiles/Melee/EonBeam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; aiType = ProjectileID.EnchantedBeam; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[0] != 1f) //excludes (True) Ark of the Ancients { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/EonBeamV2.cs b/Projectiles/Melee/EonBeamV2.cs index 8e00b9bb2a..c947095945 100644 --- a/Projectiles/Melee/EonBeamV2.cs +++ b/Projectiles/Melee/EonBeamV2.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; aiType = ProjectileID.EnchantedBeam; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.ai[0] != 1f) //excludes True Ark of the Ancients { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/EonBeamV3.cs b/Projectiles/Melee/EonBeamV3.cs index fafd897032..547bab15ee 100644 --- a/Projectiles/Melee/EonBeamV3.cs +++ b/Projectiles/Melee/EonBeamV3.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 200; aiType = ProjectileID.EnchantedBeam; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/EonBeamV4.cs b/Projectiles/Melee/EonBeamV4.cs index a2f685c4f8..80fbfb1412 100644 --- a/Projectiles/Melee/EonBeamV4.cs +++ b/Projectiles/Melee/EonBeamV4.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 200; aiType = ProjectileID.EnchantedBeam; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index ecc1241a95..04366ca82e 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/EssenceFireball.cs b/Projectiles/Melee/EssenceFireball.cs index 36c4e64058..1a36195859 100644 --- a/Projectiles/Melee/EssenceFireball.cs +++ b/Projectiles/Melee/EssenceFireball.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 115) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/EssenceFlame2.cs b/Projectiles/Melee/EssenceFlame2.cs index 9e6f4918c4..4ac31bb0fe 100644 --- a/Projectiles/Melee/EssenceFlame2.cs +++ b/Projectiles/Melee/EssenceFlame2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class EssenceFlame2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Healing/EssenceFlame"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); @@ -20,14 +22,17 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.tileCollide = false; projectile.melee = true; - projectile.timeLeft = 600; + projectile.timeLeft = 180; projectile.alpha = 255; projectile.extraUpdates = 3; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.alpha -= 5; + projectile.frameCounter++; if (projectile.frameCounter > 16) { @@ -35,11 +40,10 @@ namespace CalamityMod.Projectiles.Melee projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); } public override void Kill(int timeLeft) @@ -51,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee 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++) + 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); Main.dust[num622].velocity *= 3f; @@ -61,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 15; num623++) + 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); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Melee/EssenceFlame2.png b/Projectiles/Melee/EssenceFlame2.png deleted file mode 100644 index 3009ead213..0000000000 Binary files a/Projectiles/Melee/EssenceFlame2.png and /dev/null differ diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 1944665937..28be30ba37 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -40,12 +40,12 @@ namespace CalamityMod.Projectiles.Melee 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, 600f, 18f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/EssenceScytheGlow"), 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) @@ -78,9 +78,7 @@ namespace CalamityMod.Projectiles.Melee if (target.life <= 0) { if (projectile.owner == Main.myPlayer) - { CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], 8, ModContent.ProjectileType(), 1200f, 0f); - } } } } diff --git a/Projectiles/Melee/EssenceScytheGlow.png b/Projectiles/Melee/EssenceScytheGlow.png deleted file mode 100644 index ced8513745..0000000000 Binary files a/Projectiles/Melee/EssenceScytheGlow.png and /dev/null differ diff --git a/Projectiles/Melee/EutrophicScimitarProj.cs b/Projectiles/Melee/EutrophicScimitarProj.cs index 921e77504b..bef03ae0c6 100644 --- a/Projectiles/Melee/EutrophicScimitarProj.cs +++ b/Projectiles/Melee/EutrophicScimitarProj.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 60); } public override void AI() diff --git a/Projectiles/Melee/EutrophicSpark.cs b/Projectiles/Melee/EutrophicSpark.cs index 41b6424589..1bc3c24666 100644 --- a/Projectiles/Melee/EutrophicSpark.cs +++ b/Projectiles/Melee/EutrophicSpark.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class EutrophicSpark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eutrophic Spark"); @@ -83,13 +85,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Melee/EutrophicSpark.png b/Projectiles/Melee/EutrophicSpark.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Melee/EutrophicSpark.png and /dev/null differ diff --git a/Projectiles/Melee/ExcelsusBlue.cs b/Projectiles/Melee/ExcelsusBlue.cs index 9f55c3eae6..a4f855a8a7 100644 --- a/Projectiles/Melee/ExcelsusBlue.cs +++ b/Projectiles/Melee/ExcelsusBlue.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; projectile.alpha = 100; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/ExcelsusMain.cs b/Projectiles/Melee/ExcelsusMain.cs index 9eef3383bd..1da6089bfc 100644 --- a/Projectiles/Melee/ExcelsusMain.cs +++ b/Projectiles/Melee/ExcelsusMain.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; projectile.alpha = 100; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 327e302029..045fdf4910 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; projectile.alpha = 100; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/ExoGladComet.cs b/Projectiles/Melee/ExoGladComet.cs index 7ae372dc51..2f78cd5268 100644 --- a/Projectiles/Melee/ExoGladComet.cs +++ b/Projectiles/Melee/ExoGladComet.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class ExoGladComet : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/Exocomet"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Comet"); @@ -78,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/ExoGladComet.png b/Projectiles/Melee/ExoGladComet.png deleted file mode 100644 index abdb698535..0000000000 Binary files a/Projectiles/Melee/ExoGladComet.png and /dev/null differ diff --git a/Projectiles/Melee/ExoGladProj.cs b/Projectiles/Melee/ExoGladProj.cs index 558ddc2dc6..26149951d9 100644 --- a/Projectiles/Melee/ExoGladProj.cs +++ b/Projectiles/Melee/ExoGladProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class ExoGladProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private float counter = 0f; public override void SetStaticDefaults() @@ -55,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 1000f, 36f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/ExoGladProj.png b/Projectiles/Melee/ExoGladProj.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/ExoGladProj.png and /dev/null differ diff --git a/Projectiles/Melee/ExoGladSpears.cs b/Projectiles/Melee/ExoGladSpears.cs index 489d2eea50..eaa489c673 100644 --- a/Projectiles/Melee/ExoGladSpears.cs +++ b/Projectiles/Melee/ExoGladSpears.cs @@ -8,8 +8,12 @@ namespace CalamityMod.Projectiles.Melee { public class ExoGladSpears : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Melee/ExoGladius"; + private Color currentColor = Color.Black; + internal ref float FlySpeedMultiplier => ref projectile.ai[1]; + public override void SetStaticDefaults() { DisplayName.SetDefault("Gladius Beam"); @@ -30,62 +34,22 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - float num953 = 25f * projectile.ai[1]; //100 - float scaleFactor12 = 5f * projectile.ai[1]; //5 - float num954 = 1000f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1000f; - bool flag17 = false; - for (int num475 = 0; num475 < Main.npc.Length; num475++) + 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) { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - else if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; + 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; } } + 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); if (currentColor == Color.Black) @@ -118,23 +82,17 @@ namespace CalamityMod.Projectiles.Melee } // This projectile is always fullbright. - public override Color? GetAlpha(Color lightColor) - { - return currentColor; - } + public override Color? GetAlpha(Color lightColor) => currentColor; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 64); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -147,18 +105,19 @@ namespace CalamityMod.Projectiles.Melee 234, 269 }); - for (int num193 = 0; num193 < 6; num193++) + for (int i = 0; i < 6; i++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0, 0); + Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0, 0); } - for (int num194 = 0; num194 < 10; num194++) + for (int i = 0; i < 10; i++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 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, dustType, 0, 0); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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.velocity *= 2f; + dust.noGravity = true; } } diff --git a/Projectiles/Melee/ExoGladSpears.png b/Projectiles/Melee/ExoGladSpears.png deleted file mode 100644 index e1c9f0323b..0000000000 Binary files a/Projectiles/Melee/ExoGladSpears.png and /dev/null differ diff --git a/Projectiles/Melee/ExoGladiusBeam.cs b/Projectiles/Melee/ExoGladiusBeam.cs index bebcea157f..8482233676 100644 --- a/Projectiles/Melee/ExoGladiusBeam.cs +++ b/Projectiles/Melee/ExoGladiusBeam.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class ExoGladiusBeam : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Melee/ExoGladius"; + private int penetrationAmt = 6; private Color currentColor = Color.Black; public const float maxScale = 1.8f; @@ -109,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/ExoGladiusBeam.png b/Projectiles/Melee/ExoGladiusBeam.png deleted file mode 100644 index e1c9f0323b..0000000000 Binary files a/Projectiles/Melee/ExoGladiusBeam.png and /dev/null differ diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 382ada426d..114907d012 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Exoboom.cs b/Projectiles/Melee/Exoboom.cs index 802afbb5f6..3b6e4b7f46 100644 --- a/Projectiles/Melee/Exoboom.cs +++ b/Projectiles/Melee/Exoboom.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class Exoboom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -25,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 30; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/Exoboom.png b/Projectiles/Melee/Exoboom.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Melee/Exoboom.png and /dev/null differ diff --git a/Projectiles/Melee/Exocomet.cs b/Projectiles/Melee/Exocomet.cs index 400ab230b9..4b9cae0561 100644 --- a/Projectiles/Melee/Exocomet.cs +++ b/Projectiles/Melee/Exocomet.cs @@ -28,9 +28,12 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 1; projectile.alpha = 50; + projectile.timeLeft = 360; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 240 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.frameCounter++; if (projectile.frameCounter > 5) @@ -39,24 +42,15 @@ namespace CalamityMod.Projectiles.Melee projectile.frameCounter = 0; } if (projectile.frame > 4) - { projectile.frame = 0; - } - float num953 = 100f * projectile.ai[1]; //100 - float scaleFactor12 = 20f * projectile.ai[1]; //5 - float num954 = 40f; + 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) { 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); @@ -65,66 +59,66 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num309].velocity *= -0.25f; Main.dust[num309].position -= projectile.velocity * 0.5f; } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.5f); - if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) - { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) - { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } - } + + 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 num954 = 40f; + if (Main.player[projectile.owner].active && !Main.player[projectile.owner].dead) + { + 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; + } + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.ExoDebuffs(); - if (target.type == NPCID.TargetDummy) - { - return; - } - float healAmt = (float)damage * 0.01f; + + float healAmt = damage * 0.01f; if ((int)healAmt == 0) - { return; - } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override void OnHitPvp(Player target, int damage, bool crit) { target.ExoDebuffs(); - float healAmt = (float)damage * 0.01f; + + float healAmt = damage * 0.01f; if ((int)healAmt == 0) - { return; - } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs new file mode 100644 index 0000000000..7b10333b4f --- /dev/null +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -0,0 +1,134 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class FallenPaladinsHammerProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/TruePaladinsHammerMelee"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fallen Paladin's Hammer"); + 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; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.35f, 0.35f, 0f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + 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; + float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); + if (num46 > 3000f) + projectile.Kill(); + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + 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; + } + 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.Y < num45) + { + 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) + { + 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) + { + 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.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + OnHitEffect(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + OnHitEffect(); + } + + private void OnHitEffect() + { + 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); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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 cfb6ed319b..351cdad56a 100644 --- a/Projectiles/Melee/Feather.cs +++ b/Projectiles/Melee/Feather.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class Feather : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/TradewindsProjectile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); diff --git a/Projectiles/Melee/Feather.png b/Projectiles/Melee/Feather.png deleted file mode 100644 index 9dab70ed9c..0000000000 Binary files a/Projectiles/Melee/Feather.png and /dev/null differ diff --git a/Projectiles/Melee/Flarefrost.cs b/Projectiles/Melee/Flarefrost.cs index e91ac5b1fe..adb064c5cf 100644 --- a/Projectiles/Melee/Flarefrost.cs +++ b/Projectiles/Melee/Flarefrost.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class Flarefrost : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flarefrost"); @@ -50,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 14f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/Flarefrost.png b/Projectiles/Melee/Flarefrost.png deleted file mode 100644 index 5188920caa..0000000000 Binary files a/Projectiles/Melee/Flarefrost.png and /dev/null differ diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index a2651d5e87..cd26abb090 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = true; projectile.penetrate = 3; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; aiType = ProjectileID.DemonScythe; } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/FossilSpike.cs b/Projectiles/Melee/FossilSpike.cs index 79a514c741..1281e38dee 100644 --- a/Projectiles/Melee/FossilSpike.cs +++ b/Projectiles/Melee/FossilSpike.cs @@ -19,14 +19,15 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.timeLeft = 300; projectile.melee = true; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { if (Main.rand.NextBool(5)) - { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -34,9 +35,7 @@ namespace CalamityMod.Projectiles.Melee projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } } } } diff --git a/Projectiles/Melee/GaelExplosion.cs b/Projectiles/Melee/GaelExplosion.cs index 59a910a3ae..6e7c23f023 100644 --- a/Projectiles/Melee/GaelExplosion.cs +++ b/Projectiles/Melee/GaelExplosion.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class GaelExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index 7cb8df1cf1..8e5ffc540a 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -39,14 +39,16 @@ namespace CalamityMod.Projectiles.Melee { NPC target = projectile.Center.ClosestNPCAt(GaelsGreatsword.SearchDistance); projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC + if (target != null) { - float velocityMagnitude = projectile.velocity.Length(); - Vector2 distanceNorm = projectile.DirectionTo(target.Center) * velocityMagnitude * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); - float inverseTurnSpeed = (projectile.Distance(target.Center) < 240f ? 4f : 13f); - projectile.velocity = (projectile.velocity * inverseTurnSpeed + distanceNorm) / (inverseTurnSpeed + 0.4f); + 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 + 0.4f); projectile.velocity.Normalize(); - projectile.velocity *= velocityMagnitude; + projectile.velocity *= homingSpeed; } } @@ -123,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index 1ac7cfd262..4fbe0627ec 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class GaelSkull2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/GaelSkull"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin"); @@ -58,12 +60,13 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = target != null; //Go through walls if we're hunting an NPC if (target != null) { - float velocityMagnitude = projectile.velocity.Length(); - Vector2 distanceNorm = projectile.DirectionTo(target.Center) * velocityMagnitude * (projectile.Distance(target.Center) < 220f ? 1.3f : 1f); - float inverseTurnSpeed = (projectile.Distance(target.Center) < 240f ? 4f : 13f); - projectile.velocity = (projectile.velocity * inverseTurnSpeed + distanceNorm) / (inverseTurnSpeed + 0.4f); + 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 + 0.4f); projectile.velocity.Normalize(); - projectile.velocity *= velocityMagnitude; + projectile.velocity *= homingSpeed; } //Dust circle @@ -105,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GaelSkull2.png b/Projectiles/Melee/GaelSkull2.png deleted file mode 100644 index 706be9b2d8..0000000000 Binary files a/Projectiles/Melee/GaelSkull2.png and /dev/null differ diff --git a/Projectiles/Melee/GalacticaComet.cs b/Projectiles/Melee/GalacticaComet.cs index 4afed16530..19801e407d 100644 --- a/Projectiles/Melee/GalacticaComet.cs +++ b/Projectiles/Melee/GalacticaComet.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.penetrate = 1; + projectile.extraUpdates = 1; projectile.timeLeft = 600; projectile.ignoreWater = true; } @@ -106,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/Galaxia.cs b/Projectiles/Melee/Galaxia.cs index effeaf16c3..c07ae74a12 100644 --- a/Projectiles/Melee/Galaxia.cs +++ b/Projectiles/Melee/Galaxia.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 240; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1600f, 35f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -137,113 +137,141 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(ModContent.BuffType(), 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (jungle) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Thorns, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.Leaf, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.Leaf, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (snow) { - target.AddBuff(ModContent.BuffType(), 1200); + target.AddBuff(ModContent.BuffType(), 30); player.AddBuff(BuffID.Warmth, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.IceBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.IceBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } else if (beach) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Wet, 600); int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ProjectileID.FlaironBubble, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (corrupt) { player.AddBuff(BuffID.Wrath, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.CursedFlameFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.CursedFlameFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (ball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } } else if (crimson) { player.AddBuff(BuffID.Rage, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.GoldenShowerFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.GoldenShowerFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (ball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } } else if (dungeon) { target.AddBuff(BuffID.Frostburn, 1200); player.AddBuff(BuffID.Dangersense, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.WaterBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.WaterBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (ball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } } else if (desert) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Endurance, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.BlackBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.BlackBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (glow) { - target.AddBuff(ModContent.BuffType(), 1200); + target.AddBuff(ModContent.BuffType(), 30); player.AddBuff(BuffID.Spelunker, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.Mushroom, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.Mushroom, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (hell) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Inferno, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.BallofFire, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.BallofFire, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (holy) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Heartreach, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.RainbowCrystalExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = -1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.RainbowCrystalExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; + } } else if (nebula) { player.AddBuff(BuffID.MagicPower, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.NebulaBlaze1, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.NebulaBlaze1, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (stardust) { player.AddBuff(BuffID.Summoning, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.StardustCellMinionShot, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.StardustCellMinionShot, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (ball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } } else if (solar) { player.AddBuff(BuffID.Titan, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.SolarWhipSwordExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.SolarWhipSwordExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } else if (vortex) { player.AddBuff(BuffID.AmmoReservation, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.VortexBeaterRocket, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = -1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.VortexBeaterRocket, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; + } } else { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.DryadsWard, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.TerrarianBeam, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.TerrarianBeam, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + if (ball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ball].penetrate = 1; + } } } } diff --git a/Projectiles/Melee/Galaxia2.cs b/Projectiles/Melee/Galaxia2.cs index eebc2baa87..576111a1a9 100644 --- a/Projectiles/Melee/Galaxia2.cs +++ b/Projectiles/Melee/Galaxia2.cs @@ -13,6 +13,8 @@ namespace CalamityMod.Projectiles.Melee { public class Galaxia2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/Galaxia"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 2; projectile.melee = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -84,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1600f, 35f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -94,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -136,113 +138,139 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(ModContent.BuffType(), 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (jungle) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Thorns, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.Leaf, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.Leaf, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (snow) { - target.AddBuff(ModContent.BuffType(), 1200); + target.AddBuff(ModContent.BuffType(), 30); player.AddBuff(BuffID.Warmth, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.IceBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.IceBolt, projectile.damage, projectile.knockBack, projectile.owner); } else if (beach) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Wet, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ProjectileID.FlaironBubble, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, ProjectileID.FlaironBubble, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (corrupt) { player.AddBuff(BuffID.Wrath, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.CursedFlameFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.CursedFlameFriendly, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].penetrate = 1; + } } else if (crimson) { player.AddBuff(BuffID.Rage, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.GoldenShowerFriendly, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.GoldenShowerFriendly, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].penetrate = 1; + } } else if (dungeon) { target.AddBuff(BuffID.Frostburn, 1200); player.AddBuff(BuffID.Dangersense, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.WaterBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.WaterBolt, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].penetrate = 1; + } } else if (desert) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Endurance, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.BlackBolt, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.BlackBolt, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (glow) { - target.AddBuff(ModContent.BuffType(), 1200); + target.AddBuff(ModContent.BuffType(), 30); player.AddBuff(BuffID.Spelunker, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.Mushroom, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.Mushroom, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (hell) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Inferno, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.BallofFire, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.BallofFire, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (holy) { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.Heartreach, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.RainbowCrystalExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = -1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.RainbowCrystalExplosion, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; + } } else if (nebula) { player.AddBuff(BuffID.MagicPower, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.NebulaBlaze1, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.NebulaBlaze1, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } else if (stardust) { player.AddBuff(BuffID.Summoning, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.StardustCellMinionShot, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].Calamity().forceMelee = true; - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.StardustCellMinionShot, projectile.damage, projectile.knockBack, projectile.owner); + if (ball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[ball].Calamity().forceMelee = true; + Main.projectile[ball].penetrate = 1; + } } else if (solar) { player.AddBuff(BuffID.Titan, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.SolarWhipSwordExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.SolarWhipSwordExplosion, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } else if (vortex) { player.AddBuff(BuffID.AmmoReservation, 600); - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.VortexBeaterRocket, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = -1; + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.VortexBeaterRocket, projectile.damage, projectile.knockBack, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = -1; + } } else { target.AddBuff(ModContent.BuffType(), 1200); player.AddBuff(BuffID.DryadsWard, 600); - int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, ProjectileID.TerrarianBeam, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + int ball = Projectile.NewProjectile(projectile.Center, projectile.velocity, ProjectileID.TerrarianBeam, projectile.damage, projectile.knockBack, projectile.owner); + if (ball.WithinBounds(Main.maxProjectiles)) + Main.projectile[ball].penetrate = 1; } } } diff --git a/Projectiles/Melee/Galaxia2.png b/Projectiles/Melee/Galaxia2.png deleted file mode 100644 index b20c4ac089..0000000000 Binary files a/Projectiles/Melee/Galaxia2.png and /dev/null differ diff --git a/Projectiles/Melee/GalaxyBlast.cs b/Projectiles/Melee/GalaxyBlast.cs index 49366690f0..819d69bf99 100644 --- a/Projectiles/Melee/GalaxyBlast.cs +++ b/Projectiles/Melee/GalaxyBlast.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxyBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Melee/GalaxyBlast.png b/Projectiles/Melee/GalaxyBlast.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Melee/GalaxyBlast.png and /dev/null differ diff --git a/Projectiles/Melee/GalaxyBlastType2.cs b/Projectiles/Melee/GalaxyBlastType2.cs index 38701c980b..e2a9526cba 100644 --- a/Projectiles/Melee/GalaxyBlastType2.cs +++ b/Projectiles/Melee/GalaxyBlastType2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxyBlastType2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Melee/GalaxyBlastType2.png b/Projectiles/Melee/GalaxyBlastType2.png deleted file mode 100644 index 2c535decee..0000000000 Binary files a/Projectiles/Melee/GalaxyBlastType2.png and /dev/null differ diff --git a/Projectiles/Melee/GalaxyBlastType3.cs b/Projectiles/Melee/GalaxyBlastType3.cs index 7320c808ad..23bc05baa7 100644 --- a/Projectiles/Melee/GalaxyBlastType3.cs +++ b/Projectiles/Melee/GalaxyBlastType3.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class GalaxyBlastType3 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Melee/GalaxyBlastType3.png b/Projectiles/Melee/GalaxyBlastType3.png deleted file mode 100644 index 5188920caa..0000000000 Binary files a/Projectiles/Melee/GalaxyBlastType3.png and /dev/null differ diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs new file mode 100644 index 0000000000..cd539f4edb --- /dev/null +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -0,0 +1,213 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class GalaxySmasherHammer : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/GalaxySmasherMelee"; + + private static float RotationIncrement = 0.22f; + private static int Lifetime = 240; + private static float ReboundTime = 26f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Galaxy Smasher"); + 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; + + // Slightly ignores iframes so it can easily hit twice. + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + } + + public override void AI() + { + drawOffsetX = -12; + drawOriginOffsetY = -5; + drawOriginOffsetX = 0; + + // Produces violet dust constantly while in flight. This lights the hammer. + int numDust = 2; + for (int i = 0; i < numDust; ++i) + { + 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); + 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) + { + projectile.soundDelay = 8; + Main.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) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= ReboundTime) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float returnSpeed = GalaxySmasherMelee.Speed; + float acceleration = 3.2f; + 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 dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + 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(); + } + + // Rotate the hammer as it flies. + projectile.rotation += RotationIncrement; + return; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Applies God Slayer Inferno on contact. + target.AddBuff(ModContent.BuffType(), 480); + OnHitEffect(target.Center); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + // Applies God Slayer Inferno on contact. + target.AddBuff(ModContent.BuffType(), 480); + OnHitEffect(target.Center); + } + + private void OnHitEffect(Vector2 targetPos) + { + // Some dust gets produced on impact. + int dustSets = Main.rand.Next(5, 8); + int dustRadius = 6; + Vector2 corner = new Vector2(targetPos.X - dustRadius, targetPos.Y - dustRadius); + for (int i = 0; i < dustSets; ++i) + { + // Bigger, flying orb dust + float scaleOrb = 1.2f + Main.rand.NextFloat(1f); + int orb = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 112); + Main.dust[orb].noGravity = true; + Main.dust[orb].velocity *= 4f; + Main.dust[orb].scale = scaleOrb; + + // Add six sparkles per flying orb + for (int j = 0; j < 6; ++j) + { + float scaleSparkle = 0.8f + Main.rand.NextFloat(1.1f); + int sparkle = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, 173); + Main.dust[sparkle].noGravity = true; + float dustSpeed = Main.rand.NextFloat(10f, 18f); + Main.dust[sparkle].velocity = Main.rand.NextVector2Unit() * dustSpeed; + Main.dust[sparkle].scale = scaleSparkle; + } + } + + // Makes an explosion sound. + Main.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); + float laserKB = 2.5f; + int numLasers = 3; + for (int i = 0; i < numLasers; ++i) + { + float startDist = Main.rand.NextFloat(260f, 270f); + Vector2 startDir = Main.rand.NextVector2Unit(); + Vector2 startPoint = targetPos + startDir * startDist; + + float laserSpeed = Main.rand.NextFloat(15f, 18f); + Vector2 velocity = startDir * -laserSpeed; + + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, projectile.owner); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = 30; + } + } + } + } + } +} diff --git a/Projectiles/Melee/GalaxyStar.cs b/Projectiles/Melee/GalaxyStar.cs index 4a120d526d..5efedec6c9 100644 --- a/Projectiles/Melee/GalaxyStar.cs +++ b/Projectiles/Melee/GalaxyStar.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.timeLeft = 160; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 8; } public override void AI() { @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 189e53838d..35e7ef2063 100644 --- a/Projectiles/Melee/GalileosMoon.cs +++ b/Projectiles/Melee/GalileosMoon.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class GalileosMoon : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/Crescent"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crescent Moon"); @@ -25,12 +27,12 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.melee = true; projectile.tileCollide = false; - projectile.penetrate = 10; - projectile.timeLeft = 300; + projectile.penetrate = 12; + projectile.extraUpdates = 1; + projectile.timeLeft = 135 * projectile.MaxUpdates; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.extraUpdates = 1; + projectile.localNPCHitCooldown = projectile.MaxUpdates * 10; } public override void AI() @@ -44,46 +46,13 @@ namespace CalamityMod.Projectiles.Melee Main.PlaySound(SoundID.Item9, projectile.position); } } - projectile.rotation += (float) projectile.direction * 0.05f; - projectile.rotation += (float) ((double) projectile.direction * 0.5); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 460f; - bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + projectile.rotation += projectile.direction * 0.55f; + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 10f, 25f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GalileosMoon.png b/Projectiles/Melee/GalileosMoon.png deleted file mode 100644 index 6d0844d54a..0000000000 Binary files a/Projectiles/Melee/GalileosMoon.png and /dev/null differ diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index 3853e7760b..a1d4069b10 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Melee { public class GalileosPlanet : ModProjectile { - private int radius = 47; + private int radius = 84; public override void SetStaticDefaults() { @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/GelWave.cs b/Projectiles/Melee/GelWave.cs index 996d4c22a3..46a69dc997 100644 --- a/Projectiles/Melee/GelWave.cs +++ b/Projectiles/Melee/GelWave.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 195) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 62bb73ddd1..b35f36eeff 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class GhastlySoulLarge : ModProjectile @@ -57,16 +59,12 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 600f, 14f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } else { @@ -79,10 +77,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) - return false; + if (projectile.timeLeft > 595) + return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -113,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); - Main.PlaySound(SoundID.NPCDeath39, projectile.position); + Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 080d2d211b..aefe6f8984 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class GhastlySoulMedium : ModProjectile @@ -57,16 +59,12 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 600f, 16f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } else { @@ -79,10 +77,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) - return false; + if (projectile.timeLeft > 595) + return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -113,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); - Main.PlaySound(SoundID.NPCDeath39, projectile.position); + Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 9047b19995..462b6848e9 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -1,10 +1,12 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class GhastlySoulSmall : ModProjectile @@ -56,16 +58,12 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 600f, 18f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } else { @@ -78,10 +76,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) - return false; + if (projectile.timeLeft > 595) + return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -112,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); - Main.PlaySound(SoundID.NPCDeath39, projectile.position); + Main.PlaySound(SoulEdge.ProjectileDeathSound, projectile.Center); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Melee/GreenBall.cs b/Projectiles/Melee/GreenBall.cs deleted file mode 100644 index f7c99668db..0000000000 --- a/Projectiles/Melee/GreenBall.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GreenBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Green Bag"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.alpha = 255; - projectile.aiStyle = 14; - projectile.timeLeft = 300; - } - - 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); - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - if (projectile.alpha > 0) - projectile.alpha = 0; - } - projectile.rotation = projectile.velocity.X * 0.04f; - if (projectile.timeLeft % 15 == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - projectile.velocity *= 0.98f; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 120); - } - } -} diff --git a/Projectiles/Melee/GreenBall.png b/Projectiles/Melee/GreenBall.png deleted file mode 100644 index d2f546e3da..0000000000 Binary files a/Projectiles/Melee/GreenBall.png and /dev/null differ diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 800cffb86e..875c9525d8 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 145) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 64c2de990b..ece55b9b9e 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -73,8 +73,11 @@ namespace CalamityMod.Projectiles.Melee 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); - petal.Calamity().forceMelee = true; - petal.localNPCHitCooldown = -1; + if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) + { + petal.Calamity().forceMelee = true; + petal.localNPCHitCooldown = -1; + } } } } diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 73413c4317..60b5fd08f2 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class HolyColliderHolyFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/HolyFire2"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -23,10 +25,12 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 1; projectile.tileCollide = false; - projectile.timeLeft = 60; + projectile.timeLeft = 90; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 75 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.frameCounter++; if (projectile.frameCounter > 6) @@ -35,26 +39,14 @@ namespace CalamityMod.Projectiles.Melee projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } + if (Math.Abs(projectile.velocity.X) < 7f) - { projectile.velocity.X *= 1.05f; - } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); - 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; - vector11.Normalize(); - vector11 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 24f + vector11) / 25f; - projectile.velocity.Normalize(); - projectile.velocity *= scaleFactor2; - } - } + + if (projectile.timeLeft < 75) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 450f, 12f, 20f); + } public override Color? GetAlpha(Color lightColor) { diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index 18a8a5d620..c4b8df0d77 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -25,18 +25,19 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.melee = true; projectile.penetrate = 5; - projectile.timeLeft = 180; + projectile.timeLeft = 300; projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; + projectile.extraUpdates = 1; } public override void AI() { Lighting.AddLight(projectile.Center, 0f, 0.5f, 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 25f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 10f, 10f); } public override Color? GetAlpha(Color lightColor) @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 47e0d51738..64d6973bde 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class IceBombFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/IceBomb"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bomb"); @@ -27,8 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.985f; + projectile.velocity *= 0.985f; 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); @@ -48,10 +49,12 @@ namespace CalamityMod.Projectiles.Melee 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, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile1].Calamity().forceMelee = true; - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].Calamity().forceMelee = true; + 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; + 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; } } for (int k = 0; k < 3; k++) diff --git a/Projectiles/Melee/IceBombFriendly.png b/Projectiles/Melee/IceBombFriendly.png deleted file mode 100644 index a960989721..0000000000 Binary files a/Projectiles/Melee/IceBombFriendly.png and /dev/null differ diff --git a/Projectiles/Melee/Iceberg.cs b/Projectiles/Melee/Iceberg.cs index e2c3678cd8..ba84846d62 100644 --- a/Projectiles/Melee/Iceberg.cs +++ b/Projectiles/Melee/Iceberg.cs @@ -8,9 +8,13 @@ namespace CalamityMod.Projectiles.Melee { public class Iceberg : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/IceBomb"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Iceberg"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -21,15 +25,13 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 1; projectile.timeLeft = 300; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; projectile.coldDamage = true; } public override void AI() { projectile.rotation += 0.5f; - int dust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; } @@ -56,12 +58,12 @@ namespace CalamityMod.Projectiles.Melee { int debuffDuration = 300 - projectile.timeLeft; if (projectile.timeLeft < 270) - target.AddBuff(ModContent.BuffType(), debuffDuration); + target.AddBuff(ModContent.BuffType(), debuffDuration / 3); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/Iceberg.png b/Projectiles/Melee/Iceberg.png deleted file mode 100644 index a960989721..0000000000 Binary files a/Projectiles/Melee/Iceberg.png and /dev/null differ diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs new file mode 100644 index 0000000000..aadda9a3f7 --- /dev/null +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -0,0 +1,102 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class IllustriousKnife : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Illustrious Knife"); + 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.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + 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); + } + if (projectile.ai[0] < 240f) + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 1.57f; + else + { + projectile.rotation += 0.5f; + } + 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); + } + + 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); + Main.dust[num304].noGravity = true; + Main.dust[num304].velocity *= 1.2f; + Main.dust[num304].velocity -= projectile.oldVelocity * 0.3f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + + float healAmt = damage * 0.015f; + if ((int)healAmt == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + + float healAmt = damage * 0.015f; + if ((int)healAmt == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + 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); + return false; + } + } +} diff --git a/Projectiles/Hybrid/IllustriousKnife.png b/Projectiles/Melee/IllustriousKnife.png similarity index 100% rename from Projectiles/Hybrid/IllustriousKnife.png rename to Projectiles/Melee/IllustriousKnife.png diff --git a/Projectiles/Melee/InsidiousHarpoon.cs b/Projectiles/Melee/InsidiousHarpoon.cs index f395b7deba..42cc303867 100644 --- a/Projectiles/Melee/InsidiousHarpoon.cs +++ b/Projectiles/Melee/InsidiousHarpoon.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 ee36a00ec2..dfa50bcd89 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -76,12 +76,8 @@ namespace CalamityMod.Projectiles.Melee 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) * 6f), (float)(Math.Cos(offsetAngle) * 6f), ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 6f), (float)(-Math.Cos(offsetAngle) * 6f), 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; - Main.projectile[projectile2].velocity.Y *= 0.1f; + 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; @@ -92,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 10f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -105,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 115) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 46b1316257..acea99dd2a 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class JudgementProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + int whiteLightTimer = 5; public override void SetStaticDefaults() @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity += projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 9f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 9f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/JudgementProj.png b/Projectiles/Melee/JudgementProj.png deleted file mode 100644 index e6c2d4b44a..0000000000 Binary files a/Projectiles/Melee/JudgementProj.png and /dev/null differ diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index d07c1d5c8e..e04bb71148 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Melee { public class LaserFountain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fountain"); @@ -31,8 +33,11 @@ namespace CalamityMod.Projectiles.Melee 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); - Main.projectile[projectile1].Calamity().forceMelee = true; - Main.projectile[projectile1].aiStyle = 1; + if (projectile1.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[projectile1].Calamity().forceMelee = true; + Main.projectile[projectile1].aiStyle = 1; + } } projectile.localAI[0] = 0f; } diff --git a/Projectiles/Melee/LaserFountain.png b/Projectiles/Melee/LaserFountain.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/LaserFountain.png and /dev/null differ diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index f1a95baf0d..6bd904b1b7 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class Leech : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Leech"); @@ -15,12 +17,14 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 4; projectile.height = 4; projectile.friendly = true; - projectile.penetrate = 2; + projectile.penetrate = 1; projectile.timeLeft = 180; projectile.melee = true; } - public override void AI() + 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) @@ -33,24 +37,24 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 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); - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Main.player[projectile.owner].moonLeech) return; + Player player = Main.player[projectile.owner]; - player.statLife += 5; - player.HealEffect(5); + player.statLife += 2; + player.HealEffect(2); } } } diff --git a/Projectiles/Melee/Leech.png b/Projectiles/Melee/Leech.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/Leech.png and /dev/null differ diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index e5d767f97e..946a1feb42 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 55; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 3; + projectile.penetrate = 5; projectile.timeLeft = 240; projectile.ignoreWater = true; projectile.tileCollide = false; @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - float num395 = (float)Main.mouseTextColor / 200f - 0.35f; + float num395 = Main.mouseTextColor / 200f - 0.35f; num395 *= 0.2f; projectile.scale = num395 + 0.95f; @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 d3945cd8de..324ee2484f 100644 --- a/Projectiles/Melee/Light.cs +++ b/Projectiles/Melee/Light.cs @@ -6,7 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class Light : ModProjectile { - private int speedTimer = 120; + private const int speedTimerMax = 60; + private int speedTimer = 0; public override void SetStaticDefaults() { @@ -19,7 +20,6 @@ namespace CalamityMod.Projectiles.Melee { projectile.width = 10; projectile.height = 10; - projectile.aiStyle = 27; projectile.friendly = true; projectile.melee = true; projectile.ignoreWater = true; @@ -31,26 +31,17 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { projectile.rotation += 0.5f; - speedTimer--; - if (speedTimer > 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = 10f; - } - else if (speedTimer <= 60) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -10f; - } - if (speedTimer <= 0) - { - speedTimer = 120; - } - } + speedTimer--; + if (speedTimer <= 0) + { + speedTimer = speedTimerMax; + projectile.velocity *= -1f; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 3a1ee284a3..eedf5d49ab 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -32,10 +32,8 @@ namespace CalamityMod.Projectiles.Melee { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.6f / 255f, 0f, (255 - projectile.alpha) * 0.2f / 255f); - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 18f) - { + if (projectile.velocity.Length() < 18f) projectile.velocity *= 1.1f; - } } public override Color? GetAlpha(Color lightColor) @@ -43,15 +41,15 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -72,8 +70,8 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)((double)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 d348763537..1a7c2b29b9 100644 --- a/Projectiles/Melee/LightningThing.cs +++ b/Projectiles/Melee/LightningThing.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class LightningThing : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Lightning"); @@ -22,15 +24,18 @@ namespace CalamityMod.Projectiles.Melee } public override void Kill(int timeLeft) { - int damage = GaelsGreatsword.BaseDamage; + 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, GaelsGreatsword.BaseDamage, 0f, projectile.owner, + ProjectileID.CultistBossLightningOrbArc, damage, 0f, projectile.owner, MathHelper.PiOver2, Main.rand.Next(100)); - Main.projectile[idx].Calamity().forceMelee = true; - Main.projectile[idx].usesLocalNPCImmunity = true; - Main.projectile[idx].localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; + if (idx.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[idx].Calamity().forceMelee = true; + Main.projectile[idx].usesLocalNPCImmunity = true; + Main.projectile[idx].localNPCHitCooldown = GaelsGreatsword.ImmunityFrames; + } } } } diff --git a/Projectiles/Melee/LightningThing.png b/Projectiles/Melee/LightningThing.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/LightningThing.png and /dev/null differ diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index b5777d5a32..0385f93871 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/LuxorsGiftMelee.png b/Projectiles/Melee/LuxorsGiftMelee.png index 4f4e05f92d..ebc25190b1 100644 Binary files a/Projectiles/Melee/LuxorsGiftMelee.png and b/Projectiles/Melee/LuxorsGiftMelee.png differ diff --git a/Projectiles/Melee/MarianaProjectile.cs b/Projectiles/Melee/MarianaProjectile.cs index 999c67817c..c6bac1aa4d 100644 --- a/Projectiles/Melee/MarianaProjectile.cs +++ b/Projectiles/Melee/MarianaProjectile.cs @@ -18,14 +18,19 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 16; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 3; - projectile.timeLeft = 120; + projectile.penetrate = 1; + projectile.timeLeft = 180; } - public override void AI() + 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); - } + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 9f, 20f); + } public override Color? GetAlpha(Color lightColor) { diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs index ebbeb8d830..ded6ad31d2 100644 --- a/Projectiles/Melee/MeldGreatswordBigProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 0c511c7c71..9f09ffface 100644 --- a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 c472068f63..2d345ff58f 100644 --- a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -52,12 +52,12 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].noGravity = true; Main.dust[num458].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index 5b0e461914..52402d19b8 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class MicrowaveAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int radius = 100; public override void SetStaticDefaults() @@ -32,19 +34,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - 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[0] && p.active && p.type == ModContent.ProjectileType()) - { - parent = p; - active = true; - } - } - - if (active) + Projectile parent = FindParent(); + if (parent != null && parent.active) { projectile.Center = parent.Center; projectile.timeLeft = 2; @@ -53,18 +44,43 @@ namespace CalamityMod.Projectiles.Melee { projectile.Kill(); } - - if (!parent.active) - { - projectile.Kill(); - } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { 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); + (FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60; + } } + public override void OnHitPvp(Player target, int damage, bool crit) + { + 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); + (FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60; + } + } + + private Projectile FindParent() + { + Projectile parent = null; + 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) + { + parent = p; + break; + } + } + return parent; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); diff --git a/Projectiles/Melee/MicrowaveAura.png b/Projectiles/Melee/MicrowaveAura.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Melee/MicrowaveAura.png and /dev/null differ diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index ae3fb1ef53..fa16337150 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f9b7cfa4e7..f24cac9b6b 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -54,32 +54,44 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer != projectile.owner) return; - if (target.type == NPCID.TargetDummy || 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) return; float healAmt = damage * Main.rand.NextFloat(0.075f, 0.9f); if (healAmt < 1f) healAmt = 1f; + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); + 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) return; + if (Main.player[projectile.owner].moonLeech) return; + if (Main.player[projectile.owner].lifeSteal <= 0f) return; float healAmt = damage * Main.rand.NextFloat(0.075f, 0.9f); if (healAmt < 1f) healAmt = 1f; + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + if (Main.rand.NextBool(3)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ProjectileID.VampireHeal, 1200f, 1.5f); + 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 c526fdfb56..f969c3ae27 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 255; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.extraUpdates = 1; + projectile.extraUpdates = 2; } public override void AI() @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index e108572efd..58d3a0702e 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 4; + projectile.extraUpdates = 1; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -32,8 +33,10 @@ namespace CalamityMod.Projectiles.Melee // 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) { - 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; } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index e7e857700b..80058e9f6c 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -24,6 +24,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 override void SetStaticDefaults() @@ -35,23 +36,27 @@ namespace CalamityMod.Projectiles.Melee { 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.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; + 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) + return false; 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, 1f, spriteEffects, 0f); + spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); return false; } @@ -68,9 +73,6 @@ namespace CalamityMod.Projectiles.Melee CurrentFrame = 0; } - // Increment a timer for it to not deal damage the first few frames - projectile.ai[0]++; - // Play a "droning" noise every so often. if (Slashing) { @@ -102,7 +104,8 @@ namespace CalamityMod.Projectiles.Melee 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; + float offset = 80f * projectile.scale; + projectile.position = playerRotatedPoint - projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * offset; // Sprite and player directioning. projectile.spriteDirection = projectile.direction; @@ -137,7 +140,6 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 0, 0); - // You could possibly mess with the local immunity, but I personally prefer this method since it's actually specific. - public override bool CanDamage() => Slashing && projectile.ai[0] > 10f; + //public override bool CanDamage() => Slashing; } } diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index aa8f896117..83edf2475c 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class Nebudust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); @@ -22,35 +24,13 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 6; + } 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); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); float num461 = 25f; if (projectile.ai[0] > 60f) { diff --git a/Projectiles/Melee/Nebudust.png b/Projectiles/Melee/Nebudust.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Melee/Nebudust.png and /dev/null differ diff --git a/Projectiles/Melee/NebulaShot.cs b/Projectiles/Melee/NebulaShot.cs index f85d4b842d..c6931eadca 100644 --- a/Projectiles/Melee/NebulaShot.cs +++ b/Projectiles/Melee/NebulaShot.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class NebulaShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shot"); @@ -23,8 +25,6 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = 1; projectile.extraUpdates = 5; projectile.timeLeft = 600; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; } public override void AI() diff --git a/Projectiles/Melee/NebulaShot.png b/Projectiles/Melee/NebulaShot.png deleted file mode 100644 index ef1edb7c71..0000000000 Binary files a/Projectiles/Melee/NebulaShot.png and /dev/null differ diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 4ab697431c..7bc78626a8 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -5,10 +5,13 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { public class NeptuneOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/DepthOrb"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -29,12 +32,10 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0f, 0f, 1f); - if (projectile.timeLeft % 20 == 19) + if (projectile.timeLeft % 20 == 19 && projectile.owner == Main.myPlayer) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), projectile.damage, 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); Main.dust[num458].noGravity = true; @@ -44,10 +45,10 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 295) - return false; + if (projectile.timeLeft > 295) + return false; - Texture2D tex = Main.projectileTexture[projectile.type]; + 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; } @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; projectile.Damage(); } diff --git a/Projectiles/Melee/NeptuneOrb.png b/Projectiles/Melee/NeptuneOrb.png deleted file mode 100644 index f56704ee79..0000000000 Binary files a/Projectiles/Melee/NeptuneOrb.png and /dev/null differ diff --git a/Projectiles/Melee/NightStabber.cs b/Projectiles/Melee/NightStabber.cs index 6ecc088b0c..c7c57a7b87 100644 --- a/Projectiles/Melee/NightStabber.cs +++ b/Projectiles/Melee/NightStabber.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class NightStabber : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Stabber"); @@ -17,11 +19,13 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = false; - projectile.timeLeft = 300; + projectile.timeLeft = 180; projectile.melee = true; } - public override void AI() + 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) @@ -34,7 +38,8 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 7f, 20f); + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 7f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/NightStabber.png b/Projectiles/Melee/NightStabber.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/NightStabber.png and /dev/null differ diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index ebbde7105f..4959223b36 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index 14eda93e97..ebc7132934 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/OmegaBiomeOrb.cs b/Projectiles/Melee/OmegaBiomeOrb.cs index ec3f516763..eb38795df7 100644 --- a/Projectiles/Melee/OmegaBiomeOrb.cs +++ b/Projectiles/Melee/OmegaBiomeOrb.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee aiType = ProjectileID.LightBeam; projectile.friendly = true; projectile.penetrate = 1; - projectile.timeLeft = 240; + projectile.timeLeft = 120; projectile.melee = true; } @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 235) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -217,7 +217,7 @@ namespace CalamityMod.Projectiles.Melee } else if (snow) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 30); } else if (beach) { @@ -233,7 +233,7 @@ namespace CalamityMod.Projectiles.Melee } else if (glow) { - target.AddBuff(ModContent.BuffType(), 600); + target.AddBuff(ModContent.BuffType(), 30); } else if (hell) { diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs new file mode 100644 index 0000000000..715455b7c9 --- /dev/null +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -0,0 +1,102 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class OmnibladeSwing : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omniblade"); + Main.projFrames[projectile.type] = 6; + } + + public override void SetDefaults() + { + 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; + } + + public override void AI() + { + 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 (Owner.channel && !Owner.noItems && !Owner.CCed) + HandleChannelMovement(playerRotatedPoint); + else + projectile.Kill(); + } + + // Rotation and directioning. + projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); + + // Sprite and player directioning. + 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); + + // Prevents the projectile from dying + projectile.timeLeft = 2; + + // Player item-based field manipulation. + Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + public void HandleChannelMovement(Vector2 playerRotatedPoint) + { + 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; + + projectile.velocity = newVelocity; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (Main.rand.NextBool(5)) + target.AddBuff(ModContent.BuffType(), 360); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (Main.rand.NextBool(5)) + target.AddBuff(ModContent.BuffType(), 360); + } + + 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; + } +} diff --git a/Projectiles/Melee/OmnibladeSwing.png b/Projectiles/Melee/OmnibladeSwing.png new file mode 100644 index 0000000000..bb0103db68 Binary files /dev/null and b/Projectiles/Melee/OmnibladeSwing.png differ diff --git a/Projectiles/Melee/PhosphorescentGauntletPunches.cs b/Projectiles/Melee/PhosphorescentGauntletPunches.cs new file mode 100644 index 0000000000..3bb90dba9c --- /dev/null +++ b/Projectiles/Melee/PhosphorescentGauntletPunches.cs @@ -0,0 +1,177 @@ +using CalamityMod.DataStructures; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PhosphorescentGauntletPunches : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public bool HasPerformedLunge + { + get => projectile.ai[0] == 1f; + set + { + int newValue = value.ToInt(); + if (projectile.ai[0] != newValue) + { + projectile.ai[0] = newValue; + projectile.netUpdate = true; + } + } + } + + 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; + } + + 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; + } + + #region AI + public override void AI() + { + if (!HasPerformedLunge) + PerformLunge(); + + 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(); + HandlePositioning(); + Time++; + } + + internal void PerformLunge() + { + if (Main.myPlayer != projectile.owner) + return; + Owner.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; + HasPerformedLunge = true; + } + + internal void ReelBack() + { + Owner.immune = true; + Owner.immuneTime = 15; + + // 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; + 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; + sulphurousAcid.noGravity = true; + sulphurousAcid.scale = 1.2f; + } + } + 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(); + + // Create on-hit tile dust. + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width + 16, projectile.height + 16); + projectile.Kill(); + } + + internal static void GenerateDustOnOwnerHand(Player player) + { + if (Main.dedServ) + return; + + Vector2 handOffset = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; + if (player.direction != 1) + handOffset.X = player.bodyFrame.Width - handOffset.X; + if (player.gravDir != 1f) + handOffset.Y = player.bodyFrame.Height - handOffset.Y; + + handOffset -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - player.height) / 2f; + Vector2 rotatedHandPosition = player.RotatedRelativePoint(player.position + handOffset, true); + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustDirect(player.Center, 0, 0, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 150, default, 1.3f); + dust.position = rotatedHandPosition; + dust.velocity = Vector2.Zero; + dust.noGravity = true; + dust.fadeIn = 1f; + dust.velocity += player.velocity; + if (Main.rand.NextBool(2)) + { + dust.position += Utils.RandomVector2(Main.rand, -4f, 4f); + dust.scale += Main.rand.NextFloat(); + } + } + } + + internal void HandleProjectileVisuals() + { + float velocityAngle = projectile.velocity.ToRotation(); + projectile.rotation = velocityAngle + MathHelper.Pi; + projectile.frameCounter++; + if (projectile.frameCounter % 3 == 2) + { + projectile.frame++; + + // Die at the end of the final punch. + 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; + } + #endregion + + #region Drawing + + // 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); + 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); + return false; + } + #endregion + + #region NPC Hit Collision Logic + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ReelBack(); + #endregion + } +} diff --git a/Projectiles/Melee/PhosphorescentGauntletPunches.png b/Projectiles/Melee/PhosphorescentGauntletPunches.png new file mode 100644 index 0000000000..ae775bc14a Binary files /dev/null and b/Projectiles/Melee/PhosphorescentGauntletPunches.png differ diff --git a/Projectiles/Melee/PhotonRipperGlowmask.png b/Projectiles/Melee/PhotonRipperGlowmask.png new file mode 100644 index 0000000000..3db63d70e2 Binary files /dev/null and b/Projectiles/Melee/PhotonRipperGlowmask.png differ diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs new file mode 100644 index 0000000000..9cdf90ee11 --- /dev/null +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -0,0 +1,239 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PhotonRipperProjectile : ModProjectile + { + 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]; + + // 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 float ChargeUpPower => MathHelper.Clamp((float)Math.Pow(Time / ChargeUpTime, 1.6D), 0f, 1f); + + // Seriously though Draedon this seems a bit over the top lmfao. + public override void SetStaticDefaults() => DisplayName.SetDefault("Extraordinarily Cost-Inefficient Chainsaw"); + + 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; + // No reason to ID-static the chainsaw -- multiple players can true melee simultaneously! + 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); + Vector2 origin = texture.Size() * 0.5f; + 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); + return false; + } + + public override void AI() + { + // 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()); + DetermineDamage(); + + PlayChainsawSounds(); + + // Determines the owner's position whilst incorporating their fullRotation field. + // 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 (Owner.channel && !Owner.noItems && !Owner.CCed) + HandleChannelMovement(playerRotatedPosition); + else + projectile.Kill(); + } + + DetermineVisuals(playerRotatedPosition); + ManipulatePlayerValues(); + EmitPrettyDust(); + + if (Time % ToothShootRate == ToothShootRate - 1f) + ReleasePrismTeeth(); + + // 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; + + Time++; + } + + public void PlayChainsawSounds() + { + if (projectile.soundDelay <= 0) + { + Main.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) + { + ToothDamage = ToothDamageRatio * projectile.damage; + projectile.netUpdate = true; + } + + // And then do time based damage calculations. This does not execute if the original damage is 0. + // This line covers adjusting tooth damage if the projectile's own damage changes. + if (ToothDamage != 0f) + { + float fullMult = ToothDamageRatio; + float zeroMult = ZeroChargeDamageRatio * ToothDamageRatio; + ToothDamage = (int)MathHelper.SmoothStep(projectile.damage * zeroMult, projectile.damage * fullMult, ChargeUpPower); + } + } + + public void DetermineVisuals(Vector2 playerRotatedPosition) + { + float directionAngle = projectile.velocity.ToRotation(); + projectile.rotation = directionAngle; + + int oldDirection = projectile.spriteDirection; + if (oldDirection == -1) + projectile.rotation += MathHelper.Pi; + + 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; + + // Positioning close to the player's arm. + 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); + + // 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.frame = (projectile.frame + 1) % 6; + projectile.frameCounter = 0; + } + } + + public void HandleChannelMovement(Vector2 playerRotatedPosition) + { + Vector2 idealAimDirection = (Main.MouseWorld - playerRotatedPosition).SafeNormalize(Vector2.UnitX * Owner.direction); + + float angularAimVelocity = 0.15f; + 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); + else + projectile.velocity = idealAimDirection; + + projectile.velocity = projectile.velocity.SafeNormalize(Vector2.UnitX * Owner.direction); + } + + public void ManipulatePlayerValues() + { + Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.ChangeDir(projectile.direction); + } + + public void EmitPrettyDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 2; i++) + { + 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); + + Dust rainbowSpark = Dust.NewDustPerfect(spawnPosition, 261); + 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); + } + } + + public void ReleasePrismTeeth() + { + // 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); + + if (Main.myPlayer != projectile.owner) + return; + + 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. + shootReach *= Owner.ActiveItem().shootSpeed; + + float distanceFromMouse = Owner.Distance(Main.MouseWorld); + + // If the distance to the mouse is less than the base reach, reach only to mouse. + // This way the player can more directly control the crystals if they want. + // This comes with a small constant offset to cancel out other factors. + if (distanceFromMouse < shootReach && distanceFromMouse > 40f) + shootReach = distanceFromMouse + 32f; + + Projectile.NewProjectile(Owner.Center, projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, projectile.owner, shootReach, projectile.whoAmI); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // 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; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); + } + } +} diff --git a/Projectiles/Melee/PhotonRipperProjectile.png b/Projectiles/Melee/PhotonRipperProjectile.png new file mode 100644 index 0000000000..f0e5ea6ab4 Binary files /dev/null and b/Projectiles/Melee/PhotonRipperProjectile.png differ diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 148a617f39..47f6fc4133 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class PlagueBeeDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/PlagueDust"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); @@ -58,9 +60,12 @@ namespace CalamityMod.Projectiles.Melee { 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, 0f, 0f); - Main.projectile[bee].penetrate = 1; - Main.projectile[bee].Calamity().forceMelee = true; + 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; + Main.projectile[bee].penetrate = 1; + } } //Dust int dustType = 89; @@ -122,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/PlagueBeeDust.png b/Projectiles/Melee/PlagueBeeDust.png deleted file mode 100644 index c92fc1e1e3..0000000000 Binary files a/Projectiles/Melee/PlagueBeeDust.png and /dev/null differ diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index 5d1f2aa715..b67a157084 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f51fb3cd54..350b6a36af 100644 --- a/Projectiles/Melee/PlagueSeeker.cs +++ b/Projectiles/Melee/PlagueSeeker.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class PlagueSeeker : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Seeker"); @@ -16,12 +18,30 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 4; projectile.height = 4; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.melee = true; projectile.timeLeft = 180; + projectile.extraUpdates = 1; } - public override void AI() + // 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 cap = 3; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + 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) @@ -34,12 +54,13 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 18f, 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) { target.AddBuff(ModContent.BuffType(), 180); } - } + } } diff --git a/Projectiles/Melee/PlagueSeeker.png b/Projectiles/Melee/PlagueSeeker.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/PlagueSeeker.png and /dev/null differ diff --git a/Projectiles/Melee/PrismRay.cs b/Projectiles/Melee/PrismRay.cs new file mode 100644 index 0000000000..7d3b81c3bd --- /dev/null +++ b/Projectiles/Melee/PrismRay.cs @@ -0,0 +1,209 @@ +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class PrismRay : ModProjectile + { + public Vector2 StartingPosition; + public Color RayColor => CalamityUtils.MulticolorLerp(RayHue, CalamityGlobalItem.ExoPalette); + public Color HueDownscaledRayColor => RayColor * 0.66f; + 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; + } + + 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; + } + + public override void AI() + { + DelegateMethods.v3_1 = RayColor.ToVector3() * 0.5f; + 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.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); + 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; + } + } + if (Main.rand.NextBool(10)) + { + 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)) + canSpawnDust = false; + + if (canSpawnDust && WorldGen.SolidTile(dustTileCoords.X, dustTileCoords.Y)) + canSpawnDust = false; + + if (canSpawnDust) + { + Dust risingMagic = Dust.NewDustDirect(dustSpawnPosition, 0, 0, 267, 0f, 0f, 127, RayColor, 1f); + risingMagic.noGravity = true; + risingMagic.position = dustSpawnPosition; + risingMagic.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.6f, 7.5f); + risingMagic.fadeIn = Main.rand.NextFloat(1f, 2f); + risingMagic.scale = Main.rand.NextFloat(0.6f, 1.2f); + risingMagic.noLight = true; + + risingMagic = Dust.CloneDust(risingMagic); + risingMagic.scale *= 0.65f; + risingMagic.fadeIn *= 0.65f; + risingMagic.color = new Color(255, 255, 255, 255); + } + } + projectile.scale = projectile.Opacity * 0.5f; + projectile.velocity = Vector2.Zero; + + Time++; + if (Time >= Lifetime) + 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 _); + } + + 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 origin = frame.Size() / 2f; + 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); + } + + // Draw the shimmering ray itself. + if (projectile.Opacity > 0.3f) + { + Vector2 drawOffset = (StartingPosition - projectile.Center) * 0.5f; + Vector2 scale = new Vector2(1f, drawOffset.Length() * 2f / texture.Height); + float rotation = drawOffset.ToRotation() + MathHelper.PiOver2; + + // This factor causes the opacity to flash rather quickly. + float drawFade = MathHelper.Clamp(MathHelper.Distance(Lifetime * 0.5f, Time) / (Lifetime * 0.667f), 0f, 1f); + + for (int i = 0; i < 3; i++) + { + Vector2 drawPosition = baseDrawPosition; + 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); + spriteBatch.Draw(texture, drawPosition, frame, fadedRayColor * drawFade * 0.8f, rotation, origin, scale * 0.5f, SpriteEffects.None, 0f); + } + } + return false; + } + + public override void Kill(int timeLeft) + { + CreateKillExplosionBurstDust(Main.rand.Next(7, 13)); + + // Adjust values and do damage before dying. + 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; + } + + public void CreateKillExplosionBurstDust(int dustCount) + { + if (Main.dedServ) + return; + + Vector2 baseExplosionDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * 3f; + Vector2 outwardFireSpeedFactor = new Vector2(2.1f, 2f); + Color brightenedRayColor = RayColor; + brightenedRayColor.A = 255; + + 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; + explosionDust.velocity = baseExplosionDirection.RotatedBy(MathHelper.TwoPi * i / dustCount) * outwardFireSpeedFactor * Main.rand.NextFloat(0.8f, 1.2f); + explosionDust.noGravity = true; + explosionDust.scale = 1.1f; + explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f); + + explosionDust = Dust.CloneDust(explosionDust); + explosionDust.scale /= 2f; + explosionDust.fadeIn /= 2f; + explosionDust.color = new Color(255, 255, 255, 255); + } + 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; + 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; + explosionDust.scale = Main.rand.NextFloat(); + explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f); + + explosionDust = Dust.CloneDust(explosionDust); + explosionDust.scale /= 2f; + explosionDust.fadeIn /= 2f; + explosionDust.color = new Color(255, 255, 255, 255); + } + } + + 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 new file mode 100644 index 0000000000..388e14746c --- /dev/null +++ b/Projectiles/Melee/PrismTooth.cs @@ -0,0 +1,142 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.GameContent.Achievements; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PrismTooth : ModProjectile + { + 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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Photon Ripper"); + 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; + // 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; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi * Time / Lifetime; + + Vector2 baseDirection = (MathHelper.TwoPi * Time / Lifetime - MathHelper.PiOver2).ToRotationVector2(); + baseDirection.X *= 0.25f; + + // Constrain the Y offset into the bounds of 0-1 instead of -1-1. This prevents + // the crystal from flying behind the owner. In this context, the Y offset becomes how far away the + // crystal is from its own in terms of reach. + baseDirection.Y = baseDirection.Y * 0.5f + 0.5f; + Vector2 positionOffset = baseDirection * ShootReach; + + // Don't allow the X offset to go too far. + // This hard limit turns the squashed circle into bending, semi-rectangular shape. + if (Math.Abs(positionOffset.X) > 45f) + positionOffset.X = Math.Sign(baseDirection.X) * 45f; + + // 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); + + 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(); + AbsolutelyFuckingAnnihilateTrees(pointToCheck.X, pointToCheck.Y); + } + + // Emit light. + Lighting.AddLight(projectile.Center, Vector3.One * 0.7f); + + Time++; + } + + 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]) + return; + + // Don't attempt to mine the tile if for whatever reason it's not supposed to be broken. + if (!WorldGen.CanKillTile(x, y)) + return; + + AchievementsHelper.CurrentlyMining = true; + + WorldGen.KillTile(x, y); + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, x, y); + + AchievementsHelper.CurrentlyMining = false; + } + + 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 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (Time <= 5f) + return true; + + if (TrailDrawer is null) + TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:PrismaticStreak"]); + + // 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); + + // 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]); + + // Revert back if the above calculations caused any NaNs. + if (projectile.oldPos[1].HasNaNs()) + projectile.oldPos[1] = oldPosition; + + GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/ScarletDevilStreak")); + TrailDrawer.Draw(projectile.oldPos, projectile.Size * 0.5f + generalOffset - Main.screenPosition, 65); + return true; + } + + // Prevent the crystals from utilizing velocity. Their movement is entirely dependant on Center setting. + public override bool ShouldUpdatePosition() => false; + } +} diff --git a/Projectiles/Melee/PrismTooth.png b/Projectiles/Melee/PrismTooth.png new file mode 100644 index 0000000000..3201a55ae9 Binary files /dev/null and b/Projectiles/Melee/PrismTooth.png differ diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index 39ecd9180e..a04f42a986 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Melee { public class PrismaticBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/YharimsCrystalBeam"; + public Color[] colors = new Color[] { new Color(255, 0, 0, 50), //Red @@ -83,7 +85,9 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - } + projectile.Calamity().PierceResistHarshness = 0.06f; + projectile.Calamity().PierceResistCap = 0.4f; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -165,7 +169,7 @@ namespace CalamityMod.Projectiles.Melee //Play cool sound when fully charged if (playedSound == false) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 68); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 68); playedSound = true; } @@ -295,7 +299,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.CursedInferno, 120); @@ -307,7 +310,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.CursedInferno, 120); diff --git a/Projectiles/Melee/PrismaticBeam.png b/Projectiles/Melee/PrismaticBeam.png deleted file mode 100644 index 4bcb09bbf2..0000000000 Binary files a/Projectiles/Melee/PrismaticBeam.png and /dev/null differ diff --git a/Projectiles/Melee/PrismaticWave.cs b/Projectiles/Melee/PrismaticWave.cs index eec9f82e40..3bb44818ff 100644 --- a/Projectiles/Melee/PrismaticWave.cs +++ b/Projectiles/Melee/PrismaticWave.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 355) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -131,7 +131,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.CursedInferno, 120); @@ -144,7 +143,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.CursedInferno, 120); diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index 3e8e17d725..b579ec3874 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class ProfanedSwordProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Melee/ProfanedSword"; + private int explosionCount = 0; public override void SetStaticDefaults() { diff --git a/Projectiles/Melee/ProfanedSwordProj.png b/Projectiles/Melee/ProfanedSwordProj.png deleted file mode 100644 index 36dfb30fbe..0000000000 Binary files a/Projectiles/Melee/ProfanedSwordProj.png and /dev/null differ diff --git a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs b/Projectiles/Melee/PwnagehammerEcho.cs similarity index 78% rename from Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs rename to Projectiles/Melee/PwnagehammerEcho.cs index e04743db86..ff2fab74e3 100644 --- a/Projectiles/Hybrid/PwnagehammerProjStealthStrike.cs +++ b/Projectiles/Melee/PwnagehammerEcho.cs @@ -1,17 +1,18 @@ using System; +using System.IO; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid +namespace CalamityMod.Projectiles.Melee { - public class PwnagehammerProjStealthStrike : ModProjectile + public class PwnagehammerEcho : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Spectral Hammer"); + DisplayName.SetDefault("Pwnagehammer Echo"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -22,12 +23,23 @@ namespace CalamityMod.Projectiles.Hybrid projectile.height = 40; projectile.aiStyle = 0; projectile.friendly = true; + projectile.melee = true; projectile.penetrate = 1; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + public override Color? GetAlpha(Color lightColor) { return new Color(255, 248, 124, 255); @@ -43,11 +55,15 @@ namespace CalamityMod.Projectiles.Hybrid } else if (projectile.ai[0] < 44f) { - NPC target = Main.npc[(int)projectile.ai[1]]; - if (!target.CanBeChasedBy(projectile, false)) + if (projectile.ai[1] < 0f) { projectile.Kill(); + return; } + + NPC target = Main.npc[(int)projectile.ai[1]]; + if (!target.CanBeChasedBy(projectile, false) || !target.active) + projectile.Kill(); else { float velConst = 3f; @@ -60,7 +76,7 @@ namespace CalamityMod.Projectiles.Hybrid { 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; } @@ -68,24 +84,14 @@ namespace CalamityMod.Projectiles.Hybrid { 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) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.ai[0] > 42f; - public override bool CanHitPvp(Player target) - { - return 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) { @@ -130,9 +136,7 @@ namespace CalamityMod.Projectiles.Hybrid { SpriteEffects spriteEffects = SpriteEffects.None; if (projectile.spriteDirection == -1) - { spriteEffects = SpriteEffects.FlipHorizontally; - } Texture2D texture = Main.projectileTexture[projectile.type]; Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin = sourceRectangle.Size() / 2f; @@ -141,8 +145,8 @@ namespace CalamityMod.Projectiles.Hybrid { 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) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); - spriteBatch.Draw(texture, drawPos, new Rectangle?(), color, projectile.rotation - (i * rot), origin, projectile.scale, spriteEffects, 0f); + 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/Hybrid/PwnagehammerProjStealthStrike.png b/Projectiles/Melee/PwnagehammerEcho.png similarity index 100% rename from Projectiles/Hybrid/PwnagehammerProjStealthStrike.png rename to Projectiles/Melee/PwnagehammerEcho.png diff --git a/Projectiles/Melee/PwnagehammerMeleeProj.cs b/Projectiles/Melee/PwnagehammerMeleeProj.cs deleted file mode 100644 index ae2534c1bd..0000000000 --- a/Projectiles/Melee/PwnagehammerMeleeProj.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class PwnagehammerMeleeProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Hammer"); - 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.melee = true; - projectile.penetrate = -1; - projectile.aiStyle = 3; - projectile.timeLeft = 120; - projectile.extraUpdates = 3; - aiType = ProjectileID.PaladinsHammerFriendly; - } - - public override void AI() - { - projectile.velocity.X *= 1.06f; - projectile.velocity.Y *= 1.06f; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Melee/PwnagehammerMeleeProj.png b/Projectiles/Melee/PwnagehammerMeleeProj.png deleted file mode 100644 index 7a6cb7bc22..0000000000 Binary files a/Projectiles/Melee/PwnagehammerMeleeProj.png and /dev/null differ diff --git a/Projectiles/Hybrid/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs similarity index 82% rename from Projectiles/Hybrid/PwnagehammerProj.cs rename to Projectiles/Melee/PwnagehammerProj.cs index 09a7d6fbaa..c9e603ffae 100644 --- a/Projectiles/Hybrid/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -2,16 +2,20 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid + +namespace CalamityMod.Projectiles.Melee { public class PwnagehammerProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Melee/PwnagehammerMelee"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Hammer"); + DisplayName.SetDefault("Pwnagehammer"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -26,9 +30,19 @@ namespace CalamityMod.Projectiles.Hybrid projectile.localNPCHitCooldown = 10; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + public override void AI() { - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0f) ? 1 : -1; + projectile.direction = projectile.spriteDirection = projectile.velocity.X > 0f ? 1 : -1; projectile.rotation += MathHelper.ToRadians(22.5f) * projectile.direction; if (projectile.ai[0] == 1f) @@ -46,9 +60,7 @@ namespace CalamityMod.Projectiles.Hybrid 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; - } } } } @@ -77,7 +89,7 @@ namespace CalamityMod.Projectiles.Hybrid { 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; } @@ -85,7 +97,7 @@ namespace CalamityMod.Projectiles.Hybrid { 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; } } @@ -106,14 +118,14 @@ namespace CalamityMod.Projectiles.Hybrid dust.noGravity = true; dust.velocity = velOffset; dust.scale = 2.5f; - if ((i % 2) == 0) + if (i % 2 == 0) { 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) + if (i % 4 == 0) { dust = Dust.NewDustPerfect(projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; @@ -133,20 +145,16 @@ namespace CalamityMod.Projectiles.Hybrid 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); + 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); if (sound1 != null) - { - sound1.Volume = 0.6f; - } + sound1.Volume = 0.3f; SoundEffectInstance sound2 = Main.PlaySound(SoundID.Item14, projectile.Center); if (sound2 != null) - { - sound2.Volume = 0.45f; - } + sound2.Volume = 0.22f; } else { @@ -174,21 +182,19 @@ namespace CalamityMod.Projectiles.Hybrid 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); + 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); if (sound1 != null) { - sound1.Volume = 0.37f; + sound1.Volume = 0.16f; sound1.Pitch = Main.rand.NextFloat(-0.08f, 0.08f); } SoundEffectInstance sound2 = Main.PlaySound(SoundID.Item14, projectile.Center); if (sound2 != null) - { - sound2.Volume = 0.22f; - } + sound2.Volume = 0.11f; } } @@ -196,10 +202,10 @@ namespace CalamityMod.Projectiles.Hybrid { 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]); + 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); - Main.projectile[hammer].melee = projectile.melee; - Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; + Main.projectile[hammer].netUpdate = true; } } @@ -207,10 +213,9 @@ namespace CalamityMod.Projectiles.Hybrid { 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]); + 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].melee = projectile.melee; - Main.projectile[hammer].Calamity().rogue = projectile.Calamity().rogue; + Main.projectile[hammer].netUpdate = true; } } @@ -221,7 +226,7 @@ namespace CalamityMod.Projectiles.Hybrid public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/RainBolt.cs b/Projectiles/Melee/RainBolt.cs index 4319c2d5e9..f430295a54 100644 --- a/Projectiles/Melee/RainBolt.cs +++ b/Projectiles/Melee/RainBolt.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class RainBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -18,13 +20,13 @@ namespace CalamityMod.Projectiles.Melee projectile.friendly = true; projectile.melee = true; projectile.penetrate = 1; - projectile.timeLeft = 150; + projectile.timeLeft = 180; } - public override void AI() - { - projectile.velocity *= 0.95f; + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + public override void AI() + { if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Item9, projectile.Center); @@ -35,10 +37,13 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 14f, 20f); - } + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); + else + projectile.velocity *= 0.95f; + } - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item60, projectile.Center); for (int k = 0; k < 5; k++) diff --git a/Projectiles/Melee/RainBolt.png b/Projectiles/Melee/RainBolt.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Melee/RainBolt.png and /dev/null differ diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index 8c3a10cba8..32bf60c5d0 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class RainbowBoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Boom"); @@ -19,10 +21,10 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 60; + projectile.timeLeft = 20; projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -84,5 +86,10 @@ namespace CalamityMod.Projectiles.Melee num462++; } } - } + + 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); + } + } } diff --git a/Projectiles/Melee/RainbowBoom.png b/Projectiles/Melee/RainbowBoom.png deleted file mode 100644 index e975d88423..0000000000 Binary files a/Projectiles/Melee/RainbowBoom.png and /dev/null differ diff --git a/Projectiles/Melee/Razorwind.cs b/Projectiles/Melee/Razorwind.cs index 7c84a05395..e4ec7e0036 100644 --- a/Projectiles/Melee/Razorwind.cs +++ b/Projectiles/Melee/Razorwind.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class Razorwind : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Razorwind"); @@ -51,19 +53,12 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 450f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void Kill(int timeLeft) + public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) { @@ -78,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Razorwind.png b/Projectiles/Melee/Razorwind.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Melee/Razorwind.png and /dev/null differ diff --git a/Projectiles/Melee/RedBall.cs b/Projectiles/Melee/RedBall.cs deleted file mode 100644 index b3da2a6d7f..0000000000 --- a/Projectiles/Melee/RedBall.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class RedBall : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Red Bag"); - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.alpha = 255; - projectile.penetrate = 2; - projectile.aiStyle = 14; - projectile.timeLeft = 300; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.45f / 255f, (255 - projectile.alpha) * 0.05f / 255f, (255 - projectile.alpha) * 0.05f / 255f); - if (projectile.alpha > 0) - { - projectile.alpha -= 25; - if (projectile.alpha > 0) - projectile.alpha = 0; - } - projectile.rotation = projectile.velocity.X * 0.04f; - if (projectile.timeLeft % 15 == 0) - { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - if (projectile.timeLeft < 85) - { - byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); - } - return new Color(255, 255, 255, 100); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.penetrate--; - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } - else - { - projectile.ai[0] += 0.1f; - if (projectile.velocity.X != oldVelocity.X) - { - projectile.velocity.X = -oldVelocity.X; - } - if (projectile.velocity.Y != oldVelocity.Y) - { - projectile.velocity.Y = -oldVelocity.Y; - } - projectile.velocity *= 0.98f; - } - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.OnFire, 300); - } - } -} diff --git a/Projectiles/Melee/RedBall.png b/Projectiles/Melee/RedBall.png deleted file mode 100644 index 88df2e1c31..0000000000 Binary files a/Projectiles/Melee/RedBall.png and /dev/null differ diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index 3e80bfc60c..6fc559dcb4 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Melee { public class RedtideWhirlpool : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/BrinyTyphoonBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Whirlpool"); diff --git a/Projectiles/Melee/RedtideWhirlpool.png b/Projectiles/Melee/RedtideWhirlpool.png deleted file mode 100644 index 90a422dbd8..0000000000 Binary files a/Projectiles/Melee/RedtideWhirlpool.png and /dev/null differ diff --git a/Projectiles/Melee/RoxShockwave.cs b/Projectiles/Melee/RoxShockwave.cs index 64f81b10fc..cdbe8bba8c 100644 --- a/Projectiles/Melee/RoxShockwave.cs +++ b/Projectiles/Melee/RoxShockwave.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Melee { public class RoxShockwave : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.penetrate = -1; diff --git a/Projectiles/Melee/RoxShockwave.png b/Projectiles/Melee/RoxShockwave.png deleted file mode 100644 index 73557dc730..0000000000 Binary files a/Projectiles/Melee/RoxShockwave.png and /dev/null differ diff --git a/Projectiles/Melee/RoxSlam.cs b/Projectiles/Melee/RoxSlam.cs index c41919ffb6..76500fecf4 100644 --- a/Projectiles/Melee/RoxSlam.cs +++ b/Projectiles/Melee/RoxSlam.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class RoxSlam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.width = 10; diff --git a/Projectiles/Melee/RoxSlam.png b/Projectiles/Melee/RoxSlam.png deleted file mode 100644 index 73557dc730..0000000000 Binary files a/Projectiles/Melee/RoxSlam.png and /dev/null differ diff --git a/Projectiles/Melee/SHIV.cs b/Projectiles/Melee/SHIV.cs index 40091aee13..49f3ff6377 100644 --- a/Projectiles/Melee/SHIV.cs +++ b/Projectiles/Melee/SHIV.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f4c092f2f8..1df68774f2 100644 --- a/Projectiles/Melee/SandBlade.cs +++ b/Projectiles/Melee/SandBlade.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Melee/SandFire.cs b/Projectiles/Melee/SandFire.cs index f42aababec..6e7394fa06 100644 --- a/Projectiles/Melee/SandFire.cs +++ b/Projectiles/Melee/SandFire.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class SandFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -37,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/SandFire.png b/Projectiles/Melee/SandFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Melee/SandFire.png and /dev/null differ diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs new file mode 100644 index 0000000000..c9bd03a52c --- /dev/null +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -0,0 +1,158 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ScourgeoftheCosmosMini : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Miniature Cosmic Scourge"); + 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; + } + + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); + + public override void AI() + { + if (projectile.alpha > 0) + projectile.alpha -= 50; + else + projectile.extraUpdates = 1; + + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.frameCounter++; + if (projectile.frameCounter >= 6) + { + projectile.frame++; + projectile.frameCounter = 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); + Dust dust = Main.dust[num372]; + 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; + + 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] = 30f; + for (int num376 = 0; num376 < Main.maxNPCs; num376++) + { + 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)) + { + num375 = num379; + num373 = num377; + num374 = num378; + flag10 = true; + } + } + } + } + if (!flag10) + { + 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); + 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) + { + 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) + { + 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) + { + 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) + { + projectile.velocity.Y = projectile.velocity.Y - num381; + if (projectile.velocity.Y > 0f && num383 < 0f) + projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + 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; + } + 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; + 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); + } + } +} diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosMini.png b/Projectiles/Melee/ScourgeoftheCosmosMini.png similarity index 100% rename from Projectiles/Hybrid/ScourgeoftheCosmosMini.png rename to Projectiles/Melee/ScourgeoftheCosmosMini.png diff --git a/Projectiles/Hybrid/ScourgeoftheCosmosMiniGlow.png b/Projectiles/Melee/ScourgeoftheCosmosMiniGlow.png similarity index 100% rename from Projectiles/Hybrid/ScourgeoftheCosmosMiniGlow.png rename to Projectiles/Melee/ScourgeoftheCosmosMiniGlow.png diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs new file mode 100644 index 0000000000..0023f2d0fe --- /dev/null +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -0,0 +1,144 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ScourgeoftheCosmosProj : ModProjectile + { + private int bounce = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cosmic Scourge"); + 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; + } + + public override void AI() + { + 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; + 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.velocity.Y = projectile.velocity.Y + 0.4f; + projectile.velocity.X = projectile.velocity.X * 0.97f; + } + 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); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + 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) + { + int num626 = 1; + if (Main.rand.NextBool(10)) + num626++; + int num3; + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = Main.rand.Next(-35, 36) * 0.02f; + 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); + num3 = num627; + } + } + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.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); + Dust dust = Main.dust[num623]; + dust.scale *= 1.1f; + Main.dust[num623].noGravity = true; + num3 = num622; + } + 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); + Dust dust = Main.dust[num625]; + dust.velocity *= 2.5f; + dust = Main.dust[num625]; + dust.scale *= 0.8f; + Main.dust[num625].noGravity = true; + num3 = num624; + } + if (projectile.owner == Main.myPlayer) + { + int num626 = 3; + if (Main.rand.NextBool(10)) + num626++; + for (int num627 = 0; num627 < num626; num627 = num3 + 1) + { + float num628 = Main.rand.Next(-35, 36) * 0.02f; + 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); + num3 = num627; + } + } + } + } +} diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.png b/Projectiles/Melee/ScourgeoftheCosmosProj.png new file mode 100644 index 0000000000..64425c7f0f Binary files /dev/null and b/Projectiles/Melee/ScourgeoftheCosmosProj.png differ diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index cce741c122..c0f10bdb10 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 884073bcbd..c5df11fe34 100644 --- a/Projectiles/Melee/SoulScytheExplosion.cs +++ b/Projectiles/Melee/SoulScytheExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class SoulScytheExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Melee/SoulScytheExplosion.png b/Projectiles/Melee/SoulScytheExplosion.png deleted file mode 100644 index 80da916522..0000000000 Binary files a/Projectiles/Melee/SoulScytheExplosion.png and /dev/null differ diff --git a/Projectiles/Melee/Spark.cs b/Projectiles/Melee/Spark.cs index c186fc0840..1995da51a1 100644 --- a/Projectiles/Melee/Spark.cs +++ b/Projectiles/Melee/Spark.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class Spark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spark"); @@ -16,9 +18,9 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 12; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 120; + projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 15; projectile.melee = true; } @@ -83,13 +85,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Melee/Spark.png b/Projectiles/Melee/Spark.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Melee/Spark.png and /dev/null differ diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index 446b567508..f7552ad38d 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 180; + projectile.timeLeft = 90; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; } @@ -31,17 +31,17 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0.05f, 1f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; projectile.ai[0] += 1f; - if (projectile.ai[0] > 60f) + if (projectile.ai[0] > 30f) { - projectile.ai[0] = 60f; - projectile.velocity.Y = projectile.velocity.Y + 0.25f; + projectile.ai[0] = 30f; + projectile.velocity.Y += 0.1f; if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; } - projectile.velocity.X = projectile.velocity.X * 0.995f; + projectile.velocity.X *= 0.98f; } if (projectile.localAI[1] == 0f) { @@ -68,17 +68,17 @@ namespace CalamityMod.Projectiles.Melee 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] >= 60f) + if (projectile.localAI[0] >= 30f) { projectile.localAI[0] = 0f; int numProj = 2; - float rotation = MathHelper.ToRadians(20); + float rotation = MathHelper.ToRadians(10); 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.5f, perturbedSpeed.Y * 0.5f, ModContent.ProjectileType(), (int)((double)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); } } } @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 175) + if (projectile.timeLeft > 85) return false; Texture2D tex = Main.projectileTexture[projectile.type]; @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -105,11 +105,10 @@ namespace CalamityMod.Projectiles.Melee public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Item10, projectile.position); - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) + for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)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); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; @@ -117,7 +116,6 @@ namespace CalamityMod.Projectiles.Melee 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/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 78c53208ac..2d47ae8263 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -22,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.penetrate = 2; - projectile.timeLeft = 120; + projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; } @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Lighting.AddLight(projectile.Center, 0.05f, 0.05f, 1f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; if (projectile.localAI[1] == 0f) { projectile.scale -= 0.01f; @@ -56,17 +57,17 @@ namespace CalamityMod.Projectiles.Melee 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] >= 60f) + if (projectile.localAI[0] >= 30f) { projectile.localAI[0] = 0f; int numProj = 2; - float rotation = MathHelper.ToRadians(20); + float rotation = MathHelper.ToRadians(10); 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.5f, perturbedSpeed.Y * 0.5f, ModContent.ProjectileType(), (int)((double)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,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 115) + if (projectile.timeLeft > 55) return false; Texture2D tex = Main.projectileTexture[projectile.type]; @@ -85,18 +86,17 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) + for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)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); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; @@ -104,7 +104,6 @@ namespace CalamityMod.Projectiles.Melee 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; - num3 = num795; } } } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index d13a171c56..66d03a51ff 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -22,13 +23,13 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.penetrate = 1; - projectile.timeLeft = 80; + projectile.timeLeft = 40; } public override void AI() { Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; if (projectile.localAI[1] == 0f) { projectile.scale -= 0.01f; @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee 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] >= 60f) + if (projectile.localAI[0] >= 30f) { projectile.localAI[0] = 0f; int numProj = 2; @@ -63,8 +64,8 @@ namespace CalamityMod.Projectiles.Melee { 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.5f, perturbedSpeed.Y * 0.5f, ModContent.ProjectileType(), (int)((double)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,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 75) + if (projectile.timeLeft > 35) return false; Texture2D tex = Main.projectileTexture[projectile.type]; @@ -83,18 +84,17 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) + for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)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); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; @@ -102,7 +102,6 @@ namespace CalamityMod.Projectiles.Melee 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; - num3 = num795; } } } diff --git a/Projectiles/Melee/SpatialSpear4.cs b/Projectiles/Melee/SpatialSpear4.cs index e165ff06c2..184d9b717f 100644 --- a/Projectiles/Melee/SpatialSpear4.cs +++ b/Projectiles/Melee/SpatialSpear4.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -22,13 +23,13 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.tileCollide = false; projectile.penetrate = 1; - projectile.timeLeft = 50; + projectile.timeLeft = 25; } public override void AI() { Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.05f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; if (projectile.localAI[1] == 0f) { projectile.scale -= 0.01f; @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 45) + if (projectile.timeLeft > 20) return false; Texture2D tex = Main.projectileTexture[projectile.type]; @@ -68,18 +69,17 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) { - int num3; - for (int num795 = 4; num795 < 12; num795 = num3 + 1) + for (int num795 = 4; num795 < 12; num795++) { - float num796 = projectile.oldVelocity.X * (30f / (float)num795); - float num797 = projectile.oldVelocity.Y * (30f / (float)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); Main.dust[num798].noGravity = true; Dust dust = Main.dust[num798]; @@ -87,7 +87,6 @@ namespace CalamityMod.Projectiles.Melee 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; - num3 = num795; } } } diff --git a/Projectiles/Melee/Spears/AstralPikeProj.cs b/Projectiles/Melee/Spears/AstralPikeProj.cs index 3dcb01869d..4a9f04712d 100644 --- a/Projectiles/Melee/Spears/AstralPikeProj.cs +++ b/Projectiles/Melee/Spears/AstralPikeProj.cs @@ -49,21 +49,16 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 3; i++) { - float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt(); - Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801)); - float speedX = target.position.X - spawnPosition.X; - float speedY = target.position.Y - spawnPosition.Y; - float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY); - magnitude = 10f / xPos; - speedX *= magnitude * 150f; - speedY *= magnitude * 150f; - speedX = MathHelper.Clamp(speedX, -15f, 15f); - speedY = MathHelper.Clamp(speedY, -15f, 15f); if (projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), 1f, projectile.owner); - Main.projectile[proj].Calamity().forceMelee = 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; + star.ai[0] = 3f; + } } + } } } diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 0c3f58f8ac..90d4974778 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -1,9 +1,10 @@ +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; + namespace CalamityMod.Projectiles.Melee.Spears { public class BansheeHookProj : BaseSpearProjectile @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.hide = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 5; projectile.alpha = 255; //projectile.Calamity().trueMelee = true; } @@ -38,8 +39,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { Projectile.NewProjectile(projectile.Center + projectile.velocity * 0.5f, projectile.velocity * 0.8f, ModContent.ProjectileType(), - (int)(projectile.damage * 1.75), - projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); }; public override void ExtraBehavior() { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(startingVelocityRotation) + new Vector2(startingVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(startingVelocityRotation); - Vector2 directionTowardsEnd = player.DirectionTo(destination); + Vector2 directionTowardsEnd = player.SafeDirectionTo(destination, Vector2.UnitX * player.direction); Vector2 initalVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY); float dustCount = 2f; @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Melee.Spears while (i < dustCount) { Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f); - dust.velocity = player.DirectionTo(dust.position) * 2f; + dust.velocity = player.SafeDirectionTo(dust.position) * 2f; dust.position = projectile.Center + initalVelocity.RotatedBy(completionAsAngle * 2f + i / dustCount * MathHelper.TwoPi) * 10f; dust.scale = 1f + Main.rand.NextFloat(0.6f); @@ -79,7 +79,7 @@ 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.velocity = player.DirectionTo(dust.position) * 2f; + dust.velocity = player.SafeDirectionTo(dust.position) * 2f; dust.position = projectile.Center + directionTowardsEnd * -110f; dust.scale = 0.45f + Main.rand.NextFloat(0.4f); dust.fadeIn = 0.7f + Main.rand.NextFloat(0.4f); @@ -99,22 +99,22 @@ namespace CalamityMod.Projectiles.Melee.Spears 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); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { - float angle = projectile.rotation - MathHelper.PiOver4 * Math.Sign(projectile.velocity.X) + + 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); + } + + 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 areaCheck = -95f; float reduntantVariable = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + angle.ToRotationVector2() * areaCheck, (TravelSpeed + 1f) * projectile.scale, ref reduntantVariable)) diff --git a/Projectiles/Melee/Spears/BrimlanceProj.cs b/Projectiles/Melee/Spears/BrimlanceProj.cs index 56bf8f0efd..4d75f0be6e 100644 --- a/Projectiles/Melee/Spears/BrimlanceProj.cs +++ b/Projectiles/Melee/Spears/BrimlanceProj.cs @@ -41,22 +41,18 @@ namespace CalamityMod.Projectiles.Melee.Spears } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 7; - if (target.life <= 0) - { - int flameCount = Main.rand.Next(2, 5); - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), knockback, Main.myPlayer); - for (int i = 0; i < flameCount; 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.5), 0f, projectile.owner, 0f, 0f); - } - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + 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); + } + } + } } } diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index 23764ae2ef..c320e0737f 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -44,7 +44,8 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + 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 940739a1db..6f70ba1bbd 100644 --- a/Projectiles/Melee/Spears/EarthenPikeSpear.cs +++ b/Projectiles/Melee/Spears/EarthenPikeSpear.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Melee.Spears 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; @@ -47,7 +48,8 @@ namespace CalamityMod.Projectiles.Melee.Spears 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); - Main.projectile[proj].Calamity().forceMelee = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } } } diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index 47f5399f4e..ad14606432 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -63,8 +63,9 @@ namespace CalamityMod.Projectiles.Melee.Spears { 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); - Main.projectile[boom].Calamity().forceMelee = true; + 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; } if (crit) { diff --git a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs index 839d0b0979..91551c48ee 100644 --- a/Projectiles/Melee/Spears/FulgurationHalberdProj.cs +++ b/Projectiles/Melee/Spears/FulgurationHalberdProj.cs @@ -14,11 +14,12 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { - projectile.width = 35; //The width of the .png file in pixels divided by 2. + 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 = 33; //The height of the .png file in pixels divided by 2. + 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; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 1e94a744d9..4526ffab88 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 4; //projectile.Calamity().trueMelee = true; } @@ -44,12 +44,12 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; Player player = Main.player[projectile.owner]; - player.statLife += 1; - player.HealEffect(1); + player.statLife += 1; + player.HealEffect(1); } } } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index 1df1536735..49bd3f8949 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Spears 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.2), 0f, projectile.owner, 0f, 0f); + projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.png b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.png index 1240e307bf..0e64ae4cc6 100644 Binary files a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.png and b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.png differ diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index f4970d16a2..2405eb9ebe 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -58,8 +58,11 @@ namespace CalamityMod.Projectiles.Melee.Spears 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); - petal.Calamity().forceMelee = true; - petal.localNPCHitCooldown = -1; + if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) + { + petal.Calamity().forceMelee = true; + petal.localNPCHitCooldown = -1; + } } } } diff --git a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs index 63ecb07dfc..ebca48c63d 100644 --- a/Projectiles/Melee/Spears/InsidiousImpalerProj.cs +++ b/Projectiles/Melee/Spears/InsidiousImpalerProj.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 5; //projectile.Calamity().trueMelee = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee.Spears 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.5f), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); + 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/SausageMakerSpear.cs b/Projectiles/Melee/Spears/SausageMakerSpear.cs index cf3c3d119b..c375b431af 100644 --- a/Projectiles/Melee/Spears/SausageMakerSpear.cs +++ b/Projectiles/Melee/Spears/SausageMakerSpear.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.2f, projectile.velocity.Y * 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 1127f9fc24..bd0454caaa 100644 --- a/Projectiles/Melee/Spears/SpatialLanceProjectile.cs +++ b/Projectiles/Melee/Spears/SpatialLanceProjectile.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Projectiles.BaseProjectiles; namespace CalamityMod.Projectiles.Melee.Spears @@ -28,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + projectile.localNPCHitCooldown = 7; //projectile.Calamity().trueMelee = true; } @@ -52,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index b06ad17ee1..9096c3e3ee 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.ownerHitCheck = true; projectile.hide = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 5; //projectile.Calamity().trueMelee = true; } diff --git a/Projectiles/Melee/SpineOfThanatosBody1.png b/Projectiles/Melee/SpineOfThanatosBody1.png new file mode 100644 index 0000000000..4aae688469 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosBody1.png differ diff --git a/Projectiles/Melee/SpineOfThanatosBody1Glowmask.png b/Projectiles/Melee/SpineOfThanatosBody1Glowmask.png new file mode 100644 index 0000000000..23eaaf6294 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosBody1Glowmask.png differ diff --git a/Projectiles/Melee/SpineOfThanatosBody2.png b/Projectiles/Melee/SpineOfThanatosBody2.png new file mode 100644 index 0000000000..17382a5519 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosBody2.png differ diff --git a/Projectiles/Melee/SpineOfThanatosBody2Glowmask.png b/Projectiles/Melee/SpineOfThanatosBody2Glowmask.png new file mode 100644 index 0000000000..d12dd42818 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosBody2Glowmask.png differ diff --git a/Projectiles/Melee/SpineOfThanatosProjectile.cs b/Projectiles/Melee/SpineOfThanatosProjectile.cs new file mode 100644 index 0000000000..2ae22e3951 --- /dev/null +++ b/Projectiles/Melee/SpineOfThanatosProjectile.cs @@ -0,0 +1,223 @@ +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SpineOfThanatosProjectile : ModProjectile + { + public List WhipPoints = new List(); + public Player Owner => Main.player[projectile.owner]; + public float CurrentBendFactor => MaximumBendFactor * CalamityUtils.Convert01To010(Time / Lifetime); + 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 const int Lifetime = 125; + public const int FlyBackTime = 40; + public const int FinalWhipRayShootRate = 10; + public const int LaserRayCount = 12; + public const float MaximumBendFactor = 42f; + public override void SetStaticDefaults() => DisplayName.SetDefault("Spine of Thanatos"); + + 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; + } + + public void DetermineWhipPoints() + { + Vector2 startingPosition = Owner.RotatedRelativePoint(Owner.MountedCenter); + + List initialPoints = new List() + { + startingPosition + }; + for (int i = 0; i < 12; i++) + { + Vector2 bendOffset = Vector2.UnitX * -SwingDirection; + + // Make the bend factor depend on how far along the generated positions we are. + // The maximum bend should be halfway across the chain. + 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); + } + initialPoints.Add(projectile.Center); + + BezierCurve bezierCurve = new BezierCurve(initialPoints.ToArray()); + int totalChains = (int)(projectile.Distance(startingPosition) / 24f / projectile.scale); + totalChains = (int)MathHelper.Clamp(totalChains, 40f, 440f); + + WhipPoints = bezierCurve.GetPoints(totalChains); + } + + public override void AI() + { + DetermineWhipPoints(); + + // Determines the owner's position whilst incorporating their fullRotation field. + // 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 (!Owner.noItems && !Owner.CCed) + HandleChannelMovement(playerRotatedPosition); + else + 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) + CreateBadassPrismExplosion(); + Time++; + } + + public void HandleChannelMovement(Vector2 playerRotatedPosition) + { + // Set the initial direction as a base for rotation. + if (InitialDirectionRotation == 0f) + InitialDirectionRotation = WhipOutwardness.ToRotation() - MathHelper.PiOver2; + + 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); + + Vector2 swingDirection = (SwingDirection * baseSwingAngle + MathHelper.PiOver2).ToRotationVector2(); + 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) + WhipOutwardness = Vector2.Lerp(WhipOutwardness, InitialDirectionRotation.ToRotationVector2(), 0.1f); + else + { + // Have acceleration vary based on how much time has passed. + Vector2 swingSpeedIncrement = swingDirection * MathHelper.SmoothStep(3.8f, 13f, (float)Math.Pow(CalamityUtils.Convert01To010(Time / Lifetime), 8f)); + if (SwingDirection == 0f) + swingSpeedIncrement *= 0.84f; + WhipOutwardness += swingSpeedIncrement; + } + projectile.Center = playerRotatedPosition; + projectile.rotation = WhipOutwardness.ToRotation(); + } + + public void ManipulatePlayerValues() + { + Owner.itemTime = 2; + Owner.itemAnimation = 2; + if (SwingDirection == 0f) + { + Owner.itemRotation = WhipOutwardness.ToRotation() * projectile.direction; + Owner.ChangeDir(projectile.direction); + } + } + + public void CreateBadassPrismExplosion() + { + var sound = Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Owner.Center); + if (sound != null) + sound.Pitch = MathHelper.Clamp(sound.Pitch + 0.15f, 0f, 1f); + + if (Main.myPlayer != projectile.owner) + return; + + 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); + 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 targetAimDisparity = 0f; + if (potentialTarget != null) + 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. + Vector2 prismEndPosition = WhipEnd + rayRotation.ToRotationVector2() * 420f; + + // However, if a potential target is within the general line of sight of the whip, + // fire all lasers at it instead. This results in the entire laser spectrum appearing as one + // brilliant, blazing laser that does great damage. However, it does take some skill to do. + 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); + if (Main.projectile.IndexInRange(prismRay)) + { + Main.projectile[prismRay].ModProjectile().RayHue = i / (float)LaserRayCount; + Main.projectile[prismRay].ModProjectile().StartingPosition = WhipEnd; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + for (int i = 0; i < WhipPoints.Count - 1; i++) + { + string whipTexturePath; + if (i == WhipPoints.Count - 2) + whipTexturePath = Texture; + else if (i == 0) + 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"); + + 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); + } + + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (WhipPoints.Count <= 1) + return false; + + float width = projectile.scale * 38f; + for (int i = 0; i < WhipPoints.Count - 1; i++) + { + float _ = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), WhipPoints[i], WhipPoints[i + 1], width, ref _)) + return true; + } + return false; + } + } +} diff --git a/Projectiles/Melee/SpineOfThanatosProjectile.png b/Projectiles/Melee/SpineOfThanatosProjectile.png new file mode 100644 index 0000000000..749cc7be1b Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosProjectile.png differ diff --git a/Projectiles/Melee/SpineOfThanatosProjectileGlowmask.png b/Projectiles/Melee/SpineOfThanatosProjectileGlowmask.png new file mode 100644 index 0000000000..18a7157c07 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosProjectileGlowmask.png differ diff --git a/Projectiles/Melee/SpineOfThanatosTail.png b/Projectiles/Melee/SpineOfThanatosTail.png new file mode 100644 index 0000000000..2f7adf9370 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosTail.png differ diff --git a/Projectiles/Melee/SpineOfThanatosTailGlowmask.png b/Projectiles/Melee/SpineOfThanatosTailGlowmask.png new file mode 100644 index 0000000000..7d1ac8f4b8 Binary files /dev/null and b/Projectiles/Melee/SpineOfThanatosTailGlowmask.png differ diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index eb4b348fd8..63e0f7aaf9 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs new file mode 100644 index 0000000000..1f1e44af13 --- /dev/null +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -0,0 +1,221 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StellarContemptHammer : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/StellarContemptMelee"; + + private static float RotationIncrement = 0.22f; + private static int Lifetime = 240; + private static float ReboundTime = 26f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Stellar Contempt"); + 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; + } + + public override void AI() + { + drawOffsetX = -11; + drawOriginOffsetY = -10; + drawOriginOffsetX = 0; + + Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0.6f); + + // The hammer makes sound while flying. + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.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) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= ReboundTime) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + projectile.tileCollide = false; + float returnSpeed = StellarContemptMelee.Speed; + float acceleration = 3.2f; + 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 dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + 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(); + } + + // Rotate the hammer as it flies. + projectile.rotation += RotationIncrement; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Some dust gets produced on impact. + int dustCount = Main.rand.Next(20, 24); + int dustRadius = 6; + Vector2 corner = new Vector2(target.Center.X - dustRadius, target.Center.Y - dustRadius); + for (int i = 0; i < dustCount; ++i) + { + int dustType = 229; + float scale = 0.8f + Main.rand.NextFloat(1.1f); + int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + + // Applies Nightwither on contact at night. + if (!Main.dayTime) + target.AddBuff(ModContent.BuffType(), 480); + + SpawnFlares(target.Center, target.width, target.height); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + // Some dust gets produced on impact. + int dustCount = Main.rand.Next(20, 24); + int dustRadius = 6; + Vector2 corner = new Vector2(target.Center.X - dustRadius, target.Center.Y - dustRadius); + for (int i = 0; i < dustCount; ++i) + { + int dustType = 229; + float scale = 0.8f + Main.rand.NextFloat(1.1f); + int idx = Dust.NewDust(corner, 2 * dustRadius, 2 * dustRadius, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + + // Applies Nightwither on contact at night. + if (!Main.dayTime) + target.AddBuff(ModContent.BuffType(), 480); + + SpawnFlares(target.Center, target.width, target.height); + } + + 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; + + int numFlares = 2; + int flareDamage = (int)(0.3f * projectile.damage); + float flareKB = 4f; + for (int i = 0; i < numFlares; ++i) + { + float flareSpeed = Main.rand.NextFloat(8f, 11f); + + // Flares never come from straight up, there is always at least an 80 pixel horizontal offset + float xDist = Main.rand.NextFloat(80f, 320f) * (Main.rand.NextBool() ? -1f : 1f); + float yDist = Main.rand.NextFloat(1200f, 1440f); + Vector2 startPoint = targetPos + new Vector2(xDist, -yDist); + + // The flare is somewhat inaccurate based on the size of the target. + float xVariance = width / 4f; + if (xVariance < 8f) + xVariance = 8f; + float yVariance = height / 4f; + if (yVariance < 8f) + yVariance = 8f; + float xOffset = Main.rand.NextFloat(-xVariance, xVariance); + float yOffset = Main.rand.NextFloat(-yVariance, yVariance); + Vector2 offsetTarget = targetPos + new Vector2(xOffset, yOffset); + + // Finalize the velocity vector and make sure it's going at the right speed. + Vector2 velocity = offsetTarget - startPoint; + velocity.Normalize(); + velocity *= flareSpeed; + + float AI1 = Main.rand.Next(3); + if (projectile.owner == Main.myPlayer) + { + int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); + if (proj.WithinBounds(Main.maxProjectiles)) + { + CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); + cgp.forceMelee = true; + } + } + } + } + } +} diff --git a/Projectiles/Melee/StormBeam.cs b/Projectiles/Melee/StormBeam.cs index e889ab6c1b..7e82dfe196 100644 --- a/Projectiles/Melee/StormBeam.cs +++ b/Projectiles/Melee/StormBeam.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 e28b352a50..e5c897a4d9 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class StormMark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); diff --git a/Projectiles/Melee/StormMark.png b/Projectiles/Melee/StormMark.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Melee/StormMark.png and /dev/null differ diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index 10a9935b4e..021a64ac08 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index b280fdbca4..67a735520c 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 new file mode 100644 index 0000000000..02c044addd --- /dev/null +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsplosionBlue : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blue Sword"); + } + + 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; + aiType = ProjectileID.EnchantedBeam; + 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) + { + 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); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 203, 103, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + + public override void Kill(int timeLeft) + { + 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); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/SwordsplosionBlue.png b/Projectiles/Melee/SwordsplosionBlue.png new file mode 100644 index 0000000000..45a71e5e5b Binary files /dev/null and b/Projectiles/Melee/SwordsplosionBlue.png differ diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs new file mode 100644 index 0000000000..3c40836857 --- /dev/null +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -0,0 +1,76 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsplosionGreen : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Green Sword"); + } + + 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; + aiType = ProjectileID.EnchantedBeam; + 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) + { + 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); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(53, Main.DiscoG, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + + public override void Kill(int timeLeft) + { + 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); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/SwordsplosionGreen.png b/Projectiles/Melee/SwordsplosionGreen.png new file mode 100644 index 0000000000..f86e8afa62 Binary files /dev/null and b/Projectiles/Melee/SwordsplosionGreen.png differ diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs new file mode 100644 index 0000000000..aa200e468a --- /dev/null +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsplosionPurple : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purple Sword"); + } + + 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; + aiType = ProjectileID.EnchantedBeam; + 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) + { + 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); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 100, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + + public override void Kill(int timeLeft) + { + 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); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/SwordsplosionPurple.png b/Projectiles/Melee/SwordsplosionPurple.png new file mode 100644 index 0000000000..39bc1a2b25 Binary files /dev/null and b/Projectiles/Melee/SwordsplosionPurple.png differ diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs new file mode 100644 index 0000000000..bf83555e19 --- /dev/null +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -0,0 +1,77 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsplosionRed : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Sword"); + } + + 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; + aiType = ProjectileID.EnchantedBeam; + 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) + { + 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); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + + public override void Kill(int timeLeft) + { + 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); + Main.dust[num308].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + } +} diff --git a/Projectiles/Melee/SwordsplosionRed.png b/Projectiles/Melee/SwordsplosionRed.png new file mode 100644 index 0000000000..322531fe55 Binary files /dev/null and b/Projectiles/Melee/SwordsplosionRed.png differ diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs new file mode 100644 index 0000000000..30b8eace4f --- /dev/null +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -0,0 +1,295 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +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 float AttackCompletionRatio + { + get + { + float completionRatio = 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; + if (float.IsNaN(completionRatio) || float.IsInfinity(completionRatio)) + completionRatio = 0f; + return completionRatio; + } + } + 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; + + public Rectangle BladeFrame + { + get + { + Texture2D bladeTexture = Main.itemTexture[(int)SwordItemID]; + Rectangle bladeFrame = bladeTexture.Frame(1, 1, 0, 0); + bool hasMultipleFrames = Main.itemAnimations[(int)SwordItemID] != null; + if (hasMultipleFrames) + bladeFrame = Main.itemAnimations[(int)SwordItemID].GetFrame(bladeTexture); + return bladeFrame; + } + } + + public Vector2 BackArmAimPosition + { + get + { + Vector2 baseAimPosition = Owner.Top + new Vector2(-Owner.direction * (ForearmLength + Math.Abs(VerticalOffset) * 0.55f), -27f); + if (Variant == 1) + baseAimPosition.Y += 30f; + if (Owner.itemAnimation == 0) + return baseAimPosition; + + Vector2 endSwingPosition = Owner.Center + Vector2.UnitX * Owner.direction * 510f; + return Vector2.SmoothStep(baseAimPosition, endSwingPosition, Utils.InverseLerp(0f, 0.67f, AttackCompletionRatio, true) * Utils.InverseLerp(1f, 0.67f, AttackCompletionRatio, true)); + } + } + public Vector2 IdleMoveOffset + { + get + { + Vector2 offset = Owner.itemAnimation == 0 ? (Time / 27f).ToRotationVector2() * new Vector2(5f, 4f) : Vector2.Zero; + if (Variant == 1) + offset += Vector2.UnitX * Owner.direction * (1f - AttackCompletionRatio) * 40f; + return offset; + } + } + public Vector2 FrontArmEnd + { + get + { + float backArmRotation = Owner.AngleTo(BackArmAimPosition); + Vector2 fromArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength; + Vector2 backOffset = (projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; + return fromArmDrawPosition + backOffset; + } + } + public Vector2 BladeOffsetDirection + { + get + { + float backArmRotation = Owner.AngleTo(BackArmAimPosition); + Vector2 fromArmDrawPosition = Owner.Center + backArmRotation.ToRotationVector2() * ForearmLength; + Vector2 backOffset = (projectile.Center - fromArmDrawPosition).SafeNormalize(Vector2.Zero) * ArmLength + IdleMoveOffset; + float bladeRotation = backOffset.ToRotation() - MathHelper.PiOver4 + MathHelper.Pi; + return -(bladeRotation + MathHelper.PiOver4 + BladeRotationOffset).ToRotationVector2(); + } + } + public Vector2 BladeCenterPosition + { + get + { + float offsetFactor = BladeFrame.Height / 4f + 31f; + return FrontArmEnd + BladeOffsetDirection * offsetFactor; + } + } + public float BladeRotationOffset => MathHelper.Lerp(MathHelper.PiOver2, 0f, Utils.InverseLerp(0f, 0.17f, 1f - AttackCompletionRatio, true)) * -Owner.direction; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blade"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(VerticalOffset); + + public override void ReceiveExtraAI(BinaryReader reader) => VerticalOffset = reader.ReadSingle(); + + public override void AI() + { + CalamityPlayerMiscEffects.EnchantHeldItemEffects(Owner, Owner.Calamity(), Owner.ActiveItem()); + if (!Owner.Calamity().bladeArmEnchant || Owner.ActiveItem().type != SwordItemID || Owner.CCed || !Owner.active || Owner.dead) + { + projectile.Kill(); + return; + } + + if (Owner.itemAnimationMax == 0) + Owner.itemAnimationMax = (int)(Owner.ActiveItem().useAnimation * Owner.meleeSpeed); + + float swingOffsetAngle = MathHelper.SmoothStep(-1.87f, 3.79f, AttackCompletionRatio); + + // Offset a little bit angularly if the secondary variant to prevent complete overlap. + if (Variant == 1) + swingOffsetAngle -= 0.7f; + swingOffsetAngle *= Owner.direction; + swingOffsetAngle = MathHelper.Lerp(0f, swingOffsetAngle, Utils.InverseLerp(0f, 0.16f, AttackCompletionRatio, true)); + + if (Owner.itemAnimation == 0) + swingOffsetAngle = 0f; + + Vector2 destination = Owner.Center; + + if (Owner.itemAnimation == 0) + { + destination.X += Owner.direction * (VerticalOffset * 0.6f + 180f); + destination.Y += 330f + VerticalOffset; + if (Variant == 1) + destination.Y += 540f; + + // 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; + } + else + { + // Swing around in an arc as needed. + // One arm extends a little bit further than the other. + destination -= Vector2.UnitY.RotatedBy(swingOffsetAngle) * 600f; + + // Make a fire/swing sound. + if (Owner.itemAnimation == 21) + Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Owner.Center); + projectile.localNPCHitCooldown = 3; + } + + if (AttackCompletionRatio < 0.16f) + 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; + } + + // 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()); + + // Ensure that the position is never too far from the destination. + CalamityUtils.DistanceClamp(ref projectile.position, ref destination, 50f); + + Time++; + } + + internal float PrimitiveWidthFunction(float completionRatio) => BladeFrame.Height * 0.47f; + + internal Color PrimitiveColorFunction(float completionRatio) + { + float opacity = Utils.InverseLerp(0.8f, 0.52f, completionRatio, true) * Utils.InverseLerp(1f, 0.81f, AttackCompletionRatio, true); + Color startingColor = Color.Lerp(Color.Red, Color.DarkRed, 0.4f); + Color endingColor = Color.Lerp(Color.DarkRed, Color.Purple, 0.77f); + return Color.Lerp(startingColor, endingColor, (float)Math.Pow(completionRatio, 0.37f)) * opacity; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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"); + + // Reflect the 1st hand variant horizontally. + SpriteEffects handDirection = SpriteEffects.None; + if (Variant == (Owner.direction == -1).ToInt()) + { + handTexture = ModContent.GetTexture("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); + + 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 handRotation = frontArmRotation + MathHelper.PiOver2 + MathHelper.Pi; + float bladeRotation = handRotation - MathHelper.PiOver4 + MathHelper.Pi + BladeRotationOffset; + if (Owner.direction == -1) + bladeRotation += MathHelper.PiOver2; + + // Draw the trail behind the blade. + if (Owner.itemAnimation > 0) + { + GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.GetTexture("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; + Vector2 top = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; + Vector2 offsetToBlade = (top - bottom).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * 5f; + + TrailDrawer.OverridingStickPointStart = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f + offsetToBlade - Main.screenPosition; + TrailDrawer.OverridingStickPointEnd = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f + offsetToBlade - Main.screenPosition; + + // Swap the ends if needed so that the trail faces the right direction. + if (Owner.direction == -1) + Utils.Swap(ref TrailDrawer.OverridingStickPointStart, ref TrailDrawer.OverridingStickPointEnd); + + 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) + continue; + + drawPoints[i] = projectile.Center + perpendicularDirection.RotatedBy(i * -0.014f * Owner.direction) * i * -Owner.direction * 6f; + } + + 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); + + // Draw the hand. + spriteBatch.Draw(handTexture, FrontArmEnd - Main.screenPosition, null, projectile.GetAlpha(Color.White), handRotation, handTexture.Size() * 0.5f, projectile.scale, handDirection, 0f); + return false; + } + + // Register collision at the blade's position. + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Vector2 start = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f; + Vector2 end = BladeCenterPosition + BladeOffsetDirection * BladeFrame.Height * 0.5f; + float width = 60f; + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, end, width, ref _); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit); + NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit); + PlayerHooks.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); + } + } +} diff --git a/Projectiles/Melee/TemporalFloeNumberTwo.cs b/Projectiles/Melee/TemporalFloeNumberTwo.cs index a751649abd..93057dbad4 100644 --- a/Projectiles/Melee/TemporalFloeNumberTwo.cs +++ b/Projectiles/Melee/TemporalFloeNumberTwo.cs @@ -69,10 +69,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.rand.NextBool(3)) - { - target.AddBuff(ModContent.BuffType(), 120); - } + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 240); } } diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index f3eea114c0..8ead3149d5 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -103,10 +103,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.rand.NextBool(3)) - { - target.AddBuff(ModContent.BuffType(), 120); - } + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 240); } } diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 7970a0aa6a..badc2a25c5 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.timeLeft == 300) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TenebreusTidesWaterSpear.cs b/Projectiles/Melee/TenebreusTidesWaterSpear.cs index 0dedade38f..a917e5c6ea 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSpear.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSpear.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Projectiles.Melee projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; projectile.tileCollide = false; - } + projectile.ignoreWater = true; + } public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.cs b/Projectiles/Melee/TenebreusTidesWaterSword.cs index 0273c34318..e4caa78fcf 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSword.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSword.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Melee projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 5; projectile.tileCollide = false; - } + projectile.ignoreWater = true; + } public override void SendExtraAI(BinaryWriter writer) { diff --git a/Projectiles/Melee/TerraBall.cs b/Projectiles/Melee/TerraBall.cs index 4e445d4b70..3d33d4ebf5 100644 --- a/Projectiles/Melee/TerraBall.cs +++ b/Projectiles/Melee/TerraBall.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.01f * (float)projectile.direction; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/TerracottaExplosion.cs b/Projectiles/Melee/TerracottaExplosion.cs index 9954828fed..9a82fbc045 100644 --- a/Projectiles/Melee/TerracottaExplosion.cs +++ b/Projectiles/Melee/TerracottaExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class TerracottaExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -20,8 +22,10 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.melee = true; projectile.penetrate = -1; - projectile.timeLeft = 180; - } + projectile.timeLeft = 5; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Melee/TerracottaExplosion.png b/Projectiles/Melee/TerracottaExplosion.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Melee/TerracottaExplosion.png and /dev/null differ diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs index e795b9ba79..9e783bdddc 100644 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ b/Projectiles/Melee/TerratomereProjectile.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; + projectile.width = 30; + projectile.height = 30; projectile.aiStyle = 27; projectile.friendly = true; projectile.melee = true; @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); Lighting.AddLight(projectile.Center, 0f, (255 - projectile.alpha) * 0.75f / 255f, 0f); } @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 30); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/TerratomereProjectile.png b/Projectiles/Melee/TerratomereProjectile.png index 40743f18f7..5403f92ba1 100644 Binary files a/Projectiles/Melee/TerratomereProjectile.png and b/Projectiles/Melee/TerratomereProjectile.png differ diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 28e2726d20..6fec0b0ea3 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,11 +10,9 @@ namespace CalamityMod.Projectiles.Melee { public class TerrorBeam : ModProjectile { - private bool hasHitEnemy = false; - public override void SetStaticDefaults() { - DisplayName.SetDefault("Beam"); + DisplayName.SetDefault("Terror Beam"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 1; } @@ -29,7 +28,14 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 600; projectile.light = 1f; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3; + 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); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -43,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee { 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); + SpawnTerrorBlast(); } if (projectile.velocity.X != oldVelocity.X) { @@ -59,10 +65,10 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && !hasHitEnemy) + if (projectile.owner == Main.myPlayer && projectile.localAI[0] == 0f) { - hasHitEnemy = true; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + projectile.localAI[0] = 1f; + SpawnTerrorBlast(); } } @@ -88,34 +94,18 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) - return false; + if (projectile.timeLeft > 595) + return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } public override void Kill(int timeLeft) { - 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); - 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); - } - for (int num194 = 0; num194 < 60; num194++) - { - 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); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); + // If no on-hit explosion was ever generated, spawn it for free when the beam expires. + if (projectile.localAI[0] == 0f) + SpawnTerrorBlast(); } } } diff --git a/Projectiles/Melee/TerrorBoom.cs b/Projectiles/Melee/TerrorBlast.cs similarity index 64% rename from Projectiles/Melee/TerrorBoom.cs rename to Projectiles/Melee/TerrorBlast.cs index 7a8968d54f..67f070e523 100644 --- a/Projectiles/Melee/TerrorBoom.cs +++ b/Projectiles/Melee/TerrorBlast.cs @@ -4,39 +4,46 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class TerrorBoom : ModProjectile + public class TerrorBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Explosion"); + DisplayName.SetDefault("Terror Blast"); } public override void SetDefaults() { - projectile.width = 250; - projectile.height = 250; + projectile.width = projectile.height = 2; projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.penetrate = 4; - projectile.timeLeft = 60; + 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 = 3; + projectile.localNPCHitCooldown = -1; projectile.melee = true; } + // Terror Blasts do nothing until they explode. + 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); - for (int num193 = 0; num193 < 6; num193++) - { + + 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); - } - for (int num194 = 0; num194 < 60; num194++) + + 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); Main.dust[num195].noGravity = true; @@ -45,6 +52,9 @@ namespace CalamityMod.Projectiles.Melee 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(); } } diff --git a/Projectiles/Melee/TerrorBoom.png b/Projectiles/Melee/TerrorBoom.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Melee/TerrorBoom.png and /dev/null differ diff --git a/Projectiles/Melee/ThanatosBoom.cs b/Projectiles/Melee/ThanatosBoom.cs new file mode 100644 index 0000000000..be0d35f9f8 --- /dev/null +++ b/Projectiles/Melee/ThanatosBoom.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Melee +{ + public class ThanatosBoom : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Boom"); + + 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; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + CreateExplosionDust(); + projectile.localAI[0] = 1f; + } + } + + public void CreateExplosionDust() + { + if (Main.dedServ) + return; + + for (float speed = 2f; speed <= 6f; speed += 0.7f) + { + float lifePersistance = Main.rand.NextFloat(0.8f, 1.7f); + for (int i = 0; i < 60; i++) + { + 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); + energy.fadeIn = lifePersistance; + energy.scale = 1.4f; + } + } + } + } +} diff --git a/Projectiles/Melee/TinyCrystal.cs b/Projectiles/Melee/TinyCrystal.cs index 5cbf4ea7de..c4ce4ad91a 100644 --- a/Projectiles/Melee/TinyCrystal.cs +++ b/Projectiles/Melee/TinyCrystal.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class TinyCrystal : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal"); @@ -20,13 +22,14 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = 1; projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.tileCollide = true; + projectile.timeLeft = 90; } + 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; @@ -41,6 +44,7 @@ namespace CalamityMod.Projectiles.Melee Dust expr_4815_cp_0 = Main.dust[num96]; expr_4815_cp_0.position.Y -= num94; } + if (Main.rand.NextBool(10)) { int num97 = 4; @@ -48,11 +52,14 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num98].velocity *= 0.25f; Main.dust[num98].velocity += projectile.velocity * 0.5f; } + + 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); @@ -62,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee 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, 120); } } diff --git a/Projectiles/Melee/TinyCrystal.png b/Projectiles/Melee/TinyCrystal.png deleted file mode 100644 index 8e19554cda..0000000000 Binary files a/Projectiles/Melee/TinyCrystal.png and /dev/null differ diff --git a/Projectiles/Melee/TinyFlare.cs b/Projectiles/Melee/TinyFlare.cs index 800bcd67e4..55762268fa 100644 --- a/Projectiles/Melee/TinyFlare.cs +++ b/Projectiles/Melee/TinyFlare.cs @@ -25,7 +25,9 @@ namespace CalamityMod.Projectiles.Melee projectile.extraUpdates = 1; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { for (int num468 = 0; num468 < 3; num468++) { @@ -34,7 +36,8 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num469].velocity *= 0f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 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 7be4c0ae97..2b70ce8b31 100644 --- a/Projectiles/Melee/Tornado.cs +++ b/Projectiles/Melee/Tornado.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Melee { public class Tornado : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); diff --git a/Projectiles/Melee/Tornado.png b/Projectiles/Melee/Tornado.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Melee/Tornado.png and /dev/null differ diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs new file mode 100644 index 0000000000..99d37ebeea --- /dev/null +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -0,0 +1,162 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TriactisHammerProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMightMelee"; + + 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; + } + + 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; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.75f); + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 30f) + { + projectile.ai[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + else + { + 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; + float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45); + if (num46 > 3000f) + projectile.Kill(); + num46 = num42 / num46; + num44 *= num46; + num45 *= num46; + 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; + } + 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.Y < num45) + { + 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) + { + 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) + { + 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.rotation += 0.5f; + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250, 50); + } + + 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); + 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); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + 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); + 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); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[num624].velocity *= 2f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Melee/TrueBiomeOrb.cs b/Projectiles/Melee/TrueBiomeOrb.cs index f6ba37865d..5c6135c40b 100644 --- a/Projectiles/Melee/TrueBiomeOrb.cs +++ b/Projectiles/Melee/TrueBiomeOrb.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 295) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -175,7 +175,7 @@ namespace CalamityMod.Projectiles.Melee } else if (snow) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 30); } else if (beach) { @@ -191,7 +191,7 @@ namespace CalamityMod.Projectiles.Melee } else if (glow) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 30); } else if (hell) { diff --git a/Projectiles/Melee/TrueCausticEdgeProjectile.cs b/Projectiles/Melee/TrueCausticEdgeProjectile.cs index 2267713830..fab6461f71 100644 --- a/Projectiles/Melee/TrueCausticEdgeProjectile.cs +++ b/Projectiles/Melee/TrueCausticEdgeProjectile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -49,7 +49,6 @@ namespace CalamityMod.Projectiles.Melee public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)(projectile.damage * 1.25); projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -57,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index feb898ae16..c66090359f 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class TumbleweedRolling : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/TumbleweedFlail"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tumbleweed"); diff --git a/Projectiles/Melee/TumbleweedRolling.png b/Projectiles/Melee/TumbleweedRolling.png deleted file mode 100644 index 5d7925fa85..0000000000 Binary files a/Projectiles/Melee/TumbleweedRolling.png and /dev/null differ diff --git a/Projectiles/Melee/TyphonsGreedBubble.cs b/Projectiles/Melee/TyphonsGreedBubble.cs index b15fa59403..cc451323ca 100644 --- a/Projectiles/Melee/TyphonsGreedBubble.cs +++ b/Projectiles/Melee/TyphonsGreedBubble.cs @@ -54,12 +54,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.Distance(player.Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(player.Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector102 * speed) / inertia; + Vector2 moveDirection = projectile.SafeDirectionTo(player.Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia; } } else diff --git a/Projectiles/Melee/TyphonsGreedStaff.cs b/Projectiles/Melee/TyphonsGreedStaff.cs index 2b213b2620..2ae51421bc 100644 --- a/Projectiles/Melee/TyphonsGreedStaff.cs +++ b/Projectiles/Melee/TyphonsGreedStaff.cs @@ -72,22 +72,15 @@ namespace CalamityMod.Projectiles.Melee } else if (flag2) { - Vector2 mouseWorld2 = Main.MouseWorld; - int num11 = (player.DirectionTo(mouseWorld2).X > 0f) ? 1 : -1; - if ((float)num11 != projectile.velocity.X) + int expectedDirection = (player.SafeDirectionTo(Main.MouseWorld).X > 0f).ToDirectionInt(); + if (expectedDirection != projectile.velocity.X) { - player.ChangeDir(num11); - projectile.velocity = new Vector2((float)num11, 0f); + player.ChangeDir(expectedDirection); + projectile.velocity = Vector2.UnitX * expectedDirection; + projectile.rotation -= MathHelper.Pi; projectile.netUpdate = true; - projectile.rotation -= 3.14159274f; } } - if ((projectile.ai[0] == num10 || (projectile.ai[0] == (float)(int)(num / 2f) && projectile.active)) && projectile.owner == Main.myPlayer) - { - Vector2 mouseWorld3 = Main.MouseWorld; - Vector2 mouse = player.DirectionTo(mouseWorld3) * 0f; - player.DirectionTo(mouse); - } 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; @@ -96,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee 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.DirectionTo(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++) { diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs index c15eab7c35..6c52362304 100644 --- a/Projectiles/Melee/UltimusCleaverDust.cs +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Melee { public class UltimusCleaverDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ultimus Flame"); @@ -14,10 +16,11 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 6; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 5; - projectile.timeLeft = 120; + projectile.ignoreWater = true; + projectile.penetrate = 2; + projectile.timeLeft = 90; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 10; projectile.tileCollide = false; projectile.melee = true; } diff --git a/Projectiles/Melee/UltimusCleaverDust.png b/Projectiles/Melee/UltimusCleaverDust.png deleted file mode 100644 index ee4239cbf9..0000000000 Binary files a/Projectiles/Melee/UltimusCleaverDust.png and /dev/null differ diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs new file mode 100644 index 0000000000..90f645103c --- /dev/null +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -0,0 +1,121 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +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 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; + } + + 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; + } + + public override void AI() + { + // Fade in. + projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + + if (!Owner.channel) + { + projectile.Kill(); + return; + } + + ManipulatePlayerFields(); + 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); + 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); + + 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.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()); + } + + 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; + 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; + + 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; + + 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")); + + Texture2D spearProjectile = Main.projectileTexture[projectile.type]; + + 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; + float angleOffset = MathHelper.Pi * 0.25f * -Math.Sign(SwingSine) * i / 16f; + 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); + return true; + } + } +} diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs new file mode 100644 index 0000000000..0fcf8ac827 --- /dev/null +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -0,0 +1,161 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +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]; + 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; + } + + 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; + } + + public override void AI() + { + // Fade in. + projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + + if (Owner.channel) + { + HomeTowardsMouse(); + projectile.rotation += 0.35f / 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); + } + 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); + Time++; + } + + internal void HomeTowardsMouse() + { + if (Main.myPlayer != projectile.owner) + return; + + 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; + } + + 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)) + { + for (int i = 0; i < 75; i++) + { + Dust fire = Dust.NewDustPerfect(Owner.Center, DustID.Fire); + fire.velocity = (MathHelper.TwoPi * i / 75f).ToRotationVector2() * 4f - Vector2.UnitY * 3f; + fire.scale = 1.4f; + fire.noGravity = true; + } + projectile.Kill(); + } + } + + internal void ManipulatePlayerFields() + { + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + internal float PrimitiveWidthFunction(float completionRatio) + { + float tipWidthFactor = MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0.01f, 0.04f, completionRatio)); + float bodyWidthFactor = (float)Math.Pow(Utils.InverseLerp(1f, 0.04f, completionRatio), 0.9D); + return (float)Math.Pow(tipWidthFactor * bodyWidthFactor, 0.1D) * 30f; + } + + internal Color PrimitiveColorFunction(float completionRatio) + { + 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); + Color frontFade = Color.Lerp(new Color(255, 145, 115), new Color(113, 0, 159), fadeInterpolant); + + // Go halfway to a dark red color. + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (StreakDrawer is null) + StreakDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); + + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.GetTexture("CalamityMod/ExtraTextures/FabstaffStreak")); + + 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(); + + if (Owner.channel) + { + drawPoints[0] += aimAheadDirection * -12f; + 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; + + if (Time > projectile.oldPos.Length) + StreakDrawer.Draw(drawPoints, projectile.Size * 0.5f - Main.screenPosition, 88); + + Vector2 drawPosition = projectile.Center - Main.screenPosition; + for (int i = 0; i < 6; i++) + { + 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); + } + + return false; + } + } +} diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index 419900e99b..f50278f8c4 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee if (projectile.timeLeft > 95) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/VoidTentacle.cs b/Projectiles/Melee/VoidTentacle.cs index d11f58d592..ca8501a57a 100644 --- a/Projectiles/Melee/VoidTentacle.cs +++ b/Projectiles/Melee/VoidTentacle.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class VoidTentacle : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Void Tentacle"); diff --git a/Projectiles/Melee/VoidTentacle.png b/Projectiles/Melee/VoidTentacle.png deleted file mode 100644 index c1d65fb3be..0000000000 Binary files a/Projectiles/Melee/VoidTentacle.png and /dev/null differ diff --git a/Projectiles/Melee/Waterfall.cs b/Projectiles/Melee/Waterfall.cs index 4935767ba6..cb2887f311 100644 --- a/Projectiles/Melee/Waterfall.cs +++ b/Projectiles/Melee/Waterfall.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Melee { public class Waterfall : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -72,7 +74,6 @@ namespace CalamityMod.Projectiles.Melee } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Melee/Waterfall.png b/Projectiles/Melee/Waterfall.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/Waterfall.png and /dev/null differ diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index 632f3471be..9425aa48c1 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteBoltAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aura"); @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee else { projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + if (projectile.ai[0] > 12f) { projectile.ai[0] = 0f; if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/WhiteBoltAura.png b/Projectiles/Melee/WhiteBoltAura.png deleted file mode 100644 index 0ad8904064..0000000000 Binary files a/Projectiles/Melee/WhiteBoltAura.png and /dev/null differ diff --git a/Projectiles/Melee/WhiteBoltAuraBlah.cs b/Projectiles/Melee/WhiteBoltAuraBlah.cs index 5f0d78f330..0185ccf490 100644 --- a/Projectiles/Melee/WhiteBoltAuraBlah.cs +++ b/Projectiles/Melee/WhiteBoltAuraBlah.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteBoltAuraBlah : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aura"); @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee else { projectile.ai[0] += 1f; - if (projectile.ai[0] > 6f) + if (projectile.ai[0] > 12f) { projectile.ai[0] = 0f; if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Melee/WhiteBoltAuraBlah.png b/Projectiles/Melee/WhiteBoltAuraBlah.png deleted file mode 100644 index 0ad8904064..0000000000 Binary files a/Projectiles/Melee/WhiteBoltAuraBlah.png and /dev/null differ diff --git a/Projectiles/Melee/WhiteOrb.cs b/Projectiles/Melee/WhiteOrb.cs index c9daf49a02..de8351df18 100644 --- a/Projectiles/Melee/WhiteOrb.cs +++ b/Projectiles/Melee/WhiteOrb.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); diff --git a/Projectiles/Melee/WhiteOrb.png b/Projectiles/Melee/WhiteOrb.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/WhiteOrb.png and /dev/null differ diff --git a/Projectiles/Melee/WhiteOrbBlah.cs b/Projectiles/Melee/WhiteOrbBlah.cs index 6c0f95334a..77f4551c27 100644 --- a/Projectiles/Melee/WhiteOrbBlah.cs +++ b/Projectiles/Melee/WhiteOrbBlah.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Melee { public class WhiteOrbBlah : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); diff --git a/Projectiles/Melee/WhiteOrbBlah.png b/Projectiles/Melee/WhiteOrbBlah.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Melee/WhiteOrbBlah.png and /dev/null differ diff --git a/Projectiles/Melee/Whiterain.cs b/Projectiles/Melee/Whiterain.cs index a59faa3797..19380e7d0a 100644 --- a/Projectiles/Melee/Whiterain.cs +++ b/Projectiles/Melee/Whiterain.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class Whiterain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Rain"); @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity += projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } } } diff --git a/Projectiles/Melee/Whiterain.png b/Projectiles/Melee/Whiterain.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/Whiterain.png and /dev/null differ diff --git a/Projectiles/Melee/WhiterainBlah.cs b/Projectiles/Melee/WhiterainBlah.cs index 0bbc0a4d59..9848814ddd 100644 --- a/Projectiles/Melee/WhiterainBlah.cs +++ b/Projectiles/Melee/WhiterainBlah.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Melee { public class WhiterainBlah : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Rain"); @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity += projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1000f, 18f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } } } diff --git a/Projectiles/Melee/WhiterainBlah.png b/Projectiles/Melee/WhiterainBlah.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Melee/WhiterainBlah.png and /dev/null differ diff --git a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs index 56ba5f1f19..6668747b03 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerYoyo.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,16 +29,20 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; 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(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 3a140242f2..6d8a19767e 100644 --- a/Projectiles/Melee/Yoyos/AortaYoyo.cs +++ b/Projectiles/Melee/Yoyos/AortaYoyo.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Aorta"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 11f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 220f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 260f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 8.5f; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; @@ -28,11 +29,20 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; projectile.penetrate = -1; projectile.MaxUpdates = 2; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + 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(); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 10e9ba4b64..05ab6b164a 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -22,16 +22,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void SetDefaults() { projectile.aiStyle = 99; - projectile.width = 16; - projectile.height = 16; + 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 = 2; + projectile.localNPCHitCooldown = 6; } public override void AI() @@ -39,13 +38,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(6)) { if (projectile.owner == Main.myPlayer) - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + 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(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.png b/Projectiles/Melee/Yoyos/AzathothYoyo.png index d59b355713..ee27859aaa 100644 Binary files a/Projectiles/Melee/Yoyos/AzathothYoyo.png and b/Projectiles/Melee/Yoyos/AzathothYoyo.png differ diff --git a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs index cdf33d9689..11c79b1b5c 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Fault"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 290f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 420f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 13f; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; @@ -30,19 +30,22 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; 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); - 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.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(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -50,14 +53,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(BuffID.OnFire, 300); 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); - Main.projectile[boom].Calamity().forceMelee = true; + 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; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 0cc6fff9fd..bf2addb6b9 100644 --- a/Projectiles/Melee/Yoyos/CnidarianYoyo.cs +++ b/Projectiles/Melee/Yoyos/CnidarianYoyo.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Cnidarian"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 190f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 240f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 11f; } @@ -26,11 +26,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; 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.5); + 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) diff --git a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs index baa3195087..e1029e3e4b 100644 --- a/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs +++ b/Projectiles/Melee/Yoyos/GodsGambitYoyo.cs @@ -25,11 +25,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - } + projectile.MaxUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 450f, 6f, 10f, 5, ProjectileID.SlimeGun, 0.75); + 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) diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index d227d53804..201017c0db 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -29,26 +29,28 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; 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(); + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; + Player player = Main.player[projectile.owner]; - if (Main.rand.NextBool(5)) - { - player.statLife += 1; - player.HealEffect(1); - } + player.lifeRegenTime += 2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 9407653a75..cd4b7f222a 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,13 +14,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { private const float Radius = 100f; private SoundEffectInstance mmmmmm = null; - private bool spawnedAura = false; + private bool spawnedAura = false; + public int soundCooldown = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("The Microwave"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 320f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 450f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 14f; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; @@ -36,11 +38,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; projectile.penetrate = -1; projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 20; } + public override void SendExtraAI(BinaryWriter writer) => writer.Write(soundCooldown); + public override void ReceiveExtraAI(BinaryReader reader) => soundCooldown = reader.ReadInt32(); + public override void AI() { // Sound is done manually, so that it can loop correctly. @@ -51,16 +55,20 @@ namespace CalamityMod.Projectiles.Melee.Yoyos CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center); Main.PlaySoundInstance(mmmmmm); } - else if(!mmmmmm.IsDisposed) + else if (!mmmmmm.IsDisposed) CalamityUtils.ApplySoundStats(ref mmmmmm, projectile.Center); // Spawn invisible but damaging aura projectile if (projectile.owner == Main.myPlayer && !spawnedAura) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, projectile.identity, 0f); - spawnedAura = true; + 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()) + soundCooldown--; + // Dust circle appears for all players, even though the aura projectile is only spawned by the owner int numDust = (int)(0.2f * MathHelper.TwoPi * Radius); float angleIncrement = MathHelper.TwoPi / (float)numDust; @@ -80,18 +88,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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(); } public override void Kill(int timeLeft) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); mmmmmm?.Stop(); mmmmmm?.Dispose(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -104,6 +115,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); + if (target.life <= 0 && soundCooldown <= 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)projectile.Center.X, (int)projectile.Center.Y); + soundCooldown = 45; + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + if (target.statLife <= 0 && soundCooldown <= 0) + { + Main.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 4e8bf5dc91..06eaece88a 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // Ensures that the main AI only runs once per frame, despite the projectile's multiple updates private int extraUpdateCounter = 0; - private const int UpdatesPerFrame = 3; + private const int UpdatesPerFrame = 2; public override void SetStaticDefaults() { @@ -36,7 +36,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; projectile.penetrate = -1; projectile.MaxUpdates = UpdatesPerFrame; - projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3 * UpdatesPerFrame; } @@ -46,6 +45,9 @@ 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(); + // Only do stuff once per frame, despite the yoyo's extra updates. extraUpdateCounter = (extraUpdateCounter + 1) % UpdatesPerFrame; if (extraUpdateCounter != UpdatesPerFrame - 1) @@ -102,14 +104,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { int proj = Projectile.NewProjectile(laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, projectile.owner); - Main.projectile[proj].Calamity().forceMelee = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMelee = true; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/OblivionYoyo.cs b/Projectiles/Melee/Yoyos/OblivionYoyo.cs index f165bb20fe..43df6ecdc5 100644 --- a/Projectiles/Melee/Yoyos/OblivionYoyo.cs +++ b/Projectiles/Melee/Yoyos/OblivionYoyo.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Oblivion"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 360f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; @@ -28,11 +28,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - } + projectile.MaxUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 16f, 5, ModContent.ProjectileType(), 0.25); + 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) @@ -42,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 ebdf604fd0..64e6a384b9 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,11 +11,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public class OracleYoyo : ModProjectile { + public int AuraFrame; + // projectile.localAI[1] is the Aura Charge of the red lightning aura // Minimum value is zero. Maximum value is 200. // 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]; + private const float MaxCharge = 200f; private const float MinAuraRadius = 20f; private const float SuperchargeThreshold = 50f; @@ -22,11 +27,13 @@ namespace CalamityMod.Projectiles.Melee.Yoyos private const float MinDischargeRate = 0.05f; private const float MaxDischargeRate = 0.53f; private const float DischargeRateScaleFactor = 0.003f; - private const float ChargePerHit = 3f; + private const float ChargePerHit = 4.5f; private const int HitsPerOrbVolley = 3; + // The aura hits once per this many frames. + private const int AuraLocalIFrames = 10; + // Ensures that the main AI only runs once per frame, despite the projectile's multiple updates - private int extraUpdateCounter = 0; private const int UpdatesPerFrame = 3; public override void SetStaticDefaults() @@ -40,6 +47,18 @@ namespace CalamityMod.Projectiles.Melee.Yoyos ProjectileID.Sets.TrailingMode[projectile.type] = 1; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AuraFrame); + writer.Write(AuraCharge); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + AuraFrame = reader.ReadInt32(); + AuraCharge = reader.ReadSingle(); + } + public override void SetDefaults() { projectile.aiStyle = 99; @@ -50,16 +69,17 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; projectile.penetrate = -1; projectile.MaxUpdates = UpdatesPerFrame; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 3 * UpdatesPerFrame; + projectile.localNPCHitCooldown = 7 * UpdatesPerFrame; } public override void AI() { + 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) + if (!projectile.FinalExtraUpdate()) return; // Produces golden dust constantly while in flight. This helps light the yoyo. @@ -77,21 +97,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Lighting.AddLight(projectile.Center, 0.6f, 0.42f, 0.1f); // The aura discharges over time based on its current charge. - float discharge = MinDischargeRate + DischargeRateScaleFactor * projectile.localAI[1]; + float discharge = MinDischargeRate + DischargeRateScaleFactor * AuraCharge; if (discharge > MaxDischargeRate) discharge = MaxDischargeRate; - projectile.localAI[1] -= discharge; + AuraCharge -= discharge; // Boundary checks on aura charge - if (projectile.localAI[1] < 0f) - projectile.localAI[1] = 0f; - if (projectile.localAI[1] > MaxCharge) - projectile.localAI[1] = MaxCharge; + if (AuraCharge < 0f) + AuraCharge = 0f; + if (AuraCharge > MaxCharge) + AuraCharge = MaxCharge; // If the aura is large enough to be considered "on", draw it, make sound and damage enemies - if (projectile.localAI[1] > MinAuraRadius) + if (AuraCharge > MinAuraRadius) { - float auraRadius = projectile.localAI[1] > MaxAuraRadius ? MaxAuraRadius : projectile.localAI[1]; + float auraRadius = AuraCharge > MaxAuraRadius ? MaxAuraRadius : AuraCharge; DrawRedLightningAura(auraRadius); if (projectile.soundDelay == 0) @@ -100,32 +120,33 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Main.PlaySound(SoundID.Item93, (int)projectile.Center.X, (int)projectile.Center.Y); } - // The aura's direct damage scales with its charge and with melee stats. - float chargeRatio = projectile.localAI[1] / MaxCharge; - int auraDamage = Oracle.AuraBaseDamage + (int)(chargeRatio * (Oracle.AuraMaxDamage - Oracle.AuraBaseDamage)); - DealAuraDamage(auraRadius, auraDamage); + if (AuraFrame % AuraLocalIFrames == 0) + { + // The aura's direct damage scales with its charge and with melee stats. + float chargeRatio = AuraCharge / MaxCharge; + int auraDamage = Oracle.AuraBaseDamage + (int)(chargeRatio * (Oracle.AuraMaxDamage - Oracle.AuraBaseDamage)); + DealAuraDamage(auraRadius, auraDamage); + } } else projectile.soundDelay = 2; + + AuraFrame = (AuraFrame + 1) % AuraLocalIFrames; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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) { - // The yoyo does nothing versus normal dummies - if (target.type == NPCID.TargetDummy) - return; - // Charge up the red lightning aura with every hit - projectile.localAI[1] += ChargePerHit; + AuraCharge += ChargePerHit; // Fire Auric orbs every few hits while supercharged. - if (projectile.localAI[1] > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) + if (AuraCharge > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) FireAuricOrbs(); } @@ -218,8 +239,11 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (projectile.owner == Main.myPlayer) { Projectile p = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, projectile.owner, i); - p.melee = true; - p.Calamity().forceMelee = true; + if (p.whoAmI.WithinBounds(Main.maxProjectiles)) + { + p.melee = true; + p.Calamity().forceMelee = true; + } } } } diff --git a/Projectiles/Melee/Yoyos/PandemicYoyo.cs b/Projectiles/Melee/Yoyos/PandemicYoyo.cs index 88dea7d94a..2f1f74570b 100644 --- a/Projectiles/Melee/Yoyos/PandemicYoyo.cs +++ b/Projectiles/Melee/Yoyos/PandemicYoyo.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Pandemic"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 340f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 450f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16.5f; } @@ -26,11 +26,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; 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.5); + 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) diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index 7590b46ef2..e95d79ae4e 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Quagmire"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 12f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 15f; } @@ -25,10 +25,14 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; 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 (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) @@ -36,24 +40,33 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; + 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; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } } 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, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 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); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceMelee = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } } 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, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; + 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; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } } } } diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index f7bd3cb52a..5c53857f7f 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Riptide"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 7.5f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 180f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 220f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 12.5f; } @@ -24,11 +24,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; projectile.alpha = 150; projectile.penetrate = -1; - } + projectile.MaxUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } public override void AI() { - if (Main.rand.Next(1, 51) == 1) + 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)) { diff --git a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs index ce4cf322c3..bd4b4337bb 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkYoyo.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Shimmerspark"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 16f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 350f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; } @@ -25,11 +25,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - } + projectile.MaxUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 40f, 5, ProjectileID.HallowStar); + 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) diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index cf20c22e6d..4d2d4464ff 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; projectile.penetrate = -1; projectile.MaxUpdates = 2; - projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } @@ -40,6 +39,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { 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(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -47,14 +48,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(ModContent.BuffType(), 300); if (projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceMelee = true; + 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; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f65e00c965..4ea86694f0 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Sulphurous Grabber Yoyo"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 300f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 350f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 16f; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; @@ -35,7 +35,9 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } public override void AI() { @@ -60,14 +62,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (bubbleStronkCounter >= 240) bubbleStronk = false; - Rectangle rectangle = new Rectangle((int)((double)projectile.position.X + (double)projectile.velocity.X * 0.5 - 4.0), (int)((double)projectile.position.Y + (double)projectile.velocity.Y * 0.5 - 4.0), projectile.width + 8, projectile.height + 8); 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) { - Rectangle rect = proj.getRect(); - if (rectangle.Intersects(rect)) + if (projectile.Hitbox.Intersects(proj.Hitbox)) { proj.Kill(); bubbleStronk = true; @@ -82,18 +82,21 @@ namespace CalamityMod.Projectiles.Melee.Yoyos bubbleCounter++; if (bubbleCounter >= 60) { - int bubbleAmt = 9; + int bubbleAmt = 7; for (float i = 0; i < bubbleAmt; i++) { int projType = ModContent.ProjectileType(); 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 / 5, projectile.knockBack / 5, projectile.owner, 0f, 0f); + 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(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -103,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (bubbleStronk) { tex = ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex); + 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 2f3f26c346..758b45ac1c 100644 --- a/Projectiles/Melee/Yoyos/VerdantYoyo.cs +++ b/Projectiles/Melee/Yoyos/VerdantYoyo.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Verdant"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 400; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 560f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; @@ -28,8 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - - projectile.usesLocalNPCImmunity = true; + projectile.MaxUpdates = 2; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 9; } @@ -40,12 +40,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos 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); - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 18f, 5, ProjectileID.CrystalLeafShot, 0.6); + 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(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 980ccd323b..a6cb99b6ae 100644 --- a/Projectiles/Melee/Yoyos/YinYoyo.cs +++ b/Projectiles/Melee/Yoyos/YinYoyo.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { DisplayName.SetDefault("Yin-Yo"); ProjectileID.Sets.YoyosLifeTimeMultiplier[projectile.type] = 14f; - ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 275f; + ProjectileID.Sets.YoyosMaximumRange[projectile.type] = 350f; ProjectileID.Sets.YoyosTopSpeed[projectile.type] = 17f; } @@ -25,11 +25,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; - } + projectile.MaxUpdates = 2; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 20; + } public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 0f, 48f, 5, (Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType())); + 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) diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 56c2768446..6e4678b4a3 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -241,8 +241,12 @@ namespace CalamityMod.Projectiles.Pets } player.immune = false; player.immuneTime = 0; + for (int j = 0; j < player.hurtCooldowns.Length; j++) + { + player.hurtCooldowns[j] = player.immuneTime; + } - if (Main.netMode != NetmodeID.MultiplayerClient) + if (Main.netMode != NetmodeID.MultiplayerClient) SpawnDoggo(); } projectile.netUpdate = true; diff --git a/Projectiles/Pets/LittleLightProj.cs b/Projectiles/Pets/LittleLightProj.cs new file mode 100644 index 0000000000..93ce8385ea --- /dev/null +++ b/Projectiles/Pets/LittleLightProj.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class LittleLightProj : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + + public Color LightColor => new Color(160, 251, 255); + 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; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 24; + projectile.friendly = true; + projectile.netImportant = true; + projectile.penetrate = -1; + } + + public override void AI() + { + if (VerifyOwnerIsPresent()) + return; + + HandleFrames(); + DoSpinEffect(); + HoverTowardsOwnersShoulder(); + + // Look in the same direction as the projectile's owner. + 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); + + Time++; + } + + public bool VerifyOwnerIsPresent() + { + // No logic should be run if the player is no longer active in the game. + if (!Owner.active) + { + projectile.Kill(); + return true; + } + + if (Owner.dead) + Owner.Calamity().littleLightPet = false; + if (Owner.Calamity().littleLightPet) + projectile.timeLeft = 2; + + return false; + } + + public void HandleFrames() + { + 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; + else + projectile.rotation = 0f; + } + + public void HoverTowardsOwnersShoulder() + { + Vector2 destination = Owner.Top; + destination.X -= Owner.direction * Owner.width * 1.25f; + destination.Y += Owner.height * 0.25f; + + // 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; + else + projectile.Center += projectile.SafeDirectionTo(destination) * 4f; + + projectile.Center = destination; + } + } +} diff --git a/Projectiles/Pets/LittleLightProj.png b/Projectiles/Pets/LittleLightProj.png new file mode 100644 index 0000000000..d079096803 Binary files /dev/null and b/Projectiles/Pets/LittleLightProj.png differ diff --git a/Projectiles/Pets/RotomHeat.png b/Projectiles/Pets/RotomHeat.png index 0e74de03de..388dfed618 100644 Binary files a/Projectiles/Pets/RotomHeat.png and b/Projectiles/Pets/RotomHeat.png differ diff --git a/Projectiles/Pets/RotomHeatGlow.png b/Projectiles/Pets/RotomHeatGlow.png index c17a7f06a3..618304848e 100644 Binary files a/Projectiles/Pets/RotomHeatGlow.png and b/Projectiles/Pets/RotomHeatGlow.png differ diff --git a/Projectiles/Pets/SCalPet.cs b/Projectiles/Pets/SCalPet.cs index 20b29b0c08..52a12fd38f 100644 --- a/Projectiles/Pets/SCalPet.cs +++ b/Projectiles/Pets/SCalPet.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets @@ -8,7 +9,7 @@ namespace CalamityMod.Projectiles.Pets public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 6; Main.projPet[projectile.type] = true; } @@ -40,16 +41,13 @@ namespace CalamityMod.Projectiles.Pets projectile.timeLeft = 2; } projectile.FloatingPetAI(false, 0.05f); + projectile.rotation -= projectile.spriteDirection * MathHelper.PiOver2; projectile.frameCounter++; if (projectile.frameCounter > 6) { - projectile.frame++; + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; projectile.frameCounter = 0; } - if (projectile.frame >= 4) - { - projectile.frame = 0; - } } } } diff --git a/Projectiles/Pets/SCalPet.png b/Projectiles/Pets/SCalPet.png index 418e48c9d1..b5c0fc9f56 100644 Binary files a/Projectiles/Pets/SCalPet.png and b/Projectiles/Pets/SCalPet.png differ diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 1bf9d1fcda..e8ed17c7d0 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Pets projectile.frame = sleepy ? 16 : 8; } } - underwater = player.IsUnderwater() || modPlayer.leviathanAndSirenLore; + underwater = player.IsUnderwater(); if (underwater) { if (projectile.frame == 16) diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index 6f24ad444f..bb2cc8786b 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Ranged { public class AMR2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("AMR"); @@ -25,6 +27,6 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; - } + } } } diff --git a/Projectiles/Ranged/AMR2.png b/Projectiles/Ranged/AMR2.png deleted file mode 100644 index 3f761a0306..0000000000 Binary files a/Projectiles/Ranged/AMR2.png and /dev/null differ diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index 20d54744a4..7949bc4aa9 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -25,13 +25,31 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.ignoreWater = true; - projectile.aiStyle = 1; - aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } - public override bool OnTileCollide(Vector2 oldVelocity) + 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; + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha < 140) + return new Color(255, 255, 255, 100); + + return Color.Transparent; + } + + 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); @@ -41,28 +59,33 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { OnHitEffects(target.Center, crit); + target.AddBuff(ModContent.BuffType(), 600); - if (target.defense > 50) - { - target.defense -= 50; - } + + target.Calamity().miscDefenseLoss = 25; } public override void OnHitPvp(Player target, int damage, bool crit) { OnHitEffects(target.Center, crit); + target.AddBuff(ModContent.BuffType(), 600); } private void OnHitEffects(Vector2 targetPos, bool crit) { - if (crit) + bool skullmasher = projectile.ai[1] == 1f; + if (crit || skullmasher) { - for (int x = 0; x < 8; x++) + int extraProjectileAmt = skullmasher ? 4 : 8; + for (int x = 0; x < extraProjectileAmt; x++) { - if (projectile.owner == Main.myPlayer) - { - CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, x > 4, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); + if (projectile.owner == Main.myPlayer) + { + bool fromRight = skullmasher ? x > 1 : 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); + if (skullmasher) + CalamityUtils.ProjectileBarrage(projectile.Center, targetPos, fromRight, 1000f, 1000f, 0f, 1000f, 12f, (int)projectile.ai[0], (int)(projectile.damage * 0.1), projectile.knockBack * 0.1f, projectile.owner); } } } diff --git a/Projectiles/Ranged/AccelerationBulletProj.cs b/Projectiles/Ranged/AccelerationBulletProj.cs index f9b5f0f118..291f488c2d 100644 --- a/Projectiles/Ranged/AccelerationBulletProj.cs +++ b/Projectiles/Ranged/AccelerationBulletProj.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Acceleration Bullet"); + DisplayName.SetDefault("Acceleration Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -26,18 +26,30 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { projectile.velocity *= 1.01f; - 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; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + if (projectile.velocity.Length() >= 12f) + { + projectile.velocity *= 0.5f; + projectile.extraUpdates++; + projectile.netUpdate = true; + } + + 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; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -49,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, null, false); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/AcidBulletProj.cs b/Projectiles/Ranged/AcidBulletProj.cs index ed00aa6163..c4e4e71fa7 100644 --- a/Projectiles/Ranged/AcidBulletProj.cs +++ b/Projectiles/Ranged/AcidBulletProj.cs @@ -11,15 +11,15 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Acid Bullet"); + DisplayName.SetDefault("Acid Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -27,18 +27,24 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - 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; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); + + 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; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -50,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/AngelicBeam.cs b/Projectiles/Ranged/AngelicBeam.cs index 984b2882b4..2a423145ce 100644 --- a/Projectiles/Ranged/AngelicBeam.cs +++ b/Projectiles/Ranged/AngelicBeam.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Ranged { public class AngelicBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Angelic Beam"); @@ -26,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 10; + projectile.idStaticNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Ranged/AngelicBeam.png b/Projectiles/Ranged/AngelicBeam.png deleted file mode 100644 index ef1edb7c71..0000000000 Binary files a/Projectiles/Ranged/AngelicBeam.png and /dev/null differ diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index a4f44dbede..60812d6a9a 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -20,7 +20,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.ranged = true; - } + projectile.extraUpdates = 1; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/AquaBlastToxic.cs b/Projectiles/Ranged/AquaBlastToxic.cs index 149e8918c0..0205a1e62e 100644 --- a/Projectiles/Ranged/AquaBlastToxic.cs +++ b/Projectiles/Ranged/AquaBlastToxic.cs @@ -22,7 +22,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.ranged = true; - } + projectile.extraUpdates = 1; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 0b9f8b7705..0901bbb88b 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 300; projectile.aiStyle = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged 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.5), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner); } } } diff --git a/Projectiles/Ranged/AquashardSplit.cs b/Projectiles/Ranged/AquashardSplit.cs index eb902bbc6f..9b0f5db1f6 100644 --- a/Projectiles/Ranged/AquashardSplit.cs +++ b/Projectiles/Ranged/AquashardSplit.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class AquashardSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/Aquashard"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aquashard"); @@ -17,16 +19,21 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 16; projectile.friendly = true; projectile.ranged = true; - projectile.penetrate = 3; + projectile.penetrate = 1; projectile.timeLeft = 180; projectile.aiStyle = 1; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } + projectile.velocity.Y += 0.01f; + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Ranged/AquashardSplit.png b/Projectiles/Ranged/AquashardSplit.png deleted file mode 100644 index 0e32025173..0000000000 Binary files a/Projectiles/Ranged/AquashardSplit.png and /dev/null differ diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index 0ac9a6562b..288fc83ba5 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ArcherfishShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Water Round"); @@ -24,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; projectile.timeLeft = 600; projectile.extraUpdates = 2; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/ArcherfishShot.png b/Projectiles/Ranged/ArcherfishShot.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Ranged/ArcherfishShot.png and /dev/null differ diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs index ff3cf364b6..f4b013e427 100644 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ b/Projectiles/Ranged/ArcticArrowProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ArcticArrowProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/ArcticArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arctic Arrow"); @@ -25,7 +27,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.aiStyle = 1; projectile.coldDamage = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -66,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Ranged/ArcticArrowProj.png b/Projectiles/Ranged/ArcticArrowProj.png deleted file mode 100644 index 5fcacaa5de..0000000000 Binary files a/Projectiles/Ranged/ArcticArrowProj.png and /dev/null differ diff --git a/Projectiles/Ranged/AstralCannonProjectile.cs b/Projectiles/Ranged/AstralCannonProjectile.cs index d28d1a4f7b..a088f395b2 100644 --- a/Projectiles/Ranged/AstralCannonProjectile.cs +++ b/Projectiles/Ranged/AstralCannonProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Ranged { public class AstralCannonProjectile : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/AstralFlame"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Crystal"); @@ -68,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/AstralCannonProjectile.png b/Projectiles/Ranged/AstralCannonProjectile.png deleted file mode 100644 index d88ac5666a..0000000000 Binary files a/Projectiles/Ranged/AstralCannonProjectile.png and /dev/null differ diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index a43f9b7e03..431920b962 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,17 +19,18 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + 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 = 1; + projectile.extraUpdates = 2; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -49,22 +49,28 @@ namespace CalamityMod.Projectiles.Ranged { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); projectile.spriteDirection = projectile.direction; - if (Main.rand.NextBool(2)) - { - int randomDust = Utils.SelectRandom(Main.rand, new int[] + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool(2)) { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { 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; - Main.dust[astral].velocity *= 0f; - Main.dust[astral].noGravity = true; - } + }); + 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(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 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 53fc80c00b..805cab0fe6 100644 --- a/Projectiles/Ranged/AstralSandgun.cs +++ b/Projectiles/Ranged/AstralSandgun.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = -1; base.SetDefaults(); - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index 319409a80d..9fa02fadee 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -21,13 +21,15 @@ namespace CalamityMod.Projectiles.Ranged projectile.width = 18; projectile.height = 18; projectile.alpha = 255; - projectile.friendly = true; + 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; + } public override void AI() { @@ -80,8 +82,8 @@ 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); - projectile.ai[1] += (float)Main.rand.Next(3) + 1f; - if (projectile.ai[1] >= 180f) + projectile.ai[1] += Main.rand.Next(2) + 1; + if (projectile.ai[1] >= 135f) { projectile.ai[1] = 0f; projectile.netUpdate = true; @@ -94,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/AstrealFlame.cs b/Projectiles/Ranged/AstrealFlame.cs index c7a050c153..0bbca59048 100644 --- a/Projectiles/Ranged/AstrealFlame.cs +++ b/Projectiles/Ranged/AstrealFlame.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class AstrealFlame : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Healing/EssenceFlame"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); @@ -24,9 +26,12 @@ namespace CalamityMod.Projectiles.Ranged projectile.alpha = 255; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.alpha -= 5; + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -34,10 +39,10 @@ namespace CalamityMod.Projectiles.Ranged projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 16f, 20f); + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/AstrealFlame.png b/Projectiles/Ranged/AstrealFlame.png deleted file mode 100644 index 3009ead213..0000000000 Binary files a/Projectiles/Ranged/AstrealFlame.png and /dev/null differ diff --git a/Projectiles/Ranged/AuralisBullet.cs b/Projectiles/Ranged/AuralisBullet.cs new file mode 100644 index 0000000000..07e1a2c33f --- /dev/null +++ b/Projectiles/Ranged/AuralisBullet.cs @@ -0,0 +1,67 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class AuralisBullet : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bullet"); + } + + 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; + } + + public override void AI() + { + 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.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * d; + dust.noGravity = true; + dust.scale = 0.65f; + dust.noLight = true; + dust.color = CalamityUtils.ColorSwap(Auralis.blueColor, Auralis.greenColor, 1f); + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int duration = 600; + target.AddBuff(ModContent.BuffType(), duration); + target.AddBuff(BuffID.Ichor, duration); + target.AddBuff(BuffID.CursedInferno, duration); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + int duration = 600; + target.AddBuff(ModContent.BuffType(), duration); + target.AddBuff(BuffID.Ichor, duration); + target.AddBuff(BuffID.CursedInferno, duration); + } + } +} diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index e664972be9..3302549d2b 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class AuroraFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const int framesBeforeTurning = 70; private bool initialized = false; private int radianAmt = 0; diff --git a/Projectiles/Ranged/AuroraFire.png b/Projectiles/Ranged/AuroraFire.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Ranged/AuroraFire.png and /dev/null differ diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index f68b286d64..d1e0043fa1 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 2; projectile.aiStyle = 1; aiType = ProjectileID.WoodenArrowFriendly; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -48,21 +49,20 @@ namespace CalamityMod.Projectiles.Ranged 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) { - for (i = 0; i < 3; i++) + 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)((double)projectile.damage * 0.2f), 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)((double)projectile.damage * 0.2f), 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) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 715177685a..9807488816 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -63,22 +63,7 @@ namespace CalamityMod.Projectiles.Ranged 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; } - projectile.ai[0] += 1f; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - 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 = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -90,10 +75,7 @@ namespace CalamityMod.Projectiles.Ranged 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -115,9 +97,12 @@ namespace CalamityMod.Projectiles.Ranged value20 -= value21 * (float)num517; num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; - int num520 = 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, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; + 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; + Main.projectile[bee].Calamity().forceRanged = true; + } } } } diff --git a/Projectiles/Ranged/BeeRPG.png b/Projectiles/Ranged/BeeRPG.png index 4a173a9e96..8caad050aa 100644 Binary files a/Projectiles/Ranged/BeeRPG.png and b/Projectiles/Ranged/BeeRPG.png differ diff --git a/Projectiles/Ranged/BigCoral.cs b/Projectiles/Ranged/BigCoral.cs index 9248c8631e..44f34218f5 100644 --- a/Projectiles/Ranged/BigCoral.cs +++ b/Projectiles/Ranged/BigCoral.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -51,12 +52,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } } } diff --git a/Projectiles/Ranged/BigNuke.cs b/Projectiles/Ranged/BigNuke.cs index ded24101f6..b8e1367877 100644 --- a/Projectiles/Ranged/BigNuke.cs +++ b/Projectiles/Ranged/BigNuke.cs @@ -1,5 +1,4 @@ using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -11,12 +10,12 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Big Nuke"); + Main.projFrames[projectile.type] = 4; } public override void SetDefaults() { - projectile.width = 14; - projectile.height = 14; + projectile.width = projectile.height = 16; projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 95; @@ -25,8 +24,27 @@ namespace CalamityMod.Projectiles.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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + if (projectile.ai[0] == 0f) + { + Main.PlaySound(SoundID.Item11, (int)projectile.Center.X, (int)projectile.Center.Y); + projectile.ai[0] = 1f; + } + + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 7) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + if (projectile.velocity.Length() >= 8f) { for (int num246 = 0; num246 < 2; num246++) { @@ -46,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num249].velocity *= 0.05f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -58,15 +76,11 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 720; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 720); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; projectile.Damage(); Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); for (int num621 = 0; num621 < 90; num621++) diff --git a/Projectiles/Ranged/BigNuke.png b/Projectiles/Ranged/BigNuke.png index b6fbd0efbb..0d505af3d7 100644 Binary files a/Projectiles/Ranged/BigNuke.png and b/Projectiles/Ranged/BigNuke.png differ diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index e70ae09c9a..87a203e222 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class BloodBoilerFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private bool playedSound = false; public override void SetStaticDefaults() @@ -20,14 +22,15 @@ namespace CalamityMod.Projectiles.Ranged { 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 = 10; - projectile.timeLeft = 240; + projectile.idStaticNPCHitCooldown = 5; + projectile.timeLeft = 300; } public override void AI() @@ -38,11 +41,11 @@ namespace CalamityMod.Projectiles.Ranged playedSound = true; } - if (projectile.scale <= 1.5f) - { + if (projectile.scale <= 3f) projectile.scale *= 1.01f; - } + Lighting.AddLight(projectile.Center, 1f, 0f, 0f); + if (projectile.ai[0] > 7f) { float num296 = 1f; @@ -96,8 +99,11 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.timeLeft == 160) projectile.ai[1] = 1f; + if (projectile.ai[1] == 1f) { + projectile.tileCollide = false; + projectile.extraUpdates = 2; Player player = Main.player[projectile.owner]; @@ -140,17 +146,19 @@ namespace CalamityMod.Projectiles.Ranged 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 (projectile.Hitbox.Intersects(player.Hitbox)) + // Delete the projectile if it touches its owner. Has a chance to heal the player again + if (Main.myPlayer == projectile.owner) + { + if (projectile.Hitbox.Intersects(player.Hitbox)) { if (Main.rand.NextBool(3) && !Main.player[projectile.owner].moonLeech) { player.statLife += 1; player.HealEffect(1); } - projectile.Kill(); + projectile.Kill(); } + } } } @@ -158,14 +166,14 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 360); target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) - { + + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; - } + Player player = Main.player[projectile.owner]; if (Main.rand.NextBool(2)) { - int healAmt = Main.rand.Next(1,4); + int healAmt = Main.rand.Next(1, 4); player.statLife += healAmt; player.HealEffect(healAmt); } diff --git a/Projectiles/Ranged/BloodBoilerFire.png b/Projectiles/Ranged/BloodBoilerFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/BloodBoilerFire.png and /dev/null differ diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index bc7f625118..40dd3cd2d4 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,18 +11,21 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Clot"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -31,10 +35,23 @@ namespace CalamityMod.Projectiles.Ranged 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, 5, dspeed.X, dspeed.Y, 100, default, 2f); + int num469 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 5, dspeed.X, dspeed.Y, 100, default, 2f); Main.dust[num469].noGravity = true; } } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color 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); + return true; + } + } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 12ac42b282..e5048e45b6 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Ranged { public class BloodfireArrowProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/BloodfireArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodfire Arrow"); @@ -28,7 +30,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 300; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override bool OnTileCollide(Vector2 oldVelocity) { @@ -40,6 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - MathHelper.ToRadians(90); + if (projectile.timeLeft % 15 == 0) { for (int l = 0; l < 12; l++) @@ -55,10 +59,9 @@ namespace CalamityMod.Projectiles.Ranged 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, false, 400f, 20f, 20f); - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) @@ -84,16 +87,16 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) - { + + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; - } + Player player = Main.player[projectile.owner]; + int chance = 3; if (player.ActiveItem().type == ModContent.ItemType()) - { chance = 6; - } + if (Main.rand.NextBool(chance)) { player.statLife += 1; @@ -103,7 +106,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/BloodfireArrowProj.png b/Projectiles/Ranged/BloodfireArrowProj.png deleted file mode 100644 index 495f11392e..0000000000 Binary files a/Projectiles/Ranged/BloodfireArrowProj.png and /dev/null differ diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs new file mode 100644 index 0000000000..868cd23a15 --- /dev/null +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -0,0 +1,100 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class BloodfireBulletProj : ModProjectile + { + private const int Lifetime = 600; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bloodfire Bullet"); + 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; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + projectile.spriteDirection = projectile.direction; + + // Lighting + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0.15f); + + // Dust + 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; + d.position += posOffset - 2f * Vector2.UnitY; + d.noGravity = true; + d.velocity *= 0.6f; + d.velocity += projectile.velocity * 0.15f; + d.scale = scale; + } + } + + // These bullets glow in the dark. + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 140); + + public override bool PreDraw(SpriteBatch spriteBatch, Color 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]); + + // Returns the amount of bonus damage that should be dealt. Boosts life regeneration appropriately as a side effect. + private int OnHitEffect(Player owner) + { + // Adds 2 frames to lifeRegenTime on every hit. This increased value is used for the damage calculation. + owner.lifeRegenTime += 2; + + // Deals (1.00 + (0.05 * current lifeRegen))% of current lifeRegenTime as flat bonus damage on hit. + // For example, at 0 life regen, you get 1% of lifeRegenTime as bonus damage. + // At 10 life regen, you get 2%. At 20 life regen, you get 3%. + // Negative life regen does not decrease damage. + int regenForCalc = owner.lifeRegen > 0 ? owner.lifeRegen : 0; + float regenDamageRatio = 0.01f + 0.0005f * regenForCalc; + + // For the sake of bonus damage, life regen time caps at 3600, aka 60 seconds. This is its natural cap in vanilla. + int regenTimeForCalc = (int)MathHelper.Clamp(owner.lifeRegenTime, 0f, 3600f); + return (int)(regenDamageRatio * regenTimeForCalc); + } + + public override void Kill(int timeLeft) + { + int dustID = 90; + int dustCount = 3; + for(int i = 0; i < dustCount; ++i) + _ = 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); + return true; + } + } +} diff --git a/Projectiles/Ranged/BloodfireBulletProj.png b/Projectiles/Ranged/BloodfireBulletProj.png new file mode 100644 index 0000000000..c32c594b12 Binary files /dev/null and b/Projectiles/Ranged/BloodfireBulletProj.png differ diff --git a/Projectiles/Ranged/BloodflareSoul.cs b/Projectiles/Ranged/BloodflareSoul.cs index c205f99349..ea6c1e587a 100644 --- a/Projectiles/Ranged/BloodflareSoul.cs +++ b/Projectiles/Ranged/BloodflareSoul.cs @@ -58,15 +58,11 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 400f, 11f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 11f, 20f); } else { @@ -79,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/BlueExoArrow.cs b/Projectiles/Ranged/BlueExoArrow.cs index af1e56c89d..73d739d372 100644 --- a/Projectiles/Ranged/BlueExoArrow.cs +++ b/Projectiles/Ranged/BlueExoArrow.cs @@ -1,18 +1,16 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class BlueExoArrow : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Arrow"); + DisplayName.SetDefault("Blue Exo Arrow"); } public override void SetDefaults() @@ -22,10 +20,11 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; projectile.timeLeft = 300; projectile.ranged = true; projectile.arrow = true; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() @@ -58,64 +57,30 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); public override void OnHitPvp(Player target, int damage, bool crit) { - target.ExoDebuffs(); - OnHitEffects(target.Center); + target.ExoDebuffs(); + OnHitEffects(target.Center); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.ExoDebuffs(); - OnHitEffects(target.Center); + target.ExoDebuffs(); + OnHitEffects(target.Center); } - private void OnHitEffects(Vector2 targetPos) - { + private void OnHitEffects(Vector2 targetPos) + { for (int x = 0; x < 3; x++) { - 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); - } + 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); + } } } } diff --git a/Projectiles/Ranged/BlueExoArrow.png b/Projectiles/Ranged/BlueExoArrow.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/BlueExoArrow.png and /dev/null differ diff --git a/Projectiles/Ranged/BlueExoArrow2.cs b/Projectiles/Ranged/BlueExoArrow2.cs index 9a21c15e2b..5ccbb9dda2 100644 --- a/Projectiles/Ranged/BlueExoArrow2.cs +++ b/Projectiles/Ranged/BlueExoArrow2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class BlueExoArrow2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -55,42 +57,8 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); } } diff --git a/Projectiles/Ranged/BlueExoArrow2.png b/Projectiles/Ranged/BlueExoArrow2.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/BlueExoArrow2.png and /dev/null differ diff --git a/Projectiles/Ranged/Bolt.cs b/Projectiles/Ranged/Bolt.cs index cbe59afe1f..8631a4343a 100644 --- a/Projectiles/Ranged/Bolt.cs +++ b/Projectiles/Ranged/Bolt.cs @@ -31,9 +31,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.65f); - projectile.velocity.X *= 1.015f; - projectile.velocity.Y *= 1.015f; + projectile.velocity *= 1.015f; projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (projectile.timeLeft % 30 == 0) { @@ -65,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index 6021c400d3..7e078b4130 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 180; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/BouncingShotgunPellet.cs b/Projectiles/Ranged/BouncingShotgunPellet.cs new file mode 100644 index 0000000000..a7228035d5 --- /dev/null +++ b/Projectiles/Ranged/BouncingShotgunPellet.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class BouncingShotgunPellet : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Ranged/RealmRavagerBullet"; + private int bounce = 2; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shotgun Pellet"); + } + + 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; + aiType = ProjectileID.BulletHighVelocity; + projectile.timeLeft = 180; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + bounce--; + if (bounce <= 0) + 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; + } + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => Main.PlaySound(SoundID.Item10, projectile.Center); + + public override void OnHitPvp(Player target, int damage, bool crit) => Main.PlaySound(SoundID.Item10, projectile.Center); + + public override void Kill(int timeLeft) + { + 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); + } + 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); + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; + } + } + } +} diff --git a/Projectiles/Ranged/BrimstoneBallFriendly.cs b/Projectiles/Ranged/BrimstoneBallFriendly.cs index 0f2aa04a00..34b2218740 100644 --- a/Projectiles/Ranged/BrimstoneBallFriendly.cs +++ b/Projectiles/Ranged/BrimstoneBallFriendly.cs @@ -47,7 +47,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index 50ae2bfcd4..91a19aac79 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class BrimstoneBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -25,6 +27,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.extraUpdates = 2; projectile.timeLeft = 300; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() diff --git a/Projectiles/Ranged/BrimstoneBolt.png b/Projectiles/Ranged/BrimstoneBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Ranged/BrimstoneBolt.png and /dev/null differ diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.cs b/Projectiles/Ranged/BrimstoneFireFriendly.cs index 20a0fe97a5..b19fdf28ea 100644 --- a/Projectiles/Ranged/BrimstoneFireFriendly.cs +++ b/Projectiles/Ranged/BrimstoneFireFriendly.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class BrimstoneFireFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Ranged/BrimstoneFireFriendly.png b/Projectiles/Ranged/BrimstoneFireFriendly.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/BrimstoneFireFriendly.png and /dev/null differ diff --git a/Projectiles/Ranged/ButcherGun.cs b/Projectiles/Ranged/ButcherGun.cs index 47036152cd..0d4147c176 100644 --- a/Projectiles/Ranged/ButcherGun.cs +++ b/Projectiles/Ranged/ButcherGun.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ButcherGun : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Butcher"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Butcher"); @@ -102,7 +104,7 @@ namespace CalamityMod.Projectiles.Ranged float kback = player.ActiveItem().knockBack; if (canShoot) { - player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback, false); + player.PickAmmo(player.ActiveItem(), ref projType, ref speedMult, ref canShoot, ref damage, ref kback); kback = player.GetWeaponKnockback(player.ActiveItem(), kback); float speed = player.ActiveItem().shootSpeed * projectile.scale; Vector2 targetPos = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; diff --git a/Projectiles/Ranged/ButcherGun.png b/Projectiles/Ranged/ButcherGun.png deleted file mode 100644 index 3b6458a45f..0000000000 Binary files a/Projectiles/Ranged/ButcherGun.png and /dev/null differ diff --git a/Projectiles/Ranged/CardClub.cs b/Projectiles/Ranged/CardClub.cs index 16d290ec60..329ce76e73 100644 --- a/Projectiles/Ranged/CardClub.cs +++ b/Projectiles/Ranged/CardClub.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 8f4101d481..02b0c1a33d 100644 --- a/Projectiles/Ranged/CardClubSplit.cs +++ b/Projectiles/Ranged/CardClubSplit.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.alpha < 128) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index ccc514c942..9ca318bdf7 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 029f25bf8c..6e043d43f2 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -60,18 +60,18 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); + Player player = Main.player[projectile.owner]; - if (target.type == NPCID.TargetDummy || player.moonLeech) - { + if (player.moonLeech) return; - } + player.statLife += 1; player.HealEffect(1); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 ccca476878..f35433e32a 100644 --- a/Projectiles/Ranged/CardSpade.cs +++ b/Projectiles/Ranged/CardSpade.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; aiType = ProjectileID.Bullet; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 8; } public override void AI() @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 ac3663da55..8585178a6d 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 3; projectile.alpha = 255; projectile.timeLeft = 600; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -56,43 +59,9 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); public override void Kill(int timeLeft) { diff --git a/Projectiles/Ranged/ChargedBlast.png b/Projectiles/Ranged/ChargedBlast.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/ChargedBlast.png and /dev/null differ diff --git a/Projectiles/Ranged/ChargedBlast2.cs b/Projectiles/Ranged/ChargedBlast2.cs index 21c98913f5..6a57cc9aba 100644 --- a/Projectiles/Ranged/ChargedBlast2.cs +++ b/Projectiles/Ranged/ChargedBlast2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); @@ -56,43 +58,9 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 1f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { @@ -104,7 +72,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/ChargedBlast2.png b/Projectiles/Ranged/ChargedBlast2.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/ChargedBlast2.png and /dev/null differ diff --git a/Projectiles/Ranged/ChargedBlast3.cs b/Projectiles/Ranged/ChargedBlast3.cs index 6640730753..74048584fd 100644 --- a/Projectiles/Ranged/ChargedBlast3.cs +++ b/Projectiles/Ranged/ChargedBlast3.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ChargedBlast3 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 3; projectile.alpha = 255; projectile.timeLeft = 300; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -55,43 +58,9 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(100, 100, 255, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(100, 100, 255, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 50f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); public override bool OnTileCollide(Vector2 oldVelocity) { @@ -104,7 +73,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/ChargedBlast3.png b/Projectiles/Ranged/ChargedBlast3.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/ChargedBlast3.png and /dev/null differ diff --git a/Projectiles/Ranged/ChargedDartExplosion.cs b/Projectiles/Ranged/ChargedDartExplosion.cs index 93679bae86..ae80cd988f 100644 --- a/Projectiles/Ranged/ChargedDartExplosion.cs +++ b/Projectiles/Ranged/ChargedDartExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ChargedDartExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Ranged/ChargedDartExplosion.png b/Projectiles/Ranged/ChargedDartExplosion.png deleted file mode 100644 index 80da916522..0000000000 Binary files a/Projectiles/Ranged/ChargedDartExplosion.png and /dev/null differ diff --git a/Projectiles/Ranged/Chicken.cs b/Projectiles/Ranged/Chicken.cs deleted file mode 100644 index c5d4f7e83f..0000000000 --- a/Projectiles/Ranged/Chicken.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class Chicken : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Chicken"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.aiStyle = 1; - projectile.ranged = true; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - 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); - 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); - 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) - { - projectile.velocity *= 1.1f; - } - else if (Main.rand.NextBool(2)) - { - int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 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.rand.Next(2); - num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; - } - } - projectile.ai[0] += 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -15f; - projectile.timeLeft = 20; - return false; - } - - 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.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } - Main.PlaySound(SoundID.Item14, (int)projectile.Center.X, (int)projectile.Center.Y); - for (int num621 = 0; num621 < 40; num621++) - { - int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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, 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); - Main.dust[num624].velocity *= 2f; - } - } - - - } -} diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 3d56f27e51..a1ea46359f 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -3,13 +3,16 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class ChickenExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Explosion"); + DisplayName.SetDefault("Kentucky Fried Explosion"); } public override void SetDefaults() @@ -23,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 150; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 15; } public override void AI() @@ -34,62 +37,42 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item20, (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]) + + EmitDust(); + } + + public void EmitDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 70; i++) { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-120, 121); - float num464 = (float)Main.rand.Next(-120, 121); - float num465 = (float)Main.rand.Next(36, 108); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - 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, 2.5f); - Main.dust[num467].noGravity = true; - 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]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); - Main.dust[num467].velocity.X = num463; - Main.dust[num467].velocity.Y = num464; - num462++; + // 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; + + // 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())); + + // Fire variants. + int dustType = 6; + if (Main.rand.NextBool(4)) + dustType = 244; + + // Smoke. + if (Main.rand.NextBool(7)) + dustType = 31; + + 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); } } diff --git a/Projectiles/Ranged/ChickenExplosion.png b/Projectiles/Ranged/ChickenExplosion.png deleted file mode 100644 index f47e46f43d..0000000000 Binary files a/Projectiles/Ranged/ChickenExplosion.png and /dev/null differ diff --git a/Projectiles/Ranged/ChickenRocket.cs b/Projectiles/Ranged/ChickenRocket.cs new file mode 100644 index 0000000000..27fbee1ae4 --- /dev/null +++ b/Projectiles/Ranged/ChickenRocket.cs @@ -0,0 +1,133 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ChickenRocket : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Chicken Rocket"); + Main.projFrames[projectile.type] = 4; + } + + 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; + } + + public override void AI() + { + // Animation frames. + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + 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); + 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); + 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; + + // When going at very high speed, emit even more dust. + else if (Main.rand.NextBool()) + { + int d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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.rand.Next(2); + d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; + } + } + + 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; + } + + // 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; + + // If there isn't much time left anyway, just explode immediately on collision. + if (projectile.timeLeft > 20) + projectile.timeLeft = 20; + else + return true; + + return false; + } + + 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.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); + 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); + Main.dust[d].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[d].scale = 0.5f; + Main.dust[d].fadeIn = 1f + Main.rand.NextFloat(); + } + } + 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); + 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); + Main.dust[d].velocity *= 2f; + } + } + + + } +} diff --git a/Projectiles/Ranged/Chicken.png b/Projectiles/Ranged/ChickenRocket.png similarity index 100% rename from Projectiles/Ranged/Chicken.png rename to Projectiles/Ranged/ChickenRocket.png diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index 9b5430bd60..b144b352b2 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ignoreWater = true; projectile.penetrate = 1; projectile.ranged = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num155].velocity += projectile.velocity * 0.5f; } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 18f, 25f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 25f); } /*public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.cs b/Projectiles/Ranged/ClamorRifleProjSplit.cs index 7bae169458..1c6bd95dae 100644 --- a/Projectiles/Ranged/ClamorRifleProjSplit.cs +++ b/Projectiles/Ranged/ClamorRifleProjSplit.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ClamorRifleProjSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/ClamorRifleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Energy Bolt"); @@ -17,14 +19,19 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ignoreWater = true; projectile.scale = 0.9f; + projectile.timeLeft = 180; projectile.penetrate = 1; projectile.ranged = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.rotation += 0.15f; + Lighting.AddLight(projectile.Center, new Vector3(44, 191, 232) * (1.3f/255)); + for (int num151 = 0; num151 < 2; num151++) { int num154 = 14; @@ -33,7 +40,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num155].velocity *= 0.1f; Main.dust[num155].velocity += projectile.velocity * 0.5f; } - } + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 25f); + } /* override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Ranged/ClamorRifleProjSplit.png b/Projectiles/Ranged/ClamorRifleProjSplit.png deleted file mode 100644 index 1e19c6c77a..0000000000 Binary files a/Projectiles/Ranged/ClamorRifleProjSplit.png and /dev/null differ diff --git a/Projectiles/Ranged/BloodfireBullet.cs b/Projectiles/Ranged/ClaretCannonProj.cs similarity index 84% rename from Projectiles/Ranged/BloodfireBullet.cs rename to Projectiles/Ranged/ClaretCannonProj.cs index 43121ef10b..04acae19ad 100644 --- a/Projectiles/Ranged/BloodfireBullet.cs +++ b/Projectiles/Ranged/ClaretCannonProj.cs @@ -5,13 +5,14 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { - public class BloodfireBullet : ModProjectile + public class ClaretCannonProj : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bloodfire Bullet"); + DisplayName.SetDefault("Claret Cannon"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -28,7 +29,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -53,10 +55,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); - if (target.type == NPCID.TargetDummy || !target.canGhostHeal || Main.player[projectile.owner].moonLeech) - { + + if (!target.canGhostHeal || Main.player[projectile.owner].moonLeech) return; - } + Player player = Main.player[projectile.owner]; if (Main.rand.NextBool(2)) { @@ -67,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/BloodfireBullet.png b/Projectiles/Ranged/ClaretCannonProj.png similarity index 100% rename from Projectiles/Ranged/BloodfireBullet.png rename to Projectiles/Ranged/ClaretCannonProj.png diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs new file mode 100644 index 0000000000..9417892842 --- /dev/null +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CondemnationArrow : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Condemnation Arrow"); + 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; + } + + public override void AI() + { + 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. + if (Main.netMode != NetmodeID.MultiplayerClient && Time % 90f == 89f) + { + 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); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + + public override void Kill(int timeLeft) + { + // Release a burst of magic dust on death. + if (Main.dedServ) + return; + + 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; + + fire.noGravity = true; + fire.color = Color.Lerp(Color.White, Color.Purple, Main.rand.NextFloat()); + fire.scale = Main.rand.NextFloat(1f, 1.1f); + + fire = Dust.CloneDust(fire); + fire.velocity = Main.rand.NextVector2Circular(3f, 3f); + fire.velocity += projectile.velocity * 0.6f; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + } +} diff --git a/Projectiles/Ranged/CondemnationArrow.png b/Projectiles/Ranged/CondemnationArrow.png new file mode 100644 index 0000000000..3b2032bb20 Binary files /dev/null and b/Projectiles/Ranged/CondemnationArrow.png differ diff --git a/Projectiles/Ranged/CondemnationArrowHoming.cs b/Projectiles/Ranged/CondemnationArrowHoming.cs new file mode 100644 index 0000000000..14d7acf2b3 --- /dev/null +++ b/Projectiles/Ranged/CondemnationArrowHoming.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Condemnation Arrow"); + 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; + } + + 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); + + 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; + Time++; + } + + public override Color? GetAlpha(Color lightColor) + { + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + + public override void Kill(int timeLeft) + { + // Release a burst of magic dust on death. + if (Main.dedServ) + return; + + for (int i = 0; i < 10; i++) + { + 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); + fire.noGravity = true; + } + } + + 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 new file mode 100644 index 0000000000..1ac21ab858 --- /dev/null +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -0,0 +1,146 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class CondemnationHoldout : ModProjectile + { + public Player Owner => Main.player[projectile.owner]; + public bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + public ref float ChargeUpTime => ref projectile.ai[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; + } + + public override void AI() + { + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + + Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; + if (ChargeUpTime < 20f) + ReleaseInitialChargeDust(tipPosition); + if (ChargeUpTime == 20f) + ReleaseInitialBurstDust(tipPosition); + + // Release projectiles after done charging. + if (!OwnerCanShoot) + { + projectile.Kill(); + + // If killed prior to the charge being complete, don't bother spawning anything. Just die. + if (ChargeUpTime < 20f) + return; + + int totalProjectilesToShoot = (int)Math.Pow(ChargeUpTime * 0.15f, 0.71) + 1; + if (totalProjectilesToShoot > 32) + totalProjectilesToShoot = 32; + + for (int i = 0; i < totalProjectilesToShoot; i++) + ShootProjectiles(tipPosition, MathHelper.Lerp(0.425f, 1f, i / (float)totalProjectilesToShoot)); + + Main.PlaySound(SoundID.DD2_BallistaTowerShot); + } + + UpdateProjectileHeldVariables(armPosition); + ManipulatePlayerVariables(); + ChargeUpTime++; + } + + public void ReleaseInitialBurstDust(Vector2 tipPosition) + { + if (Main.dedServ) + return; + + for (int i = 0; i < 36; i++) + { + Dust chargeMagic = Dust.NewDustPerfect(tipPosition, 267); + chargeMagic.velocity = (MathHelper.TwoPi * i / 36f).ToRotationVector2() * 5f + Owner.velocity; + chargeMagic.scale = Main.rand.NextFloat(1f, 1.5f); + chargeMagic.color = Color.Violet; + chargeMagic.noGravity = true; + } + } + + public void ReleaseInitialChargeDust(Vector2 tipPosition) + { + if (Main.dedServ) + return; + + for (int i = 0; i < 2; i++) + { + 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.noGravity = true; + } + } + + public void ShootProjectiles(Vector2 tipPosition, float speedFactor) + { + if (Main.myPlayer != projectile.owner) + return; + + Item heldItem = Owner.ActiveItem(); + int projectileType = ModContent.ProjectileType(); + float shootSpeed = heldItem.shootSpeed * speedFactor * 1.5f; + int damage = (int)(Owner.GetWeaponDamage(heldItem) * 1.45); + float knockback = heldItem.knockBack; + + bool uselessFuckYou = OwnerCanShoot; + Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref damage, ref knockback, false); + projectileType = ModContent.ProjectileType(); + + knockback = Owner.GetWeaponKnockback(heldItem, knockback); + Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY) * shootSpeed; + + Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, damage, knockback, projectile.owner, 0f, 0f); + } + + public void UpdateProjectileHeldVariables(Vector2 armPosition) + { + 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) + { + 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; + } + + public void ManipulatePlayerVariables() + { + Owner.ChangeDir(projectile.direction); + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + 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 bdb059f307..63715891da 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.ranged = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -65,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ContagionBow.cs b/Projectiles/Ranged/ContagionBow.cs index 11aab62623..89ac2dd550 100644 --- a/Projectiles/Ranged/ContagionBow.cs +++ b/Projectiles/Ranged/ContagionBow.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; @@ -7,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ContagionBow : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Contagion"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Contagion"); @@ -14,8 +17,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 84; - projectile.height = 42; + projectile.width = 42; + projectile.height = 84; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; @@ -26,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Player player = Main.player[projectile.owner]; - float num = 1.57079637f; Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.type == ModContent.ProjectileType()) { @@ -68,13 +70,13 @@ namespace CalamityMod.Projectiles.Ranged projectile.soundDelay = num3 - num4 * num2; if (projectile.ai[0] != 1f) { - Main.PlaySound(SoundID.Item5, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Item5, projectile.Center); } } if (projectile.ai[1] == 1f && projectile.ai[0] != 1f) { Vector2 vector2 = Vector2.UnitX * 24f; - vector2 = vector2.RotatedBy((double)(projectile.rotation - 1.57079637f), default); + vector2 = vector2.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); Vector2 value = projectile.Center + vector2; for (int i = 0; i < 2; i++) { @@ -86,38 +88,38 @@ namespace CalamityMod.Projectiles.Ranged } if (flag && Main.myPlayer == projectile.owner) { - bool flag2 = player.channel && player.CheckMana(player.ActiveItem().mana, true, false) && !player.noItems && !player.CCed; + bool flag2 = player.channel && !player.noItems && !player.CCed; if (flag2) { - float scaleFactor = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 value2 = vector; - Vector2 value3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - value2; + 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) { - value3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - value2.Y; + direction.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - spawnPos.Y; } - Vector2 vector3 = Vector2.Normalize(value3); - if (float.IsNaN(vector3.X) || float.IsNaN(vector3.Y)) + Vector2 velocity = Vector2.Normalize(direction); + if (float.IsNaN(velocity.X) || float.IsNaN(velocity.Y)) { - vector3 = -Vector2.UnitY; + velocity = -Vector2.UnitY; } - vector3 *= scaleFactor; - if (vector3.X != projectile.velocity.X || vector3.Y != projectile.velocity.Y) + velocity *= speed; + if (velocity.X != projectile.velocity.X || velocity.Y != projectile.velocity.Y) { projectile.netUpdate = true; } - projectile.velocity = vector3; - int num6 = ModContent.ProjectileType(); - float scaleFactor2 = 14f; - int num7 = 7; - value2 = projectile.Center + new Vector2((float)Main.rand.Next(-num7, num7 + 1), (float)Main.rand.Next(-num7, num7 + 1)); - Vector2 spinningpoint = Vector2.Normalize(projectile.velocity) * scaleFactor2; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.098174773156642914, default); + 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; + 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(value2.X, value2.Y, spinningpoint.X, spinningpoint.Y, num6, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(spawnPos, spinningpoint, projType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } else { @@ -125,8 +127,11 @@ namespace CalamityMod.Projectiles.Ranged } } } - projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + 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); @@ -135,5 +140,9 @@ namespace CalamityMod.Projectiles.Ranged player.itemAnimation = 2; 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; } } diff --git a/Projectiles/Ranged/ContagionBow.png b/Projectiles/Ranged/ContagionBow.png deleted file mode 100644 index 070294c643..0000000000 Binary files a/Projectiles/Ranged/ContagionBow.png and /dev/null differ diff --git a/Projectiles/Ranged/CorossiveFlames.cs b/Projectiles/Ranged/CorossiveFlames.cs index 7537988e86..3fecaf98aa 100644 --- a/Projectiles/Ranged/CorossiveFlames.cs +++ b/Projectiles/Ranged/CorossiveFlames.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class CorossiveFlames : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flames"); @@ -26,10 +28,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, 0f, 0.25f, 0f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } if (projectile.ai[0] > 7f) { float num296 = 1f; diff --git a/Projectiles/Ranged/CorossiveFlames.png b/Projectiles/Ranged/CorossiveFlames.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/CorossiveFlames.png and /dev/null differ diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index b1609103d1..5d71414ead 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -22,12 +22,14 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.arrow = true; - projectile.penetrate = 6; + 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() { @@ -39,9 +41,12 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - int aura = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.15), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[aura].Calamity().forceRanged = true; - Main.projectile[aura].timeLeft = 40; + 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; + Main.projectile[aura].timeLeft = 40; + } } } } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index a55ec15ef8..756cfe71a6 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class CosmicFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -21,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = -1; projectile.extraUpdates = 3; - projectile.timeLeft = 90; + projectile.timeLeft = 100; } public override void AI() @@ -31,10 +33,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.scale *= 1.01f; } Lighting.AddLight(projectile.Center, 0.25f, 0f, 0.1f); - if (projectile.timeLeft > 90) - { - projectile.timeLeft = 90; - } if (projectile.ai[0] > 7f) { float scalar = 1f; diff --git a/Projectiles/Ranged/CosmicFire.png b/Projectiles/Ranged/CosmicFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/CosmicFire.png and /dev/null differ diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index fc8884b8f3..6bf19e4db3 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -24,9 +24,10 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 5; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 10; projectile.arrow = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -40,12 +41,6 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item12, (int)projectile.position.X, (int)projectile.position.Y); } - // Force damage type based on AI variable (this is outdated code and the weapons themselves should set the force variables) - if (projectile.ai[0] == 1f) - projectile.Calamity().forceMelee = true; - else if (projectile.ai[0] == 2f) - projectile.Calamity().forceRogue = true; - Lighting.AddLight(projectile.Center, 0.4f, 0.2f, 0.4f); for (int num121 = 0; num121 < 2; num121++) { diff --git a/Projectiles/Ranged/DaemonsFlameArrow.cs b/Projectiles/Ranged/DaemonsFlameArrow.cs index 56cac4d51f..c1f5b87044 100644 --- a/Projectiles/Ranged/DaemonsFlameArrow.cs +++ b/Projectiles/Ranged/DaemonsFlameArrow.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -56,11 +56,22 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { + Main.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 - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item14, (int)projectile.position.X, (int)projectile.position.Y); + 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(); + 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); diff --git a/Projectiles/Ranged/DaemonsFlameBow.cs b/Projectiles/Ranged/DaemonsFlameBow.cs index 2ebf38877f..43e8692a41 100644 --- a/Projectiles/Ranged/DaemonsFlameBow.cs +++ b/Projectiles/Ranged/DaemonsFlameBow.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Ranged } if (flag15 && Main.myPlayer == projectile.owner) { - int num42 = 14; + int num42 = ProjectileID.WoodenArrowFriendly; float scaleFactor11 = 14f; int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback2 = player.ActiveItem().knockBack; diff --git a/Projectiles/Ranged/DesertMark.cs b/Projectiles/Ranged/DesertMark.cs index 046935c507..7612ca6562 100644 --- a/Projectiles/Ranged/DesertMark.cs +++ b/Projectiles/Ranged/DesertMark.cs @@ -2,10 +2,14 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Ranged { public class DesertMark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); @@ -32,7 +36,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.soundDelay == 0) { projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); + Main.PlaySound(SoundID.Item, projectile.Center, 60); } if (projectile.localAI[1] < 30f) { diff --git a/Projectiles/Ranged/DesertMark.png b/Projectiles/Ranged/DesertMark.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Ranged/DesertMark.png and /dev/null differ diff --git a/Projectiles/Ranged/DesertTornado.cs b/Projectiles/Ranged/DesertTornado.cs index d730ebcad7..a5a84fd003 100644 --- a/Projectiles/Ranged/DesertTornado.cs +++ b/Projectiles/Ranged/DesertTornado.cs @@ -2,10 +2,14 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Ranged { public class DesertTornado : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); @@ -60,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.soundDelay == 0) { projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); + Main.PlaySound(SoundID.Item, projectile.Center, 122); } projectile.ai[0] += 1f; if (projectile.ai[0] >= lifeSpan) diff --git a/Projectiles/Ranged/DesertTornado.png b/Projectiles/Ranged/DesertTornado.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Ranged/DesertTornado.png and /dev/null differ diff --git a/Projectiles/Ranged/DragonBurst.cs b/Projectiles/Ranged/DragonsBreathRound.cs similarity index 65% rename from Projectiles/Ranged/DragonBurst.cs rename to Projectiles/Ranged/DragonsBreathRound.cs index af708a634a..a675df0cbb 100644 --- a/Projectiles/Ranged/DragonBurst.cs +++ b/Projectiles/Ranged/DragonsBreathRound.cs @@ -7,24 +7,25 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class DragonBurst : ModProjectile + public class DragonsBreathRound : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Burst"); + DisplayName.SetDefault("Dragon's Breath Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + 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; } public override void AI() @@ -32,21 +33,20 @@ 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.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { - float num93 = projectile.velocity.X / 3f; float num94 = projectile.velocity.Y / 3f; 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, 127, 0f, 0f, 100, default, 2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].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]; - expr_4815_cp_0.position.Y -= num94; + 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.position.X -= num93; + dust.position.Y -= num94; if (Main.rand.NextBool(20)) { @@ -62,8 +62,9 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - int proj = 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); - Main.projectile[proj].Calamity().forceRanged = true; + 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; } } @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); return false; } } diff --git a/Projectiles/Ranged/DragonBurst.png b/Projectiles/Ranged/DragonsBreathRound.png similarity index 100% rename from Projectiles/Ranged/DragonBurst.png rename to Projectiles/Ranged/DragonsBreathRound.png diff --git a/Projectiles/Ranged/DrataliornusBow.cs b/Projectiles/Ranged/DrataliornusBow.cs index 8a317572fa..17987e2d85 100644 --- a/Projectiles/Ranged/DrataliornusBow.cs +++ b/Projectiles/Ranged/DrataliornusBow.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class DrataliornusBow : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Drataliornus"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Drataliornus"); @@ -89,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged { if (canFire) //fire an angery flame { - int type = 14; + int type = ProjectileID.WoodenArrowFriendly; //Gets changed below anyways float scaleFactor = 18f; int damage = player.GetWeaponDamage(player.ActiveItem()); float knockBack = player.ActiveItem().knockBack; @@ -141,7 +143,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; if (projectile.spriteDirection == -1) - projectile.rotation += 3.14159274f; + projectile.rotation += MathHelper.Pi; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); diff --git a/Projectiles/Ranged/DrataliornusBow.png b/Projectiles/Ranged/DrataliornusBow.png deleted file mode 100644 index 2f44baf58e..0000000000 Binary files a/Projectiles/Ranged/DrataliornusBow.png and /dev/null differ diff --git a/Projectiles/Ranged/DrataliornusExoArrow.cs b/Projectiles/Ranged/DrataliornusExoArrow.cs index d57837122d..79f2c19311 100644 --- a/Projectiles/Ranged/DrataliornusExoArrow.cs +++ b/Projectiles/Ranged/DrataliornusExoArrow.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class DrataliornusExoArrow : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Drataliornus Arrow"); @@ -76,42 +78,8 @@ namespace CalamityMod.Projectiles.Ranged target.ExoDebuffs(); } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 3f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 3f, lightColor); } } diff --git a/Projectiles/Ranged/DrataliornusExoArrow.png b/Projectiles/Ranged/DrataliornusExoArrow.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/DrataliornusExoArrow.png and /dev/null differ diff --git a/Projectiles/Ranged/DrizzlefishFireSplit.cs b/Projectiles/Ranged/DrizzlefishFireSplit.cs index 2900b68c6b..61e6342020 100644 --- a/Projectiles/Ranged/DrizzlefishFireSplit.cs +++ b/Projectiles/Ranged/DrizzlefishFireSplit.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class DrizzlefishFireSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/DrizzlefishFire"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Drizzlefish Flames"); @@ -31,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged //Changes the texture of the projectile if (projectile.ai[1] == 1f) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/DrizzlefishFireSplit2"); + 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); return false; } diff --git a/Projectiles/Ranged/DrizzlefishFireSplit.png b/Projectiles/Ranged/DrizzlefishFireSplit.png deleted file mode 100644 index ed1c459ae1..0000000000 Binary files a/Projectiles/Ranged/DrizzlefishFireSplit.png and /dev/null differ diff --git a/Projectiles/Ranged/DrizzlefishFireSplit2.png b/Projectiles/Ranged/DrizzlefishFireSplit2.png deleted file mode 100644 index 407c8a5885..0000000000 Binary files a/Projectiles/Ranged/DrizzlefishFireSplit2.png and /dev/null differ diff --git a/Projectiles/Ranged/DrizzlefishFireball.cs b/Projectiles/Ranged/DrizzlefishFireball.cs index 5d6877e8e2..886768a044 100644 --- a/Projectiles/Ranged/DrizzlefishFireball.cs +++ b/Projectiles/Ranged/DrizzlefishFireball.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class DrizzlefishFireball : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Drizzlefish Fireball"); @@ -58,10 +60,6 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { - if (projectile.penetrate <= 0) - { - projectile.Kill(); - } projectile.velocity *= 0.98f; return false; } diff --git a/Projectiles/Ranged/DrizzlefishFireball.png b/Projectiles/Ranged/DrizzlefishFireball.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Ranged/DrizzlefishFireball.png and /dev/null differ diff --git a/Projectiles/Ranged/DualpoonProj.cs b/Projectiles/Ranged/DualpoonProj.cs index d5ff61e800..8f11d8514a 100644 --- a/Projectiles/Ranged/DualpoonProj.cs +++ b/Projectiles/Ranged/DualpoonProj.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.extraUpdates = 0; projectile.timeLeft = 300; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 484e84d68c..dee738bca3 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ElysianArrowProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/ElysianArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -28,7 +30,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.aiStyle = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -46,15 +49,9 @@ namespace CalamityMod.Projectiles.Ranged { 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.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.maxPenetrate = -1; - projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.damage /= 2; - projectile.Damage(); for (int num621 = 0; num621 < 2; num621++) { int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); @@ -62,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 6; num623++) @@ -74,20 +71,20 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num624].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); - float x = projectile.position.X + (float)Main.rand.Next(-400, 400); - float y = projectile.position.Y - (float)Main.rand.Next(500, 800); + 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 + (float)(projectile.width / 2) - vector.X; - float num16 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; - num15 += (float)Main.rand.Next(-100, 101); + 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((double)(num15 * num15 + num16 * num16)); - num18 = (float)num17 / num18; + float num18 = (float)Math.Sqrt(num15 * num15 + num16 * num16); + num18 = num17 / num18; num15 *= num18; num16 *= num18; if (projectile.owner == Main.myPlayer) { - int num19 = Projectile.NewProjectile(x, y, num15, num16, ModContent.ProjectileType(), projectile.damage, 5f, projectile.owner, 0f, 0f); + 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; } } @@ -99,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ElysianArrowProj.png b/Projectiles/Ranged/ElysianArrowProj.png deleted file mode 100644 index e0936c2556..0000000000 Binary files a/Projectiles/Ranged/ElysianArrowProj.png and /dev/null differ diff --git a/Projectiles/Ranged/EmesisGore.cs b/Projectiles/Ranged/EmesisGore.cs index e31c82702e..5791500a5d 100644 --- a/Projectiles/Ranged/EmesisGore.cs +++ b/Projectiles/Ranged/EmesisGore.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 10; projectile.timeLeft = 600; projectile.ranged = true; - projectile.usesLocalNPCImmunity = true; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 6; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Ranged/EnhancedNanoRoundProj.cs b/Projectiles/Ranged/EnhancedNanoRoundProj.cs index 2e3f3e5e69..b3e2b15138 100644 --- a/Projectiles/Ranged/EnhancedNanoRoundProj.cs +++ b/Projectiles/Ranged/EnhancedNanoRoundProj.cs @@ -1,4 +1,3 @@ - using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,7 +10,7 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Nano Round"); + DisplayName.SetDefault("Enhanced Nano Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; @@ -19,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -28,23 +27,29 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } 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); - 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; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + Lighting.AddLight(projectile.Center, 0f, 0.25f, 0.25f); + + 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; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index ff134707ac..b8ec097d7b 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class EssenceFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -21,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = -1; projectile.extraUpdates = 3; - projectile.timeLeft = 50; + projectile.timeLeft = 65; } public override void AI() @@ -31,10 +33,9 @@ namespace CalamityMod.Projectiles.Ranged 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 > 50) - { - projectile.timeLeft = 50; - } + if (projectile.timeLeft > 65) + projectile.timeLeft = 65; + if (projectile.ai[0] > 5f) { float num296 = 1f; @@ -84,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged { projectile.ai[0] += 1f; } - projectile.rotation += 0.3f * (float)projectile.direction; + projectile.rotation += 0.3f * projectile.direction; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Ranged/EssenceFire.png b/Projectiles/Ranged/EssenceFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/EssenceFire.png and /dev/null differ diff --git a/Projectiles/Ranged/ExoFire.cs b/Projectiles/Ranged/ExoFire.cs index 455f3739a8..cf9f55413a 100644 --- a/Projectiles/Ranged/ExoFire.cs +++ b/Projectiles/Ranged/ExoFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool ProducedAcceleration = false; public override void SetStaticDefaults() @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.extraUpdates = 10; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; projectile.timeLeft = 180; } diff --git a/Projectiles/Ranged/ExoFire.png b/Projectiles/Ranged/ExoFire.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/ExoFire.png and /dev/null differ diff --git a/Projectiles/Ranged/ExoLight.cs b/Projectiles/Ranged/ExoLight.cs index 3572009064..9b76732b06 100644 --- a/Projectiles/Ranged/ExoLight.cs +++ b/Projectiles/Ranged/ExoLight.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoLight : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float OffsetSpeed { get => projectile.ai[0]; @@ -46,6 +48,14 @@ namespace CalamityMod.Projectiles.Ranged OffsetSpeed = Main.rand.NextFloat(MathHelper.ToRadians(2.5f), MathHelper.ToRadians(4f)) * Main.rand.NextBool(2).ToDirectionInt(); projectile.localAI[0] = 1f; } + + // Ensure that the owner projectile index is a valid one. + if (!Main.projectile.IndexInRange((int)projectile.localAI[1])) + { + projectile.Kill(); + return; + } + Projectile owner = Main.projectile[(int)projectile.localAI[1]]; // Ensure the owner is the correct projectile. diff --git a/Projectiles/Ranged/ExoLight.png b/Projectiles/Ranged/ExoLight.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/ExoLight.png and /dev/null differ diff --git a/Projectiles/Ranged/ExoLightBomb.cs b/Projectiles/Ranged/ExoLightBomb.cs index 8a0eefce83..65c54e31ff 100644 --- a/Projectiles/Ranged/ExoLightBomb.cs +++ b/Projectiles/Ranged/ExoLightBomb.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoLightBomb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Vector2 InitialCenter; public Vector2 Destination; public const float MaxRadius = 90f; @@ -50,10 +52,12 @@ namespace CalamityMod.Projectiles.Ranged public override void SendExtraAI(BinaryWriter writer) { writer.Write(YDirection); + writer.WriteVector2(Destination); } public override void ReceiveExtraAI(BinaryReader reader) { YDirection = reader.ReadSingle(); + Destination = reader.ReadVector2(); } public override void AI() @@ -64,7 +68,11 @@ namespace CalamityMod.Projectiles.Ranged if (projectile.localAI[0] == 0f) { InitialCenter = projectile.Center; - Destination = Main.MouseWorld; + if (Main.myPlayer == projectile.owner) + { + Destination = Main.MouseWorld; + projectile.netUpdate = true; + } DustType = Main.rand.NextBool(2) ? 107 : 234; if (Main.rand.NextBool(4)) { @@ -72,6 +80,10 @@ namespace CalamityMod.Projectiles.Ranged } projectile.localAI[0] = 1f; } + + if (Destination == Vector2.Zero) + return; + if (Time <= 90f) { projectile.position = Vector2.Lerp(InitialCenter, Destination, Time / 90f); @@ -90,9 +102,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.Center = Destination + ((Time - 90) / 90f * MathHelper.ToRadians(720f) + (YDirection == -1).ToInt() * MathHelper.Pi).ToRotationVector2() * radius; } else if (Time == 180f) - { projectile.Kill(); - } + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; Time++; } @@ -172,7 +183,6 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(ModContent.BuffType(), 30); target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.CursedInferno, 180); diff --git a/Projectiles/Ranged/ExoLightBomb.png b/Projectiles/Ranged/ExoLightBomb.png deleted file mode 100644 index 67c615a142..0000000000 Binary files a/Projectiles/Ranged/ExoLightBomb.png and /dev/null differ diff --git a/Projectiles/Ranged/ExoLightBurst.cs b/Projectiles/Ranged/ExoLightBurst.cs index f47126559c..02a59edf62 100644 --- a/Projectiles/Ranged/ExoLightBurst.cs +++ b/Projectiles/Ranged/ExoLightBurst.cs @@ -7,8 +7,10 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoLightBurst : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const float MinDistanceFromTarget = 45f; - public const float MaxDistanceFromTarget = 1350f; + public const float MaxDistanceFromTarget = 350f; public override void SetStaticDefaults() { DisplayName.SetDefault("Exo Flare"); @@ -17,14 +19,14 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = projectile.height = 190; + 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 = 5; + projectile.localNPCHitCooldown = 10; projectile.timeLeft = 180; } public override void AI() @@ -66,17 +68,15 @@ namespace CalamityMod.Projectiles.Ranged projectile.ModifyHitNPCSticky(4, false); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - int width = (int)MathHelper.Min(targetHitbox.Width, 150); - int height = (int)MathHelper.Min(targetHitbox.Height, 150); - CalamityGlobalProjectile.ExpandHitboxBy(projectile, width, height); - return null; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.ExoDebuffs(2f); + 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); + } + target.ExoDebuffs(2f); } public override void OnHitPvp(Player target, int damage, bool crit) diff --git a/Projectiles/Ranged/ExoLightBurst.png b/Projectiles/Ranged/ExoLightBurst.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/ExoLightBurst.png and /dev/null differ diff --git a/Projectiles/Ranged/ExoMark.cs b/Projectiles/Ranged/ExoMark.cs index b2e75a22d6..b73065b0fe 100644 --- a/Projectiles/Ranged/ExoMark.cs +++ b/Projectiles/Ranged/ExoMark.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoMark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); @@ -23,8 +25,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 9; } public override void AI() diff --git a/Projectiles/Ranged/ExoMark.png b/Projectiles/Ranged/ExoMark.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Ranged/ExoMark.png and /dev/null differ diff --git a/Projectiles/Ranged/ExoSpark.cs b/Projectiles/Ranged/ExoSpark.cs index 5f9aee48ff..3e68966afb 100644 --- a/Projectiles/Ranged/ExoSpark.cs +++ b/Projectiles/Ranged/ExoSpark.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; + projectile.localNPCHitCooldown = 8; } public override void AI() @@ -46,9 +46,8 @@ namespace CalamityMod.Projectiles.Ranged } NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxTargetDistance); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.DirectionTo(potentialTarget.Center) * 16f) / HomingInertia; - } + projectile.velocity = (projectile.velocity * (HomingInertia - 1) + projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / HomingInertia; + projectile.rotation = projectile.velocity.ToRotation(); if (!Main.dedServ) { @@ -72,7 +71,6 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.CursedInferno, 120); diff --git a/Projectiles/Ranged/ExoTornado.cs b/Projectiles/Ranged/ExoTornado.cs index 5f37a5ddd9..45f0fa1cff 100644 --- a/Projectiles/Ranged/ExoTornado.cs +++ b/Projectiles/Ranged/ExoTornado.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ExoTornado : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); @@ -20,9 +22,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.tileCollide = false; projectile.ranged = true; projectile.penetrate = -1; - projectile.timeLeft = 240; //1200 - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 9; + projectile.timeLeft = 240; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/ExoTornado.png b/Projectiles/Ranged/ExoTornado.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Ranged/ExoTornado.png and /dev/null differ diff --git a/Projectiles/Ranged/ExplodingStake.cs b/Projectiles/Ranged/ExplodingStake.cs index 4e57b6f021..c6d7734c8e 100644 --- a/Projectiles/Ranged/ExplodingStake.cs +++ b/Projectiles/Ranged/ExplodingStake.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 3; projectile.aiStyle = 1; aiType = ProjectileID.Stake; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -64,8 +65,9 @@ namespace CalamityMod.Projectiles.Ranged 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); - Main.projectile[boom].Calamity().forceRanged = true; - } + if (boom.WithinBounds(Main.maxProjectiles)) + Main.projectile[boom].Calamity().forceRanged = true; + } } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index 434cadd9c1..bdafaa3dbe 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = 1; projectile.timeLeft = 300; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/FishronRPG.cs b/Projectiles/Ranged/FishronRPG.cs index ed7da93168..3a7e947ebd 100644 --- a/Projectiles/Ranged/FishronRPG.cs +++ b/Projectiles/Ranged/FishronRPG.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/FlakKrakenGun.cs b/Projectiles/Ranged/FlakKrakenGun.cs index 068c2a669a..15604514a5 100644 --- a/Projectiles/Ranged/FlakKrakenGun.cs +++ b/Projectiles/Ranged/FlakKrakenGun.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class FlakKrakenGun : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/FlakKraken"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flak Kraken"); diff --git a/Projectiles/Ranged/FlakKrakenGun.png b/Projectiles/Ranged/FlakKrakenGun.png deleted file mode 100644 index 1353a556b8..0000000000 Binary files a/Projectiles/Ranged/FlakKrakenGun.png and /dev/null differ diff --git a/Projectiles/Ranged/FlakKrakenProj.cs b/Projectiles/Ranged/FlakKrakenProj.cs index 3f3e24d321..c6c6448c5e 100644 --- a/Projectiles/Ranged/FlakKrakenProj.cs +++ b/Projectiles/Ranged/FlakKrakenProj.cs @@ -40,6 +40,13 @@ namespace CalamityMod.Projectiles.Ranged 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) + return; + projectile.rotation += 0.2f; if (projectile.localAI[0] < 1f) { @@ -135,7 +142,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 aa2e150a3d..42badc0ff5 100644 --- a/Projectiles/Ranged/FlamingStake.cs +++ b/Projectiles/Ranged/FlamingStake.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class FlamingStake : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/ExplodingStake"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Stake"); @@ -24,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 3; projectile.aiStyle = 1; aiType = ProjectileID.Stake; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/FlamingStake.png b/Projectiles/Ranged/FlamingStake.png deleted file mode 100644 index bde4f15c6f..0000000000 Binary files a/Projectiles/Ranged/FlamingStake.png and /dev/null differ diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index c2ace743bd..e6ad5a58d9 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.light = 0.25f; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -72,7 +73,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index 2d48c4fbba..9cb046d88b 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class Flash : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flash"); diff --git a/Projectiles/Ranged/Flash.png b/Projectiles/Ranged/Flash.png deleted file mode 100644 index 3cb685553d..0000000000 Binary files a/Projectiles/Ranged/Flash.png and /dev/null differ diff --git a/Projectiles/Ranged/FlashBulletProj.cs b/Projectiles/Ranged/FlashBulletProj.cs index de9c60d85f..6f9e5b4708 100644 --- a/Projectiles/Ranged/FlashBulletProj.cs +++ b/Projectiles/Ranged/FlashBulletProj.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Flash Round"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -26,23 +26,29 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.1f / 255f); - 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; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + Lighting.AddLight(projectile.Center, 0.1f, 0.1f, 0.1f); + + 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; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/FlurrystormCannonShooting.cs b/Projectiles/Ranged/FlurrystormCannonShooting.cs index 286986f8e6..f7180c3125 100644 --- a/Projectiles/Ranged/FlurrystormCannonShooting.cs +++ b/Projectiles/Ranged/FlurrystormCannonShooting.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 58; - projectile.height = 34; + projectile.width = 68; + projectile.height = 38; projectile.friendly = true; projectile.penetrate = -1; projectile.tileCollide = false; @@ -29,12 +29,6 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Player player = Main.player[projectile.owner]; - float num = 0f; - Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); - if (projectile.spriteDirection == -1) - { - num = 3.14159274f; - } projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -46,117 +40,118 @@ namespace CalamityMod.Projectiles.Ranged projectile.frame = 0; } projectile.ai[0] += 1f; - int num39 = 0; - float spreadMult = 0.15f; + int fireRate = 0; if (projectile.ai[0] >= 60f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 120f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 180f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 240f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 300f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 360f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 420f) { - num39++; + fireRate++; } if (projectile.ai[0] >= 480f) //full speed after 8 seconds { - num39++; + fireRate++; } - int num40 = 24; - int num41 = 2; + int initialRate = 24; + int fireRateMult = 2; projectile.ai[1] -= 1f; - bool flag15 = false; + bool shouldShoot = false; if (projectile.ai[1] <= 0f) { - projectile.ai[1] = (float)(num40 - num41 * num39); - flag15 = true; + projectile.ai[1] = (float)(initialRate - fireRateMult * fireRate); + shouldShoot = true; } - bool flag16 = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; + bool canShoot = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; if (projectile.localAI[0] > 0f) { projectile.localAI[0] -= 1f; } - if (projectile.soundDelay <= 0 && flag16) + if (projectile.soundDelay <= 0 && canShoot) { - projectile.soundDelay = num40 - num41 * num39; + projectile.soundDelay = initialRate - fireRateMult * fireRate; if (projectile.ai[0] != 1f) { Main.PlaySound(SoundID.Item11, projectile.position); } projectile.localAI[0] = 12f; } - if (flag15 && Main.myPlayer == projectile.owner) + if (shouldShoot && Main.myPlayer == projectile.owner) { - int num42 = 14; - float scaleFactor11 = 14f; - int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); - float weaponKnockback2 = player.ActiveItem().knockBack; - if (flag16) + int projType = ProjectileID.SnowBallFriendly; + float speedMult2 = 14f; + int dmg = player.GetWeaponDamage(player.ActiveItem()); + float kBack = player.ActiveItem().knockBack; + if (canShoot) { - player.PickAmmo(player.ActiveItem(), ref num42, ref scaleFactor11, ref flag16, ref weaponDamage2, ref weaponKnockback2, false); - weaponKnockback2 = player.GetWeaponKnockback(player.ActiveItem(), weaponKnockback2); - float scaleFactor12 = player.ActiveItem().shootSpeed * projectile.scale; - Vector2 vector19 = vector; - Vector2 value18 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - vector19; + 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; + Vector2 source = player.RotatedRelativePoint(player.MountedCenter, true); + Vector2 direction = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - source; if (player.gravDir == -1f) { - value18.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector19.Y; + direction.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - source.Y; } - Vector2 value19 = Vector2.Normalize(value18); - if (float.IsNaN(value19.X) || float.IsNaN(value19.Y)) + Vector2 speedMult = Vector2.Normalize(direction); + if (float.IsNaN(speedMult.X) || float.IsNaN(speedMult.Y)) { - value19 = -Vector2.UnitY; + speedMult = -Vector2.UnitY; } - value19 *= scaleFactor12; - if (value19.X != projectile.velocity.X || value19.Y != projectile.velocity.Y) + speedMult *= shootSpeed; + if (speedMult.X != projectile.velocity.X || speedMult.Y != projectile.velocity.Y) { projectile.netUpdate = true; } - projectile.velocity = value19 * 0.55f; + projectile.velocity = speedMult * 0.55f; - Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * spreadMult); - if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) + Vector2 snowballVel = Vector2.Normalize(projectile.velocity) * speedMult2 * (0.6f + Main.rand.NextFloat(0f, 0.15f)); + if (float.IsNaN(snowballVel.X) || float.IsNaN(snowballVel.Y)) { - vector20 = -Vector2.UnitY; + snowballVel = -Vector2.UnitY; + } + 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); + if (snowball.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[snowball].noDropItem = true; + Main.projectile[snowball].Calamity().forceRanged = true; + Main.projectile[snowball].thrown = false; + Main.projectile[snowball].extraUpdates += Main.rand.Next(0,2); } - Vector2 vector21 = vector19 + Utils.RandomVector2(Main.rand, -5f, 5f); - vector20.X += (float)Main.rand.Next(-15, 16) * spreadMult; - vector20.Y += (float)Main.rand.Next(-15, 16) * spreadMult; - int snowball = Projectile.NewProjectile(vector21.X, vector21.Y, vector20.X, vector20.Y, num42, weaponDamage2, weaponKnockback2, projectile.owner, 0f, 0f); - Main.projectile[snowball].noDropItem = true; - Main.projectile[snowball].Calamity().forceRanged = true; - Main.projectile[snowball].thrown = false; - Main.projectile[snowball].extraUpdates += Main.rand.Next(0,2); if (Main.rand.NextBool(5)) //ice chunk { - Vector2 vector2 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); - if (float.IsNaN(vector2.X) || float.IsNaN(vector2.Y)) + Vector2 chunkVel = Vector2.Normalize(projectile.velocity) * speedMult2 * (0.6f + Main.rand.NextFloat() * 0.8f); + if (float.IsNaN(chunkVel.X) || float.IsNaN(chunkVel.Y)) { - vector2 = -Vector2.UnitY; + chunkVel = -Vector2.UnitY; } - float speedY = vector2.Y; - Vector2 vector3 = vector19 + Utils.RandomVector2(Main.rand, -15f, 15f); - int iceChunk = Projectile.NewProjectile(vector3.X, vector3.Y, vector2.X, vector2.Y, ModContent.ProjectileType(), (int)((double)weaponDamage2 * 1.5), (int)((double)weaponKnockback2 * 1.5), projectile.owner, 0.0f, speedY); - Main.projectile[iceChunk].extraUpdates += num39 / 2; //0 to 2 + 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); + Main.projectile[iceChunk].extraUpdates += fireRate / 2; //0 to 2 } } else @@ -165,14 +160,14 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - projectile.Size / 2f; - projectile.rotation = projectile.velocity.ToRotation() + num; + 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((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)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/FlurrystormCannonShooting.png b/Projectiles/Ranged/FlurrystormCannonShooting.png index 546fc4bcea..324940bd9b 100644 Binary files a/Projectiles/Ranged/FlurrystormCannonShooting.png and b/Projectiles/Ranged/FlurrystormCannonShooting.png differ diff --git a/Projectiles/Ranged/FlurrystormIceChunk.cs b/Projectiles/Ranged/FlurrystormIceChunk.cs index b32c4b8ad7..b0d25dcfdd 100644 --- a/Projectiles/Ranged/FlurrystormIceChunk.cs +++ b/Projectiles/Ranged/FlurrystormIceChunk.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.coldDamage = true; projectile.penetrate = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 6a2444b113..fc7fb22b7e 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + if (projectile.velocity.Y <= 0f) + projectile.velocity.Y = 0.1f; projectile.rotation += projectile.velocity.Y; projectile.velocity.Y *= 1.05f; } diff --git a/Projectiles/Ranged/FrostsparkBulletProj.cs b/Projectiles/Ranged/FrostsparkBulletProj.cs index 72f0dfa94d..c7f1a4c317 100644 --- a/Projectiles/Ranged/FrostsparkBulletProj.cs +++ b/Projectiles/Ranged/FrostsparkBulletProj.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -27,26 +27,32 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { Lighting.AddLight(projectile.Center, 0.15f, 0.05f, 0.3f); - if (Main.rand.NextBool()) - { - int dustType = 15; - float spacing = Main.rand.NextFloat(-0.2f, 0.8f); - int dust = Dust.NewDust(projectile.Center - spacing * projectile.velocity, 1, 1, dustType);; - Main.dust[dust].position = projectile.Center; - Main.dust[dust].velocity *= 0.4f; - Main.dust[dust].velocity += projectile.velocity * 0.7f; - Main.dust[dust].noGravity = true; - } + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + if (Main.rand.NextBool()) + { + int dustType = 15; + float spacing = Main.rand.NextFloat(-0.2f, 0.8f); + int dust = Dust.NewDust(projectile.Center - spacing * projectile.velocity, 1, 1, dustType); ; + Main.dust[dust].position = projectile.Center; + Main.dust[dust].velocity *= 0.4f; + Main.dust[dust].velocity += projectile.velocity * 0.7f; + Main.dust[dust].noGravity = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } @@ -60,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged { target.AddBuff(BuffID.OnFire, 240); target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index 5515739c10..db8cea8ace 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.aiStyle = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -44,13 +45,12 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - int fungiAmt = Main.rand.Next(2, 5); if (projectile.owner == Main.myPlayer) { - for (int f = 0; f < fungiAmt; f++) + 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.25), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), 0f, projectile.owner); } } Main.PlaySound(SoundID.NPCDeath1, projectile.position); diff --git a/Projectiles/Ranged/FungiOrb2.cs b/Projectiles/Ranged/FungiOrb2.cs index e6831c49f2..241dea6b6b 100644 --- a/Projectiles/Ranged/FungiOrb2.cs +++ b/Projectiles/Ranged/FungiOrb2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class FungiOrb2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/FungiOrb"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -20,10 +22,12 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; + projectile.timeLeft = 180; } - public override void AI() + 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(); @@ -33,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.velocity.Y += 0.1f; projectile.velocity.X *= 0.95f; + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { @@ -41,7 +46,10 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].noGravity = true; Main.dust[num469].velocity = dspeed; } - } + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 6f, 20f); + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Ranged/FungiOrb2.png b/Projectiles/Ranged/FungiOrb2.png deleted file mode 100644 index 50c3603ed9..0000000000 Binary files a/Projectiles/Ranged/FungiOrb2.png and /dev/null differ diff --git a/Projectiles/Ranged/GodSlayerSlugBlue.png b/Projectiles/Ranged/GodSlayerSlugBlue.png new file mode 100644 index 0000000000..3c3aeb4246 Binary files /dev/null and b/Projectiles/Ranged/GodSlayerSlugBlue.png differ diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs new file mode 100644 index 0000000000..029616278d --- /dev/null +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -0,0 +1,176 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class GodSlayerSlugProj : ModProjectile + { + private const int Lifetime = 600; + private const int NoDrawFrames = 2; + private const int BlueNoCollideFrames = 9; + private const int TurnBlueFrameDelay = 7; + + 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; + + if (Main.netMode != NetmodeID.Server) + TextureBlue = mod.GetTexture("Projectiles/Ranged/GodSlayerSlugBlue"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = ProjectileID.Bullet; + projectile.alpha = 255; + projectile.extraUpdates = 5; + 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 AI() + { + // On frame 1, store the original velocity. This is needed for the warp. + if (projectile.timeLeft == Lifetime) + projectile.localAI[0] = projectile.velocity.Length(); + + // Rapidly fade into visibility. + 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); + else + 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 the bullet has struck at least one target but hasn't hit anything for ten frames, turn blue and warp. + if (projectile.ai[1] >= TurnBlueFrameDelay) + TurnBlue(true); + + // When blue, ignore walls for the first several updates. + if (BlueMode && projectile.ai[1] > 0f) + { + --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; + + // Provide several frames of passing through walls to prevent frustration + projectile.ai[1] = BlueNoCollideFrames; + projectile.tileCollide = false; + + // Reduce damage, but remove piercing + projectile.damage = (int)(0.3f * projectile.damage); + projectile.penetrate = 1; + projectile.usesLocalNPCImmunity = false; + + // Reset projectile lifetime so it can fly again for its full possible range + projectile.timeLeft = Lifetime - NoDrawFrames * projectile.MaxUpdates; + + if (!setPosition || Main.myPlayer != projectile.owner) + return; + + // The warp must be performed client side because it requires knowledge of the player's mouse position. + projectile.netUpdate = true; + projectile.tileCollide = false; + Vector2 mouseVec = 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 * mouseVec.RotatedBy(warpAngle); + projectile.position = Main.LocalPlayer.MountedCenter + warpOffset; + + // Set all old positions to the bullet's warp position so that there aren't weird afterimages + for (int i = 0; i < ProjectileID.Sets.TrailCacheLength[projectile.type]; ++i) + projectile.oldPos[i] = projectile.position; + + // TODO -- when the bullet warps it should produce a tiny puff of dust + // this may require vector math so that the puff of dust is at the back of the bullet + + // TODO -- the bullet should aim itself towards the mouse with about 26px square deviation + projectile.velocity = mouseVec * projectile.localAI[0]; + } + + public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, 140); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + + // God Slayer Slugs explode on death, even if they never visually turned blue. + public override void Kill(int timeLeft) + { + // Turn blue to set stats correctly, if not already done. + if (!BlueMode) + TurnBlue(false); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + projectile.Damage(); + + // Create a fancy triangle of dust. + // TODO: This is too loose, it needs to be a tight triangular pattern. + int dustID = 180; + for (int i = 0; i < 9; ++i) + { + float speed = Main.rand.NextFloat(3f, 11.2f); + Vector2 dustVel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); + 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); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 2f / 3f); + Dust.CloneDust(d).velocity = dustVel.RotatedBy(MathHelper.Pi * 4f / 3f); + } + } + + 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) + { + TurnBlue(true); + return false; + } + + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(SoundID.Dig, projectile.Center, 1); + return true; + } + } +} diff --git a/Projectiles/Ranged/GodSlayerSlugPurple.png b/Projectiles/Ranged/GodSlayerSlugPurple.png new file mode 100644 index 0000000000..8b5a2816bb Binary files /dev/null and b/Projectiles/Ranged/GodSlayerSlugPurple.png differ diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 1d7a314a2e..39b5d5bf4e 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -79,22 +79,7 @@ namespace CalamityMod.Projectiles.Ranged 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 = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - 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 = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -106,10 +91,7 @@ namespace CalamityMod.Projectiles.Ranged 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 160); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -131,9 +113,12 @@ namespace CalamityMod.Projectiles.Ranged value20 -= value21 * (float)num517; num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; - int num520 = 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, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; + 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; + Main.projectile[bee].Calamity().forceRanged = true; + } } } } diff --git a/Projectiles/Ranged/GoliathRocket.png b/Projectiles/Ranged/GoliathRocket.png index 61874e912e..ff29869435 100644 Binary files a/Projectiles/Ranged/GoliathRocket.png and b/Projectiles/Ranged/GoliathRocket.png differ diff --git a/Projectiles/Ranged/GreenExoArrow.cs b/Projectiles/Ranged/GreenExoArrow.cs index 966670abc7..2da0e02ad4 100644 --- a/Projectiles/Ranged/GreenExoArrow.cs +++ b/Projectiles/Ranged/GreenExoArrow.cs @@ -1,15 +1,16 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class GreenExoArrow : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Arrow"); + DisplayName.SetDefault("Green Exo Arrow"); } public override void SetDefaults() @@ -19,10 +20,11 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; projectile.timeLeft = 300; projectile.ranged = true; projectile.arrow = true; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() @@ -55,59 +57,19 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.ExoDebuffs(); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.ExoDebuffs(); - } + public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + 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) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 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/GreenExoArrow.png b/Projectiles/Ranged/GreenExoArrow.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/GreenExoArrow.png and /dev/null differ diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index 791ce568d8..92c91ae5a1 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class HalleysComet : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Halley's Comet"); diff --git a/Projectiles/Ranged/HalleysComet.png b/Projectiles/Ranged/HalleysComet.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/HalleysComet.png and /dev/null differ diff --git a/Projectiles/Ranged/HandheldTankShell.cs b/Projectiles/Ranged/HandheldTankShell.cs index 428e03643e..f5f7e9bd73 100644 --- a/Projectiles/Ranged/HandheldTankShell.cs +++ b/Projectiles/Ranged/HandheldTankShell.cs @@ -92,42 +92,14 @@ namespace CalamityMod.Projectiles.Ranged // 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.X = projectile.position.X - projectile.width / 2; + projectile.position.Y = projectile.position.Y - projectile.height / 2; - // Spawn explosion dust (separate method because it's messy) - SpawnExplosionDust(); + // Rocket III type explosion is now a utility for convenience + projectile.LargeFieryExplosion(); // Make the explosion cause damage to nearby targets (makes projectile hit twice) projectile.Damage(); } - - // Dust copied from Rocket III - void SpawnExplosionDust() - { - // Sparks and such - Vector2 corner = projectile.position; - for (int i = 0; i < 40; i++) - { - 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)) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int i = 0; i < 70; i++) - { - 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); - Main.dust[idx].velocity *= 2f; - } - - // Smoke, which counts as a Gore - CalamityUtils.ExplosionGores(projectile.Center, 3); - } } } diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs new file mode 100644 index 0000000000..9f538d6f38 --- /dev/null +++ b/Projectiles/Ranged/HighExplosivePeanutShell.cs @@ -0,0 +1,93 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class HighExplosivePeanutShell : ModProjectile + { + private const int Lifetime = 180; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("High Explosive Peanut Shell"); + 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; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation(); + projectile.spriteDirection = 1; + + // Lighting + 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); + d.noGravity = true; + d.scale = scale; + + // Dust velocity is a complicated flaking function taken from Holy Fire Bullets + d.velocity *= 0.2f; + float angleDeviation = 0.17f; + float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); + 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); + 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); + + // 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; + + // Allow infinite piercing and ignoring iframes for this one extra hit + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + + // Rocket III type explosion is now a utility for convenience + projectile.LargeFieryExplosion(); + + // Deal damage again. The explosion deals half the damage of the direct hit. + projectile.damage /= 2; + projectile.Damage(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + return true; // the projectile does indeed die on collision + } + } +} diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.png b/Projectiles/Ranged/HighExplosivePeanutShell.png new file mode 100644 index 0000000000..5e07d7886c Binary files /dev/null and b/Projectiles/Ranged/HighExplosivePeanutShell.png differ diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 40452af1b9..3af34311f0 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -79,22 +79,7 @@ namespace CalamityMod.Projectiles.Ranged 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 = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - 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 = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -106,10 +91,7 @@ namespace CalamityMod.Projectiles.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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 64); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -131,9 +113,12 @@ namespace CalamityMod.Projectiles.Ranged value20 -= value21 * (float)num517; num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; - int num520 = 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, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; + 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; + Main.projectile[bee].Calamity().forceRanged = true; + } } } } diff --git a/Projectiles/Ranged/HiveBomb.png b/Projectiles/Ranged/HiveBomb.png index 88c8031a84..49bbe2abdd 100644 Binary files a/Projectiles/Ranged/HiveBomb.png and b/Projectiles/Ranged/HiveBomb.png differ diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index f765cf2c87..dc20218bae 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -79,22 +79,7 @@ namespace CalamityMod.Projectiles.Ranged 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 = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - if (projectile.ai[0] > 10f || projectile.ai[0] > 5f) - { - 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 = 0f; - projectile.netUpdate = true; - } - } - projectile.velocity.Y = projectile.velocity.Y + 0.2f; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -106,10 +91,7 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -131,9 +113,12 @@ namespace CalamityMod.Projectiles.Ranged value20 -= value21 * (float)num517; num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; - int num520 = 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, 0f, 0f); - Main.projectile[num520].penetrate = 2; - Main.projectile[num520].Calamity().forceRanged = true; + 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; + Main.projectile[bee].Calamity().forceRanged = true; + } } } } diff --git a/Projectiles/Ranged/HiveMissile.png b/Projectiles/Ranged/HiveMissile.png index eccb2b98dc..7ee7ecf5a7 100644 Binary files a/Projectiles/Ranged/HiveMissile.png and b/Projectiles/Ranged/HiveMissile.png differ diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index 9b76d0d1f4..bf75ff42f5 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -10,64 +10,74 @@ namespace CalamityMod.Projectiles.Ranged { public class HolyFireBulletProj : ModProjectile { + private const int Lifetime = 600; + private static readonly Color Alpha = new Color(1f, 1f, 1f, 0f); + public override void SetStaticDefaults() { DisplayName.SetDefault("Holy Fire Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; - projectile.extraUpdates = 4; - projectile.penetrate = 1; - projectile.timeLeft = 600; projectile.ranged = true; - } + projectile.extraUpdates = 4; + projectile.timeLeft = Lifetime; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); projectile.spriteDirection = projectile.direction; - // Flaking dust - 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; - 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; - Main.dust[dustID].velocity = sprayVelocity; - } + // Flaking dust + 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; + 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; + Main.dust[dustID].velocity = sprayVelocity; + } + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(1f, 1f, 1f, 0f); - } + public override Color? GetAlpha(Color lightColor) => Alpha; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + 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) { - int blastDamage = (int)(projectile.damage * 0.85f); + int blastDamage = (int)(projectile.damage * 0.75); 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); - Main.projectile[boom].Calamity().forceRanged = true; + + // Only declare the explosion as ranged class if the bullet itself is ranged class. + if (boom.WithinBounds(Main.maxProjectiles) && projectile.ranged) + Main.projectile[boom].Calamity().forceRanged = true; } + + // Spawn four shrapnel dust. This deals no damage. for (int k = 0; k < 4; k++) { float scale = Main.rand.NextFloat(1.4f, 1.8f); diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 2f0713c0b3..255640f7b4 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -69,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/HyperiusSplit.cs b/Projectiles/Ranged/HyperiusSplit.cs index 60719f0a07..7705520b29 100644 --- a/Projectiles/Ranged/HyperiusSplit.cs +++ b/Projectiles/Ranged/HyperiusSplit.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Ranged { public class HyperiusSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/HyperiusBulletProj"; private Color currentColor = Color.Black; public override void SetStaticDefaults() @@ -19,6 +20,7 @@ namespace CalamityMod.Projectiles.Ranged 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; @@ -50,9 +52,9 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft == 360) - return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + if (projectile.timeLeft == 360) + return false; + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/HyperiusSplit.png b/Projectiles/Ranged/HyperiusSplit.png deleted file mode 100644 index 796dc78281..0000000000 Binary files a/Projectiles/Ranged/HyperiusSplit.png and /dev/null differ diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 5b81d450b4..2e4161ee24 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class IcicleArrowProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/IcicleArrow"; + public override void SetDefaults() { projectile.width = 10; @@ -19,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.coldDamage = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void SetStaticDefaults() { @@ -34,6 +37,7 @@ namespace CalamityMod.Projectiles.Ranged 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; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -57,7 +61,7 @@ namespace CalamityMod.Projectiles.Ranged { 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); + 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/IcicleArrowProj.png b/Projectiles/Ranged/IcicleArrowProj.png deleted file mode 100644 index 6812f4d459..0000000000 Binary files a/Projectiles/Ranged/IcicleArrowProj.png and /dev/null differ diff --git a/Projectiles/Ranged/IcyBulletProj.cs b/Projectiles/Ranged/IcyBulletProj.cs index 3cad98ad52..473aa6dc22 100644 --- a/Projectiles/Ranged/IcyBulletProj.cs +++ b/Projectiles/Ranged/IcyBulletProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,14 @@ namespace CalamityMod.Projectiles.Ranged { public class IcyBulletProj : ModProjectile { - public override void SetDefaults() + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icy Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() { projectile.width = 4; projectile.height = 4; @@ -22,30 +30,36 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; - projectile.coldDamage = true; - } - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icy Bullet"); - } + projectile.coldDamage = true; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - 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); - Main.dust[index2].noGravity = true; - } + 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); + Main.dust[index2].noGravity = true; + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } - public override Color? GetAlpha(Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override Color? GetAlpha(Color lightColor) { return new Color(200, 200, 200, projectile.alpha); } diff --git a/Projectiles/Ranged/IlluminatedBullet.cs b/Projectiles/Ranged/IlluminatedBullet.cs index b3af24bd70..75cbf19659 100644 --- a/Projectiles/Ranged/IlluminatedBullet.cs +++ b/Projectiles/Ranged/IlluminatedBullet.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class IlluminatedBullet : ModProjectile @@ -10,7 +12,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Illuminated Bullet"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } public override void SetDefaults() { @@ -25,7 +29,8 @@ namespace CalamityMod.Projectiles.Ranged // Invisible for the first few frames projectile.alpha = 255; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -47,7 +52,13 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 360); } diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index 77be1dd621..60d9eb92ff 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -3,45 +3,65 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { - public class ImpactRound : ModProjectile - { - private bool initialized = false; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Impact Round"); - } + public class ImpactRound : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot"; - 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; - aiType = ProjectileID.BulletHighVelocity; - projectile.penetrate = -1; - projectile.timeLeft = 600; + private bool initialized = false; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Impact Round"); + } + + 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; + aiType = ProjectileID.BulletHighVelocity; + projectile.penetrate = -1; + projectile.timeLeft = 600; projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - if (!initialized) + if (!initialized && projectile.ranged) //Ranged check prevents quiver splits triggering the sound { initialized = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), (int)projectile.position.X, (int)projectile.position.Y); + + if (Main.netMode != NetmodeID.Server) + { + var sound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + sound = sound.WithVolume(sound.Volume * 0.45f); + Main.PlaySound(sound, projectile.Center); + } } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + double damageMult = 1D; + if (crit) + damageMult += 0.25; + if (target.Inorganic()) + damageMult += 0.1; + damage = (int)(damage * damageMult); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; + } } diff --git a/Projectiles/Ranged/ImpactRound.png b/Projectiles/Ranged/ImpactRound.png deleted file mode 100644 index 3f761a0306..0000000000 Binary files a/Projectiles/Ranged/ImpactRound.png and /dev/null differ diff --git a/Projectiles/Ranged/KarasawaShot.cs b/Projectiles/Ranged/KarasawaShot.cs index 0786bf5b81..4646ac0f3c 100644 --- a/Projectiles/Ranged/KarasawaShot.cs +++ b/Projectiles/Ranged/KarasawaShot.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class KarasawaShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust1 = 187; //160 private int dust2 = 229; //187 @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 100; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Ranged/KarasawaShot.png b/Projectiles/Ranged/KarasawaShot.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Ranged/KarasawaShot.png and /dev/null differ diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index 329aded31a..90bb1ec76a 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.timeLeft = 300; projectile.ranged = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Ranged/LeafArrow.png b/Projectiles/Ranged/LeafArrow.png index 13e97ea9b7..b8a4061769 100644 Binary files a/Projectiles/Ranged/LeafArrow.png and b/Projectiles/Ranged/LeafArrow.png differ diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index 754ecb0a8b..528e2adf84 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.timeLeft = 180; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/LunarBolt2.cs b/Projectiles/Ranged/LunarBolt2.cs index b47d752cb2..34c4c9a36f 100644 --- a/Projectiles/Ranged/LunarBolt2.cs +++ b/Projectiles/Ranged/LunarBolt2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class LunarBolt2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/LunarBolt"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.extraUpdates = 1; projectile.timeLeft = 180; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/LunarBolt2.png b/Projectiles/Ranged/LunarBolt2.png deleted file mode 100644 index e72e6b4f11..0000000000 Binary files a/Projectiles/Ranged/LunarBolt2.png and /dev/null differ diff --git a/Projectiles/Ranged/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index 54def4f8b1..accf968003 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Ranged/LuxorsGiftRanged.png b/Projectiles/Ranged/LuxorsGiftRanged.png index 86c8cace93..e05c83cbe4 100644 Binary files a/Projectiles/Ranged/LuxorsGiftRanged.png and b/Projectiles/Ranged/LuxorsGiftRanged.png differ diff --git a/Projectiles/Ranged/MagnaStrike.cs b/Projectiles/Ranged/MagnaStrike.cs index b78e8904e7..8731255296 100644 --- a/Projectiles/Ranged/MagnaStrike.cs +++ b/Projectiles/Ranged/MagnaStrike.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 300; projectile.ranged = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -42,7 +43,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/MagnaStrike.png b/Projectiles/Ranged/MagnaStrike.png index 4a8591fafa..31e2a916a5 100644 Binary files a/Projectiles/Ranged/MagnaStrike.png and b/Projectiles/Ranged/MagnaStrike.png differ diff --git a/Projectiles/Ranged/MagnomalyAura.cs b/Projectiles/Ranged/MagnomalyAura.cs index 6487b61ecc..cc6d225cd3 100644 --- a/Projectiles/Ranged/MagnomalyAura.cs +++ b/Projectiles/Ranged/MagnomalyAura.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class MagnomalyAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int radius = 100; public override void SetStaticDefaults() diff --git a/Projectiles/Ranged/MagnomalyAura.png b/Projectiles/Ranged/MagnomalyAura.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Ranged/MagnomalyAura.png and /dev/null differ diff --git a/Projectiles/Ranged/MagnomalyBeam.cs b/Projectiles/Ranged/MagnomalyBeam.cs index 6814cdcebe..ea0cc7d318 100644 --- a/Projectiles/Ranged/MagnomalyBeam.cs +++ b/Projectiles/Ranged/MagnomalyBeam.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Ranged { public class MagnomalyBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 5; projectile.timeLeft = 300; projectile.tileCollide = false; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -63,52 +66,12 @@ namespace CalamityMod.Projectiles.Ranged } } - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 100f; - float scaleFactor = 2f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(100f, 2f, lightColor); - public override Color? GetAlpha(Color lightColor) - { - return 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(); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.ExoDebuffs(); - } + public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); } } diff --git a/Projectiles/Ranged/MagnomalyBeam.png b/Projectiles/Ranged/MagnomalyBeam.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/MagnomalyBeam.png and /dev/null differ diff --git a/Projectiles/Ranged/MagnomalyExplosion.cs b/Projectiles/Ranged/MagnomalyExplosion.cs index eaa19849a5..4278e023ee 100644 --- a/Projectiles/Ranged/MagnomalyExplosion.cs +++ b/Projectiles/Ranged/MagnomalyExplosion.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Ranged { public class MagnomalyExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() //don't remove this projectile { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Ranged/MagnomalyExplosion.png b/Projectiles/Ranged/MagnomalyExplosion.png deleted file mode 100644 index 3cb685553d..0000000000 Binary files a/Projectiles/Ranged/MagnomalyExplosion.png and /dev/null differ diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 767866cf0e..286ee8ae84 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; projectile.ranged = true; projectile.tileCollide = false; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -75,17 +76,15 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[exo].noGravity = true; Main.dust[exo].noLight = true; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 16f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) { if (projectile.owner == Main.myPlayer) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 192; - projectile.Center = projectile.position; - Main.PlaySound(SoundID.Item14, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 192); + Main.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); @@ -121,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/MeowFire.cs b/Projectiles/Ranged/MeowFire.cs index 5c33815136..5bd5f1860b 100644 --- a/Projectiles/Ranged/MeowFire.cs +++ b/Projectiles/Ranged/MeowFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class MeowFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Ranged/MeowFire.png b/Projectiles/Ranged/MeowFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/MeowFire.png and /dev/null differ diff --git a/Projectiles/Ranged/MeowFire2.cs b/Projectiles/Ranged/MeowFire2.cs index 0217dea070..8127103975 100644 --- a/Projectiles/Ranged/MeowFire2.cs +++ b/Projectiles/Ranged/MeowFire2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class MeowFire2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Ranged/MeowFire2.png b/Projectiles/Ranged/MeowFire2.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/MeowFire2.png and /dev/null differ diff --git a/Projectiles/Ranged/MiniRocket.cs b/Projectiles/Ranged/MiniRocket.cs index 4f328eebd1..d832f23a71 100644 --- a/Projectiles/Ranged/MiniRocket.cs +++ b/Projectiles/Ranged/MiniRocket.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Rocket"); + Main.projFrames[projectile.type] = 4; } public override void SetDefaults() @@ -24,52 +25,52 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(90); + + if (projectile.ai[0] == 0f) + { + Main.PlaySound(SoundID.Item11, (int)projectile.Center.X, (int)projectile.Center.Y); + projectile.ai[0] = 1f; + } + + //Animation + projectile.frameCounter++; + if (projectile.frameCounter > 7) { - 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.frame++; + projectile.frameCounter = 0; } - else + if (projectile.frame >= Main.projFrames[projectile.type]) { - if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f) - { - for (int num246 = 0; num246 < 2; num246++) - { - float num247 = 0f; - float num248 = 0f; - if (num246 == 1) - { - 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); - 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); - Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num249].velocity *= 0.05f; - } - } + projectile.frame = 0; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); + + if (projectile.velocity.Length() >= 8f) + { + for (int num246 = 0; num246 < 2; num246++) + { + float num247 = 0f; + float num248 = 0f; + if (num246 == 1) + { + 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); + 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); + 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); } 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Ranged/MiniRocket.png b/Projectiles/Ranged/MiniRocket.png index b6fbd0efbb..7c7d563a3c 100644 Binary files a/Projectiles/Ranged/MiniRocket.png and b/Projectiles/Ranged/MiniRocket.png differ diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs new file mode 100644 index 0000000000..32d0e16985 --- /dev/null +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class MiniSharkron : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mini Sharkron"); + Main.projFrames[projectile.type] = 2; + } + + public override void SetDefaults() + { + 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; + } + + 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); + Dust dust = Main.dust[idx]; + dust.velocity /= 2f; + } + 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); + Main.gore[body].timeLeft /= 10; + int head = Gore.NewGore(projectile.Center, projectile.velocity * 1f, 586, 1f); + Main.gore[head].timeLeft /= 10; + } + } +} diff --git a/Projectiles/Ranged/MiniSharkron.png b/Projectiles/Ranged/MiniSharkron.png new file mode 100644 index 0000000000..050249c6a8 Binary files /dev/null and b/Projectiles/Ranged/MiniSharkron.png differ diff --git a/Projectiles/Ranged/Minibirb.cs b/Projectiles/Ranged/Minibirb.cs index be4ddb512b..99d25e0ba9 100644 --- a/Projectiles/Ranged/Minibirb.cs +++ b/Projectiles/Ranged/Minibirb.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? MathHelper.Pi : 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 10f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 10f, 20f); } } } diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index a4c846cd12..b2e2563fcd 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.WoodenArrowFriendly; projectile.arrow = true; projectile.coldDamage = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 240); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index bcf4bcf1aa..1963b357a5 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Ranged { public class MortarRoundProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/MortarRound"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mortar"); diff --git a/Projectiles/Ranged/MortarRoundProj.png b/Projectiles/Ranged/MortarRoundProj.png deleted file mode 100644 index 37ef5e341c..0000000000 Binary files a/Projectiles/Ranged/MortarRoundProj.png and /dev/null differ diff --git a/Projectiles/Ranged/Nanomachine.cs b/Projectiles/Ranged/Nanomachine.cs index d64c90f11b..bdda8883bd 100644 --- a/Projectiles/Ranged/Nanomachine.cs +++ b/Projectiles/Ranged/Nanomachine.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/Nanomachine"); if (projectile.localAI[1] == 2) texture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/Nanomachine2"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, texture); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, texture); return false; } diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index c9bed216bd..31df40787c 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class NapalmArrowProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/NapalmArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -23,7 +25,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 600; projectile.aiStyle = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -36,10 +39,7 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); Main.PlaySound(SoundID.Item14, projectile.position); for (int j = 0; j < 5; j++) { @@ -64,16 +64,16 @@ namespace CalamityMod.Projectiles.Ranged { for (int i = 0; i < 3; i++) { - Vector2 velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (velocity.X == 0f && velocity.Y == 0f) - { - velocity = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - } - velocity.Normalize(); - velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); - Main.projectile[flames].Calamity().forceRanged = true; - Main.projectile[flames].penetrate = 3; + 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); + if (flames.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[flames].Calamity().forceRanged = true; + Main.projectile[flames].penetrate = 3; + Main.projectile[flames].usesLocalNPCImmunity = false; + Main.projectile[flames].usesIDStaticNPCImmunity = true; + Main.projectile[flames].idStaticNPCHitCooldown = 10; + } } } } diff --git a/Projectiles/Ranged/NapalmArrowProj.png b/Projectiles/Ranged/NapalmArrowProj.png deleted file mode 100644 index 48ef48d4c4..0000000000 Binary files a/Projectiles/Ranged/NapalmArrowProj.png and /dev/null differ diff --git a/Projectiles/Ranged/NeedlerProj.png b/Projectiles/Ranged/NeedlerProj.png index 8a38d483fa..b31911d4da 100644 Binary files a/Projectiles/Ranged/NeedlerProj.png and b/Projectiles/Ranged/NeedlerProj.png differ diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index 7b122cbf95..dee6a914f1 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class NorfleetCannon : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Norfleet"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Norfleet"); @@ -43,21 +45,21 @@ namespace CalamityMod.Projectiles.Ranged case 540: projectile.localAI[0] += 1f; projectile.ai[0] = -1f; - Main.PlaySound(SoundID.Item14, projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + Main.PlaySound(SoundID.Item14, projectile.Center); + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) { - 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, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 0, default, 4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + 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); + Main.dust[index].noGravity = true; + Main.dust[index].velocity = dustVel; } break; } } - int baseUseTime = 75; + int baseUseTime = 75; //Ranges from 75 to 63 use time int modifier = 2; bool timeToFire = false; if (projectile.ai[1] <= 0f) @@ -70,20 +72,19 @@ namespace CalamityMod.Projectiles.Ranged { projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item92, projectile.position); + Main.PlaySound(SoundID.Item92, projectile.Center); } - player.phantasmTime = 2; if (timeToFire && Main.myPlayer == projectile.owner) { if (canFire) { - int type = 12; - float scaleFactor = 30f; + int type = ProjectileID.FallingStar; //Gets changed below anyways + float shootSpeed = 30f; int damage = player.GetWeaponDamage(player.ActiveItem()); float knockBack = player.ActiveItem().knockBack; for (int i = 0; i < 5; i++) { - player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + 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; @@ -94,14 +95,14 @@ namespace CalamityMod.Projectiles.Ranged projectile.velocity.Normalize(); float variation = (1f + projectile.localAI[0]) * 3f; 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 * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); type = ModContent.ProjectileType(); - speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; - speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - speed.X += (float)Main.rand.Next(-30, 31) * 0.05f; - speed.Y += (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + 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); + 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; } } @@ -111,10 +112,10 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); + 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 += 3.14159274f; + projectile.rotation += MathHelper.Pi; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); @@ -124,9 +125,6 @@ namespace CalamityMod.Projectiles.Ranged player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Ranged/NorfleetCannon.png b/Projectiles/Ranged/NorfleetCannon.png deleted file mode 100644 index 64cd96565e..0000000000 Binary files a/Projectiles/Ranged/NorfleetCannon.png and /dev/null differ diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index 39d6e1a5d7..f3161f88a2 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class NorfleetComet : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/GalacticaComet"; + private int noTileHitCounter = 120; public override void SetStaticDefaults() @@ -52,34 +55,30 @@ namespace CalamityMod.Projectiles.Ranged projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - 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) ? 221 : 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; + 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); + 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; } } projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + int alphaLimit = 150; + if (projectile.alpha < alphaLimit) { - num58 = 0; + projectile.alpha = alphaLimit; } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; 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, Main.rand.NextBool(2) ? 221 : 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; + 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; } if (projectile.ai[1] == 1f) { @@ -100,31 +99,30 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner); } - 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); - for (int num193 = 0; num193 < 4; num193++) + Main.PlaySound(SoundID.Item10, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + for (int d = 0; d < 4; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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 num194 = 0; num194 < 20; num194++) + for (int d = 0; d < 20; d++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 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, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + if (projectile.timeLeft >= 600) + return false; + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/NorfleetComet.png b/Projectiles/Ranged/NorfleetComet.png deleted file mode 100644 index a48c0a7b7a..0000000000 Binary files a/Projectiles/Ranged/NorfleetComet.png and /dev/null differ diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index 8451566c53..a10cf5019c 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class NorfleetExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -28,61 +30,15 @@ namespace CalamityMod.Projectiles.Ranged 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); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-120, 121); - float num464 = (float)Main.rand.Next(-120, 121); - float num465 = (float)Main.rand.Next(36, 108); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 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 += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; - } + 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); + Dust dust = Main.dust[idx]; + dust.noGravity = true; + 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/NorfleetExplosion.png b/Projectiles/Ranged/NorfleetExplosion.png deleted file mode 100644 index 3cb685553d..0000000000 Binary files a/Projectiles/Ranged/NorfleetExplosion.png and /dev/null differ diff --git a/Projectiles/Ranged/Nuke.cs b/Projectiles/Ranged/Nuke.cs index 304f24dcad..d2e3acd5b9 100644 --- a/Projectiles/Ranged/Nuke.cs +++ b/Projectiles/Ranged/Nuke.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.width = 22; projectile.height = 22; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 125; projectile.ranged = true; } @@ -86,7 +87,6 @@ namespace CalamityMod.Projectiles.Ranged } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 24f, 20f); } public override void Kill(int timeLeft) @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 5215d220bb..ed961fbbc7 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class NullShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Null"); @@ -20,7 +22,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 120; projectile.ranged = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -60,11 +63,11 @@ namespace CalamityMod.Projectiles.Ranged } else if (nullBuff == 2) { - target.damage += 100; + target.damage += 10; } else if (nullBuff == 3) { - target.damage -= 100; + target.damage -= 10; } else if (nullBuff == 4) { @@ -76,11 +79,11 @@ namespace CalamityMod.Projectiles.Ranged } else if (nullBuff == 6) { - target.defense += 10; + target.defense += 5; } else { - target.defense -= 10; + target.defense -= 5; } } } diff --git a/Projectiles/Ranged/NullShot.png b/Projectiles/Ranged/NullShot.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/NullShot.png and /dev/null differ diff --git a/Projectiles/Ranged/NullShot2.cs b/Projectiles/Ranged/NullShot2.cs index 60a9a3fb42..845c02b29e 100644 --- a/Projectiles/Ranged/NullShot2.cs +++ b/Projectiles/Ranged/NullShot2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class NullShot2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Null"); @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 120; projectile.ranged = true; projectile.extraUpdates = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -61,11 +64,11 @@ namespace CalamityMod.Projectiles.Ranged } else if (nullBuff == 2) { - target.damage += 500; + target.damage += 20; } else if (nullBuff == 3) { - target.damage -= 500; + target.damage -= 20; } else if (nullBuff == 4) { @@ -77,15 +80,15 @@ namespace CalamityMod.Projectiles.Ranged } else if (nullBuff == 6) { - target.defense += 20; + target.defense += 10; } else if (nullBuff == 7) { - target.defense -= 20; + target.defense -= 10; } else if (nullBuff == 8) { - target.velocity.Y = -30f; + target.velocity.Y = Main.rand.NextBool(2) ? 30f : -30f; } else { diff --git a/Projectiles/Ranged/NullShot2.png b/Projectiles/Ranged/NullShot2.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/NullShot2.png and /dev/null differ diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index 7ca7cf2202..f96a4328ab 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -85,8 +85,8 @@ namespace CalamityMod.Projectiles.Ranged 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)((double)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)((double)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 5c8b0efd96..667b806e43 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -16,33 +17,29 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 26; - projectile.height = 26; + 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; + } 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 = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/OpalStrike.png b/Projectiles/Ranged/OpalStrike.png index 7b8bbf5551..e2e53c497a 100644 Binary files a/Projectiles/Ranged/OpalStrike.png and b/Projectiles/Ranged/OpalStrike.png differ diff --git a/Projectiles/Ranged/OrangeExoArrow.cs b/Projectiles/Ranged/OrangeExoArrow.cs index 275bbc4e0a..77407f29f5 100644 --- a/Projectiles/Ranged/OrangeExoArrow.cs +++ b/Projectiles/Ranged/OrangeExoArrow.cs @@ -3,13 +3,16 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class OrangeExoArrow : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Arrow"); + DisplayName.SetDefault("Orange Exo Arrow"); } public override void SetDefaults() @@ -19,10 +22,11 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = 1; - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; projectile.timeLeft = 300; projectile.ranged = true; projectile.arrow = true; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } public override void AI() @@ -55,80 +59,37 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + 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(); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.ExoDebuffs(); - } + public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 188; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 188); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; projectile.Damage(); - Main.PlaySound(SoundID.Item14, projectile.position); - for (int num193 = 0; num193 < 4; num193++) + Main.PlaySound(SoundID.Item14, projectile.Center); + for (int d = 0; d < 4; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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 num194 = 0; num194 < 40; num194++) + for (int d = 0; d < 40; d++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 0, default, 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].noLight = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 50, default, 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - Main.dust[num195].noLight = true; + 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); + Main.dust[orange].velocity *= 2f; + Main.dust[orange].noGravity = true; + Main.dust[orange].noLight = true; } } } diff --git a/Projectiles/Ranged/OrangeExoArrow.png b/Projectiles/Ranged/OrangeExoArrow.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/OrangeExoArrow.png and /dev/null differ diff --git a/Projectiles/Ranged/PhangasmBow.cs b/Projectiles/Ranged/PhangasmBow.cs index 74f2c751e5..e4082745f2 100644 --- a/Projectiles/Ranged/PhangasmBow.cs +++ b/Projectiles/Ranged/PhangasmBow.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PhangasmBow : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Phangasm"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Phangasm"); @@ -32,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true); if (projectile.spriteDirection == -1) { - num = 3.14159274f; + num = MathHelper.Pi; } projectile.ai[0] += 1f; int num39 = 0; @@ -75,7 +77,7 @@ namespace CalamityMod.Projectiles.Ranged player.phantasmTime = 2; if (flag15 && Main.myPlayer == projectile.owner) { - int num42 = 14; + int num42 = ProjectileID.WoodenArrowFriendly; float scaleFactor11 = 14f; int weaponDamage2 = player.GetWeaponDamage(player.ActiveItem()); float weaponKnockback2 = player.ActiveItem().knockBack; @@ -101,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.netUpdate = true; } projectile.velocity = value19 * 0.55f; - for (int num43 = 0; num43 < 10; num43++) + for (int num43 = 0; num43 < 5; num43++) { Vector2 vector20 = Vector2.Normalize(projectile.velocity) * scaleFactor11 * (0.6f + Main.rand.NextFloat() * 0.8f); if (float.IsNaN(vector20.X) || float.IsNaN(vector20.Y)) @@ -109,7 +111,7 @@ namespace CalamityMod.Projectiles.Ranged 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, vector20, num42, weaponDamage2, weaponKnockback2, projectile.owner); Main.projectile[num44].noDropItem = true; } } diff --git a/Projectiles/Ranged/PhangasmBow.png b/Projectiles/Ranged/PhangasmBow.png deleted file mode 100644 index c18ca4431f..0000000000 Binary files a/Projectiles/Ranged/PhangasmBow.png and /dev/null differ diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs index 05416b3556..0d5def5d21 100644 --- a/Projectiles/Ranged/PiercingBullet.cs +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PiercingBullet : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Piercing Blow"); @@ -28,7 +30,8 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.BulletHighVelocity; 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) { @@ -48,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); return true; } diff --git a/Projectiles/Ranged/PiercingBullet.png b/Projectiles/Ranged/PiercingBullet.png deleted file mode 100644 index 3f761a0306..0000000000 Binary files a/Projectiles/Ranged/PiercingBullet.png and /dev/null differ diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 6490b0ae85..dea634e090 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; projectile.timeLeft = 600; aiType = ProjectileID.WoodenArrowFriendly; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void Kill(int timeLeft) { @@ -48,9 +49,12 @@ namespace CalamityMod.Projectiles.Ranged value20 -= value21 * (float)num517; num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; - int num520 = 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, 0f, 0f); - Main.projectile[num520].Calamity().forceRanged = true; - Main.projectile[num520].penetrate = 2; + 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; + Main.projectile[bee].Calamity().forceRanged = true; + } } } } @@ -58,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 3d588dda0c..aad7897bfe 100644 --- a/Projectiles/Ranged/PlagueExplosionFriendly.cs +++ b/Projectiles/Ranged/PlagueExplosionFriendly.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PlagueExplosionFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Ranged/PlagueExplosionFriendly.png b/Projectiles/Ranged/PlagueExplosionFriendly.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Ranged/PlagueExplosionFriendly.png and /dev/null differ diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 60db04bcb7..2d28d1819f 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PlanarRipperBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/ShockGrenadeBolt"; + public static int frameWidth = 12; public static int frameHeight = 26; @@ -30,7 +32,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.aiStyle = 1; aiType = ProjectileID.BulletHighVelocity; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -88,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Ranged/PlanarRipperBolt.png b/Projectiles/Ranged/PlanarRipperBolt.png deleted file mode 100644 index 4852045f46..0000000000 Binary files a/Projectiles/Ranged/PlanarRipperBolt.png and /dev/null differ diff --git a/Projectiles/Ranged/PlanarRipperExplosion.cs b/Projectiles/Ranged/PlanarRipperExplosion.cs index 174bf40692..835ca461c1 100644 --- a/Projectiles/Ranged/PlanarRipperExplosion.cs +++ b/Projectiles/Ranged/PlanarRipperExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PlanarRipperExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -64,7 +66,12 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + 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); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Electrified, 180); } diff --git a/Projectiles/Ranged/PlanarRipperExplosion.png b/Projectiles/Ranged/PlanarRipperExplosion.png deleted file mode 100644 index 54ff224808..0000000000 Binary files a/Projectiles/Ranged/PlanarRipperExplosion.png and /dev/null differ diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs index e7866791d7..2efbf38199 100644 --- a/Projectiles/Ranged/PlanetaryAnnihilationProj.cs +++ b/Projectiles/Ranged/PlanetaryAnnihilationProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PlanetaryAnnihilationProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dustType = 0; public override void SetStaticDefaults() @@ -23,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = 1; projectile.extraUpdates = 1; - projectile.tileCollide = true; projectile.timeLeft = 600; projectile.arrow = true; } @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 18f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/PlanetaryAnnihilationProj.png b/Projectiles/Ranged/PlanetaryAnnihilationProj.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Ranged/PlanetaryAnnihilationProj.png and /dev/null differ diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index bc6f5d6735..9a869cb061 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index eaef416898..23e50e2a8f 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PlasmaExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Ranged/PlasmaExplosion.png b/Projectiles/Ranged/PlasmaExplosion.png deleted file mode 100644 index d0ac21fbc0..0000000000 Binary files a/Projectiles/Ranged/PlasmaExplosion.png and /dev/null differ diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index e315f5bfe0..1a1ad3f71b 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PolarStar : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + private int dust1 = 86; private int dust2 = 91; @@ -44,17 +46,17 @@ namespace CalamityMod.Projectiles.Ranged } else { - for (int num41 = 0; num41 < 2; num41++) + for (int d = 0; d < 2; d++) { - int dustType = num41 == 0 ? dust1 : dust2; + int dustType = d == 0 ? dust1 : dust2; Vector2 value8 = Vector2.UnitX * -12f; - value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + 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(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 0.8f); + 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; } @@ -62,7 +64,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[1] == 2f) //Boost three { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 14f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } else if (projectile.ai[1] == 1f) //Boost two { @@ -124,55 +126,17 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + 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) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) + if ((target.damage > 5 || target.boss) && projectile.owner == Main.myPlayer && !target.SpawnedFromStatue) { player.AddBuff(ModContent.BuffType(), 180); } - else - { - return; - } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -199,11 +163,7 @@ namespace CalamityMod.Projectiles.Ranged } if (projectile.ai[1] == 2f) //Boost three { - int height = 150; - - projectile.position = projectile.Center; - projectile.width = projectile.height = height; - projectile.Center = projectile.position; + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 150); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -211,21 +171,21 @@ namespace CalamityMod.Projectiles.Ranged projectile.damage /= 2; projectile.Damage(); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) // 108 dusts + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) // 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)) * MathHelper.TwoPi / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - 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 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; + 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; - int num229 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, vector7.X * 0.2f, vector7.Y * 0.2f, 100, default, 2f); - Main.dust[num229].noGravity = true; + int j = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, dustVel.X * 0.2f, dustVel.Y * 0.2f, 100, default, 2f); + Main.dust[j].noGravity = true; - int num230 = Dust.NewDust(vector6 + vector7, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, vector7.X * 0.1f, vector7.Y * 0.1f, 100, default, 2f); - Main.dust[num230].noGravity = true; + int k = Dust.NewDust(source + dustVel, 0, 0, Main.rand.NextBool(2) ? dust1 : dust2, dustVel.X * 0.1f, dustVel.Y * 0.1f, 100, default, 2f); + Main.dust[k].noGravity = true; } bool random = Main.rand.NextBool(); diff --git a/Projectiles/Ranged/PolarStar.png b/Projectiles/Ranged/PolarStar.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/PolarStar.png and /dev/null differ diff --git a/Projectiles/Ranged/PrismComet.cs b/Projectiles/Ranged/PrismComet.cs new file mode 100644 index 0000000000..5fc4a36842 --- /dev/null +++ b/Projectiles/Ranged/PrismComet.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PrismComet : ModProjectile + { + 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; + } + + public override void SetDefaults() + { + projectile.scale = 0.86f; + projectile.width = projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.melee = true; + 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]; + + projectile.alpha = Utils.Clamp(projectile.alpha - 25, 30, 255); + + if (projectile.alpha < 40) + ReleaseIdleDust(); + + // Home onto any targets after a short amount of time. + if (Time >= 25f) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1050f); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 12f + projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 13f; + } + else + projectile.velocity *= 1.05f; + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + Time++; + } + public void ReleaseIdleDust() + { + 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); + prismEnergy.velocity *= -0.25f; + 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.velocity *= -0.25f; + 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); + return false; + } + + public override Color? GetAlpha(Color lightColor) + { + 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(); + + if (Main.myPlayer != projectile.owner) + return; + + 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 new file mode 100644 index 0000000000..cf1920bd67 --- /dev/null +++ b/Projectiles/Ranged/PrismEnergyBullet.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +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 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; + } + + public override void AI() + { + 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) + 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); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = Main.projectileTexture[projectile.type]; + Vector2 origin = texture.Size() * 0.5f; + 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; + 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); + } + return false; + } + } +} diff --git a/Projectiles/Ranged/PrismExplosionLarge.cs b/Projectiles/Ranged/PrismExplosionLarge.cs new file mode 100644 index 0000000000..c79abef3d0 --- /dev/null +++ b/Projectiles/Ranged/PrismExplosionLarge.cs @@ -0,0 +1,60 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PrismExplosionLarge : ModProjectile + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Explosion"); + + 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; + } + + public override void AI() + { + 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); + } + + 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; + 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, Items.CalamityGlobalItem.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(texture, drawPosition, frame, Color.White, 0f, origin, 1.6f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Ranged/PrismExplosionLarge.png b/Projectiles/Ranged/PrismExplosionLarge.png new file mode 100644 index 0000000000..3bbf34853c Binary files /dev/null and b/Projectiles/Ranged/PrismExplosionLarge.png differ diff --git a/Projectiles/Ranged/PrismExplosionSmall.cs b/Projectiles/Ranged/PrismExplosionSmall.cs new file mode 100644 index 0000000000..d1398625c0 --- /dev/null +++ b/Projectiles/Ranged/PrismExplosionSmall.cs @@ -0,0 +1,56 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PrismExplosionSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + 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; + } + + public override void AI() + { + 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); + } + + 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; + Vector2 origin = frame.Size() * 0.5f; + + spriteBatch.Draw(texture, drawPosition, frame, Color.White, 0f, origin, 1f, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Ranged/PrismExplosionSmall.png b/Projectiles/Ranged/PrismExplosionSmall.png new file mode 100644 index 0000000000..b4c5a29207 Binary files /dev/null and b/Projectiles/Ranged/PrismExplosionSmall.png differ diff --git a/Projectiles/Ranged/PrismMine.cs b/Projectiles/Ranged/PrismMine.cs new file mode 100644 index 0000000000..6dd01e07dc --- /dev/null +++ b/Projectiles/Ranged/PrismMine.cs @@ -0,0 +1,124 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PrismMine : ModProjectile + { + public List MinesToConnectTo = new List(); + 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; + } + + public override void AI() + { + 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)); + Time++; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + foreach (Projectile mine in LocateOtherMines()) + { + if (projectile.timeLeft <= 12) + break; + + float _ = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, mine.Center, 20f, ref _)) + return true; + } + return base.Colliding(projHitbox, targetHitbox); + } + + 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); + + // 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) + damageFactor = DamageFactorLowerBound; + + damage = (int)(damage * damageFactor); + } + + public List LocateOtherMines() + { + List mines = new List(); + 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) + continue; + if (!projectile.WithinRange(proj.Center, MineConnectDistanceMax)) + continue; + + mines.Add(proj); + } + + return mines; + } + + 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"); + + void drawLineTo(Vector2 destination, Color laserColor) + { + 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); + Vector2 laserOrigin = frame.Size() * 0.5f; + while (remainingDistance > frame.Height * laserScale) + { + 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; + + foreach (Projectile mine in LocateOtherMines()) + { + 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); + + 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); + return false; + } + } +} diff --git a/Projectiles/Ranged/PrismMine.png b/Projectiles/Ranged/PrismMine.png new file mode 100644 index 0000000000..f6e0b4a1e3 Binary files /dev/null and b/Projectiles/Ranged/PrismMine.png differ diff --git a/Projectiles/Ranged/PrismMineArc.png b/Projectiles/Ranged/PrismMineArc.png new file mode 100644 index 0000000000..5fa9c7b1b4 Binary files /dev/null and b/Projectiles/Ranged/PrismMineArc.png differ diff --git a/Projectiles/Ranged/PrismMineGlowmask.png b/Projectiles/Ranged/PrismMineGlowmask.png new file mode 100644 index 0000000000..bec3e59194 Binary files /dev/null and b/Projectiles/Ranged/PrismMineGlowmask.png differ diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.cs b/Projectiles/Ranged/PrismaticEnergyBlast.cs new file mode 100644 index 0000000000..ee55885a43 --- /dev/null +++ b/Projectiles/Ranged/PrismaticEnergyBlast.cs @@ -0,0 +1,147 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class PrismaticEnergyBlast : BaseLaserbeamProjectile + { + public bool ExplodedYet + { + get => projectile.ai[1] == 1f; + set => projectile.ai[1] = value.ToInt(); + } + public override string Texture => "CalamityMod/ExtraTextures/Lasers/PrismLaserStart"; + public override float MaxScale => 1f; + public override float MaxLaserLength => 2700f; + 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 void SetStaticDefaults() + { + DisplayName.SetDefault("Energy Blast"); + 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; + } + + public override bool PreAI() + { + projectile.frameCounter++; + if (projectile.frameCounter % 5 == 4) + projectile.frame++; + + Vector2 laserEnd = projectile.position + projectile.velocity * LaserLength; + if (Collision.SolidCollision(laserEnd, 84, 84)) + CreateExplosion(laserEnd + projectile.Size * 0.5f); + return true; + } + + public void CreateExplosion(Vector2 laserEnd) + { + if (Main.myPlayer != projectile.owner || ExplodedYet || LaserLength <= 60f) + return; + + Projectile.NewProjectile(laserEnd, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); + + if (!ExplodedYet) + { + ExplodedYet = true; + projectile.netUpdate = true; + } + } + + public override float DetermineLaserLength() + { + if (projectile.penetrate == 100) + return DetermineLaserLength_CollideWithTiles(8); + return LaserLength; + } + + public override bool CanDamage() => projectile.penetrate == 100; + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + LaserLength = projectile.Distance(target.Center); + CreateExplosion(target.Center); + } + + public override void Kill(int timeLeft) + { + 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); + spriteBatch.Draw(LaserBeginTexture, + projectile.Center - Main.screenPosition, + beginFrame, + Color.White, + projectile.rotation, + beginFrame.Size() / 2f, + 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; + + // Body drawing. + 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 incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + middleFrame, + Color.White, + projectile.rotation, + middleFrame.Width * 0.5f * Vector2.UnitX, + projectile.scale, + SpriteEffects.None, + 0f); + incrementalBodyLength += laserOffset; + centerOnLaser += projectile.velocity * laserOffset; + } + } + + // End texture drawing. + 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, + endFrame.Size() * new Vector2(0.5f, 0f), + projectile.scale, + SpriteEffects.None, + 0f); + return false; + } + } +} diff --git a/Projectiles/Ranged/PrismaticEnergyBlast.png b/Projectiles/Ranged/PrismaticEnergyBlast.png new file mode 100644 index 0000000000..8e2d2a871c Binary files /dev/null and b/Projectiles/Ranged/PrismaticEnergyBlast.png differ diff --git a/Projectiles/Ranged/PristineFire.cs b/Projectiles/Ranged/PristineFire.cs index ec9083f3be..98dbe7a863 100644 --- a/Projectiles/Ranged/PristineFire.cs +++ b/Projectiles/Ranged/PristineFire.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PristineFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust1 = (int)CalamityDusts.ProfanedFire; private int dust2 = ModContent.DustType(); diff --git a/Projectiles/Ranged/PristineFire.png b/Projectiles/Ranged/PristineFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/PristineFire.png and /dev/null differ diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index c282d27679..93d9bd7198 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class PristineSecondary : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private int dust1 = (int)CalamityDusts.ProfanedFire; private int dust2 = ModContent.DustType(); diff --git a/Projectiles/Ranged/PristineSecondary.png b/Projectiles/Ranged/PristineSecondary.png deleted file mode 100644 index 80da916522..0000000000 Binary files a/Projectiles/Ranged/PristineSecondary.png and /dev/null differ diff --git a/Projectiles/Ranged/ProBolt.cs b/Projectiles/Ranged/ProBolt.cs index 66d9929bad..933ca2cb8c 100644 --- a/Projectiles/Ranged/ProBolt.cs +++ b/Projectiles/Ranged/ProBolt.cs @@ -1,6 +1,9 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class ProBolt : ModProjectile @@ -8,17 +11,20 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 3; projectile.timeLeft = 600; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -27,21 +33,29 @@ namespace CalamityMod.Projectiles.Ranged 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)); - for (int num134 = 0; num134 < 6; num134++) - { - Vector2 dspeed = -projectile.velocity * 0.8f; - float x = projectile.Center.X - projectile.velocity.X / 10f * (float)num134; - float y = projectile.Center.Y - projectile.velocity.Y / 10f * (float)num134; - 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].position.X = x; - Main.dust[num135].position.Y = y; - Main.dust[num135].velocity = dspeed; - Main.dust[num135].noGravity = true; - } + + 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; + 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].position.X = x; + Main.dust[num135].position.Y = y; + Main.dust[num135].velocity = dspeed; + Main.dust[num135].noGravity = true; + } } - public override bool OnTileCollide(Vector2 oldVelocity) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; if (projectile.penetrate <= 0) @@ -50,7 +64,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/RainbowBlast.cs b/Projectiles/Ranged/RainbowBlast.cs index 40350fe446..a73b369265 100644 --- a/Projectiles/Ranged/RainbowBlast.cs +++ b/Projectiles/Ranged/RainbowBlast.cs @@ -44,13 +44,13 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num469].velocity = dspeed; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 18f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/RainbowTrail.cs b/Projectiles/Ranged/RainbowTrail.cs index c9bb76baa7..7ccdfbafdf 100644 --- a/Projectiles/Ranged/RainbowTrail.cs +++ b/Projectiles/Ranged/RainbowTrail.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Ranged { public class RainbowTrail : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/RainbowFront"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Rainbow"); @@ -16,7 +18,7 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 46; projectile.friendly = true; projectile.penetrate = -1; - projectile.magic = true; + projectile.ranged = true; projectile.alpha = 255; projectile.light = 0.3f; projectile.tileCollide = false; diff --git a/Projectiles/Ranged/RainbowTrail.png b/Projectiles/Ranged/RainbowTrail.png deleted file mode 100644 index 6900303ebd..0000000000 Binary files a/Projectiles/Ranged/RainbowTrail.png and /dev/null differ diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index ba81aca67d..45466c59a7 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class RealmRavagerBullet : ModProjectile @@ -9,7 +11,9 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Explosive Bullet"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { @@ -24,27 +28,31 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 90; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } - public override void Kill(int timeLeft) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + 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); - for (int num193 = 0; num193 < 2; num193++) + Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); + for (int d = 0; d < 2; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int d = 0; d < 20; d++) { - 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); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } projectile.maxPenetrate = -1; projectile.penetrate = -1; diff --git a/Projectiles/Ranged/RubberMortarRoundProj.cs b/Projectiles/Ranged/RubberMortarRoundProj.cs index ff38403a00..444acabe82 100644 --- a/Projectiles/Ranged/RubberMortarRoundProj.cs +++ b/Projectiles/Ranged/RubberMortarRoundProj.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Ranged { public class RubberMortarRoundProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/RubberMortarRound"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); diff --git a/Projectiles/Ranged/RubberMortarRoundProj.png b/Projectiles/Ranged/RubberMortarRoundProj.png deleted file mode 100644 index b8057deb9e..0000000000 Binary files a/Projectiles/Ranged/RubberMortarRoundProj.png and /dev/null differ diff --git a/Projectiles/Ranged/SandWater.cs b/Projectiles/Ranged/SandWater.cs index 07429f0c36..d9ab2316b3 100644 --- a/Projectiles/Ranged/SandWater.cs +++ b/Projectiles/Ranged/SandWater.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SandWater : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Water"); diff --git a/Projectiles/Ranged/SandWater.png b/Projectiles/Ranged/SandWater.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/SandWater.png and /dev/null differ diff --git a/Projectiles/Ranged/SandstormBullet.cs b/Projectiles/Ranged/SandstormBullet.cs index 8deefb9cf3..cd29b7fbd2 100644 --- a/Projectiles/Ranged/SandstormBullet.cs +++ b/Projectiles/Ranged/SandstormBullet.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SandstormBullet : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/SandBlast"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sandstorm"); @@ -27,7 +29,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.extraUpdates = 1; projectile.aiStyle = 1; projectile.alpha = 255; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -74,15 +77,12 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (!target.boss) - { - target.velocity.X *= 0.5f; - target.velocity.Y *= 0.5f; - } + target.velocity *= 0.5f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SandstormBullet.png b/Projectiles/Ranged/SandstormBullet.png deleted file mode 100644 index 2392a80f7b..0000000000 Binary files a/Projectiles/Ranged/SandstormBullet.png and /dev/null differ diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index cb3eb1c217..33c2e01724 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -25,31 +25,15 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 240; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 210 && target.CanBeChasedBy(projectile); + + 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) - { - 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; - } - if (projectile.ai[0] < 0f) - { - if (projectile.velocity.Length() < 18f) - { - projectile.velocity *= 1.05f; - } - } 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; + projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -57,20 +41,22 @@ namespace CalamityMod.Projectiles.Ranged projectile.frameCounter = 0; } if (projectile.frame > 7) - { projectile.frame = 0; - } + if (projectile.velocity.X < 0f) { projectile.spriteDirection = -1; - projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(-projectile.velocity.Y, -projectile.velocity.X); } else { projectile.spriteDirection = 1; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X); } - } + + if (projectile.timeLeft < 210) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { diff --git a/Projectiles/Ranged/SeaDragonRocket.cs b/Projectiles/Ranged/SeaDragonRocket.cs index 757e5a6ad8..4e3592c4c7 100644 --- a/Projectiles/Ranged/SeaDragonRocket.cs +++ b/Projectiles/Ranged/SeaDragonRocket.cs @@ -77,15 +77,12 @@ namespace CalamityMod.Projectiles.Ranged } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 24f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 192); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -122,9 +119,12 @@ namespace CalamityMod.Projectiles.Ranged } velocity.Normalize(); velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner, 0f, 0f); - Main.projectile[flames].Calamity().forceRanged = true; - Main.projectile[flames].penetrate = 3; + int flames = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33), 0f, projectile.owner); + if (flames.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[flames].penetrate = 3; + Main.projectile[flames].Calamity().forceRanged = true; + } } } } diff --git a/Projectiles/Ranged/SeasSearingBubble.cs b/Projectiles/Ranged/SeasSearingBubble.cs index 56554d93b7..37ab014921 100644 --- a/Projectiles/Ranged/SeasSearingBubble.cs +++ b/Projectiles/Ranged/SeasSearingBubble.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SeasSearingSecondary.cs b/Projectiles/Ranged/SeasSearingSecondary.cs index cbcf0bfa8d..3a2c79fd6d 100644 --- a/Projectiles/Ranged/SeasSearingSecondary.cs +++ b/Projectiles/Ranged/SeasSearingSecondary.cs @@ -3,11 +3,14 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { public class SeasSearingSecondary : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hydroshower"); @@ -60,7 +63,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(BuffID.Frostburn, 360); target.AddBuff(ModContent.BuffType(), 360); } } diff --git a/Projectiles/Ranged/SeasSearingSecondary.png b/Projectiles/Ranged/SeasSearingSecondary.png deleted file mode 100644 index 4a5f92eb8f..0000000000 Binary files a/Projectiles/Ranged/SeasSearingSecondary.png and /dev/null differ diff --git a/Projectiles/Ranged/SepticSkewerBacteria.cs b/Projectiles/Ranged/SepticSkewerBacteria.cs index 5090c199c1..bbe41f7b58 100644 --- a/Projectiles/Ranged/SepticSkewerBacteria.cs +++ b/Projectiles/Ranged/SepticSkewerBacteria.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SepticSkewerBacteria : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bacteria"); diff --git a/Projectiles/Ranged/SepticSkewerBacteria.png b/Projectiles/Ranged/SepticSkewerBacteria.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/SepticSkewerBacteria.png and /dev/null differ diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index 3112b9b18d..2d1471cfae 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -19,12 +19,14 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.penetrate = -1; projectile.alpha = 255; - projectile.ranged = true; + projectile.ignoreWater = true; + projectile.ranged = true; projectile.extraUpdates = 1; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; projectile.timeLeft = 900; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -39,13 +41,13 @@ namespace CalamityMod.Projectiles.Ranged { projectile.alpha = 0; } - if ((int)projectile.ai[1] % 4 == 0 && 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 *= (float)Main.rand.Next(45, 65) * 0.1f; - vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * MathHelper.PiOver2, default); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.4), projectile.knockBack * 0.2f, projectile.owner, -10f, 0f); + 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); } if (player.dead) { diff --git a/Projectiles/Ranged/ShadeFire.cs b/Projectiles/Ranged/ShadeFire.cs index 718f73f24e..2817333c6c 100644 --- a/Projectiles/Ranged/ShadeFire.cs +++ b/Projectiles/Ranged/ShadeFire.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ShadeFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Ranged/ShadeFire.png b/Projectiles/Ranged/ShadeFire.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Ranged/ShadeFire.png and /dev/null differ diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index bc8b666b4a..acccef7873 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -15,18 +15,19 @@ namespace CalamityMod.Projectiles.Ranged { projectile.width = 34; projectile.height = 18; - projectile.friendly = true; + 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; + } public override void AI() { - projectile.velocity.X *= 0.9995f; - projectile.velocity.Y *= 0.9995f; + projectile.velocity *= 0.9995f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/Shockblast.cs b/Projectiles/Ranged/Shockblast.cs index 047957c048..1ac0485097 100644 --- a/Projectiles/Ranged/Shockblast.cs +++ b/Projectiles/Ranged/Shockblast.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class Shockblast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); @@ -27,29 +29,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.025f / 255f, (255 - projectile.alpha) * 0.25f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } + Lighting.AddLight(projectile.Center, 0f, 0f, 0.25f); float num461 = 25f; if (projectile.ai[0] > 180f) { @@ -63,22 +43,24 @@ namespace CalamityMod.Projectiles.Ranged num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + 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; + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default, 1f); + 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 += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.position.X += Main.rand.Next(-10, 11); + dust.position.Y += Main.rand.Next(-10, 11); dust.velocity.X = num463; dust.velocity.Y = num464; num462++; diff --git a/Projectiles/Ranged/Shockblast.png b/Projectiles/Ranged/Shockblast.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Ranged/Shockblast.png and /dev/null differ diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index ff994af960..535c115982 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -29,77 +29,73 @@ namespace CalamityMod.Projectiles.Ranged projectile.light = 0.5f; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); + 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; + } return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } - public override void AI() - { - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - projectile.damage = (int)(projectile.damage * 0.995); - projectile.knockBack = projectile.knockBack * 0.995f; - } - } - 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; - 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 * (float)num136; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f * (float)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].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]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - } + 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; + 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].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity = dspeed; + Main.dust[num137].noGravity = true; + } + } + return false; } 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(), projectile.damage, 0f, projectile.owner, 0f, 0f); - } - if (target.type == NPCID.TargetDummy || Main.player[projectile.owner].moonLeech) - { + 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; + } + + if (Main.player[projectile.owner].moonLeech) return; - } - float healAmt = (float)damage * 0.05f; + + float healAmt = damage * 0.05f; if ((int)healAmt == 0) - { return; - } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { return; - } - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1.5f); + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + 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 a74d61b961..af7968804e 100644 --- a/Projectiles/Ranged/Shroom.cs +++ b/Projectiles/Ranged/Shroom.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged { Lighting.AddLight(projectile.Center, 0f, 0.2f, 0.6f); projectile.rotation += 1f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 25f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 5342d88783..d1a7362ee0 100644 --- a/Projectiles/Ranged/Sickness.cs +++ b/Projectiles/Ranged/Sickness.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class Sickness : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sickness"); diff --git a/Projectiles/Ranged/Sickness.png b/Projectiles/Ranged/Sickness.png deleted file mode 100644 index 54ff224808..0000000000 Binary files a/Projectiles/Ranged/Sickness.png and /dev/null differ diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index eb3d9e3d17..5a760a16d5 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -18,44 +18,41 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + 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 = 1; + projectile.extraUpdates = 2; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override bool PreAI() { - for (int num136 = 0; num136 < 3; num136++) - { - Vector2 dspeed = -projectile.velocity * 0.5f; - float x2 = projectile.Center.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.Center.Y - projectile.velocity.Y / 10f * (float)num136; - 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].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]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - } + 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; + 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].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; @@ -78,8 +75,8 @@ namespace CalamityMod.Projectiles.Ranged 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, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)((double)projectile.damage * 0.5), (float)(int)((double)projectile.knockBack * 0.5), Main.myPlayer, 0f, 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.5f, Main.myPlayer); } } } diff --git a/Projectiles/Ranged/SicknessRound2.cs b/Projectiles/Ranged/SicknessRound2.cs index 65ec72388a..dd5bf6b1e4 100644 --- a/Projectiles/Ranged/SicknessRound2.cs +++ b/Projectiles/Ranged/SicknessRound2.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -30,9 +30,11 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.WoodenArrowFriendly; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -47,18 +49,15 @@ namespace CalamityMod.Projectiles.Ranged 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]; - if (num139 == 0f) - { - projectile.localAI[0] = num138; - } + //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.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * projectile.direction; - return false; + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 25f); + + return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -71,9 +70,7 @@ namespace CalamityMod.Projectiles.Ranged public override void Kill(int timeLeft) { 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, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } } } diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index 92f5458091..fa82eeda44 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -1,9 +1,11 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class SlagRound : ModProjectile @@ -11,35 +13,42 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); - } + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; + projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 2f) - { - 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, 32, 0f, 0f, 100, default, 1.3f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity = dspeed; - } - } + 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); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity = dspeed; + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); } @@ -60,8 +69,8 @@ namespace CalamityMod.Projectiles.Ranged 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)((double)projectile.damage * 0.35f), 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)((double)projectile.damage * 0.35f), 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/SlashRound.cs b/Projectiles/Ranged/SlashRound.cs index c95c64aa1f..e10e810451 100644 --- a/Projectiles/Ranged/SlashRound.cs +++ b/Projectiles/Ranged/SlashRound.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SlashRound : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/AMRShot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Ranged/SlashRound.png b/Projectiles/Ranged/SlashRound.png deleted file mode 100644 index 3f761a0306..0000000000 Binary files a/Projectiles/Ranged/SlashRound.png and /dev/null differ diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index e28d39bc95..df82641be0 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Ranged/SmallCoral.cs b/Projectiles/Ranged/SmallCoral.cs index 0f66c294f1..f8350d0b1b 100644 --- a/Projectiles/Ranged/SmallCoral.cs +++ b/Projectiles/Ranged/SmallCoral.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.penetrate = 1; projectile.aiStyle = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index 97f9a05507..428690e613 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SparkSpreaderFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Ranged/SparkSpreaderFire.png b/Projectiles/Ranged/SparkSpreaderFire.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/SparkSpreaderFire.png and /dev/null differ diff --git a/Projectiles/Ranged/SporeBomb.cs b/Projectiles/Ranged/SporeBomb.cs index c05d251d6a..e31407c09b 100644 --- a/Projectiles/Ranged/SporeBomb.cs +++ b/Projectiles/Ranged/SporeBomb.cs @@ -85,17 +85,20 @@ namespace CalamityMod.Projectiles.Ranged 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, 0f, 0f); - Main.projectile[proj].Calamity().forceRanged = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 30; + 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; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 30; + } } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/SporeBomb.png b/Projectiles/Ranged/SporeBomb.png index 2c89e060cf..bd6fe298a4 100644 Binary files a/Projectiles/Ranged/SporeBomb.png and b/Projectiles/Ranged/SporeBomb.png differ diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index 5e04f0dc13..9e173eb246 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 28ddd0cf2f..9f1fd535d1 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -48,12 +48,12 @@ namespace CalamityMod.Projectiles.Ranged Main.PlaySound(SoundID.Item9, projectile.position); } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 150f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/SpykerProj.cs b/Projectiles/Ranged/SpykerProj.cs index 9abaee61b8..c483466e74 100644 --- a/Projectiles/Ranged/SpykerProj.cs +++ b/Projectiles/Ranged/SpykerProj.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -66,13 +66,12 @@ namespace CalamityMod.Projectiles.Ranged 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 projAmt = Main.rand.Next(3, 6); if (projectile.owner == Main.myPlayer) { - for (int p = 0; p < projAmt; p++) + 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.65), 0f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, projectile.owner); } } for (int num621 = 0; num621 < 3; num621++) diff --git a/Projectiles/Ranged/SpykerProj.png b/Projectiles/Ranged/SpykerProj.png index e2368dcfcd..f63a755ede 100644 Binary files a/Projectiles/Ranged/SpykerProj.png and b/Projectiles/Ranged/SpykerProj.png differ diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index 388ff54128..81183bda4e 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Ranged { public class StarfleetMK2Gun : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/StarfleetMK2"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Starmada"); @@ -46,21 +48,21 @@ namespace CalamityMod.Projectiles.Ranged case 540: projectile.localAI[0] += 1f; projectile.ai[0] = -1f; - Main.PlaySound(SoundID.Item14, projectile.position); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + Main.PlaySound(SoundID.Item14, projectile.Center); + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) { - 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, 221, 0f, 0f, 0, default, 4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; + 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); + Main.dust[index].noGravity = true; + Main.dust[index].velocity = dustVel; } break; } } - int baseUseTime = 27; + int baseUseTime = 27; //Ranges from 27 to 15 use time int modifier = 2; bool timeToFire = false; if (projectile.ai[1] <= 0f) @@ -73,18 +75,17 @@ namespace CalamityMod.Projectiles.Ranged { projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item92, projectile.position); + Main.PlaySound(SoundID.Item92, projectile.Center); } - player.phantasmTime = 2; if (timeToFire && Main.myPlayer == projectile.owner) { if (canFire) { int type = ModContent.ProjectileType(); - float scaleFactor = 16f; + float shootSpeed = 16f; int damage = player.GetWeaponDamage(player.ActiveItem()); float knockBack = player.ActiveItem().knockBack; - player.PickAmmo(player.ActiveItem(), ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + player.PickAmmo(player.ActiveItem(), ref type, ref shootSpeed, ref canFire, ref damage, ref knockBack, false); for (int i = 0; i < 5; i++) { knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); @@ -97,29 +98,23 @@ namespace CalamityMod.Projectiles.Ranged projectile.velocity.Normalize(); float variation = (1f + projectile.localAI[0]) * 3f; Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); - switch (Main.rand.Next(5)) - { - case 0: - type = ModContent.ProjectileType(); - break; - case 1: - type = ModContent.ProjectileType(); - break; - case 2: - type = ModContent.ProjectileType(); - break; - case 3: //falling star projectile - break; - case 4: //starfury projectile - type = ProjectileID.Starfury; - break; - } - int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - Main.projectile[star].penetrate = 1; - Main.projectile[star].timeLeft = 300; - Main.projectile[star].Calamity().forceRanged = true; - Main.projectile[star].netUpdate = true; + Vector2 speed = projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); + type = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ProjectileID.Starfury + }); + int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner); + if (star.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[star].penetrate = 1; + Main.projectile[star].timeLeft = 300; + Main.projectile[star].Calamity().forceRanged = true; + Main.projectile[star].netUpdate = true; + } projectile.netUpdate = true; } } @@ -129,10 +124,10 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); + 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 += 3.14159274f; + projectile.rotation += MathHelper.Pi; projectile.spriteDirection = projectile.direction; projectile.timeLeft = 2; player.ChangeDir(projectile.direction); @@ -142,9 +137,6 @@ namespace CalamityMod.Projectiles.Ranged player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Ranged/StarfleetMK2Gun.png b/Projectiles/Ranged/StarfleetMK2Gun.png deleted file mode 100644 index 3cef0ffadf..0000000000 Binary files a/Projectiles/Ranged/StarfleetMK2Gun.png and /dev/null differ diff --git a/Projectiles/Ranged/SulphuricAcidBubble2.cs b/Projectiles/Ranged/SulphuricAcidBubble2.cs index 3ceba84047..a672ac40f1 100644 --- a/Projectiles/Ranged/SulphuricAcidBubble2.cs +++ b/Projectiles/Ranged/SulphuricAcidBubble2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SulphuricAcidBubble2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; + public float counter = 0f; public float counter2 = 0f; public int killCounter = 0; diff --git a/Projectiles/Ranged/SulphuricAcidBubble2.png b/Projectiles/Ranged/SulphuricAcidBubble2.png deleted file mode 100644 index 3bb08e0246..0000000000 Binary files a/Projectiles/Ranged/SulphuricAcidBubble2.png and /dev/null differ diff --git a/Projectiles/Ranged/SulphuricAcidMist2.cs b/Projectiles/Ranged/SulphuricAcidMist2.cs index 9b0c7f2348..9d88d7ec00 100644 --- a/Projectiles/Ranged/SulphuricAcidMist2.cs +++ b/Projectiles/Ranged/SulphuricAcidMist2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class SulphuricAcidMist2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidMist"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Mist"); diff --git a/Projectiles/Ranged/SulphuricAcidMist2.png b/Projectiles/Ranged/SulphuricAcidMist2.png deleted file mode 100644 index 7d12c2559f..0000000000 Binary files a/Projectiles/Ranged/SulphuricAcidMist2.png and /dev/null differ diff --git a/Projectiles/Ranged/SuperballBulletProj.cs b/Projectiles/Ranged/SuperballBulletProj.cs index d46834f706..51d6be2175 100644 --- a/Projectiles/Ranged/SuperballBulletProj.cs +++ b/Projectiles/Ranged/SuperballBulletProj.cs @@ -10,15 +10,15 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Superball Bullet"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -26,17 +26,22 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - 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; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + 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; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } + } } public override bool OnTileCollide(Vector2 oldVelocity) @@ -48,16 +53,14 @@ namespace CalamityMod.Projectiles.Ranged } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) - { projectile.velocity.X = -oldVelocity.X; - } if (projectile.velocity.Y != oldVelocity.Y) - { projectile.velocity.Y = -oldVelocity.Y; - } - projectile.velocity *= 1.5f; + + if (projectile.extraUpdates < 5) + projectile.extraUpdates++; + Main.PlaySound(SoundID.Item10, projectile.position); } return false; @@ -65,7 +68,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); return false; } diff --git a/Projectiles/Ranged/SurgeDriverHoldout.cs b/Projectiles/Ranged/SurgeDriverHoldout.cs new file mode 100644 index 0000000000..0031b41ef4 --- /dev/null +++ b/Projectiles/Ranged/SurgeDriverHoldout.cs @@ -0,0 +1,100 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SurgeDriverHoldout : ModProjectile + { + 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 override void SetStaticDefaults() => DisplayName.SetDefault("Storm 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; + } + + public override void AI() + { + if (!OwnerCanShoot) + projectile.Kill(); + + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + armPosition += projectile.velocity.SafeNormalize(Owner.direction * Vector2.UnitX) * 32f; + armPosition.Y -= 12f; + + UpdateProjectileHeldVariables(armPosition); + ManipulatePlayerVariables(); + + ShootCountdown--; + if (ShootCountdown <= 0f) + { + if (Main.myPlayer == projectile.owner) + { + ShootProjectiles(armPosition); + ShootCountdown = 28f; + projectile.netUpdate = true; + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), projectile.Center); + } + } + + public void ShootProjectiles(Vector2 armPosition) + { + if (Main.myPlayer != projectile.owner) + return; + + Item heldItem = Owner.ActiveItem(); + int projectileType = ModContent.ProjectileType(); + float shootSpeed = heldItem.shootSpeed * projectile.scale * 0.64f; + int damage = (int)(Owner.GetWeaponDamage(heldItem) * 6.66); + float knockback = heldItem.knockBack; + + bool uselessFuckYou = OwnerCanShoot; + Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref damage, ref knockback, false); + projectileType = ModContent.ProjectileType(); + + knockback = Owner.GetWeaponKnockback(heldItem, knockback); + 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; + + Vector2 gunTip = armPosition + shootDirection * heldItem.scale * 130f; + Projectile.NewProjectile(gunTip, shootVelocity, projectileType, damage, knockback, projectile.owner, 0f, 0f); + + 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; + } + + public void ManipulatePlayerVariables() + { + Owner.ChangeDir(projectile.direction); + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + } +} diff --git a/Projectiles/Ranged/SurgeDriverHoldout.png b/Projectiles/Ranged/SurgeDriverHoldout.png new file mode 100644 index 0000000000..1d943243d5 Binary files /dev/null and b/Projectiles/Ranged/SurgeDriverHoldout.png differ diff --git a/Projectiles/Ranged/TealExoArrow.cs b/Projectiles/Ranged/TealExoArrow.cs index 0704497d31..8f7f2b288b 100644 --- a/Projectiles/Ranged/TealExoArrow.cs +++ b/Projectiles/Ranged/TealExoArrow.cs @@ -1,15 +1,17 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Ranged { public class TealExoArrow : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Arrow"); + DisplayName.SetDefault("Teal Exo Arrow"); } public override void SetDefaults() @@ -19,90 +21,44 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.extraUpdates = 2; + projectile.extraUpdates = 3; projectile.timeLeft = 300; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + 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; - } + float num55 = 40f; float num56 = 1.5f; if (projectile.ai[1] == 0f) { 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(); - } } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.ExoDebuffs(); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.ExoDebuffs(); - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.ExoDebuffs(); - } + public override void OnHitPvp(Player target, int damage, bool crit) => target.ExoDebuffs(); - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); } } diff --git a/Projectiles/Ranged/TealExoArrow.png b/Projectiles/Ranged/TealExoArrow.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/TealExoArrow.png and /dev/null differ diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs new file mode 100644 index 0000000000..f7a3b32874 --- /dev/null +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -0,0 +1,136 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class TelluricGlareArrow : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public PrimitiveTrail TrailDrawer = null; + private const int Lifetime = 180; + private static Color ShaderColorOne = new Color(237, 194, 66); + private static Color ShaderColorTwo = new Color(235, 227, 117); + private static Color ShaderEndColor = new Color(199, 153, 26); + + public override void SetStaticDefaults() + { + 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; + } + + 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; + } + + public override bool CanDamage() => projectile.timeLeft < Lifetime - 4; + + public override void AI() => Lighting.AddLight(projectile.Center, ShaderColorOne.ToVector3()); + + private void RestrictLifetime() + { + if (projectile.timeLeft > 8) + projectile.timeLeft = 8; + } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + RestrictLifetime(); + target.AddBuff(ModContent.BuffType(), 240); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + RestrictLifetime(); + target.AddBuff(ModContent.BuffType(), 240); + } + + private float PrimitiveWidthFunction(float completionRatio) + { + float arrowheadCutoff = 0.36f; + float width = 39f; + float minHeadWidth = 0.02f; + float maxHeadWidth = width; + if (completionRatio <= arrowheadCutoff) + width = MathHelper.Lerp(minHeadWidth, maxHeadWidth, Utils.InverseLerp(0f, arrowheadCutoff, completionRatio, true)); + return width; + } + + private Color PrimitiveColorFunction(float completionRatio) + { + float endFadeRatio = 0.41f; + + float completionRatioFactor = 2.7f; + float globalTimeFactor = 5.3f; + float endFadeFactor = 3.2f; + float endFadeTerm = Utils.InverseLerp(0f, endFadeRatio * 0.5f, completionRatio, true) * endFadeFactor; + float cosArgument = completionRatio * completionRatioFactor - Main.GlobalTime * globalTimeFactor + endFadeTerm; + float startingInterpolant = (float)Math.Cos(cosArgument) * 0.5f + 0.5f; + + float colorLerpFactor = 0.6f; + Color startingColor = Color.Lerp(ShaderColorOne, ShaderColorTwo, startingInterpolant * colorLerpFactor); + + return Color.Lerp(startingColor, ShaderEndColor, MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0f, endFadeRatio, completionRatio, true))); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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 + return false; + } + + public override void Kill(int timeLeft) + { + Main.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); + holyFire.velocity *= 3f; + + if (Main.rand.NextBool(2)) + { + holyFire.scale = 0.5f; + holyFire.fadeIn = Main.rand.NextFloat(1f, 2f); + } + } + for (int i = 0; i < 20; i++) + { + 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.velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Ranged/TelluricGlareProj.png b/Projectiles/Ranged/TelluricGlareArrow.png similarity index 100% rename from Projectiles/Ranged/TelluricGlareProj.png rename to Projectiles/Ranged/TelluricGlareArrow.png diff --git a/Projectiles/Ranged/TelluricGlareProj.cs b/Projectiles/Ranged/TelluricGlareProj.cs deleted file mode 100644 index 0f9c86ca28..0000000000 --- a/Projectiles/Ranged/TelluricGlareProj.cs +++ /dev/null @@ -1,77 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Ranged -{ - public class TelluricGlareProj : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Glare"); - } - - public override void SetDefaults() - { - projectile.width = 10; - projectile.height = 10; - projectile.extraUpdates = 30; - projectile.friendly = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.aiStyle = 1; - projectile.timeLeft = 300; - projectile.arrow = true; - aiType = ProjectileID.WoodenArrowFriendly; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; - } - - public override void AI() - { - 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, 244, 0f, 0f, 100, default, 1.7f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - } - - 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); - Main.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); - Main.dust[num622].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - 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); - 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); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } -} diff --git a/Projectiles/Ranged/TerraArrowMain.cs b/Projectiles/Ranged/TerraArrowMain.cs index 7af1f17a05..0472b5c8e0 100644 --- a/Projectiles/Ranged/TerraArrowMain.cs +++ b/Projectiles/Ranged/TerraArrowMain.cs @@ -7,6 +7,9 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraArrowMain : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/TerraArrow"; + + private bool initialized = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -21,26 +24,32 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 600; - projectile.aiStyle = 1; - } + projectile.extraUpdates = 1; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - projectile.velocity *= 1.005f; - if (projectile.velocity.Length() >= 20f) - { - projectile.Kill(); - } - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (!initialized) + { + projectile.velocity *= 0.5f; + initialized = true; + } + if (projectile.FinalExtraUpdate() && initialized) + { + projectile.velocity *= 1.003f; + if (projectile.velocity.Length() >= 22f) + { + projectile.Kill(); + } + } + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void Kill(int timeLeft) { - projectile.position = projectile.Center; - projectile.width = projectile.height = 32; - projectile.position.X -= (float)(projectile.width / 2); - projectile.position.Y -= (float)(projectile.height / 2); - Main.PlaySound(SoundID.Item60, projectile.position); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 32); + Main.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); diff --git a/Projectiles/Ranged/TerraArrowMain.png b/Projectiles/Ranged/TerraArrowMain.png deleted file mode 100644 index 35ca0057e8..0000000000 Binary files a/Projectiles/Ranged/TerraArrowMain.png and /dev/null differ diff --git a/Projectiles/Ranged/TerraArrowSplit.cs b/Projectiles/Ranged/TerraArrowSplit.cs index 7b26b855de..281e5dc197 100644 --- a/Projectiles/Ranged/TerraArrowSplit.cs +++ b/Projectiles/Ranged/TerraArrowSplit.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraArrowSplit : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/TerraArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -25,11 +27,15 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; } - public override void AI() + 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; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 20f, 20f); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + + if (projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Ranged/TerraArrowSplit.png b/Projectiles/Ranged/TerraArrowSplit.png deleted file mode 100644 index c7d7c3c20a..0000000000 Binary files a/Projectiles/Ranged/TerraArrowSplit.png and /dev/null differ diff --git a/Projectiles/Ranged/TerraBulletMain.cs b/Projectiles/Ranged/TerraBulletMain.cs index db3ce4ef4a..1173112c0d 100644 --- a/Projectiles/Ranged/TerraBulletMain.cs +++ b/Projectiles/Ranged/TerraBulletMain.cs @@ -11,60 +11,52 @@ namespace CalamityMod.Projectiles.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Terra Bullet"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + 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 = 1; - aiType = ProjectileID.Bullet; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - 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.25f / 255f, (255 - projectile.alpha) * 0f / 255f); + 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] >= 6f) + if (projectile.localAI[0] > 4f) { + // After 15 frames, the alpha will be exactly 0 if (projectile.alpha > 0) - { projectile.alpha -= 17; - } - 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; - 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].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } + + // Dust type 74, scale 0.8, no gravity, no light, no velocity + 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; + d.noGravity = true; + d.noLight = true; } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; } public override void Kill(int timeLeft) @@ -73,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged { for (int b = 0; b < 2; b++) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), 0f, projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Ranged/TerraBulletSplit.cs b/Projectiles/Ranged/TerraBulletSplit.cs index b2f59896bc..a18dda526c 100644 --- a/Projectiles/Ranged/TerraBulletSplit.cs +++ b/Projectiles/Ranged/TerraBulletSplit.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Ranged public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; + projectile.width = 4; + projectile.height = 4; projectile.aiStyle = 1; projectile.friendly = true; projectile.ranged = true; @@ -31,19 +31,15 @@ namespace CalamityMod.Projectiles.Ranged aiType = ProjectileID.Bullet; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 90 && target.CanBeChasedBy(projectile); - public override void AI() + public override bool PreDraw(SpriteBatch spriteBatch, Color 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) @@ -61,7 +57,9 @@ namespace CalamityMod.Projectiles.Ranged if (speed == 0f) speed = projectile.velocity.Length(); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 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 1c9801af74..455d520174 100644 --- a/Projectiles/Ranged/TerraFireGreen.cs +++ b/Projectiles/Ranged/TerraFireGreen.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraFireGreen : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Ranged/TerraFireGreen.png b/Projectiles/Ranged/TerraFireGreen.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/TerraFireGreen.png and /dev/null differ diff --git a/Projectiles/Ranged/TerraFireGreen2.cs b/Projectiles/Ranged/TerraFireGreen2.cs index 28030a7c25..25d67e9217 100644 --- a/Projectiles/Ranged/TerraFireGreen2.cs +++ b/Projectiles/Ranged/TerraFireGreen2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class TerraFireGreen2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -85,7 +87,6 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.CursedInferno, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(BuffID.Frostburn, 300); } } diff --git a/Projectiles/Ranged/TerraFireGreen2.png b/Projectiles/Ranged/TerraFireGreen2.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Ranged/TerraFireGreen2.png and /dev/null differ diff --git a/Projectiles/Ranged/ThePackMinissile.cs b/Projectiles/Ranged/ThePackMinissile.cs index 684fcd6fe8..13726bb8e2 100644 --- a/Projectiles/Ranged/ThePackMinissile.cs +++ b/Projectiles/Ranged/ThePackMinissile.cs @@ -21,12 +21,13 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; 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, false, 1500f, 25f, 15f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 15f); projectile.frameCounter++; if (projectile.frameCounter > 3) { diff --git a/Projectiles/Ranged/ThePackMissile.cs b/Projectiles/Ranged/ThePackMissile.cs index 8b4176bbdd..bf1b72900d 100644 --- a/Projectiles/Ranged/ThePackMissile.cs +++ b/Projectiles/Ranged/ThePackMissile.cs @@ -23,72 +23,52 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.tileCollide = false; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 2500f; - float explode = 200f; + Vector2 targetCenter = projectile.Center; + float minTargetDistance = 2500f; bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) + for (int i = 0; i < 200; i++) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].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); - if (num478 < explode) + float distanceFromTarget = projectile.Center.ManhattanDistance(Main.npc[i].Center); + if (distanceFromTarget < 200f) { - int numProj = 4; - float rotation = MathHelper.ToRadians(50); if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < numProj + 1; i++) + for (int j = 0; j < 5; j++) { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - while (speed.X == 0f && speed.Y == 0f) - { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - } - 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)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); + 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); } } Main.PlaySound(SoundID.Item14, projectile.position); projectile.Kill(); return; } - else if (num478 < num474) + else if (distanceFromTarget < minTargetDistance) { - num474 = num478; - centerX = num476; - centerY = num477; + minTargetDistance = distanceFromTarget; + targetCenter = Main.npc[i].Center; homeIn = true; } } } if (homeIn) { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 15f + num484) / 16f; - projectile.velocity.Y = (projectile.velocity.Y * 15f + num485) / 16f; + projectile.velocity = (projectile.velocity * 15f + projectile.SafeDirectionTo(targetCenter) * 30f) / 16f; return; } + projectile.frameCounter++; if (projectile.frameCounter > 3) { @@ -132,7 +112,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 38af08a56c..36245102ba 100644 --- a/Projectiles/Ranged/TitRail.cs +++ b/Projectiles/Ranged/TitRail.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Ranged { public class TitRail : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Ranged/TitRail.png b/Projectiles/Ranged/TitRail.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Ranged/TitRail.png and /dev/null differ diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index 087a802f04..4ca8bb805d 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class TorrentialArrow : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -22,9 +24,10 @@ namespace CalamityMod.Projectiles.Ranged projectile.timeLeft = 300; projectile.ranged = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; projectile.arrow = true; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { @@ -56,42 +59,8 @@ namespace CalamityMod.Projectiles.Ranged } } - public override Color? GetAlpha(Color lightColor) - { - return 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) - { - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 40f; - float scaleFactor = 1.5f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(40f, 1.5f, lightColor); } } diff --git a/Projectiles/Ranged/TorrentialArrow.png b/Projectiles/Ranged/TorrentialArrow.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Ranged/TorrentialArrow.png and /dev/null differ diff --git a/Projectiles/Ranged/ToxicArrow.cs b/Projectiles/Ranged/ToxicArrow.cs index e0e8fb48f5..c0f2993e8c 100644 --- a/Projectiles/Ranged/ToxicArrow.cs +++ b/Projectiles/Ranged/ToxicArrow.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 240; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/ToxicannonDrop.cs b/Projectiles/Ranged/ToxicannonDrop.cs index c17c8d455e..d86a12b2a0 100644 --- a/Projectiles/Ranged/ToxicannonDrop.cs +++ b/Projectiles/Ranged/ToxicannonDrop.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ToxicannonDrop : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Ranged/ToxicannonDrop.png b/Projectiles/Ranged/ToxicannonDrop.png deleted file mode 100644 index f5e4db998f..0000000000 Binary files a/Projectiles/Ranged/ToxicannonDrop.png and /dev/null differ diff --git a/Projectiles/Ranged/ToxicannonShot.cs b/Projectiles/Ranged/ToxicannonShot.cs index 049975c04c..d5d03ff76a 100644 --- a/Projectiles/Ranged/ToxicannonShot.cs +++ b/Projectiles/Ranged/ToxicannonShot.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Ranged { public class ToxicannonShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/FlakAcid"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cannon Shot"); @@ -83,7 +85,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Ranged/ToxicannonShot.png b/Projectiles/Ranged/ToxicannonShot.png deleted file mode 100644 index 80d124f58d..0000000000 Binary files a/Projectiles/Ranged/ToxicannonShot.png and /dev/null differ diff --git a/Projectiles/Ranged/TriploonProj.cs b/Projectiles/Ranged/TriploonProj.cs index be1796a307..878a4b1c23 100644 --- a/Projectiles/Ranged/TriploonProj.cs +++ b/Projectiles/Ranged/TriploonProj.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.ranged = true; projectile.extraUpdates = 0; projectile.timeLeft = 300; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index 656ef65779..4f0b0b9f22 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.aiStyle = 1; projectile.timeLeft = 600; aiType = ProjectileID.WoodenArrowFriendly; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Ranged/TyphoonBubble.cs b/Projectiles/Ranged/TyphoonBubble.cs index 6419595806..781f1215e0 100644 --- a/Projectiles/Ranged/TyphoonBubble.cs +++ b/Projectiles/Ranged/TyphoonBubble.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Ranged { public class TyphoonBubble : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/BrinyTyphoonBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bubble"); diff --git a/Projectiles/Ranged/TyphoonBubble.png b/Projectiles/Ranged/TyphoonBubble.png deleted file mode 100644 index 90a422dbd8..0000000000 Binary files a/Projectiles/Ranged/TyphoonBubble.png and /dev/null differ diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs index 1201e4a9ae..cc4ac59014 100644 --- a/Projectiles/Ranged/UltimaBolt.cs +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Projectiles.Ranged projectile.arrow = true; projectile.penetrate = 1; projectile.timeLeft = 300; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs index 5ac6ef3154..22c7f00099 100644 --- a/Projectiles/Ranged/UltimaBowProjectile.cs +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class UltimaBowProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/Ultima"; + public float Time { get => projectile.ai[0]; @@ -65,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); shotPosition += projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * projectile.spriteDirection) * 42f; - projectile.velocity = projectile.DirectionTo(Main.MouseWorld); + projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld); Vector2 shotVelocity = projectile.velocity * shotSpeed; // The velocity should always be a unit vector. @@ -74,14 +76,13 @@ namespace CalamityMod.Projectiles.Ranged { type = ModContent.ProjectileType(); shotVelocity = shotVelocity.RotatedByRandom(0.03f); - damage = (int)(damage * 1.5); } // Sometimes fire little sparks if the bow is fully charged. if (Time >= Ultima.FullChargeTime * 0.7f && Main.rand.NextBool(6)) { // 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.DirectionTo(Main.MouseWorld).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); } diff --git a/Projectiles/Ranged/UltimaBowProjectile.png b/Projectiles/Ranged/UltimaBowProjectile.png deleted file mode 100644 index a5e99993fd..0000000000 Binary files a/Projectiles/Ranged/UltimaBowProjectile.png and /dev/null differ diff --git a/Projectiles/Ranged/UltimaRay.cs b/Projectiles/Ranged/UltimaRay.cs index 5f2b6287d4..da0fbcf95e 100644 --- a/Projectiles/Ranged/UltimaRay.cs +++ b/Projectiles/Ranged/UltimaRay.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Ranged { public class UltimaRay : BaseLaserbeamProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float HueOffset { get => projectile.ai[1]; diff --git a/Projectiles/Ranged/UltimaRay.png b/Projectiles/Ranged/UltimaRay.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Ranged/UltimaRay.png and /dev/null differ diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs index 277bb81070..7cc133ac60 100644 --- a/Projectiles/Ranged/UltimaSpark.cs +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Ranged { public class UltimaSpark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; @@ -49,7 +51,7 @@ namespace CalamityMod.Projectiles.Ranged NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxHomingDistance); if (potentialTarget != null) { - projectile.velocity = (projectile.velocity * 8f + projectile.DirectionTo(potentialTarget.Center) * 18f) / 9f; + projectile.velocity = (projectile.velocity * 8f + projectile.SafeDirectionTo(potentialTarget.Center) * 18f) / 9f; return; } diff --git a/Projectiles/Ranged/UltimaSpark.png b/Projectiles/Ranged/UltimaSpark.png deleted file mode 100644 index a799dbbc35..0000000000 Binary files a/Projectiles/Ranged/UltimaSpark.png and /dev/null differ diff --git a/Projectiles/Ranged/VanquisherArrowGlow.png b/Projectiles/Ranged/VanquisherArrowGlow.png deleted file mode 100644 index 625f85ab73..0000000000 Binary files a/Projectiles/Ranged/VanquisherArrowGlow.png and /dev/null differ diff --git a/Projectiles/Ranged/VanquisherArrowMain.cs b/Projectiles/Ranged/VanquisherArrowMain.cs index 2838316807..d81d560126 100644 --- a/Projectiles/Ranged/VanquisherArrowMain.cs +++ b/Projectiles/Ranged/VanquisherArrowMain.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Ranged { public class VanquisherArrowMain : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -25,17 +27,16 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = 1; projectile.timeLeft = 90; projectile.extraUpdates = 1; - } + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - if (projectile.timeLeft % 60 == 0) + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (projectile.timeLeft % 45 == 0) { - if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center, projectile.velocity * 0.25f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + 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); } } @@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged 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/Projectiles/Ranged/VanquisherArrowGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("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) diff --git a/Projectiles/Ranged/VanquisherArrowMain.png b/Projectiles/Ranged/VanquisherArrowMain.png deleted file mode 100644 index 5ff3f9498b..0000000000 Binary files a/Projectiles/Ranged/VanquisherArrowMain.png and /dev/null differ diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 855bdf7477..8a2b121bb2 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -1,54 +1,59 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class VeriumBulletProj : ModProjectile - { + public class VeriumBulletProj : ModProjectile + { private float speed = 0f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bullet"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Verium Bullet"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + 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 = 2; - projectile.timeLeft = 600; - projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - } + 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; + aiType = ProjectileID.Bullet; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesFromEdge(projectile, 0, lightColor); + return false; + } - public override bool PreAI() - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); - projectile.spriteDirection = projectile.direction; - 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; - Main.dust[purple].velocity *= 0f; - Main.dust[purple].noGravity = true; - } + public override bool PreAI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; + + 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; + Main.dust[purple].velocity *= 0f; + Main.dust[purple].noGravity = true; + } + } if (projectile.ai[0] > 0f) projectile.ai[0]--; @@ -108,40 +113,30 @@ namespace CalamityMod.Projectiles.Ranged if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * inertia + homeInVector * 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) - { - if (projectile.ai[0] > 0f) - { - return false; - } - return null; } - public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f; + public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f && target.CanBeChasedBy(projectile); - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { + 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.damage /= 2; if (target.life > 0) projectile.ai[1] = target.whoAmI; - } + } - public override void OnHitPvp(Player target, int damage, bool crit) - { + public override void OnHitPvp(Player target, int damage, bool crit) + { projectile.ai[0] = 10f; - projectile.damage /= 2; - } - } + projectile.damage /= 2; + } + } } diff --git a/Projectiles/Ranged/Voidragon.cs b/Projectiles/Ranged/Voidragon.cs index e12926a541..8c52e85306 100644 --- a/Projectiles/Ranged/Voidragon.cs +++ b/Projectiles/Ranged/Voidragon.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Ranged/Voidragon.png b/Projectiles/Ranged/Voidragon.png index fac11a2bd0..fb550a3cd6 100644 Binary files a/Projectiles/Ranged/Voidragon.png and b/Projectiles/Ranged/Voidragon.png differ diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index 2e56efabf7..40327e0c42 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -25,9 +25,9 @@ namespace CalamityMod.Projectiles.Ranged projectile.penetrate = -1; projectile.alpha = 255; projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs index 4410afbd4e..0ca8a7e093 100644 --- a/Projectiles/Rogue/AbyssalMirrorProjectile.cs +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue { if (!target.friendly) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs new file mode 100644 index 0000000000..2df7ba00fa --- /dev/null +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -0,0 +1,69 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AccretionDisk2 : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AccretionDisk"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Accretion Disk"); + 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; + aiType = ProjectileID.WoodenBoomerang; + 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); + Main.dust[num250].noGravity = true; + Main.dust[num250].velocity *= 0f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + return false; + } + } +} diff --git a/Projectiles/Rogue/AccretionDiskProj.cs b/Projectiles/Rogue/AccretionDiskProj.cs new file mode 100644 index 0000000000..2c796ac029 --- /dev/null +++ b/Projectiles/Rogue/AccretionDiskProj.cs @@ -0,0 +1,205 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AccretionDiskProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AccretionDisk"; + private int Lifetime = 400; + private int ReboundTime = 30; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Disk"); + 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; + } + + public override void AI() + { + SpawnProjectilesNearEnemies(); + BoomerangAI(); + LightingAndDust(); + } + + private void BoomerangAI() + { + // Boomerang rotation + projectile.rotation += 0.4f * projectile.direction; + + // Boomerang sound + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.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; + + if (projectile.ai[0] == 1f) + { + Player player = Main.player[projectile.owner]; + float returnSpeed = 9f; + float acceleration = 0.4f; + Vector2 playerVec = player.Center - projectile.Center; + float dist = playerVec.Length(); + + // Delete the projectile if it's excessively far away. + if (dist > 3000f) + projectile.Kill(); + + playerVec.Normalize(); + playerVec *= returnSpeed; + + // Home back in on the player. + if (projectile.velocity.X < playerVec.X) + { + projectile.velocity.X += acceleration; + if (projectile.velocity.X < 0f && playerVec.X > 0f) + projectile.velocity.X += acceleration; + } + 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.Y < playerVec.Y) + { + projectile.velocity.Y += acceleration; + if (projectile.velocity.Y < 0f && playerVec.Y > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > playerVec.Y) + { + 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(); + } + } + + private void SpawnProjectilesNearEnemies() + { + if (!projectile.friendly) + return; + + float maxDistance = 300f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + 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); + + if (Vector2.Distance(npc.Center, projectile.Center) < maxDistance + extraDistance && canHit) + { + homeIn = true; + break; + } + } + } + + if (homeIn) + { + 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) + { + float spread = 45f * 0.0174f; + 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) + { + Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 6; + Main.projectile[disk].usesIDStaticNPCImmunity = Main.projectile[disk2].usesIDStaticNPCImmunity = true; + Main.projectile[disk].timeLeft = Main.projectile[disk2].timeLeft = 90; + } + } + } + } + } + } + + private void LightingAndDust() + { + 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); + Main.dust[rainbow].noGravity = true; + Main.dust[rainbow].velocity *= 0f; + } + + Lighting.AddLight(projectile.Center, 0.15f, 1f, 0.25f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + if (!projectile.Calamity().stealthStrike) + projectile.ai[0] = 1f; + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + 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); + return false; + } + } +} diff --git a/Projectiles/Rogue/AcidBarrelDrop.cs b/Projectiles/Rogue/AcidBarrelDrop.cs index a422e48017..0c0dc8024e 100644 --- a/Projectiles/Rogue/AcidBarrelDrop.cs +++ b/Projectiles/Rogue/AcidBarrelDrop.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class AcidBarrelDrop : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid"); @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(255, 255, 255, 127), ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(255, 255, 255, 127), 2); return false; } } diff --git a/Projectiles/Rogue/AcidBarrelDrop.png b/Projectiles/Rogue/AcidBarrelDrop.png deleted file mode 100644 index f5e4db998f..0000000000 Binary files a/Projectiles/Rogue/AcidBarrelDrop.png and /dev/null differ diff --git a/Projectiles/Rogue/AcidShrapnel.cs b/Projectiles/Rogue/AcidShrapnel.cs index 896100f07c..38983e6a21 100644 --- a/Projectiles/Rogue/AcidShrapnel.cs +++ b/Projectiles/Rogue/AcidShrapnel.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class AcidShrapnel : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/BarrelShrapnel"; + public bool HitTile = false; public override void SetStaticDefaults() { @@ -25,7 +27,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 160; projectile.tileCollide = true; projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + } public override void AI() { projectile.ai[0] += 1f; diff --git a/Projectiles/Rogue/AcidShrapnel.png b/Projectiles/Rogue/AcidShrapnel.png deleted file mode 100644 index 7e787acdea..0000000000 Binary files a/Projectiles/Rogue/AcidShrapnel.png and /dev/null differ diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs index 822d2c22f1..054adaa258 100644 --- a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs +++ b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class AdamantiteThrowingAxeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AdamantiteThrowingAxe"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Adamantite Throwing Axe"); diff --git a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.png b/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.png deleted file mode 100644 index 3eef4bdc0b..0000000000 Binary files a/Projectiles/Rogue/AdamantiteThrowingAxeProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/AlphaSeeker.cs b/Projectiles/Rogue/AlphaSeeker.cs index 9502386e21..c28829ac38 100644 --- a/Projectiles/Rogue/AlphaSeeker.cs +++ b/Projectiles/Rogue/AlphaSeeker.cs @@ -1,11 +1,17 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { - public class AlphaSeeker : ModProjectile + public class AlphaSeeker : ModProjectile { + private const float MaxSpeed = 15f; + private const float HomingStartRange = 400f; + public static float moveSpeed = 2f; public static float rotateSpeed = 0.04f; public static int lifetime = 120; @@ -14,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - DisplayName.SetDefault("Seeker"); + DisplayName.SetDefault("Alpha Virus Seeker"); } public override void SetDefaults() @@ -22,9 +28,11 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 8; projectile.height = 8; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = lifetime; projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; } public override void AI() @@ -35,42 +43,13 @@ namespace CalamityMod.Projectiles.Rogue 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) - { - // 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)) - { - float dist = (projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = i; - } - } - } - - Vector2 velocityNew; - if (minDist < 999f) - { - velocityNew = Main.npc[index].Center - projectile.Center; - velocityNew.Normalize(); - projectile.velocity += velocityNew; - if (projectile.velocity.Length() > 10f) - { - projectile.velocity.Normalize(); - projectile.velocity *= 10f; - } - } - } - else if (projectile.ai[0] == 2f) { // projectile.localAI[0] controls the distance from the parent projectile - projectile.tileCollide = false; Projectile parent = Main.projectile[0]; @@ -101,18 +80,92 @@ namespace CalamityMod.Projectiles.Rogue { 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) + { + 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 + } + } } else { projectile.Kill(); } } + else + { + HomingAI(); + } 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; } + // TODO -- shamelessly copied from Nanoblack Reaper. This should be made into a Utils function ASAP + private void HomingAI() + { + // If we don't currently have a target, go try and get one! + 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; + + // If there's no target, just don't do anything. Otherwise home in. + if (targetID < 0) + return; + NPC target = Main.npc[targetID]; + + // Adds a multiple of the towards-target vector to its velocity every frame. + float homingFactor = 2.5f; + Vector2 posDiff = target.Center - projectile.Center; + posDiff = posDiff.SafeNormalize(Vector2.Zero); + posDiff *= homingFactor; + Vector2 newVelocity = projectile.velocity += posDiff; + + // Caps speed to make sure it doesn't go too fast. + if (newVelocity.Length() >= MaxSpeed) + { + newVelocity = newVelocity.SafeNormalize(Vector2.Zero); + newVelocity *= MaxSpeed; + } + + projectile.velocity = newVelocity; + } + + // TODO -- shamelessly copied from Nanoblack Reaper. This should be made into a Utils function ASAP + private int AcquireTarget() + { + int target = -1; + float minDist = HomingStartRange; + for (int i = 0; i < Main.maxNPCs; ++i) + { + NPC npc = Main.npc[i]; + if (!npc.active || npc.type == NPCID.TargetDummy) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + 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) + { + minDist = distToNPC; + target = i; + } + } + } + return target; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Rogue/AlphaVirusProjectile.cs b/Projectiles/Rogue/AlphaVirusProjectile.cs index 12df69f515..a0ce21a17e 100644 --- a/Projectiles/Rogue/AlphaVirusProjectile.cs +++ b/Projectiles/Rogue/AlphaVirusProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class AlphaVirusProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AlphaVirus"; + public static int lifetime = 600; public static float finalVelocity = 2f; public static float decelerationRate = 0.07f; @@ -25,11 +27,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 5; + 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() @@ -51,12 +55,12 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.timeLeft < lifetime - 30 && projectile.timeLeft % 15 == 0 && projectile.ai[0] <= finalVelocity) { - int projdamage = projectile.damage / 2; - Vector2 randomVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - randomVelocity.Normalize(); - randomVelocity *= 5f; - - int p = Projectile.NewProjectile(projectile.Center, randomVelocity, ModContent.ProjectileType(), projdamage, 1f, projectile.owner, 2, projectile.identity); + int projID = ModContent.ProjectileType(); + 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); } } else @@ -190,12 +194,14 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - for (int i = 0; i < 6; i++) + int numSeekers = 6; + int damage = projectile.damage; + float kb = 1f; + float speed = 10f; + for (int i = 0; i < numSeekers; i++) { - int damage2 = projectile.damage; - Vector2 velocity = new Vector2(0, 10); - velocity = velocity.RotatedBy(MathHelper.ToRadians(60) * i); - Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), damage2, 5, projectile.owner, i % 2, 0); + Vector2 velocity = (MathHelper.Pi * i / 3f).ToRotationVector2() * speed; + Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), damage, kb, projectile.owner, 0f, 0f); } int numDust = 20; diff --git a/Projectiles/Rogue/AlphaVirusProjectile.png b/Projectiles/Rogue/AlphaVirusProjectile.png deleted file mode 100644 index e3e8c3c7ea..0000000000 Binary files a/Projectiles/Rogue/AlphaVirusProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index fb9821e918..8bdbbb4a94 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class AntumbraShardProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/XerocPitchfork"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Antumbra Shard"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.extraUpdates = 1; projectile.aiStyle = 113; projectile.timeLeft = 600; @@ -32,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (projectile.spriteDirection == -1) { projectile.rotation -= 1.57f; @@ -56,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/AntumbraShardProjectile.png b/Projectiles/Rogue/AntumbraShardProjectile.png deleted file mode 100644 index ca5e3d8840..0000000000 Binary files a/Projectiles/Rogue/AntumbraShardProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ApoctolithProj.cs b/Projectiles/Rogue/ApoctolithProj.cs index c89abfc6bd..a34331ba52 100644 --- a/Projectiles/Rogue/ApoctolithProj.cs +++ b/Projectiles/Rogue/ApoctolithProj.cs @@ -5,10 +5,14 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class ApoctolithProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Apoctolith"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Apoctolith"); @@ -20,6 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 30; projectile.friendly = true; projectile.Calamity().rogue = true; + projectile.ignoreWater = true; } public override void AI() @@ -41,14 +46,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - if (crit && target.defense > 0) - { - target.defense -= Math.Min(target.defense, 15); - } + + if (crit) + target.Calamity().miscDefenseLoss = Math.Min(target.defense, 15); + if (projectile.Calamity().stealthStrike) - { target.AddBuff(ModContent.BuffType(), 120); - } } public override void OnHitPvp(Player target, int damage, bool crit) @@ -62,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(21, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Tink, (int)projectile.position.X, (int)projectile.position.Y); //Dust on impact int dust_splash = 0; while (dust_splash < 9) diff --git a/Projectiles/Rogue/ApoctolithProj.png b/Projectiles/Rogue/ApoctolithProj.png deleted file mode 100644 index 8bb4754fdf..0000000000 Binary files a/Projectiles/Rogue/ApoctolithProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ApoctolithShard.cs b/Projectiles/Rogue/ApoctolithShard.cs index 0c9f5c5c94..5282d9a24a 100644 --- a/Projectiles/Rogue/ApoctolithShard.cs +++ b/Projectiles/Rogue/ApoctolithShard.cs @@ -1,10 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class ApoctolithShard : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/AbyssalMirrorProjectile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Apoctolith Shard"); @@ -13,6 +17,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { projectile.friendly = true; + projectile.ignoreWater = true; projectile.width = 13; projectile.height = 13; projectile.Calamity().rogue = true; @@ -30,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void Kill(int timeLeft) { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) diff --git a/Projectiles/Rogue/ApoctolithShard.png b/Projectiles/Rogue/ApoctolithShard.png deleted file mode 100644 index e7cc9f5a56..0000000000 Binary files a/Projectiles/Rogue/ApoctolithShard.png and /dev/null differ diff --git a/Projectiles/Rogue/AshenStalactiteProj.cs b/Projectiles/Rogue/AshenStalactiteProj.cs index e8c73d50a4..b457b77321 100644 --- a/Projectiles/Rogue/AshenStalactiteProj.cs +++ b/Projectiles/Rogue/AshenStalactiteProj.cs @@ -1,4 +1,3 @@ - using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -10,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class AshenStalactiteProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AshenStalactite"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ashen Stalactite"); @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue 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) + MathHelper.ToRadians(45f); projectile.velocity.Y += 0.1f; if (projectile.velocity.Y > 16f) diff --git a/Projectiles/Rogue/AshenStalactiteProj.png b/Projectiles/Rogue/AshenStalactiteProj.png deleted file mode 100644 index 2bc70a87aa..0000000000 Binary files a/Projectiles/Rogue/AshenStalactiteProj.png and /dev/null differ diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index d638712c57..89ef71f1f2 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.soundDelay = 20 + Main.rand.Next(40); if (Main.rand.NextBool(5)) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 9); } } @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; if (projectile.ai[0] > 15f) { - int astral = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue { if (Main.myPlayer != projectile.owner) return; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9, 1f, 0f); + Main.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; @@ -108,14 +108,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); for (int d = 0; d < 2; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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(new Vector2(projectile.position.X, projectile.position.Y), 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(new Vector2(projectile.position.X, projectile.position.Y), 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; } diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 5af928b27e..bfe32f872c 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue } //Home in - float maxDistance = 1600f; + float maxDistance = 500f; int targetIndex = -1; int i; for (i = 0; i < Main.maxNPCs; i++) @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -126,29 +126,29 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); + OnHitEffect(target.Center, target.width); + } + + private void OnHitEffect(Vector2 targetPos, int width) + { if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) { - Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (target.Center - pos) / 40f; + 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, 0f, 0f); - Main.projectile[comet].Calamity().forceRogue = true; - Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3); + int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner); + if (comet.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[comet].Calamity().forceRogue = true; + Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3); + } } } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - if (projectile.Calamity().stealthStrike && Main.myPlayer == projectile.owner) - { - Vector2 pos = new Vector2(target.Center.X + target.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (target.Center - pos) / 40f; - int dmg = projectile.damage / 2; - int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[comet].Calamity().forceRogue = true; - Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3); - } + OnHitEffect(target.Center, target.width); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index d6e9dbf72b..03c15058fb 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 200; projectile.tileCollide = false; projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + } public override void AI() { diff --git a/Projectiles/Rogue/BarrelShrapnel.cs b/Projectiles/Rogue/BarrelShrapnel.cs index 779bbb38d2..7f79178e03 100644 --- a/Projectiles/Rogue/BarrelShrapnel.cs +++ b/Projectiles/Rogue/BarrelShrapnel.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 160; projectile.tileCollide = true; projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + } public override void AI() { projectile.ai[0] += 1f; diff --git a/Projectiles/Rogue/BettyExplosion.cs b/Projectiles/Rogue/BettyExplosion.cs index 29f5e8bfc3..458b8b6ca5 100644 --- a/Projectiles/Rogue/BettyExplosion.cs +++ b/Projectiles/Rogue/BettyExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BettyExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Betty Explosion"); diff --git a/Projectiles/Rogue/BettyExplosion.png b/Projectiles/Rogue/BettyExplosion.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Rogue/BettyExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/BileExplosion.cs b/Projectiles/Rogue/BileExplosion.cs index 238c754d97..e831a44646 100644 --- a/Projectiles/Rogue/BileExplosion.cs +++ b/Projectiles/Rogue/BileExplosion.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BileExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bile"); diff --git a/Projectiles/Rogue/BileExplosion.png b/Projectiles/Rogue/BileExplosion.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Rogue/BileExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 68e7dcf63c..2aaa0865be 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BlastBarrelProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/BlastBarrel"; + public float BounceEffectCooldown = 0f; public float OldVelocityX = 0f; public float RemainingBounces @@ -30,7 +32,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 48; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 480; + projectile.ignoreWater = true; + projectile.timeLeft = 480; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; @@ -64,21 +67,24 @@ namespace CalamityMod.Projectiles.Rogue { projectileCount += 4; // More shit the closer we are to death } - 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); - } - 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); - fire.timeLeft = 300; - fire.penetrate = 3; - } - } + 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); + } + 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); + fire.timeLeft = 300; + fire.penetrate = 3; + } + } + } RemainingBounces--; BounceEffectCooldown = 15; if (RemainingBounces <= 0) @@ -90,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) => false; public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BlastBarrelProjectile.png b/Projectiles/Rogue/BlastBarrelProjectile.png deleted file mode 100644 index d1a66f22f7..0000000000 Binary files a/Projectiles/Rogue/BlastBarrelProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/BlazingStarProj.cs b/Projectiles/Rogue/BlazingStarProj.cs index 0f4b17bd59..3baee6041b 100644 --- a/Projectiles/Rogue/BlazingStarProj.cs +++ b/Projectiles/Rogue/BlazingStarProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BlazingStarProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/BlazingStar"; + public const int Lifetime = 1540; public const int ReboundTime = 40; @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 32; projectile.friendly = true; projectile.tileCollide = true; - projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.penetrate = 5; projectile.timeLeft = Lifetime; projectile.Calamity().rogue = true; } @@ -106,7 +109,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } // Make the star bounce on tiles. diff --git a/Projectiles/Rogue/BlazingStarProj.png b/Projectiles/Rogue/BlazingStarProj.png deleted file mode 100644 index ac480e43b1..0000000000 Binary files a/Projectiles/Rogue/BlazingStarProj.png and /dev/null differ diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index d871f158a9..e0bdbcffb0 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -9,8 +9,11 @@ namespace CalamityMod.Projectiles.Rogue { public class BloodsoakedCrashax : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/BloodsoakedCrasher"; + private int bounce = 3; //number of times it bounces private int grind = 0; //used to know when to slow down + private const float MaxSpeed = 14f; public override void SetStaticDefaults() { @@ -23,42 +26,41 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = projectile.height = 30; projectile.friendly = true; - projectile.penetrate = 10; - projectile.timeLeft = 600; //10 seconds and counting - projectile.aiStyle = 2; - aiType = ProjectileID.ThrowingKnife; //Throwing Knife AI + projectile.ignoreWater = true; + projectile.penetrate = 6; + projectile.timeLeft = 600; //10 seconds and counting (but not actually because extra updates) projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; projectile.extraUpdates = 1; } public override void AI() { + float speed = projectile.velocity.Length(); if (grind > 0) { grind--; - } - if (grind >= 1) - { - projectile.extraUpdates = 0; //stop, you're touching an enemy + // Suddenly stop when on top of enemies. projectile.velocity.X *= 0.75f; projectile.velocity.Y *= 0.75f; } else { - 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; - } - if (projectile.velocity.Y > 16f) - { - projectile.velocity.Y = 16f; - } - projectile.extraUpdates = 1; + // Gravity + projectile.velocity.Y += 0.11f; + + // Cap velocity. + speed = projectile.velocity.Length(); + if (speed > MaxSpeed) + 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; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -96,32 +98,34 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(bool cannotLifesteal) { - if (grind < 10) - { - grind += 5; //THE GRIND NEVER STOPS - } + grind += 5; //THE GRIND NEVER STOPS + if (grind > 15) + grind = 15; // except when it's too much if (projectile.Calamity().stealthStrike && projectile.owner == Main.myPlayer) //stealth strike attack { - int stealth = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[stealth].Calamity().forceRogue = true; + int projID = ModContent.ProjectileType(); + 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); + if (stealth.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[stealth].Calamity().forceRogue = true; + Main.projectile[stealth].extraUpdates = 1; + } } - Player player = Main.player[projectile.owner]; - if (cannotLifesteal) //canGhostHeal be like lol - { + if (cannotLifesteal || Main.rand.NextBool(2)) //canGhostHeal be like lol return; - } - if (Main.rand.NextBool(2)) - { - player.statLife += 1; //Trello said 2 hp per hit. Sounds like a fat balancing problem. - player.HealEffect(1); - } + + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.HealEffect(1); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) //afterimages { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/BloodsoakedCrashax.png b/Projectiles/Rogue/BloodsoakedCrashax.png deleted file mode 100644 index 1d8b42d1cf..0000000000 Binary files a/Projectiles/Rogue/BloodsoakedCrashax.png and /dev/null differ diff --git a/Projectiles/Rogue/BlueFlamePillar.cs b/Projectiles/Rogue/BlueFlamePillar.cs index 00c8be3541..3acc0df2da 100644 --- a/Projectiles/Rogue/BlueFlamePillar.cs +++ b/Projectiles/Rogue/BlueFlamePillar.cs @@ -50,8 +50,9 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { + Texture2D tex = Main.projectileTexture[projectile.type]; Rectangle frame = new Rectangle(frameX * 80, frameY * 322, 80, 322); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/BlueFlamePillar"), 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 a9a6cfb925..3096335aa5 100644 --- a/Projectiles/Rogue/BlunderBoosterLightning.cs +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); + Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 93, 0.25f, 0f); for (int i = 0; i < 5; i++) { diff --git a/Projectiles/Rogue/BouncingBettyProjectile.cs b/Projectiles/Rogue/BouncingBettyProjectile.cs index 662a1209ff..a28e30e317 100644 --- a/Projectiles/Rogue/BouncingBettyProjectile.cs +++ b/Projectiles/Rogue/BouncingBettyProjectile.cs @@ -19,29 +19,33 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 600; projectile.penetrate = 3; projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + } private void Explode() { Main.PlaySound(SoundID.Item14, projectile.Center); - 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++) - { - 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); - } - 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); - fire.localNPCHitCooldown = 9; - fire.timeLeft = 240; - } - } + if (Main.myPlayer == projectile.owner) + { + 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++) + { + 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); + } + 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); + fire.localNPCHitCooldown = 9; + fire.timeLeft = 240; + } + } + } } } public override void AI() diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index dae606d6f0..da8c602865 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BouncingEyeballProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/BouncingEyeball"; + private int Bounces = 5; public override void SetStaticDefaults() { @@ -66,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.png b/Projectiles/Rogue/BouncingEyeballProjectile.png deleted file mode 100644 index 2f9d97ba66..0000000000 Binary files a/Projectiles/Rogue/BouncingEyeballProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index 44ec1498bc..a51307a88c 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 cbe6740d68..5849a54cc5 100644 --- a/Projectiles/Rogue/BouncyBol.cs +++ b/Projectiles/Rogue/BouncyBol.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BouncyBol : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/BouncySpikyBall"; + private bool hasHitEnemy = false; private int targetNPC = -1; private List previousNPCs = new List() { -1 }; diff --git a/Projectiles/Rogue/BouncyBol.png b/Projectiles/Rogue/BouncyBol.png deleted file mode 100644 index d409a6b571..0000000000 Binary files a/Projectiles/Rogue/BouncyBol.png and /dev/null differ diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index e5683ce1d5..0a2b552d31 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BrackishFlaskProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/BrackishFlask"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brackish Flask"); @@ -23,7 +25,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; aiType = ProjectileID.ThrowingKnife; projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Rogue/BrackishFlaskProj.png b/Projectiles/Rogue/BrackishFlaskProj.png deleted file mode 100644 index 0e5ad78a57..0000000000 Binary files a/Projectiles/Rogue/BrackishFlaskProj.png and /dev/null differ diff --git a/Projectiles/Rogue/BrackishSpear.cs b/Projectiles/Rogue/BrackishSpear.cs index d7c4dbb5bc..ddc4d2253f 100644 --- a/Projectiles/Rogue/BrackishSpear.cs +++ b/Projectiles/Rogue/BrackishSpear.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 52; projectile.aiStyle = 4; projectile.friendly = true; - projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.alpha = 255; projectile.penetrate = -1; projectile.tileCollide = false; projectile.Calamity().rogue = true; @@ -54,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue 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(27, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } } diff --git a/Projectiles/Rogue/BrackishWaterBlast.cs b/Projectiles/Rogue/BrackishWaterBlast.cs index 90c57ae76b..06dcf3ac7f 100644 --- a/Projectiles/Rogue/BrackishWaterBlast.cs +++ b/Projectiles/Rogue/BrackishWaterBlast.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BrackishWaterBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Water"); diff --git a/Projectiles/Rogue/BrackishWaterBlast.png b/Projectiles/Rogue/BrackishWaterBlast.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Rogue/BrackishWaterBlast.png and /dev/null differ diff --git a/Projectiles/Rogue/Brick.cs b/Projectiles/Rogue/Brick.cs index 416a248a60..97687621a9 100644 --- a/Projectiles/Rogue/Brick.cs +++ b/Projectiles/Rogue/Brick.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Brick : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ThrowingBrick"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brick"); diff --git a/Projectiles/Rogue/Brick.png b/Projectiles/Rogue/Brick.png deleted file mode 100644 index 3790f358ac..0000000000 Binary files a/Projectiles/Rogue/Brick.png and /dev/null differ diff --git a/Projectiles/Rogue/BrickFragment.cs b/Projectiles/Rogue/BrickFragment.cs index 54b7e0ad19..ec6521d053 100644 --- a/Projectiles/Rogue/BrickFragment.cs +++ b/Projectiles/Rogue/BrickFragment.cs @@ -1,5 +1,7 @@ using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class BrickFragment : ModProjectile @@ -35,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void Kill(int timeLeft) { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) diff --git a/Projectiles/Rogue/BrickFragment.png b/Projectiles/Rogue/BrickFragment.png index 8f15bd9a4c..36e20cc3a8 100644 Binary files a/Projectiles/Rogue/BrickFragment.png and b/Projectiles/Rogue/BrickFragment.png differ diff --git a/Projectiles/Rogue/Brimblade2.cs b/Projectiles/Rogue/Brimblade2.cs index a17d1da2f3..5d3775b415 100644 --- a/Projectiles/Rogue/Brimblade2.cs +++ b/Projectiles/Rogue/Brimblade2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Brimblade2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Brimblade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimblade"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 3; projectile.timeLeft = 180; aiType = ProjectileID.WoodenBoomerang; diff --git a/Projectiles/Rogue/Brimblade2.png b/Projectiles/Rogue/Brimblade2.png deleted file mode 100644 index 0d93160ef8..0000000000 Binary files a/Projectiles/Rogue/Brimblade2.png and /dev/null differ diff --git a/Projectiles/Rogue/BrimbladeProj.cs b/Projectiles/Rogue/BrimbladeProj.cs index 9f95776b31..59075b32d9 100644 --- a/Projectiles/Rogue/BrimbladeProj.cs +++ b/Projectiles/Rogue/BrimbladeProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class BrimbladeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Brimblade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimblade"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 180; aiType = ProjectileID.WoodenBoomerang; diff --git a/Projectiles/Rogue/BrimbladeProj.png b/Projectiles/Rogue/BrimbladeProj.png deleted file mode 100644 index 0d93160ef8..0000000000 Binary files a/Projectiles/Rogue/BrimbladeProj.png and /dev/null differ diff --git a/Projectiles/Rogue/BurningStrifeProj.cs b/Projectiles/Rogue/BurningStrifeProj.cs index df19353474..316094df18 100644 --- a/Projectiles/Rogue/BurningStrifeProj.cs +++ b/Projectiles/Rogue/BurningStrifeProj.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 14; projectile.height = 14; projectile.timeLeft = 720; - projectile.friendly = true; + projectile.ignoreWater = true; + projectile.friendly = true; projectile.extraUpdates = 1; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 82c6285f99..17b634a6d0 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 14; projectile.height = 14; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 300; projectile.Calamity().rogue = true; projectile.extraUpdates = 1; @@ -138,7 +139,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 6508ed2839..cecdf33481 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -20,14 +20,16 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.penetrate = -1; + 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; + } public override void AI() { @@ -53,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 67eeb6059e..b661d820db 100644 --- a/Projectiles/Rogue/CelestialReaperAfterimage.cs +++ b/Projectiles/Rogue/CelestialReaperAfterimage.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CelestialReaperAfterimage : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CelestialReaper"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Celestial Reaper"); @@ -15,21 +17,27 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 66; projectile.height = 76; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 51; projectile.tileCollide = false; projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.timeLeft = 180; } - public override void AI() + + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.rotation += MathHelper.ToRadians(30f); // Buzzsaw scythe. - NPC target = projectile.position.ClosestNPCAt(640f); - if (target != null) - { - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(target.Center) * 20f) / 21f; - } + + if (projectile.timeLeft < 150) + { + NPC target = projectile.Center.ClosestNPCAt(640f); + if (target != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(target.Center) * 20f) / 21f; + } + projectile.alpha += 5; } } diff --git a/Projectiles/Rogue/CelestialReaperAfterimage.png b/Projectiles/Rogue/CelestialReaperAfterimage.png deleted file mode 100644 index b244fdcb7e..0000000000 Binary files a/Projectiles/Rogue/CelestialReaperAfterimage.png and /dev/null differ diff --git a/Projectiles/Rogue/CelestialReaperProjectile.cs b/Projectiles/Rogue/CelestialReaperProjectile.cs index a98fc3150f..65135370c5 100644 --- a/Projectiles/Rogue/CelestialReaperProjectile.cs +++ b/Projectiles/Rogue/CelestialReaperProjectile.cs @@ -2,11 +2,15 @@ using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { - public class CelestialReaperProjectile : ModProjectile + public class CelestialReaperProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CelestialReaper"; + public int HomingCooldown = 0; + public override void SetStaticDefaults() { DisplayName.SetDefault("Celestial Reaper"); @@ -17,12 +21,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 66; projectile.height = 76; projectile.friendly = true; - projectile.penetrate = 6; + 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. @@ -32,30 +39,28 @@ namespace CalamityMod.Projectiles.Rogue } else { - NPC target = projectile.position.ClosestNPCAt(640f); + NPC target = projectile.Center.ClosestNPCAt(640f); if (target != null) - { - projectile.velocity = (projectile.velocity * 20f + projectile.DirectionTo(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) { - // Damaging afterimage projectiles. - float framesNeeded = 60f; - framesNeeded /= 6f - projectile.penetrate + 1f; // The addition of 1 is to prevent division by zero. The more hits, the more afterimages. + // 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) { - Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack / 2f, projectile.owner); + 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); } } } - public override bool? CanHitNPC(NPC target) - { - if (HomingCooldown > 0) - return false; - return null; - } + // The explicit (bool?) cast is necessary until C# 9.0. How ugly. + public override bool? CanHitNPC(NPC target) => HomingCooldown > 0 ? false : (bool?)null; public override bool CanHitPvp(Player target) => HomingCooldown <= 0; @@ -64,12 +69,20 @@ namespace CalamityMod.Projectiles.Rogue HomingCooldown = 25; projectile.velocity *= -0.75f; // Bounce off of the enemy. } + public override void Kill(int timeLeft) { - for (float i = 0f; i < 7f; i += 1f) + 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; + float speed = 12f; + for (float i = 0; i < numSplits; ++i) { - float angle = MathHelper.TwoPi * i / 7f; - Projectile.NewProjectile(projectile.Center, angle.ToRotationVector2() * 12f, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); + float angle = MathHelper.TwoPi * i / numSplits; + Vector2 velocity = angle.ToRotationVector2() * speed; + Projectile.NewProjectile(projectile.Center, velocity, projID, damage, kb, projectile.owner); } } } diff --git a/Projectiles/Rogue/CelestialReaperProjectile.png b/Projectiles/Rogue/CelestialReaperProjectile.png deleted file mode 100644 index b244fdcb7e..0000000000 Binary files a/Projectiles/Rogue/CelestialReaperProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/Celestus2.cs b/Projectiles/Rogue/Celestus2.cs index 825b8d27e4..8794a470a3 100644 --- a/Projectiles/Rogue/Celestus2.cs +++ b/Projectiles/Rogue/Celestus2.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 48; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.extraUpdates = 4; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 40; @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 b98fee3c22..9dd6075380 100644 --- a/Projectiles/Rogue/CelestusBoomerang.cs +++ b/Projectiles/Rogue/CelestusBoomerang.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CelestusBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Celestus"; + private bool initialized = false; private float speed = 25f; public override void SetStaticDefaults() @@ -23,6 +25,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = projectile.height = 94; projectile.friendly = true; projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.penetrate = -1; projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; @@ -123,7 +126,7 @@ namespace CalamityMod.Projectiles.Rogue } break; case 2f: - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1000f, speed, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, speed, 20f); break; default: break; @@ -164,7 +167,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/CelestusBoomerang.png b/Projectiles/Rogue/CelestusBoomerang.png deleted file mode 100644 index cc5385f89f..0000000000 Binary files a/Projectiles/Rogue/CelestusBoomerang.png and /dev/null differ diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 87c5e73fa2..d2bbf85c04 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CinquedeaProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Cinquedea"; + internal float gravspin = 0f; public override void SetStaticDefaults() @@ -68,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue //Stealth strike if (stealthstrike) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 7f, 20f); } //Gravity code else @@ -91,13 +93,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, projectile.position); + Main.PlaySound(SoundID.Dig, projectile.position); return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CinquedeaProj.png b/Projectiles/Rogue/CinquedeaProj.png deleted file mode 100644 index 2837cf598d..0000000000 Binary files a/Projectiles/Rogue/CinquedeaProj.png and /dev/null differ diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index c32acf0143..55e30a1c2f 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -2,10 +2,14 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class CircletMark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); @@ -32,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.soundDelay == 0) { projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 60); + Main.PlaySound(SoundID.Item, projectile.Center, 60); } if (projectile.localAI[1] < 30f) { diff --git a/Projectiles/Rogue/CircletMark.png b/Projectiles/Rogue/CircletMark.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Rogue/CircletMark.png and /dev/null differ diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index f3dba7b2d1..08eaaa892e 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -2,10 +2,14 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class CircletTornado : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); @@ -60,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.soundDelay == 0) { projectile.soundDelay = -1; - Main.PlaySound(2, projectile.Center, 122); + Main.PlaySound(SoundID.Item, projectile.Center, 122); } projectile.ai[0] += 1f; if (projectile.ai[0] >= lifeSpan) diff --git a/Projectiles/Rogue/CircletTornado.png b/Projectiles/Rogue/CircletTornado.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Rogue/CircletTornado.png and /dev/null differ diff --git a/Projectiles/Rogue/CobaltEnergy.cs b/Projectiles/Rogue/CobaltEnergy.cs index a3df47bec9..3d8a030cb1 100644 --- a/Projectiles/Rogue/CobaltEnergy.cs +++ b/Projectiles/Rogue/CobaltEnergy.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CobaltEnergy : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private bool hasHitEnemy = false; private int targetNPC = -1; private List previousNPCs = new List() { -1 }; @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue if (!hasHitEnemy && projectile.timeLeft < 575) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 350f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } else if (hasHitEnemy) { @@ -102,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); - Main.PlaySound(0, projectile.position); + Main.PlaySound(SoundID.Dig, projectile.position); projectile.Kill(); return false; } @@ -116,7 +118,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + Main.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); diff --git a/Projectiles/Rogue/CobaltEnergy.png b/Projectiles/Rogue/CobaltEnergy.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Rogue/CobaltEnergy.png and /dev/null differ diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.cs b/Projectiles/Rogue/CobaltKunaiProjectile.cs index 5328a97ecf..906baefa81 100644 --- a/Projectiles/Rogue/CobaltKunaiProjectile.cs +++ b/Projectiles/Rogue/CobaltKunaiProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CobaltKunaiProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CobaltKunai"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Kunai"); @@ -34,7 +36,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/CobaltKunaiProjectile.png b/Projectiles/Rogue/CobaltKunaiProjectile.png deleted file mode 100644 index 01aeb2d044..0000000000 Binary files a/Projectiles/Rogue/CobaltKunaiProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.cs b/Projectiles/Rogue/ConsecratedWaterProjectile.cs index 2e982beb4c..e6cd90256e 100644 --- a/Projectiles/Rogue/ConsecratedWaterProjectile.cs +++ b/Projectiles/Rogue/ConsecratedWaterProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ConsecratedWaterProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ConsecratedWater"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Consecrated Water"); @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; projectile.timeLeft = 200; projectile.tileCollide = true; - projectile.alpha = 0; + projectile.ignoreWater = true; + projectile.alpha = 0; projectile.Calamity().rogue = true; } public override void AI() diff --git a/Projectiles/Rogue/ConsecratedWaterProjectile.png b/Projectiles/Rogue/ConsecratedWaterProjectile.png deleted file mode 100644 index 05478e95bd..0000000000 Binary files a/Projectiles/Rogue/ConsecratedWaterProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ContaminatedBileFlask.cs b/Projectiles/Rogue/ContaminatedBileFlask.cs index f18fdc331e..3a6cb5381c 100644 --- a/Projectiles/Rogue/ContaminatedBileFlask.cs +++ b/Projectiles/Rogue/ContaminatedBileFlask.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ContaminatedBileFlask : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ContaminatedBile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Contaminated Bile"); @@ -37,8 +39,11 @@ namespace CalamityMod.Projectiles.Rogue { 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); - explosion.Calamity().stealthStrike = projectile.Calamity().stealthStrike; - explosion.timeLeft = explosion.Calamity().stealthStrike ? 60 : 20; + if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) + { + explosion.Calamity().stealthStrike = projectile.Calamity().stealthStrike; + explosion.timeLeft = explosion.Calamity().stealthStrike ? 60 : 20; + } } } } diff --git a/Projectiles/Rogue/ContaminatedBileFlask.png b/Projectiles/Rogue/ContaminatedBileFlask.png deleted file mode 100644 index d16033af3c..0000000000 Binary files a/Projectiles/Rogue/ContaminatedBileFlask.png and /dev/null differ diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs new file mode 100644 index 0000000000..89415d34e6 --- /dev/null +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -0,0 +1,102 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CorpusAvertorClone : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + 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; + } + + public override void AI() + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.04f; + + projectile.velocity.X *= 1.005f; + projectile.velocity.Y *= 1.005f; + + switch ((int)projectile.ai[0]) + { + case 20: + projectile.scale = 0.7f; + break; + case 40: + projectile.scale = 0.8f; + break; + case 60: + projectile.scale = 0.9f; + break; + default: + break; + } + projectile.width = projectile.height = (int)(24f * projectile.scale); + + 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); + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + } + } +} diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs new file mode 100644 index 0000000000..78a2c22f0b --- /dev/null +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -0,0 +1,109 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CorpusAvertorProj : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + 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; + } + + public override void AI() + { + 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] < 61f) + { + 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 + velocity *= mult; + + 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; + + 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) + { + if (projectile.ai[0] >= 61f) + { + int scale = (int)((projectile.ai[0] - 60f) * 4.25f); + return new Color(scale, 0, 0, 50); + } + return new Color(0, 0, 0, 50); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + float heal = damage * 0.05f; + if ((int)heal == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], heal, ProjectileID.VampireHeal, 1200f, 3f); + } + } +} diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs new file mode 100644 index 0000000000..29708977e0 --- /dev/null +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -0,0 +1,98 @@ +using CalamityMod.Buffs.StatBuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CorpusAvertorStealth : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corpus Avertor"); + 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; + } + + public override void AI() + { + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.02f; + + if (projectile.ai[0] < 120f) + projectile.ai[0] += 1f; + + 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); + 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 bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + OnHitEffects(damage); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + OnHitEffects(damage); + } + + private void OnHitEffects(int damage) + { + Player player = Main.player[projectile.owner]; + if (Main.rand.NextBool(7)) + { + int lifeLossAmt = (int)Math.Ceiling(player.statLife * 0.5); + player.statLife -= lifeLossAmt; + if (Main.myPlayer == player.whoAmI) + player.HealEffect(-lifeLossAmt, true); + if (player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " became the blood god's sacrifice."), 1000.0, 0, false); + } + else if (Main.LocalPlayer.team == player.team && player.team != 0) + { + Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); + player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); + + float heal = damage * 0.025f; + if ((int)heal == 0) + return; + + if (Main.player[Main.myPlayer].lifeSteal <= 0f) + return; + + if (heal > CalamityMod.lifeStealCap) + heal = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, player, heal, ProjectileID.VampireHeal, 1200f, 3f); + } + } + } +} diff --git a/Projectiles/Rogue/Corrocloud1.cs b/Projectiles/Rogue/Corrocloud1.cs index a126772cf8..ea6f8173c8 100644 --- a/Projectiles/Rogue/Corrocloud1.cs +++ b/Projectiles/Rogue/Corrocloud1.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } diff --git a/Projectiles/Rogue/Corrocloud2.cs b/Projectiles/Rogue/Corrocloud2.cs index 4125f75db8..82313b6398 100644 --- a/Projectiles/Rogue/Corrocloud2.cs +++ b/Projectiles/Rogue/Corrocloud2.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } diff --git a/Projectiles/Rogue/Corrocloud3.cs b/Projectiles/Rogue/Corrocloud3.cs index 2934a7b2c9..3e82f5b360 100644 --- a/Projectiles/Rogue/Corrocloud3.cs +++ b/Projectiles/Rogue/Corrocloud3.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 4; projectile.timeLeft = 600; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 8; } diff --git a/Projectiles/Rogue/CosmicKunaiProj.cs b/Projectiles/Rogue/CosmicKunaiProj.cs index dd3dfb91ec..6adceeef0f 100644 --- a/Projectiles/Rogue/CosmicKunaiProj.cs +++ b/Projectiles/Rogue/CosmicKunaiProj.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CosmicKunaiProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CosmicKunai"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Kunai"); @@ -16,7 +18,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 24; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.Calamity().rogue = true; } @@ -29,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue 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, false, 300f, 28f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } } } diff --git a/Projectiles/Rogue/CosmicKunaiProj.png b/Projectiles/Rogue/CosmicKunaiProj.png deleted file mode 100644 index 645149a78c..0000000000 Binary files a/Projectiles/Rogue/CosmicKunaiProj.png and /dev/null differ diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 4bf40f1380..feb9d89443 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CosmicScythe : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/SignusScythe"; + private int originalDamage; public override void SetStaticDefaults() @@ -49,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 350) projectile.velocity *= 1.06f; projectile.damage = (int)(originalDamage * 1.25); - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1500f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } } @@ -62,7 +64,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CosmicScythe.png b/Projectiles/Rogue/CosmicScythe.png deleted file mode 100644 index f151811060..0000000000 Binary files a/Projectiles/Rogue/CosmicScythe.png and /dev/null differ diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index 7da9b66221..148c927533 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -1,11 +1,14 @@ using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; +using Terraria.ID; namespace CalamityMod.Projectiles.Rogue { public class CraniumSMASH : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cranium SMASH"); @@ -35,7 +38,7 @@ namespace CalamityMod.Projectiles.Rogue void SpawnExplosionDust() { - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); CalamityUtils.ExplosionGores(projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { diff --git a/Projectiles/Rogue/CraniumSMASH.png b/Projectiles/Rogue/CraniumSMASH.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Rogue/CraniumSMASH.png and /dev/null differ diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 41d1d816d9..dacf541e0f 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 50; projectile.height = 50; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 300; projectile.localNPCHitCooldown = 15; projectile.tileCollide = false; diff --git a/Projectiles/Rogue/CraniumSmasherProj.cs b/Projectiles/Rogue/CraniumSmasherProj.cs index b2bc71b179..71fe67556d 100644 --- a/Projectiles/Rogue/CraniumSmasherProj.cs +++ b/Projectiles/Rogue/CraniumSmasherProj.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CraniumSmasherProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CraniumSmasher"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cranium Smasher"); @@ -15,7 +17,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 50; projectile.height = 50; projectile.friendly = true; - projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.penetrate = 5; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; @@ -44,13 +47,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Rogue/CraniumSmasherProj.png b/Projectiles/Rogue/CraniumSmasherProj.png deleted file mode 100644 index ee328a69cc..0000000000 Binary files a/Projectiles/Rogue/CraniumSmasherProj.png and /dev/null differ diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index 7e616a124d..1aa7596445 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -2,6 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class CraniumSmasherStealth : ModProjectile @@ -18,6 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 50; projectile.height = 50; projectile.friendly = true; + projectile.ignoreWater = true; projectile.penetrate = 5; projectile.timeLeft = 300; projectile.usesLocalNPCImmunity = true; @@ -67,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; projectile.Damage(); - Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14); + Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14); CalamityUtils.ExplosionGores(projectile.Center, 3); for (int num194 = 0; num194 < 25; num194++) { diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 71e08ebe97..26c1194e50 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.penetrate = 2; projectile.aiStyle = 2; projectile.timeLeft = 300; aiType = ProjectileID.ThrowingKnife; @@ -27,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 350f, 12f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -39,7 +40,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.cs b/Projectiles/Rogue/CrystalPiercerProjectile.cs index 67d6c09b97..300be26580 100644 --- a/Projectiles/Rogue/CrystalPiercerProjectile.cs +++ b/Projectiles/Rogue/CrystalPiercerProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CrystalPiercerProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CrystalPiercer"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Piercer"); @@ -35,11 +37,9 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f); } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + 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) { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/CrystalPiercerProjectile.png b/Projectiles/Rogue/CrystalPiercerProjectile.png deleted file mode 100644 index eec2382c63..0000000000 Binary files a/Projectiles/Rogue/CrystalPiercerProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/Crystalline2.cs b/Projectiles/Rogue/Crystalline2.cs index 3bcb692706..2e826f872f 100644 --- a/Projectiles/Rogue/Crystalline2.cs +++ b/Projectiles/Rogue/Crystalline2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Crystalline2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Crystalline"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystalline"); @@ -28,11 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.localAI[0]++; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); - if (projectile.spriteDirection == -1) - { - projectile.rotation -= MathHelper.PiOver2; - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (projectile.localAI[0] == 10f && projectile.ai[1] == 1f) { int numProj = 2; @@ -70,7 +68,8 @@ namespace CalamityMod.Projectiles.Rogue { 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); - Main.projectile[shard].Calamity().forceRogue = true; + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceRogue = true; } } } diff --git a/Projectiles/Rogue/Crystalline2.png b/Projectiles/Rogue/Crystalline2.png deleted file mode 100644 index 70e714e1c8..0000000000 Binary files a/Projectiles/Rogue/Crystalline2.png and /dev/null differ diff --git a/Projectiles/Rogue/CrystallineProj.cs b/Projectiles/Rogue/CrystallineProj.cs index 9df12d07e1..70a21036b0 100644 --- a/Projectiles/Rogue/CrystallineProj.cs +++ b/Projectiles/Rogue/CrystallineProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CrystallineProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Crystalline"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystalline"); @@ -27,11 +29,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); - if (projectile.spriteDirection == -1) - { - projectile.rotation -= MathHelper.PiOver2; - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); projectile.ai[1] += 1f; if (projectile.ai[1] == 30f) { diff --git a/Projectiles/Rogue/CrystallineProj.png b/Projectiles/Rogue/CrystallineProj.png deleted file mode 100644 index 70e714e1c8..0000000000 Binary files a/Projectiles/Rogue/CrystallineProj.png and /dev/null differ diff --git a/Projectiles/Rogue/CursedDaggerProj.cs b/Projectiles/Rogue/CursedDaggerProj.cs index 70b8d075be..bdddc72975 100644 --- a/Projectiles/Rogue/CursedDaggerProj.cs +++ b/Projectiles/Rogue/CursedDaggerProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class CursedDaggerProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/CursedDagger"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cursed Dagger"); @@ -41,10 +43,13 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - Main.projectile[flame].Calamity().forceRogue = true; - Main.projectile[flame].usesLocalNPCImmunity = true; - Main.projectile[flame].localNPCHitCooldown = 10; + 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; + Main.projectile[flame].usesLocalNPCImmunity = true; + Main.projectile[flame].localNPCHitCooldown = 10; + } } } } @@ -67,7 +72,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/CursedDaggerProj.png b/Projectiles/Rogue/CursedDaggerProj.png deleted file mode 100644 index 9a81c1fccc..0000000000 Binary files a/Projectiles/Rogue/CursedDaggerProj.png and /dev/null differ diff --git a/Projectiles/Rogue/DeepSeaDumbbell1.cs b/Projectiles/Rogue/DeepSeaDumbbell1.cs index c67740a287..b914996c9c 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell1.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell1.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DeepSeaDumbbell1 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DeepSeaDumbbell"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Sea Dumbbell"); @@ -73,9 +75,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.defense > 0) - target.defense -= 15; - target.AddBuff(ModContent.BuffType(), 600); Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); diff --git a/Projectiles/Rogue/DeepSeaDumbbell1.png b/Projectiles/Rogue/DeepSeaDumbbell1.png deleted file mode 100644 index eff272685f..0000000000 Binary files a/Projectiles/Rogue/DeepSeaDumbbell1.png and /dev/null differ diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.cs b/Projectiles/Rogue/DeepSeaDumbbell2.cs index e52f09b46c..90c9672d52 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell2.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell2.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DeepSeaDumbbell2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DeepSeaDumbbell"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Sea Dumbbell"); @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; @@ -80,9 +82,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.defense > 0) - target.defense -= 15; - target.AddBuff(ModContent.BuffType(), 600); Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); diff --git a/Projectiles/Rogue/DeepSeaDumbbell2.png b/Projectiles/Rogue/DeepSeaDumbbell2.png deleted file mode 100644 index 765f532311..0000000000 Binary files a/Projectiles/Rogue/DeepSeaDumbbell2.png and /dev/null differ diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.cs b/Projectiles/Rogue/DeepSeaDumbbell3.cs index bf1888a56e..49758ee5e9 100644 --- a/Projectiles/Rogue/DeepSeaDumbbell3.cs +++ b/Projectiles/Rogue/DeepSeaDumbbell3.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DeepSeaDumbbell3 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DeepSeaDumbbell"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Sea Dumbbell"); @@ -30,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f); } projectile.rotation += Math.Abs(projectile.velocity.X) * 0.01f * (float)projectile.direction; @@ -72,9 +74,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.defense > 0) - target.defense -= 15; - target.AddBuff(ModContent.BuffType(), 600); Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 43, 0.35f, 0f); diff --git a/Projectiles/Rogue/DeepSeaDumbbell3.png b/Projectiles/Rogue/DeepSeaDumbbell3.png deleted file mode 100644 index 7f508c0914..0000000000 Binary files a/Projectiles/Rogue/DeepSeaDumbbell3.png and /dev/null differ diff --git a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs index 2fdbe96ce3..f30d04fd95 100644 --- a/Projectiles/Rogue/DeepSeaDumbbellWeight.cs +++ b/Projectiles/Rogue/DeepSeaDumbbellWeight.cs @@ -60,9 +60,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.defense > 0) - target.defense -= 15; - target.AddBuff(ModContent.BuffType(), 600); } diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 59e0021e9b..2b36d2babc 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DeepWounderProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DeepWounder"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Deep Wounder Projectile"); @@ -20,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 600; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/DeepWounderProjectile.png b/Projectiles/Rogue/DeepWounderProjectile.png deleted file mode 100644 index 0212f6a971..0000000000 Binary files a/Projectiles/Rogue/DeepWounderProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/DeepWounderWater.cs b/Projectiles/Rogue/DeepWounderWater.cs index bd36f500e3..844854db19 100644 --- a/Projectiles/Rogue/DeepWounderWater.cs +++ b/Projectiles/Rogue/DeepWounderWater.cs @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 50; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/DeificThunderboltProj.cs b/Projectiles/Rogue/DeificThunderboltProj.cs index bcfca59e95..3459ec91e8 100644 --- a/Projectiles/Rogue/DeificThunderboltProj.cs +++ b/Projectiles/Rogue/DeificThunderboltProj.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { - DisplayName.SetDefault("Lightning"); + DisplayName.SetDefault("Deific Thunderbolt"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; Main.projFrames[projectile.type] = 8; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)projectile.position.X, (int)projectile.position.Y); } - int amt = stealthStrike ? Main.rand.Next(3, 6) : 1; + int amt = stealthStrike ? 5 : 1; float damageMult = stealthStrike ? 0.5f : 1f; for (int n = 0; n < amt; n++) { @@ -89,22 +89,22 @@ namespace CalamityMod.Projectiles.Rogue 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)) * 7f; + 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); - Main.projectile[proj].extraUpdates += 6; + Main.projectile[proj].extraUpdates += 9; //Does not force to Rogue because lightning is extremely abusable with Moonstone Crown Main.projectile[proj].friendly = true; Main.projectile[proj].hostile = false; Main.projectile[proj].penetrate = -1; Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 2400; + Main.projectile[proj].localNPCHitCooldown = -1; } } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f94aa0fd13..67965c5e3a 100644 --- a/Projectiles/Rogue/DesecratedBubble.cs +++ b/Projectiles/Rogue/DesecratedBubble.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[1] == 0f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 8f, 20f); } } } @@ -82,19 +82,9 @@ namespace CalamityMod.Projectiles.Rogue } } - // Cannot deal damage for the first several frames of existence. - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft >= 100) - { - return false; - } - return null; - } + // Cannot deal damage for the first several frames of existence. + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 100; - public override bool CanHitPvp(Player target) - { - return projectile.timeLeft < 100; - } + public override bool CanHitPvp(Player target) => projectile.timeLeft < 100; } } \ No newline at end of file diff --git a/Projectiles/Rogue/DesecratedWaterProj.cs b/Projectiles/Rogue/DesecratedWaterProj.cs index 0790402941..0120c37d0d 100644 --- a/Projectiles/Rogue/DesecratedWaterProj.cs +++ b/Projectiles/Rogue/DesecratedWaterProj.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DesecratedWaterProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DesecratedWater"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Desecrated Water"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 25; projectile.height = 25; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 2; projectile.timeLeft = 300; aiType = ProjectileID.ThrowingKnife; diff --git a/Projectiles/Rogue/DesecratedWaterProj.png b/Projectiles/Rogue/DesecratedWaterProj.png deleted file mode 100644 index e9fbc43d8c..0000000000 Binary files a/Projectiles/Rogue/DesecratedWaterProj.png and /dev/null differ diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index f90577c3fa..f467af26f8 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.alpha > 0) projectile.alpha -= 8; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; float num29 = 5f; float num30 = 300f; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 2018a0a830..ff99544287 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DestructionStar : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/StarofDestruction"; + public int hitCount = 0; private static float Radius = 47f; diff --git a/Projectiles/Rogue/DestructionStar.png b/Projectiles/Rogue/DestructionStar.png deleted file mode 100644 index 46c3428789..0000000000 Binary files a/Projectiles/Rogue/DestructionStar.png and /dev/null differ diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 1c098b42a1..73117aab85 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -11,26 +11,28 @@ namespace CalamityMod.Projectiles.Rogue { public NPC target; public Vector2 rotationVector = Vector2.UnitY * -13f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 5; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; - projectile.scale = 1f; + 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.Calamity().rogue = true; + } - public override void AI() + 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) @@ -38,37 +40,48 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f); projectile.localAI[0] = 1f; } + projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) - { + if (projectile.frame >= Main.projFrames[projectile.type]) projectile.frame = 0; - } - if (projectile.timeLeft >= 380) - { - projectile.velocity *= 1.07f; - } - else if (target != null) - { - projectile.velocity = (projectile.velocity * 23f + projectile.DirectionTo(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])); - } + + if (projectile.timeLeft >= 380) + { + projectile.velocity *= 1.07f; + } + else if (target != null) + { + 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])); + } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + // 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 cap = 5; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { @@ -78,35 +91,30 @@ namespace CalamityMod.Projectiles.Rogue 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, (int)projectile.position.X, (int)projectile.position.Y); - 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 num621 = 0; num621 < 5; num621++) + Main.PlaySound(SoundID.Item14, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 80); + for (int d = 0; d < 5; d++) { - int num622 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + 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)) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 8; num623++) + for (int d = 0; d < 8; d++) { - int num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 244, 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 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); + Main.dust[idx].velocity *= 2f; } CalamityUtils.ExplosionGores(projectile.Center, 3); - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.Damage(); } } } diff --git a/Projectiles/Rogue/DragonShit.png b/Projectiles/Rogue/DragonShit.png index 24f7e7a2b3..502339b5c9 100644 Binary files a/Projectiles/Rogue/DragonShit.png and b/Projectiles/Rogue/DragonShit.png differ diff --git a/Projectiles/Rogue/DukesDecapitatorBubble.cs b/Projectiles/Rogue/DukesDecapitatorBubble.cs index 829d2c7a65..77347524df 100644 --- a/Projectiles/Rogue/DukesDecapitatorBubble.cs +++ b/Projectiles/Rogue/DukesDecapitatorBubble.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DukesDecapitatorBubble : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Typeless/CoralBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bubble"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.alpha = 255; + projectile.ignoreWater = true; + projectile.alpha = 255; projectile.penetrate = 1; projectile.timeLeft = 300; } @@ -66,9 +69,6 @@ namespace CalamityMod.Projectiles.Rogue 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); int num190 = Main.rand.Next(5, 9); for (int num191 = 0; num191 < num190; num191++) { diff --git a/Projectiles/Rogue/DukesDecapitatorBubble.png b/Projectiles/Rogue/DukesDecapitatorBubble.png deleted file mode 100644 index e3e51784ba..0000000000 Binary files a/Projectiles/Rogue/DukesDecapitatorBubble.png and /dev/null differ diff --git a/Projectiles/Rogue/DukesDecapitatorProj.cs b/Projectiles/Rogue/DukesDecapitatorProj.cs index 5dcde53c74..2162902ecd 100644 --- a/Projectiles/Rogue/DukesDecapitatorProj.cs +++ b/Projectiles/Rogue/DukesDecapitatorProj.cs @@ -8,10 +8,9 @@ using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Rogue { public class DukesDecapitatorProj : ModProjectile - { - bool stealthBubbles = false; + { float rotationAmount = 1.5f; - + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DukesDecapitator"; public override void SetStaticDefaults() { DisplayName.SetDefault("Decapitator"); @@ -24,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; @@ -35,31 +35,25 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); - if(projectile.velocity.X != 0 || projectile.velocity.Y != 0) + if (projectile.velocity.X != 0 || projectile.velocity.Y != 0) { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; + projectile.velocity *= 0.99f; } projectile.ai[0] += 1f; - if(projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) - { - stealthBubbles = true; - projectile.Calamity().stealthStrike = true; - } if (projectile.ai[0] == 5f) projectile.tileCollide = true; if ((projectile.ai[0] % 15f) == 0f && rotationAmount > 0) { rotationAmount -= 0.05f; - if(stealthBubbles == true && 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)((double)projectile.damage * 0.8), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner); } } - if(rotationAmount <= 0f) + if (rotationAmount <= 0f) projectile.Kill(); projectile.rotation += rotationAmount; @@ -67,8 +61,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - projectile.velocity.X = 0f; - projectile.velocity.Y = 0f; + projectile.velocity = Vector2.Zero; rotationAmount -= 0.05f; } @@ -82,7 +75,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/DukesDecapitatorProj.png b/Projectiles/Rogue/DukesDecapitatorProj.png deleted file mode 100644 index b65fe6725e..0000000000 Binary files a/Projectiles/Rogue/DukesDecapitatorProj.png and /dev/null differ diff --git a/Projectiles/Rogue/DuneHopperProjectile.cs b/Projectiles/Rogue/DuneHopperProjectile.cs index 6993f781e0..4a91a280ac 100644 --- a/Projectiles/Rogue/DuneHopperProjectile.cs +++ b/Projectiles/Rogue/DuneHopperProjectile.cs @@ -1,12 +1,14 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class DuneHopperProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuneHopper"; public override void SetStaticDefaults() { @@ -34,11 +36,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y += 0.4f; } } - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -60,7 +58,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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/DuneHopperProjectile.png b/Projectiles/Rogue/DuneHopperProjectile.png deleted file mode 100644 index a000180d87..0000000000 Binary files a/Projectiles/Rogue/DuneHopperProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index d61ebad5c5..f03be7d21f 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class DuststormInABottleProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Duststorm"); @@ -16,6 +18,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; + projectile.ignoreWater = true; projectile.penetrate = 1; projectile.aiStyle = 2; projectile.timeLeft = 180; diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs index abafa6657c..05f3f06686 100644 --- a/Projectiles/Rogue/EclipseMirrorBurst.cs +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 750; - projectile.height = 750; + projectile.width = 752; + projectile.height = 752; projectile.friendly = true; projectile.alpha = 0; projectile.penetrate = -1; @@ -49,25 +49,22 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/EclipseMirrorFlash"); + Texture2D texture = Main.projectileTexture[projectile.type]; spriteBatch.Draw ( texture, - new Vector2 - ( - projectile.position.X - Main.screenPosition.X + projectile.width * 0.5f - 50, - projectile.position.Y - Main.screenPosition.Y + projectile.height - 750 * 0.5f - 50 - ), - new Rectangle(frameX * 752, frameY * 752, 750, 750), + projectile.Center - Main.screenPosition, + new Rectangle(frameX * 752, frameY * 752, 752, 752), Color.White, projectile.rotation, - new Vector2(325, 325), + projectile.Size / 2f, projectile.scale, SpriteEffects.None, 0f ); + return false; } } } diff --git a/Projectiles/Rogue/EclipseMirrorBurst.png b/Projectiles/Rogue/EclipseMirrorBurst.png index c51889a8cd..31dbce55bb 100644 Binary files a/Projectiles/Rogue/EclipseMirrorBurst.png and b/Projectiles/Rogue/EclipseMirrorBurst.png differ diff --git a/Projectiles/Rogue/EclipseMirrorFlash.png b/Projectiles/Rogue/EclipseMirrorFlash.png deleted file mode 100644 index 31dbce55bb..0000000000 Binary files a/Projectiles/Rogue/EclipseMirrorFlash.png and /dev/null differ diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 94dfe345b5..d97e6978e3 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class EclipsesFallMain : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eclipse's Fall"); @@ -63,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/EclipsesFallMain.png b/Projectiles/Rogue/EclipsesFallMain.png deleted file mode 100644 index 358cd43775..0000000000 Binary files a/Projectiles/Rogue/EclipsesFallMain.png and /dev/null differ diff --git a/Projectiles/Rogue/EclipsesSmol.cs b/Projectiles/Rogue/EclipsesSmol.cs index 0da5447707..cb05bd132e 100644 --- a/Projectiles/Rogue/EclipsesSmol.cs +++ b/Projectiles/Rogue/EclipsesSmol.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } public override void Kill(int timeLeft) @@ -36,21 +36,21 @@ namespace CalamityMod.Projectiles.Rogue Main.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); - Main.dust[dustInt].velocity *= 3f; - if (Main.rand.NextBool(2)) - { - Main.dust[dustInt].scale = 0.5f; - Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } + 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)) + { + Main.dust[dustInt].scale = 0.5f; + Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } } for (int j = 0; j < 3; j++) { - 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); - Main.dust[moreDust].velocity *= 2f; + 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); + Main.dust[moreDust].velocity *= 2f; } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 4dfec90536..257317e083 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,11 +8,15 @@ namespace CalamityMod.Projectiles.Rogue { public class EclipsesStealth : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EclipsesFall"; + + // For more consistent DPS, always alternates between spawning 1 and 2 spears instead of picking randomly + private bool spawnTwoSpears = true; private bool changedTimeLeft = false; public override void SetStaticDefaults() { - DisplayName.SetDefault("Eclipse's Stealth"); + DisplayName.SetDefault("Eclipse's Fall"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -32,44 +35,59 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } + // Uses localAI[1] to decide how many frames until the next spear drops. public override void AI() { - if (projectile.timeLeft % 5 == 0) //congrats Pinkie... every 5 ticks + // Behavior when not sticking to anything + if (projectile.ai[0] == 0f) { - if (Main.rand.NextBool(2) && Main.myPlayer == projectile.owner) + // Keep the spear oriented in the correct direction + 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); + } + + // Behavior when having impaled a target + else + { + // Eclipse's Fall is guaranteed to impale for 10 seconds, no more, no less + if (!changedTimeLeft) { - float dmgKBMult = Main.rand.NextFloat(0.4f, 0.6f); - int spearAmt = Main.rand.Next(1, 3); //1 to 2 spears - for (int n = 0; n < spearAmt; n++) + projectile.timeLeft = 600; + changedTimeLeft = true; + } + + // Spawn spears. As this uses local AI, it's done client-side only. + if (projectile.owner == Main.myPlayer) + { + projectile.localAI[1] -= 1f; + + if (projectile.localAI[1] <= 0f) { - CalamityUtils.ProjectileRain(projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(projectile.damage * dmgKBMult), projectile.knockBack * dmgKBMult, projectile.owner); + // 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 + + int type = ModContent.ProjectileType(); + 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); } } } - //Behavior when not sticking to anything - if (projectile.ai[0] == 0f) - { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; - if (Main.rand.NextBool(8)) //dust - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 138, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - } - - //Ensures that a spear will last 10 seconds after it hits something - if (projectile.ai[0] == 1f && !changedTimeLeft) - { - projectile.timeLeft = 600; - changedTimeLeft = true; - } - - //Sticky Behaviour + // Sticky behavior. Lets the projectile impale enemies and sticks to its impaled enemy automatically. 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); } @@ -84,18 +102,11 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } - public override bool? CanHitNPC(NPC target) - { - if (projectile.ai[0] == 1f) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.ai[0] != 1f; public override bool CanHitPvp(Player target) => projectile.ai[0] != 1f; } diff --git a/Projectiles/Rogue/EclipsesStealth.png b/Projectiles/Rogue/EclipsesStealth.png deleted file mode 100644 index 358cd43775..0000000000 Binary files a/Projectiles/Rogue/EclipsesStealth.png and /dev/null differ diff --git a/Projectiles/Rogue/EnchantedAxe2.cs b/Projectiles/Rogue/EnchantedAxe2.cs index 1fcbab5b14..2755d7be5b 100644 --- a/Projectiles/Rogue/EnchantedAxe2.cs +++ b/Projectiles/Rogue/EnchantedAxe2.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class EnchantedAxe2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EnchantedAxe"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Enchanted Axe"); diff --git a/Projectiles/Rogue/EnchantedAxe2.png b/Projectiles/Rogue/EnchantedAxe2.png deleted file mode 100644 index cdae20aa68..0000000000 Binary files a/Projectiles/Rogue/EnchantedAxe2.png and /dev/null differ diff --git a/Projectiles/Rogue/EnchantedAxeProj.cs b/Projectiles/Rogue/EnchantedAxeProj.cs index 4dfc4f69ac..d4dceb78db 100644 --- a/Projectiles/Rogue/EnchantedAxeProj.cs +++ b/Projectiles/Rogue/EnchantedAxeProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class EnchantedAxeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EnchantedAxe"; + private bool recall = false; private bool summonAxe = true; @@ -127,7 +129,7 @@ namespace CalamityMod.Projectiles.Rogue { 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); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/EnchantedAxeProj.png b/Projectiles/Rogue/EnchantedAxeProj.png deleted file mode 100644 index cdae20aa68..0000000000 Binary files a/Projectiles/Rogue/EnchantedAxeProj.png and /dev/null differ diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.cs b/Projectiles/Rogue/EpidemicShredderProjectile.cs index e5ad162a6c..10c8b6aa9d 100644 --- a/Projectiles/Rogue/EpidemicShredderProjectile.cs +++ b/Projectiles/Rogue/EpidemicShredderProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class EpidemicShredderProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/EpidemicShredder"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Epidemic Shredder"); @@ -36,16 +38,15 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.timeLeft < 580f) { - projectile.velocity = (projectile.velocity * 18f + projectile.DirectionTo(Main.player[projectile.owner].Center) * 18f) / 19f; + 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) { int projIndex2 = Projectile.NewProjectile(projectile.Center, (projectile.velocity * -1f).RotatedByRandom(MathHelper.ToRadians(15f)), ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); - Main.projectile[projIndex2].Calamity().forceRogue = true; + if (projIndex2.WithinBounds(Main.maxProjectiles)) + Main.projectile[projIndex2].Calamity().forceRogue = true; } } @@ -64,7 +65,8 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 0f) { int projIndex1 = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); - Main.projectile[projIndex1].Calamity().forceRogue = true; + if (projIndex1.WithinBounds(Main.maxProjectiles)) + Main.projectile[projIndex1].Calamity().forceRogue = true; projectile.ai[0] = 12f; //0.2th of a second cooldown } projectile.penetrate--; @@ -80,7 +82,8 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 0f) { int projectileIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); - Main.projectile[projectileIndex].Calamity().forceRogue = true; + if (projectileIndex.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectileIndex].Calamity().forceRogue = true; projectile.ai[0] = 12f; //0.2th of a second cooldown } target.AddBuff(ModContent.BuffType(), 300); @@ -91,7 +94,8 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 0f) { int projectileIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.25f), 2f, projectile.owner); - Main.projectile[projectileIndex].Calamity().forceRogue = true; + if (projectileIndex.WithinBounds(Main.maxProjectiles)) + Main.projectile[projectileIndex].Calamity().forceRogue = true; projectile.ai[0] = 12f; //0.2th of a second cooldown } target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Rogue/EpidemicShredderProjectile.png b/Projectiles/Rogue/EpidemicShredderProjectile.png deleted file mode 100644 index 22c9f4381a..0000000000 Binary files a/Projectiles/Rogue/EpidemicShredderProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/EquanimityDarkShard.cs b/Projectiles/Rogue/EquanimityDarkShard.cs index f77c90d281..3603af26f3 100644 --- a/Projectiles/Rogue/EquanimityDarkShard.cs +++ b/Projectiles/Rogue/EquanimityDarkShard.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 14; projectile.friendly = true; - projectile.alpha = 0; + projectile.ignoreWater = true; + projectile.alpha = 0; projectile.penetrate = 1; projectile.tileCollide = true; projectile.timeLeft = 120; diff --git a/Projectiles/Rogue/EquanimityLightShard.cs b/Projectiles/Rogue/EquanimityLightShard.cs index 5eebb24db8..bec2451479 100644 --- a/Projectiles/Rogue/EquanimityLightShard.cs +++ b/Projectiles/Rogue/EquanimityLightShard.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 14; projectile.friendly = true; - projectile.alpha = 0; + projectile.ignoreWater = true; + projectile.alpha = 0; projectile.penetrate = 3; projectile.tileCollide = true; projectile.timeLeft = 120; diff --git a/Projectiles/Rogue/EquanimityProj.cs b/Projectiles/Rogue/EquanimityProj.cs index 523d1a41fb..3cfb24208c 100644 --- a/Projectiles/Rogue/EquanimityProj.cs +++ b/Projectiles/Rogue/EquanimityProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class EquanimityProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Equanimity"; + private bool recall = false; public override void SetStaticDefaults() @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 28; projectile.height = 36; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 15; @@ -112,7 +115,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3); return false; } diff --git a/Projectiles/Rogue/EquanimityProj.png b/Projectiles/Rogue/EquanimityProj.png deleted file mode 100644 index 7e0cbdd5e5..0000000000 Binary files a/Projectiles/Rogue/EquanimityProj.png and /dev/null differ diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs new file mode 100644 index 0000000000..38403d84a8 --- /dev/null +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -0,0 +1,214 @@ +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class EradicatorProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Eradicator"; + private const float RotationIncrement = 0.09f; + private const int Lifetime = 170; + private const float ReboundTime = 40f; + + private float randomLaserCharge = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eradicator"); + 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; + } + + public override void AI() + { + // + // Boomerang AI copied from Nanoblack Reaper + // + + // On the frame the disc begins returning, send a net update. + 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) + { + float returnSpeed = Eradicator.Speed * 1.3f; + float acceleration = 0.25f; + 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 dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + 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(); + } + + // Lighting. + 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; + + // If attached to something (this only occurs for stealth strikes), do the buzzsaw grind and spam lasers everywhere. + 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); + } + } + + private void StealthStrikeGrind(float spinDir) + { + // Spin extra fast to visually shred the enemy. + 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); + if (randomLaserCharge >= 1f) + { + 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); + if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) + { + laser.Calamity().forceRogue = true; + laser.aiStyle = Main.rand.NextBool() ? 1 : -1; + laser.penetrate = -1; + laser.usesLocalNPCImmunity = true; + + // This projectile has a hefty amount of extra updates, which will influence the hit cooldown. + laser.localNPCHitCooldown = 120; + } + } + + // Stay stuck to the target. + projectile.StickyProjAI(6, true); + + // If still attached to a target, do nothing. + 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); + if (uDie != null) + { + Vector2 distNorm = (uDie.Center - projectile.Center).SafeNormalize(Vector2.UnitX); + projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 600); + target.AddBuff(BuffID.Frostburn, 600); + } + + public override void ModifyHitPvp(Player target, ref int damage, ref bool crit) => OnHit(); + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) => OnHit(); + + private void OnHit() + { + // Non-stealth strikes do nothing special on hit. + 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) + { + projectile.velocity *= 0.1f; + + // Provide a fixed amount of grind time so that DPS can't vary wildly. + projectile.timeLeft = 90; + } + + // Apply sticky AI. + projectile.ModifyHitNPCSticky(3, true); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color 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); + } + } +} diff --git a/Projectiles/Rogue/ExecutionersBladeGlow.png b/Projectiles/Rogue/ExecutionersBladeGlow.png deleted file mode 100644 index cc42a1e719..0000000000 Binary files a/Projectiles/Rogue/ExecutionersBladeGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/ExecutionersBladeProj.cs b/Projectiles/Rogue/ExecutionersBladeProj.cs index f8cc4426ce..7215ed3111 100644 --- a/Projectiles/Rogue/ExecutionersBladeProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeProj.cs @@ -9,20 +9,17 @@ namespace CalamityMod.Projectiles.Rogue { public class ExecutionersBladeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ExecutionersBlade"; - private void handleStealth(Vector2 position, int damage, bool crit, float knockback) + private void handleStealth(Vector2 position) { if (Main.myPlayer == projectile.owner) { - Player player = Main.player[projectile.owner]; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) - { - Main.PlaySound(SoundID.Item73, projectile.position); - for (int i = 0; i < 20; i++) - { - Projectile.NewProjectile(new Vector2(position.X + (-600 + i * 60), position.Y - 800), new Vector2(0f, 5f), ModContent.ProjectileType(), (int)((double)projectile.damage * 1.2f), projectile.knockBack, player.whoAmI); - } - } + Main.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); + } } } @@ -39,7 +36,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 64; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 2; projectile.timeLeft = 240; aiType = ProjectileID.ThrowingKnife; @@ -53,13 +51,13 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 1200f, 26f, 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/Projectiles/Rogue/ExecutionersBladeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("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) @@ -67,7 +65,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 300); if (projectile.Calamity().stealthStrike) { - handleStealth(target.Center, damage, crit, knockback); + handleStealth(target.Center); } } @@ -76,16 +74,13 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 300); if (projectile.Calamity().stealthStrike) { - handleStealth(target.Center, damage, crit, 0f); + handleStealth(target.Center); } } 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); for (int num621 = 0; num621 < 3; num621++) { @@ -109,7 +104,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExecutionersBladeProj.png b/Projectiles/Rogue/ExecutionersBladeProj.png deleted file mode 100644 index bdc4b8fe5d..0000000000 Binary files a/Projectiles/Rogue/ExecutionersBladeProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ExecutionersBladeStealthGlow.png b/Projectiles/Rogue/ExecutionersBladeStealthGlow.png deleted file mode 100644 index cc42a1e719..0000000000 Binary files a/Projectiles/Rogue/ExecutionersBladeStealthGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs index 6a57b35726..133ede7040 100644 --- a/Projectiles/Rogue/ExecutionersBladeStealthProj.cs +++ b/Projectiles/Rogue/ExecutionersBladeStealthProj.cs @@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class ExecutionersBladeStealthProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ExecutionersBlade"; public override void SetStaticDefaults() { @@ -24,13 +25,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.tileCollide = false; projectile.penetrate = 1; - projectile.timeLeft = 100; + projectile.timeLeft = 200; projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; } public override void AI() { - if (projectile.timeLeft >= 75) + 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); @@ -39,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(32f, 32f); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ExecutionersBladeStealthGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("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) @@ -54,10 +56,7 @@ namespace CalamityMod.Projectiles.Rogue 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 128); Main.PlaySound(SoundID.Item74, (int)projectile.position.X, (int)projectile.position.Y); for (int num621 = 0; num621 < 3; num621++) { @@ -81,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ExecutionersBladeStealthProj.png b/Projectiles/Rogue/ExecutionersBladeStealthProj.png deleted file mode 100644 index bdc4b8fe5d..0000000000 Binary files a/Projectiles/Rogue/ExecutionersBladeStealthProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 3029ed2be5..4a59aa156b 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ExorcismProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Exorcism"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Exorcism"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.alpha = 0; + projectile.ignoreWater = true; + projectile.alpha = 0; projectile.penetrate = 1; projectile.tileCollide = true; projectile.timeLeft = 600; diff --git a/Projectiles/Rogue/ExorcismProj.png b/Projectiles/Rogue/ExorcismProj.png deleted file mode 100644 index f3c6031a7a..0000000000 Binary files a/Projectiles/Rogue/ExorcismProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index a7211b83fc..ede3620ccc 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,4 +1,3 @@ - using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -7,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ExorcismShockwave : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static float radius = 100; public override void SetStaticDefaults() diff --git a/Projectiles/Rogue/ExorcismShockwave.png b/Projectiles/Rogue/ExorcismShockwave.png deleted file mode 100644 index 5cd30373af..0000000000 Binary files a/Projectiles/Rogue/ExorcismShockwave.png and /dev/null differ diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs index b67b6fa54d..44a2f1b27a 100644 --- a/Projectiles/Rogue/ExplosiveSun.cs +++ b/Projectiles/Rogue/ExplosiveSun.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 22; //projectile.aiStyle = 115; projectile.friendly = true; + projectile.ignoreWater = true; projectile.penetrate = 1; projectile.light = 0.5f; projectile.alpha = 50; diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 744533b7e7..a46ae0af24 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -48,8 +48,11 @@ namespace CalamityMod.Projectiles.Rogue { int spiritDamage = projectile.damage / 2; Projectile ghost = CalamityGlobalProjectile.SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); - ghost.Calamity().forceRogue = true; - ghost.penetrate = 1; + if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) + { + ghost.Calamity().forceRogue = true; + ghost.penetrate = 1; + } } } } @@ -57,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index fb27738123..375a2e1322 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class FantasyTalismanStealth : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/FantasyTalismanProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Talisman"); @@ -58,8 +60,11 @@ namespace CalamityMod.Projectiles.Rogue { int spiritDamage = projectile.damage / 2; Projectile ghost = CalamityGlobalProjectile.SpawnOrb(projectile, spiritDamage, ProjectileID.SpectreWrath, 800f, 4f); - ghost.Calamity().forceRogue = true; - ghost.penetrate = 1; + if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) + { + ghost.Calamity().forceRogue = true; + ghost.penetrate = 1; + } } } } @@ -67,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/FantasyTalismanStealth.png b/Projectiles/Rogue/FantasyTalismanStealth.png deleted file mode 100644 index 197b14099b..0000000000 Binary files a/Projectiles/Rogue/FantasyTalismanStealth.png and /dev/null differ diff --git a/Projectiles/Rogue/FeatherKnifeProjectile.cs b/Projectiles/Rogue/FeatherKnifeProjectile.cs index 003f9bf825..986aad93c0 100644 --- a/Projectiles/Rogue/FeatherKnifeProjectile.cs +++ b/Projectiles/Rogue/FeatherKnifeProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class FeatherKnifeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/FeatherKnife"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); @@ -39,7 +41,8 @@ namespace CalamityMod.Projectiles.Rogue 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); - Main.projectile[proj].Calamity().forceRogue = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceRogue = true; } } } @@ -47,15 +50,14 @@ 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); - Main.projectile[proj].Calamity().forceRogue = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceRogue = true; } public override void Kill(int timeLeft) { - if (Main.rand.NextBool(2) && !projectile.Calamity().stealthStrike) - { + 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/FeatherKnifeProjectile.png b/Projectiles/Rogue/FeatherKnifeProjectile.png deleted file mode 100644 index 0c0b80d6c9..0000000000 Binary files a/Projectiles/Rogue/FeatherKnifeProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/FinalDawnFireSlash.cs b/Projectiles/Rogue/FinalDawnFireSlash.cs index ff28601aa3..1189bd149a 100644 --- a/Projectiles/Rogue/FinalDawnFireSlash.cs +++ b/Projectiles/Rogue/FinalDawnFireSlash.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 300; projectile.height = 398; projectile.friendly = false; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.tileCollide = false; projectile.Calamity().rogue = true; projectile.ownerHitCheck = true; @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null) + if (player is null || player.dead) projectile.Kill(); player.direction = projectile.direction; @@ -49,7 +50,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[1] == 5) { projectile.friendly = true; - Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Item71, projectile.Center); } } if (projectile.ai[1] >= 11) diff --git a/Projectiles/Rogue/FinalDawnFireball.cs b/Projectiles/Rogue/FinalDawnFireball.cs index 2df97df18e..1a4e9bc4c9 100644 --- a/Projectiles/Rogue/FinalDawnFireball.cs +++ b/Projectiles/Rogue/FinalDawnFireball.cs @@ -35,17 +35,17 @@ namespace CalamityMod.Projectiles.Rogue if(!chargeAt.active) projectile.Kill(); - int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, ModContent.DustType(), 0f, 0f, 0, default, 1.0f); + 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) + if (projectile.ai[0] >= 20) { projectile.friendly = true; NPC npc = Main.npc[(int)projectile.ai[1]]; - Vector2 desiredVelocity = projectile.DirectionTo(npc.Center) * DesiredSpeed; + Vector2 desiredVelocity = projectile.SafeDirectionTo(npc.Center) * DesiredSpeed; projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); if(!npc.active) projectile.Kill(); diff --git a/Projectiles/Rogue/FinalDawnFlame.cs b/Projectiles/Rogue/FinalDawnFlame.cs index c5ba6d565f..294f0b6a24 100644 --- a/Projectiles/Rogue/FinalDawnFlame.cs +++ b/Projectiles/Rogue/FinalDawnFlame.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Rogue Flames = new Flame[TotalFlames]; for (int i = 0; i < Flames.Length; i++) { - Vector2 flamePosition = Main.rand.NextVector2Circular(projectile.width / 2, 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); @@ -57,16 +57,16 @@ namespace CalamityMod.Projectiles.Rogue Flames[i].Direction = Main.rand.Next(2); } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + 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]; - + if (Flames.Length > 0) { - for(int i = 0; i < Flames.Length; i++) - { + for (int i = 0; i < Flames.Length; i++) + { int frameHeight2 = frameHeight * Flames[i].Frame; spriteBatch.Draw(texture, projectile.Center + Flames[i].Position - Main.screenPosition, @@ -77,9 +77,9 @@ namespace CalamityMod.Projectiles.Rogue Flames[i].Scale, Flames[i].Direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); - } + } } - return false; + return false; } public override void AI() @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[0] < 570) { - Vector2 pos = new Vector2(Main.rand.NextFloat(projectile.width / 2)).RotatedByRandom(MathHelper.TwoPi); + Vector2 pos = new Vector2(Main.rand.NextFloat(projectile.width * 0.36f)).RotatedByRandom(MathHelper.TwoPi); float widthHeightRatio = (float)projectile.height / projectile.width; pos.Y *= widthHeightRatio; diff --git a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs index 63e04254e4..ee41c0781b 100644 --- a/Projectiles/Rogue/FinalDawnHorizontalSlash.cs +++ b/Projectiles/Rogue/FinalDawnHorizontalSlash.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 600; projectile.height = 156; projectile.friendly = false; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.tileCollide = false; projectile.Calamity().rogue = true; projectile.ownerHitCheck = true; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null) + if (player is null || player.dead) projectile.Kill(); projectile.Center = player.Center; diff --git a/Projectiles/Rogue/FinalDawnProjectile.cs b/Projectiles/Rogue/FinalDawnProjectile.cs index 9ba9fc1557..ce177acb2a 100644 --- a/Projectiles/Rogue/FinalDawnProjectile.cs +++ b/Projectiles/Rogue/FinalDawnProjectile.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 16; projectile.friendly = false; projectile.Calamity().rogue = true; + projectile.ignoreWater = true; projectile.penetrate = -1; projectile.tileCollide = false; //projectile.extraUpdates = 2; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null) + if (player is null || player.dead) projectile.Kill(); if (Main.myPlayer == player.whoAmI) @@ -99,9 +100,9 @@ namespace CalamityMod.Projectiles.Rogue if (player.Calamity().StealthStrikeAvailable() && projectile.ai[1] != 1f) { int stealth = Projectile.NewProjectile(player.Center, - player.DirectionTo(Main.MouseWorld) * 38f, + player.SafeDirectionTo(Main.MouseWorld) * 38f, ModContent.ProjectileType(), - (int)(projectile.damage * 1.5f), + (int)(projectile.damage * 1.05f), projectile.knockBack, projectile.owner); Main.projectile[stealth].Calamity().stealthStrike = true; @@ -110,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue else { Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(Main.MouseWorld) * 38f, + projectile.SafeDirectionTo(Main.MouseWorld) * 38f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); if (projectile.ai[1] != 1f) @@ -144,6 +145,8 @@ namespace CalamityMod.Projectiles.Rogue } } } + else + player.Calamity().ConsumeStealthByAttacking(); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/FinalDawnThrow.cs b/Projectiles/Rogue/FinalDawnThrow.cs index d09dc8400f..40f3d2d823 100644 --- a/Projectiles/Rogue/FinalDawnThrow.cs +++ b/Projectiles/Rogue/FinalDawnThrow.cs @@ -24,23 +24,24 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 80; projectile.friendly = true; projectile.Calamity().rogue = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.light = 0.0f; projectile.extraUpdates = 2; projectile.tileCollide = false; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; } public override void AI() { Player player = Main.player[projectile.owner]; - if (player.dead || player is null) + if (player is null || player.dead) projectile.Kill(); if (projectile.localAI[0] == 0) { - Main.PlaySound(SoundID.Item71, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Item71, projectile.Center); projectile.localAI[0] = 1; } @@ -50,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0]++; if (projectile.ai[0] >= 30) { - Vector2 desiredVelocity = projectile.DirectionTo(player.Center) * DesiredSpeed; + Vector2 desiredVelocity = projectile.SafeDirectionTo(player.Center) * DesiredSpeed; projectile.velocity = Vector2.Lerp(projectile.velocity, desiredVelocity, 1f / InterpolationTime); float distance = projectile.Distance(player.Center); @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Kill(); } - int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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].noGravity = true; diff --git a/Projectiles/Rogue/FinalDawnThrow2.cs b/Projectiles/Rogue/FinalDawnThrow2.cs index 18ce66d4a1..4efe2a4d1b 100644 --- a/Projectiles/Rogue/FinalDawnThrow2.cs +++ b/Projectiles/Rogue/FinalDawnThrow2.cs @@ -1,3 +1,4 @@ +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -21,12 +22,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 200; projectile.friendly = true; projectile.Calamity().rogue = true; - projectile.penetrate = -1; + 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 = 5; + projectile.localNPCHitCooldown = 10; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { @@ -55,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[projectile.owner]; - if (player.dead || player is null) + if (player is null || player.dead) projectile.Kill(); if (projectile.localAI[0] == 0) @@ -85,7 +87,9 @@ namespace CalamityMod.Projectiles.Rogue player.heldProj = projectile.whoAmI; player.bodyFrame.Y = player.bodyFrame.Height; player.immuneNoBlink = true; - player.immuneTime = 10; + player.immuneTime = 6; + for (int k = 0; k < player.hurtCooldowns.Length; k++) + 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; @@ -96,7 +100,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.Kill(); } - int idx = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width , projectile.height, mod.DustType("FinalFlame"), 0f, 0f, 0, default, 2.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; diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs new file mode 100644 index 0000000000..be8a2ab3ab --- /dev/null +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -0,0 +1,89 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.Projectiles.Rogue +{ + public class FlameScytheProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/FlameScythe"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + 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; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + 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); + 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]--; + } + + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.OnFire, 300); + OnHitEffects(target.Center); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + OnHitEffects(target.Center); + } + + private void OnHitEffects(Vector2 position) + { + 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); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceRogue = true; + 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)) + { + Projectile.NewProjectile(result.ToVector2() * 16f, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner, 1f); + projectile.localAI[0] = 30f; + } + } + } + } + } +} diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 1b7f5b2765..9d1c8bb67a 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -20,11 +20,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 14; projectile.height = 14; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; + projectile.extraUpdates = 1; } public override void AI() @@ -54,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 134deb8fa9..b02e34420c 100644 --- a/Projectiles/Rogue/FossilShardThrown.cs +++ b/Projectiles/Rogue/FossilShardThrown.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class FossilShardThrown : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/FossilShard"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shard"); diff --git a/Projectiles/Rogue/FossilShardThrown.png b/Projectiles/Rogue/FossilShardThrown.png deleted file mode 100644 index 81b7a03b84..0000000000 Binary files a/Projectiles/Rogue/FossilShardThrown.png and /dev/null differ diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index ff7841fd36..ed6ef31c27 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class FrostyFlareProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/FrostyFlare"; + public override void SetDefaults() { projectile.width = 10; @@ -40,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.velocity.X *= 0.99f; projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation(); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (shoot) { @@ -87,7 +89,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); target.immune[projectile.owner] = 0; projectile.ai[0] = 1f; projectile.ai[1] = target.whoAmI; @@ -113,10 +115,8 @@ namespace CalamityMod.Projectiles.Rogue break; } } - //Main.NewText("found " + flaresFound.ToString()); if (flaresFound >= maxFlares && oldestFlare >= 0) { - //Main.NewText("killing flare " + oldestFlare.ToString()); Main.projectile[oldestFlare].Kill(); } } @@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } public override bool CanDamage() => projectile.ai[0] == 0f; diff --git a/Projectiles/Rogue/FrostyFlareProj.png b/Projectiles/Rogue/FrostyFlareProj.png deleted file mode 100644 index 8f934864f9..0000000000 Binary files a/Projectiles/Rogue/FrostyFlareProj.png and /dev/null differ diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index 8b23654c57..d9b2bf1334 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue { public class FrostyFlareStealth : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Rogue/FrostyFlareProj"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/FrostyFlare"; public override void SetDefaults() { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.velocity.X *= 0.99f; projectile.velocity.Y += 0.25f; - projectile.rotation = projectile.velocity.ToRotation(); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; if (shoot) { @@ -57,8 +57,11 @@ namespace CalamityMod.Projectiles.Rogue 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)); - Main.projectile[snowflake].Calamity().forceRogue = true; - Main.projectile[snowflake].timeLeft = 300; + if (snowflake.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[snowflake].Calamity().forceRogue = true; + Main.projectile[snowflake].timeLeft = 300; + } } int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); @@ -69,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue 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) + 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; @@ -95,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); target.immune[projectile.owner] = 0; projectile.ai[0] = 1f; projectile.ai[1] = target.whoAmI; @@ -121,10 +124,8 @@ namespace CalamityMod.Projectiles.Rogue break; } } - //Main.NewText("found " + flaresFound.ToString()); if (flaresFound >= maxFlares && oldestFlare >= 0) { - //Main.NewText("killing flare " + oldestFlare.ToString()); Main.projectile[oldestFlare].Kill(); } } @@ -132,7 +133,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } public override bool CanDamage() => projectile.ai[0] == 0f; diff --git a/Projectiles/Rogue/GacruxianHome.cs b/Projectiles/Rogue/GacruxianHome.cs index a427357321..27f8ae3d03 100644 --- a/Projectiles/Rogue/GacruxianHome.cs +++ b/Projectiles/Rogue/GacruxianHome.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class GacruxianHome : ModProjectile { - private int stealthTrailTimer = 10; + public override string Texture => "CalamityMod/Items/Fishing/AstralCatches/GacruxianMollusk"; public override void SetStaticDefaults() { @@ -22,8 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 18; projectile.friendly = true; projectile.Calamity().rogue = true; - projectile.penetrate = 5; - projectile.timeLeft = 180; + projectile.penetrate = 3; + projectile.timeLeft = 120; projectile.ignoreWater = true; aiType = ProjectileID.DeathSickle; projectile.usesLocalNPCImmunity = true; @@ -32,20 +33,17 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - stealthTrailTimer--; 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); } - if (stealthTrailTimer == 0 && projectile.owner == Main.myPlayer) + if (projectile.timeLeft % 30 == 0 && projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].localNPCHitCooldown = 10; - Main.projectile[proj].penetrate = 3; - stealthTrailTimer = 10; + 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, false, 500f, 16f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 250f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/GacruxianHome.png b/Projectiles/Rogue/GacruxianHome.png deleted file mode 100644 index 4a4defcff8..0000000000 Binary files a/Projectiles/Rogue/GacruxianHome.png and /dev/null differ diff --git a/Projectiles/Rogue/GacruxianProj.cs b/Projectiles/Rogue/GacruxianProj.cs index bed850a36d..db907d792b 100644 --- a/Projectiles/Rogue/GacruxianProj.cs +++ b/Projectiles/Rogue/GacruxianProj.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class GacruxianProj : ModProjectile { - private int sparkTrailTimer = 10; + public override string Texture => "CalamityMod/Items/Fishing/AstralCatches/GacruxianMollusk"; public override void SetStaticDefaults() { @@ -20,7 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; @@ -29,25 +31,22 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - sparkTrailTimer--; 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); } - if (sparkTrailTimer == 0) + if (projectile.timeLeft % 15 == 0) { if (projectile.Calamity().stealthStrike == true) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack, projectile.owner); } else { - int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].localNPCHitCooldown = 10; - Main.projectile[proj].penetrate = 3; + 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; } - sparkTrailTimer = 10; } } diff --git a/Projectiles/Rogue/GacruxianProj.png b/Projectiles/Rogue/GacruxianProj.png deleted file mode 100644 index 4a4defcff8..0000000000 Binary files a/Projectiles/Rogue/GacruxianProj.png and /dev/null differ diff --git a/Projectiles/Rogue/GelDartProjectile.cs b/Projectiles/Rogue/GelDartProjectile.cs index 299cb380e0..6ee65ee71f 100644 --- a/Projectiles/Rogue/GelDartProjectile.cs +++ b/Projectiles/Rogue/GelDartProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class GelDartProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GelDart"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dart"); @@ -34,10 +36,13 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft % 8 == 0) { Vector2 velocity = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); - int flame = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SlimeGun, (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - Main.projectile[flame].Calamity().forceRogue = true; - Main.projectile[flame].usesLocalNPCImmunity = true; - Main.projectile[flame].localNPCHitCooldown = 10; + 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; + Main.projectile[slime].usesLocalNPCImmunity = true; + Main.projectile[slime].localNPCHitCooldown = 10; + } } } } @@ -61,7 +66,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/GelDartProjectile.png b/Projectiles/Rogue/GelDartProjectile.png deleted file mode 100644 index d4b10b05ac..0000000000 Binary files a/Projectiles/Rogue/GelDartProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/GhoulishGougerBoomerang.cs b/Projectiles/Rogue/GhoulishGougerBoomerang.cs index 729d25a48e..5a821088da 100644 --- a/Projectiles/Rogue/GhoulishGougerBoomerang.cs +++ b/Projectiles/Rogue/GhoulishGougerBoomerang.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,141 +8,150 @@ namespace CalamityMod.Projectiles.Rogue { public class GhoulishGougerBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GhoulishGouger"; + + private const int FramesBeforeReturning = 50; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Scythe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + DisplayName.SetDefault("Ghoulish Gouger"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 7; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 74; - projectile.height = 68; + projectile.width = 58; + projectile.height = 58; projectile.friendly = true; projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.penetrate = -1; - projectile.extraUpdates = 4; + projectile.extraUpdates = 2; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 36; projectile.Calamity().rogue = true; } public override void AI() { + // Boomerang glows pink Lighting.AddLight(projectile.Center, 0.7f, 0f, 0.15f); - if (projectile.soundDelay == 0) - { - projectile.soundDelay = 8; - Main.PlaySound(SoundID.Item7, projectile.position); - } - if (projectile.ai[0] == 0f) - { - projectile.ai[1] += 1f; - if (projectile.ai[1] >= 45f) - { - projectile.ai[0] = 1f; - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - } - else - { - projectile.tileCollide = false; - float num42 = 28f; - float num43 = 5f; - 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(); - } - num46 = num42 / num46; - num44 *= num46; - num45 *= num46; - 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; - } - } - 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.Y < num45) - { - 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) - { - 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) - { - 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.rotation += 0.5f; - } - public override Color? GetAlpha(Color lightColor) - { - return new Color(250, 250, 250, 50); + // 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; + + // Main boomerang logic. projectile.ai[0] is a frame counter. + projectile.ai[0] += 1f; + + // On the first returning frame, send a net update. + if (projectile.ai[0] == FramesBeforeReturning) + projectile.netUpdate = true; + + // Once returning, use boomerang return AI. + if (projectile.ai[0] >= FramesBeforeReturning) + { + float returnSpeed = 16f; + float acceleration = 1.15f; + + 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(); + + // Homing vector math (the boomerang homes in on the player using rather ugly code) + dist = returnSpeed / dist; + dx *= dist; + dy *= dist; + + // X/Y specific boomerang return code. This is what gives them their unique flight path. + 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; + } + } + 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.Y < dy) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && dy > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + } + } + 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; + } + } + + // Destroy the boomerang when it returns to the player. + 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; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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/Projectiles/Rogue/GhoulishGougerBoomerangGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); - } + 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); + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float spread = 45f * 0.0174f; - 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 && projectile.Calamity().stealthStrike && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (i = 0; i < 8; i++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - 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 num23 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 1f, ai1); - int num24 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.2), 0f, projectile.owner, 1f, ai1); - } - } - } - } + 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) + return; + + int numSouls = 8; + int projID = ModContent.ProjectileType(); + int soulDamage = projectile.damage; + float soulKB = 0f; + float speed = 6f; + Vector2 velocity = Main.rand.NextVector2CircularEdge(speed, speed); + for (int i = 0; i < numSouls; ++i) + { + // 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); + + // Rotate direction for the next soul + velocity = velocity.RotatedBy(MathHelper.TwoPi / numSouls); + } + } + } } diff --git a/Projectiles/Rogue/GhoulishGougerBoomerang.png b/Projectiles/Rogue/GhoulishGougerBoomerang.png deleted file mode 100644 index 93333dc689..0000000000 Binary files a/Projectiles/Rogue/GhoulishGougerBoomerang.png and /dev/null differ diff --git a/Projectiles/Rogue/GhoulishGougerBoomerangGlow.png b/Projectiles/Rogue/GhoulishGougerBoomerangGlow.png deleted file mode 100644 index 6e9fbc3de3..0000000000 Binary files a/Projectiles/Rogue/GhoulishGougerBoomerangGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/GildedDaggerProj.cs b/Projectiles/Rogue/GildedDaggerProj.cs index 0f2116a534..98317d8eb9 100644 --- a/Projectiles/Rogue/GildedDaggerProj.cs +++ b/Projectiles/Rogue/GildedDaggerProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class GildedDaggerProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GildedDagger"; + private bool hasHitEnemy = false; private int targetNPC = -1; private List previousNPCs = new List() { -1 }; diff --git a/Projectiles/Rogue/GildedDaggerProj.png b/Projectiles/Rogue/GildedDaggerProj.png deleted file mode 100644 index 825cade719..0000000000 Binary files a/Projectiles/Rogue/GildedDaggerProj.png and /dev/null differ diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index f8af833e7e..ecfbbd80dd 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class GlaiveProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Glaive"; + private static int Lifetime = 180; private static int ReboundTime = 45; @@ -114,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GlaiveProj.png b/Projectiles/Rogue/GlaiveProj.png deleted file mode 100644 index 810ef35287..0000000000 Binary files a/Projectiles/Rogue/GlaiveProj.png and /dev/null differ diff --git a/Projectiles/Rogue/GleamingDaggerProj.cs b/Projectiles/Rogue/GleamingDaggerProj.cs index ac82018507..bd3503a196 100644 --- a/Projectiles/Rogue/GleamingDaggerProj.cs +++ b/Projectiles/Rogue/GleamingDaggerProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class GleamingDaggerProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GleamingDagger"; + private bool hasHitEnemy = false; private int targetNPC = -1; private List previousNPCs = new List() { -1 }; diff --git a/Projectiles/Rogue/GleamingDaggerProj.png b/Projectiles/Rogue/GleamingDaggerProj.png deleted file mode 100644 index 95e0b396b9..0000000000 Binary files a/Projectiles/Rogue/GleamingDaggerProj.png and /dev/null differ diff --git a/Projectiles/Rogue/GodsParanoiaDart.cs b/Projectiles/Rogue/GodsParanoiaDart.cs index c183d603df..e7092419f6 100644 --- a/Projectiles/Rogue/GodsParanoiaDart.cs +++ b/Projectiles/Rogue/GodsParanoiaDart.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = 10; projectile.height = 10; - projectile.friendly = true; + projectile.ignoreWater = true; + projectile.friendly = true; projectile.Calamity().rogue = true; projectile.penetrate = 1; projectile.tileCollide = false; @@ -43,11 +44,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = 12f; } - int num822 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(3) ? 56 : 242, 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; + 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); + flame.velocity *= 0.1f; + flame.scale = 1.3f; + flame.noGravity = true; + } } public override void Kill(int timeLeft) @@ -62,18 +65,17 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = -1; projectile.damage /= 2; projectile.Damage(); - for (int num621 = 0; num621 < 3; num621++) + for (int i = 0; i < 2; i++) { - 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; + 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; + if (Main.rand.NextBool(2)) { - Main.dust[num622].scale = 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; + flame.scale *= 0.5f; + flame.fadeIn = Main.rand.NextFloat(1f, 2f); } } } @@ -93,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 595) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 7549220f05..21811f8cb8 100644 --- a/Projectiles/Rogue/GodsParanoiaProj.cs +++ b/Projectiles/Rogue/GodsParanoiaProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class GodsParanoiaProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/GodsParanoia"; + public int kunaiStabbing = 12; public override void SetStaticDefaults() @@ -23,7 +25,8 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = 15; projectile.height = 15; - projectile.friendly = true; + projectile.ignoreWater = true; + projectile.friendly = true; projectile.tileCollide = false; projectile.Calamity().rogue = true; projectile.penetrate = -1; @@ -38,26 +41,19 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); if (Main.rand.NextBool(2)) { - int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + 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(15); + projectile.StickyProjAI(50); if (projectile.ai[0] == 1f) { - if (projectile.Calamity().stealthStrike) - { - kunaiStabbing += 2; - } - else - { - kunaiStabbing++; - } - if (kunaiStabbing >= 20) - { + kunaiStabbing++; + if (kunaiStabbing >= 20) + { 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); @@ -88,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue else { projectile.rotation += 0.2f * (float)projectile.direction; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, (projectile.Calamity().stealthStrike ? 14f : 7f), 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, projectile.Calamity().stealthStrike ? 12f : 7f, 20f); } Player player = Main.player[projectile.owner]; @@ -116,7 +112,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/GodsParanoiaProj.png b/Projectiles/Rogue/GodsParanoiaProj.png deleted file mode 100644 index ea832bffbc..0000000000 Binary files a/Projectiles/Rogue/GodsParanoiaProj.png and /dev/null differ diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.cs b/Projectiles/Rogue/GreenDonkeyKongReference.cs index 2f77058a5e..eddc4eb933 100644 --- a/Projectiles/Rogue/GreenDonkeyKongReference.cs +++ b/Projectiles/Rogue/GreenDonkeyKongReference.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class GreenDonkeyKongReference : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/AcidicRainBarrel"; + public float cooldown = 0f; public float oldVelocityX = 0f; public override void SetStaticDefaults() @@ -23,7 +25,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 48; projectile.height = 48; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 480; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; @@ -81,10 +84,13 @@ namespace CalamityMod.Projectiles.Rogue int acidIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + acidVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), 1f, projectile.owner); - Main.projectile[acidIndex].Calamity().forceRogue = true; - Main.projectile[acidIndex].timeLeft = 300; - Main.projectile[acidIndex].usesLocalNPCImmunity = true; - Main.projectile[acidIndex].localNPCHitCooldown = -1; + if (acidIndex.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[acidIndex].Calamity().forceRogue = true; + Main.projectile[acidIndex].timeLeft = 300; + Main.projectile[acidIndex].usesLocalNPCImmunity = true; + Main.projectile[acidIndex].localNPCHitCooldown = -1; + } } } @@ -96,8 +102,11 @@ namespace CalamityMod.Projectiles.Rogue int acidIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + acidVelocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.667f), 1f, projectile.owner); - Main.projectile[acidIndex].Calamity().forceRogue = true; - Main.projectile[acidIndex].timeLeft = 420; + if (acidIndex.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[acidIndex].Calamity().forceRogue = true; + Main.projectile[acidIndex].timeLeft = 420; + } } } @@ -110,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/GreenDonkeyKongReference.png b/Projectiles/Rogue/GreenDonkeyKongReference.png deleted file mode 100644 index 2a8d7fd74b..0000000000 Binary files a/Projectiles/Rogue/GreenDonkeyKongReference.png and /dev/null differ diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index e538815554..e821005505 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class HeavenfallenEnergy : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenfallen Energy"); diff --git a/Projectiles/Rogue/HeavenfallenEnergy.png b/Projectiles/Rogue/HeavenfallenEnergy.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Rogue/HeavenfallenEnergy.png and /dev/null differ diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index c93ea3e640..0823f3d4b6 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Rogue { public class HeavenfallenStardiskBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/HeavenfallenStardisk"; + private bool explode = false; public override void SetStaticDefaults() @@ -201,7 +203,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.png b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.png deleted file mode 100644 index b97b3655fd..0000000000 Binary files a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.png and /dev/null differ diff --git a/Projectiles/Rogue/HellsSunProj.cs b/Projectiles/Rogue/HellsSunProj.cs index 7b0eae84f3..181ed3c8e5 100644 --- a/Projectiles/Rogue/HellsSunProj.cs +++ b/Projectiles/Rogue/HellsSunProj.cs @@ -8,6 +8,7 @@ namespace CalamityMod.Projectiles.Rogue { public class HellsSunProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/HellsSun"; public override void SetStaticDefaults() { @@ -21,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.Calamity().rogue = true; projectile.tileCollide = false; - projectile.penetrate = 20; + projectile.ignoreWater = true; + projectile.penetrate = 20; projectile.timeLeft = 1200; projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Rogue/HellsSunProj.png b/Projectiles/Rogue/HellsSunProj.png deleted file mode 100644 index 130f9037b4..0000000000 Binary files a/Projectiles/Rogue/HellsSunProj.png and /dev/null differ diff --git a/Projectiles/Rogue/Honeycomb.cs b/Projectiles/Rogue/Honeycomb.cs index 786ef9fd0f..a174b4e99b 100644 --- a/Projectiles/Rogue/Honeycomb.cs +++ b/Projectiles/Rogue/Honeycomb.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Honeycomb : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/HardenedHoneycomb"; + private const float radius = 15f; public override void SetStaticDefaults() diff --git a/Projectiles/Rogue/Honeycomb.png b/Projectiles/Rogue/Honeycomb.png deleted file mode 100644 index a29278afaa..0000000000 Binary files a/Projectiles/Rogue/Honeycomb.png and /dev/null differ diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index 05d18001a9..4c10079e84 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -6,14 +6,14 @@ using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Projectiles.Rogue { - public class HypothermiaChunk : ModProjectile + public class HypothermiaChunk : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ice Chunk"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ice Chunk"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } + } public override void SetDefaults() { @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 80; - projectile.extraUpdates = 3; + projectile.extraUpdates = 4; projectile.ignoreWater = true; projectile.Calamity().rogue = true; projectile.tileCollide = false; @@ -58,18 +58,24 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.owner == Main.myPlayer) { - for (int i = 0; i < Main.rand.Next(1,4); i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.33f), projectile.knockBack * 0.75f, Main.myPlayer, Main.rand.Next(4), 1f); - } - } + int numSplits = Main.rand.NextBool() ? 4 : 3; + int type = ModContent.ProjectileType(); + 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); + } + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 300); - } + } public override void OnHitPvp(Player target, int damage, bool crit) { @@ -78,7 +84,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 8c9b3d1ae5..14c1f328a1 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Projectiles.Rogue { public class HypothermiaShard : ModProjectile { - private float counter = 0f; + private float counter = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Ice Shard"); @@ -20,11 +20,12 @@ namespace CalamityMod.Projectiles.Rogue 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.extraUpdates = 3; } public override void AI() @@ -54,14 +55,14 @@ namespace CalamityMod.Projectiles.Rogue 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; - } + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } return false; } @@ -99,8 +100,8 @@ namespace CalamityMod.Projectiles.Rogue { texture = ModContent.GetTexture("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); - return false; + 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 ed89e83139..a86c008cc6 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class IceStarProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/IceStar"; + private bool initStealth = false; private Vector2 initialVelocity; @@ -68,11 +70,8 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 14f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 14f) / (21f); } projectile.velocity = initStealth && !homeIn ? initialVelocity : projectile.velocity; } diff --git a/Projectiles/Rogue/IceStarProjectile.png b/Projectiles/Rogue/IceStarProjectile.png deleted file mode 100644 index cfeebe4f90..0000000000 Binary files a/Projectiles/Rogue/IceStarProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 0f3852fee3..d9a2a00b04 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class IcebreakerHammer : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Icebreaker"; + private int explosionCount = 0; public override void SetStaticDefaults() @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = 30; projectile.height = 30; - projectile.friendly = true; + projectile.ignoreWater = true; + projectile.friendly = true; projectile.Calamity().rogue = true; projectile.penetrate = -1; projectile.aiStyle = 3; @@ -56,7 +59,8 @@ namespace CalamityMod.Projectiles.Rogue 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); - Main.projectile[ice].Calamity().forceRogue = true; + if (ice.WithinBounds(Main.maxProjectiles)) + Main.projectile[ice].Calamity().forceRogue = true; explosionCount++; } @@ -69,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue if (nPC.active && !nPC.dontTakeDamage && !nPC.buffImmune[buffType] && Vector2.Distance(projectile.Center, nPC.Center) <= radius) { if (nPC.FindBuffIndex(buffType) == -1) - nPC.AddBuff(buffType, 180, false); + nPC.AddBuff(buffType, 60, false); } } } @@ -86,7 +90,8 @@ namespace CalamityMod.Projectiles.Rogue { //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); - Main.projectile[ice].Calamity().forceRogue = true; + if (ice.WithinBounds(Main.maxProjectiles)) + Main.projectile[ice].Calamity().forceRogue = true; int buffType = ModContent.BuffType(); float radius = 112f; // 7 blocks @@ -98,7 +103,7 @@ namespace CalamityMod.Projectiles.Rogue 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, 180, false); + player.AddBuff(buffType, 60, false); } } } diff --git a/Projectiles/Rogue/IcebreakerHammer.png b/Projectiles/Rogue/IcebreakerHammer.png deleted file mode 100644 index 2b21544257..0000000000 Binary files a/Projectiles/Rogue/IcebreakerHammer.png and /dev/null differ diff --git a/Projectiles/Rogue/IchorSpearProj.cs b/Projectiles/Rogue/IchorSpearProj.cs index aa53d53619..36897eb7d5 100644 --- a/Projectiles/Rogue/IchorSpearProj.cs +++ b/Projectiles/Rogue/IchorSpearProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class IchorSpearProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/IchorSpear"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spear"); @@ -19,7 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.penetrate = 2; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; @@ -46,11 +49,14 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - Main.projectile[ichor].Calamity().forceRogue = true; - Main.projectile[ichor].usesLocalNPCImmunity = true; - Main.projectile[ichor].localNPCHitCooldown = 10; - Main.projectile[ichor].extraUpdates = 2; + 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; + Main.projectile[ichor].usesLocalNPCImmunity = true; + Main.projectile[ichor].localNPCHitCooldown = 10; + Main.projectile[ichor].extraUpdates = 2; + } } } } diff --git a/Projectiles/Rogue/IchorSpearProj.png b/Projectiles/Rogue/IchorSpearProj.png deleted file mode 100644 index c3519a7c59..0000000000 Binary files a/Projectiles/Rogue/IchorSpearProj.png and /dev/null differ diff --git a/Projectiles/Rogue/InfernalFireball.png b/Projectiles/Rogue/InfernalFireball.png deleted file mode 100644 index 6a4eedebff..0000000000 Binary files a/Projectiles/Rogue/InfernalFireball.png and /dev/null differ diff --git a/Projectiles/Rogue/InfernalFireballEruption.png b/Projectiles/Rogue/InfernalFireballEruption.png deleted file mode 100644 index 6a4eedebff..0000000000 Binary files a/Projectiles/Rogue/InfernalFireballEruption.png and /dev/null differ diff --git a/Projectiles/Rogue/InfernalKrisExplosion.cs b/Projectiles/Rogue/InfernalKrisExplosion.cs index eaf64b8bd0..485b0bbca9 100644 --- a/Projectiles/Rogue/InfernalKrisExplosion.cs +++ b/Projectiles/Rogue/InfernalKrisExplosion.cs @@ -1,4 +1,3 @@ - using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -8,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class InfernalKrisExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public static float radius = 64; public override void SetStaticDefaults() diff --git a/Projectiles/Rogue/InfernalKrisExplosion.png b/Projectiles/Rogue/InfernalKrisExplosion.png deleted file mode 100644 index 5cd30373af..0000000000 Binary files a/Projectiles/Rogue/InfernalKrisExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index fe3c273a31..1df55c9f15 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class InfernalKrisProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/InfernalKris"; + public static int spinTime = 280; public override void SetStaticDefaults() @@ -112,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue { // If this is a stealth strike, make the blade glow orange Color glowColour = new Color(255, 215, 100, 100); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, glowColour, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], glowColour, 1); float minScale = 1.9f; float maxScale = 2.5f; @@ -121,7 +123,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); } return false; } diff --git a/Projectiles/Rogue/InfernalKrisProjectile.png b/Projectiles/Rogue/InfernalKrisProjectile.png deleted file mode 100644 index e709f2df95..0000000000 Binary files a/Projectiles/Rogue/InfernalKrisProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/InfernalSpearProjectile.cs b/Projectiles/Rogue/InfernalSpearProjectile.cs deleted file mode 100644 index a6fdd83cd6..0000000000 --- a/Projectiles/Rogue/InfernalSpearProjectile.cs +++ /dev/null @@ -1,133 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class InfernalSpearProjectile : ModProjectile - { - private float speedX = -3f; - private float speedX2 = -5f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spear"); - Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; - } - - public override void SetDefaults() - { - projectile.width = 62; - projectile.height = 62; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.tileCollide = false; - projectile.timeLeft = 300; - projectile.Calamity().rogue = true; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(speedX); - writer.Write(speedX2); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - speedX = reader.ReadSingle(); - speedX2 = reader.ReadSingle(); - } - - public override void AI() - { - if (projectile.timeLeft % 12 == 0) - { - if (projectile.owner == Main.myPlayer) - { - if (projectile.Calamity().stealthStrike) - { - Projectile.NewProjectile(projectile.Center, projectile.velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } - - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 24f, 20f); - } - - public override void Kill(int timeLeft) - { - if (projectile.Calamity().stealthStrike) - { - if (projectile.owner == Main.myPlayer) - { - for (int x = 0; x < 3; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, -50f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); - speedX += 3f; - } - for (int x = 0; x < 2; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, -75f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 0f); - speedX2 += 10f; - } - } - } - 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); - for (int num621 = 0; num621 < 20; num621++) - { - 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)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 30; num623++) - { - 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); - Main.dust[num624].velocity *= 2f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Daybreak, 360); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/IronFranciscaProj.cs b/Projectiles/Rogue/IronFranciscaProj.cs index d06cf86b74..4a4668493d 100644 --- a/Projectiles/Rogue/IronFranciscaProj.cs +++ b/Projectiles/Rogue/IronFranciscaProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class IronFranciscaProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/IronFrancisca"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Iron Francisca"); diff --git a/Projectiles/Rogue/IronFranciscaProj.png b/Projectiles/Rogue/IronFranciscaProj.png deleted file mode 100644 index f8e7c806ad..0000000000 Binary files a/Projectiles/Rogue/IronFranciscaProj.png and /dev/null differ diff --git a/Projectiles/Rogue/JawsProjectile.cs b/Projectiles/Rogue/JawsProjectile.cs index b9fd32b1e7..55f7a707ff 100644 --- a/Projectiles/Rogue/JawsProjectile.cs +++ b/Projectiles/Rogue/JawsProjectile.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = 600; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; @@ -37,23 +38,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; if (projectile.Calamity().stealthStrike) { - int dustToUse = Main.rand.Next(0, 4); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 33; - break; - case 1: - dustType = 101; - break; - case 2: - dustType = 111; - break; - case 3: - dustType = 180; - break; - } + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 101, + 111, + 180 + }); int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); Main.dust[dust].noGravity = true; @@ -104,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -112,23 +103,13 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dustToUse = Main.rand.Next(0, 4); - int dustType = 0; - switch (dustToUse) - { - case 0: - dustType = 33; - break; - case 1: - dustType = 101; - break; - case 2: - dustType = 111; - break; - case 3: - dustType = 180; - break; - } + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 101, + 111, + 180 + }); 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 10b2b5e885..ca521aeae9 100644 --- a/Projectiles/Rogue/JawsShockwave.cs +++ b/Projectiles/Rogue/JawsShockwave.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class JawsShockwave : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Reaper Tooth Shockwave"); diff --git a/Projectiles/Rogue/JawsShockwave.png b/Projectiles/Rogue/JawsShockwave.png deleted file mode 100644 index d86a683fca..0000000000 Binary files a/Projectiles/Rogue/JawsShockwave.png and /dev/null differ diff --git a/Projectiles/Rogue/JewelSpike.cs b/Projectiles/Rogue/JewelSpike.cs index eef21832c8..dc87dd67ab 100644 --- a/Projectiles/Rogue/JewelSpike.cs +++ b/Projectiles/Rogue/JewelSpike.cs @@ -19,29 +19,29 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 40; - projectile.Calamity().rogue = true; - projectile.usesLocalNPCImmunity = true; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } public override void AI() { projectile.velocity *= 0f; + 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); Main.dust[crystalDust].noGravity = true; } + projectile.frameCounter++; if (projectile.frameCounter > 4 && projectile.frame > 0) { projectile.frame--; projectile.frameCounter = 0; } - if (projectile.frame < 0) //just in case - { + if (projectile.frame < 0) projectile.frame = 0; - } } public override void Kill(int timeLeft) @@ -52,8 +52,7 @@ namespace CalamityMod.Projectiles.Rogue { 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 / 4, 0f, projectile.owner); - Main.projectile[shard].Calamity().forceRogue = true; + 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 new file mode 100644 index 0000000000..b3db6fa438 --- /dev/null +++ b/Projectiles/Rogue/KelvinCatalystBoomerang.cs @@ -0,0 +1,200 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class KelvinCatalystBoomerang : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/KelvinCatalyst"; + public int AIState = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kelvin Catalyst"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(AIState); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + AIState = reader.ReadInt32(); + } + + public override void AI() + { + VisualAudioEffects(); + BoomerangAI(); + } + + private void BoomerangAI() + { + switch (AIState) + { + case 0: + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 75f) + { + ResetStats(projectile.Calamity().stealthStrike); + } + break; + case 1: + ReturnToPlayer(); + 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) + { + ResetStats(false); + } + break; + } + } + + private void ReturnToPlayer() + { + Player player = Main.player[projectile.owner]; + float returnSpeed = 20f; + float acceleration = 2f; + Vector2 playerVec = player.Center - projectile.Center; + float dist = playerVec.Length(); + + // Delete the projectile if it's excessively far away. + if (dist > 3000f) + projectile.Kill(); + + playerVec.Normalize(); + playerVec *= returnSpeed; + + // Home back in on the player. + if (projectile.velocity.X < playerVec.X) + { + projectile.velocity.X += acceleration; + if (projectile.velocity.X < 0f && playerVec.X > 0f) + projectile.velocity.X += acceleration; + } + 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.Y < playerVec.Y) + { + projectile.velocity.Y += acceleration; + if (projectile.velocity.Y < 0f && playerVec.Y > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > playerVec.Y) + { + 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(); + } + + private void VisualAudioEffects() + { + Lighting.AddLight(projectile.Center, Main.DiscoR * 0.3f / 255f, Main.DiscoR * 0.4f / 255f, Main.DiscoR * 0.5f / 255f); + + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + + 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; + } + + 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; + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + OnHitEffects(); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Frostburn, 240); + OnHitEffects(); + } + + private void OnHitEffects() + { + int projType = ModContent.ProjectileType(); + 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 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); + } + } + Main.PlaySound(SoundID.Item30, projectile.position); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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 4af4645e27..d150b12b1e 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -20,12 +20,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; - } + projectile.extraUpdates = 1; + } public override void AI() { @@ -51,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 7263d41f16..5f5468e9bf 100644 --- a/Projectiles/Rogue/KylieBoomerang.cs +++ b/Projectiles/Rogue/KylieBoomerang.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class KylieBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Kylie"; + //This variable will be used for the stealth strike public float ReboundTime = 0f; public float timer = 0f; diff --git a/Projectiles/Rogue/KylieBoomerang.png b/Projectiles/Rogue/KylieBoomerang.png deleted file mode 100644 index f29f779e13..0000000000 Binary files a/Projectiles/Rogue/KylieBoomerang.png and /dev/null differ diff --git a/Projectiles/Rogue/LatcherMineProjectile.cs b/Projectiles/Rogue/LatcherMineProjectile.cs index 5b59d81b0b..68c4cd1c37 100644 --- a/Projectiles/Rogue/LatcherMineProjectile.cs +++ b/Projectiles/Rogue/LatcherMineProjectile.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Rogue { public class LatcherMineProjectile : ModProjectile { + private int projdmg = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Latcher Mine"); @@ -113,6 +114,7 @@ namespace CalamityMod.Projectiles.Rogue } 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); } @@ -138,12 +140,12 @@ namespace CalamityMod.Projectiles.Rogue 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(), projectile.damage, 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(), projectile.damage / 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 0b75959f64..a8a0bd162f 100644 --- a/Projectiles/Rogue/LeadTomahawkProj.cs +++ b/Projectiles/Rogue/LeadTomahawkProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class LeadTomahawkProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LeadTomahawk"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Lead Tomahawk"); diff --git a/Projectiles/Rogue/LeadTomahawkProj.png b/Projectiles/Rogue/LeadTomahawkProj.png deleted file mode 100644 index bbef54a725..0000000000 Binary files a/Projectiles/Rogue/LeadTomahawkProj.png and /dev/null differ diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs index a2109daa19..806da402db 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 42; projectile.aiStyle = 1; projectile.friendly = true; + projectile.ignoreWater = true; projectile.Calamity().rogue = true; projectile.tileCollide = false; projectile.extraUpdates = 2; @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1); return false; } diff --git a/Projectiles/Rogue/LeonidCometSmall.cs b/Projectiles/Rogue/LeonidCometSmall.cs index aa7879816c..3296513a2a 100644 --- a/Projectiles/Rogue/LeonidCometSmall.cs +++ b/Projectiles/Rogue/LeonidCometSmall.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 28; projectile.height = 28; projectile.friendly = true; - projectile.Calamity().rogue = true; + projectile.ignoreWater = true; + projectile.Calamity().rogue = true; projectile.penetrate = 1; projectile.timeLeft = 300; projectile.extraUpdates = 1; diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 8e916906c0..e90c929175 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue { public class LeonidProgenitorBombshell : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LeonidProgenitor"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Leonid Bombshell"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 32; projectile.height = 32; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 180; projectile.Calamity().rogue = true; } @@ -75,41 +78,34 @@ namespace CalamityMod.Projectiles.Rogue if (Main.myPlayer == projectile.owner) { int flash = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 0f, 1f); - Main.projectile[flash].Calamity().forceRogue = true; - Main.projectile[flash].usesLocalNPCImmunity = true; - Main.projectile[flash].localNPCHitCooldown = 10; + if (flash.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[flash].Calamity().forceRogue = true; + Main.projectile[flash].usesLocalNPCImmunity = true; + 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; - int comet = Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + Projectile.NewProjectile(pos, velocity, ModContent.ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); - if (!projectile.Calamity().stealthStrike || Main.myPlayer != projectile.owner) - return; - - Vector2 spinningpoint = new Vector2(0f, 6f); - float num1 = MathHelper.ToRadians(45f); - int cometAmt = 5; - 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); - Projectile proj = Main.projectile[index2]; - for (int index3 = 0; index3 < projectile.localNPCImmunity.Length; ++index3) - { - proj.localNPCImmunity[index3] = projectile.localNPCImmunity[index3]; - } - } - } + StealthStrikeEffect(); + } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 300); + StealthStrikeEffect(); + } + + private void StealthStrikeEffect() + { if (!projectile.Calamity().stealthStrike || Main.myPlayer != projectile.owner) return; diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.png b/Projectiles/Rogue/LeonidProgenitorBombshell.png deleted file mode 100644 index bec6bcd49b..0000000000 Binary files a/Projectiles/Rogue/LeonidProgenitorBombshell.png and /dev/null differ diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index c0045d9d56..e0ce3791cd 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Rogue 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) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1, tex); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1, tex); } return false; } diff --git a/Projectiles/Rogue/LionfishProj.cs b/Projectiles/Rogue/LionfishProj.cs index 1328886ff4..e020e9dcc9 100644 --- a/Projectiles/Rogue/LionfishProj.cs +++ b/Projectiles/Rogue/LionfishProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class LionfishProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Lionfish"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Lionfish"); @@ -29,10 +31,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - int num982 = 25; if (projectile.alpha > 0) { - projectile.alpha -= num982; + projectile.alpha -= 25; } if (projectile.alpha < 0) { @@ -40,36 +41,26 @@ namespace CalamityMod.Projectiles.Rogue } 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) { - float num986 = 0.98f; - float num987 = 0.35f; - projectile.ai[1] = 45f; - projectile.velocity.X = projectile.velocity.X * num986; - projectile.velocity.Y = projectile.velocity.Y + num987; - if (projectile.velocity.X < 0f) - { - 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); - } + float horizontalMult = 0.98f; + float fallSpeed = 0.35f; + projectile.velocity.X *= horizontalMult; + projectile.velocity.Y += fallSpeed; } if (projectile.Calamity().stealthStrike) { if (projectile.timeLeft % 8 == 0 && projectile.owner == Main.myPlayer) { - 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); - int spike = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, -10f, 0f); - Main.projectile[spike].Calamity().forceRogue = true; + 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); + if (spike.WithinBounds(Main.maxProjectiles)) + Main.projectile[spike].Calamity().forceRogue = true; } } } @@ -94,29 +85,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); + SpriteEffects spriteEffects = SpriteEffects.None; + 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); return false; } public override void Kill(int timeLeft) { Main.PlaySound(SoundID.Dig, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 72; - 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 < 3; num193++) + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 72); + for (int d = 0; d < 3; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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 num194 = 0; num194 < 30; num194++) + for (int d = 0; d < 30; d++) { - 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), 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, 14, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } } diff --git a/Projectiles/Rogue/LionfishProj.png b/Projectiles/Rogue/LionfishProj.png deleted file mode 100644 index e97c12862e..0000000000 Binary files a/Projectiles/Rogue/LionfishProj.png and /dev/null differ diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index cb510d3ae1..c10ed1cd31 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -23,12 +23,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.penetrate = 1; projectile.timeLeft = 240; - projectile.Calamity().rogue = true; + projectile.Calamity().rogue = true; projectile.extraUpdates = 1; projectile.alpha = 150; + projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.basePointBlankShotDuration; } - public override void AI() + 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) @@ -37,16 +40,34 @@ namespace CalamityMod.Projectiles.Rogue projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) - { projectile.frame = 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, 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); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 6f, 20f); + + if (projectile.ai[0] != 1f && (projectile.timeLeft < 210 || projectile.ai[0] == 2f)) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 600f, 12f, 20f); } - public override void Kill(int timeLeft) + // 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) + { + int projectileCount = Main.player[projectile.owner].ownedProjectileCounts[projectile.type]; + int cap = 5; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + } + + public override void Kill(int timeLeft) { for (int j = 0; j <= 10; j++) { @@ -58,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 042fbcfec3..a11ed1bb26 100644 --- a/Projectiles/Rogue/LuminousShard.cs +++ b/Projectiles/Rogue/LuminousShard.cs @@ -19,22 +19,27 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 10; projectile.height = 18; projectile.friendly = true; - projectile.penetrate = 1; + 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 void AI() { if (projectile.ai[0] == 0f && projectile.velocity.X == 0f && projectile.velocity.Y == -2f) gravity = true; projectile.ai[0] = 1f; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; if (gravity) projectile.velocity.Y *= 1.05f; + if (projectile.timeLeft < 90) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/LuminousStrikerProj.cs b/Projectiles/Rogue/LuminousStrikerProj.cs index 4901678780..424654f468 100644 --- a/Projectiles/Rogue/LuminousStrikerProj.cs +++ b/Projectiles/Rogue/LuminousStrikerProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class LuminousStrikerProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/LuminousStriker"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Luminous Striker"); @@ -22,17 +24,16 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 120; projectile.Calamity().rogue = true; } public override void AI() { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); - if (projectile.ai[0] == 0f && modPlayer.StealthStrikeAvailable()) + if (projectile.ai[0] == 0f && projectile.Calamity().stealthStrike) { - projectile.Calamity().stealthStrike = true; projectile.timeLeft = 600; projectile.ai[0] = 1f; } @@ -40,7 +41,7 @@ namespace CalamityMod.Projectiles.Rogue 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); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4; if (projectile.timeLeft % 4 == 0) { @@ -48,17 +49,17 @@ namespace CalamityMod.Projectiles.Rogue { 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, 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.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, 0f, 0f); + 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) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -68,14 +69,14 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 7; i++) { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + Vector2 speed = new Vector2(Main.rand.Next(-50, 51), Main.rand.Next(-50, 51)); while (speed.X == 0f && speed.Y == 0f) { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + speed = new Vector2(Main.rand.Next(-50, 51), Main.rand.Next(-50, 51)); } 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 * 0.25f, projectile.owner, 0f, 0f); + 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); } } } @@ -86,14 +87,14 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 7; i++) { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + Vector2 speed = new Vector2(Main.rand.Next(-50, 51), Main.rand.Next(-50, 51)); while (speed.X == 0f && speed.Y == 0f) { - speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + speed = new Vector2(Main.rand.Next(-50, 51), Main.rand.Next(-50, 51)); } 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 * 0.25f, projectile.owner, 0f, 0f); + 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); } } } diff --git a/Projectiles/Rogue/LuminousStrikerProj.png b/Projectiles/Rogue/LuminousStrikerProj.png deleted file mode 100644 index f558de03aa..0000000000 Binary files a/Projectiles/Rogue/LuminousStrikerProj.png and /dev/null differ diff --git a/Projectiles/Rogue/LunarKunaiProj.cs b/Projectiles/Rogue/LunarKunaiProj.cs index 1cff899d34..91f93e8086 100644 --- a/Projectiles/Rogue/LunarKunaiProj.cs +++ b/Projectiles/Rogue/LunarKunaiProj.cs @@ -25,7 +25,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 14; projectile.height = 14; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 300; projectile.Calamity().rogue = true; } @@ -45,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.frame = 0; projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, (lunarEnhance ? 1000f : 500f), (lunarEnhance ? 35f : 15f), 20f); + 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); } @@ -87,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 045a593822..f783897502 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -92,7 +92,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -107,7 +106,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/LuxorsGiftRogue.png b/Projectiles/Rogue/LuxorsGiftRogue.png index 4adb519052..ebc2f0e189 100644 Binary files a/Projectiles/Rogue/LuxorsGiftRogue.png and b/Projectiles/Rogue/LuxorsGiftRogue.png differ diff --git a/Projectiles/Rogue/MalachiteBolt.cs b/Projectiles/Rogue/MalachiteBolt.cs index ac0e718b95..67e00d910e 100644 --- a/Projectiles/Rogue/MalachiteBolt.cs +++ b/Projectiles/Rogue/MalachiteBolt.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Rogue { public class MalachiteBolt : ModProjectile { - public override string Texture => "CalamityMod/Projectiles/Rogue/MalachiteProj"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Malachite"; public override void SetStaticDefaults() { @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MalachiteProj.cs b/Projectiles/Rogue/MalachiteProj.cs index 9bcfb4aa6e..9055fd8faa 100644 --- a/Projectiles/Rogue/MalachiteProj.cs +++ b/Projectiles/Rogue/MalachiteProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class MalachiteProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Malachite"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Malachite"); @@ -53,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/MalachiteProj.png b/Projectiles/Rogue/MalachiteProj.png deleted file mode 100644 index 7112e64fbf..0000000000 Binary files a/Projectiles/Rogue/MalachiteProj.png and /dev/null differ diff --git a/Projectiles/Rogue/MalachiteStealth.cs b/Projectiles/Rogue/MalachiteStealth.cs index 456d7fb07a..0bbcd4fe01 100644 --- a/Projectiles/Rogue/MalachiteStealth.cs +++ b/Projectiles/Rogue/MalachiteStealth.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public class MalachiteStealth : ModProjectile { private const int lifeSpan = 300; - public override string Texture => "CalamityMod/Projectiles/Rogue/MalachiteProj"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Malachite"; public override void SetStaticDefaults() { @@ -38,14 +38,14 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[0] == 0f) { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.PiOver2; - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 800f, 10f, 25f); + 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(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(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; } @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue else { int id = (int)projectile.ai[1]; - if (id >= 0 && id < Main.maxNPCs && Main.npc[id].active && !Main.npc[id].dontTakeDamage) + 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; @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -83,14 +83,11 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { projectile.ai[0] = 2f; - 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 112); Main.PlaySound(SoundID.Item14, projectile.position); for (int i = 0; i < 7; i++) { - int dusty = 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 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)) { @@ -100,10 +97,10 @@ namespace CalamityMod.Projectiles.Rogue } for (int j = 0; j < 15; j++) { - int green = 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 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(new Vector2(projectile.position.X, projectile.position.Y), 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; @@ -139,10 +136,8 @@ namespace CalamityMod.Projectiles.Rogue break; } } - // Main.NewText("found " + kunaiFound.ToString()); if (kunaiFound >= maxKunai && oldestKunai >= 0) { - // Main.NewText("killing kunai " + oldestKunai.ToString()); Main.projectile[oldestKunai].Kill(); } } diff --git a/Projectiles/Rogue/MangroveChakramFlower.cs b/Projectiles/Rogue/MangroveChakramFlower.cs new file mode 100644 index 0000000000..d497603719 --- /dev/null +++ b/Projectiles/Rogue/MangroveChakramFlower.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class MangroveChakramFlower : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Magic/BeamingBolt"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flower"); + } + + 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; + } + + 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; + for (int dust = 0; dust < 2; dust++) + { + 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); + } + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 6; k++) + { + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 164, + 58, + 204 + }); + 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); + } + } +} diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs new file mode 100644 index 0000000000..db5b73d2c1 --- /dev/null +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MangroveChakramProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/MangroveChakram"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mangrove Chakram"); + } + + 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; + aiType = ProjectileID.WoodenBoomerang; + projectile.melee = true; + } + + public override void AI() + { + 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) + { + projectile.localAI[0] += Main.rand.Next(0,3); + if (projectile.localAI[0] >= 10f) + { + projectile.localAI[0] = 0f; + Projectile.NewProjectile(projectile.Center + new Vector2(Main.rand.NextFloat(-10f,10f), Main.rand.NextFloat(-10f,10f)), + (projectile.velocity).RotatedByRandom(0.1f) * 0.25f, + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; + target.AddBuff(BuffID.CursedInferno, 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 120); + } + } +} diff --git a/Projectiles/Rogue/MetalChunk.cs b/Projectiles/Rogue/MetalChunk.cs index a8f4cf8e4c..46a2130327 100644 --- a/Projectiles/Rogue/MetalChunk.cs +++ b/Projectiles/Rogue/MetalChunk.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class MetalChunk : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/MetalMonstrosity"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Metal Chunk"); //Metal Chungus - Shucks diff --git a/Projectiles/Rogue/MetalChunk.png b/Projectiles/Rogue/MetalChunk.png deleted file mode 100644 index a9984302ef..0000000000 Binary files a/Projectiles/Rogue/MetalChunk.png and /dev/null differ diff --git a/Projectiles/Rogue/MoltenAmputatorProj.cs b/Projectiles/Rogue/MoltenAmputatorProj.cs index 47995b561b..aee58752e0 100644 --- a/Projectiles/Rogue/MoltenAmputatorProj.cs +++ b/Projectiles/Rogue/MoltenAmputatorProj.cs @@ -1,3 +1,4 @@ +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -8,11 +9,13 @@ namespace CalamityMod.Projectiles.Rogue { public class MoltenAmputatorProj : ModProjectile { - private int stealthyBlobTimer = 6; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/MoltenAmputator"; + private const int FramesBeforeReturning = 15; + private const int FramesPerBlob = 8; public override void SetStaticDefaults() { - DisplayName.SetDefault("Amputator"); + DisplayName.SetDefault("Molten Amputator"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; ProjectileID.Sets.TrailingMode[projectile.type] = 1; } @@ -23,20 +26,21 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 74; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = -1; - projectile.aiStyle = 3; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; projectile.timeLeft = 180; - aiType = ProjectileID.WoodenBoomerang; projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } - private void fireInTheBlob(int blobCount) + private void SpawnBlobs(int blobCount) { for (int i = 0; i < blobCount; i++) { @@ -51,25 +55,120 @@ namespace CalamityMod.Projectiles.Rogue } } + // Manually implemented boomerang AI copied from Ghoulish Gouger + // TODO -- this should be a utils function public override void AI() { + // Stealth strikes constantly spawn molten blobs. if (projectile.Calamity().stealthStrike) { - stealthyBlobTimer--; - if (stealthyBlobTimer <= 0 && projectile.timeLeft % 2 == 0) + // If the stealth blob timer isn't set up yet, set it up + if (projectile.ai[1] == 0f) + projectile.ai[1] = FramesPerBlob; + else { - fireInTheBlob(1); - stealthyBlobTimer = Main.rand.Next(4, 10); + projectile.ai[1]--; + if (projectile.ai[1] <= 0f) + { + SpawnBlobs(1); + 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; + + // Boomerang glows orange + Lighting.AddLight(projectile.Center, 0.65f, 0.45f, 0f); + + // Boomerang noises + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + + // Main boomerang logic. projectile.ai[0] is a frame counter. + projectile.ai[0] += 1f; + + // On the first returning frame, send a net update. + if (projectile.ai[0] == FramesBeforeReturning) + projectile.netUpdate = true; + + // Once returning, use boomerang return AI. + 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; + 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(); + + // Homing vector math (the boomerang homes in on the player using rather ugly code) + dist = returnSpeed / dist; + dx *= dist; + dy *= dist; + + // X/Y specific boomerang return code. This is what gives them their unique flight path. + 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; + } + } + 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.Y < dy) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && dy > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + } + } + 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; + } + } + + // Destroy the boomerang when it returns to the player. + 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; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 4; if (projectile.owner == Main.myPlayer) { - fireInTheBlob(projectile.Calamity().stealthStrike ? Main.rand.Next(3, 5) : Main.rand.Next(1, 3)); + int blobCount = projectile.Calamity().stealthStrike ? 4 : 2; + SpawnBlobs(blobCount); } Main.PlaySound(SoundID.Item20, projectile.position); for (int k = 0; k < 10; k++) @@ -82,7 +181,8 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - fireInTheBlob(projectile.Calamity().stealthStrike ? Main.rand.Next(3, 5) : Main.rand.Next(1, 3)); + int blobCount = projectile.Calamity().stealthStrike ? 4 : 2; + SpawnBlobs(blobCount); } Main.PlaySound(SoundID.Item20, projectile.position); for (int k = 0; k < 10; k++) diff --git a/Projectiles/Rogue/MoltenAmputatorProj.png b/Projectiles/Rogue/MoltenAmputatorProj.png deleted file mode 100644 index 4e44d58710..0000000000 Binary files a/Projectiles/Rogue/MoltenAmputatorProj.png and /dev/null differ diff --git a/Projectiles/Rogue/MoltenBlobThrown.cs b/Projectiles/Rogue/MoltenBlobThrown.cs index bbd1a40ca0..91ed97f076 100644 --- a/Projectiles/Rogue/MoltenBlobThrown.cs +++ b/Projectiles/Rogue/MoltenBlobThrown.cs @@ -6,9 +6,11 @@ namespace CalamityMod.Projectiles.Rogue { public class MoltenBlobThrown : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/MoltenBlob"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Blob"); + DisplayName.SetDefault("Molten Blob"); Main.projFrames[projectile.type] = 2; } @@ -55,12 +57,9 @@ namespace CalamityMod.Projectiles.Rogue return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) { return new Color(250, 150, 0, projectile.alpha); } diff --git a/Projectiles/Rogue/MoltenBlobThrown.png b/Projectiles/Rogue/MoltenBlobThrown.png deleted file mode 100644 index 811a46069d..0000000000 Binary files a/Projectiles/Rogue/MoltenBlobThrown.png and /dev/null differ diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index b603cf425a..b5f3ad2bc2 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.ai[0] == 1) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 8011116e47..81138074a9 100644 --- a/Projectiles/Rogue/MoonSigil.cs +++ b/Projectiles/Rogue/MoonSigil.cs @@ -16,15 +16,13 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.alpha = 0; - projectile.penetrate = 10; - projectile.tileCollide = true; + projectile.penetrate = 2; projectile.ignoreWater = true; projectile.timeLeft = 250; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } public override void AI() { @@ -40,10 +38,24 @@ namespace CalamityMod.Projectiles.Rogue return; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 8f, 20f); } - public override void Kill(int timeLeft) + // 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 cap = 5; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void Kill(int timeLeft) { float dustSp = 0.2f; int dustD = 0; diff --git a/Projectiles/Rogue/MycorootProj.cs b/Projectiles/Rogue/MycorootProj.cs index d429476e14..fe474d2eca 100644 --- a/Projectiles/Rogue/MycorootProj.cs +++ b/Projectiles/Rogue/MycorootProj.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class MycorootProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Mycoroot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Root"); diff --git a/Projectiles/Rogue/MycorootProj.png b/Projectiles/Rogue/MycorootProj.png deleted file mode 100644 index 2e5a1a8018..0000000000 Binary files a/Projectiles/Rogue/MycorootProj.png and /dev/null differ diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.cs b/Projectiles/Rogue/MythrilKnifeProjectile.cs index df31e12117..e5b7103e3e 100644 --- a/Projectiles/Rogue/MythrilKnifeProjectile.cs +++ b/Projectiles/Rogue/MythrilKnifeProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class MythrilKnifeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/MythrilKnife"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); @@ -36,7 +38,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; diff --git a/Projectiles/Rogue/MythrilKnifeProjectile.png b/Projectiles/Rogue/MythrilKnifeProjectile.png deleted file mode 100644 index 628e080fa1..0000000000 Binary files a/Projectiles/Rogue/MythrilKnifeProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs new file mode 100644 index 0000000000..633aa0f140 --- /dev/null +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -0,0 +1,162 @@ +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NanoblackMain : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/NanoblackReaperRogue"; + + private const float RotationIncrement = 0.22f; + private const int Lifetime = 240; + private const float ReboundTime = 50f; + private const int MinBladeTimer = 13; + private const int MaxBladeTimer = 18; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Reaper"); + 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; + } + + public override void AI() + { + drawOffsetX = -11; + drawOriginOffsetY = -4; + drawOriginOffsetX = 0; + + // Initialize the frame counter and random blade delay on the very first frame. + if (projectile.timeLeft == Lifetime) + projectile.ai[1] = GetBladeDelay(); + + // Produces electricity and green firework sparks constantly while in flight. + if (Main.rand.NextBool(3)) + { + 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); + Main.dust[idx].noGravity = true; + 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; + + // On the frame the scythe begins returning, send a net update. + 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) + { + float returnSpeed = NanoblackReaperRogue.Speed; + float acceleration = 2.4f; + 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 dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); + if (dist > 3000f) + projectile.Kill(); + + dist = returnSpeed / dist; + xDist *= dist; + yDist *= dist; + + // Home back in on the player. + if (projectile.velocity.X < xDist) + { + projectile.velocity.X = projectile.velocity.X + acceleration; + if (projectile.velocity.X < 0f && xDist > 0f) + projectile.velocity.X += acceleration; + } + else if (projectile.velocity.X > xDist) + { + projectile.velocity.X = projectile.velocity.X - acceleration; + if (projectile.velocity.X > 0f && xDist < 0f) + projectile.velocity.X -= acceleration; + } + if (projectile.velocity.Y < yDist) + { + projectile.velocity.Y = projectile.velocity.Y + acceleration; + if (projectile.velocity.Y < 0f && yDist > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > yDist) + { + 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(); + } + + // Create nanoblack energy blades at a somewhat-random rate while in flight. + if (projectile.ai[1] <= 0f) + { + SpawnEnergyBlade(); + projectile.ai[1] = GetBladeDelay(); + } + + // Rotate the scythe as it flies. + 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); + return false; + } + + private int GetBladeDelay() + { + return Main.rand.Next(MinBladeTimer, MaxBladeTimer + 1); + } + + private void SpawnEnergyBlade() + { + int bladeID = ModContent.ProjectileType(); + int bladeDamage = projectile.damage / 5; + float bladeKB = 3f; + 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); + } + } +} diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs new file mode 100644 index 0000000000..cb09ac1599 --- /dev/null +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -0,0 +1,213 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NanoblackSplit : ModProjectile + { + private static int SpriteWidth = 52; + private static int Lifetime = 90; + private static float MaxRotationSpeed = 0.25f; + private static float MaxSpeed = 22f; + + private static float HomingStartRange = 600f; + private static float HomingBreakRange = 1000f; + private static float HomingBonusRangeCap = 200f; + private static float BaseHomingFactor = 1.6f; + private static float MaxHomingFactor = 6.6f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Nanoblack Blade"); + 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; + } + + // ai[0] = Index of current NPC target. If 0 or negative, the projectile has no target + // ai[1] = Current spin speed. Negative speeds are also allowed. + public override void AI() + { + drawOffsetX = -10; + drawOriginOffsetY = 0; + drawOriginOffsetX = 0; + + // 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) + 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 spinReduction = 0.0166f * currentSpin; + projectile.ai[1] -= spinReduction; + + // If about to disappear, shrink by 8% every frame + if (projectile.timeLeft < 15) + projectile.scale *= 0.92f; + + // Search for and home in on nearby targets + HomingAI(); + } + + private void HomingAI() + { + // If we don't currently have a target, go try and get one! + 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; + + // If we don't have a target, then just slow down a bit. + if (targetID < 0) + { + 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 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; + return; + } + + // Adds a multiple of the towards-target vector to its velocity every frame. + float homingFactor = CalcHomingFactor(dist); + Vector2 posDiff = target.Center - projectile.Center; + posDiff = posDiff.SafeNormalize(Vector2.Zero); + posDiff *= homingFactor; + Vector2 newVelocity = projectile.velocity += posDiff; + + // Caps speed to make sure it doesn't go too fast. + if (newVelocity.Length() >= MaxSpeed) + { + newVelocity = newVelocity.SafeNormalize(Vector2.Zero); + newVelocity *= MaxSpeed; + } + + projectile.velocity = newVelocity; + } + + // Returns the ID of the NPC to be targeted by this energy blade. + // It chooses the closest target which can be chased, ignoring invulnerable NPCs. + // Nanoblack Blades prefer to target bosses whenever possible. + private int AcquireTarget() + { + bool bossFound = false; + int target = -1; + float minDist = HomingStartRange; + for (int i = 0; i < 200; ++i) + { + NPC npc = Main.npc[i]; + if (!npc.active || npc.type == NPCID.TargetDummy) + continue; + + // If we've found a valid boss target, ignore ALL targets which aren't bosses. + if (bossFound && !npc.boss) + continue; + + if (npc.CanBeChasedBy(projectile, false)) + { + 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) + { + // If this target within range is a boss, set the boss found flag. + if (npc.boss) + bossFound = true; + minDist = distToNPC; + target = i; + } + } + } + return target; + } + + // Energy blades home even more aggressively if they are very close to their target. + private float CalcHomingFactor(float dist) + { + float baseFactor = BaseHomingFactor; + float bonus = (MaxHomingFactor - BaseHomingFactor) * (1f - dist / HomingBonusRangeCap); + if (bonus < 0f) + bonus = 0f; + return baseFactor + bonus; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + // Draws the energy blade's glowmask. + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + float fWidthOverTwo = SpriteWidth / 2f; + float fHeightOverTwo = projectile.height / 2f; + + // Make sure the glowmask matches the blade's own orientation + SpriteEffects eff = SpriteEffects.None; + 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); + } + + // Spawns a tiny bit of dust when the energy blade vanishes. + public override void Kill(int timeLeft) + { + SpawnDust(); + } + + // Spawns a small bit of Luminite themed dust. + private void SpawnDust() + { + int dustCount = Main.rand.Next(3, 6); + 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); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + Main.dust[idx].scale = scale; + } + } + } +} diff --git a/Projectiles/Hybrid/NanoblackSplit.png b/Projectiles/Rogue/NanoblackSplit.png similarity index 100% rename from Projectiles/Hybrid/NanoblackSplit.png rename to Projectiles/Rogue/NanoblackSplit.png diff --git a/Projectiles/Hybrid/NanoblackSplitGlow.png b/Projectiles/Rogue/NanoblackSplitGlow.png similarity index 100% rename from Projectiles/Hybrid/NanoblackSplitGlow.png rename to Projectiles/Rogue/NanoblackSplitGlow.png diff --git a/Projectiles/Rogue/NastyChollaBol.cs b/Projectiles/Rogue/NastyChollaBol.cs index 65724c1574..a9c9546e96 100644 --- a/Projectiles/Rogue/NastyChollaBol.cs +++ b/Projectiles/Rogue/NastyChollaBol.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class NastyChollaBol : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/NastyCholla"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nasty Cholla"); diff --git a/Projectiles/Rogue/NastyChollaBol.png b/Projectiles/Rogue/NastyChollaBol.png deleted file mode 100644 index 3dd805f735..0000000000 Binary files a/Projectiles/Rogue/NastyChollaBol.png and /dev/null differ diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs index 61af3eff00..401e5d904a 100644 --- a/Projectiles/Rogue/NightsGazeProjectile.cs +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class NightsGazeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/NightsGaze"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Night's Gaze"); @@ -22,27 +24,29 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 300; projectile.Calamity().rogue = true; } + private int SplitProjDamage => (int)(projectile.damage * 0.6f); + public override void AI() { if (projectile.ai[0] == 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45); - } + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.ToRadians(45); if (projectile.Calamity().stealthStrike) { if (Main.rand.NextBool(8)) { - int projectileDamage = (int)(projectile.damage * 0.75f); - int projectileType = ModContent.ProjectileType(); + int projID = ModContent.ProjectileType(); + int starDamage = SplitProjDamage; + float starKB = 5f; Vector2 velocity = projectile.velocity; - int p = Projectile.NewProjectile(projectile.Center, velocity, projectileType, projectileDamage, 5f, projectile.owner, 1f, 0f); + int p = Projectile.NewProjectile(projectile.Center, velocity, projID, starDamage, starKB, projectile.owner, 1f, 0f); Main.projectile[p].penetrate = 1; } } @@ -51,50 +55,31 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), projectile.timeLeft); - - int starCount = 6; - int starFrequency = 3; - float spread = 20f; - for (int i = 0; i < starCount; i++) - { - int projectileDamage = (int)(projectile.damage * 0.75f); - int projectileType = ModContent.ProjectileType(); - if (Main.rand.Next(starCount) < starFrequency) - { - projectileType = ModContent.ProjectileType(); - } - 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, projectileType, projectileDamage, 5f, 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); + OnHitEffects(); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), projectile.timeLeft); + OnHitEffects(); + } - int starCount = 6; - int starFrequency = 3; + private void OnHitEffects() + { + int onHitCount = 6; + int chanceOfStar = 2; float spread = 20f; - for (int i = 0; i < starCount; i++) + int projectileDamage = SplitProjDamage; + float kb = 5f; + int sparkID = ModContent.ProjectileType(); + int starID = ModContent.ProjectileType(); + for (int i = 0; i < onHitCount; i++) { - int projectileDamage = (int)(projectile.damage * 0.75f); - int projectileType = ModContent.ProjectileType(); - if (Main.rand.Next(starCount) < starFrequency) - { - projectileType = ModContent.ProjectileType(); - } + int projID = Main.rand.NextBool(chanceOfStar) ? starID : sparkID; 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, projectileType, projectileDamage, 5f, 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); @@ -112,14 +97,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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/Projectiles/Rogue/NightsGazeProjectileGlow"); - Vector2 origin = new Vector2(texture.Width / 2f, texture.Height / 2f); + Texture2D texture = ModContent.GetTexture("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); } @@ -127,12 +112,12 @@ namespace CalamityMod.Projectiles.Rogue { for (int i = 0; i < 5; i++) { - int dustType = Utils.SelectRandom(Main.rand, new int[] - { - 109, - 111, - 132 - }); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + 109, + 111, + 132 + }); 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/NightsGazeProjectile.png b/Projectiles/Rogue/NightsGazeProjectile.png deleted file mode 100644 index 6b12c7754c..0000000000 Binary files a/Projectiles/Rogue/NightsGazeProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/NightsGazeProjectileGlow.png b/Projectiles/Rogue/NightsGazeProjectileGlow.png deleted file mode 100644 index 146c7cd893..0000000000 Binary files a/Projectiles/Rogue/NightsGazeProjectileGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs index 596befdf11..a01662ee66 100644 --- a/Projectiles/Rogue/NightsGazeSpark.cs +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 6; projectile.height = 6; projectile.friendly = true; - projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.penetrate = 5; projectile.timeLeft = lifetime; projectile.Calamity().rogue = true; projectile.localAI[0] = 10f; diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs index da8436154c..c9e67b2132 100644 --- a/Projectiles/Rogue/NightsGazeStar.cs +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.penetrate = 5; projectile.timeLeft = lifetime; projectile.Calamity().rogue = true; projectile.localAI[0] = 10f; @@ -115,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, Color.White, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.White, 1); return false; } diff --git a/Projectiles/Rogue/NychthemeronOrb.cs b/Projectiles/Rogue/NychthemeronOrb.cs index 52687b0046..d4af22a7bf 100644 --- a/Projectiles/Rogue/NychthemeronOrb.cs +++ b/Projectiles/Rogue/NychthemeronOrb.cs @@ -63,6 +63,8 @@ namespace CalamityMod.Projectiles.Rogue } else if (projectile.localAI[0] == 1f) { + if (projectile.timeLeft > 240 && projectile.Calamity().lineColor == 1) + projectile.timeLeft = 240; // Follow Enemy float minDist = 999f; int index = 0; @@ -114,10 +116,5 @@ namespace CalamityMod.Projectiles.Rogue } return false; } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } } } diff --git a/Projectiles/Rogue/NychthemeronProjectile.cs b/Projectiles/Rogue/NychthemeronProjectile.cs index 4c1bf56c47..c9af0188a7 100644 --- a/Projectiles/Rogue/NychthemeronProjectile.cs +++ b/Projectiles/Rogue/NychthemeronProjectile.cs @@ -1,4 +1,3 @@ - using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -9,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class NychthemeronProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Nychthemeron"; + public static int lifetime = 300; public override void SetStaticDefaults() @@ -21,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 10; projectile.height = 10; projectile.friendly = true; - projectile.penetrate = 4; + projectile.ignoreWater = true; + projectile.penetrate = 4; projectile.timeLeft = lifetime; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/NychthemeronProjectile.png b/Projectiles/Rogue/NychthemeronProjectile.png deleted file mode 100644 index 35694b0ef6..0000000000 Binary files a/Projectiles/Rogue/NychthemeronProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs index ca65813395..d9368777f3 100644 --- a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs +++ b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class OrichalcumSpikedGemstoneProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/OrichalcumSpikedGemstone"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Gemstone"); @@ -54,31 +56,17 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer != projectile.owner) - return; - - for (int i = 0; i < 2; i++) - { - int direction = Main.player[projectile.owner].direction; - float xStart = Main.screenPosition.X; - if (direction < 0) - xStart += Main.screenWidth; - float yStart = Main.screenPosition.Y + Main.rand.Next(Main.screenHeight); - Vector2 startPos = new Vector2(xStart, yStart); - Vector2 pathToTravel = target.Center - startPos; - pathToTravel.X += Main.rand.NextFloat(-50f, 50f) * 0.1f; - pathToTravel.Y += Main.rand.NextFloat(-50f, 50f) * 0.1f; - float speedMult = 24f / pathToTravel.Length(); - pathToTravel.X *= speedMult; - pathToTravel.Y *= speedMult; - int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, projectile.damage, 0f, projectile.owner, 0f, 0f); - Main.projectile[petal].Calamity().forceRogue = true; - } + OnHitEffect(target.Center); } public override void OnHitPvp(Player target, int damage, bool crit) { - if (Main.myPlayer != projectile.owner) + OnHitEffect(target.Center); + } + + private void OnHitEffect(Vector2 targetPos) + { + if (Main.myPlayer != projectile.owner || !projectile.Calamity().stealthStrike) return; for (int i = 0; i < 2; i++) @@ -89,14 +77,15 @@ namespace CalamityMod.Projectiles.Rogue xStart += Main.screenWidth; float yStart = Main.screenPosition.Y + Main.rand.Next(Main.screenHeight); Vector2 startPos = new Vector2(xStart, yStart); - Vector2 pathToTravel = target.Center - startPos; + Vector2 pathToTravel = targetPos - startPos; pathToTravel.X += Main.rand.NextFloat(-50f, 50f) * 0.1f; pathToTravel.Y += Main.rand.NextFloat(-50f, 50f) * 0.1f; float speedMult = 24f / pathToTravel.Length(); pathToTravel.X *= speedMult; pathToTravel.Y *= speedMult; - int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, projectile.damage, 0f, projectile.owner, 0f, 0f); - Main.projectile[petal].Calamity().forceRogue = true; + int petal = Projectile.NewProjectile(startPos, pathToTravel, ProjectileID.FlowerPetal, projectile.damage, 0f, projectile.owner); + if (petal.WithinBounds(Main.maxProjectiles)) + Main.projectile[petal].Calamity().forceRogue = true; } } diff --git a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.png b/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.png deleted file mode 100644 index 3868486806..0000000000 Binary files a/Projectiles/Rogue/OrichalcumSpikedGemstoneProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index a5ef1bc4fa..765e9f7e23 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class PalladiumJavelinProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/PalladiumJavelin"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Javelin"); @@ -50,12 +52,18 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - int javelin2 = Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(MathHelper.ToRadians(-5f)), projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[javelin].Calamity().lineColor = projectile.Calamity().lineColor + 1; - Main.projectile[javelin2].Calamity().lineColor = projectile.Calamity().lineColor + 1; - Main.projectile[javelin].Calamity().stealthStrike = true; - Main.projectile[javelin2].Calamity().stealthStrike = true; + 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().stealthStrike = true; + } + if (javelin2.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[javelin2].Calamity().lineColor = projectile.Calamity().lineColor + 1; + Main.projectile[javelin2].Calamity().stealthStrike = true; + } projectile.Kill(); } } diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.png b/Projectiles/Rogue/PalladiumJavelinProjectile.png deleted file mode 100644 index 1eded3636f..0000000000 Binary files a/Projectiles/Rogue/PalladiumJavelinProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/PartisanExplosion.cs b/Projectiles/Rogue/PartisanExplosion.cs index 34a94d9c83..68047213d2 100644 --- a/Projectiles/Rogue/PartisanExplosion.cs +++ b/Projectiles/Rogue/PartisanExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class PartisanExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Explosion"); diff --git a/Projectiles/Rogue/PartisanExplosion.png b/Projectiles/Rogue/PartisanExplosion.png deleted file mode 100644 index 73557dc730..0000000000 Binary files a/Projectiles/Rogue/PartisanExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index dfd806d74b..d4736abf63 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class PenumbraBomb : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Penumbra"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Penumbra Bomb"); @@ -103,7 +105,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PenumbraBomb.png b/Projectiles/Rogue/PenumbraBomb.png deleted file mode 100644 index 38b624009e..0000000000 Binary files a/Projectiles/Rogue/PenumbraBomb.png and /dev/null differ diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index 1d9c5b7aa4..3f57c5d8dd 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Projectiles.Rogue { projectile.height = 18; projectile.width = 18; - projectile.Calamity().rogue = true; projectile.timeLeft = 150; projectile.friendly = true; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.alpha = 80; + projectile.Calamity().rogue = true; + projectile.alpha = 80; projectile.penetrate = 2; projectile.usesLocalNPCImmunity = true; @@ -61,12 +61,12 @@ namespace CalamityMod.Projectiles.Rogue private void HomingAI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, (Penumbra.ShootSpeed * 1.5f), 35f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, Penumbra.ShootSpeed * 1.5f, 35f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/PhantasmalRuinGhost.cs b/Projectiles/Rogue/PhantasmalRuinGhost.cs index c1f640c736..ca47d2927a 100644 --- a/Projectiles/Rogue/PhantasmalRuinGhost.cs +++ b/Projectiles/Rogue/PhantasmalRuinGhost.cs @@ -6,11 +6,11 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class PhantasmalRuinGhost : ModProjectile + public class PhantasmalRuinGhost : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Phantasmal Ghost"); + DisplayName.SetDefault("Phantasmal Afterimage"); } public override void SetDefaults() @@ -18,7 +18,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 240; projectile.extraUpdates = 1; @@ -27,31 +28,22 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (projectile.timeLeft >= 207) - { - projectile.alpha += 6; - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default(Color), 0.85f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 18f, 20f); + // Set the projectile's direction correctly + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + + // The projectile rapidly fades in as it starts existing + if (projectile.timeLeft >= 207) + projectile.alpha += 6; + + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 40f); } - public override void Kill(int timeLeft) - { - projectile.position = projectile.Center; - projectile.width = projectile.height = 110; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - projectile.damage /= 2; - projectile.Damage(); - } + public override Color? GetAlpha(Color lightColor) => new Color(100, 200, 255, 100); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 239) - return false; + 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); diff --git a/Projectiles/Rogue/PhantasmalRuinProj.cs b/Projectiles/Rogue/PhantasmalRuinProj.cs index c5abeb7eb9..764da0c0ad 100644 --- a/Projectiles/Rogue/PhantasmalRuinProj.cs +++ b/Projectiles/Rogue/PhantasmalRuinProj.cs @@ -1,19 +1,23 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class PhantasmalRuinProj : ModProjectile + public class PhantasmalRuinProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/PhantasmalRuin"; + + private const int Lifetime = 600; + private const int FramesPerSubProjectile = 13; + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantasmal Ruin"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 12; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -21,90 +25,72 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.tileCollide = false; - projectile.timeLeft = 600; + projectile.timeLeft = Lifetime; projectile.extraUpdates = 1; projectile.Calamity().rogue = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3); return false; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 175, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, default(Color), 0.85f); - if (projectile.timeLeft % 18 == 0) - { - if (projectile.owner == Main.myPlayer) - { - if (projectile.Calamity().stealthStrike) - { - 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); - } - else - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, Main.rand.NextFloat(-2,2), ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); - } - } - } + // Set the projectile's direction correctly + 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); + d.noLight = true; + 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 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); + 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); + } } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - float spread = 45f * 0.0174f; - 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 (Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (i = 0; i < 8; i++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - 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 num23 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.05), 0f, projectile.owner, 1f, ai1); - int num24 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.05), 0f, projectile.owner, 1f, ai1); - } - } - else - { - damage = (int)(damage * 0.9); - } - } - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => OnHitEffects(); + public override void OnHitPvp(Player target, int damage, bool crit) => OnHitEffects(); - public override void OnHitPvp(Player target, int damage, bool crit) + private void OnHitEffects() { - float spread = 45f * 0.0174f; - 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 && Main.player[projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()] < 8) - { - for (i = 0; i < 8; i++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - 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 num23 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f) + randomSpeed, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.05), 0f, projectile.owner, 1f, ai1); - int num24 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f) + randomSpeed2, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.05), 0f, projectile.owner, 1f, ai1); - } - } - else - { - damage = (int)(damage * 0.9); - } - } + if (projectile.owner != Main.myPlayer) + return; + + int numSouls = 4; + int projID = ModContent.ProjectileType(); + int soulDamage = (int)(projectile.damage * 0.1f); + float soulKB = 0f; + float speed = 5f; + float startAngle = Main.rand.NextFloat(-0.07f, 0.07f) + MathHelper.PiOver4; + Vector2 velocity = (Vector2.UnitX * speed).RotatedBy(startAngle); + for (int i = 0; i < numSouls; i += 2) + { + // 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); + if (Main.rand.NextBool(2)) + 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/PhantasmalRuinProj.png b/Projectiles/Rogue/PhantasmalRuinProj.png deleted file mode 100644 index 337b8ecc7d..0000000000 Binary files a/Projectiles/Rogue/PhantasmalRuinProj.png and /dev/null differ diff --git a/Projectiles/Rogue/PhantasmalSoul.cs b/Projectiles/Rogue/PhantasmalSoul.cs index 15696f1831..352fdb98ea 100644 --- a/Projectiles/Rogue/PhantasmalSoul.cs +++ b/Projectiles/Rogue/PhantasmalSoul.cs @@ -1,27 +1,30 @@ +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { - public class PhantasmalSoul : ModProjectile + public class PhantasmalSoul : ModProjectile { - private int originDamage; - private int divider = 10; + private const int Lifetime = 300; + private const int NoHomingFrames = 40; + private const int NoHitFrames = 10; + private const int NoDrawFrames = 5; + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantasmal Soul"); Main.projFrames[projectile.type] = 4; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = projectile.height = 36; projectile.alpha = 100; projectile.friendly = true; projectile.ignoreWater = true; @@ -29,23 +32,14 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; projectile.extraUpdates = 1; projectile.penetrate = 1; - projectile.timeLeft = 600; + projectile.timeLeft = Lifetime; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < Lifetime - NoHomingFrames && target.CanBeChasedBy(projectile); + + public override void AI() { - if (projectile.timeLeft == 600) - { - originDamage = projectile.damage; - projectile.damage = 0; - } - else if (projectile.timeLeft % 5 == 0 && divider > 0) - { - projectile.damage = originDamage / divider; - divider--; - } - else if (divider == 0) - projectile.damage = originDamage; + // Handle animation projectile.frameCounter++; if (projectile.frameCounter > 6) { @@ -53,58 +47,64 @@ namespace CalamityMod.Projectiles.Rogue projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } - if (projectile.timeLeft <= 560) - { - projectile.ai[0] = 0f; - } - 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 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) + + // Activate homing on enemies after a brief delay + if (projectile.timeLeft < Lifetime - NoHomingFrames) + projectile.ai[0] = 1f; + + // Occasional dust + if (Main.rand.NextBool(4)) { - if (projectile.Distance(Main.player[projectile.owner].Center) > num954) + int dustID = 173; + Dust d = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustID); + d.velocity *= 0.1f; + d.scale = 1.3f; + d.noGravity = true; + d.noLight = true; + } + + // Purple light + 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; + + 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]; + 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) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * scaleFactor12) / num953; + Vector2 moveDirection = projectile.SafeDirectionTo(Main.player[projectile.owner].Center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; return; } - if (projectile.ai[0] == 0f) - { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); - } - } - else - { - if (projectile.timeLeft > 30) - { - projectile.timeLeft = 30; - } + + // 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 the owner is dead these projectiles disappear rapidly. + else if (projectile.timeLeft > 30) + projectile.timeLeft = 30; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - if (projectile.timeLeft > 595) - return false; + if (projectile.timeLeft > Lifetime - NoDrawFrames) + return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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) @@ -118,46 +118,23 @@ namespace CalamityMod.Projectiles.Rogue 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 /= 4; - 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; - 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; - Main.dust[num228].velocity = vector7; - } - if (Main.rand.NextBool(6)) - { - Main.PlaySound(SoundID.NPCDeath39, projectile.position); + int dustCount = 36; + int dustID = 173; + 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); + 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); } // Cannot deal damage for the first several frames of existence. - public override bool? CanHitNPC(NPC target) - { - if (projectile.timeLeft >= 590) - { - return false; - } - return null; - } - - public override bool CanHitPvp(Player target) - { - return projectile.timeLeft < 590; - } + public override bool CanHitPvp(Player target) => projectile.timeLeft < Lifetime - NoHitFrames; } } diff --git a/Projectiles/Rogue/PhantasmalSoul.png b/Projectiles/Rogue/PhantasmalSoul.png index 96f62a52d5..fe77251e7c 100644 Binary files a/Projectiles/Rogue/PhantasmalSoul.png and b/Projectiles/Rogue/PhantasmalSoul.png differ diff --git a/Projectiles/Rogue/PhantomLanceProj.cs b/Projectiles/Rogue/PhantomLanceProj.cs index 47616a7ef9..d0ffe55ddc 100644 --- a/Projectiles/Rogue/PhantomLanceProj.cs +++ b/Projectiles/Rogue/PhantomLanceProj.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue { public class PhantomLanceProj : ModProjectile { - private int projCount = 22; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/PhantomLance"; public override void SetStaticDefaults() { @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 300; projectile.extraUpdates = 1; @@ -33,13 +34,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } public override void AI() { - if (projectile.Calamity().stealthStrike != true) + if (!projectile.Calamity().stealthStrike) { if (projectile.timeLeft <= 255) projectile.alpha += 1; @@ -49,34 +50,25 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y *= 0.995f; } } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + 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); - projCount--; - if (projCount <= 0) + projectile.ai[0]++; + if (projectile.ai[0] % 18f == 0f) { if (projectile.owner == Main.myPlayer) { + 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); + if (soul.WithinBounds(Main.maxProjectiles)) { - int stealthSoulDamage = (int)(projectile.damage * 0.7f); - float stealthSoulKB = projectile.knockBack; - int stealthSoul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), stealthSoulDamage, stealthSoulKB, projectile.owner, 0f, 0f); - Main.projectile[stealthSoul].Calamity().forceRogue = true; - Main.projectile[stealthSoul].usesLocalNPCImmunity = true; - Main.projectile[stealthSoul].localNPCHitCooldown = -2; - } - else - { - float damageMult = projectile.timeLeft * 0.7f / 300f; - int soulDamage = (int)(projectile.damage * damageMult); - float soulKB = projectile.knockBack; - int soul = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), soulDamage, soulKB, projectile.owner, 0f, 0f); Main.projectile[soul].Calamity().forceRogue = true; Main.projectile[soul].usesLocalNPCImmunity = true; Main.projectile[soul].localNPCHitCooldown = -2; } } - projCount = 18; } } diff --git a/Projectiles/Rogue/PhantomLanceProj.png b/Projectiles/Rogue/PhantomLanceProj.png deleted file mode 100644 index 55db8c10ed..0000000000 Binary files a/Projectiles/Rogue/PhantomLanceProj.png and /dev/null differ diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index 3ff3bbec5e..108ccaf40d 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class PlaguenadeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Plaguenade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Plaguenade"); diff --git a/Projectiles/Rogue/PlaguenadeProj.png b/Projectiles/Rogue/PlaguenadeProj.png deleted file mode 100644 index 16cbb3dd4e..0000000000 Binary files a/Projectiles/Rogue/PlaguenadeProj.png and /dev/null differ diff --git a/Projectiles/Rogue/PoisonBol.cs b/Projectiles/Rogue/PoisonBol.cs index 1423a4bd95..31bb6eb1f3 100644 --- a/Projectiles/Rogue/PoisonBol.cs +++ b/Projectiles/Rogue/PoisonBol.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class PoisonBol : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/PoisonPack"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Poison Ball"); @@ -35,30 +37,29 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft < 20) projectile.alpha += 13; - if (projectile.Calamity().stealthStrike == true) + if (projectile.Calamity().stealthStrike) { projectile.localAI[1]++; - if ((double) projectile.localAI[1] >= 35) + if (projectile.localAI[1] % 35f == 0f) { - 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, 21) * 0.1f); - if (Main.rand.Next(3) == 0) - vector2_2 *= 2f; - Vector2 vector2_3 = velocity * 0.25f + vector2_2; - Vector2 vector2_5 = vector2_3 * 0.8f; - int proj = Projectile.NewProjectile(projectile.Center.X - vector2_5.X, projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, Main.rand.Next(569,572), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 45; - projectile.localAI[1] = 0.0f; + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 20f); + if (Main.rand.NextBool(3)) + velocity *= 2f; + 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); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].Calamity().forceRogue = true; + Main.projectile[proj].usesLocalNPCImmunity = true; + Main.projectile[proj].localNPCHitCooldown = 45; + } } } Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.killSpikyBalls == true) + if (modPlayer.killSpikyBalls) { projectile.active = false; projectile.netUpdate = true; diff --git a/Projectiles/Rogue/PoisonBol.png b/Projectiles/Rogue/PoisonBol.png deleted file mode 100644 index ba811c24d2..0000000000 Binary files a/Projectiles/Rogue/PoisonBol.png and /dev/null differ diff --git a/Projectiles/Rogue/PrismRocket.cs b/Projectiles/Rogue/PrismRocket.cs new file mode 100644 index 0000000000..25e8598ab3 --- /dev/null +++ b/Projectiles/Rogue/PrismRocket.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 const int Lifetime = 150; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Rocket"); + 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; + } + + public override void AI() + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(800f, true); + if (potentialTarget != null) + AttackTarget(potentialTarget); + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + EmitDust(); + } + + public void AttackTarget(NPC target) + { + float newSpeed = projectile.velocity.Length() * ExponentialAccelerationFactor; + if (newSpeed > MaxHomingSpeed) + newSpeed = MaxHomingSpeed; + + 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; + } + } + + public void EmitDust() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 2; i++) + { + if (!Main.rand.NextBool(3)) + continue; + + 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); + dust.noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/PrismRocket.png b/Projectiles/Rogue/PrismRocket.png new file mode 100644 index 0000000000..dd035814fc Binary files /dev/null and b/Projectiles/Rogue/PrismRocket.png differ diff --git a/Projectiles/Rogue/PrismShurikenBlade.cs b/Projectiles/Rogue/PrismShurikenBlade.cs new file mode 100644 index 0000000000..7ac5b498b5 --- /dev/null +++ b/Projectiles/Rogue/PrismShurikenBlade.cs @@ -0,0 +1,54 @@ +using Terraria; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.ID; + +namespace CalamityMod.Projectiles.Rogue +{ + public class PrismShurikenBlade : ModProjectile + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Blade"); + + 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; + } + + public override void AI() + { + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 850f, 19f, 30f); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void Kill(int timeLeft) + { + if (Main.dedServ) + return; + + 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; + spawnPosition += circularOffsetDirection * new Vector2(12f, 7f); + + Dust energy = Dust.NewDustPerfect(spawnPosition, 261); + energy.velocity = circularOffsetDirection * new Vector2(3f, 2f); + energy.color = Color.Cyan; + energy.scale = 0.7f; + energy.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + } +} diff --git a/Projectiles/Rogue/PrismShurikenBlade.png b/Projectiles/Rogue/PrismShurikenBlade.png new file mode 100644 index 0000000000..dd035814fc Binary files /dev/null and b/Projectiles/Rogue/PrismShurikenBlade.png differ diff --git a/Projectiles/Rogue/Prismalline2.cs b/Projectiles/Rogue/Prismalline2.cs index f989130189..888783e3d7 100644 --- a/Projectiles/Rogue/Prismalline2.cs +++ b/Projectiles/Rogue/Prismalline2.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Prismalline2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Prismalline"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Prismalline"); @@ -18,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 113; projectile.timeLeft = 60; aiType = ProjectileID.BoneJavelin; @@ -27,11 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Rogue/Prismalline2.png b/Projectiles/Rogue/Prismalline2.png deleted file mode 100644 index 91fbee0144..0000000000 Binary files a/Projectiles/Rogue/Prismalline2.png and /dev/null differ diff --git a/Projectiles/Rogue/Prismalline3.cs b/Projectiles/Rogue/Prismalline3.cs index 5fc4d6946c..34669dcb54 100644 --- a/Projectiles/Rogue/Prismalline3.cs +++ b/Projectiles/Rogue/Prismalline3.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Prismalline3 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Prismalline"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Prismalline"); @@ -18,19 +20,20 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 180; projectile.Calamity().rogue = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); - if (projectile.spriteDirection == -1) - { - projectile.rotation -= MathHelper.PiOver2; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 25f, 20f); + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 450f, 12f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -52,9 +55,12 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - Main.projectile[shard].Calamity().forceRogue = true; - Main.projectile[shard].penetrate = 1; + 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; + Main.projectile[shard].penetrate = 1; + } } } } diff --git a/Projectiles/Rogue/Prismalline3.png b/Projectiles/Rogue/Prismalline3.png deleted file mode 100644 index 91fbee0144..0000000000 Binary files a/Projectiles/Rogue/Prismalline3.png and /dev/null differ diff --git a/Projectiles/Rogue/PrismallineProj.cs b/Projectiles/Rogue/PrismallineProj.cs index a1fab9f455..99854af771 100644 --- a/Projectiles/Rogue/PrismallineProj.cs +++ b/Projectiles/Rogue/PrismallineProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class PrismallineProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Prismalline"; + public bool hitEnemy = false; public override void SetStaticDefaults() @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.penetrate = 2; projectile.aiStyle = 113; projectile.timeLeft = 180; aiType = ProjectileID.BoneJavelin; @@ -31,11 +34,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); projectile.ai[1] += 1f; if (projectile.ai[1] == 40f) { @@ -66,10 +65,13 @@ 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, 0f, 0f); - Main.projectile[shard].Calamity().forceRogue = true; - Main.projectile[shard].usesLocalNPCImmunity = true; - Main.projectile[shard].localNPCHitCooldown = 10; + 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; + Main.projectile[shard].usesLocalNPCImmunity = true; + Main.projectile[shard].localNPCHitCooldown = 10; + } } for (int i = 0; i < numProj + 1; i++) { @@ -101,9 +103,12 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - Main.projectile[shard].Calamity().forceRogue = true; - Main.projectile[shard].penetrate = 1; + 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; + Main.projectile[shard].penetrate = 1; + } } } } @@ -112,14 +117,14 @@ namespace CalamityMod.Projectiles.Rogue { hitEnemy = true; if (projectile.Calamity().stealthStrike) - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } public override void OnHitPvp(Player target, int damage, bool crit) { hitEnemy = true; if (projectile.Calamity().stealthStrike) - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } } } diff --git a/Projectiles/Rogue/PrismallineProj.png b/Projectiles/Rogue/PrismallineProj.png deleted file mode 100644 index 91fbee0144..0000000000 Binary files a/Projectiles/Rogue/PrismallineProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ProfanedPartisanproj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs similarity index 69% rename from Projectiles/Rogue/ProfanedPartisanproj.cs rename to Projectiles/Rogue/ProfanedPartisanProj.cs index f5f60cf019..060010e6c6 100644 --- a/Projectiles/Rogue/ProfanedPartisanproj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -8,28 +8,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class ProfanedPartisanproj : ModProjectile + public class ProfanedPartisanProj : ModProjectile { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Profaned Partisan"); + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ProfanedPartisan"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Partisan"); 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 = 5; + projectile.penetrate = 9; projectile.timeLeft = 600; projectile.extraUpdates = 3; projectile.tileCollide = false; projectile.ignoreWater = true; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 12; } public override void AI() @@ -65,7 +67,7 @@ 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(Color), 1.1f); + 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; @@ -73,29 +75,36 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(projectile.Center, 1f, 0.8f, 0.2f); 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) - { - Projectile.NewProjectile(spearPosition, spearSpeed, ModContent.ProjectileType(), projectile.damage / 10, projectile.knockBack * 0.1f, projectile.owner); - } - } + { + 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); + float spearKB = 1f; + Projectile.NewProjectile(spearPosition, spearSpeed, projID, spearDamage, spearKB, projectile.owner); + } + } } public override void Kill(int timeLeft) { for (int i = 0; i < 20; i++) { - Dust.NewDust(projectile.position, projectile.width, projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 50, default(Color), 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); - Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner); + + int projID = ModContent.ProjectileType(); + int explosionDamage = (int)(projectile.damage * 0.8f); + float explosionKB = 8f; + Projectile.NewProjectile(projectile.Center, Vector2.Zero, projID, explosionDamage, explosionKB, projectile.owner); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 similarity index 94% rename from Projectiles/Rogue/ProfanedPartisanspear.cs rename to Projectiles/Rogue/ProfanedPartisanSpear.cs index 79c8b1d30d..fd54a84369 100644 --- a/Projectiles/Rogue/ProfanedPartisanspear.cs +++ b/Projectiles/Rogue/ProfanedPartisanSpear.cs @@ -6,7 +6,7 @@ using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { - public class ProfanedPartisanspear : ModProjectile + public class ProfanedPartisanSpear : ModProjectile { public int timer = 0; @@ -86,7 +86,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = 1; if (timer >= 10) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 7f, 20f); } } diff --git a/Projectiles/Rogue/ProfanedPartisanspear.png b/Projectiles/Rogue/ProfanedPartisanSpear.png similarity index 100% rename from Projectiles/Rogue/ProfanedPartisanspear.png rename to Projectiles/Rogue/ProfanedPartisanSpear.png diff --git a/Projectiles/Rogue/ProfanedPartisanproj.png b/Projectiles/Rogue/ProfanedPartisanproj.png deleted file mode 100644 index defd077056..0000000000 Binary files a/Projectiles/Rogue/ProfanedPartisanproj.png and /dev/null differ diff --git a/Projectiles/Rogue/Quasar2.cs b/Projectiles/Rogue/Quasar2.cs index fc219c5d6f..02951b4af3 100644 --- a/Projectiles/Rogue/Quasar2.cs +++ b/Projectiles/Rogue/Quasar2.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Quasar2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Quasar"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Quasar"); @@ -23,18 +25,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 300; projectile.Calamity().rogue = true; } public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 600f; @@ -80,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -93,9 +92,12 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.Calamity().stealthStrike && projectile.owner == Main.myPlayer) { int boomer = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 1f); - Main.projectile[boomer].Calamity().stealthStrike = projectile.Calamity().stealthStrike; - Main.projectile[boomer].height = Main.projectile[boomer].width = 280; - Main.projectile[boomer].Center = projectile.Center; + if (boomer.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[boomer].Calamity().stealthStrike = true; + Main.projectile[boomer].height = Main.projectile[boomer].width = 280; + Main.projectile[boomer].Center = projectile.Center; + } } } } diff --git a/Projectiles/Rogue/Quasar2.png b/Projectiles/Rogue/Quasar2.png deleted file mode 100644 index 9401139162..0000000000 Binary files a/Projectiles/Rogue/Quasar2.png and /dev/null differ diff --git a/Projectiles/Rogue/QuasarKnife.cs b/Projectiles/Rogue/QuasarKnife.cs index d6b214fab5..0bdf26a5c0 100644 --- a/Projectiles/Rogue/QuasarKnife.cs +++ b/Projectiles/Rogue/QuasarKnife.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Rogue { public class QuasarKnife : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Quasar"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Quasar"); @@ -23,18 +25,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.penetrate = 4; + projectile.ignoreWater = true; + projectile.penetrate = 4; projectile.timeLeft = 300; projectile.Calamity().rogue = true; } public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 600f; @@ -108,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/QuasarKnife.png b/Projectiles/Rogue/QuasarKnife.png deleted file mode 100644 index 9401139162..0000000000 Binary files a/Projectiles/Rogue/QuasarKnife.png and /dev/null differ diff --git a/Projectiles/Rogue/RadiantExplosion.cs b/Projectiles/Rogue/RadiantExplosion.cs index 4099775005..4fec6b4f2f 100644 --- a/Projectiles/Rogue/RadiantExplosion.cs +++ b/Projectiles/Rogue/RadiantExplosion.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue { public class RadiantExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private bool updatedTime = false; public override void SetStaticDefaults() @@ -95,68 +97,31 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ModContent.ProjectileType(); - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, (int)(projectile.damage * 0.75), 5f, projectile.owner, 2f, 0f); - Main.projectile[num17].Calamity().forceRogue = true; - } - } + OnHitEffect(target.Center); + } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); + OnHitEffect(target.Center); + } + + private void OnHitEffect(Vector2 targetPos) + { for (int n = 0; n < 3; n++) { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = ModContent.ProjectileType(); - } - else if (projectileType == 1) - { - projectileType = ProjectileID.HallowStar; - } - else - { - projectileType = ModContent.ProjectileType(); - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, (int)(projectile.damage * 0.75), 5f, projectile.owner, 2f, 0f); - Main.projectile[num17].Calamity().forceRogue = true; + int projType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ProjectileType(), + ProjectileID.HallowStar, + ModContent.ProjectileType() + }); + 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; + star.ai[0] = 2f; + } } } } diff --git a/Projectiles/Rogue/RadiantExplosion.png b/Projectiles/Rogue/RadiantExplosion.png deleted file mode 100644 index 3ccaea528f..0000000000 Binary files a/Projectiles/Rogue/RadiantExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/RadiantStar2.cs b/Projectiles/Rogue/RadiantStar2.cs index e161cf92fd..427d04dfd6 100644 --- a/Projectiles/Rogue/RadiantStar2.cs +++ b/Projectiles/Rogue/RadiantStar2.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue { public class RadiantStar2 : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/RadiantStar"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Star"); @@ -24,18 +26,17 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 300; projectile.Calamity().rogue = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); + + public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (projectile.ai[0] == 1f) { float num472 = projectile.Center.X; @@ -71,10 +72,8 @@ namespace CalamityMod.Projectiles.Rogue } } } - else - { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, projectile.Calamity().stealthStrike ? 1800f : 600f, 24f, 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) @@ -89,7 +88,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RadiantStar2.png b/Projectiles/Rogue/RadiantStar2.png deleted file mode 100644 index d5a854d774..0000000000 Binary files a/Projectiles/Rogue/RadiantStar2.png and /dev/null differ diff --git a/Projectiles/Rogue/RadiantStarKnife.cs b/Projectiles/Rogue/RadiantStarKnife.cs index 1a3d5b515e..9bc04e7e11 100644 --- a/Projectiles/Rogue/RadiantStarKnife.cs +++ b/Projectiles/Rogue/RadiantStarKnife.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Rogue { public class RadiantStarKnife : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/RadiantStar"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Star"); @@ -23,18 +25,15 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.penetrate = 4; + projectile.ignoreWater = true; + projectile.penetrate = 4; projectile.timeLeft = 300; projectile.Calamity().rogue = true; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= MathHelper.PiOver2; - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (projectile.ai[0] == 1f) { float num472 = projectile.Center.X; @@ -92,10 +91,10 @@ namespace CalamityMod.Projectiles.Rogue Main.projectile[stabber2].Calamity().stealthStrike = projectile.Calamity().stealthStrike; } Main.PlaySound(SoundID.Item14, projectile.position); - int boomer = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[boomer].Calamity().stealthStrike = projectile.Calamity().stealthStrike; - if (projectile.Calamity().stealthStrike) + 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; } @@ -117,7 +116,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/RadiantStarKnife.png b/Projectiles/Rogue/RadiantStarKnife.png deleted file mode 100644 index d5a854d774..0000000000 Binary files a/Projectiles/Rogue/RadiantStarKnife.png and /dev/null differ diff --git a/Projectiles/Rogue/ReaperProjectile.cs b/Projectiles/Rogue/ReaperProjectile.cs index d58a4244c1..9a4f67deb9 100644 --- a/Projectiles/Rogue/ReaperProjectile.cs +++ b/Projectiles/Rogue/ReaperProjectile.cs @@ -4,13 +4,16 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Rogue { - public class ReaperProjectile : ModProjectile + public class ReaperProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheReaper"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Scythe"); + DisplayName.SetDefault("The Reaper"); ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -21,11 +24,12 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 70; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = 12; - projectile.timeLeft = 750; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.extraUpdates = 3; + projectile.timeLeft = projectile.MaxUpdates * 90; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.localNPCHitCooldown = 32; // can't hit too fast, but can hit many many times projectile.Calamity().rogue = true; } @@ -39,21 +43,25 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.localAI[0] == 0f) { projectile.ai[1] += 1f; - if (projectile.ai[1] >= 60f) + + // If the Reaper lands a hit, switch to second behavior mode immediately. + if (projectile.ai[1] >= 60f || projectile.numHits > 0) { projectile.localAI[0] = 1f; projectile.ai[1] = 0f; projectile.netUpdate = true; } + + // Initial homing before landing a hit. else - { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 250f, 12f, 14f); } + + // Homing after landing a hit. This homing repeatedly turns on and off. else { - float num633 = 700f; - bool flag24 = false; + float homingRange = 700f; + bool noHomingThisFrame = false; if (projectile.ai[0] == 1f) { projectile.ai[1] += 1f; @@ -64,48 +72,50 @@ namespace CalamityMod.Projectiles.Rogue projectile.netUpdate = true; } else - { - flag24 = true; - } + noHomingThisFrame = true; } - if (flag24) - { + + if (noHomingThisFrame) return; - } - Vector2 vector46 = projectile.position; - bool flag25 = false; - for (int num645 = 0; num645 < Main.maxNPCs; num645++) + + Vector2 homingTarget = projectile.Center; + bool foundTarget = false; + for (int i = 0; i < Main.maxNPCs; i++) { - NPC nPC2 = Main.npc[num645]; + NPC nPC2 = Main.npc[i]; if (nPC2.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (!flag25) + float npcDist = Vector2.Distance(nPC2.Center, projectile.Center); + if (!foundTarget) { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; + homingRange = npcDist; + homingTarget = nPC2.Center; + foundTarget = true; + break; } } } - if (flag25 && projectile.ai[0] == 0f) + + if (foundTarget && projectile.ai[0] == 0f) { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) + Vector2 delta = homingTarget - projectile.Center; + float distance = delta.Length(); + delta /= distance; + + if (distance > 200f) { - float scaleFactor2 = 8f; - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + float homingScalar = 11f; + delta *= homingScalar; + projectile.velocity = (projectile.velocity * 40f + delta) / 41f; } else { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + float homingScalar = 3.6f; + delta *= -homingScalar; // yes this is intentionally backwards + projectile.velocity = (projectile.velocity * 40f + delta) / 41f; } } + if (projectile.ai[1] > 0f) { projectile.ai[1] += (float)Main.rand.Next(1, 4); @@ -117,13 +127,13 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] == 0f) { - if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + if (projectile.ai[1] == 0f && foundTarget && homingRange < 500f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { projectile.ai[0] = 1f; - Vector2 value20 = vector46 - projectile.Center; + Vector2 value20 = homingTarget - projectile.Center; value20.Normalize(); projectile.velocity = value20 * 8f; projectile.netUpdate = true; @@ -131,12 +141,12 @@ namespace CalamityMod.Projectiles.Rogue } } } - projectile.rotation += 0.5f; + projectile.rotation += 0.07f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/ReaperProjectile.png b/Projectiles/Rogue/ReaperProjectile.png deleted file mode 100644 index 0714005470..0000000000 Binary files a/Projectiles/Rogue/ReaperProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/RefractionRotorGlowmask.png b/Projectiles/Rogue/RefractionRotorGlowmask.png new file mode 100644 index 0000000000..0cdffe82c6 Binary files /dev/null and b/Projectiles/Rogue/RefractionRotorGlowmask.png differ diff --git a/Projectiles/Rogue/RefractionRotorProjectile.cs b/Projectiles/Rogue/RefractionRotorProjectile.cs new file mode 100644 index 0000000000..24cdfaf854 --- /dev/null +++ b/Projectiles/Rogue/RefractionRotorProjectile.cs @@ -0,0 +1,115 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class RefractionRotorProjectile : ModProjectile + { + public const int EnergyShotCount = 6; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/RefractionRotor"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Prism Shuriken"); + 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; + } + + 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; + } + + 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; + } + + public override void Kill(int timeLeft) + { + // Release a puff of rainbow dust and some blades. + // If this projectile is a stealth strike, don't create the blades as a gore-- create them as a projectile instead. + if (!Main.dedServ) + { + for (int i = 0; i < 15; i++) + { + 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); + rainbowBurst.fadeIn = Main.rand.NextFloat(0.8f, 1.6f); + rainbowBurst.noGravity = true; + } + + if (!projectile.Calamity().stealthStrike) + { + 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; + if (!WorldGen.SolidTile((int)spawnPosition.X / 16, (int)spawnPosition.Y / 16)) + Gore.NewGorePerfect(spawnPosition, projectile.velocity * 0.5f + shootDirection * 7f, goreType, projectile.scale); + } + } + } + + int shootType = ModContent.ProjectileType(); + if (Main.myPlayer != projectile.owner) + return; + + // Release a circle of damaging blades if this projectile is a stealth strike. + if (projectile.Calamity().stealthStrike) + { + int bladeType = ModContent.ProjectileType(); + 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, projectile.damage, projectile.knockBack, projectile.owner); + } + } + + if (CalamityUtils.CountProjectiles(shootType) > 24) + return; + + int energyDamage = (int)(projectile.damage * 0.66); + 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); + } + } + + 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; + Vector2 origin = glowmask.Size() * 0.5f; + 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 082a1c488b..63af8ba324 100644 --- a/Projectiles/Rogue/RegulusEnergy.cs +++ b/Projectiles/Rogue/RegulusEnergy.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class RegulusEnergy : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Regulus Energy"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = 8; projectile.height = 8; - projectile.friendly = true; + projectile.ignoreWater = true; + projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = false; projectile.Calamity().rogue = true; @@ -71,12 +74,9 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } else projectile.Kill(); diff --git a/Projectiles/Rogue/RegulusEnergy.png b/Projectiles/Rogue/RegulusEnergy.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Rogue/RegulusEnergy.png and /dev/null differ diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 862e1f579d..316d034937 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Rogue { public class RegulusRiotProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/RegulusRiot"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Regulus Riot"); @@ -157,7 +159,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/RegulusRiotProj.png b/Projectiles/Rogue/RegulusRiotProj.png deleted file mode 100644 index 923bd363b8..0000000000 Binary files a/Projectiles/Rogue/RegulusRiotProj.png and /dev/null differ diff --git a/Projectiles/Rogue/RotBallProjectile.cs b/Projectiles/Rogue/RotBallProjectile.cs index d9e11daa8f..b167091dd8 100644 --- a/Projectiles/Rogue/RotBallProjectile.cs +++ b/Projectiles/Rogue/RotBallProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class RotBallProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/RotBall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ball"); diff --git a/Projectiles/Rogue/RotBallProjectile.png b/Projectiles/Rogue/RotBallProjectile.png deleted file mode 100644 index 1e8619998a..0000000000 Binary files a/Projectiles/Rogue/RotBallProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs new file mode 100644 index 0000000000..f091712f59 --- /dev/null +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -0,0 +1,117 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 bool AbleToHealOwner = true; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sacrifice"; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sacrifice"); + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + } + + public override void SetDefaults() + { + projectile.width = 62; + projectile.height = 18; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(AbleToHealOwner); + + public override void ReceiveExtraAI(BinaryReader reader) => AbleToHealOwner = reader.ReadBoolean(); + + + public override void AI() + { + if (ReturningToOwner) + { + 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 (!Owner.moonLeech && AbleToHealOwner) + { + int healAmount = projectile.Calamity().stealthStrike ? 50 : 4; + + Owner.HealEffect(healAmount); + Owner.statLife += healAmount; + if (Owner.statLife > Owner.statLifeMax2) + Owner.statLife = Owner.statLifeMax2; + } + + projectile.Kill(); + } + } + else if (!StickingToAnything) + 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); + blood.velocity = Main.rand.NextVector2Circular(3f, 3f); + blood.noGravity = true; + blood.color = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat(0.25f, 1f)); + blood.scale = Main.rand.NextFloat(1f, 1.4f); + } + } + + if (StickingToAnything && projectile.timeLeft > 90) + projectile.timeLeft = 90; + 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; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + 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(); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size()); + + public override void Kill(int timeLeft) + { + 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; + blood.noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/SandDollarProj.cs b/Projectiles/Rogue/SandDollarProj.cs index 5f2f5ce92f..31f8649e35 100644 --- a/Projectiles/Rogue/SandDollarProj.cs +++ b/Projectiles/Rogue/SandDollarProj.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SandDollarProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Dollar"); diff --git a/Projectiles/Rogue/SandDollarProj.png b/Projectiles/Rogue/SandDollarProj.png deleted file mode 100644 index 126d908944..0000000000 Binary files a/Projectiles/Rogue/SandDollarProj.png and /dev/null differ diff --git a/Projectiles/Rogue/SandDollarStealth.cs b/Projectiles/Rogue/SandDollarStealth.cs index 4986c1cac4..98e134d66f 100644 --- a/Projectiles/Rogue/SandDollarStealth.cs +++ b/Projectiles/Rogue/SandDollarStealth.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SandDollarStealth : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SandDollar"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sand Dollar"); @@ -44,8 +46,9 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - Main.projectile[coral].Calamity().forceRogue = true; + 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; } } } diff --git a/Projectiles/Rogue/SandDollarStealth.png b/Projectiles/Rogue/SandDollarStealth.png deleted file mode 100644 index 126d908944..0000000000 Binary files a/Projectiles/Rogue/SandDollarStealth.png and /dev/null differ diff --git a/Projectiles/Rogue/SandslasherProj.cs b/Projectiles/Rogue/SandslasherProj.cs index 289d265cd0..4869517c5f 100644 --- a/Projectiles/Rogue/SandslasherProj.cs +++ b/Projectiles/Rogue/SandslasherProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SandslasherProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Sandslasher"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sandslasher"); @@ -20,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 40; projectile.height = 40; projectile.friendly = true; - projectile.penetrate = 3; + projectile.ignoreWater = true; + projectile.penetrate = 3; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 16; projectile.Calamity().rogue = true; @@ -64,7 +67,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SandslasherProj.png b/Projectiles/Rogue/SandslasherProj.png deleted file mode 100644 index bee7527680..0000000000 Binary files a/Projectiles/Rogue/SandslasherProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs index ef6c1943bb..907772b72d 100644 --- a/Projectiles/Rogue/ScarletBlast.cs +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ScarletBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.penetrate = -1; projectile.timeLeft = 30; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 10; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/ScarletBlast.png b/Projectiles/Rogue/ScarletBlast.png deleted file mode 100644 index cbdfcfe589..0000000000 Binary files a/Projectiles/Rogue/ScarletBlast.png and /dev/null differ diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs index c896663b37..dd5420ca52 100644 --- a/Projectiles/Rogue/ScarletDevilBullet.cs +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 140; projectile.tileCollide = false; projectile.ignoreWater = true; - projectile.Calamity().rogue = true; } public override void AI() @@ -51,12 +50,9 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 10f + homeInVector * 30f) / (11f); + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 10f + moveDirection * 30f) / (11f); } else { @@ -70,5 +66,12 @@ namespace CalamityMod.Projectiles.Rogue { return new Color(250, 250, 250); } + + public override bool CanDamage() + { + 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 4c03adf672..12af7ff5c2 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -10,19 +11,25 @@ namespace CalamityMod.Projectiles.Rogue { public class ScarletDevilProjectile : ModProjectile { + internal PrimitiveTrail TrailDrawer; + 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] = 8; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 45; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 116; - projectile.height = 116; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 45; + projectile.width = 92; + projectile.height = 92; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.tileCollide = false; projectile.timeLeft = 300; projectile.extraUpdates = 1; @@ -31,29 +38,72 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - CalamityPlayer modPlayer = Main.player[projectile.owner].Calamity(); Lighting.AddLight(projectile.Center, 0.55f, 0.25f, 0f); - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - 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); - projectile.ai[0] += 1f; - if (projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + + if (!Main.dedServ) { - projectile.Calamity().stealthStrike = true; + 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); } - if ((projectile.ai[0] %= 5f) == 0f) + + ShootTimer++; + + if (!projectile.Calamity().stealthStrike && projectile.oldPos.Length != 6) + projectile.oldPos = new Vector2[6]; + + if ((ShootTimer %= 5f) == 0f && !projectile.Calamity().stealthStrike) { - int numProj = 2; - float rotation = MathHelper.ToRadians(15); if (projectile.owner == Main.myPlayer) + GenerateSideBullets(2, MathHelper.ToRadians(15f)); + } + } + + internal void GenerateSideBullets(int totalBullets, float rotationalOffset) + { + 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))); + for (int j = 0; j < 2; j++) { - for (int i = 0; i < numProj; i++) + Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(projectile.damage * 0.03), 0f, projectile.owner, 0f, 0f); + perturbedSpeed *= 1.05f; + } + } + } + + internal void SpawnOnStealthStrikeBullets() + { + float starSpeed = 25f; + + // Spawn a circle of fast bullets. + 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); + if (Main.projectile.IndexInRange(bullet)) + Main.projectile[bullet].Calamity().stealthStrike = true; + } + + // Spawn a pair of stars, one slow, one fast. + int pointsOnStar = 6; + for (int k = 0; k < 2; k++) + { + for (int i = 0; i < pointsOnStar; i++) + { + float angle = MathHelper.Pi * 1.5f - i * MathHelper.TwoPi / pointsOnStar; + float nextAngle = MathHelper.Pi * 1.5f - (i + 3) % pointsOnStar * MathHelper.TwoPi / pointsOnStar; + if (k == 1) + nextAngle = MathHelper.Pi * 1.5f - (i + 2) * MathHelper.TwoPi / pointsOnStar; + Vector2 start = angle.ToRotationVector2(); + Vector2 end = nextAngle.ToRotationVector2(); + int pointsOnStarSegment = 18; + for (int j = 0; j < pointsOnStarSegment; j++) { - Vector2 perturbedSpeed = new Vector2(-projectile.velocity.X / 3, -projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - for (int j = 0; j < 2; j++) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.03), 0f, projectile.owner, 0f, 0f); - perturbedSpeed *= 1.05f; - } + 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); + if (Main.projectile.IndexInRange(bullet)) + Main.projectile[bullet].Calamity().stealthStrike = true; } } } @@ -71,38 +121,78 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - 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.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); - if (target.type == NPCID.TargetDummy || !projectile.Calamity().stealthStrike || Main.player[projectile.owner].moonLeech) - { + 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) + { + // 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(); } public override void OnHitPvp(Player target, int damage, bool crit) { - 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.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); + 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); + + // And spawn a bloom of bullets. + SpawnOnStealthStrikeBullets(); + } + + internal float WidthFunction(float completionRatio) + { + float widthRatio = Utils.InverseLerp(0f, 0.1f, completionRatio, true); + float baseWidth = MathHelper.Lerp(0f, 110f, widthRatio) * MathHelper.Clamp(1f - (float)Math.Pow(completionRatio, 0.4D), 0.37f, 1f); + return baseWidth; + } + + internal Color ColorFunction(float completionRatio) + { + float colorFade = 1f - Utils.InverseLerp(0.6f, 0.98f, completionRatio, true); + Color baseColor = CalamityUtils.MulticolorLerp((float)Math.Pow(completionRatio, 1D / 2D), Color.White, Color.DarkRed, Color.Wheat, Color.IndianRed) * MathHelper.Lerp(0f, 1.4f, colorFade); + return Color.Lerp(baseColor, Color.DarkRed, (float)Math.Pow(completionRatio, 3D)); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, new Color(100, 100, 100), ProjectileID.Sets.TrailingMode[projectile.type], 1); - return true; + if (!projectile.Calamity().stealthStrike) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], new Color(100, 100, 100)); + return true; + } + else + { + 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); + + Texture2D spearTexture = ModContent.GetTexture(Texture); + + for (int i = 0; i < 7; i++) + { + Color drawColor = Color.Lerp(lightColor, Color.White, 0.8f) * 0.2f; + 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); + } + } + return false; } } } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.png b/Projectiles/Rogue/ScarletDevilProjectile.png deleted file mode 100644 index b5748ead84..0000000000 Binary files a/Projectiles/Rogue/ScarletDevilProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.cs b/Projectiles/Rogue/ScourgeoftheDesertProj.cs index d1b4a88457..8ea261ac7d 100644 --- a/Projectiles/Rogue/ScourgeoftheDesertProj.cs +++ b/Projectiles/Rogue/ScourgeoftheDesertProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ScourgeoftheDesertProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ScourgeoftheDesert"; + private int StealthDamageCap = 0; private int BaseDamage = 0; @@ -76,7 +78,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Rogue/ScourgeoftheDesertProj.png b/Projectiles/Rogue/ScourgeoftheDesertProj.png deleted file mode 100644 index bf471717cd..0000000000 Binary files a/Projectiles/Rogue/ScourgeoftheDesertProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index 33a18cf336..59359ee3ca 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ScourgeoftheSeasProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ScourgeoftheSeas"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Moist Scourge"); @@ -22,7 +24,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 26; projectile.height = 26; projectile.friendly = true; - projectile.aiStyle = 113; + projectile.ignoreWater = true; + projectile.aiStyle = 113; aiType = ProjectileID.BoneJavelin; projectile.penetrate = 1; projectile.extraUpdates = 1; @@ -82,7 +85,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.png b/Projectiles/Rogue/ScourgeoftheSeasProjectile.png deleted file mode 100644 index 5a47cfa531..0000000000 Binary files a/Projectiles/Rogue/ScourgeoftheSeasProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/SeafoamBubble.cs b/Projectiles/Rogue/SeafoamBubble.cs index 27d2607c8e..6876119d55 100644 --- a/Projectiles/Rogue/SeafoamBubble.cs +++ b/Projectiles/Rogue/SeafoamBubble.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SeafoamBubble : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Typeless/CoralBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Seafoam Bubble"); diff --git a/Projectiles/Rogue/SeafoamBubble.png b/Projectiles/Rogue/SeafoamBubble.png deleted file mode 100644 index e3e51784ba..0000000000 Binary files a/Projectiles/Rogue/SeafoamBubble.png and /dev/null differ diff --git a/Projectiles/Rogue/SealedSingularityBlackhole.cs b/Projectiles/Rogue/SealedSingularityBlackhole.cs index 6f23733ccd..be879c0e2c 100644 --- a/Projectiles/Rogue/SealedSingularityBlackhole.cs +++ b/Projectiles/Rogue/SealedSingularityBlackhole.cs @@ -1,6 +1,7 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,16 +18,22 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 88; - projectile.height = 90; + projectile.width = 40; + projectile.height = 40; projectile.friendly = true; projectile.penetrate = -1; projectile.Calamity().rogue = true; projectile.tileCollide = false; projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 5; + projectile.idStaticNPCHitCooldown = 10; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + public override void AI() { // Update animation diff --git a/Projectiles/Rogue/SealedSingularityGore.cs b/Projectiles/Rogue/SealedSingularityGore.cs index 5b1f906bc4..d8c74334a6 100644 --- a/Projectiles/Rogue/SealedSingularityGore.cs +++ b/Projectiles/Rogue/SealedSingularityGore.cs @@ -2,6 +2,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; +using Terraria.ID; + namespace CalamityMod.Projectiles.Rogue { public class SealedSingularityGore : ModProjectile @@ -32,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) diff --git a/Projectiles/Rogue/SealedSingularityProj.cs b/Projectiles/Rogue/SealedSingularityProj.cs index 5d5e9b04ea..62b3b1bb44 100644 --- a/Projectiles/Rogue/SealedSingularityProj.cs +++ b/Projectiles/Rogue/SealedSingularityProj.cs @@ -30,8 +30,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] >= 70f) { - projectile.velocity.X *= 0.96f; - projectile.velocity.Y *= 0.96f; + projectile.velocity *= 0.96f; } else { @@ -48,8 +47,11 @@ namespace CalamityMod.Projectiles.Rogue Main.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); - Main.projectile[blackhole].Center = projectile.Center; - Main.projectile[blackhole].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + if (blackhole.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[blackhole].Center = projectile.Center; + Main.projectile[blackhole].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + } for (int index = 0; index < 3; ++index) { diff --git a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs b/Projectiles/Rogue/SeashellBoomerangProjectile.cs similarity index 51% rename from Projectiles/Hybrid/SeashellBoomerangProjectile.cs rename to Projectiles/Rogue/SeashellBoomerangProjectile.cs index 2586510f85..b8637e0898 100644 --- a/Projectiles/Hybrid/SeashellBoomerangProjectile.cs +++ b/Projectiles/Rogue/SeashellBoomerangProjectile.cs @@ -1,12 +1,17 @@ +using CalamityMod.Projectiles.Typeless; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Hybrid + +namespace CalamityMod.Projectiles.Rogue { public class SeashellBoomerangProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SeashellBoomerang"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Boomerang"); + DisplayName.SetDefault("Seashell Boomerang"); } public override void SetDefaults() @@ -18,7 +23,13 @@ namespace CalamityMod.Projectiles.Hybrid projectile.aiStyle = 3; projectile.timeLeft = 240; aiType = ProjectileID.WoodenBoomerang; - projectile.melee = true; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (projectile.Calamity().stealthStrike) + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 10f, 20f, 5, ModContent.ProjectileType()); } } } diff --git a/Projectiles/Rogue/ShadowBlackhole.cs b/Projectiles/Rogue/ShadowBlackhole.cs index 37a6d41934..96f618b100 100644 --- a/Projectiles/Rogue/ShadowBlackhole.cs +++ b/Projectiles/Rogue/ShadowBlackhole.cs @@ -1,3 +1,5 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 88; - projectile.height = 90; + projectile.width = 40; + projectile.height = 40; projectile.friendly = true; projectile.penetrate = -1; projectile.Calamity().rogue = true; @@ -24,6 +26,12 @@ namespace CalamityMod.Projectiles.Rogue projectile.idStaticNPCHitCooldown = 20; } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + public override void AI() { // Update animation diff --git a/Projectiles/Rogue/ShatteredExplosion.cs b/Projectiles/Rogue/ShatteredExplosion.cs index bfcf956607..6a13ef485e 100644 --- a/Projectiles/Rogue/ShatteredExplosion.cs +++ b/Projectiles/Rogue/ShatteredExplosion.cs @@ -6,11 +6,13 @@ namespace CalamityMod.Projectiles.Rogue { public class ShatteredExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + bool dust = true; public override void SetStaticDefaults() { - DisplayName.SetDefault("Explosion"); + DisplayName.SetDefault("Shattered Sun Blast"); } public override void SetDefaults() diff --git a/Projectiles/Rogue/ShatteredExplosion.png b/Projectiles/Rogue/ShatteredExplosion.png deleted file mode 100644 index 3ccaea528f..0000000000 Binary files a/Projectiles/Rogue/ShatteredExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/ShatteredSunKnife.cs b/Projectiles/Rogue/ShatteredSunKnife.cs index c61db514c9..692ef944a6 100644 --- a/Projectiles/Rogue/ShatteredSunKnife.cs +++ b/Projectiles/Rogue/ShatteredSunKnife.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShatteredSunKnife : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShatteredSun"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shattered Sun"); @@ -21,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 56; projectile.height = 56; projectile.friendly = true; - projectile.penetrate = 4; + projectile.ignoreWater = true; + projectile.penetrate = 4; projectile.timeLeft = 300; projectile.alpha = 255; projectile.tileCollide = false; @@ -32,11 +34,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); projectile.ai[1] += 1f; if (projectile.ai[1] < 5f) { @@ -51,14 +49,16 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[1] == 20f) { int numProj = 5; - float rotation = MathHelper.ToRadians(10); if (projectile.owner == Main.myPlayer) { int spread = 6; + int projID = ModContent.ProjectileType(); + 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.X, projectile.Center.Y, perturbedspeed.X * 0.2f, perturbedspeed.Y * 0.2f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.75), 1f, projectile.owner, 0f, 0f); + 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); } @@ -70,7 +70,6 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { - //Main.dust[num622].scale = 0.5f; Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } @@ -88,26 +87,26 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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) + private void ShatteredExplosion() { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int) ((double) damage * 0.15), projectile.knockBack, projectile.owner, 0f, 0f); + int projID = ModContent.ProjectileType(); + 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); } - public override void OnHitPvp(Player target, int damage, bool crit) - { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)damage * 0.15), projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item14, projectile.position); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ShatteredExplosion(); + + public override void OnHitPvp(Player target, int damage, bool crit) => ShatteredExplosion(); public override bool OnTileCollide(Vector2 oldVelocity) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.15), projectile.knockBack, projectile.owner, 0f, 0f); - Main.PlaySound(SoundID.Item14, projectile.position); + ShatteredExplosion(); return true; } diff --git a/Projectiles/Rogue/ShatteredSunKnife.png b/Projectiles/Rogue/ShatteredSunKnife.png deleted file mode 100644 index 982e2829cd..0000000000 Binary files a/Projectiles/Rogue/ShatteredSunKnife.png and /dev/null differ diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index 2120ecd134..42372cc373 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Rogue public class ShatteredSunScorchedBlade : ModProjectile { int counter = 0; - float multiplier = 1f; bool stealthOrigin = false; public override void SetStaticDefaults() @@ -53,9 +52,8 @@ namespace CalamityMod.Projectiles.Rogue } if (counter % 10 == 0) { - multiplier -= 0.005f; - if (multiplier >= 0.5f && !stealthOrigin && projectile.alpha < 200) - projectile.alpha += Main.rand.Next(5, 7); + if (!stealthOrigin && projectile.alpha < 200) + projectile.alpha += 6; } if (counter % 9 == 0 || (counter % 5 == 0 && projectile.Calamity().stealthStrike)) { @@ -77,8 +75,8 @@ namespace CalamityMod.Projectiles.Rogue } Lighting.AddLight(projectile.Center, 0.7f, 0.3f, 0f); - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); - float num633 = 700f; + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); + float num633; Vector2 vector46 = projectile.position; bool flag25 = false; for (int num645 = 0; num645 < 200; num645++) @@ -117,19 +115,15 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 (multiplier < 0.5f) - multiplier = 0.5f; - damage = stealthOrigin ? damage : (int)((float)damage * multiplier); if (projectile.Calamity().stealthStrike) { int numProj = 2; - float rotation = MathHelper.ToRadians(10); if (projectile.owner == Main.myPlayer) { Player owner = Main.player[projectile.owner]; @@ -140,8 +134,9 @@ 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 proj = Projectile.NewProjectile(owner.Center.X, owner.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.6), 1f, projectile.owner, 1f, projectile.alpha); + 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); spread -= Main.rand.Next(2, 6); Main.projectile[proj].ai[0] = 1f; } @@ -153,13 +148,9 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPvp(Player target, int damage, bool crit) { - if (multiplier < 0.5f) - multiplier = 0.5f; - damage = stealthOrigin ? damage : (int)((double)damage * multiplier); if (projectile.Calamity().stealthStrike) { int numProj = 2; - float rotation = MathHelper.ToRadians(10); if (projectile.owner == Main.myPlayer) { Player owner = Main.player[projectile.owner]; @@ -170,8 +161,9 @@ 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 proj = Projectile.NewProjectile(owner.Center.X, owner.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.55), 1f, projectile.owner, 0f, 0f); + 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); spread -= Main.rand.Next(2, 6); Main.projectile[proj].ai[0] = 1f; } diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index dbbbb3c1d5..9e43321131 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShinobiBladeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShinobiBlade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shinobi Blade"); @@ -18,8 +20,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 10; - projectile.height = 10; + projectile.width = projectile.height = 16; projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 300; @@ -29,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue 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.ToRadians(45) * projectile.direction; + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.PiOver2 * projectile.spriteDirection; if (Main.rand.NextBool(5)) { @@ -48,24 +49,20 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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); - } } 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); - } } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.png b/Projectiles/Rogue/ShinobiBladeProjectile.png deleted file mode 100644 index 1cf29b4d30..0000000000 Binary files a/Projectiles/Rogue/ShinobiBladeProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.cs b/Projectiles/Rogue/ShockGrenadeExplosion.cs index ca46d9e5fe..492c860f56 100644 --- a/Projectiles/Rogue/ShockGrenadeExplosion.cs +++ b/Projectiles/Rogue/ShockGrenadeExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShockGrenadeExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private const float radius = 100f; public override void SetStaticDefaults() diff --git a/Projectiles/Rogue/ShockGrenadeExplosion.png b/Projectiles/Rogue/ShockGrenadeExplosion.png deleted file mode 100644 index d86a683fca..0000000000 Binary files a/Projectiles/Rogue/ShockGrenadeExplosion.png and /dev/null differ diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.cs b/Projectiles/Rogue/ShockGrenadeProjectile.cs index 5f5369025f..7037aeebbb 100644 --- a/Projectiles/Rogue/ShockGrenadeProjectile.cs +++ b/Projectiles/Rogue/ShockGrenadeProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShockGrenadeProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ShockGrenade"; + public static int spriteWidth = 14; public static int spriteHeight = 30; @@ -80,7 +82,7 @@ namespace CalamityMod.Projectiles.Rogue public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { Vector2 origin = new Vector2(spriteWidth / 2, spriteHeight / 2); - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ShockGrenadeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("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) diff --git a/Projectiles/Rogue/ShockGrenadeProjectile.png b/Projectiles/Rogue/ShockGrenadeProjectile.png deleted file mode 100644 index 9d72d6d1f6..0000000000 Binary files a/Projectiles/Rogue/ShockGrenadeProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ShockGrenadeProjectileGlow.png b/Projectiles/Rogue/ShockGrenadeProjectileGlow.png deleted file mode 100644 index 1dc546dcbe..0000000000 Binary files a/Projectiles/Rogue/ShockGrenadeProjectileGlow.png and /dev/null differ diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index d853466fba..38081d680a 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShockTeslaAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Typeless/TeslaAura"; + private const float radius = 98f; private const int lifetime = 240; private const int framesX = 3; diff --git a/Projectiles/Rogue/ShockTeslaAura.png b/Projectiles/Rogue/ShockTeslaAura.png deleted file mode 100644 index d8e87ce805..0000000000 Binary files a/Projectiles/Rogue/ShockTeslaAura.png and /dev/null differ diff --git a/Projectiles/Rogue/ShroomerangProj.cs b/Projectiles/Rogue/ShroomerangProj.cs index 0b08145772..de06c11ebb 100644 --- a/Projectiles/Rogue/ShroomerangProj.cs +++ b/Projectiles/Rogue/ShroomerangProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShroomerangProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Shroomerang"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shroomerang"); diff --git a/Projectiles/Rogue/ShroomerangProj.png b/Projectiles/Rogue/ShroomerangProj.png deleted file mode 100644 index b33235e4d0..0000000000 Binary files a/Projectiles/Rogue/ShroomerangProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ShroomerangSpore.cs b/Projectiles/Rogue/ShroomerangSpore.cs index 66cf5ec7b6..7c6068b771 100644 --- a/Projectiles/Rogue/ShroomerangSpore.cs +++ b/Projectiles/Rogue/ShroomerangSpore.cs @@ -7,7 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ShroomerangSpore : ModProjectile { - private int scaleFactor = 0; + public override string Texture => "CalamityMod/Projectiles/Ranged/FungiOrb"; + private bool initialized = false; public override void SetStaticDefaults() { @@ -36,165 +37,12 @@ namespace CalamityMod.Projectiles.Rogue } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.35f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - scaleFactor++; - if (scaleFactor >= 90) - { - scaleFactor *= -1; - } - if (scaleFactor >= 0) - { - projectile.scale += 0.003f; - } - else - { - projectile.scale -= 0.003f; - } - projectile.rotation += 0.0025f * projectile.scale; - float num945 = 1f; - float num946 = 1f; - if (projectile.identity % 6 == 0) - { - num946 *= -1f; - } - if (projectile.identity % 6 == 1) - { - num945 *= -1f; - } - if (projectile.identity % 6 == 2) - { - num946 *= -1f; - num945 *= -1f; - } - if (projectile.identity % 6 == 3) - { - num946 = 0f; - } - if (projectile.identity % 6 == 4) - { - num945 = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - 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.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; - if (num947 > 4f) - { - num947 *= 1.1f; - } - if (num947 > 5f) - { - num947 *= 1.2f; - } - if (num947 > 6f) - { - num947 *= 1.3f; - } - if (num947 > 7f) - { - num947 *= 1.4f; - } - if (num947 > 8f) - { - num947 *= 1.5f; - } - if (num947 > 9f) - { - num947 *= 1.6f; - } - if (num947 > 10f) - { - num947 *= 1.7f; - } - projectile.ai[0] += num947; - if (projectile.alpha > 50) - { - projectile.alpha -= 10; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - } - } - if (projectile.Calamity().lineColor != 1 || projectile.timeLeft < (3300 + projectile.localAI[0])) - { - bool flag49 = false; - Vector2 center12 = new Vector2(0f, 0f); - float num948 = 600f; - for (int num949 = 0; num949 < Main.maxNPCs; num949++) - { - 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); - if (num952 < num948) - { - num948 = num952; - center12 = Main.npc[num949].Center; - flag49 = true; - } - } - } - if (flag49) - { - if (projectile.Calamity().lineColor == 1) - projectile.extraUpdates = 5; - - Vector2 vector101 = center12 - projectile.Center; - vector101.Normalize(); - vector101 *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; - return; - } - else - { - projectile.extraUpdates = 0; - } - } - if ((double)projectile.velocity.Length() > 0.2) - { - projectile.velocity *= 0.98f; - } + projectile.SporeSacAI(); } 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 56); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { diff --git a/Projectiles/Rogue/ShroomerangSpore.png b/Projectiles/Rogue/ShroomerangSpore.png deleted file mode 100644 index 50c3603ed9..0000000000 Binary files a/Projectiles/Rogue/ShroomerangSpore.png and /dev/null differ diff --git a/Projectiles/Rogue/SkyStabberProj.cs b/Projectiles/Rogue/SkyStabberProj.cs index 64cb49d15f..eb911614ac 100644 --- a/Projectiles/Rogue/SkyStabberProj.cs +++ b/Projectiles/Rogue/SkyStabberProj.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SkyStabberProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SkyStabber"; + private static int Lifetime = 1200; public override void SetStaticDefaults() @@ -84,7 +86,9 @@ namespace CalamityMod.Projectiles.Rogue { for (int n = 0; n < 4; n++) { - CalamityUtils.ProjectileRain(targetPos, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), (int)(projectile.damage * 0.25), projectile.knockBack * 0.25f, projectile.owner, 5); + 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/SkyStabberProj.png b/Projectiles/Rogue/SkyStabberProj.png deleted file mode 100644 index cd4be4f0a2..0000000000 Binary files a/Projectiles/Rogue/SkyStabberProj.png and /dev/null differ diff --git a/Projectiles/Rogue/SkyfinNuke.cs b/Projectiles/Rogue/SkyfinNuke.cs index b0a90ee668..f8ce36f5f3 100644 --- a/Projectiles/Rogue/SkyfinNuke.cs +++ b/Projectiles/Rogue/SkyfinNuke.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SkyfinNuke : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SkyfinBombers"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Skyfin Nuke"); @@ -21,7 +23,6 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 720; - projectile.tileCollide = true; projectile.alpha = 0; projectile.Calamity().rogue = true; projectile.extraUpdates = 1; @@ -32,12 +33,15 @@ namespace CalamityMod.Projectiles.Rogue 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; + const float homingRange = 300f; if (!projectile.Calamity().stealthStrike) //normal attack { projectile.ai[0]++; if (projectile.ai[0] > 30f) //0.5 seconds { - NPC target = projectile.Center.ClosestNPCAt(800f); + NPC target = projectile.Center.ClosestNPCAt(homingRange); // Ignore targets above the nuke if (target != null) { @@ -48,8 +52,6 @@ namespace CalamityMod.Projectiles.Rogue } if (target != null) { - const float turnSpeed = 10f; - const float speedMult = 40f; Vector2 distNorm = (target.Center - projectile.Center).SafeNormalize(Vector2.UnitX); projectile.velocity = (projectile.velocity * (turnSpeed - 1f) + distNorm * speedMult) / turnSpeed; } @@ -58,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue else { //More range - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 800f, 40f, 10f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, homingRange, speedMult, turnSpeed); } } @@ -75,21 +77,19 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = 10; projectile.Damage(); - int num220 = Main.rand.Next(2, 5); + int cloudAmt = Main.rand.Next(2, 5); if (projectile.owner == Main.myPlayer) { - for (int num221 = 0; num221 < num220; num221++) + for (int c = 0; c < cloudAmt; c++) { - Vector2 value17 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); - value17.Normalize(); - value17 *= (float)Main.rand.Next(10, 51) * 0.01f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value17.X, value17.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.4), projectile.knockBack * 0.4f, projectile.owner, 0f, 0f); + 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); } if (projectile.Calamity().stealthStrike) { - int explode = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, 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 = 20; + Main.projectile[explode].localNPCHitCooldown = 30; } } diff --git a/Projectiles/Rogue/SkyfinNuke.png b/Projectiles/Rogue/SkyfinNuke.png deleted file mode 100644 index c0f0586af0..0000000000 Binary files a/Projectiles/Rogue/SkyfinNuke.png and /dev/null differ diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 4f07af1c06..f5ad45c0aa 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SlickCaneProjectile : BaseSpearProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SlickCane"; + private bool initialized = false; public override void SetStaticDefaults() { diff --git a/Projectiles/Rogue/SlickCaneProjectile.png b/Projectiles/Rogue/SlickCaneProjectile.png deleted file mode 100644 index 2f514b8ddc..0000000000 Binary files a/Projectiles/Rogue/SlickCaneProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/SludgeSplotchProj1.cs b/Projectiles/Rogue/SludgeSplotchProj1.cs index ed1b70f1d2..04357ae2a8 100644 --- a/Projectiles/Rogue/SludgeSplotchProj1.cs +++ b/Projectiles/Rogue/SludgeSplotchProj1.cs @@ -90,13 +90,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Slow, 240); + target.AddBuff(BuffID.Slow, 120); Main.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, 240); + target.AddBuff(BuffID.Slow, 120); Main.PlaySound(SoundID.NPCKilled, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); } diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs index 69e0e6b79d..592d16d382 100644 --- a/Projectiles/Rogue/SludgeSplotchProj2.cs +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -59,12 +59,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Slow, 120); + target.AddBuff(BuffID.Slow, 60); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Slow, 120); + target.AddBuff(BuffID.Slow, 60); } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/SpearofDestinyGlow.png b/Projectiles/Rogue/SpearofDestinyGlow.png index ce935139cd..b6523b8969 100644 Binary files a/Projectiles/Rogue/SpearofDestinyGlow.png and b/Projectiles/Rogue/SpearofDestinyGlow.png differ diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index 685c5a4dc3..3bc92202ed 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SpearofDestinyProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SpearofDestiny"; + private bool initialized = false; public override void SetStaticDefaults() @@ -23,7 +25,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.penetrate = 2; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; @@ -47,11 +50,7 @@ namespace CalamityMod.Projectiles.Rogue { 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) + 2.355f; - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; Vector2 center = projectile.Center; float maxDistance = 300f; @@ -76,17 +75,14 @@ namespace CalamityMod.Projectiles.Rogue if (homeIn) { projectile.extraUpdates = 2; - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.png b/Projectiles/Rogue/SpearofDestinyProjectile.png deleted file mode 100644 index 52f7eefcf4..0000000000 Binary files a/Projectiles/Rogue/SpearofDestinyProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/SpearofPaleolithProj.cs b/Projectiles/Rogue/SpearofPaleolithProj.cs index c7a80c8a2f..8fa14e0290 100644 --- a/Projectiles/Rogue/SpearofPaleolithProj.cs +++ b/Projectiles/Rogue/SpearofPaleolithProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SpearofPaleolithProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/SpearofPaleolith"; + private bool stealthInit = false; public override void SetStaticDefaults() @@ -24,7 +26,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; @@ -44,23 +47,19 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 159, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } - 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 = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (projectile.timeLeft % 3 == 0) { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0f, projectile.velocity.Y * 0f, 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) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/SpearofPaleolithProj.png b/Projectiles/Rogue/SpearofPaleolithProj.png deleted file mode 100644 index 2850b0d4d7..0000000000 Binary files a/Projectiles/Rogue/SpearofPaleolithProj.png and /dev/null differ diff --git a/Projectiles/Rogue/SpentFuelContainerProjectile.cs b/Projectiles/Rogue/SpentFuelContainerProjectile.cs index fa7b73db3e..fc16d6867d 100644 --- a/Projectiles/Rogue/SpentFuelContainerProjectile.cs +++ b/Projectiles/Rogue/SpentFuelContainerProjectile.cs @@ -53,7 +53,8 @@ namespace CalamityMod.Projectiles.Rogue 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); - Main.projectile[proj].Calamity().stealthStrike = projectile.Calamity().stealthStrike; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = projectile.Calamity().stealthStrike; } } } diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index 4845cc80a0..fb62eab57a 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -21,7 +21,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 20; projectile.friendly = true; projectile.tileCollide = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.extraUpdates = 1; projectile.Calamity().rogue = true; projectile.usesIDStaticNPCImmunity = true; @@ -119,7 +120,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 071e99e826..d7d2d5ef8d 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 300; projectile.tileCollide = false; projectile.Calamity().rogue = true; @@ -41,7 +42,7 @@ namespace CalamityMod.Projectiles.Rogue 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, false, 800f, 16f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } public override void Kill(int timeLeft) @@ -86,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f49ed67b44..4bab34e09a 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SphereSpiked : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DefectiveSphere"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spiked Sphere"); @@ -20,7 +22,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 20; projectile.friendly = true; projectile.penetrate = -1; - projectile.aiStyle = 3; + projectile.ignoreWater = true; + projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; projectile.Calamity().rogue = true; @@ -33,20 +36,16 @@ namespace CalamityMod.Projectiles.Rogue { 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) - { - projectile.extraUpdates = 1; - } - } + if (projectile.ai[0] == 1f) + { + projectile.extraUpdates = 1; + } + } - public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - damage = (int)(damage * 1.2); - if (Main.rand.NextBool(10)) - { - if (!crit) - crit = true; - } + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + damage = (int)(damage * 1.2); + crit |= Main.rand.NextBool(10); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -56,7 +55,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SphereSpiked.png b/Projectiles/Rogue/SphereSpiked.png deleted file mode 100644 index c4c2b56c25..0000000000 Binary files a/Projectiles/Rogue/SphereSpiked.png and /dev/null differ diff --git a/Projectiles/Rogue/SphereYellow.cs b/Projectiles/Rogue/SphereYellow.cs index b6995efcd1..e3d5a194d2 100644 --- a/Projectiles/Rogue/SphereYellow.cs +++ b/Projectiles/Rogue/SphereYellow.cs @@ -19,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 300; aiType = ProjectileID.WoodenBoomerang; @@ -59,7 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f7c5aa01af..9cc72ef8cd 100644 --- a/Projectiles/Rogue/StealthNimbus.cs +++ b/Projectiles/Rogue/StealthNimbus.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class StealthNimbus : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); diff --git a/Projectiles/Rogue/StealthNimbus.png b/Projectiles/Rogue/StealthNimbus.png deleted file mode 100644 index 234d306f54..0000000000 Binary files a/Projectiles/Rogue/StealthNimbus.png and /dev/null differ diff --git a/Projectiles/Rogue/StealthNimbus2.png b/Projectiles/Rogue/StealthNimbus2.png index 6f7be4f25a..fe49b64f61 100644 Binary files a/Projectiles/Rogue/StealthNimbus2.png and b/Projectiles/Rogue/StealthNimbus2.png differ diff --git a/Projectiles/Rogue/StealthNimbusCloud.cs b/Projectiles/Rogue/StealthNimbusCloud.cs index 9b939bc076..f0db307733 100644 --- a/Projectiles/Rogue/StealthNimbusCloud.cs +++ b/Projectiles/Rogue/StealthNimbusCloud.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class StealthNimbusCloud : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/ShadeNimbusCloud"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nimbus"); diff --git a/Projectiles/Rogue/StealthNimbusCloud.png b/Projectiles/Rogue/StealthNimbusCloud.png deleted file mode 100644 index c7e15d492c..0000000000 Binary files a/Projectiles/Rogue/StealthNimbusCloud.png and /dev/null differ diff --git a/Projectiles/Rogue/StealthNimbusCloud2.png b/Projectiles/Rogue/StealthNimbusCloud2.png index be7e4a9284..5ac9056f6d 100644 Binary files a/Projectiles/Rogue/StealthNimbusCloud2.png and b/Projectiles/Rogue/StealthNimbusCloud2.png differ diff --git a/Projectiles/Rogue/StealthRain.cs b/Projectiles/Rogue/StealthRain.cs index b0cf8e7d57..456630b624 100644 --- a/Projectiles/Rogue/StealthRain.cs +++ b/Projectiles/Rogue/StealthRain.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class StealthRain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/ShaderainHostile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Rain"); diff --git a/Projectiles/Rogue/StealthRain.png b/Projectiles/Rogue/StealthRain.png deleted file mode 100644 index 56fa0aa8a6..0000000000 Binary files a/Projectiles/Rogue/StealthRain.png and /dev/null differ diff --git a/Projectiles/Rogue/StellarKnifeProj.cs b/Projectiles/Rogue/StellarKnifeProj.cs index 6bc326dd0d..94459d1cfe 100644 --- a/Projectiles/Rogue/StellarKnifeProj.cs +++ b/Projectiles/Rogue/StellarKnifeProj.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Projectiles.Rogue { public class StellarKnifeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/StellarKnife"; public override void SetStaticDefaults() { @@ -24,12 +26,23 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 32; projectile.height = 34; projectile.friendly = true; - projectile.penetrate = 1; + 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]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[1] = reader.ReadSingle(); + } + public override void AI() { //synthesized timeLeft @@ -46,27 +59,18 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[1] += 0.75f; if (projectile.ai[1] <= 60f) { - projectile.rotation += 1f; + 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 -= 1.57f; - } - projectile.localAI[0]++; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); Vector2 center = projectile.Center; float maxDistance = 600f; bool homeIn = false; - if (projectile.localAI[0] >= 20f && !homeIn) //shorten knife lifespan if it hasn't found a target - if (projectile.timeLeft >= 60) - projectile.timeLeft = 60; - 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)) @@ -86,14 +90,14 @@ namespace CalamityMod.Projectiles.Rogue { projectile.timeLeft = 600; //when homing in, the projectile cannot run out of timeLeft, but synthesized timeLeft still runs - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 10f + homeInVector * 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; } @@ -107,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/StellarKnifeProj.png b/Projectiles/Rogue/StellarKnifeProj.png deleted file mode 100644 index 0adabcb0fc..0000000000 Binary files a/Projectiles/Rogue/StellarKnifeProj.png and /dev/null differ diff --git a/Projectiles/Rogue/StickyBol.cs b/Projectiles/Rogue/StickyBol.cs index 13627e9af6..5a31871b96 100644 --- a/Projectiles/Rogue/StickyBol.cs +++ b/Projectiles/Rogue/StickyBol.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class StickyBol : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/StickySpikyBall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sticky Bol"); diff --git a/Projectiles/Rogue/StickyBol.png b/Projectiles/Rogue/StickyBol.png deleted file mode 100644 index 6d92f61274..0000000000 Binary files a/Projectiles/Rogue/StickyBol.png and /dev/null differ diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.cs b/Projectiles/Rogue/StormfrontRazorProjectile.cs index 265d0021e4..3e6bdb3e98 100644 --- a/Projectiles/Rogue/StormfrontRazorProjectile.cs +++ b/Projectiles/Rogue/StormfrontRazorProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class StormfrontRazorProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/StormfrontRazor"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Stormfront Knife"); @@ -21,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 5; + projectile.ignoreWater = true; + projectile.penetrate = 5; projectile.timeLeft = 300; projectile.extraUpdates = 1; projectile.Calamity().rogue = true; @@ -74,7 +77,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/StormfrontRazorProjectile.png b/Projectiles/Rogue/StormfrontRazorProjectile.png deleted file mode 100644 index bce22e87ec..0000000000 Binary files a/Projectiles/Rogue/StormfrontRazorProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/Stormfrontspark.cs b/Projectiles/Rogue/Stormfrontspark.cs index f108f67a61..b78b5d5a14 100644 --- a/Projectiles/Rogue/Stormfrontspark.cs +++ b/Projectiles/Rogue/Stormfrontspark.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Rogue { public class Stormfrontspark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spark"); @@ -13,7 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { projectile.friendly = true; - projectile.width = 6; + projectile.ignoreWater = true; + projectile.width = 6; projectile.height = 12; projectile.timeLeft = 240; projectile.penetrate = -1; @@ -52,13 +55,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Rogue/Stormfrontspark.png b/Projectiles/Rogue/Stormfrontspark.png deleted file mode 100644 index ee4239cbf9..0000000000 Binary files a/Projectiles/Rogue/Stormfrontspark.png and /dev/null differ diff --git a/Projectiles/Rogue/SubductionFlameburst.cs b/Projectiles/Rogue/SubductionFlameburst.cs new file mode 100644 index 0000000000..d3764f141b --- /dev/null +++ b/Projectiles/Rogue/SubductionFlameburst.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Rogue +{ + public class SubductionFlameburst : ModProjectile + { + public int frameX = 0; + public int frameY = 0; + public int currentFrame => frameY + frameX * 4; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Flame Pillar"); + } + + 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; + } + + public override void AI() + { + //2-6 + projectile.frameCounter += 1; + if (projectile.frameCounter % 7 == 6) + { + frameY += 1; + if (frameY >= 4) + { + frameX += 1; + frameY = 0; + } + if (frameX >= 3) + { + projectile.Kill(); + } + } + if (projectile.localAI[0] == 0f) + { + 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); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Daybreak, 300); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.OnFire, 300); + } + } +} diff --git a/Projectiles/Rogue/SubductionFlameburst.png b/Projectiles/Rogue/SubductionFlameburst.png new file mode 100644 index 0000000000..0d3852064a Binary files /dev/null and b/Projectiles/Rogue/SubductionFlameburst.png differ diff --git a/Projectiles/Rogue/SupernovaBomb.cs b/Projectiles/Rogue/SupernovaBomb.cs index 6d0552505d..d303ea6680 100644 --- a/Projectiles/Rogue/SupernovaBomb.cs +++ b/Projectiles/Rogue/SupernovaBomb.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SupernovaBomb : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Supernova Bomb"); @@ -145,7 +147,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/SupernovaBomb.png b/Projectiles/Rogue/SupernovaBomb.png deleted file mode 100644 index d4aa9c8ad8..0000000000 Binary files a/Projectiles/Rogue/SupernovaBomb.png and /dev/null differ diff --git a/Projectiles/Rogue/SupernovaBoom.cs b/Projectiles/Rogue/SupernovaBoom.cs index 1045d2940b..0472537ec2 100644 --- a/Projectiles/Rogue/SupernovaBoom.cs +++ b/Projectiles/Rogue/SupernovaBoom.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Rogue { projectile.width = 408; projectile.height = 410; + projectile.scale = 2f; projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; diff --git a/Projectiles/Rogue/SupernovaHoming.cs b/Projectiles/Rogue/SupernovaHoming.cs index b1631a0873..eee05e5b13 100644 --- a/Projectiles/Rogue/SupernovaHoming.cs +++ b/Projectiles/Rogue/SupernovaHoming.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SupernovaHoming : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Supernova Energy"); @@ -40,8 +42,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[0] < 90) { - projectile.velocity.X *= 0.98f; - projectile.velocity.Y *= 0.98f; + projectile.velocity *= 0.98f; } else { @@ -67,12 +68,9 @@ namespace CalamityMod.Projectiles.Rogue } if (homeIn) - { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 12f) / (21f); + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); } else projectile.Kill(); diff --git a/Projectiles/Rogue/SupernovaHoming.png b/Projectiles/Rogue/SupernovaHoming.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Rogue/SupernovaHoming.png and /dev/null differ diff --git a/Projectiles/Rogue/SupernovaSpike.cs b/Projectiles/Rogue/SupernovaSpike.cs index e6d3859eb4..7fa6d3ede1 100644 --- a/Projectiles/Rogue/SupernovaSpike.cs +++ b/Projectiles/Rogue/SupernovaSpike.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class SupernovaSpike : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/BallisticPoisonBombSpike"; + private Color currentColor = Color.Black; public override void SetStaticDefaults() diff --git a/Projectiles/Rogue/SupernovaSpike.png b/Projectiles/Rogue/SupernovaSpike.png deleted file mode 100644 index 156ae21160..0000000000 Binary files a/Projectiles/Rogue/SupernovaSpike.png and /dev/null differ diff --git a/Projectiles/Rogue/SylvanSlash.cs b/Projectiles/Rogue/SylvanSlash.cs index 8c5abd3973..141448cb15 100644 --- a/Projectiles/Rogue/SylvanSlash.cs +++ b/Projectiles/Rogue/SylvanSlash.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.timeLeft > 195) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Rogue/SylvanSlashAttack.cs b/Projectiles/Rogue/SylvanSlashAttack.cs index 72c1212f54..12186cdbdf 100644 --- a/Projectiles/Rogue/SylvanSlashAttack.cs +++ b/Projectiles/Rogue/SylvanSlashAttack.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 68; projectile.height = 68; projectile.friendly = true; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.tileCollide = false; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; @@ -91,7 +92,8 @@ namespace CalamityMod.Projectiles.Rogue player.itemAnimation = 2; player.itemRotation = (float)Math.Atan2((double)(projectile.velocity.Y * (float)projectile.direction), (double)(projectile.velocity.X * (float)projectile.direction)); - projectile.ai[0]++; + if (projectile.ai[0] > 0) + projectile.ai[0]--; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -100,14 +102,19 @@ namespace CalamityMod.Projectiles.Rogue CalamityPlayer modPlayer = player.Calamity(); if (projectile.owner == Main.myPlayer) { - if (projectile.ai[0] % 5 == 0) + if (projectile.ai[0] <= 0f) { if ((target.damage > 5 || target.boss) && !target.SpawnedFromStatue) { if (modPlayer.wearingRogueArmor && modPlayer.rogueStealthMax != 0) { if (modPlayer.rogueStealth < modPlayer.rogueStealthMax) - modPlayer.rogueStealth += 0.01f; + { + modPlayer.rogueStealth += 0.05f; + projectile.ai[0] = 3f; + if (modPlayer.rogueStealth > modPlayer.rogueStealthMax) + modPlayer.rogueStealth = modPlayer.rogueStealthMax; + } } } } @@ -127,12 +134,16 @@ namespace CalamityMod.Projectiles.Rogue CalamityPlayer modPlayer = player.Calamity(); if (projectile.owner == Main.myPlayer) { - if (projectile.ai[0] >= 5) + if (projectile.ai[0] <= 0f) { if (modPlayer.wearingRogueArmor && modPlayer.rogueStealthMax != 0) { if (modPlayer.rogueStealth < modPlayer.rogueStealthMax) - modPlayer.rogueStealth += 0.01f; + { + modPlayer.rogueStealth += 0.05f; + if (modPlayer.rogueStealth > modPlayer.rogueStealthMax) + modPlayer.rogueStealth = modPlayer.rogueStealthMax; + } } } if (Main.rand.NextBool(8)) diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index 33802c7687..1de7c63a9b 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -20,7 +20,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 20; projectile.height = 20; projectile.friendly = true; - projectile.penetrate = 10; + projectile.ignoreWater = true; + projectile.penetrate = 10; projectile.tileCollide = false; projectile.timeLeft = 180; projectile.Calamity().rogue = true; @@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 e08e5ce3ad..9287484d4f 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = false; - projectile.timeLeft = 600; + projectile.ignoreWater = true; + projectile.timeLeft = 600; projectile.Calamity().rogue = true; SineFrequency = 0.15f; diff --git a/Projectiles/Rogue/TarraThornRight.cs b/Projectiles/Rogue/TarraThornRight.cs index ebbd9cc68a..80883ed70a 100644 --- a/Projectiles/Rogue/TarraThornRight.cs +++ b/Projectiles/Rogue/TarraThornRight.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TarraThornRight : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/NettleRight"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Thorn"); @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ignoreWater = true; projectile.Calamity().rogue = true; projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 3; + projectile.idStaticNPCHitCooldown = 10; projectile.aiStyle = 4; } diff --git a/Projectiles/Rogue/TarraThornRight.png b/Projectiles/Rogue/TarraThornRight.png deleted file mode 100644 index 9a7fef67e4..0000000000 Binary files a/Projectiles/Rogue/TarraThornRight.png and /dev/null differ diff --git a/Projectiles/Rogue/TarraThornTip.cs b/Projectiles/Rogue/TarraThornTip.cs index 22d3cdb81c..60d4e4bfc8 100644 --- a/Projectiles/Rogue/TarraThornTip.cs +++ b/Projectiles/Rogue/TarraThornTip.cs @@ -4,6 +4,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TarraThornTip : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/NettleTip"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Thorn"); diff --git a/Projectiles/Rogue/TarraThornTip.png b/Projectiles/Rogue/TarraThornTip.png deleted file mode 100644 index 529fa9df45..0000000000 Binary files a/Projectiles/Rogue/TarraThornTip.png and /dev/null differ diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 8e849da80a..6407eb637f 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -10,9 +10,11 @@ namespace CalamityMod.Projectiles.Rogue { public class TarragonThrowingDartProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TarragonThrowingDart"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Dart"); + DisplayName.SetDefault("Tarragon Throwing Dart"); } public override void SetDefaults() @@ -20,27 +22,24 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 12; projectile.height = 12; projectile.friendly = true; - projectile.penetrate = 3; + projectile.ignoreWater = true; + projectile.penetrate = 6; projectile.aiStyle = 113; projectile.timeLeft = 600; aiType = ProjectileID.BoneJavelin; projectile.Calamity().rogue = true; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 3; - projectile.localNPCHitCooldown = 10; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.extraUpdates = 1; } public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + 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); } - if (projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -60,22 +59,26 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (Main.myPlayer == projectile.owner) - { - 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 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) * 2f, (float)(Math.Cos(offsetAngle) * 5f) * 2f, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 0f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f) * 2f, (float)(-Math.Cos(offsetAngle) * 5f) * 2f, ModContent.ProjectileType(), projectile.damage / 4, projectile.knockBack / 4, projectile.owner, 0f, 0f); - } - } - } + if (Main.myPlayer == projectile.owner) + { + 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 deltaAngle = spread / 8f; + + int projID = ModContent.ProjectileType(); + 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); + } + } + } } } } diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.png b/Projectiles/Rogue/TarragonThrowingDartProjectile.png deleted file mode 100644 index 91d11f0659..0000000000 Binary files a/Projectiles/Rogue/TarragonThrowingDartProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/TerraDiskProjectile.cs b/Projectiles/Rogue/TerraDiskProjectile.cs new file mode 100644 index 0000000000..40cf6c04ae --- /dev/null +++ b/Projectiles/Rogue/TerraDiskProjectile.cs @@ -0,0 +1,230 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TerraDiskProjectile : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TerraDisk"; + + private bool initialized = false; + private int Lifetime = 180; + private int ReboundTime = 45; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Disk"); + 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; + } + + public override void AI() + { + Initialize(); + BoomerangAI(); + StealthStrikeAI(); + SpawnProjectilesNearEnemies(); + LightingandDust(); + } + + private void Initialize() + { + if (initialized) + return; + + 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; + + // Boomerang sound + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.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.ai[0] == 1f) + { + //Ignore tiles and fly faster + projectile.tileCollide = false; + projectile.extraUpdates = 1; + + Player player = Main.player[projectile.owner]; + float returnSpeed = 16f; + float acceleration = 1.4f; + Vector2 playerVec = player.Center - projectile.Center; + float dist = playerVec.Length(); + + // Delete the projectile if it's excessively far away. + if (dist > 3000f) + projectile.Kill(); + + playerVec.Normalize(); + playerVec *= returnSpeed; + + // Home back in on the player. + if (projectile.velocity.X < playerVec.X) + { + projectile.velocity.X += acceleration; + if (projectile.velocity.X < 0f && playerVec.X > 0f) + projectile.velocity.X += acceleration; + } + 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.Y < playerVec.Y) + { + projectile.velocity.Y += acceleration; + if (projectile.velocity.Y < 0f && playerVec.Y > 0f) + projectile.velocity.Y += acceleration; + } + else if (projectile.velocity.Y > playerVec.Y) + { + 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(); + } + } + + private void StealthStrikeAI() + { + if (!projectile.Calamity().stealthStrike) + return; + + 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)); + Main.projectile[disk].timeLeft *= 2; + Main.projectile[disk].idStaticNPCHitCooldown = 8; + Main.projectile[disk].usesIDStaticNPCImmunity = true; + Main.projectile[disk].aiStyle = -1; + } + } + + private void SpawnProjectilesNearEnemies() + { + if (!projectile.friendly) + return; + + const float maxDistance = 300f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + 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); + + if (Vector2.Distance(npc.Center, projectile.Center) < maxDistance + extraDistance && canHit) + { + homeIn = true; + break; + } + } + } + + if (homeIn) + { + if (Main.player[projectile.owner].miscCounter % 50 == 0) + { + int splitProj = ModContent.ProjectileType(); + if (projectile.owner == Main.myPlayer) + { + float spread = 60f * 0.0174f; + 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); + } + } + } + } + } + + private void LightingandDust() + { + 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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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]++; + } + + // 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); + + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + projectile.ai[0] = 1f; + return false; + } + } +} diff --git a/Projectiles/Rogue/TerraDiskProjectile2.cs b/Projectiles/Rogue/TerraDiskProjectile2.cs new file mode 100644 index 0000000000..a87f3ff0c8 --- /dev/null +++ b/Projectiles/Rogue/TerraDiskProjectile2.cs @@ -0,0 +1,97 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TerraDiskProjectile2 : ModProjectile + { + private double rotation = 0; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra Disk"); + 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; + aiType = ProjectileID.WoodenBoomerang; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + StealthStrikeAI(); + LightingandDust(); + } + + private void StealthStrikeAI() + { + if (projectile.aiStyle == 3) + return; + + 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()) + { + parent = p; + active = true; + break; + } + } + + if (active) + { + 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; + } + else + { + projectile.Kill(); + } + + if (!parent.active) + { + projectile.Kill(); + } + } + + private void LightingandDust() + { + 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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); + return false; + } + } +} diff --git a/Projectiles/Hybrid/TerraDiskProjectile2.png b/Projectiles/Rogue/TerraDiskProjectile2.png similarity index 100% rename from Projectiles/Hybrid/TerraDiskProjectile2.png rename to Projectiles/Rogue/TerraDiskProjectile2.png diff --git a/Projectiles/Rogue/TheAtomSplitterDuplicate.cs b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs new file mode 100644 index 0000000000..aad20f8398 --- /dev/null +++ b/Projectiles/Rogue/TheAtomSplitterDuplicate.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Atom Splitter"); + 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; + } + + public override void AI() + { + // Accelerate until at a certain speed. + if (projectile.velocity.Length() < 20f) + projectile.velocity *= 1.02f; + + projectile.Opacity = CalamityUtils.Convert01To010(Time / Lifetime) * 0.6f; + if (Time >= Lifetime) + projectile.Kill(); + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Time++; + } + + 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, CalamityGlobalItem.ExoPalette); + drawColor.A = 0; + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], drawColor); + return false; + } + } +} diff --git a/Projectiles/Rogue/TheAtomSplitterDuplicate.png b/Projectiles/Rogue/TheAtomSplitterDuplicate.png new file mode 100644 index 0000000000..e6f4b2d8f3 Binary files /dev/null and b/Projectiles/Rogue/TheAtomSplitterDuplicate.png differ diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs new file mode 100644 index 0000000000..530230a8b7 --- /dev/null +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -0,0 +1,183 @@ +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class TheAtomSplitterProjectile : ModProjectile + { + // Atom splitting is cool and all, but actual thermonuclear meltdown levels of DPS is unacceptable. + // DO NOT increase this unless you are ABSOLUTELY SURE you know what will happen. + private const float NormalSplitMultiplier = 0.7f; + private const float StealthSplitMultiplier = 0.12f; + + 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"; + + public override void SetStaticDefaults() => DisplayName.SetDefault("Atom Splitter"); + + 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; + } + + 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); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + 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.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); + + bool stealth = projectile.Calamity().stealthStrike; + int shootRate = stealth ? 2 : 4; + if (projectile.timeLeft % shootRate == shootRate - 1) + { + NPC target = Main.npc[(int)HitTargetIndex]; + FireDuplicateAtTarget(target, stealth ? 305f : 200f, stealth); + if (stealth) + FireExtraDuplicatesAtTarget(target); + } + } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4; + Time++; + } + + public void EmitDustFromTip() + { + if (Main.dedServ) + return; + + 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; + Color dustColor = CalamityUtils.MulticolorLerp(colorInterpolant, CalamityGlobalItem.ExoPalette); + 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.scale = 1.2f; + prismaticEnergy.color = dustColor; + prismaticEnergy.noGravity = true; + + prismaticEnergy = Dust.CloneDust(prismaticEnergy); + prismaticEnergy.scale *= 0.6f; + } + } + + public void FireDuplicateAtTarget(NPC target, float baseOutwardness, bool stealth) + { + 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); + } + + public void FireExtraDuplicatesAtTarget(NPC target) + { + 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); + 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); + } + + public void ReleaseHitDust(Vector2 spawnPosition) + { + if (Main.dedServ) + return; + + int dustCount = projectile.Calamity().stealthStrike ? 60 : 40; + Vector2 baseDustVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * 1.4f; + Vector2 outwardFireSpeedFactor = new Vector2(2.1f, 2f); + + for (float i = 0f; i < dustCount; i++) + { + Color dustColor = CalamityUtils.MulticolorLerp(Main.rand.NextFloat(), CalamityGlobalItem.ExoPalette); + 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 *= 1.6f; + + explosionDust.noGravity = true; + explosionDust.scale = 1.1f; + explosionDust.fadeIn = Main.rand.NextFloat(1.4f, 2.4f); + + Dust.CloneDust(explosionDust).velocity *= Main.rand.NextFloat(0.8f); + + explosionDust = Dust.CloneDust(explosionDust); + explosionDust.scale /= 2f; + explosionDust.fadeIn /= 2f; + explosionDust.color = new Color(255, 255, 255, 255); + } + } + + public override bool CanDamage() => projectile.alpha < 80; + + public override bool? CanHitNPC(NPC target) + { + if (HitTargetIndex >= 0 && target.whoAmI != HitTargetIndex) + return false; + return base.CanHitNPC(target); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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; + } + } + } +} diff --git a/Projectiles/Rogue/TheSyringeCinder.cs b/Projectiles/Rogue/TheSyringeCinder.cs index b7218845ce..40df8407c9 100644 --- a/Projectiles/Rogue/TheSyringeCinder.cs +++ b/Projectiles/Rogue/TheSyringeCinder.cs @@ -114,10 +114,6 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { projectile.ai[1] = 1f; - if (projectile.penetrate == 0) - { - projectile.Kill(); - } return false; } diff --git a/Projectiles/Rogue/TheSyringeProj.cs b/Projectiles/Rogue/TheSyringeProj.cs index 1694cd1276..fdfd01b1d8 100644 --- a/Projectiles/Rogue/TheSyringeProj.cs +++ b/Projectiles/Rogue/TheSyringeProj.cs @@ -9,9 +9,13 @@ namespace CalamityMod.Projectiles.Rogue { public class TheSyringeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TheSyringe"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Syringe"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -32,15 +36,14 @@ namespace CalamityMod.Projectiles.Rogue 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); - } + projectile.damage += projectile.Calamity().defDamage / 200; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -56,10 +59,7 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 100); projectile.maxPenetrate = -1; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; @@ -76,12 +76,12 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); + 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.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; + 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); } } @@ -89,9 +89,9 @@ namespace CalamityMod.Projectiles.Rogue { for (int b = 0; b < 5; b++) { - float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; - float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - int bee = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speedX, speedY, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + 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); Main.projectile[bee].penetrate = 1; } } diff --git a/Projectiles/Rogue/TheSyringeProj.png b/Projectiles/Rogue/TheSyringeProj.png deleted file mode 100644 index 9eb9fc7d3b..0000000000 Binary files a/Projectiles/Rogue/TheSyringeProj.png and /dev/null differ diff --git a/Projectiles/Rogue/TheSyringeS1.cs b/Projectiles/Rogue/TheSyringeS1.cs index 22a3e0d5e5..a3eb0bb390 100644 --- a/Projectiles/Rogue/TheSyringeS1.cs +++ b/Projectiles/Rogue/TheSyringeS1.cs @@ -7,15 +7,15 @@ using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { public class TheSyringeS1 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shrapnel"); - Main.projFrames[projectile.type] = 3; - } + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shrapnel"); + Main.projFrames[projectile.type] = 3; + } - public override void SetDefaults() - { + public override void SetDefaults() + { projectile.width = 6; projectile.height = 6; projectile.aiStyle = 24; @@ -24,37 +24,45 @@ namespace CalamityMod.Projectiles.Rogue projectile.light = 0.5f; projectile.alpha = 50; projectile.scale = 1.2f; - projectile.timeLeft = 600; + projectile.timeLeft = 180; projectile.tileCollide = false; - projectile.Calamity().rogue = true; - } + projectile.Calamity().rogue = true; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - //Changes the texture of the projectile - 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); - return false; - } - 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); - return false; - } - return true; - } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } + public override void PostAI() + { + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 10f, 20f); + } - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Changes the texture of the projectile + 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); + return false; + } + 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); + return false; + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + } } diff --git a/Projectiles/Rogue/TimeBoltKnife.cs b/Projectiles/Rogue/TimeBoltKnife.cs index 89e88d0d0b..0d9804ebc2 100644 --- a/Projectiles/Rogue/TimeBoltKnife.cs +++ b/Projectiles/Rogue/TimeBoltKnife.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TimeBoltKnife : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TimeBolt"; + private int maxPenetrate = 6; private int penetrationAmt = 6; private bool initialized = false; @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = 28; projectile.height = 28; projectile.friendly = true; - projectile.penetrate = penetrationAmt; + projectile.ignoreWater = true; + projectile.penetrate = penetrationAmt; projectile.timeLeft = 600; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; @@ -128,7 +131,7 @@ namespace CalamityMod.Projectiles.Rogue int whoAmI = -1; Vector2 targetSpot = projectile.Center; - float detectRange = 400f; + float detectRange = 1000f; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; @@ -148,7 +151,7 @@ namespace CalamityMod.Projectiles.Rogue { 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.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 @@ -222,7 +225,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -307,7 +310,7 @@ namespace CalamityMod.Projectiles.Rogue if (npc.active && !npc.dontTakeDamage && !npc.buffImmune[buffType] && Vector2.Distance(projectile.Center, npc.Center) <= radius) { if (npc.FindBuffIndex(buffType) == -1) - npc.AddBuff(buffType, 180, false); + npc.AddBuff(buffType, 60, false); } } } @@ -315,7 +318,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (projectile.Calamity().stealthStrike) - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Rogue/TimeBoltKnife.png b/Projectiles/Rogue/TimeBoltKnife.png deleted file mode 100644 index 4d67710be8..0000000000 Binary files a/Projectiles/Rogue/TimeBoltKnife.png and /dev/null differ diff --git a/Projectiles/Rogue/TitaniumClone.cs b/Projectiles/Rogue/TitaniumClone.cs index 5fba2a737d..6692827311 100644 --- a/Projectiles/Rogue/TitaniumClone.cs +++ b/Projectiles/Rogue/TitaniumClone.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TitaniumClone : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TitaniumShuriken"; + private static float RotationIncrement = 0.22f; public override void SetStaticDefaults() { @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0] += 1f; if (projectile.ai[0] > 30f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 400f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } } @@ -42,7 +44,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TitaniumClone.png b/Projectiles/Rogue/TitaniumClone.png deleted file mode 100644 index 91b3bddea8..0000000000 Binary files a/Projectiles/Rogue/TitaniumClone.png and /dev/null differ diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.cs b/Projectiles/Rogue/TitaniumShurikenProjectile.cs index 094d8ce6f8..0fcbacdff2 100644 --- a/Projectiles/Rogue/TitaniumShurikenProjectile.cs +++ b/Projectiles/Rogue/TitaniumShurikenProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TitaniumShurikenProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TitaniumShuriken"; + private static float RotationIncrement = 0.22f; private static float ReboundTime = 26f; @@ -115,7 +117,6 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike) { - projectile.ai[0] += 0.1f; if (projectile.velocity.X != oldVelocity.X) { projectile.velocity.X = -oldVelocity.X; @@ -134,7 +135,7 @@ namespace CalamityMod.Projectiles.Rogue Texture2D tex = Main.projectileTexture[projectile.type]; if (projectile.Calamity().stealthStrike) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); } else { diff --git a/Projectiles/Rogue/TitaniumShurikenProjectile.png b/Projectiles/Rogue/TitaniumShurikenProjectile.png deleted file mode 100644 index 91b3bddea8..0000000000 Binary files a/Projectiles/Rogue/TitaniumShurikenProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/ToothBallProjectile.cs b/Projectiles/Rogue/ToothBallProjectile.cs index 3d0aaa83db..7714c27ed4 100644 --- a/Projectiles/Rogue/ToothBallProjectile.cs +++ b/Projectiles/Rogue/ToothBallProjectile.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ToothBallProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ToothBall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ball"); diff --git a/Projectiles/Rogue/ToothBallProjectile.png b/Projectiles/Rogue/ToothBallProjectile.png deleted file mode 100644 index c5c248dd8f..0000000000 Binary files a/Projectiles/Rogue/ToothBallProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/TotalityFire.cs b/Projectiles/Rogue/TotalityFire.cs index 627421cb0f..d1ff48b432 100644 --- a/Projectiles/Rogue/TotalityFire.cs +++ b/Projectiles/Rogue/TotalityFire.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; projectile.Calamity().rogue = true; - } + projectile.ignoreWater = true; + } public override void AI() { @@ -139,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 c78562fb18..80b6cde1d2 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TotalityFlask : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/TotalityBreakers"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Totality Flask"); diff --git a/Projectiles/Rogue/TotalityFlask.png b/Projectiles/Rogue/TotalityFlask.png deleted file mode 100644 index e0c0bd34c6..0000000000 Binary files a/Projectiles/Rogue/TotalityFlask.png and /dev/null differ diff --git a/Projectiles/Rogue/ToxicantTwisterDust.cs b/Projectiles/Rogue/ToxicantTwisterDust.cs index de95a1526a..ad348aa335 100644 --- a/Projectiles/Rogue/ToxicantTwisterDust.cs +++ b/Projectiles/Rogue/ToxicantTwisterDust.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ToxicantTwisterDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); @@ -17,7 +19,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 6; projectile.friendly = true; projectile.tileCollide = true; - projectile.penetrate = 1; + projectile.ignoreWater = true; + projectile.penetrate = 1; projectile.timeLeft = 180; projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/ToxicantTwisterDust.png b/Projectiles/Rogue/ToxicantTwisterDust.png deleted file mode 100644 index 55a2f41495..0000000000 Binary files a/Projectiles/Rogue/ToxicantTwisterDust.png and /dev/null differ diff --git a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs index b7535085c7..b14aac28e3 100644 --- a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs +++ b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ToxicantTwisterTwoPointZero : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/ToxicantTwister"; + private int lifeTime = 300; private int targetIndex = -1; @@ -24,7 +26,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 46; projectile.friendly = true; projectile.tileCollide = false; - projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.penetrate = -1; projectile.timeLeft = lifeTime; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; @@ -35,20 +38,16 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike) { - if (projectile.timeLeft % 20 == 0) + if (projectile.timeLeft % 20 == 0 && Main.myPlayer == projectile.owner) { for (int i = 0; i < 2; i++) - { - Projectile.NewProjectile(projectile.Center, - (-1f * projectile.velocity).RotatedByRandom(0.1f) * 0.6f, - ModContent.ProjectileType(), projectile.damage, 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(); } // Boomerang rotation - projectile.rotation += 0.4f * (float)projectile.direction; + projectile.rotation += 0.4f * projectile.direction; // Boomerang sound if (projectile.soundDelay == 0) @@ -115,11 +114,9 @@ namespace CalamityMod.Projectiles.Rogue targetIndex = closestTarget.whoAmI; float inertia = 20f; float homingVelocity = projectile.Calamity().stealthStrike ? 30f : 20f; - Vector2 homeInVector = projectile.DirectionTo(closestTarget.Center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 moveDirection = projectile.SafeDirectionTo(closestTarget.Center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * inertia + homeInVector * homingVelocity) / (inertia + 1f); + projectile.velocity = (projectile.velocity * inertia + moveDirection * homingVelocity) / (inertia + 1f); } } else @@ -144,11 +141,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 180); Main.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) @@ -157,11 +150,7 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 180); Main.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/ToxicantTwisterTwoPointZero.png b/Projectiles/Rogue/ToxicantTwisterTwoPointZero.png deleted file mode 100644 index f54ead37b4..0000000000 Binary files a/Projectiles/Rogue/ToxicantTwisterTwoPointZero.png and /dev/null differ diff --git a/Projectiles/Rogue/TurbulanceProjectile.cs b/Projectiles/Rogue/TurbulanceProjectile.cs index caadbbdac8..0283aeefe4 100644 --- a/Projectiles/Rogue/TurbulanceProjectile.cs +++ b/Projectiles/Rogue/TurbulanceProjectile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Rogue { public class TurbulanceProjectile : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Turbulance"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Turbulance"); @@ -32,11 +34,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.ai[0]++; projectile.tileCollide = projectile.ai[0] >= 2f; - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); - if (projectile.spriteDirection == -1) - { - projectile.rotation -= MathHelper.PiOver2; - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); if (Main.rand.NextBool(5)) { @@ -87,14 +85,14 @@ namespace CalamityMod.Projectiles.Rogue 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) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Rogue/TurbulanceProjectile.png b/Projectiles/Rogue/TurbulanceProjectile.png deleted file mode 100644 index b97f8dc9b5..0000000000 Binary files a/Projectiles/Rogue/TurbulanceProjectile.png and /dev/null differ diff --git a/Projectiles/Rogue/TurbulanceWindSlash.cs b/Projectiles/Rogue/TurbulanceWindSlash.cs index 6b7d5a1db6..c04ae62df1 100644 --- a/Projectiles/Rogue/TurbulanceWindSlash.cs +++ b/Projectiles/Rogue/TurbulanceWindSlash.cs @@ -28,10 +28,11 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 180; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { - projectile.velocity.X *= 0.99f; - projectile.velocity.Y *= 0.99f; + projectile.velocity *= 0.99f; if (projectile.localAI[0] == 0f) { projectile.scale += 0.005f; @@ -60,13 +61,13 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.ai[1] == 1f) { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, (projectile.ai[0] == 1f ? 500f : 150f), 8f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, projectile.ai[0] == 1f ? 900f : 450f, 8f, 20f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Rogue/UmbraphileBoom.cs b/Projectiles/Rogue/UmbraphileBoom.cs index eb6d987646..401bbc4b5e 100644 --- a/Projectiles/Rogue/UmbraphileBoom.cs +++ b/Projectiles/Rogue/UmbraphileBoom.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class UmbraphileBoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -29,63 +31,16 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - int dustType = Main.rand.NextBool(2) ? 246 : 176; - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - 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, 1f); - Dust dust = Main.dust[num467]; - dust.noGravity = true; - 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++; - } - return; + 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); + Dust dust = Main.dust[boom]; + dust.noGravity = true; + 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 void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/UmbraphileBoom.png b/Projectiles/Rogue/UmbraphileBoom.png deleted file mode 100644 index 80da916522..0000000000 Binary files a/Projectiles/Rogue/UmbraphileBoom.png and /dev/null differ diff --git a/Projectiles/Rogue/UrchinStingerProj.cs b/Projectiles/Rogue/UrchinStingerProj.cs index 5b4c05f8b4..a22d191664 100644 --- a/Projectiles/Rogue/UrchinStingerProj.cs +++ b/Projectiles/Rogue/UrchinStingerProj.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class UrchinStingerProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/UrchinStinger"; + private int projdmg = 0; public override void SetStaticDefaults() { @@ -50,8 +52,9 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); - Main.projectile[proj].Calamity().forceRogue = true; + 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; } return false; } diff --git a/Projectiles/Rogue/UrchinStingerProj.png b/Projectiles/Rogue/UrchinStingerProj.png deleted file mode 100644 index a5c38c11b9..0000000000 Binary files a/Projectiles/Rogue/UrchinStingerProj.png and /dev/null differ diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index 4e0e029242..b32e793ced 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ValariBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/FrostcrushValari"; + //This variable will be used for the stealth strike public float ReboundTime = 0f; public float timer = 0f; @@ -26,7 +28,8 @@ namespace CalamityMod.Projectiles.Rogue projectile.height = 40; projectile.penetrate = -1; projectile.timeLeft = 360; - projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.usesIDStaticNPCImmunity = true; projectile.idStaticNPCHitCooldown = 15; projectile.coldDamage = true; @@ -136,7 +139,7 @@ namespace CalamityMod.Projectiles.Rogue 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, 0f, 0f); + int shard = Projectile.NewProjectile(projectile.Center, velocity, Main.rand.NextBool(2) ? ModContent.ProjectileType() : ModContent.ProjectileType(), projectile.damage / 3, 0f, projectile.owner); } } } @@ -147,8 +150,7 @@ namespace CalamityMod.Projectiles.Rogue OnHitEffects(); target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(ModContent.BuffType(), 240); - if (Main.rand.NextBool(5)) - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } public override void OnHitPvp(Player target, int damage, bool crit) @@ -156,8 +158,7 @@ namespace CalamityMod.Projectiles.Rogue OnHitEffects(); target.AddBuff(BuffID.Frostburn, 240); target.AddBuff(ModContent.BuffType(), 240); - if (Main.rand.NextBool(5)) - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/ValariBoomerang.png b/Projectiles/Rogue/ValariBoomerang.png deleted file mode 100644 index 1dd40a54e7..0000000000 Binary files a/Projectiles/Rogue/ValariBoomerang.png and /dev/null differ diff --git a/Projectiles/Rogue/Valaricicle.cs b/Projectiles/Rogue/Valaricicle.cs index 3baa99dce9..4cf1eef705 100644 --- a/Projectiles/Rogue/Valaricicle.cs +++ b/Projectiles/Rogue/Valaricicle.cs @@ -23,11 +23,16 @@ namespace CalamityMod.Projectiles.Rogue projectile.coldDamage = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } + projectile.velocity.Y += 0.01f; + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Rogue/Valaricicle2.cs b/Projectiles/Rogue/Valaricicle2.cs index 12051d82de..3627bbe3da 100644 --- a/Projectiles/Rogue/Valaricicle2.cs +++ b/Projectiles/Rogue/Valaricicle2.cs @@ -23,11 +23,16 @@ namespace CalamityMod.Projectiles.Rogue projectile.coldDamage = true; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 150 && target.CanBeChasedBy(projectile); + + public override void AI() { projectile.velocity.X *= 0.9995f; - projectile.velocity.Y = projectile.velocity.Y + 0.01f; - } + projectile.velocity.Y += 0.01f; + + if (projectile.timeLeft < 150) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 8f, 20f); + } public override void Kill(int timeLeft) { diff --git a/Projectiles/Rogue/ValedictionBoomerang.cs b/Projectiles/Rogue/ValedictionBoomerang.cs index c4d6044ff8..444c608735 100644 --- a/Projectiles/Rogue/ValedictionBoomerang.cs +++ b/Projectiles/Rogue/ValedictionBoomerang.cs @@ -2,7 +2,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +10,8 @@ namespace CalamityMod.Projectiles.Rogue { public class ValedictionBoomerang : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Valediction"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Valediction"); @@ -23,6 +24,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.width = projectile.height = 70; projectile.friendly = true; projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.penetrate = -1; projectile.extraUpdates = 3; projectile.usesLocalNPCImmunity = true; @@ -49,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue } else { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 20f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } } else @@ -112,7 +114,7 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -131,7 +133,8 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects() { int typhoonAmt = 3; - if (projectile.owner == Main.myPlayer && 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); for (int typhoonCount = 0; typhoonCount < typhoonAmt; typhoonCount++) @@ -143,10 +146,13 @@ namespace CalamityMod.Projectiles.Rogue } velocity.Normalize(); velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile typhoon = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage / 2, 0f, projectile.owner); - typhoon.Calamity().forceRogue = true; - typhoon.usesLocalNPCImmunity = true; - typhoon.localNPCHitCooldown = 10; + Projectile typhoon = Projectile.NewProjectileDirect(projectile.Center, velocity, ModContent.ProjectileType(), typhoonDamage, 0f, projectile.owner); + if (typhoon.whoAmI.WithinBounds(Main.maxProjectiles)) + { + typhoon.Calamity().forceRogue = true; + typhoon.usesLocalNPCImmunity = true; + typhoon.localNPCHitCooldown = 10; + } } } } diff --git a/Projectiles/Rogue/ValedictionBoomerang.png b/Projectiles/Rogue/ValedictionBoomerang.png deleted file mode 100644 index 1c3cefaf35..0000000000 Binary files a/Projectiles/Rogue/ValedictionBoomerang.png and /dev/null differ diff --git a/Projectiles/Rogue/VeneratedKnife.cs b/Projectiles/Rogue/VeneratedKnife.cs index 2e944dc3ed..c6bac499a8 100644 --- a/Projectiles/Rogue/VeneratedKnife.cs +++ b/Projectiles/Rogue/VeneratedKnife.cs @@ -73,12 +73,12 @@ namespace CalamityMod.Projectiles.Rogue if (projectile.ai[0] == 0f) { Texture2D knife1 = Main.projectileTexture[projectile.type]; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3, knife1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, knife1); } else if (projectile.ai[0] == 1f) { Texture2D knife2 = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/VeneratedKnife2"); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3, knife2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, knife2); } return false; } diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs index db16285d15..3fc6b2b13b 100644 --- a/Projectiles/Rogue/WebBallBol.cs +++ b/Projectiles/Rogue/WebBallBol.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Rogue { public class WebBallBol : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/WebBall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Web Ball"); @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike == true) { - target.AddBuff(BuffID.Webbed, 180); + target.AddBuff(BuffID.Webbed, 120); } else { @@ -46,7 +48,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.Calamity().stealthStrike == true) { - target.AddBuff(BuffID.Webbed, 180); + target.AddBuff(BuffID.Webbed, 120); } else { diff --git a/Projectiles/Rogue/WebBallBol.png b/Projectiles/Rogue/WebBallBol.png deleted file mode 100644 index 3640d6596e..0000000000 Binary files a/Projectiles/Rogue/WebBallBol.png and /dev/null differ diff --git a/Projectiles/Rogue/InfernalFireballEruption.cs b/Projectiles/Rogue/WrathwingCinder.cs similarity index 61% rename from Projectiles/Rogue/InfernalFireballEruption.cs rename to Projectiles/Rogue/WrathwingCinder.cs index 8ba12f9a3e..f7fabbe202 100644 --- a/Projectiles/Rogue/InfernalFireballEruption.cs +++ b/Projectiles/Rogue/WrathwingCinder.cs @@ -7,23 +7,28 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class InfernalFireballEruption : ModProjectile + public class WrathwingCinder : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/WrathwingFireball"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Dragon Fireball"); + DisplayName.SetDefault("Wrathwing Eruption"); + Main.projFrames[projectile.type] = 5; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = 34; + projectile.height = 34; projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.timeLeft = 3600; + projectile.timeLeft = 480; projectile.Calamity().rogue = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 30; @@ -43,6 +48,16 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } if (projectile.velocity.Y < 0f) { projectile.velocity.Y *= 0.97f; @@ -61,12 +76,17 @@ namespace CalamityMod.Projectiles.Rogue projectile.velocity.Y = 1f; } projectile.velocity.X *= 0.995f; - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + + // commented out sound because it was way too loud + /* if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); } + */ + if (projectile.ai[0] >= 2f) { projectile.alpha -= 25; @@ -83,45 +103,30 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool CanHitPlayer(Player target) - { - if (projectile.velocity.Y < -16f) - { - return false; - } - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, projectile.alpha); public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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); - 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 < 2; num193++) + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + for (int d = 0; d < 2; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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 num194 = 0; num194 < 20; num194++) + for (int d = 0; d < 20; d++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 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, 55, 0f, 0f, 100, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } } } diff --git a/Projectiles/Rogue/InfernalFireball.cs b/Projectiles/Rogue/WrathwingFireball.cs similarity index 55% rename from Projectiles/Rogue/InfernalFireball.cs rename to Projectiles/Rogue/WrathwingFireball.cs index 13d408154d..f9b4741fea 100644 --- a/Projectiles/Rogue/InfernalFireball.cs +++ b/Projectiles/Rogue/WrathwingFireball.cs @@ -6,20 +6,22 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class InfernalFireball : ModProjectile + public class WrathwingFireball : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Dragon Fireball"); + DisplayName.SetDefault("Wrathwing Fireball"); + Main.projFrames[projectile.type] = 5; ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = 34; + projectile.height = 34; projectile.friendly = true; + projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = 1; projectile.timeLeft = 180; @@ -28,11 +30,27 @@ namespace CalamityMod.Projectiles.Rogue projectile.Calamity().rogue = true; } - public override Color? GetAlpha(Color lightColor) + public override void AI() { - return new Color(255, Main.DiscoG, 53, projectile.alpha); + // Cancel out the first ten frames of Betsy fireball gravity, and half of all gravity thereafter + projectile.velocity.Y -= 0.1f; + + // Animation + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 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; } + 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]; @@ -60,24 +78,29 @@ namespace CalamityMod.Projectiles.Rogue return false; } + // Expand hitbox and explode on hit. 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); - for (int num193 = 0; num193 < 2; num193++) + 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(); + + for (int i = 0; i < 2; i++) + Dust.NewDust(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 50, default, 1.5f); + + for (int i = 0; i < 20; i++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 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, 55, 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, 55, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + 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); + Main.dust[d].velocity *= 2f; + Main.dust[d].noGravity = true; } } } diff --git a/Projectiles/Rogue/WrathwingFireball.png b/Projectiles/Rogue/WrathwingFireball.png new file mode 100644 index 0000000000..d506ade923 Binary files /dev/null and b/Projectiles/Rogue/WrathwingFireball.png differ diff --git a/Projectiles/Rogue/WrathwingSpear.cs b/Projectiles/Rogue/WrathwingSpear.cs new file mode 100644 index 0000000000..a1d54242ee --- /dev/null +++ b/Projectiles/Rogue/WrathwingSpear.cs @@ -0,0 +1,114 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WrathwingSpear : ModProjectile + { + private const float FireballAngleVariance = 0.07f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wrathwing"); + 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; + } + + 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) + { + projectile.ai[0] = Main.rand.NextFloat(15f, 19f); + + int fireballID = ModContent.ProjectileType(); + 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); + } + + 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); + + // Animation + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + // Rotation + 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) + { + int eruptionID = ModContent.ProjectileType(); + int damage = (int)(projectile.damage * 0.75f); + 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); + 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); + } + } + + // Spawn shrapnel dust. Code adapted from Holy Fire Bullets. + for (int k = 0; k < 36; k++) + { + float scale = Main.rand.NextFloat(1.4f, 1.8f); + 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; + Main.dust[dustID].velocity = shrapnelVelocity; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Daybreak, 360); + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.Daybreak, 360); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + } +} diff --git a/Projectiles/Rogue/InfernalSpearProjectile.png b/Projectiles/Rogue/WrathwingSpear.png similarity index 100% rename from Projectiles/Rogue/InfernalSpearProjectile.png rename to Projectiles/Rogue/WrathwingSpear.png diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index d85df228ae..3c71ca9ff6 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Rogue { public class WulfrumKnifeProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Rogue/WulfrumKnife"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); diff --git a/Projectiles/Rogue/WulfrumKnifeProj.png b/Projectiles/Rogue/WulfrumKnifeProj.png deleted file mode 100644 index 94ca6dcea6..0000000000 Binary files a/Projectiles/Rogue/WulfrumKnifeProj.png and /dev/null differ diff --git a/Projectiles/Boss/HolyLight.png b/Projectiles/StarProj.png similarity index 100% rename from Projectiles/Boss/HolyLight.png rename to Projectiles/StarProj.png diff --git a/Projectiles/Summon/AndromedaRegislash.cs b/Projectiles/Summon/AndromedaRegislash.cs index 574be30c67..80946f58a3 100644 --- a/Projectiles/Summon/AndromedaRegislash.cs +++ b/Projectiles/Summon/AndromedaRegislash.cs @@ -58,11 +58,26 @@ namespace CalamityMod.Projectiles.Summon { projectile.Kill(); } + projectile.direction = ((player.Center.X - projectile.Center.X) < 0).ToDirectionInt(); + projectile.spriteDirection = projectile.direction; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + 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; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipVertically; + + Main.spriteBatch.Draw(texture, startPos, rectangle, projectile.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); return false; } } diff --git a/Projectiles/Typeless/CirrusBolt.cs b/Projectiles/Summon/AngelBolt.cs similarity index 50% rename from Projectiles/Typeless/CirrusBolt.cs rename to Projectiles/Summon/AngelBolt.cs index c9ffb06860..dce9e63033 100644 --- a/Projectiles/Typeless/CirrusBolt.cs +++ b/Projectiles/Summon/AngelBolt.cs @@ -1,13 +1,19 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless +namespace CalamityMod.Projectiles.Summon { - public class CirrusBolt : ModProjectile + public class AngelBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.MinionShot[projectile.type] = true; } public override void SetDefaults() @@ -17,8 +23,9 @@ namespace CalamityMod.Projectiles.Typeless projectile.extraUpdates = 100; projectile.friendly = true; projectile.timeLeft = 45; - projectile.magic = true; - projectile.npcProj = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; } public override void AI() @@ -27,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless { Vector2 vector33 = projectile.position; vector33 -= projectile.velocity * 0.25f; - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.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; Main.dust[num448].noLight = true; @@ -35,5 +42,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num448].velocity *= 0.1f; } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Summon/AngelOrb.cs b/Projectiles/Summon/AngelOrb.cs new file mode 100644 index 0000000000..feae94e766 --- /dev/null +++ b/Projectiles/Summon/AngelOrb.cs @@ -0,0 +1,42 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class AngelOrb : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Orb"); + 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; + } + + public override void AI() + { + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType(), 1D, true); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + } +} diff --git a/Projectiles/Typeless/CirrusRay.cs b/Projectiles/Summon/AngelRay.cs similarity index 62% rename from Projectiles/Typeless/CirrusRay.cs rename to Projectiles/Summon/AngelRay.cs index 58fc0fce3c..a01c7fe624 100644 --- a/Projectiles/Typeless/CirrusRay.cs +++ b/Projectiles/Summon/AngelRay.cs @@ -1,13 +1,19 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless +namespace CalamityMod.Projectiles.Summon { - public class CirrusRay : ModProjectile + public class AngelRay : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); + ProjectileID.Sets.MinionShot[projectile.type] = true; } public override void SetDefaults() @@ -15,14 +21,15 @@ namespace CalamityMod.Projectiles.Typeless projectile.width = 4; projectile.height = 4; projectile.friendly = true; - projectile.magic = true; - projectile.penetrate = 5; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.ignoreWater = true; + projectile.penetrate = 10; projectile.extraUpdates = 100; - projectile.timeLeft = 300; + projectile.timeLeft = 600; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 0; - projectile.npcProj = true; - } + projectile.localNPCHitCooldown = 10; + } public override void AI() { @@ -30,13 +37,13 @@ namespace CalamityMod.Projectiles.Typeless 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, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } if (projectile.ai[0] > 16f && projectile.ai[0] % 2f == 0f) { Vector2 source = projectile.position; - int pink = Dust.NewDust(source, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + 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; Main.dust[pink].position = source; @@ -65,5 +72,9 @@ namespace CalamityMod.Projectiles.Typeless } return false; } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Summon/AngelicAllianceArchangel.cs b/Projectiles/Summon/AngelicAllianceArchangel.cs new file mode 100644 index 0000000000..1540e0903b --- /dev/null +++ b/Projectiles/Summon/AngelicAllianceArchangel.cs @@ -0,0 +1,168 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class AngelicAllianceArchangel : ModProjectile + { + private int lifeSpan = 900; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Archangel"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.Write(lifeSpan); + + public override void ReceiveExtraAI(BinaryReader reader) => lifeSpan = reader.ReadInt32(); + + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + if (!modPlayer.divineBless || player.dead || !player.active) + { + lifeSpan = 0; + } + + // Initialization and dust + if (projectile.localAI[0] == 0f) + { + 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); + } + projectile.localAI[0] += 1f; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + // Rotate around the player + 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; + + if (!projectile.FinalExtraUpdate()) + return; + + lifeSpan--; + if (lifeSpan <= 0) + { + projectile.alpha += 30; + if (projectile.alpha >= 255) + { + 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); + + // Get a target + NPC target = projectile.Center.MinionHoming(2000f, player, false, true); + + // Shoot the target + if (target != null) + { + Vector2 direction = target.Center - projectile.Center; + direction.Normalize(); + direction *= 6f; + if (direction.X >= 0.25f) + { + projectile.direction = -1; + } + else if (direction.X < -0.25f) + { + projectile.direction = 1; + } + projectile.ai[0]++; + int timerLimit = 120; + if (projectile.ai[0] > timerLimit && projectile.alpha < 50) + { + if (Main.myPlayer == projectile.owner) + { + int type = ModContent.ProjectileType(); + Projectile.NewProjectile(projectile.Center, direction, type, projectile.damage, projectile.knockBack, projectile.owner); + } + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + } + else + { + Vector2 direction = player.Center - projectile.Center; + direction.Normalize(); + direction *= 6f; + if (direction.X >= 0.25f) + { + projectile.direction = -1; + } + else if (direction.X < -0.25f) + { + projectile.direction = 1; + } + } + projectile.spriteDirection = projectile.direction; + + // Frames + projectile.frameCounter++; + if (projectile.frameCounter > 7) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + 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); + return false; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/AngelicAllianceArchangel.png b/Projectiles/Summon/AngelicAllianceArchangel.png new file mode 100644 index 0000000000..664d3841f7 Binary files /dev/null and b/Projectiles/Summon/AngelicAllianceArchangel.png differ diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index d42ac52fac..91980ab5a2 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Summon { public class ApexShark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/SandyWaifuShark"; + private int HitCooldown = 0; public override void SetStaticDefaults() { @@ -52,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon 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); + 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; } @@ -75,8 +77,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - float num633 = 700f; - float num634 = 1000f; + float num633 = 1200f; + float num634 = 1500f; float num635 = 2200f; float num636 = 150f; bool flag64 = projectile.type == ModContent.ProjectileType(); diff --git a/Projectiles/Summon/ApexShark.png b/Projectiles/Summon/ApexShark.png deleted file mode 100644 index 1d2efce76d..0000000000 Binary files a/Projectiles/Summon/ApexShark.png and /dev/null differ diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 93ac1816d0..9febfeb7b3 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,8 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = projectile.height = 32; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -64,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon } 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(1200f, 1500f, 2200f, 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/AquaticStarMinion.png b/Projectiles/Summon/AquaticStarMinion.png index aa1ec4c4c2..56606a7a18 100644 Binary files a/Projectiles/Summon/AquaticStarMinion.png and b/Projectiles/Summon/AquaticStarMinion.png differ diff --git a/Projectiles/Summon/AstrageldonLaser.cs b/Projectiles/Summon/AstrageldonLaser.cs index 26cd5201d7..44bdf30d64 100644 --- a/Projectiles/Summon/AstrageldonLaser.cs +++ b/Projectiles/Summon/AstrageldonLaser.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 eeb30a3c4f..07996c0071 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -12,97 +12,99 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { public class AstrageldonSummon : ModProjectile - { - public bool dust = false; + { + public bool dust = false; private int attackCounter = 1; private int teleportCounter = 400; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrageldon"); - Main.projFrames[projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; - } + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrageldon"); + 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; - aiType = ProjectileID.BabySlime; - } + 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; + aiType = ProjectileID.BabySlime; + } - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) - { + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { //for platform collision? - fallThrough = false; - return true; - } + fallThrough = false; + return true; + } - public override void AI() - { - Player player = Main.player[projectile.owner];; - CalamityPlayer modPlayer = player.Calamity(); + public override void AI() + { + Player player = Main.player[projectile.owner];; + CalamityPlayer modPlayer = player.Calamity(); CalamityGlobalProjectile modProj = projectile.Calamity(); - projectile.minionSlots = modProj.lineColor; - //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); //on spawn effects and flexible minions - if (!dust) - { - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - 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; - 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; - Main.dust[dusty].velocity = vector7; - } - dust = true; - } - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } + if (!dust) + { + modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); + 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; + 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; + Main.dust[dusty].velocity = vector7; + } + + dust = true; + } + if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) + { + int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / + modProj.spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } //Bool setup - bool flag64 = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) - { - if (player.dead) - { - modPlayer.aSlime = false; - } - if (modPlayer.aSlime) - { - projectile.timeLeft = 2; - } - } + bool flag64 = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (flag64) + { + if (player.dead) + { + modPlayer.aSlime = false; + } + if (modPlayer.aSlime) + { + projectile.timeLeft = 2; + } + } if (projectile.frame == 0 || projectile.frame == 1) { @@ -212,34 +214,27 @@ namespace CalamityMod.Projectiles.Summon Vector2 laserVel = objectivepos - projectile.Center; laserVel.Normalize(); laserVel *= scaleFactor3; - int laser = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, laserVel.X, laserVel.Y, projType, projectile.damage, 0f, projectile.owner, 0f, 0f); + int laser = Projectile.NewProjectile(projectile.Center, laserVel, projType, projectile.damage, 0f, projectile.owner); projectile.netUpdate = true; } } } - } + } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 120); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } - 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); - 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 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 09f08b9890..054eec0313 100644 --- a/Projectiles/Summon/AstralProbeRound.cs +++ b/Projectiles/Summon/AstralProbeRound.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Summon { public class AstralProbeRound : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/AstralRound"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); @@ -48,76 +50,9 @@ namespace CalamityMod.Projectiles.Summon Main.dust[astral].velocity *= 0f; Main.dust[astral].noGravity = true; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) - { - float num476 = npc.Center.X; - float num477 = npc.Center.Y; - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - else if (projectile.ai[0] != -1f && Main.npc[(int)projectile.ai[0]].active) - { - NPC npc = Main.npc[(int)projectile.ai[0]]; - if (npc.CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1)) - { - float num476 = npc.Center.X; - float num477 = npc.Center.Y; - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (!flag17) - { - for (int target = 0; target < Main.npc.Length; target++) - { - if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - 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; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 17f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 17f) / 21f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -127,7 +62,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/AstralProbeRound.png b/Projectiles/Summon/AstralProbeRound.png deleted file mode 100644 index 8e4b2a680f..0000000000 Binary files a/Projectiles/Summon/AstralProbeRound.png and /dev/null differ diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index 1dc3e65293..82c54cf7f3 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -76,46 +76,12 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - float range = 1000f; - Vector2 targetVec = projectile.position; - bool foundTarget = false; - int targetIndex = -1; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); - if (!foundTarget && npcDist < range) - { - targetVec = npc.Center; - foundTarget = true; - targetIndex = npc.whoAmI; - } - } - } - if (!foundTarget) - { - for (int num645 = 0; num645 < Main.maxNPCs; num645++) - { - NPC npc = Main.npc[num645]; - if (npc.CanBeChasedBy(projectile, false)) - { - float npcDist = Vector2.Distance(npc.Center, projectile.Center); - if (!foundTarget && npcDist < range) - { - targetVec = npc.Center; - foundTarget = true; - targetIndex = num645; - } - } - } - } + NPC target = projectile.Center.MinionHoming(1000f, player, true, true); Vector2 vector = player.Center - projectile.Center; - if (foundTarget) + if (target != null) { - 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 = ((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 { @@ -141,16 +107,16 @@ namespace CalamityMod.Projectiles.Summon } float speedMult = 6f; int projType = ModContent.ProjectileType(); - if (foundTarget && projectile.ai[1] == 0f && targetVec != projectile.position) + 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) { - Vector2 velocity = targetVec - projectile.Center; + Vector2 velocity = target.Center - projectile.Center; velocity.Normalize(); velocity *= speedMult; - Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, 0f, projectile.owner, targetIndex, 0f); + 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 1347dfcbc3..d2a4885906 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -262,14 +262,11 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f0d3a1b2d4..fa9e73016c 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -100,16 +100,9 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { //1 spider = 15 frames, 5 spiders, 10 frames int immuneTime = 16 - spiderCount; @@ -117,44 +110,22 @@ namespace CalamityMod.Projectiles.Summon immuneTime = 5; //cap to prevent potential insanity target.immune[projectile.owner] = immuneTime; - if (Main.rand.NextBool(2)) - { - for (int n = 0; n < Main.rand.Next(1, 3); n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((float)projectile.damage * Main.rand.NextFloat(0.7f, 1f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); - } - } - } + OnHitEffects(target.Center); + } public override void OnHitPvp(Player target, int damage, bool crit) { + OnHitEffects(target.Center); + } + + private void OnHitEffects(Vector2 targetPos) + { if (Main.rand.NextBool(2)) { - for (int n = 0; n < Main.rand.Next(1, 3); n++) + int projAmt = Main.rand.Next(1, 3); + for (int n = 0; n < projAmt; n++) { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 29; - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - Projectile.NewProjectile(x, y, num13, num14, ModContent.ProjectileType(), (int)((float)projectile.damage * Main.rand.NextFloat(0.7f, 1f)), projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), projectile.owner, 0f, 0f); + 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 24154ac42b..fa7555bd2d 100644 --- a/Projectiles/Summon/BabyPlaguebringer.cs +++ b/Projectiles/Summon/BabyPlaguebringer.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Summon { public class BabyPlaguebringer : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Pets/PlaguebringerBab"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Baby Plaguebringer"); diff --git a/Projectiles/Summon/BabyPlaguebringer.png b/Projectiles/Summon/BabyPlaguebringer.png deleted file mode 100644 index 9103613fa4..0000000000 Binary files a/Projectiles/Summon/BabyPlaguebringer.png and /dev/null differ diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 1b4c9423fd..7eaa0c7ad6 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Summon { float angle = Main.rand.NextFloat(-0.1f, 0.1f) + i * 0.05f; Projectile.NewProjectile(projectile.Center + new Vector2(0f, -6f), - projectile.DirectionTo(target.Center).RotatedBy(angle) * 7.5f, + projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 7.5f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, diff --git a/Projectiles/Summon/BlackHawkBullet.cs b/Projectiles/Summon/BlackHawkBullet.cs index 71969f4126..e59b17622a 100644 --- a/Projectiles/Summon/BlackHawkBullet.cs +++ b/Projectiles/Summon/BlackHawkBullet.cs @@ -1,14 +1,14 @@ using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class BlackHawkBullet : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Bullet"); + DisplayName.SetDefault("Black Hawk Bullet"); ProjectileID.Sets.MinionShot[projectile.type] = true; } @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Summon projectile.width = 4; projectile.height = 4; projectile.light = 0.5f; - projectile.alpha = 255; + projectile.alpha = 0; projectile.extraUpdates = 4; projectile.scale = 1.18f; projectile.friendly = true; @@ -28,13 +28,7 @@ namespace CalamityMod.Projectiles.Summon aiType = ProjectileID.BulletHighVelocity; projectile.penetrate = 1; projectile.timeLeft = 600; - projectile.tileCollide = false; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; + projectile.tileCollide = false; } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); diff --git a/Projectiles/Summon/BloodBreath.cs b/Projectiles/Summon/BloodBreath.cs index 989846e46b..d11efadd2b 100644 --- a/Projectiles/Summon/BloodBreath.cs +++ b/Projectiles/Summon/BloodBreath.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Summon { public class BloodBreath : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float Time { get => projectile.ai[0]; diff --git a/Projectiles/Summon/BloodBreath.png b/Projectiles/Summon/BloodBreath.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Summon/BloodBreath.png and /dev/null differ diff --git a/Projectiles/Summon/BloodRain.cs b/Projectiles/Summon/BloodRain.cs index 1fb9337783..d8c4f7b021 100644 --- a/Projectiles/Summon/BloodRain.cs +++ b/Projectiles/Summon/BloodRain.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Summon { public class BloodRain : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blood Rain"); diff --git a/Projectiles/Summon/BloodRain.png b/Projectiles/Summon/BloodRain.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Summon/BloodRain.png and /dev/null differ diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 2e300e5a65..9342cd422b 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -7,6 +7,7 @@ namespace CalamityMod.Projectiles.Summon public class BloodSpit : ModProjectile { public const int OnDeathHealValue = 1; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spit"); @@ -37,6 +38,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frameCounter = 0; } } + public override void Kill(int timeLeft) { for (int i = 0; i < 15; i++) @@ -45,12 +47,11 @@ namespace CalamityMod.Projectiles.Summon 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; - } } } } diff --git a/Projectiles/Summon/BrimstoneDartMinion.cs b/Projectiles/Summon/BrimstoneDartMinion.cs new file mode 100644 index 0000000000..68f0f1acd4 --- /dev/null +++ b/Projectiles/Summon/BrimstoneDartMinion.cs @@ -0,0 +1,58 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class BrimstoneDartMinion : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneBarrage"; + + 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; + } + + 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; + } + + 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; + + if (projectile.velocity.Length() < 35f) + projectile.velocity *= 1.036f; + + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 600); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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 new file mode 100644 index 0000000000..4c234ceeba --- /dev/null +++ b/Projectiles/Summon/BrimstoneDartSummon.cs @@ -0,0 +1,80 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class BrimstoneDartSummon : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneBarrage"; + 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; + } + + 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; + } + + public override void AI() + { + if (projectile.velocity.Length() < 21f) + projectile.velocity *= 1.02f; + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + 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); + + Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + if (Main.dedServ) + return; + + 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); + brimstone.scale = Main.rand.NextFloat(1.5f, 1.85f); + brimstone.color = Color.DarkRed; + brimstone.noGravity = true; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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 5b45e67e2d..aa936a1da4 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -35,11 +35,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs index 86152658e6..b5d08a0540 100644 --- a/Projectiles/Summon/BrimstoneExplosionMinion.cs +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Summon { public class BrimstoneExplosionMinion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.png b/Projectiles/Summon/BrimstoneExplosionMinion.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Summon/BrimstoneExplosionMinion.png and /dev/null differ diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index dec9b2d870..95a5126d88 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class BrimstoneFireSummon : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); diff --git a/Projectiles/Summon/BrimstoneFireSummon.png b/Projectiles/Summon/BrimstoneFireSummon.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Summon/BrimstoneFireSummon.png and /dev/null differ diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs index d4d3396abb..319d87c8fa 100644 --- a/Projectiles/Summon/BrimstoneFireballMinion.cs +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Summon { public class BrimstoneFireballMinion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneHellfireball"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimfire"); @@ -85,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/BrimstoneFireballMinion.png b/Projectiles/Summon/BrimstoneFireballMinion.png deleted file mode 100644 index 71720f8c11..0000000000 Binary files a/Projectiles/Summon/BrimstoneFireballMinion.png and /dev/null differ diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index db5d539dad..abe86e0537 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class BrimstoneLaserSummon : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/BrimstoneLaser"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); diff --git a/Projectiles/Summon/BrimstoneLaserSummon.png b/Projectiles/Summon/BrimstoneLaserSummon.png deleted file mode 100644 index fc59a4cd75..0000000000 Binary files a/Projectiles/Summon/BrimstoneLaserSummon.png and /dev/null differ diff --git a/Projectiles/Summon/CalamariInk.cs b/Projectiles/Summon/CalamariInk.cs index 5ee1bbd833..55914056f4 100644 --- a/Projectiles/Summon/CalamariInk.cs +++ b/Projectiles/Summon/CalamariInk.cs @@ -25,13 +25,13 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 180; projectile.minion = true; projectile.minionSlots = 0f; - projectile.extraUpdates = 2; + projectile.extraUpdates = 1; } public override void AI() { projectile.frameCounter++; - if (projectile.frameCounter > 12) + if (projectile.frameCounter > 8) { projectile.frame++; projectile.frameCounter = 0; @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) - 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; Player player = Main.player[projectile.owner]; int targetIdx = -1; @@ -123,8 +123,8 @@ namespace CalamityMod.Projectiles.Summon { 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.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); for (int num621 = 0; num621 < 10; num621++) { @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 15; num623++) diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index ffcec98ab1..296c2c322d 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon } projectile.MinionAntiClump(); Vector2 vector = projectile.position; - float num10 = 3000f; //300 + float num10 = 3000f; bool flag = false; Vector2 center = player.Center; Vector2 value = new Vector2(0.5f); @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Summon { 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; @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Summon { 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,7 +181,7 @@ namespace CalamityMod.Projectiles.Summon { num16 = 4000; } - if (Vector2.Distance(player.Center, projectile.Center) > (float)num16) + if (Vector2.Distance(player.Center, projectile.Center) > num16) { projectile.ai[0] = 1f; projectile.netUpdate = true; @@ -198,11 +198,11 @@ namespace CalamityMod.Projectiles.Summon num18 = 0; } Tile tile = Main.tile[(int)vector4.X / 16, num18]; - if (tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type]) + if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type]) { vector4 += Vector2.UnitY * 16f; tile = Main.tile[(int)vector4.X / 16, (int)vector4.Y / 16]; - if (tile != null && tile.active() && Main.tileSolid[(int)tile.type] && !Main.tileSolidTop[(int)tile.type]) + if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type]) { vector4 += Vector2.UnitY * 16f; } @@ -210,28 +210,28 @@ namespace CalamityMod.Projectiles.Summon vector4 -= projectile.Center; num17 = vector4.Length(); vector4.Normalize(); - if (num17 > 300f && num17 <= 800f && projectile.localAI[0] == 0f) + if (num17 > 300f && num17 <= 1600f && projectile.localAI[0] == 0f) { projectile.ai[0] = 2f; - projectile.ai[1] = (float)(int)(num17 / 5f); //10 + projectile.ai[1] = (int)(num17 / 10f); projectile.extraUpdates = (int)(projectile.ai[1] * 2f); - projectile.velocity = vector4 * 5f; //10 + projectile.velocity = vector4 * 10f; projectile.localAI[0] = 60f; return; } if (num17 > 200f) { - float scaleFactor2 = 9f; //6 + 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; } if (num17 > 70f && num17 < 130f) { - float scaleFactor3 = 14f; //7 + float scaleFactor3 = 18f; if (num17 < 100f) { - scaleFactor3 = -6f; //-3 + scaleFactor3 = -7.5f; } vector4 *= scaleFactor3; projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; @@ -247,14 +247,14 @@ namespace CalamityMod.Projectiles.Summon } else { - if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) - { - projectile.ai[0] = 1f; - } - float num21 = 6f; //6 + if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + { + projectile.ai[0] = 1f; + } + float num21 = 12f; //6 if (projectile.ai[0] == 1f) { - num21 = 22.5f; //15 + num21 = 18f; //15 } Vector2 center2 = projectile.Center; Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f); @@ -263,15 +263,15 @@ namespace CalamityMod.Projectiles.Summon { num21 = 13.5f; //9 } - if (num23 < 400f && projectile.ai[0] == 1f) + if (num23 < 800f && projectile.ai[0] == 1f) { projectile.ai[0] = 0f; projectile.netUpdate = true; } - if (num23 > 3000f) + if (num23 > 4000f) { - 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 - (projectile.width / 2); + projectile.position.Y = player.Center.Y - (projectile.width / 2); } if (num23 > 70f) { @@ -293,28 +293,28 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[1] > 0f) { projectile.ai[1] += 1f; - if (Main.rand.Next(3) != 0) + if (Main.rand.Next(2) != 0) { projectile.ai[1] += 1f; } } - if (projectile.ai[1] > 15f) + if (projectile.ai[1] > 20f) { projectile.ai[1] = 0f; projectile.netUpdate = true; } if (projectile.ai[0] == 0f) { - float scaleFactor4 = 9f; + float scaleFactor4 = 12f; int num28 = ModContent.ProjectileType(); if (flag) { - if (Math.Abs((vector - projectile.Center).ToRotation() - 1.57079637f) > 0.7853982f) + if (Math.Abs((vector - projectile.Center).ToRotation() - MathHelper.PiOver2) > MathHelper.PiOver4) { - projectile.velocity += Vector2.Normalize(vector - projectile.Center - Vector2.UnitY * 80f); //80 + projectile.velocity += Vector2.Normalize(vector - projectile.Center - Vector2.UnitY * 80f); return; } - if ((vector - projectile.Center).Length() <= 400f && projectile.ai[1] == 0f) //400 + if ((vector - projectile.Center).Length() <= 600f && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 9355116a00..d0db982c7f 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -3,10 +3,10 @@ using CalamityMod.Dusts; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class Calamitamini : ModProjectile @@ -26,8 +26,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = projectile.height = 36; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; diff --git a/Projectiles/Summon/Calamitamini.png b/Projectiles/Summon/Calamitamini.png index b498a82ddf..35dd3f7fdc 100644 Binary files a/Projectiles/Summon/Calamitamini.png and b/Projectiles/Summon/Calamitamini.png differ diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 8e44adf61a..377443b82f 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 40; - projectile.height = 20; + projectile.width = projectile.height = 32; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; diff --git a/Projectiles/Summon/Cataclymini.png b/Projectiles/Summon/Cataclymini.png index dcc35d190b..925e50ce23 100644 Binary files a/Projectiles/Summon/Cataclymini.png and b/Projectiles/Summon/Cataclymini.png differ diff --git a/Projectiles/Summon/CataclysmSummon.cs b/Projectiles/Summon/CataclysmSummon.cs new file mode 100644 index 0000000000..36beeecad4 --- /dev/null +++ b/Projectiles/Summon/CataclysmSummon.cs @@ -0,0 +1,115 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class CataclysmSummon : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() => Behavior(projectile, Main.player[projectile.owner], ref Time); + + public static void Behavior(Projectile projectile, Player owner, ref float time) + { + DoFrameEffects(projectile); + + if (time < 40f) + FadeIn(projectile); + + else if (time > 95f) + { + projectile.Opacity -= 0.06f; + if (projectile.Opacity < 0f) + projectile.Kill(); + } + + if (time < 25f) + { + float idealRotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2; + projectile.rotation = projectile.rotation.AngleLerp(idealRotation, 0.08f); + projectile.rotation = projectile.rotation.AngleTowards(idealRotation, 0.2f); + } + else if (time < 40f) + { + projectile.rotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2; + projectile.velocity = projectile.SafeDirectionTo(owner.Center) * -5f; + } + else if (time == 40f) + { + projectile.rotation = projectile.AngleTo(owner.Center) - MathHelper.PiOver2; + projectile.velocity = projectile.SafeDirectionTo(owner.Center) * 31f; + projectile.damage = (int)(projectile.damage * 1.45); + + Main.PlaySound(SoundID.DD2_BetsyFlameBreath, owner.Center); + Main.PlaySound(SoundID.DD2_WyvernDiveDown, owner.Center); + } + + time++; + } + + public static void FadeIn(Projectile projectile) + { + if (projectile.localAI[0] == 0f) + { + for (int i = 0; i < 40; i++) + { + Dust brimstone = Dust.NewDustPerfect(projectile.Center + Main.rand.NextVector2Square(-65f, 65f), 267); + brimstone.velocity = -Vector2.UnitY * Main.rand.NextFloat(1.8f, 3.6f); + brimstone.scale = Main.rand.NextFloat(1.65f, 1.85f); + brimstone.fadeIn = Main.rand.NextFloat(0.7f, 0.9f); + brimstone.color = Color.Red; + brimstone.noGravity = true; + } + projectile.localAI[0] = 1f; + } + + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.075f, 0f, 1f); + } + + public static void DoFrameEffects(Projectile projectile) + { + projectile.frameCounter++; + if (projectile.frameCounter % 5f == 4f) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.Red, 1); + return true; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; + + public override bool CanDamage() => projectile.Opacity >= 1f; + } +} diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 3fdb8ed79b..0eeec16ac4 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = projectile.height = 36; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; diff --git a/Projectiles/Summon/Catastromini.png b/Projectiles/Summon/Catastromini.png index 54b5691802..e10ed795f9 100644 Binary files a/Projectiles/Summon/Catastromini.png and b/Projectiles/Summon/Catastromini.png differ diff --git a/Projectiles/Summon/CatastropheSummon.cs b/Projectiles/Summon/CatastropheSummon.cs new file mode 100644 index 0000000000..d60bdafa56 --- /dev/null +++ b/Projectiles/Summon/CatastropheSummon.cs @@ -0,0 +1,51 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class CatastropheSummon : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() => CataclysmSummon.Behavior(projectile, Main.player[projectile.owner], ref Time); + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], Color.Red, 1); + return true; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) => damage = 70; + + public override bool CanDamage() => projectile.Opacity >= 1f; + } +} diff --git a/Projectiles/Summon/ChaosFlame.cs b/Projectiles/Summon/ChaosFlame.cs index a657dfb348..29a9379eb4 100644 --- a/Projectiles/Summon/ChaosFlame.cs +++ b/Projectiles/Summon/ChaosFlame.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class ChaosFlame : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/ChaosFlameSmall"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Chaos Flame"); @@ -64,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon if (projectile.timeLeft == 300) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/ChaosFlame.png b/Projectiles/Summon/ChaosFlame.png deleted file mode 100644 index 5a1fe37e31..0000000000 Binary files a/Projectiles/Summon/ChaosFlame.png and /dev/null differ diff --git a/Projectiles/Summon/Cinder.cs b/Projectiles/Summon/Cinder.cs index 19ce727b89..11c74f713b 100644 --- a/Projectiles/Summon/Cinder.cs +++ b/Projectiles/Summon/Cinder.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class Cinder : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const float FallAcceleration = 0.185f; public const float FallSpeedMax = 16; public const float FallDelay = 300; @@ -87,13 +89,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/Cinder.png b/Projectiles/Summon/Cinder.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Summon/Cinder.png and /dev/null differ diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index 7b037d1901..91ae28461b 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon { if (Time++ % 35f == 34f && Collision.CanHit(projectile.position, projectile.width, projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { - Vector2 velocity = projectile.DirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); + Vector2 velocity = projectile.SafeDirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } } diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 1a1b5e46e1..9fc5723b07 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -34,11 +34,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/ColdDivinityPointyThing.cs b/Projectiles/Summon/ColdDivinityPointyThing.cs index 552ad4b40c..74ecd0efd6 100644 --- a/Projectiles/Summon/ColdDivinityPointyThing.cs +++ b/Projectiles/Summon/ColdDivinityPointyThing.cs @@ -315,7 +315,7 @@ namespace CalamityMod.Projectiles.Summon { if (!circling || (!circlingPlayer && recharging == 0)) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], !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 1a634da6ab..3b1c0b2dce 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -97,13 +97,6 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index 8048b833d3..ada310e94e 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -91,13 +91,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index d648e78b7d..68346087f4 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -50,74 +50,9 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num59].velocity = value3 * 0.66f; Main.dust[num59].position = projectile.Center + value3 * 12f; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - else if (Main.npc[target].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (!flag17) - { - for (int i = 0; i < Main.maxNPCs; ++i) - { - NPC npc = Main.npc[i]; - if (npc is null || !npc.active) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 40f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 40f) / 21f; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 48f0203e43..f8eda30ca8 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -64,74 +64,9 @@ namespace CalamityMod.Projectiles.Summon Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - else if (Main.npc[target].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (!flag17) - { - for (int i = 0; i < Main.maxNPCs; ++i) - { - NPC npc = Main.npc[i]; - if (npc is null || !npc.active) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 45f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + NPC potentialTarget = projectile.Center.MinionHoming(600f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 45f) / 21f; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Summon/CosmicViperConcussionMissile.cs b/Projectiles/Summon/CosmicViperConcussionMissile.cs index c34a69b30f..80fad55789 100644 --- a/Projectiles/Summon/CosmicViperConcussionMissile.cs +++ b/Projectiles/Summon/CosmicViperConcussionMissile.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/CosmicViperHomingRocket.cs b/Projectiles/Summon/CosmicViperHomingRocket.cs index 31c43114e3..761a7989c3 100644 --- a/Projectiles/Summon/CosmicViperHomingRocket.cs +++ b/Projectiles/Summon/CosmicViperHomingRocket.cs @@ -105,19 +105,17 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - float homingRatio = 20f; + float homingInertia = 20f; float homingVelocity = 20f; - projectile.velocity = (projectile.velocity * homingRatio + homeInVector * homingVelocity) / (homingRatio + 1f); + projectile.velocity = (projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/CosmicViperSplittingRocket.cs b/Projectiles/Summon/CosmicViperSplittingRocket.cs index 96eb17d447..72c6ebf811 100644 --- a/Projectiles/Summon/CosmicViperSplittingRocket.cs +++ b/Projectiles/Summon/CosmicViperSplittingRocket.cs @@ -151,13 +151,11 @@ namespace CalamityMod.Projectiles.Summon } if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - float homingRatio = 15f; + float homingInertia = 15f; float homingVelocity = 30f; - projectile.velocity = (projectile.velocity * homingRatio + homeInVector * homingVelocity) / (homingRatio + 1f); + projectile.velocity = (projectile.velocity * homingInertia + moveDirection * homingVelocity) / (homingInertia + 1f); } projectile.frameCounter++; if (projectile.frameCounter > 3) @@ -210,7 +208,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 0b00106531..ac5c1bd993 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Summon projectile.MinionAntiClump(); - float detectRange = 700f; + float detectRange = 1100f; Vector2 targetVec = projectile.position; bool foundTarget = false; int targetIndex = -1; diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index 36a8963d37..58ac452d02 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -10,11 +10,14 @@ namespace CalamityMod.Projectiles.Summon { public class CosmilampMinion : ModProjectile { + public override string Texture => "CalamityMod/NPCs/Signus/CosmicLantern"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmilamp"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + Main.projFrames[projectile.type] = 4; } public override void SetDefaults() @@ -62,6 +65,18 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } + + projectile.frameCounter++; + if (projectile.frameCounter >= 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + 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; diff --git a/Projectiles/Summon/CosmilampMinion.png b/Projectiles/Summon/CosmilampMinion.png deleted file mode 100644 index 335f855c50..0000000000 Binary files a/Projectiles/Summon/CosmilampMinion.png and /dev/null differ diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index 97de782c29..c08d48f1bc 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -97,13 +97,6 @@ namespace CalamityMod.Projectiles.Summon return false; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index fac39b6bf0..f3b9591cd3 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -91,13 +91,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index f75f3d3f12..99c15ac208 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class DaedalusCrystalShot : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Crystal Shot"); diff --git a/Projectiles/Summon/DaedalusCrystalShot.png b/Projectiles/Summon/DaedalusCrystalShot.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Summon/DaedalusCrystalShot.png and /dev/null differ diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs new file mode 100644 index 0000000000..ef481613a1 --- /dev/null +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -0,0 +1,318 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.Projectiles.Summon +{ + public class DaedalusGolem : ModProjectile + { + public int AttackTimer; + public bool UsingChargedLaserAttack; + 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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Daedalus Golem"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AttackTimer); + writer.Write(UsingChargedLaserAttack); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + AttackTimer = reader.ReadInt32(); + UsingChargedLaserAttack = reader.ReadBoolean(); + } + + #region AI + public override void AI() + { + Main.projFrames[projectile.type] = 16; + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + Owner.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (Owner.dead) + Owner.Calamity().daedalusGolem = false; + + if (Owner.Calamity().daedalusGolem) + projectile.timeLeft = 2; + } + + AdjustMinionDamage(); + + // Fall down. + if (projectile.velocity.Y < 15f) + projectile.velocity.Y += Gravity; + + Vector2 destination; + NPC potentialTarget = projectile.Center.MinionHoming(900f, Owner); + if (potentialTarget is null) + destination = Owner.Center + Vector2.UnitX * (80f + (projectile.identity * 28f) % 560f); + else + destination = potentialTarget.Center + Vector2.UnitX * (130f + (projectile.identity * 28f) % 560f); + + // Go upwards, and check down again to discover any height differences before deciding where to move. + // There's a chance that this will encounter a null tile. If it us, just skip this step. + try + { + Vector2 upwardCheck = destination - Vector2.UnitY * 2400f; + upwardCheck.Y = Utils.Clamp(upwardCheck.Y, 0f, Main.maxTilesY * 16f - 100f); + WorldUtils.Find(upwardCheck.ToTileCoordinates(), Searches.Chain(new Searches.Down(200), new Conditions.IsSolid()), out Point loweredPoint); + destination = loweredPoint.ToWorldCoordinates(); + } + catch (NullReferenceException) { } + + StuckWalkThroughWallsTimer = Utils.Clamp(StuckWalkThroughWallsTimer, 0, 160); + + if (projectile.Distance(Owner.Center) > 3500f) + { + projectile.Center = Owner.Center; + StuckWalkThroughWallsTimer = 0; + projectile.netImportant = true; + } + if ((MoveToDestination(destination) || AttackTimer > 0) && potentialTarget != null) + { + AttackTimer++; + if (AttackTimer == 1) + { + UsingChargedLaserAttack = Main.rand.NextBool(7); + projectile.netUpdate = true; + } + + if (AttackTimer >= (UsingChargedLaserAttack ? ChargedLaserAttackTime : ChargedPelletAttackTime)) + { + AttackTimer = 0; + projectile.netUpdate = true; + } + + if (MathHelper.Distance(potentialTarget.Center.X, projectile.Center.X) > 30f) + projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X < 0).ToDirectionInt(); + + if (UsingChargedLaserAttack) + { + if (AttackTimer >= 45 && AttackTimer < ChargedLaserAttackTime / 2 && !Main.dedServ) + { + Vector2 drawOffset = Main.rand.NextVector2CircularEdge(12f, 12f); + Dust light = Dust.NewDustPerfect(ArmPosition + drawOffset, 261); + light.velocity = drawOffset.SafeNormalize(Vector2.Zero) * -2.5f; + light.color = Color.Lerp(Color.HotPink, Color.LightPink, Main.rand.NextFloat()); + light.scale = Main.rand.NextFloat(1.2f, 1.45f); + light.noGravity = true; + } + else if (AttackTimer >= ChargedLaserAttackTime / 2 && AttackTimer <= ChargedLaserAttackTime / 2 + 60 && AttackTimer % 10 == 9) + { + Main.PlaySound(SoundID.Item122, ArmPosition); + if (Main.myPlayer == projectile.owner) + { + 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)); + } + } + } + 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); + } + } + else if (potentialTarget is null && AttackTimer != 0) + { + AttackTimer = 0; + projectile.netUpdate = true; + } + } + + public void AdjustMinionDamage() + { + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int newDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + Owner.MinionDamage()); + projectile.damage = newDamage; + } + } + + public bool MoveToDestination(Vector2 destination) + { + Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(projectile.Bottom.X / 16), (int)(projectile.Bottom.Y / 16) + 1); + + // Float to the destination if stuck. + if (Stuck) + { + StuckJumpSpeed = 0f; + projectile.tileCollide = false; + + if (projectile.DistanceSQ(destination - Vector2.UnitY * 16f) > 10f * 10f) + projectile.velocity = projectile.SafeDirectionTo(destination - Vector2.UnitY * 16f) * 6f; + else + StuckWalkThroughWallsTimer = 0; + + StuckWalkThroughWallsTimer -= 4; + return false; + } + + 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)) + { + StuckJumpSpeed = 0f; + projectile.velocity.X *= 0.8f; + return true; + } + + 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) + 1); + + if (tileBelowAhead.IsTileSolidGround()) + break; + + tilesSearchedAhead++; + } + while (tilesSearchedAhead < 4); + + 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); + + // Jump if there's a gap or a wall. + 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)) + { + projectile.velocity.Y = -12f - StuckJumpSpeed; + projectile.netSpam -= 10; + StuckJumpSpeed += 3.5f; + StuckJumpSpeed = Utils.Clamp(StuckJumpSpeed, 0f, 14f); + + StuckWalkThroughWallsTimer += 10f; + + projectile.netUpdate = true; + } + else if (tilesSearchedAhead > 0) + { + projectile.velocity.X = 7f; + + projectile.velocity.Y = -(5f + tilesSearchedAhead * 2f); + projectile.netSpam -= 10; + projectile.netUpdate = true; + } + else + { + StuckJumpSpeed = 0f; + StuckWalkThroughWallsTimer -= 5f; + } + } + + projectile.spriteDirection = (Owner.Center.X - projectile.Center.X < 0).ToDirectionInt(); + return false; + } + #endregion + + // Prevent on-tile collision death. + 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; + return true; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + int startingWalkFrame = 6; + int endingWalkFrame = 10; + + int startingPelletFrame = 1; + int endingPelletFrame = 4; + + int startingBeamFrame = 11; + 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) + 1); + + if (Stuck) + { + projectile.frame = 5; + } + else if (AttackTimer > 0) + { + if (UsingChargedLaserAttack) + 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)); + } + 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))) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame >= endingWalkFrame) + projectile.frame = startingWalkFrame; + } + projectile.frame = Utils.Clamp(projectile.frame, startingWalkFrame, endingWalkFrame); + } + else if (Math.Abs(projectile.velocity.X) <= 1f) + { + projectile.frame = 0; + } + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/DaedalusGolem.png b/Projectiles/Summon/DaedalusGolem.png new file mode 100644 index 0000000000..56ae471ca9 Binary files /dev/null and b/Projectiles/Summon/DaedalusGolem.png differ diff --git a/Projectiles/Summon/DaedalusLightning.cs b/Projectiles/Summon/DaedalusLightning.cs new file mode 100644 index 0000000000..056a522d17 --- /dev/null +++ b/Projectiles/Summon/DaedalusLightning.cs @@ -0,0 +1,150 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +namespace CalamityMod.Projectiles.Summon +{ + public class DaedalusLightning : ModProjectile + { + internal PrimitiveTrail LightningDrawer; + + public const int MaximumBranchingIterations = 3; + public const float LightningTurnRandomnessFactor = 1.7f; + 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 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; + } + + 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; + + // 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) + { + projectile.velocity /= projectile.extraUpdates; + } + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AccumulatedXMovementSpeeds); + writer.Write(BranchingIteration); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + AccumulatedXMovementSpeeds = reader.ReadSingle(); + BranchingIteration = reader.ReadSingle(); + } + + public override void AI() + { + // frameCounter in this context is really just an arbitrary timer + // which allows random turning to occur. + projectile.frameCounter++; + + 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) + { + projectile.frameCounter = 0; + + float originalSpeed = MathHelper.Min(6f, projectile.velocity.Length()); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)BaseTurnAngleRatio); + int turnTries = 0; + Vector2 newBaseDirection = -Vector2.UnitY; + Vector2 potentialBaseDirection; + + do + { + BaseTurnAngleRatio = unifiedRandom.Next() % 100; + potentialBaseDirection = (BaseTurnAngleRatio / 100f * MathHelper.TwoPi).ToRotationVector2(); + + // Ensure that the new potential direction base is always moving upwards (this is supposed to be somewhat similar to a -UnitY + RotatedBy). + potentialBaseDirection.Y = -Math.Abs(potentialBaseDirection.Y); + + bool canChangeLightningDirection = true; + + // Potential directions with very little Y speed should not be considered, because this + // consequentially means that the X speed would be quite large. + if (potentialBaseDirection.Y > -0.02f) + canChangeLightningDirection = false; + + // 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) + { + canChangeLightningDirection = false; + } + + // If the above checks were all passed, redefine the base direction of the lightning. + if (canChangeLightningDirection) + newBaseDirection = potentialBaseDirection; + + turnTries++; + } + while (turnTries < 100); + + 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; + } + } + } + + #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; + return baseWidth * (float)Math.Sin(MathHelper.Pi * completionRatio); + } + internal Color ColorFunction(float completionRatio) + { + Color baseColor = Color.Lerp(Color.Pink, Color.HotPink, (float)Math.Sin(MathHelper.TwoPi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f); + return Color.Lerp(baseColor, Color.Red, ((float)Math.Sin(MathHelper.Pi * completionRatio + Main.GlobalTime * 4f) * 0.5f + 0.5f) * 0.8f); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + return false; + } + #endregion + } +} diff --git a/Projectiles/Summon/DaedalusLightning.png b/Projectiles/Summon/DaedalusLightning.png new file mode 100644 index 0000000000..f99e9c57d5 Binary files /dev/null and b/Projectiles/Summon/DaedalusLightning.png differ diff --git a/Projectiles/Summon/DaedalusPellet.cs b/Projectiles/Summon/DaedalusPellet.cs new file mode 100644 index 0000000000..99d908f1dd --- /dev/null +++ b/Projectiles/Summon/DaedalusPellet.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class DaedalusPellet : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + projectile.frameCounter = 0; + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 1f; + Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center); + } + projectile.alpha = Utils.Clamp(projectile.alpha - 50, 0, 255); + } + + public override Color? GetAlpha(Color lightColor) + { + 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); + return false; + } + } +} diff --git a/Projectiles/Summon/DaedalusPellet.png b/Projectiles/Summon/DaedalusPellet.png new file mode 100644 index 0000000000..b057abe312 Binary files /dev/null and b/Projectiles/Summon/DaedalusPellet.png differ diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index 5eb8d4bce0..99c39730e1 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -1,33 +1,24 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class DazzlingStabber : ModProjectile + public class DazzlingStabber : ModProjectile { - public float NPCTargetTimer - { - get => projectile.ai[0]; - set => projectile.ai[0] = value; - } - public float IdleOffsetAngle - { - get => projectile.ai[1]; - set => projectile.ai[1] = value; - } - public const float DistanceToCheck = 1500f; - public const float TeleportSlice = 40f; - public static readonly float TeleportSliceAngleMax = MathHelper.ToRadians(23f); + 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; } @@ -40,128 +31,144 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.ignoreWater = true; projectile.minionSlots = 1f; - projectile.timeLeft = 18000; + projectile.timeLeft = 90000; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft *= 5; projectile.minion = true; + projectile.light = 1f; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 12; + projectile.localNPCHitCooldown = 10; } public override void AI() { Lighting.AddLight(projectile.Center, Color.White.ToVector3()); - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + + ApplyPlayerBuffs(); + AdjustDamageDynamically(); + UpdateFrames(); + + NPC potentialTarget = projectile.Center.MinionHoming(1100f, Owner); + + if (potentialTarget != null) + SliceTarget(potentialTarget); + else + ReturnToRestingPosition(); + } + + public void ApplyPlayerBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().providenceStabber = false; + if (Owner.Calamity().providenceStabber) + projectile.timeLeft = 2; + } + } + + public void AdjustDamageDynamically() + { if (projectile.localAI[0] == 0f) { - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; projectile.localAI[0] = 1f; } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); projectile.damage = trueDamage; } - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isProperProjectile) - { - if (player.dead) - { - modPlayer.providenceStabber = false; - } - if (modPlayer.providenceStabber) - { - projectile.timeLeft = 2; - } - } + } - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); - - if (projectile.frameCounter++ > 6) - { + public void UpdateFrames() + { + projectile.frameCounter++; + if (projectile.frameCounter % 6 == 0) projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; - projectile.frameCounter = 0; - } - - if (potentialTarget is null) - { - projectile.rotation = projectile.rotation.AngleTowards(IdleOffsetAngle, 0.05f); - Vector2 destination = player.Center + new Vector2(0f, -120f).RotatedBy(IdleOffsetAngle); - projectile.velocity = (destination - projectile.Center) / 15f; - } - else - { - NPCTargetTimer++; - // Alternate between normal charge and slower charge/knife summon - if (NPCTargetTimer % 160f < 100f) - { - ChargeAttack(potentialTarget); - } - // Teleport onto the target and just the rotation for a slice. - else if (NPCTargetTimer % 160f == 160f - TeleportSlice) - { - TeleportOntoTarget(potentialTarget); - } - // Slice the target and don't move. - else if (NPCTargetTimer % 160f > 160f - TeleportSlice) - { - projectile.rotation -= TeleportSliceAngleMax * 2f / TeleportSlice; - } - } - projectile.direction = projectile.spriteDirection = (projectile.velocity.X > 0).ToDirectionInt(); } - public void ChargeAttack(NPC target) + public void SliceTarget(NPC target) { - if (NPCTargetTimer % 160f < 30f) + // Don't do anything if the attack delay is still passing. + if (AttackDelay > -60f) { - projectile.velocity *= 0.99f; - projectile.rotation = projectile.rotation.AngleLerp(projectile.AngleTo(target.Center) + MathHelper.PiOver2, 0.25f); + AttackDelay--; + if (AttackDelay > 0f) + return; } - else if (NPCTargetTimer % 160f == 30f) + + // 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 close to the target, slow down dramatically. + 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; + + float angularTurnSpeed = 0.35f; + 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 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) { - projectile.velocity = projectile.DirectionTo(target.Center) * 20f; + projectile.velocity = projectile.SafeDirectionTo(target.Center) * 36f; + AttackDelay = 15f; + + projectile.netUpdate = true; } - else if (NPCTargetTimer % 160f < 60f) - { - projectile.velocity *= 0.99f; - projectile.rotation = projectile.rotation.AngleLerp(projectile.AngleTo(target.Center) + MathHelper.PiOver2, 0.25f); - } - else if (NPCTargetTimer % 160f == 60f) - { - projectile.velocity = projectile.DirectionTo(target.Center) * 16f; - for (int i = 0; i < 3; i++) - { - float angle = MathHelper.Lerp(-0.3f, 0.3f, i / 3f); - Projectile.NewProjectile(projectile.Center, projectile.velocity.RotatedBy(angle), ModContent.ProjectileType(), (int)(projectile.damage * 0.25), 1f, projectile.owner); - } - } - else projectile.velocity *= 0.99f; + + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } - public void TeleportOntoTarget(NPC target) + public void ReturnToRestingPosition() { - // Spawn a spiral of holy flame dust. - float angleStart = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0; i < 30; i++) + 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; + } + + 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); + + Texture2D trailSegmentTexture = ModContent.GetTexture("CalamityMod/Projectiles/StarProj"); + for (int i = 2; i < projectile.oldPos.Length; i++) { - float angle = MathHelper.TwoPi / 30f * i + angleStart; - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * 10f, (int)CalamityDusts.ProfanedFire); - dust.velocity = angle.ToRotationVector2() * 5f * MathHelper.Lerp(1f, 0f, i % 6f / 6f); + 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); + + // 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); + + spriteBatch.Draw(trailSegmentTexture, + projectile.oldPos[i] + projectile.Size * 0.5f + new Vector2(0f, 8f).RotatedBy(projectile.rotation) - Main.screenPosition, + null, + color, + rotation, + trailSegmentTexture.Size() * 0.5f, + scale, + SpriteEffects.None, + 0f); } - - Vector2 teleportOffset = Utils.RandomVector2(Main.rand, -12f, 12f); - - projectile.Center = target.Center + teleportOffset; - projectile.rotation = projectile.AngleTo(target.Center) + MathHelper.PiOver2 + TeleportSliceAngleMax; - projectile.velocity = Vector2.Zero; - projectile.netUpdate = true; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Summon/DazzlingStabberKnife.cs b/Projectiles/Summon/DazzlingStabberKnife.cs deleted file mode 100644 index b3cfa88bfd..0000000000 --- a/Projectiles/Summon/DazzlingStabberKnife.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class DazzlingStabberKnife : ModProjectile - { - public const float HomingSpeed = 17f; - public const float HomingInertia = 20f; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Knife"); - ProjectileID.Sets.MinionShot[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 24; - projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.ignoreWater = true; - projectile.penetrate = 1; - projectile.timeLeft = 600; - } - public override void AI() - { - Lighting.AddLight(projectile.Center, Color.White.ToVector3()); - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; - NPC potentialTarget = projectile.Center.MinionHoming(750f, Main.player[projectile.owner]); - if (potentialTarget != null) - { - if (projectile.Distance(potentialTarget.Center) > 70f) - { - projectile.velocity = (projectile.velocity * (HomingInertia - 1f) + projectile.DirectionTo(potentialTarget.Center) * HomingSpeed) / HomingInertia; - } - } - } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Summon/DazzlingStabberKnife.png b/Projectiles/Summon/DazzlingStabberKnife.png deleted file mode 100644 index 35d51ec4d1..0000000000 Binary files a/Projectiles/Summon/DazzlingStabberKnife.png and /dev/null differ diff --git a/Projectiles/Summon/DeathstareBeam.cs b/Projectiles/Summon/DeathstareBeam.cs new file mode 100644 index 0000000000..e9804eb637 --- /dev/null +++ b/Projectiles/Summon/DeathstareBeam.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class DeathstareBeam : ModProjectile + { + public ref float OwnerUUID => ref projectile.ai[0]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + 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; + } + public override void AI() + { + if (!Main.projectile.IndexInRange((int)OwnerUUID)) + { + 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; + } + 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; + + if (Math.Abs(projectile.rotation - MathHelper.PiOver2) > 0.008f) + spriteBatch.Draw(beamTexture, drawPosition, null, color, projectile.rotation, beamTexture.Frame().Bottom(), drawScale, SpriteEffects.None, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/DeathstareBeam.png b/Projectiles/Summon/DeathstareBeam.png new file mode 100644 index 0000000000..a47f130bae Binary files /dev/null and b/Projectiles/Summon/DeathstareBeam.png differ diff --git a/Projectiles/Summon/DeathstareEyePupil.png b/Projectiles/Summon/DeathstareEyePupil.png new file mode 100644 index 0000000000..ea9db1fb5d Binary files /dev/null and b/Projectiles/Summon/DeathstareEyePupil.png differ diff --git a/Projectiles/Summon/DeathstareEyeball.cs b/Projectiles/Summon/DeathstareEyeball.cs new file mode 100644 index 0000000000..3845740cb1 --- /dev/null +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -0,0 +1,181 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class DeathstareEyeball : ModProjectile + { + // 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 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; + } + + 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; + } + + #region AI + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.Blue.ToVector3()); + + bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); + CalamityPlayer modPlayer = Owner.Calamity(); + Owner.AddBuff(ModContent.BuffType(), 3600); + + // Ensure that the projectile executing this code is a valid one. + if (isCorrectMinion) + { + if (Owner.dead) + modPlayer.deathstareEyeball = false; + if (modPlayer.deathstareEyeball) + projectile.timeLeft = 2; + } + + Vector2 destination = Owner.Center + Vector2.UnitY * (Owner.gfxOffY - 110f); + if (Owner.gravDir == -1f) + 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.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.localAI[0] == 0f) + { + Initialize(Owner); + projectile.localAI[0] = 1f; + } + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + Owner.MinionDamage()); + projectile.damage = trueDamage; + } + + NPC potentialTarget = projectile.Center.MinionHoming(720f, Owner); + + if (potentialTarget is null) + DoHoveringAI(); + else + DoAttackingAI(potentialTarget); + + projectile.frame = (int)(Time / 5) % 4; + + Time++; + } + + 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) + { + float idealAngle = Utils.InverseLerp(120f, 180f, Time % 180f, true) * MathHelper.TwoPi; + + PupilAngle = PupilAngle.AngleTowards(idealAngle, MathHelper.ToRadians(12f)); + PupilOutwardness = MathHelper.Lerp(PupilOutwardness, 4f, 0.2f); + } + else + { + float idealOutwardness = MathHelper.Clamp(Owner.velocity.Length() * 0.5f, 0f, 5f); + float idealAngle = Owner.velocity.ToRotation(); + + PupilOutwardness = MathHelper.Lerp(PupilOutwardness, idealOutwardness, 0.2f); + PupilAngle = PupilAngle.AngleTowards(idealAngle, MathHelper.ToRadians(12f)); + } + } + + public void DoAttackingAI(NPC target) + { + PupilOutwardness = MathHelper.Lerp(PupilOutwardness, 4f, 0.25f); + + if (Time % BeamFireRate == BeamFireRate - 20) + { + 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); + Main.projectile[beam].Damage(); + } + PupilScale = 1.5f; + } + + // After firing, have the pupil retract a bit. + if (Time % BeamFireRate > BeamFireRate - 20) + { + PupilScale = MathHelper.Lerp(PupilScale, 0.7f, 0.15f); + } + // Otherwise, have it behave like normal. + else + { + PupilScale = MathHelper.Lerp(PupilScale, 1f, 0.175f); + 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; + + if (!Main.dedServ) + return; + + for (int i = 0; i < 25; i++) + { + Dust dust = Dust.NewDustDirect(projectile.position, 52, 52, DustID.Blood); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.5f); + } + } + + #endregion + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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); + + // Pupil drawing. + Texture2D pupilTexture = ModContent.GetTexture("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); + return false; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/DeathstareEyeball.png b/Projectiles/Summon/DeathstareEyeball.png new file mode 100644 index 0000000000..6825c3c664 Binary files /dev/null and b/Projectiles/Summon/DeathstareEyeball.png differ diff --git a/Projectiles/Summon/DormantBrimseekerAura.cs b/Projectiles/Summon/DormantBrimseekerAura.cs index b32d163158..bfc7818c92 100644 --- a/Projectiles/Summon/DormantBrimseekerAura.cs +++ b/Projectiles/Summon/DormantBrimseekerAura.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class DormantBrimseekerAura : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Summon/DormantBrimseeker"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dormant Brimseeker Aura Projecter"); diff --git a/Projectiles/Summon/DormantBrimseekerAura.png b/Projectiles/Summon/DormantBrimseekerAura.png deleted file mode 100644 index 05cc154fbb..0000000000 Binary files a/Projectiles/Summon/DormantBrimseekerAura.png and /dev/null differ diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index e9c08e0989..4b4ed9b1f2 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Summon } Vector2 destination = player.Center + projectile.ai[1].ToRotationVector2() * new Vector2(1f, (float)Math.Cos(projectile.ai[1])) * 200f; - projectile.velocity = (projectile.velocity * 18f + projectile.DirectionTo(destination) * 14f) / 20f; + projectile.velocity = (projectile.velocity * 18f + projectile.SafeDirectionTo(destination) * 14f) / 20f; projectile.frameCounter++; if (projectile.frameCounter >= 6) @@ -109,8 +109,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = (projectile.localAI[1] == 1f).ToInt() * 4; } - - projectile.MinionAntiClump(0.1f); + + projectile.MinionAntiClump(0.1f); if (projectile.Distance(player.Center) > 2700f) { projectile.Center = player.Center; @@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Summon 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.DirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + acceleration, minSpeed, maxSpeed); + 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) @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon 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.DirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + 2f, 6f, 15f); + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * MathHelper.Clamp(projectile.velocity.Length() + 2f, 6f, 15f); SeekingTarget = true; projectile.ai[0] = 0f; } diff --git a/Projectiles/Summon/DormantBrimseekerSummoner.cs b/Projectiles/Summon/DormantBrimseekerSummoner.cs index 9c82495d12..70cfe54ec9 100644 --- a/Projectiles/Summon/DormantBrimseekerSummoner.cs +++ b/Projectiles/Summon/DormantBrimseekerSummoner.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class DormantBrimseekerSummoner : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Summon/DormantBrimseeker"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dormant Brimseeker"); diff --git a/Projectiles/Summon/DormantBrimseekerSummoner.png b/Projectiles/Summon/DormantBrimseekerSummoner.png deleted file mode 100644 index 05cc154fbb..0000000000 Binary files a/Projectiles/Summon/DormantBrimseekerSummoner.png and /dev/null differ diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index 05e0a97089..7352e8b006 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -69,21 +69,21 @@ namespace CalamityMod.Projectiles.Summon { Projectile.NewProjectile(projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + 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, 3f, 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, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), projectile.damage, 3f, projectile.owner); + 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, 3f, projectile.owner); + 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, 3f, projectile.owner); + ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } // WoF vomit sound. Main.PlaySound(SoundID.NPCKilled, projectile.Center, 13); @@ -95,6 +95,8 @@ namespace CalamityMod.Projectiles.Summon { projectile.velocity.Y = 10f; } + + projectile.StickToTiles(false, false); } public override bool CanDamage() => false; diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index 7cf3f115c5..cb5dd7e234 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.tileCollide = false; projectile.extraUpdates = 1; - projectile.usesIDStaticNPCImmunity = true; - projectile.idStaticNPCHitCooldown = 6; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; } public override void AI() @@ -59,11 +59,11 @@ namespace CalamityMod.Projectiles.Summon player.AddBuff(ModContent.BuffType(), 3600); if (flag64) { - if (player.dead) - { - modPlayer.eAxe = false; - } - if (modPlayer.eAxe) + if (player.dead) + { + modPlayer.eAxe = false; + } + if (modPlayer.eAxe) { projectile.timeLeft = 2; } @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Summon/EndoBeam.cs b/Projectiles/Summon/EndoBeam.cs index b35201bca1..6f234bf436 100644 --- a/Projectiles/Summon/EndoBeam.cs +++ b/Projectiles/Summon/EndoBeam.cs @@ -3,13 +3,16 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.ID; using Terraria.Enums; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class EndoBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + // For if this laser should stop firing if it hits a tile private static bool LaserTileCollision = false; @@ -36,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = timeToExist; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; - projectile.coldDamage = true; + projectile.coldDamage = true; } // Netcode for sending and receiving shit @@ -199,10 +202,5 @@ namespace CalamityMod.Projectiles.Summon } return false; } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(ModLoader.GetMod("CalamityMod").BuffType("GodSlayerInferno"), 300); - } } } diff --git a/Projectiles/Summon/EndoBeam.png b/Projectiles/Summon/EndoBeam.png deleted file mode 100644 index 61eebb9472..0000000000 Binary files a/Projectiles/Summon/EndoBeam.png and /dev/null differ diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index 9294fffd71..c9a37b48fc 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -340,7 +340,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -352,8 +352,8 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 180); } diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index 3457d54020..3e95b267c3 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.ai[0] == 2f) return false; - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -150,8 +150,8 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 180); } diff --git a/Projectiles/Summon/EndoFire.cs b/Projectiles/Summon/EndoFire.cs index 11cbebd619..d88bab58f6 100644 --- a/Projectiles/Summon/EndoFire.cs +++ b/Projectiles/Summon/EndoFire.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class EndoFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool speedXChoice = false; public bool speedYChoice = false; @@ -103,8 +105,8 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 90); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 180); } } diff --git a/Projectiles/Summon/EndoFire.png b/Projectiles/Summon/EndoFire.png deleted file mode 100644 index 04c5646fde..0000000000 Binary files a/Projectiles/Summon/EndoFire.png and /dev/null differ diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index d3649cfe2e..6352c75f0e 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -1,3 +1,4 @@ +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -118,9 +119,7 @@ namespace CalamityMod.Projectiles.Summon if (targetAliveAndInLineOfSight && target.CanBeChasedBy() && Main.myPlayer == projectile.owner) { if (Time % 40f == 24f) - { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(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; @@ -154,7 +153,7 @@ namespace CalamityMod.Projectiles.Summon if (distanceFromTarget > 7f) { float speed = MathHelper.Lerp(2f, 17f, Utils.InverseLerp(10f, 70f, distanceFromTarget, true)); - projectile.velocity = (projectile.velocity * 9f + projectile.DirectionTo(returnPosition) * speed) / 10f; + projectile.velocity = (projectile.velocity * 9f + projectile.SafeDirectionTo(returnPosition) * speed) / 10f; } if (projectile.Center.Y > body.Center.Y - 50f) @@ -168,6 +167,7 @@ namespace CalamityMod.Projectiles.Summon projectile.MinionAntiClump(0.15f); AdjustOldVelocityArray(); } + public void AdjustOldVelocityArray() { for (int i = OldVelocities.Length - 1; i > 0; i--) @@ -176,6 +176,7 @@ namespace CalamityMod.Projectiles.Summon } OldVelocities[0] = projectile.velocity; } + public override void Kill(int timeLeft) { for (int i = 0; i < 10; i++) diff --git a/Projectiles/Summon/EndoIceShard.cs b/Projectiles/Summon/EndoIceShard.cs index 965991c921..023186e28b 100644 --- a/Projectiles/Summon/EndoIceShard.cs +++ b/Projectiles/Summon/EndoIceShard.cs @@ -124,14 +124,14 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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(), 90); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 180); } } diff --git a/Projectiles/Summon/EndoRay.cs b/Projectiles/Summon/EndoRay.cs index 9ca295f9cf..1ad285a510 100644 --- a/Projectiles/Summon/EndoRay.cs +++ b/Projectiles/Summon/EndoRay.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Summon { public class EndoRay : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ray"); diff --git a/Projectiles/Summon/EndoRay.png b/Projectiles/Summon/EndoRay.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Summon/EndoRay.png and /dev/null differ diff --git a/Projectiles/Summon/EnergyOrb.cs b/Projectiles/Summon/EnergyOrb.cs index 8f324ed043..aa64f7219c 100644 --- a/Projectiles/Summon/EnergyOrb.cs +++ b/Projectiles/Summon/EnergyOrb.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class EnergyOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/BlueBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Energy Orb"); @@ -30,70 +32,14 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { - for (int num468 = 0; num468 < 1; num468++) - { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - Player player = Main.player[projectile.owner]; - - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (!flag17) - { - for (int num475 = 0; num475 < Main.maxNPCs; num475++) - { - NPC npc = Main.npc[num475]; - if (npc.CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; + 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]); + if (potentialTarget != null) + 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/EnergyOrb.png b/Projectiles/Summon/EnergyOrb.png deleted file mode 100644 index 479a56ea6c..0000000000 Binary files a/Projectiles/Summon/EnergyOrb.png and /dev/null differ diff --git a/Projectiles/Summon/EyeOfNightCell.cs b/Projectiles/Summon/EyeOfNightCell.cs new file mode 100644 index 0000000000..9c67226c3c --- /dev/null +++ b/Projectiles/Summon/EyeOfNightCell.cs @@ -0,0 +1,54 @@ +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class EyeOfNightCell : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cell"); + 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 = -1; + projectile.timeLeft = 180; + projectile.extraUpdates = 1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 19; + } + + public override void AI() + { + if (!Main.dedServ && projectile.velocity.Length() > 5f) + Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid).noGravity = true; + + projectile.StickyProjAI(360); + } + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60); + projectile.Damage(); + + if (!Main.dedServ) + for (int i = 0; i < 10; i++) + 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(10, false); + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.CursedInferno, 120); + + public override void OnHitPvp(Player target, int damage, bool crit) => target.AddBuff(BuffID.CursedInferno, 120); + } +} diff --git a/Projectiles/Summon/EyeOfNightCell.png b/Projectiles/Summon/EyeOfNightCell.png new file mode 100644 index 0000000000..99bc8669bf Binary files /dev/null and b/Projectiles/Summon/EyeOfNightCell.png differ diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs new file mode 100644 index 0000000000..d558709329 --- /dev/null +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -0,0 +1,137 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class EyeOfNightSummon : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() + { + ProvidePlayerMinionBuffs(); + DynamicallyUpdateDamage(); + GenerateVisuals(); + NPC potentialTarget = projectile.Center.MinionHoming(750f, Owner); + if (potentialTarget is null) + FlyNearOwner(); + else + AttackTarget(potentialTarget); + } + + internal void ProvidePlayerMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + + // 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()) + return; + + if (Owner.dead) + Owner.Calamity().eyeOfNight = false; + if (Owner.Calamity().eyeOfNight) + projectile.timeLeft = 2; + } + + internal void DynamicallyUpdateDamage() + { + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if (Owner.MinionDamage() == projectile.Calamity().spawnedPlayerMinionDamageValue) + return; + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + projectile.damage = trueDamage; + } + + internal void GenerateVisuals() + { + // The code within this method is visual. There is no need to waste resources executing it on the server. + if (Main.dedServ) + return; + + 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; + + if (!projectile.WithinRange(Owner.Center, 1800f)) + { + projectile.Center = Owner.Center; + projectile.velocity = -Vector2.UnitY * 4f; + projectile.netUpdate = true; + } + + // Slow down a bit over time. + projectile.velocity *= 0.985f; + } + + internal void AttackTarget(NPC target) + { + 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); + HoverTime++; + } + + Vector2 destination = target.Center; + 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.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)); + + if (projectile.WithinRange(destination, 24f + target.velocity.Length() * 2f)) + HoverTime++; + + projectile.velocity = (destination - projectile.Center).SafeNormalize(Vector2.Zero) * flySpeed; + } + } +} \ No newline at end of file diff --git a/Projectiles/Summon/EyeOfNightSummon.png b/Projectiles/Summon/EyeOfNightSummon.png new file mode 100644 index 0000000000..7caaf49286 Binary files /dev/null and b/Projectiles/Summon/EyeOfNightSummon.png differ diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 3339600f83..1269feae56 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class FlameBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public float count = 0; public override void SetStaticDefaults() @@ -68,74 +70,9 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num469].velocity *= 0f; } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - else if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (!flag17) - { - for (int i = 0; i < Main.maxNPCs; ++i) - { - NPC npc = Main.npc[i]; - if (npc is null || !npc.active) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 25f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + NPC potentialTarget = projectile.Center.MinionHoming(300f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 25f) / 21f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/FlameBlast.png b/Projectiles/Summon/FlameBlast.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Summon/FlameBlast.png and /dev/null differ diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 795bf3520a..00d7233e4d 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class FlameBurst : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private float count = 0; public override void SetStaticDefaults() @@ -68,74 +70,9 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num469].velocity *= 0f; } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 1200f; - bool flag17 = false; - int target = (int)projectile.ai[0]; - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - else if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) - { - float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); - float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - if (!flag17) - { - for (int i = 0; i < Main.maxNPCs; ++i) - { - NPC npc = Main.npc[i]; - if (npc is null || !npc.active) - continue; - - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.position.X + (float)(npc.width / 2); - float num477 = npc.position.Y + (float)(npc.height / 2); - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 21f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/FlameBurst.png b/Projectiles/Summon/FlameBurst.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Summon/FlameBurst.png and /dev/null differ diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs new file mode 100644 index 0000000000..ba44c8210d --- /dev/null +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -0,0 +1,165 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 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; + } + + 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; + } + + public override void AI() + { + ProvidePlayerMinionBuffs(); + DetermineFrames(); + GenerateVisuals(); + + HopTimer++; + SufferFromSeparationAnxiety(); + NPC potentialTarget = projectile.Center.MinionHoming(950f, Owner); + if (potentialTarget is null) + GoNearOwner(); + else + AttackTarget(potentialTarget); + EnforceGravity(); + } + + internal void ProvidePlayerMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + + // 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()) + return; + + if (Owner.dead) + Owner.Calamity().fleshBall = false; + if (Owner.Calamity().fleshBall) + projectile.timeLeft = 2; + } + + internal void DetermineFrames() + { + 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; + } + + internal void GenerateVisuals() + { + // All code within this method is visual. There is no need to waste resources executing it on the server. + if (Main.dedServ) + return; + + 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); + 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)) + { + projectile.Center = Owner.Center; + projectile.netUpdate = true; + } + } + + internal void GoNearOwner() + { + projectile.tileCollide = true; + + 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); + + // Don't collide with tiles for 1 frame, to prevent slopes from being a nuisance. + projectile.tileCollide = false; + projectile.netUpdate = true; + } + } + + internal void AttackTarget(NPC target) + { + projectile.tileCollide = true; + + if (SittingOnGround && HopTimer % 20f == 19f) + { + projectile.velocity = projectile.SafeDirectionTo(target.Center) * 6f + new Vector2(Math.Sign(projectile.velocity.X) * 2f, -7f); + + // Release a bunch of blood. + if (Main.myPlayer == projectile.owner) + { + for (int i = 0; i < Main.rand.Next(1, 4 + 1); 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); + if (Main.projectile.IndexInRange(blood)) + { + Main.projectile[blood].Calamity().forceMinion = true; + Main.projectile[blood].penetrate = 1; + } + } + } + + // Don't collide with tiles for 1 frame, to prevent slopes from being a nuisance. + 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; + return false; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + fallThrough = projectile.Bottom.Y < Owner.Top.Y; + return true; + } + } +} diff --git a/Projectiles/Summon/FleshBallMinion.png b/Projectiles/Summon/FleshBallMinion.png new file mode 100644 index 0000000000..955f105050 Binary files /dev/null and b/Projectiles/Summon/FleshBallMinion.png differ diff --git a/Projectiles/Summon/FlowersOfMortalityCore.png b/Projectiles/Summon/FlowersOfMortalityCore.png new file mode 100644 index 0000000000..8e10fb5b09 Binary files /dev/null and b/Projectiles/Summon/FlowersOfMortalityCore.png differ diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.cs b/Projectiles/Summon/FlowersOfMortalityPetal.cs new file mode 100644 index 0000000000..b4478dfbeb --- /dev/null +++ b/Projectiles/Summon/FlowersOfMortalityPetal.cs @@ -0,0 +1,106 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +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 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; + } + + 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.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectMinion) + { + if (player.dead) + modPlayer.flowersOfMortality = false; + if (modPlayer.flowersOfMortality) + projectile.timeLeft = 2; + } + + SetProjectileDamage(); + + Time++; + NPC potentialTarget = projectile.Center.MinionHoming(1050f, Owner, false); + 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 / 3, projectile.knockBack, projectile.owner); + } + 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) + { + 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.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; + } + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + Owner.MinionDamage()); + 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"); + 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); + + return false; + } + } +} diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.png b/Projectiles/Summon/FlowersOfMortalityPetal.png new file mode 100644 index 0000000000..a32bdc4d1e Binary files /dev/null and b/Projectiles/Summon/FlowersOfMortalityPetal.png differ diff --git a/Projectiles/Summon/FlyingOrthocera.cs b/Projectiles/Summon/FlyingOrthocera.cs index 423efb030a..f77650b307 100644 --- a/Projectiles/Summon/FlyingOrthocera.cs +++ b/Projectiles/Summon/FlyingOrthocera.cs @@ -68,9 +68,7 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0]++ % 30f == 29f) { if (projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 11f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); - } + Projectile.NewProjectile(projectile.Center, projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY) * 11f, ModContent.ProjectileType(), projectile.damage, 4f, projectile.owner); } } else diff --git a/Projectiles/Summon/FlyingOrthoceraStream.cs b/Projectiles/Summon/FlyingOrthoceraStream.cs index 05c7530ecd..3f86b8bd40 100644 --- a/Projectiles/Summon/FlyingOrthoceraStream.cs +++ b/Projectiles/Summon/FlyingOrthoceraStream.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class FlyingOrthoceraStream : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Acid Stream"); diff --git a/Projectiles/Summon/FlyingOrthoceraStream.png b/Projectiles/Summon/FlyingOrthoceraStream.png deleted file mode 100644 index 2f776c6c06..0000000000 Binary files a/Projectiles/Summon/FlyingOrthoceraStream.png and /dev/null differ diff --git a/Projectiles/Summon/FrostBeam.cs b/Projectiles/Summon/FrostBeam.cs index 2f5caea681..29f69f7504 100644 --- a/Projectiles/Summon/FrostBeam.cs +++ b/Projectiles/Summon/FrostBeam.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class FrostBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index 6f0b771a20..53a6441b6d 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -87,11 +87,9 @@ namespace CalamityMod.Projectiles.Summon 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.DirectionTo(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/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index b48421bd07..bb7b4fb9ef 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon public class FungalClumpMinion : ModProjectile { private bool returnToPlayer = false; - private bool amalgam = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fungal Clump"); @@ -58,7 +58,6 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - amalgam = projectile.ai[0] == 1f; //Initializing dust and damage if (projectile.localAI[0] == 0f) @@ -97,22 +96,11 @@ namespace CalamityMod.Projectiles.Summon //Anti-sticky movement failsafe projectile.MinionAntiClump(); - //If summoned by Amalgam, trail poisonous seawater - if (Math.Abs(projectile.velocity.X) > 0.1f || Math.Abs(projectile.velocity.Y) > 0.1f) - { - if (projectile.owner == Main.myPlayer && amalgam) - { - int water = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, 1f, 0f); - Main.projectile[water].usesIDStaticNPCImmunity = true; - Main.projectile[water].usesLocalNPCImmunity = false; - } - } - //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) - playerRange = amalgam ? 2000f : 1400f; + playerRange = 1400f; if (Math.Abs(projectile.Center.X - player.Center.X) + Math.Abs(projectile.Center.Y - player.Center.Y) > playerRange) returnToPlayer = true; @@ -169,10 +157,10 @@ namespace CalamityMod.Projectiles.Summon if (!npcFound) { projectile.friendly = true; - float homingSpeed = amalgam ? 12f : 8f; + float homingSpeed = 8f; float turnSpeed = 20f; if (returnToPlayer) //move faster if returning to the player - homingSpeed = amalgam ? 30f : 12f; + homingSpeed = 12f; Vector2 playerVector = player.Center - projectile.Center; playerVector.Y -= 60f; float playerDist = playerVector.Length(); @@ -217,20 +205,14 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[1] == 0f) { projectile.friendly = true; - float minionSpeed = amalgam ? 20f : 8f; + float minionSpeed = 8f; float turnSpeed = 14f; - Vector2 targetLocation = targetVec - projectile.Center; - float targetDist = targetLocation.Length(); + float targetDist = projectile.Distance(targetVec); if (targetDist < 100f) - minionSpeed = amalgam ? 25f : 10f; + minionSpeed = 10f; - Vector2 homeInVector = projectile.DirectionTo(targetLocation); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - targetLocation.Normalize(); - targetLocation *= minionSpeed; - projectile.velocity = (projectile.velocity * turnSpeed + targetLocation) / (turnSpeed + 1f); + Vector2 homingVelocity = projectile.SafeDirectionTo(targetVec) * minionSpeed; + projectile.velocity = (projectile.velocity * turnSpeed + homingVelocity) / (turnSpeed + 1f); } else { @@ -247,22 +229,20 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy || !target.canGhostHeal) - { + if (!target.canGhostHeal) return; - } + float healAmt = damage * 0.25f; if ((int)healAmt == 0) - { return; - } + if (Main.player[Main.myPlayer].lifeSteal <= 0f) - { return; - } - if (healAmt > 50f) - healAmt = 50f; - CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 1f); + + if (healAmt > CalamityMod.lifeStealCap) + healAmt = CalamityMod.lifeStealCap; + + CalamityGlobalProjectile.SpawnLifeStealProjectile(projectile, Main.player[projectile.owner], healAmt, ModContent.ProjectileType(), 1200f, 3f); } public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Summon/GammaBullet.cs b/Projectiles/Summon/GammaBullet.cs deleted file mode 100644 index ead4b2300a..0000000000 --- a/Projectiles/Summon/GammaBullet.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class GammaBullet : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Gamma Bullet"); - 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 = 180; - projectile.tileCollide = true; - projectile.ignoreWater = true; - } - public override void AI() - { - Lighting.AddLight(projectile.Center, Color.White.ToVector3() * 1.25f); - projectile.ai[1]++; - if (projectile.ai[1] <= 20f) - { - projectile.alpha = (int)MathHelper.Lerp(255, 0, projectile.ai[1] / 20f); - } - if (projectile.ai[1] % 10f == 9f) - { - for (int i = 0; i < 24; i++) - { - float angle = MathHelper.TwoPi / 24f * i; - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2().RotatedBy(projectile.rotation) * new Vector2(7f, 4f), (int)CalamityDusts.SulfurousSeaAcid); - dust.scale = 0.9f; - dust.alpha = projectile.alpha; - dust.noGravity = true; - } - } - projectile.velocity *= 1.03f; - projectile.rotation = projectile.velocity.ToRotation(); - } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 240); - } - 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); - 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); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 3f; - } - } - } -} diff --git a/Projectiles/Summon/GammaBullet.png b/Projectiles/Summon/GammaBullet.png deleted file mode 100644 index 942ef43445..0000000000 Binary files a/Projectiles/Summon/GammaBullet.png and /dev/null differ diff --git a/Projectiles/Summon/GammaCanister.cs b/Projectiles/Summon/GammaCanister.cs index c997d37fc3..4e73e67f94 100644 --- a/Projectiles/Summon/GammaCanister.cs +++ b/Projectiles/Summon/GammaCanister.cs @@ -1,14 +1,13 @@ -using CalamityMod.Dusts; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class GammaCanister : ModProjectile { + public const float Gravity = 0.2f; public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Canister"); @@ -19,75 +18,38 @@ namespace CalamityMod.Projectiles.Summon { projectile.width = 20; projectile.height = 28; - projectile.friendly = projectile.hostile = false; + 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() { - if (!Main.player[projectile.owner].Calamity().GammaCanisters.Contains(projectile.whoAmI)) + NPC potentialTarget = projectile.Center.MinionHoming(1450f, Main.player[projectile.owner]); + if (projectile.timeLeft >= 180) + projectile.velocity.Y += Gravity; + + else if (potentialTarget != null) { - Main.player[projectile.owner].Calamity().GammaCanisters.Add(projectile.whoAmI); + // 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.ai[1]++; - if (projectile.ai[1] == 80f) - { - for (int i = 0; i < 36; i++) - { - Vector2 velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(3f, 8f); - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = velocity; - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(1.3f, 1.7f); - } - } - projectile.velocity = Vector2.UnitY * (float)Math.Sin(projectile.ai[1] / 40f * MathHelper.TwoPi) * 0.5f; - } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - const float totalRotations = 3f; - const float outwardPositionDeltaStart = 8f; - float angle = MathHelper.TwoPi * projectile.ai[1] / totalRotations / 80f; - float outwardPositionDelta = outwardPositionDeltaStart; - if (projectile.ai[1] < 80f && projectile.ai[1] > 55f) - { - outwardPositionDelta = MathHelper.Lerp(outwardPositionDeltaStart, 0f, (projectile.ai[1] - 55f) / 35f); - } - if (projectile.ai[1] >= 80f) - { - outwardPositionDelta = 0f; - } - for (int i = 0; i < 3; i++) - { - angle += MathHelper.TwoPi / 3f * i; - spriteBatch.Draw(ModContent.GetTexture(Texture), - projectile.Center + angle.ToRotationVector2() * outwardPositionDelta + Vector2.UnitY * (float)Math.Cos(angle) * 3f - Main.screenPosition, - null, - Color.White, - projectile.rotation, - projectile.Size * 0.5f, - projectile.scale, - SpriteEffects.None, - 0f); - } - return false; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + projectile.alpha = Utils.Clamp(projectile.alpha - 22, 0, 255); } + public override void Kill(int timeLeft) { - Main.player[projectile.owner].Calamity().GammaCanisters.Clear(); - for (int i = 0; i < 12; i++) + if (Main.myPlayer != projectile.owner) + return; + + for (int i = 0; i < 6; i++) { - 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; - Main.dust[idx].scale = 1.8f; - 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; - Main.dust[idx].scale = 1.8f; + 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); } } } diff --git a/Projectiles/Summon/GammaDeathray.png b/Projectiles/Summon/GammaDeathray.png deleted file mode 100644 index 1e24eea3ca..0000000000 Binary files a/Projectiles/Summon/GammaDeathray.png and /dev/null differ diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 759fe64824..d989b40b4b 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -1,10 +1,11 @@ using CalamityMod.Buffs.Summon; +using CalamityMod.DataStructures; using CalamityMod.Dusts; -using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,14 +14,20 @@ namespace CalamityMod.Projectiles.Summon { public class GammaHead : ModProjectile { - public Vector2 DeltaPosition; - public int BulletShootCounter; - public float AngularMultiplier1; - public float AngularMultiplier2; - public const int MaximumLaserCount = 6; // Otherwise intense lag ensues. - public const float AttackStartWait = 30f; - public const float SuperchargeTimeMax = 540f; - public const float DistanceToCheck = 1000f; + 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 Vector2 DrawStartPosition + { + get + { + if (projectile.owner < 0 || projectile.owner >= Main.player.Length) + return Vector2.Zero; + return Main.player[projectile.owner].Top + Vector2.UnitY * 8f; + } + } public override void SetStaticDefaults() { DisplayName.SetDefault("Gamma Head"); @@ -42,278 +49,217 @@ namespace CalamityMod.Projectiles.Summon projectile.tileCollide = false; projectile.timeLeft *= 5; projectile.minion = true; - projectile.coldDamage = true; - } - public Vector2 DrawStartPosition - { - get - { - if (projectile.owner < 0 || projectile.owner >= Main.player.Length) - return Vector2.Zero; - return Main.player[projectile.owner].Top + Vector2.UnitY * 8f; - } - } - public override void ReceiveExtraAI(BinaryReader reader) - { - BulletShootCounter = reader.ReadInt32(); - AngularMultiplier1 = reader.ReadSingle(); - AngularMultiplier2 = reader.ReadSingle(); - DeltaPosition = reader.ReadVector2(); } + public override void SendExtraAI(BinaryWriter writer) { - writer.Write(BulletShootCounter); - writer.Write(AngularMultiplier1); - writer.Write(AngularMultiplier2); - writer.WriteVector2(DeltaPosition); + writer.WritePackedVector2(CurrentPositionOffset); + writer.WritePackedVector2(IdealPositionOffset); } + + public override void ReceiveExtraAI(BinaryReader reader) + { + CurrentPositionOffset = reader.ReadPackedVector2(); + IdealPositionOffset = reader.ReadPackedVector2(); + } + public override void AI() { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); + Vector2 returnPosition = DrawStartPosition + CurrentPositionOffset; if (projectile.localAI[0] == 0f) { - int totalHeads = CalamityUtils.CountProjectiles(projectile.type); - DeltaPosition = new Vector2(Main.rand.NextFloat(-42f - 6f * totalHeads, 42f + 6f * totalHeads), -Main.rand.NextFloat(8f, 64f + 7f * totalHeads)); - - projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - - AngularMultiplier1 = Main.rand.NextFloat(3f); - AngularMultiplier2 = Main.rand.NextFloat(3f); - projectile.netUpdate = true; + PerformInitializationEffects(); projectile.localAI[0] = 1f; - } - - bool isProperProjectile = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isProperProjectile) - { - if (player.dead) - { - modPlayer.gammaHead = false; - } - if (modPlayer.gammaHead) - { - projectile.timeLeft = 2; - } } - if (modPlayer.GammaCanisters.Count > 0) - { - for (int i = 0; i < modPlayer.GammaCanisters.Count; i++) - { - if (projectile.Hitbox.Intersects(Main.projectile[modPlayer.GammaCanisters[i]].Hitbox) && - Main.projectile[modPlayer.GammaCanisters[i]].active) - { - int laserCount = 0; - for (int j = 0; j < Main.projectile.Length; j++) - { - if (laserCount < MaximumLaserCount) - { - if (Main.projectile[j].type == projectile.type && Main.projectile[j].owner == projectile.owner && - Main.projectile[j].ai[0] == 0f && Main.projectile[j].active && Main.projectile[j].ai[1] <= 0) - { - Main.projectile[j].ai[0] = Projectile.NewProjectile(projectile.Center, Vector2.UnitY, ModContent.ProjectileType(), - (int)(projectile.damage * 1.2f), projectile.knockBack, projectile.owner, Main.projectile[j].whoAmI); + ApplyMinionBuffs(); - Main.projectile[j].ai[1] = SuperchargeTimeMax; - Main.projectile[j].netUpdate = true; - laserCount++; - } - } - else - { - Main.projectile[j].ai[1] = SuperchargeTimeMax; - Main.projectile[j].netUpdate = true; - } - } + projectile.direction = projectile.spriteDirection = Owner.direction; - // Kill removes the respective canister from the list. No need to do this manually. - for (int j = 0; j < modPlayer.GammaCanisters.Count; j++) - { - Main.projectile[modPlayer.GammaCanisters[i]].Kill(); - } - break; - } - } - } - - // Spawn gamma canisters - else if (player.ownedProjectileCounts[projectile.type] >= 7) - { - int ownedGammaHeads = player.ownedProjectileCounts[projectile.type]; - int canisterSpawnChance = 520 - (int)(200 * (1 - 1f / (ownedGammaHeads + 6f))); - if (Main.rand.NextBool(canisterSpawnChance * ownedGammaHeads)) - { - Vector2 spawnPosition = player.Center + new Vector2(Main.screenWidth / 2, Main.screenHeight / 2) * Main.rand.NextFloat(-1f, 1f); - Projectile.NewProjectileDirect(spawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, projectile.owner); - } - } - - // Omega-complex dust. - projectile.localAI[1]++; - if (projectile.localAI[1] < 60f) - { - for (int i = 0; i < 5; i++) - { - float angle = projectile.localAI[1] / 60f * MathHelper.TwoPi; - float x = (float)Math.Sin(angle * AngularMultiplier1) * (float)Math.Cos(angle); - float y = (float)Math.Cos(angle * (float)Math.Cos(MathHelper.PiOver2 * AngularMultiplier2 + angle * 2f)) * (float)Math.Sin(angle); - Vector2 velocity = new Vector2(x * 4f, y * 4f) + player.velocity; - velocity = velocity.RotatedBy(MathHelper.TwoPi / 5f * i); - - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = velocity; - dust.scale = (float)Math.Cos(angle) + 1.3f; - dust.noGravity = true; - } - } - // Explosion - if (projectile.localAI[1] == 60f) - { - for (int i = 0; i < 60; i++) - { - float angle = MathHelper.TwoPi / 60f * i; - angle += projectile.AngleFrom(player.Center) / 60f; - angle += (float)Math.Sin(angle) * MathHelper.PiOver2; - Dust dust = Dust.NewDustPerfect(projectile.Center + angle.ToRotationVector2() * 8f, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = angle.ToRotationVector2() * new Vector2(4f, 3f * (float)Math.Cos(angle)) * 3f; - dust.scale = 1.3f; - dust.noGravity = true; - } - } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = trueDamage; - } - - Vector2 returnPosition = DrawStartPosition + (player.direction > 0).ToDirectionInt() * 6f * Vector2.UnitX + DeltaPosition; - - NPC potentialTarget = projectile.Center.MinionHoming(DistanceToCheck, player); - - // Kill laser when done - if (projectile.ai[1] == GammaDeathray.TotalFadeoutTime && projectile.ai[0] != 0f) - { - for (int i = 0; i < Main.projectile.Length; i++) - { - if (Main.projectile[i].active && Main.projectile[i].ai[1] >= 0f && Main.projectile[i].type == projectile.type && Main.projectile[i].owner == projectile.owner) - { - Main.projectile[i].spriteDirection = 1; - Main.projectile[i].ai[1] = 0f; - Main.projectile[i].netUpdate = true; - Main.projectile[(int)Main.projectile[i].ai[0]].timeLeft = GammaDeathray.TotalFadeoutTime; - } - } - } - // Bullet/deathray - if (projectile.ai[1] > 0) - { - projectile.direction = projectile.spriteDirection = 1; - projectile.rotation = projectile.AngleTo(Main.MouseWorld); - projectile.ai[1]--; - } - else if (potentialTarget != null) - { - if (projectile.Distance(player.Center) < DistanceToCheck && - Collision.CanHit(projectile.Center, 1, 1, player.Center, 1, 1) && - Main.myPlayer == projectile.owner) - { - BulletShootCounter++; - if (BulletShootCounter % 20f == 14f) - { - Projectile bullet = Projectile.NewProjectileDirect(projectile.Center, - projectile.DirectionTo(potentialTarget.Center) * 2.5f, - ModContent.ProjectileType(), projectile.damage, 2f, projectile.owner); - bullet.ai[0] = potentialTarget.whoAmI; - } - - if (BulletShootCounter % 20f >= 17f) - projectile.frame = Main.projFrames[projectile.type] - 1; - else if (BulletShootCounter % 20f >= 11f) - projectile.frame = Main.projFrames[projectile.type] - 2; - else if (BulletShootCounter % 20f >= 6f) - projectile.frame = Main.projFrames[projectile.type] - 3; - - projectile.direction = projectile.spriteDirection = (potentialTarget.Center.X - projectile.Center.X > 0).ToDirectionInt(); - returnPosition.X -= 48f * (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); - } - else - { - projectile.direction = projectile.spriteDirection = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); - projectile.frame = 0; - } - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.05f); - } + float idealRotation = 0f; + NPC potentialTarget = projectile.Center.MinionHoming(950f, Owner); + if (potentialTarget != null) + NoticeTarget(potentialTarget, ref returnPosition, ref idealRotation); else - { - projectile.direction = projectile.spriteDirection = (player.Center.X - projectile.Center.X > 0).ToDirectionInt(); - projectile.rotation = projectile.rotation.AngleTowards(0f, 0.05f); projectile.frame = 0; + + 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)); + MoveTowardsDestination(returnPosition); + AdjustOldVelocityArray(); + + Time++; + } + + public void PerformInitializationEffects() + { + 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.netUpdate = true; + + if (Main.dedServ) + return; + + // Release a circle of sulphuric dust. + for (int i = 0; i < 18; i++) + { + 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; + } + } + + public void ApplyMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().gammaHead = false; + if (Owner.Calamity().gammaHead) + 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; + + // 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]; + + 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)); + + float fireAngle = shootVelocity.ToRotation(); + + // Direction affecting. + if (target.Center.X - spawnPosition.X < 0) + 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); + } + + public void MoveTowardsDestination(Vector2 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; } - if (projectile.Distance(returnPosition) > 28f) - { - projectile.velocity += new Vector2(Math.Sign(returnPosition.X - projectile.Center.X), Math.Sign(returnPosition.Y - projectile.Center.Y)) * new Vector2(0.015f, 0.025f) * Main.rand.NextFloat(0.98f, 1.02f); - if (Math.Abs(projectile.velocity.X) > 2.5f) - { - projectile.velocity.X = 2.1f * Math.Sign(projectile.velocity.X); - } - if (Math.Abs(projectile.velocity.Y) > 1.6f) - { - projectile.velocity.Y = 1.4f * Math.Sign(projectile.velocity.Y); - } - projectile.velocity += (returnPosition - projectile.Center) / 10f; - } - else projectile.velocity *= 0.98f; - projectile.Center = new Vector2(projectile.Center.X, MathHelper.Clamp(projectile.Center.Y, 1f, returnPosition.Y - 8f)); + int totalHeads = CalamityUtils.CountProjectiles(projectile.type); + int moveRate = 40 + totalHeads * 4; + + // Reset the ideal offset from time to time. + if (Time % moveRate == moveRate - 1f) + IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); + + if (Vector2.Distance(IdealPositionOffset, CurrentPositionOffset) > 0.2f) + 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); + + // 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; + + // Disallow heads from getting too close to each other. + projectile.MinionAntiClump(0.15f); } + + public void AdjustOldVelocityArray() + { + for (int i = OldVelocities.Length - 1; i > 0; i--) + OldVelocities[i] = OldVelocities[i - 1]; + + OldVelocities[0] = projectile.velocity; + } + public override void Kill(int timeLeft) { + if (Main.dedServ) + return; + for (int i = 0; i < 10; i++) - { - Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 4f).noGravity = true; - } + Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid, Main.rand.NextVector2CircularEdge(4f, 4f)).noGravity = true; } - public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - Player player = Main.player[projectile.owner]; - Texture2D chain = ModContent.GetTexture("CalamityMod/Projectiles/Summon/GammaHeadChain"); - Vector2 start = projectile.Center + (projectile.spriteDirection == -1).ToInt() * 10f * Vector2.UnitX; - Vector2 end = DrawStartPosition - projectile.DirectionTo(DrawStartPosition) * 11f; - Vector2 bodyTop = DrawStartPosition + new Vector2(player.direction == 1 ? 6f : -6f, 0f); + Vector2 end = projectile.Center + (projectile.spriteDirection == 1).ToInt() * 10 * Vector2.UnitX; - for (int i = 0; i <= (int)projectile.Distance(end) / 10 + 1; i++) + List controlPoints = new List { - float ratio = i / (projectile.Distance(end) / 10 + 1); - Vector2 positionAtPoint = start + (bodyTop - start) * ratio; - if (projectile.Distance(positionAtPoint) > 9) - { - float angleAtPoint = (start - positionAtPoint).ToRotation(); - if (i < (int)projectile.Distance(end) / 10 + 1) - { - float nextRatio = (i + 1f) / (projectile.Distance(end) / 10 + 1); - Vector2 nextPositionAtPoint = start + (bodyTop - start) * nextRatio; - - angleAtPoint = (nextPositionAtPoint - positionAtPoint).ToRotation(); - } - angleAtPoint += MathHelper.PiOver2; - spriteBatch.Draw(chain, - positionAtPoint - Main.screenPosition, - null, - Color.Lerp(Color.White, Color.Transparent, 0.5f), - angleAtPoint, - chain.Size() / 2f, - 1f, - SpriteEffects.None, - 0f); - } + DrawStartPosition + }; + for (int i = 0; i < OldVelocities.Length; i++) + { + // Incorporate the past movement into neck turns, giving it rubber band-like movment. + // Become less responsive at the neck ends. Having the ends have typical movement can look strange sometimes. + float swayResponsiveness = Utils.InverseLerp(0f, 6f, i, true) * Utils.InverseLerp(OldVelocities.Length, OldVelocities.Length - 6f, i, true); + Vector2 swayTotalOffset = OldVelocities[i] * swayResponsiveness; + controlPoints.Add(Vector2.Lerp(DrawStartPosition, end, i / (float)OldVelocities.Length) + swayTotalOffset); } + controlPoints.Add(end); + + int chainPointCount = (int)(Vector2.Distance(controlPoints.First(), controlPoints.Last()) / 5f); + if (chainPointCount < 12) + chainPointCount = 12; + BezierCurve bezierCurve = new BezierCurve(controlPoints.ToArray()); + List chainPoints = bezierCurve.GetPoints(chainPointCount); + + for (int i = 0; i < chainPoints.Count; i++) + { + Vector2 positionAtPoint = chainPoints[i]; + 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; + spriteBatch.Draw(chain, + positionAtPoint - Main.screenPosition, + null, + Color.Lerp(Color.White, Color.Transparent, 0.6f), + angleAtPoint, + chain.Size() / 2f, + 1f, + SpriteEffects.None, + 0f); + } + + Texture2D headTexture = ModContent.GetTexture(Texture); + spriteBatch.Draw(headTexture, + 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, + 0f); + + return false; } public override bool CanDamage() => false; } diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs index bb9909b9cf..b83a6033c4 100644 --- a/Projectiles/Summon/GastricBelcherVomit.cs +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y); + Main.PlaySound(SoundID.Dig, (int)projectile.position.X, (int)projectile.position.Y); //Dust effect int splash = 0; while (splash < 4) diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index 63785476a1..e3c86d6bda 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Summon { public class GhostFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Summon projectile.extraUpdates = 100; projectile.timeLeft = 80; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; + projectile.localNPCHitCooldown = 50; projectile.minion = true; projectile.minionSlots = 0f; } diff --git a/Projectiles/Summon/GhostFire.png b/Projectiles/Summon/GhostFire.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Summon/GhostFire.png and /dev/null differ diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 7653515597..1a4ab6437e 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class GhostlyMine : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/PhantomMine"; + public bool start = true; public bool spawnDust = true; @@ -52,7 +54,7 @@ namespace CalamityMod.Projectiles.Summon 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; //1f + projectile.ai[1] += 1f; if (spawnDust) { for (int num621 = 0; num621 < 10; num621++) diff --git a/Projectiles/Summon/GhostlyMine.png b/Projectiles/Summon/GhostlyMine.png deleted file mode 100644 index aaf6477611..0000000000 Binary files a/Projectiles/Summon/GhostlyMine.png and /dev/null differ diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 1de6bb0f26..0d3bbca0cf 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -50,9 +50,9 @@ namespace CalamityMod.Projectiles.Summon /// This cooldown is set in /// public int LaserCooldown = 0; - public const int LaserBaseDamage = 21000; - public const int RegicideBaseDamageSmall = 9487; - public const int RegicideBaseDamageLarge = 26000; + public const int LaserBaseDamage = 4200; + public const int RegicideBaseDamageSmall = 1897; + public const int RegicideBaseDamageLarge = 5200; public override void SetStaticDefaults() { @@ -152,10 +152,13 @@ namespace CalamityMod.Projectiles.Summon { ExitChargeModeEarly(player); } - player.velocity = Vector2.Lerp(player.velocity, projectile.DirectionTo(Main.MouseWorld) * RightIconLungeSpeed, 0.225f); + + 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; + else + projectile.rotation = 0f; + if (player.mount != null) // Kill any mounts { player.mount.Dismount(player); @@ -387,7 +390,7 @@ namespace CalamityMod.Projectiles.Summon 8f, projectile.owner, projectile.whoAmI); - if (player.HeldItem != null) + if (player.HeldItem != null && deathLaser.whoAmI.WithinBounds(Main.maxProjectiles)) { if (player.HeldItem.magic) { @@ -439,13 +442,13 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; dust.scale = 1.6f; dust.position = player.Center + outwardness * (MathHelper.TwoPi / 10f * angleInterval).ToRotationVector2().RotatedBy(angle); - dust.velocity = player.DirectionTo(dust.position) * 8f * speedSign; + dust.velocity = player.SafeDirectionTo(dust.position) * 8f * speedSign; 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.DirectionTo(dust.position) * 8f * speedSign; + dust.velocity = player.SafeDirectionTo(dust.position) * 8f * speedSign; } } } diff --git a/Projectiles/Summon/GigaFlareFriendly.cs b/Projectiles/Summon/GigaFlareFriendly.cs deleted file mode 100644 index 3629f9c71b..0000000000 --- a/Projectiles/Summon/GigaFlareFriendly.cs +++ /dev/null @@ -1,138 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class GigaFlareFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Flare"); - 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.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 4; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 120; - } - - public override void AI() - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - Lighting.AddLight(projectile.Center, 1f, 0.7f, 0f); - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - bool flag17 = false; - 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)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } - } - - 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); - return false; - } - - public override void Kill(int timeLeft) - { - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - if (projectile.owner == Main.myPlayer) - { - for (int 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); - } - } - 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 = 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 < 20; num621++) - { - 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)) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 35; num623++) - { - 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); - Main.dust[num624].velocity *= 2f; - } - CalamityUtils.ExplosionGores(projectile.Center, 3); - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 200); - } - } -} diff --git a/Projectiles/Summon/GigaFlareFriendly.png b/Projectiles/Summon/GigaFlareFriendly.png deleted file mode 100644 index 01e2bd24ca..0000000000 Binary files a/Projectiles/Summon/GigaFlareFriendly.png and /dev/null differ diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index 05788a4298..57e394ff2f 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Projectiles.Summon projectile.width = 24; projectile.height = 24; projectile.friendly = true; - projectile.minion = true; - projectile.minionSlots = 0f; + projectile.minion = true; + projectile.minionSlots = 0f; projectile.alpha = 50; projectile.penetrate = 1; projectile.tileCollide = false; @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index 70ffa18b50..b1608eb3f9 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Summon 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 > 1000f) + if (playerDist > 1500f) { projectile.ai[0] = 1f; } @@ -116,10 +116,10 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0] != 0f) //flying back to the player { projectile.tileCollide = false; - float npcDetectRange = 800f; + float npcDetectRange = 1200f; bool npcFound = false; int num6 = -1; - for (int index = 0; index < Main.npc.Length; ++index) + for (int index = 0; index < Main.maxNPCs; ++index) { NPC npc2 = Main.npc[index]; if (npc2.CanBeChasedBy((object) projectile, false)) @@ -289,7 +289,7 @@ namespace CalamityMod.Projectiles.Summon } if (num9 == -1) { - for (int index = 0; index < Main.npc.Length; ++index) + for (int index = 0; index < Main.maxNPCs; ++index) { if (Main.npc[index].CanBeChasedBy((object) projectile, false)) { @@ -356,16 +356,16 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = attackCooldown; double num11 = 12.0; Vector2 vector2 = new Vector2(projectile.Center.X, projectile.Center.Y - 8f); - float num12 = num5 - vector2.X + (float) Main.rand.Next(-10, 11); + 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 + (float) Main.rand.Next(-10, 11) - num14; + float num15 = num6 - vector2.Y + Main.rand.NextFloat(-6f, 6f) - num14; double num16 = Math.Sqrt((double) num12 * (double) num12 + (double) num15 * (double) num15); float num17 = (float) (num11 / num16); float SpeedX = num12 * num17; float SpeedY = num15 * num17; int damage = projectile.damage; int Type = ModContent.ProjectileType(); - int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX * 1.5f, SpeedY * 1.5f, 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; if (SpeedX > 0f) @@ -590,12 +590,9 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void Kill(int timeLeft) + 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); Main.gore[index].velocity *= 0.1f; diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index 58aa77bc25..b9501c9d4a 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -369,13 +369,6 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index 9ff8667a41..c122b9efe2 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -6,6 +6,7 @@ namespace CalamityMod.Projectiles.Summon { public class Hive : ModProjectile { + public override string Texture => "CalamityMod/NPCs/Astral/Hive"; public override void SetStaticDefaults() { @@ -17,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { projectile.width = 38; - projectile.height = 60; + projectile.height = 62; projectile.ignoreWater = true; projectile.tileCollide = true; projectile.sentry = true; diff --git a/Projectiles/Summon/Hive.png b/Projectiles/Summon/Hive.png deleted file mode 100644 index fcd1ef8827..0000000000 Binary files a/Projectiles/Summon/Hive.png and /dev/null differ diff --git a/Projectiles/Summon/Hiveling.cs b/Projectiles/Summon/Hiveling.cs index fb4b693fb2..e869594621 100644 --- a/Projectiles/Summon/Hiveling.cs +++ b/Projectiles/Summon/Hiveling.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Summon { public class Hiveling : ModProjectile { + public override string Texture => "CalamityMod/NPCs/Astral/Hiveling"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hiveling"); @@ -43,78 +45,13 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4; projectile.spriteDirection = -projectile.direction; projectile.rotation = projectile.velocity.X * 0.05f; - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 1200f; - bool homeIn = false; - int target = (int)projectile.ai[0]; - - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.Center.X; - float num477 = npc.Center.Y; - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - else if (Main.npc[target].CanBeChasedBy(projectile, false)) - { - float num476 = Main.npc[target].Center.X; - float num477 = Main.npc[target].Center.Y; - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - centerX = num476; - centerY = num477; - homeIn = true; - } - } - if (!homeIn) - { - for (int i = 0; i < Main.maxNPCs; ++i) - { - NPC npc = Main.npc[i]; - if (npc is null || !npc.active) - continue; - if (npc.CanBeChasedBy(projectile, false)) - { - float num476 = npc.Center.X; - float num477 = npc.Center.Y; - float num478 = Math.Abs(projectile.Center.X - num476) + Math.Abs(projectile.Center.Y - num477); - if (num478 < num474) - { - centerX = num476; - centerY = num477; - homeIn = true; - } - } - } - } - if (homeIn) - { - float num483 = 10f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; - projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; - } + NPC potentialTarget = projectile.Center.MinionHoming(1200f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 30f + projectile.SafeDirectionTo(potentialTarget.Center) * 10f) / 31f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -136,7 +73,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/Hiveling.png b/Projectiles/Summon/Hiveling.png deleted file mode 100644 index c4e18b5159..0000000000 Binary files a/Projectiles/Summon/Hiveling.png and /dev/null differ diff --git a/Projectiles/Summon/HomingGammaBullet.cs b/Projectiles/Summon/HomingGammaBullet.cs new file mode 100644 index 0000000000..933b4065ff --- /dev/null +++ b/Projectiles/Summon/HomingGammaBullet.cs @@ -0,0 +1,60 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class HomingGammaBullet : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Enemy/NuclearBulletMedium"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gamma Bullet"); + 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; + } + + public override void AI() + { + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(ModContent.BuffType(), 240); + + public override void Kill(int timeLeft) + { + if (Main.dedServ) + return; + + for (int i = 0; i < 3; i++) + { + Dust sulphuricAcid = Dust.NewDustDirect(projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f); + sulphuricAcid.noGravity = true; + sulphuricAcid.velocity *= 1.8f; + + sulphuricAcid = Dust.CloneDust(sulphuricAcid); + sulphuricAcid.velocity *= -1f; + } + } + } +} diff --git a/Projectiles/Summon/HowlsHeartFireball.cs b/Projectiles/Summon/HowlsHeartFireball.cs index 8dc31d65be..bea3cb6f03 100644 --- a/Projectiles/Summon/HowlsHeartFireball.cs +++ b/Projectiles/Summon/HowlsHeartFireball.cs @@ -106,11 +106,8 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 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); diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index 8006752eb9..411a06934a 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Summon { public class IceClasperMinion : ModProjectile { + private int dust = 3; public override void SetStaticDefaults() @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.05f, 0.15f, 0.2f); + 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) @@ -89,9 +90,9 @@ namespace CalamityMod.Projectiles.Summon } } - projectile.ChargingMinionAI(700f, 1000f, 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() - 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index 1fca4c68b6..b41df48151 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -82,7 +82,6 @@ namespace CalamityMod.Projectiles.Summon 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)) { - //Main.NewText("targeting special target"); projectile.ai[0] = minionAttackTargetNpc.whoAmI; projectile.ai[1] = 0f; projectile.localAI[0] = 0f; @@ -104,13 +103,11 @@ namespace CalamityMod.Projectiles.Summon float delay = 60f - projectile.ai[1] / 60f * 10f; if (projectile.localAI[0] > delay) { - //Main.NewText("time to attack, delay " + delay.ToString()); projectile.localAI[0] = 0f; rememberTarget = Collision.CanHit(projectile.Center, 0, 0, npc.position, npc.width, npc.height); if (rememberTarget && projectile.owner == Main.myPlayer) { - //Main.NewText("i attacked"); Vector2 speed = npc.Center - projectile.Center; speed.Normalize(); speed *= 8f; @@ -118,14 +115,11 @@ namespace CalamityMod.Projectiles.Summon 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); } - - //if (!rememberTarget) Main.NewText("couldn't hit target"); } } if (!rememberTarget) { - //Main.NewText("forgetting target"); projectile.ai[0] = -1f; projectile.ai[1] = 0f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs index baaa3e9518..ba44de76e8 100644 --- a/Projectiles/Summon/IceSentryFrostBolt.cs +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class IceSentryFrostBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/FrostBoltProjectile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ball"); @@ -62,7 +64,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/IceSentryFrostBolt.png b/Projectiles/Summon/IceSentryFrostBolt.png deleted file mode 100644 index 701164b9ac..0000000000 Binary files a/Projectiles/Summon/IceSentryFrostBolt.png and /dev/null differ diff --git a/Projectiles/Summon/IceSentryShard.cs b/Projectiles/Summon/IceSentryShard.cs index 7a1f1de402..2857ee4dbe 100644 --- a/Projectiles/Summon/IceSentryShard.cs +++ b/Projectiles/Summon/IceSentryShard.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class IceSentryShard : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Boss/IceRain"; + public override void SetDefaults() { projectile.width = 12; diff --git a/Projectiles/Summon/IceSentryShard.png b/Projectiles/Summon/IceSentryShard.png deleted file mode 100644 index 14ddad107b..0000000000 Binary files a/Projectiles/Summon/IceSentryShard.png and /dev/null differ diff --git a/Projectiles/Summon/IgneousBladeStrike.cs b/Projectiles/Summon/IgneousBladeStrike.cs index 5f185bd8d4..51b5798e38 100644 --- a/Projectiles/Summon/IgneousBladeStrike.cs +++ b/Projectiles/Summon/IgneousBladeStrike.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Summon { public class IgneousBladeStrike : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Summon/IgneousBlade"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blade"); diff --git a/Projectiles/Summon/IgneousBladeStrike.png b/Projectiles/Summon/IgneousBladeStrike.png deleted file mode 100644 index 81d7df8b2c..0000000000 Binary files a/Projectiles/Summon/IgneousBladeStrike.png and /dev/null differ diff --git a/Projectiles/Summon/IrradiatedAura.cs b/Projectiles/Summon/IrradiatedAura.cs index 9887357c79..273cf7a271 100644 --- a/Projectiles/Summon/IrradiatedAura.cs +++ b/Projectiles/Summon/IrradiatedAura.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class IrradiatedAura : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Irradiated Aura"); diff --git a/Projectiles/Summon/IrradiatedAura.png b/Projectiles/Summon/IrradiatedAura.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Summon/IrradiatedAura.png and /dev/null differ diff --git a/Projectiles/Summon/LanternFlame.cs b/Projectiles/Summon/LanternFlame.cs index 4a83651bd5..89bd124696 100644 --- a/Projectiles/Summon/LanternFlame.cs +++ b/Projectiles/Summon/LanternFlame.cs @@ -49,60 +49,10 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.alpha <= 25) { - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 700f; - bool flag17 = false; - if (Main.player[projectile.owner].HasMinionAttackTargetNPC) - { - 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); - if (num952 < num474) - { - num474 = num952; - num472 = num950; - num473 = num951; - flag17 = true; - } - } - } - if (!flag17) - { - for (int num475 = 0; num475 < Main.npc.Length; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - } - if (flag17) - { - float num483 = 16f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } - } + NPC potentialTarget = projectile.Center.MinionHoming(700f, Main.player[projectile.owner]); + if (potentialTarget != null) + projectile.velocity = (projectile.velocity * 20f + projectile.SafeDirectionTo(potentialTarget.Center) * 16f) / 21f; + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/LostSoulGiant.cs b/Projectiles/Summon/LostSoulGiant.cs new file mode 100644 index 0000000000..b7caaff612 --- /dev/null +++ b/Projectiles/Summon/LostSoulGiant.cs @@ -0,0 +1,110 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class LostSoulGiant : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() => DoSoulAI(projectile, ref Time); + + public static void DoSoulAI(Projectile projectile, ref float time) + { + if (time >= 15f) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1800f, false); + if (potentialTarget != null) + HomeInOnTarget(projectile, potentialTarget); + } + + projectile.Opacity = Utils.InverseLerp(0f, 15f, time, true); + projectile.frameCounter++; + if (projectile.frameCounter % 5f == 4f) + projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type]; + + projectile.rotation = projectile.velocity.ToRotation(); + projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + if (projectile.spriteDirection == -1) + projectile.rotation += MathHelper.Pi; + + time++; + } + + public static void HomeInOnTarget(Projectile projectile, NPC target) + { + float speed = MathHelper.Lerp(11f, 21f, (float)Math.Sin(projectile.identity % 7f / 7f * MathHelper.TwoPi) * 0.5f + 0.5f); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(target.Center) * speed, 0.075f); + } + + public override Color? GetAlpha(Color lightColor) + { + 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; + } + + 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); + for (int i = 0; i < 4; i++) + { + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + } + + return false; + } + + public override void Kill(int timeLeft) + { + // Play a wraith death sound. + Main.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); + ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f); + ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.scale = 1.45f; + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Summon/LostSoulGiant.png b/Projectiles/Summon/LostSoulGiant.png new file mode 100644 index 0000000000..3e0e4507b7 Binary files /dev/null and b/Projectiles/Summon/LostSoulGiant.png differ diff --git a/Projectiles/Summon/LostSoulGold.cs b/Projectiles/Summon/LostSoulGold.cs new file mode 100644 index 0000000000..bd21a7662f --- /dev/null +++ b/Projectiles/Summon/LostSoulGold.cs @@ -0,0 +1,81 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class LostSoulGold : ModProjectile + { + 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; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 38; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } + + 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 color = Color.Lerp(baseColor, Color.White, (float)Math.Cos(Main.GlobalTime * 2.7f) * 0.04f + 0.5f); + color.A = 127; + 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); + for (int i = 0; i < 4; i++) + { + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + } + + return false; + } + + public override void Kill(int timeLeft) + { + // Play a wraith death sound. + Main.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); + ectoplasm.velocity = Main.rand.NextVector2Circular(1.75f, 1.75f); + ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.scale = 1.45f; + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Summon/LostSoulGold.png b/Projectiles/Summon/LostSoulGold.png new file mode 100644 index 0000000000..ecffa8c8a3 Binary files /dev/null and b/Projectiles/Summon/LostSoulGold.png differ diff --git a/Projectiles/Summon/LostSoulLarge.cs b/Projectiles/Summon/LostSoulLarge.cs new file mode 100644 index 0000000000..204733a066 --- /dev/null +++ b/Projectiles/Summon/LostSoulLarge.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class LostSoulLarge : ModProjectile + { + 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; + } + + 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; + } + + 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 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; + } + + 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); + for (int i = 0; i < 4; i++) + { + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + } + + return false; + } + + public override void Kill(int timeLeft) + { + // Play a wraith death sound. + Main.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); + ectoplasm.velocity = Main.rand.NextVector2Circular(1.75f, 1.75f); + ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.scale = 1.45f; + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Summon/LostSoulLarge.png b/Projectiles/Summon/LostSoulLarge.png new file mode 100644 index 0000000000..06675010ab Binary files /dev/null and b/Projectiles/Summon/LostSoulLarge.png differ diff --git a/Projectiles/Summon/LostSoulSmall.cs b/Projectiles/Summon/LostSoulSmall.cs new file mode 100644 index 0000000000..0bc2e93403 --- /dev/null +++ b/Projectiles/Summon/LostSoulSmall.cs @@ -0,0 +1,81 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class LostSoulSmall : ModProjectile + { + 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; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 38; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.magic = true; + projectile.ignoreWater = true; + } + + 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 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; + } + + 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); + for (int i = 0; i < 4; i++) + { + 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]; + + spriteBatch.Draw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, projectile.scale, direction, 0f); + } + } + + return false; + } + + public override void Kill(int timeLeft) + { + // Play a wraith death sound. + Main.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); + ectoplasm.velocity = Main.rand.NextVector2Circular(1.75f, 1.75f); + ectoplasm.color = projectile.GetAlpha(Color.White); + ectoplasm.scale = 1.45f; + ectoplasm.noGravity = true; + ectoplasm.noLight = true; + } + } + } +} diff --git a/Projectiles/Summon/LostSoulSmall.png b/Projectiles/Summon/LostSoulSmall.png new file mode 100644 index 0000000000..f02bca1221 Binary files /dev/null and b/Projectiles/Summon/LostSoulSmall.png differ diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index cf036c555a..861f707d5a 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.ignoreWater = true; projectile.minionSlots = 0f; - projectile.timeLeft = 18000; + projectile.timeLeft = 180000; projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft *= 5; @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } } diff --git a/Projectiles/Summon/LuxorsGiftSummon.png b/Projectiles/Summon/LuxorsGiftSummon.png index bb9aa16eae..0c2d362ed3 100644 Binary files a/Projectiles/Summon/LuxorsGiftSummon.png and b/Projectiles/Summon/LuxorsGiftSummon.png differ diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs index 3d0ad4db21..8590b9a481 100644 --- a/Projectiles/Summon/MK2FlaskSummon.cs +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class MK2FlaskSummon : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Summon/FuelCellBundle"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flask"); diff --git a/Projectiles/Summon/MK2FlaskSummon.png b/Projectiles/Summon/MK2FlaskSummon.png deleted file mode 100644 index 191e5f6570..0000000000 Binary files a/Projectiles/Summon/MK2FlaskSummon.png and /dev/null differ diff --git a/Projectiles/Summon/MK2RocketHoming.cs b/Projectiles/Summon/MK2RocketHoming.cs index 29d7cf5828..3472cab2ef 100644 --- a/Projectiles/Summon/MK2RocketHoming.cs +++ b/Projectiles/Summon/MK2RocketHoming.cs @@ -35,9 +35,8 @@ namespace CalamityMod.Projectiles.Summon NPC potentialTarget = projectile.Center.MinionHoming(1000f, player); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 24f + projectile.DirectionTo(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) diff --git a/Projectiles/Summon/MagicAxe.cs b/Projectiles/Summon/MagicAxe.cs index c06f5d277f..7ce569fd1b 100644 --- a/Projectiles/Summon/MagicAxe.cs +++ b/Projectiles/Summon/MagicAxe.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Axe"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; ProjectileID.Sets.MinionShot[projectile.type] = true; } @@ -60,14 +60,14 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Frostburn, 120); target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs index 651e618f1d..ba2245b17f 100644 --- a/Projectiles/Summon/MagicBat.cs +++ b/Projectiles/Summon/MagicBat.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class MagicBat : ModProjectile @@ -26,15 +27,9 @@ namespace CalamityMod.Projectiles.Summon 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) - { - return 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) { diff --git a/Projectiles/Summon/MagicBird.cs b/Projectiles/Summon/MagicBird.cs index 64b185c573..5f1eb4a8e0 100644 --- a/Projectiles/Summon/MagicBird.cs +++ b/Projectiles/Summon/MagicBird.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Bird"); Main.projFrames[projectile.type] = 7; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; ProjectileID.Sets.TrailingMode[projectile.type] = 0; ProjectileID.Sets.MinionShot[projectile.type] = true; } @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f87517bbc9..15985b3adb 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class MagicBullet : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Ranged/BloodClotFriendly"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bullet"); diff --git a/Projectiles/Summon/MagicBullet.png b/Projectiles/Summon/MagicBullet.png deleted file mode 100644 index 2fabfdd09a..0000000000 Binary files a/Projectiles/Summon/MagicBullet.png and /dev/null differ diff --git a/Projectiles/Summon/MagicHammer.cs b/Projectiles/Summon/MagicHammer.cs index d1740b14db..756aba4ea6 100644 --- a/Projectiles/Summon/MagicHammer.cs +++ b/Projectiles/Summon/MagicHammer.cs @@ -4,6 +4,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class MagicHammer : ModProjectile @@ -13,8 +14,8 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Hammer"); ProjectileID.Sets.MinionShot[projectile.type] = true; - ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() @@ -143,7 +144,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/MagicUmbrella.cs b/Projectiles/Summon/MagicUmbrella.cs index 74f40b8eb7..4546dec019 100644 --- a/Projectiles/Summon/MagicUmbrella.cs +++ b/Projectiles/Summon/MagicUmbrella.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon DisplayName.SetDefault("Umbrella"); ProjectileID.Sets.MinionShot[projectile.type] = true; ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; - ProjectileID.Sets.TrailingMode[projectile.type] = 1; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index e79811ec5c..14f97109f5 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -1,6 +1,8 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,122 +20,185 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; + projectile.width = 24; + projectile.height = 24; projectile.friendly = true; projectile.ignoreWater = true; projectile.alpha = 255; projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; + projectile.timeLeft = 90000; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; + projectile.hide = true; + } + + // Arbitrary function used to identify a projectile based owner and identity. + // Used to get the correct projectile to attach to. + // Do not EVER touch this. + internal static bool SameIdentity(Projectile proj, int owner, int identity) + { + return proj.owner == owner && (proj.projUUID == identity || proj.identity == identity); + } + + internal static void SegmentAI(Projectile projectile, int offsetFromNextSegment, ref int playerMinionSlots) + { + // If the mechworm is opaque enough, produce light. + if (projectile.alpha <= 128) + Lighting.AddLight(projectile.Center, Color.DarkMagenta.ToVector3()); + + Player owner = Main.player[projectile.owner]; + CalamityPlayer modPlayer = owner.Calamity(); + + // Track the minion presence boolean. + if (owner.dead) + modPlayer.mWorm = false; + if (modPlayer.mWorm) + projectile.timeLeft = 2; + + int headProjType = ModContent.ProjectileType(); + int bodyProjType = ModContent.ProjectileType(); + int tailProjType = ModContent.ProjectileType(); + + ref float segmentAheadIdentity = ref projectile.ai[0]; + Projectile segmentAhead = Main.projectile.Take(Main.maxProjectiles).FirstOrDefault(proj => SameIdentity(proj, projectile.owner, (int)projectile.ai[0])); + + // Ensure that the segment ahead actually exists. If it doesn't, kill this segment. + if (segmentAhead is null || !Main.projectile.IndexInRange(segmentAhead.whoAmI) || (segmentAhead.type != bodyProjType && segmentAhead.type != headProjType)) + { + projectile.Kill(); + return; + } + + // Delete segments if some are lost for whatever reason (such as a summon potion expiring). + // playerMinionSlots is set to -1 for body segments to avoid type checking. + if (playerMinionSlots != -1 && (owner.maxMinions < playerMinionSlots || !owner.active)) + { + int lostSlots = playerMinionSlots - owner.maxMinions; + while (lostSlots > 0) + { + Projectile ahead = segmentAhead; + // Each body slot is actually 0.5 slots. Kill two segments to lose 1 "true" slot. + for (int i = 0; i < 2; ++i) + { + if (ahead.type != ModContent.ProjectileType()) + projectile.localAI[1] = ahead.localAI[1]; + + // Inherit the ahead segment index of the ahead segment (basically attaching to the segment that's two indices ahead). + segmentAheadIdentity = ahead.ai[0]; + projectile.netUpdate = true; + + ahead.Kill(); + + // And re-decide the ahead segment. + segmentAhead = Main.projectile.Take(Main.maxProjectiles).FirstOrDefault(proj => SameIdentity(proj, projectile.owner, (int)projectile.ai[0])); + + // Ensure that the segment ahead actually exists. If it doesn't, kill this segment. + if (segmentAhead is null || !Main.projectile.IndexInRange(segmentAhead.whoAmI)) + { + projectile.Kill(); + return; + } + ahead = segmentAhead; + } + lostSlots--; + } + playerMinionSlots = owner.maxMinions; + } + + // Accumulate the total segments of the worm. + segmentAhead.localAI[0] = projectile.localAI[0] + 1f; + + // Locate the head segment by looping through the projectile array. + // Doing identity checks across every segment would be much more expensive than doing just this one loop. + Projectile head = LocateHead(projectile); + + // If no such head exists, kill this segment. + if (head is null) + { + projectile.Kill(); + return; + } + + // If the head is set to net update every body segment will also update. + // This update cannot be blocked by netSpam. + if (head.netUpdate) + { + projectile.netUpdate = true; + if (projectile.netSpam > 59) + projectile.netSpam = 59; + } + + MechwormHead headModProj = head.modProjectile as MechwormHead; + if (headModProj.EndRiftGateUUID == -1) + { + // Very rapidly fade-in. + projectile.alpha = Utils.Clamp(projectile.alpha - 16, 0, 255); + } + else if (projectile.Hitbox.Intersects(Main.projectile[headModProj.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. + projectile.alpha = 255; + } + + projectile.velocity = Vector2.Zero; + Vector2 offsetToDestination = segmentAhead.Center - projectile.Center; + + // This variant of segment attachment incorporates rotation. + // 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 (segmentAhead.rotation != projectile.rotation) + { + float offsetAngle = MathHelper.WrapAngle(segmentAhead.rotation - projectile.rotation); + offsetToDestination = offsetToDestination.RotatedBy(offsetAngle * 0.08f); + } + projectile.rotation = offsetToDestination.ToRotation() + MathHelper.PiOver2; + + // Adjust the width/height of the segment in case the general size of the worm changes. + if (offsetToDestination != Vector2.Zero) + projectile.Center = segmentAhead.Center - offsetToDestination.SafeNormalize(Vector2.Zero) * offsetFromNextSegment; + + projectile.Center = Vector2.Clamp(projectile.Center, new Vector2(160f), new Vector2(Main.maxTilesX - 10, Main.maxTilesY - 10) * 16); + } + + public static Projectile LocateHead(Projectile projectile) + { + int headType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != headType || !Main.projectile[i].active || Main.projectile[i].owner != projectile.owner) + continue; + return Main.projectile[i]; + } + return null; } public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player9.Calamity(); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); - float num1064; - float scaleFactor17; - float scaleFactor18; - if (chase >= 0 && Main.projectile[chase].active) - { - //Delete the player's mechworm if it's attaching to something weird - if (Main.projectile[chase].type != ModContent.ProjectileType() && - Main.projectile[chase].type != ModContent.ProjectileType() && - Main.projectile[chase].type != ModContent.ProjectileType()) - { - 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() || - Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType())) - { - Main.projectile[i].Kill(); - } - } - } - value68 = Main.projectile[chase].Center; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - - // Calculations have a safeguard against division by 0. - float speed = 0f; - 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()) - { - speed = Main.projectile[i].velocity.Length(); - break; - } - } - scaleFactor17 = MechwormHead.ComputeDistance(16f, speed); - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - //Maybe add some kill code here ? - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (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.netSpam = 5; - projectile.scale = scaleFactor18; - projectile.width = projectile.height = (int)((float)num1051 * projectile.scale); - projectile.Center = projectile.position; - projectile.netSpam = 5; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * projectile.Size.Length() * scaleFactor18; - } - projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; - projectile.netSpam = 5; + int _ = -1; + SegmentAI(projectile, 16, ref _); } 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); + 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 void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindProjectiles.Add(index); + } + + public override bool ShouldUpdatePosition() => false; } } diff --git a/Projectiles/Summon/MechwormBody.png b/Projectiles/Summon/MechwormBody.png index dc5d42e257..e27c80c807 100644 Binary files a/Projectiles/Summon/MechwormBody.png and b/Projectiles/Summon/MechwormBody.png differ diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs deleted file mode 100644 index db459d37b3..0000000000 --- a/Projectiles/Summon/MechwormBody2.cs +++ /dev/null @@ -1,138 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class MechwormBody2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mechworm"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.NeedsUUID[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.alpha = 255; - projectile.minionSlots = 0.5f; - projectile.timeLeft = 18000; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.timeLeft *= 5; - projectile.minion = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player9.Calamity(); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - int chase = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); - float num1064; - float scaleFactor17; - float scaleFactor18; - if (chase >= 0 && Main.projectile[chase].active) - { - //Delete the player's mechworm if it's attaching to something weird - if (Main.projectile[chase].type != ModContent.ProjectileType() && - Main.projectile[chase].type != ModContent.ProjectileType() && - Main.projectile[chase].type != ModContent.ProjectileType()) - { - 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() || - Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType() || - Main.projectile[i].type == ModContent.ProjectileType())) - { - Main.projectile[i].Kill(); - } - } - } - value68 = Main.projectile[chase].Center; - num1064 = Main.projectile[chase].rotation; - scaleFactor18 = MathHelper.Clamp(Main.projectile[chase].scale, 0f, 50f); - - // Calculations have a safeguard against division by 0. - float speed = 0f; - 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()) - { - speed = Main.projectile[i].velocity.Length(); - break; - } - } - scaleFactor17 = MechwormHead.ComputeDistance(16f, speed); - Main.projectile[chase].localAI[0] = projectile.localAI[0] + 1f; - } - else - { - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (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.netSpam = 5; - projectile.scale = scaleFactor18; - projectile.width = projectile.height = (int)((float)num1051 * projectile.scale); - projectile.Center = projectile.position; - projectile.netSpam = 5; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * projectile.Size.Length() * scaleFactor18; - } - projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; - 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); - return false; - } - } -} diff --git a/Projectiles/Summon/MechwormBody2.png b/Projectiles/Summon/MechwormBody2.png deleted file mode 100644 index dc5d42e257..0000000000 Binary files a/Projectiles/Summon/MechwormBody2.png and /dev/null differ diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index ea44caeb92..987d15575b 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -1,28 +1,67 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Collections.Generic; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { public class MechwormHead : ModProjectile { - private int dust = 3; + internal enum AttackState : byte + { + PortalGateCharge, + LaserCharge + } + internal int AttackStateTimer = 0; + internal int EndRiftGateUUID = -1; + internal Vector2 TeleportStartingPoint; + internal Vector2 TeleportEndingPoint; + internal AttackState CurrentAttackState = AttackState.LaserCharge; + + internal const int MaxSegmentsToCountForScaling = 50; + internal const int AttackStateShiftTime = 320; + internal const int StartupLethargy = 150; + internal const int LaserChargeFrames = 45; + 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]; + + private static bool Use_TML_0_11_7_7_Hacky_Netcode = true; + + + // Helper functions because Mechworm does a lot of checking for either itself or its target being near the edge of the world. + private static Vector2 WorldTopLeft(int tileDist = 15) => new Vector2(tileDist * 16f); + private static Vector2 WorldBottomRight(int tileDist = 15) => new Vector2(Main.maxTilesX - tileDist, Main.maxTilesY - tileDist) * 16f; + 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; + + 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."); + } + else + mod.Logger.Info("ModLoader version <= 0.11.7.7 detected. Mechworm UUID workaround is enabled."); } public override void SetDefaults() { - projectile.width = 20; - projectile.height = 20; + projectile.width = 24; + projectile.height = 24; projectile.friendly = true; projectile.ignoreWater = true; projectile.netImportant = true; @@ -33,170 +72,353 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; + projectile.hide = true; } + #region Syncing + public override void SendExtraAI(BinaryWriter writer) + { + // TODO -- remove when TML updates to 0.11.7.8 + // 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); + + 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(EndRiftGateUUID); + writer.WriteVector2(TeleportStartingPoint); + writer.WriteVector2(TeleportEndingPoint); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + byte enumByte = reader.ReadByte(); + CurrentAttackState = (AttackState)enumByte; + AttackStateTimer = reader.ReadInt32(); + TotalWormSegments = reader.ReadSingle(); + projectile.alpha = reader.ReadInt32(); + EndRiftGateUUID = reader.ReadInt32(); + TeleportStartingPoint = reader.ReadVector2(); + TeleportEndingPoint = reader.ReadVector2(); + + // TODO -- remove when TML updates to 0.11.7.8 + // TML 0.11.7.7 SPECIFIC FIX (because they were too slow to update): Read and dump 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) + _ = reader.ReadInt16(); + } + #endregion + + #region AI public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - if (dust > 0) - { - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + // If the mechworm is opaque enough, produce light. + 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)); + + 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++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + 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; } - dust--; - } - CalamityPlayer modPlayer = player9.Calamity(); - player9.AddBuff(ModContent.BuffType(), 3600); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - int num1051 = 30; - if (player9.dead) - { + CalamityPlayer modPlayer = owner.Calamity(); + + // Maintain or remove the Mechworm buff from the owner. + owner.AddBuff(ModContent.BuffType(), 3600); + if (owner.dead) modPlayer.mWorm = false; - } if (modPlayer.mWorm) - { projectile.timeLeft = 2; - } - Vector2 center14 = player9.Center; - float num1053 = 1800f; //700 - float num1054 = 2200f; //1000 - int num1055 = -1; - if (projectile.Distance(center14) > 3000f) //2000 + + Time++; + + if (!Main.projectile.IndexInRange(EndRiftGateUUID)) { - projectile.Center = center14; + // Very rapidly fade-in. + projectile.alpha = Utils.Clamp(projectile.alpha - 42, 0, 255); + } + 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) + { + for (int i = 0; i < 35; i++) + { + Dust burstDust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.PurpleCosmolite); + burstDust.velocity = (MathHelper.TwoPi * i / 35f).ToRotationVector2().RotatedByRandom(0.035f) * 12f; + burstDust.noGravity = true; + + burstDust = Dust.NewDustDirect(projectile.Center, 70, 70, (int)CalamityDusts.PurpleCosmolite); + 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; + } + } + + // 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); + + // Teleport to the player if the worm is very far away from them. + if (projectile.Distance(owner.Center) > 2700f) + { + 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; } - if (player9.HasMinionAttackTargetNPC) + + // Don't bother attacking if the target is close to the world edge, to prevent issues. + if (potentialTarget != null && Time > StartupLethargy && TargetInSafeBoundaries(potentialTarget)) { - NPC npc = Main.npc[player9.MinionAttackTargetNPC]; - if (npc.CanBeChasedBy(projectile, false) && player9.Distance(npc.Center) < num1054) - { - float num1057 = projectile.Distance(npc.Center); - if (num1057 < num1053) - { - num1055 = npc.whoAmI; - } - } + if (CurrentAttackState == AttackState.LaserCharge) + LaserAttackMovement(potentialTarget); + else + PortalAttackMovement(potentialTarget); + UpdateAttackStates(); } + // Attacking movement can be canceled, so if it was, run the passive movement instead. else - { - for (int num1056 = 0; num1056 < Main.maxNPCs; num1056++) - { - NPC nPC13 = Main.npc[num1056]; - if (nPC13.CanBeChasedBy(projectile, false) && player9.Distance(nPC13.Center) < num1054) - { - float num1057 = projectile.Distance(nPC13.Center); - if (num1057 < num1053) - { - num1055 = num1056; - } - } - } - } - if (num1055 != -1) - { - NPC nPC14 = Main.npc[num1055]; - Vector2 vector132 = nPC14.Center - projectile.Center; - (vector132.X > 0f).ToDirectionInt(); - (vector132.Y > 0f).ToDirectionInt(); - float scaleFactor16 = 0.3f; //.4 - if (vector132.Length() < 900f) - { - scaleFactor16 = 0.45f; //.5 - } - if (vector132.Length() < 600f) - { - scaleFactor16 = 0.6f; //.6 - } - if (vector132.Length() < 300f) - { - scaleFactor16 = 0.8f; //.8 - } - if (vector132.Length() > nPC14.Size.Length() * 0.75f) - { - projectile.velocity += Vector2.Normalize(vector132) * scaleFactor16 * 1.5f; - if (Vector2.Dot(projectile.velocity, vector132) < 0.25f) - { - projectile.velocity *= 0.8f; - } - } - float num1058 = 50f; //30 - if (projectile.velocity.Length() > num1058) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * num1058; - } - } - else - { - float num1059 = 0.2f; - Vector2 vector133 = center14 - projectile.Center; - if (vector133.Length() < 200f) - { - num1059 = 0.12f; - } - if (vector133.Length() < 140f) - { - num1059 = 0.06f; - } - if (vector133.Length() > 100f) - { - if (Math.Abs(center14.X - projectile.Center.X) > 20f) - { - projectile.velocity.X = projectile.velocity.X + num1059 * (float)Math.Sign(center14.X - projectile.Center.X); - } - if (Math.Abs(center14.Y - projectile.Center.Y) > 10f) - { - projectile.velocity.Y = projectile.velocity.Y + num1059 * (float)Math.Sign(center14.Y - projectile.Center.Y); - } - } - else if (projectile.velocity.Length() > 2f) - { - projectile.velocity *= 0.96f; - } - if (Math.Abs(projectile.velocity.Y) < 1f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.1f; - } - float num1060 = 25f; //15 - if (projectile.velocity.Length() > num1060) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * num1060; - } - } - 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) + PlayerFollowMovement(owner); + + 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(); + + // If it changed for some reason, fire a net update. This update cannot be blocked by netSpam. + if (previousDirection != projectile.direction) { projectile.netUpdate = true; + if (projectile.netSpam > 59) + projectile.netSpam = 59; } - float num1061 = MathHelper.Clamp(projectile.localAI[0], 0f, 50f); - projectile.position = projectile.Center; - projectile.netSpam = 5; - projectile.scale = 1f + num1061 * 0.01f; - projectile.width = projectile.height = (int)((float)num1051 * projectile.scale); - projectile.Center = projectile.position; - projectile.netSpam = 5; - if (projectile.alpha > 0) - { - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - } - projectile.netSpam = 5; } + private bool TailExists() + { + 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) + continue; + return true; + } + return false; + } + + private bool TargetInSafeBoundaries(NPC target) => target?.Center.Between(WorldTopLeft(), WorldBottomRight()) ?? true; + + private void PlayerFollowMovement(Player owner) + { + // Reset the gate UUID from any previous teleports. + if (EndRiftGateUUID != -1) + { + EndRiftGateUUID = -1; + 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; + } + + float hoverAcceleration = 0.2f; + float distanceFromOwner = projectile.Distance(owner.Center); + if (distanceFromOwner < 200f) + hoverAcceleration = 0.12f; + if (distanceFromOwner < 140f) + hoverAcceleration = 0.06f; + + 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); + } + else if (projectile.velocity.Length() > 1f) + projectile.velocity *= 0.96f; + + 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; + } + + private void LaserAttackMovement(NPC target) + { + // Reset the gate UUID from any previous teleports. + if (EndRiftGateUUID != -1) + { + EndRiftGateUUID = -1; + 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); + + 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; + + // 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) + { + AttackStateTimer += LaserRedirectFrames - (AttackStateTimer % LaserChargeFrames); + projectile.netUpdate = true; + } + } + + // On the exact frame the worm enters charge mode, fire 3 lasers and send a net update. + if (AttackStateTimer % (LaserChargeFrames + LaserRedirectFrames) == LaserChargeFrames) + { + // Charge and fire three lasers. + projectile.velocity = projectile.SafeDirectionTo(target.Center) * MaxAttackFlySpeed; + + 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); + } + } + + Main.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. + } + + private void PortalAttackMovement(NPC target) + { + // Instantly abort and switch to laser mode if the target is too close to the edges of the world. + if (!target.Center.Between(WorldTopLeft(37), WorldBottomRight(37))) + { + CurrentAttackState = AttackState.LaserCharge; + EndRiftGateUUID = -1; + projectile.netUpdate = true; + return; + } + + int chargeTime = (int)MathHelper.Min(36 + TotalWormSegments, 70); + if (AttackStateTimer % chargeTime == 0) + { + Vector2 offsetBounds = Vector2.Max(target.Size, new Vector2(425f + TotalWormSegments * 8f)); + Vector2 offset = Main.rand.NextVector2CircularEdge(offsetBounds.X, offsetBounds.Y) * 0.65f; + + // Dont teleport on the very first portal summon. Fly into a portal and THEN teleport later. + if (AttackStateTimer != 0) + { + TeleportStartingPoint = target.Center + offset; + TeleportEndingPoint = target.Center - offset; + } + else + TeleportEndingPoint = projectile.Center + projectile.velocity * chargeTime / 2f; + + // On the starting frame of a teleport, spawn portals. + 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); + + Main.projectile[EndRiftGateUUID].ai[0] = chargeTime; + Main.projectile[EndRiftGateUUID].timeLeft = chargeTime; + } + + // Dont teleport on the very first portal summon. + if (AttackStateTimer != 0) + 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) + continue; + + if (otherProj.type == ModContent.ProjectileType() || otherProj.type == ModContent.ProjectileType()) + { + otherProj.alpha = 0; + if (AttackStateTimer != 0) + 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; + } + } + + private void UpdateAttackStates() + { + // If the current attack state is out of time, pick a new one. + if (++AttackStateTimer >= AttackStateShiftTime) + { + // When leaving portal-charge state, delete any remaining portals spawned by this worm. + if (CurrentAttackState == AttackState.PortalGateCharge) + CleanUpMechwormPortals(); + + CurrentAttackState = CurrentAttackState == AttackState.LaserCharge ? AttackState.PortalGateCharge : AttackState.LaserCharge; + AttackStateTimer = 0; + projectile.netUpdate = true; + } + } + + private void CleanUpMechwormPortals() + { + int portalType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile proj = Main.projectile[i]; + if (proj.type != portalType || !proj.active || proj.owner != projectile.owner) + continue; + + proj.Kill(); + // Spawn a little bit of dust when the portals are destroyed. + if (!Main.dedServ) + for (int j = 0; j < 16; j++) + Dust.NewDustDirect(proj.position, 45, 45, (int)CalamityDusts.PurpleCosmolite); + } + } + #endregion + + #region Drawing + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; @@ -205,20 +427,18 @@ namespace CalamityMod.Projectiles.Summon } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) { + 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); } - /// - /// Determines the distance factor used in mechworm segments to make it adjust based on components of the head. - /// However, eventually even this equation will falter in use. These conditions should never happen with the mechworm, however. - /// - /// The original distance factor. - /// The speed of the mechworm's head. - /// The base of the exponent used in the equation. - /// - public static float ComputeDistance(float initialDistance, float speed, float @base = 0.98f) + + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) { - return initialDistance * (float)Math.Pow(@base, speed); + drawCacheProjsBehindProjectiles.Add(index); } + + #endregion } } diff --git a/Projectiles/Summon/MechwormHead.png b/Projectiles/Summon/MechwormHead.png index ff75841dec..51125cc48c 100644 Binary files a/Projectiles/Summon/MechwormHead.png and b/Projectiles/Summon/MechwormHead.png differ diff --git a/Projectiles/Summon/MechwormLaser.cs b/Projectiles/Summon/MechwormLaser.cs new file mode 100644 index 0000000000..0ed2a1b3da --- /dev/null +++ b/Projectiles/Summon/MechwormLaser.cs @@ -0,0 +1,73 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MechwormLaser : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Laser"); + 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; + } + + public override void AI() + { + // Very quickly fade in. + projectile.alpha = Utils.Clamp(projectile.alpha - 25, 0, 255); + + 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; + } + else + { + projectile.localAI[0] -= 6f; + if (projectile.localAI[0] <= 0f) + { + 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 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); + Main.dust[rainbow].velocity *= 2f; + Main.dust[rainbow].noGravity = true; + } + } + } +} diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index 27b8e896f8..a00363ac84 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -1,6 +1,6 @@ -using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 38; - projectile.height = 34; + projectile.width = 24; + projectile.height = 24; projectile.friendly = true; projectile.ignoreWater = true; projectile.alpha = 255; @@ -33,140 +33,42 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.localNPCHitCooldown = 10; + projectile.hide = true; } public override void AI() { - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; - if (player9.maxMinions > playerMinionSlots) - { - playerMinionSlots = player9.maxMinions; - } + Player owner = Main.player[projectile.owner]; + if (owner.maxMinions > playerMinionSlots) + playerMinionSlots = owner.maxMinions; + if (runCheck) { runCheck = false; - playerMinionSlots = player9.maxMinions; + playerMinionSlots = owner.maxMinions; } - CalamityPlayer modPlayer = player9.Calamity(); - if ((int)Main.time % 120 == 0) - { - projectile.netUpdate = true; - } - int byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); - if (!player9.active || player9.maxMinions < playerMinionSlots) - { - int lostSlots = playerMinionSlots - player9.maxMinions; - while (lostSlots > 0) - { - Projectile ahead = Main.projectile[byUUID]; - // Each body slot is actually 0.5 slots. Kill two segments to lose 1 "true" slot. - for (int i = 0; i < 2; i++) - { - if (ahead.type != ModContent.ProjectileType()) - { - projectile.localAI[1] = ahead.localAI[1]; - } - projectile.ai[0] = ahead.ai[0]; - projectile.ai[1] = 1f; - projectile.netUpdate = true; - ahead.Kill(); - byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]); - ahead = Main.projectile[byUUID]; - } - lostSlots--; - } - playerMinionSlots = player9.maxMinions; - } - int num1051 = 10; - if (player9.dead) - { - modPlayer.mWorm = false; - } - if (modPlayer.mWorm) - { - projectile.timeLeft = 2; - } - Vector2 value68 = Vector2.Zero; - if (projectile.ai[1] == 1f) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - float num1064; - float scaleFactor17; - float scaleFactor18; - if (byUUID >= 0 && Main.projectile[byUUID].active && (Main.projectile[byUUID].type == ModContent.ProjectileType() || - Main.projectile[byUUID].type == ModContent.ProjectileType() || - Main.projectile[byUUID].type == ModContent.ProjectileType())) - { - value68 = Main.projectile[byUUID].Center; - num1064 = Main.projectile[byUUID].rotation; - float num1063 = MathHelper.Clamp(Main.projectile[byUUID].scale, 0f, 50f); - // Calculations have a safeguard against division by 0. - float speed = 0f; - 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()) - { - speed = Main.projectile[i].velocity.Length(); - break; - } - } - scaleFactor17 = MechwormHead.ComputeDistance(16f, speed); - scaleFactor18 = num1063; - Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f; - if (Main.projectile[byUUID].type != ModContent.ProjectileType()) - { - Main.projectile[byUUID].localAI[1] = (float)projectile.whoAmI; - } - if (projectile.owner == Main.myPlayer && Main.projectile[byUUID].type == ModContent.ProjectileType() && projectile.type == ModContent.ProjectileType()) - { - Main.projectile[byUUID].Kill(); - projectile.Kill(); - return; - } - } - else - { - projectile.Kill(); - return; - } - projectile.alpha -= 42; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - projectile.velocity = Vector2.Zero; - Vector2 vector134 = value68 - projectile.Center; - if (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.netSpam = 5; - projectile.scale = scaleFactor18; - projectile.width = projectile.height = (int)((float)num1051 * projectile.scale); - projectile.Center = projectile.position; - projectile.netSpam = 5; - if (vector134 != Vector2.Zero) - { - projectile.Center = value68 - Vector2.Normalize(vector134) * projectile.Size.Length() * scaleFactor18 * 0.2f; - } - projectile.spriteDirection = (vector134.X > 0f) ? 1 : -1; - projectile.netSpam = 5; - return; + projectile.localAI[0] = 0f; + + MechwormBody.SegmentAI(projectile, 16, ref playerMinionSlots); } 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); + 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 void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindProjectiles.Add(index); + } + + public override bool ShouldUpdatePosition() => false; } } diff --git a/Projectiles/Summon/MechwormTail.png b/Projectiles/Summon/MechwormTail.png index 4831fd658e..1b8899fe11 100644 Binary files a/Projectiles/Summon/MechwormTail.png and b/Projectiles/Summon/MechwormTail.png differ diff --git a/Projectiles/Summon/MechwormTeleportRift.cs b/Projectiles/Summon/MechwormTeleportRift.cs new file mode 100644 index 0000000000..f8c8eb02d3 --- /dev/null +++ b/Projectiles/Summon/MechwormTeleportRift.cs @@ -0,0 +1,99 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MechwormTeleportRift : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/StarProj"; + + public ref float GeneralRotationalOffset => ref projectile.ai[0]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rift"); + 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; + } + + public override void AI() + { + if (projectile.ai[0] == 0f) + projectile.ai[0] = 45f; + + GeneralRotationalOffset += MathHelper.Pi / 8f; + projectile.Opacity = MathHelper.Clamp(GeneralRotationalOffset, 0f, 1f); + + 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.velocity.X = 0f; + dust.noGravity = true; + dust.position = projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(4f, 20f); + dust.fadeIn = 1f; + dust.scale = 0.5f; + } + } + + 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); + 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; + baseColor *= 0.5f; + baseColor.A = 0; + Color colorA = baseColor; + Color colorB = baseColor * 0.5f; + colorA *= currentFade; + colorB *= currentFade; + Vector2 origin = texture.Size() / 2f; + Vector2 scale = new Vector2(3f, 7f) * projectile.Opacity * projectile.scale * currentFade; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver2, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, 0f, origin, scale, spriteEffects, 0); + 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 + GeneralRotationalOffset * 0.25f, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, GeneralRotationalOffset * 0.25f, origin, scale, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver2 + GeneralRotationalOffset * 0.5f, origin, scale * 0.8f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, GeneralRotationalOffset * 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 + GeneralRotationalOffset * 0.75f, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorA, MathHelper.PiOver4 * 3f + GeneralRotationalOffset * 0.75f, origin, scale * 0.6f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 + GeneralRotationalOffset, origin, scale * 0.4f, spriteEffects, 0); + spriteBatch.Draw(texture, drawPos, null, colorB, MathHelper.PiOver4 * 3f + GeneralRotationalOffset, origin, scale * 0.4f, spriteEffects, 0); + + return false; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/MidnightSunBeaconProj.cs b/Projectiles/Summon/MidnightSunBeaconProj.cs index a5bc92c304..8d2ab5d3a6 100644 --- a/Projectiles/Summon/MidnightSunBeaconProj.cs +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class MidnightSunBeaconProj : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Summon/MidnightSunBeacon"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beacon"); diff --git a/Projectiles/Summon/MidnightSunBeaconProj.png b/Projectiles/Summon/MidnightSunBeaconProj.png deleted file mode 100644 index fc4de89b2d..0000000000 Binary files a/Projectiles/Summon/MidnightSunBeaconProj.png and /dev/null differ diff --git a/Projectiles/Summon/MidnightSunLaser.cs b/Projectiles/Summon/MidnightSunLaser.cs index 3027455004..94be9d4488 100644 --- a/Projectiles/Summon/MidnightSunLaser.cs +++ b/Projectiles/Summon/MidnightSunLaser.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f3132eea99..12c6f6f0ae 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -95,12 +95,12 @@ namespace CalamityMod.Projectiles.Summon } 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.DirectionTo(destination) * 24f, 0.03f); - if (projectile.ai[0] % 3f == 2f && potentialTarget.Top.Y > projectile.Bottom.Y) + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(destination) * 24f, 0.03f); + + if (projectile.ai[0] % 4f == 3f && potentialTarget.Top.Y > projectile.Bottom.Y) { - Projectile.NewProjectile(projectile.Bottom, projectile.DirectionTo(potentialTarget.Center).RotatedByRandom(0.15f) * 25f, - 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); } @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.velocity = (projectile.velocity * 15f + projectile.DirectionTo(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; if (distanceVector.Length() > DistanceToCheck * 1.5f) @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 047bedfc93..ad025c0a84 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -17,12 +18,24 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (100f + - (CalamityWorld.downedDoG ? 100f : 0f) + - (CalamityWorld.downedYharon ? 100f : 0f) + - (modPlayer.profanedCrystalBuffs ? 700f : 0f)); - projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); + float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (75f + + (CalamityWorld.downedDoG ? 75f : 0f) + + (CalamityWorld.downedYharon ? 75f : 0f) + + (modPlayer.profanedCrystalBuffs ? 420f : 0f)); + projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage() * 0.7f); ai = type; + if (baseDamage >= 420f) + { + projectile.localNPCHitCooldown = 6; + } + else if (baseDamage == 0) + { + projectile.localNPCHitCooldown = 69; + } + else + { + projectile.localNPCHitCooldown = 9; + } } public override void SendExtraAI(BinaryWriter writer) @@ -70,8 +83,8 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * (type == 1 ? 14f : 20f) + num551) / (type == 1 ? 15f : 21f); - projectile.velocity.Y = (projectile.velocity.Y * (type == 1 ? 14f : 20f) + num552) / (type == 1 ? 15f : 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 { @@ -86,8 +99,8 @@ namespace CalamityMod.Projectiles.Summon projectile.tileCollide = false; int num17 = 100; Vector2 vector3 = projectile.Center; - float num18 = Main.player[projectile.owner].Center.X - vector3.X; - float num19 = Main.player[projectile.owner].Center.Y - vector3.Y; + 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); @@ -95,8 +108,8 @@ namespace CalamityMod.Projectiles.Summon float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; - 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 && + 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.ai[0] = 0f; @@ -107,8 +120,7 @@ namespace CalamityMod.Projectiles.Summon } if (num20 > 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.position = player.position; projectile.netUpdate = true; } if (num20 < 50f) @@ -136,34 +148,34 @@ namespace CalamityMod.Projectiles.Summon if (projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; } } if (projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; } } if (projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; + projectile.velocity.Y += num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += num16 * 2f; } } if (projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; + projectile.velocity.Y -= num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= num16 * 2f; } } break; @@ -191,7 +203,6 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 18000; projectile.timeLeft *= 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -200,7 +211,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().endoCooper) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } else @@ -229,12 +240,13 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } if (!modPlayer.pArtifact || (!modPlayer.profanedCrystal && !modPlayer.tarraSummon && !modPlayer.bloodflareSummon && - !modPlayer.godSlayerSummon && !modPlayer.silvaSummon && !modPlayer.dsSetBonus && !modPlayer.omegaBlueSet && !modPlayer.fearmongerSet)) + !modPlayer.silvaSummon && !modPlayer.dsSetBonus && !modPlayer.omegaBlueSet && !modPlayer.fearmongerSet)) { modPlayer.gOffense = false; projectile.active = false; return; } + projectile.MinionAntiClump(); float num535 = projectile.position.X; float num536 = projectile.position.Y; float num537 = 3000f; @@ -242,9 +254,9 @@ namespace CalamityMod.Projectiles.Summon 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 num539 = ownerMinionAttackTargetNPC2.Center.X; + float num540 = ownerMinionAttackTargetNPC2.Center.Y; + float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); if (num541 < num537) { num537 = num541; @@ -260,9 +272,9 @@ namespace CalamityMod.Projectiles.Summon { 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 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); if (num545 < num537) { num537 = num545; @@ -280,10 +292,12 @@ namespace CalamityMod.Projectiles.Summon } else { - if (player.Calamity().profanedCrystalBuffs) - AI(2, num535, num536, player); - else - AI(1, num535, num536, player); + { + if (player.Calamity().profanedCrystalBuffs) + AI(2, num535, num536, player); + else + AI(1, num535, num536, player); + } } if (projectile.velocity.X > 0.25f) { @@ -312,5 +326,17 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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) + target.AddBuff(ModContent.BuffType(), 300); + } } } diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 5719d88996..c52bf43fbb 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -17,12 +18,24 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (100f + - (CalamityWorld.downedDoG ? 100f : 0f) + - (CalamityWorld.downedYharon ? 100f : 0f) + - (modPlayer.profanedCrystalBuffs ? 700f : 0f)); + float baseDamage = (modPlayer.profanedCrystal && !modPlayer.profanedCrystalBuffs) ? 0f : (75f + + (CalamityWorld.downedDoG ? 75f : 0f) + + (CalamityWorld.downedYharon ? 75f : 0f) + + (modPlayer.profanedCrystalBuffs ? 420f : 0f)); projectile.damage = baseDamage == 0 ? 0 : (int)(baseDamage * player.MinionDamage()); ai = type; + if (baseDamage >= 420f) + { + projectile.localNPCHitCooldown = 6; + } + else if (baseDamage == 0) + { + projectile.localNPCHitCooldown = 69; + } + else + { + projectile.localNPCHitCooldown = 9; + } } public override void SendExtraAI(BinaryWriter writer) @@ -68,8 +81,8 @@ namespace CalamityMod.Projectiles.Summon num553 = num550 / num553; num551 *= num553; num552 *= num553; - projectile.velocity.X = (projectile.velocity.X * (type == 1 ? 14f : 20f) + num551) / (type == 1 ? 15f : 21f); - projectile.velocity.Y = (projectile.velocity.Y * (type == 1 ? 14f : 20f) + num552) / (type == 1 ? 15f : 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 { @@ -84,17 +97,17 @@ namespace CalamityMod.Projectiles.Summon projectile.tileCollide = false; int num17 = 100; Vector2 vector3 = projectile.Center; - float num18 = Main.player[projectile.owner].Center.X - vector3.X; - float num19 = Main.player[projectile.owner].Center.Y - vector3.Y; + 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)player.direction); num19 -= 60f; float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); float num21 = 18f; - 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 && + 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.ai[0] = 0f; @@ -105,8 +118,7 @@ namespace CalamityMod.Projectiles.Summon } if (num20 > 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.position = player.position; projectile.netUpdate = true; } if (num20 < 50f) @@ -134,34 +146,34 @@ namespace CalamityMod.Projectiles.Summon if (projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; } } if (projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; } } if (projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; + projectile.velocity.Y += num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += num16 * 2f; } } if (projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; + projectile.velocity.Y -= num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= num16 * 2f; } } break; @@ -189,7 +201,6 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 18000; projectile.timeLeft *= 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 6; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -205,7 +216,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.player[projectile.owner].Calamity().profanedCrystalBuffs && !Main.player[projectile.owner].Calamity().endoCooper) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } else @@ -233,6 +244,7 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } + projectile.MinionAntiClump(); float num535 = projectile.position.X; float num536 = projectile.position.Y; float num537 = 3000f; @@ -240,9 +252,9 @@ namespace CalamityMod.Projectiles.Summon 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 num539 = ownerMinionAttackTargetNPC2.Center.X; + float num540 = ownerMinionAttackTargetNPC2.Center.Y; + float num541 = Math.Abs(projectile.Center.X - num539) + Math.Abs(projectile.Center.Y - num540); if (num541 < num537) { num537 = num541; @@ -258,9 +270,9 @@ namespace CalamityMod.Projectiles.Summon { 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 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); if (num545 < num537) { num537 = num545; @@ -310,5 +322,17 @@ namespace CalamityMod.Projectiles.Summon projectile.frame = 0; } } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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) + target.AddBuff(ModContent.BuffType(), 300); + } } } diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 1ab9ca526e..35577702b1 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -57,13 +57,14 @@ namespace CalamityMod.Projectiles.Summon projectile.active = false; return; } + projectile.MinionAntiClump(); Player projOwner = Main.player[projectile.owner]; float num16 = 0.5f; 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 = projOwner.position.X + (float)(projOwner.width / 2) - vector3.X; - float num19 = projOwner.position.Y + (float)(projOwner.height / 2) - vector3.Y; + 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); num18 += (float)Main.rand.Next(-10, 21); num18 += (float)(60 * -(float)projOwner.direction); @@ -83,8 +84,7 @@ namespace CalamityMod.Projectiles.Summon } if (num20 > 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.position = projOwner.position; projectile.netUpdate = true; } if (num20 < 50f) @@ -112,46 +112,46 @@ namespace CalamityMod.Projectiles.Summon if (projectile.velocity.X < num18) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; if (num16 > 0.05f && projectile.velocity.X < 0f) { - projectile.velocity.X = projectile.velocity.X + num16; + projectile.velocity.X += num16; } } if (projectile.velocity.X > num18) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; if (num16 > 0.05f && projectile.velocity.X > 0f) { - projectile.velocity.X = projectile.velocity.X - num16; + projectile.velocity.X -= num16; } } if (projectile.velocity.Y < num19) { - projectile.velocity.Y = projectile.velocity.Y + num16; + projectile.velocity.Y += num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) { - projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + projectile.velocity.Y += num16 * 2f; } } if (projectile.velocity.Y > num19) { - projectile.velocity.Y = projectile.velocity.Y - num16; + projectile.velocity.Y -= num16; if (num16 > 0.05f && projectile.velocity.Y > 0f) { - projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + projectile.velocity.Y -= num16 * 2f; } } - if ((double)projectile.velocity.X > 0.25) + if (projectile.velocity.X > 0.25f) { projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.25) + else if (projectile.velocity.X < -0.25f) { projectile.direction = 1; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } diff --git a/Projectiles/Summon/MortalityBeam.cs b/Projectiles/Summon/MortalityBeam.cs new file mode 100644 index 0000000000..622f0b5b14 --- /dev/null +++ b/Projectiles/Summon/MortalityBeam.cs @@ -0,0 +1,79 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class MortalityBeam : ModProjectile + { + 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; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 20; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.minionSlots = 0f; + projectile.minion = true; + projectile.penetrate = 1; + projectile.timeLeft = 180; + } + + public override void AI() + { + 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); + + 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; + rainbowDust.noGravity = true; + } + } + + Time++; + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + 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); + bolt.localAI[0] = Utils.SelectRandom(Main.rand, redHue, greenHue, blueHue); + } + } + } +} diff --git a/Projectiles/Environment/HotSteam.png b/Projectiles/Summon/MortalityBeam.png similarity index 100% rename from Projectiles/Environment/HotSteam.png rename to Projectiles/Summon/MortalityBeam.png diff --git a/Projectiles/Summon/MortalityBolt.cs b/Projectiles/Summon/MortalityBolt.cs new file mode 100644 index 0000000000..d0083cbc4e --- /dev/null +++ b/Projectiles/Summon/MortalityBolt.cs @@ -0,0 +1,66 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class MortalityBolt : ModProjectile + { + public Color ProjectileColor => Main.hslToRgb(projectile.localAI[0], 1f, 0.5f); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + 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; + } + + public override void AI() + { + 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); + rainbowDust.color = ProjectileColor; + rainbowDust.velocity += projectile.velocity; + rainbowDust.noGravity = true; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) + { + if (!Main.dedServ) + { + for (int i = 0; i < 15; i++) + { + 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/MortalityBolt.png b/Projectiles/Summon/MortalityBolt.png new file mode 100644 index 0000000000..3c8f498e7b Binary files /dev/null and b/Projectiles/Summon/MortalityBolt.png differ diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index 1b8c893917..4dc831be45 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -7,7 +7,6 @@ namespace CalamityMod.Projectiles.Summon { public class OldDukeHeadCorpse : ModProjectile { - public override void SetStaticDefaults() { DisplayName.SetDefault("Absolutely Disgusting Shark Puker"); diff --git a/Projectiles/Summon/PerditionBeacon.cs b/Projectiles/Summon/PerditionBeacon.cs new file mode 100644 index 0000000000..fdd5ec89b8 --- /dev/null +++ b/Projectiles/Summon/PerditionBeacon.cs @@ -0,0 +1,173 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; + +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]; + + // 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; + } + + 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; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + + if (projectile.localAI[0] == 0f) + { + DoInitializationEffects(); + projectile.localAI[0] = 1f; + } + + // Dynamically adjust damage of the minion. + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + 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); + + HandleFrames(); + FollowOwner(); + ProvidePlayerMinionBuffs(); + if (Target != null && projectile.WithinRange(Target.Center, 2200f)) + { + AttackTarget(); + DownwardCrossFade = MathHelper.Clamp(DownwardCrossFade + 0.025f, 0f, 1f); + AttackTime++; + } + else + { + DownwardCrossFade = MathHelper.Clamp(DownwardCrossFade - 0.025f, 0f, 1f); + AttackTime = 0f; + } + + AttackTime++; + } + + internal void DoInitializationEffects() + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + + // Release a burst of fire dust on spawn. + if (Main.dedServ) + return; + + for (int i = 0; i < 55; i++) + { + 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); + fire.noGravity = true; + } + } + + internal void ProvidePlayerMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + + // 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()) + return; + + if (Owner.dead) + Owner.Calamity().perditionBeacon = false; + if (Owner.Calamity().perditionBeacon) + projectile.timeLeft = 2; + } + + internal void HandleFrames() + { + 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; + + if (projectile.WithinRange(destination, 5f) || !projectile.WithinRange(destination, 2200f)) + projectile.Center = destination; + } + + internal void AttackTarget() + { + // Release cinders around the target. + Dust cinder = Dust.NewDustPerfect(Target.Center + Main.rand.NextVector2Circular(800f, 800f), DustID.Fire); + cinder.velocity = Vector2.UnitY * -Main.rand.NextFloat(3f, 7f); + cinder.scale = 1f + cinder.velocity.Length() * 0.17f; + cinder.noGravity = true; + + int shootRate = (int)MathHelper.Lerp(24f, 3f, Utils.InverseLerp(0f, 300f, AttackTime, true)); + AttackTimer++; + + if (AttackTimer < shootRate || Main.myPlayer != projectile.owner) + return; + + AttackTimer = 0f; + projectile.netUpdate = true; + + 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); + rng.Add(ModContent.ProjectileType(), 1f); + + 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); + Projectile.NewProjectile(spawnPosition, shootVelocity, rng.Get(), projectile.damage, projectile.knockBack, projectile.owner); + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (Target is null) + return; + + Texture2D crossTexture = ModContent.GetTexture("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); + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/PerditionBeacon.png b/Projectiles/Summon/PerditionBeacon.png new file mode 100644 index 0000000000..daa5e3f58f Binary files /dev/null and b/Projectiles/Summon/PerditionBeacon.png differ diff --git a/Projectiles/Summon/PerditionCross.png b/Projectiles/Summon/PerditionCross.png new file mode 100644 index 0000000000..e7441f8d10 Binary files /dev/null and b/Projectiles/Summon/PerditionCross.png differ diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 0f8d79935f..d5477c9ce7 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Summon { public class PhantomGuy : ModProjectile { + public override string Texture => "CalamityMod/NPCs/Polterghast/PhantomFuckYou"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom"); @@ -30,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon projectile.tileCollide = false; projectile.timeLeft *= 5; projectile.minion = true; + projectile.extraUpdates = 1; } public override void AI() @@ -43,8 +46,8 @@ namespace CalamityMod.Projectiles.Summon 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 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; @@ -54,7 +57,7 @@ namespace CalamityMod.Projectiles.Summon } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + int damage2 = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; @@ -127,13 +130,13 @@ namespace CalamityMod.Projectiles.Summon vector47.Normalize(); if (num648 > 200f) { - float scaleFactor2 = 18f; //12 + float scaleFactor2 = 18f; vector47 *= scaleFactor2; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } else { - float num649 = 9f; + float num649 = 12f; vector47 *= -num649; projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; } @@ -162,10 +165,10 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] = 0f; projectile.netUpdate = true; } - if (num651 > 2000f) + if (num651 > 3500f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2); + projectile.position.X = player.Center.X - (projectile.width / 2); + projectile.position.Y = player.Center.Y - (projectile.height / 2); projectile.netUpdate = true; } if (num651 > 70f) @@ -182,17 +185,17 @@ namespace CalamityMod.Projectiles.Summon } if (flag25) { - projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46) + MathHelper.Pi, 0.1f); + projectile.rotation = projectile.rotation.AngleTowards(projectile.AngleTo(vector46), 0.1f); } else { - projectile.rotation = projectile.velocity.ToRotation() + MathHelper.Pi; + projectile.rotation = projectile.velocity.ToRotation(); } if (projectile.ai[1] > 0f) { - projectile.ai[1] += (float)Main.rand.Next(1, 4); + projectile.ai[1] += Main.rand.Next(1, 3); } - if (projectile.ai[1] > 90f) + if (projectile.ai[1] > 75f) { projectile.ai[1] = 0f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/PhantomGuy.png b/Projectiles/Summon/PhantomGuy.png deleted file mode 100644 index b842e7e9b6..0000000000 Binary files a/Projectiles/Summon/PhantomGuy.png and /dev/null differ diff --git a/Projectiles/Summon/PhantomicDagger.cs b/Projectiles/Summon/PhantomicDagger.cs new file mode 100644 index 0000000000..9743ca8ffd --- /dev/null +++ b/Projectiles/Summon/PhantomicDagger.cs @@ -0,0 +1,157 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + class PhantomicDagger : ModProjectile + { + private bool homing = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantom Dagger"); + 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; + } + + public override bool? CanHitNPC(NPC target) + { + if (homing) + return null; //cannot hit until it is beginning to home. + return false; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(homing); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + homing = reader.ReadBoolean(); + } + + // 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) + { + // Avoid touching things that you probably aren't meant to damage + if (target.defense > 999 || target.Calamity().DR >= 0.95f || target.Calamity().unbreakableDR) + return; + + 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 cap2 = 3; + int oldDamage = damage; + if (projectileCount > cap2) + { + damage -= (int)(oldDamage * ((projectileCount - cap2) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + Main.dust[shadow].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[shadow].scale = 0.5f; + Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[shadow].velocity *= 2f; + } + + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (CalamityConfig.Instance.Afterimages) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + } + return true; + } + + public override void AI() + { + if (Main.dust.Length < Main.maxDust - 3) + { + 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) + Main.dust[dust].noGravity = true; + } + } + if (projectile.alpha != 0) + { + projectile.rotation -= 0.25f; + projectile.velocity.X *= 0.985f; + projectile.velocity.Y *= 0.985f; + if (projectile.alpha < 3) + { + projectile.alpha = 0; + homing = true; + } + else + projectile.alpha -= 3; + } + else + { + 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); + float num551 = target.Center.X - vector43.X; + float num552 = target.Center.Y - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + 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; + } + else + { + projectile.velocity *= 0.9f; + } + projectile.rotation = projectile.velocity.ToRotation() + (float)Math.Atan(90); + } + } + } +} diff --git a/Projectiles/Summon/PhantomicDagger.png b/Projectiles/Summon/PhantomicDagger.png new file mode 100644 index 0000000000..d0f6ad90ae Binary files /dev/null and b/Projectiles/Summon/PhantomicDagger.png differ diff --git a/Projectiles/Summon/PhantomicShield.cs b/Projectiles/Summon/PhantomicShield.cs new file mode 100644 index 0000000000..d0dc4f5727 --- /dev/null +++ b/Projectiles/Summon/PhantomicShield.cs @@ -0,0 +1,109 @@ +using CalamityMod.Buffs.StatBuffs; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + class PhantomicShield : ModProjectile + { + public const float floatDist = 50f; + + public int deathTimer = 240; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Phantomic Bulwark"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(deathTimer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + deathTimer = reader.ReadInt32(); + } + + public override void Kill(int timeLeft) + { + 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); + Main.dust[shadow].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[shadow].scale = 0.5f; + Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[shadow].velocity *= 2f; + } + } + + public override void AI() + { + 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(); + } + else + { + projectile.ai[0] -= MathHelper.ToRadians(2f); + } + if (target == null) + { + deathTimer--; + } + else + { + 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.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + if (projectile.frame % 2 == 0) + projectile.netUpdate = true; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } + } +} diff --git a/Projectiles/Summon/PhantomicShield.png b/Projectiles/Summon/PhantomicShield.png new file mode 100644 index 0000000000..162c288eb6 Binary files /dev/null and b/Projectiles/Summon/PhantomicShield.png differ diff --git a/Projectiles/Summon/PhoenixFireFriendly.cs b/Projectiles/Summon/PhoenixFireFriendly.cs deleted file mode 100644 index a2eae68f58..0000000000 --- a/Projectiles/Summon/PhoenixFireFriendly.cs +++ /dev/null @@ -1,90 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Summon -{ - public class PhoenixFireFriendly : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Fire"); - ProjectileID.Sets.MinionShot[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 = 200; - } - - public override void AI() - { - 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, 1f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - } - } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - 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)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 30f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; - } - } - - 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 * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(ModContent.BuffType(), 100); - } - } -} diff --git a/Projectiles/Summon/PhoenixFireFriendly.png b/Projectiles/Summon/PhoenixFireFriendly.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Summon/PhoenixFireFriendly.png and /dev/null differ diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 322ec34f58..190eff0efb 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minionSlots = 1f; + projectile.minionSlots = 0.5f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += (float)Main.rand.Next(1, 3); // Reset timer - if (projectile.ai[1] > 70f) + if (projectile.ai[1] > 300f) { projectile.ai[1] = 0f; projectile.netUpdate = true; @@ -238,7 +238,7 @@ 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.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, 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; } diff --git a/Projectiles/Summon/PlagueBeeSmall.cs b/Projectiles/Summon/PlagueBeeSmall.cs index 498bfc334a..26f1efe933 100644 --- a/Projectiles/Summon/PlagueBeeSmall.cs +++ b/Projectiles/Summon/PlagueBeeSmall.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Summon { public class PlagueBeeSmall : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/PlaguenadeBee"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Plague Bee"); diff --git a/Projectiles/Summon/PlagueBeeSmall.png b/Projectiles/Summon/PlagueBeeSmall.png deleted file mode 100644 index 7bbde31901..0000000000 Binary files a/Projectiles/Summon/PlagueBeeSmall.png and /dev/null differ diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs index 559121220d..77a5bf8b73 100644 --- a/Projectiles/Summon/PlaguebringerMK2.cs +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -76,21 +76,19 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity *= 0.9f; } else - { - Vector2 velocity = projectile.DirectionTo(destination) * projectile.Distance(destination) / 36f; - projectile.velocity = velocity; - } + 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) { Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(potentialTarget.Center) * 14f, + projectile.SafeDirectionTo(potentialTarget.Center) * 14f, ModContent.ProjectileType(), (int)(projectile.damage * 0.9), 3f, projectile.owner); Projectile.NewProjectile(projectile.Center, - projectile.DirectionTo(potentialTarget.Center) * 11.5f, + projectile.SafeDirectionTo(potentialTarget.Center) * 11.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.9), 3f, diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index fb8a9e01f4..ebe12c499e 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -102,7 +102,8 @@ namespace CalamityMod.Projectiles.Summon if (dealDamage) { Projectile aura = Projectile.NewProjectileDirect(npc.Center, Vector2.Zero, ModContent.ProjectileType(), dmg, 0f, projectile.owner, l); - aura.Calamity().forceMinion = true; + if (aura.whoAmI.WithinBounds(Main.maxProjectiles)) + aura.Calamity().forceMinion = true; } } } diff --git a/Projectiles/Summon/PlantSeed.cs b/Projectiles/Summon/PlantSeed.cs index 09ba64cec6..590e7b5078 100644 --- a/Projectiles/Summon/PlantSeed.cs +++ b/Projectiles/Summon/PlantSeed.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 78a91fef24..8fd1542a5a 100644 --- a/Projectiles/Summon/PlantSeedGreen.cs +++ b/Projectiles/Summon/PlantSeedGreen.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } diff --git a/Projectiles/Summon/PlateProjectile.cs b/Projectiles/Summon/PlateProjectile.cs index cbdac97176..27f4332fd2 100644 --- a/Projectiles/Summon/PlateProjectile.cs +++ b/Projectiles/Summon/PlateProjectile.cs @@ -51,8 +51,8 @@ namespace CalamityMod.Projectiles.Summon float SpeedX = -projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; float SpeedY = -projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f; int shard = Projectile.NewProjectile(projectile.Center.X + SpeedX, projectile.Center.Y + SpeedY, SpeedX, SpeedY, ProjectileID.CrystalShard, projectile.damage / 2, 0f, projectile.owner); - Main.projectile[shard].Calamity().forceMinion = true; - ProjectileID.Sets.MinionShot[Main.projectile[shard].type] = true; + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].Calamity().forceMinion = true; } } } diff --git a/Projectiles/Summon/PolypLauncherProjectile.cs b/Projectiles/Summon/PolypLauncherProjectile.cs new file mode 100644 index 0000000000..fc0eeee785 --- /dev/null +++ b/Projectiles/Summon/PolypLauncherProjectile.cs @@ -0,0 +1,80 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class PolypLauncherProjectile : ModProjectile + { + public const float Gravity = 0.4f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polyp Chunk"); + 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; + } + + public override void AI() + { + if (projectile.velocity.Y <= 10f) + { + projectile.velocity.Y += Gravity; + } + projectile.ai[0]++; + if (projectile.ai[0] < 10) + { + 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; + } + + public override void Kill(int timeLeft) + { + Main.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_splash += 1; + } + int split = 0; + int shardAmt = Main.rand.Next(1,5); + 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; + //Prevents the projectile speed from being too low + if (shardspeedX < 2f && shardspeedX > -2f) + { + shardspeedX += -projectile.velocity.X; + } + if (shardspeedY > 2f && shardspeedY < 2f) + { + 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)); + split += 1; + } + } + } +} diff --git a/Projectiles/Summon/PolypLauncherProjectile.png b/Projectiles/Summon/PolypLauncherProjectile.png new file mode 100644 index 0000000000..d4fb7e3171 Binary files /dev/null and b/Projectiles/Summon/PolypLauncherProjectile.png differ diff --git a/Projectiles/Summon/PolypLauncherSentry.cs b/Projectiles/Summon/PolypLauncherSentry.cs new file mode 100644 index 0000000000..88b104c1c1 --- /dev/null +++ b/Projectiles/Summon/PolypLauncherSentry.cs @@ -0,0 +1,99 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class PolypLauncherSentry : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polyp Launcher"); + 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; + } + + public override void AI() + { + 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; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = damage2; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.velocity.Y += 0.5f; + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + + projectile.StickToTiles(false, false); + + if (projectile.ai[0] > 0f) + { + projectile.ai[0] -= 1f; + return; + } + projectile.ai[1] += Main.rand.Next(1,3); + + NPC potentialTarget = projectile.Center.MinionHoming(800f, player, false); + + if (projectile.owner == Main.myPlayer && potentialTarget != null) + { + if (projectile.ai[1] > 40f) + { + Vector2 spawnPosition = new Vector2(projectile.oldPosition.X + (projectile.width / 2), projectile.oldPosition.Y + (projectile.height / 2)); + + float shootSpeed = 16f; + float gravity = -PolypLauncherProjectile.Gravity; + float distance = Vector2.Distance(spawnPosition, potentialTarget.Center); + 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(); + + Projectile.NewProjectile(spawnPosition, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/PolypLauncherSentry.png b/Projectiles/Summon/PolypLauncherSentry.png new file mode 100644 index 0000000000..605f9b0719 Binary files /dev/null and b/Projectiles/Summon/PolypLauncherSentry.png differ diff --git a/Projectiles/Summon/PolypLauncherShrapnel.cs b/Projectiles/Summon/PolypLauncherShrapnel.cs new file mode 100644 index 0000000000..69dff708fe --- /dev/null +++ b/Projectiles/Summon/PolypLauncherShrapnel.cs @@ -0,0 +1,65 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class PolypLauncherShrapnel : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polyp Shrapnel"); + 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; + } + + public override void AI() + { + //Rotation and gravity + projectile.rotation += 0.6f * projectile.direction; + projectile.velocity.Y += 0.27f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override void Kill(int timeLeft) + { + //Dust effect + 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); + splash += 1; + } + } + + 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) + { + texture = ModContent.GetTexture("CalamityMod/Projectiles/Summon/PolypLauncherShrapnel2"); + } + if (projectile.ai[0] == 2f) + { + texture = ModContent.GetTexture("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); + return false; + } + } +} diff --git a/Projectiles/Summon/PolypLauncherShrapnel.png b/Projectiles/Summon/PolypLauncherShrapnel.png new file mode 100644 index 0000000000..94fe76c650 Binary files /dev/null and b/Projectiles/Summon/PolypLauncherShrapnel.png differ diff --git a/Projectiles/Summon/PolypLauncherShrapnel2.png b/Projectiles/Summon/PolypLauncherShrapnel2.png new file mode 100644 index 0000000000..08c20fef73 Binary files /dev/null and b/Projectiles/Summon/PolypLauncherShrapnel2.png differ diff --git a/Projectiles/Summon/PolypLauncherShrapnel3.png b/Projectiles/Summon/PolypLauncherShrapnel3.png new file mode 100644 index 0000000000..b4ca87e39c Binary files /dev/null and b/Projectiles/Summon/PolypLauncherShrapnel3.png differ diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs index c04550dbc3..d946a9477b 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -151,10 +151,8 @@ namespace CalamityMod.Projectiles.Summon projectile.velocity = Utils.NextVector2Unit(Main.rand) * 12f; projectile.netUpdate = true; } - else if (projectile.Distance(player.Center) > 90f) - { - projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(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(); } diff --git a/Projectiles/Summon/PrincessMissile.cs b/Projectiles/Summon/PrincessMissile.cs index ef67769255..35f75c92bd 100644 --- a/Projectiles/Summon/PrincessMissile.cs +++ b/Projectiles/Summon/PrincessMissile.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Summon { public class PrincessMissile : ModProjectile { + public override string Texture => "CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissile"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hive Bomb"); @@ -77,7 +79,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/PrincessMissile.png b/Projectiles/Summon/PrincessMissile.png deleted file mode 100644 index 3d288c7cdf..0000000000 Binary files a/Projectiles/Summon/PrincessMissile.png and /dev/null differ diff --git a/Projectiles/Summon/ProfanedCrystalRangedSmalls.png b/Projectiles/Summon/ProfanedCrystalRangedSmalls.png index 385e7d67b1..102b893fb6 100644 Binary files a/Projectiles/Summon/ProfanedCrystalRangedSmalls.png and b/Projectiles/Summon/ProfanedCrystalRangedSmalls.png differ diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index a13f89d86e..8c72742204 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Summon { public class ProfanedEnergy : ModProjectile { + public override string Texture => "CalamityMod/NPCs/NormalNPCs/ImpiousImmolator"; + private float count = 0f; public override void SetStaticDefaults() @@ -145,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon ModContent.ProjectileType(), ModContent.ProjectileType() }); - float speed = Main.rand.Next(20, 30); //modify the speed the projectile are shot. Lower number = slower projectile. + float speed = 25f; 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; @@ -154,7 +156,7 @@ namespace CalamityMod.Projectiles.Summon 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] = 8f; + projectile.ai[0] = 16f; } } } diff --git a/Projectiles/Summon/ProfanedEnergy.png b/Projectiles/Summon/ProfanedEnergy.png deleted file mode 100644 index 84082faf9b..0000000000 Binary files a/Projectiles/Summon/ProfanedEnergy.png and /dev/null differ diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 905d11af2a..38e65e8656 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= 8f; int proj = Projectile.NewProjectile(projectile.Center + outerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); - if (proj != -1) + if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; if (innerSplits > 0) //only runs if there's still inner splits to create { @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= 5f; proj = Projectile.NewProjectile(projectile.Center + innerPosVec, velocity, ModContent.ProjectileType(), damage, projectile.knockBack, projectile.owner, 0f, 0f); - if (proj != -1) + if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMinion = true; } innerSplits--; @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Summon 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); - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3, texture2D13); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 3, texture2D13); return false; } @@ -469,7 +469,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } @@ -627,7 +627,8 @@ namespace CalamityMod.Projectiles.Summon correctedVelocity.Normalize(); correctedVelocity *= 25f; int proj = Projectile.NewProjectile(pos, correctedVelocity, ModContent.ProjectileType(), (int)((double)projectile.damage * 1.5f), projectile.knockBack, projectile.owner, 2); - Main.projectile[proj].Calamity().forceMinion = true; + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().forceMinion = true; ((ProfanedCrystalRangedHuges)Main.projectile[proj].modProjectile).boomerSwarm = true; } } @@ -707,7 +708,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 2); return false; } @@ -1299,7 +1300,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 316b161435..9b0449f328 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Summon projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - projectile.minionSlots = 1f; + projectile.minionSlots = 0.5f; projectile.timeLeft = 18000; projectile.penetrate = -1; projectile.tileCollide = false; diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index 718b0202de..6bcaedbc13 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -99,19 +99,20 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 2; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(20f), MathHelper.ToRadians(20f), i / 2f); - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f, - ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); + Vector2 fireVelocity = projectile.SafeDirectionTo(potentialTarget.Center).RotatedBy(angle) * 15f; + Projectile.NewProjectile(projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } } if (projectile.ai[1] % radiantOrbAppearRate == radiantOrbAppearRate - 1) { - Projectile.NewProjectile(projectile.Center + Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(100f, 360f), - projectile.DirectionTo(potentialTarget.Center) * 2f, ModContent.ProjectileType(), radiantOrbDamage, projectile.knockBack * 4f, projectile.owner); + Vector2 spawnPosition = projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(100f, 360f); + Vector2 bootlegRadianceOrbVelocity = projectile.SafeDirectionTo(potentialTarget.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); - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f, - ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); + Vector2 fireVelocity = projectile.SafeDirectionTo(potentialTarget.Center).RotatedBy(angle) * 19f; + Projectile.NewProjectile(projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, projectile.knockBack, projectile.owner); } } } diff --git a/Projectiles/Summon/RadiantResolutionFire.cs b/Projectiles/Summon/RadiantResolutionFire.cs index 97f276bef3..78487162b3 100644 --- a/Projectiles/Summon/RadiantResolutionFire.cs +++ b/Projectiles/Summon/RadiantResolutionFire.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class RadiantResolutionFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Fire"); @@ -31,9 +33,7 @@ namespace CalamityMod.Projectiles.Summon dust.noGravity = true; NPC potentialTarget = projectile.Center.MinionHoming(1750f, player); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(potentialTarget.Center) * 20f) / 20f; - } + projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(potentialTarget.Center) * 20f) / 20f; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/RadiantResolutionFire.png b/Projectiles/Summon/RadiantResolutionFire.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Summon/RadiantResolutionFire.png and /dev/null differ diff --git a/Projectiles/Summon/RadiantResolutionOrb.cs b/Projectiles/Summon/RadiantResolutionOrb.cs index 3fb5706260..a511f4f07b 100644 --- a/Projectiles/Summon/RadiantResolutionOrb.cs +++ b/Projectiles/Summon/RadiantResolutionOrb.cs @@ -55,9 +55,7 @@ namespace CalamityMod.Projectiles.Summon { NPC potentialTarget = projectile.Center.MinionHoming(2000f, player); if (potentialTarget != null) - { - projectile.velocity = (projectile.velocity * 7f + projectile.DirectionTo(potentialTarget.Center) * 19f) / 8f; - } + projectile.velocity = (projectile.velocity * 7f + projectile.SafeDirectionTo(potentialTarget.Center) * 19f) / 8f; } } } diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs deleted file mode 100644 index 9a8949e334..0000000000 --- a/Projectiles/Summon/ReaverOrb.cs +++ /dev/null @@ -1,136 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class ReaverOrb : ModProjectile - { - public int dust = 3; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Reaver Orb"); - ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 50; - projectile.netImportant = true; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.minion = true; - projectile.minionSlots = 0f; - projectile.timeLeft = 18000; - projectile.alpha = 50; - 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]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.reaverOrb) - { - projectile.active = false; - return; - } - if (flag64) - { - if (player.dead) - { - modPlayer.rOrb = false; - } - if (modPlayer.rOrb) - { - projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - 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, 157, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; - } - } - if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; - } - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 1f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; - if (player.gravDir == -1f) - { - projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = MathHelper.Pi; - } - else - { - projectile.rotation = 0f; - } - projectile.position.X = (float)(int)projectile.position.X; - projectile.position.Y = (float)(int)projectile.position.Y; - if (projectile.owner == Main.myPlayer) - { - if (projectile.ai[0] != 0f) - { - projectile.ai[0] -= 1f; - return; - } - bool foundTarget = false; - float maxDist = 600f; - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - 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)) - { - foundTarget = true; - break; - } - } - } - if (foundTarget) - { - int projAmt = Main.rand.Next(4, 9); - for (int u = 0; u < projAmt; u++) - { - Vector2 source = new Vector2(projectile.Center.X - 4f, projectile.Center.Y); - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 90f, 120f); - int spore = Projectile.NewProjectile(source, velocity, ProjectileID.SporeGas + Main.rand.Next(3), projectile.damage, 1.5f, projectile.owner, 0f, 0f); - Main.projectile[spore].minionSlots = 0f; - Main.projectile[spore].Calamity().forceMinion = true; - Main.projectile[spore].usesLocalNPCImmunity = true; - Main.projectile[spore].localNPCHitCooldown = 30; - } - Main.PlaySound(SoundID.Item77, projectile.position); - projectile.ai[0] = 50f; - } - } - } - - public override bool CanDamage() - { - return false; - } - } -} diff --git a/Projectiles/Summon/RustShrapnel.cs b/Projectiles/Summon/RustShrapnel.cs index 336e16ce96..6af2946d43 100644 --- a/Projectiles/Summon/RustShrapnel.cs +++ b/Projectiles/Summon/RustShrapnel.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Projectiles.Summon { public class RustShrapnel : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Rogue/BarrelShrapnel"; + public bool HitTile = false; public override void SetStaticDefaults() { @@ -73,7 +75,7 @@ namespace CalamityMod.Projectiles.Summon } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } } diff --git a/Projectiles/Summon/RustShrapnel.png b/Projectiles/Summon/RustShrapnel.png deleted file mode 100644 index 7e787acdea..0000000000 Binary files a/Projectiles/Summon/RustShrapnel.png and /dev/null differ diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 042137dfe4..1cdc716486 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Summon { if (projectile.Distance(player.Center) > 120f) { - projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.DirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); + projectile.velocity = (projectile.velocity * PlayerHomingInertia + projectile.SafeDirectionTo(player.Top) * PlayerHomingSpeed) / (PlayerHomingInertia + 1); } if (projectile.frame >= 8) { @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon { // 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.DirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); + projectile.velocity = (projectile.velocity * NPCHomingInertia + projectile.SafeDirectionTo(destination) * NPCHomingSpeed) / (NPCHomingInertia + 1); if (projectile.frame < 8) { projectile.frame = 8; diff --git a/Projectiles/Summon/SageNeedle.cs b/Projectiles/Summon/SageNeedle.cs new file mode 100644 index 0000000000..76f51d3629 --- /dev/null +++ b/Projectiles/Summon/SageNeedle.cs @@ -0,0 +1,75 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class SageNeedle : ModProjectile + { + public const int OnDeathHealValue = 1; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sage Needle"); + 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; + } + + public override void AI() + { + 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; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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 + // at around 344 allocated slots. + float averageDamageMultiplier = (float)(Math.Pow(totalSageSpirits, 0.73D) + Math.Pow(totalSageSpirits, 1.1D)) * 0.5f; + + // 1 slot provides 40 DoT. + // 2 slots provide 76 DoT. + // 3 slots provide 111 DoT. + // 4 slots provide 146 DoT. + // 5 slots provide 182 DoT. + int sagePoisonDamage = (int)(40 * averageDamageMultiplier); + sagePoisonDamage = CalamityUtils.DamageSoftCap(sagePoisonDamage, 270); + + target.AddBuff(ModContent.BuffType(), 300); + target.Calamity().sagePoisonDamage = sagePoisonDamage; + } + + public override void Kill(int timeLeft) + { + if (Main.dedServ) + return; + + 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); + 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/SageNeedle.png b/Projectiles/Summon/SageNeedle.png new file mode 100644 index 0000000000..539aaa7384 Binary files /dev/null and b/Projectiles/Summon/SageNeedle.png differ diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs new file mode 100644 index 0000000000..105c02e434 --- /dev/null +++ b/Projectiles/Summon/SageSpirit.cs @@ -0,0 +1,197 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 bool Initialized = false; + internal Vector2 PlayerFlyStart; + internal Vector2 PlayerFlyOffsetAtEnds; + internal Vector2 PlayerFlyDestination; + + internal const int ShootRate = 40; + 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; + } + + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(Initialized); + writer.Write(SageSpiritIndex); + writer.Write(GeneralTime); + writer.WritePackedVector2(PlayerFlyStart); + writer.WritePackedVector2(PlayerFlyOffsetAtEnds); + writer.WritePackedVector2(PlayerFlyDestination); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + Initialized = reader.ReadBoolean(); + SageSpiritIndex = reader.ReadSingle(); + GeneralTime = reader.ReadSingle(); + PlayerFlyStart = reader.ReadPackedVector2(); + PlayerFlyOffsetAtEnds = reader.ReadPackedVector2(); + PlayerFlyDestination = reader.ReadPackedVector2(); + } + + public override void AI() + { + GeneralTime++; + ProvidePlayerMinionBuffs(); + Initialize(); + DetermineFrames(); + NPC potentialTarget = projectile.Center.MinionHoming(750f, Owner); + if (potentialTarget is null) + FlyNearOwner(); + else + { + ResetOwnerFlyValues(); + AttackTarget(potentialTarget); + } + } + + internal void ProvidePlayerMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + + // 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()) + return; + + if (Owner.dead) + Owner.Calamity().sageSpirit = false; + if (Owner.Calamity().sageSpirit) + projectile.timeLeft = 2; + } + + internal void Initialize() + { + if (Initialized) + return; + + Initialized = true; + PlayerFlyTime = 1f; + PlayerFlyOffsetAtEnds = Vector2.UnitY; + 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]; + } + + internal void ResetOwnerFlyValues() + { + PlayerFlyTime = 0f; + PlayerFlyOffsetAtEnds = Vector2.Zero; + PlayerFlyStart = PlayerFlyDestination = -Vector2.One; + projectile.netUpdate = true; + } + + internal void FlyNearOwner() + { + Vector2 destination = Owner.Center + Vector2.UnitX * Owner.width * 1.6f * Owner.direction; + + int totalSageSpirits = Owner.ownedProjectileCounts[projectile.type]; + destination += (SageSpiritIndex * MathHelper.TwoPi / totalSageSpirits).ToRotationVector2() * 70f; + if (PlayerFlyTime >= 1f) + { + projectile.Center = PlayerFlyDestination; + ResetOwnerFlyValues(); + return; + } + + 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; + PlayerFlyOffsetAtEnds = Vector2.UnitY * distanceFromDestination; + PlayerFlyDestination = destination; + projectile.netUpdate = true; + PlayerFlyTime = 0.01f; + return; + } + + projectile.position.Y += (float)Math.Cos(GeneralTime / 60f * MathHelper.TwoPi + projectile.identity * 1.1f) * 0.5f; + + if (distanceFromDestination < 160f && PlayerFlyTime <= 0f) + return; + + // A catmull-rom spline attempts to find a smooth arc of two points based on a 0-1 interpolant. + // Its results are always within the bounds of the second and third term. They are intended to be the "middle" of the spline. + // 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( + PlayerFlyStart + PlayerFlyOffsetAtEnds, + PlayerFlyStart, + PlayerFlyDestination, + PlayerFlyDestination + PlayerFlyOffsetAtEnds, + PlayerFlyTime); + + PlayerFlyTime = MathHelper.Clamp(PlayerFlyTime + 0.03f, 0f, 1f); + } + + internal void AttackTarget(NPC target) + { + AttackTimer++; + + 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); + + // Frequently release a bunch of spikes. + if (projectile.owner == Main.myPlayer && AttackTimer % ShootRate == ShootRate - 1) + { + for (int i = 0; i < 3; i++) + { + Vector2 spikeVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.56f, 0.56f, i / 3f)) * 6f; + Projectile.NewProjectile(projectile.Top, spikeVelocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); + } + } + } + + // The spirit itself should not do direct damage. + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/SageSpirit.png b/Projectiles/Summon/SageSpirit.png new file mode 100644 index 0000000000..6bd3337fd9 Binary files /dev/null and b/Projectiles/Summon/SageSpirit.png differ diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index 06852ff327..5e68028f20 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -86,11 +86,8 @@ namespace CalamityMod.Projectiles.Summon if (homeIn) { - Vector2 homeInVector = projectile.DirectionTo(center); - if (homeInVector.HasNaNs()) - homeInVector = Vector2.UnitY; - - projectile.velocity = (projectile.velocity * 20f + homeInVector * 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); diff --git a/Projectiles/Summon/SandBolt.cs b/Projectiles/Summon/SandBolt.cs index 9a76b93e71..2f435e2922 100644 --- a/Projectiles/Summon/SandBolt.cs +++ b/Projectiles/Summon/SandBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Summon { public class SandBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Summon/SandBolt.png b/Projectiles/Summon/SandBolt.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Summon/SandBolt.png and /dev/null differ diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 7085205f54..d26e86b001 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -35,11 +35,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index b5eb286cb6..d3fedfb327 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -34,11 +34,7 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/SandMark.cs b/Projectiles/Summon/SandMark.cs index 15aef08a1d..0f51a49245 100644 --- a/Projectiles/Summon/SandMark.cs +++ b/Projectiles/Summon/SandMark.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class SandMark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); @@ -26,11 +28,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 30 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 30; } public override void AI() diff --git a/Projectiles/Summon/SandMark.png b/Projectiles/Summon/SandMark.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Summon/SandMark.png and /dev/null differ diff --git a/Projectiles/Summon/SandTornado.cs b/Projectiles/Summon/SandTornado.cs index 620285019e..fd78b7949d 100644 --- a/Projectiles/Summon/SandTornado.cs +++ b/Projectiles/Summon/SandTornado.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class SandTornado : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tornado"); @@ -24,11 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.penetrate = NPC.downedMoonlord ? -1 : 3; projectile.timeLeft = 1200; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Summon/SandTornado.png b/Projectiles/Summon/SandTornado.png deleted file mode 100644 index c97d6cde91..0000000000 Binary files a/Projectiles/Summon/SandTornado.png and /dev/null differ diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index c39f019a34..fc39ac0728 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -32,8 +32,6 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft *= 5; projectile.minion = true; projectile.tileCollide = false; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; } public override void AI() @@ -44,16 +42,16 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) { - 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)) * MathHelper.TwoPi / (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.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + 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; } @@ -64,9 +62,9 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -78,9 +76,6 @@ namespace CalamityMod.Projectiles.Summon } } projectile.MinionAntiClump(0.1f); - Vector2 vector = projectile.position; - float num10 = 1800f; - bool flag = false; if (Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { projectile.alpha += 20; @@ -97,110 +92,106 @@ namespace CalamityMod.Projectiles.Summon projectile.alpha = 60; } } - Vector2 center = Main.player[projectile.owner].Center; - Vector2 value = new Vector2(0.5f); + Vector2 targetPos = projectile.position; + float range = 1800f; + bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; 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)) + 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)) { - num10 = num12; - vector = vector2; - flag = true; + range = npcDist; + targetPos = npc.Center; + foundTarget = true; int num11 = npc.whoAmI; } } } - if (!flag) + if (!foundTarget) { for (int k = 0; k < Main.maxNPCs; k++) { - NPC nPC = Main.npc[k]; - if (nPC.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[k]; + 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)) + 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)) { - num10 = num13; - vector = vector3; - flag = true; + range = npcDist; + targetPos = npc.Center; + foundTarget = true; } } } } - float num16 = 1200f; - if (flag) + float sepAnxietyDist = 1200f; + if (foundTarget) { - num16 = 3000f; + sepAnxietyDist = 3000f; } - if (Vector2.Distance(player.Center, projectile.Center) > num16) + if (Vector2.Distance(player.Center, projectile.Center) > sepAnxietyDist) { projectile.ai[0] = 1f; projectile.netUpdate = true; } - if (flag && projectile.ai[0] == 0f) + if (foundTarget && projectile.ai[0] == 0f) { - Vector2 vector4 = vector - projectile.Center; - float num17 = vector4.Length(); - vector4.Normalize(); - if (num17 > 400f) + Vector2 targetDir = targetPos - projectile.Center; + float targetDist = targetDir.Length(); + targetDir.Normalize(); + if (targetDist > 400f) { - float scaleFactor = 6f; - vector4 *= scaleFactor; - projectile.velocity = (projectile.velocity * 20f + vector4) / 21f; + float speedMult = 6f; + targetDir *= speedMult; + projectile.velocity = (projectile.velocity * 20f + targetDir) / 21f; } else { projectile.velocity *= 0.96f; } - if (num17 > 200f) + if (targetDist > 200f) { - float scaleFactor2 = 12f; - vector4 *= scaleFactor2; - projectile.velocity.X = (projectile.velocity.X * 40f + vector4.X) / 41f; - projectile.velocity.Y = (projectile.velocity.Y * 40f + vector4.Y) / 41f; + float speedMult = 12f; + targetDir *= speedMult; + projectile.velocity = (projectile.velocity * 40f + targetDir) / 41f; } if (projectile.velocity.Y > -1f) { - projectile.velocity.Y = projectile.velocity.Y - 0.1f; + projectile.velocity.Y -= 0.1f; } } else { - if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1)) + if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) { projectile.ai[0] = 1f; } - float num21 = 12f; - Vector2 center2 = projectile.Center; - Vector2 vector6 = player.Center - center2 + new Vector2(0f, -60f) + new Vector2(0f, 40f); - float num23 = vector6.Length(); - if (num23 > 200f && num21 < 12f) + float returnSpeed = 12f; + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -20f); + float playerDist = playerVec.Length(); + if (playerDist > 200f && returnSpeed < 12f) { - num21 = 12f; + returnSpeed = 12f; } - if (num23 < 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; } - if (num23 > 2000f) + if (playerDist > 2000f) { - projectile.position.X = player.Center.X - (float)(projectile.width / 2); - projectile.position.Y = player.Center.Y - (float)(projectile.width / 2); + projectile.position = player.position; projectile.netUpdate = true; } - if (Math.Abs(vector6.X) > 40f || Math.Abs(vector6.Y) > 10f) + if (Math.Abs(playerVec.X) > 40f || Math.Abs(playerVec.Y) > 10f) { - vector6.Normalize(); - vector6 *= num21; - vector6 *= new Vector2(1.25f, 0.65f); - projectile.velocity = (projectile.velocity * 20f + vector6) / 21f; + playerVec.Normalize(); + playerVec *= returnSpeed; + playerVec *= new Vector2(1.25f, 0.65f); + projectile.velocity = (projectile.velocity * 20f + playerVec) / 21f; } else { @@ -214,18 +205,18 @@ namespace CalamityMod.Projectiles.Summon } projectile.rotation = projectile.velocity.X * 0.05f; projectile.frameCounter++; - int num25 = 2; - if (projectile.frameCounter >= 6 * num25) + int two = 2; + if (projectile.frameCounter >= 6 * two) { projectile.frameCounter = 0; } - projectile.frame = projectile.frameCounter / num25; + projectile.frame = projectile.frameCounter / two; if (Main.rand.NextBool(5)) { - int num26 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 85, 0f, 0f, 100, default, 2f); - Main.dust[num26].velocity *= 0.3f; - Main.dust[num26].noGravity = true; - Main.dust[num26].noLight = true; + 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) { @@ -250,9 +241,9 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - float scaleFactor4 = 14f; - int num28 = ModContent.ProjectileType(); - if (flag) + float speed = 14f; + int projType = ModContent.ProjectileType(); + if (foundTarget) { if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { @@ -261,11 +252,11 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner) { - Vector2 vector9 = vector - projectile.Center; - vector9.Normalize(); - vector9 *= scaleFactor4; - int num32 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector9.X, vector9.Y, num28, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num32].netUpdate = true; + Vector2 velocity = targetPos - projectile.Center; + velocity.Normalize(); + velocity *= speed; + int shark = Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, projectile.knockBack, projectile.owner); + Main.projectile[shark].netUpdate = true; projectile.netUpdate = true; } } @@ -276,16 +267,13 @@ 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 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; } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs new file mode 100644 index 0000000000..7805fd543a --- /dev/null +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -0,0 +1,150 @@ +using CalamityMod.Buffs.Summon; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Seeker"); + 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.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 8; + projectile.alpha = 255; + } + + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + DoInitializationEffects(); + projectile.localAI[0] = 1f; + } + + ProvidePlayerMinionBuffs(); + DetermineFrames(); + + projectile.alpha = Utils.Clamp(projectile.alpha - 15, 0, 255); + NPC potentialTarget = projectile.Center.MinionHoming(2050f, Owner); + if (potentialTarget is null) + FlyNearOwner(); + else + AttackTarget(potentialTarget); + Time++; + } + + internal void DoInitializationEffects() + { + if (Main.dedServ) + return; + + for (int i = 0; i < 40; i++) + { + 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()); + brimstoneFire.noGravity = true; + } + } + + internal void ProvidePlayerMinionBuffs() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + + // 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()) + return; + + if (Owner.dead) + Owner.Calamity().soulSeeker = false; + if (Owner.Calamity().soulSeeker) + projectile.timeLeft = 2; + } + + internal void DetermineFrames() + { + 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); + + Vector2 destination = Owner.Center + (MathHelper.TwoPi * CircleAngleRatio - MathHelper.PiOver2).ToRotationVector2() * 310f; + 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(Owner.Center, 1800f)) + { + projectile.Center = Owner.Center; + projectile.velocity = -Vector2.UnitY * 4f; + projectile.netUpdate = true; + } + + projectile.spriteDirection = (destination.X - projectile.Center.X > 0f).ToDirectionInt(); + } + + internal void AttackTarget(NPC target) + { + // Slow down and release a bunch of darts at the enemy for a short interval. + if (Time % 90f > 45f) + { + // Make an imp scream sound every so often. + if (Main.rand.NextBool(400)) + Main.PlaySound(SoundID.DD2_KoboldFlyerChargeScream); + + projectile.velocity *= 0.9f; + if (Time % 16f == 15f) + { + float shootSpeed = 14f; + 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(); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + 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; + } + } +} diff --git a/Projectiles/Summon/SeekerSummonProj.png b/Projectiles/Summon/SeekerSummonProj.png new file mode 100644 index 0000000000..bd3a5924ca Binary files /dev/null and b/Projectiles/Summon/SeekerSummonProj.png differ diff --git a/Projectiles/Summon/SepulcherArm.png b/Projectiles/Summon/SepulcherArm.png new file mode 100644 index 0000000000..b45111f206 Binary files /dev/null and b/Projectiles/Summon/SepulcherArm.png differ diff --git a/Projectiles/Summon/SepulcherForeArm.png b/Projectiles/Summon/SepulcherForeArm.png new file mode 100644 index 0000000000..da24ee8a4f Binary files /dev/null and b/Projectiles/Summon/SepulcherForeArm.png differ diff --git a/Projectiles/Summon/SepulcherHand.png b/Projectiles/Summon/SepulcherHand.png new file mode 100644 index 0000000000..c28935e9f2 Binary files /dev/null and b/Projectiles/Summon/SepulcherHand.png differ diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs new file mode 100644 index 0000000000..7635085c33 --- /dev/null +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -0,0 +1,690 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.NPCs.Other; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SepulcherMinion : ModProjectile + { + public struct SepulcherSegment + { + public Vector2 CurrentPosition; + public float Rotation; + public SepulcherSegment(Vector2 position, float rotation) + { + CurrentPosition = position; + Rotation = rotation; + } + } + + public class SepulcherArm + { + public class SepulcherArmLimb + { + public Vector2 Center; + public float Rotation; + + public SepulcherArmLimb(Vector2 center, float rotation) + { + Center = center; + Rotation = rotation; + } + + public void SendData(BinaryWriter writer) + { + writer.WritePackedVector2(Center); + writer.Write(Rotation); + } + + public static SepulcherArmLimb ReceiveData(BinaryReader reader) => new SepulcherArmLimb(reader.ReadPackedVector2(), reader.ReadSingle()); + } + + public SepulcherArmLimb[] Limbs = new SepulcherArmLimb[2]; + public byte SegmentIndexToAttachTo; + public Vector2 Center; + public float Rotation; + public bool ReelingBack = false; + public bool Direction; + public SepulcherArm(Vector2 center, byte segmentIndexToAttachTo, float rotation, bool reelingBack, bool direction) + { + Center = center; + SegmentIndexToAttachTo = segmentIndexToAttachTo; + Rotation = rotation; + ReelingBack = reelingBack; + Direction = direction; + Limbs = new SepulcherArmLimb[2] + { + new SepulcherArmLimb(center, rotation), + new SepulcherArmLimb(center, rotation) + }; + } + } + + public enum AIState + { + HoverNearOwner, + AttackEnemy_Charge, + AttackEnemy_ReleaseDartBurst, + AttackOwner + } + + public int IdleTimer; + public int AttackTimer; + public int PlayerAttackCountdown; + public SepulcherSegment[] Segments = new SepulcherSegment[24]; + public List Arms = new List(); + public Player Owner => Main.player[projectile.owner]; + public AIState CurrentAIState + { + 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) + return; + + 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 override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + 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; + } + + 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; + } + + #region Syncing + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(IdleTimer); + writer.Write(PlayerAttackCountdown); + writer.Write(Arms.Count); + for (int i = 0; i < Arms.Count; i++) + { + writer.WritePackedVector2(Arms[i].Center); + writer.Write(Arms[i].SegmentIndexToAttachTo); + writer.Write(Arms[i].Rotation); + writer.Write(Arms[i].ReelingBack); + writer.Write(Arms[i].Direction); + Arms[0].Limbs[0].SendData(writer); + Arms[0].Limbs[1].SendData(writer); + } + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + IdleTimer = reader.ReadInt32(); + PlayerAttackCountdown = reader.ReadInt32(); + Arms.Clear(); + for (int i = 0; i < reader.ReadInt32(); i++) + { + Arms.Add(new SepulcherArm(reader.ReadPackedVector2(), reader.ReadByte(), reader.ReadSingle(), reader.ReadBoolean(), reader.ReadBoolean())); + Arms.Last().Limbs[0] = SepulcherArm.SepulcherArmLimb.ReceiveData(reader); + Arms.Last().Limbs[1] = SepulcherArm.SepulcherArmLimb.ReceiveData(reader); + } + } + #endregion + + #region AI + public override void AI() + { + Initialize(); + HandleBuffs(); + HandleFlexibleDamage(); + UpdateSegments(); + + // Fade in rapidly. + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.2f, 0f, 1f); + + NPC potentialTarget = AttemptToFindTarget(1450f); + + // Enter the attack state if a valid enemy is found and go back to hovering otherwise. + // This will be overriden if attacking the owner. + if (CurrentAIState != AIState.AttackEnemy_ReleaseDartBurst && CurrentAIState != AIState.AttackEnemy_Charge) + { + if (potentialTarget != null) + CurrentAIState = AIState.AttackEnemy_ReleaseDartBurst; + } + else if (potentialTarget is null) + { + CurrentAIState = AIState.HoverNearOwner; + AttackTimer = 0; + } + + // Reset the AI to player attack mode if the countdown is going on. + if (PlayerAttackCountdown > 0) + { + if (CurrentAIState != AIState.AttackOwner) + CurrentAIState = AIState.AttackOwner; + + PlayerAttackCountdown--; + + // If it's finished, go back to idle owner hover movement. + if (PlayerAttackCountdown <= 0) + CurrentAIState = AIState.HoverNearOwner; + } + + + // Determine whether the projectile can attack its owner based on the attakc countdown. + projectile.hostile = PlayerAttackCountdown > 0; + + switch (CurrentAIState) + { + case AIState.HoverNearOwner: + HoverNearOwner(); + break; + case AIState.AttackEnemy_ReleaseDartBurst: + AttackEnemyWithDarts(potentialTarget); + AttackTimer++; + break; + case AIState.AttackEnemy_Charge: + AttackEnemyByCharging(potentialTarget); + AttackTimer++; + break; + case AIState.AttackOwner: + AttackOwner(); + break; + } + + // Check if ready to enrage every so often. + IdleTimer++; + if (IdleTimer % 600 == 599) + { + int heartsAttachedToOwner = 0; + 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) + continue; + heartsAttachedToOwner++; + } + + float chanceToBecomeAngry = 0f; + if (heartsAttachedToOwner >= 2) + chanceToBecomeAngry = Utils.InverseLerp(2f, 6f, heartsAttachedToOwner, true); + if (Main.rand.NextFloat() < chanceToBecomeAngry) + { + PlayerAttackCountdown = 300; + projectile.netUpdate = true; + } + else if (Main.netMode != NetmodeID.MultiplayerClient) + NPC.NewNPC((int)Owner.Center.X, (int)Owner.Center.Y, heartType); + } + + if (JawSnapTimer > 0f) + { + JawRotation = JawRotation.AngleTowards(-0.44f, 0.064f); + JawSnapTimer--; + } + else + JawRotation = JawRotation.AngleTowards(0f, 0.03f); + } + + public void Initialize() + { + 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; + + 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) + { + Arms.Add(new SepulcherArm(Segments[i].CurrentPosition, i, rotationalOffset, false, false)); + rotationalOffset = MathHelper.WrapAngle(rotationalOffset + MathHelper.Pi / 6f); + + Arms.Add(new SepulcherArm(Segments[i].CurrentPosition, i, rotationalOffset + MathHelper.Pi, false, true)); + rotationalOffset = MathHelper.WrapAngle(rotationalOffset + MathHelper.Pi / 6f); + } + projectile.netUpdate = true; + } + } + + public void HandleBuffs() + { + // Maintain or remove the Mechworm buff from the owner. + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Owner.dead) + Owner.Calamity().sepulcher = false; + if (Owner.Calamity().sepulcher) + 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) + { + 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; + + // Connect all segments to each-other and calculate their rotations. + for (int i = 0; i < Segments.Length; i++) + { + Vector2 offsetToDestination = aheadPosition - Segments[i].CurrentPosition; + // This variant of segment attachment incorporates rotation. + // 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 != Segments[i].Rotation) + { + float angleOffset = MathHelper.WrapAngle(aheadRotation - Segments[i].Rotation.AngleLerp(aheadRotation, 0.08f)); + offsetToDestination = offsetToDestination.RotatedBy(angleOffset * 0.08f); + } + + Segments[i].Rotation = (aheadPosition - Segments[i].CurrentPosition).ToRotation() + MathHelper.PiOver2; + Segments[i].CurrentPosition = aheadPosition - offsetToDestination.SafeNormalize(Vector2.Zero) * 48f; + + // Adjust the ahead positions before interating further. + aheadPosition = Segments[i].CurrentPosition; + aheadRotation = Segments[i].Rotation; + } + + // Adjust the arms. + for (int i = 0; i < Arms.Count; i++) + { + SepulcherSegment segmentToAttachTo = Segments[Arms[i].SegmentIndexToAttachTo]; + Vector2 idealMovePosition = segmentToAttachTo.CurrentPosition; + 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; + Arms[i].Center = idealMovePosition; + + Vector2 offsetFromSegment = Vector2.Zero; + + offsetFromSegment += new Vector2(direction * 35f, 28f).RotatedBy(segmentToAttachTo.Rotation - (MathHelper.PiOver2 - Arms[i].Rotation * 1.7f - 0.77f) * direction).SafeNormalize(Vector2.UnitY) * 62f; + Arms[i].Limbs[0].Center = segmentToAttachTo.CurrentPosition + offsetFromSegment; + Arms[i].Limbs[0].Rotation = offsetFromSegment.ToRotation(); + + 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); + if (CurrentAIState == AIState.AttackEnemy_Charge) + rotationalVelocityFactor *= 0.85f; + if (CurrentAIState == AIState.AttackOwner) + rotationalVelocityFactor *= 1.2f; + + if (Arms[i].ReelingBack) + { + Arms[i].Rotation -= rotationalVelocityFactor * 0.066f; + if (Arms[i].Rotation < -0.55f) + Arms[i].ReelingBack = false; + } + else + { + Arms[i].Rotation += rotationalVelocityFactor * 0.029f; + if (Arms[i].Rotation > 0.77f) + Arms[i].ReelingBack = true; + } + } + } + + public void HoverNearOwner() + { + // Teleport to the owner if it's very far away. + if (!projectile.WithinRange(Owner.Center, 3200f)) + { + 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)) + { + Vector2 destination = Owner.Center + (IdleTimer / 31f).ToRotationVector2() * 240f; + 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(); + } + else if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.03f; + + // Determine the head rotation. + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public void AttackEnemyWithDarts(NPC target) + { + 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; + + // Release a burst of darts from all segments at the target. + 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); + } + + if (Main.myPlayer == projectile.owner && AttackTimer > 430) + { + CurrentAIState = AIState.AttackEnemy_Charge; + AttackTimer = 0; + } + } + + public void AttackEnemyByCharging(NPC target) + { + 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); + + float updatedDirectionRotation = projectile.velocity.ToRotation().AngleTowards(projectile.AngleTo(destination), 0.12f); + projectile.velocity = updatedDirectionRotation.ToRotationVector2() * projectile.velocity.Length(); + } + else if (projectile.velocity.Length() < 29f) + { + 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)) + JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); + + // If really close, snap. + if (projectile.WithinRange(target.Center, 165f)) + { + Main.PlaySound(SoundID.DD2_SkeletonHurt, projectile.Center); + JawSnapTimer = 45f; + } + } + } + + // Determine the head rotation. + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + + if (Main.myPlayer == projectile.owner && AttackTimer > 480) + { + CurrentAIState = AIState.AttackEnemy_ReleaseDartBurst; + AttackTimer = 0; + } + } + + public void AttackOwner() + { + // Attempt to angle towards the owner. + float newSpeed = MathHelper.Lerp(projectile.velocity.Length(), 21f, 0.025f); + + if (!projectile.WithinRange(Owner.Center, 370f)) + { + 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(); + } + else if (projectile.velocity.Length() < 36f) + { + 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)) + JawRotation = JawRotation.AngleLerp(0.87f, 0.12f); + + // If really close, snap. + if (projectile.WithinRange(Owner.Center, 180f)) + { + Main.PlaySound(SoundID.DD2_SkeletonHurt, projectile.Center); + JawSnapTimer = 45f; + } + } + } + + // Determine the head rotation. + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public NPC AttemptToFindTarget(float searchDistance) + { + NPC closestTarget = null; + + int heartType = ModContent.NPCType(); + if (Owner.HasMinionAttackTargetNPC) + { + NPC targetedNPC = Main.npc[Owner.MinionAttackTargetNPC]; + if (targetedNPC.WithinRange(projectile.Center, searchDistance) && targetedNPC.CanBeChasedBy() && targetedNPC.type != heartType) + return targetedNPC; + } + + float distance = searchDistance * searchDistance; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy() && Main.npc[i].type != heartType) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + + if (Main.npc[i].WithinRange(projectile.Center, distance + extraDistance)) + { + distance = Main.npc[i].DistanceSQ(projectile.Center); + closestTarget = Main.npc[i]; + } + } + } + + return closestTarget; + } + + #endregion + + #region Drawing + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + float angerFactor = Utils.InverseLerp(300f, 280f, PlayerAttackCountdown, true) * Utils.InverseLerp(0f, 30f, PlayerAttackCountdown, true); + float afterimageOutwardness = MathHelper.Lerp(6f, 8f, (float)Math.Cos(Main.GlobalTime * 2.3f) * 0.5f + 0.5f) * angerFactor; + 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"); + + Vector2 drawPosition; + + // Draw the arms. + for (int i = 0; i < Arms.Count; i++) + { + Vector2 forearmDrawPosition = Arms[i].Limbs[0].Center - Main.screenPosition; + Color drawColor = Lighting.GetColor((int)(Arms[i].Limbs[0].Center.X / 16), (int)(Arms[i].Limbs[0].Center.Y / 16)); + + if (afterimageOutwardness > 0f) + { + 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, 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)); + + if (afterimageOutwardness > 0f) + { + 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, 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; + + if (afterimageOutwardness > 0f) + { + 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, null, drawColor, Arms[i].Limbs[1].Rotation - MathHelper.PiOver2, handTexture.Size() * new Vector2(0.5f, 0f), projectile.scale, handDirection, 0f); + } + + // Draw the segments. + for (int i = 0; i < Segments.Length; i++) + { + Texture2D textureToUse = i % 2 == 1 ? bodyTexture2 : bodyTexture; + + // Use the tail texture for the last segment. + if (i == Segments.Length - 1) + textureToUse = tailTexture; + + drawPosition = Segments[i].CurrentPosition - Main.screenPosition; + lightColor = Lighting.GetColor((int)(drawPosition.X + Main.screenPosition.X) / 16, (int)(drawPosition.Y + Main.screenPosition.Y) / 16); + + if (afterimageOutwardness > 0f) + { + 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, null, projectile.GetAlpha(lightColor), Segments[i].Rotation, textureToUse.Size() * 0.5f, projectile.scale, SpriteEffects.None, 0f); + } + + 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. + for (int i = -1; i <= 1; i += 2) + { + 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); + } + + // Draw the head. + if (afterimageOutwardness > 0f) + { + 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, 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++) + { + 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); + } + } + + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // If default collision is possible return true immediately. + if (projHitbox.Intersects(targetHitbox)) + return true; + + // Check based on segments. + for (int i = 0; i < Segments.Length; i++) + { + if (Utils.CenteredRectangle(Segments[i].CurrentPosition, Vector2.One * 52f).Intersects(targetHitbox)) + return true; + } + + return false; + } + + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + { + drawCacheProjsBehindProjectiles.Add(index); + } + + #endregion + + #region Damage Stuff + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + damage = Main.rand.Next(80, 90); + } + + public override bool? CanHitNPC(NPC target) + { + if (target.type == ModContent.NPCType()) + return false; + return null; + } + #endregion + } +} diff --git a/Projectiles/Summon/SepulcherMinionBody.png b/Projectiles/Summon/SepulcherMinionBody.png new file mode 100644 index 0000000000..5e8b75333e Binary files /dev/null and b/Projectiles/Summon/SepulcherMinionBody.png differ diff --git a/Projectiles/Summon/SepulcherMinionBodyAlt.png b/Projectiles/Summon/SepulcherMinionBodyAlt.png new file mode 100644 index 0000000000..7bddb6f35e Binary files /dev/null and b/Projectiles/Summon/SepulcherMinionBodyAlt.png differ diff --git a/Projectiles/Summon/SepulcherMinionEyes.png b/Projectiles/Summon/SepulcherMinionEyes.png new file mode 100644 index 0000000000..29f5267031 Binary files /dev/null and b/Projectiles/Summon/SepulcherMinionEyes.png differ diff --git a/Projectiles/Summon/SepulcherMinionHead.png b/Projectiles/Summon/SepulcherMinionHead.png new file mode 100644 index 0000000000..e1fb445359 Binary files /dev/null and b/Projectiles/Summon/SepulcherMinionHead.png differ diff --git a/Projectiles/Summon/SepulcherMinionJaw.png b/Projectiles/Summon/SepulcherMinionJaw.png new file mode 100644 index 0000000000..11df3bb5ae Binary files /dev/null and b/Projectiles/Summon/SepulcherMinionJaw.png differ diff --git a/Projectiles/Summon/SepulcherMinionTail.png b/Projectiles/Summon/SepulcherMinionTail.png new file mode 100644 index 0000000000..283e094283 Binary files /dev/null and b/Projectiles/Summon/SepulcherMinionTail.png differ diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 31a96b7b64..597c02229e 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -347,7 +347,7 @@ namespace CalamityMod.Projectiles.Summon { NPC npc = Main.npc[npcIndex]; //covers most edge cases like voodoo dolls - if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && + 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)) { diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index b6261124df..2190db47b7 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -164,12 +164,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] += 1f; if (projectile.ai[0] >= 5f) { - Vector2 vector154 = projectile.DirectionTo(Main.npc[num1079].Center); - if (vector154.HasNaNs()) - { - vector154 = Vector2.UnitY; - } - int num1082 = (vector154.X > 0f) ? 1 : -1; + int num1082 = (projectile.SafeDirectionTo(Main.npc[num1079].Center, Vector2.UnitY).X > 0f) ? 1 : -1; projectile.direction = num1082; projectile.ai[0] = -20f; projectile.netUpdate = true; diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index a9c0ebf248..d1ab495e5b 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class SilvaCrystalExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index e5fd753a52..8effbbe2c6 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class SiriusBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -24,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.extraUpdates = 220; projectile.timeLeft = 1000; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; + projectile.localNPCHitCooldown = 110; projectile.tileCollide = false; } diff --git a/Projectiles/Summon/SiriusBeam.png b/Projectiles/Summon/SiriusBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Summon/SiriusBeam.png and /dev/null differ diff --git a/Projectiles/Summon/SiriusExplosion.cs b/Projectiles/Summon/SiriusExplosion.cs index 82033cc14d..e228945983 100644 --- a/Projectiles/Summon/SiriusExplosion.cs +++ b/Projectiles/Summon/SiriusExplosion.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Summon { public class SiriusExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/StarProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Summon/SiriusExplosion.png b/Projectiles/Summon/SiriusExplosion.png deleted file mode 100644 index 0968156e79..0000000000 Binary files a/Projectiles/Summon/SiriusExplosion.png and /dev/null differ diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index e36f826882..248134b6c1 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -68,10 +68,9 @@ namespace CalamityMod.Projectiles.Summon if (target != null) { projectile.ai[1]++; - if (projectile.ai[1] % 55f == 54f && - Main.myPlayer == projectile.owner) + if (projectile.ai[1] % 55f == 54f && Main.myPlayer == projectile.owner) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(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); } } @@ -86,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.velocity = (projectile.velocity * 19f + projectile.DirectionTo(mother.Center) * 16f) / 20f; + projectile.velocity = (projectile.velocity * 19f + projectile.SafeDirectionTo(mother.Center) * 18f) / 20f; } } else diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index 99e696e153..094a4c4d8a 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -74,6 +74,7 @@ namespace CalamityMod.Projectiles.Summon if (target != null) { + projectile.extraUpdates = 1; projectile.ai[0]++; // Arc towards enemy every 60 frames for 30 frames. @@ -82,7 +83,7 @@ namespace CalamityMod.Projectiles.Summon (modulo >= 90 && modulo < 120f)) { if (projectile.velocity.Length() == 0f) - projectile.velocity = projectile.DirectionTo(target.Center).RotatedByRandom(0.5f) * -7f; + 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); @@ -92,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon } else { - projectile.velocity = (projectile.velocity * 44f + projectile.DirectionTo(player.Center) * 13f) / 45f; + projectile.velocity = (projectile.velocity * 44f + projectile.SafeDirectionTo(player.Center) * 24f) / 45f; projectile.ai[0] += 30 - projectile.ai[0] % 30f; } projectile.ai[1] = 1f; @@ -103,16 +104,17 @@ namespace CalamityMod.Projectiles.Summon } if ((modulo >= 30f && modulo <= 60f) || (modulo >= 90f && modulo <= 120f)) { - if (projectile.owner == player.whoAmI && projectile.spriteDirection == (projectile.DirectionTo(target.Center).X > 0).ToDirectionInt()) + if (projectile.owner == player.whoAmI && projectile.spriteDirection == (projectile.SafeDirectionTo(target.Center).X > 0).ToDirectionInt()) { - Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(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) { + projectile.extraUpdates = 0; projectile.ai[1] = 0f; - projectile.velocity = (projectile.velocity * 24f + projectile.DirectionTo(player.Center) * 13f) / 25f; + projectile.velocity = (projectile.velocity * 24f + projectile.SafeDirectionTo(player.Center) * 16f) / 25f; if (projectile.Distance(player.Center) > 3250f) { projectile.Center = player.Center; diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs new file mode 100644 index 0000000000..2141fdc467 --- /dev/null +++ b/Projectiles/Summon/SlimePuppet.cs @@ -0,0 +1,118 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SlimePuppet : ModProjectile + { + 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; + } + + 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; + } + + public override void AI() + { + ResetDamage(); + + // Prevent clumping of other slime puppets near this one. + projectile.MinionAntiClump(); + + 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; + 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; + } + 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, 120f)) + projectile.Center += projectile.SafeDirectionTo(potentialTarget.Center) * 3f; + } + if (projectile.ai[0] > 0f) + { + 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(); + + 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) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + 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); + + 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); + slime.velocity = spawnOffset.RotatedBy(MathHelper.PiOver2 * Main.rand.NextBool(2).ToDirectionInt()) * 0.16f; + slime.scale = 1.2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) => false; + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor); + return false; + } + } +} diff --git a/Projectiles/Summon/SlimePuppet.png b/Projectiles/Summon/SlimePuppet.png new file mode 100644 index 0000000000..25eb7cc27f Binary files /dev/null and b/Projectiles/Summon/SlimePuppet.png differ diff --git a/Projectiles/Summon/SolarBeam.cs b/Projectiles/Summon/SolarBeam.cs index 27d6c29e48..982e7df62f 100644 --- a/Projectiles/Summon/SolarBeam.cs +++ b/Projectiles/Summon/SolarBeam.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Summon { public class SolarBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); diff --git a/Projectiles/Summon/SolarBeam.png b/Projectiles/Summon/SolarBeam.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Summon/SolarBeam.png and /dev/null differ diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index 25edbb53b3..c3be41c73a 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 54; - projectile.height = 54; + projectile.width = 74; + projectile.height = 90; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -33,12 +33,11 @@ namespace CalamityMod.Projectiles.Summon 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); - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) { if (player.dead) { @@ -61,19 +60,20 @@ namespace CalamityMod.Projectiles.Summon } 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; + 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.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + int dustAmt = 50; + for (int d = 0; d < dustAmt; d++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + 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; } @@ -91,57 +91,48 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] -= 1f; return; } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 700f; - bool flag11 = false; + Vector2 targetPos = projectile.position; + float maxDistance = 700f; + bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; 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 < num398 && 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)) { - num396 = num539; - num397 = num540; - flag11 = true; + targetPos = npc.Center; + foundTarget = true; } } } - if (!flag11) + if (!foundTarget) { - for (int num399 = 0; num399 < Main.maxNPCs; num399++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num399].CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[i]; + if (npc.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); - if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].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)) { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; + maxDistance = npcDist; + targetPos = npc.Center; + foundTarget = true; } } } } - if (flag11) + if (foundTarget) { - float num403 = 15f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - 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, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - projectile.ai[0] = 30f; + float shootSpeed = 15f; + 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; } } } diff --git a/Projectiles/Summon/SolarGod.png b/Projectiles/Summon/SolarGod.png index 6be1a06822..741a5ba3b5 100644 Binary files a/Projectiles/Summon/SolarGod.png and b/Projectiles/Summon/SolarGod.png differ diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 4a2288c4e2..9718915629 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 46; - projectile.height = 46; + projectile.width = 50; + projectile.height = 50; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; @@ -33,12 +33,11 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + bool correctMinion = projectile.type == ModContent.ProjectileType(); + if (correctMinion) { if (player.dead) { @@ -61,19 +60,20 @@ namespace CalamityMod.Projectiles.Summon } 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; + 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.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num501 = 25; - for (int num502 = 0; num502 < num501; num502++) + int dustAmt = 25; + for (int d = 0; d < dustAmt; d++) { - int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 244, 0f, 0f, 0, default, 1f); - Main.dust[num503].velocity *= 2f; - Main.dust[num503].scale *= 1.15f; + 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; } @@ -91,72 +91,56 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[0] -= 1f; return; } - float num396 = projectile.position.X; - float num397 = projectile.position.Y; - float num398 = 700f; - bool flag11 = false; + Vector2 targetPos = projectile.position; + float maxDistance = 700f; + bool foundTarget = false; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; 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 < num398 && 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)) { - num396 = num539; - num397 = num540; - flag11 = true; + targetPos = npc.Center; + foundTarget = true; } } } - if (!flag11) + if (!foundTarget) { - for (int num399 = 0; num399 < Main.maxNPCs; num399++) + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[num399].CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[i]; + if (npc.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); - if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].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)) { - num398 = num402; - num396 = num400; - num397 = num401; - flag11 = true; + maxDistance = npcDist; + targetPos = npc.Center; + foundTarget = true; } } } } - if (flag11) + if (foundTarget) { - float num403 = 30f; - Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num404 = num396 - vector29.X; - float num405 = num397 - vector29.Y; - float num406 = (float)Math.Sqrt((double)(num404 * num404 + num405 * num405)); - num406 = num403 / num406; - num404 *= num406; - num405 *= num406; - int beam = Projectile.NewProjectile(projectile.Center.X - 4f, projectile.Center.Y, num404, num405, ProjectileID.HeatRay, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[beam].magic = false; - Main.projectile[beam].minion = true; - ProjectileID.Sets.MinionShot[Main.projectile[beam].type] = true; + float shootSpeed = 30f; + 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); + if (beam.WithinBounds(Main.maxProjectiles)) + Main.projectile[beam].Calamity().forceMinion = true; projectile.ai[0] = 50f; } } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 200, 200, 200); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/SolarPixie.png b/Projectiles/Summon/SolarPixie.png index fcb995c6ca..2b3c4522b1 100644 Binary files a/Projectiles/Summon/SolarPixie.png and b/Projectiles/Summon/SolarPixie.png differ diff --git a/Projectiles/Summon/SonOfYharon.cs b/Projectiles/Summon/SonOfYharon.cs index d1213a083e..f24f76fb13 100644 --- a/Projectiles/Summon/SonOfYharon.cs +++ b/Projectiles/Summon/SonOfYharon.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.friendly = true; projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 20; projectile.extraUpdates = 1; projectile.minionSlots = 4f; projectile.timeLeft = 18000; @@ -92,22 +92,22 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 12) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - } + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 12) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + } - projectile.ChargingMinionAI(1000f, 2000f, 3000f, 500f, 1, 30f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, true, true); + projectile.ChargingMinionAI(1000f, 2000f, 3000f, 500f, 1, 30f, 8f, 4f, new Vector2(0f, -60f), 40f, 8f, true, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Summon/SquirrelSquireAcorn.cs b/Projectiles/Summon/SquirrelSquireAcorn.cs index 8e312d4e7f..3b2f88f4d1 100644 --- a/Projectiles/Summon/SquirrelSquireAcorn.cs +++ b/Projectiles/Summon/SquirrelSquireAcorn.cs @@ -1,11 +1,12 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Microsoft.Xna.Framework; + namespace CalamityMod.Projectiles.Summon { public class SquirrelSquireAcorn : ModProjectile { + public const float Gravity = 0.5f; public override void SetStaticDefaults() { DisplayName.SetDefault("Acorn"); @@ -20,22 +21,18 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; projectile.penetrate = 2; 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(180) * projectile.direction; + 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); - } } } } diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index 0e7023830d..91192cb293 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -2,15 +2,38 @@ using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class SquirrelSquireMinion : ModProjectile + public class SquirrelSquireMinion : ModProjectile { - public float dust = 0f; + public int StuckTimer; + public bool TryingToGetCloseToOwner + { + get => projectile.ai[0] == 1f; + set => projectile.ai[0] = value.ToInt(); + } + public ref float AttackTimer => ref projectile.ai[1]; + public bool OnSolidGround + { + get + { + bool groundSolid = false; + for (int i = (int)projectile.Left.X / 16 - 1; i < (int)projectile.Right.X / 16 + 1; i++) + { + bool bottomTileSolid = WorldGen.SolidTile(i, (int)projectile.Bottom.Y / 16); + bool firstTileDownSolid = WorldGen.SolidTile(i, (int)projectile.Bottom.Y / 16 + 1); + bool secondTileDownSolid = WorldGen.SolidTile(i, (int)projectile.Bottom.Y / 16 + 2); + groundSolid |= bottomTileSolid || firstTileDownSolid || secondTileDownSolid; + } + return projectile.velocity.Y == 0f && groundSolid; + } + } + public Player Owner => Main.player[projectile.owner]; public override void SetStaticDefaults() { @@ -22,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - projectile.width = 64; + projectile.width = 34; projectile.height = 64; projectile.netImportant = true; projectile.friendly = true; @@ -35,571 +58,213 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; } + public override void SendExtraAI(BinaryWriter writer) => writer.Write(StuckTimer); + + public override void ReceiveExtraAI(BinaryReader reader) => StuckTimer = reader.ReadInt32(); + public override void AI() { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - CalamityGlobalProjectile modProj = projectile.Calamity(); - if (dust == 0f) + if (projectile.localAI[0] == 0f) { - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - 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; - 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; - Main.dust[dusty].velocity = vector7; - } - dust += 1f; + DoInitializationEffects(); + projectile.localAI[0] = 1f; } - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) + + // Re-adjust damage as needed. + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * - player.MinionDamage()); - projectile.damage = damage2; + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); + projectile.damage = trueDamage; } - bool projTypeCheck = projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (projTypeCheck) + + projectile.frameCounter++; + + VerifyIdentity(); + if (!projectile.WithinRange(Owner.Center, 1000f) || TryingToGetCloseToOwner || Collision.SolidCollision(projectile.position + Vector2.One * 4f, projectile.width - 8, projectile.height - 8)) { - if (player.dead) + // Once far off, don't go back to normal until 350 pixels away from the owner or less. + TryingToGetCloseToOwner = !projectile.WithinRange(Owner.Center, 350f) && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height); + + ReturnToOwner(); + if (!projectile.WithinRange(Owner.Center, 2000f)) { - modPlayer.squirrel = false; - } - if (modPlayer.squirrel) - { - projectile.timeLeft = 2; + projectile.Center = Owner.Center; + projectile.netUpdate = true; } + projectile.tileCollide = false; + return; } - bool flag1 = false; - bool flag2 = false; - bool flag3 = false; - bool flag4 = false; - int num1 = 60 + 30 * projectile.minionPos; - if (projectile.lavaWet) - { - 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) - flag1 = true; - 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) - { - int conflict1 = 500; - 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); - 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 > 1000f) - { - 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); - } - } - if (projectile.ai[0] != 0f) //flying back to the player - { - projectile.tileCollide = false; - float npcDetectRange = 800f; - bool npcFound = false; - int num6 = -1; - for (int index = 0; index < Main.npc.Length; ++index) - { - NPC npc2 = Main.npc[index]; - 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)) - num6 = index; - npcFound = true; - break; - } - } - } + NPC potentialTarget = projectile.Center.MinionHoming(800f, Owner, false); + if (potentialTarget is null) + FollowOwner(); + else + AttackTarget(potentialTarget); - //return to normal if npc found - if (npcFound && num6 >= 0) - projectile.ai[0] = 0f; - - 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); - float yDist = player.position.Y + (float) (player.height / 2) - vector2.Y; - yDist -= 60f; - float playerDist2 = (float) Math.Sqrt(xDist * xDist + yDist * yDist); - float num11 = 12f; - float num12 = playerDist2; - float conflict2 = 0.4f; - if (num11 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - 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))) - { - 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; - } - if (playerDist2 < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.99f; - } - conflict2 = 0.01f; - } - else - { - if (playerDist2 < 100f) - { - conflict2 = 0.1f; - } - if (playerDist2 > 300f) - { - conflict2 = 1f; - } - playerDist2 = num12 / playerDist2; - xDist *= playerDist2; - yDist *= playerDist2; - } - 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 (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 (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 * 2f; - } - } - 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 * 2f; - } - } - if (projectile.frame < 12 || projectile.frame == 16) - { - projectile.frame = 12; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 16) - { - projectile.frame = 13; - } - } - 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 attackCooldown = 30f; - int num4 = 60; - --projectile.localAI[0]; - if (projectile.localAI[0] < 0f) - projectile.localAI[0] = 0f; - if (projectile.ai[1] > 0f) - { - --projectile.ai[1]; - } - else - { - 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)) - { - 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); - if (num12 < num7) - { - if (num9 == -1 && num12 <= num8) - { - num8 = num12; - num5 = num10; - num6 = num11; - } - if (Collision.CanHit(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height)) - { - num7 = num12; - num5 = num10; - num6 = num11; - num9 = minionAttackTargetNpc.whoAmI; - } - } - } - if (num9 == -1) - { - for (int index = 0; index < Main.npc.Length; ++index) - { - 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); - if (num12 < num7) - { - if (num9 == -1 && num12 <= num8) - { - num8 = num12; - 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)) - { - num7 = num12; - num5 = num10; - num6 = num11; - num9 = index; - } - } - } - } - } - if (num9 == -1 && num8 < num7) - num7 = num8; - float num13 = 400f; - 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)); - if (num10 < -5f) - { - flag1 = true; - flag2 = false; - } - else if (num10 > 5f) - { - flag2 = true; - flag1 = false; - } - } - else if (num9 >= 0 && num7 < 800f + conflict3) - { - projectile.localAI[0] = (float) num4; - float num10 = num5 - (projectile.position.X + (float) (projectile.width / 2)); - if (num10 > 300f || num10 < -300f) - { - if (num10 < -50f) - { - flag1 = true; - flag2 = false; - } - else if (num10 > 50f) - { - flag2 = true; - flag1 = false; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.ai[1] = attackCooldown; - double num11 = 12.0; - Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, (float) ((double) projectile.position.Y + (double) (projectile.height / 2) - 8.0)); - float num12 = num5 - vector2.X + (float) Main.rand.Next(-20, 21); - float num14 = (float) ((double) (Math.Abs(num12) * 0.1f) * (double) Main.rand.Next(0, 100) * (1.0 / 1000.0)); - float num15 = num6 - vector2.Y + (float) Main.rand.Next(-20, 21) - num14; - double num16 = Math.Sqrt((double) num12 * (double) num12 + (double) num15 * (double) num15); - float num17 = (float) (num11 / num16); - float SpeedX = num12 * num17; - float SpeedY = num15 * num17; - int damage = projectile.damage; - int Type = ModContent.ProjectileType(); - int index = Projectile.NewProjectile(vector2.X, vector2.Y, SpeedX, SpeedY, Type, damage, projectile.knockBack, projectile.owner, 0f, 0f); - if (SpeedX < 0f) - projectile.direction = -1; - if (SpeedX > 0f) - projectile.direction = 1; - projectile.netUpdate = true; - } - } - } - Vector2 vector2_1 = Vector2.Zero; - bool flag7 = false; - if (projectile.ai[1] != 0f) - { - flag1 = false; - flag2 = false; - } - else if (projectile.localAI[0] == 0f) - projectile.direction = player.direction; - if (!flag7) - projectile.rotation = 0f; - projectile.tileCollide = true; - float num18 = 0.08f; - float num19 = 6.5f; - num19 = 6f; - num18 = 0.2f; - if (num19 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num19 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - num18 = 0.3f; - } - if (flag1) - { - if (projectile.velocity.X > -3.5f) - projectile.velocity.X -= num18; - else - projectile.velocity.X -= num18 * 0.25f; - } - else if (flag2) - { - if (projectile.velocity.X < 3.5f) - projectile.velocity.X += num18; - else - 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; - } - 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; - if (flag1) - --conflict4; - if (flag2) - ++conflict4; - if (WorldGen.SolidTile(conflict4 + (int) projectile.velocity.X, j)) - flag4 = true; - } - 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) - { - 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; - if (flag1) - --i; - if (flag2) - ++i; - WorldGen.SolidTile(i, j); - } - 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)) - { - if (projectile.type == 200) - { - 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; - if (flag1) - --conflict5; - if (flag2) - ++conflict5; - int i2 = conflict5 + (int) projectile.velocity.X; - if (!WorldGen.SolidTile(i2, conflict7 - 1) && !WorldGen.SolidTile(i2, conflict7 - 2)) - projectile.velocity.Y = -5.1f; - else if (!WorldGen.SolidTile(i2, conflict7 - 2)) - projectile.velocity.Y = -7.1f; - else if (WorldGen.SolidTile(i2, conflict7 - 5)) - projectile.velocity.Y = -11.1f; - else if (WorldGen.SolidTile(i2, conflict7 - 4)) - projectile.velocity.Y = -10.1f; - else - projectile.velocity.Y = -9.1f; - } - catch - { - projectile.velocity.Y = -9.1f; - } - } - } - } - 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.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.frame = 8; - } - if (projectile.frame >= 8 && projectile.frame <= 11) - { - projectile.frameCounter++; - if (projectile.frameCounter > 8) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame == 11) - projectile.frame = 8; - } - } - else if (projectile.velocity.Y == 0f) - { - projectile.localAI[1] = 0f; - if (projectile.velocity.X == 0f) - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 4) - { - projectile.frame = 0; - } - } - 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.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame < 4) - projectile.frame = 4; - if (projectile.frame >= 8) - projectile.frame = 4; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame >= 4) - { - projectile.frame = 0; - } - } - } - else if (projectile.velocity.Y < 0f) - { - projectile.frameCounter = 0; - projectile.frame = 16; - } - else if (projectile.velocity.Y > 0f) - { - projectile.frameCounter = 0; - projectile.frame = 16; - } - projectile.velocity.Y += 0.4f; - if (projectile.velocity.Y > 10f) - projectile.velocity.Y = 10f; - Vector2 velocity = projectile.velocity; - } - } - - public override bool CanDamage() - { - return false; + projectile.rotation = 0f; + projectile.tileCollide = true; } + public void DoInitializationEffects() + { + 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.scale = 1.4f; + dust.velocity = (MathHelper.TwoPi * d / dustQuantity).ToRotationVector2() * 4f; + dust.noGravity = true; + dust.noLight = true; + } + } + + public void VerifyIdentity() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().squirrel = false; + if (Owner.Calamity().squirrel) + projectile.timeLeft = 2; + } + } + + public void ReturnToOwner() + { + projectile.frame = 12 + projectile.frameCounter / 8 % 4; + projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(Owner.Top) * 8f, 0.8f); + projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + projectile.rotation = projectile.velocity.X * 0.025f; + } + + public void AttemptToJumpToDestination(Vector2 destination) + { + if (OnSolidGround) + { + float jumpSpeed = MathHelper.Lerp(8f, 13f, Utils.InverseLerp(100f, 250f, MathHelper.Distance(projectile.Center.X, destination.X), true)); + projectile.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(projectile.Center, Owner.Center, 0.4f, jumpSpeed); + projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt(); + projectile.netUpdate = true; + projectile.frame = 4; + } + else + { + if (projectile.frameCounter % 5 == 4 && projectile.frame < 7) + projectile.frame++; + } + } + + public void FollowOwner() + { + projectile.rotation = 0f; + + // Slow down and just idly vibe if close enough to the owner. + float horizontalDistanceFromOwner = MathHelper.Distance(projectile.Center.X, Owner.Center.X); + float verticalDistanceFromOwner = MathHelper.Distance(projectile.Center.Y, Owner.Center.Y); + if (horizontalDistanceFromOwner < 100f && verticalDistanceFromOwner < 450f) + { + projectile.velocity.X *= 0.94f; + if (OnSolidGround) + { + projectile.frame = projectile.frameCounter / 5 % 4; + projectile.velocity *= 0.9f; + } + StuckTimer = 0; + } + + // Otherwise try to catch up with them on foot. + else + { + AttemptToJumpToDestination(Owner.Center); + // Determine if there's something in the way of this minion and its owner. + if (!Collision.CanHit(projectile.position, projectile.width, projectile.height, Owner.Center, 2, 2) || MathHelper.Distance(projectile.position.X, projectile.oldPosition.X) < 1f) + { + StuckTimer++; + + // If stuck for a sufficiently long time fly to the owner again. + if (StuckTimer > 180) + { + TryingToGetCloseToOwner = true; + StuckTimer = 0; + projectile.netUpdate = true; + } + } + else if (StuckTimer > 0) + StuckTimer--; + } + + // Enforce gravity. + projectile.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -12f, 12f); + } + + public void AttackTarget(NPC target) + { + float horizontalDistanceFromTarget = MathHelper.Distance(projectile.Center.X, target.Center.X); + + // Determine if the minion is stuck. + if (MathHelper.Distance(projectile.position.X, projectile.oldPosition.X) < 1f) + { + StuckTimer++; + + // If stuck for a sufficiently long time fly to the owner again. + if (StuckTimer > 180) + { + TryingToGetCloseToOwner = true; + StuckTimer = 0; + projectile.netUpdate = true; + } + } + else if (StuckTimer > 0) + StuckTimer--; + + if (horizontalDistanceFromTarget > 350f) + AttemptToJumpToDestination(target.Center); + else if (OnSolidGround) + { + projectile.velocity.X *= 0.94f; + if (OnSolidGround) + { + projectile.frame = projectile.frameCounter / 5 % 4; + projectile.velocity *= 0.9f; + } + AttackTimer++; + + // Pelt the target with acorns. + projectile.frame = 8 + (int)(AttackTimer / 6.4) % 4; + 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 = 14f; + Vector2 acornShootVelocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(acornSpawnPosition, target.Center + target.velocity * 25f, SquirrelSquireAcorn.Gravity, acornShootSpeed); + + 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.velocity.Y = MathHelper.Clamp(projectile.velocity.Y + 0.4f, -12f, 12f); + } + + public override bool CanDamage() => false; + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) { fallThrough = false; return true; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; 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); - Main.gore[index].velocity *= 0.1f; + 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 a37881fbb2..96ced419ae 100644 --- a/Projectiles/Summon/StormMarkSummon.cs +++ b/Projectiles/Summon/StormMarkSummon.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Summon { public class StormMarkSummon : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mark"); @@ -24,11 +26,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ignoreWater = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.localNPCHitCooldown = 30 - - (NPC.downedGolemBoss ? 5 : 0) - - (NPC.downedMoonlord ? 5 : 0) - - (CalamityWorld.downedDoG ? 4 : 0) - - (CalamityWorld.downedYharon ? 3 : 0); + projectile.localNPCHitCooldown = 30; } public override void AI() diff --git a/Projectiles/Summon/StormMarkSummon.png b/Projectiles/Summon/StormMarkSummon.png deleted file mode 100644 index 2bbbfb60bb..0000000000 Binary files a/Projectiles/Summon/StormMarkSummon.png and /dev/null differ diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index ca4f622fbf..b691a22377 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -263,12 +263,15 @@ namespace CalamityMod.Projectiles.Summon { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[spark].Calamity().forceMinion = true; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; + if (spark.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark].Calamity().forceMinion = true; + Main.projectile[spark].timeLeft = 120; + Main.projectile[spark].penetrate = 3; + Main.projectile[spark].usesIDStaticNPCImmunity = true; + Main.projectile[spark].idStaticNPCHitCooldown = 10; + Main.projectile[spark].usesLocalNPCImmunity = false; + } } sparkCounter = 0; } @@ -507,12 +510,15 @@ namespace CalamityMod.Projectiles.Summon { Vector2 sparkS = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); int spark = Projectile.NewProjectile(projectile.Center, sparkS, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[spark].Calamity().forceMinion = true; - Main.projectile[spark].timeLeft = 120; - Main.projectile[spark].penetrate = 3; - Main.projectile[spark].usesIDStaticNPCImmunity = true; - Main.projectile[spark].idStaticNPCHitCooldown = 10; - Main.projectile[spark].usesLocalNPCImmunity = false; + if (spark.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[spark].Calamity().forceMinion = true; + Main.projectile[spark].timeLeft = 120; + Main.projectile[spark].penetrate = 3; + Main.projectile[spark].usesIDStaticNPCImmunity = true; + Main.projectile[spark].idStaticNPCHitCooldown = 10; + Main.projectile[spark].usesLocalNPCImmunity = false; + } } sparkCounter = 0; } diff --git a/Projectiles/Summon/SummonBrimstoneExplosion.cs b/Projectiles/Summon/SummonBrimstoneExplosion.cs new file mode 100644 index 0000000000..0c4eb00e90 --- /dev/null +++ b/Projectiles/Summon/SummonBrimstoneExplosion.cs @@ -0,0 +1,72 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SummonBrimstoneExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + 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; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + CreateInitialDust(); + projectile.localAI[0] = 1f; + } + + // Emit crimson light. + Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 1.1f); + if (projectile.timeLeft % 5f == 4f) + projectile.frame++; + } + + public void CreateInitialDust() + { + float randomnessSmoothness = 3f; + for (int i = 0; i < 10; i++) + { + randomnessSmoothness += i; + + int offsetVariance = (int)(randomnessSmoothness * 4f); + 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.position += Main.rand.NextVector2Square(-10f, 10f); + dust.velocity = velocity; + dust.noGravity = true; + } + } + + projectile.Damage(); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 48); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + // Prevent absurd quantities of damage to the player. + damage = (int)(damage * 0.018); + } + } +} diff --git a/Projectiles/Summon/SummonBrimstoneExplosion.png b/Projectiles/Summon/SummonBrimstoneExplosion.png new file mode 100644 index 0000000000..b53b2fea88 Binary files /dev/null and b/Projectiles/Summon/SummonBrimstoneExplosion.png differ diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs new file mode 100644 index 0000000000..24b4b6de0e --- /dev/null +++ b/Projectiles/Summon/SummonBrimstoneExplosionSmall.cs @@ -0,0 +1,64 @@ +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SummonBrimstoneExplosionSmall : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + 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; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + CreateInitialDust(); + projectile.localAI[0] = 1f; + } + + // Emit crimson light. + Lighting.AddLight(projectile.Center, Color.Red.ToVector3() * 1.1f); + if (projectile.timeLeft % 5f == 4f) + projectile.frame++; + } + + public void CreateInitialDust() + { + float randomnessSmoothness = 3f; + for (int i = 0; i < 6; i++) + { + randomnessSmoothness += i * 0.36f; + + 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.position += Main.rand.NextVector2Square(-10f, 10f); + dust.velocity = velocity; + dust.noGravity = true; + } + } + + projectile.Damage(); + } + } +} diff --git a/Projectiles/Summon/SummonBrimstoneExplosionSmall.png b/Projectiles/Summon/SummonBrimstoneExplosionSmall.png new file mode 100644 index 0000000000..b53b2fea88 Binary files /dev/null and b/Projectiles/Summon/SummonBrimstoneExplosionSmall.png differ diff --git a/Projectiles/Summon/TacticalPlagueEngineSummon.cs b/Projectiles/Summon/TacticalPlagueJet.cs similarity index 54% rename from Projectiles/Summon/TacticalPlagueEngineSummon.cs rename to Projectiles/Summon/TacticalPlagueJet.cs index 91254c9fe4..977589f42e 100644 --- a/Projectiles/Summon/TacticalPlagueEngineSummon.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -1,17 +1,19 @@ using CalamityMod.Buffs.Summon; -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.CalPlayer; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Summon { - public class TacticalPlagueEngineSummon : ModProjectile + public class TacticalPlagueJet : ModProjectile { public static Item FalseGun = null; + public override void SetStaticDefaults() { DisplayName.SetDefault("Tactical Plague Jet"); @@ -32,16 +34,34 @@ namespace CalamityMod.Projectiles.Summon 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. + // The false gun's damage is changed to the appropriate value every time a Tactical Plague Jet wants to fire a bullet. + private static void DefineFalseGun() + { + int p90ID = ModContent.ItemType(); + FalseGun = new Item(); + FalseGun.SetDefaults(p90ID, true); + FalseGun.ranged = false; + FalseGun.summon = true; + } + + public override bool CanDamage() => false; + public override void AI() { Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + + // Frame 1 spawning effects. if (projectile.localAI[0] == 0f) { 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; @@ -49,18 +69,23 @@ namespace CalamityMod.Projectiles.Summon Dust dust = Dust.NewDustPerfect(projectile.Center + velocity * 2f, (int)CalamityDusts.Plague, velocity); dust.noGravity = true; } - FalseGun = ItemLoader.GetItem(ModContent.ItemType()).item; + + // Construct a fake item to use with vanilla code for the sake of firing bullets. + if (FalseGun is null) + DefineFalseGun(); projectile.localAI[0] = 1f; } + + // Animation handling. if (projectile.frameCounter++ > 6f) { projectile.frame++; projectile.frameCounter = 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) { int trueDamage = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / @@ -68,110 +93,112 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = trueDamage; } - bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + bool isCorrectProjectile = projectile.type == ModContent.ProjectileType(); if (isCorrectProjectile) { if (player.dead) - { modPlayer.plagueEngine = false; - } if (modPlayer.plagueEngine) - { projectile.timeLeft = 2; - } } + + // Pick a target and possibly fire at them. 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 acceleration = 0.1f; - Vector2 distanceVector = player.Center - projectile.Center; - if (distanceVector.Length() < 200f) - { - acceleration = 0.07f; - } - if (distanceVector.Length() < 140f) - { + + // Reduce acceleration significantly if close to the player. + if (distanceToOwner < 140f) acceleration = 0.035f; - } - if (distanceVector.Length() > 100f) + else if (distanceToOwner < 200f) + acceleration = 0.07f; + + // 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); - } - } - else if (projectile.velocity.Length() > 4f) - { - projectile.velocity *= 0.95f; - } - if (Math.Abs(projectile.velocity.Y) < 2f) - { - projectile.velocity.Y += 0.1f * Math.Sign(player.Center.Y - projectile.Center.Y); - } - if (projectile.velocity.Length() > 9f) - { - projectile.velocity = Vector2.Normalize(projectile.velocity) * 9f; } + // If the jet is moving too fast, start giving it air friction. + 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 the jet is moving WAY too fast, clamp its velocity. + 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; - } + + // Angle the jet as it moves. projectile.rotation = projectile.rotation.AngleTowards(0f, 0.2f); - if (distanceVector.Length() > 2700f) + // If the jet is absurdly far away, teleport directly onto the player. + if (distanceToOwner > 2700f) { projectile.Center = player.Center; projectile.netUpdate = true; } } + + // The jet has ammo and has a target. Open fire. else { projectile.spriteDirection = 1; - Vector2 idealVelocity = projectile.DirectionTo(potentialTarget.Center - Vector2.UnitY * 195f) * 17f; - projectile.velocity = Vector2.Lerp(projectile.velocity, idealVelocity, 0.035f); + 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) { - int damage = projectile.damage; - if (Main.rand.NextBool(20)) + int projID = ProjectileID.Bullet; + float shootSpeed = FalseGun.shootSpeed; + bool canShoot = true; + int damage = FalseGun.damage = projectile.damage; + float kb = projectile.knockBack; + bool shootRocket = ++projectile.ai[1] % 20f == 0f; + // Rockets never consume ammo. + bool dontConsumeAmmo = Main.rand.NextBool() || shootRocket; + int projIndex; + + // Vanilla function tricked into using a fake gun item with the appropriate base damage as the "firing item". + player.PickAmmo(FalseGun, ref projID, ref shootSpeed, ref canShoot, ref damage, ref kb, dontConsumeAmmo); + + // One in every 20 shots is a rocket which deals 1.5x total damage and extreme knockback. + if (shootRocket) { - int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * 18f, ModContent.ProjectileType(), - (int)(damage * 1.5), 5f, projectile.owner); - Main.projectile[idx].Calamity().forceMinion = true; + 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); } + + // Fire the selected bullet, nothing special. else - { - int shoot = 0; - float shootSpeed = 0f; - bool canShoot = true; - float knockBack = projectile.knockBack * 0.5f; - player.PickAmmo(FalseGun, ref shoot, ref shootSpeed, ref canShoot, ref damage, ref knockBack); - int idx = Projectile.NewProjectile(projectile.Center, projectile.DirectionTo(potentialTarget.Center) * shootSpeed, shoot, - damage, knockBack, projectile.owner); - // There's airway for a small bug in here, but the potential alterative (that has indeed been appearing), where - // the projectile simply cannot exist, is far worse than this. If you have another solution, let me know. - if (idx >= 0 && idx < Main.projectile.Length) - { - Main.projectile[idx].Calamity().forceMinion = true; - } - } + 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)) + Main.projectile[projIndex].Calamity().forceMinion = true; } - projectile.MinionAntiClump(0.25f); + + // Prevent minion clumping while firing. + projectile.MinionAntiClump(0.25f); } } - - public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/TacticalPlagueEngineSummon.png b/Projectiles/Summon/TacticalPlagueJet.png similarity index 100% rename from Projectiles/Summon/TacticalPlagueEngineSummon.png rename to Projectiles/Summon/TacticalPlagueJet.png diff --git a/Projectiles/Summon/TundraFlameBlossomsOrb.cs b/Projectiles/Summon/TundraFlameBlossomsOrb.cs index 02db424590..d171d9dbc0 100644 --- a/Projectiles/Summon/TundraFlameBlossomsOrb.cs +++ b/Projectiles/Summon/TundraFlameBlossomsOrb.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Summon/UniverseSplitterField.cs b/Projectiles/Summon/UniverseSplitterField.cs new file mode 100644 index 0000000000..56fc408f48 --- /dev/null +++ b/Projectiles/Summon/UniverseSplitterField.cs @@ -0,0 +1,159 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class UniverseSplitterField : ModProjectile + { + public float Timer + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float DustRadius = 0f; + public const float DustChargeTime = 30f; + public const float DustMinRadius = 0f; + public const float DustMaxRadius = 90f; + public const int SpiralPrecision = 25; + public const int SpiralRings = 5; + public const int TimeLeft = 720; + + public const float SmallBeamAngleMax = MathHelper.TwoPi / 15f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Field"); + 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; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(DustRadius); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + DustRadius = reader.ReadSingle(); + } + + public override void AI() + { + Timer++; + if (Timer < DustChargeTime) + { + DustRadius = MathHelper.Lerp(DustMinRadius, DustMaxRadius, Timer / DustChargeTime); + } + else + { + DustRadius = DustMaxRadius + (float)Math.Sin(Timer / 50f) * 16f; + } + if (!Main.dedServ) + { + GenerateIdleDust(); + } + SpawnLasers(); + } + + public void GenerateIdleDust() + { + // 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.velocity = Vector2.Zero; + dust.scale = 1.2f; + dust.noGravity = true; + } + + // Spirals that spin around + for (int i = 0; i < SpiralPrecision; i++) + { + for (int direction = -1; direction <= 1; direction += 2) + { + for (int j = 0; j < SpiralRings; j++) + { + 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; + dust.scale = 0.7f; + dust.noGravity = true; + } + } + } + + // Outward expansion of dust + bool firingGiantLaserBeam = Timer > TimeLeft - UniverseSplitterHugeBeam.TimeLeft; + for (int i = 0; i < (firingGiantLaserBeam ? 30 : 16); i++) + { + 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; + } + + // Energy dust that appears before the giant beam does and remains + if (Timer > TimeLeft - UniverseSplitterHugeBeam.TimeLeft - 120f) + { + 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.scale = 1.2f; + dust.noGravity = true; + dust.velocity = Main.rand.NextBool(7) ? projectile.DirectionFrom(dust.position) * 6f : Vector2.Zero; + } + } + } + + public void SpawnLasers() + { + // Create small beams sometimes + if (Timer > 120f && + Timer < TimeLeft - UniverseSplitterHugeBeam.TimeLeft && + Timer % 60f == 0f) + { + Main.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, + -Vector2.Normalize(offset), + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner, + (-Vector2.Normalize(offset)).ToRotation()); + } + } + // Summon a giant beam + 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, + Vector2.UnitY, + ModContent.ProjectileType(), + projectile.damage, + projectile.knockBack, + projectile.owner, + 0f); + } + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Melee/GaelExplosion.png b/Projectiles/Summon/UniverseSplitterField.png similarity index 79% rename from Projectiles/Melee/GaelExplosion.png rename to Projectiles/Summon/UniverseSplitterField.png index 810820c0b4..c8fba012d0 100644 Binary files a/Projectiles/Melee/GaelExplosion.png and b/Projectiles/Summon/UniverseSplitterField.png differ diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.cs b/Projectiles/Summon/UniverseSplitterHugeBeam.cs new file mode 100644 index 0000000000..fa8adf72e8 --- /dev/null +++ b/Projectiles/Summon/UniverseSplitterHugeBeam.cs @@ -0,0 +1,201 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.Enums; +using Terraria.ModLoader; +using CalamityMod.Buffs.DamageOverTime; +using Terraria.GameContent.Events; + +namespace CalamityMod.Projectiles.Summon +{ + public class UniverseSplitterHugeBeam : ModProjectile + { + // Pretty self explanatory + public const int TotalFadeoutTime = 25; + public const int TimeLeft = 180; + public const float MaximumLength = 3000f; + // How fat the laser is + public const float LaserSize = 1.45f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Universe Splitter Ray"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = TimeLeft; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 6; + } + + // Netcode for sending and receiving shit + // localAI[0] is the timer, localAI[1] is the laser length + + public override void SendExtraAI(BinaryWriter writer) + { + 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(); + } + + public override void AI() + { + projectile.velocity = (projectile.velocity.ToRotation() + projectile.ai[0]).ToRotationVector2(); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + + projectile.localAI[0]++; + + // Fadein/out. The timeleft varies, so this must be done manually. + if (projectile.localAI[0] < TotalFadeoutTime) + { + projectile.scale = MathHelper.Lerp(0.01f, LaserSize, projectile.localAI[0] / TotalFadeoutTime); + } + + if (projectile.timeLeft < TotalFadeoutTime) + { + projectile.scale = MathHelper.Lerp(LaserSize, 0f, 1f - (projectile.timeLeft / (float)TotalFadeoutTime)); + } + + Vector2 samplingPoint = projectile.Top; + + float[] samples = new float[12]; + + float determinedLength = 0f; + 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; + + 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(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) + { + if (projectile.localAI[0] == 30f) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), projectile.Center); + for (int i = 0; i < 75; i++) + { + Dust dust = Dust.NewDustPerfect(beamEndPosition, 269); + dust.velocity = Main.rand.NextVector2Circular(16f, 11f); + dust.velocity = dust.velocity.SafeNormalize(Vector2.UnitY) * new Vector2(5f, 3.5f); + dust.scale = Main.rand.NextFloat(1.2f, 1.5f); + dust.noGravity = true; + + dust = Dust.NewDustPerfect(beamEndPosition, 269); + dust.velocity = (i / 75f * MathHelper.TwoPi).ToRotationVector2().RotatedByRandom(0.2f) * new Vector2(16f, 11f) * 1.3f; + dust.scale = Main.rand.NextFloat(1.4f, 1.75f); + dust.noGravity = true; + } + } + + if (projectile.localAI[0] > TimeLeft - 50f) + { + float light = 1f; + if (projectile.localAI[0] < TimeLeft - 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)); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + 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]; + 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; + if (laserLength > 0f) + { + float laserLengthDelta = 0f; + 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); + if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) + { + sourceRectangle.Y = 0; + } + } + } + + // 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); + + return false; + } + + public override bool ShouldUpdatePosition() => 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)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + 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)) + { + return true; + } + return false; + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Electrified, 300); + target.AddBuff(ModContent.BuffType(), 45 * 60); + } + } +} diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.png b/Projectiles/Summon/UniverseSplitterHugeBeam.png new file mode 100644 index 0000000000..58ba72804a Binary files /dev/null and b/Projectiles/Summon/UniverseSplitterHugeBeam.png differ diff --git a/Projectiles/Summon/GammaDeathray.cs b/Projectiles/Summon/UniverseSplitterSmallBeam.cs similarity index 64% rename from Projectiles/Summon/GammaDeathray.cs rename to Projectiles/Summon/UniverseSplitterSmallBeam.cs index d7b1961d43..8a177e8a5a 100644 --- a/Projectiles/Summon/GammaDeathray.cs +++ b/Projectiles/Summon/UniverseSplitterSmallBeam.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -9,31 +9,33 @@ using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class GammaDeathray : ModProjectile + public class UniverseSplitterSmallBeam : ModProjectile { - public float MaximumLength => projectile.Distance(Main.MouseWorld); - // How fat the laser is - public const float LaserSize = 1.35f; // Pretty self explanatory - public const int TotalFadeoutTime = 45; + public const int FadeinTime = 25; + public const int MovementTime = 60; + public const int TimeLeft = 120; + public const float TotalSweeps = 4f; + public const float MaximumLength = 3000f; + // How fat the laser is + public const float LaserSize = 1.2f; public override void SetStaticDefaults() { - DisplayName.SetDefault("Gamma Ray"); - ProjectileID.Sets.MinionShot[projectile.type] = true; + DisplayName.SetDefault("Universe Splitter Ray"); } public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; + projectile.width = 14; + projectile.height = 14; projectile.friendly = true; - projectile.minion = true; + projectile.magic = true; projectile.penetrate = -1; projectile.tileCollide = false; - projectile.timeLeft = 10000; + projectile.timeLeft = TimeLeft; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 7; + projectile.localNPCHitCooldown = 6; } // Netcode for sending and receiving shit @@ -51,77 +53,56 @@ namespace CalamityMod.Projectiles.Summon projectile.localAI[1] = reader.ReadSingle(); } + public static float CosineInterpolation(float start, float end, float time) + { + float cosineTime = (1f - (float)Math.Cos(MathHelper.Pi * time)) * 0.5f; + return start * (1 - cosineTime) + end * cosineTime; + } + + public override bool ShouldUpdatePosition() => false; + public override void AI() { - Projectile owner = Main.projectile[(int)projectile.ai[0]]; - if (!owner.active || owner.type != ModContent.ProjectileType()) - projectile.Kill(); - - projectile.velocity = projectile.AngleTo(Main.MouseWorld).ToRotationVector2(); + 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.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; - if (owner.active) - { - projectile.Center = owner.Center + projectile.AngleTo(Main.MouseWorld).ToRotationVector2() * 12f; - } projectile.localAI[0] += 1f; // Fadein/out. The timeleft varies, so this must be done manually. - if (projectile.localAI[0] < TotalFadeoutTime) + if (projectile.localAI[0] < FadeinTime) { - projectile.scale = MathHelper.Lerp(0.01f, LaserSize, projectile.localAI[0] / TotalFadeoutTime); + projectile.scale = MathHelper.Lerp(0.01f, LaserSize, projectile.localAI[0] / FadeinTime); + } + if (projectile.localAI[0] > MovementTime && + projectile.localAI[0] <= MovementTime + 10f) + { + projectile.scale = MathHelper.Lerp(LaserSize, 3.25f, (projectile.localAI[0] - MovementTime) / 10f); + } + if (projectile.localAI[0] > TimeLeft - 15f) + { + projectile.scale = MathHelper.Lerp(3.25f, 0.01f, (projectile.localAI[0] - (TimeLeft - 15f)) / 15f); } - if (projectile.timeLeft < TotalFadeoutTime) - { - projectile.scale = MathHelper.Lerp(LaserSize, 0f, 1f - (projectile.timeLeft / (float)TotalFadeoutTime)); - } - - for (int i = 0; i < 6; i++) - { - Dust dust = Dust.NewDustPerfect(projectile.Center, (int)CalamityDusts.SulfurousSeaAcid); - dust.velocity = projectile.velocity.RotatedBy(MathHelper.Pi * 0.75f) * (i >= 3).ToDirectionInt(); - dust.velocity = dust.velocity.RotatedByRandom(0.3f); - dust.noGravity = true; - dust.scale = 1f / (float)Math.Cos(i / 6f * MathHelper.PiOver2) / (float)Math.Sqrt(i + 1); - } - - Vector2 samplingPoint = projectile.Center; - - float[] samples = new float[3]; - - float determinedLength = 0f; - 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; - - determinedLength = MathHelper.Clamp(determinedLength, MaximumLength * 0.5f, MaximumLength); - - float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], MaximumLength, 0.5f); Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); - // Draw acid green light across the laser - DelegateMethods.v3_1 = new Vector3(0.62f, 0.94f, 0.38f); + // 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)); } - public override void Kill(int timeLeft) - { - Main.projectile[(int)projectile.ai[0]].ai[0] = 0f; // Detach this laser from its owner. - Main.projectile[(int)projectile.ai[0]].netUpdate = true; - } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { 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"); + 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]; Color drawColor = new Color(1f, 1f, 1f) * 0.9f; @@ -137,7 +118,7 @@ namespace CalamityMod.Projectiles.Summon if (laserLength > 0f) { float laserLengthDelta = 0f; - Rectangle sourceRectangle = new Rectangle(0, 16 * (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) @@ -147,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon 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; + sourceRectangle.Y += 14; if (sourceRectangle.Y + sourceRectangle.Height > laserBodyTexture.Height) { sourceRectangle.Y = 0; diff --git a/Projectiles/Summon/UniverseSplitterSmallBeam.png b/Projectiles/Summon/UniverseSplitterSmallBeam.png new file mode 100644 index 0000000000..50902dedaf Binary files /dev/null and b/Projectiles/Summon/UniverseSplitterSmallBeam.png differ diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index 8f1e606c5d..262a8ed0e9 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,6 +38,16 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.Calamity().lineColor); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.Calamity().lineColor = reader.ReadInt32(); + } + public override void AI() { Player player = Main.player[projectile.owner]; @@ -117,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon { breakAway = true; } - else if (npcIndex < 0 || npcIndex >= Main.maxNPCs) + else if (!npcIndex.WithinBounds(Main.maxNPCs)) { breakAway = true; } @@ -173,7 +184,7 @@ namespace CalamityMod.Projectiles.Summon { NPC npc = Main.npc[npcIndex]; //covers most edge cases like voodoo dolls - if (npc.active && !npc.dontTakeDamage && npc.defense < 9999 && + 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)) { diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs new file mode 100644 index 0000000000..df19971af4 --- /dev/null +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -0,0 +1,198 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class ViridVanguardBlade : ModProjectile + { + public bool AltTexture = false; + + public int RemainingSlices = 0; + public int PostSliceDeathTimer; + public float RedirectAngle; + public float FiringTime = 0f; + public Vector2 IdealPosition; + public float Angle + { + 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; + } + + 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; + } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(RedirectAngle); + writer.Write(FiringTime); + writer.Write(AltTexture); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + RedirectAngle = reader.ReadSingle(); + FiringTime = reader.ReadSingle(); + AltTexture = reader.ReadBoolean(); + } + public override void AI() + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + projectile.spriteDirection = AltTexture.ToDirectionInt(); + if (projectile.localAI[0] == 0f) + { + projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); + projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] = 1f; + } + if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + player.MinionDamage()); + projectile.damage = trueDamage; + } + bool isProperProjectile = projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isProperProjectile) + { + if (player.dead) + { + modPlayer.viridVanguard = false; + } + if (modPlayer.viridVanguard) + { + projectile.timeLeft = 2; + } + } + + if (FiringTime <= 0f) + { + 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; + Angle += MathHelper.ToRadians(4f); + } + else + { + projectile.spriteDirection = 1; + if (FiringTime >= 239f) + { + 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); + } + else if (FiringTime > 80f) + { + 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; + } + else if (FiringTime == 1f) + { + if (RemainingSlices <= 0) + { + projectile.Kill(); + } + else if (RemainingSlices <= 2) + { + projectile.velocity *= -1; + FiringTime = 20f; + } + } + FiringTime--; + } + + if (RemainingSlices > 0) + PostSliceDeathTimer--; + if (PostSliceDeathTimer == 1) + projectile.Kill(); + + if (projectile.localAI[1] > 0) + { + 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) + { + if (RemainingSlices > 0) + { + FiringTime = 10f; + RemainingSlices--; + } + } + public override void Kill(int timeLeft) + { + for (int j = 0; j < 40; j++) + { + 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")); + + Rectangle rectangle = new Rectangle(0, 0, texture.Width, texture.Height); + + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + if (CalamityConfig.Instance.Afterimages && FiringTime > 0f && FiringTime < 80f) + { + 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); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, + 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, + rectangle.Size() / 2f, 1f, spriteEffects, 0f); + return false; + } + } +} diff --git a/Projectiles/Summon/ViridVanguardBlade.png b/Projectiles/Summon/ViridVanguardBlade.png new file mode 100644 index 0000000000..400382aa1c Binary files /dev/null and b/Projectiles/Summon/ViridVanguardBlade.png differ diff --git a/Projectiles/Summon/ViridVanguardBladeAlt.png b/Projectiles/Summon/ViridVanguardBladeAlt.png new file mode 100644 index 0000000000..127ec26b1c Binary files /dev/null and b/Projectiles/Summon/ViridVanguardBladeAlt.png differ diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs new file mode 100644 index 0000000000..41076dda92 --- /dev/null +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -0,0 +1,94 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Steamworks; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + class VoidConcentrationAura : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int timer = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Concentrated Void Aura"); + } + + 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.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(timer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + timer = reader.ReadInt32(); + } + + public override bool? CanCutTiles() + { + return true; + } + + public void HandleRightClick() + { + 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(); + } + + public override void AI() + { + Player owner = Main.player[projectile.owner]; + CalamityPlayer mp = owner.Calamity(); + projectile.Center = owner.Center; + mp.voidAuraDamage = true; + if (owner.dead) + mp.voidAuraDamage = false; + if (!mp.voidAuraDamage) + { + mp.voidAura = false; + projectile.Kill(); + } + if (owner.whoAmI == Main.myPlayer && owner.ownedProjectileCounts[projectile.type] <= 25 && timer > 0 && timer % 4 == 0) + { + NPC target = CalamityUtils.MinionHoming(projectile.Center, 1800f, owner); + if (target != null) + { + Vector2 correctedVelocity = target.Center - owner.Center; + correctedVelocity.Normalize(); + 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.X, projectile.Center.Y, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.75f), 0f, owner.whoAmI); + } + timer = -1; + } + if (timer > 50 && timer % 4 == 0) + return; + timer++; + } + } +} diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.cs b/Projectiles/Summon/VoidConcentrationBlackhole.cs new file mode 100644 index 0000000000..e05dd64f54 --- /dev/null +++ b/Projectiles/Summon/VoidConcentrationBlackhole.cs @@ -0,0 +1,190 @@ +using CalamityMod.NPCs; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + class VoidConcentrationBlackhole : ModProjectile + { + private int damage = 0; + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(damage); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + damage = reader.ReadInt32(); + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Black Hole"); + 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.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; + velocity *= 2f; + velocity.SafeNormalize(Vector2.Zero); + 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 num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + num553 = num550 / num553; + num551 *= num553; + num552 *= num553; + npc.velocity.X = (velocity.X * 15f + num551) / 16f; + npc.velocity.Y = (velocity.Y * 15f + num552) / 16f; + npc.velocity = (velocity / succStrength); + } + + private void Death() + { + 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(); + } + } + + public override void Kill(int timeLeft) + { + 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); + Main.dust[shadow].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[shadow].scale = 0.5f; + Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[shadow].velocity *= 2f; + } + } + + public override bool PreAI() + { + if (damage == 0) + { + 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; + 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) + spriteEffects = SpriteEffects.FlipHorizontally; + 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; //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) + 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); + + + + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type] - 1) + { + projectile.frame = 0; + } + 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) + ApplySucc(Main.npc[i]); + } + } + + + if (projectile.scale >= 2.5f) //it's boom o' clock + { + Death(); + } + } + } +} diff --git a/Projectiles/Summon/VoidConcentrationBlackhole.png b/Projectiles/Summon/VoidConcentrationBlackhole.png new file mode 100644 index 0000000000..ab6fe62770 Binary files /dev/null and b/Projectiles/Summon/VoidConcentrationBlackhole.png differ diff --git a/Projectiles/Summon/VoidConcentrationOrb.cs b/Projectiles/Summon/VoidConcentrationOrb.cs new file mode 100644 index 0000000000..51bd4f81ad --- /dev/null +++ b/Projectiles/Summon/VoidConcentrationOrb.cs @@ -0,0 +1,115 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + class VoidConcentrationOrb : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Orb"); + 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.tileCollide = false; + projectile.minion = true; + projectile.scale = 0.01f; + } + + public override bool? CanHitNPC(NPC target) + { + if (projectile.scale < 1f) + return false; + return null; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + 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); + Main.dust[shadow].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[shadow].scale = 0.5f; + Main.dust[shadow].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + 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); + 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); + Main.dust[shadow].velocity *= 2f; + } + } + + public override void AI() + { + Player owner = Main.player[projectile.owner]; + NPC target = CalamityUtils.MinionHoming(projectile.Center, 1800f, owner); + + 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); + float num551 = target.Center.X - vector43.X; + float num552 = target.Center.Y - vector43.Y; + float num553 = (float)Math.Sqrt((double)(num551 * num551 + num552 * num552)); + if (num553 < 100f) + { + num550 = 28f; //14 + } + 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; + if (Main.rand.NextBool(5)) + projectile.velocity *= 1.1f; + } + + } + else + { + projectile.scale += 0.025f; + projectile.velocity *= 1.03f; + } + + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= Main.projFrames[projectile.type] - 1) + { + projectile.frame = 0; + } + projectile.frameCounter++; + + if (projectile.timeLeft <= 60) + { + projectile.alpha += 4; + } + } + } +} diff --git a/Projectiles/Summon/VoidConcentrationOrb.png b/Projectiles/Summon/VoidConcentrationOrb.png new file mode 100644 index 0000000000..036c9b9603 Binary files /dev/null and b/Projectiles/Summon/VoidConcentrationOrb.png differ diff --git a/Projectiles/Summon/WitherBlossom.cs b/Projectiles/Summon/WitherBlossom.cs new file mode 100644 index 0000000000..94bf3ee576 --- /dev/null +++ b/Projectiles/Summon/WitherBlossom.cs @@ -0,0 +1,87 @@ +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +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 override void SetStaticDefaults() + { + DisplayName.SetDefault("Wither Blossom"); + 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; + } + + public override void AI() + { + bool isCorrectMinion = projectile.type == ModContent.ProjectileType(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectMinion) + { + if (player.dead) + modPlayer.witherBlossom = false; + if (modPlayer.witherBlossom) + projectile.timeLeft = 2; + } + + SetProjectileDamage(); + + Time++; + 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); + } + projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * 150f; + projectile.rotation += MathHelper.ToRadians(5f); + OffsetAngle += MathHelper.ToRadians(4f); + } + + public void SetProjectileDamage() + { + if (projectile.localAI[0] == 0f) + { + 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.noGravity = true; + dust.velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(2f, 7f); + } + projectile.localAI[0] += 1f; + } + if (Owner.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) + { + int trueDamage = (int)(projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / + projectile.Calamity().spawnedPlayerMinionDamageValue * + Owner.MinionDamage()); + projectile.damage = trueDamage; + } + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Summon/WitherBlossom.png b/Projectiles/Summon/WitherBlossom.png new file mode 100644 index 0000000000..a0ba831dd4 Binary files /dev/null and b/Projectiles/Summon/WitherBlossom.png differ diff --git a/Projectiles/Summon/WitherBolt.cs b/Projectiles/Summon/WitherBolt.cs new file mode 100644 index 0000000000..fed98e329a --- /dev/null +++ b/Projectiles/Summon/WitherBolt.cs @@ -0,0 +1,97 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class WitherBolt : ModProjectile + { + 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; + } + + 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; + } + public override void AI() + { + Lighting.AddLight(projectile.Center, Color.DarkGreen.ToVector3() * 1.25f); + float oldSpeed = projectile.velocity.Length(); + + 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.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); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D boltTexture = Main.projectileTexture[projectile.type]; + for (int i = 0; i < projectile.oldPos.Length; i++) + { + 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); + } + return false; + } + + public override void Kill(int timeLeft) + { + if (!Main.dedServ) + { + 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); + plague.color = Color.Olive; + plague.noGravity = true; + } + } + } + + 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); + Main.projectile[seeker].Calamity().forceMinion = true; + } + } + } + } +} diff --git a/Projectiles/Summon/SilvaCrystalExplosion.png b/Projectiles/Summon/WitherBolt.png similarity index 100% rename from Projectiles/Summon/SilvaCrystalExplosion.png rename to Projectiles/Summon/WitherBolt.png diff --git a/Projectiles/Summon/WulfrumBoltMinion.cs b/Projectiles/Summon/WulfrumBoltMinion.cs index 2d3c30e3ae..9514f9fb76 100644 --- a/Projectiles/Summon/WulfrumBoltMinion.cs +++ b/Projectiles/Summon/WulfrumBoltMinion.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Summon { public class WulfrumBoltMinion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Summon/WulfrumBoltMinion.png b/Projectiles/Summon/WulfrumBoltMinion.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Summon/WulfrumBoltMinion.png and /dev/null differ diff --git a/Projectiles/Summon/YoungDuke.cs b/Projectiles/Summon/YoungDuke.cs index b33f6107c1..1cb73ca6aa 100644 --- a/Projectiles/Summon/YoungDuke.cs +++ b/Projectiles/Summon/YoungDuke.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon float chargeSpeed = playerHalfLife ? 25f : 20f; if (projectile.ai[0] >= timePerCharge) { - projectile.velocity = projectile.DirectionTo(potentialTarget.Center) * chargeSpeed; + projectile.velocity = projectile.SafeDirectionTo(potentialTarget.Center) * chargeSpeed; projectile.ai[0] = 0f; } else @@ -112,15 +112,12 @@ namespace CalamityMod.Projectiles.Summon { float intertia = 0.94f; float homeSpeed = playerHalfLife ? 38f : 32f; - projectile.velocity = Vector2.Lerp(projectile.velocity, - projectile.DirectionTo(potentialTarget.Center) * homeSpeed, - 1f - intertia); + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(potentialTarget.Center) * homeSpeed, 1f - intertia); } } - else if (projectile.Distance(player.Center) > 140f) - { - projectile.velocity = (projectile.velocity * 30f + projectile.DirectionTo(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(); } } diff --git a/Projectiles/Enemy/TornadoHostile.png b/Projectiles/TornadoProj.png similarity index 100% rename from Projectiles/Enemy/TornadoHostile.png rename to Projectiles/TornadoProj.png diff --git a/Projectiles/Typeless/AllianceTriangle.cs b/Projectiles/Typeless/AllianceTriangle.cs new file mode 100644 index 0000000000..15547cb5fc --- /dev/null +++ b/Projectiles/Typeless/AllianceTriangle.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class AllianceTriangle : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Alliance Triangle"); + } + + 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; + } + + 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; + + projectile.ai[0]++; + if (projectile.ai[0] <= 5f) + { + projectile.alpha -= 75; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + else + { + projectile.scale *= 1.06f; + projectile.alpha += 10; + } + + if (projectile.alpha >= 255 || player is null || player.dead) + { + projectile.Kill(); + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.alpha <= 0) + return new Color(200, 200, 200, 200); + return null; + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/AllianceTriangle.png b/Projectiles/Typeless/AllianceTriangle.png new file mode 100644 index 0000000000..66f397a1f3 Binary files /dev/null and b/Projectiles/Typeless/AllianceTriangle.png differ diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index e698101cd7..01e3656923 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class AstralSpray : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.width = 16; @@ -24,11 +26,12 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreAI() { - if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) + if (Main.myPlayer == projectile.owner) { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); - WorldGenerationMethods.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); + + AstralBiome.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); } if (projectile.timeLeft > 133) { @@ -56,7 +59,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[0]++; for (int i = 0; i < 1; i++) { - int d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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; diff --git a/Projectiles/Typeless/AstralSpray.png b/Projectiles/Typeless/AstralSpray.png deleted file mode 100644 index 6063d18a0b..0000000000 Binary files a/Projectiles/Typeless/AstralSpray.png and /dev/null differ diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index 525c749cd1..36d8fe419b 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -32,6 +32,9 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + if (projectile.ai[0] == 3f) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20); + if (projectile.ai[0] == 2f) { projectile.Calamity().rogue = true; @@ -138,7 +141,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 f59f33e26f..a6544f5859 100644 --- a/Projectiles/Typeless/AtaxiaOrb.cs +++ b/Projectiles/Typeless/AtaxiaOrb.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class AtaxiaOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Ataxia Orb"); @@ -24,44 +26,16 @@ namespace CalamityMod.Projectiles.Typeless projectile.timeLeft = 200; } - public override void AI() + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 170 && target.CanBeChasedBy(projectile); + + public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); - Main.dust[num469].noGravity = true; - Main.dust[num469].velocity *= 0f; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 400f; - 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)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 9f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + 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); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Typeless/AtaxiaOrb.png b/Projectiles/Typeless/AtaxiaOrb.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Typeless/AtaxiaOrb.png and /dev/null differ diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index c0f6ef183a..529ca96f00 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class BloodBomb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bomb"); @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless { 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, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Typeless/BloodBomb.png b/Projectiles/Typeless/BloodBomb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Typeless/BloodBomb.png and /dev/null differ diff --git a/Projectiles/Typeless/BloodBombExplosion.cs b/Projectiles/Typeless/BloodBombExplosion.cs index a6811338ea..3bc242d30a 100644 --- a/Projectiles/Typeless/BloodBombExplosion.cs +++ b/Projectiles/Typeless/BloodBombExplosion.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class BloodBombExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -23,7 +25,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 60; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Typeless/BloodBombExplosion.png b/Projectiles/Typeless/BloodBombExplosion.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Typeless/BloodBombExplosion.png and /dev/null differ diff --git a/Projectiles/Typeless/BobbitHead.cs b/Projectiles/Typeless/BobbitHead.cs index 9853d2c331..7ac1093342 100644 --- a/Projectiles/Typeless/BobbitHead.cs +++ b/Projectiles/Typeless/BobbitHead.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Projectiles.Typeless { public class BobbitHead : ModProjectile { + public const float PullSpeed = 24f; + public const float ReelbackSpeed = 28f; + public const float LaunchSpeed = 25f; + public const float GrappleRangInTiles = 40f; public override void SetStaticDefaults() { DisplayName.SetDefault("Bobbit Head"); @@ -38,10 +42,7 @@ namespace CalamityMod.Projectiles.Typeless } // Amethyst Hook is 300, Static Hook is 600, 16f = 1 tile - public override float GrappleRange() - { - return 640f; //40 tiles - } + public override float GrappleRange() => GrappleRangInTiles * 16f; public override void NumGrappleHooks(Player player, ref int numHooks) { @@ -51,12 +52,12 @@ namespace CalamityMod.Projectiles.Typeless // default is 11, Lunar is 24 public override void GrappleRetreatSpeed(Player player, ref float speed) { - speed = 28f; + speed = ReelbackSpeed; } public override void GrapplePullSpeed(Player player, ref float speed) { - speed = 24; + speed = PullSpeed; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs index 76f0e61b44..0092cc871b 100644 --- a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs +++ b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Typeless { public class BrimstoneHellfireballFriendly2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Hellfire"); diff --git a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.png b/Projectiles/Typeless/BrimstoneHellfireballFriendly2.png deleted file mode 100644 index 831f72cfc8..0000000000 Binary files a/Projectiles/Typeless/BrimstoneHellfireballFriendly2.png and /dev/null differ diff --git a/Projectiles/Typeless/ChaosBlaze.cs b/Projectiles/Typeless/ChaosBlaze.cs index c49d1bb392..449c733fb1 100644 --- a/Projectiles/Typeless/ChaosBlaze.cs +++ b/Projectiles/Typeless/ChaosBlaze.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosBlaze : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blaze"); diff --git a/Projectiles/Typeless/ChaosBlaze.png b/Projectiles/Typeless/ChaosBlaze.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Typeless/ChaosBlaze.png and /dev/null differ diff --git a/Projectiles/Typeless/ChaosFlare.cs b/Projectiles/Typeless/ChaosFlare.cs index c348dcd45a..04869804f8 100644 --- a/Projectiles/Typeless/ChaosFlare.cs +++ b/Projectiles/Typeless/ChaosFlare.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosFlare : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); @@ -23,14 +25,18 @@ namespace CalamityMod.Projectiles.Typeless projectile.extraUpdates = 1; } - public override void AI() + 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.25f / 255f, (255 - projectile.alpha) * 0f / 255f); + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + if (projectile.localAI[0] == 0f) { Main.PlaySound(SoundID.Item20, (int)projectile.position.X, (int)projectile.position.Y); projectile.localAI[0] += 1f; } + for (int num457 = 0; num457 < 6; num457++) { int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 1.2f); @@ -38,7 +44,9 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, 15f, 20f); + + if (projectile.timeLeft < 90) + 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/ChaosFlare.png b/Projectiles/Typeless/ChaosFlare.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Typeless/ChaosFlare.png and /dev/null differ diff --git a/Projectiles/Typeless/ChaosFlare2.cs b/Projectiles/Typeless/ChaosFlare2.cs index d29c4f3896..3f26337b07 100644 --- a/Projectiles/Typeless/ChaosFlare2.cs +++ b/Projectiles/Typeless/ChaosFlare2.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosFlare2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flare"); @@ -20,21 +22,23 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.timeLeft = 300; projectile.penetrate = 1; - projectile.extraUpdates = 1; + projectile.extraUpdates = 2; } - public override void AI() - { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0f / 255f); - for (int num457 = 0; num457 < 6; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 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; - } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 500f, 11f, 20f); - } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 270 && target.CanBeChasedBy(projectile); + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 127, 0f, 0f, 100, default, 2f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + + if (projectile.timeLeft < 270) + 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/ChaosFlare2.png b/Projectiles/Typeless/ChaosFlare2.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Typeless/ChaosFlare2.png and /dev/null differ diff --git a/Projectiles/Typeless/ChaosGeyser.cs b/Projectiles/Typeless/ChaosGeyser.cs index 834b23401e..1fe2138a9a 100644 --- a/Projectiles/Typeless/ChaosGeyser.cs +++ b/Projectiles/Typeless/ChaosGeyser.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class ChaosGeyser : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Geyser"); @@ -23,7 +25,21 @@ namespace CalamityMod.Projectiles.Typeless projectile.localNPCHitCooldown = 6; } - public override void AI() + // 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 cap = 3; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void AI() { if (projectile.velocity.X != projectile.velocity.X) { @@ -86,16 +102,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.OnFire, 180); } diff --git a/Projectiles/Typeless/ChaosGeyser.png b/Projectiles/Typeless/ChaosGeyser.png deleted file mode 100644 index dd0a1e7735..0000000000 Binary files a/Projectiles/Typeless/ChaosGeyser.png and /dev/null differ diff --git a/Projectiles/Typeless/ChaoticSpreadBobber.cs b/Projectiles/Typeless/ChaoticSpreadBobber.cs index 8f9d2d97b8..97688c44f7 100644 --- a/Projectiles/Typeless/ChaoticSpreadBobber.cs +++ b/Projectiles/Typeless/ChaoticSpreadBobber.cs @@ -6,30 +6,47 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class ChaoticSpreadBobber : ModProjectile - { + { + private bool initialized = false; + private Color fishingLineColor; + public Color[] PossibleLineColors = new Color[] + { + new Color(255, 165, 0, 100), //an orange color + new Color(0, 206, 209, 100) // a blue color + }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Chaotic Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { projectile.width = 14; projectile.height = 14; projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; - } + projectile.bobber = true; + projectile.penetrate = -1; + } - public override bool PreDrawExtras(SpriteBatch spriteBatch) - { - if (projectile.Calamity().lineColor == 1) + //What if we want to randomize the line color + public override void AI() + { + if (!initialized) + { + //Decide color of the pole by randomizing the array + fishingLineColor = Main.rand.Next(PossibleLineColors); + initialized = true; + } + } + + public override bool PreDrawExtras(SpriteBatch spriteBatch) + { + if (fishingLineColor == PossibleLineColors[0]) Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); else Lighting.AddLight(projectile.Center, 0f, 0.45f, 0.46f); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), projectile.Calamity().lineColor == 1 ? new Color(255, 165, 0, 100) : new Color(0, 206, 209, 100), 65, 30f); - return false; + return projectile.DrawFishingLine(ModContent.ItemType(), fishingLineColor, 65, 30f); } - } + } } diff --git a/Projectiles/Typeless/CirrusBolt.png b/Projectiles/Typeless/CirrusBolt.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Typeless/CirrusBolt.png and /dev/null differ diff --git a/Projectiles/Typeless/CirrusOrb.cs b/Projectiles/Typeless/CirrusOrb.cs deleted file mode 100644 index 86758bc9bf..0000000000 --- a/Projectiles/Typeless/CirrusOrb.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Typeless -{ - public class CirrusOrb : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Orb"); - } - - 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.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10; - projectile.npcProj = true; - } - - public override void AI() - { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType()); - } - } -} diff --git a/Projectiles/Typeless/CirrusOrb.png b/Projectiles/Typeless/CirrusOrb.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Typeless/CirrusOrb.png and /dev/null differ diff --git a/Projectiles/Typeless/CirrusRay.png b/Projectiles/Typeless/CirrusRay.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Typeless/CirrusRay.png and /dev/null differ diff --git a/Projectiles/Typeless/CoralBubbleSmall.cs b/Projectiles/Typeless/CoralBubbleSmall.cs index cacf6eee29..cdb4df05b8 100644 --- a/Projectiles/Typeless/CoralBubbleSmall.cs +++ b/Projectiles/Typeless/CoralBubbleSmall.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class CoralBubbleSmall : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Typeless/CoralBubble"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bubble"); diff --git a/Projectiles/Typeless/CoralBubbleSmall.png b/Projectiles/Typeless/CoralBubbleSmall.png deleted file mode 100644 index e3e51784ba..0000000000 Binary files a/Projectiles/Typeless/CoralBubbleSmall.png and /dev/null differ diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index aef6539f04..2fd585b01b 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -185,18 +185,18 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) diff --git a/Projectiles/Typeless/CursorProjSplit.cs b/Projectiles/Typeless/CursorProjSplit.cs index f6762606db..a992d5d345 100644 --- a/Projectiles/Typeless/CursorProjSplit.cs +++ b/Projectiles/Typeless/CursorProjSplit.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Typeless { public class CursorProjSplit : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Typeless/CursorProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Aestheticus Crystal"); @@ -185,33 +187,23 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 60); } - public override bool? CanHitNPC(NPC target) - { - if (projectile.alpha >= 128) - { - return false; - } - return null; - } + public override bool? CanHitNPC(NPC target) => projectile.alpha < 128; - public override bool CanHitPvp(Player target) - { - return projectile.alpha < 128; - } + public override bool CanHitPvp(Player target) => projectile.alpha < 128; public override void Kill(int timeLeft) { diff --git a/Projectiles/Typeless/CursorProjSplit.png b/Projectiles/Typeless/CursorProjSplit.png deleted file mode 100644 index f9596ad6f7..0000000000 Binary files a/Projectiles/Typeless/CursorProjSplit.png and /dev/null differ diff --git a/Projectiles/Typeless/DarkIce.cs b/Projectiles/Typeless/DarkIce.cs index a2fc890051..beeadbbc90 100644 --- a/Projectiles/Typeless/DarkIce.cs +++ b/Projectiles/Typeless/DarkIce.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Typeless { public class DarkIce : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Melee/DarkIceZero"; + public override void SetDefaults() { projectile.width = 28; @@ -49,13 +51,13 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(ModContent.BuffType(), 480); + target.AddBuff(ModContent.BuffType(), 60); } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(BuffID.Frostburn, 480); - target.AddBuff(ModContent.BuffType(), 480); + target.AddBuff(ModContent.BuffType(), 60); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Typeless/DarkIce.png b/Projectiles/Typeless/DarkIce.png deleted file mode 100644 index 98bedb5a00..0000000000 Binary files a/Projectiles/Typeless/DarkIce.png and /dev/null differ diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index e9d1b1ceaf..b3c5540d7a 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -100,30 +100,6 @@ namespace CalamityMod.Projectiles.Typeless float num634 = 2000f; float num635 = 3000f; float num636 = 150f; - float num637 = 0.05f; - for (int num638 = 0; num638 < Main.maxProjectiles; num638++) - { - bool flag23 = Main.projectile[num638].type == ModContent.ProjectileType(); - if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) - { - if (projectile.position.X < Main.projectile[num638].position.X) - { - projectile.velocity.X = projectile.velocity.X - num637; - } - else - { - projectile.velocity.X = projectile.velocity.X + num637; - } - if (projectile.position.Y < Main.projectile[num638].position.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num637; - } - else - { - projectile.velocity.Y = projectile.velocity.Y + num637; - } - } - } bool flag24 = false; if (projectile.ai[0] == 2f) { @@ -269,21 +245,24 @@ namespace CalamityMod.Projectiles.Typeless } if (projectile.ai[0] == 0f) { - float scaleFactor3 = 24f; - int num658 = ProjectileID.UnholyTridentFriendly; + float speed = 24f; + int projType = ProjectileID.UnholyTridentFriendly; if (flag25 && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, vector46, 0, 0)) + if (Main.myPlayer == projectile.owner && Collision.CanHitLine(projectile.Center, projectile.width, projectile.height, vector46, 0, 0)) { - Vector2 value19 = vector46 - projectile.Center; - value19.Normalize(); - value19 *= scaleFactor3; - int num659 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num659].timeLeft = 300; - Main.projectile[num659].usesLocalNPCImmunity = true; - Main.projectile[num659].localNPCHitCooldown = 10; - Main.projectile[num659].Calamity().forceTypeless = true; //typeless + Vector2 velocity = vector46 - projectile.Center; + velocity.Normalize(); + velocity *= speed; + int trident = Projectile.NewProjectile(projectile.Center, velocity, projType, projectile.damage, 0f, Main.myPlayer); + if (trident.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[trident].timeLeft = 300; + Main.projectile[trident].usesLocalNPCImmunity = true; + Main.projectile[trident].localNPCHitCooldown = 10; + Main.projectile[trident].Calamity().forceTypeless = true; //typeless + } projectile.netUpdate = true; } } diff --git a/Projectiles/Typeless/DevourerofCodsBobber.cs b/Projectiles/Typeless/DevourerofCodsBobber.cs index 7cd14689c6..3597647f95 100644 --- a/Projectiles/Typeless/DevourerofCodsBobber.cs +++ b/Projectiles/Typeless/DevourerofCodsBobber.cs @@ -7,36 +7,63 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class DevourerofCodsBobber : ModProjectile - { + { + private bool initialized = false; + private Color fishingLineColor; + public Color[] PossibleLineColors = new Color[] + { + new Color(252, 109, 202, 100), //a pink color + new Color(39, 151, 171, 100) // a blue color + }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Devourer of Cods Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { projectile.width = 14; projectile.height = 14; projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; - } + projectile.bobber = true; + projectile.penetrate = -1; + } + + //What if we want to randomize the line color + public override void AI() + { + if (!initialized) + { + //Decide color of the pole by randomizing the array + fishingLineColor = Main.rand.Next(PossibleLineColors); + initialized = true; + } + } //fuck glowmasks btw + //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; + drawPos.X += xOffset; + 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; - //i second this notion -Dominic - 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/DevourerofCodsGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); - } - - public override bool PreDrawExtras(SpriteBatch spriteBatch) - { - Lighting.AddLight(projectile.Center, 0.35f, 0f, 0.25f); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), projectile.Calamity().lineColor == 1 ? new Color(252, 109, 202, 100) : new Color(39, 151, 171, 100)); - return false; + if (projectile.ai[0] <= 1f) + { + 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); + } + } } diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs index b8fa9e0cc3..787b439876 100644 --- a/Projectiles/Typeless/DirectStrike.cs +++ b/Projectiles/Typeless/DirectStrike.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Typeless { public class DirectStrike : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nondescript Damaging Entity"); diff --git a/Projectiles/Typeless/DirectStrike.png b/Projectiles/Typeless/DirectStrike.png deleted file mode 100644 index 50986e43ef..0000000000 Binary files a/Projectiles/Typeless/DirectStrike.png and /dev/null differ diff --git a/Projectiles/Typeless/DragonDust.cs b/Projectiles/Typeless/DragonDust.cs index bec93ad532..5ac0bd88db 100644 --- a/Projectiles/Typeless/DragonDust.cs +++ b/Projectiles/Typeless/DragonDust.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class DragonDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); diff --git a/Projectiles/Typeless/DragonDust.png b/Projectiles/Typeless/DragonDust.png deleted file mode 100644 index 59a8c48354..0000000000 Binary files a/Projectiles/Typeless/DragonDust.png and /dev/null differ diff --git a/Projectiles/Typeless/EarlyBloomBobber.cs b/Projectiles/Typeless/EarlyBloomBobber.cs index 0abbb3823d..4dfa30dc6f 100644 --- a/Projectiles/Typeless/EarlyBloomBobber.cs +++ b/Projectiles/Typeless/EarlyBloomBobber.cs @@ -6,27 +6,25 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class EarlyBloomBobber : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Early Bloom Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { 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); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(190, 140, 69, 100)); - return false; + 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)); + } + } } diff --git a/Projectiles/Typeless/FabsolDust.cs b/Projectiles/Typeless/FabsolDust.cs index 1a8c1f94fa..0178d7219c 100644 --- a/Projectiles/Typeless/FabsolDust.cs +++ b/Projectiles/Typeless/FabsolDust.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Typeless { public class FabsolDust : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Dust"); diff --git a/Projectiles/Typeless/FabsolDust.png b/Projectiles/Typeless/FabsolDust.png deleted file mode 100644 index b2414440a0..0000000000 Binary files a/Projectiles/Typeless/FabsolDust.png and /dev/null differ diff --git a/Projectiles/Typeless/FeralDoubleBobber.cs b/Projectiles/Typeless/FeralDoubleBobber.cs index 8bc790de17..9b0b04d9fb 100644 --- a/Projectiles/Typeless/FeralDoubleBobber.cs +++ b/Projectiles/Typeless/FeralDoubleBobber.cs @@ -6,27 +6,25 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class FeralDoubleBobber : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Feral Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { 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); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(220, 20, 60, 100)); - return false; + 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)); + } + } } diff --git a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs index b89fd39e36..3c6bca39fb 100644 --- a/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs +++ b/Projectiles/Typeless/FiniteUse/ExplosiveShotgunShell.cs @@ -29,9 +29,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - damage += target.lifeMax / 150; //120 + 30 = 150 + (100000 / 150 = 666) = 816 * 15 (pellets) = 12240 * 2 (explosion) = 24480 = 24.48% of boss HP - if (damage > target.lifeMax / 90 && CalamityPlayer.areThereAnyDamnBosses) - damage = target.lifeMax / 90; + damage += target.lifeMax / 400; // 120 + 30 = 150 + (100000 / 400 = 250) = 400 * 8 = 3200 * 2 (explosion) = 6400 = 6.4% of boss HP } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Typeless/FiniteUse/GrenadeRound.cs b/Projectiles/Typeless/FiniteUse/GrenadeRound.cs index a4c1a88fbf..1352f5125a 100644 --- a/Projectiles/Typeless/FiniteUse/GrenadeRound.cs +++ b/Projectiles/Typeless/FiniteUse/GrenadeRound.cs @@ -62,11 +62,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (target.Inorganic()) - { - damage += target.lifeMax / 20; //500 + 200 = 700 + (100000 / 20 = 5000) = 5700 * 2 (explosion) = 11400 = 11.4% of boss HP - } - if (damage > target.lifeMax / 12 && CalamityPlayer.areThereAnyDamnBosses) - damage = target.lifeMax / 12; + damage += target.lifeMax / 100; // 500 + 200 = 700 + (100000 / 100 = 1000) = 1700 * 2 (explosion) = 3400 = 3.4% of boss HP } public override void Kill(int timeLeft) diff --git a/Projectiles/Typeless/FiniteUse/MagnumRound.cs b/Projectiles/Typeless/FiniteUse/MagnumRound.cs index e9d87d18e4..129f8b3deb 100644 --- a/Projectiles/Typeless/FiniteUse/MagnumRound.cs +++ b/Projectiles/Typeless/FiniteUse/MagnumRound.cs @@ -1,4 +1,3 @@ -using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,11 +29,7 @@ namespace CalamityMod.Projectiles.Typeless.FiniteUse public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { if (target.Organic()) - { - damage += target.lifeMax / 25; //400 + 80 = 480 + (100000 / 25 = 4000) = 4480, if crit = 5600 = 5.6% of boss HP - } - if (damage > target.lifeMax / 15 && CalamityPlayer.areThereAnyDamnBosses) - damage = target.lifeMax / 15; + damage += target.lifeMax / 75; // 400 + 80 = 480 + (100000 / 75 = 1333) = 1813 = 1.813% of boss HP } } } diff --git a/Projectiles/Typeless/FlareExplosion.cs b/Projectiles/Typeless/FlareExplosion.cs index 7fa406c06e..3d6192d769 100644 --- a/Projectiles/Typeless/FlareExplosion.cs +++ b/Projectiles/Typeless/FlareExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class FlareExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Typeless/FlareExplosion.png b/Projectiles/Typeless/FlareExplosion.png deleted file mode 100644 index e975d88423..0000000000 Binary files a/Projectiles/Typeless/FlareExplosion.png and /dev/null differ diff --git a/Projectiles/Typeless/FuckYou.cs b/Projectiles/Typeless/FuckYou.cs index be379d8bc5..488628edc6 100644 --- a/Projectiles/Typeless/FuckYou.cs +++ b/Projectiles/Typeless/FuckYou.cs @@ -65,18 +65,18 @@ namespace CalamityMod.Projectiles.Typeless Main.PlaySound(SoundID.Item14, projectile.position); for (int dustIndexA = 0; dustIndexA < 4; dustIndexA = incrementer + 1) { - int num992 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default, 1.5f); + 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(new Vector2(projectile.position.X, projectile.position.Y), 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.noGravity = true; dust.velocity *= 3f; - fireDust = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 1.5f); + 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; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int dustIndexC = 0; dustIndexC < 5; dustIndexC = incrementer + 1) { - int fireDust2 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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.noGravity = true; @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Typeless } for (int dustIndexD = 0; dustIndexD < 10; dustIndexD = incrementer + 1) { - int num998 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 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.noGravity = true; diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index a17b1f5866..ad4f730a7b 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class GhostlyBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Typeless/GhostlyBolt.png b/Projectiles/Typeless/GhostlyBolt.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Typeless/GhostlyBolt.png and /dev/null differ diff --git a/Projectiles/Typeless/GladiatorSword.cs b/Projectiles/Typeless/GladiatorSword.cs index b55bdd2e6b..1b661ba401 100644 --- a/Projectiles/Typeless/GladiatorSword.cs +++ b/Projectiles/Typeless/GladiatorSword.cs @@ -1,5 +1,4 @@ using CalamityMod.CalPlayer; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,7 +8,7 @@ namespace CalamityMod.Projectiles.Typeless { public class GladiatorSword : ModProjectile { - private double rotation = 0; + private double rotation = 0D; public override void SetStaticDefaults() { @@ -19,8 +18,7 @@ namespace CalamityMod.Projectiles.Typeless public override void SetDefaults() { - projectile.width = 22; - projectile.height = 22; + projectile.width = projectile.height = 22; projectile.ignoreWater = true; projectile.timeLeft = 18000; projectile.tileCollide = false; @@ -28,20 +26,15 @@ namespace CalamityMod.Projectiles.Typeless projectile.timeLeft *= 5; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10 - - (Main.hardMode ? 2 : 0) - - (NPC.downedPlantBoss ? 2 : 0) - - (NPC.downedMoonlord ? 2 : 0) - - (CalamityWorld.downedDoG ? 2 : 0); + projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.friendly = true; - projectile.hostile = false; bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); @@ -55,32 +48,32 @@ namespace CalamityMod.Projectiles.Typeless player.AverageDamage()); projectile.damage = damage2; } + if (!modPlayer.gladiatorSword) { projectile.active = false; return; } + if (flag64) { if (player.dead) - { modPlayer.glSword = false; - } if (modPlayer.glSword) - { 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); + + Lighting.AddLight(projectile.Center, 0.15f, 0.15f, 0f); + Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; + projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - double rotateAmt = CalamityWorld.downedDoG ? 0.1 : NPC.downedMoonlord ? 0.08 : NPC.downedPlantBoss ? 0.05 : Main.hardMode ? 0.04 : 0.03; - rotation += rotateAmt; - if (rotation >= 360) - { - rotation = 0; - } + + rotation += 0.1; + if (rotation >= 360D) + rotation = 0D; + projectile.velocity.X = (vector.X > 0f) ? -0.000001f : 0f; } } diff --git a/Projectiles/Typeless/GladiatorSword.png b/Projectiles/Typeless/GladiatorSword.png index c4f7aae317..a9f7f7f16f 100644 Binary files a/Projectiles/Typeless/GladiatorSword.png and b/Projectiles/Typeless/GladiatorSword.png differ diff --git a/Projectiles/Typeless/GladiatorSword2.cs b/Projectiles/Typeless/GladiatorSword2.cs index 7ce5080fa2..d4dc29f631 100644 --- a/Projectiles/Typeless/GladiatorSword2.cs +++ b/Projectiles/Typeless/GladiatorSword2.cs @@ -1,5 +1,4 @@ using CalamityMod.CalPlayer; -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,7 +8,7 @@ namespace CalamityMod.Projectiles.Typeless { public class GladiatorSword2 : ModProjectile { - private double rotation = 0; + private double rotation = 0D; public override void SetStaticDefaults() { @@ -28,20 +27,15 @@ namespace CalamityMod.Projectiles.Typeless projectile.timeLeft *= 5; projectile.penetrate = -1; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 10 - - (Main.hardMode ? 2 : 0) - - (NPC.downedPlantBoss ? 2 : 0) - - (NPC.downedMoonlord ? 2 : 0) - - (CalamityWorld.downedDoG ? 2 : 0); + projectile.localNPCHitCooldown = 10; } public override void AI() { - projectile.friendly = true; - projectile.hostile = false; bool flag64 = projectile.type == ModContent.ProjectileType(); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + if (projectile.localAI[0] == 0f) { projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); @@ -55,33 +49,33 @@ namespace CalamityMod.Projectiles.Typeless player.AverageDamage()); projectile.damage = damage2; } + if (!modPlayer.gladiatorSword) { projectile.active = false; return; } + if (flag64) { if (player.dead) - { modPlayer.glSword = false; - } if (modPlayer.glSword) - { 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); + + Lighting.AddLight(projectile.Center, 0.15f, 0.15f, 0f); + Vector2 vector = player.Center - projectile.Center; - projectile.rotation = vector.ToRotation() - 1.57f; + projectile.rotation = vector.ToRotation() - MathHelper.PiOver2; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); - double rotateAmt = CalamityWorld.downedDoG ? 0.09 : NPC.downedMoonlord ? 0.07 : NPC.downedPlantBoss ? 0.04 : Main.hardMode ? 0.03 : 0.02; - //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 -= rotateAmt; - if (rotation <= 0) - { - rotation = 360; - } + + // 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; } } diff --git a/Projectiles/Typeless/GodKiller.cs b/Projectiles/Typeless/GodKiller.cs index 96fee4d9c6..8946685375 100644 --- a/Projectiles/Typeless/GodKiller.cs +++ b/Projectiles/Typeless/GodKiller.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Typeless } } } - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 35f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 300f, 12f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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 a1bfd834fc..415d58ea45 100644 --- a/Projectiles/Typeless/GodSlayerBlaze.cs +++ b/Projectiles/Typeless/GodSlayerBlaze.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerBlaze : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blaze"); diff --git a/Projectiles/Typeless/GodSlayerBlaze.png b/Projectiles/Typeless/GodSlayerBlaze.png deleted file mode 100644 index df1dd57993..0000000000 Binary files a/Projectiles/Typeless/GodSlayerBlaze.png and /dev/null differ diff --git a/Projectiles/Typeless/GodSlayerOrb.cs b/Projectiles/Typeless/GodSlayerOrb.cs index 96c53f1ede..8896d03735 100644 --- a/Projectiles/Typeless/GodSlayerOrb.cs +++ b/Projectiles/Typeless/GodSlayerOrb.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Orb"); @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless 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, false, 600f, 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/GodSlayerOrb.png b/Projectiles/Typeless/GodSlayerOrb.png deleted file mode 100644 index 15e8775737..0000000000 Binary files a/Projectiles/Typeless/GodSlayerOrb.png and /dev/null differ diff --git a/Projectiles/Typeless/GodSlayerPhantom.cs b/Projectiles/Typeless/GodSlayerPhantom.cs index ce10466e68..a58b8d038a 100644 --- a/Projectiles/Typeless/GodSlayerPhantom.cs +++ b/Projectiles/Typeless/GodSlayerPhantom.cs @@ -53,15 +53,11 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.Distance(Main.player[projectile.owner].Center) > num954) { - Vector2 vector102 = projectile.DirectionTo(Main.player[projectile.owner].Center); - if (vector102.HasNaNs()) - { - vector102 = Vector2.UnitY; - } - projectile.velocity = (projectile.velocity * (num953 - 1f) + vector102 * 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, false, 400f, 15f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } else { diff --git a/Projectiles/Typeless/GodSlayerShrapnel.cs b/Projectiles/Typeless/GodSlayerShrapnel.cs index d1540d85c0..2323a36ea4 100644 --- a/Projectiles/Typeless/GodSlayerShrapnel.cs +++ b/Projectiles/Typeless/GodSlayerShrapnel.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnel : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); @@ -83,13 +85,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Typeless/GodSlayerShrapnel.png b/Projectiles/Typeless/GodSlayerShrapnel.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Typeless/GodSlayerShrapnel.png and /dev/null differ diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.cs b/Projectiles/Typeless/GodSlayerShrapnelRound.cs index 622dcfeb94..0e7fdf26de 100644 --- a/Projectiles/Typeless/GodSlayerShrapnelRound.cs +++ b/Projectiles/Typeless/GodSlayerShrapnelRound.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class GodSlayerShrapnelRound : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Round"); diff --git a/Projectiles/Typeless/GodSlayerShrapnelRound.png b/Projectiles/Typeless/GodSlayerShrapnelRound.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Typeless/GodSlayerShrapnelRound.png and /dev/null differ diff --git a/Projectiles/Typeless/GoldenGunProj.cs b/Projectiles/Typeless/GoldenGunProj.cs index 60404e6db7..5c7a255fc0 100644 --- a/Projectiles/Typeless/GoldenGunProj.cs +++ b/Projectiles/Typeless/GoldenGunProj.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class GoldenGunProj : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Golden Round"); diff --git a/Projectiles/Typeless/GoldenGunProj.png b/Projectiles/Typeless/GoldenGunProj.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Typeless/GoldenGunProj.png and /dev/null differ diff --git a/Projectiles/Typeless/HellfireExplosionFriendly2.cs b/Projectiles/Typeless/HellfireExplosionFriendly2.cs index a74ca74e37..1f04c40eaa 100644 --- a/Projectiles/Typeless/HellfireExplosionFriendly2.cs +++ b/Projectiles/Typeless/HellfireExplosionFriendly2.cs @@ -9,6 +9,8 @@ namespace CalamityMod.Projectiles.Typeless { public class HellfireExplosionFriendly2 : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Typeless/HellfireExplosionFriendly2.png b/Projectiles/Typeless/HellfireExplosionFriendly2.png deleted file mode 100644 index 59d45407ff..0000000000 Binary files a/Projectiles/Typeless/HellfireExplosionFriendly2.png and /dev/null differ diff --git a/Projectiles/Typeless/HeronBobber.cs b/Projectiles/Typeless/HeronBobber.cs index 7e3e696563..80de1b556b 100644 --- a/Projectiles/Typeless/HeronBobber.cs +++ b/Projectiles/Typeless/HeronBobber.cs @@ -5,26 +5,24 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class HeronBobber : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Heron Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { projectile.width = 14; projectile.height = 14; projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; - } - - public override bool PreDrawExtras(SpriteBatch spriteBatch) - { - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(101, 149, 154, 100)); - return false; + projectile.bobber = true; + projectile.penetrate = -1; } - } + + public override bool PreDrawExtras(SpriteBatch spriteBatch) + { + return projectile.DrawFishingLine(ModContent.ItemType(), new Color(101, 149, 154, 100)); + } + } } diff --git a/Projectiles/Typeless/HolyEruption.cs b/Projectiles/Typeless/HolyEruption.cs index 2c7be1d463..f4af993411 100644 --- a/Projectiles/Typeless/HolyEruption.cs +++ b/Projectiles/Typeless/HolyEruption.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyEruption : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Eruption"); @@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 360; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 2; + projectile.localNPCHitCooldown = 10; } public override void AI() @@ -80,16 +82,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); } diff --git a/Projectiles/Typeless/HolyEruption.png b/Projectiles/Typeless/HolyEruption.png deleted file mode 100644 index dd0a1e7735..0000000000 Binary files a/Projectiles/Typeless/HolyEruption.png and /dev/null differ diff --git a/Projectiles/Typeless/HolyExplosion.cs b/Projectiles/Typeless/HolyExplosion.cs index 904f6c550d..9cbde1ea87 100644 --- a/Projectiles/Typeless/HolyExplosion.cs +++ b/Projectiles/Typeless/HolyExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); diff --git a/Projectiles/Typeless/HolyExplosion.png b/Projectiles/Typeless/HolyExplosion.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Typeless/HolyExplosion.png and /dev/null differ diff --git a/Projectiles/Typeless/HolyExplosionSupreme.cs b/Projectiles/Typeless/HolyExplosionSupreme.cs index ff67d7bed8..05398a1421 100644 --- a/Projectiles/Typeless/HolyExplosionSupreme.cs +++ b/Projectiles/Typeless/HolyExplosionSupreme.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class HolyExplosionSupreme : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -33,7 +35,7 @@ namespace CalamityMod.Projectiles.Typeless 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 < 30; num621++) + 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); Main.dust[num622].velocity *= 3f; @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + 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); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Typeless/HolyExplosionSupreme.png b/Projectiles/Typeless/HolyExplosionSupreme.png deleted file mode 100644 index 80da916522..0000000000 Binary files a/Projectiles/Typeless/HolyExplosionSupreme.png and /dev/null differ diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index ad8570c1c9..c84877dc68 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class HydrothermalSmoke : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Smoke"); diff --git a/Projectiles/Typeless/HydrothermalSmoke.png b/Projectiles/Typeless/HydrothermalSmoke.png deleted file mode 100644 index d72b7b5eac..0000000000 Binary files a/Projectiles/Typeless/HydrothermalSmoke.png and /dev/null differ diff --git a/Projectiles/Typeless/KelvinCatalystStar.cs b/Projectiles/Typeless/KelvinCatalystStar.cs index 72092691cf..ba98f48f8f 100644 --- a/Projectiles/Typeless/KelvinCatalystStar.cs +++ b/Projectiles/Typeless/KelvinCatalystStar.cs @@ -38,41 +38,30 @@ namespace CalamityMod.Projectiles.Typeless { projectile.extraUpdates = 1; - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 500f; - bool flag17 = false; + Vector2 center = projectile.Center; + float maxDistance = 500f; + bool homeIn = false; - for (int num475 = 0; num475 < 200; num475++) - { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + 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; + break; + } + } + } + + if (homeIn) + { + Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); + projectile.velocity = (projectile.velocity * 20f + moveDirection * 12f) / (21f); + } else projectile.Kill(); } @@ -96,17 +85,14 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 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); - 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); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 24); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -116,6 +102,8 @@ namespace CalamityMod.Projectiles.Typeless 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(); } diff --git a/Projectiles/Typeless/LunicBeam.cs b/Projectiles/Typeless/LunicBeam.cs index db6d22ab19..fba899764a 100644 --- a/Projectiles/Typeless/LunicBeam.cs +++ b/Projectiles/Typeless/LunicBeam.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class LunicBeam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { float num29 = 5f; - float num30 = 300f; + float num30 = 150f; float scaleFactor = 6f; Vector2 value7 = new Vector2(10f, 20f); float num31 = 1f; diff --git a/Projectiles/Typeless/LunicBeam.png b/Projectiles/Typeless/LunicBeam.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Typeless/LunicBeam.png and /dev/null differ diff --git a/Projectiles/Typeless/MageHammerBoom.cs b/Projectiles/Typeless/MageHammerBoom.cs index 4142e9f277..9dcc2656fb 100644 --- a/Projectiles/Typeless/MageHammerBoom.cs +++ b/Projectiles/Typeless/MageHammerBoom.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Typeless { public class MageHammerBoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Explosion"); @@ -18,7 +20,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.penetrate = -1; projectile.timeLeft = 5; projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 1; + projectile.localNPCHitCooldown = 6; } } } diff --git a/Projectiles/Typeless/MageHammerBoom.png b/Projectiles/Typeless/MageHammerBoom.png deleted file mode 100644 index a727d47235..0000000000 Binary files a/Projectiles/Typeless/MageHammerBoom.png and /dev/null differ diff --git a/Projectiles/Typeless/MarkRound.cs b/Projectiles/Typeless/MarkRound.cs index 3e6ca65fbb..63839a7933 100644 --- a/Projectiles/Typeless/MarkRound.cs +++ b/Projectiles/Typeless/MarkRound.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class MarkRound : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/LaserProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Laser"); @@ -54,52 +56,18 @@ namespace CalamityMod.Projectiles.Typeless } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(200, 0, 250, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 250, 0); - 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)); - int num147 = 0; - int num148 = 0; - float num149 = (float)(Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; - SpriteEffects spriteEffects = SpriteEffects.None; - if (projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Rectangle value6 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); - if (projectile.getRect().Intersects(value6)) - { - Vector2 value7 = new Vector2(projectile.position.X - Main.screenPosition.X + num149 + (float)num148, projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY); - float num162 = 30f; - float scaleFactor = 2f; - if (projectile.ai[1] == 1f) - { - num162 = (float)(int)projectile.localAI[0]; - } - for (int num163 = 1; num163 <= (int)projectile.localAI[0]; num163++) - { - Vector2 value8 = Vector2.Normalize(projectile.velocity) * (float)num163 * scaleFactor; - Color color29 = projectile.GetAlpha(color25); - color29 *= (num162 - (float)num163) / num162; - color29.A = 0; - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], value7 - value8, null, color29, projectile.rotation, new Vector2(num149, (float)(projectile.height / 2 + num147)), projectile.scale, spriteEffects, 0f); - } - } - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.DrawBeam(30f, 2f, lightColor); public override void Kill(int timeLeft) { - int num212 = Main.rand.Next(3, 7); - for (int num213 = 0; num213 < num212; num213++) + int dustAmt = Main.rand.Next(3, 7); + for (int d = 0; d < dustAmt; d++) { - int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 173, 0f, 0f, 100, default, 2.1f); - Main.dust[num214].velocity *= 2f; - Main.dust[num214].noGravity = true; + 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/MarkRound.png b/Projectiles/Typeless/MarkRound.png deleted file mode 100644 index d2fb806a1a..0000000000 Binary files a/Projectiles/Typeless/MarkRound.png and /dev/null differ diff --git a/Projectiles/Typeless/MomentumCapacitorOrb.cs b/Projectiles/Typeless/MomentumCapacitorOrb.cs index 3eca89eb47..0a0c42b0a2 100644 --- a/Projectiles/Typeless/MomentumCapacitorOrb.cs +++ b/Projectiles/Typeless/MomentumCapacitorOrb.cs @@ -53,7 +53,6 @@ namespace CalamityMod.Projectiles.Typeless Main.projectile[k].type == ModContent.ProjectileType() || Main.projectile[k].type == ModContent.ProjectileType()) continue; - Circle aura = new Circle(projectile.Center, Radius); 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) diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index 0641e04831..29ab33f4f1 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class NanoFlare : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nano Flare"); @@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.ignoreWater = true; projectile.tileCollide = false; - projectile.extraUpdates = 10; + projectile.extraUpdates = 10; projectile.timeLeft = 60; } diff --git a/Projectiles/Typeless/NanoFlare.png b/Projectiles/Typeless/NanoFlare.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Typeless/NanoFlare.png and /dev/null differ diff --git a/Projectiles/Typeless/Nanotech.cs b/Projectiles/Typeless/Nanotech.cs index 0f9e7064c4..48d5a76213 100644 --- a/Projectiles/Typeless/Nanotech.cs +++ b/Projectiles/Typeless/Nanotech.cs @@ -1,14 +1,14 @@ using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Typeless { public class Nanotech : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Nanotech"); + DisplayName.SetDefault("Nanoblade"); } public override void SetDefaults() @@ -16,24 +16,25 @@ namespace CalamityMod.Projectiles.Typeless projectile.width = 26; projectile.height = 26; projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = 1; - projectile.extraUpdates = 2; } - public override void AI() + 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)); + projectile.rotation += projectile.velocity.X * 0.2f; if (projectile.velocity.X > 0f) - { projectile.rotation += 0.08f; - } else - { projectile.rotation -= 0.08f; - } + projectile.ai[1] += 1f; - if (projectile.ai[1] > 30f) + if (projectile.ai[1] > 60f) { projectile.alpha += 5; if (projectile.alpha >= 255) @@ -43,42 +44,26 @@ namespace CalamityMod.Projectiles.Typeless return; } } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 600f; - 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)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 20f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + + if (projectile.ai[1] >= 30f) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f); } - public override void Kill(int timeLeft) + // 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 cap = 5; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void Kill(int timeLeft) { int num3; for (int num191 = 0; num191 < 2; num191 = num3 + 1) diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index f7b80b79bc..f92ee13080 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -5,27 +5,26 @@ using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class NavyBobber : ModProjectile - { + public class NavyBobber : ModProjectile + { public override void SetStaticDefaults() { DisplayName.SetDefault("Navy Bobber"); } - public override void SetDefaults() - { + public override void SetDefaults() + { 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); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(36, 61, 111, 100), 55, 33f); - return false; + 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); + } + } } diff --git a/Projectiles/Typeless/NobodyKnows.cs b/Projectiles/Typeless/NobodyKnows.cs index b302886136..e519c8d03f 100644 --- a/Projectiles/Typeless/NobodyKnows.cs +++ b/Projectiles/Typeless/NobodyKnows.cs @@ -3,6 +3,8 @@ namespace CalamityMod.Projectiles.Typeless { public class NobodyKnows : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Nope"); diff --git a/Projectiles/Typeless/NobodyKnows.png b/Projectiles/Typeless/NobodyKnows.png deleted file mode 100644 index 0c09522090..0000000000 Binary files a/Projectiles/Typeless/NobodyKnows.png and /dev/null differ diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 24bdf104aa..a917cf028f 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 6; i++) { segment[i] = projectile.Center; - //Main.NewText("init segment " + segment[i].X.ToString() + " " + segment[i].Y.ToString()); } } return true; @@ -194,7 +193,7 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].lifeSteal > 0f && target.type != NPCID.TargetDummy && !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 if (healAmount > 0) diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs index 788a79bf13..3e63e4d649 100644 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ b/Projectiles/Typeless/PendantProjectile1.cs @@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } } } diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs index 9e4b19b4c1..fc81792b6e 100644 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ b/Projectiles/Typeless/PendantProjectile2.cs @@ -37,12 +37,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 15); + target.AddBuff(ModContent.BuffType(), 30); } } } diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PendantProjectile3.cs index 694f423348..433215f277 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PendantProjectile3.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 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; @@ -39,12 +39,12 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); } public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 216f5a153a..f9722a3126 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class PoisonousSeawater : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Seawater"); diff --git a/Projectiles/Typeless/PoisonousSeawater.png b/Projectiles/Typeless/PoisonousSeawater.png deleted file mode 100644 index d72b7b5eac..0000000000 Binary files a/Projectiles/Typeless/PoisonousSeawater.png and /dev/null differ diff --git a/Projectiles/Typeless/ReaverBlast.cs b/Projectiles/Typeless/ReaverBlast.cs deleted file mode 100644 index 929e6d7207..0000000000 --- a/Projectiles/Typeless/ReaverBlast.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ReaverBlast : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Blast"); - } - - 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; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.1f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.015f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 74, 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 += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; - } - return; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 60); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.CursedInferno, 60); - } - } -} diff --git a/Projectiles/Typeless/ReaverBlast.png b/Projectiles/Typeless/ReaverBlast.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Typeless/ReaverBlast.png and /dev/null differ diff --git a/Projectiles/Typeless/ReaverOrb.cs b/Projectiles/Typeless/ReaverOrb.cs new file mode 100644 index 0000000000..7405696c31 --- /dev/null +++ b/Projectiles/Typeless/ReaverOrb.cs @@ -0,0 +1,84 @@ +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ReaverOrb : ModProjectile + { + public int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Reaver Orb"); + } + + 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; + } + + public override void AI() + { + bool correctMinion = projectile.type == ModContent.ProjectileType(); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (!modPlayer.reaverExplore) + { + projectile.active = false; + return; + } + if (correctMinion) + { + if (player.dead) + { + modPlayer.rOrb = false; + } + if (modPlayer.rOrb) + { + projectile.timeLeft = 2; + } + } + dust--; + if (dust >= 0) + { + 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); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].scale *= 1.15f; + } + } + + Lighting.AddLight(projectile.Center, 0.5f, 2f, 0.5f); + + projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); + if (player.gravDir == -1f) + { + projectile.position.Y += 120f; + projectile.rotation = MathHelper.Pi; + } + else + { + projectile.rotation = 0f; + } + projectile.position.X = (int)projectile.position.X; + projectile.position.Y = (int)projectile.position.Y; + } + + public override bool CanDamage() => false; + } +} \ No newline at end of file diff --git a/Projectiles/Summon/ReaverOrb.png b/Projectiles/Typeless/ReaverOrb.png similarity index 100% rename from Projectiles/Summon/ReaverOrb.png rename to Projectiles/Typeless/ReaverOrb.png diff --git a/Projectiles/Typeless/ReaverSpore.cs b/Projectiles/Typeless/ReaverSpore.cs deleted file mode 100644 index fb2d03a80c..0000000000 --- a/Projectiles/Typeless/ReaverSpore.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ReaverSpore : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Spore"); - } - - public override void SetDefaults() - { - projectile.width = projectile.height = 16; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 3600; - projectile.tileCollide = false; - projectile.ignoreWater = true; - } - - public override void AI() - { - projectile.SporeSacAI(); - } - - public override void Kill(int timeLeft) - { - if (projectile.owner == Main.myPlayer) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 1f, 1f, 0.3f); - int gas = Projectile.NewProjectile(projectile.Center, velocity, ProjectileID.SporeGas + Main.rand.Next(3), projectile.damage, 0f, projectile.owner); - Main.projectile[gas].usesLocalNPCImmunity = true; - Main.projectile[gas].localNPCHitCooldown = 30; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture; - switch (projectile.ai[0]) - { - case 1f: texture = ModContent.GetTexture("CalamityMod/Projectiles/Typeless/ReaverSpore2"); - break; - 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); - return false; - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 11)); - } - - public override void OnHitPvp(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Poisoned, 60 * Main.rand.Next(5, 11)); - } - } -} diff --git a/Projectiles/Typeless/ReaverSpore.png b/Projectiles/Typeless/ReaverSpore.png deleted file mode 100644 index 02c53c1a78..0000000000 Binary files a/Projectiles/Typeless/ReaverSpore.png and /dev/null differ diff --git a/Projectiles/Typeless/ReaverSpore2.png b/Projectiles/Typeless/ReaverSpore2.png deleted file mode 100644 index 235e4f51cc..0000000000 Binary files a/Projectiles/Typeless/ReaverSpore2.png and /dev/null differ diff --git a/Projectiles/Typeless/ReaverThornBase.cs b/Projectiles/Typeless/ReaverThornBase.cs new file mode 100644 index 0000000000..390c161a9c --- /dev/null +++ b/Projectiles/Typeless/ReaverThornBase.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class ReaverThornBase : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Melee/ThornBase"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thorn"); + } + + 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; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + if (projectile.ai[0] == 0f) + { + projectile.alpha -= 50; + if (projectile.alpha > 0) + return; + projectile.alpha = 0; + projectile.ai[0] = 1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] += 1f; + projectile.position += projectile.velocity * 1f; + } + if (Main.myPlayer == projectile.owner) + { + 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; + } + } + else + { + 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, 14, 0f, 0f, 170, new Color(), 1.1f); + } + projectile.alpha += 3; + if (projectile.alpha < 255) + return; + projectile.Kill(); + } + } + } +} diff --git a/Projectiles/Typeless/ReaverThornTip.cs b/Projectiles/Typeless/ReaverThornTip.cs new file mode 100644 index 0000000000..44e1a51c56 --- /dev/null +++ b/Projectiles/Typeless/ReaverThornTip.cs @@ -0,0 +1,29 @@ +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Typeless +{ + public class ReaverThornTip : ModProjectile + { + public override string Texture => "CalamityMod/Projectiles/Melee/ThornTip"; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thorn"); + } + + 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; + aiType = ProjectileID.VilethornTip; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } + } +} diff --git a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs index dce1ce17b3..47da484d44 100644 --- a/Projectiles/Typeless/RelicOfConvergenceCrystal.cs +++ b/Projectiles/Typeless/RelicOfConvergenceCrystal.cs @@ -71,8 +71,8 @@ namespace CalamityMod.Projectiles.Typeless dust.fadeIn = Main.rand.NextFloat(3f, 4f); dust.noGravity = true; } - player.HealEffect(35, false); - player.statLife += 35; + player.HealEffect(70, false); + player.statLife += 70; if (player.statLife > player.statLifeMax2) { player.statLife = player.statLifeMax2; @@ -80,6 +80,7 @@ namespace CalamityMod.Projectiles.Typeless Main.PlaySound(SoundID.DD2_DarkMageHealImpact, projectile.Center); } } + public void UpdatePlayerVisuals(Player player) { projectile.Center = player.Center + Vector2.UnitX * 15f * player.direction; diff --git a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs index c6fab199e7..9f29a25cc5 100644 --- a/Projectiles/Typeless/RelicOfDeliveranceSpear.cs +++ b/Projectiles/Typeless/RelicOfDeliveranceSpear.cs @@ -94,12 +94,13 @@ namespace CalamityMod.Projectiles.Typeless if (projectile.ai[0] >= WaitTimeRequiredForCharge) { // Begin the lunge - if (Main.mouseLeft && !Main.blockMouse && !player.mouseInterface) + 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); if (chargeSpeed > MaxChargeSpeed) chargeSpeed = MaxChargeSpeed; - projectile.velocity = projectile.DirectionTo(Main.MouseWorld) * chargeSpeed; + projectile.velocity = projectile.SafeDirectionTo(Main.MouseWorld) * chargeSpeed; IdealVelocity = projectile.velocity; projectile.ai[1] = chargeSpeed; Main.PlaySound(SoundID.Item73, projectile.Center); @@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.Typeless { 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.DirectionFrom(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; @@ -146,7 +147,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.localAI[0] <= MaxCharges && projectile.localAI[1] <= 0f) { - IdealVelocity = projectile.DirectionTo(Main.MouseWorld) * projectile.ai[1]; + IdealVelocity = projectile.SafeDirectionTo(Main.MouseWorld) * projectile.ai[1]; projectile.localAI[0]++; projectile.localAI[1] = 40f; Main.PlaySound(SoundID.Item73, projectile.Center); @@ -209,23 +210,22 @@ namespace CalamityMod.Projectiles.Typeless // 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; + // 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) + { + player.velocity.Y = 0f; + DoDeathDust(projectile.oldVelocity); + + projectile.Kill(); + } + Lighting.AddLight(projectile.Center, Color.LightGoldenrodYellow.ToVector3()); } - - public override bool CanDamage() => projectile.velocity != Vector2.Zero; - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + public void DoDeathDust(Vector2 oldVelocity) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); - return false; - } - // Force the spear to have "priority" when drawing so that it draws over the player. - public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, - List drawCacheProjsBehindNPCs, - List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) => drawCacheProjsOverWiresUI.Add(index); + if (Main.dedServ) + return; - public override bool OnTileCollide(Vector2 oldVelocity) - { for (int i = 0; i < 60; i++) { Vector2 spawnOffset = (projectile.Size / 2f).RotatedBy(projectile.rotation); @@ -236,6 +236,24 @@ namespace CalamityMod.Projectiles.Typeless dust.fadeIn = 1.9f; } Main.PlaySound(SoundID.Item14, projectile.Center); + } + + + 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); + return false; + } + // Force the spear to have "priority" when drawing so that it draws over the player. + public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, + List drawCacheProjsBehindNPCs, + List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) => drawCacheProjsOverWiresUI.Add(index); + + public override bool OnTileCollide(Vector2 oldVelocity) + { + DoDeathDust(oldVelocity); return base.OnTileCollide(oldVelocity); } } diff --git a/Projectiles/Typeless/SabatonBoom.cs b/Projectiles/Typeless/SabatonBoom.cs index 22059f16f5..c82b125783 100644 --- a/Projectiles/Typeless/SabatonBoom.cs +++ b/Projectiles/Typeless/SabatonBoom.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Typeless { public class SabatonBoom : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.penetrate = -1; @@ -13,10 +15,20 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.tileCollide = false; projectile.timeLeft = 40; - projectile.usesLocalNPCImmunity = true; + projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = -1; } + public override void AI() + { + if (projectile.ai[0] == 1f) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 100); //Not really an expansion + projectile.timeLeft /= 2; + projectile.ai[0] = 0f; + } + } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Typeless/SabatonBoom.png b/Projectiles/Typeless/SabatonBoom.png deleted file mode 100644 index 73557dc730..0000000000 Binary files a/Projectiles/Typeless/SabatonBoom.png and /dev/null differ diff --git a/Projectiles/Typeless/SabatonSlam.cs b/Projectiles/Typeless/SabatonSlam.cs index 83fefd68d1..4b9f90d58a 100644 --- a/Projectiles/Typeless/SabatonSlam.cs +++ b/Projectiles/Typeless/SabatonSlam.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class SabatonSlam : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.width = 10; diff --git a/Projectiles/Typeless/SabatonSlam.png b/Projectiles/Typeless/SabatonSlam.png deleted file mode 100644 index dd0a1e7735..0000000000 Binary files a/Projectiles/Typeless/SabatonSlam.png and /dev/null differ diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index bbd9ad770e..770bc3af89 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -1,3 +1,4 @@ +using CalamityMod.DataStructures; using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; diff --git a/Projectiles/Typeless/SandExplosion.cs b/Projectiles/Typeless/SandExplosion.cs index 1a5af9741b..9a78d71c7c 100644 --- a/Projectiles/Typeless/SandExplosion.cs +++ b/Projectiles/Typeless/SandExplosion.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class SandExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Sand"); diff --git a/Projectiles/Typeless/SandExplosion.png b/Projectiles/Typeless/SandExplosion.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Typeless/SandExplosion.png and /dev/null differ diff --git a/Projectiles/Typeless/SepulcherSoul.cs b/Projectiles/Typeless/SepulcherSoul.cs new file mode 100644 index 0000000000..38e6ccace4 --- /dev/null +++ b/Projectiles/Typeless/SepulcherSoul.cs @@ -0,0 +1,42 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class SepulcherSoul : ModProjectile + { + public ref float Time => ref projectile.ai[0]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tormented Soul"); + 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; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + 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); + Time++; + } + } +} diff --git a/Projectiles/Typeless/SepulcherSoul.png b/Projectiles/Typeless/SepulcherSoul.png new file mode 100644 index 0000000000..a59212a6b7 Binary files /dev/null and b/Projectiles/Typeless/SepulcherSoul.png differ diff --git a/Projectiles/Typeless/SerpentsBiteHook.cs b/Projectiles/Typeless/SerpentsBiteHook.cs index 3565ffd5df..e4b3c0cc3f 100644 --- a/Projectiles/Typeless/SerpentsBiteHook.cs +++ b/Projectiles/Typeless/SerpentsBiteHook.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Projectiles.Typeless { public class SerpentsBiteHook : ModProjectile { + public const float PullSpeed = 12f; + public const float ReelbackSpeed = 14f; + public const float LaunchSpeed = 18f; + public const float GrappleRangInTiles = 28.125f; public override void SetStaticDefaults() { DisplayName.SetDefault("Serpent's Bite"); @@ -38,10 +42,7 @@ namespace CalamityMod.Projectiles.Typeless } // Amethyst Hook is 300, Static Hook is 600, 16f = 1 tile - public override float GrappleRange() - { - return 450f; //28.125 tiles - } + public override float GrappleRange() => GrappleRangInTiles * 16f; public override void NumGrappleHooks(Player player, ref int numHooks) { @@ -51,12 +52,12 @@ namespace CalamityMod.Projectiles.Typeless // default is 11, Lunar is 24 public override void GrappleRetreatSpeed(Player player, ref float speed) { - speed = 14f; + speed = ReelbackSpeed; } public override void GrapplePullSpeed(Player player, ref float speed) { - speed = 12; + speed = PullSpeed; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/ShadowflameExplosion.cs b/Projectiles/Typeless/ShadowflameExplosion.cs index 6eabe62f99..72e0e46b74 100644 --- a/Projectiles/Typeless/ShadowflameExplosion.cs +++ b/Projectiles/Typeless/ShadowflameExplosion.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class ShadowflameExplosion : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowflame Explosion"); diff --git a/Projectiles/Typeless/ShadowflameExplosion.png b/Projectiles/Typeless/ShadowflameExplosion.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Typeless/ShadowflameExplosion.png and /dev/null differ diff --git a/Projectiles/Typeless/ShadowflameExplosionBig.cs b/Projectiles/Typeless/ShadowflameExplosionBig.cs index 25f859886b..d59b33c22f 100644 --- a/Projectiles/Typeless/ShadowflameExplosionBig.cs +++ b/Projectiles/Typeless/ShadowflameExplosionBig.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class ShadowflameExplosionBig : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Shadowflame Explosion"); diff --git a/Projectiles/Typeless/ShadowflameExplosionBig.png b/Projectiles/Typeless/ShadowflameExplosionBig.png deleted file mode 100644 index 983260eb07..0000000000 Binary files a/Projectiles/Typeless/ShadowflameExplosionBig.png and /dev/null differ diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 185f408433..88de19c668 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { - CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); return false; } diff --git a/Projectiles/Typeless/SlurperBobber.cs b/Projectiles/Typeless/SlurperBobber.cs index 026126015c..af21fba268 100644 --- a/Projectiles/Typeless/SlurperBobber.cs +++ b/Projectiles/Typeless/SlurperBobber.cs @@ -6,27 +6,25 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class SlurperBobber : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Slurper Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { 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); - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(227, 79, 79, 100)); - return false; + 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)); + } + } } diff --git a/Projectiles/Typeless/StandingFire.cs b/Projectiles/Typeless/StandingFire.cs index 6514f32fbb..506625c457 100644 --- a/Projectiles/Typeless/StandingFire.cs +++ b/Projectiles/Typeless/StandingFire.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class StandingFire : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); @@ -87,16 +89,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Typeless/StandingFire.png b/Projectiles/Typeless/StandingFire.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Typeless/StandingFire.png and /dev/null differ diff --git a/Projectiles/Typeless/StarStruckWaterBottle.cs b/Projectiles/Typeless/StarStruckWaterBottle.cs index 2f45c6cbb8..a30e7286a9 100644 --- a/Projectiles/Typeless/StarStruckWaterBottle.cs +++ b/Projectiles/Typeless/StarStruckWaterBottle.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class StarStruckWaterBottle : ModProjectile { + public override string Texture => "CalamityMod/Items/Weapons/Typeless/StarStruckWater"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bottle"); @@ -36,7 +38,7 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.owner == Main.myPlayer) { - Main.PlaySound(SoundID.Shatter, (int) projectile.position.X, (int) projectile.position.Y, 1, 1f, 0.0f); + Main.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); for (int index1 = 0; index1 < 30; ++index1) @@ -47,7 +49,7 @@ namespace CalamityMod.Projectiles.Typeless dust.velocity.X *= 1.5f; dust.velocity *= 3f; } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 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/StarStruckWaterBottle.png b/Projectiles/Typeless/StarStruckWaterBottle.png deleted file mode 100644 index 31498f0b6e..0000000000 Binary files a/Projectiles/Typeless/StarStruckWaterBottle.png and /dev/null differ diff --git a/Projectiles/Typeless/StickyFeatherAero.cs b/Projectiles/Typeless/StickyFeatherAero.cs index 4c526b30c3..0775c6f2f4 100644 --- a/Projectiles/Typeless/StickyFeatherAero.cs +++ b/Projectiles/Typeless/StickyFeatherAero.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class StickyFeatherAero : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Magic/StickyFeather"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Feather"); @@ -31,39 +33,7 @@ namespace CalamityMod.Projectiles.Typeless { projectile.tileCollide = true; } - float num472 = projectile.Center.X; - float num473 = projectile.Center.Y; - float num474 = 300f; - 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)) - { - 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); - if (num478 < num474) - { - num474 = num478; - num472 = num476; - num473 = num477; - flag17 = true; - } - } - } - if (flag17) - { - float num483 = 12f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = num472 - vector35.X; - float num485 = num473 - vector35.Y; - float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485)); - num486 = num483 / num486; - num484 *= num486; - num485 *= num486; - projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; - projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 150f, 12f, 20f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Typeless/StickyFeatherAero.png b/Projectiles/Typeless/StickyFeatherAero.png deleted file mode 100644 index 45b6489022..0000000000 Binary files a/Projectiles/Typeless/StickyFeatherAero.png and /dev/null differ diff --git a/Projectiles/Typeless/StormBolt.cs b/Projectiles/Typeless/StormBolt.cs index 856f61f10e..acb469cbfe 100644 --- a/Projectiles/Typeless/StormBolt.cs +++ b/Projectiles/Typeless/StormBolt.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Typeless { public class StormBolt : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Bolt"); diff --git a/Projectiles/Typeless/StormBolt.png b/Projectiles/Typeless/StormBolt.png deleted file mode 100644 index ead80128fa..0000000000 Binary files a/Projectiles/Typeless/StormBolt.png and /dev/null differ diff --git a/Projectiles/Typeless/SuicideBomberDemon.cs b/Projectiles/Typeless/SuicideBomberDemon.cs new file mode 100644 index 0000000000..85061dca7d --- /dev/null +++ b/Projectiles/Typeless/SuicideBomberDemon.cs @@ -0,0 +1,136 @@ +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class SuicideBomberDemon : ModProjectile + { + public bool HasDamagedSomething + { + get => projectile.ai[0] == 1f; + set => projectile.ai[0] = value.ToInt(); + } + public Player Owner => Main.player[projectile.owner]; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Demon"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 32; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.Opacity = 0f; + projectile.timeLeft = 300; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.friendly); + writer.Write(projectile.hostile); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.friendly = reader.ReadBoolean(); + projectile.hostile = reader.ReadBoolean(); + } + + public override void AI() + { + if (projectile.owner == 255) + projectile.owner = Player.FindClosest(projectile.Center, 1, 1); + projectile.Opacity = MathHelper.Clamp(projectile.Opacity + 0.025f, 0f, 1f); + + projectile.frame = projectile.frameCounter++ / 5 % Main.projFrames[projectile.type]; + + // Anti-clumping behavior. + float pushForce = 0.08f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + 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) + 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); + if (sameProjType && taxicabDist < 60f) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= pushForce; + else + projectile.velocity.X += pushForce; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= pushForce; + else + projectile.velocity.Y += pushForce; + } + } + + if (projectile.hostile) + { + projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(Owner.Center) * 16f, 1.4f); + projectile.spriteDirection = (Owner.Center.X > projectile.Center.X).ToDirectionInt(); + + if (HasDamagedSomething && projectile.WithinRange(Owner.Center, Owner.Size.Length() * 0.25f)) + projectile.Kill(); + } + else if (projectile.friendly) + { + NPC potentialTarget = projectile.Center.ClosestNPCAt(1360f); + if (potentialTarget is null) + projectile.velocity = Vector2.Lerp(projectile.velocity, -Vector2.UnitY * 10f, 0.06f); + else + { + projectile.spriteDirection = (potentialTarget.Center.X > projectile.Center.X).ToDirectionInt(); + projectile.velocity = projectile.velocity.MoveTowards(projectile.SafeDirectionTo(potentialTarget.Center) * 18.5f, 3f); + projectile.friendly = true; + } + + if (HasDamagedSomething && projectile.WithinRange(potentialTarget.Center, potentialTarget.Size.Length() * 0.25f)) + projectile.Kill(); + } + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 40; i++) + { + 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; + explosion.fadeIn = 0.45f; + explosion.noGravity = true; + } + } + + 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; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + HasDamagedSomething = true; + projectile.netUpdate = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + HasDamagedSomething = true; + projectile.netUpdate = true; + } + } +} diff --git a/Projectiles/Typeless/SuicideBomberDemon.png b/Projectiles/Typeless/SuicideBomberDemon.png new file mode 100644 index 0000000000..bd3a5924ca Binary files /dev/null and b/Projectiles/Typeless/SuicideBomberDemon.png differ diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs index cd5464b843..4f3476719e 100644 --- a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs +++ b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class SulphuricAcidBubbleFriendly : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Enemy/SulphuricAcidBubble"; + private bool fromArmour = false; public override void SetStaticDefaults() { diff --git a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.png b/Projectiles/Typeless/SulphuricAcidBubbleFriendly.png deleted file mode 100644 index 3bb08e0246..0000000000 Binary files a/Projectiles/Typeless/SulphuricAcidBubbleFriendly.png and /dev/null differ diff --git a/Projectiles/Typeless/TarraEnergy.cs b/Projectiles/Typeless/TarraEnergy.cs index ce127d9b2c..19236f4bfc 100644 --- a/Projectiles/Typeless/TarraEnergy.cs +++ b/Projectiles/Typeless/TarraEnergy.cs @@ -9,60 +9,57 @@ namespace CalamityMod.Projectiles.Typeless { public class TarraEnergy : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { - DisplayName.SetDefault("Round"); - ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; - ProjectileID.Sets.TrailingMode[projectile.type] = 0; + DisplayName.SetDefault("Tarra Energy"); } public override void SetDefaults() { - projectile.width = 8; - projectile.height = 8; - projectile.aiStyle = 1; + projectile.width = 4; + projectile.height = 4; projectile.friendly = true; projectile.penetrate = 1; - projectile.alpha = 255; - projectile.timeLeft = 120; + projectile.timeLeft = 200; projectile.extraUpdates = 1; - aiType = ProjectileID.Bullet; } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); - for (int k = 0; k < projectile.oldPos.Length; k++) - { - Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); - Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); - spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); - } - return true; - } + public override bool? CanHitNPC(NPC target) => projectile.timeLeft < 170 && target.CanBeChasedBy(projectile); - public override bool PreAI() - { - 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); - 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].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity = dspeed; - Main.dust[num137].noGravity = true; - Main.dust[num137].noLight = true; - } - 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; - } - return false; - } + // 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 cap = 2; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void AI() + { + 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); + 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].position.X = x2; + Main.dust[num137].position.Y = y2; + Main.dust[num137].velocity = dspeed; + Main.dust[num137].noGravity = true; + Main.dust[num137].noLight = true; + } + + if (projectile.timeLeft < 170) + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 600f, 9f, 20f); + } } } diff --git a/Projectiles/Typeless/TarraEnergy.png b/Projectiles/Typeless/TarraEnergy.png deleted file mode 100644 index 0056fc1e24..0000000000 Binary files a/Projectiles/Typeless/TarraEnergy.png and /dev/null differ diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 61b057707d..88df1972ad 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -71,8 +71,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Electrified, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Electrified, 180); + target.AddBuff(ModContent.BuffType(), 60); if (target.knockBackResist <= 0f) return; @@ -92,8 +92,8 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitPvp(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Electrified, 300); - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.Electrified, 180); + target.AddBuff(ModContent.BuffType(), 60); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/TrueBattleSpawn.cs b/Projectiles/Typeless/TrueBattleSpawn.cs index 06e4a6a021..bf690db289 100644 --- a/Projectiles/Typeless/TrueBattleSpawn.cs +++ b/Projectiles/Typeless/TrueBattleSpawn.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class TrueBattleSpawn : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Spawn"); diff --git a/Projectiles/Typeless/TrueBattleSpawn.png b/Projectiles/Typeless/TrueBattleSpawn.png deleted file mode 100644 index a3192f9461..0000000000 Binary files a/Projectiles/Typeless/TrueBattleSpawn.png and /dev/null differ diff --git a/Projectiles/Typeless/UnstableSpark.cs b/Projectiles/Typeless/UnstableSpark.cs index 96ccb95791..6d9cb7bbc9 100644 --- a/Projectiles/Typeless/UnstableSpark.cs +++ b/Projectiles/Typeless/UnstableSpark.cs @@ -5,6 +5,8 @@ namespace CalamityMod.Projectiles.Typeless { public class UnstableSpark : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Unstable Spark"); @@ -16,12 +18,26 @@ namespace CalamityMod.Projectiles.Typeless projectile.height = 12; projectile.friendly = true; projectile.penetrate = -1; - projectile.timeLeft = 120; + projectile.timeLeft = 90; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; } - public override void AI() + // 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 cap = 5; + int oldDamage = damage; + if (projectileCount > cap) + { + damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05)); + if (damage < 1) + damage = 1; + } + } + + public override void AI() { if (projectile.velocity.X != projectile.velocity.X) { @@ -42,7 +58,7 @@ namespace CalamityMod.Projectiles.Typeless 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) + if (projectile.velocity.X > -0.01 && projectile.velocity.X < 0.01) { projectile.velocity.X = 0f; projectile.netUpdate = true; @@ -55,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless Dust dust = Main.dust[num199]; dust.position.X -= 2f; dust.position.Y += 2f; - dust.scale += (float)Main.rand.Next(50) * 0.01f; + dust.scale += Main.rand.Next(50) * 0.01f; dust.noGravity = true; dust.velocity.Y -= 2f; if (Main.rand.NextBool(2)) @@ -64,11 +80,11 @@ namespace CalamityMod.Projectiles.Typeless Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; - dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + dust2.scale += 0.3f + Main.rand.Next(50) * 0.01f; dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + if (projectile.velocity.Y < 0.25 && projectile.velocity.Y > 0.15) { projectile.velocity.X = projectile.velocity.X * 0.8f; } @@ -79,13 +95,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Typeless/UnstableSpark.png b/Projectiles/Typeless/UnstableSpark.png deleted file mode 100644 index 28f94674d6..0000000000 Binary files a/Projectiles/Typeless/UnstableSpark.png and /dev/null differ diff --git a/Projectiles/Typeless/VanquisherArrowSplit.cs b/Projectiles/Typeless/VanquisherArrowSplit.cs index 5f7ab1e5fe..9f82647636 100644 --- a/Projectiles/Typeless/VanquisherArrowSplit.cs +++ b/Projectiles/Typeless/VanquisherArrowSplit.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class VanquisherArrowSplit : ModProjectile { + public override string Texture => "CalamityMod/Items/Ammo/VanquisherArrow"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Arrow"); @@ -26,8 +28,8 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 600f, 20f, 20f); + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + CalamityGlobalProjectile.HomeInOnNPC(projectile, !projectile.tileCollide, 200f, 12f, 20f); } public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless 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/Projectiles/Typeless/VanquisherArrowSplitGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Ammo/VanquisherArrowGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); } } diff --git a/Projectiles/Typeless/VanquisherArrowSplit.png b/Projectiles/Typeless/VanquisherArrowSplit.png deleted file mode 100644 index 5ff3f9498b..0000000000 Binary files a/Projectiles/Typeless/VanquisherArrowSplit.png and /dev/null differ diff --git a/Projectiles/Typeless/VanquisherArrowSplitGlow.png b/Projectiles/Typeless/VanquisherArrowSplitGlow.png deleted file mode 100644 index 625f85ab73..0000000000 Binary files a/Projectiles/Typeless/VanquisherArrowSplitGlow.png and /dev/null differ diff --git a/Projectiles/Typeless/WaterConvertor.cs b/Projectiles/Typeless/WaterConvertor.cs index 63ec125038..0072558c70 100644 --- a/Projectiles/Typeless/WaterConvertor.cs +++ b/Projectiles/Typeless/WaterConvertor.cs @@ -6,6 +6,8 @@ namespace CalamityMod.Projectiles.Typeless { public class WaterConvertor : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { projectile.penetrate = -1; @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Typeless public void ConvertShit(Projectile projectile) { - if (projectile.owner == Main.myPlayer/* && Main.netMode != NetmodeID.MultiplayerClient*/) + if (Main.netMode != NetmodeID.MultiplayerClient) { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); @@ -39,23 +41,24 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.ai[0] == 0f) { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); + AstralBiome.ConvertFromAstral(i, j, ConvertType.Pure); } if (projectile.ai[0] == 1f) { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); + AstralBiome.ConvertFromAstral(i, j, ConvertType.Corrupt); } if (projectile.ai[0] == 2f) { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); + AstralBiome.ConvertFromAstral(i, j, ConvertType.Crimson); } if (projectile.ai[0] == 3f) { - WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); + AstralBiome.ConvertFromAstral(i, j, ConvertType.Hallow); } if (projectile.ai[0] == 4f) { - WorldGenerationMethods.ConvertToAstral(i, j); + AstralBiome.ConvertToAstral(i, j); + NetMessage.SendTileRange(-1, i, j, 1, 1); } } } diff --git a/Projectiles/Typeless/WaterConvertor.png b/Projectiles/Typeless/WaterConvertor.png deleted file mode 100644 index e975d88423..0000000000 Binary files a/Projectiles/Typeless/WaterConvertor.png and /dev/null differ diff --git a/Projectiles/Typeless/WulfrumBobber.cs b/Projectiles/Typeless/WulfrumBobber.cs index f178c2fbf2..b08edf5763 100644 --- a/Projectiles/Typeless/WulfrumBobber.cs +++ b/Projectiles/Typeless/WulfrumBobber.cs @@ -6,26 +6,24 @@ using CalamityMod.Items.Fishing.FishingRods; namespace CalamityMod.Projectiles.Typeless { public class WulfrumBobber : ModProjectile - { + { public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Bobber"); } - public override void SetDefaults() - { - //projectile.CloneDefaults(360); //Wooden Bobber + public override void SetDefaults() + { projectile.width = 14; projectile.height = 14; projectile.aiStyle = 61; - projectile.bobber = true; - projectile.penetrate = -1; - } - - public override bool PreDrawExtras(SpriteBatch spriteBatch) - { - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(200, 200, 200, 100), 38, 28f); - return false; + 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); + } + } } diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index 3a1db33347..f4ee638296 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -8,6 +8,8 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocBlast : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Blast"); diff --git a/Projectiles/Typeless/XerocBlast.png b/Projectiles/Typeless/XerocBlast.png deleted file mode 100644 index 6ea4de3903..0000000000 Binary files a/Projectiles/Typeless/XerocBlast.png and /dev/null differ diff --git a/Projectiles/Typeless/XerocBubble.cs b/Projectiles/Typeless/XerocBubble.cs index 986923299c..064121072f 100644 --- a/Projectiles/Typeless/XerocBubble.cs +++ b/Projectiles/Typeless/XerocBubble.cs @@ -26,16 +26,13 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 1; num468++) - { - 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, false, 400f, 8f, 20f); + 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); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 8f, 20f); } } } diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index f3d8d7e5f1..4cb5481bcc 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -82,13 +82,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (projectile.penetrate == 0) - { - projectile.Kill(); - } - return false; - } - } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + } } diff --git a/Projectiles/Typeless/XerocOrb.cs b/Projectiles/Typeless/XerocOrb.cs index 00a76b1ba2..29c583eede 100644 --- a/Projectiles/Typeless/XerocOrb.cs +++ b/Projectiles/Typeless/XerocOrb.cs @@ -7,6 +7,8 @@ namespace CalamityMod.Projectiles.Typeless { public class XerocOrb : ModProjectile { + public override string Texture => "CalamityMod/Projectiles/Healing/XerocHealOrb"; + public override void SetStaticDefaults() { DisplayName.SetDefault("Orb"); @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Typeless 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, false, 400f, 7f, 20f); + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 7f, 20f); } } } diff --git a/Projectiles/Typeless/XerocOrb.png b/Projectiles/Typeless/XerocOrb.png deleted file mode 100644 index c1fdbf1381..0000000000 Binary files a/Projectiles/Typeless/XerocOrb.png and /dev/null differ diff --git a/Projectiles/Typeless/XerocStar.cs b/Projectiles/Typeless/XerocStar.cs index 511f7f198e..081c24808b 100644 --- a/Projectiles/Typeless/XerocStar.cs +++ b/Projectiles/Typeless/XerocStar.cs @@ -21,23 +21,21 @@ namespace CalamityMod.Projectiles.Typeless projectile.friendly = true; projectile.penetrate = 1; projectile.tileCollide = false; - projectile.timeLeft = 300; + projectile.ignoreWater = true; + projectile.timeLeft = 300; } public override void AI() { projectile.rotation += 0.25f; projectile.localAI[0] += 1f; - if (projectile.localAI[0] > 4f) - { - for (int num468 = 0; num468 < 1; num468++) - { - 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, false, 400f, 10f, 20f); + 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); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + } + CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 10f, 20f); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs index 599ff27179..346fbfc9d2 100644 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -1,5 +1,10 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; using Microsoft.Xna.Framework; using System; using Terraria; @@ -11,7 +16,25 @@ namespace CalamityMod.Projectiles.Typeless public class YanmeisKnifeSlash : ModProjectile { // This is a rather weird thing, but it's what the patron asked for. - public static readonly Func CanRecieveCoolEffectsFrom = (npc) => npc.boss || CalamityMod.bossMinionList.Contains(npc.type); + public static readonly Func CanRecieveCoolEffectsFrom = (npc) => + { + bool validBoss = npc.boss && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType() + && npc.type != ModContent.NPCType(); + if (validBoss) + return true; + bool bossMinion = CalamityLists.bossMinionList.Contains(npc.type); + if (bossMinion) + return true; + bool miniboss = CalamityLists.minibossList.Contains(npc.type) || AcidRainEvent.AllMinibosses.Contains(npc.type); + return miniboss; + }; + public override void SetStaticDefaults() { DisplayName.SetDefault("Yanmei's Knife"); @@ -28,7 +51,9 @@ namespace CalamityMod.Projectiles.Typeless projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 20; - projectile.Calamity().trueMelee = true; + + // Not considered true melee to prevent Titan Scale from triggering. + // projectile.Calamity().trueMelee = true; } public override void AI() diff --git a/Schematics/AstralBeacon.csch b/Schematics/AstralBeacon.csch new file mode 100644 index 0000000000..aa59db9925 Binary files /dev/null and b/Schematics/AstralBeacon.csch differ diff --git a/Schematics/AutoGeneratedContent/AstralBeaconSchematic.cs b/Schematics/AutoGeneratedContent/AstralBeaconSchematic.cs deleted file mode 100644 index 0dc22ea208..0000000000 --- a/Schematics/AutoGeneratedContent/AstralBeaconSchematic.cs +++ /dev/null @@ -1,243 +0,0 @@ -using CalamityMod.Walls; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.Ores; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class AstralBeaconSchematic - { - [GeneratedCode("ScreenCaptureToSchematic", "1.0.1")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 90); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 3, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(144, 54); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(18, 18); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(144, 36); - var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 18); - var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(18, 18); - var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 4, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(18, 36); - var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(18, 0); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 28, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 432, 0); - var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 36); - var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(126, 36); - var tile26 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(180, 36); - var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 54); - var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 3, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 360, 108); - var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 153, 2, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 324, 72); - var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(144, 54); - var tile32 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 140, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 432, 72); - var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 36); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 54); - var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(18, 0); - var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(126, 36); - var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(36, 18); - var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 36); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(18, 36); - var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 1056); - var tile44 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 36); - var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224); - var tile47 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 1056); - var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(36, 36); - var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224); - var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 16416).UseFrame(0, 36); - var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(54, 0); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 18); - var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile55 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(180, 54); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 54); - var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(144, 36); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 36); - var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(36, 0); - var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(126, 54); - var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32); - var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 18); - var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(126, 54); - var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile72 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(36, 36); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(36, 0); - var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile76 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile77 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 0); - var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 18); - var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 36); - var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 54); - var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 3, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0); - var tile85 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 18); - var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 36); - var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 54); - var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 18); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 36); - var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 54); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 0); - var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224); - var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(36, 36); - var tile95 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(54, 0); - var tile96 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 18); - var tile97 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(180, 54); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 12320).UseFrame(36, 36); - var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 1056).UseFrame(36, 0); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 92, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 432, 36); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 3, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 396, 108); - var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 3, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 108); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(180, 36); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 3, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 3, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 360, 108); - var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36); - var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(36, 0); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(69, 89, 217), tile2 }, - { new Color(42, 157, 230), tile3 }, - { new Color(26, 59, 82), tile4 }, - { new Color(37, 51, 189), tile5 }, - { new Color(201, 62, 244), tile6 }, - { new Color(75, 7, 228), tile7 }, - { new Color(88, 216, 67), tile8 }, - { new Color(239, 83, 114), tile9 }, - { new Color(224, 106, 75), tile10 }, - { new Color(203, 232, 84), tile11 }, - { new Color(158, 21, 124), tile12 }, - { new Color(25, 39, 133), tile13 }, - { new Color(113, 168, 156), tile14 }, - { new Color(228, 222, 227), tile15 }, - { new Color(184, 94, 97), tile16 }, - { new Color(114, 102, 1), tile17 }, - { new Color(118, 115, 249), tile18 }, - { new Color(32, 85, 59), tile19 }, - { new Color(61, 86, 5), tile20 }, - { new Color(102, 74, 50), tile21 }, - { new Color(154, 78, 82), tile22 }, - { new Color(253, 134, 30), tile23 }, - { new Color(64, 175, 22), tile24 }, - { new Color(111, 218, 94), tile25 }, - { new Color(71, 115, 249), tile26 }, - { new Color(95, 54, 244), tile27 }, - { new Color(17, 109, 4), tile28 }, - { new Color(73, 85, 117), tile29 }, - { new Color(90, 126, 192), tile30 }, - { new Color(65, 220, 209), tile31 }, - { new Color(127, 10, 93), tile32 }, - { new Color(105, 74, 143), tile33 }, - { new Color(145, 187, 216), tile34 }, - { new Color(66, 50, 183), tile35 }, - { new Color(234, 7, 153), tile36 }, - { new Color(155, 217, 225), tile37 }, - { new Color(66, 221, 32), tile38 }, - { new Color(16, 85, 221), tile39 }, - { new Color(46, 81, 249), tile40 }, - { new Color(221, 162, 8), tile41 }, - { new Color(94, 254, 210), tile42 }, - { new Color(69, 239, 207), tile43 }, - { new Color(0, 221, 40), tile44 }, - { new Color(105, 206, 122), tile45 }, - { new Color(28, 206, 59), tile46 }, - { new Color(76, 94, 78), tile47 }, - { new Color(220, 191, 165), tile48 }, - { new Color(222, 255, 254), tile49 }, - { new Color(176, 110, 181), tile50 }, - { new Color(128, 59, 249), tile51 }, - { new Color(150, 179, 24), tile52 }, - { new Color(207, 228, 51), tile53 }, - { new Color(228, 165, 23), tile54 }, - { new Color(201, 154, 251), tile55 }, - { new Color(184, 216, 14), tile56 }, - { new Color(165, 243, 134), tile57 }, - { new Color(161, 226, 242), tile58 }, - { new Color(170, 0, 226), tile59 }, - { new Color(99, 127, 255), tile60 }, - { new Color(211, 148, 128), tile61 }, - { new Color(25, 128, 162), tile62 }, - { new Color(47, 210, 27), tile63 }, - { new Color(98, 77, 233), tile64 }, - { new Color(8, 104, 185), tile65 }, - { new Color(55, 18, 37), tile66 }, - { new Color(169, 37, 38), tile67 }, - { new Color(240, 11, 122), tile68 }, - { new Color(47, 223, 89), tile69 }, - { new Color(6, 236, 179), tile70 }, - { new Color(53, 108, 100), tile71 }, - { new Color(52, 16, 16), tile72 }, - { new Color(150, 176, 26), tile73 }, - { new Color(89, 137, 6), tile74 }, - { new Color(243, 67, 166), tile75 }, - { new Color(156, 153, 121), tile76 }, - { new Color(57, 115, 238), tile77 }, - { new Color(189, 185, 90), tile78 }, - { new Color(216, 227, 137), tile79 }, - { new Color(5, 234, 160), tile80 }, - { new Color(73, 41, 230), tile81 }, - { new Color(103, 44, 224), tile82 }, - { new Color(132, 212, 88), tile83 }, - { new Color(168, 160, 98), tile84 }, - { new Color(11, 80, 156), tile85 }, - { new Color(32, 252, 200), tile86 }, - { new Color(212, 146, 70), tile87 }, - { new Color(223, 204, 120), tile88 }, - { new Color(196, 120, 179), tile89 }, - { new Color(10, 91, 44), tile90 }, - { new Color(135, 144, 197), tile91 }, - { new Color(121, 16, 95), tile92 }, - { new Color(31, 139, 23), tile93 }, - { new Color(198, 24, 196), tile94 }, - { new Color(33, 145, 211), tile95 }, - { new Color(139, 177, 105), tile96 }, - { new Color(190, 183, 230), tile97 }, - { new Color(193, 49, 88), tile98 }, - { new Color(90, 105, 92), tile99 }, - { new Color(109, 162, 179), tile100 }, - { new Color(45, 122, 120), tile101 }, - { new Color(43, 33, 15), tile102 }, - { new Color(156, 146, 64), tile103 }, - { new Color(60, 0, 112), tile104 }, - { new Color(176, 13, 122), tile105 }, - { new Color(129, 189, 59), tile106 }, - { new Color(165, 57, 198), tile107 }, - { new Color(74, 76, 164), tile108 }, - { new Color(69, 198, 94), tile109 }, - { new Color(109, 30, 166), tile110 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/AstralBeaconSchematic.png b/Schematics/AutoGeneratedContent/AstralBeaconSchematic.png deleted file mode 100644 index 13007fa3fb..0000000000 Binary files a/Schematics/AutoGeneratedContent/AstralBeaconSchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs deleted file mode 100644 index def71131a6..0000000000 --- a/Schematics/AutoGeneratedContent/HellLaboratorySchematic.cs +++ /dev/null @@ -1,2530 +0,0 @@ -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Walls.DraedonStructures; -using CalamityMod.Tiles.Plates; -using CalamityMod.Walls; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class HellLaboratorySchematic - { - // This is horrible. I am sorry. - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 0); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 0); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile26 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); - var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile32 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 0, 0, 32).UseFrame(108, 0); - var tile33 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile34 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile35 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile36 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 0, 0, 32).UseFrame(108, 54); - var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(18, 216); - var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)WallID.Glass, 72, 0); - var tile45 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 108, 36); - var tile46 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 216, 72); - var tile47 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 72, 36); - var tile48 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 252, 72); - var tile49 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 36, 36); - var tile50 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 288, 72); - var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(72, 54).UseWall((ushort)WallID.Glass, 108, 72); - var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile55 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); - var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile60 = new TileDefinitionStructure(TileID.SapphireGemspark).UseHeaders(0, 41, 3, 32).UseFrame(198, 54).UseWall((ushort)WallID.SapphireGemspark, 324, 108); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile62 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)WallID.Glass, 108, 0); - var tile63 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 396, 36); - var tile64 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 252, 36); - var tile65 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 396, 72); - var tile66 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 288, 36); - var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(108, 72).UseWall((ushort)WallID.Glass, 288, 36); - var tile68 = new TileDefinitionStructure(TileID.AmberGemspark).UseHeaders(0, 136, 3, 32).UseFrame(162, 54).UseWall((ushort)WallID.AmberGemspark, 288, 108); - var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 16416).UseFrame(72, 72); - var tile72 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(162, 36); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile76 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 10, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 360, 0); - var tile78 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 74, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 360, 36); - var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 0).UseWall((ushort)WallID.Glass, 72, 72); - var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 18); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile85 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(54, 0).UseWall((ushort)WallID.Glass, 108, 72); - var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 54); - var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile94 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 396, 0); - var tile95 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 216, 36); - var tile96 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(54, 0).UseWall((ushort)WallID.Glass, 36, 72); - var tile97 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 36); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 72); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 73, 1, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 324, 36); - var tile103 = new TileDefinitionStructure(TileID.SapphireGemspark).UseHeaders(0, 25, 3, 32).UseFrame(180, 54).UseWall((ushort)WallID.SapphireGemspark, 324, 108); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile105 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 138, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)WallID.Glass, 360, 72); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(108, 72).UseWall((ushort)WallID.Glass, 360, 36); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 9, 0, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 324, 0); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 54); - var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 72); - var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile114 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 216); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile120 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)WallID.Glass, 36, 0); - var tile121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 54).UseWall((ushort)WallID.Glass, 36, 72); - var tile122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 198); - var tile123 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile124 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 54); - var tile127 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile128 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile130 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile136 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile137 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); - var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile142 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile147 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile148 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile149 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile150 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 4128).UseFrame(468, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile152 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile153 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile154 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile155 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile159 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile160 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile161 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 54); - var tile162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 72); - var tile163 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile165 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile166 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile167 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile168 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile173 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile174 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile175 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile177 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile178 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(252, 72).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 72); - var tile183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 54); - var tile184 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile186 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile189 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile193 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile194 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile195 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile196 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile197 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile198 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile199 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile200 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 72); - var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile207 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile209 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile211 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile212 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile217 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile219 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile221 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile222 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 105, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 324, 36); - var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 0); - var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile229 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile231 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile232 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile234 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile237 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile240 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile247 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile249 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile251 = new TileDefinitionStructure(TileID.Hellforge).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile252 = new TileDefinitionStructure(TileID.Hellforge).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile255 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(126, 144).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 3, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); - var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile268 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile270 = new TileDefinitionStructure(TileID.Hellforge).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile271 = new TileDefinitionStructure(TileID.Hellforge).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 8224).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile276 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile277 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile281 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile282 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(54, 216).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile284 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile286 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 2, 0).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile288 = new TileDefinitionStructure(TileID.Hellforge).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile289 = new TileDefinitionStructure(TileID.Hellforge).UseHeaders(0, 136, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile291 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile294 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile295 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile296 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile297 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile298 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile299 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile300 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile301 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile302 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile305 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile308 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile309 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile311 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile312 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile315 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile316 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile317 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile318 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 36); - var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile323 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 98, 1, 10336).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile326 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile328 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile330 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile333 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile334 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile335 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile336 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 66, 1, 3168).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile337 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 22, 2, 2144).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 72).MakeActuated(); - var tile338 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile342 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile343 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 1056).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile348 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 155, 2, 2144).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 72).MakeActuated(); - var tile349 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 163, 1, 2144).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile350 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile352 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile353 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile358 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile359 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 72); - var tile360 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile361 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 154, 2, 3168).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 360, 72).MakeActuated(); - var tile362 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 131, 1, 2144).UseFrame(108, 18).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile363 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 17, 1, 2144).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile364 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile365 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 74, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile366 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile367 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile368 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile369 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile370 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile371 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 8224).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile372 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 18); - var tile373 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 16416).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile375 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile376 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile377 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 163, 1, 6240).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile378 = new TileDefinitionStructure(TileID.Hellstone).UseHeaders(0, 168, 2, 2144).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 288, 72).MakeActuated(); - var tile379 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile380 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile381 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 136, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile382 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile383 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile386 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 16, 0, 32).UseFrame(162, 18); - var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18).UseWall((ushort)WallID.Glass, 0, 0); - var tile388 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); - var tile389 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile390 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile391 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile392 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile393 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 36); - var tile394 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile397 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile399 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile400 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 396, 0); - var tile401 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile402 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 36); - var tile403 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile404 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile405 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile406 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile407 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile408 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile409 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile410 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile411 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 108, 36); - var tile412 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile413 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile414 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 54); - var tile415 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 54); - var tile416 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile417 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile418 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile419 = new TileDefinitionStructure(TileID.MetalBars).UseHeaders(0, 6, 2, 32).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile420 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile421 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile422 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile423 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile424 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile425 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile426 = new TileDefinitionStructure(TileID.MetalBars).UseHeaders(0, 1, 1, 32).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile427 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile428 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile429 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile430 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile431 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile432 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile433 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile434 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile435 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile436 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile437 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile438 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 396, 72); - var tile439 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile440 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 36); - var tile441 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile442 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile443 = new TileDefinitionStructure(TileID.LavaDrip).UseHeaders(32, 66, 1, 32).UseLiquid(LiquidState.Lava, 24).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile444 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile445 = new TileDefinitionStructure(TileID.MetalBars).UseHeaders(0, 131, 1, 32).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile446 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile447 = new TileDefinitionStructure(TileID.MetalBars).UseHeaders(0, 66, 1, 32).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile448 = new TileDefinitionStructure(TileID.MetalBars).UseHeaders(0, 4, 0, 32).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile449 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile450 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile451 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile452 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile453 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile454 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile455 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 36); - var tile456 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile457 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile458 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile459 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile460 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 72, 36); - var tile461 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile462 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile463 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile464 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile465 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile466 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 71, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile467 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile468 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile469 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile470 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile471 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile472 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile473 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile474 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile475 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile476 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile477 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile478 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile479 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile480 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 36, 36); - var tile481 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile482 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile483 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile484 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile487 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile488 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile489 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile490 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 128, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile491 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile492 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile493 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile494 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile495 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)WallID.Glass, 396, 36); - var tile496 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile497 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 54); - var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile500 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile501 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile502 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile503 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0); - var tile504 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile505 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile506 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile507 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile508 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile509 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile511 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile512 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile516 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile517 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile518 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile519 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile520 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile521 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile522 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile523 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 54); - var tile524 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile525 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 18); - var tile526 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile527 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile528 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile529 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile530 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile531 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 0); - var tile532 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile533 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 3, 32).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile534 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile535 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile536 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile537 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile538 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile539 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 96).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile540 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 36); - var tile541 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile542 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile543 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile544 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile545 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile546 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile547 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile548 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile549 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile550 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile551 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile552 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 0); - var tile553 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile554 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile555 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile556 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile557 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(16, 64).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile558 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(16, 80).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile559 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(16, 96).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile560 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile561 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile562 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile563 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 37, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile564 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile565 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile566 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile567 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile568 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile569 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile570 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile571 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 67, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile572 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 139, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile573 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile574 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile575 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile576 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile577 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile578 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile579 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile580 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(32, 64).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile581 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile582 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(32, 96).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile583 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 0, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile584 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile585 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile586 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile587 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile588 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile589 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile590 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile591 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile592 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile593 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile594 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 0); - var tile595 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile596 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile597 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile598 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile599 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile600 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile601 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile602 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile603 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile604 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile605 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile606 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 64).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile607 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 80).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile608 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(48, 96).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile609 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile610 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile611 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile612 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile613 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile614 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 4, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile615 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile616 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile617 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile618 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile619 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile620 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile621 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile622 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile623 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile624 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile625 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile626 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile627 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile628 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile629 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile630 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile631 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(64, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile632 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(64, 16).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile633 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(64, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile634 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile635 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(64, 64).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile636 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(64, 80).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile637 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(64, 96).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile638 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile639 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile640 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile641 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 37, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile642 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile643 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile644 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile645 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile646 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile647 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile648 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile649 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile650 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 4, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile651 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile652 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile653 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile654 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile655 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile656 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(80, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile657 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(80, 16).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile658 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile659 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile660 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(80, 64).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile661 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile662 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(80, 96).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile663 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 36); - var tile664 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile665 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile666 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile667 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile668 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile669 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile670 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile671 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile672 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile673 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile674 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile675 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile676 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile677 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile678 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile679 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 73, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 324, 36); - var tile680 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile681 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile682 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(162, 0).UseWall((ushort)WallID.Glass, 36, 36); - var tile683 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile684 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 16416).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile685 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile686 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile687 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(36, 216).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile688 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile689 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile690 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile691 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile692 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile693 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile694 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile695 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile696 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile697 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile698 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile699 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile700 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile701 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile702 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 32, 0, 32).UseFrame(216, 36); - var tile703 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)WallID.Glass, 36, 36); - var tile704 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile705 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile706 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 32, 0, 32).UseFrame(144, 0); - var tile707 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile708 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile709 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile710 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile711 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile712 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile713 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile714 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile715 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile716 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile717 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile718 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile719 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile720 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile721 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile722 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile723 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile724 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile725 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile726 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile727 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile728 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 4, 32).UseFrame(162, 126).UseWall((ushort)WallID.Glass, 252, 144); - var tile729 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile730 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile731 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)WallID.Glass, 396, 0); - var tile732 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)WallID.Glass, 36, 36); - var tile733 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 2, 0).UseLiquid(LiquidState.Lava, 203).UseWall((ushort)WallID.Glass, 72, 72); - var tile734 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile735 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile736 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile737 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile738 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile739 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile740 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile741 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile742 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile743 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile744 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 10, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile745 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 138, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile746 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile747 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile748 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile749 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 66, 0, 32).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile750 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile751 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 1, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile752 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 4, 32).UseFrame(36, 18).UseWall((ushort)WallID.Glass, 288, 144); - var tile753 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(216, 36).UseWall((ushort)WallID.Glass, 36, 0); - var tile754 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)WallID.Glass, 108, 36); - var tile755 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 2, 0).UseLiquid(LiquidState.Lava, 203).UseWall((ushort)WallID.Glass, 108, 72); - var tile756 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile757 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile758 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile759 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile760 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile761 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 136, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile762 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile763 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile764 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile765 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile766 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile767 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile768 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile769 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 1, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile770 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile771 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 66, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile772 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 4, 32).UseFrame(18, 18).UseWall((ushort)WallID.Glass, 288, 144); - var tile773 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(144, 90); - var tile774 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(144, 54).UseWall((ushort)WallID.Glass, 36, 0); - var tile775 = new TileDefinitionStructure(TileID.LavaDrip).UseHeaders(0, 131, 1, 32).UseWall((ushort)WallID.Glass, 108, 36); - var tile776 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)WallID.Glass, 288, 72); - var tile777 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile778 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile779 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile780 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile781 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile782 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile783 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile784 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile785 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile786 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile787 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile788 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile789 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile790 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile791 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile792 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile793 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile794 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile795 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 1, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile796 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 11, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile797 = new TileDefinitionStructure(TileID.Extractinator).UseHeaders(0, 131, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile798 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 4, 32).UseFrame(36, 18).UseWall((ushort)WallID.Glass, 216, 144); - var tile799 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 3, 32).UseFrame(162, 18).UseWall((ushort)WallID.Glass, 108, 108); - var tile800 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile801 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile802 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile803 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile804 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile805 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile806 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile807 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile808 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 4, 32).UseFrame(144, 144).UseWall((ushort)WallID.Glass, 288, 144); - var tile809 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile810 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)WallID.Glass, 72, 36); - var tile811 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile812 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile813 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile814 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(72, 216).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile815 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile816 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 2, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile817 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile818 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile819 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile820 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile821 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile822 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile823 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)WallID.Glass, 72, 36); - var tile824 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile825 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile826 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile827 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 36); - var tile828 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72).MakeActuated(); - var tile829 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile830 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 4, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile831 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile832 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile833 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile834 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile835 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile836 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile837 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile838 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile839 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile840 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 76, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 432, 36); - var tile841 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile842 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile843 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(216, 18).UseWall((ushort)WallID.Glass, 396, 0); - var tile844 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile845 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 12320).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile846 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile847 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile848 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile849 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile850 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72).MakeActuated(); - var tile851 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile852 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile853 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile854 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile855 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile856 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile857 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile858 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile859 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile860 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 108, 36); - var tile861 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile862 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile863 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 72).MakeActuated(); - var tile864 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile865 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile866 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile867 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile868 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile869 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile870 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile871 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile872 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile873 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile874 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 37, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile875 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile876 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 36, 36); - var tile877 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile878 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile879 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile880 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile881 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile882 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile883 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile884 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile885 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile886 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile887 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile888 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile889 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile890 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile891 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile892 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile893 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile894 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 396, 0); - var tile895 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile896 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile897 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile898 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile899 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 101, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile900 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile901 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile902 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile903 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile904 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile905 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile906 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 4, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile907 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile908 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile909 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile910 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile911 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile912 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile913 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile914 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 36); - var tile915 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile916 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 72).MakeActuated(); - var tile917 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile918 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile919 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile920 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile921 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile922 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(216, 36); - var tile923 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile924 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile925 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile926 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile927 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile928 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile929 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile930 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile931 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 396, 36); - var tile932 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile933 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile934 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); - var tile935 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile936 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile937 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile938 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile939 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 72, 36); - var tile940 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile941 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile942 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile943 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 72).MakeActuated(); - var tile944 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile945 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile946 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 6, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile947 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile948 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile949 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile950 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile951 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile952 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile953 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile954 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile955 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile956 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile957 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile958 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile959 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile960 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile961 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile962 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile963 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile964 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile965 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile966 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile967 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile968 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 72).MakeActuated(); - var tile969 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 54); - var tile970 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile971 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile972 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile973 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile974 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile975 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile976 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile977 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile978 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile979 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 4128).UseFrame(468, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile980 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile981 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile982 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile983 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile984 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile985 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile986 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile987 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)WallID.Glass, 396, 72); - var tile988 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile989 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile990 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile991 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile992 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile993 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile994 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile995 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile996 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile997 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile998 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile999 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1000 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1001 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile1002 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 72).MakeActuated(); - var tile1003 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1004 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1005 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1006 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1007 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1008 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1009 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1010 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1011 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1012 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1013 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1014 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1015 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1016 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1017 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1018 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1019 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1020 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1021 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(450, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1022 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1023 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1024 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1025 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1026 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1027 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1028 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1029 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(180, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1030 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1031 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1032 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1033 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 6, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1034 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1035 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1036 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1037 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1038 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1039 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1040 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1041 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); - var tile1042 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(162, 36).UseWall((ushort)WallID.Glass, 144, 72); - var tile1043 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1044 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1045 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1046 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1047 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1048 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1049 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1050 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1051 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1052 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1053 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1054 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 71, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1055 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 11, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1056 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1057 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1058 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1059 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1060 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 18); - var tile1061 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 12320).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile1062 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 4, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile1063 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1064 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1065 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1066 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1067 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1068 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1069 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1070 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1071 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1072 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1073 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1074 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1075 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1076 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1077 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 216, 72).MakeActuated(); - var tile1078 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1079 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1080 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1081 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1082 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1083 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1084 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1085 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1086 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1087 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1088 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1089 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1090 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1091 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile1093 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile1094 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1095 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1096 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1097 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1098 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1099 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1109 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile1111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(360, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1113 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1117 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 72).MakeActuated(); - var tile1119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(162, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1123 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile1127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 8224).UseFrame(342, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1129 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 4128).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1136 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1142 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(18, 216).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1147 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1148 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1150 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1151 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1152 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1153 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1155 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(126, 180).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1156 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1157 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1159 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1160 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1161 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1163 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 72); - var tile1165 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 72).MakeActuated(); - var tile1166 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1168 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1171 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1174 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1175 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1177 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1178 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1180 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1184 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1190 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 3, 0).UseWall((ushort)ModContent.WallType(), 252, 108); - var tile1191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile1192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile1193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 0); - var tile1194 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 72); - var tile1195 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0).MakeActuated(); - var tile1196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1199 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1200 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile1204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 2144).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 108).MakeActuated(); - var tile1205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile1206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile1207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(198, 54); - var tile1208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 72); - var tile1210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 54); - var tile1211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 2144).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile1212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile1213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 0).MakeActuated(); - var tile1214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 396, 72).MakeActuated(); - var tile1215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 2144).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile1216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 8224).UseFrame(450, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 72); - var tile1218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 0).MakeActuated(); - var tile1219 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile1221 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile1222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(36, 216); - var tile1225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 54).UseWall((ushort)WallID.Glass, 72, 72); - var tile1226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 198); - var tile1227 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 4, 0).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile1228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 44, 0, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 432, 0); - var tile1229 = new TileDefinitionStructure(TileID.SapphireGemspark).UseHeaders(0, 74, 3, 32).UseFrame(162, 54).UseWall((ushort)WallID.SapphireGemspark, 360, 108); - var tile1230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)WallID.Glass, 288, 36); - var tile1231 = new TileDefinitionStructure(TileID.AmberGemspark).UseHeaders(0, 103, 3, 32).UseFrame(198, 54).UseWall((ushort)WallID.AmberGemspark, 252, 108); - var tile1232 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 140, 2, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 432, 72); - var tile1233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 0).UseWall((ushort)WallID.Glass, 72, 72); - var tile1234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile1235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(36, 0).UseWall((ushort)WallID.Glass, 36, 72); - var tile1236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(216, 36); - var tile1237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54); - var tile1238 = new TileDefinitionStructure(TileID.SapphireGemspark).UseHeaders(0, 106, 3, 32).UseFrame(198, 54).UseWall((ushort)WallID.SapphireGemspark, 360, 108); - var tile1239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(144, 72).UseWall((ushort)WallID.Glass, 360, 36); - var tile1240 = new TileDefinitionStructure(TileID.AmberGemspark).UseHeaders(0, 38, 3, 32).UseFrame(198, 54).UseWall((ushort)WallID.AmberGemspark, 216, 108); - var tile1241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); - var tile1242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile1243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 216); - var tile1244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(90, 54).UseWall((ushort)WallID.Glass, 36, 72); - var tile1245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile1246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile1247 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); - var tile1248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); - var tile1249 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 0); - var tile1250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile1251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile1252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(53, 193, 252), tile2 }, - { new Color(91, 129, 188), tile3 }, - { new Color(108, 75, 74), tile4 }, - { new Color(221, 100, 141), tile5 }, - { new Color(11, 134, 228), tile6 }, - { new Color(87, 31, 104), tile7 }, - { new Color(186, 30, 20), tile8 }, - { new Color(3, 48, 15), tile9 }, - { new Color(254, 166, 107), tile10 }, - { new Color(54, 243, 148), tile11 }, - { new Color(241, 158, 208), tile12 }, - { new Color(233, 216, 69), tile13 }, - { new Color(205, 166, 13), tile14 }, - { new Color(118, 57, 241), tile15 }, - { new Color(102, 222, 90), tile16 }, - { new Color(41, 183, 105), tile17 }, - { new Color(84, 195, 251), tile18 }, - { new Color(127, 217, 205), tile19 }, - { new Color(8, 50, 145), tile20 }, - { new Color(236, 92, 219), tile21 }, - { new Color(81, 53, 88), tile22 }, - { new Color(181, 236, 197), tile23 }, - { new Color(189, 33, 173), tile24 }, - { new Color(158, 138, 120), tile25 }, - { new Color(90, 68, 229), tile26 }, - { new Color(34, 157, 82), tile27 }, - { new Color(181, 212, 238), tile28 }, - { new Color(1, 226, 47), tile29 }, - { new Color(153, 114, 197), tile30 }, - { new Color(2, 224, 166), tile31 }, - { new Color(180, 225, 73), tile32 }, - { new Color(50, 37, 3), tile33 }, - { new Color(153, 176, 242), tile34 }, - { new Color(148, 108, 149), tile35 }, - { new Color(188, 181, 57), tile36 }, - { new Color(131, 36, 148), tile37 }, - { new Color(232, 230, 148), tile38 }, - { new Color(63, 54, 136), tile39 }, - { new Color(236, 79, 83), tile40 }, - { new Color(40, 28, 121), tile41 }, - { new Color(255, 186, 65), tile42 }, - { new Color(7, 234, 168), tile43 }, - { new Color(46, 39, 31), tile44 }, - { new Color(225, 136, 236), tile45 }, - { new Color(95, 32, 103), tile46 }, - { new Color(89, 69, 45), tile47 }, - { new Color(246, 22, 77), tile48 }, - { new Color(49, 26, 250), tile49 }, - { new Color(17, 117, 171), tile50 }, - { new Color(193, 69, 213), tile51 }, - { new Color(176, 113, 148), tile52 }, - { new Color(120, 149, 178), tile53 }, - { new Color(84, 181, 202), tile54 }, - { new Color(145, 84, 253), tile55 }, - { new Color(117, 7, 93), tile56 }, - { new Color(168, 223, 22), tile57 }, - { new Color(32, 147, 10), tile58 }, - { new Color(38, 50, 6), tile59 }, - { new Color(44, 206, 160), tile60 }, - { new Color(70, 245, 117), tile61 }, - { new Color(253, 109, 226), tile62 }, - { new Color(73, 48, 23), tile63 }, - { new Color(88, 231, 139), tile64 }, - { new Color(181, 4, 144), tile65 }, - { new Color(98, 100, 193), tile66 }, - { new Color(80, 188, 19), tile67 }, - { new Color(156, 105, 149), tile68 }, - { new Color(149, 160, 177), tile69 }, - { new Color(203, 138, 62), tile70 }, - { new Color(141, 75, 198), tile71 }, - { new Color(18, 13, 191), tile72 }, - { new Color(85, 148, 231), tile73 }, - { new Color(26, 43, 214), tile74 }, - { new Color(70, 79, 247), tile75 }, - { new Color(138, 107, 142), tile76 }, - { new Color(121, 196, 205), tile77 }, - { new Color(68, 220, 18), tile78 }, - { new Color(140, 170, 140), tile79 }, - { new Color(223, 104, 204), tile80 }, - { new Color(48, 126, 166), tile81 }, - { new Color(216, 202, 155), tile82 }, - { new Color(196, 163, 247), tile83 }, - { new Color(209, 12, 208), tile84 }, - { new Color(218, 53, 145), tile85 }, - { new Color(60, 86, 25), tile86 }, - { new Color(158, 10, 53), tile87 }, - { new Color(34, 81, 197), tile88 }, - { new Color(113, 73, 111), tile89 }, - { new Color(180, 133, 99), tile90 }, - { new Color(50, 118, 44), tile91 }, - { new Color(26, 234, 172), tile92 }, - { new Color(47, 109, 132), tile93 }, - { new Color(91, 198, 199), tile94 }, - { new Color(151, 168, 183), tile95 }, - { new Color(252, 106, 167), tile96 }, - { new Color(129, 79, 84), tile97 }, - { new Color(114, 64, 93), tile98 }, - { new Color(151, 13, 44), tile99 }, - { new Color(224, 103, 129), tile100 }, - { new Color(44, 15, 30), tile101 }, - { new Color(147, 158, 149), tile102 }, - { new Color(164, 191, 74), tile103 }, - { new Color(228, 13, 232), tile104 }, - { new Color(149, 66, 67), tile105 }, - { new Color(109, 138, 169), tile106 }, - { new Color(14, 116, 222), tile107 }, - { new Color(199, 51, 53), tile108 }, - { new Color(14, 192, 53), tile109 }, - { new Color(206, 130, 220), tile110 }, - { new Color(128, 78, 5), tile111 }, - { new Color(2, 46, 182), tile112 }, - { new Color(169, 4, 9), tile113 }, - { new Color(34, 88, 170), tile114 }, - { new Color(92, 156, 66), tile115 }, - { new Color(107, 220, 254), tile116 }, - { new Color(25, 42, 130), tile117 }, - { new Color(130, 210, 242), tile118 }, - { new Color(163, 101, 220), tile119 }, - { new Color(232, 132, 222), tile120 }, - { new Color(96, 214, 60), tile121 }, - { new Color(110, 100, 190), tile122 }, - { new Color(227, 147, 19), tile123 }, - { new Color(141, 195, 134), tile124 }, - { new Color(159, 236, 28), tile125 }, - { new Color(51, 107, 150), tile126 }, - { new Color(242, 163, 227), tile127 }, - { new Color(55, 180, 88), tile128 }, - { new Color(89, 253, 124), tile129 }, - { new Color(19, 95, 201), tile130 }, - { new Color(217, 192, 127), tile131 }, - { new Color(43, 194, 129), tile132 }, - { new Color(110, 238, 56), tile133 }, - { new Color(132, 136, 73), tile134 }, - { new Color(234, 140, 102), tile135 }, - { new Color(251, 227, 230), tile136 }, - { new Color(213, 111, 249), tile137 }, - { new Color(69, 246, 225), tile138 }, - { new Color(251, 40, 33), tile139 }, - { new Color(227, 20, 103), tile140 }, - { new Color(65, 207, 51), tile141 }, - { new Color(74, 179, 2), tile142 }, - { new Color(7, 116, 42), tile143 }, - { new Color(155, 197, 125), tile144 }, - { new Color(94, 110, 27), tile145 }, - { new Color(153, 76, 40), tile146 }, - { new Color(241, 93, 25), tile147 }, - { new Color(149, 61, 239), tile148 }, - { new Color(207, 147, 202), tile149 }, - { new Color(157, 47, 153), tile150 }, - { new Color(95, 138, 217), tile151 }, - { new Color(208, 66, 184), tile152 }, - { new Color(22, 160, 216), tile153 }, - { new Color(99, 244, 110), tile154 }, - { new Color(188, 58, 170), tile155 }, - { new Color(124, 231, 135), tile156 }, - { new Color(198, 98, 220), tile157 }, - { new Color(249, 241, 182), tile158 }, - { new Color(77, 171, 146), tile159 }, - { new Color(68, 122, 31), tile160 }, - { new Color(56, 105, 69), tile161 }, - { new Color(144, 59, 58), tile162 }, - { new Color(163, 141, 43), tile163 }, - { new Color(99, 131, 171), tile164 }, - { new Color(79, 142, 105), tile165 }, - { new Color(171, 217, 2), tile166 }, - { new Color(69, 82, 172), tile167 }, - { new Color(67, 215, 205), tile168 }, - { new Color(188, 102, 152), tile169 }, - { new Color(35, 131, 150), tile170 }, - { new Color(37, 209, 38), tile171 }, - { new Color(184, 43, 138), tile172 }, - { new Color(41, 43, 255), tile173 }, - { new Color(111, 217, 89), tile174 }, - { new Color(91, 98, 223), tile175 }, - { new Color(48, 169, 99), tile176 }, - { new Color(76, 161, 210), tile177 }, - { new Color(143, 254, 39), tile178 }, - { new Color(115, 245, 146), tile179 }, - { new Color(119, 211, 212), tile180 }, - { new Color(162, 128, 10), tile181 }, - { new Color(149, 61, 177), tile182 }, - { new Color(133, 151, 98), tile183 }, - { new Color(223, 130, 173), tile184 }, - { new Color(3, 214, 121), tile185 }, - { new Color(83, 231, 116), tile186 }, - { new Color(238, 140, 188), tile187 }, - { new Color(52, 214, 225), tile188 }, - { new Color(196, 150, 211), tile189 }, - { new Color(254, 69, 54), tile190 }, - { new Color(248, 177, 87), tile191 }, - { new Color(42, 204, 89), tile192 }, - { new Color(79, 198, 37), tile193 }, - { new Color(45, 170, 18), tile194 }, - { new Color(0, 109, 31), tile195 }, - { new Color(36, 140, 40), tile196 }, - { new Color(174, 32, 13), tile197 }, - { new Color(29, 137, 71), tile198 }, - { new Color(24, 109, 170), tile199 }, - { new Color(40, 208, 167), tile200 }, - { new Color(222, 135, 81), tile201 }, - { new Color(44, 231, 208), tile202 }, - { new Color(85, 217, 9), tile203 }, - { new Color(32, 3, 32), tile204 }, - { new Color(79, 192, 225), tile205 }, - { new Color(169, 51, 104), tile206 }, - { new Color(194, 159, 10), tile207 }, - { new Color(170, 80, 37), tile208 }, - { new Color(40, 218, 40), tile209 }, - { new Color(16, 17, 94), tile210 }, - { new Color(174, 38, 245), tile211 }, - { new Color(126, 79, 35), tile212 }, - { new Color(193, 212, 133), tile213 }, - { new Color(79, 206, 178), tile214 }, - { new Color(31, 141, 28), tile215 }, - { new Color(236, 206, 200), tile216 }, - { new Color(101, 111, 57), tile217 }, - { new Color(65, 102, 49), tile218 }, - { new Color(157, 51, 54), tile219 }, - { new Color(44, 3, 12), tile220 }, - { new Color(167, 69, 199), tile221 }, - { new Color(170, 113, 221), tile222 }, - { new Color(42, 208, 113), tile223 }, - { new Color(190, 232, 95), tile224 }, - { new Color(226, 115, 208), tile225 }, - { new Color(87, 139, 194), tile226 }, - { new Color(9, 59, 12), tile227 }, - { new Color(96, 171, 162), tile228 }, - { new Color(37, 109, 192), tile229 }, - { new Color(196, 225, 27), tile230 }, - { new Color(237, 148, 209), tile231 }, - { new Color(121, 167, 137), tile232 }, - { new Color(235, 116, 28), tile233 }, - { new Color(63, 194, 253), tile234 }, - { new Color(87, 166, 134), tile235 }, - { new Color(218, 94, 243), tile236 }, - { new Color(96, 70, 168), tile237 }, - { new Color(116, 35, 199), tile238 }, - { new Color(0, 71, 153), tile239 }, - { new Color(36, 133, 4), tile240 }, - { new Color(29, 102, 239), tile241 }, - { new Color(85, 209, 83), tile242 }, - { new Color(141, 105, 203), tile243 }, - { new Color(71, 107, 22), tile244 }, - { new Color(165, 202, 121), tile245 }, - { new Color(14, 8, 4), tile246 }, - { new Color(27, 74, 14), tile247 }, - { new Color(204, 100, 155), tile248 }, - { new Color(115, 120, 113), tile249 }, - { new Color(10, 121, 95), tile250 }, - { new Color(240, 198, 238), tile251 }, - { new Color(24, 34, 91), tile252 }, - { new Color(14, 1, 213), tile253 }, - { new Color(51, 77, 244), tile254 }, - { new Color(39, 25, 218), tile255 }, - { new Color(145, 206, 89), tile256 }, - { new Color(77, 241, 62), tile257 }, - { new Color(148, 8, 59), tile258 }, - { new Color(245, 80, 1), tile259 }, - { new Color(83, 226, 88), tile260 }, - { new Color(225, 131, 240), tile261 }, - { new Color(108, 86, 164), tile262 }, - { new Color(39, 141, 167), tile263 }, - { new Color(30, 0, 7), tile264 }, - { new Color(47, 232, 252), tile265 }, - { new Color(25, 164, 75), tile266 }, - { new Color(192, 225, 170), tile267 }, - { new Color(24, 188, 135), tile268 }, - { new Color(32, 91, 189), tile269 }, - { new Color(179, 35, 209), tile270 }, - { new Color(89, 186, 31), tile271 }, - { new Color(125, 81, 202), tile272 }, - { new Color(4, 187, 194), tile273 }, - { new Color(53, 105, 64), tile274 }, - { new Color(177, 47, 241), tile275 }, - { new Color(55, 101, 31), tile276 }, - { new Color(62, 219, 171), tile277 }, - { new Color(182, 146, 0), tile278 }, - { new Color(173, 201, 198), tile279 }, - { new Color(105, 75, 250), tile280 }, - { new Color(230, 116, 106), tile281 }, - { new Color(214, 196, 69), tile282 }, - { new Color(232, 178, 151), tile283 }, - { new Color(50, 21, 233), tile284 }, - { new Color(136, 138, 120), tile285 }, - { new Color(105, 103, 141), tile286 }, - { new Color(150, 232, 246), tile287 }, - { new Color(157, 116, 72), tile288 }, - { new Color(37, 163, 39), tile289 }, - { new Color(30, 207, 136), tile290 }, - { new Color(3, 155, 111), tile291 }, - { new Color(199, 79, 245), tile292 }, - { new Color(214, 218, 107), tile293 }, - { new Color(172, 79, 178), tile294 }, - { new Color(136, 12, 197), tile295 }, - { new Color(194, 45, 8), tile296 }, - { new Color(136, 67, 97), tile297 }, - { new Color(57, 210, 98), tile298 }, - { new Color(3, 72, 255), tile299 }, - { new Color(33, 177, 32), tile300 }, - { new Color(29, 202, 226), tile301 }, - { new Color(15, 46, 122), tile302 }, - { new Color(121, 193, 59), tile303 }, - { new Color(131, 147, 140), tile304 }, - { new Color(34, 233, 153), tile305 }, - { new Color(67, 21, 104), tile306 }, - { new Color(130, 98, 117), tile307 }, - { new Color(31, 149, 139), tile308 }, - { new Color(38, 202, 200), tile309 }, - { new Color(12, 195, 6), tile310 }, - { new Color(245, 180, 41), tile311 }, - { new Color(74, 143, 133), tile312 }, - { new Color(207, 121, 221), tile313 }, - { new Color(75, 73, 108), tile314 }, - { new Color(204, 5, 176), tile315 }, - { new Color(212, 23, 233), tile316 }, - { new Color(201, 192, 51), tile317 }, - { new Color(151, 159, 78), tile318 }, - { new Color(170, 253, 52), tile319 }, - { new Color(87, 233, 100), tile320 }, - { new Color(177, 108, 253), tile321 }, - { new Color(53, 141, 223), tile322 }, - { new Color(99, 215, 90), tile323 }, - { new Color(19, 116, 156), tile324 }, - { new Color(139, 55, 25), tile325 }, - { new Color(9, 83, 144), tile326 }, - { new Color(219, 81, 179), tile327 }, - { new Color(223, 67, 3), tile328 }, - { new Color(211, 94, 21), tile329 }, - { new Color(218, 159, 145), tile330 }, - { new Color(81, 120, 144), tile331 }, - { new Color(120, 153, 220), tile332 }, - { new Color(110, 150, 119), tile333 }, - { new Color(209, 113, 63), tile334 }, - { new Color(142, 182, 76), tile335 }, - { new Color(150, 11, 103), tile336 }, - { new Color(53, 161, 169), tile337 }, - { new Color(163, 124, 151), tile338 }, - { new Color(177, 210, 41), tile339 }, - { new Color(249, 98, 47), tile340 }, - { new Color(201, 136, 55), tile341 }, - { new Color(201, 194, 251), tile342 }, - { new Color(12, 18, 157), tile343 }, - { new Color(60, 154, 188), tile344 }, - { new Color(25, 9, 224), tile345 }, - { new Color(115, 81, 141), tile346 }, - { new Color(183, 60, 82), tile347 }, - { new Color(173, 165, 254), tile348 }, - { new Color(231, 173, 252), tile349 }, - { new Color(248, 199, 199), tile350 }, - { new Color(179, 117, 52), tile351 }, - { new Color(72, 7, 232), tile352 }, - { new Color(8, 197, 243), tile353 }, - { new Color(80, 138, 248), tile354 }, - { new Color(201, 248, 6), tile355 }, - { new Color(237, 138, 114), tile356 }, - { new Color(183, 62, 129), tile357 }, - { new Color(156, 66, 37), tile358 }, - { new Color(220, 28, 227), tile359 }, - { new Color(56, 225, 21), tile360 }, - { new Color(255, 19, 75), tile361 }, - { new Color(214, 137, 37), tile362 }, - { new Color(135, 209, 2), tile363 }, - { new Color(247, 107, 139), tile364 }, - { new Color(153, 103, 177), tile365 }, - { new Color(89, 227, 172), tile366 }, - { new Color(248, 250, 34), tile367 }, - { new Color(137, 65, 137), tile368 }, - { new Color(70, 22, 50), tile369 }, - { new Color(14, 107, 235), tile370 }, - { new Color(4, 207, 228), tile371 }, - { new Color(222, 80, 119), tile372 }, - { new Color(173, 243, 111), tile373 }, - { new Color(224, 101, 185), tile374 }, - { new Color(112, 191, 210), tile375 }, - { new Color(245, 3, 218), tile376 }, - { new Color(116, 130, 56), tile377 }, - { new Color(55, 64, 230), tile378 }, - { new Color(242, 118, 210), tile379 }, - { new Color(194, 144, 114), tile380 }, - { new Color(242, 120, 101), tile381 }, - { new Color(23, 242, 156), tile382 }, - { new Color(167, 187, 22), tile383 }, - { new Color(58, 172, 240), tile384 }, - { new Color(60, 23, 149), tile385 }, - { new Color(104, 25, 129), tile386 }, - { new Color(182, 81, 19), tile387 }, - { new Color(88, 154, 232), tile388 }, - { new Color(178, 205, 142), tile389 }, - { new Color(253, 235, 218), tile390 }, - { new Color(164, 234, 98), tile391 }, - { new Color(253, 237, 236), tile392 }, - { new Color(84, 88, 204), tile393 }, - { new Color(54, 77, 72), tile394 }, - { new Color(196, 57, 214), tile395 }, - { new Color(72, 250, 41), tile396 }, - { new Color(80, 137, 92), tile397 }, - { new Color(80, 12, 63), tile398 }, - { new Color(94, 154, 222), tile399 }, - { new Color(125, 101, 37), tile400 }, - { new Color(13, 169, 207), tile401 }, - { new Color(59, 149, 193), tile402 }, - { new Color(141, 62, 41), tile403 }, - { new Color(168, 20, 192), tile404 }, - { new Color(181, 127, 3), tile405 }, - { new Color(203, 147, 96), tile406 }, - { new Color(18, 105, 211), tile407 }, - { new Color(101, 173, 97), tile408 }, - { new Color(126, 84, 222), tile409 }, - { new Color(35, 158, 83), tile410 }, - { new Color(14, 215, 243), tile411 }, - { new Color(167, 41, 163), tile412 }, - { new Color(120, 136, 164), tile413 }, - { new Color(20, 186, 187), tile414 }, - { new Color(255, 167, 117), tile415 }, - { new Color(155, 154, 140), tile416 }, - { new Color(59, 146, 6), tile417 }, - { new Color(125, 106, 251), tile418 }, - { new Color(81, 167, 252), tile419 }, - { new Color(109, 189, 65), tile420 }, - { new Color(227, 106, 160), tile421 }, - { new Color(214, 154, 61), tile422 }, - { new Color(205, 13, 86), tile423 }, - { new Color(96, 82, 11), tile424 }, - { new Color(188, 253, 175), tile425 }, - { new Color(23, 102, 5), tile426 }, - { new Color(236, 226, 185), tile427 }, - { new Color(81, 231, 11), tile428 }, - { new Color(76, 144, 108), tile429 }, - { new Color(248, 85, 129), tile430 }, - { new Color(166, 11, 202), tile431 }, - { new Color(99, 49, 79), tile432 }, - { new Color(27, 41, 12), tile433 }, - { new Color(56, 206, 140), tile434 }, - { new Color(54, 219, 64), tile435 }, - { new Color(250, 193, 108), tile436 }, - { new Color(75, 57, 65), tile437 }, - { new Color(247, 129, 219), tile438 }, - { new Color(135, 145, 131), tile439 }, - { new Color(148, 137, 10), tile440 }, - { new Color(208, 212, 184), tile441 }, - { new Color(212, 185, 71), tile442 }, - { new Color(65, 89, 204), tile443 }, - { new Color(95, 252, 60), tile444 }, - { new Color(248, 180, 19), tile445 }, - { new Color(44, 27, 12), tile446 }, - { new Color(203, 81, 207), tile447 }, - { new Color(255, 172, 27), tile448 }, - { new Color(64, 175, 138), tile449 }, - { new Color(238, 219, 159), tile450 }, - { new Color(204, 135, 159), tile451 }, - { new Color(2, 103, 249), tile452 }, - { new Color(212, 97, 33), tile453 }, - { new Color(248, 185, 104), tile454 }, - { new Color(159, 236, 61), tile455 }, - { new Color(4, 254, 204), tile456 }, - { new Color(200, 91, 117), tile457 }, - { new Color(119, 200, 55), tile458 }, - { new Color(59, 209, 40), tile459 }, - { new Color(156, 148, 10), tile460 }, - { new Color(189, 82, 125), tile461 }, - { new Color(45, 147, 117), tile462 }, - { new Color(157, 245, 77), tile463 }, - { new Color(25, 87, 186), tile464 }, - { new Color(234, 211, 152), tile465 }, - { new Color(102, 95, 192), tile466 }, - { new Color(222, 59, 176), tile467 }, - { new Color(189, 38, 128), tile468 }, - { new Color(42, 84, 190), tile469 }, - { new Color(104, 199, 149), tile470 }, - { new Color(209, 56, 204), tile471 }, - { new Color(22, 59, 102), tile472 }, - { new Color(234, 114, 88), tile473 }, - { new Color(200, 103, 9), tile474 }, - { new Color(127, 174, 3), tile475 }, - { new Color(186, 140, 244), tile476 }, - { new Color(159, 212, 113), tile477 }, - { new Color(103, 190, 88), tile478 }, - { new Color(90, 255, 44), tile479 }, - { new Color(253, 3, 62), tile480 }, - { new Color(182, 52, 46), tile481 }, - { new Color(183, 71, 31), tile482 }, - { new Color(237, 211, 152), tile483 }, - { new Color(49, 124, 237), tile484 }, - { new Color(104, 21, 212), tile485 }, - { new Color(167, 62, 119), tile486 }, - { new Color(124, 111, 200), tile487 }, - { new Color(201, 201, 242), tile488 }, - { new Color(36, 106, 121), tile489 }, - { new Color(116, 188, 59), tile490 }, - { new Color(57, 236, 111), tile491 }, - { new Color(25, 18, 50), tile492 }, - { new Color(218, 200, 103), tile493 }, - { new Color(227, 205, 184), tile494 }, - { new Color(92, 109, 87), tile495 }, - { new Color(131, 255, 169), tile496 }, - { new Color(132, 178, 193), tile497 }, - { new Color(181, 129, 148), tile498 }, - { new Color(118, 236, 107), tile499 }, - { new Color(60, 146, 221), tile500 }, - { new Color(166, 121, 22), tile501 }, - { new Color(92, 248, 144), tile502 }, - { new Color(126, 78, 3), tile503 }, - { new Color(161, 205, 118), tile504 }, - { new Color(15, 153, 161), tile505 }, - { new Color(15, 109, 92), tile506 }, - { new Color(155, 160, 106), tile507 }, - { new Color(208, 240, 9), tile508 }, - { new Color(122, 131, 107), tile509 }, - { new Color(219, 162, 38), tile510 }, - { new Color(199, 157, 53), tile511 }, - { new Color(137, 61, 84), tile512 }, - { new Color(161, 0, 116), tile513 }, - { new Color(198, 5, 177), tile514 }, - { new Color(165, 226, 229), tile515 }, - { new Color(75, 166, 232), tile516 }, - { new Color(242, 103, 127), tile517 }, - { new Color(15, 161, 241), tile518 }, - { new Color(114, 213, 137), tile519 }, - { new Color(13, 226, 116), tile520 }, - { new Color(37, 162, 171), tile521 }, - { new Color(221, 217, 47), tile522 }, - { new Color(64, 133, 91), tile523 }, - { new Color(77, 109, 109), tile524 }, - { new Color(231, 212, 154), tile525 }, - { new Color(185, 42, 13), tile526 }, - { new Color(35, 47, 221), tile527 }, - { new Color(131, 233, 59), tile528 }, - { new Color(167, 184, 252), tile529 }, - { new Color(67, 23, 103), tile530 }, - { new Color(203, 148, 29), tile531 }, - { new Color(0, 161, 99), tile532 }, - { new Color(5, 200, 8), tile533 }, - { new Color(182, 10, 32), tile534 }, - { new Color(140, 164, 250), tile535 }, - { new Color(18, 39, 205), tile536 }, - { new Color(87, 185, 171), tile537 }, - { new Color(123, 233, 178), tile538 }, - { new Color(150, 162, 185), tile539 }, - { new Color(112, 53, 33), tile540 }, - { new Color(50, 253, 110), tile541 }, - { new Color(243, 130, 216), tile542 }, - { new Color(79, 231, 50), tile543 }, - { new Color(55, 179, 97), tile544 }, - { new Color(4, 108, 37), tile545 }, - { new Color(189, 246, 68), tile546 }, - { new Color(64, 149, 144), tile547 }, - { new Color(47, 236, 93), tile548 }, - { new Color(188, 79, 171), tile549 }, - { new Color(106, 105, 254), tile550 }, - { new Color(169, 149, 146), tile551 }, - { new Color(231, 132, 12), tile552 }, - { new Color(177, 152, 34), tile553 }, - { new Color(34, 194, 64), tile554 }, - { new Color(154, 31, 5), tile555 }, - { new Color(73, 119, 124), tile556 }, - { new Color(141, 216, 171), tile557 }, - { new Color(117, 47, 160), tile558 }, - { new Color(144, 2, 17), tile559 }, - { new Color(16, 55, 51), tile560 }, - { new Color(44, 228, 125), tile561 }, - { new Color(51, 141, 30), tile562 }, - { new Color(206, 29, 232), tile563 }, - { new Color(24, 12, 94), tile564 }, - { new Color(33, 30, 210), tile565 }, - { new Color(80, 149, 204), tile566 }, - { new Color(88, 114, 215), tile567 }, - { new Color(47, 221, 145), tile568 }, - { new Color(83, 52, 102), tile569 }, - { new Color(242, 86, 129), tile570 }, - { new Color(251, 160, 96), tile571 }, - { new Color(239, 245, 222), tile572 }, - { new Color(195, 102, 145), tile573 }, - { new Color(230, 122, 90), tile574 }, - { new Color(147, 117, 204), tile575 }, - { new Color(77, 83, 16), tile576 }, - { new Color(206, 64, 109), tile577 }, - { new Color(68, 184, 197), tile578 }, - { new Color(91, 253, 7), tile579 }, - { new Color(236, 224, 89), tile580 }, - { new Color(184, 220, 198), tile581 }, - { new Color(102, 28, 107), tile582 }, - { new Color(253, 50, 41), tile583 }, - { new Color(243, 140, 46), tile584 }, - { new Color(58, 113, 247), tile585 }, - { new Color(125, 155, 103), tile586 }, - { new Color(196, 5, 224), tile587 }, - { new Color(86, 35, 21), tile588 }, - { new Color(19, 183, 232), tile589 }, - { new Color(155, 147, 247), tile590 }, - { new Color(215, 215, 133), tile591 }, - { new Color(56, 46, 158), tile592 }, - { new Color(147, 44, 88), tile593 }, - { new Color(97, 80, 32), tile594 }, - { new Color(230, 218, 180), tile595 }, - { new Color(63, 9, 70), tile596 }, - { new Color(205, 222, 98), tile597 }, - { new Color(159, 39, 219), tile598 }, - { new Color(120, 98, 184), tile599 }, - { new Color(176, 83, 101), tile600 }, - { new Color(131, 97, 159), tile601 }, - { new Color(50, 28, 181), tile602 }, - { new Color(168, 2, 67), tile603 }, - { new Color(89, 233, 110), tile604 }, - { new Color(14, 99, 180), tile605 }, - { new Color(192, 111, 72), tile606 }, - { new Color(97, 212, 173), tile607 }, - { new Color(161, 206, 181), tile608 }, - { new Color(149, 55, 175), tile609 }, - { new Color(170, 191, 204), tile610 }, - { new Color(229, 226, 217), tile611 }, - { new Color(243, 221, 239), tile612 }, - { new Color(129, 180, 190), tile613 }, - { new Color(255, 150, 7), tile614 }, - { new Color(3, 116, 244), tile615 }, - { new Color(244, 144, 196), tile616 }, - { new Color(39, 184, 242), tile617 }, - { new Color(112, 79, 126), tile618 }, - { new Color(184, 226, 147), tile619 }, - { new Color(233, 157, 228), tile620 }, - { new Color(5, 254, 67), tile621 }, - { new Color(118, 115, 6), tile622 }, - { new Color(148, 27, 133), tile623 }, - { new Color(197, 62, 187), tile624 }, - { new Color(137, 98, 62), tile625 }, - { new Color(166, 157, 90), tile626 }, - { new Color(193, 161, 166), tile627 }, - { new Color(235, 130, 6), tile628 }, - { new Color(217, 117, 147), tile629 }, - { new Color(91, 59, 251), tile630 }, - { new Color(92, 151, 23), tile631 }, - { new Color(218, 249, 151), tile632 }, - { new Color(195, 140, 0), tile633 }, - { new Color(237, 95, 117), tile634 }, - { new Color(63, 97, 121), tile635 }, - { new Color(55, 230, 236), tile636 }, - { new Color(64, 18, 68), tile637 }, - { new Color(56, 40, 252), tile638 }, - { new Color(61, 26, 123), tile639 }, - { new Color(61, 157, 254), tile640 }, - { new Color(115, 57, 224), tile641 }, - { new Color(137, 105, 167), tile642 }, - { new Color(164, 175, 104), tile643 }, - { new Color(166, 226, 17), tile644 }, - { new Color(89, 211, 65), tile645 }, - { new Color(49, 172, 32), tile646 }, - { new Color(140, 162, 142), tile647 }, - { new Color(166, 26, 41), tile648 }, - { new Color(183, 35, 111), tile649 }, - { new Color(26, 156, 223), tile650 }, - { new Color(27, 134, 239), tile651 }, - { new Color(1, 121, 37), tile652 }, - { new Color(149, 181, 248), tile653 }, - { new Color(210, 146, 54), tile654 }, - { new Color(131, 153, 47), tile655 }, - { new Color(50, 222, 84), tile656 }, - { new Color(186, 12, 110), tile657 }, - { new Color(91, 176, 250), tile658 }, - { new Color(111, 204, 30), tile659 }, - { new Color(183, 210, 70), tile660 }, - { new Color(55, 137, 18), tile661 }, - { new Color(137, 138, 92), tile662 }, - { new Color(34, 87, 89), tile663 }, - { new Color(28, 155, 247), tile664 }, - { new Color(40, 185, 15), tile665 }, - { new Color(88, 34, 128), tile666 }, - { new Color(249, 132, 68), tile667 }, - { new Color(26, 96, 144), tile668 }, - { new Color(113, 192, 213), tile669 }, - { new Color(244, 146, 173), tile670 }, - { new Color(6, 222, 226), tile671 }, - { new Color(178, 155, 9), tile672 }, - { new Color(35, 250, 14), tile673 }, - { new Color(211, 16, 135), tile674 }, - { new Color(250, 158, 113), tile675 }, - { new Color(119, 50, 246), tile676 }, - { new Color(234, 23, 169), tile677 }, - { new Color(158, 189, 77), tile678 }, - { new Color(1, 29, 40), tile679 }, - { new Color(130, 24, 202), tile680 }, - { new Color(134, 45, 197), tile681 }, - { new Color(172, 21, 188), tile682 }, - { new Color(20, 117, 30), tile683 }, - { new Color(6, 52, 40), tile684 }, - { new Color(113, 38, 116), tile685 }, - { new Color(189, 31, 194), tile686 }, - { new Color(30, 250, 141), tile687 }, - { new Color(223, 10, 123), tile688 }, - { new Color(3, 104, 33), tile689 }, - { new Color(149, 176, 125), tile690 }, - { new Color(224, 160, 226), tile691 }, - { new Color(68, 76, 227), tile692 }, - { new Color(193, 78, 137), tile693 }, - { new Color(180, 98, 189), tile694 }, - { new Color(216, 228, 227), tile695 }, - { new Color(129, 44, 151), tile696 }, - { new Color(217, 68, 253), tile697 }, - { new Color(102, 100, 29), tile698 }, - { new Color(60, 167, 34), tile699 }, - { new Color(74, 169, 172), tile700 }, - { new Color(155, 127, 196), tile701 }, - { new Color(160, 37, 147), tile702 }, - { new Color(70, 45, 217), tile703 }, - { new Color(144, 251, 209), tile704 }, - { new Color(57, 106, 151), tile705 }, - { new Color(208, 6, 37), tile706 }, - { new Color(152, 130, 60), tile707 }, - { new Color(138, 187, 108), tile708 }, - { new Color(128, 121, 60), tile709 }, - { new Color(196, 8, 165), tile710 }, - { new Color(192, 119, 164), tile711 }, - { new Color(220, 24, 227), tile712 }, - { new Color(248, 55, 190), tile713 }, - { new Color(79, 58, 254), tile714 }, - { new Color(189, 72, 73), tile715 }, - { new Color(44, 45, 249), tile716 }, - { new Color(134, 107, 160), tile717 }, - { new Color(253, 178, 39), tile718 }, - { new Color(111, 17, 195), tile719 }, - { new Color(88, 32, 172), tile720 }, - { new Color(86, 130, 37), tile721 }, - { new Color(51, 208, 131), tile722 }, - { new Color(44, 92, 81), tile723 }, - { new Color(179, 216, 207), tile724 }, - { new Color(103, 72, 71), tile725 }, - { new Color(61, 204, 115), tile726 }, - { new Color(34, 84, 76), tile727 }, - { new Color(66, 61, 156), tile728 }, - { new Color(5, 195, 197), tile729 }, - { new Color(125, 109, 7), tile730 }, - { new Color(32, 159, 23), tile731 }, - { new Color(18, 248, 183), tile732 }, - { new Color(217, 137, 119), tile733 }, - { new Color(197, 255, 209), tile734 }, - { new Color(168, 210, 147), tile735 }, - { new Color(208, 149, 105), tile736 }, - { new Color(223, 49, 69), tile737 }, - { new Color(79, 54, 204), tile738 }, - { new Color(95, 20, 68), tile739 }, - { new Color(136, 46, 13), tile740 }, - { new Color(190, 175, 239), tile741 }, - { new Color(74, 147, 57), tile742 }, - { new Color(184, 85, 80), tile743 }, - { new Color(144, 100, 66), tile744 }, - { new Color(251, 92, 84), tile745 }, - { new Color(122, 154, 107), tile746 }, - { new Color(9, 52, 45), tile747 }, - { new Color(91, 157, 59), tile748 }, - { new Color(194, 208, 105), tile749 }, - { new Color(74, 178, 228), tile750 }, - { new Color(114, 80, 91), tile751 }, - { new Color(106, 7, 80), tile752 }, - { new Color(225, 93, 62), tile753 }, - { new Color(89, 24, 64), tile754 }, - { new Color(25, 79, 205), tile755 }, - { new Color(2, 83, 217), tile756 }, - { new Color(119, 228, 121), tile757 }, - { new Color(217, 127, 249), tile758 }, - { new Color(223, 98, 17), tile759 }, - { new Color(179, 136, 194), tile760 }, - { new Color(208, 109, 162), tile761 }, - { new Color(107, 29, 20), tile762 }, - { new Color(230, 144, 85), tile763 }, - { new Color(4, 152, 61), tile764 }, - { new Color(44, 175, 28), tile765 }, - { new Color(237, 66, 78), tile766 }, - { new Color(110, 191, 124), tile767 }, - { new Color(143, 211, 205), tile768 }, - { new Color(107, 153, 208), tile769 }, - { new Color(98, 139, 164), tile770 }, - { new Color(62, 46, 213), tile771 }, - { new Color(124, 137, 170), tile772 }, - { new Color(157, 173, 49), tile773 }, - { new Color(185, 27, 194), tile774 }, - { new Color(131, 115, 75), tile775 }, - { new Color(60, 172, 207), tile776 }, - { new Color(220, 242, 32), tile777 }, - { new Color(194, 69, 200), tile778 }, - { new Color(69, 64, 154), tile779 }, - { new Color(212, 0, 131), tile780 }, - { new Color(67, 132, 5), tile781 }, - { new Color(177, 197, 106), tile782 }, - { new Color(103, 176, 38), tile783 }, - { new Color(114, 79, 148), tile784 }, - { new Color(28, 181, 163), tile785 }, - { new Color(185, 12, 96), tile786 }, - { new Color(129, 47, 237), tile787 }, - { new Color(1, 133, 153), tile788 }, - { new Color(131, 123, 232), tile789 }, - { new Color(12, 54, 72), tile790 }, - { new Color(15, 200, 173), tile791 }, - { new Color(174, 117, 151), tile792 }, - { new Color(189, 210, 173), tile793 }, - { new Color(224, 212, 251), tile794 }, - { new Color(169, 106, 162), tile795 }, - { new Color(139, 166, 144), tile796 }, - { new Color(36, 139, 52), tile797 }, - { new Color(58, 83, 209), tile798 }, - { new Color(149, 66, 254), tile799 }, - { new Color(108, 45, 73), tile800 }, - { new Color(130, 90, 122), tile801 }, - { new Color(222, 98, 134), tile802 }, - { new Color(231, 110, 63), tile803 }, - { new Color(12, 252, 58), tile804 }, - { new Color(178, 160, 90), tile805 }, - { new Color(242, 88, 27), tile806 }, - { new Color(246, 247, 213), tile807 }, - { new Color(87, 232, 170), tile808 }, - { new Color(19, 213, 117), tile809 }, - { new Color(219, 24, 51), tile810 }, - { new Color(152, 81, 164), tile811 }, - { new Color(99, 94, 121), tile812 }, - { new Color(128, 202, 7), tile813 }, - { new Color(28, 164, 55), tile814 }, - { new Color(81, 24, 143), tile815 }, - { new Color(250, 135, 178), tile816 }, - { new Color(118, 163, 233), tile817 }, - { new Color(227, 117, 53), tile818 }, - { new Color(115, 43, 114), tile819 }, - { new Color(208, 202, 140), tile820 }, - { new Color(16, 11, 85), tile821 }, - { new Color(11, 115, 170), tile822 }, - { new Color(149, 79, 66), tile823 }, - { new Color(224, 113, 141), tile824 }, - { new Color(19, 218, 83), tile825 }, - { new Color(158, 6, 207), tile826 }, - { new Color(26, 25, 78), tile827 }, - { new Color(195, 101, 116), tile828 }, - { new Color(73, 180, 220), tile829 }, - { new Color(110, 240, 50), tile830 }, - { new Color(7, 176, 0), tile831 }, - { new Color(123, 11, 153), tile832 }, - { new Color(225, 70, 164), tile833 }, - { new Color(228, 100, 56), tile834 }, - { new Color(111, 150, 50), tile835 }, - { new Color(92, 208, 155), tile836 }, - { new Color(226, 213, 37), tile837 }, - { new Color(163, 181, 177), tile838 }, - { new Color(61, 76, 166), tile839 }, - { new Color(225, 193, 191), tile840 }, - { new Color(206, 38, 95), tile841 }, - { new Color(16, 217, 192), tile842 }, - { new Color(141, 151, 206), tile843 }, - { new Color(186, 188, 191), tile844 }, - { new Color(42, 54, 180), tile845 }, - { new Color(22, 84, 206), tile846 }, - { new Color(66, 237, 227), tile847 }, - { new Color(64, 140, 26), tile848 }, - { new Color(13, 100, 251), tile849 }, - { new Color(78, 61, 191), tile850 }, - { new Color(242, 0, 132), tile851 }, - { new Color(229, 21, 62), tile852 }, - { new Color(217, 95, 188), tile853 }, - { new Color(113, 207, 57), tile854 }, - { new Color(205, 40, 25), tile855 }, - { new Color(101, 120, 127), tile856 }, - { new Color(252, 39, 248), tile857 }, - { new Color(215, 158, 211), tile858 }, - { new Color(219, 141, 154), tile859 }, - { new Color(68, 2, 117), tile860 }, - { new Color(197, 62, 90), tile861 }, - { new Color(14, 199, 187), tile862 }, - { new Color(59, 68, 32), tile863 }, - { new Color(118, 61, 245), tile864 }, - { new Color(17, 208, 30), tile865 }, - { new Color(170, 115, 99), tile866 }, - { new Color(1, 168, 235), tile867 }, - { new Color(124, 82, 22), tile868 }, - { new Color(198, 27, 97), tile869 }, - { new Color(176, 10, 135), tile870 }, - { new Color(163, 148, 92), tile871 }, - { new Color(71, 171, 144), tile872 }, - { new Color(222, 190, 97), tile873 }, - { new Color(93, 41, 51), tile874 }, - { new Color(94, 134, 234), tile875 }, - { new Color(3, 197, 206), tile876 }, - { new Color(181, 48, 26), tile877 }, - { new Color(54, 67, 90), tile878 }, - { new Color(137, 73, 236), tile879 }, - { new Color(67, 71, 172), tile880 }, - { new Color(89, 138, 58), tile881 }, - { new Color(152, 210, 168), tile882 }, - { new Color(152, 201, 36), tile883 }, - { new Color(141, 203, 181), tile884 }, - { new Color(2, 163, 126), tile885 }, - { new Color(183, 29, 203), tile886 }, - { new Color(44, 195, 85), tile887 }, - { new Color(147, 250, 217), tile888 }, - { new Color(109, 109, 80), tile889 }, - { new Color(2, 189, 98), tile890 }, - { new Color(164, 154, 118), tile891 }, - { new Color(180, 4, 159), tile892 }, - { new Color(249, 198, 180), tile893 }, - { new Color(65, 107, 251), tile894 }, - { new Color(169, 40, 100), tile895 }, - { new Color(100, 51, 160), tile896 }, - { new Color(219, 210, 43), tile897 }, - { new Color(32, 23, 132), tile898 }, - { new Color(86, 197, 143), tile899 }, - { new Color(97, 42, 101), tile900 }, - { new Color(87, 149, 12), tile901 }, - { new Color(194, 232, 48), tile902 }, - { new Color(63, 77, 158), tile903 }, - { new Color(222, 189, 87), tile904 }, - { new Color(23, 234, 88), tile905 }, - { new Color(89, 234, 210), tile906 }, - { new Color(116, 9, 57), tile907 }, - { new Color(176, 38, 235), tile908 }, - { new Color(54, 132, 131), tile909 }, - { new Color(241, 94, 63), tile910 }, - { new Color(15, 152, 155), tile911 }, - { new Color(79, 233, 213), tile912 }, - { new Color(239, 231, 64), tile913 }, - { new Color(51, 37, 229), tile914 }, - { new Color(2, 252, 20), tile915 }, - { new Color(212, 8, 45), tile916 }, - { new Color(43, 253, 219), tile917 }, - { new Color(189, 236, 33), tile918 }, - { new Color(43, 167, 110), tile919 }, - { new Color(32, 139, 99), tile920 }, - { new Color(173, 77, 239), tile921 }, - { new Color(95, 207, 37), tile922 }, - { new Color(187, 200, 1), tile923 }, - { new Color(130, 105, 3), tile924 }, - { new Color(145, 65, 228), tile925 }, - { new Color(84, 173, 41), tile926 }, - { new Color(214, 97, 123), tile927 }, - { new Color(86, 198, 96), tile928 }, - { new Color(99, 81, 172), tile929 }, - { new Color(122, 35, 65), tile930 }, - { new Color(103, 206, 91), tile931 }, - { new Color(220, 134, 215), tile932 }, - { new Color(245, 162, 45), tile933 }, - { new Color(239, 24, 64), tile934 }, - { new Color(43, 168, 147), tile935 }, - { new Color(215, 43, 171), tile936 }, - { new Color(61, 215, 249), tile937 }, - { new Color(68, 74, 42), tile938 }, - { new Color(232, 87, 135), tile939 }, - { new Color(143, 251, 125), tile940 }, - { new Color(121, 65, 164), tile941 }, - { new Color(191, 27, 154), tile942 }, - { new Color(168, 181, 187), tile943 }, - { new Color(12, 94, 11), tile944 }, - { new Color(252, 231, 73), tile945 }, - { new Color(58, 42, 29), tile946 }, - { new Color(204, 139, 38), tile947 }, - { new Color(0, 60, 76), tile948 }, - { new Color(71, 34, 132), tile949 }, - { new Color(49, 244, 46), tile950 }, - { new Color(80, 102, 167), tile951 }, - { new Color(176, 117, 214), tile952 }, - { new Color(155, 107, 141), tile953 }, - { new Color(248, 47, 118), tile954 }, - { new Color(240, 48, 120), tile955 }, - { new Color(238, 72, 99), tile956 }, - { new Color(224, 173, 45), tile957 }, - { new Color(106, 194, 111), tile958 }, - { new Color(87, 120, 4), tile959 }, - { new Color(88, 120, 248), tile960 }, - { new Color(22, 118, 193), tile961 }, - { new Color(140, 188, 248), tile962 }, - { new Color(99, 76, 113), tile963 }, - { new Color(114, 159, 190), tile964 }, - { new Color(143, 212, 91), tile965 }, - { new Color(175, 16, 12), tile966 }, - { new Color(212, 88, 218), tile967 }, - { new Color(32, 80, 70), tile968 }, - { new Color(0, 230, 163), tile969 }, - { new Color(55, 88, 253), tile970 }, - { new Color(209, 67, 243), tile971 }, - { new Color(148, 226, 185), tile972 }, - { new Color(181, 99, 116), tile973 }, - { new Color(128, 138, 252), tile974 }, - { new Color(241, 110, 14), tile975 }, - { new Color(110, 218, 238), tile976 }, - { new Color(19, 168, 103), tile977 }, - { new Color(248, 132, 31), tile978 }, - { new Color(30, 245, 38), tile979 }, - { new Color(122, 139, 213), tile980 }, - { new Color(84, 44, 243), tile981 }, - { new Color(116, 160, 91), tile982 }, - { new Color(203, 251, 242), tile983 }, - { new Color(162, 249, 173), tile984 }, - { new Color(151, 83, 206), tile985 }, - { new Color(222, 46, 225), tile986 }, - { new Color(56, 145, 11), tile987 }, - { new Color(181, 35, 176), tile988 }, - { new Color(149, 217, 191), tile989 }, - { new Color(212, 117, 236), tile990 }, - { new Color(146, 59, 215), tile991 }, - { new Color(158, 43, 94), tile992 }, - { new Color(8, 125, 205), tile993 }, - { new Color(178, 163, 222), tile994 }, - { new Color(252, 113, 174), tile995 }, - { new Color(186, 97, 48), tile996 }, - { new Color(81, 64, 199), tile997 }, - { new Color(68, 65, 249), tile998 }, - { new Color(201, 158, 8), tile999 }, - { new Color(66, 223, 199), tile1000 }, - { new Color(156, 247, 133), tile1001 }, - { new Color(6, 16, 190), tile1002 }, - { new Color(213, 248, 39), tile1003 }, - { new Color(111, 213, 177), tile1004 }, - { new Color(20, 134, 238), tile1005 }, - { new Color(45, 185, 178), tile1006 }, - { new Color(2, 218, 120), tile1007 }, - { new Color(143, 130, 53), tile1008 }, - { new Color(36, 77, 249), tile1009 }, - { new Color(221, 213, 141), tile1010 }, - { new Color(85, 197, 158), tile1011 }, - { new Color(6, 22, 172), tile1012 }, - { new Color(89, 246, 96), tile1013 }, - { new Color(239, 228, 104), tile1014 }, - { new Color(8, 225, 106), tile1015 }, - { new Color(21, 48, 187), tile1016 }, - { new Color(11, 156, 229), tile1017 }, - { new Color(86, 64, 4), tile1018 }, - { new Color(79, 13, 116), tile1019 }, - { new Color(79, 225, 194), tile1020 }, - { new Color(197, 248, 35), tile1021 }, - { new Color(154, 26, 15), tile1022 }, - { new Color(19, 13, 112), tile1023 }, - { new Color(65, 211, 195), tile1024 }, - { new Color(81, 18, 245), tile1025 }, - { new Color(15, 134, 161), tile1026 }, - { new Color(202, 15, 29), tile1027 }, - { new Color(61, 209, 56), tile1028 }, - { new Color(167, 255, 133), tile1029 }, - { new Color(153, 183, 8), tile1030 }, - { new Color(56, 9, 21), tile1031 }, - { new Color(158, 42, 236), tile1032 }, - { new Color(69, 109, 199), tile1033 }, - { new Color(90, 2, 35), tile1034 }, - { new Color(75, 201, 200), tile1035 }, - { new Color(34, 5, 46), tile1036 }, - { new Color(15, 63, 134), tile1037 }, - { new Color(211, 132, 210), tile1038 }, - { new Color(165, 136, 38), tile1039 }, - { new Color(234, 243, 27), tile1040 }, - { new Color(138, 122, 85), tile1041 }, - { new Color(103, 9, 202), tile1042 }, - { new Color(174, 178, 231), tile1043 }, - { new Color(9, 202, 25), tile1044 }, - { new Color(217, 111, 12), tile1045 }, - { new Color(249, 241, 7), tile1046 }, - { new Color(111, 133, 250), tile1047 }, - { new Color(87, 138, 120), tile1048 }, - { new Color(130, 101, 132), tile1049 }, - { new Color(66, 249, 162), tile1050 }, - { new Color(197, 90, 122), tile1051 }, - { new Color(172, 208, 136), tile1052 }, - { new Color(205, 228, 192), tile1053 }, - { new Color(254, 116, 82), tile1054 }, - { new Color(70, 5, 117), tile1055 }, - { new Color(108, 249, 20), tile1056 }, - { new Color(197, 171, 150), tile1057 }, - { new Color(30, 123, 109), tile1058 }, - { new Color(33, 50, 240), tile1059 }, - { new Color(221, 228, 164), tile1060 }, - { new Color(69, 107, 185), tile1061 }, - { new Color(69, 67, 111), tile1062 }, - { new Color(158, 45, 159), tile1063 }, - { new Color(132, 44, 13), tile1064 }, - { new Color(71, 112, 17), tile1065 }, - { new Color(168, 17, 132), tile1066 }, - { new Color(2, 21, 107), tile1067 }, - { new Color(111, 125, 78), tile1068 }, - { new Color(11, 166, 223), tile1069 }, - { new Color(12, 139, 157), tile1070 }, - { new Color(152, 240, 0), tile1071 }, - { new Color(27, 184, 8), tile1072 }, - { new Color(152, 0, 194), tile1073 }, - { new Color(5, 206, 204), tile1074 }, - { new Color(117, 65, 126), tile1075 }, - { new Color(137, 215, 10), tile1076 }, - { new Color(92, 121, 33), tile1077 }, - { new Color(107, 218, 206), tile1078 }, - { new Color(56, 214, 237), tile1079 }, - { new Color(106, 57, 156), tile1080 }, - { new Color(144, 146, 161), tile1081 }, - { new Color(1, 235, 59), tile1082 }, - { new Color(13, 43, 183), tile1083 }, - { new Color(8, 15, 16), tile1084 }, - { new Color(194, 252, 71), tile1085 }, - { new Color(159, 249, 60), tile1086 }, - { new Color(207, 130, 207), tile1087 }, - { new Color(213, 176, 18), tile1088 }, - { new Color(123, 44, 22), tile1089 }, - { new Color(49, 227, 226), tile1090 }, - { new Color(27, 45, 199), tile1091 }, - { new Color(37, 117, 59), tile1092 }, - { new Color(42, 116, 85), tile1093 }, - { new Color(67, 124, 172), tile1094 }, - { new Color(82, 84, 105), tile1095 }, - { new Color(17, 169, 221), tile1096 }, - { new Color(134, 153, 220), tile1097 }, - { new Color(177, 155, 182), tile1098 }, - { new Color(205, 186, 226), tile1099 }, - { new Color(143, 133, 190), tile1100 }, - { new Color(37, 219, 72), tile1101 }, - { new Color(213, 237, 225), tile1102 }, - { new Color(73, 156, 134), tile1103 }, - { new Color(11, 116, 133), tile1104 }, - { new Color(230, 139, 6), tile1105 }, - { new Color(35, 130, 91), tile1106 }, - { new Color(168, 106, 131), tile1107 }, - { new Color(56, 171, 73), tile1108 }, - { new Color(5, 105, 146), tile1109 }, - { new Color(16, 87, 186), tile1110 }, - { new Color(89, 155, 238), tile1111 }, - { new Color(150, 30, 160), tile1112 }, - { new Color(99, 125, 103), tile1113 }, - { new Color(135, 200, 12), tile1114 }, - { new Color(86, 122, 37), tile1115 }, - { new Color(87, 203, 15), tile1116 }, - { new Color(176, 170, 56), tile1117 }, - { new Color(134, 230, 27), tile1118 }, - { new Color(59, 236, 48), tile1119 }, - { new Color(255, 207, 131), tile1120 }, - { new Color(79, 56, 69), tile1121 }, - { new Color(203, 178, 216), tile1122 }, - { new Color(151, 79, 109), tile1123 }, - { new Color(101, 191, 5), tile1124 }, - { new Color(244, 33, 162), tile1125 }, - { new Color(118, 225, 48), tile1126 }, - { new Color(35, 174, 158), tile1127 }, - { new Color(130, 95, 173), tile1128 }, - { new Color(130, 211, 181), tile1129 }, - { new Color(211, 91, 49), tile1130 }, - { new Color(112, 100, 173), tile1131 }, - { new Color(227, 55, 143), tile1132 }, - { new Color(199, 138, 200), tile1133 }, - { new Color(77, 192, 124), tile1134 }, - { new Color(161, 74, 234), tile1135 }, - { new Color(50, 146, 197), tile1136 }, - { new Color(121, 197, 10), tile1137 }, - { new Color(0, 219, 32), tile1138 }, - { new Color(229, 205, 217), tile1139 }, - { new Color(151, 73, 222), tile1140 }, - { new Color(35, 195, 244), tile1141 }, - { new Color(59, 245, 91), tile1142 }, - { new Color(88, 16, 233), tile1143 }, - { new Color(18, 175, 86), tile1144 }, - { new Color(103, 213, 238), tile1145 }, - { new Color(34, 224, 21), tile1146 }, - { new Color(195, 79, 65), tile1147 }, - { new Color(240, 90, 149), tile1148 }, - { new Color(39, 112, 136), tile1149 }, - { new Color(141, 254, 106), tile1150 }, - { new Color(182, 47, 65), tile1151 }, - { new Color(233, 42, 252), tile1152 }, - { new Color(136, 102, 85), tile1153 }, - { new Color(142, 218, 129), tile1154 }, - { new Color(219, 102, 22), tile1155 }, - { new Color(179, 152, 6), tile1156 }, - { new Color(49, 195, 236), tile1157 }, - { new Color(195, 211, 249), tile1158 }, - { new Color(157, 50, 105), tile1159 }, - { new Color(94, 20, 132), tile1160 }, - { new Color(211, 203, 17), tile1161 }, - { new Color(126, 92, 127), tile1162 }, - { new Color(21, 125, 171), tile1163 }, - { new Color(242, 153, 122), tile1164 }, - { new Color(191, 52, 117), tile1165 }, - { new Color(191, 20, 243), tile1166 }, - { new Color(127, 115, 215), tile1167 }, - { new Color(130, 91, 59), tile1168 }, - { new Color(126, 242, 92), tile1169 }, - { new Color(72, 76, 247), tile1170 }, - { new Color(146, 41, 81), tile1171 }, - { new Color(208, 187, 15), tile1172 }, - { new Color(112, 93, 10), tile1173 }, - { new Color(150, 158, 27), tile1174 }, - { new Color(90, 63, 41), tile1175 }, - { new Color(113, 4, 159), tile1176 }, - { new Color(132, 222, 30), tile1177 }, - { new Color(118, 222, 160), tile1178 }, - { new Color(172, 80, 111), tile1179 }, - { new Color(214, 0, 105), tile1180 }, - { new Color(35, 205, 49), tile1181 }, - { new Color(180, 95, 112), tile1182 }, - { new Color(40, 238, 121), tile1183 }, - { new Color(101, 79, 182), tile1184 }, - { new Color(233, 232, 213), tile1185 }, - { new Color(188, 40, 27), tile1186 }, - { new Color(18, 12, 238), tile1187 }, - { new Color(188, 196, 110), tile1188 }, - { new Color(216, 28, 75), tile1189 }, - { new Color(177, 35, 106), tile1190 }, - { new Color(159, 154, 93), tile1191 }, - { new Color(160, 115, 209), tile1192 }, - { new Color(233, 165, 223), tile1193 }, - { new Color(185, 73, 21), tile1194 }, - { new Color(38, 30, 142), tile1195 }, - { new Color(103, 140, 245), tile1196 }, - { new Color(203, 240, 40), tile1197 }, - { new Color(83, 195, 243), tile1198 }, - { new Color(123, 102, 9), tile1199 }, - { new Color(194, 220, 67), tile1200 }, - { new Color(36, 119, 202), tile1201 }, - { new Color(14, 197, 181), tile1202 }, - { new Color(89, 73, 116), tile1203 }, - { new Color(4, 210, 130), tile1204 }, - { new Color(60, 89, 195), tile1205 }, - { new Color(216, 150, 165), tile1206 }, - { new Color(223, 112, 143), tile1207 }, - { new Color(85, 229, 51), tile1208 }, - { new Color(66, 76, 214), tile1209 }, - { new Color(106, 36, 13), tile1210 }, - { new Color(200, 39, 201), tile1211 }, - { new Color(155, 148, 209), tile1212 }, - { new Color(74, 24, 89), tile1213 }, - { new Color(217, 14, 67), tile1214 }, - { new Color(128, 199, 29), tile1215 }, - { new Color(166, 23, 106), tile1216 }, - { new Color(47, 163, 207), tile1217 }, - { new Color(99, 227, 107), tile1218 }, - { new Color(179, 206, 146), tile1219 }, - { new Color(151, 203, 121), tile1220 }, - { new Color(222, 239, 37), tile1221 }, - { new Color(103, 60, 171), tile1222 }, - { new Color(184, 160, 196), tile1223 }, - { new Color(242, 141, 126), tile1224 }, - { new Color(76, 5, 98), tile1225 }, - { new Color(76, 212, 30), tile1226 }, - { new Color(22, 156, 52), tile1227 }, - { new Color(107, 58, 128), tile1228 }, - { new Color(61, 100, 68), tile1229 }, - { new Color(94, 232, 197), tile1230 }, - { new Color(63, 179, 76), tile1231 }, - { new Color(223, 251, 30), tile1232 }, - { new Color(30, 25, 139), tile1233 }, - { new Color(113, 237, 118), tile1234 }, - { new Color(165, 61, 21), tile1235 }, - { new Color(81, 23, 221), tile1236 }, - { new Color(8, 103, 249), tile1237 }, - { new Color(115, 128, 47), tile1238 }, - { new Color(68, 114, 181), tile1239 }, - { new Color(164, 41, 215), tile1240 }, - { new Color(103, 90, 184), tile1241 }, - { new Color(255, 178, 218), tile1242 }, - { new Color(50, 108, 10), tile1243 }, - { new Color(67, 46, 187), tile1244 }, - { new Color(147, 164, 175), tile1245 }, - { new Color(189, 197, 252), tile1246 }, - { new Color(106, 236, 76), tile1247 }, - { new Color(102, 85, 129), tile1248 }, - { new Color(203, 203, 50), tile1249 }, - { new Color(28, 154, 136), tile1250 }, - { new Color(105, 121, 239), tile1251 }, - { new Color(179, 10, 146), tile1252 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/HellLaboratorySchematic.png b/Schematics/AutoGeneratedContent/HellLaboratorySchematic.png deleted file mode 100644 index 3b422123ef..0000000000 Binary files a/Schematics/AutoGeneratedContent/HellLaboratorySchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs deleted file mode 100644 index 8d459e4a2e..0000000000 --- a/Schematics/AutoGeneratedContent/IceLaboratorySchematic.cs +++ /dev/null @@ -1,2055 +0,0 @@ -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Walls.DraedonStructures; -using CalamityMod.Tiles.Plates; -using CalamityMod.Walls; -using CalamityMod.Tiles.SunkenSea; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class IceLaboratorySchematic - { - // This is horrible. I am sorry. - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 16416).UseFrame(0, 72); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 16416).UseFrame(72, 72); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 72); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 54); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 72); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 72); - var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 72); - var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); - var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 72); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile23 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 54); - var tile26 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile29 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile30 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile32 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 54); - var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile39 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile40 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 72); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 72); - var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile45 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile47 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(198, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile55 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(198, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 4, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile67 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 66, 0, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile68 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile69 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile72 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile73 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile74 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile76 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile78 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile79 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile80 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile81 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile82 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile83 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile84 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile85 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile87 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 136, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile88 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 11, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile89 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile90 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile91 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile94 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 71, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile95 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 139, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile96 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile97 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile99 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 4, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile103 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile109 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile110 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile111 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile112 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile114 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile115 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile116 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile120 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile121 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile122 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile123 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); - var tile127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile128 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile129 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile134 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile135 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile136 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile137 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile138 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile146 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile147 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile148 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); - var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile152 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile153 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile155 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile156 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile158 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile159 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile160 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile161 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile162 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile163 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile164 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile165 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile166 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile168 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile170 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile174 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile175 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile177 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile178 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile179 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile180 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile181 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile182 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile183 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile184 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile186 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 138, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile187 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile188 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile191 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile192 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 68, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile193 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile194 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile195 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile197 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 4, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile199 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile200 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0); - var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 18); - var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 18); - var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile215 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 108, 36); - var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile219 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile221 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile226 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile227 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 288, 36); - var tile228 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)WallID.SnowWallUnsafe, 396, 0); - var tile229 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 36, 36); - var tile230 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 396, 72); - var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile232 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 1, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile233 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 10, 0, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile234 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 2, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile240 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 3, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile245 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile246 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile247 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile249 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile250 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 66, 1, 32).UseFrame(54, 630).UseWall((ushort)WallID.IceUnsafe, 72, 36); - var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile255 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 0); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 36); - var tile262 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile263 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 136, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile264 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)WallID.IceUnsafe, 252, 72); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile268 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)WallID.SnowWallUnsafe, 216, 72); - var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile273 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 54); - var tile277 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile279 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile281 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile282 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile284 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile285 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)WallID.IceUnsafe, 72, 36); - var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SnowWallUnsafe, 108, 36); - var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 36).UseWall((ushort)WallID.IceUnsafe, 396, 72); - var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 4, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile295 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(270, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile296 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile297 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile298 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile299 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile300 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile301 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 0); - var tile303 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)WallID.IceUnsafe, 360, 72); - var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 0).UseWall((ushort)WallID.SnowWallUnsafe, 36, 36); - var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 36).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile312 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile315 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile316 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile317 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 131, 0, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile318 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 72, 36); - var tile319 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 6, 2, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 216, 72); - var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile323 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile326 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile328 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile330 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile332 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile333 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)WallID.IceUnsafe, 396, 0); - var tile334 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)WallID.IceUnsafe, 252, 36); - var tile335 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)WallID.IceUnsafe, 396, 36); - var tile336 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)WallID.IceUnsafe, 216, 36); - var tile337 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 131, 1, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile338 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 396, 36); - var tile339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile340 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile342 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile343 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile349 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile350 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile351 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile352 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)WallID.IceUnsafe, 360, 36); - var tile353 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)WallID.IceUnsafe, 360, 0); - var tile354 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 66, 1, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 72, 36); - var tile355 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 360, 72); - var tile356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile358 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile359 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile360 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(252, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile363 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile364 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile365 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile366 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile367 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile368 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile369 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)WallID.IceUnsafe, 288, 72); - var tile370 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 131, 1, 32).UseFrame(36, 180).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile371 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 66, 1, 32).UseFrame(36, 198).UseWall((ushort)WallID.IceUnsafe, 72, 36); - var tile372 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile373 = new TileDefinitionStructure(TileID.Candles).UseHeaders(0, 6, 1, 32).UseFrame(0, 154).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile375 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile376 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile377 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile378 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile379 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile380 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile381 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile382 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 54); - var tile383 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile384 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile385 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile389 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile390 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile391 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile392 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile393 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 1, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile394 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile395 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 136, 1, 32).UseFrame(54, 180).UseWall((ushort)WallID.IceUnsafe, 288, 36); - var tile396 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 139, 2, 32).UseFrame(54, 198).UseWall((ushort)WallID.IceUnsafe, 396, 72); - var tile397 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile399 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile400 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile401 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile402 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile403 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile404 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile405 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile406 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile407 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile408 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile409 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile410 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 0, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile411 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 37, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile412 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile413 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile414 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile415 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile416 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile417 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 85, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile418 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 3, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 252, 108); - var tile419 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 67, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile420 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile421 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile422 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 1, 1, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile423 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile424 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile425 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile426 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile427 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile428 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile429 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile430 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile431 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile432 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile433 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile434 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile435 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 3, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile436 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile437 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile438 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile439 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile440 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile441 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile442 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile443 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile444 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile445 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile446 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile447 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 89, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 324, 36); - var tile448 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile449 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile450 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)WallID.IceUnsafe, 216, 72); - var tile451 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 131, 1, 32).UseFrame(0, 144).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile452 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 1, 1, 32).UseFrame(0, 162).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile453 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 71, 2, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 252, 72); - var tile454 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile455 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile456 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile457 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile458 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile459 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile460 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile461 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile462 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile463 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile464 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile465 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile466 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile467 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile468 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile469 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile470 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile471 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile472 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile473 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile474 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile475 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile476 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile477 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile478 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile479 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile480 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile481 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile482 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 252, 36); - var tile483 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 6, 1, 32).UseFrame(18, 144).UseWall((ushort)WallID.IceUnsafe, 216, 36); - var tile484 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 11, 0, 32).UseFrame(18, 162).UseWall((ushort)WallID.IceUnsafe, 396, 0); - var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile487 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile488 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile489 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile490 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile491 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile492 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile493 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile494 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 36); - var tile495 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 0); - var tile496 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile497 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile500 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile501 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile502 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile503 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile504 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile505 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile506 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile507 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile508 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile509 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 18); - var tile511 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)WallID.SnowWallUnsafe, 360, 0); - var tile512 = new TileDefinitionStructure(TileID.Torches).UseHeaders(0, 1, 1, 32).UseFrame(0, 198).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(306, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile516 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile517 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile518 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile519 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile520 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile521 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 4, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile522 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 54); - var tile523 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile524 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile525 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile526 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile527 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile528 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile529 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile530 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile531 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile532 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile533 = new TileDefinitionStructure(TileID.Platforms).UseHeaders(0, 136, 2, 32).UseFrame(0, 630).UseWall((ushort)WallID.IceUnsafe, 288, 72); - var tile534 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 216, 72); - var tile535 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile536 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile537 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile538 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile539 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile540 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile541 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile542 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile543 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 64).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile544 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 80).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile545 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 96).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile546 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile547 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile548 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile549 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile550 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile551 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile552 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile553 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile554 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile555 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile556 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile557 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile558 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile559 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile560 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile561 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile562 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile563 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile564 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile565 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 216, 36); - var tile566 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)WallID.IceUnsafe, 396, 72); - var tile567 = new TileDefinitionStructure(TileID.Containers).UseHeaders(0, 6, 1, 32).UseFrame(792, 0).UseWall((ushort)WallID.IceUnsafe, 216, 36); - var tile568 = new TileDefinitionStructure(TileID.Containers).UseHeaders(0, 11, 0, 32).UseFrame(792, 18).UseWall((ushort)WallID.IceUnsafe, 396, 0); - var tile569 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)WallID.IceUnsafe, 288, 36); - var tile570 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile571 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile572 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile573 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile574 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile575 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile576 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(16, 64).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile577 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile578 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 96).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile579 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile580 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile581 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile582 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile583 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile584 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile585 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile586 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile587 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile588 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 74, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile589 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 138, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile590 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile591 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile592 = new TileDefinitionStructure(TileID.Containers).UseHeaders(0, 74, 1, 32).UseFrame(810, 0).UseWall((ushort)WallID.IceUnsafe, 360, 36); - var tile593 = new TileDefinitionStructure(TileID.Containers).UseHeaders(0, 1, 1, 32).UseFrame(810, 18).UseWall((ushort)WallID.IceUnsafe, 36, 36); - var tile594 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile595 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile596 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile597 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile598 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile599 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile600 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile601 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile602 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile603 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 64).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile604 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile605 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(32, 96).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile606 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile607 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile608 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile609 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile610 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile611 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile612 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile613 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile614 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile615 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile616 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile617 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile618 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile619 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile620 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile621 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 252, 72); - var tile622 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile623 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile624 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile625 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile626 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile627 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile628 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile629 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile630 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile631 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile632 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(48, 64).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile633 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(48, 80).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile634 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 96).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile635 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile636 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile637 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile638 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile639 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile640 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile641 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile642 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile643 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile644 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile645 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile646 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile647 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile648 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 66, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile649 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile650 = new TileDefinitionStructure(TileID.Torches).UseHeaders(0, 139, 2, 32).UseFrame(0, 198).UseWall((ushort)WallID.IceUnsafe, 396, 72); - var tile651 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 72, 72); - var tile652 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54); - var tile653 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile654 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile655 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile656 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile657 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile658 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile659 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(64, 16).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile660 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile661 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(64, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile662 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(64, 64).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile663 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(64, 80).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile664 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(64, 96).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile665 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile666 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile667 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile668 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile669 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile670 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile671 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile672 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile673 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 4, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile674 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); - var tile675 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile676 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile677 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile678 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(80, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile679 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(80, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile680 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile681 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(80, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile682 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 64).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile683 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile684 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(80, 96).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile685 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile686 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile687 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile688 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile689 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile690 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile691 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)WallID.IceUnsafe, 108, 36); - var tile692 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 4, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile693 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); - var tile694 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); - var tile695 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile696 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile697 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile698 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile699 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile700 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile701 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile702 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile703 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile704 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile705 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile706 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile707 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile708 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile709 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile710 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile711 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile712 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile713 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(288, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile714 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile715 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile716 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile717 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile718 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile719 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 54); - var tile720 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile721 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile722 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 3, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile723 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile724 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile725 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile726 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile727 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile728 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile729 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile730 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile731 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)WallID.SnowWallUnsafe, 360, 36); - var tile732 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 4, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile733 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile734 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile735 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile736 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile737 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile738 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile739 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 136, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile740 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile741 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile742 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile743 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile744 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 36); - var tile745 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 0); - var tile746 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile747 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile748 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile749 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile750 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile751 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile752 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile753 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile754 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile755 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile756 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 18); - var tile757 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 1, 0, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile758 = new TileDefinitionStructure(TileID.Torches).UseHeaders(0, 66, 1, 32).UseFrame(0, 198).UseWall((ushort)WallID.IceUnsafe, 72, 36); - var tile759 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile760 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile761 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile762 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile763 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile764 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile765 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile766 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile767 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile768 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile769 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile770 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile771 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile772 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile773 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile774 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile775 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile776 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile777 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 136, 1, 32).UseFrame(72, 216).UseWall((ushort)WallID.IceUnsafe, 288, 36); - var tile778 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 139, 2, 32).UseFrame(72, 234).UseWall((ushort)WallID.IceUnsafe, 396, 72); - var tile779 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile780 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 12320).UseFrame(54, 72); - var tile781 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile782 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile783 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile784 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile785 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile786 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile787 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile788 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile789 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile790 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile791 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile792 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile793 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile794 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile795 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile796 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile797 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile798 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile799 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile800 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile801 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile802 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile803 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile804 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile805 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile806 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0); - var tile807 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile808 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile809 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile810 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile811 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 138, 2, 32).UseFrame(90, 216).UseWall((ushort)WallID.IceUnsafe, 360, 72); - var tile812 = new TileDefinitionStructure(TileID.Pots).UseHeaders(0, 66, 1, 32).UseFrame(90, 234).UseWall((ushort)WallID.IceUnsafe, 72, 36); - var tile813 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile814 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile815 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile816 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile817 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile818 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile819 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile820 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile821 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile822 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile823 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile824 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile825 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 2, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile826 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile827 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile828 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile829 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)WallID.SnowWallUnsafe, 288, 72); - var tile830 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile831 = new TileDefinitionStructure(TileID.Candles).UseHeaders(0, 136, 1, 32).UseFrame(0, 154).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile832 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile833 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile834 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile835 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile836 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile837 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile838 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile839 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile840 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile841 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile842 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile843 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile844 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile845 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile846 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile847 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile848 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile849 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile850 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile851 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(270, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile852 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile853 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile854 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 4, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile855 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); - var tile856 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile857 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile858 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile859 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile860 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile861 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile862 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile863 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile864 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)WallID.SnowWallUnsafe, 288, 72); - var tile865 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile866 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile867 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile868 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile869 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile870 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile871 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile872 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile873 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile874 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)WallID.SnowWallUnsafe, 36, 36); - var tile875 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile876 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile877 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile878 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile879 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile880 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile881 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile882 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile883 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile884 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile885 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(252, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile886 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile887 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 68, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile888 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile889 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile890 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile891 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile892 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile893 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 54); - var tile894 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile895 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile896 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile897 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile898 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile899 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile900 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 36).UseWall((ushort)WallID.SnowWallUnsafe, 396, 0); - var tile901 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)WallID.SnowWallUnsafe, 108, 36); - var tile902 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 4, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile903 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile904 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile905 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile906 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile907 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile908 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile909 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile910 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile911 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 6, 2, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile912 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 1, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile913 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 2, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile914 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile915 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile916 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile917 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile918 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile919 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile920 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile921 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile922 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile923 = new TileDefinitionStructure(TileID.Stalactite).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile924 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile925 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile926 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile927 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile928 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile929 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile930 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile931 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile932 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile933 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile934 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile935 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 4, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile936 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile937 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile938 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile939 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile940 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 18); - var tile941 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile942 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile943 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile944 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile945 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 18); - var tile946 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile947 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile948 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile949 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile950 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile951 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile952 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile953 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile954 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile955 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile956 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile957 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile958 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile959 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile960 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 128, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile961 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile962 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile963 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile964 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile965 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile966 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile967 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile968 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile969 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile970 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile971 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile972 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile973 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile974 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile975 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile976 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile977 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile978 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile979 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile980 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile981 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile982 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile983 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile984 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile985 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile986 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile987 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile988 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile989 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile990 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile991 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile992 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile993 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile994 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile995 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile996 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile997 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(180, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile998 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile999 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1000 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1001 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1002 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1003 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1004 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1005 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1006 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1007 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1008 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1009 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile1010 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile1011 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 72); - var tile1012 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 54); - var tile1013 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 72); - var tile1014 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(93, 15, 243), tile2 }, - { new Color(106, 103, 216), tile3 }, - { new Color(212, 204, 194), tile4 }, - { new Color(182, 154, 28), tile5 }, - { new Color(103, 158, 19), tile6 }, - { new Color(60, 102, 223), tile7 }, - { new Color(43, 100, 106), tile8 }, - { new Color(14, 74, 157), tile9 }, - { new Color(238, 90, 197), tile10 }, - { new Color(61, 31, 160), tile11 }, - { new Color(192, 71, 167), tile12 }, - { new Color(14, 6, 7), tile13 }, - { new Color(203, 212, 80), tile14 }, - { new Color(118, 104, 182), tile15 }, - { new Color(121, 89, 205), tile16 }, - { new Color(90, 54, 158), tile17 }, - { new Color(188, 153, 132), tile18 }, - { new Color(166, 127, 49), tile19 }, - { new Color(133, 79, 196), tile20 }, - { new Color(86, 123, 12), tile21 }, - { new Color(18, 151, 173), tile22 }, - { new Color(33, 246, 83), tile23 }, - { new Color(117, 89, 151), tile24 }, - { new Color(11, 113, 146), tile25 }, - { new Color(142, 180, 252), tile26 }, - { new Color(180, 148, 241), tile27 }, - { new Color(207, 148, 36), tile28 }, - { new Color(39, 128, 133), tile29 }, - { new Color(27, 25, 199), tile30 }, - { new Color(118, 136, 182), tile31 }, - { new Color(66, 117, 88), tile32 }, - { new Color(68, 99, 208), tile33 }, - { new Color(8, 88, 99), tile34 }, - { new Color(121, 228, 221), tile35 }, - { new Color(6, 176, 39), tile36 }, - { new Color(242, 23, 202), tile37 }, - { new Color(52, 208, 186), tile38 }, - { new Color(211, 134, 231), tile39 }, - { new Color(231, 234, 22), tile40 }, - { new Color(39, 5, 220), tile41 }, - { new Color(139, 255, 208), tile42 }, - { new Color(224, 200, 252), tile43 }, - { new Color(58, 74, 81), tile44 }, - { new Color(43, 172, 60), tile45 }, - { new Color(142, 86, 175), tile46 }, - { new Color(71, 33, 208), tile47 }, - { new Color(94, 41, 1), tile48 }, - { new Color(252, 65, 184), tile49 }, - { new Color(252, 111, 238), tile50 }, - { new Color(112, 92, 121), tile51 }, - { new Color(186, 224, 82), tile52 }, - { new Color(134, 237, 229), tile53 }, - { new Color(12, 37, 231), tile54 }, - { new Color(42, 184, 205), tile55 }, - { new Color(121, 9, 36), tile56 }, - { new Color(126, 68, 48), tile57 }, - { new Color(55, 160, 200), tile58 }, - { new Color(70, 201, 220), tile59 }, - { new Color(218, 143, 189), tile60 }, - { new Color(24, 228, 89), tile61 }, - { new Color(14, 201, 238), tile62 }, - { new Color(215, 113, 203), tile63 }, - { new Color(233, 7, 104), tile64 }, - { new Color(202, 58, 252), tile65 }, - { new Color(232, 51, 113), tile66 }, - { new Color(52, 130, 56), tile67 }, - { new Color(147, 126, 42), tile68 }, - { new Color(190, 57, 187), tile69 }, - { new Color(176, 116, 23), tile70 }, - { new Color(118, 171, 94), tile71 }, - { new Color(39, 244, 64), tile72 }, - { new Color(142, 28, 238), tile73 }, - { new Color(222, 161, 151), tile74 }, - { new Color(88, 148, 61), tile75 }, - { new Color(200, 108, 102), tile76 }, - { new Color(204, 93, 150), tile77 }, - { new Color(106, 166, 12), tile78 }, - { new Color(133, 132, 102), tile79 }, - { new Color(46, 79, 144), tile80 }, - { new Color(50, 39, 252), tile81 }, - { new Color(180, 115, 91), tile82 }, - { new Color(9, 163, 69), tile83 }, - { new Color(188, 89, 22), tile84 }, - { new Color(130, 85, 225), tile85 }, - { new Color(160, 59, 233), tile86 }, - { new Color(237, 246, 204), tile87 }, - { new Color(85, 227, 22), tile88 }, - { new Color(129, 11, 5), tile89 }, - { new Color(82, 161, 111), tile90 }, - { new Color(217, 95, 205), tile91 }, - { new Color(94, 172, 122), tile92 }, - { new Color(154, 164, 32), tile93 }, - { new Color(225, 190, 200), tile94 }, - { new Color(32, 16, 3), tile95 }, - { new Color(127, 231, 80), tile96 }, - { new Color(42, 228, 73), tile97 }, - { new Color(124, 65, 89), tile98 }, - { new Color(195, 221, 68), tile99 }, - { new Color(230, 51, 103), tile100 }, - { new Color(85, 182, 1), tile101 }, - { new Color(214, 226, 249), tile102 }, - { new Color(72, 36, 169), tile103 }, - { new Color(102, 5, 150), tile104 }, - { new Color(200, 11, 55), tile105 }, - { new Color(3, 52, 211), tile106 }, - { new Color(18, 1, 35), tile107 }, - { new Color(181, 39, 189), tile108 }, - { new Color(38, 92, 30), tile109 }, - { new Color(116, 154, 206), tile110 }, - { new Color(54, 180, 113), tile111 }, - { new Color(185, 140, 8), tile112 }, - { new Color(199, 74, 46), tile113 }, - { new Color(9, 54, 195), tile114 }, - { new Color(167, 196, 222), tile115 }, - { new Color(178, 180, 54), tile116 }, - { new Color(33, 192, 169), tile117 }, - { new Color(112, 211, 49), tile118 }, - { new Color(67, 160, 142), tile119 }, - { new Color(68, 175, 133), tile120 }, - { new Color(219, 212, 137), tile121 }, - { new Color(218, 48, 81), tile122 }, - { new Color(37, 15, 127), tile123 }, - { new Color(47, 60, 234), tile124 }, - { new Color(165, 8, 202), tile125 }, - { new Color(96, 13, 99), tile126 }, - { new Color(222, 115, 168), tile127 }, - { new Color(232, 82, 218), tile128 }, - { new Color(37, 197, 224), tile129 }, - { new Color(63, 117, 235), tile130 }, - { new Color(122, 130, 154), tile131 }, - { new Color(168, 46, 98), tile132 }, - { new Color(57, 204, 147), tile133 }, - { new Color(141, 141, 165), tile134 }, - { new Color(182, 242, 131), tile135 }, - { new Color(190, 203, 203), tile136 }, - { new Color(103, 227, 147), tile137 }, - { new Color(42, 102, 60), tile138 }, - { new Color(220, 242, 129), tile139 }, - { new Color(175, 181, 107), tile140 }, - { new Color(113, 230, 153), tile141 }, - { new Color(147, 181, 186), tile142 }, - { new Color(79, 252, 218), tile143 }, - { new Color(104, 38, 65), tile144 }, - { new Color(208, 80, 230), tile145 }, - { new Color(3, 49, 96), tile146 }, - { new Color(86, 102, 250), tile147 }, - { new Color(21, 216, 146), tile148 }, - { new Color(88, 79, 28), tile149 }, - { new Color(94, 203, 59), tile150 }, - { new Color(224, 138, 22), tile151 }, - { new Color(39, 28, 167), tile152 }, - { new Color(11, 35, 61), tile153 }, - { new Color(201, 111, 206), tile154 }, - { new Color(240, 255, 188), tile155 }, - { new Color(81, 90, 21), tile156 }, - { new Color(85, 217, 192), tile157 }, - { new Color(32, 89, 79), tile158 }, - { new Color(112, 91, 13), tile159 }, - { new Color(6, 59, 101), tile160 }, - { new Color(157, 241, 49), tile161 }, - { new Color(158, 135, 156), tile162 }, - { new Color(42, 168, 52), tile163 }, - { new Color(63, 247, 14), tile164 }, - { new Color(35, 140, 247), tile165 }, - { new Color(44, 36, 217), tile166 }, - { new Color(214, 6, 245), tile167 }, - { new Color(6, 8, 242), tile168 }, - { new Color(122, 191, 49), tile169 }, - { new Color(199, 182, 192), tile170 }, - { new Color(153, 5, 232), tile171 }, - { new Color(215, 43, 125), tile172 }, - { new Color(157, 82, 119), tile173 }, - { new Color(32, 39, 177), tile174 }, - { new Color(224, 22, 226), tile175 }, - { new Color(178, 253, 205), tile176 }, - { new Color(87, 68, 55), tile177 }, - { new Color(52, 48, 52), tile178 }, - { new Color(112, 151, 233), tile179 }, - { new Color(62, 35, 199), tile180 }, - { new Color(107, 98, 241), tile181 }, - { new Color(116, 165, 241), tile182 }, - { new Color(38, 75, 96), tile183 }, - { new Color(121, 143, 209), tile184 }, - { new Color(97, 181, 222), tile185 }, - { new Color(68, 37, 241), tile186 }, - { new Color(15, 200, 193), tile187 }, - { new Color(99, 111, 113), tile188 }, - { new Color(136, 100, 213), tile189 }, - { new Color(179, 103, 148), tile190 }, - { new Color(148, 94, 47), tile191 }, - { new Color(175, 181, 196), tile192 }, - { new Color(191, 108, 112), tile193 }, - { new Color(240, 140, 178), tile194 }, - { new Color(108, 221, 181), tile195 }, - { new Color(101, 211, 122), tile196 }, - { new Color(85, 43, 113), tile197 }, - { new Color(247, 47, 91), tile198 }, - { new Color(5, 7, 242), tile199 }, - { new Color(127, 235, 65), tile200 }, - { new Color(28, 114, 227), tile201 }, - { new Color(203, 229, 48), tile202 }, - { new Color(162, 177, 0), tile203 }, - { new Color(26, 132, 185), tile204 }, - { new Color(128, 31, 60), tile205 }, - { new Color(15, 247, 145), tile206 }, - { new Color(188, 35, 144), tile207 }, - { new Color(91, 93, 59), tile208 }, - { new Color(35, 157, 47), tile209 }, - { new Color(212, 170, 173), tile210 }, - { new Color(210, 63, 129), tile211 }, - { new Color(47, 211, 25), tile212 }, - { new Color(206, 161, 248), tile213 }, - { new Color(132, 195, 34), tile214 }, - { new Color(121, 59, 167), tile215 }, - { new Color(184, 118, 15), tile216 }, - { new Color(30, 246, 15), tile217 }, - { new Color(96, 195, 200), tile218 }, - { new Color(176, 193, 21), tile219 }, - { new Color(168, 168, 72), tile220 }, - { new Color(1, 206, 7), tile221 }, - { new Color(83, 72, 69), tile222 }, - { new Color(55, 81, 76), tile223 }, - { new Color(34, 65, 86), tile224 }, - { new Color(153, 55, 95), tile225 }, - { new Color(110, 225, 34), tile226 }, - { new Color(148, 106, 38), tile227 }, - { new Color(31, 181, 179), tile228 }, - { new Color(157, 113, 123), tile229 }, - { new Color(185, 127, 18), tile230 }, - { new Color(4, 38, 248), tile231 }, - { new Color(175, 131, 244), tile232 }, - { new Color(26, 38, 243), tile233 }, - { new Color(97, 128, 36), tile234 }, - { new Color(195, 252, 181), tile235 }, - { new Color(185, 199, 140), tile236 }, - { new Color(104, 65, 223), tile237 }, - { new Color(242, 19, 61), tile238 }, - { new Color(33, 226, 25), tile239 }, - { new Color(83, 181, 214), tile240 }, - { new Color(201, 126, 210), tile241 }, - { new Color(57, 30, 26), tile242 }, - { new Color(93, 233, 180), tile243 }, - { new Color(107, 84, 187), tile244 }, - { new Color(46, 50, 234), tile245 }, - { new Color(1, 92, 185), tile246 }, - { new Color(254, 228, 169), tile247 }, - { new Color(238, 80, 61), tile248 }, - { new Color(50, 17, 19), tile249 }, - { new Color(187, 141, 160), tile250 }, - { new Color(218, 199, 112), tile251 }, - { new Color(28, 151, 1), tile252 }, - { new Color(82, 137, 221), tile253 }, - { new Color(154, 92, 221), tile254 }, - { new Color(216, 252, 237), tile255 }, - { new Color(36, 196, 224), tile256 }, - { new Color(82, 32, 133), tile257 }, - { new Color(96, 84, 209), tile258 }, - { new Color(44, 218, 45), tile259 }, - { new Color(148, 7, 13), tile260 }, - { new Color(7, 162, 91), tile261 }, - { new Color(19, 144, 140), tile262 }, - { new Color(74, 17, 155), tile263 }, - { new Color(232, 175, 211), tile264 }, - { new Color(219, 100, 135), tile265 }, - { new Color(204, 22, 84), tile266 }, - { new Color(80, 13, 77), tile267 }, - { new Color(50, 104, 109), tile268 }, - { new Color(27, 122, 114), tile269 }, - { new Color(159, 239, 188), tile270 }, - { new Color(211, 189, 129), tile271 }, - { new Color(208, 147, 185), tile272 }, - { new Color(129, 197, 108), tile273 }, - { new Color(96, 217, 178), tile274 }, - { new Color(69, 106, 112), tile275 }, - { new Color(178, 132, 240), tile276 }, - { new Color(73, 96, 196), tile277 }, - { new Color(217, 68, 249), tile278 }, - { new Color(191, 212, 58), tile279 }, - { new Color(238, 248, 22), tile280 }, - { new Color(26, 171, 33), tile281 }, - { new Color(222, 20, 241), tile282 }, - { new Color(81, 10, 208), tile283 }, - { new Color(206, 74, 80), tile284 }, - { new Color(231, 240, 52), tile285 }, - { new Color(154, 237, 253), tile286 }, - { new Color(253, 104, 245), tile287 }, - { new Color(130, 86, 143), tile288 }, - { new Color(248, 250, 121), tile289 }, - { new Color(135, 16, 190), tile290 }, - { new Color(126, 147, 205), tile291 }, - { new Color(85, 69, 46), tile292 }, - { new Color(144, 103, 85), tile293 }, - { new Color(126, 97, 121), tile294 }, - { new Color(31, 122, 21), tile295 }, - { new Color(115, 241, 84), tile296 }, - { new Color(197, 37, 231), tile297 }, - { new Color(60, 240, 143), tile298 }, - { new Color(32, 152, 85), tile299 }, - { new Color(146, 230, 26), tile300 }, - { new Color(120, 201, 250), tile301 }, - { new Color(18, 79, 183), tile302 }, - { new Color(131, 146, 170), tile303 }, - { new Color(6, 9, 134), tile304 }, - { new Color(168, 126, 6), tile305 }, - { new Color(123, 98, 219), tile306 }, - { new Color(122, 132, 8), tile307 }, - { new Color(37, 194, 235), tile308 }, - { new Color(215, 65, 162), tile309 }, - { new Color(61, 53, 173), tile310 }, - { new Color(216, 254, 128), tile311 }, - { new Color(58, 6, 151), tile312 }, - { new Color(127, 13, 42), tile313 }, - { new Color(94, 239, 95), tile314 }, - { new Color(169, 191, 27), tile315 }, - { new Color(97, 147, 114), tile316 }, - { new Color(136, 164, 53), tile317 }, - { new Color(121, 24, 97), tile318 }, - { new Color(18, 83, 7), tile319 }, - { new Color(15, 58, 13), tile320 }, - { new Color(20, 70, 92), tile321 }, - { new Color(252, 45, 11), tile322 }, - { new Color(5, 110, 119), tile323 }, - { new Color(111, 251, 84), tile324 }, - { new Color(176, 28, 148), tile325 }, - { new Color(168, 123, 2), tile326 }, - { new Color(207, 118, 173), tile327 }, - { new Color(47, 180, 144), tile328 }, - { new Color(120, 95, 230), tile329 }, - { new Color(31, 39, 179), tile330 }, - { new Color(143, 112, 210), tile331 }, - { new Color(28, 73, 169), tile332 }, - { new Color(3, 173, 145), tile333 }, - { new Color(16, 91, 37), tile334 }, - { new Color(250, 25, 168), tile335 }, - { new Color(224, 201, 252), tile336 }, - { new Color(205, 106, 215), tile337 }, - { new Color(4, 63, 196), tile338 }, - { new Color(96, 229, 145), tile339 }, - { new Color(203, 132, 206), tile340 }, - { new Color(37, 230, 70), tile341 }, - { new Color(196, 223, 139), tile342 }, - { new Color(130, 147, 210), tile343 }, - { new Color(234, 165, 206), tile344 }, - { new Color(112, 190, 26), tile345 }, - { new Color(136, 53, 155), tile346 }, - { new Color(231, 152, 149), tile347 }, - { new Color(233, 81, 189), tile348 }, - { new Color(219, 139, 49), tile349 }, - { new Color(14, 188, 100), tile350 }, - { new Color(24, 55, 41), tile351 }, - { new Color(195, 235, 117), tile352 }, - { new Color(222, 53, 57), tile353 }, - { new Color(29, 94, 53), tile354 }, - { new Color(41, 226, 197), tile355 }, - { new Color(9, 147, 128), tile356 }, - { new Color(169, 215, 175), tile357 }, - { new Color(245, 228, 235), tile358 }, - { new Color(56, 59, 148), tile359 }, - { new Color(137, 233, 84), tile360 }, - { new Color(90, 115, 214), tile361 }, - { new Color(110, 209, 109), tile362 }, - { new Color(165, 173, 211), tile363 }, - { new Color(165, 170, 255), tile364 }, - { new Color(97, 201, 57), tile365 }, - { new Color(96, 192, 111), tile366 }, - { new Color(248, 210, 247), tile367 }, - { new Color(176, 100, 229), tile368 }, - { new Color(180, 34, 83), tile369 }, - { new Color(61, 139, 176), tile370 }, - { new Color(225, 84, 76), tile371 }, - { new Color(229, 195, 234), tile372 }, - { new Color(94, 186, 16), tile373 }, - { new Color(87, 99, 230), tile374 }, - { new Color(173, 4, 45), tile375 }, - { new Color(176, 148, 26), tile376 }, - { new Color(178, 216, 122), tile377 }, - { new Color(36, 145, 23), tile378 }, - { new Color(92, 169, 14), tile379 }, - { new Color(241, 186, 174), tile380 }, - { new Color(26, 104, 33), tile381 }, - { new Color(34, 196, 85), tile382 }, - { new Color(178, 123, 6), tile383 }, - { new Color(78, 1, 6), tile384 }, - { new Color(94, 160, 110), tile385 }, - { new Color(17, 2, 96), tile386 }, - { new Color(183, 3, 142), tile387 }, - { new Color(56, 138, 178), tile388 }, - { new Color(53, 188, 195), tile389 }, - { new Color(53, 137, 25), tile390 }, - { new Color(220, 108, 0), tile391 }, - { new Color(97, 60, 251), tile392 }, - { new Color(196, 138, 64), tile393 }, - { new Color(216, 253, 24), tile394 }, - { new Color(19, 99, 214), tile395 }, - { new Color(116, 198, 240), tile396 }, - { new Color(168, 75, 167), tile397 }, - { new Color(174, 58, 182), tile398 }, - { new Color(32, 225, 221), tile399 }, - { new Color(111, 236, 8), tile400 }, - { new Color(145, 125, 242), tile401 }, - { new Color(236, 114, 148), tile402 }, - { new Color(5, 252, 100), tile403 }, - { new Color(114, 76, 119), tile404 }, - { new Color(32, 223, 5), tile405 }, - { new Color(118, 36, 39), tile406 }, - { new Color(220, 193, 245), tile407 }, - { new Color(210, 140, 61), tile408 }, - { new Color(114, 45, 50), tile409 }, - { new Color(73, 65, 90), tile410 }, - { new Color(30, 85, 157), tile411 }, - { new Color(55, 70, 128), tile412 }, - { new Color(37, 39, 241), tile413 }, - { new Color(66, 110, 201), tile414 }, - { new Color(140, 54, 254), tile415 }, - { new Color(47, 141, 90), tile416 }, - { new Color(177, 169, 188), tile417 }, - { new Color(181, 146, 43), tile418 }, - { new Color(18, 191, 240), tile419 }, - { new Color(180, 122, 68), tile420 }, - { new Color(97, 188, 187), tile421 }, - { new Color(9, 83, 247), tile422 }, - { new Color(218, 232, 152), tile423 }, - { new Color(132, 80, 253), tile424 }, - { new Color(54, 153, 82), tile425 }, - { new Color(44, 70, 86), tile426 }, - { new Color(63, 67, 160), tile427 }, - { new Color(216, 151, 151), tile428 }, - { new Color(157, 104, 194), tile429 }, - { new Color(114, 37, 135), tile430 }, - { new Color(144, 113, 172), tile431 }, - { new Color(172, 224, 177), tile432 }, - { new Color(13, 130, 226), tile433 }, - { new Color(7, 85, 165), tile434 }, - { new Color(193, 44, 89), tile435 }, - { new Color(190, 127, 249), tile436 }, - { new Color(216, 230, 120), tile437 }, - { new Color(153, 117, 55), tile438 }, - { new Color(164, 137, 36), tile439 }, - { new Color(35, 108, 235), tile440 }, - { new Color(52, 103, 195), tile441 }, - { new Color(17, 244, 223), tile442 }, - { new Color(81, 137, 184), tile443 }, - { new Color(161, 30, 196), tile444 }, - { new Color(116, 55, 238), tile445 }, - { new Color(251, 22, 107), tile446 }, - { new Color(62, 222, 232), tile447 }, - { new Color(201, 153, 63), tile448 }, - { new Color(15, 246, 252), tile449 }, - { new Color(117, 8, 87), tile450 }, - { new Color(140, 234, 21), tile451 }, - { new Color(247, 210, 237), tile452 }, - { new Color(225, 176, 55), tile453 }, - { new Color(122, 109, 245), tile454 }, - { new Color(64, 55, 199), tile455 }, - { new Color(179, 37, 61), tile456 }, - { new Color(73, 169, 115), tile457 }, - { new Color(185, 229, 141), tile458 }, - { new Color(2, 107, 205), tile459 }, - { new Color(132, 2, 253), tile460 }, - { new Color(227, 220, 129), tile461 }, - { new Color(97, 20, 52), tile462 }, - { new Color(174, 125, 100), tile463 }, - { new Color(0, 25, 101), tile464 }, - { new Color(52, 196, 113), tile465 }, - { new Color(243, 136, 98), tile466 }, - { new Color(119, 91, 209), tile467 }, - { new Color(190, 44, 94), tile468 }, - { new Color(227, 211, 4), tile469 }, - { new Color(136, 244, 103), tile470 }, - { new Color(31, 92, 173), tile471 }, - { new Color(57, 150, 145), tile472 }, - { new Color(116, 222, 34), tile473 }, - { new Color(147, 4, 168), tile474 }, - { new Color(216, 72, 143), tile475 }, - { new Color(13, 133, 32), tile476 }, - { new Color(28, 15, 226), tile477 }, - { new Color(107, 13, 167), tile478 }, - { new Color(44, 36, 175), tile479 }, - { new Color(34, 126, 65), tile480 }, - { new Color(47, 38, 136), tile481 }, - { new Color(253, 225, 188), tile482 }, - { new Color(184, 250, 45), tile483 }, - { new Color(223, 127, 170), tile484 }, - { new Color(64, 228, 86), tile485 }, - { new Color(41, 229, 228), tile486 }, - { new Color(207, 214, 78), tile487 }, - { new Color(227, 107, 229), tile488 }, - { new Color(133, 179, 79), tile489 }, - { new Color(6, 13, 114), tile490 }, - { new Color(225, 81, 96), tile491 }, - { new Color(225, 99, 222), tile492 }, - { new Color(31, 219, 102), tile493 }, - { new Color(210, 85, 138), tile494 }, - { new Color(243, 60, 144), tile495 }, - { new Color(56, 43, 40), tile496 }, - { new Color(80, 3, 63), tile497 }, - { new Color(203, 83, 168), tile498 }, - { new Color(242, 75, 186), tile499 }, - { new Color(163, 119, 45), tile500 }, - { new Color(108, 177, 237), tile501 }, - { new Color(187, 253, 45), tile502 }, - { new Color(74, 94, 128), tile503 }, - { new Color(120, 9, 9), tile504 }, - { new Color(125, 252, 128), tile505 }, - { new Color(195, 240, 47), tile506 }, - { new Color(85, 77, 136), tile507 }, - { new Color(38, 182, 9), tile508 }, - { new Color(51, 21, 253), tile509 }, - { new Color(184, 238, 23), tile510 }, - { new Color(35, 124, 99), tile511 }, - { new Color(56, 102, 163), tile512 }, - { new Color(157, 56, 62), tile513 }, - { new Color(98, 237, 204), tile514 }, - { new Color(168, 215, 250), tile515 }, - { new Color(53, 78, 87), tile516 }, - { new Color(39, 47, 91), tile517 }, - { new Color(139, 77, 42), tile518 }, - { new Color(165, 69, 251), tile519 }, - { new Color(227, 136, 232), tile520 }, - { new Color(48, 146, 112), tile521 }, - { new Color(104, 85, 140), tile522 }, - { new Color(165, 68, 150), tile523 }, - { new Color(221, 38, 184), tile524 }, - { new Color(240, 243, 95), tile525 }, - { new Color(188, 126, 222), tile526 }, - { new Color(15, 253, 199), tile527 }, - { new Color(165, 144, 191), tile528 }, - { new Color(188, 152, 46), tile529 }, - { new Color(56, 147, 32), tile530 }, - { new Color(168, 186, 175), tile531 }, - { new Color(86, 49, 91), tile532 }, - { new Color(92, 63, 130), tile533 }, - { new Color(109, 143, 9), tile534 }, - { new Color(193, 74, 9), tile535 }, - { new Color(162, 155, 90), tile536 }, - { new Color(203, 232, 199), tile537 }, - { new Color(28, 212, 138), tile538 }, - { new Color(32, 138, 1), tile539 }, - { new Color(176, 172, 188), tile540 }, - { new Color(93, 109, 176), tile541 }, - { new Color(117, 52, 107), tile542 }, - { new Color(8, 153, 193), tile543 }, - { new Color(3, 95, 63), tile544 }, - { new Color(91, 162, 110), tile545 }, - { new Color(189, 228, 70), tile546 }, - { new Color(182, 26, 252), tile547 }, - { new Color(212, 109, 170), tile548 }, - { new Color(89, 139, 229), tile549 }, - { new Color(37, 54, 166), tile550 }, - { new Color(90, 171, 146), tile551 }, - { new Color(197, 15, 34), tile552 }, - { new Color(88, 75, 21), tile553 }, - { new Color(157, 153, 1), tile554 }, - { new Color(152, 200, 137), tile555 }, - { new Color(135, 192, 50), tile556 }, - { new Color(28, 98, 166), tile557 }, - { new Color(186, 250, 145), tile558 }, - { new Color(192, 137, 255), tile559 }, - { new Color(5, 28, 168), tile560 }, - { new Color(133, 227, 99), tile561 }, - { new Color(27, 168, 179), tile562 }, - { new Color(172, 150, 146), tile563 }, - { new Color(75, 101, 152), tile564 }, - { new Color(49, 25, 128), tile565 }, - { new Color(251, 59, 165), tile566 }, - { new Color(33, 209, 203), tile567 }, - { new Color(179, 9, 211), tile568 }, - { new Color(0, 160, 177), tile569 }, - { new Color(1, 5, 133), tile570 }, - { new Color(34, 82, 46), tile571 }, - { new Color(108, 23, 182), tile572 }, - { new Color(157, 125, 31), tile573 }, - { new Color(213, 219, 42), tile574 }, - { new Color(159, 208, 253), tile575 }, - { new Color(13, 137, 224), tile576 }, - { new Color(17, 196, 78), tile577 }, - { new Color(90, 228, 75), tile578 }, - { new Color(221, 210, 218), tile579 }, - { new Color(143, 27, 8), tile580 }, - { new Color(1, 171, 144), tile581 }, - { new Color(12, 41, 18), tile582 }, - { new Color(106, 196, 2), tile583 }, - { new Color(202, 93, 189), tile584 }, - { new Color(134, 76, 246), tile585 }, - { new Color(160, 20, 57), tile586 }, - { new Color(214, 242, 23), tile587 }, - { new Color(208, 239, 64), tile588 }, - { new Color(55, 200, 110), tile589 }, - { new Color(227, 143, 69), tile590 }, - { new Color(220, 13, 98), tile591 }, - { new Color(22, 211, 47), tile592 }, - { new Color(154, 146, 166), tile593 }, - { new Color(235, 163, 196), tile594 }, - { new Color(222, 71, 103), tile595 }, - { new Color(144, 212, 151), tile596 }, - { new Color(85, 61, 189), tile597 }, - { new Color(160, 185, 40), tile598 }, - { new Color(241, 49, 187), tile599 }, - { new Color(79, 213, 97), tile600 }, - { new Color(163, 135, 53), tile601 }, - { new Color(188, 238, 79), tile602 }, - { new Color(90, 111, 120), tile603 }, - { new Color(198, 5, 129), tile604 }, - { new Color(146, 235, 79), tile605 }, - { new Color(82, 241, 168), tile606 }, - { new Color(217, 166, 244), tile607 }, - { new Color(215, 142, 81), tile608 }, - { new Color(135, 59, 84), tile609 }, - { new Color(58, 36, 162), tile610 }, - { new Color(115, 74, 189), tile611 }, - { new Color(69, 71, 28), tile612 }, - { new Color(143, 33, 89), tile613 }, - { new Color(23, 54, 100), tile614 }, - { new Color(30, 142, 55), tile615 }, - { new Color(59, 14, 206), tile616 }, - { new Color(217, 158, 63), tile617 }, - { new Color(19, 117, 47), tile618 }, - { new Color(108, 204, 249), tile619 }, - { new Color(227, 53, 178), tile620 }, - { new Color(251, 32, 74), tile621 }, - { new Color(214, 83, 186), tile622 }, - { new Color(196, 76, 163), tile623 }, - { new Color(50, 195, 208), tile624 }, - { new Color(79, 194, 111), tile625 }, - { new Color(143, 184, 255), tile626 }, - { new Color(25, 75, 44), tile627 }, - { new Color(133, 96, 134), tile628 }, - { new Color(99, 95, 213), tile629 }, - { new Color(141, 216, 123), tile630 }, - { new Color(35, 171, 236), tile631 }, - { new Color(166, 28, 21), tile632 }, - { new Color(25, 72, 58), tile633 }, - { new Color(124, 119, 194), tile634 }, - { new Color(43, 166, 219), tile635 }, - { new Color(111, 196, 179), tile636 }, - { new Color(191, 221, 19), tile637 }, - { new Color(249, 201, 233), tile638 }, - { new Color(134, 117, 191), tile639 }, - { new Color(196, 115, 243), tile640 }, - { new Color(229, 54, 115), tile641 }, - { new Color(39, 15, 24), tile642 }, - { new Color(227, 169, 165), tile643 }, - { new Color(90, 118, 111), tile644 }, - { new Color(197, 157, 212), tile645 }, - { new Color(106, 90, 185), tile646 }, - { new Color(170, 243, 155), tile647 }, - { new Color(33, 206, 251), tile648 }, - { new Color(103, 41, 225), tile649 }, - { new Color(2, 31, 166), tile650 }, - { new Color(85, 84, 212), tile651 }, - { new Color(71, 150, 64), tile652 }, - { new Color(78, 3, 150), tile653 }, - { new Color(194, 139, 27), tile654 }, - { new Color(13, 101, 103), tile655 }, - { new Color(163, 52, 44), tile656 }, - { new Color(21, 27, 27), tile657 }, - { new Color(5, 25, 127), tile658 }, - { new Color(87, 195, 104), tile659 }, - { new Color(120, 192, 230), tile660 }, - { new Color(55, 225, 137), tile661 }, - { new Color(254, 4, 33), tile662 }, - { new Color(155, 125, 6), tile663 }, - { new Color(148, 28, 87), tile664 }, - { new Color(35, 231, 104), tile665 }, - { new Color(128, 19, 105), tile666 }, - { new Color(148, 195, 245), tile667 }, - { new Color(180, 237, 3), tile668 }, - { new Color(139, 80, 58), tile669 }, - { new Color(85, 239, 211), tile670 }, - { new Color(215, 213, 67), tile671 }, - { new Color(176, 139, 170), tile672 }, - { new Color(145, 15, 97), tile673 }, - { new Color(69, 8, 182), tile674 }, - { new Color(38, 129, 255), tile675 }, - { new Color(196, 226, 49), tile676 }, - { new Color(23, 215, 176), tile677 }, - { new Color(255, 227, 252), tile678 }, - { new Color(240, 130, 244), tile679 }, - { new Color(133, 114, 180), tile680 }, - { new Color(230, 70, 142), tile681 }, - { new Color(51, 188, 70), tile682 }, - { new Color(19, 114, 92), tile683 }, - { new Color(189, 238, 4), tile684 }, - { new Color(8, 78, 186), tile685 }, - { new Color(63, 142, 107), tile686 }, - { new Color(4, 199, 109), tile687 }, - { new Color(8, 61, 23), tile688 }, - { new Color(34, 216, 241), tile689 }, - { new Color(70, 192, 9), tile690 }, - { new Color(182, 12, 156), tile691 }, - { new Color(172, 95, 194), tile692 }, - { new Color(39, 242, 196), tile693 }, - { new Color(185, 176, 111), tile694 }, - { new Color(213, 89, 232), tile695 }, - { new Color(171, 246, 149), tile696 }, - { new Color(65, 176, 244), tile697 }, - { new Color(136, 129, 170), tile698 }, - { new Color(70, 221, 8), tile699 }, - { new Color(118, 16, 227), tile700 }, - { new Color(84, 205, 178), tile701 }, - { new Color(83, 7, 225), tile702 }, - { new Color(103, 91, 239), tile703 }, - { new Color(247, 24, 155), tile704 }, - { new Color(167, 75, 23), tile705 }, - { new Color(253, 51, 228), tile706 }, - { new Color(46, 118, 226), tile707 }, - { new Color(92, 4, 15), tile708 }, - { new Color(21, 45, 139), tile709 }, - { new Color(241, 102, 129), tile710 }, - { new Color(186, 176, 226), tile711 }, - { new Color(225, 100, 226), tile712 }, - { new Color(189, 130, 81), tile713 }, - { new Color(7, 67, 155), tile714 }, - { new Color(166, 73, 152), tile715 }, - { new Color(88, 225, 53), tile716 }, - { new Color(147, 73, 170), tile717 }, - { new Color(35, 71, 153), tile718 }, - { new Color(1, 248, 200), tile719 }, - { new Color(163, 61, 217), tile720 }, - { new Color(86, 118, 244), tile721 }, - { new Color(109, 61, 103), tile722 }, - { new Color(185, 197, 230), tile723 }, - { new Color(52, 63, 176), tile724 }, - { new Color(146, 39, 51), tile725 }, - { new Color(70, 182, 186), tile726 }, - { new Color(118, 188, 76), tile727 }, - { new Color(85, 94, 29), tile728 }, - { new Color(215, 150, 104), tile729 }, - { new Color(72, 223, 108), tile730 }, - { new Color(26, 26, 68), tile731 }, - { new Color(120, 176, 205), tile732 }, - { new Color(166, 56, 12), tile733 }, - { new Color(49, 159, 27), tile734 }, - { new Color(79, 94, 9), tile735 }, - { new Color(249, 145, 32), tile736 }, - { new Color(102, 186, 65), tile737 }, - { new Color(13, 44, 129), tile738 }, - { new Color(140, 0, 24), tile739 }, - { new Color(215, 149, 166), tile740 }, - { new Color(254, 112, 229), tile741 }, - { new Color(122, 26, 37), tile742 }, - { new Color(107, 26, 119), tile743 }, - { new Color(101, 160, 125), tile744 }, - { new Color(174, 69, 29), tile745 }, - { new Color(49, 6, 255), tile746 }, - { new Color(19, 221, 5), tile747 }, - { new Color(72, 226, 37), tile748 }, - { new Color(42, 12, 238), tile749 }, - { new Color(195, 235, 175), tile750 }, - { new Color(181, 206, 163), tile751 }, - { new Color(101, 50, 46), tile752 }, - { new Color(53, 213, 67), tile753 }, - { new Color(228, 142, 118), tile754 }, - { new Color(169, 0, 26), tile755 }, - { new Color(196, 95, 230), tile756 }, - { new Color(99, 91, 250), tile757 }, - { new Color(24, 196, 184), tile758 }, - { new Color(160, 182, 142), tile759 }, - { new Color(192, 79, 13), tile760 }, - { new Color(54, 168, 47), tile761 }, - { new Color(199, 176, 209), tile762 }, - { new Color(218, 72, 19), tile763 }, - { new Color(239, 251, 49), tile764 }, - { new Color(187, 47, 79), tile765 }, - { new Color(143, 159, 225), tile766 }, - { new Color(10, 102, 173), tile767 }, - { new Color(8, 96, 143), tile768 }, - { new Color(181, 156, 10), tile769 }, - { new Color(235, 197, 123), tile770 }, - { new Color(159, 116, 134), tile771 }, - { new Color(54, 173, 229), tile772 }, - { new Color(71, 226, 80), tile773 }, - { new Color(72, 233, 22), tile774 }, - { new Color(210, 116, 96), tile775 }, - { new Color(201, 92, 148), tile776 }, - { new Color(104, 17, 23), tile777 }, - { new Color(173, 182, 232), tile778 }, - { new Color(96, 46, 72), tile779 }, - { new Color(160, 17, 20), tile780 }, - { new Color(199, 239, 131), tile781 }, - { new Color(152, 79, 134), tile782 }, - { new Color(170, 133, 130), tile783 }, - { new Color(105, 72, 189), tile784 }, - { new Color(145, 193, 125), tile785 }, - { new Color(150, 53, 235), tile786 }, - { new Color(47, 236, 63), tile787 }, - { new Color(118, 130, 179), tile788 }, - { new Color(100, 242, 190), tile789 }, - { new Color(157, 213, 126), tile790 }, - { new Color(157, 166, 208), tile791 }, - { new Color(59, 129, 249), tile792 }, - { new Color(147, 58, 36), tile793 }, - { new Color(217, 30, 215), tile794 }, - { new Color(17, 254, 201), tile795 }, - { new Color(90, 27, 244), tile796 }, - { new Color(106, 201, 249), tile797 }, - { new Color(92, 113, 37), tile798 }, - { new Color(212, 81, 108), tile799 }, - { new Color(207, 51, 93), tile800 }, - { new Color(199, 13, 176), tile801 }, - { new Color(4, 203, 161), tile802 }, - { new Color(236, 85, 63), tile803 }, - { new Color(131, 3, 251), tile804 }, - { new Color(199, 85, 206), tile805 }, - { new Color(104, 100, 132), tile806 }, - { new Color(234, 10, 214), tile807 }, - { new Color(202, 51, 11), tile808 }, - { new Color(133, 65, 53), tile809 }, - { new Color(171, 103, 48), tile810 }, - { new Color(141, 195, 6), tile811 }, - { new Color(199, 17, 17), tile812 }, - { new Color(39, 13, 50), tile813 }, - { new Color(39, 109, 198), tile814 }, - { new Color(180, 231, 198), tile815 }, - { new Color(254, 148, 27), tile816 }, - { new Color(86, 108, 236), tile817 }, - { new Color(232, 229, 41), tile818 }, - { new Color(134, 253, 217), tile819 }, - { new Color(164, 127, 138), tile820 }, - { new Color(107, 64, 238), tile821 }, - { new Color(15, 246, 63), tile822 }, - { new Color(244, 0, 67), tile823 }, - { new Color(188, 65, 86), tile824 }, - { new Color(81, 194, 156), tile825 }, - { new Color(16, 21, 76), tile826 }, - { new Color(68, 134, 173), tile827 }, - { new Color(25, 84, 250), tile828 }, - { new Color(67, 164, 222), tile829 }, - { new Color(220, 64, 20), tile830 }, - { new Color(55, 130, 142), tile831 }, - { new Color(168, 188, 44), tile832 }, - { new Color(216, 165, 240), tile833 }, - { new Color(135, 9, 148), tile834 }, - { new Color(216, 154, 43), tile835 }, - { new Color(150, 151, 34), tile836 }, - { new Color(141, 118, 231), tile837 }, - { new Color(141, 95, 248), tile838 }, - { new Color(221, 82, 236), tile839 }, - { new Color(243, 203, 82), tile840 }, - { new Color(96, 24, 192), tile841 }, - { new Color(46, 133, 190), tile842 }, - { new Color(200, 168, 6), tile843 }, - { new Color(111, 56, 112), tile844 }, - { new Color(91, 188, 125), tile845 }, - { new Color(24, 65, 186), tile846 }, - { new Color(207, 173, 12), tile847 }, - { new Color(187, 79, 201), tile848 }, - { new Color(45, 169, 34), tile849 }, - { new Color(150, 203, 105), tile850 }, - { new Color(64, 228, 218), tile851 }, - { new Color(158, 39, 241), tile852 }, - { new Color(212, 169, 20), tile853 }, - { new Color(108, 206, 238), tile854 }, - { new Color(28, 29, 62), tile855 }, - { new Color(119, 50, 162), tile856 }, - { new Color(122, 196, 16), tile857 }, - { new Color(49, 35, 29), tile858 }, - { new Color(69, 165, 200), tile859 }, - { new Color(246, 1, 219), tile860 }, - { new Color(155, 49, 221), tile861 }, - { new Color(156, 47, 83), tile862 }, - { new Color(150, 189, 149), tile863 }, - { new Color(140, 68, 151), tile864 }, - { new Color(165, 99, 223), tile865 }, - { new Color(29, 158, 50), tile866 }, - { new Color(139, 182, 119), tile867 }, - { new Color(128, 27, 6), tile868 }, - { new Color(88, 14, 192), tile869 }, - { new Color(188, 88, 130), tile870 }, - { new Color(40, 221, 168), tile871 }, - { new Color(57, 208, 156), tile872 }, - { new Color(17, 128, 237), tile873 }, - { new Color(234, 224, 116), tile874 }, - { new Color(13, 238, 127), tile875 }, - { new Color(121, 140, 192), tile876 }, - { new Color(62, 39, 6), tile877 }, - { new Color(150, 106, 75), tile878 }, - { new Color(99, 27, 22), tile879 }, - { new Color(214, 67, 32), tile880 }, - { new Color(146, 218, 100), tile881 }, - { new Color(19, 100, 103), tile882 }, - { new Color(239, 108, 146), tile883 }, - { new Color(66, 12, 30), tile884 }, - { new Color(68, 160, 213), tile885 }, - { new Color(2, 115, 45), tile886 }, - { new Color(135, 223, 130), tile887 }, - { new Color(0, 125, 48), tile888 }, - { new Color(123, 145, 115), tile889 }, - { new Color(92, 213, 181), tile890 }, - { new Color(133, 58, 60), tile891 }, - { new Color(204, 88, 6), tile892 }, - { new Color(16, 249, 138), tile893 }, - { new Color(24, 138, 31), tile894 }, - { new Color(46, 251, 27), tile895 }, - { new Color(231, 82, 201), tile896 }, - { new Color(118, 97, 168), tile897 }, - { new Color(233, 78, 100), tile898 }, - { new Color(158, 146, 92), tile899 }, - { new Color(51, 151, 210), tile900 }, - { new Color(243, 146, 151), tile901 }, - { new Color(220, 189, 209), tile902 }, - { new Color(225, 119, 72), tile903 }, - { new Color(206, 242, 121), tile904 }, - { new Color(162, 111, 84), tile905 }, - { new Color(99, 210, 129), tile906 }, - { new Color(21, 148, 63), tile907 }, - { new Color(170, 230, 116), tile908 }, - { new Color(13, 156, 235), tile909 }, - { new Color(216, 46, 198), tile910 }, - { new Color(170, 220, 97), tile911 }, - { new Color(183, 36, 248), tile912 }, - { new Color(136, 81, 62), tile913 }, - { new Color(73, 5, 219), tile914 }, - { new Color(128, 167, 110), tile915 }, - { new Color(46, 70, 223), tile916 }, - { new Color(15, 59, 191), tile917 }, - { new Color(218, 30, 3), tile918 }, - { new Color(147, 73, 171), tile919 }, - { new Color(34, 207, 32), tile920 }, - { new Color(230, 9, 72), tile921 }, - { new Color(130, 36, 21), tile922 }, - { new Color(24, 235, 74), tile923 }, - { new Color(92, 218, 128), tile924 }, - { new Color(67, 204, 143), tile925 }, - { new Color(100, 41, 63), tile926 }, - { new Color(5, 222, 85), tile927 }, - { new Color(12, 201, 243), tile928 }, - { new Color(6, 207, 189), tile929 }, - { new Color(94, 36, 219), tile930 }, - { new Color(76, 101, 130), tile931 }, - { new Color(29, 99, 252), tile932 }, - { new Color(146, 254, 130), tile933 }, - { new Color(88, 22, 91), tile934 }, - { new Color(148, 178, 96), tile935 }, - { new Color(62, 150, 82), tile936 }, - { new Color(115, 47, 32), tile937 }, - { new Color(108, 29, 240), tile938 }, - { new Color(203, 217, 63), tile939 }, - { new Color(85, 123, 84), tile940 }, - { new Color(88, 185, 198), tile941 }, - { new Color(111, 16, 117), tile942 }, - { new Color(254, 37, 104), tile943 }, - { new Color(146, 209, 42), tile944 }, - { new Color(188, 172, 200), tile945 }, - { new Color(249, 119, 23), tile946 }, - { new Color(147, 199, 56), tile947 }, - { new Color(107, 234, 245), tile948 }, - { new Color(187, 224, 71), tile949 }, - { new Color(145, 82, 137), tile950 }, - { new Color(188, 60, 130), tile951 }, - { new Color(46, 0, 92), tile952 }, - { new Color(148, 37, 161), tile953 }, - { new Color(235, 63, 113), tile954 }, - { new Color(233, 225, 93), tile955 }, - { new Color(245, 175, 113), tile956 }, - { new Color(40, 209, 98), tile957 }, - { new Color(39, 194, 179), tile958 }, - { new Color(27, 236, 206), tile959 }, - { new Color(209, 179, 48), tile960 }, - { new Color(45, 109, 211), tile961 }, - { new Color(223, 213, 148), tile962 }, - { new Color(167, 142, 171), tile963 }, - { new Color(107, 100, 81), tile964 }, - { new Color(117, 167, 135), tile965 }, - { new Color(199, 129, 9), tile966 }, - { new Color(151, 197, 49), tile967 }, - { new Color(214, 104, 128), tile968 }, - { new Color(39, 149, 122), tile969 }, - { new Color(206, 18, 20), tile970 }, - { new Color(141, 195, 113), tile971 }, - { new Color(113, 189, 210), tile972 }, - { new Color(157, 10, 11), tile973 }, - { new Color(200, 77, 32), tile974 }, - { new Color(197, 189, 108), tile975 }, - { new Color(16, 178, 26), tile976 }, - { new Color(43, 83, 106), tile977 }, - { new Color(197, 57, 238), tile978 }, - { new Color(255, 86, 5), tile979 }, - { new Color(83, 184, 64), tile980 }, - { new Color(26, 216, 124), tile981 }, - { new Color(151, 221, 161), tile982 }, - { new Color(223, 4, 234), tile983 }, - { new Color(181, 42, 119), tile984 }, - { new Color(254, 207, 119), tile985 }, - { new Color(16, 17, 171), tile986 }, - { new Color(19, 22, 226), tile987 }, - { new Color(96, 162, 190), tile988 }, - { new Color(169, 200, 137), tile989 }, - { new Color(131, 114, 103), tile990 }, - { new Color(205, 73, 82), tile991 }, - { new Color(202, 173, 116), tile992 }, - { new Color(164, 46, 223), tile993 }, - { new Color(203, 49, 173), tile994 }, - { new Color(48, 118, 41), tile995 }, - { new Color(243, 199, 106), tile996 }, - { new Color(119, 238, 69), tile997 }, - { new Color(89, 63, 162), tile998 }, - { new Color(93, 186, 54), tile999 }, - { new Color(189, 237, 20), tile1000 }, - { new Color(24, 92, 145), tile1001 }, - { new Color(131, 232, 224), tile1002 }, - { new Color(37, 51, 33), tile1003 }, - { new Color(2, 107, 227), tile1004 }, - { new Color(203, 72, 229), tile1005 }, - { new Color(53, 48, 44), tile1006 }, - { new Color(149, 181, 1), tile1007 }, - { new Color(30, 11, 131), tile1008 }, - { new Color(33, 115, 9), tile1009 }, - { new Color(175, 108, 243), tile1010 }, - { new Color(62, 230, 64), tile1011 }, - { new Color(202, 178, 212), tile1012 }, - { new Color(27, 172, 141), tile1013 }, - { new Color(72, 206, 147), tile1014 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/IceLaboratorySchematic.png b/Schematics/AutoGeneratedContent/IceLaboratorySchematic.png deleted file mode 100644 index b96f4709d7..0000000000 Binary files a/Schematics/AutoGeneratedContent/IceLaboratorySchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs deleted file mode 100644 index 680099d678..0000000000 --- a/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.cs +++ /dev/null @@ -1,2328 +0,0 @@ -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Tiles.FurniturePlaguedPlate; -using CalamityMod.Tiles.Plates; -using CalamityMod.Walls; -using CalamityMod.Walls.DraedonStructures; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class PlagueLaboratorySchematic - { - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 72); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); - var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 72); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile17 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile18 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile19 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 4, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile24 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile25 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile26 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile27 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile32 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 72); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); - var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile37 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile38 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile39 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile40 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile41 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile42 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 11, 0, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile43 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 1, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile44 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 71, 1, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile46 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile47 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 3, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 96).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile55 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile57 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 64).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(16, 80).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 96).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 54); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 36); - var tile72 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile76 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile77 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(32, 64).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 80).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(32, 96).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile85 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile86 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile91 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile95 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile96 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile97 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(48, 96).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile105 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile106 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile108 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile113 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(64, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(64, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(64, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(64, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(64, 80).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 96).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile123 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 72); - var tile126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(80, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(80, 16).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(80, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(80, 48).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(80, 64).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(80, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile136 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(80, 96).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile139 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile140 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 18); - var tile142 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile144 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile145 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 1, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile146 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 138, 2, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile147 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile148 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile149 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile151 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile152 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile153 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 4, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 36); - var tile155 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile157 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile159 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 163, 1, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile160 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 82, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile161 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 103, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile162 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 147, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile163 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 66, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile164 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 168, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile165 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile166 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 33, 1, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile168 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile170 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile171 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile172 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile173 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile174 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile175 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 72); - var tile177 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile178 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 36); - var tile183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile184 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36); - var tile186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 0); - var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 16416).UseFrame(234, 36); - var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 0); - var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile193 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile194 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile195 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile196 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile199 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile200 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 90).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 288, 36).MakeActuated(); - var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 252, 36).MakeActuated(); - var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 2144).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile206 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile207 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 128).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile208 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 128).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile209 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 136, 1, 160).UseFrame(18, 216).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile210 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 128, 2, 160).UseFrame(18, 234).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile211 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 132, 4, 160).UseFrame(18, 252).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile214 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile218 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile219 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile220 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 128, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile221 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 18); - var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 0); - var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 18); - var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 54); - var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 37, 0, 32).UseFrame(198, 54).UseWall((ushort)WallID.EmeraldGemspark, 180, 0); - var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile232 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile233 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile234 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile236 = new TileDefinitionStructure(TileID.SapphireGemspark).UseHeaders(0, 66, 4, 32).UseFrame(162, 54).UseWall((ushort)WallID.SapphireGemspark, 72, 144); - var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 90).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile240 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 16416).UseFrame(36, 216).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile241 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile242 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile243 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile245 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile247 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 160).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile249 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 0); - var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 18); - var tile255 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 54); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile268 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile269 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile276 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile277 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 160).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile281 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile282 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile284 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile285 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile286 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile287 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile289 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile290 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile291 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile292 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile295 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile296 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile297 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile298 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile299 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile300 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile301 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile307 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile312 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile314 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile315 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile316 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile317 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 128).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile318 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile323 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile324 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile325 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile326 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile327 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile328 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile329 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile330 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile331 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile333 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile334 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile335 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile336 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile337 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile338 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile342 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile343 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 4, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile349 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile350 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile352 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 160).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile353 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile358 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile359 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile360 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile363 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile364 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile365 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile366 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(180, 54).UseWall((ushort)WallID.EmeraldGemspark, 252, 72); - var tile367 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile368 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile369 = new TileDefinitionStructure(TileID.SapphireGemspark).UseHeaders(0, 64, 1, 32).UseFrame(162, 54).UseWall((ushort)WallID.SapphireGemspark, 0, 36); - var tile370 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile371 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(0, 90).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile372 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 12320).UseFrame(54, 216).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile373 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile374 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile375 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile376 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 160).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile377 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile378 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile379 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile380 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile381 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile382 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile383 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile389 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile390 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile391 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile392 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile393 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile394 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile397 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 126).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile399 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 216, 36).MakeActuated(); - var tile400 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile401 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 2144).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile402 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 128).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile403 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile404 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile405 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile406 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile407 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile408 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile409 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile410 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile411 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile412 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile413 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile414 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile415 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile416 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 4, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile417 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 4, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile418 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile419 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile420 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile421 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile422 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile423 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile424 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile425 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); - var tile426 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 18); - var tile427 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 54); - var tile428 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile429 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile430 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 26, 0, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile431 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 33, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile432 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 17, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile433 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 106, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile434 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 131, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile435 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 154, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile436 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 131, 1, 32).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile437 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile438 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile439 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile440 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 128).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile441 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile442 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile443 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile444 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 0); - var tile445 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 18); - var tile446 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 18); - var tile447 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 18); - var tile448 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(306, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile449 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile450 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile451 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile452 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile453 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile454 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile455 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile456 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 3, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile457 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 36); - var tile458 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 0); - var tile459 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(270, 36); - var tile460 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 4, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile461 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0); - var tile462 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile463 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 128).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile464 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile465 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile466 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile467 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile468 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); - var tile469 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(216, 36); - var tile470 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 36); - var tile471 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile472 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile473 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile474 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 0); - var tile475 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile476 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); - var tile477 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 4, 0).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile478 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile479 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile480 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile481 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile482 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile483 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile484 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile485 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile487 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile488 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile489 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile490 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0); - var tile491 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile492 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile493 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile494 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile495 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile496 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile497 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); - var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile500 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile501 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile502 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 160).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile503 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile504 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile505 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile506 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile507 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(144, 108).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile508 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile509 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile511 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile512 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile516 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile517 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile518 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile519 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile520 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile521 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile522 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile523 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile524 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile525 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile526 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile527 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile528 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 16416).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile529 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile530 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile531 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 2144).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 72).MakeActuated(); - var tile532 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 2144).UseFrame(90, 0).MakeActuated(); - var tile533 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 2144).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 108, 0).MakeActuated(); - var tile534 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 160).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile535 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile536 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile537 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile538 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(162, 54).UseWall((ushort)WallID.EmeraldGemspark, 216, 72); - var tile539 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 4, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile540 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile541 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 90); - var tile542 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile543 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile544 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile545 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile546 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile547 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile548 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 4, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile549 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile550 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile551 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile552 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile553 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile554 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile555 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile556 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile557 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile558 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 72).MakeActuated(); - var tile559 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 160).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile560 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile561 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile562 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile563 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile564 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(144, 108); - var tile565 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile566 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile567 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile568 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 4, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile569 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile570 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 4, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile571 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile572 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile573 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile574 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile575 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile576 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile577 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile578 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 4, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile579 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(198, 18); - var tile580 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile581 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile582 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile583 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile584 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile585 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile586 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile587 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile588 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(360, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile589 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile590 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 128).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile591 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 128).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile592 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 128).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile593 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 1, 160).UseFrame(18, 216).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile594 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 136, 2, 160).UseFrame(18, 234).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile595 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 2, 160).UseFrame(18, 252).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile596 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile597 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(180, 54); - var tile598 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile599 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile600 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile601 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile602 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile603 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile604 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile605 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile606 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile607 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile608 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile609 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile610 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile611 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile612 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile613 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile614 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile615 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile616 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile617 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile618 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile619 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile620 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile621 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile622 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile623 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile624 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile625 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile626 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile627 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile628 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile629 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile630 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile631 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 160).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile632 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile633 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(144, 108).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile634 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile635 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile636 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile637 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile638 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile639 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile640 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 101, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile641 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile642 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile643 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 2, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile644 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile645 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile646 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile647 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile648 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile649 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile650 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile651 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile652 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile653 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile654 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile655 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 12320).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile656 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 2144).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile657 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 252, 72).MakeActuated(); - var tile658 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile659 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 160).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile660 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile661 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(162, 54).UseWall((ushort)WallID.EmeraldGemspark, 288, 72); - var tile662 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile663 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(180, 90); - var tile664 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile665 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile666 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile667 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile668 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 21, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile669 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile670 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile671 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile672 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile673 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile674 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile675 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile676 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile677 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile678 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile679 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile680 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile681 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile682 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(162, 36); - var tile683 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile684 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile685 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 160).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile686 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile687 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile688 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile689 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(180, 108).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile690 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile691 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile692 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile693 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile694 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile695 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile696 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile697 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile698 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile699 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile700 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile701 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile702 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile703 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile704 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile705 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile706 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile707 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile708 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 36); - var tile709 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 16416).UseFrame(72, 72); - var tile710 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile711 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile712 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile713 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile714 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile715 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile716 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(198, 36); - var tile717 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile718 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile719 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile720 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile721 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile722 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile723 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile724 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile725 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile726 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile727 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile728 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile729 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile730 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 36); - var tile731 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(234, 36); - var tile732 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile733 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile734 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile735 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile736 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile737 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 160).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile738 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile739 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile740 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile741 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile742 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile743 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile744 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile745 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile746 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile747 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile748 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile749 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile750 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile751 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile752 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile753 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile754 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile755 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(162, 36); - var tile756 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 18); - var tile757 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile758 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile759 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile760 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile761 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 160).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile762 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile763 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile764 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile765 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile766 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile767 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile768 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile769 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile770 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile771 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile772 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile773 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile774 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile775 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile776 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile777 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 54); - var tile778 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile779 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile780 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile781 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile782 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile783 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile784 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile785 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 160).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile786 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile787 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile788 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile789 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile790 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile791 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile792 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 230).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile793 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile794 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 74, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile795 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 138, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile796 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile797 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile798 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile799 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile800 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile801 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile802 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile803 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile804 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile805 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile806 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile807 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile808 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile809 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile810 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile811 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile812 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile813 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile814 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile815 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile816 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile817 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile818 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile819 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile820 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile821 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile822 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 128).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile823 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 128).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile824 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 75, 1, 160).UseFrame(18, 216).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile825 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 1, 160).UseFrame(18, 234).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile826 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 2, 160).UseFrame(18, 252).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile827 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile828 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile829 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile830 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile831 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile832 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 230).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile833 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile834 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile835 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile836 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile837 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile838 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile839 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile840 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile841 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile842 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile843 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile844 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile845 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile846 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile847 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile848 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile849 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile850 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile851 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile852 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile853 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile854 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile855 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile856 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 230).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile857 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile858 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile859 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile860 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 18); - var tile861 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile862 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile863 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile864 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile865 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 160).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile866 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile867 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile868 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile869 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile870 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile871 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 0); - var tile872 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(270, 36); - var tile873 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 160).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile874 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile875 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile876 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile877 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile878 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 4, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile879 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile880 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile881 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile882 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile883 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile884 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile885 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile886 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile887 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile888 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile889 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile890 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile891 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile892 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 12320).UseFrame(54, 72); - var tile893 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile894 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 4, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile895 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile896 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile897 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile898 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile899 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile900 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile901 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile902 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile903 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile904 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile905 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile906 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile907 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 16416).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile908 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile909 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile910 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile911 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile912 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile913 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile914 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile915 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile916 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile917 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile918 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile919 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile920 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile921 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile922 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile923 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile924 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile925 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile926 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 21, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile927 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile928 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile929 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile930 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile931 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile932 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile933 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 2144).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 360, 0).MakeActuated(); - var tile934 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile935 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile936 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile937 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(180, 54).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile938 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile939 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile940 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile941 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile942 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile943 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile944 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile945 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile946 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile947 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile948 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile949 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile950 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile951 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile952 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile953 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile954 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile955 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile956 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile957 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile958 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile959 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile960 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile961 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile962 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile963 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile964 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 32).UseFrame(162, 108).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile965 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile966 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile967 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 21, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile968 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile969 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile970 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile971 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile972 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile973 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile974 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile975 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile976 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile977 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile978 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile979 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile980 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile981 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile982 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile983 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(306, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile984 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile985 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile986 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile987 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile988 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile989 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile990 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile991 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile992 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile993 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile994 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile995 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile996 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile997 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 128).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile998 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 2, 160).UseFrame(18, 252).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile999 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 54); - var tile1000 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 54); - var tile1001 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1002 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1003 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1004 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1005 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1006 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1007 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1008 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile1009 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile1010 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1011 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1012 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1013 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1014 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 12320).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1015 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1016 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile1017 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1018 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1019 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1020 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile1021 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 3, 2144).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 180, 108).MakeActuated(); - var tile1022 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 0).MakeActuated(); - var tile1023 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 2144).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 360, 0).MakeActuated(); - var tile1024 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1025 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1026 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(198, 54).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1027 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile1028 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 2144).UseFrame(216, 0).MakeActuated(); - var tile1029 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile1030 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1031 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1032 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(162, 108); - var tile1033 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 133, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1034 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 68, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1035 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 2048); - var tile1036 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 128).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile1037 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile1038 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile1039 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile1040 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1041 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile1042 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(216, 36); - var tile1043 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 128); - var tile1044 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1045 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1046 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1047 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1048 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); - var tile1049 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1050 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1051 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1052 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 4, 0).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile1053 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 17, 3, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile1054 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 148, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1055 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 68, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1056 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 20, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1057 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile1058 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 16, 0, 32).UseFrame(126, 54); - var tile1059 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1060 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1061 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1062 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(288, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1063 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1064 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1065 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1066 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1067 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1068 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1069 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1070 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 108); - var tile1071 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 76, 1, 0).UseWall((ushort)ModContent.WallType(), 432, 36); - var tile1072 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile1073 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile1074 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1075 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1076 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1077 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile1078 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1079 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1080 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 128, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile1081 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1082 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1083 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1084 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1085 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1086 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile1087 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 160).UseFrame(0, 18); - var tile1088 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1089 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1090 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1091 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1093 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1094 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1095 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1096 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1097 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile1098 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile1099 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile1100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 160).UseFrame(18, 18); - var tile1101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1103 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile1110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1113 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1114 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 54); - var tile1119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1122 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1123 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 4128).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1125 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1129 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 0, 0).UseWall((ushort)ModContent.WallType(), 216, 0); - var tile1130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile1133 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1136 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 0, 160).UseFrame(18, 216).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1137 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 75, 1, 160).UseFrame(18, 234).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1138 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 67, 4, 160).UseFrame(18, 252).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1141 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 68, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile1142 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); - var tile1147 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile1148 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile1149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 72); - var tile1150 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile1151 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 0); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(43, 26, 79), tile2 }, - { new Color(245, 92, 45), tile3 }, - { new Color(39, 81, 195), tile4 }, - { new Color(205, 20, 169), tile5 }, - { new Color(187, 199, 220), tile6 }, - { new Color(247, 1, 115), tile7 }, - { new Color(154, 62, 3), tile8 }, - { new Color(59, 147, 135), tile9 }, - { new Color(209, 52, 218), tile10 }, - { new Color(115, 98, 64), tile11 }, - { new Color(124, 145, 209), tile12 }, - { new Color(171, 102, 21), tile13 }, - { new Color(170, 16, 98), tile14 }, - { new Color(220, 63, 168), tile15 }, - { new Color(125, 198, 159), tile16 }, - { new Color(45, 66, 82), tile17 }, - { new Color(161, 10, 35), tile18 }, - { new Color(163, 67, 231), tile19 }, - { new Color(67, 240, 135), tile20 }, - { new Color(199, 36, 39), tile21 }, - { new Color(83, 180, 238), tile22 }, - { new Color(130, 81, 130), tile23 }, - { new Color(216, 16, 96), tile24 }, - { new Color(198, 77, 241), tile25 }, - { new Color(16, 190, 254), tile26 }, - { new Color(91, 189, 205), tile27 }, - { new Color(232, 164, 242), tile28 }, - { new Color(135, 209, 88), tile29 }, - { new Color(29, 216, 78), tile30 }, - { new Color(233, 103, 118), tile31 }, - { new Color(142, 227, 235), tile32 }, - { new Color(58, 137, 139), tile33 }, - { new Color(185, 250, 117), tile34 }, - { new Color(28, 85, 50), tile35 }, - { new Color(242, 218, 189), tile36 }, - { new Color(49, 146, 132), tile37 }, - { new Color(232, 232, 50), tile38 }, - { new Color(186, 223, 127), tile39 }, - { new Color(53, 203, 226), tile40 }, - { new Color(150, 101, 120), tile41 }, - { new Color(52, 238, 168), tile42 }, - { new Color(234, 56, 105), tile43 }, - { new Color(6, 213, 53), tile44 }, - { new Color(115, 161, 194), tile45 }, - { new Color(88, 203, 79), tile46 }, - { new Color(192, 149, 247), tile47 }, - { new Color(154, 235, 69), tile48 }, - { new Color(201, 1, 127), tile49 }, - { new Color(68, 211, 3), tile50 }, - { new Color(108, 5, 189), tile51 }, - { new Color(168, 35, 149), tile52 }, - { new Color(252, 231, 102), tile53 }, - { new Color(137, 7, 162), tile54 }, - { new Color(83, 43, 188), tile55 }, - { new Color(79, 117, 70), tile56 }, - { new Color(111, 98, 19), tile57 }, - { new Color(48, 116, 54), tile58 }, - { new Color(235, 251, 121), tile59 }, - { new Color(50, 107, 237), tile60 }, - { new Color(40, 166, 100), tile61 }, - { new Color(102, 153, 208), tile62 }, - { new Color(119, 202, 125), tile63 }, - { new Color(45, 91, 227), tile64 }, - { new Color(232, 54, 141), tile65 }, - { new Color(84, 70, 192), tile66 }, - { new Color(137, 121, 140), tile67 }, - { new Color(57, 212, 113), tile68 }, - { new Color(240, 59, 144), tile69 }, - { new Color(135, 189, 39), tile70 }, - { new Color(27, 202, 124), tile71 }, - { new Color(121, 97, 97), tile72 }, - { new Color(61, 237, 145), tile73 }, - { new Color(236, 216, 170), tile74 }, - { new Color(200, 66, 6), tile75 }, - { new Color(47, 71, 62), tile76 }, - { new Color(168, 150, 180), tile77 }, - { new Color(185, 169, 241), tile78 }, - { new Color(97, 239, 209), tile79 }, - { new Color(243, 117, 94), tile80 }, - { new Color(63, 240, 13), tile81 }, - { new Color(86, 17, 144), tile82 }, - { new Color(103, 111, 212), tile83 }, - { new Color(43, 23, 89), tile84 }, - { new Color(46, 156, 161), tile85 }, - { new Color(225, 112, 146), tile86 }, - { new Color(106, 192, 244), tile87 }, - { new Color(82, 222, 38), tile88 }, - { new Color(114, 97, 33), tile89 }, - { new Color(139, 24, 114), tile90 }, - { new Color(143, 73, 119), tile91 }, - { new Color(51, 173, 231), tile92 }, - { new Color(157, 114, 48), tile93 }, - { new Color(118, 200, 216), tile94 }, - { new Color(105, 125, 126), tile95 }, - { new Color(91, 139, 13), tile96 }, - { new Color(79, 127, 126), tile97 }, - { new Color(63, 136, 181), tile98 }, - { new Color(105, 236, 17), tile99 }, - { new Color(230, 227, 175), tile100 }, - { new Color(111, 220, 87), tile101 }, - { new Color(98, 155, 206), tile102 }, - { new Color(225, 251, 238), tile103 }, - { new Color(186, 68, 254), tile104 }, - { new Color(97, 244, 248), tile105 }, - { new Color(28, 232, 97), tile106 }, - { new Color(167, 23, 214), tile107 }, - { new Color(19, 59, 152), tile108 }, - { new Color(243, 80, 192), tile109 }, - { new Color(194, 201, 193), tile110 }, - { new Color(213, 182, 142), tile111 }, - { new Color(128, 6, 235), tile112 }, - { new Color(128, 7, 225), tile113 }, - { new Color(176, 121, 143), tile114 }, - { new Color(30, 149, 59), tile115 }, - { new Color(128, 221, 148), tile116 }, - { new Color(188, 77, 4), tile117 }, - { new Color(176, 62, 204), tile118 }, - { new Color(216, 92, 160), tile119 }, - { new Color(190, 110, 75), tile120 }, - { new Color(13, 31, 49), tile121 }, - { new Color(45, 228, 141), tile122 }, - { new Color(111, 224, 238), tile123 }, - { new Color(12, 155, 224), tile124 }, - { new Color(128, 247, 157), tile125 }, - { new Color(71, 244, 165), tile126 }, - { new Color(92, 115, 114), tile127 }, - { new Color(44, 5, 124), tile128 }, - { new Color(188, 37, 119), tile129 }, - { new Color(194, 167, 170), tile130 }, - { new Color(75, 194, 152), tile131 }, - { new Color(149, 163, 89), tile132 }, - { new Color(94, 241, 177), tile133 }, - { new Color(174, 17, 253), tile134 }, - { new Color(165, 175, 178), tile135 }, - { new Color(35, 48, 71), tile136 }, - { new Color(46, 145, 103), tile137 }, - { new Color(250, 97, 251), tile138 }, - { new Color(216, 224, 25), tile139 }, - { new Color(181, 112, 191), tile140 }, - { new Color(21, 172, 56), tile141 }, - { new Color(68, 193, 216), tile142 }, - { new Color(71, 234, 83), tile143 }, - { new Color(67, 233, 3), tile144 }, - { new Color(244, 174, 98), tile145 }, - { new Color(117, 134, 85), tile146 }, - { new Color(201, 153, 244), tile147 }, - { new Color(48, 148, 22), tile148 }, - { new Color(66, 80, 96), tile149 }, - { new Color(157, 189, 195), tile150 }, - { new Color(64, 168, 129), tile151 }, - { new Color(242, 153, 100), tile152 }, - { new Color(196, 97, 238), tile153 }, - { new Color(217, 219, 70), tile154 }, - { new Color(244, 234, 168), tile155 }, - { new Color(99, 6, 179), tile156 }, - { new Color(153, 99, 89), tile157 }, - { new Color(195, 235, 215), tile158 }, - { new Color(202, 229, 24), tile159 }, - { new Color(34, 1, 113), tile160 }, - { new Color(120, 170, 45), tile161 }, - { new Color(144, 3, 64), tile162 }, - { new Color(129, 2, 21), tile163 }, - { new Color(253, 177, 37), tile164 }, - { new Color(103, 240, 189), tile165 }, - { new Color(174, 59, 169), tile166 }, - { new Color(109, 223, 73), tile167 }, - { new Color(172, 4, 89), tile168 }, - { new Color(105, 124, 188), tile169 }, - { new Color(170, 39, 179), tile170 }, - { new Color(76, 161, 96), tile171 }, - { new Color(124, 96, 49), tile172 }, - { new Color(24, 100, 230), tile173 }, - { new Color(104, 226, 3), tile174 }, - { new Color(158, 156, 177), tile175 }, - { new Color(52, 92, 251), tile176 }, - { new Color(25, 27, 169), tile177 }, - { new Color(110, 181, 34), tile178 }, - { new Color(39, 204, 166), tile179 }, - { new Color(211, 38, 135), tile180 }, - { new Color(131, 215, 218), tile181 }, - { new Color(97, 176, 15), tile182 }, - { new Color(196, 234, 143), tile183 }, - { new Color(139, 149, 215), tile184 }, - { new Color(195, 5, 252), tile185 }, - { new Color(69, 13, 104), tile186 }, - { new Color(167, 52, 32), tile187 }, - { new Color(193, 144, 12), tile188 }, - { new Color(10, 222, 236), tile189 }, - { new Color(61, 85, 148), tile190 }, - { new Color(139, 69, 61), tile191 }, - { new Color(95, 228, 11), tile192 }, - { new Color(41, 61, 235), tile193 }, - { new Color(162, 111, 113), tile194 }, - { new Color(107, 142, 134), tile195 }, - { new Color(210, 170, 175), tile196 }, - { new Color(37, 225, 190), tile197 }, - { new Color(62, 43, 242), tile198 }, - { new Color(103, 194, 70), tile199 }, - { new Color(206, 86, 210), tile200 }, - { new Color(35, 135, 149), tile201 }, - { new Color(251, 0, 80), tile202 }, - { new Color(154, 99, 33), tile203 }, - { new Color(241, 28, 208), tile204 }, - { new Color(124, 5, 196), tile205 }, - { new Color(174, 85, 1), tile206 }, - { new Color(134, 56, 51), tile207 }, - { new Color(60, 23, 115), tile208 }, - { new Color(214, 77, 25), tile209 }, - { new Color(75, 248, 33), tile210 }, - { new Color(196, 90, 230), tile211 }, - { new Color(25, 126, 232), tile212 }, - { new Color(219, 112, 142), tile213 }, - { new Color(53, 55, 71), tile214 }, - { new Color(142, 52, 197), tile215 }, - { new Color(238, 193, 37), tile216 }, - { new Color(45, 184, 108), tile217 }, - { new Color(68, 72, 30), tile218 }, - { new Color(158, 231, 111), tile219 }, - { new Color(34, 37, 178), tile220 }, - { new Color(54, 78, 107), tile221 }, - { new Color(255, 44, 193), tile222 }, - { new Color(233, 99, 135), tile223 }, - { new Color(220, 211, 229), tile224 }, - { new Color(115, 80, 0), tile225 }, - { new Color(236, 173, 227), tile226 }, - { new Color(174, 232, 139), tile227 }, - { new Color(244, 29, 63), tile228 }, - { new Color(180, 127, 18), tile229 }, - { new Color(200, 122, 151), tile230 }, - { new Color(121, 184, 75), tile231 }, - { new Color(219, 255, 232), tile232 }, - { new Color(219, 142, 7), tile233 }, - { new Color(3, 4, 94), tile234 }, - { new Color(158, 80, 229), tile235 }, - { new Color(135, 209, 248), tile236 }, - { new Color(29, 178, 57), tile237 }, - { new Color(139, 116, 60), tile238 }, - { new Color(38, 66, 49), tile239 }, - { new Color(44, 75, 173), tile240 }, - { new Color(175, 32, 232), tile241 }, - { new Color(239, 99, 26), tile242 }, - { new Color(154, 151, 80), tile243 }, - { new Color(23, 17, 30), tile244 }, - { new Color(219, 171, 227), tile245 }, - { new Color(45, 85, 205), tile246 }, - { new Color(89, 45, 174), tile247 }, - { new Color(25, 170, 200), tile248 }, - { new Color(93, 237, 68), tile249 }, - { new Color(14, 180, 189), tile250 }, - { new Color(183, 174, 67), tile251 }, - { new Color(90, 83, 228), tile252 }, - { new Color(117, 175, 237), tile253 }, - { new Color(203, 236, 57), tile254 }, - { new Color(167, 6, 160), tile255 }, - { new Color(26, 175, 201), tile256 }, - { new Color(89, 249, 236), tile257 }, - { new Color(99, 210, 30), tile258 }, - { new Color(254, 150, 117), tile259 }, - { new Color(31, 145, 117), tile260 }, - { new Color(213, 140, 227), tile261 }, - { new Color(147, 95, 98), tile262 }, - { new Color(219, 129, 87), tile263 }, - { new Color(255, 183, 166), tile264 }, - { new Color(223, 142, 64), tile265 }, - { new Color(117, 113, 164), tile266 }, - { new Color(39, 67, 61), tile267 }, - { new Color(123, 180, 187), tile268 }, - { new Color(208, 84, 220), tile269 }, - { new Color(37, 91, 188), tile270 }, - { new Color(110, 86, 29), tile271 }, - { new Color(120, 245, 96), tile272 }, - { new Color(86, 20, 166), tile273 }, - { new Color(62, 63, 46), tile274 }, - { new Color(113, 90, 65), tile275 }, - { new Color(70, 132, 68), tile276 }, - { new Color(221, 137, 36), tile277 }, - { new Color(209, 247, 78), tile278 }, - { new Color(55, 90, 215), tile279 }, - { new Color(39, 194, 11), tile280 }, - { new Color(133, 181, 37), tile281 }, - { new Color(154, 144, 97), tile282 }, - { new Color(137, 103, 152), tile283 }, - { new Color(223, 31, 93), tile284 }, - { new Color(253, 232, 3), tile285 }, - { new Color(15, 9, 90), tile286 }, - { new Color(121, 138, 208), tile287 }, - { new Color(152, 72, 210), tile288 }, - { new Color(152, 156, 94), tile289 }, - { new Color(206, 64, 155), tile290 }, - { new Color(137, 46, 82), tile291 }, - { new Color(155, 185, 138), tile292 }, - { new Color(8, 214, 201), tile293 }, - { new Color(224, 189, 28), tile294 }, - { new Color(171, 254, 106), tile295 }, - { new Color(199, 211, 14), tile296 }, - { new Color(74, 40, 80), tile297 }, - { new Color(125, 174, 55), tile298 }, - { new Color(59, 237, 109), tile299 }, - { new Color(83, 2, 244), tile300 }, - { new Color(2, 186, 39), tile301 }, - { new Color(253, 86, 240), tile302 }, - { new Color(10, 98, 47), tile303 }, - { new Color(121, 6, 51), tile304 }, - { new Color(144, 152, 205), tile305 }, - { new Color(179, 237, 73), tile306 }, - { new Color(103, 208, 201), tile307 }, - { new Color(79, 131, 23), tile308 }, - { new Color(74, 12, 128), tile309 }, - { new Color(26, 95, 203), tile310 }, - { new Color(29, 180, 212), tile311 }, - { new Color(213, 222, 2), tile312 }, - { new Color(245, 173, 167), tile313 }, - { new Color(121, 188, 112), tile314 }, - { new Color(223, 209, 33), tile315 }, - { new Color(29, 236, 21), tile316 }, - { new Color(106, 135, 255), tile317 }, - { new Color(35, 236, 49), tile318 }, - { new Color(43, 178, 54), tile319 }, - { new Color(15, 178, 74), tile320 }, - { new Color(112, 240, 3), tile321 }, - { new Color(99, 92, 82), tile322 }, - { new Color(94, 186, 186), tile323 }, - { new Color(202, 190, 63), tile324 }, - { new Color(161, 238, 20), tile325 }, - { new Color(88, 112, 178), tile326 }, - { new Color(246, 45, 31), tile327 }, - { new Color(106, 175, 215), tile328 }, - { new Color(204, 249, 200), tile329 }, - { new Color(162, 170, 43), tile330 }, - { new Color(204, 229, 250), tile331 }, - { new Color(93, 8, 204), tile332 }, - { new Color(109, 123, 117), tile333 }, - { new Color(207, 190, 50), tile334 }, - { new Color(90, 160, 201), tile335 }, - { new Color(192, 129, 254), tile336 }, - { new Color(29, 210, 65), tile337 }, - { new Color(132, 24, 133), tile338 }, - { new Color(42, 5, 64), tile339 }, - { new Color(43, 151, 98), tile340 }, - { new Color(137, 188, 16), tile341 }, - { new Color(142, 253, 216), tile342 }, - { new Color(69, 67, 229), tile343 }, - { new Color(71, 234, 245), tile344 }, - { new Color(60, 39, 111), tile345 }, - { new Color(236, 15, 15), tile346 }, - { new Color(14, 11, 119), tile347 }, - { new Color(202, 133, 215), tile348 }, - { new Color(234, 72, 204), tile349 }, - { new Color(117, 50, 2), tile350 }, - { new Color(139, 65, 227), tile351 }, - { new Color(19, 69, 2), tile352 }, - { new Color(33, 204, 162), tile353 }, - { new Color(240, 123, 61), tile354 }, - { new Color(24, 213, 231), tile355 }, - { new Color(76, 71, 241), tile356 }, - { new Color(22, 62, 245), tile357 }, - { new Color(49, 28, 139), tile358 }, - { new Color(234, 191, 54), tile359 }, - { new Color(56, 164, 181), tile360 }, - { new Color(12, 207, 17), tile361 }, - { new Color(226, 188, 169), tile362 }, - { new Color(17, 41, 226), tile363 }, - { new Color(108, 202, 67), tile364 }, - { new Color(109, 30, 144), tile365 }, - { new Color(58, 177, 176), tile366 }, - { new Color(239, 158, 0), tile367 }, - { new Color(219, 95, 244), tile368 }, - { new Color(12, 90, 36), tile369 }, - { new Color(87, 40, 133), tile370 }, - { new Color(203, 233, 39), tile371 }, - { new Color(237, 228, 171), tile372 }, - { new Color(44, 54, 24), tile373 }, - { new Color(62, 58, 30), tile374 }, - { new Color(15, 169, 115), tile375 }, - { new Color(178, 196, 254), tile376 }, - { new Color(251, 176, 14), tile377 }, - { new Color(134, 72, 6), tile378 }, - { new Color(180, 48, 111), tile379 }, - { new Color(28, 213, 97), tile380 }, - { new Color(132, 185, 0), tile381 }, - { new Color(92, 160, 225), tile382 }, - { new Color(28, 127, 58), tile383 }, - { new Color(228, 13, 122), tile384 }, - { new Color(151, 177, 99), tile385 }, - { new Color(226, 204, 182), tile386 }, - { new Color(129, 90, 150), tile387 }, - { new Color(38, 92, 120), tile388 }, - { new Color(119, 69, 160), tile389 }, - { new Color(33, 57, 179), tile390 }, - { new Color(60, 16, 96), tile391 }, - { new Color(183, 186, 128), tile392 }, - { new Color(30, 178, 8), tile393 }, - { new Color(145, 149, 68), tile394 }, - { new Color(195, 22, 162), tile395 }, - { new Color(147, 239, 151), tile396 }, - { new Color(162, 209, 100), tile397 }, - { new Color(185, 154, 122), tile398 }, - { new Color(203, 93, 93), tile399 }, - { new Color(136, 228, 91), tile400 }, - { new Color(64, 251, 70), tile401 }, - { new Color(134, 168, 253), tile402 }, - { new Color(25, 224, 246), tile403 }, - { new Color(227, 196, 25), tile404 }, - { new Color(173, 240, 196), tile405 }, - { new Color(82, 98, 70), tile406 }, - { new Color(214, 227, 86), tile407 }, - { new Color(9, 126, 103), tile408 }, - { new Color(79, 130, 117), tile409 }, - { new Color(229, 235, 92), tile410 }, - { new Color(35, 150, 206), tile411 }, - { new Color(173, 80, 154), tile412 }, - { new Color(253, 60, 109), tile413 }, - { new Color(164, 121, 14), tile414 }, - { new Color(160, 191, 13), tile415 }, - { new Color(74, 11, 170), tile416 }, - { new Color(181, 121, 251), tile417 }, - { new Color(22, 178, 1), tile418 }, - { new Color(4, 55, 124), tile419 }, - { new Color(223, 55, 38), tile420 }, - { new Color(135, 51, 244), tile421 }, - { new Color(153, 191, 46), tile422 }, - { new Color(75, 0, 159), tile423 }, - { new Color(42, 84, 37), tile424 }, - { new Color(216, 49, 106), tile425 }, - { new Color(71, 104, 190), tile426 }, - { new Color(89, 4, 118), tile427 }, - { new Color(203, 47, 114), tile428 }, - { new Color(97, 12, 228), tile429 }, - { new Color(204, 168, 24), tile430 }, - { new Color(29, 30, 5), tile431 }, - { new Color(71, 29, 69), tile432 }, - { new Color(26, 6, 255), tile433 }, - { new Color(223, 255, 11), tile434 }, - { new Color(10, 139, 36), tile435 }, - { new Color(213, 61, 128), tile436 }, - { new Color(150, 188, 207), tile437 }, - { new Color(190, 133, 51), tile438 }, - { new Color(175, 188, 3), tile439 }, - { new Color(129, 56, 179), tile440 }, - { new Color(74, 126, 87), tile441 }, - { new Color(135, 12, 53), tile442 }, - { new Color(32, 145, 19), tile443 }, - { new Color(36, 44, 97), tile444 }, - { new Color(190, 122, 4), tile445 }, - { new Color(107, 192, 164), tile446 }, - { new Color(78, 140, 206), tile447 }, - { new Color(99, 54, 235), tile448 }, - { new Color(73, 95, 153), tile449 }, - { new Color(209, 152, 96), tile450 }, - { new Color(65, 153, 206), tile451 }, - { new Color(76, 149, 129), tile452 }, - { new Color(179, 131, 127), tile453 }, - { new Color(239, 180, 172), tile454 }, - { new Color(109, 114, 143), tile455 }, - { new Color(109, 255, 11), tile456 }, - { new Color(47, 67, 251), tile457 }, - { new Color(95, 51, 172), tile458 }, - { new Color(228, 231, 72), tile459 }, - { new Color(107, 61, 173), tile460 }, - { new Color(156, 78, 248), tile461 }, - { new Color(179, 226, 147), tile462 }, - { new Color(147, 113, 228), tile463 }, - { new Color(131, 183, 61), tile464 }, - { new Color(37, 94, 215), tile465 }, - { new Color(34, 246, 195), tile466 }, - { new Color(91, 219, 96), tile467 }, - { new Color(141, 162, 84), tile468 }, - { new Color(101, 226, 101), tile469 }, - { new Color(34, 104, 174), tile470 }, - { new Color(57, 72, 69), tile471 }, - { new Color(209, 82, 102), tile472 }, - { new Color(179, 186, 143), tile473 }, - { new Color(252, 218, 141), tile474 }, - { new Color(38, 172, 139), tile475 }, - { new Color(190, 58, 212), tile476 }, - { new Color(212, 193, 241), tile477 }, - { new Color(132, 15, 98), tile478 }, - { new Color(77, 15, 172), tile479 }, - { new Color(164, 77, 0), tile480 }, - { new Color(45, 113, 9), tile481 }, - { new Color(54, 73, 111), tile482 }, - { new Color(247, 83, 12), tile483 }, - { new Color(113, 111, 60), tile484 }, - { new Color(51, 95, 1), tile485 }, - { new Color(210, 102, 246), tile486 }, - { new Color(200, 166, 167), tile487 }, - { new Color(145, 77, 167), tile488 }, - { new Color(189, 180, 56), tile489 }, - { new Color(227, 132, 67), tile490 }, - { new Color(185, 15, 108), tile491 }, - { new Color(143, 206, 105), tile492 }, - { new Color(132, 240, 98), tile493 }, - { new Color(28, 198, 230), tile494 }, - { new Color(199, 99, 82), tile495 }, - { new Color(181, 80, 176), tile496 }, - { new Color(96, 122, 168), tile497 }, - { new Color(181, 219, 166), tile498 }, - { new Color(88, 156, 35), tile499 }, - { new Color(98, 121, 148), tile500 }, - { new Color(54, 20, 206), tile501 }, - { new Color(201, 183, 95), tile502 }, - { new Color(207, 164, 144), tile503 }, - { new Color(152, 78, 118), tile504 }, - { new Color(148, 172, 224), tile505 }, - { new Color(192, 201, 233), tile506 }, - { new Color(84, 8, 100), tile507 }, - { new Color(136, 130, 10), tile508 }, - { new Color(155, 3, 51), tile509 }, - { new Color(197, 54, 50), tile510 }, - { new Color(69, 33, 118), tile511 }, - { new Color(205, 229, 178), tile512 }, - { new Color(24, 254, 172), tile513 }, - { new Color(242, 229, 172), tile514 }, - { new Color(31, 200, 44), tile515 }, - { new Color(49, 33, 46), tile516 }, - { new Color(198, 151, 210), tile517 }, - { new Color(58, 13, 113), tile518 }, - { new Color(48, 174, 145), tile519 }, - { new Color(196, 46, 179), tile520 }, - { new Color(43, 10, 109), tile521 }, - { new Color(94, 82, 44), tile522 }, - { new Color(0, 198, 198), tile523 }, - { new Color(45, 168, 203), tile524 }, - { new Color(60, 97, 34), tile525 }, - { new Color(183, 104, 185), tile526 }, - { new Color(222, 105, 225), tile527 }, - { new Color(5, 254, 159), tile528 }, - { new Color(96, 10, 20), tile529 }, - { new Color(5, 156, 54), tile530 }, - { new Color(32, 83, 207), tile531 }, - { new Color(248, 198, 218), tile532 }, - { new Color(63, 192, 118), tile533 }, - { new Color(255, 49, 91), tile534 }, - { new Color(103, 152, 238), tile535 }, - { new Color(7, 253, 172), tile536 }, - { new Color(78, 121, 69), tile537 }, - { new Color(216, 230, 196), tile538 }, - { new Color(209, 38, 11), tile539 }, - { new Color(206, 254, 71), tile540 }, - { new Color(24, 250, 42), tile541 }, - { new Color(144, 13, 85), tile542 }, - { new Color(251, 67, 154), tile543 }, - { new Color(72, 120, 167), tile544 }, - { new Color(67, 222, 56), tile545 }, - { new Color(134, 157, 102), tile546 }, - { new Color(176, 88, 13), tile547 }, - { new Color(103, 183, 35), tile548 }, - { new Color(240, 72, 109), tile549 }, - { new Color(11, 39, 160), tile550 }, - { new Color(207, 112, 194), tile551 }, - { new Color(46, 230, 54), tile552 }, - { new Color(48, 215, 139), tile553 }, - { new Color(153, 11, 185), tile554 }, - { new Color(17, 6, 0), tile555 }, - { new Color(157, 148, 7), tile556 }, - { new Color(140, 74, 137), tile557 }, - { new Color(164, 29, 165), tile558 }, - { new Color(58, 176, 67), tile559 }, - { new Color(7, 159, 196), tile560 }, - { new Color(232, 240, 28), tile561 }, - { new Color(250, 120, 7), tile562 }, - { new Color(229, 20, 248), tile563 }, - { new Color(2, 86, 197), tile564 }, - { new Color(219, 23, 77), tile565 }, - { new Color(83, 86, 177), tile566 }, - { new Color(34, 83, 180), tile567 }, - { new Color(101, 127, 220), tile568 }, - { new Color(22, 42, 83), tile569 }, - { new Color(29, 243, 54), tile570 }, - { new Color(243, 41, 56), tile571 }, - { new Color(198, 176, 27), tile572 }, - { new Color(156, 22, 141), tile573 }, - { new Color(249, 184, 127), tile574 }, - { new Color(15, 138, 244), tile575 }, - { new Color(196, 201, 6), tile576 }, - { new Color(88, 230, 90), tile577 }, - { new Color(146, 229, 76), tile578 }, - { new Color(16, 131, 113), tile579 }, - { new Color(64, 228, 78), tile580 }, - { new Color(180, 200, 33), tile581 }, - { new Color(194, 14, 44), tile582 }, - { new Color(140, 20, 102), tile583 }, - { new Color(49, 182, 63), tile584 }, - { new Color(35, 41, 154), tile585 }, - { new Color(52, 85, 245), tile586 }, - { new Color(231, 82, 96), tile587 }, - { new Color(77, 197, 13), tile588 }, - { new Color(219, 97, 68), tile589 }, - { new Color(236, 182, 45), tile590 }, - { new Color(170, 92, 50), tile591 }, - { new Color(63, 68, 240), tile592 }, - { new Color(94, 77, 123), tile593 }, - { new Color(199, 55, 181), tile594 }, - { new Color(159, 38, 48), tile595 }, - { new Color(26, 110, 187), tile596 }, - { new Color(177, 219, 45), tile597 }, - { new Color(124, 88, 145), tile598 }, - { new Color(237, 103, 3), tile599 }, - { new Color(20, 230, 173), tile600 }, - { new Color(232, 160, 93), tile601 }, - { new Color(56, 135, 89), tile602 }, - { new Color(13, 228, 228), tile603 }, - { new Color(170, 213, 8), tile604 }, - { new Color(121, 31, 26), tile605 }, - { new Color(171, 173, 158), tile606 }, - { new Color(220, 193, 242), tile607 }, - { new Color(136, 59, 218), tile608 }, - { new Color(0, 45, 4), tile609 }, - { new Color(160, 82, 221), tile610 }, - { new Color(236, 74, 103), tile611 }, - { new Color(205, 223, 151), tile612 }, - { new Color(87, 103, 158), tile613 }, - { new Color(214, 12, 137), tile614 }, - { new Color(215, 6, 5), tile615 }, - { new Color(37, 2, 56), tile616 }, - { new Color(119, 65, 186), tile617 }, - { new Color(100, 55, 36), tile618 }, - { new Color(186, 95, 101), tile619 }, - { new Color(130, 55, 89), tile620 }, - { new Color(85, 108, 146), tile621 }, - { new Color(7, 189, 139), tile622 }, - { new Color(160, 172, 64), tile623 }, - { new Color(130, 83, 69), tile624 }, - { new Color(0, 6, 181), tile625 }, - { new Color(105, 177, 52), tile626 }, - { new Color(213, 219, 43), tile627 }, - { new Color(203, 41, 16), tile628 }, - { new Color(35, 136, 19), tile629 }, - { new Color(67, 18, 127), tile630 }, - { new Color(50, 213, 47), tile631 }, - { new Color(68, 128, 160), tile632 }, - { new Color(247, 208, 73), tile633 }, - { new Color(122, 132, 85), tile634 }, - { new Color(248, 244, 238), tile635 }, - { new Color(116, 100, 48), tile636 }, - { new Color(111, 81, 174), tile637 }, - { new Color(48, 173, 92), tile638 }, - { new Color(46, 137, 67), tile639 }, - { new Color(129, 227, 53), tile640 }, - { new Color(120, 93, 153), tile641 }, - { new Color(192, 80, 125), tile642 }, - { new Color(22, 187, 133), tile643 }, - { new Color(20, 113, 225), tile644 }, - { new Color(235, 91, 87), tile645 }, - { new Color(213, 211, 52), tile646 }, - { new Color(33, 175, 36), tile647 }, - { new Color(226, 211, 192), tile648 }, - { new Color(209, 1, 40), tile649 }, - { new Color(210, 22, 246), tile650 }, - { new Color(92, 117, 236), tile651 }, - { new Color(19, 2, 38), tile652 }, - { new Color(187, 55, 163), tile653 }, - { new Color(112, 93, 168), tile654 }, - { new Color(170, 90, 224), tile655 }, - { new Color(205, 69, 82), tile656 }, - { new Color(5, 88, 181), tile657 }, - { new Color(14, 96, 52), tile658 }, - { new Color(17, 149, 137), tile659 }, - { new Color(217, 238, 79), tile660 }, - { new Color(85, 67, 165), tile661 }, - { new Color(142, 183, 251), tile662 }, - { new Color(244, 215, 88), tile663 }, - { new Color(48, 26, 156), tile664 }, - { new Color(145, 176, 81), tile665 }, - { new Color(124, 55, 121), tile666 }, - { new Color(224, 4, 187), tile667 }, - { new Color(213, 205, 190), tile668 }, - { new Color(64, 78, 21), tile669 }, - { new Color(183, 2, 108), tile670 }, - { new Color(156, 226, 72), tile671 }, - { new Color(84, 27, 25), tile672 }, - { new Color(2, 27, 162), tile673 }, - { new Color(229, 216, 110), tile674 }, - { new Color(249, 213, 62), tile675 }, - { new Color(25, 125, 175), tile676 }, - { new Color(227, 149, 93), tile677 }, - { new Color(16, 249, 234), tile678 }, - { new Color(147, 127, 118), tile679 }, - { new Color(231, 77, 105), tile680 }, - { new Color(230, 61, 213), tile681 }, - { new Color(236, 147, 55), tile682 }, - { new Color(83, 60, 149), tile683 }, - { new Color(55, 121, 27), tile684 }, - { new Color(214, 251, 43), tile685 }, - { new Color(77, 220, 247), tile686 }, - { new Color(127, 39, 209), tile687 }, - { new Color(101, 212, 109), tile688 }, - { new Color(14, 140, 233), tile689 }, - { new Color(93, 193, 155), tile690 }, - { new Color(163, 27, 206), tile691 }, - { new Color(57, 254, 155), tile692 }, - { new Color(153, 12, 65), tile693 }, - { new Color(6, 198, 65), tile694 }, - { new Color(26, 172, 27), tile695 }, - { new Color(66, 57, 254), tile696 }, - { new Color(190, 70, 162), tile697 }, - { new Color(126, 103, 38), tile698 }, - { new Color(152, 128, 104), tile699 }, - { new Color(103, 221, 7), tile700 }, - { new Color(78, 245, 122), tile701 }, - { new Color(250, 147, 93), tile702 }, - { new Color(77, 157, 252), tile703 }, - { new Color(144, 180, 207), tile704 }, - { new Color(182, 121, 96), tile705 }, - { new Color(144, 75, 40), tile706 }, - { new Color(81, 204, 82), tile707 }, - { new Color(235, 159, 123), tile708 }, - { new Color(248, 36, 180), tile709 }, - { new Color(167, 161, 125), tile710 }, - { new Color(50, 49, 47), tile711 }, - { new Color(58, 184, 208), tile712 }, - { new Color(198, 31, 24), tile713 }, - { new Color(190, 244, 156), tile714 }, - { new Color(1, 46, 145), tile715 }, - { new Color(211, 200, 237), tile716 }, - { new Color(198, 7, 53), tile717 }, - { new Color(64, 22, 16), tile718 }, - { new Color(180, 98, 86), tile719 }, - { new Color(255, 1, 111), tile720 }, - { new Color(169, 166, 252), tile721 }, - { new Color(126, 94, 131), tile722 }, - { new Color(160, 123, 192), tile723 }, - { new Color(144, 202, 43), tile724 }, - { new Color(16, 146, 216), tile725 }, - { new Color(182, 233, 112), tile726 }, - { new Color(233, 37, 92), tile727 }, - { new Color(198, 225, 153), tile728 }, - { new Color(72, 241, 26), tile729 }, - { new Color(30, 133, 85), tile730 }, - { new Color(122, 198, 30), tile731 }, - { new Color(169, 21, 77), tile732 }, - { new Color(159, 131, 207), tile733 }, - { new Color(14, 50, 76), tile734 }, - { new Color(45, 54, 61), tile735 }, - { new Color(10, 48, 131), tile736 }, - { new Color(56, 254, 121), tile737 }, - { new Color(229, 22, 220), tile738 }, - { new Color(18, 226, 197), tile739 }, - { new Color(99, 54, 108), tile740 }, - { new Color(104, 129, 245), tile741 }, - { new Color(107, 21, 3), tile742 }, - { new Color(13, 103, 125), tile743 }, - { new Color(138, 22, 102), tile744 }, - { new Color(161, 218, 242), tile745 }, - { new Color(15, 153, 171), tile746 }, - { new Color(91, 61, 192), tile747 }, - { new Color(150, 230, 135), tile748 }, - { new Color(220, 148, 175), tile749 }, - { new Color(65, 150, 50), tile750 }, - { new Color(136, 60, 77), tile751 }, - { new Color(98, 166, 176), tile752 }, - { new Color(86, 193, 32), tile753 }, - { new Color(58, 253, 201), tile754 }, - { new Color(6, 173, 231), tile755 }, - { new Color(19, 68, 60), tile756 }, - { new Color(234, 2, 73), tile757 }, - { new Color(26, 8, 248), tile758 }, - { new Color(172, 209, 155), tile759 }, - { new Color(110, 143, 128), tile760 }, - { new Color(84, 203, 208), tile761 }, - { new Color(74, 2, 218), tile762 }, - { new Color(24, 62, 52), tile763 }, - { new Color(65, 185, 215), tile764 }, - { new Color(138, 33, 64), tile765 }, - { new Color(247, 144, 56), tile766 }, - { new Color(160, 200, 80), tile767 }, - { new Color(115, 87, 148), tile768 }, - { new Color(233, 110, 52), tile769 }, - { new Color(85, 182, 212), tile770 }, - { new Color(21, 232, 50), tile771 }, - { new Color(159, 230, 49), tile772 }, - { new Color(249, 187, 171), tile773 }, - { new Color(12, 250, 6), tile774 }, - { new Color(8, 168, 73), tile775 }, - { new Color(113, 143, 230), tile776 }, - { new Color(183, 180, 65), tile777 }, - { new Color(98, 205, 198), tile778 }, - { new Color(48, 224, 116), tile779 }, - { new Color(60, 96, 147), tile780 }, - { new Color(166, 195, 135), tile781 }, - { new Color(95, 44, 208), tile782 }, - { new Color(164, 235, 59), tile783 }, - { new Color(15, 254, 212), tile784 }, - { new Color(140, 147, 205), tile785 }, - { new Color(74, 107, 174), tile786 }, - { new Color(74, 120, 222), tile787 }, - { new Color(77, 157, 2), tile788 }, - { new Color(146, 178, 27), tile789 }, - { new Color(108, 111, 5), tile790 }, - { new Color(188, 188, 91), tile791 }, - { new Color(23, 102, 55), tile792 }, - { new Color(126, 168, 124), tile793 }, - { new Color(120, 204, 164), tile794 }, - { new Color(171, 168, 182), tile795 }, - { new Color(109, 213, 58), tile796 }, - { new Color(248, 229, 117), tile797 }, - { new Color(197, 241, 232), tile798 }, - { new Color(181, 89, 37), tile799 }, - { new Color(133, 205, 121), tile800 }, - { new Color(181, 56, 123), tile801 }, - { new Color(53, 82, 65), tile802 }, - { new Color(121, 117, 45), tile803 }, - { new Color(150, 203, 194), tile804 }, - { new Color(50, 209, 171), tile805 }, - { new Color(58, 161, 245), tile806 }, - { new Color(75, 37, 220), tile807 }, - { new Color(224, 115, 138), tile808 }, - { new Color(144, 246, 202), tile809 }, - { new Color(114, 98, 13), tile810 }, - { new Color(17, 249, 219), tile811 }, - { new Color(3, 195, 148), tile812 }, - { new Color(41, 118, 86), tile813 }, - { new Color(117, 244, 96), tile814 }, - { new Color(13, 98, 25), tile815 }, - { new Color(178, 147, 32), tile816 }, - { new Color(60, 123, 184), tile817 }, - { new Color(48, 58, 167), tile818 }, - { new Color(156, 212, 197), tile819 }, - { new Color(241, 165, 91), tile820 }, - { new Color(118, 6, 19), tile821 }, - { new Color(31, 132, 210), tile822 }, - { new Color(231, 46, 14), tile823 }, - { new Color(23, 17, 42), tile824 }, - { new Color(159, 214, 49), tile825 }, - { new Color(124, 211, 17), tile826 }, - { new Color(112, 221, 99), tile827 }, - { new Color(170, 54, 231), tile828 }, - { new Color(85, 225, 191), tile829 }, - { new Color(51, 102, 239), tile830 }, - { new Color(206, 55, 209), tile831 }, - { new Color(250, 254, 238), tile832 }, - { new Color(77, 237, 221), tile833 }, - { new Color(71, 203, 100), tile834 }, - { new Color(17, 37, 106), tile835 }, - { new Color(141, 145, 99), tile836 }, - { new Color(118, 31, 1), tile837 }, - { new Color(180, 128, 200), tile838 }, - { new Color(248, 204, 207), tile839 }, - { new Color(43, 202, 163), tile840 }, - { new Color(18, 179, 200), tile841 }, - { new Color(31, 72, 217), tile842 }, - { new Color(89, 164, 215), tile843 }, - { new Color(67, 46, 230), tile844 }, - { new Color(51, 41, 17), tile845 }, - { new Color(254, 152, 17), tile846 }, - { new Color(125, 199, 80), tile847 }, - { new Color(91, 189, 70), tile848 }, - { new Color(238, 26, 183), tile849 }, - { new Color(9, 2, 50), tile850 }, - { new Color(30, 33, 34), tile851 }, - { new Color(58, 52, 24), tile852 }, - { new Color(156, 242, 220), tile853 }, - { new Color(144, 51, 236), tile854 }, - { new Color(140, 51, 241), tile855 }, - { new Color(26, 128, 87), tile856 }, - { new Color(182, 249, 51), tile857 }, - { new Color(190, 174, 3), tile858 }, - { new Color(83, 183, 246), tile859 }, - { new Color(129, 49, 45), tile860 }, - { new Color(34, 80, 162), tile861 }, - { new Color(165, 36, 13), tile862 }, - { new Color(195, 249, 244), tile863 }, - { new Color(249, 97, 166), tile864 }, - { new Color(52, 236, 147), tile865 }, - { new Color(99, 207, 137), tile866 }, - { new Color(85, 211, 154), tile867 }, - { new Color(95, 82, 8), tile868 }, - { new Color(255, 95, 114), tile869 }, - { new Color(31, 230, 124), tile870 }, - { new Color(34, 27, 193), tile871 }, - { new Color(174, 110, 227), tile872 }, - { new Color(74, 230, 14), tile873 }, - { new Color(227, 87, 135), tile874 }, - { new Color(98, 189, 152), tile875 }, - { new Color(141, 138, 194), tile876 }, - { new Color(111, 239, 232), tile877 }, - { new Color(108, 43, 93), tile878 }, - { new Color(147, 194, 254), tile879 }, - { new Color(153, 166, 197), tile880 }, - { new Color(154, 164, 18), tile881 }, - { new Color(120, 214, 70), tile882 }, - { new Color(228, 133, 125), tile883 }, - { new Color(176, 24, 232), tile884 }, - { new Color(122, 114, 124), tile885 }, - { new Color(18, 253, 149), tile886 }, - { new Color(112, 113, 212), tile887 }, - { new Color(176, 175, 247), tile888 }, - { new Color(148, 182, 239), tile889 }, - { new Color(100, 27, 172), tile890 }, - { new Color(229, 177, 64), tile891 }, - { new Color(73, 72, 178), tile892 }, - { new Color(117, 234, 230), tile893 }, - { new Color(81, 169, 4), tile894 }, - { new Color(69, 190, 215), tile895 }, - { new Color(255, 241, 185), tile896 }, - { new Color(225, 129, 197), tile897 }, - { new Color(104, 40, 52), tile898 }, - { new Color(240, 234, 244), tile899 }, - { new Color(26, 227, 32), tile900 }, - { new Color(87, 128, 106), tile901 }, - { new Color(208, 203, 103), tile902 }, - { new Color(167, 49, 41), tile903 }, - { new Color(201, 156, 18), tile904 }, - { new Color(174, 31, 200), tile905 }, - { new Color(208, 106, 241), tile906 }, - { new Color(31, 148, 196), tile907 }, - { new Color(53, 130, 153), tile908 }, - { new Color(231, 124, 136), tile909 }, - { new Color(11, 88, 94), tile910 }, - { new Color(189, 90, 6), tile911 }, - { new Color(197, 250, 40), tile912 }, - { new Color(154, 116, 243), tile913 }, - { new Color(111, 87, 191), tile914 }, - { new Color(144, 23, 228), tile915 }, - { new Color(178, 186, 9), tile916 }, - { new Color(107, 32, 128), tile917 }, - { new Color(3, 251, 79), tile918 }, - { new Color(92, 33, 253), tile919 }, - { new Color(208, 233, 79), tile920 }, - { new Color(223, 156, 217), tile921 }, - { new Color(202, 11, 65), tile922 }, - { new Color(11, 233, 36), tile923 }, - { new Color(160, 53, 245), tile924 }, - { new Color(253, 176, 60), tile925 }, - { new Color(5, 165, 106), tile926 }, - { new Color(181, 52, 194), tile927 }, - { new Color(126, 160, 55), tile928 }, - { new Color(222, 186, 95), tile929 }, - { new Color(183, 105, 217), tile930 }, - { new Color(43, 201, 139), tile931 }, - { new Color(164, 144, 187), tile932 }, - { new Color(230, 197, 12), tile933 }, - { new Color(162, 167, 209), tile934 }, - { new Color(228, 203, 235), tile935 }, - { new Color(138, 5, 74), tile936 }, - { new Color(18, 86, 123), tile937 }, - { new Color(147, 27, 180), tile938 }, - { new Color(140, 96, 251), tile939 }, - { new Color(161, 236, 81), tile940 }, - { new Color(226, 83, 127), tile941 }, - { new Color(75, 116, 107), tile942 }, - { new Color(106, 89, 32), tile943 }, - { new Color(128, 30, 223), tile944 }, - { new Color(94, 18, 141), tile945 }, - { new Color(241, 153, 212), tile946 }, - { new Color(76, 84, 180), tile947 }, - { new Color(20, 165, 18), tile948 }, - { new Color(93, 151, 174), tile949 }, - { new Color(214, 23, 47), tile950 }, - { new Color(192, 68, 217), tile951 }, - { new Color(186, 192, 83), tile952 }, - { new Color(81, 153, 86), tile953 }, - { new Color(127, 31, 172), tile954 }, - { new Color(42, 146, 55), tile955 }, - { new Color(155, 53, 8), tile956 }, - { new Color(39, 155, 199), tile957 }, - { new Color(38, 84, 152), tile958 }, - { new Color(156, 205, 174), tile959 }, - { new Color(108, 237, 221), tile960 }, - { new Color(188, 148, 66), tile961 }, - { new Color(240, 192, 218), tile962 }, - { new Color(6, 163, 82), tile963 }, - { new Color(57, 159, 0), tile964 }, - { new Color(126, 205, 52), tile965 }, - { new Color(8, 234, 18), tile966 }, - { new Color(218, 194, 98), tile967 }, - { new Color(166, 174, 123), tile968 }, - { new Color(104, 153, 239), tile969 }, - { new Color(65, 29, 243), tile970 }, - { new Color(164, 228, 172), tile971 }, - { new Color(121, 194, 138), tile972 }, - { new Color(105, 57, 209), tile973 }, - { new Color(93, 148, 145), tile974 }, - { new Color(182, 237, 252), tile975 }, - { new Color(199, 168, 135), tile976 }, - { new Color(99, 148, 227), tile977 }, - { new Color(155, 146, 43), tile978 }, - { new Color(122, 22, 229), tile979 }, - { new Color(198, 136, 38), tile980 }, - { new Color(234, 197, 133), tile981 }, - { new Color(94, 149, 186), tile982 }, - { new Color(83, 4, 10), tile983 }, - { new Color(169, 158, 176), tile984 }, - { new Color(64, 125, 45), tile985 }, - { new Color(209, 239, 192), tile986 }, - { new Color(127, 161, 240), tile987 }, - { new Color(104, 221, 137), tile988 }, - { new Color(16, 9, 82), tile989 }, - { new Color(128, 255, 171), tile990 }, - { new Color(164, 162, 177), tile991 }, - { new Color(171, 114, 207), tile992 }, - { new Color(11, 87, 88), tile993 }, - { new Color(65, 115, 163), tile994 }, - { new Color(124, 185, 245), tile995 }, - { new Color(50, 90, 21), tile996 }, - { new Color(253, 169, 39), tile997 }, - { new Color(37, 71, 230), tile998 }, - { new Color(53, 130, 231), tile999 }, - { new Color(252, 78, 140), tile1000 }, - { new Color(104, 210, 5), tile1001 }, - { new Color(95, 5, 252), tile1002 }, - { new Color(254, 149, 10), tile1003 }, - { new Color(94, 197, 151), tile1004 }, - { new Color(103, 62, 46), tile1005 }, - { new Color(76, 235, 36), tile1006 }, - { new Color(148, 221, 174), tile1007 }, - { new Color(61, 131, 85), tile1008 }, - { new Color(132, 127, 91), tile1009 }, - { new Color(202, 117, 239), tile1010 }, - { new Color(231, 15, 9), tile1011 }, - { new Color(204, 217, 160), tile1012 }, - { new Color(158, 29, 180), tile1013 }, - { new Color(249, 51, 197), tile1014 }, - { new Color(10, 159, 227), tile1015 }, - { new Color(143, 189, 9), tile1016 }, - { new Color(184, 232, 151), tile1017 }, - { new Color(195, 103, 113), tile1018 }, - { new Color(221, 42, 79), tile1019 }, - { new Color(175, 219, 133), tile1020 }, - { new Color(160, 51, 32), tile1021 }, - { new Color(26, 118, 181), tile1022 }, - { new Color(142, 154, 100), tile1023 }, - { new Color(141, 174, 205), tile1024 }, - { new Color(112, 155, 169), tile1025 }, - { new Color(233, 51, 227), tile1026 }, - { new Color(113, 244, 194), tile1027 }, - { new Color(82, 18, 140), tile1028 }, - { new Color(88, 36, 168), tile1029 }, - { new Color(151, 239, 174), tile1030 }, - { new Color(80, 238, 66), tile1031 }, - { new Color(46, 88, 0), tile1032 }, - { new Color(164, 239, 41), tile1033 }, - { new Color(46, 1, 34), tile1034 }, - { new Color(164, 42, 58), tile1035 }, - { new Color(201, 82, 204), tile1036 }, - { new Color(199, 244, 247), tile1037 }, - { new Color(108, 61, 230), tile1038 }, - { new Color(195, 77, 33), tile1039 }, - { new Color(147, 194, 82), tile1040 }, - { new Color(13, 246, 171), tile1041 }, - { new Color(181, 61, 192), tile1042 }, - { new Color(139, 65, 66), tile1043 }, - { new Color(169, 68, 67), tile1044 }, - { new Color(186, 67, 243), tile1045 }, - { new Color(159, 174, 231), tile1046 }, - { new Color(82, 142, 209), tile1047 }, - { new Color(219, 208, 250), tile1048 }, - { new Color(183, 228, 176), tile1049 }, - { new Color(91, 107, 10), tile1050 }, - { new Color(222, 17, 45), tile1051 }, - { new Color(215, 33, 10), tile1052 }, - { new Color(118, 238, 237), tile1053 }, - { new Color(122, 62, 17), tile1054 }, - { new Color(137, 29, 176), tile1055 }, - { new Color(180, 178, 250), tile1056 }, - { new Color(243, 35, 159), tile1057 }, - { new Color(57, 64, 51), tile1058 }, - { new Color(128, 49, 38), tile1059 }, - { new Color(177, 254, 88), tile1060 }, - { new Color(15, 47, 213), tile1061 }, - { new Color(55, 203, 50), tile1062 }, - { new Color(21, 227, 34), tile1063 }, - { new Color(233, 41, 191), tile1064 }, - { new Color(250, 216, 79), tile1065 }, - { new Color(191, 81, 178), tile1066 }, - { new Color(73, 2, 50), tile1067 }, - { new Color(182, 104, 72), tile1068 }, - { new Color(107, 164, 209), tile1069 }, - { new Color(249, 86, 239), tile1070 }, - { new Color(227, 197, 239), tile1071 }, - { new Color(148, 106, 15), tile1072 }, - { new Color(60, 82, 82), tile1073 }, - { new Color(125, 159, 206), tile1074 }, - { new Color(215, 10, 250), tile1075 }, - { new Color(223, 63, 104), tile1076 }, - { new Color(227, 193, 223), tile1077 }, - { new Color(116, 103, 251), tile1078 }, - { new Color(38, 88, 198), tile1079 }, - { new Color(140, 204, 38), tile1080 }, - { new Color(97, 27, 140), tile1081 }, - { new Color(51, 5, 100), tile1082 }, - { new Color(208, 101, 109), tile1083 }, - { new Color(64, 131, 255), tile1084 }, - { new Color(95, 203, 99), tile1085 }, - { new Color(99, 222, 94), tile1086 }, - { new Color(78, 139, 100), tile1087 }, - { new Color(104, 21, 149), tile1088 }, - { new Color(15, 111, 93), tile1089 }, - { new Color(244, 109, 17), tile1090 }, - { new Color(72, 175, 133), tile1091 }, - { new Color(44, 28, 131), tile1092 }, - { new Color(66, 164, 4), tile1093 }, - { new Color(150, 15, 218), tile1094 }, - { new Color(250, 163, 61), tile1095 }, - { new Color(224, 21, 155), tile1096 }, - { new Color(151, 195, 122), tile1097 }, - { new Color(104, 62, 65), tile1098 }, - { new Color(193, 248, 5), tile1099 }, - { new Color(247, 35, 150), tile1100 }, - { new Color(6, 220, 247), tile1101 }, - { new Color(91, 248, 211), tile1102 }, - { new Color(122, 50, 175), tile1103 }, - { new Color(224, 33, 57), tile1104 }, - { new Color(89, 184, 123), tile1105 }, - { new Color(138, 110, 114), tile1106 }, - { new Color(87, 46, 89), tile1107 }, - { new Color(193, 92, 170), tile1108 }, - { new Color(151, 223, 113), tile1109 }, - { new Color(67, 106, 35), tile1110 }, - { new Color(125, 74, 129), tile1111 }, - { new Color(110, 143, 51), tile1112 }, - { new Color(226, 158, 171), tile1113 }, - { new Color(106, 102, 226), tile1114 }, - { new Color(236, 183, 162), tile1115 }, - { new Color(65, 15, 133), tile1116 }, - { new Color(197, 55, 138), tile1117 }, - { new Color(147, 160, 244), tile1118 }, - { new Color(60, 68, 127), tile1119 }, - { new Color(76, 196, 24), tile1120 }, - { new Color(97, 54, 200), tile1121 }, - { new Color(139, 98, 214), tile1122 }, - { new Color(184, 234, 41), tile1123 }, - { new Color(71, 167, 207), tile1124 }, - { new Color(198, 237, 200), tile1125 }, - { new Color(119, 213, 164), tile1126 }, - { new Color(8, 86, 208), tile1127 }, - { new Color(236, 126, 50), tile1128 }, - { new Color(153, 234, 170), tile1129 }, - { new Color(140, 49, 74), tile1130 }, - { new Color(179, 150, 218), tile1131 }, - { new Color(147, 8, 48), tile1132 }, - { new Color(25, 96, 85), tile1133 }, - { new Color(203, 136, 36), tile1134 }, - { new Color(92, 125, 144), tile1135 }, - { new Color(186, 204, 179), tile1136 }, - { new Color(44, 197, 111), tile1137 }, - { new Color(219, 68, 110), tile1138 }, - { new Color(71, 117, 184), tile1139 }, - { new Color(149, 241, 119), tile1140 }, - { new Color(44, 43, 184), tile1141 }, - { new Color(222, 148, 17), tile1142 }, - { new Color(245, 51, 228), tile1143 }, - { new Color(152, 93, 116), tile1144 }, - { new Color(78, 60, 205), tile1145 }, - { new Color(172, 143, 0), tile1146 }, - { new Color(162, 223, 30), tile1147 }, - { new Color(247, 96, 108), tile1148 }, - { new Color(218, 216, 81), tile1149 }, - { new Color(107, 75, 146), tile1150 }, - { new Color(120, 131, 111), tile1151 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.png b/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.png deleted file mode 100644 index 0297d101d4..0000000000 Binary files a/Schematics/AutoGeneratedContent/PlagueLaboratorySchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic.cs deleted file mode 100644 index ec74020be3..0000000000 --- a/Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic.cs +++ /dev/null @@ -1,1075 +0,0 @@ -using CalamityMod.Tiles; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Tiles.Plates; -using CalamityMod.Walls; -using CalamityMod.Walls.DraedonStructures; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class PlanetoidLaboratorySchematic - { - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 0); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 36); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile13 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile14 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile15 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 32).UseFrame(288, 54).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile19 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile20 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile26 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile32 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile45 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile47 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile51 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile52 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile53 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile54 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile55 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile58 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile64 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile65 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 74, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile72 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile76 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile77 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile85 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile89 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile95 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile96 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile97 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile98 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 3, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile113 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 0); - var tile114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile118 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile119 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile120 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile121 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile122 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile123 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile125 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 36); - var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile129 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile130 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile131 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile132 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile133 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile134 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile135 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile136 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile138 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile139 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile142 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0); - var tile143 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile144 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile145 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile146 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile147 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile148 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile152 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile153 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile155 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile158 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile159 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile160 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile161 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile162 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile163 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile165 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile166 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile167 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile168 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile169 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile170 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile171 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile172 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile174 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile175 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile176 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile177 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile178 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile184 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile185 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile186 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 0); - var tile188 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile189 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 37, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile194 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile195 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 4, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile198 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 133, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile199 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile200 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile201 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 0, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile216 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile217 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile218 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile219 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile221 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile232 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 101, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile237 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile238 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile239 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile240 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 4, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile247 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile249 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile255 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile256 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile257 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile268 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile274 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile275 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile277 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile281 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile282 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile283 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile284 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile289 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile295 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile296 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile297 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile298 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile299 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile300 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile301 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 64).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 80).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 96).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile312 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile315 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile316 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 138, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile317 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile318 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile323 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 64).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile326 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(16, 96).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile327 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile328 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile330 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile333 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile334 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile335 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile336 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile337 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile338 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile342 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 80).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile343 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(32, 96).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile349 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 232).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile350 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile352 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile353 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile358 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(48, 64).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile359 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile360 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(48, 96).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile363 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile364 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile365 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile366 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile367 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(64, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile368 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(64, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile369 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(64, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile370 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(64, 48).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile371 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 64).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile372 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(64, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile373 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(64, 96).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile375 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile376 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile377 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile378 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile379 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile380 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(80, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile381 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(80, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile382 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(80, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile383 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(80, 80).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseFrame(80, 96).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 4, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile389 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile390 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile391 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile392 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile393 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile394 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile397 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 4, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile399 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile400 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile401 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile402 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile403 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile404 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile405 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile406 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile407 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile408 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 3, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 216, 108); - var tile409 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile410 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile411 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile412 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile413 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile414 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile415 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile416 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile417 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile418 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile419 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 252, 0); - var tile420 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile421 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile422 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile423 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile424 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile425 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile426 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile427 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile428 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile429 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile430 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile431 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile432 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile433 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile434 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile435 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile436 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile437 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile438 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile439 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile440 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile441 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 4, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile442 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile443 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile444 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile445 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile446 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile447 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile448 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile449 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile450 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile451 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile452 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile453 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile454 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile455 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile456 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile457 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile458 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile459 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile460 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile461 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile462 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile463 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile464 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile465 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile466 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile467 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 3, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile468 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile469 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile470 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile471 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile472 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile473 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile474 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile475 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile476 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile477 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile478 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile479 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile480 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile481 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile482 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile483 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile484 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile487 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile488 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile489 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile490 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile491 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile492 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 71, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile493 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile494 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile495 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile496 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile497 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile500 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile501 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile502 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile503 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile504 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile505 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile506 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile507 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile508 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile509 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile511 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile512 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile516 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile517 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 36); - var tile518 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile519 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile520 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile521 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 172, 2, 32).UseFrame(306, 54).UseWall((ushort)ModContent.WallType(), 432, 72); - var tile522 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile523 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 0); - var tile524 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile525 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(171, 207, 220), tile2 }, - { new Color(31, 131, 98), tile3 }, - { new Color(15, 39, 51), tile4 }, - { new Color(76, 217, 213), tile5 }, - { new Color(36, 112, 202), tile6 }, - { new Color(45, 255, 45), tile7 }, - { new Color(16, 201, 129), tile8 }, - { new Color(71, 200, 35), tile9 }, - { new Color(41, 51, 153), tile10 }, - { new Color(118, 69, 50), tile11 }, - { new Color(139, 201, 160), tile12 }, - { new Color(224, 193, 254), tile13 }, - { new Color(181, 215, 209), tile14 }, - { new Color(227, 149, 89), tile15 }, - { new Color(148, 126, 40), tile16 }, - { new Color(56, 4, 25), tile17 }, - { new Color(236, 1, 244), tile18 }, - { new Color(22, 148, 168), tile19 }, - { new Color(84, 99, 7), tile20 }, - { new Color(184, 245, 80), tile21 }, - { new Color(200, 153, 225), tile22 }, - { new Color(1, 192, 15), tile23 }, - { new Color(53, 67, 174), tile24 }, - { new Color(203, 119, 39), tile25 }, - { new Color(91, 45, 51), tile26 }, - { new Color(39, 178, 73), tile27 }, - { new Color(251, 241, 47), tile28 }, - { new Color(128, 138, 68), tile29 }, - { new Color(62, 117, 53), tile30 }, - { new Color(247, 140, 93), tile31 }, - { new Color(247, 253, 226), tile32 }, - { new Color(128, 26, 252), tile33 }, - { new Color(120, 147, 189), tile34 }, - { new Color(24, 2, 192), tile35 }, - { new Color(106, 32, 137), tile36 }, - { new Color(205, 186, 102), tile37 }, - { new Color(117, 44, 177), tile38 }, - { new Color(189, 188, 4), tile39 }, - { new Color(33, 72, 15), tile40 }, - { new Color(157, 194, 75), tile41 }, - { new Color(217, 61, 183), tile42 }, - { new Color(81, 212, 122), tile43 }, - { new Color(68, 218, 18), tile44 }, - { new Color(55, 174, 31), tile45 }, - { new Color(140, 226, 238), tile46 }, - { new Color(110, 21, 105), tile47 }, - { new Color(186, 113, 186), tile48 }, - { new Color(206, 130, 95), tile49 }, - { new Color(172, 57, 64), tile50 }, - { new Color(222, 95, 210), tile51 }, - { new Color(237, 218, 208), tile52 }, - { new Color(113, 62, 196), tile53 }, - { new Color(9, 25, 76), tile54 }, - { new Color(15, 136, 223), tile55 }, - { new Color(84, 62, 125), tile56 }, - { new Color(145, 49, 218), tile57 }, - { new Color(21, 178, 50), tile58 }, - { new Color(165, 227, 81), tile59 }, - { new Color(144, 11, 187), tile60 }, - { new Color(87, 164, 155), tile61 }, - { new Color(57, 102, 123), tile62 }, - { new Color(63, 74, 212), tile63 }, - { new Color(78, 26, 163), tile64 }, - { new Color(42, 101, 252), tile65 }, - { new Color(29, 170, 232), tile66 }, - { new Color(219, 122, 68), tile67 }, - { new Color(225, 26, 8), tile68 }, - { new Color(102, 201, 173), tile69 }, - { new Color(160, 71, 247), tile70 }, - { new Color(126, 225, 51), tile71 }, - { new Color(9, 177, 116), tile72 }, - { new Color(177, 213, 34), tile73 }, - { new Color(100, 20, 243), tile74 }, - { new Color(169, 67, 22), tile75 }, - { new Color(54, 234, 77), tile76 }, - { new Color(54, 135, 56), tile77 }, - { new Color(105, 181, 144), tile78 }, - { new Color(119, 117, 137), tile79 }, - { new Color(146, 211, 157), tile80 }, - { new Color(206, 158, 2), tile81 }, - { new Color(220, 208, 57), tile82 }, - { new Color(111, 33, 179), tile83 }, - { new Color(135, 108, 212), tile84 }, - { new Color(198, 119, 101), tile85 }, - { new Color(80, 55, 215), tile86 }, - { new Color(241, 48, 222), tile87 }, - { new Color(95, 106, 191), tile88 }, - { new Color(190, 21, 44), tile89 }, - { new Color(163, 146, 59), tile90 }, - { new Color(234, 30, 2), tile91 }, - { new Color(132, 150, 117), tile92 }, - { new Color(241, 205, 115), tile93 }, - { new Color(221, 198, 201), tile94 }, - { new Color(153, 174, 27), tile95 }, - { new Color(99, 162, 61), tile96 }, - { new Color(42, 38, 62), tile97 }, - { new Color(178, 161, 163), tile98 }, - { new Color(190, 110, 52), tile99 }, - { new Color(66, 29, 186), tile100 }, - { new Color(12, 204, 142), tile101 }, - { new Color(119, 156, 77), tile102 }, - { new Color(210, 65, 225), tile103 }, - { new Color(239, 95, 106), tile104 }, - { new Color(100, 19, 105), tile105 }, - { new Color(20, 198, 187), tile106 }, - { new Color(164, 90, 114), tile107 }, - { new Color(238, 120, 107), tile108 }, - { new Color(253, 56, 124), tile109 }, - { new Color(95, 198, 39), tile110 }, - { new Color(65, 174, 175), tile111 }, - { new Color(184, 208, 249), tile112 }, - { new Color(59, 33, 18), tile113 }, - { new Color(205, 145, 96), tile114 }, - { new Color(92, 58, 199), tile115 }, - { new Color(211, 78, 141), tile116 }, - { new Color(57, 170, 167), tile117 }, - { new Color(120, 158, 195), tile118 }, - { new Color(71, 30, 83), tile119 }, - { new Color(35, 122, 99), tile120 }, - { new Color(209, 114, 123), tile121 }, - { new Color(185, 174, 176), tile122 }, - { new Color(187, 171, 66), tile123 }, - { new Color(112, 217, 164), tile124 }, - { new Color(169, 214, 201), tile125 }, - { new Color(17, 146, 61), tile126 }, - { new Color(164, 42, 233), tile127 }, - { new Color(238, 38, 27), tile128 }, - { new Color(128, 201, 15), tile129 }, - { new Color(235, 112, 178), tile130 }, - { new Color(165, 23, 167), tile131 }, - { new Color(174, 252, 31), tile132 }, - { new Color(229, 162, 140), tile133 }, - { new Color(22, 23, 163), tile134 }, - { new Color(75, 201, 208), tile135 }, - { new Color(2, 207, 200), tile136 }, - { new Color(249, 54, 139), tile137 }, - { new Color(22, 126, 80), tile138 }, - { new Color(122, 226, 76), tile139 }, - { new Color(95, 57, 229), tile140 }, - { new Color(161, 207, 58), tile141 }, - { new Color(144, 202, 193), tile142 }, - { new Color(253, 250, 218), tile143 }, - { new Color(170, 44, 239), tile144 }, - { new Color(177, 142, 18), tile145 }, - { new Color(70, 163, 93), tile146 }, - { new Color(75, 125, 249), tile147 }, - { new Color(71, 242, 58), tile148 }, - { new Color(38, 143, 152), tile149 }, - { new Color(87, 52, 25), tile150 }, - { new Color(210, 133, 105), tile151 }, - { new Color(166, 116, 72), tile152 }, - { new Color(104, 186, 254), tile153 }, - { new Color(15, 5, 212), tile154 }, - { new Color(238, 79, 9), tile155 }, - { new Color(156, 100, 240), tile156 }, - { new Color(61, 51, 62), tile157 }, - { new Color(238, 20, 188), tile158 }, - { new Color(235, 90, 221), tile159 }, - { new Color(0, 105, 58), tile160 }, - { new Color(40, 166, 198), tile161 }, - { new Color(192, 215, 166), tile162 }, - { new Color(133, 10, 25), tile163 }, - { new Color(202, 222, 232), tile164 }, - { new Color(94, 60, 120), tile165 }, - { new Color(37, 88, 162), tile166 }, - { new Color(48, 138, 43), tile167 }, - { new Color(168, 25, 0), tile168 }, - { new Color(219, 227, 112), tile169 }, - { new Color(173, 187, 26), tile170 }, - { new Color(106, 103, 81), tile171 }, - { new Color(196, 230, 94), tile172 }, - { new Color(13, 46, 120), tile173 }, - { new Color(98, 23, 90), tile174 }, - { new Color(215, 115, 85), tile175 }, - { new Color(86, 144, 216), tile176 }, - { new Color(68, 197, 1), tile177 }, - { new Color(59, 207, 223), tile178 }, - { new Color(15, 128, 141), tile179 }, - { new Color(198, 229, 243), tile180 }, - { new Color(53, 216, 78), tile181 }, - { new Color(254, 95, 118), tile182 }, - { new Color(151, 154, 85), tile183 }, - { new Color(25, 24, 42), tile184 }, - { new Color(41, 205, 115), tile185 }, - { new Color(209, 208, 165), tile186 }, - { new Color(170, 132, 83), tile187 }, - { new Color(152, 105, 246), tile188 }, - { new Color(24, 47, 152), tile189 }, - { new Color(114, 180, 101), tile190 }, - { new Color(209, 70, 73), tile191 }, - { new Color(133, 44, 62), tile192 }, - { new Color(11, 216, 20), tile193 }, - { new Color(223, 190, 246), tile194 }, - { new Color(130, 42, 172), tile195 }, - { new Color(215, 17, 1), tile196 }, - { new Color(108, 62, 176), tile197 }, - { new Color(231, 28, 96), tile198 }, - { new Color(159, 157, 110), tile199 }, - { new Color(88, 230, 47), tile200 }, - { new Color(221, 37, 229), tile201 }, - { new Color(240, 71, 209), tile202 }, - { new Color(225, 164, 161), tile203 }, - { new Color(52, 197, 248), tile204 }, - { new Color(145, 202, 198), tile205 }, - { new Color(93, 21, 63), tile206 }, - { new Color(73, 65, 29), tile207 }, - { new Color(150, 5, 118), tile208 }, - { new Color(181, 234, 42), tile209 }, - { new Color(232, 229, 143), tile210 }, - { new Color(208, 178, 242), tile211 }, - { new Color(228, 2, 153), tile212 }, - { new Color(16, 146, 226), tile213 }, - { new Color(218, 246, 109), tile214 }, - { new Color(96, 56, 120), tile215 }, - { new Color(183, 85, 81), tile216 }, - { new Color(154, 66, 136), tile217 }, - { new Color(47, 15, 165), tile218 }, - { new Color(17, 71, 31), tile219 }, - { new Color(111, 58, 93), tile220 }, - { new Color(167, 248, 191), tile221 }, - { new Color(17, 99, 19), tile222 }, - { new Color(5, 172, 200), tile223 }, - { new Color(44, 76, 131), tile224 }, - { new Color(92, 110, 74), tile225 }, - { new Color(176, 53, 205), tile226 }, - { new Color(253, 253, 148), tile227 }, - { new Color(216, 78, 162), tile228 }, - { new Color(6, 161, 162), tile229 }, - { new Color(77, 210, 186), tile230 }, - { new Color(122, 161, 87), tile231 }, - { new Color(132, 51, 253), tile232 }, - { new Color(174, 78, 212), tile233 }, - { new Color(100, 178, 168), tile234 }, - { new Color(136, 109, 246), tile235 }, - { new Color(5, 211, 161), tile236 }, - { new Color(90, 96, 17), tile237 }, - { new Color(81, 113, 61), tile238 }, - { new Color(201, 206, 169), tile239 }, - { new Color(28, 11, 194), tile240 }, - { new Color(112, 184, 217), tile241 }, - { new Color(13, 177, 170), tile242 }, - { new Color(43, 215, 58), tile243 }, - { new Color(77, 2, 230), tile244 }, - { new Color(248, 152, 75), tile245 }, - { new Color(235, 79, 224), tile246 }, - { new Color(172, 1, 206), tile247 }, - { new Color(1, 242, 113), tile248 }, - { new Color(169, 40, 48), tile249 }, - { new Color(26, 187, 100), tile250 }, - { new Color(83, 145, 67), tile251 }, - { new Color(18, 244, 249), tile252 }, - { new Color(206, 123, 188), tile253 }, - { new Color(75, 217, 251), tile254 }, - { new Color(102, 12, 94), tile255 }, - { new Color(42, 88, 216), tile256 }, - { new Color(241, 221, 126), tile257 }, - { new Color(201, 112, 9), tile258 }, - { new Color(244, 111, 197), tile259 }, - { new Color(104, 100, 137), tile260 }, - { new Color(122, 16, 27), tile261 }, - { new Color(214, 249, 113), tile262 }, - { new Color(163, 230, 164), tile263 }, - { new Color(81, 28, 212), tile264 }, - { new Color(36, 96, 39), tile265 }, - { new Color(210, 155, 229), tile266 }, - { new Color(19, 126, 207), tile267 }, - { new Color(87, 40, 222), tile268 }, - { new Color(229, 138, 33), tile269 }, - { new Color(58, 30, 132), tile270 }, - { new Color(51, 102, 22), tile271 }, - { new Color(50, 209, 200), tile272 }, - { new Color(223, 144, 19), tile273 }, - { new Color(237, 135, 114), tile274 }, - { new Color(52, 160, 192), tile275 }, - { new Color(170, 164, 15), tile276 }, - { new Color(225, 33, 211), tile277 }, - { new Color(223, 84, 229), tile278 }, - { new Color(185, 35, 232), tile279 }, - { new Color(61, 240, 110), tile280 }, - { new Color(79, 104, 200), tile281 }, - { new Color(31, 30, 181), tile282 }, - { new Color(190, 241, 143), tile283 }, - { new Color(94, 242, 11), tile284 }, - { new Color(210, 38, 247), tile285 }, - { new Color(93, 35, 136), tile286 }, - { new Color(29, 59, 229), tile287 }, - { new Color(17, 89, 252), tile288 }, - { new Color(176, 83, 18), tile289 }, - { new Color(48, 121, 173), tile290 }, - { new Color(224, 162, 159), tile291 }, - { new Color(164, 157, 31), tile292 }, - { new Color(169, 20, 129), tile293 }, - { new Color(11, 235, 178), tile294 }, - { new Color(128, 130, 46), tile295 }, - { new Color(200, 13, 45), tile296 }, - { new Color(238, 91, 255), tile297 }, - { new Color(96, 32, 180), tile298 }, - { new Color(136, 62, 15), tile299 }, - { new Color(204, 111, 202), tile300 }, - { new Color(163, 141, 120), tile301 }, - { new Color(225, 126, 80), tile302 }, - { new Color(107, 46, 137), tile303 }, - { new Color(216, 180, 15), tile304 }, - { new Color(6, 17, 79), tile305 }, - { new Color(51, 145, 214), tile306 }, - { new Color(205, 232, 70), tile307 }, - { new Color(229, 66, 30), tile308 }, - { new Color(173, 128, 129), tile309 }, - { new Color(235, 27, 95), tile310 }, - { new Color(15, 221, 165), tile311 }, - { new Color(183, 104, 94), tile312 }, - { new Color(58, 158, 4), tile313 }, - { new Color(222, 93, 223), tile314 }, - { new Color(164, 22, 167), tile315 }, - { new Color(240, 89, 14), tile316 }, - { new Color(100, 85, 172), tile317 }, - { new Color(57, 254, 134), tile318 }, - { new Color(132, 190, 75), tile319 }, - { new Color(89, 51, 254), tile320 }, - { new Color(207, 128, 18), tile321 }, - { new Color(42, 200, 214), tile322 }, - { new Color(106, 79, 169), tile323 }, - { new Color(241, 248, 243), tile324 }, - { new Color(210, 239, 139), tile325 }, - { new Color(103, 64, 43), tile326 }, - { new Color(119, 189, 38), tile327 }, - { new Color(114, 134, 197), tile328 }, - { new Color(178, 214, 222), tile329 }, - { new Color(30, 50, 170), tile330 }, - { new Color(19, 224, 106), tile331 }, - { new Color(6, 15, 220), tile332 }, - { new Color(204, 121, 77), tile333 }, - { new Color(208, 134, 10), tile334 }, - { new Color(101, 115, 93), tile335 }, - { new Color(185, 102, 15), tile336 }, - { new Color(251, 29, 125), tile337 }, - { new Color(31, 226, 118), tile338 }, - { new Color(215, 92, 250), tile339 }, - { new Color(77, 119, 242), tile340 }, - { new Color(247, 75, 28), tile341 }, - { new Color(255, 222, 23), tile342 }, - { new Color(136, 204, 224), tile343 }, - { new Color(174, 154, 199), tile344 }, - { new Color(222, 166, 54), tile345 }, - { new Color(28, 13, 19), tile346 }, - { new Color(104, 249, 111), tile347 }, - { new Color(207, 34, 21), tile348 }, - { new Color(44, 243, 254), tile349 }, - { new Color(244, 46, 178), tile350 }, - { new Color(226, 127, 2), tile351 }, - { new Color(91, 216, 58), tile352 }, - { new Color(237, 101, 148), tile353 }, - { new Color(69, 49, 154), tile354 }, - { new Color(46, 77, 130), tile355 }, - { new Color(182, 65, 60), tile356 }, - { new Color(64, 187, 78), tile357 }, - { new Color(230, 228, 125), tile358 }, - { new Color(130, 40, 41), tile359 }, - { new Color(7, 210, 234), tile360 }, - { new Color(25, 148, 157), tile361 }, - { new Color(45, 204, 27), tile362 }, - { new Color(196, 130, 205), tile363 }, - { new Color(251, 46, 168), tile364 }, - { new Color(126, 35, 200), tile365 }, - { new Color(212, 160, 213), tile366 }, - { new Color(146, 118, 178), tile367 }, - { new Color(193, 180, 115), tile368 }, - { new Color(100, 251, 155), tile369 }, - { new Color(132, 216, 176), tile370 }, - { new Color(17, 230, 146), tile371 }, - { new Color(170, 43, 156), tile372 }, - { new Color(253, 1, 128), tile373 }, - { new Color(103, 241, 190), tile374 }, - { new Color(110, 68, 140), tile375 }, - { new Color(166, 104, 193), tile376 }, - { new Color(181, 174, 135), tile377 }, - { new Color(83, 116, 91), tile378 }, - { new Color(56, 87, 224), tile379 }, - { new Color(42, 201, 208), tile380 }, - { new Color(128, 63, 170), tile381 }, - { new Color(28, 234, 71), tile382 }, - { new Color(21, 212, 247), tile383 }, - { new Color(43, 215, 159), tile384 }, - { new Color(84, 43, 133), tile385 }, - { new Color(243, 83, 111), tile386 }, - { new Color(231, 189, 147), tile387 }, - { new Color(217, 207, 42), tile388 }, - { new Color(41, 189, 114), tile389 }, - { new Color(54, 113, 211), tile390 }, - { new Color(188, 211, 55), tile391 }, - { new Color(175, 231, 178), tile392 }, - { new Color(20, 81, 90), tile393 }, - { new Color(68, 144, 147), tile394 }, - { new Color(201, 137, 214), tile395 }, - { new Color(231, 255, 73), tile396 }, - { new Color(214, 68, 4), tile397 }, - { new Color(112, 66, 12), tile398 }, - { new Color(61, 166, 112), tile399 }, - { new Color(127, 243, 44), tile400 }, - { new Color(213, 222, 98), tile401 }, - { new Color(36, 110, 4), tile402 }, - { new Color(104, 164, 67), tile403 }, - { new Color(211, 223, 1), tile404 }, - { new Color(21, 162, 45), tile405 }, - { new Color(255, 16, 69), tile406 }, - { new Color(84, 65, 190), tile407 }, - { new Color(41, 96, 45), tile408 }, - { new Color(207, 76, 144), tile409 }, - { new Color(43, 114, 65), tile410 }, - { new Color(65, 148, 93), tile411 }, - { new Color(45, 111, 178), tile412 }, - { new Color(49, 165, 26), tile413 }, - { new Color(209, 127, 90), tile414 }, - { new Color(5, 3, 101), tile415 }, - { new Color(2, 91, 160), tile416 }, - { new Color(222, 62, 149), tile417 }, - { new Color(42, 43, 177), tile418 }, - { new Color(110, 172, 126), tile419 }, - { new Color(53, 85, 34), tile420 }, - { new Color(116, 60, 50), tile421 }, - { new Color(2, 145, 74), tile422 }, - { new Color(164, 231, 51), tile423 }, - { new Color(122, 205, 107), tile424 }, - { new Color(42, 130, 194), tile425 }, - { new Color(100, 35, 92), tile426 }, - { new Color(199, 204, 241), tile427 }, - { new Color(239, 76, 52), tile428 }, - { new Color(171, 22, 104), tile429 }, - { new Color(172, 191, 195), tile430 }, - { new Color(51, 252, 79), tile431 }, - { new Color(248, 93, 66), tile432 }, - { new Color(39, 3, 113), tile433 }, - { new Color(26, 94, 115), tile434 }, - { new Color(109, 100, 112), tile435 }, - { new Color(41, 255, 169), tile436 }, - { new Color(239, 9, 136), tile437 }, - { new Color(33, 109, 136), tile438 }, - { new Color(49, 132, 240), tile439 }, - { new Color(254, 86, 122), tile440 }, - { new Color(226, 248, 40), tile441 }, - { new Color(111, 71, 209), tile442 }, - { new Color(27, 50, 37), tile443 }, - { new Color(127, 60, 31), tile444 }, - { new Color(234, 173, 110), tile445 }, - { new Color(126, 130, 232), tile446 }, - { new Color(196, 130, 23), tile447 }, - { new Color(191, 188, 181), tile448 }, - { new Color(58, 18, 143), tile449 }, - { new Color(199, 198, 216), tile450 }, - { new Color(82, 41, 173), tile451 }, - { new Color(247, 56, 102), tile452 }, - { new Color(75, 253, 29), tile453 }, - { new Color(158, 13, 205), tile454 }, - { new Color(132, 112, 205), tile455 }, - { new Color(104, 54, 191), tile456 }, - { new Color(26, 179, 2), tile457 }, - { new Color(7, 58, 211), tile458 }, - { new Color(99, 34, 59), tile459 }, - { new Color(114, 52, 52), tile460 }, - { new Color(66, 84, 107), tile461 }, - { new Color(77, 45, 19), tile462 }, - { new Color(114, 243, 116), tile463 }, - { new Color(7, 50, 132), tile464 }, - { new Color(203, 37, 116), tile465 }, - { new Color(73, 59, 76), tile466 }, - { new Color(232, 209, 220), tile467 }, - { new Color(207, 173, 19), tile468 }, - { new Color(213, 74, 239), tile469 }, - { new Color(217, 148, 21), tile470 }, - { new Color(42, 216, 200), tile471 }, - { new Color(232, 92, 185), tile472 }, - { new Color(97, 54, 67), tile473 }, - { new Color(186, 246, 66), tile474 }, - { new Color(74, 18, 128), tile475 }, - { new Color(126, 60, 20), tile476 }, - { new Color(95, 25, 231), tile477 }, - { new Color(239, 137, 98), tile478 }, - { new Color(88, 115, 166), tile479 }, - { new Color(88, 119, 226), tile480 }, - { new Color(35, 152, 95), tile481 }, - { new Color(95, 221, 90), tile482 }, - { new Color(187, 226, 201), tile483 }, - { new Color(186, 232, 4), tile484 }, - { new Color(9, 46, 219), tile485 }, - { new Color(153, 132, 155), tile486 }, - { new Color(146, 87, 13), tile487 }, - { new Color(218, 122, 122), tile488 }, - { new Color(45, 59, 79), tile489 }, - { new Color(101, 144, 232), tile490 }, - { new Color(18, 8, 191), tile491 }, - { new Color(96, 150, 94), tile492 }, - { new Color(227, 235, 53), tile493 }, - { new Color(38, 194, 90), tile494 }, - { new Color(74, 165, 49), tile495 }, - { new Color(227, 230, 90), tile496 }, - { new Color(135, 190, 238), tile497 }, - { new Color(11, 198, 32), tile498 }, - { new Color(212, 73, 30), tile499 }, - { new Color(228, 49, 161), tile500 }, - { new Color(10, 85, 81), tile501 }, - { new Color(224, 167, 223), tile502 }, - { new Color(68, 168, 152), tile503 }, - { new Color(124, 181, 153), tile504 }, - { new Color(102, 108, 148), tile505 }, - { new Color(179, 143, 213), tile506 }, - { new Color(73, 74, 85), tile507 }, - { new Color(244, 222, 210), tile508 }, - { new Color(250, 7, 66), tile509 }, - { new Color(158, 139, 77), tile510 }, - { new Color(64, 254, 185), tile511 }, - { new Color(147, 27, 109), tile512 }, - { new Color(8, 106, 253), tile513 }, - { new Color(81, 159, 61), tile514 }, - { new Color(194, 11, 8), tile515 }, - { new Color(85, 165, 89), tile516 }, - { new Color(140, 33, 185), tile517 }, - { new Color(72, 155, 231), tile518 }, - { new Color(76, 21, 119), tile519 }, - { new Color(127, 230, 160), tile520 }, - { new Color(157, 165, 28), tile521 }, - { new Color(75, 60, 183), tile522 }, - { new Color(223, 210, 80), tile523 }, - { new Color(38, 171, 37), tile524 }, - { new Color(215, 248, 171), tile525 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic.png b/Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic.png deleted file mode 100644 index ac8d3ea4eb..0000000000 Binary files a/Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs deleted file mode 100644 index 0f61e9f544..0000000000 --- a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.cs +++ /dev/null @@ -1,599 +0,0 @@ -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Walls.DraedonStructures; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class ResearchFacilitySchematic - { - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 72); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 16); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 32); - var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 48); - var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile21 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); - var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile24 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile25 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile26 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile27 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile28 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)WallID.SapphireGemspark, 72, 144); - var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); - var tile30 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile31 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile32 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile33 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 54).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 72); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile43 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile47 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 54).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 72); - var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile55 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile56 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile57 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile60 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile62 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile65 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); - var tile66 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile67 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile70 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 54).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile72 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile75 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile76 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile79 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile80 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile81 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile82 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile84 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile85 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile86 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 74, 1, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile87 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 1, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile88 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 2, 32).UseFrame(0, 252).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile92 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile93 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile94 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile95 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile96 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 288, 72); - var tile97 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 4128).UseFrame(180, 0).UseWall((ushort)WallID.SapphireGemspark, 0, 144); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile99 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile100 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile102 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile109 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile112 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile113 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile115 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile116 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 54); - var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile123 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 252, 36); - var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 4128).UseFrame(180, 0).UseWall((ushort)WallID.SapphireGemspark, 144, 144); - var tile125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile126 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile127 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile129 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 360, 72); - var tile130 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)WallID.SapphireGemspark, 36, 36); - var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile136 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 75, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 288, 36); - var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); - var tile141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 360, 36); - var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 0); - var tile147 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile148 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile149 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 72, 36); - var tile152 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile153 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile154 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile155 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile157 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(180, 54).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile159 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile160 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 71, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile161 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 216, 36); - var tile162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile163 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile164 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile165 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile166 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile168 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 360, 72); - var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 36).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile171 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile174 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile175 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile177 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 36); - var tile178 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 36).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile180 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile184 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 252, 36); - var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 36).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile188 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(54, 18).UseWall((ushort)WallID.SapphireGemspark, 360, 72); - var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(54, 36).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile194 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile195 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(198, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile197 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 6, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 216, 0); - var tile199 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile200 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile201 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile203 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); - var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 72); - var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)WallID.SapphireGemspark, 360, 72); - var tile209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile210 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 36); - var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(216, 0); - var tile214 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile215 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(36, 0).UseWall((ushort)WallID.SapphireGemspark, 252, 36); - var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(162, 36); - var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile219 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)WallID.SapphireGemspark, 360, 0); - var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 54); - var tile221 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile225 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)WallID.SapphireGemspark, 36, 36); - var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 8224).UseFrame(144, 0).UseWall((ushort)WallID.SapphireGemspark, 180, 144); - var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); - var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(252, 72); - var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile232 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 36).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile240 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(18, 36).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54); - var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 72); - var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile247 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 8224).UseFrame(144, 0).UseWall((ushort)WallID.SapphireGemspark, 108, 144); - var tile249 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile251 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 138, 2, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile252 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 2, 32).UseFrame(0, 252).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 72); - var tile255 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 18).UseWall((ushort)WallID.SapphireGemspark, 72, 72); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 54); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)WallID.SapphireGemspark, 108, 72); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 72); - var tile266 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile268 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 18).UseWall((ushort)WallID.SapphireGemspark, 36, 72); - var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 3, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile275 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile277 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile281 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile282 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile283 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)WallID.SapphireGemspark, 36, 144); - var tile284 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); - var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); - var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(162, 232, 156), tile2 }, - { new Color(34, 165, 254), tile3 }, - { new Color(64, 91, 200), tile4 }, - { new Color(153, 132, 10), tile5 }, - { new Color(243, 70, 244), tile6 }, - { new Color(230, 156, 166), tile7 }, - { new Color(126, 135, 46), tile8 }, - { new Color(86, 104, 121), tile9 }, - { new Color(87, 253, 57), tile10 }, - { new Color(150, 125, 121), tile11 }, - { new Color(34, 194, 177), tile12 }, - { new Color(174, 59, 143), tile13 }, - { new Color(135, 2, 57), tile14 }, - { new Color(24, 79, 181), tile15 }, - { new Color(161, 205, 112), tile16 }, - { new Color(39, 194, 138), tile17 }, - { new Color(34, 189, 177), tile18 }, - { new Color(224, 238, 215), tile19 }, - { new Color(195, 75, 127), tile20 }, - { new Color(34, 203, 168), tile21 }, - { new Color(197, 170, 222), tile22 }, - { new Color(79, 119, 194), tile23 }, - { new Color(89, 69, 10), tile24 }, - { new Color(101, 95, 153), tile25 }, - { new Color(109, 102, 55), tile26 }, - { new Color(121, 180, 155), tile27 }, - { new Color(9, 48, 59), tile28 }, - { new Color(175, 115, 192), tile29 }, - { new Color(200, 65, 211), tile30 }, - { new Color(217, 234, 240), tile31 }, - { new Color(15, 100, 55), tile32 }, - { new Color(145, 83, 165), tile33 }, - { new Color(214, 82, 86), tile34 }, - { new Color(173, 205, 125), tile35 }, - { new Color(127, 188, 93), tile36 }, - { new Color(23, 115, 136), tile37 }, - { new Color(159, 74, 150), tile38 }, - { new Color(228, 25, 155), tile39 }, - { new Color(108, 21, 54), tile40 }, - { new Color(30, 135, 53), tile41 }, - { new Color(238, 127, 90), tile42 }, - { new Color(26, 86, 251), tile43 }, - { new Color(98, 219, 18), tile44 }, - { new Color(146, 162, 98), tile45 }, - { new Color(68, 91, 98), tile46 }, - { new Color(190, 48, 182), tile47 }, - { new Color(98, 176, 206), tile48 }, - { new Color(74, 57, 160), tile49 }, - { new Color(89, 42, 75), tile50 }, - { new Color(155, 36, 61), tile51 }, - { new Color(110, 184, 203), tile52 }, - { new Color(33, 190, 77), tile53 }, - { new Color(34, 100, 102), tile54 }, - { new Color(98, 180, 151), tile55 }, - { new Color(118, 13, 168), tile56 }, - { new Color(52, 159, 189), tile57 }, - { new Color(56, 174, 229), tile58 }, - { new Color(128, 187, 214), tile59 }, - { new Color(103, 164, 70), tile60 }, - { new Color(186, 193, 43), tile61 }, - { new Color(175, 198, 183), tile62 }, - { new Color(212, 36, 233), tile63 }, - { new Color(150, 35, 156), tile64 }, - { new Color(20, 155, 203), tile65 }, - { new Color(80, 0, 251), tile66 }, - { new Color(54, 212, 44), tile67 }, - { new Color(247, 36, 139), tile68 }, - { new Color(141, 99, 117), tile69 }, - { new Color(88, 238, 253), tile70 }, - { new Color(244, 186, 26), tile71 }, - { new Color(7, 104, 162), tile72 }, - { new Color(59, 178, 237), tile73 }, - { new Color(224, 161, 233), tile74 }, - { new Color(191, 158, 123), tile75 }, - { new Color(32, 35, 18), tile76 }, - { new Color(26, 47, 187), tile77 }, - { new Color(218, 48, 207), tile78 }, - { new Color(25, 195, 157), tile79 }, - { new Color(160, 33, 99), tile80 }, - { new Color(65, 124, 53), tile81 }, - { new Color(235, 162, 105), tile82 }, - { new Color(129, 13, 51), tile83 }, - { new Color(40, 20, 77), tile84 }, - { new Color(14, 86, 50), tile85 }, - { new Color(66, 55, 134), tile86 }, - { new Color(15, 108, 63), tile87 }, - { new Color(99, 61, 190), tile88 }, - { new Color(65, 25, 137), tile89 }, - { new Color(74, 237, 165), tile90 }, - { new Color(5, 155, 144), tile91 }, - { new Color(137, 158, 37), tile92 }, - { new Color(179, 211, 252), tile93 }, - { new Color(18, 158, 22), tile94 }, - { new Color(223, 241, 27), tile95 }, - { new Color(110, 204, 218), tile96 }, - { new Color(157, 214, 139), tile97 }, - { new Color(23, 144, 181), tile98 }, - { new Color(36, 222, 62), tile99 }, - { new Color(119, 169, 136), tile100 }, - { new Color(224, 54, 31), tile101 }, - { new Color(142, 35, 121), tile102 }, - { new Color(188, 132, 183), tile103 }, - { new Color(13, 143, 100), tile104 }, - { new Color(138, 253, 205), tile105 }, - { new Color(40, 131, 76), tile106 }, - { new Color(163, 211, 77), tile107 }, - { new Color(174, 173, 22), tile108 }, - { new Color(26, 238, 10), tile109 }, - { new Color(219, 101, 191), tile110 }, - { new Color(230, 59, 41), tile111 }, - { new Color(115, 49, 104), tile112 }, - { new Color(247, 80, 205), tile113 }, - { new Color(161, 177, 72), tile114 }, - { new Color(34, 144, 71), tile115 }, - { new Color(38, 140, 146), tile116 }, - { new Color(231, 251, 90), tile117 }, - { new Color(242, 212, 214), tile118 }, - { new Color(59, 49, 137), tile119 }, - { new Color(8, 116, 53), tile120 }, - { new Color(110, 224, 30), tile121 }, - { new Color(248, 38, 83), tile122 }, - { new Color(58, 22, 203), tile123 }, - { new Color(101, 49, 51), tile124 }, - { new Color(126, 1, 33), tile125 }, - { new Color(4, 140, 29), tile126 }, - { new Color(207, 243, 97), tile127 }, - { new Color(119, 244, 106), tile128 }, - { new Color(101, 244, 103), tile129 }, - { new Color(83, 56, 0), tile130 }, - { new Color(222, 238, 220), tile131 }, - { new Color(152, 51, 209), tile132 }, - { new Color(41, 42, 105), tile133 }, - { new Color(243, 236, 118), tile134 }, - { new Color(199, 129, 201), tile135 }, - { new Color(39, 115, 210), tile136 }, - { new Color(180, 54, 165), tile137 }, - { new Color(107, 57, 129), tile138 }, - { new Color(211, 246, 236), tile139 }, - { new Color(180, 146, 49), tile140 }, - { new Color(236, 231, 221), tile141 }, - { new Color(203, 135, 67), tile142 }, - { new Color(86, 230, 206), tile143 }, - { new Color(80, 219, 97), tile144 }, - { new Color(179, 219, 7), tile145 }, - { new Color(234, 176, 115), tile146 }, - { new Color(161, 61, 129), tile147 }, - { new Color(148, 158, 2), tile148 }, - { new Color(91, 114, 181), tile149 }, - { new Color(91, 196, 60), tile150 }, - { new Color(229, 117, 151), tile151 }, - { new Color(55, 7, 4), tile152 }, - { new Color(152, 251, 250), tile153 }, - { new Color(134, 208, 141), tile154 }, - { new Color(3, 100, 90), tile155 }, - { new Color(67, 184, 93), tile156 }, - { new Color(121, 233, 69), tile157 }, - { new Color(120, 19, 85), tile158 }, - { new Color(176, 87, 72), tile159 }, - { new Color(219, 112, 20), tile160 }, - { new Color(141, 251, 33), tile161 }, - { new Color(146, 107, 102), tile162 }, - { new Color(201, 123, 211), tile163 }, - { new Color(2, 81, 181), tile164 }, - { new Color(121, 26, 109), tile165 }, - { new Color(244, 145, 58), tile166 }, - { new Color(167, 23, 186), tile167 }, - { new Color(87, 225, 219), tile168 }, - { new Color(246, 108, 98), tile169 }, - { new Color(66, 135, 176), tile170 }, - { new Color(188, 189, 138), tile171 }, - { new Color(229, 248, 212), tile172 }, - { new Color(107, 113, 248), tile173 }, - { new Color(244, 121, 60), tile174 }, - { new Color(138, 119, 151), tile175 }, - { new Color(144, 255, 248), tile176 }, - { new Color(231, 188, 198), tile177 }, - { new Color(14, 52, 88), tile178 }, - { new Color(90, 54, 26), tile179 }, - { new Color(69, 155, 255), tile180 }, - { new Color(3, 135, 244), tile181 }, - { new Color(34, 69, 148), tile182 }, - { new Color(42, 147, 34), tile183 }, - { new Color(152, 136, 31), tile184 }, - { new Color(65, 178, 157), tile185 }, - { new Color(125, 205, 105), tile186 }, - { new Color(68, 102, 108), tile187 }, - { new Color(105, 91, 202), tile188 }, - { new Color(234, 174, 136), tile189 }, - { new Color(50, 139, 194), tile190 }, - { new Color(186, 37, 214), tile191 }, - { new Color(249, 240, 242), tile192 }, - { new Color(71, 103, 49), tile193 }, - { new Color(2, 101, 108), tile194 }, - { new Color(213, 78, 51), tile195 }, - { new Color(166, 204, 129), tile196 }, - { new Color(187, 220, 104), tile197 }, - { new Color(176, 1, 52), tile198 }, - { new Color(146, 154, 43), tile199 }, - { new Color(42, 56, 151), tile200 }, - { new Color(11, 248, 7), tile201 }, - { new Color(95, 222, 99), tile202 }, - { new Color(72, 72, 193), tile203 }, - { new Color(171, 54, 102), tile204 }, - { new Color(55, 65, 0), tile205 }, - { new Color(0, 147, 12), tile206 }, - { new Color(150, 67, 225), tile207 }, - { new Color(6, 119, 175), tile208 }, - { new Color(89, 9, 35), tile209 }, - { new Color(161, 102, 86), tile210 }, - { new Color(198, 29, 46), tile211 }, - { new Color(153, 246, 109), tile212 }, - { new Color(100, 117, 112), tile213 }, - { new Color(208, 94, 132), tile214 }, - { new Color(192, 15, 165), tile215 }, - { new Color(2, 121, 191), tile216 }, - { new Color(52, 146, 6), tile217 }, - { new Color(31, 147, 244), tile218 }, - { new Color(182, 5, 129), tile219 }, - { new Color(88, 6, 213), tile220 }, - { new Color(63, 167, 225), tile221 }, - { new Color(106, 229, 24), tile222 }, - { new Color(55, 157, 75), tile223 }, - { new Color(146, 156, 30), tile224 }, - { new Color(156, 198, 229), tile225 }, - { new Color(92, 70, 103), tile226 }, - { new Color(9, 87, 143), tile227 }, - { new Color(100, 109, 212), tile228 }, - { new Color(80, 166, 137), tile229 }, - { new Color(58, 227, 241), tile230 }, - { new Color(236, 11, 111), tile231 }, - { new Color(154, 145, 182), tile232 }, - { new Color(163, 85, 42), tile233 }, - { new Color(140, 202, 219), tile234 }, - { new Color(116, 161, 245), tile235 }, - { new Color(232, 131, 205), tile236 }, - { new Color(14, 89, 190), tile237 }, - { new Color(25, 78, 174), tile238 }, - { new Color(69, 219, 57), tile239 }, - { new Color(12, 26, 62), tile240 }, - { new Color(143, 253, 186), tile241 }, - { new Color(89, 166, 144), tile242 }, - { new Color(174, 1, 52), tile243 }, - { new Color(46, 185, 240), tile244 }, - { new Color(61, 124, 141), tile245 }, - { new Color(180, 239, 204), tile246 }, - { new Color(222, 104, 35), tile247 }, - { new Color(188, 43, 137), tile248 }, - { new Color(51, 210, 188), tile249 }, - { new Color(193, 84, 182), tile250 }, - { new Color(125, 150, 59), tile251 }, - { new Color(236, 253, 204), tile252 }, - { new Color(33, 26, 250), tile253 }, - { new Color(101, 57, 129), tile254 }, - { new Color(152, 224, 159), tile255 }, - { new Color(205, 220, 210), tile256 }, - { new Color(32, 145, 235), tile257 }, - { new Color(109, 46, 177), tile258 }, - { new Color(26, 211, 210), tile259 }, - { new Color(48, 38, 211), tile260 }, - { new Color(212, 236, 172), tile261 }, - { new Color(126, 177, 35), tile262 }, - { new Color(181, 80, 127), tile263 }, - { new Color(193, 146, 212), tile264 }, - { new Color(209, 121, 46), tile265 }, - { new Color(162, 35, 74), tile266 }, - { new Color(234, 101, 245), tile267 }, - { new Color(234, 161, 195), tile268 }, - { new Color(202, 15, 103), tile269 }, - { new Color(137, 210, 42), tile270 }, - { new Color(249, 241, 243), tile271 }, - { new Color(39, 145, 77), tile272 }, - { new Color(212, 26, 46), tile273 }, - { new Color(124, 24, 140), tile274 }, - { new Color(83, 95, 254), tile275 }, - { new Color(22, 156, 181), tile276 }, - { new Color(130, 119, 175), tile277 }, - { new Color(135, 70, 193), tile278 }, - { new Color(222, 233, 74), tile279 }, - { new Color(233, 180, 161), tile280 }, - { new Color(188, 43, 126), tile281 }, - { new Color(84, 199, 161), tile282 }, - { new Color(225, 169, 232), tile283 }, - { new Color(225, 206, 9), tile284 }, - { new Color(27, 109, 77), tile285 }, - { new Color(105, 151, 66), tile286 }, - { new Color(197, 179, 115), tile287 }, - { new Color(178, 7, 91), tile288 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.png b/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.png deleted file mode 100644 index eed77ae870..0000000000 Binary files a/Schematics/AutoGeneratedContent/ResearchFacilitySchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs b/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs deleted file mode 100644 index ce87da1797..0000000000 --- a/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.cs +++ /dev/null @@ -1,2833 +0,0 @@ -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Walls.DraedonStructures; -using CalamityMod.Tiles.Plates; -using CalamityMod.Walls; -using CalamityMod.Tiles.SunkenSea; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class SunkenSeaLaboratorySchematic - { - // This is horrible. I am sorry. - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 72); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 36); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile11 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 54); - var tile12 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 0); - var tile13 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile15 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 36); - var tile16 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile17 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 128, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile18 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile19 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile20 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile21 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile22 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 0); - var tile23 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0); - var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(270, 36); - var tile26 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile27 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile28 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile29 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile30 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile31 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(468, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile32 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 0); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 36); - var tile36 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile37 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile38 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile39 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile40 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile41 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile44 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 36); - var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile47 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile48 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile49 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile50 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile51 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile52 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile54 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile55 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(468, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile57 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile60 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile62 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile63 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile64 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile65 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile66 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile67 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile68 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile69 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile70 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile71 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile72 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile74 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile76 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile78 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 0); - var tile79 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile81 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile85 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile86 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile87 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile88 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile93 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile94 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile95 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile96 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile97 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile102 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 2144).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 108, 0).MakeActuated(); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 2144).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 252, 72).MakeActuated(); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile110 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile113 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile114 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile115 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile121 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 33, 1, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile122 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 87, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile123 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 27, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile124 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 163, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile125 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 38, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile126 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 107, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile127 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 17, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile129 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile131 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(270, 0); - var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile135 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile136 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile140 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile141 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(180, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile147 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 16416).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile148 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile151 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 288, 72).MakeActuated(); - var tile152 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile153 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile155 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile156 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile157 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile159 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile160 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile161 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile163 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile164 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile165 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile166 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile168 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile169 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile172 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile173 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile174 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile175 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile176 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile177 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile178 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile180 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile182 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile183 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile184 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 360, 0).MakeActuated(); - var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile190 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseLiquid(LiquidState.Water, 195).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile191 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(36, 144).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile194 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile195 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 2144).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 360, 36).MakeActuated(); - var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 2144).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 36, 72).MakeActuated(); - var tile199 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile200 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile201 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 33, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile202 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 90).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 108).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile209 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile210 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile213 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile214 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 22, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile215 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseLiquid(LiquidState.Water, 195).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile216 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile217 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile218 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile219 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 1056).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile221 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(162, 90).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 2144).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile229 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 2144).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 216, 36).MakeActuated(); - var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile232 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 4128).UseFrame(468, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(270, 0); - var tile234 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile235 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 10, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile239 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 138, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile240 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile247 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile249 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(270, 0); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile255 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile256 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 1056).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(54, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(54, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 4128).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile268 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile269 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile273 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 103, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile274 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(72, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile277 = new TileDefinitionStructure(TileID.SmallPiles).UseHeaders(0, 71, 1, 32).UseFrame(324, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile279 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile281 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 106, 1, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile282 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseLiquid(LiquidState.Water, 195).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile284 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(90, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 1056).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 64).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile295 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 80).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile296 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 96).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile297 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile298 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 540).UseLiquid(LiquidState.Water, 195).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile299 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 71, 2, 32).UseFrame(0, 558).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile300 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile301 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 36).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile312 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(16, 64).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(16, 80).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile315 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 96).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile316 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile317 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseLiquid(LiquidState.Water, 195).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile318 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile323 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile326 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 139, 2, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile328 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile330 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile333 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile334 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(32, 64).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile335 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile336 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 96).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile337 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile338 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 36).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile342 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile343 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile349 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile350 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 64).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile352 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 80).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile353 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(48, 96).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 1056).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile358 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile359 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile360 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile363 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(64, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile364 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(64, 16).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile365 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(64, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile366 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile367 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(64, 64).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile368 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(64, 80).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile369 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(64, 96).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile370 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile371 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile372 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile373 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile375 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(80, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile376 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(80, 16).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile377 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile378 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(80, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile379 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(80, 64).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile380 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 80).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile381 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(80, 96).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile382 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile383 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile389 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile390 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile391 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 82, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile392 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile393 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile394 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile397 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile399 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile400 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile401 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile402 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 1056).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile403 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile404 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile405 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile406 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile407 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile408 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile409 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile410 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile411 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile412 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile413 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile414 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile415 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseLiquid(LiquidState.Water, 195).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile416 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile417 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile418 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 36).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile419 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile420 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile421 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile422 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile423 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile424 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile425 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile426 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile427 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile428 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile429 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile430 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile431 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile432 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile433 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile434 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile435 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile436 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile437 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile438 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile439 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile440 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile441 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile442 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile443 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile444 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile445 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile446 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile447 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile448 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile449 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 2144).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile450 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile451 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 288, 36).MakeActuated(); - var tile452 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile453 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 2144).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 108, 72).MakeActuated(); - var tile454 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile455 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile456 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile457 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile458 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 154, 2, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile459 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile460 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile461 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile462 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile463 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile464 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile465 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 2144).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 216, 72).MakeActuated(); - var tile466 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile467 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile468 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile469 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile470 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile471 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile472 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 72).MakeActuated(); - var tile473 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile474 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile475 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile476 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile477 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile478 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(180, 90).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile479 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile480 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile481 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile482 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile483 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile484 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile485 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile486 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile487 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile488 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile489 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile490 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 4128).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile491 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile492 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile493 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(144, 126).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile494 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile495 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile496 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile497 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile498 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile499 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile500 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile501 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile502 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile503 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile504 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); - var tile505 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile506 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile507 = new TileDefinitionStructure(TileID.SmallPiles).UseHeaders(0, 71, 2, 32).UseFrame(234, 0).UseLiquid(LiquidState.Water, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile508 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile509 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(198, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile510 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile511 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile512 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile513 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile514 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile515 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile516 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile517 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile518 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile519 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile520 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile521 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile522 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile523 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 22, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile524 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 171, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile525 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 152, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile526 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 6, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile527 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile528 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile529 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile530 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile531 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(234, 0); - var tile532 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile533 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile534 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile535 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile536 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile537 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile538 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile539 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile540 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile541 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile542 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile543 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile544 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile545 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile546 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile547 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile548 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile549 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile550 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile551 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 2144).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile552 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 2144).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 216, 72).MakeActuated(); - var tile553 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile554 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile555 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile556 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile557 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile558 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile559 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile560 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile561 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile562 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile563 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile564 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile565 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile566 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 2144).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 216, 36).MakeActuated(); - var tile567 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile568 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile569 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile570 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile571 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile572 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile573 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile574 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile575 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile576 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile577 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile578 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile579 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile580 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 3, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile581 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 72).MakeActuated(); - var tile582 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile583 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile584 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile585 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile586 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile587 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 2144).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile588 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 2, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile589 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile590 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile591 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile592 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile593 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile594 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile595 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile596 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile597 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 64, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile598 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile599 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile600 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile601 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile602 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile603 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile604 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36).MakeActuated(); - var tile605 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile606 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 8224).UseFrame(450, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile607 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile608 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile609 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile610 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile611 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile612 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile613 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile614 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile615 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile616 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 2144).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 108, 108).MakeActuated(); - var tile617 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 8224).UseFrame(450, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile618 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile619 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 4, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile620 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile621 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile622 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile623 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 133, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile624 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 4, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile625 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile626 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile627 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile628 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile629 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile630 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile631 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile632 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 36); - var tile633 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile634 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile635 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile636 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36); - var tile637 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile638 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile639 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile640 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile641 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile642 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile643 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile644 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile645 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile646 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 4, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile647 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile648 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 72); - var tile649 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(216, 36); - var tile650 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile651 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile652 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 3, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile653 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 21, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile654 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile655 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile656 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile657 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile658 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile659 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile660 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile661 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile662 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile663 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 67, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile664 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 136, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile665 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile666 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 4, 0).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile667 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(180, 0); - var tile668 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile669 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 0, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 252, 0); - var tile670 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile671 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile672 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(270, 36); - var tile673 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile674 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile675 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile676 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile677 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile678 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile679 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile680 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile681 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile682 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 4, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile683 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile684 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile685 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile686 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile687 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 4, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile688 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile689 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile690 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile691 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile692 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile693 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile694 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile695 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile696 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile697 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile698 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile699 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile700 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile701 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile702 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 160, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile703 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile704 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 4, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile705 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile706 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile707 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile708 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile709 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile710 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile711 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile712 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile713 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile714 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile715 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile716 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile717 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile718 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile719 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile720 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile721 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile722 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile723 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile724 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile725 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile726 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile727 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile728 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile729 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile730 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile731 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile732 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile733 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile734 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile735 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile736 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 66, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile737 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile738 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 1, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile739 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile740 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile741 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile742 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile743 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile744 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile745 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile746 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile747 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile748 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile749 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile750 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile751 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 11, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile752 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 6, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile753 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile754 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile755 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile756 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile757 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile758 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile759 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile760 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile761 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile762 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile763 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile764 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 10, 0, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile765 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 10, 0, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile766 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 138, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile767 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile768 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile769 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile770 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile771 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile772 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile773 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile774 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile775 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile776 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile777 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 131, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile778 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 71, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile779 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile780 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 3, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile781 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile782 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile783 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 136, 1, 0).UseLiquid(LiquidState.Lava, 231).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile784 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 139, 2, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile785 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 75, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile786 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile787 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile788 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile789 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile790 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile791 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile792 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile793 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile794 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(32, 74, 1, 0).UseLiquid(LiquidState.Lava, 255).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile795 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile796 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile797 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile798 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile799 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile800 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile801 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile802 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile803 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile804 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile805 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile806 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile807 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile808 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile809 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile810 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile811 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile812 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile813 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile814 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile815 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile816 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile817 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile818 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile819 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile820 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile821 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile822 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile823 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile824 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile825 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile826 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile827 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 72); - var tile828 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile829 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile830 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile831 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(234, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile832 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile833 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile834 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile835 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 2, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile836 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile837 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile838 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile839 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile840 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile841 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 67, 3, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile842 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile843 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(234, 36); - var tile844 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile845 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile846 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile847 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile848 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile849 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile850 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile851 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile852 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile853 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 4, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile854 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile855 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile856 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile857 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(270, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile858 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile859 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile860 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile861 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 84, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile862 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile863 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(270, 36).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile864 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 4, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile865 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile866 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 74, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile867 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile868 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile869 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile870 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile871 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile872 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile873 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile874 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 3, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile875 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile876 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile877 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile878 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 4, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile879 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile880 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile881 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile882 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile883 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile884 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile885 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile886 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile887 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile888 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile889 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile890 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile891 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile892 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile893 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile894 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile895 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile896 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(180, 90).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile897 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile898 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile899 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile900 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile901 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile902 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile903 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile904 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile905 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(144, 144).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile906 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile907 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile908 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile909 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile910 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 132, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile911 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(468, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile912 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile913 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile914 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile915 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile916 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile917 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile918 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile919 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile920 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile921 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile922 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile923 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile924 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile925 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile926 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile927 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile928 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile929 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile930 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 3, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile931 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(252, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile932 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile933 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile934 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile935 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile936 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile937 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 4, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile938 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile939 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile940 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile941 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile942 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile943 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile944 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile945 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile946 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile947 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile948 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 32).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile949 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile950 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile951 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile952 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile953 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile954 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(72, 180).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile955 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile956 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile957 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile958 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile959 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 3, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile960 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile961 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile962 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile963 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile964 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile965 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile966 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile967 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile968 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile969 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile970 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile971 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile972 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile973 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile974 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile975 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile976 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile977 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile978 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile979 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile980 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile981 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile982 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile983 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile984 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile985 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile986 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36); - var tile987 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile988 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile989 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile990 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile991 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile992 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile993 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile994 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile995 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile996 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile997 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile998 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile999 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1000 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1001 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1002 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1003 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1004 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile1005 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1006 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1007 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1008 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1009 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1010 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1011 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1012 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1013 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 4, 32).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile1014 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1015 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1016 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1017 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1018 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1019 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1020 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1021 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1022 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1023 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1024 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1025 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1026 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1027 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1028 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1029 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1030 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1031 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1032 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1033 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1034 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1035 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1036 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1037 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1038 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1039 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1040 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1041 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1042 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1043 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1044 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1045 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1046 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1047 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1048 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1049 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1050 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1051 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1052 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1053 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 75, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1054 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1055 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1056 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1057 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1058 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1059 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1060 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1061 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1062 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1063 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1064 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1065 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1066 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 4, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1067 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1068 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1069 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1070 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1071 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1072 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1073 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1074 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1075 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1076 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1077 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1078 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1079 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1080 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1081 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1082 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1083 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1084 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1085 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1086 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1087 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1088 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1089 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1090 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1091 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1092 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1093 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1094 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1095 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1096 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1097 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1098 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1099 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1103 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1107 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1111 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1112 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1113 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 18); - var tile1115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 54); - var tile1116 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1119 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1120 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1123 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1124 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 1, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1126 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1127 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); - var tile1129 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1132 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1136 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(180, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1138 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1139 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1140 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1141 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1142 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1144 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1145 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1146 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile1147 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1148 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 4, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile1149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile1150 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 66, 0, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1151 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 138, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1152 = new TileDefinitionStructure(TileID.Glass).UseHeaders(0, 131, 1, 32).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1153 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1154 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1155 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1156 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1157 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1159 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1160 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(54, 198).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1161 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1162 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1163 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(144, 162).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile1165 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1166 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile1168 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile1169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile1170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1171 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile1174 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); - var tile1175 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile1176 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile1177 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1178 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1179 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 1, 3, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile1180 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 138, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1183 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1184 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 96, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile1187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); - var tile1192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1194 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1195 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1199 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1200 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1204 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 4, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile1205 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); - var tile1206 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile1208 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 26, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1209 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 8224).UseFrame(450, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1212 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1213 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 1, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1214 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 71, 2, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1215 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 1, 1, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1217 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 136, 2, 32).UseFrame(0, 234).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1218 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 1, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1219 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1220 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1221 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 165, 3, 32).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 8224).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 155, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1229 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 16416).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1232 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1233 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 16416).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile1236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1240 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1241 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1242 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1243 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1244 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile1246 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile1247 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1248 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1249 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1250 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1254 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1255 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1260 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 2, 4128).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1268 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 2, 32).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(18, 216).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1271 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(54, 54); - var tile1272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 4, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile1273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile1274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 0, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(306, 36).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1277 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 8224).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1281 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1282 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1284 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 152, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 22, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 27, 0, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 1, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 171, 2, 32).UseFrame(306, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1295 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 4, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile1296 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile1297 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1298 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1299 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(288, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1300 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1301 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 90, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1312 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(288, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile1315 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile1316 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(144, 144).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1317 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1318 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 168, 2, 32).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1323 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1326 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1328 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1330 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile1331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 12320).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1333 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 2, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile1334 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1335 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1336 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 2, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile1337 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(72, 216).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1338 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 43, 0, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile1339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 87, 1, 32).UseFrame(216, 18).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile1342 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1343 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 107, 1, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 4128).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1347 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1349 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1350 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 12320).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 4128).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1352 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1353 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 42, 0, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 12320).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1356 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile1357 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 4, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 288, 144); - var tile1358 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(108, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1359 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 131, 1, 32).UseFrame(0, 216).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1360 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 66, 1, 32).UseFrame(0, 252).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1361 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile1362 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 103, 4, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile1363 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile1364 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1365 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile1366 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 4, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1367 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 1, 32).UseFrame(54, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1368 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1369 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1370 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1371 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1372 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1373 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile1374 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1375 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 170, 2, 32).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile1376 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1377 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1378 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 4, 32).UseFrame(90, 72).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile1379 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1380 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile1381 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1382 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 74, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1383 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile1384 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1385 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1386 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 38, 1, 32).UseFrame(162, 162).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile1387 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 139, 2, 32).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile1388 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1389 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile1390 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 106, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile1391 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile1392 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1393 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 4, 0).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile1394 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile1395 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile1396 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 36); - var tile1397 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 99, 3, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile1398 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile1399 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1400 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 20, 0, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile1401 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 4, 32).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile1402 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile1403 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 0); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(35, 57, 217), tile2 }, - { new Color(65, 164, 33), tile3 }, - { new Color(102, 132, 226), tile4 }, - { new Color(203, 168, 180), tile5 }, - { new Color(247, 44, 196), tile6 }, - { new Color(92, 5, 239), tile7 }, - { new Color(45, 134, 16), tile8 }, - { new Color(16, 15, 190), tile9 }, - { new Color(226, 148, 71), tile10 }, - { new Color(198, 186, 114), tile11 }, - { new Color(251, 19, 72), tile12 }, - { new Color(139, 43, 105), tile13 }, - { new Color(88, 81, 241), tile14 }, - { new Color(81, 133, 20), tile15 }, - { new Color(109, 229, 244), tile16 }, - { new Color(19, 5, 155), tile17 }, - { new Color(144, 97, 88), tile18 }, - { new Color(21, 119, 86), tile19 }, - { new Color(136, 19, 42), tile20 }, - { new Color(26, 94, 15), tile21 }, - { new Color(218, 159, 202), tile22 }, - { new Color(111, 208, 148), tile23 }, - { new Color(107, 108, 1), tile24 }, - { new Color(90, 3, 180), tile25 }, - { new Color(254, 220, 1), tile26 }, - { new Color(252, 163, 42), tile27 }, - { new Color(201, 206, 143), tile28 }, - { new Color(171, 54, 88), tile29 }, - { new Color(26, 230, 156), tile30 }, - { new Color(241, 3, 24), tile31 }, - { new Color(63, 62, 242), tile32 }, - { new Color(225, 119, 229), tile33 }, - { new Color(73, 253, 21), tile34 }, - { new Color(96, 168, 153), tile35 }, - { new Color(154, 53, 94), tile36 }, - { new Color(164, 23, 154), tile37 }, - { new Color(85, 139, 111), tile38 }, - { new Color(255, 80, 144), tile39 }, - { new Color(128, 46, 105), tile40 }, - { new Color(113, 85, 233), tile41 }, - { new Color(248, 122, 104), tile42 }, - { new Color(232, 27, 197), tile43 }, - { new Color(193, 28, 101), tile44 }, - { new Color(28, 178, 165), tile45 }, - { new Color(21, 105, 38), tile46 }, - { new Color(246, 17, 1), tile47 }, - { new Color(250, 118, 207), tile48 }, - { new Color(1, 155, 119), tile49 }, - { new Color(168, 64, 237), tile50 }, - { new Color(97, 97, 72), tile51 }, - { new Color(124, 215, 167), tile52 }, - { new Color(43, 103, 45), tile53 }, - { new Color(48, 177, 26), tile54 }, - { new Color(152, 226, 250), tile55 }, - { new Color(52, 57, 217), tile56 }, - { new Color(202, 234, 231), tile57 }, - { new Color(106, 137, 29), tile58 }, - { new Color(103, 119, 223), tile59 }, - { new Color(26, 247, 222), tile60 }, - { new Color(241, 63, 219), tile61 }, - { new Color(215, 95, 186), tile62 }, - { new Color(29, 159, 218), tile63 }, - { new Color(253, 233, 2), tile64 }, - { new Color(248, 198, 95), tile65 }, - { new Color(231, 97, 147), tile66 }, - { new Color(212, 204, 98), tile67 }, - { new Color(157, 222, 85), tile68 }, - { new Color(6, 247, 216), tile69 }, - { new Color(42, 20, 96), tile70 }, - { new Color(200, 17, 112), tile71 }, - { new Color(79, 62, 114), tile72 }, - { new Color(63, 192, 130), tile73 }, - { new Color(64, 23, 153), tile74 }, - { new Color(254, 204, 0), tile75 }, - { new Color(228, 113, 195), tile76 }, - { new Color(190, 128, 21), tile77 }, - { new Color(76, 69, 42), tile78 }, - { new Color(123, 83, 96), tile79 }, - { new Color(133, 209, 103), tile80 }, - { new Color(225, 243, 139), tile81 }, - { new Color(122, 53, 216), tile82 }, - { new Color(145, 168, 135), tile83 }, - { new Color(236, 167, 161), tile84 }, - { new Color(16, 147, 181), tile85 }, - { new Color(200, 158, 18), tile86 }, - { new Color(84, 33, 134), tile87 }, - { new Color(21, 107, 147), tile88 }, - { new Color(74, 123, 203), tile89 }, - { new Color(70, 211, 234), tile90 }, - { new Color(17, 185, 239), tile91 }, - { new Color(26, 94, 36), tile92 }, - { new Color(14, 132, 151), tile93 }, - { new Color(40, 83, 201), tile94 }, - { new Color(59, 210, 216), tile95 }, - { new Color(116, 59, 178), tile96 }, - { new Color(117, 178, 180), tile97 }, - { new Color(78, 48, 175), tile98 }, - { new Color(225, 204, 135), tile99 }, - { new Color(247, 47, 185), tile100 }, - { new Color(12, 75, 212), tile101 }, - { new Color(156, 218, 238), tile102 }, - { new Color(178, 245, 52), tile103 }, - { new Color(144, 186, 26), tile104 }, - { new Color(122, 44, 206), tile105 }, - { new Color(188, 218, 153), tile106 }, - { new Color(187, 214, 64), tile107 }, - { new Color(25, 208, 32), tile108 }, - { new Color(53, 195, 137), tile109 }, - { new Color(63, 57, 146), tile110 }, - { new Color(156, 23, 85), tile111 }, - { new Color(221, 27, 7), tile112 }, - { new Color(244, 158, 247), tile113 }, - { new Color(234, 193, 69), tile114 }, - { new Color(125, 228, 248), tile115 }, - { new Color(154, 211, 4), tile116 }, - { new Color(225, 36, 241), tile117 }, - { new Color(238, 59, 88), tile118 }, - { new Color(121, 243, 122), tile119 }, - { new Color(179, 103, 23), tile120 }, - { new Color(100, 115, 188), tile121 }, - { new Color(162, 243, 163), tile122 }, - { new Color(197, 157, 16), tile123 }, - { new Color(199, 200, 59), tile124 }, - { new Color(162, 209, 20), tile125 }, - { new Color(250, 156, 236), tile126 }, - { new Color(40, 155, 239), tile127 }, - { new Color(133, 94, 20), tile128 }, - { new Color(160, 174, 219), tile129 }, - { new Color(252, 100, 40), tile130 }, - { new Color(140, 64, 55), tile131 }, - { new Color(223, 133, 78), tile132 }, - { new Color(137, 218, 240), tile133 }, - { new Color(85, 213, 54), tile134 }, - { new Color(243, 25, 92), tile135 }, - { new Color(182, 75, 106), tile136 }, - { new Color(67, 126, 87), tile137 }, - { new Color(142, 139, 203), tile138 }, - { new Color(40, 223, 20), tile139 }, - { new Color(168, 1, 68), tile140 }, - { new Color(200, 200, 56), tile141 }, - { new Color(232, 58, 136), tile142 }, - { new Color(4, 194, 75), tile143 }, - { new Color(198, 113, 193), tile144 }, - { new Color(251, 211, 198), tile145 }, - { new Color(185, 145, 68), tile146 }, - { new Color(184, 234, 99), tile147 }, - { new Color(112, 184, 230), tile148 }, - { new Color(208, 254, 181), tile149 }, - { new Color(107, 183, 165), tile150 }, - { new Color(57, 224, 216), tile151 }, - { new Color(172, 140, 12), tile152 }, - { new Color(253, 10, 223), tile153 }, - { new Color(212, 177, 136), tile154 }, - { new Color(31, 125, 13), tile155 }, - { new Color(149, 146, 184), tile156 }, - { new Color(4, 110, 78), tile157 }, - { new Color(208, 240, 23), tile158 }, - { new Color(225, 88, 15), tile159 }, - { new Color(82, 23, 60), tile160 }, - { new Color(210, 152, 11), tile161 }, - { new Color(166, 140, 144), tile162 }, - { new Color(232, 79, 70), tile163 }, - { new Color(186, 187, 134), tile164 }, - { new Color(101, 228, 57), tile165 }, - { new Color(218, 81, 59), tile166 }, - { new Color(217, 59, 107), tile167 }, - { new Color(253, 102, 72), tile168 }, - { new Color(87, 105, 240), tile169 }, - { new Color(193, 202, 52), tile170 }, - { new Color(252, 171, 242), tile171 }, - { new Color(163, 1, 24), tile172 }, - { new Color(125, 121, 241), tile173 }, - { new Color(124, 173, 67), tile174 }, - { new Color(113, 74, 179), tile175 }, - { new Color(199, 107, 12), tile176 }, - { new Color(222, 7, 7), tile177 }, - { new Color(212, 121, 220), tile178 }, - { new Color(208, 213, 49), tile179 }, - { new Color(195, 78, 34), tile180 }, - { new Color(159, 38, 132), tile181 }, - { new Color(17, 189, 16), tile182 }, - { new Color(147, 193, 226), tile183 }, - { new Color(32, 93, 216), tile184 }, - { new Color(73, 92, 142), tile185 }, - { new Color(40, 139, 28), tile186 }, - { new Color(148, 144, 254), tile187 }, - { new Color(228, 227, 195), tile188 }, - { new Color(45, 39, 50), tile189 }, - { new Color(22, 210, 43), tile190 }, - { new Color(230, 185, 42), tile191 }, - { new Color(206, 221, 134), tile192 }, - { new Color(190, 95, 140), tile193 }, - { new Color(163, 51, 169), tile194 }, - { new Color(41, 189, 169), tile195 }, - { new Color(47, 138, 28), tile196 }, - { new Color(78, 168, 74), tile197 }, - { new Color(21, 46, 190), tile198 }, - { new Color(36, 186, 67), tile199 }, - { new Color(193, 228, 150), tile200 }, - { new Color(221, 125, 238), tile201 }, - { new Color(183, 57, 163), tile202 }, - { new Color(173, 122, 127), tile203 }, - { new Color(8, 105, 43), tile204 }, - { new Color(143, 241, 92), tile205 }, - { new Color(84, 187, 38), tile206 }, - { new Color(25, 254, 156), tile207 }, - { new Color(21, 199, 42), tile208 }, - { new Color(224, 209, 139), tile209 }, - { new Color(107, 170, 34), tile210 }, - { new Color(66, 252, 123), tile211 }, - { new Color(246, 197, 181), tile212 }, - { new Color(186, 113, 131), tile213 }, - { new Color(6, 129, 16), tile214 }, - { new Color(157, 70, 62), tile215 }, - { new Color(30, 133, 60), tile216 }, - { new Color(98, 207, 254), tile217 }, - { new Color(29, 168, 229), tile218 }, - { new Color(249, 200, 181), tile219 }, - { new Color(196, 215, 104), tile220 }, - { new Color(23, 66, 208), tile221 }, - { new Color(92, 197, 108), tile222 }, - { new Color(176, 153, 43), tile223 }, - { new Color(167, 153, 74), tile224 }, - { new Color(162, 18, 125), tile225 }, - { new Color(140, 119, 129), tile226 }, - { new Color(235, 194, 75), tile227 }, - { new Color(78, 9, 218), tile228 }, - { new Color(35, 37, 84), tile229 }, - { new Color(149, 252, 253), tile230 }, - { new Color(255, 246, 154), tile231 }, - { new Color(27, 239, 62), tile232 }, - { new Color(64, 64, 128), tile233 }, - { new Color(210, 110, 236), tile234 }, - { new Color(16, 187, 54), tile235 }, - { new Color(180, 123, 149), tile236 }, - { new Color(104, 109, 80), tile237 }, - { new Color(52, 217, 20), tile238 }, - { new Color(28, 200, 57), tile239 }, - { new Color(245, 56, 160), tile240 }, - { new Color(24, 26, 156), tile241 }, - { new Color(46, 167, 163), tile242 }, - { new Color(176, 134, 35), tile243 }, - { new Color(62, 76, 55), tile244 }, - { new Color(0, 25, 83), tile245 }, - { new Color(94, 61, 78), tile246 }, - { new Color(164, 111, 170), tile247 }, - { new Color(190, 45, 143), tile248 }, - { new Color(172, 203, 28), tile249 }, - { new Color(133, 254, 38), tile250 }, - { new Color(5, 74, 7), tile251 }, - { new Color(224, 186, 83), tile252 }, - { new Color(80, 226, 19), tile253 }, - { new Color(146, 4, 244), tile254 }, - { new Color(114, 41, 32), tile255 }, - { new Color(25, 52, 192), tile256 }, - { new Color(193, 190, 138), tile257 }, - { new Color(235, 81, 201), tile258 }, - { new Color(246, 89, 237), tile259 }, - { new Color(12, 129, 220), tile260 }, - { new Color(135, 42, 136), tile261 }, - { new Color(253, 57, 1), tile262 }, - { new Color(47, 31, 94), tile263 }, - { new Color(255, 13, 91), tile264 }, - { new Color(58, 17, 107), tile265 }, - { new Color(181, 76, 3), tile266 }, - { new Color(110, 147, 150), tile267 }, - { new Color(92, 195, 64), tile268 }, - { new Color(155, 26, 249), tile269 }, - { new Color(62, 234, 97), tile270 }, - { new Color(102, 68, 96), tile271 }, - { new Color(55, 11, 217), tile272 }, - { new Color(108, 116, 240), tile273 }, - { new Color(30, 233, 20), tile274 }, - { new Color(97, 193, 176), tile275 }, - { new Color(47, 176, 63), tile276 }, - { new Color(94, 64, 12), tile277 }, - { new Color(233, 157, 238), tile278 }, - { new Color(69, 42, 102), tile279 }, - { new Color(72, 98, 31), tile280 }, - { new Color(8, 241, 53), tile281 }, - { new Color(253, 153, 201), tile282 }, - { new Color(251, 2, 6), tile283 }, - { new Color(146, 73, 215), tile284 }, - { new Color(19, 79, 169), tile285 }, - { new Color(130, 250, 2), tile286 }, - { new Color(143, 108, 105), tile287 }, - { new Color(186, 224, 169), tile288 }, - { new Color(84, 125, 166), tile289 }, - { new Color(113, 242, 224), tile290 }, - { new Color(114, 36, 18), tile291 }, - { new Color(209, 22, 248), tile292 }, - { new Color(222, 99, 40), tile293 }, - { new Color(231, 51, 174), tile294 }, - { new Color(56, 203, 247), tile295 }, - { new Color(52, 213, 77), tile296 }, - { new Color(68, 194, 47), tile297 }, - { new Color(100, 184, 246), tile298 }, - { new Color(181, 78, 16), tile299 }, - { new Color(140, 169, 27), tile300 }, - { new Color(34, 138, 16), tile301 }, - { new Color(37, 32, 36), tile302 }, - { new Color(197, 66, 57), tile303 }, - { new Color(176, 164, 151), tile304 }, - { new Color(218, 168, 56), tile305 }, - { new Color(187, 129, 20), tile306 }, - { new Color(177, 31, 168), tile307 }, - { new Color(89, 45, 47), tile308 }, - { new Color(177, 13, 107), tile309 }, - { new Color(28, 27, 200), tile310 }, - { new Color(231, 82, 186), tile311 }, - { new Color(12, 196, 169), tile312 }, - { new Color(157, 18, 171), tile313 }, - { new Color(210, 111, 146), tile314 }, - { new Color(20, 147, 30), tile315 }, - { new Color(152, 138, 16), tile316 }, - { new Color(189, 250, 204), tile317 }, - { new Color(252, 218, 137), tile318 }, - { new Color(115, 201, 92), tile319 }, - { new Color(224, 116, 18), tile320 }, - { new Color(185, 168, 39), tile321 }, - { new Color(112, 200, 81), tile322 }, - { new Color(220, 205, 227), tile323 }, - { new Color(143, 29, 110), tile324 }, - { new Color(104, 222, 176), tile325 }, - { new Color(21, 69, 153), tile326 }, - { new Color(17, 24, 131), tile327 }, - { new Color(90, 95, 33), tile328 }, - { new Color(252, 235, 120), tile329 }, - { new Color(49, 153, 251), tile330 }, - { new Color(76, 189, 158), tile331 }, - { new Color(153, 25, 198), tile332 }, - { new Color(107, 163, 202), tile333 }, - { new Color(204, 188, 189), tile334 }, - { new Color(44, 45, 220), tile335 }, - { new Color(93, 148, 251), tile336 }, - { new Color(217, 94, 132), tile337 }, - { new Color(195, 206, 92), tile338 }, - { new Color(143, 94, 73), tile339 }, - { new Color(5, 116, 221), tile340 }, - { new Color(217, 171, 52), tile341 }, - { new Color(232, 67, 96), tile342 }, - { new Color(208, 207, 197), tile343 }, - { new Color(233, 169, 161), tile344 }, - { new Color(206, 69, 92), tile345 }, - { new Color(198, 45, 49), tile346 }, - { new Color(68, 158, 86), tile347 }, - { new Color(124, 88, 58), tile348 }, - { new Color(118, 137, 238), tile349 }, - { new Color(66, 9, 187), tile350 }, - { new Color(125, 101, 46), tile351 }, - { new Color(236, 242, 17), tile352 }, - { new Color(136, 68, 234), tile353 }, - { new Color(124, 141, 197), tile354 }, - { new Color(54, 239, 180), tile355 }, - { new Color(226, 244, 137), tile356 }, - { new Color(255, 201, 48), tile357 }, - { new Color(24, 193, 213), tile358 }, - { new Color(134, 92, 82), tile359 }, - { new Color(249, 113, 186), tile360 }, - { new Color(113, 141, 197), tile361 }, - { new Color(9, 107, 67), tile362 }, - { new Color(115, 225, 82), tile363 }, - { new Color(75, 61, 233), tile364 }, - { new Color(70, 199, 17), tile365 }, - { new Color(145, 70, 104), tile366 }, - { new Color(133, 148, 148), tile367 }, - { new Color(100, 66, 64), tile368 }, - { new Color(139, 101, 164), tile369 }, - { new Color(88, 102, 150), tile370 }, - { new Color(190, 143, 210), tile371 }, - { new Color(48, 11, 255), tile372 }, - { new Color(255, 44, 131), tile373 }, - { new Color(113, 111, 18), tile374 }, - { new Color(55, 180, 139), tile375 }, - { new Color(70, 209, 250), tile376 }, - { new Color(196, 244, 21), tile377 }, - { new Color(234, 115, 221), tile378 }, - { new Color(37, 12, 75), tile379 }, - { new Color(132, 126, 6), tile380 }, - { new Color(159, 26, 123), tile381 }, - { new Color(188, 140, 174), tile382 }, - { new Color(22, 21, 188), tile383 }, - { new Color(17, 146, 26), tile384 }, - { new Color(228, 20, 36), tile385 }, - { new Color(130, 45, 141), tile386 }, - { new Color(181, 68, 147), tile387 }, - { new Color(170, 148, 113), tile388 }, - { new Color(128, 212, 27), tile389 }, - { new Color(245, 11, 254), tile390 }, - { new Color(180, 123, 173), tile391 }, - { new Color(125, 209, 84), tile392 }, - { new Color(150, 122, 40), tile393 }, - { new Color(221, 48, 188), tile394 }, - { new Color(61, 178, 98), tile395 }, - { new Color(251, 5, 94), tile396 }, - { new Color(184, 163, 223), tile397 }, - { new Color(189, 207, 58), tile398 }, - { new Color(115, 245, 134), tile399 }, - { new Color(10, 60, 184), tile400 }, - { new Color(146, 33, 10), tile401 }, - { new Color(190, 93, 22), tile402 }, - { new Color(109, 103, 66), tile403 }, - { new Color(208, 235, 178), tile404 }, - { new Color(101, 215, 20), tile405 }, - { new Color(215, 108, 225), tile406 }, - { new Color(14, 133, 206), tile407 }, - { new Color(188, 60, 104), tile408 }, - { new Color(30, 247, 172), tile409 }, - { new Color(115, 10, 220), tile410 }, - { new Color(206, 139, 62), tile411 }, - { new Color(111, 74, 14), tile412 }, - { new Color(178, 127, 84), tile413 }, - { new Color(76, 141, 158), tile414 }, - { new Color(28, 232, 183), tile415 }, - { new Color(44, 87, 247), tile416 }, - { new Color(37, 155, 136), tile417 }, - { new Color(164, 252, 182), tile418 }, - { new Color(233, 214, 228), tile419 }, - { new Color(161, 159, 102), tile420 }, - { new Color(106, 249, 93), tile421 }, - { new Color(102, 1, 95), tile422 }, - { new Color(115, 246, 141), tile423 }, - { new Color(5, 37, 237), tile424 }, - { new Color(140, 194, 247), tile425 }, - { new Color(48, 160, 84), tile426 }, - { new Color(176, 241, 160), tile427 }, - { new Color(180, 77, 110), tile428 }, - { new Color(84, 41, 143), tile429 }, - { new Color(136, 134, 115), tile430 }, - { new Color(42, 16, 223), tile431 }, - { new Color(238, 225, 148), tile432 }, - { new Color(64, 182, 230), tile433 }, - { new Color(87, 185, 97), tile434 }, - { new Color(105, 31, 118), tile435 }, - { new Color(155, 24, 57), tile436 }, - { new Color(191, 184, 54), tile437 }, - { new Color(143, 240, 174), tile438 }, - { new Color(198, 181, 171), tile439 }, - { new Color(238, 17, 215), tile440 }, - { new Color(208, 235, 112), tile441 }, - { new Color(25, 219, 21), tile442 }, - { new Color(13, 158, 224), tile443 }, - { new Color(98, 239, 234), tile444 }, - { new Color(109, 89, 56), tile445 }, - { new Color(62, 75, 45), tile446 }, - { new Color(247, 185, 17), tile447 }, - { new Color(85, 200, 205), tile448 }, - { new Color(61, 154, 31), tile449 }, - { new Color(49, 40, 43), tile450 }, - { new Color(232, 81, 164), tile451 }, - { new Color(15, 135, 205), tile452 }, - { new Color(240, 80, 68), tile453 }, - { new Color(97, 141, 122), tile454 }, - { new Color(89, 92, 200), tile455 }, - { new Color(75, 34, 151), tile456 }, - { new Color(117, 135, 106), tile457 }, - { new Color(125, 247, 88), tile458 }, - { new Color(197, 122, 34), tile459 }, - { new Color(162, 219, 64), tile460 }, - { new Color(245, 220, 117), tile461 }, - { new Color(181, 122, 158), tile462 }, - { new Color(69, 94, 210), tile463 }, - { new Color(107, 77, 251), tile464 }, - { new Color(233, 150, 43), tile465 }, - { new Color(151, 252, 108), tile466 }, - { new Color(4, 242, 120), tile467 }, - { new Color(136, 187, 160), tile468 }, - { new Color(193, 106, 90), tile469 }, - { new Color(75, 73, 12), tile470 }, - { new Color(170, 78, 116), tile471 }, - { new Color(3, 107, 176), tile472 }, - { new Color(4, 164, 226), tile473 }, - { new Color(42, 5, 195), tile474 }, - { new Color(196, 10, 57), tile475 }, - { new Color(111, 148, 97), tile476 }, - { new Color(44, 45, 126), tile477 }, - { new Color(182, 158, 233), tile478 }, - { new Color(200, 109, 32), tile479 }, - { new Color(212, 243, 15), tile480 }, - { new Color(67, 250, 20), tile481 }, - { new Color(198, 192, 255), tile482 }, - { new Color(134, 229, 42), tile483 }, - { new Color(123, 147, 88), tile484 }, - { new Color(137, 217, 236), tile485 }, - { new Color(180, 195, 177), tile486 }, - { new Color(103, 82, 214), tile487 }, - { new Color(249, 31, 27), tile488 }, - { new Color(141, 243, 175), tile489 }, - { new Color(139, 59, 254), tile490 }, - { new Color(144, 47, 176), tile491 }, - { new Color(211, 231, 11), tile492 }, - { new Color(174, 254, 73), tile493 }, - { new Color(57, 232, 175), tile494 }, - { new Color(54, 177, 154), tile495 }, - { new Color(38, 44, 196), tile496 }, - { new Color(252, 19, 170), tile497 }, - { new Color(111, 109, 161), tile498 }, - { new Color(56, 74, 218), tile499 }, - { new Color(249, 56, 204), tile500 }, - { new Color(79, 251, 169), tile501 }, - { new Color(44, 234, 99), tile502 }, - { new Color(167, 182, 242), tile503 }, - { new Color(225, 5, 196), tile504 }, - { new Color(103, 45, 105), tile505 }, - { new Color(38, 194, 109), tile506 }, - { new Color(129, 103, 198), tile507 }, - { new Color(235, 142, 40), tile508 }, - { new Color(83, 33, 194), tile509 }, - { new Color(14, 154, 156), tile510 }, - { new Color(48, 181, 198), tile511 }, - { new Color(124, 233, 237), tile512 }, - { new Color(5, 10, 198), tile513 }, - { new Color(54, 126, 118), tile514 }, - { new Color(209, 27, 13), tile515 }, - { new Color(230, 7, 63), tile516 }, - { new Color(55, 17, 135), tile517 }, - { new Color(108, 120, 209), tile518 }, - { new Color(6, 100, 108), tile519 }, - { new Color(129, 216, 201), tile520 }, - { new Color(161, 153, 28), tile521 }, - { new Color(85, 176, 79), tile522 }, - { new Color(254, 234, 68), tile523 }, - { new Color(124, 33, 184), tile524 }, - { new Color(167, 74, 233), tile525 }, - { new Color(80, 25, 114), tile526 }, - { new Color(26, 109, 25), tile527 }, - { new Color(131, 214, 136), tile528 }, - { new Color(21, 195, 61), tile529 }, - { new Color(245, 118, 133), tile530 }, - { new Color(128, 132, 50), tile531 }, - { new Color(252, 149, 229), tile532 }, - { new Color(89, 123, 107), tile533 }, - { new Color(189, 232, 28), tile534 }, - { new Color(251, 187, 240), tile535 }, - { new Color(207, 197, 45), tile536 }, - { new Color(231, 181, 74), tile537 }, - { new Color(249, 102, 107), tile538 }, - { new Color(176, 30, 194), tile539 }, - { new Color(148, 64, 236), tile540 }, - { new Color(18, 8, 116), tile541 }, - { new Color(190, 252, 156), tile542 }, - { new Color(134, 170, 181), tile543 }, - { new Color(3, 246, 158), tile544 }, - { new Color(7, 92, 133), tile545 }, - { new Color(253, 135, 27), tile546 }, - { new Color(151, 70, 254), tile547 }, - { new Color(16, 13, 193), tile548 }, - { new Color(59, 134, 29), tile549 }, - { new Color(198, 76, 118), tile550 }, - { new Color(35, 197, 59), tile551 }, - { new Color(126, 171, 223), tile552 }, - { new Color(168, 60, 191), tile553 }, - { new Color(83, 72, 26), tile554 }, - { new Color(120, 227, 190), tile555 }, - { new Color(172, 242, 10), tile556 }, - { new Color(229, 178, 150), tile557 }, - { new Color(166, 252, 249), tile558 }, - { new Color(238, 1, 251), tile559 }, - { new Color(178, 131, 117), tile560 }, - { new Color(127, 191, 93), tile561 }, - { new Color(62, 224, 48), tile562 }, - { new Color(98, 136, 176), tile563 }, - { new Color(165, 84, 74), tile564 }, - { new Color(91, 67, 253), tile565 }, - { new Color(227, 151, 41), tile566 }, - { new Color(2, 142, 148), tile567 }, - { new Color(19, 225, 153), tile568 }, - { new Color(224, 124, 201), tile569 }, - { new Color(65, 144, 169), tile570 }, - { new Color(227, 245, 185), tile571 }, - { new Color(73, 212, 137), tile572 }, - { new Color(188, 58, 3), tile573 }, - { new Color(142, 73, 105), tile574 }, - { new Color(89, 63, 94), tile575 }, - { new Color(75, 75, 184), tile576 }, - { new Color(252, 10, 106), tile577 }, - { new Color(209, 176, 244), tile578 }, - { new Color(225, 108, 222), tile579 }, - { new Color(196, 94, 100), tile580 }, - { new Color(103, 32, 248), tile581 }, - { new Color(6, 193, 94), tile582 }, - { new Color(145, 18, 111), tile583 }, - { new Color(115, 39, 93), tile584 }, - { new Color(38, 115, 68), tile585 }, - { new Color(42, 185, 161), tile586 }, - { new Color(59, 148, 49), tile587 }, - { new Color(16, 69, 134), tile588 }, - { new Color(63, 18, 68), tile589 }, - { new Color(197, 104, 104), tile590 }, - { new Color(171, 248, 220), tile591 }, - { new Color(158, 38, 41), tile592 }, - { new Color(113, 82, 126), tile593 }, - { new Color(255, 186, 56), tile594 }, - { new Color(73, 136, 227), tile595 }, - { new Color(12, 171, 60), tile596 }, - { new Color(175, 182, 178), tile597 }, - { new Color(60, 136, 201), tile598 }, - { new Color(51, 86, 219), tile599 }, - { new Color(113, 198, 175), tile600 }, - { new Color(26, 203, 169), tile601 }, - { new Color(6, 200, 46), tile602 }, - { new Color(129, 136, 77), tile603 }, - { new Color(27, 185, 102), tile604 }, - { new Color(35, 59, 217), tile605 }, - { new Color(248, 199, 189), tile606 }, - { new Color(163, 51, 102), tile607 }, - { new Color(7, 22, 177), tile608 }, - { new Color(181, 110, 111), tile609 }, - { new Color(18, 106, 207), tile610 }, - { new Color(78, 255, 139), tile611 }, - { new Color(206, 229, 239), tile612 }, - { new Color(143, 66, 191), tile613 }, - { new Color(180, 138, 35), tile614 }, - { new Color(239, 147, 252), tile615 }, - { new Color(76, 25, 77), tile616 }, - { new Color(240, 59, 143), tile617 }, - { new Color(29, 206, 147), tile618 }, - { new Color(73, 18, 181), tile619 }, - { new Color(248, 81, 89), tile620 }, - { new Color(191, 111, 29), tile621 }, - { new Color(125, 205, 186), tile622 }, - { new Color(218, 85, 86), tile623 }, - { new Color(234, 104, 132), tile624 }, - { new Color(253, 239, 168), tile625 }, - { new Color(67, 24, 130), tile626 }, - { new Color(180, 105, 85), tile627 }, - { new Color(34, 33, 47), tile628 }, - { new Color(64, 48, 48), tile629 }, - { new Color(248, 133, 210), tile630 }, - { new Color(58, 151, 241), tile631 }, - { new Color(102, 245, 27), tile632 }, - { new Color(5, 114, 198), tile633 }, - { new Color(66, 113, 196), tile634 }, - { new Color(246, 6, 210), tile635 }, - { new Color(11, 32, 223), tile636 }, - { new Color(235, 5, 250), tile637 }, - { new Color(50, 67, 232), tile638 }, - { new Color(4, 156, 77), tile639 }, - { new Color(237, 60, 156), tile640 }, - { new Color(137, 226, 207), tile641 }, - { new Color(131, 176, 209), tile642 }, - { new Color(147, 150, 249), tile643 }, - { new Color(140, 61, 165), tile644 }, - { new Color(187, 114, 247), tile645 }, - { new Color(144, 43, 27), tile646 }, - { new Color(93, 53, 16), tile647 }, - { new Color(81, 13, 127), tile648 }, - { new Color(216, 7, 83), tile649 }, - { new Color(9, 98, 88), tile650 }, - { new Color(206, 24, 53), tile651 }, - { new Color(41, 184, 143), tile652 }, - { new Color(244, 115, 85), tile653 }, - { new Color(0, 119, 137), tile654 }, - { new Color(229, 94, 200), tile655 }, - { new Color(84, 118, 208), tile656 }, - { new Color(240, 115, 112), tile657 }, - { new Color(49, 144, 7), tile658 }, - { new Color(140, 56, 212), tile659 }, - { new Color(80, 170, 169), tile660 }, - { new Color(126, 138, 52), tile661 }, - { new Color(161, 190, 37), tile662 }, - { new Color(111, 146, 186), tile663 }, - { new Color(104, 156, 184), tile664 }, - { new Color(197, 92, 189), tile665 }, - { new Color(134, 108, 175), tile666 }, - { new Color(183, 131, 144), tile667 }, - { new Color(131, 24, 238), tile668 }, - { new Color(231, 156, 135), tile669 }, - { new Color(46, 157, 127), tile670 }, - { new Color(186, 164, 200), tile671 }, - { new Color(172, 130, 237), tile672 }, - { new Color(84, 67, 160), tile673 }, - { new Color(162, 228, 228), tile674 }, - { new Color(22, 135, 215), tile675 }, - { new Color(183, 107, 51), tile676 }, - { new Color(74, 5, 203), tile677 }, - { new Color(37, 153, 38), tile678 }, - { new Color(25, 251, 113), tile679 }, - { new Color(69, 185, 33), tile680 }, - { new Color(157, 65, 245), tile681 }, - { new Color(58, 174, 248), tile682 }, - { new Color(240, 25, 218), tile683 }, - { new Color(207, 50, 40), tile684 }, - { new Color(15, 20, 159), tile685 }, - { new Color(171, 109, 145), tile686 }, - { new Color(23, 48, 49), tile687 }, - { new Color(84, 228, 151), tile688 }, - { new Color(180, 148, 10), tile689 }, - { new Color(161, 147, 135), tile690 }, - { new Color(124, 14, 138), tile691 }, - { new Color(126, 4, 162), tile692 }, - { new Color(239, 219, 217), tile693 }, - { new Color(222, 199, 82), tile694 }, - { new Color(88, 122, 211), tile695 }, - { new Color(163, 22, 132), tile696 }, - { new Color(135, 109, 141), tile697 }, - { new Color(223, 46, 137), tile698 }, - { new Color(240, 73, 93), tile699 }, - { new Color(93, 134, 25), tile700 }, - { new Color(237, 78, 133), tile701 }, - { new Color(83, 83, 35), tile702 }, - { new Color(157, 144, 15), tile703 }, - { new Color(252, 187, 145), tile704 }, - { new Color(184, 56, 104), tile705 }, - { new Color(222, 251, 105), tile706 }, - { new Color(196, 16, 126), tile707 }, - { new Color(134, 25, 38), tile708 }, - { new Color(249, 157, 224), tile709 }, - { new Color(1, 142, 187), tile710 }, - { new Color(69, 146, 85), tile711 }, - { new Color(191, 241, 120), tile712 }, - { new Color(205, 5, 39), tile713 }, - { new Color(175, 5, 133), tile714 }, - { new Color(116, 139, 177), tile715 }, - { new Color(252, 39, 245), tile716 }, - { new Color(32, 17, 78), tile717 }, - { new Color(243, 152, 117), tile718 }, - { new Color(154, 102, 52), tile719 }, - { new Color(94, 90, 182), tile720 }, - { new Color(67, 156, 1), tile721 }, - { new Color(84, 182, 41), tile722 }, - { new Color(60, 248, 71), tile723 }, - { new Color(240, 17, 246), tile724 }, - { new Color(66, 20, 10), tile725 }, - { new Color(248, 17, 142), tile726 }, - { new Color(116, 252, 117), tile727 }, - { new Color(234, 224, 125), tile728 }, - { new Color(108, 81, 249), tile729 }, - { new Color(223, 36, 138), tile730 }, - { new Color(67, 110, 170), tile731 }, - { new Color(113, 108, 105), tile732 }, - { new Color(132, 31, 212), tile733 }, - { new Color(136, 192, 47), tile734 }, - { new Color(174, 48, 255), tile735 }, - { new Color(88, 177, 132), tile736 }, - { new Color(107, 162, 85), tile737 }, - { new Color(166, 234, 94), tile738 }, - { new Color(64, 88, 187), tile739 }, - { new Color(132, 232, 101), tile740 }, - { new Color(48, 93, 211), tile741 }, - { new Color(188, 172, 162), tile742 }, - { new Color(75, 209, 168), tile743 }, - { new Color(161, 116, 242), tile744 }, - { new Color(186, 235, 60), tile745 }, - { new Color(70, 59, 176), tile746 }, - { new Color(125, 19, 160), tile747 }, - { new Color(117, 116, 130), tile748 }, - { new Color(53, 157, 131), tile749 }, - { new Color(76, 48, 19), tile750 }, - { new Color(173, 255, 55), tile751 }, - { new Color(110, 88, 98), tile752 }, - { new Color(91, 242, 132), tile753 }, - { new Color(93, 12, 223), tile754 }, - { new Color(219, 201, 46), tile755 }, - { new Color(98, 236, 254), tile756 }, - { new Color(33, 249, 28), tile757 }, - { new Color(11, 7, 212), tile758 }, - { new Color(197, 186, 233), tile759 }, - { new Color(81, 134, 14), tile760 }, - { new Color(30, 255, 161), tile761 }, - { new Color(148, 244, 116), tile762 }, - { new Color(187, 75, 147), tile763 }, - { new Color(217, 235, 73), tile764 }, - { new Color(44, 32, 7), tile765 }, - { new Color(192, 153, 170), tile766 }, - { new Color(84, 210, 177), tile767 }, - { new Color(132, 43, 54), tile768 }, - { new Color(247, 162, 248), tile769 }, - { new Color(98, 169, 157), tile770 }, - { new Color(121, 10, 107), tile771 }, - { new Color(117, 62, 13), tile772 }, - { new Color(62, 70, 213), tile773 }, - { new Color(185, 167, 161), tile774 }, - { new Color(107, 71, 14), tile775 }, - { new Color(210, 223, 230), tile776 }, - { new Color(205, 4, 33), tile777 }, - { new Color(62, 252, 180), tile778 }, - { new Color(93, 154, 212), tile779 }, - { new Color(106, 157, 82), tile780 }, - { new Color(124, 88, 161), tile781 }, - { new Color(245, 95, 224), tile782 }, - { new Color(222, 182, 226), tile783 }, - { new Color(249, 130, 82), tile784 }, - { new Color(213, 155, 43), tile785 }, - { new Color(16, 25, 227), tile786 }, - { new Color(39, 36, 195), tile787 }, - { new Color(17, 149, 165), tile788 }, - { new Color(124, 59, 13), tile789 }, - { new Color(183, 24, 164), tile790 }, - { new Color(57, 211, 169), tile791 }, - { new Color(130, 60, 78), tile792 }, - { new Color(255, 117, 231), tile793 }, - { new Color(46, 244, 40), tile794 }, - { new Color(4, 212, 129), tile795 }, - { new Color(206, 104, 97), tile796 }, - { new Color(137, 76, 128), tile797 }, - { new Color(240, 66, 121), tile798 }, - { new Color(143, 107, 195), tile799 }, - { new Color(251, 121, 36), tile800 }, - { new Color(211, 39, 158), tile801 }, - { new Color(61, 191, 175), tile802 }, - { new Color(169, 83, 94), tile803 }, - { new Color(220, 16, 163), tile804 }, - { new Color(251, 249, 47), tile805 }, - { new Color(154, 12, 193), tile806 }, - { new Color(36, 173, 211), tile807 }, - { new Color(171, 46, 203), tile808 }, - { new Color(35, 72, 145), tile809 }, - { new Color(47, 243, 209), tile810 }, - { new Color(139, 4, 252), tile811 }, - { new Color(195, 90, 204), tile812 }, - { new Color(138, 198, 20), tile813 }, - { new Color(210, 37, 21), tile814 }, - { new Color(3, 172, 60), tile815 }, - { new Color(221, 245, 72), tile816 }, - { new Color(73, 244, 94), tile817 }, - { new Color(2, 215, 204), tile818 }, - { new Color(81, 39, 249), tile819 }, - { new Color(210, 26, 118), tile820 }, - { new Color(29, 122, 95), tile821 }, - { new Color(141, 80, 12), tile822 }, - { new Color(166, 55, 158), tile823 }, - { new Color(98, 16, 69), tile824 }, - { new Color(172, 81, 136), tile825 }, - { new Color(189, 168, 129), tile826 }, - { new Color(142, 69, 83), tile827 }, - { new Color(72, 229, 255), tile828 }, - { new Color(114, 137, 44), tile829 }, - { new Color(48, 114, 51), tile830 }, - { new Color(211, 183, 172), tile831 }, - { new Color(157, 180, 170), tile832 }, - { new Color(181, 117, 92), tile833 }, - { new Color(48, 54, 190), tile834 }, - { new Color(169, 230, 227), tile835 }, - { new Color(25, 85, 133), tile836 }, - { new Color(67, 147, 127), tile837 }, - { new Color(120, 68, 212), tile838 }, - { new Color(35, 213, 148), tile839 }, - { new Color(96, 27, 199), tile840 }, - { new Color(223, 118, 197), tile841 }, - { new Color(107, 143, 89), tile842 }, - { new Color(153, 14, 157), tile843 }, - { new Color(221, 7, 50), tile844 }, - { new Color(36, 93, 14), tile845 }, - { new Color(149, 159, 254), tile846 }, - { new Color(27, 88, 51), tile847 }, - { new Color(166, 236, 222), tile848 }, - { new Color(180, 90, 114), tile849 }, - { new Color(215, 122, 223), tile850 }, - { new Color(22, 85, 90), tile851 }, - { new Color(149, 81, 192), tile852 }, - { new Color(249, 62, 87), tile853 }, - { new Color(138, 128, 70), tile854 }, - { new Color(232, 102, 140), tile855 }, - { new Color(76, 83, 230), tile856 }, - { new Color(197, 142, 54), tile857 }, - { new Color(149, 69, 194), tile858 }, - { new Color(147, 56, 138), tile859 }, - { new Color(230, 183, 52), tile860 }, - { new Color(230, 193, 148), tile861 }, - { new Color(190, 199, 178), tile862 }, - { new Color(216, 143, 12), tile863 }, - { new Color(78, 156, 96), tile864 }, - { new Color(167, 144, 216), tile865 }, - { new Color(236, 190, 133), tile866 }, - { new Color(82, 103, 7), tile867 }, - { new Color(140, 17, 235), tile868 }, - { new Color(168, 128, 16), tile869 }, - { new Color(151, 1, 24), tile870 }, - { new Color(53, 18, 134), tile871 }, - { new Color(34, 163, 190), tile872 }, - { new Color(178, 41, 159), tile873 }, - { new Color(217, 115, 195), tile874 }, - { new Color(217, 118, 242), tile875 }, - { new Color(213, 238, 180), tile876 }, - { new Color(233, 166, 121), tile877 }, - { new Color(4, 147, 79), tile878 }, - { new Color(45, 90, 175), tile879 }, - { new Color(168, 21, 71), tile880 }, - { new Color(161, 64, 142), tile881 }, - { new Color(243, 25, 137), tile882 }, - { new Color(218, 133, 237), tile883 }, - { new Color(26, 58, 148), tile884 }, - { new Color(230, 120, 244), tile885 }, - { new Color(67, 178, 155), tile886 }, - { new Color(249, 211, 145), tile887 }, - { new Color(91, 174, 90), tile888 }, - { new Color(159, 49, 127), tile889 }, - { new Color(55, 245, 73), tile890 }, - { new Color(14, 9, 20), tile891 }, - { new Color(87, 56, 51), tile892 }, - { new Color(53, 230, 93), tile893 }, - { new Color(105, 250, 105), tile894 }, - { new Color(199, 206, 108), tile895 }, - { new Color(228, 29, 26), tile896 }, - { new Color(91, 233, 167), tile897 }, - { new Color(20, 175, 66), tile898 }, - { new Color(181, 69, 146), tile899 }, - { new Color(52, 84, 231), tile900 }, - { new Color(10, 163, 143), tile901 }, - { new Color(163, 11, 49), tile902 }, - { new Color(128, 143, 64), tile903 }, - { new Color(192, 14, 204), tile904 }, - { new Color(61, 144, 216), tile905 }, - { new Color(40, 148, 223), tile906 }, - { new Color(237, 186, 19), tile907 }, - { new Color(100, 219, 11), tile908 }, - { new Color(162, 250, 89), tile909 }, - { new Color(210, 162, 242), tile910 }, - { new Color(160, 1, 145), tile911 }, - { new Color(118, 95, 87), tile912 }, - { new Color(217, 36, 195), tile913 }, - { new Color(59, 100, 142), tile914 }, - { new Color(218, 154, 219), tile915 }, - { new Color(218, 215, 31), tile916 }, - { new Color(105, 140, 177), tile917 }, - { new Color(178, 70, 153), tile918 }, - { new Color(211, 165, 199), tile919 }, - { new Color(132, 1, 17), tile920 }, - { new Color(215, 174, 236), tile921 }, - { new Color(78, 32, 12), tile922 }, - { new Color(59, 199, 49), tile923 }, - { new Color(128, 79, 112), tile924 }, - { new Color(28, 178, 86), tile925 }, - { new Color(133, 137, 65), tile926 }, - { new Color(47, 199, 35), tile927 }, - { new Color(58, 104, 21), tile928 }, - { new Color(64, 238, 186), tile929 }, - { new Color(247, 162, 185), tile930 }, - { new Color(144, 84, 34), tile931 }, - { new Color(178, 100, 181), tile932 }, - { new Color(161, 140, 122), tile933 }, - { new Color(206, 159, 16), tile934 }, - { new Color(238, 232, 61), tile935 }, - { new Color(65, 150, 147), tile936 }, - { new Color(67, 78, 27), tile937 }, - { new Color(134, 84, 58), tile938 }, - { new Color(238, 156, 70), tile939 }, - { new Color(214, 13, 49), tile940 }, - { new Color(82, 67, 36), tile941 }, - { new Color(119, 240, 250), tile942 }, - { new Color(77, 105, 78), tile943 }, - { new Color(160, 227, 253), tile944 }, - { new Color(198, 97, 39), tile945 }, - { new Color(19, 76, 127), tile946 }, - { new Color(216, 255, 87), tile947 }, - { new Color(38, 180, 83), tile948 }, - { new Color(157, 9, 0), tile949 }, - { new Color(232, 196, 199), tile950 }, - { new Color(111, 203, 126), tile951 }, - { new Color(72, 124, 92), tile952 }, - { new Color(235, 118, 247), tile953 }, - { new Color(67, 243, 44), tile954 }, - { new Color(69, 162, 106), tile955 }, - { new Color(30, 191, 243), tile956 }, - { new Color(18, 219, 79), tile957 }, - { new Color(198, 254, 14), tile958 }, - { new Color(218, 43, 142), tile959 }, - { new Color(209, 218, 231), tile960 }, - { new Color(249, 101, 165), tile961 }, - { new Color(134, 49, 24), tile962 }, - { new Color(126, 126, 228), tile963 }, - { new Color(202, 39, 214), tile964 }, - { new Color(135, 148, 11), tile965 }, - { new Color(42, 225, 18), tile966 }, - { new Color(233, 127, 73), tile967 }, - { new Color(13, 214, 233), tile968 }, - { new Color(120, 169, 204), tile969 }, - { new Color(112, 109, 81), tile970 }, - { new Color(205, 26, 155), tile971 }, - { new Color(16, 73, 142), tile972 }, - { new Color(135, 191, 112), tile973 }, - { new Color(82, 159, 65), tile974 }, - { new Color(14, 71, 179), tile975 }, - { new Color(121, 62, 105), tile976 }, - { new Color(2, 175, 74), tile977 }, - { new Color(124, 231, 91), tile978 }, - { new Color(157, 236, 142), tile979 }, - { new Color(188, 14, 136), tile980 }, - { new Color(75, 14, 16), tile981 }, - { new Color(147, 252, 13), tile982 }, - { new Color(58, 118, 75), tile983 }, - { new Color(124, 163, 33), tile984 }, - { new Color(161, 151, 223), tile985 }, - { new Color(8, 255, 142), tile986 }, - { new Color(53, 254, 106), tile987 }, - { new Color(98, 110, 190), tile988 }, - { new Color(7, 81, 50), tile989 }, - { new Color(64, 115, 93), tile990 }, - { new Color(255, 202, 177), tile991 }, - { new Color(232, 6, 145), tile992 }, - { new Color(49, 122, 74), tile993 }, - { new Color(165, 63, 199), tile994 }, - { new Color(30, 133, 12), tile995 }, - { new Color(40, 219, 80), tile996 }, - { new Color(123, 148, 237), tile997 }, - { new Color(0, 134, 15), tile998 }, - { new Color(29, 233, 159), tile999 }, - { new Color(82, 140, 171), tile1000 }, - { new Color(219, 249, 2), tile1001 }, - { new Color(237, 125, 217), tile1002 }, - { new Color(111, 184, 144), tile1003 }, - { new Color(78, 215, 132), tile1004 }, - { new Color(68, 144, 191), tile1005 }, - { new Color(163, 68, 232), tile1006 }, - { new Color(177, 222, 118), tile1007 }, - { new Color(225, 197, 223), tile1008 }, - { new Color(112, 255, 67), tile1009 }, - { new Color(161, 203, 28), tile1010 }, - { new Color(241, 223, 237), tile1011 }, - { new Color(158, 201, 69), tile1012 }, - { new Color(196, 48, 8), tile1013 }, - { new Color(51, 184, 34), tile1014 }, - { new Color(191, 44, 189), tile1015 }, - { new Color(104, 188, 245), tile1016 }, - { new Color(79, 122, 164), tile1017 }, - { new Color(182, 160, 174), tile1018 }, - { new Color(53, 250, 52), tile1019 }, - { new Color(35, 125, 125), tile1020 }, - { new Color(149, 205, 237), tile1021 }, - { new Color(116, 92, 248), tile1022 }, - { new Color(151, 165, 199), tile1023 }, - { new Color(122, 222, 19), tile1024 }, - { new Color(224, 126, 37), tile1025 }, - { new Color(83, 33, 152), tile1026 }, - { new Color(33, 8, 67), tile1027 }, - { new Color(77, 82, 80), tile1028 }, - { new Color(120, 58, 62), tile1029 }, - { new Color(63, 105, 206), tile1030 }, - { new Color(16, 161, 179), tile1031 }, - { new Color(138, 157, 234), tile1032 }, - { new Color(53, 75, 208), tile1033 }, - { new Color(197, 208, 22), tile1034 }, - { new Color(46, 213, 155), tile1035 }, - { new Color(145, 214, 33), tile1036 }, - { new Color(136, 226, 216), tile1037 }, - { new Color(156, 1, 117), tile1038 }, - { new Color(58, 71, 123), tile1039 }, - { new Color(156, 251, 33), tile1040 }, - { new Color(185, 88, 59), tile1041 }, - { new Color(248, 105, 61), tile1042 }, - { new Color(96, 85, 225), tile1043 }, - { new Color(58, 29, 213), tile1044 }, - { new Color(200, 92, 55), tile1045 }, - { new Color(44, 30, 124), tile1046 }, - { new Color(180, 230, 100), tile1047 }, - { new Color(29, 182, 135), tile1048 }, - { new Color(246, 116, 159), tile1049 }, - { new Color(61, 80, 85), tile1050 }, - { new Color(111, 152, 79), tile1051 }, - { new Color(174, 12, 120), tile1052 }, - { new Color(219, 54, 108), tile1053 }, - { new Color(94, 49, 128), tile1054 }, - { new Color(64, 78, 196), tile1055 }, - { new Color(2, 211, 164), tile1056 }, - { new Color(62, 13, 40), tile1057 }, - { new Color(255, 231, 20), tile1058 }, - { new Color(189, 155, 161), tile1059 }, - { new Color(180, 2, 244), tile1060 }, - { new Color(157, 34, 5), tile1061 }, - { new Color(139, 203, 132), tile1062 }, - { new Color(133, 25, 80), tile1063 }, - { new Color(190, 81, 232), tile1064 }, - { new Color(16, 86, 181), tile1065 }, - { new Color(227, 221, 103), tile1066 }, - { new Color(195, 243, 160), tile1067 }, - { new Color(250, 255, 66), tile1068 }, - { new Color(44, 111, 177), tile1069 }, - { new Color(59, 240, 112), tile1070 }, - { new Color(214, 39, 51), tile1071 }, - { new Color(119, 192, 14), tile1072 }, - { new Color(123, 180, 130), tile1073 }, - { new Color(63, 125, 186), tile1074 }, - { new Color(84, 128, 188), tile1075 }, - { new Color(64, 239, 145), tile1076 }, - { new Color(95, 217, 190), tile1077 }, - { new Color(58, 241, 15), tile1078 }, - { new Color(83, 162, 34), tile1079 }, - { new Color(194, 95, 92), tile1080 }, - { new Color(211, 74, 40), tile1081 }, - { new Color(224, 231, 42), tile1082 }, - { new Color(180, 153, 149), tile1083 }, - { new Color(166, 104, 40), tile1084 }, - { new Color(228, 131, 118), tile1085 }, - { new Color(230, 166, 127), tile1086 }, - { new Color(134, 236, 128), tile1087 }, - { new Color(31, 219, 23), tile1088 }, - { new Color(177, 156, 53), tile1089 }, - { new Color(36, 35, 29), tile1090 }, - { new Color(236, 185, 84), tile1091 }, - { new Color(38, 107, 50), tile1092 }, - { new Color(145, 115, 152), tile1093 }, - { new Color(146, 139, 85), tile1094 }, - { new Color(252, 184, 113), tile1095 }, - { new Color(150, 85, 109), tile1096 }, - { new Color(153, 109, 252), tile1097 }, - { new Color(162, 60, 115), tile1098 }, - { new Color(219, 179, 111), tile1099 }, - { new Color(17, 47, 74), tile1100 }, - { new Color(244, 143, 117), tile1101 }, - { new Color(119, 186, 175), tile1102 }, - { new Color(211, 190, 23), tile1103 }, - { new Color(67, 85, 50), tile1104 }, - { new Color(230, 243, 96), tile1105 }, - { new Color(42, 35, 35), tile1106 }, - { new Color(165, 26, 71), tile1107 }, - { new Color(200, 139, 182), tile1108 }, - { new Color(33, 73, 124), tile1109 }, - { new Color(225, 75, 183), tile1110 }, - { new Color(195, 127, 68), tile1111 }, - { new Color(78, 158, 251), tile1112 }, - { new Color(224, 132, 254), tile1113 }, - { new Color(194, 194, 151), tile1114 }, - { new Color(85, 85, 23), tile1115 }, - { new Color(201, 188, 72), tile1116 }, - { new Color(18, 176, 144), tile1117 }, - { new Color(75, 108, 20), tile1118 }, - { new Color(2, 43, 3), tile1119 }, - { new Color(191, 85, 112), tile1120 }, - { new Color(50, 242, 114), tile1121 }, - { new Color(96, 128, 214), tile1122 }, - { new Color(238, 152, 85), tile1123 }, - { new Color(101, 74, 159), tile1124 }, - { new Color(37, 227, 88), tile1125 }, - { new Color(176, 115, 54), tile1126 }, - { new Color(158, 87, 141), tile1127 }, - { new Color(52, 207, 154), tile1128 }, - { new Color(39, 119, 19), tile1129 }, - { new Color(48, 75, 114), tile1130 }, - { new Color(247, 32, 46), tile1131 }, - { new Color(141, 144, 208), tile1132 }, - { new Color(36, 245, 212), tile1133 }, - { new Color(65, 219, 35), tile1134 }, - { new Color(242, 173, 102), tile1135 }, - { new Color(240, 38, 136), tile1136 }, - { new Color(187, 82, 184), tile1137 }, - { new Color(205, 33, 254), tile1138 }, - { new Color(227, 253, 34), tile1139 }, - { new Color(216, 56, 8), tile1140 }, - { new Color(194, 190, 76), tile1141 }, - { new Color(227, 109, 41), tile1142 }, - { new Color(112, 152, 83), tile1143 }, - { new Color(136, 139, 125), tile1144 }, - { new Color(98, 93, 124), tile1145 }, - { new Color(105, 66, 33), tile1146 }, - { new Color(51, 54, 81), tile1147 }, - { new Color(138, 116, 249), tile1148 }, - { new Color(185, 42, 255), tile1149 }, - { new Color(48, 169, 146), tile1150 }, - { new Color(173, 76, 188), tile1151 }, - { new Color(203, 126, 29), tile1152 }, - { new Color(215, 15, 63), tile1153 }, - { new Color(60, 128, 141), tile1154 }, - { new Color(53, 51, 198), tile1155 }, - { new Color(58, 107, 195), tile1156 }, - { new Color(130, 122, 187), tile1157 }, - { new Color(0, 164, 1), tile1158 }, - { new Color(183, 55, 73), tile1159 }, - { new Color(83, 41, 66), tile1160 }, - { new Color(42, 64, 238), tile1161 }, - { new Color(192, 218, 63), tile1162 }, - { new Color(192, 150, 222), tile1163 }, - { new Color(94, 146, 51), tile1164 }, - { new Color(226, 247, 182), tile1165 }, - { new Color(195, 85, 64), tile1166 }, - { new Color(50, 126, 191), tile1167 }, - { new Color(59, 174, 47), tile1168 }, - { new Color(215, 172, 167), tile1169 }, - { new Color(187, 20, 70), tile1170 }, - { new Color(211, 131, 229), tile1171 }, - { new Color(253, 17, 63), tile1172 }, - { new Color(159, 116, 88), tile1173 }, - { new Color(134, 122, 212), tile1174 }, - { new Color(229, 35, 232), tile1175 }, - { new Color(135, 30, 173), tile1176 }, - { new Color(74, 244, 226), tile1177 }, - { new Color(8, 32, 170), tile1178 }, - { new Color(131, 239, 146), tile1179 }, - { new Color(190, 233, 46), tile1180 }, - { new Color(152, 5, 130), tile1181 }, - { new Color(151, 139, 14), tile1182 }, - { new Color(77, 229, 229), tile1183 }, - { new Color(118, 36, 224), tile1184 }, - { new Color(232, 171, 4), tile1185 }, - { new Color(234, 85, 138), tile1186 }, - { new Color(71, 79, 142), tile1187 }, - { new Color(250, 112, 32), tile1188 }, - { new Color(100, 202, 99), tile1189 }, - { new Color(59, 121, 34), tile1190 }, - { new Color(173, 224, 139), tile1191 }, - { new Color(42, 238, 116), tile1192 }, - { new Color(82, 77, 151), tile1193 }, - { new Color(217, 58, 57), tile1194 }, - { new Color(199, 212, 208), tile1195 }, - { new Color(2, 32, 117), tile1196 }, - { new Color(165, 152, 153), tile1197 }, - { new Color(7, 119, 153), tile1198 }, - { new Color(159, 157, 148), tile1199 }, - { new Color(98, 51, 192), tile1200 }, - { new Color(171, 18, 107), tile1201 }, - { new Color(194, 200, 67), tile1202 }, - { new Color(84, 189, 188), tile1203 }, - { new Color(143, 152, 8), tile1204 }, - { new Color(242, 109, 21), tile1205 }, - { new Color(84, 50, 156), tile1206 }, - { new Color(79, 97, 170), tile1207 }, - { new Color(237, 149, 225), tile1208 }, - { new Color(137, 166, 105), tile1209 }, - { new Color(242, 138, 81), tile1210 }, - { new Color(224, 239, 26), tile1211 }, - { new Color(215, 46, 39), tile1212 }, - { new Color(206, 4, 11), tile1213 }, - { new Color(140, 173, 98), tile1214 }, - { new Color(184, 21, 255), tile1215 }, - { new Color(145, 20, 9), tile1216 }, - { new Color(132, 75, 106), tile1217 }, - { new Color(247, 18, 209), tile1218 }, - { new Color(22, 189, 125), tile1219 }, - { new Color(138, 57, 34), tile1220 }, - { new Color(218, 98, 51), tile1221 }, - { new Color(107, 175, 169), tile1222 }, - { new Color(238, 27, 62), tile1223 }, - { new Color(237, 134, 45), tile1224 }, - { new Color(145, 195, 180), tile1225 }, - { new Color(71, 53, 127), tile1226 }, - { new Color(225, 248, 145), tile1227 }, - { new Color(95, 110, 63), tile1228 }, - { new Color(230, 232, 221), tile1229 }, - { new Color(72, 192, 113), tile1230 }, - { new Color(170, 67, 203), tile1231 }, - { new Color(232, 178, 75), tile1232 }, - { new Color(47, 76, 102), tile1233 }, - { new Color(86, 162, 248), tile1234 }, - { new Color(202, 150, 197), tile1235 }, - { new Color(60, 102, 79), tile1236 }, - { new Color(29, 207, 135), tile1237 }, - { new Color(253, 169, 64), tile1238 }, - { new Color(144, 122, 244), tile1239 }, - { new Color(244, 132, 198), tile1240 }, - { new Color(203, 165, 91), tile1241 }, - { new Color(205, 66, 66), tile1242 }, - { new Color(98, 169, 16), tile1243 }, - { new Color(105, 23, 232), tile1244 }, - { new Color(25, 138, 85), tile1245 }, - { new Color(153, 149, 215), tile1246 }, - { new Color(121, 170, 130), tile1247 }, - { new Color(142, 42, 241), tile1248 }, - { new Color(233, 173, 154), tile1249 }, - { new Color(139, 87, 56), tile1250 }, - { new Color(86, 59, 199), tile1251 }, - { new Color(160, 138, 253), tile1252 }, - { new Color(157, 253, 83), tile1253 }, - { new Color(131, 218, 189), tile1254 }, - { new Color(62, 180, 183), tile1255 }, - { new Color(159, 228, 30), tile1256 }, - { new Color(234, 247, 228), tile1257 }, - { new Color(29, 122, 218), tile1258 }, - { new Color(67, 61, 123), tile1259 }, - { new Color(105, 227, 149), tile1260 }, - { new Color(167, 214, 81), tile1261 }, - { new Color(216, 18, 220), tile1262 }, - { new Color(32, 120, 255), tile1263 }, - { new Color(88, 251, 151), tile1264 }, - { new Color(131, 246, 207), tile1265 }, - { new Color(197, 79, 117), tile1266 }, - { new Color(57, 74, 200), tile1267 }, - { new Color(123, 160, 96), tile1268 }, - { new Color(83, 57, 193), tile1269 }, - { new Color(237, 92, 76), tile1270 }, - { new Color(129, 51, 25), tile1271 }, - { new Color(189, 219, 3), tile1272 }, - { new Color(108, 101, 161), tile1273 }, - { new Color(219, 126, 107), tile1274 }, - { new Color(31, 146, 251), tile1275 }, - { new Color(76, 153, 131), tile1276 }, - { new Color(10, 126, 238), tile1277 }, - { new Color(5, 47, 153), tile1278 }, - { new Color(204, 43, 54), tile1279 }, - { new Color(240, 133, 217), tile1280 }, - { new Color(27, 51, 28), tile1281 }, - { new Color(178, 214, 200), tile1282 }, - { new Color(126, 197, 26), tile1283 }, - { new Color(204, 89, 233), tile1284 }, - { new Color(211, 94, 204), tile1285 }, - { new Color(93, 92, 14), tile1286 }, - { new Color(101, 6, 160), tile1287 }, - { new Color(61, 226, 222), tile1288 }, - { new Color(94, 123, 3), tile1289 }, - { new Color(128, 241, 175), tile1290 }, - { new Color(205, 123, 224), tile1291 }, - { new Color(200, 191, 75), tile1292 }, - { new Color(78, 108, 187), tile1293 }, - { new Color(50, 206, 211), tile1294 }, - { new Color(105, 62, 36), tile1295 }, - { new Color(4, 49, 209), tile1296 }, - { new Color(204, 111, 207), tile1297 }, - { new Color(39, 139, 126), tile1298 }, - { new Color(56, 221, 80), tile1299 }, - { new Color(62, 84, 91), tile1300 }, - { new Color(197, 253, 212), tile1301 }, - { new Color(107, 254, 221), tile1302 }, - { new Color(8, 11, 158), tile1303 }, - { new Color(129, 14, 240), tile1304 }, - { new Color(83, 50, 55), tile1305 }, - { new Color(205, 211, 163), tile1306 }, - { new Color(185, 90, 74), tile1307 }, - { new Color(50, 179, 129), tile1308 }, - { new Color(224, 165, 240), tile1309 }, - { new Color(98, 143, 226), tile1310 }, - { new Color(250, 16, 24), tile1311 }, - { new Color(96, 109, 208), tile1312 }, - { new Color(254, 254, 64), tile1313 }, - { new Color(70, 251, 38), tile1314 }, - { new Color(50, 75, 96), tile1315 }, - { new Color(222, 212, 88), tile1316 }, - { new Color(70, 107, 9), tile1317 }, - { new Color(172, 132, 249), tile1318 }, - { new Color(16, 146, 74), tile1319 }, - { new Color(83, 138, 88), tile1320 }, - { new Color(237, 166, 123), tile1321 }, - { new Color(188, 134, 254), tile1322 }, - { new Color(216, 242, 196), tile1323 }, - { new Color(103, 206, 213), tile1324 }, - { new Color(99, 114, 94), tile1325 }, - { new Color(35, 0, 103), tile1326 }, - { new Color(33, 1, 208), tile1327 }, - { new Color(152, 27, 36), tile1328 }, - { new Color(216, 77, 139), tile1329 }, - { new Color(30, 79, 219), tile1330 }, - { new Color(134, 171, 115), tile1331 }, - { new Color(231, 89, 84), tile1332 }, - { new Color(171, 117, 197), tile1333 }, - { new Color(98, 6, 225), tile1334 }, - { new Color(148, 223, 157), tile1335 }, - { new Color(52, 73, 17), tile1336 }, - { new Color(155, 237, 146), tile1337 }, - { new Color(226, 49, 136), tile1338 }, - { new Color(135, 85, 139), tile1339 }, - { new Color(87, 228, 57), tile1340 }, - { new Color(115, 186, 163), tile1341 }, - { new Color(233, 224, 35), tile1342 }, - { new Color(98, 123, 25), tile1343 }, - { new Color(10, 120, 138), tile1344 }, - { new Color(162, 191, 251), tile1345 }, - { new Color(239, 3, 59), tile1346 }, - { new Color(135, 164, 4), tile1347 }, - { new Color(121, 130, 98), tile1348 }, - { new Color(72, 163, 121), tile1349 }, - { new Color(234, 95, 4), tile1350 }, - { new Color(201, 84, 144), tile1351 }, - { new Color(140, 238, 76), tile1352 }, - { new Color(62, 170, 254), tile1353 }, - { new Color(121, 209, 205), tile1354 }, - { new Color(248, 145, 117), tile1355 }, - { new Color(7, 63, 114), tile1356 }, - { new Color(141, 152, 81), tile1357 }, - { new Color(79, 208, 64), tile1358 }, - { new Color(53, 249, 55), tile1359 }, - { new Color(65, 160, 60), tile1360 }, - { new Color(170, 119, 27), tile1361 }, - { new Color(20, 64, 35), tile1362 }, - { new Color(250, 22, 208), tile1363 }, - { new Color(175, 176, 89), tile1364 }, - { new Color(60, 13, 210), tile1365 }, - { new Color(54, 128, 241), tile1366 }, - { new Color(237, 65, 100), tile1367 }, - { new Color(6, 93, 199), tile1368 }, - { new Color(179, 122, 132), tile1369 }, - { new Color(79, 87, 245), tile1370 }, - { new Color(20, 253, 10), tile1371 }, - { new Color(194, 207, 90), tile1372 }, - { new Color(177, 227, 80), tile1373 }, - { new Color(81, 13, 41), tile1374 }, - { new Color(162, 222, 232), tile1375 }, - { new Color(248, 18, 194), tile1376 }, - { new Color(110, 254, 120), tile1377 }, - { new Color(69, 84, 95), tile1378 }, - { new Color(216, 163, 25), tile1379 }, - { new Color(84, 97, 198), tile1380 }, - { new Color(159, 170, 191), tile1381 }, - { new Color(219, 154, 179), tile1382 }, - { new Color(78, 122, 62), tile1383 }, - { new Color(119, 132, 157), tile1384 }, - { new Color(161, 155, 52), tile1385 }, - { new Color(58, 100, 127), tile1386 }, - { new Color(223, 187, 103), tile1387 }, - { new Color(193, 225, 88), tile1388 }, - { new Color(124, 207, 169), tile1389 }, - { new Color(170, 233, 43), tile1390 }, - { new Color(64, 93, 130), tile1391 }, - { new Color(138, 177, 98), tile1392 }, - { new Color(105, 199, 67), tile1393 }, - { new Color(52, 169, 151), tile1394 }, - { new Color(132, 246, 122), tile1395 }, - { new Color(219, 164, 184), tile1396 }, - { new Color(43, 157, 63), tile1397 }, - { new Color(154, 117, 166), tile1398 }, - { new Color(94, 221, 200), tile1399 }, - { new Color(103, 95, 202), tile1400 }, - { new Color(9, 163, 144), tile1401 }, - { new Color(18, 54, 39), tile1402 }, - { new Color(26, 22, 233), tile1403 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.png b/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.png deleted file mode 100644 index 4b98d727ff..0000000000 Binary files a/Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic.png and /dev/null differ diff --git a/Schematics/AutoGeneratedContent/WorkshopSchematic.cs b/Schematics/AutoGeneratedContent/WorkshopSchematic.cs deleted file mode 100644 index 1d955e7a30..0000000000 --- a/Schematics/AutoGeneratedContent/WorkshopSchematic.cs +++ /dev/null @@ -1,733 +0,0 @@ -using CalamityMod.Tiles; -using CalamityMod.Tiles.DraedonStructures; -using CalamityMod.Walls.DraedonStructures; -using Microsoft.Xna.Framework; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Schematics.AutoGeneratedContent -{ - public class WorkshopSchematic - { - [GeneratedCode("ScreenCaptureToSchematic", "1.0.2")] - public static ColorTileMap GetMap() - { - var tile1 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0); - var tile2 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(0, 54); - var tile3 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 0); - var tile4 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile5 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(90, 18); - var tile6 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 18); - var tile7 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(0, 36); - var tile8 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 16416).UseFrame(72, 72); - var tile9 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 54); - var tile10 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 72); - var tile11 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 3, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile12 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile13 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile14 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 149, 2, 2144).UseFrame(162, 18).UseWall((ushort)ModContent.WallType(), 180, 72).MakeActuated(); - var tile15 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 2, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile16 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile17 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile18 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 8224).UseFrame(36, 54); - var tile19 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 0); - var tile20 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 3, 12320).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile21 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 2, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile22 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile23 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile24 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 2144).UseFrame(108, 72).MakeActuated(); - var tile25 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile26 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile27 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile28 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(162, 0); - var tile29 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 0); - var tile30 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 36); - var tile31 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 3, 0).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile32 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile33 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 3, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 144, 108).MakeActuated(); - var tile34 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile35 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile36 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile37 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 72); - var tile38 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile39 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 36); - var tile40 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 540); - var tile41 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile42 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 4, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 216, 144).MakeActuated(); - var tile43 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile44 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile45 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 36); - var tile46 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 3, 12320).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile47 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile48 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 2, 2144).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 36, 72).MakeActuated(); - var tile49 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile50 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile51 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile52 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 72); - var tile53 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 0); - var tile54 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 17, 0, 2144).UseFrame(126, 0).UseWall((ushort)ModContent.WallType(), 36, 0).MakeActuated(); - var tile55 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 91, 1, 2144).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 396, 36).MakeActuated(); - var tile56 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile57 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 2144).UseFrame(90, 36).UseWall((ushort)ModContent.WallType(), 72, 72).MakeActuated(); - var tile58 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 2144).UseFrame(90, 36).MakeActuated(); - var tile59 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 140, 2, 2144).UseFrame(18, 72).UseWall((ushort)ModContent.WallType(), 432, 72).MakeActuated(); - var tile60 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile61 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile62 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile63 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile64 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile65 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile66 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile67 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(234, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile68 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 36); - var tile69 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile70 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 0, 0, 32).UseFrame(0, 216); - var tile71 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 0, 0, 32).UseFrame(0, 234); - var tile72 = new TileDefinitionStructure(TileID.Lamps).UseHeaders(0, 0, 0, 32).UseFrame(0, 252); - var tile73 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile74 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(0, 18); - var tile75 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 16416).UseFrame(36, 72); - var tile76 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 54); - var tile77 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile78 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 2, 0).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile79 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(144, 0); - var tile80 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 12, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 432, 0); - var tile81 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); - var tile82 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 72); - var tile83 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 16416).UseFrame(0, 72); - var tile84 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 72); - var tile85 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 18); - var tile86 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 18); - var tile87 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 36); - var tile88 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 54); - var tile89 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile90 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile91 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 36); - var tile92 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 54); - var tile93 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(270, 54); - var tile94 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile95 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile96 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile97 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile98 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 8224).UseFrame(144, 0); - var tile99 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 73, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 324, 36); - var tile100 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 4128).UseFrame(54, 54); - var tile101 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(288, 54); - var tile102 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 54); - var tile103 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile104 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); - var tile105 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile106 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile107 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile108 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile109 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile110 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 54); - var tile111 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 76, 1, 0).UseWall((ushort)ModContent.WallType(), 432, 36); - var tile112 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile113 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile114 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 4128).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile115 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile116 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 4, 32).UseFrame(72, 36).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile117 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(72, 0); - var tile118 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 3, 12320).UseFrame(54, 72).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile119 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile120 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile121 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile122 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile123 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile124 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile125 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(162, 36).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile126 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile127 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 64, 1, 0).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile128 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile129 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile130 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile131 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 144, 2, 12320).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile132 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 2, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile133 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(16, 0); - var tile134 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile135 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile136 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 2, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 252, 72); - var tile137 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile138 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile139 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 0, 0).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile140 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile141 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 1, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile142 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile143 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile144 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile145 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile146 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile147 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile148 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile149 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 72); - var tile150 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile151 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 4, 0, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile152 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile153 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile154 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 5, 0, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile155 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseFrame(32, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile156 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile157 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile158 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile159 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile160 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile161 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 2, 0).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile162 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 10, 0, 0).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile163 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile164 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 5, 0, 32).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile165 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 2, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile166 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 67, 3, 0).UseWall((ushort)ModContent.WallType(), 108, 108); - var tile167 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 3, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 288, 108); - var tile168 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 0, 0, 32).UseFrame(0, 558); - var tile169 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(48, 0); - var tile170 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile171 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile172 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile173 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile174 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 140, 2, 0).UseWall((ushort)ModContent.WallType(), 432, 72); - var tile175 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 0, 0).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile176 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile177 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile178 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 71, 4, 0).UseWall((ushort)ModContent.WallType(), 252, 144); - var tile179 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0); - var tile180 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 0, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile181 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile182 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(306, 54); - var tile183 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 1, 0).UseWall((ushort)ModContent.WallType(), 216, 36); - var tile184 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 4, 0).UseWall((ushort)ModContent.WallType(), 216, 144); - var tile185 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile186 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 36); - var tile187 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 138, 2, 32).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile188 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile189 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile190 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile191 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile192 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile193 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile194 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile195 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile196 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile197 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 0, 32).UseWall((ushort)ModContent.WallType(), 252, 0); - var tile198 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 132, 4, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 144); - var tile199 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile200 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile201 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile202 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile203 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile204 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 137, 2, 0).UseWall((ushort)ModContent.WallType(), 324, 72); - var tile205 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile206 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile207 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile208 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile209 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 4, 0).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile210 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 18).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile211 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 32).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile212 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 132, 3, 0).UseWall((ushort)ModContent.WallType(), 144, 108); - var tile213 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile214 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 6, 0, 0).UseWall((ushort)ModContent.WallType(), 216, 0); - var tile215 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 5, 0, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile216 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 69, 1, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile217 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(36, 18).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile218 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile219 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 74, 1, 0).UseWall((ushort)ModContent.WallType(), 360, 36); - var tile220 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 0, 0).UseWall((ushort)ModContent.WallType(), 288, 0); - var tile221 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 138, 2, 0).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile222 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile223 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 1, 2144).UseFrame(36, 54).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile224 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 2144).UseFrame(90, 0).UseWall((ushort)ModContent.WallType(), 72, 72).MakeActuated(); - var tile225 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 2144).UseFrame(90, 18).MakeActuated(); - var tile226 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 0, 2144).UseFrame(126, 54).UseWall((ushort)ModContent.WallType(), 108, 0).MakeActuated(); - var tile227 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(18, 54).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile228 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(288, 54); - var tile229 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 1, 1, 0).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile230 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile231 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(162, 36); - var tile232 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 131, 0, 32).UseFrame(0, 540).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile233 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 66, 1, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile234 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 2144).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 36).MakeActuated(); - var tile235 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile236 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 32).UseFrame(0, 16).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile237 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 32).UseWall((ushort)ModContent.WallType(), 0, 0); - var tile238 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 6, 2, 32).UseFrame(0, 48).UseWall((ushort)ModContent.WallType(), 216, 72); - var tile239 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(162, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile240 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 0, 0).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile241 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 11, 0, 0).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile242 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 1, 0).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile243 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 136, 1, 0).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile244 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 139, 2, 0).UseWall((ushort)ModContent.WallType(), 396, 72); - var tile245 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 32).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile246 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 128, 2, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile247 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 5, 0, 0).UseWall((ushort)ModContent.WallType(), 180, 0); - var tile248 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 69, 1, 0).UseWall((ushort)ModContent.WallType(), 180, 36); - var tile249 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 2, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile250 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 68, 1, 0).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile251 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 71, 1, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 252, 36); - var tile252 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 80, 1, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile253 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 396, 0).MakeActuated(); - var tile254 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 2, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile255 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 2, 32).UseFrame(16, 0).UseWall((ushort)ModContent.WallType(), 180, 72); - var tile256 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(16, 16).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile257 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 11, 0, 32).UseFrame(16, 32).UseWall((ushort)ModContent.WallType(), 396, 0); - var tile258 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(16, 48).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile259 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile260 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 4, 0).UseWall((ushort)ModContent.WallType(), 180, 144); - var tile261 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(234, 0); - var tile262 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 1, 32).UseFrame(90, 54).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile263 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 16416).UseFrame(144, 54).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile264 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 2144).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile265 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(32, 0); - var tile266 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(32, 16).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile267 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 32).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile268 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 1, 32).UseFrame(32, 48).UseWall((ushort)ModContent.WallType(), 72, 36); - var tile269 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile270 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 3, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 72, 108); - var tile271 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 4, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile272 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 32).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile273 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 36, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile274 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile275 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile276 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 163, 1, 2144).UseFrame(216, 36).UseWall((ushort)ModContent.WallType(), 108, 36).MakeActuated(); - var tile277 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 128, 2, 32).UseFrame(48, 0).UseWall((ushort)ModContent.WallType(), 0, 72); - var tile278 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 16).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile279 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 1, 32).UseFrame(48, 32).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile280 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 2, 32).UseFrame(48, 48).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile281 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile282 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile283 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile284 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 66, 2, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile285 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 8224).UseFrame(72, 54); - var tile286 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 54); - var tile287 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile288 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(252, 72); - var tile289 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 32).UseFrame(270, 54).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile290 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 148, 2, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile291 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 100, 1, 16416).UseFrame(72, 72).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile292 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 164, 2, 8224).UseFrame(72, 54).UseWall((ushort)ModContent.WallType(), 144, 72); - var tile293 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 83, 4, 32).UseFrame(0, 18).UseWall((ushort)ModContent.WallType(), 108, 144); - var tile294 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 4128).UseFrame(180, 0).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile295 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 4, 8224).UseFrame(144, 0).UseWall((ushort)ModContent.WallType(), 72, 144); - var tile296 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 72); - var tile297 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); - var tile298 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 4128).UseFrame(90, 54); - var tile299 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(126, 36); - var tile300 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(144, 54); - var tile301 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(252, 54); - var tile302 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(108, 0); - var tile303 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(90, 0); - var tile304 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 82, 0, 32).UseFrame(90, 18).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile305 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 147, 2, 32).UseFrame(36, 72).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile306 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile307 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(288, 36); - var tile308 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); - var tile309 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(72, 18); - var tile310 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 12320).UseFrame(18, 72); - var tile311 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 54); - var tile312 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 0, 3, 0).UseWall((ushort)ModContent.WallType(), 0, 108); - var tile313 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 98, 2, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile314 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32); - var tile315 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(0, 18); - var tile316 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 0, 32).UseFrame(0, 36).UseWall((ushort)ModContent.WallType(), 108, 0); - var tile317 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile318 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(54, 0); - var tile319 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(306, 36); - var tile320 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 133, 3, 16416).UseFrame(0, 72).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile321 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 154, 2, 32).UseFrame(126, 72).UseWall((ushort)ModContent.WallType(), 360, 72); - var tile322 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 4, 32).UseFrame(18, 0).UseWall((ushort)ModContent.WallType(), 0, 144); - var tile323 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 18); - var tile324 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 0, 32).UseFrame(18, 36).UseWall((ushort)ModContent.WallType(), 72, 0); - var tile325 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 2, 32).UseWall((ushort)ModContent.WallType(), 108, 72); - var tile326 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(18, 0); - var tile327 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(54, 0); - var tile328 = new TileDefinitionStructure(TileID.HangingLanterns).UseHeaders(0, 136, 2, 32).UseFrame(0, 558).UseWall((ushort)ModContent.WallType(), 288, 72); - var tile329 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 33, 1, 32).UseFrame(144, 72).UseWall((ushort)ModContent.WallType(), 36, 36); - var tile330 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseFrame(36, 0).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile331 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(36, 18); - var tile332 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 0, 32).UseFrame(36, 36).UseWall((ushort)ModContent.WallType(), 36, 0); - var tile333 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 2, 32).UseWall((ushort)ModContent.WallType(), 36, 72); - var tile334 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 136, 1, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 288, 36); - var tile335 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 75, 1, 0).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile336 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 131, 1, 32).UseFrame(54, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile337 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 64, 1, 32).UseFrame(54, 18).UseWall((ushort)ModContent.WallType(), 0, 36); - var tile338 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 75, 1, 32).UseFrame(54, 36).UseWall((ushort)ModContent.WallType(), 396, 36); - var tile339 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 0); - var tile340 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 3, 16416).UseFrame(108, 54).UseWall((ushort)ModContent.WallType(), 36, 108); - var tile341 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 10, 0, 32).UseFrame(108, 72).UseWall((ushort)ModContent.WallType(), 360, 0); - var tile342 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile343 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 131, 1, 0).UseWall((ushort)ModContent.WallType(), 108, 36); - var tile344 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 66, 2, 32).UseFrame(72, 0).UseWall((ushort)ModContent.WallType(), 72, 72); - var tile345 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(216, 18); - var tile346 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 16, 0, 32).UseFrame(36, 72); - var tile347 = new TileDefinitionStructure(TileID.Dirt, false).UseHeaders(0, 133, 3, 0).UseWall((ushort)ModContent.WallType(), 180, 108); - var tile348 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 4, 0, 32).UseFrame(216, 0).UseWall((ushort)ModContent.WallType(), 144, 0); - var tile349 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 68, 1, 8224).UseFrame(0, 54).UseWall((ushort)ModContent.WallType(), 144, 36); - var tile350 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 1, 4, 32).UseWall((ushort)ModContent.WallType(), 36, 144); - var tile351 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(72, 72); - var tile352 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 0); - var tile353 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 32).UseFrame(90, 36); - var tile354 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 0, 0, 32).UseFrame(306, 18); - var tile355 = new TileDefinitionStructure(ModContent.TileType()).UseHeaders(0, 32, 0, 12320).UseFrame(90, 72); - Dictionary colorTileMap = new Dictionary() - { - { new Color(0, 0, 0), tile1 }, - { new Color(157, 140, 172), tile2 }, - { new Color(50, 95, 63), tile3 }, - { new Color(140, 9, 160), tile4 }, - { new Color(8, 152, 177), tile5 }, - { new Color(102, 12, 199), tile6 }, - { new Color(218, 61, 146), tile7 }, - { new Color(64, 185, 3), tile8 }, - { new Color(219, 54, 168), tile9 }, - { new Color(24, 155, 241), tile10 }, - { new Color(42, 209, 210), tile11 }, - { new Color(176, 205, 249), tile12 }, - { new Color(224, 96, 74), tile13 }, - { new Color(79, 209, 38), tile14 }, - { new Color(168, 164, 143), tile15 }, - { new Color(126, 250, 89), tile16 }, - { new Color(138, 139, 47), tile17 }, - { new Color(203, 79, 21), tile18 }, - { new Color(143, 241, 164), tile19 }, - { new Color(211, 193, 86), tile20 }, - { new Color(4, 26, 195), tile21 }, - { new Color(77, 97, 55), tile22 }, - { new Color(206, 88, 203), tile23 }, - { new Color(184, 133, 171), tile24 }, - { new Color(124, 138, 108), tile25 }, - { new Color(107, 152, 21), tile26 }, - { new Color(116, 92, 59), tile27 }, - { new Color(79, 142, 15), tile28 }, - { new Color(194, 95, 130), tile29 }, - { new Color(189, 33, 219), tile30 }, - { new Color(85, 13, 158), tile31 }, - { new Color(244, 75, 182), tile32 }, - { new Color(98, 90, 66), tile33 }, - { new Color(87, 176, 162), tile34 }, - { new Color(141, 209, 6), tile35 }, - { new Color(132, 78, 196), tile36 }, - { new Color(168, 35, 89), tile37 }, - { new Color(143, 94, 101), tile38 }, - { new Color(26, 180, 140), tile39 }, - { new Color(179, 139, 2), tile40 }, - { new Color(181, 17, 54), tile41 }, - { new Color(239, 99, 119), tile42 }, - { new Color(12, 135, 63), tile43 }, - { new Color(182, 9, 61), tile44 }, - { new Color(210, 28, 172), tile45 }, - { new Color(152, 193, 188), tile46 }, - { new Color(9, 62, 16), tile47 }, - { new Color(189, 20, 253), tile48 }, - { new Color(130, 198, 174), tile49 }, - { new Color(57, 218, 151), tile50 }, - { new Color(41, 174, 207), tile51 }, - { new Color(64, 162, 158), tile52 }, - { new Color(108, 157, 110), tile53 }, - { new Color(142, 119, 199), tile54 }, - { new Color(133, 242, 26), tile55 }, - { new Color(27, 188, 66), tile56 }, - { new Color(184, 129, 242), tile57 }, - { new Color(208, 170, 77), tile58 }, - { new Color(242, 247, 253), tile59 }, - { new Color(56, 109, 157), tile60 }, - { new Color(200, 210, 173), tile61 }, - { new Color(167, 140, 90), tile62 }, - { new Color(109, 146, 122), tile63 }, - { new Color(14, 44, 35), tile64 }, - { new Color(77, 123, 198), tile65 }, - { new Color(73, 56, 34), tile66 }, - { new Color(227, 102, 9), tile67 }, - { new Color(108, 129, 88), tile68 }, - { new Color(164, 89, 4), tile69 }, - { new Color(130, 78, 170), tile70 }, - { new Color(161, 51, 48), tile71 }, - { new Color(209, 197, 165), tile72 }, - { new Color(25, 221, 102), tile73 }, - { new Color(191, 173, 42), tile74 }, - { new Color(200, 170, 84), tile75 }, - { new Color(206, 130, 46), tile76 }, - { new Color(134, 168, 191), tile77 }, - { new Color(218, 85, 6), tile78 }, - { new Color(147, 92, 81), tile79 }, - { new Color(84, 3, 50), tile80 }, - { new Color(86, 235, 68), tile81 }, - { new Color(207, 108, 249), tile82 }, - { new Color(243, 124, 181), tile83 }, - { new Color(33, 47, 90), tile84 }, - { new Color(188, 36, 184), tile85 }, - { new Color(222, 164, 215), tile86 }, - { new Color(4, 213, 215), tile87 }, - { new Color(213, 251, 165), tile88 }, - { new Color(235, 198, 221), tile89 }, - { new Color(41, 61, 104), tile90 }, - { new Color(83, 196, 218), tile91 }, - { new Color(51, 105, 194), tile92 }, - { new Color(230, 248, 61), tile93 }, - { new Color(90, 219, 5), tile94 }, - { new Color(120, 101, 120), tile95 }, - { new Color(100, 30, 49), tile96 }, - { new Color(78, 180, 184), tile97 }, - { new Color(122, 80, 45), tile98 }, - { new Color(91, 128, 240), tile99 }, - { new Color(158, 228, 166), tile100 }, - { new Color(27, 201, 63), tile101 }, - { new Color(77, 205, 107), tile102 }, - { new Color(128, 136, 186), tile103 }, - { new Color(246, 248, 171), tile104 }, - { new Color(153, 169, 250), tile105 }, - { new Color(209, 93, 149), tile106 }, - { new Color(44, 135, 167), tile107 }, - { new Color(172, 219, 136), tile108 }, - { new Color(176, 217, 115), tile109 }, - { new Color(172, 216, 233), tile110 }, - { new Color(209, 71, 20), tile111 }, - { new Color(151, 63, 17), tile112 }, - { new Color(198, 43, 152), tile113 }, - { new Color(13, 228, 150), tile114 }, - { new Color(118, 88, 188), tile115 }, - { new Color(12, 224, 167), tile116 }, - { new Color(51, 137, 34), tile117 }, - { new Color(90, 113, 93), tile118 }, - { new Color(254, 111, 238), tile119 }, - { new Color(182, 156, 243), tile120 }, - { new Color(248, 211, 176), tile121 }, - { new Color(209, 36, 176), tile122 }, - { new Color(151, 2, 105), tile123 }, - { new Color(232, 11, 49), tile124 }, - { new Color(253, 31, 162), tile125 }, - { new Color(17, 54, 131), tile126 }, - { new Color(204, 164, 248), tile127 }, - { new Color(203, 121, 78), tile128 }, - { new Color(198, 119, 213), tile129 }, - { new Color(183, 152, 208), tile130 }, - { new Color(35, 15, 143), tile131 }, - { new Color(164, 21, 16), tile132 }, - { new Color(229, 165, 51), tile133 }, - { new Color(11, 116, 222), tile134 }, - { new Color(61, 74, 125), tile135 }, - { new Color(241, 93, 82), tile136 }, - { new Color(186, 237, 56), tile137 }, - { new Color(106, 234, 248), tile138 }, - { new Color(250, 44, 90), tile139 }, - { new Color(97, 10, 173), tile140 }, - { new Color(218, 224, 105), tile141 }, - { new Color(153, 196, 251), tile142 }, - { new Color(162, 88, 10), tile143 }, - { new Color(146, 43, 144), tile144 }, - { new Color(79, 192, 47), tile145 }, - { new Color(26, 141, 46), tile146 }, - { new Color(208, 213, 25), tile147 }, - { new Color(131, 252, 171), tile148 }, - { new Color(151, 184, 37), tile149 }, - { new Color(150, 169, 232), tile150 }, - { new Color(182, 131, 154), tile151 }, - { new Color(134, 49, 147), tile152 }, - { new Color(116, 164, 133), tile153 }, - { new Color(130, 78, 4), tile154 }, - { new Color(72, 39, 193), tile155 }, - { new Color(168, 27, 42), tile156 }, - { new Color(201, 224, 158), tile157 }, - { new Color(43, 144, 53), tile158 }, - { new Color(147, 87, 227), tile159 }, - { new Color(189, 2, 11), tile160 }, - { new Color(214, 11, 174), tile161 }, - { new Color(33, 220, 167), tile162 }, - { new Color(245, 201, 143), tile163 }, - { new Color(155, 165, 233), tile164 }, - { new Color(169, 78, 134), tile165 }, - { new Color(21, 59, 213), tile166 }, - { new Color(233, 238, 157), tile167 }, - { new Color(251, 205, 201), tile168 }, - { new Color(74, 139, 243), tile169 }, - { new Color(101, 243, 217), tile170 }, - { new Color(175, 182, 161), tile171 }, - { new Color(121, 172, 66), tile172 }, - { new Color(85, 38, 75), tile173 }, - { new Color(25, 178, 81), tile174 }, - { new Color(155, 45, 58), tile175 }, - { new Color(180, 130, 66), tile176 }, - { new Color(175, 125, 28), tile177 }, - { new Color(14, 212, 19), tile178 }, - { new Color(110, 219, 62), tile179 }, - { new Color(229, 215, 80), tile180 }, - { new Color(180, 144, 214), tile181 }, - { new Color(181, 235, 239), tile182 }, - { new Color(72, 47, 162), tile183 }, - { new Color(67, 192, 20), tile184 }, - { new Color(137, 207, 59), tile185 }, - { new Color(76, 95, 159), tile186 }, - { new Color(143, 150, 9), tile187 }, - { new Color(176, 181, 117), tile188 }, - { new Color(189, 161, 226), tile189 }, - { new Color(141, 11, 208), tile190 }, - { new Color(4, 112, 79), tile191 }, - { new Color(250, 101, 34), tile192 }, - { new Color(123, 229, 65), tile193 }, - { new Color(75, 107, 82), tile194 }, - { new Color(159, 108, 189), tile195 }, - { new Color(7, 133, 4), tile196 }, - { new Color(216, 34, 123), tile197 }, - { new Color(158, 85, 64), tile198 }, - { new Color(71, 3, 218), tile199 }, - { new Color(96, 247, 74), tile200 }, - { new Color(12, 186, 35), tile201 }, - { new Color(209, 62, 79), tile202 }, - { new Color(197, 142, 106), tile203 }, - { new Color(25, 208, 122), tile204 }, - { new Color(94, 68, 42), tile205 }, - { new Color(182, 17, 73), tile206 }, - { new Color(183, 182, 27), tile207 }, - { new Color(222, 181, 233), tile208 }, - { new Color(85, 101, 27), tile209 }, - { new Color(14, 179, 98), tile210 }, - { new Color(72, 26, 237), tile211 }, - { new Color(246, 62, 177), tile212 }, - { new Color(47, 205, 45), tile213 }, - { new Color(110, 66, 246), tile214 }, - { new Color(153, 190, 81), tile215 }, - { new Color(0, 64, 16), tile216 }, - { new Color(22, 145, 242), tile217 }, - { new Color(144, 169, 65), tile218 }, - { new Color(46, 45, 5), tile219 }, - { new Color(58, 124, 217), tile220 }, - { new Color(52, 182, 219), tile221 }, - { new Color(8, 209, 182), tile222 }, - { new Color(140, 103, 5), tile223 }, - { new Color(121, 135, 67), tile224 }, - { new Color(28, 73, 115), tile225 }, - { new Color(37, 69, 246), tile226 }, - { new Color(151, 84, 37), tile227 }, - { new Color(10, 248, 34), tile228 }, - { new Color(111, 183, 113), tile229 }, - { new Color(172, 200, 17), tile230 }, - { new Color(171, 245, 81), tile231 }, - { new Color(84, 57, 139), tile232 }, - { new Color(26, 145, 237), tile233 }, - { new Color(155, 116, 216), tile234 }, - { new Color(10, 157, 10), tile235 }, - { new Color(174, 116, 95), tile236 }, - { new Color(205, 9, 232), tile237 }, - { new Color(14, 162, 39), tile238 }, - { new Color(179, 41, 190), tile239 }, - { new Color(185, 152, 25), tile240 }, - { new Color(69, 224, 159), tile241 }, - { new Color(244, 205, 145), tile242 }, - { new Color(242, 199, 16), tile243 }, - { new Color(232, 10, 179), tile244 }, - { new Color(8, 252, 224), tile245 }, - { new Color(76, 255, 90), tile246 }, - { new Color(24, 193, 66), tile247 }, - { new Color(17, 222, 190), tile248 }, - { new Color(40, 156, 83), tile249 }, - { new Color(42, 160, 15), tile250 }, - { new Color(205, 97, 248), tile251 }, - { new Color(212, 86, 148), tile252 }, - { new Color(57, 21, 207), tile253 }, - { new Color(120, 188, 172), tile254 }, - { new Color(79, 229, 255), tile255 }, - { new Color(52, 5, 165), tile256 }, - { new Color(71, 102, 42), tile257 }, - { new Color(99, 160, 214), tile258 }, - { new Color(215, 51, 1), tile259 }, - { new Color(224, 204, 48), tile260 }, - { new Color(62, 200, 38), tile261 }, - { new Color(0, 26, 168), tile262 }, - { new Color(187, 52, 166), tile263 }, - { new Color(75, 18, 234), tile264 }, - { new Color(139, 159, 5), tile265 }, - { new Color(149, 193, 248), tile266 }, - { new Color(191, 243, 150), tile267 }, - { new Color(174, 226, 57), tile268 }, - { new Color(229, 106, 192), tile269 }, - { new Color(34, 252, 34), tile270 }, - { new Color(147, 89, 73), tile271 }, - { new Color(159, 58, 243), tile272 }, - { new Color(134, 79, 203), tile273 }, - { new Color(86, 121, 209), tile274 }, - { new Color(254, 251, 84), tile275 }, - { new Color(64, 216, 1), tile276 }, - { new Color(208, 65, 113), tile277 }, - { new Color(8, 32, 217), tile278 }, - { new Color(153, 144, 229), tile279 }, - { new Color(236, 26, 176), tile280 }, - { new Color(231, 152, 55), tile281 }, - { new Color(132, 184, 185), tile282 }, - { new Color(160, 236, 101), tile283 }, - { new Color(17, 15, 114), tile284 }, - { new Color(45, 105, 121), tile285 }, - { new Color(197, 175, 230), tile286 }, - { new Color(229, 165, 145), tile287 }, - { new Color(191, 81, 187), tile288 }, - { new Color(176, 138, 56), tile289 }, - { new Color(111, 5, 169), tile290 }, - { new Color(14, 153, 52), tile291 }, - { new Color(26, 110, 224), tile292 }, - { new Color(153, 122, 67), tile293 }, - { new Color(154, 159, 236), tile294 }, - { new Color(155, 191, 49), tile295 }, - { new Color(254, 219, 183), tile296 }, - { new Color(95, 211, 224), tile297 }, - { new Color(254, 7, 117), tile298 }, - { new Color(30, 39, 71), tile299 }, - { new Color(124, 211, 46), tile300 }, - { new Color(128, 48, 230), tile301 }, - { new Color(187, 3, 118), tile302 }, - { new Color(62, 19, 250), tile303 }, - { new Color(152, 44, 53), tile304 }, - { new Color(163, 74, 6), tile305 }, - { new Color(165, 36, 145), tile306 }, - { new Color(137, 178, 175), tile307 }, - { new Color(129, 16, 49), tile308 }, - { new Color(200, 15, 146), tile309 }, - { new Color(190, 251, 70), tile310 }, - { new Color(153, 28, 167), tile311 }, - { new Color(21, 26, 110), tile312 }, - { new Color(5, 223, 187), tile313 }, - { new Color(187, 192, 200), tile314 }, - { new Color(189, 198, 167), tile315 }, - { new Color(171, 91, 188), tile316 }, - { new Color(111, 121, 3), tile317 }, - { new Color(181, 242, 33), tile318 }, - { new Color(126, 255, 32), tile319 }, - { new Color(181, 243, 243), tile320 }, - { new Color(228, 127, 23), tile321 }, - { new Color(179, 255, 15), tile322 }, - { new Color(141, 141, 48), tile323 }, - { new Color(151, 160, 69), tile324 }, - { new Color(214, 206, 241), tile325 }, - { new Color(231, 195, 73), tile326 }, - { new Color(138, 29, 180), tile327 }, - { new Color(214, 79, 130), tile328 }, - { new Color(67, 227, 42), tile329 }, - { new Color(133, 150, 26), tile330 }, - { new Color(77, 80, 236), tile331 }, - { new Color(200, 215, 64), tile332 }, - { new Color(176, 9, 199), tile333 }, - { new Color(151, 29, 205), tile334 }, - { new Color(139, 215, 216), tile335 }, - { new Color(189, 223, 36), tile336 }, - { new Color(47, 151, 59), tile337 }, - { new Color(214, 42, 214), tile338 }, - { new Color(63, 13, 48), tile339 }, - { new Color(148, 111, 28), tile340 }, - { new Color(229, 8, 247), tile341 }, - { new Color(22, 74, 80), tile342 }, - { new Color(88, 13, 246), tile343 }, - { new Color(176, 54, 186), tile344 }, - { new Color(130, 242, 255), tile345 }, - { new Color(230, 74, 119), tile346 }, - { new Color(170, 133, 3), tile347 }, - { new Color(6, 86, 254), tile348 }, - { new Color(222, 118, 37), tile349 }, - { new Color(22, 136, 201), tile350 }, - { new Color(16, 28, 153), tile351 }, - { new Color(170, 178, 21), tile352 }, - { new Color(214, 116, 141), tile353 }, - { new Color(136, 101, 209), tile354 }, - { new Color(45, 126, 97), tile355 }, - }; - return new ColorTileMap(colorTileMap); - } - } -} diff --git a/Schematics/AutoGeneratedContent/WorkshopSchematic.png b/Schematics/AutoGeneratedContent/WorkshopSchematic.png deleted file mode 100644 index 8d6672cb24..0000000000 Binary files a/Schematics/AutoGeneratedContent/WorkshopSchematic.png and /dev/null differ diff --git a/Schematics/CalamitySchematicIO.cs b/Schematics/CalamitySchematicIO.cs new file mode 100644 index 0000000000..ee4b26f00f --- /dev/null +++ b/Schematics/CalamitySchematicIO.cs @@ -0,0 +1,566 @@ +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.IO; +using System.IO.Compression; +using System.Text; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Default; +using Terraria.ModLoader.IO; + +namespace CalamityMod.Schematics +{ + #region Structs + // A struct parallel to Tile which, for modded tiles, stores offset tile and wall type IDs based on the schematic's mod name arrays. + public struct SchematicMetaTile + { + public byte bTileHeader, bTileHeader2, bTileHeader3; + public ushort sTileHeader; + public ushort type; // If >= TileID.Count, is a modded tile type; consult mod tile name array + public ushort wall; // If >= WallID.Count, is a modded wall type; consule mod wall name array + internal readonly ushort originalType; + internal readonly ushort originalWall; + public byte liquid; + public short frameX, frameY; + public bool keepTile; + public bool keepWall; + + public SchematicMetaTile(Tile t) + { + bTileHeader = t.bTileHeader; + 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 + originalType = type; // This is never changed + originalWall = wall; // This is never changed + liquid = t.liquid; + frameX = t.frameX; + frameY = t.frameY; + keepTile = false; + keepWall = false; + } + + // This function is used by the schematic placer to respect the keepTile and keepWall booleans. + public void ApplyTo(ref Tile target, Tile original) + { + // This full-overwrite hypothetical tile is used to partially copy over various forms of data. + // A lot of tile data is nefariously binary encoded into the tile header bytes. + Tile replacement = new Tile + { + bTileHeader = bTileHeader, + bTileHeader2 = bTileHeader2, + bTileHeader3 = bTileHeader3, + sTileHeader = sTileHeader, + type = type, + frameX = frameX, + frameY = frameY, + wall = wall, + liquid = liquid + }; + + if (!keepTile && !keepWall) // full overwrite + target.CopyFrom(replacement); + else if (keepTile && keepWall) // full preservation + target.CopyFrom(original); + else if (keepWall) // wall from original, tile from replacement + { + target.CopyFrom(replacement); + target.wall = original.wall; + target.wallFrameX(original.wallFrameX()); + target.wallFrameY(original.wallFrameY()); + target.wallColor(original.wallColor()); + } + else if (keepTile) // tile from original, wall from replacement + { + target.CopyFrom(original); + target.wall = replacement.wall; + target.wallFrameX(replacement.wallFrameX()); + target.wallFrameY(replacement.wallFrameY()); + target.wallColor(replacement.wallColor()); + } + } + } + + // A container struct for a List of unique tile definitions and an array of indices to those tile definitions. + public struct SchematicData + { + // Schematics assume 1024 or less unique tile definitions for their internal buffer. + // In real schematics, this number usually doesn't go above about 800. + // The buffer can be expanded up to 65536, as the indices used for it are 2 bytes. + // Note this would by definition require a schematic of size at least 256x256, so you should never really get to this point. + private const int DefaultUniqueTileCount = 1024; + public const int MaxUniqueTileCount = ushort.MaxValue + 1; + private const int DefaultModTileCount = 256; + private const int DefaultModWallCount = 32; + + public readonly IList uniqueTiles; + public readonly IList modTileNames; + public readonly IList modWallNames; + public readonly ushort[,] areaIndices; + + public SchematicData(int width, int height) + { + // Schematics by default have one "unique tile", which is air -- equivalent to new Tile(). + // This tile is always provided in schematics, even if it isn't used (e.g. your schematic is a solid block of stone). + // This allows for index zero to always refer to a fully blank tile. + uniqueTiles = new List(DefaultUniqueTileCount) + { + new SchematicMetaTile() + }; + modTileNames = new List(DefaultModTileCount); + modWallNames = new List(DefaultModWallCount); + areaIndices = new ushort[width, height]; + } + } + + public enum ExportResult + { + Success, + CornerOutOfWorld, + ZeroArea, + TooManyUniqueTiles, + }; + #endregion + + public static class CalamitySchematicIO + { + // A generous buffer of 1 megabyte is the default for schematics. If this somehow isn't big enough, they can get bigger. + private const int SchematicBufferStartingSize = 1048576; + + // If true, written schematics will have all data GZip compressed except for the magic number header. + public static bool UseCompression = true; + + // This is a 3-byte magic number header for Calamity Schematic Files. CA1A5C = "CalaSC" + private static readonly byte[] SchematicMagicNumberHeader = new byte[] + { + 0xCA, + 0x1A, + 0x5C + }; + private const byte UncompressedMagicNumber = 0x00; + private const byte CompressedMagicNumber = 0xC0; + private const string PreserveTileName = "_"; + + // These two fields are set to a non-zero value when the CalamitySchematicExporter mod loads. + public static ushort PreserveTileID = 0; + public static ushort PreserveWallID = 0; + + #region Export Helper Methods + private static Tile[,] GetTilesInRectangle(Rectangle area) + { + Tile[,] tiles = new Tile[area.Width, area.Height]; + for (int i = area.Left; i < area.Right; i++) + for (int j = area.Top; j < area.Bottom; j++) + { + Tile t = Main.tile[i, j]; + if (t is null) // Vanilla does this itself all the time. I wish it weren't necessary. + t = new Tile(); + tiles[i - area.Left, j - area.Top] = t; + } + return tiles; + } + + // This equality is slightly more strict than Tile.isTheSameAs because it checks type, wall and frame on non-active tiles. + public static bool EqualToMetaTile(this Tile t, SchematicMetaTile smt) + { + bool tileHeadersMatch = (t.bTileHeader == smt.bTileHeader) & (t.bTileHeader2 == smt.bTileHeader2) & (t.bTileHeader3 == smt.bTileHeader3) & (t.sTileHeader == smt.sTileHeader); + if (!tileHeadersMatch) + return false; + + bool typesMatch = t.type == smt.originalType; + if (!typesMatch) + return false; + + bool wallsMatch = t.wall == smt.originalWall; + if (!wallsMatch) + return false; + + bool framesMatch = t.frameX == smt.frameX; + framesMatch &= t.frameY == smt.frameY; + // Wall frames are not checked separately because these are computed from binary headers. + // wallFrameX() => (bTileHeader2 & 0xF) * 36; + // wallFrameY() => (bTileHeader3 & 7) * 36; + if (!framesMatch) + return false; + + // Lava and honey state are not checked separately because these are computed from binary headers. + // lava() => (bTileHeader & 0x20) == 32; + // honey() => (bTileHeader & 0x40) == 64; + return t.liquid == smt.liquid; + } + + private static int GetMetaTileIndex(IList metaTiles, Tile toSearch) + { + int numTiles = metaTiles.Count; + for (int i = 0; i < numTiles; ++i) + if (toSearch.EqualToMetaTile(metaTiles[i])) + return i; + 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 void ComputeMetaIndices(ref SchematicData schematic, ref SchematicMetaTile smt) + { + // Special case: this meta tile demands that the original tile in the destination be preserved. + // The meta index of this special mod tile name is always zero. + if (PreserveTileID > 0 && smt.type == PreserveTileID) + { + smt.type = TileID.Count; + smt.keepTile = true; + } + else if (smt.type >= TileID.Count) + { + ModTile mt = ModContent.GetModTile(smt.type); + if (mt != null) + { + // This tile has a valid modded tile. Check if that ModTile is already registered to find its index. + string tileFullName = mt.GetFullName(); + int tileNameIndex = schematic.modTileNames.IndexOf(tileFullName); + if (tileNameIndex == -1) + { + // This modded tile is not yet registered. Register it. The list's previous length is its index. + tileNameIndex = schematic.modTileNames.Count; + schematic.modTileNames.Add(tileFullName); + } + + // Adjust the meta tile's type so that it points to the mod tile name array. + // typeOriginal is unaffected so that future searches will still function. + smt.type = (ushort)(TileID.Count + tileNameIndex); + } + } + + // Special case: this meta tile demands that the original wall in the destination be preserved. + // The meta index of this special mod wall name is always zero. + if (PreserveWallID > 0 && smt.wall == PreserveWallID) + { + smt.wall = WallID.Count; + smt.keepWall = true; + } + else if (smt.wall >= WallID.Count) + { + ModWall mw = ModContent.GetModWall(smt.wall); + if (mw != null) + { + // This tile has a valid modded wall. Check if that ModWall is already registered to find its index. + string wallFullName = mw.GetFullName(); + int wallNameIndex = schematic.modWallNames.IndexOf(wallFullName); + if (wallNameIndex == -1) + { + // This modded wall is not yet registered. Register it. The list's previous length is its index. + wallNameIndex = schematic.modWallNames.Count; + schematic.modWallNames.Add(wallFullName); + } + + // Adjust the meta tile's wall so that it points to the mod wall name array. + // wallOriginal is unaffected so that future searches will still function. + smt.wall = (ushort)(WallID.Count + wallNameIndex); + } + } + } + + private static SchematicData ConstructSchematicData(Tile[,] tiles) + { + int width = tiles.GetLength(0); + int height = tiles.GetLength(1); + SchematicData schematic = new SchematicData(tiles.GetLength(0), tiles.GetLength(1)); + + // Add the fixed mod tile and mod wall for index zero. These special tiles preserve the existing tile or wall at that location. + schematic.modTileNames.Add(PreserveTileName); + schematic.modWallNames.Add(PreserveTileName); + + for (int y = 0; y < height; ++y) + for (int x = 0; x < width; ++x) + { + Tile t = tiles[x, y]; + int metaTileIndex = GetMetaTileIndex(schematic.uniqueTiles, t); + + // If this is a new tile not already registered, it must be added to uniqueTiles. + if (metaTileIndex == -1) + { + metaTileIndex = schematic.uniqueTiles.Count; + SchematicMetaTile smt = new SchematicMetaTile(t); + + // If either the tile or the wall are modded, we may need to register that data. + // We will surely need to modify the meta tile's type and wall fields if it contains modded data. + // This function also handles the special case of preservation tiles/walls. + ComputeMetaIndices(ref schematic, ref smt); + + // With potentially modded data processed, add the meta tile to the list of registered meta tiles. + schematic.uniqueTiles.Add(smt); + } + + // There is no reason to continue processing a schematic if it is too complicated. + if (metaTileIndex >= SchematicData.MaxUniqueTileCount) + goto PostAreaIteration; + + // Update the area indices so that the tile at this position is the correct reference. + schematic.areaIndices[x, y] = (ushort)metaTileIndex; + } + + PostAreaIteration: + + // If there are too many unique tiles, set the size to zero. This will cause the schematic to fail to export. + // Even in a schematic of nothing but air, there is one unique tile: air. + if (schematic.uniqueTiles.Count > SchematicData.MaxUniqueTileCount) + schematic.uniqueTiles.Clear(); + + return schematic; + } + + private static void WriteSchematicMetaTile(this BinaryWriter writer, SchematicMetaTile smt) + { + writer.Write(smt.bTileHeader); + writer.Write(smt.bTileHeader2); + writer.Write(smt.bTileHeader3); + writer.Write(smt.sTileHeader); + writer.Write(smt.type); + writer.Write(smt.wall); + writer.Write(smt.frameX); + writer.Write(smt.frameY); + writer.Write(smt.liquid); + } + #endregion + + #region Export + public static ExportResult ExportSchematic(Rectangle area) + { + if (area.Top < 0 || area.Left < 0 || area.Right >= Main.maxTilesX || area.Bottom >= Main.maxTilesY) + return ExportResult.CornerOutOfWorld; + // IsEmpty does NOT return false for all rectangles with zero area. + if (area.Width <= 0 || area.Height <= 0) + return ExportResult.ZeroArea; + + Tile[,] tiles = GetTilesInRectangle(area); + + byte[] renderedStream; + using (MemoryStream stream = new MemoryStream(SchematicBufferStartingSize)) + using (BinaryWriter writer = new BinaryWriter(stream, Encoding.UTF8)) + { + // 1: 4-byte magic number header + // This is only included here if compression is turned off + if (!UseCompression) + { + writer.Write(SchematicMagicNumberHeader); + writer.Write(UncompressedMagicNumber); + } + + // Calculate the schematic's data. Fail immediately if the schematic has too many unique tiles. + SchematicData schematic = ConstructSchematicData(tiles); + if (schematic.uniqueTiles.Count <= 0) + { + writer.Close(); + return ExportResult.TooManyUniqueTiles; + } + + // 2: Length of list 3. + ushort numModTileNames = (ushort)schematic.modTileNames.Count; + writer.Write(numModTileNames); + + // 3: List of fully qualified modded tile names. + for (ushort i = 0; i < numModTileNames; ++i) + writer.Write(schematic.modTileNames[i]); + + // 4: Length of list 5. + ushort numModWallNames = (ushort)schematic.modWallNames.Count; + writer.Write(numModWallNames); + + // 5: List of fully qualified modded wall names. + for (ushort i = 0; i < numModWallNames; ++i) + writer.Write(schematic.modWallNames[i]); + + // 6: Length of list 7. + ushort numUniqueTiles = (ushort)schematic.uniqueTiles.Count; + writer.Write(numUniqueTiles); + + // 7: List of definitions of unique tiles. For modded tiles, their types are lookup indices to the mod tile and mod wall name arrays. + // Specific tiles and walls from the CalamitySchematicExporter mod have hardcoded behavior at this step. + // They will be replaced with preserve flags by overriding the tile and wall meta indices. + for (ushort i = 0; i < numUniqueTiles; ++i) + writer.WriteSchematicMetaTile(schematic.uniqueTiles[i]); + + // 8: Width and height of array 9. + ushort tileWidth = (ushort)schematic.areaIndices.GetLength(0); + writer.Write(tileWidth); + ushort tileHeight = (ushort)schematic.areaIndices.GetLength(1); + writer.Write(tileHeight); + + // 9: Array of indices to unique tile definitions. + for (ushort y = 0; y < tileHeight; ++y) + for (ushort x = 0; x < tileWidth; ++x) + writer.Write(schematic.areaIndices[x, y]); + + // Compile all serialized data into a byte array for writing. + renderedStream = stream.ToArray(); + } + + // If compression is enabled, replace the current rendered stream with a re-written compressed one. + if (UseCompression) + { + using (MemoryStream gzMem = new MemoryStream(renderedStream.Length)) + { + // Write the magic number outside the compressed region of data if compression is enabled. + // This is the only way for a reading algorithm to know this is a compressed schematic. + gzMem.Write(SchematicMagicNumberHeader, 0, SchematicMagicNumberHeader.Length); + gzMem.WriteByte(CompressedMagicNumber); + + using (GZipStream gz = new GZipStream(gzMem, CompressionLevel.Optimal)) + { + gz.Write(renderedStream, 0, renderedStream.Length); + } + renderedStream = gzMem.ToArray(); + } + } + + // To prevent overwrites, every schematic has an incredibly precise timestamp in its filename. + long fileTimestamp = System.DateTime.Now.ToFileTime(); + string filename = $"schematic_{fileTimestamp}.csch"; + string fullPath = Path.Combine(Main.SavePath, filename); + File.WriteAllBytes(fullPath, renderedStream); + return ExportResult.Success; + } + #endregion + + #region Import Helper Methods + private static SchematicMetaTile ReadSchematicMetaTile(this BinaryReader reader) + { + SchematicMetaTile smt = new SchematicMetaTile(); + smt.bTileHeader = reader.ReadByte(); + smt.bTileHeader2 = reader.ReadByte(); + smt.bTileHeader3 = reader.ReadByte(); + smt.sTileHeader = reader.ReadUInt16(); + smt.type = reader.ReadUInt16(); + smt.wall = reader.ReadUInt16(); + smt.frameX = reader.ReadInt16(); + smt.frameY = reader.ReadInt16(); + smt.liquid = reader.ReadByte(); + return smt; + } + + private static void ReplaceMetaIndicesWithLoadedIDs(ref SchematicMetaTile smt, string[] modTileNames, string[] modWallNames) + { + // If this schematic tile has a modded foreground tile, replace the meta index offset with that modded tile's ID. + if (smt.type >= TileID.Count) + { + // The first entry in modTileNames is always the special preserver name. If you hit this name, just set the keepTile flag. + string tileFullName = modTileNames[smt.type - TileID.Count]; + if (tileFullName == PreserveTileName) + smt.keepTile = true; + else + { + 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)); + } + } + // If this schematic tile has a modded wall, replace the meta index offset with that modded wall's ID. + if (smt.wall >= WallID.Count) + { + // The first entry in modWallNames is always the special preserver name. If you hit this name, just set the keepWall flag. + string wallFullName = modWallNames[smt.wall - WallID.Count]; + if (wallFullName == PreserveTileName) + smt.keepWall = true; + else + { + 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)); + } + } + } + #endregion + + #region Import + public static SchematicMetaTile[,] LoadSchematic(string filename) + { + SchematicMetaTile[,] ret = null; + using (Stream st = CalamityMod.Instance.GetFileStream(filename, true)) + { + ret = ImportSchematic(st); + } + return ret; + } + + private const string InvalidFormatString = "Provided file is not a valid Calamity Schematic."; + private static SchematicMetaTile[,] ImportSchematic(Stream fileInputStream) + { + // 1: Header. First three bytes are a magic number. Fourth byte determines compression. + byte[] header = fileInputStream.ReadBytes(4); + + for (int i = 0; i < SchematicMagicNumberHeader.Length; ++i) + if (header[i] != SchematicMagicNumberHeader[i]) + throw new InvalidDataException($"{InvalidFormatString} The magic number signature is invalid."); + + bool compression = false; + if (header[3] == CompressedMagicNumber) + compression = true; + else if (header[3] != UncompressedMagicNumber) + throw new InvalidDataException($"{InvalidFormatString} The file is not properly marked as compressed or uncompressed."); + + SchematicMetaTile[,] ret; + byte[] buffer; + using (MemoryStream stream = new MemoryStream(SchematicBufferStartingSize)) + { + if (compression) + using (GZipStream gz = new GZipStream(fileInputStream, CompressionMode.Decompress)) + gz.CopyTo(stream); + else + fileInputStream.CopyTo(stream); + buffer = stream.ToArray(); + } + + using (MemoryStream bufferStream = new MemoryStream(buffer, false)) + using (BinaryReader reader = new BinaryReader(bufferStream, Encoding.UTF8)) + { + // 2: Length of list 3. + ushort numModTileNames = reader.ReadUInt16(); + + // 3: List of fully qualified modded tile names. + string[] modTileNames = new string[numModTileNames]; + for (int i = 0; i < numModTileNames; ++i) + modTileNames[i] = reader.ReadString(); + + // 4: Length of list 5. + ushort numModWallNames = reader.ReadUInt16(); + string[] modWallNames = new string[numModWallNames]; + + // 5: List of fully qualified modded wall names. + for (int i = 0; i < numModWallNames; ++i) + modWallNames[i] = reader.ReadString(); + + // 6: Length of list 7. + ushort numUniqueTiles = reader.ReadUInt16(); + SchematicMetaTile[] uniqueTiles = new SchematicMetaTile[numUniqueTiles]; + + // 7: List of definitions of unique tiles. For modded tiles, their types are lookup indices to the mod tile and mod wall name arrays. + for (ushort i = 0; i < numUniqueTiles; ++i) + { + SchematicMetaTile smt = reader.ReadSchematicMetaTile(); + ReplaceMetaIndicesWithLoadedIDs(ref smt, modTileNames, modWallNames); + uniqueTiles[i] = smt; + } + + // 8: Width and height of array 9. + ushort tileWidth = reader.ReadUInt16(); + ushort tileHeight = reader.ReadUInt16(); + ret = new SchematicMetaTile[tileWidth, tileHeight]; + + // 9: Array of indices to unique tile definitions. We immediately convert these to tiles. + for (ushort y = 0; y < tileHeight; ++y) + for (ushort x = 0; x < tileWidth; ++x) + { + ushort tileIndex = reader.ReadUInt16(); + ret[x, y] = uniqueTiles[tileIndex]; + } + } + return ret; + } + #endregion + } +} diff --git a/Schematics/ColorTileCombination.cs b/Schematics/ColorTileCombination.cs deleted file mode 100644 index 5d9ffc1f11..0000000000 --- a/Schematics/ColorTileCombination.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Terraria; -using Microsoft.Xna.Framework; - -namespace CalamityMod.Schematics -{ - public struct ColorTileCombination - { - internal Color InternalColor; - internal Tile InternalTile; - public ColorTileCombination(Color color, Tile tile) - { - InternalColor = color; - InternalTile = tile; - } - } -} diff --git a/Schematics/ColorTileMap.cs b/Schematics/ColorTileMap.cs deleted file mode 100644 index f8ae2f2a43..0000000000 --- a/Schematics/ColorTileMap.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.Xna.Framework; -using System.Collections.Generic; - -namespace CalamityMod.Schematics -{ - public class ColorTileMap - { - internal readonly Dictionary Map = new Dictionary(); - public ColorTileMap(Dictionary colorTileMap) - { - Map = colorTileMap; - } - // For general convenience and as a means of mitigating the key check every time. - public TileDefinitionStructure this[Color key] => Map.ContainsKey(key) ? Map[key] : TileDefinitionStructure.AirDefinition; - } -} diff --git a/Schematics/HellLaboratory.csch b/Schematics/HellLaboratory.csch new file mode 100644 index 0000000000..ba6de92ab1 Binary files /dev/null and b/Schematics/HellLaboratory.csch differ diff --git a/Schematics/IceLaboratory.csch b/Schematics/IceLaboratory.csch new file mode 100644 index 0000000000..704c506db2 Binary files /dev/null and b/Schematics/IceLaboratory.csch differ diff --git a/Schematics/LargeScrapPile1.csch b/Schematics/LargeScrapPile1.csch new file mode 100644 index 0000000000..71acadddb1 Binary files /dev/null and b/Schematics/LargeScrapPile1.csch differ diff --git a/Schematics/LargeScrapPile2.csch b/Schematics/LargeScrapPile2.csch new file mode 100644 index 0000000000..415cbbcfc6 Binary files /dev/null and b/Schematics/LargeScrapPile2.csch differ diff --git a/Schematics/LargeScrapPile3.csch b/Schematics/LargeScrapPile3.csch new file mode 100644 index 0000000000..3faf1e1d48 Binary files /dev/null and b/Schematics/LargeScrapPile3.csch differ diff --git a/Schematics/LargeScrapPile4.csch b/Schematics/LargeScrapPile4.csch new file mode 100644 index 0000000000..d444a71416 Binary files /dev/null and b/Schematics/LargeScrapPile4.csch differ diff --git a/Schematics/PlagueLaboratory.csch b/Schematics/PlagueLaboratory.csch new file mode 100644 index 0000000000..2e9b29aec9 Binary files /dev/null and b/Schematics/PlagueLaboratory.csch differ diff --git a/Schematics/PlanetoidLaboratory.csch b/Schematics/PlanetoidLaboratory.csch new file mode 100644 index 0000000000..698f88c971 Binary files /dev/null and b/Schematics/PlanetoidLaboratory.csch differ diff --git a/Schematics/ResearchFacility.csch b/Schematics/ResearchFacility.csch new file mode 100644 index 0000000000..0f8be5b2cb Binary files /dev/null and b/Schematics/ResearchFacility.csch differ diff --git a/Schematics/SchematicDataTypes.cs b/Schematics/SchematicDataTypes.cs new file mode 100644 index 0000000000..8a1d8c7097 --- /dev/null +++ b/Schematics/SchematicDataTypes.cs @@ -0,0 +1,31 @@ +namespace CalamityMod.Schematics +{ + public struct ChestItem + { + internal int Type; + internal int Stack; + internal ChestItem(int type, int stack) + { + Type = type; + Stack = stack; + } + } + + // The numbers assigned to these anchor types correspond to the layout of a numpad: + // 7 8 9 + // 4 5 6 + // 1 2 3 + public enum SchematicAnchor + { + Default = 0, // default is treated as equivalent to top left, but top left can be explicitly specified + TopLeft = 7, + TopCenter = 8, + TopRight = 9, + CenterLeft = 4, + Center = 5, + CenterRight = 6, + BottomLeft = 1, + BottomCenter = 2, + BottomRight = 3, + } +} diff --git a/Schematics/SchematicLoader.cs b/Schematics/SchematicLoader.cs deleted file mode 100644 index 4ce55aeaea..0000000000 --- a/Schematics/SchematicLoader.cs +++ /dev/null @@ -1,83 +0,0 @@ -using CalamityMod.Schematics.AutoGeneratedContent; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Terraria.ModLoader; - -namespace CalamityMod.Schematics -{ - public static class SchematicLoader - { - #region Fields - internal static Dictionary TileMaps = new Dictionary(); - internal static Dictionary PilePlacementMaps = new Dictionary(); - public delegate void PilePlacementFunction(int x, int y, Rectangle placeInArea); - #endregion - - #region Loading/Unloading - internal static void LoadEverything() - { - PilePlacementMaps = new Dictionary(); - TileMaps = new Dictionary - { - // Texture loading does not require a .png at the end of the path string. - ["Workshop"] = LoadSchematicCodeAndTexture(typeof(WorkshopSchematic), "Schematics/AutoGeneratedContent/WorkshopSchematic"), - ["Research Facility"] = LoadSchematicCodeAndTexture(typeof(ResearchFacilitySchematic), "Schematics/AutoGeneratedContent/ResearchFacilitySchematic"), - ["Hell Laboratory"] = LoadSchematicCodeAndTexture(typeof(HellLaboratorySchematic), "Schematics/AutoGeneratedContent/HellLaboratorySchematic"), - ["Sunken Sea Laboratory"] = LoadSchematicCodeAndTexture(typeof(SunkenSeaLaboratorySchematic), "Schematics/AutoGeneratedContent/SunkenSeaLaboratorySchematic"), - ["Ice Laboratory"] = LoadSchematicCodeAndTexture(typeof(IceLaboratorySchematic), "Schematics/AutoGeneratedContent/IceLaboratorySchematic"), - ["Plague Laboratory"] = LoadSchematicCodeAndTexture(typeof(PlagueLaboratorySchematic), "Schematics/AutoGeneratedContent/PlagueLaboratorySchematic"), - ["Planetoid Laboratory"] = LoadSchematicCodeAndTexture(typeof(PlanetoidLaboratorySchematic), "Schematics/AutoGeneratedContent/PlanetoidLaboratorySchematic"), - - ["Astral Beacon"] = LoadSchematicCodeAndTexture(typeof(AstralBeaconSchematic), "Schematics/AutoGeneratedContent/AstralBeaconSchematic") - }; - } - internal static void UnloadEverything() - { - TileMaps = null; - PilePlacementMaps = null; - } - #endregion - - #region Texture and Code to Tile - internal static MethodInfo SeekSchematicLoaderInType(Type toSearch) - { - // Checks if the method has a GeneratedCode attribute with a specific tool. - // This should always be the case as it is added by default with the auto-generated code. - bool isSuitableMethod(MethodInfo method) - { - GeneratedCodeAttribute generatedCodeAttribute = method.GetCustomAttribute(typeof(GeneratedCodeAttribute)) as GeneratedCodeAttribute; - - if (generatedCodeAttribute == null) - return false; - return generatedCodeAttribute.Tool.ToLower() == "screencapturetoschematic"; - } - MethodInfo[] appropriateMethodsFound = toSearch.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); - MethodInfo match = appropriateMethodsFound.First(isSuitableMethod); - if (match == null) - throw new NullReferenceException($"Could not load any methods from {toSearch.FullName} that are appropriately marked to be used for schematic loading."); - return match; - } - internal static ColorTileCombination[,] LoadSchematicCodeAndTexture(Type schematicType, string texturePath) - { - ColorTileMap map = (ColorTileMap)SeekSchematicLoaderInType(schematicType).Invoke(null, null); - Texture2D schemanticTexture = ModContent.GetTexture($"CalamityMod/{texturePath}"); - - ColorTileCombination[,] schematic = new ColorTileCombination[schemanticTexture.Width, schemanticTexture.Height]; - Color[,] colors = schemanticTexture.GetColorsFromTexture(); - for (int x = 0; x < schemanticTexture.Width; x++) - { - for (int y = 0; y < schemanticTexture.Height; y++) - { - schematic[x, y] = new ColorTileCombination(colors[x, y], map[colors[x, y]].SpecifiedTile); - } - } - return schematic; - } - #endregion - } -} diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs new file mode 100644 index 0000000000..031a94261e --- /dev/null +++ b/Schematics/SchematicManager.cs @@ -0,0 +1,233 @@ +using CalamityMod.TileEntities; +using CalamityMod.Tiles.DraedonStructures; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Schematics +{ + public static class SchematicManager + { + internal static Dictionary TileMaps; + internal static Dictionary PilePlacementMaps; + public delegate void PilePlacementFunction(int x, int y, Rectangle placeInArea); + + #region Load/Unload + internal static void Load() + { + PilePlacementMaps = new Dictionary(); + TileMaps = new Dictionary + { + // Draedon's Arsenal world gen structures + ["Workshop"] = CalamitySchematicIO.LoadSchematic("Schematics/Workshop.csch"), + ["Research Facility"] = CalamitySchematicIO.LoadSchematic("Schematics/ResearchFacility.csch"), + ["Hell Laboratory"] = CalamitySchematicIO.LoadSchematic("Schematics/HellLaboratory.csch"), + ["Sunken Sea Laboratory"] = CalamitySchematicIO.LoadSchematic("Schematics/SunkenSeaLaboratory.csch"), + ["Ice Laboratory"] = CalamitySchematicIO.LoadSchematic("Schematics/IceLaboratory.csch"), + ["Plague Laboratory"] = CalamitySchematicIO.LoadSchematic("Schematics/PlagueLaboratory.csch"), + ["Planetoid Laboratory"] = CalamitySchematicIO.LoadSchematic("Schematics/PlanetoidLaboratory.csch"), + + // Astral world gen structures + ["Astral Beacon"] = CalamitySchematicIO.LoadSchematic("Schematics/AstralBeacon.csch"), + + // Sulphurous Sea scrap world gen structures + ["Sulphurous Scrap 1"] = CalamitySchematicIO.LoadSchematic("Schematics/SmallScrapPile1.csch").ShaveOffEdge(), + ["Sulphurous Scrap 2"] = CalamitySchematicIO.LoadSchematic("Schematics/SmallScrapPile2.csch").ShaveOffEdge(), + ["Sulphurous Scrap 3"] = CalamitySchematicIO.LoadSchematic("Schematics/SmallScrapPile3.csch").ShaveOffEdge(), + ["Sulphurous Scrap 4"] = CalamitySchematicIO.LoadSchematic("Schematics/SmallScrapPile4.csch").ShaveOffEdge(), + ["Large Sulphurous Scrap 1"] = CalamitySchematicIO.LoadSchematic("Schematics/LargeScrapPile1.csch").ShaveOffEdge(), + ["Large Sulphurous Scrap 2"] = CalamitySchematicIO.LoadSchematic("Schematics/LargeScrapPile2.csch").ShaveOffEdge(), + ["Large Sulphurous Scrap 3"] = CalamitySchematicIO.LoadSchematic("Schematics/LargeScrapPile3.csch").ShaveOffEdge(), + ["Large Sulphurous Scrap 4"] = CalamitySchematicIO.LoadSchematic("Schematics/LargeScrapPile4.csch").ShaveOffEdge(), + }; + } + internal static void Unload() + { + TileMaps = null; + PilePlacementMaps = null; + } + #endregion + + #region Get Schematic Area + public static Vector2? GetSchematicArea(string name) + { + // If no schematic exists with this name, simply return null. + if (!TileMaps.TryGetValue(name, out SchematicMetaTile[,] schematic)) + return null; + + return new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + } + #endregion Get Schematic Area + + #region Place Schematic + public static void PlaceSchematic(string name, Point pos, SchematicAnchor anchorType, ref bool specialCondition, T chestDelegate = null) where T : Delegate + { + // If no schematic exists with this name, cancel with a helpful log message. + if (!TileMaps.ContainsKey(name)) + { + CalamityMod.Instance.Logger.Warn($"Tried to place a schematic with name \"{name}\". No matching schematic file found."); + return; + } + + // Invalid chest interaction delegates need to throw an error. + if (chestDelegate != null && + !(chestDelegate is Action) && + !(chestDelegate is Action)) + { + throw new ArgumentException("The chest interaction function has invalid parameters.", nameof(chestDelegate)); + } + PilePlacementMaps.TryGetValue(name, out PilePlacementFunction pilePlacementFunction); + + // Grab the schematic itself from the dictionary of loaded schematics. + SchematicMetaTile[,] schematic = TileMaps[name]; + int width = schematic.GetLength(0); + int height = schematic.GetLength(1); + + // Calculate the appropriate location to start laying down schematic tiles. + int cornerX = pos.X; + int cornerY = pos.Y; + switch (anchorType) + { + case SchematicAnchor.TopLeft: // Provided point is top-left corner = No change + case SchematicAnchor.Default: // This is also default behavior + default: + break; + case SchematicAnchor.TopCenter: // Provided point is top center = Top-left corner is 1/2 width to the left + cornerX -= width / 2; + break; + case SchematicAnchor.TopRight: // Provided point is top-right corner = Top-left corner is 1 width to the left + cornerX -= width; + break; + case SchematicAnchor.CenterLeft: // Provided point is left center: Top-left corner is 1/2 height above + cornerY -= height / 2; + break; + case SchematicAnchor.Center: // Provided point is center = Top-left corner is 1/2 width and 1/2 height up-left + cornerX -= width / 2; + cornerY -= height / 2; + break; + case SchematicAnchor.CenterRight: // Provided point is right center: Top-left corner is 1 width and 1/2 height up-left + cornerX -= width; + cornerY -= height / 2; + break; + case SchematicAnchor.BottomLeft: // Provided point is bottom-left corner = Top-left corner is 1 height above + cornerY -= height; + break; + case SchematicAnchor.BottomCenter: // Provided point is bottom center: Top-left corner is 1/2 width and 1 height up-left + cornerX -= width / 2; + cornerY -= height; + break; + case SchematicAnchor.BottomRight: // Provided point is bottom-right corner = Top-left corner is 1 width to the left and 1 height above + cornerX -= width; + cornerY -= height; + break; + } + + // Make sure that all four corners of the target area are actually in the world. + if (!WorldGen.InWorld(cornerX, cornerY) || !WorldGen.InWorld(cornerX + width, cornerY + height)) + { + CalamityMod.Instance.Logger.Warn("Schematic failed to place: Part of the target location is outside the game world."); + return; + } + + // Make an array for the tiles that used to be where this schematic will be pasted. + Tile[,] originalTiles = new Tile[width, height]; + + // Schematic area pre-processing has three steps. + // Step 1: Kill all trees and cacti specifically. This prevents ugly tree/cactus pieces from being restored later. + // Step 2: Fill the original tiles array with everything that was originally in the target rectangle. + // Step 3: Destroy everything in the target rectangle (except chests -- that'll cause infinite recursion). + // The third step is necessary so that multi tiles on the edge of the region are properly destroyed (e.g. Life Crystals). + + for (int x = 0; x < width; ++x) + 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) + WorldGen.KillTile(x + cornerX, y + cornerY); + } + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + 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) + 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. + for (int x = 0; x < width; ++x) + for (int y = 0; y < height; ++y) + { + SchematicMetaTile smt = schematic[x, y]; + string modChestStr = TileLoader.GetTile(smt.type)?.chest ?? ""; + bool isChest = smt.type == TileID.Containers || modChestStr != ""; + + // If the determined tile type is a chest and this is its top left corner, define it appropriately. + if (isChest && smt.frameX % 36 == 0 && smt.frameY == 0) + { + Chest chest = PlaceChest(x + cornerX, y + cornerY, smt.type); + // Use the appropriate chest delegate function to fill the chest. + if (chestDelegate is Action) + { + (chestDelegate as Action)?.Invoke(chest, smt.type, specialCondition); + specialCondition = true; + } + else if (chestDelegate is Action) + (chestDelegate as Action)?.Invoke(chest); + } + + // This is where the meta tile keep booleans are applied. + Tile t = Main.tile[x + cornerX, y + cornerY]; + smt.ApplyTo(ref t, originalTiles[x, y]); + TryToPlaceTileEntities(x + cornerX, y + cornerY, t); + + // Activate the pile placement function if defined. + Rectangle placeInArea = new Rectangle(x, y, width, height); + pilePlacementFunction?.Invoke(x + cornerX, y + cornerY, placeInArea); + } + } + #endregion + + #region Place Schematic Helper Methods + private static void TryToPlaceTileEntities(int x, int y, Tile t) + { + // A tile entity in an empty spot would make no sense. + if (!t.active()) + 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) + 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; + if (tileType == ModContent.TileType()) + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + else if (tileType == ModContent.TileType()) + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + else if (tileType == ModContent.TileType()) + TileEntity.PlaceEntityNet(x, y, ModContent.TileEntityType()); + } + + private static Chest PlaceChest(int x, int y, int chestType) + { + int chestIndex = Chest.FindEmptyChest(x, y, chestType); + Main.chest[chestIndex] = new Chest() + { + x = x, + y = y + }; + Main.chest[chestIndex].item = new Item[Main.chest[chestIndex].item.Length]; + for (int i = 0; i < Main.chest[chestIndex].item.Length; i++) + { + Main.chest[chestIndex].item[i] = new Item(); + } + return Main.chest[chestIndex]; + } + #endregion + } +} diff --git a/Schematics/SmallScrapPile1.csch b/Schematics/SmallScrapPile1.csch new file mode 100644 index 0000000000..71adf27c17 Binary files /dev/null and b/Schematics/SmallScrapPile1.csch differ diff --git a/Schematics/SmallScrapPile2.csch b/Schematics/SmallScrapPile2.csch new file mode 100644 index 0000000000..51fc4a598e Binary files /dev/null and b/Schematics/SmallScrapPile2.csch differ diff --git a/Schematics/SmallScrapPile3.csch b/Schematics/SmallScrapPile3.csch new file mode 100644 index 0000000000..6d291fcf13 Binary files /dev/null and b/Schematics/SmallScrapPile3.csch differ diff --git a/Schematics/SmallScrapPile4.csch b/Schematics/SmallScrapPile4.csch new file mode 100644 index 0000000000..0161115799 Binary files /dev/null and b/Schematics/SmallScrapPile4.csch differ diff --git a/Schematics/SunkenSeaLaboratory.csch b/Schematics/SunkenSeaLaboratory.csch new file mode 100644 index 0000000000..28b81f4411 Binary files /dev/null and b/Schematics/SunkenSeaLaboratory.csch differ diff --git a/Schematics/TileDefinitionStructure.cs b/Schematics/TileDefinitionStructure.cs deleted file mode 100644 index 503934a5ac..0000000000 --- a/Schematics/TileDefinitionStructure.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System; -using Terraria; - -namespace CalamityMod.Schematics -{ - public enum LiquidState - { - Water, - Lava, - Honey - } - // This class exists to make tile creation easier when creating schematic maps. - public class TileDefinitionStructure - { - public Tile SpecifiedTile { get; private set; } = new Tile(); - public Action SpecialAction { get; private set; } = null; - public static readonly TileDefinitionStructure AirDefinition = new TileDefinitionStructure(0, false); - - // Don't remove this just because another constructor with a default argument exists. It seems the CodeDOM isn't smart enough to work with the other constructor. - public TileDefinitionStructure(int type) - { - SpecifiedTile.type = (ushort)type; - SpecifiedTile.liquid = 0; - SpecifiedTile.active(true); - } - public TileDefinitionStructure(ushort type, bool active = true) - { - SpecifiedTile.type = type; - SpecifiedTile.liquid = 0; - SpecifiedTile.active(active); - } - public TileDefinitionStructure UseWall(ushort wallType, int xFrame, int yFrame) - { - SpecifiedTile.wall = wallType; - SpecifiedTile.wallFrameX(xFrame); - SpecifiedTile.wallFrameY(yFrame); - return this; - } - public TileDefinitionStructure UseSlope(byte slope) - { - SpecifiedTile.slope(slope); - return this; - } - public TileDefinitionStructure UseFrame(short frameX, short frameY) - { - SpecifiedTile.frameX = frameX; - SpecifiedTile.frameY = frameY; - return this; - } - public TileDefinitionStructure UseHeaders(byte header1, byte header2, byte header3, ushort header4) - { - SpecifiedTile.bTileHeader = header1; - SpecifiedTile.bTileHeader2 = header2; - SpecifiedTile.bTileHeader3 = header3; - SpecifiedTile.sTileHeader = header4; - return this; - } - public TileDefinitionStructure UseLiquid(LiquidState liquidType, byte liquidAmount) - { - SpecifiedTile.liquid = liquidAmount; - SpecifiedTile.lava(liquidType == LiquidState.Lava); - SpecifiedTile.honey(liquidType == LiquidState.Honey); - return this; - } - public TileDefinitionStructure MakeActuated() - { - SpecifiedTile.inActive(true); - return this; - } - } -} diff --git a/Schematics/TilePlacementHelpers.cs b/Schematics/TilePlacementHelpers.cs deleted file mode 100644 index 7ae7a24691..0000000000 --- a/Schematics/TilePlacementHelpers.cs +++ /dev/null @@ -1,216 +0,0 @@ -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using static CalamityMod.Schematics.SchematicLoader; - -namespace CalamityMod.Schematics -{ - public static class SchematicPlacementHelpers - { - public enum PlacementAnchorType - { - TopLeft, - TopRight, - Center, - BottomLeft, - BottomRight, - } - internal static Tile SchematicTileConversion(Tile oldTile, Tile toReplaceWith, Color schematicColorAtPosition) - { - float opacity = schematicColorAtPosition.A / 255f; - - Tile newTile = new Tile(); - // Destroy the original tile completely. - if (opacity == 0f) - return newTile; - - // Destroy the original tile itself but preserve the wall. - if (oldTile.wall != 0 && toReplaceWith.wall == 0 && opacity > 0f && opacity <= 0.33f) - newTile.wall = oldTile.wall; - - // Do nothing to the tile. - if (opacity > 0.33f && opacity <= 0.66f) - newTile = (Tile)oldTile.Clone(); - - // Completely replace the tile. - if (opacity > 0.66f) - newTile = (Tile)toReplaceWith.Clone(); - return newTile; - } - public static void PlaceStructure(string mapKey, Point placementPosition, PlacementAnchorType placementAnchor, Action chestInteraction = null) - { - if (!TileMaps.ContainsKey(mapKey)) - return; - PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); - ColorTileCombination[,] schematic = TileMaps[mapKey]; - Tile[,] oldTiles = new Tile[schematic.GetLength(0), schematic.GetLength(1)]; - int xOffset = placementPosition.X; - int yOffset = placementPosition.Y; - // Top-left is the default for terraria. There is no need to include it in this switch. - switch (placementAnchor) - { - case PlacementAnchorType.TopRight: - xOffset += schematic.GetLength(0); - break; - case PlacementAnchorType.Center: - xOffset += schematic.GetLength(0) / 2; - yOffset += schematic.GetLength(1) / 2; - break; - case PlacementAnchorType.BottomLeft: - yOffset += schematic.GetLength(1); - break; - case PlacementAnchorType.BottomRight: - xOffset += schematic.GetLength(0); - yOffset += schematic.GetLength(1); - break; - } - for (int x = 0; x < schematic.GetLength(0); x++) - { - for (int y = 0; y < schematic.GetLength(1); y++) - { - oldTiles[x, y] = (Tile)Main.tile[x + xOffset, y + yOffset].Clone(); - - // Attempting to break chests causes the game to attempt to infinitely recurse in an attempt to break the tile, resulting in a stack overflow. - if (oldTiles[x, y].type == TileID.Containers) - continue; - WorldGen.KillTile(x + xOffset, y + yOffset); - } - } - for (int x = 0; x < schematic.GetLength(0); x++) - { - for (int y = 0; y < schematic.GetLength(1); y++) - { - if (WorldGen.InWorld(x + xOffset, y + yOffset)) - { - Tile tile = schematic[x, y].InternalTile; - ModTile modTile = TileLoader.GetTile(tile.type); - bool isChest = tile.type == TileID.Containers || (modTile != null && modTile.chest != ""); - - // If the determined tile type is a chest, define it appropriately. - if (isChest) - { - if (tile.frameX % 36 == 0 && tile.frameY == 0) - { - Chest chest = PlaceChest(x + xOffset, y + yOffset, tile.type); - chestInteraction?.Invoke(chest); - } - } - if (tile.type == ModContent.TileType() || - tile.type == ModContent.TileType()) - { - WorldGen.PlaceTile(x, y, tile.type); - } - - if (tile.type == TileID.Trees || tile.type == TileID.PineTree || tile.type == TileID.Cactus) - { - ushort oldWall = oldTiles[x, y].wall; - oldTiles[x, y] = new Tile - { - wall = oldWall - }; - } - else Main.tile[x + xOffset, y + yOffset] = SchematicTileConversion(oldTiles[x, y], (Tile)tile.Clone(), schematic[x, y].InternalColor); - - Rectangle placeInArea = new Rectangle(x, y, schematic.GetLength(0), schematic.GetLength(1)); - - // Dictionary.TryGetValue returns null if the specified key is not present. - pilePlacementFunction?.Invoke(x + xOffset, y + yOffset, placeInArea); - } - } - } - } - public static void PlaceStructure(string mapKey, Point placementPosition, PlacementAnchorType placementAnchor, ref bool specialCondition, Action chestInteraction = null) - { - LoadEverything(); // Just in case they weren't loaded properly beforehand. - - PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); - ColorTileCombination[,] schematic = TileMaps[mapKey]; - Tile[,] oldTiles = new Tile[schematic.GetLength(0), schematic.GetLength(1)]; - int xOffset = placementPosition.X; - int yOffset = placementPosition.Y; - // Top-left is the default for terraria. There is no need to include it in this switch. - switch (placementAnchor) - { - case PlacementAnchorType.TopRight: - xOffset += schematic.GetLength(0); - break; - case PlacementAnchorType.Center: - xOffset += schematic.GetLength(0) / 2; - yOffset += schematic.GetLength(1) / 2; - break; - case PlacementAnchorType.BottomLeft: - yOffset += schematic.GetLength(1); - break; - case PlacementAnchorType.BottomRight: - xOffset += schematic.GetLength(0); - yOffset += schematic.GetLength(1); - break; - } - for (int x = 0; x < schematic.GetLength(0); x++) - { - for (int y = 0; y < schematic.GetLength(1); y++) - { - oldTiles[x, y] = (Tile)CalamityUtils.ParanoidTileRetrieval(x + xOffset, y + yOffset).Clone(); - - // Attempting to break chests causes the game to attempt to infinitely recurse in an attempt to break the tile, resulting in a stack overflow. - if (oldTiles[x, y].type == TileID.Containers) - continue; - WorldGen.KillTile(x + xOffset, y + yOffset); - } - } - for (int x = 0; x < schematic.GetLength(0); x++) - { - for (int y = 0; y < schematic.GetLength(1); y++) - { - if (WorldGen.InWorld(x + xOffset, y + yOffset)) - { - Tile tile = schematic[x, y].InternalTile; - ModTile modTile = TileLoader.GetTile(tile.type); - bool isChest = tile.type == TileID.Containers || (modTile != null && modTile.chest != ""); - - if (tile.type == ModContent.TileType() || - tile.type == ModContent.TileType()) - { - WorldGen.PlaceTile(x, y, tile.type); - } - // If the determined tile type is a chest, define it appropriately. - if (isChest) - { - if (tile.frameX % 36 == 0 && tile.frameY == 0) - { - Chest chest = PlaceChest(x + xOffset, y + yOffset, tile.type); - chestInteraction?.Invoke(chest, tile.type, specialCondition); - specialCondition = true; - } - } - - Main.tile[x + xOffset, y + yOffset] = SchematicTileConversion(oldTiles[x, y], (Tile)tile.Clone(), schematic[x, y].InternalColor); - - Rectangle placeInArea = new Rectangle(x, y, schematic.GetLength(0), schematic.GetLength(1)); - - // Dictionary.TryGetValue returns null if the specified key is not present. - pilePlacementFunction?.Invoke(x + xOffset, y + yOffset, placeInArea); - } - } - } - } - public static Chest PlaceChest(int x, int y, int chestType) - { - int chestIndex = Chest.FindEmptyChest(x, y, chestType); - Main.chest[chestIndex] = new Chest() - { - x = x, - y = y - }; - Main.chest[chestIndex].item = new Item[Main.chest[chestIndex].item.Length]; - for (int i = 0; i < Main.chest[chestIndex].item.Length; i++) - { - Main.chest[chestIndex].item[i] = new Item(); - } - return Main.chest[chestIndex]; - } - } -} diff --git a/Schematics/Workshop.csch b/Schematics/Workshop.csch new file mode 100644 index 0000000000..f6cac9315e Binary files /dev/null and b/Schematics/Workshop.csch differ diff --git a/Skies/AstralScreenShaderData.cs b/Skies/AstralScreenShaderData.cs index 58bfa3aba6..886e7040ca 100644 --- a/Skies/AstralScreenShaderData.cs +++ b/Skies/AstralScreenShaderData.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Skies public override void Apply() { Vector3 vec = Main.bgColor.ToVector3(); - vec *= (CalamityWorld.death ? 0.7f : 0.4f); + vec *= CalamityWorld.death ? 0.55f : 0.4f; base.UseOpacity(Math.Max(vec.X, Math.Max(vec.Y, vec.Z))); base.Apply(); } diff --git a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs b/Skies/SCalScreenShaderData.cs similarity index 94% rename from NPCs/SupremeCalamitas/SCalScreenShaderData.cs rename to Skies/SCalScreenShaderData.cs index 7f0b3dca34..af7e823da1 100644 --- a/NPCs/SupremeCalamitas/SCalScreenShaderData.cs +++ b/Skies/SCalScreenShaderData.cs @@ -1,8 +1,9 @@ +using CalamityMod.NPCs.SupremeCalamitas; using Terraria; using Terraria.Graphics.Shaders; using Terraria.ModLoader; -namespace CalamityMod.NPCs.SupremeCalamitas +namespace CalamityMod.Skies { public class SCalScreenShaderData : ScreenShaderData { diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs new file mode 100644 index 0000000000..d0e2978fe8 --- /dev/null +++ b/Skies/SCalSky.cs @@ -0,0 +1,246 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + public class SCalSky : CustomSky + { + public class Cinder + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + public Cinder(int lifetime, int identity, float depth, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + } + } + + private bool isActive = false; + private float intensity = 0f; + private int SCalIndex = -1; + public List Cinders = new List(); + public static int CinderReleaseChance + { + get + { + if (!Main.npc.IndexInRange(CalamityGlobalNPC.SCal) || Main.npc[CalamityGlobalNPC.SCal].type != ModContent.NPCType()) + return int.MaxValue; + + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + float lifeRatio = scal.life / (float)scal.lifeMax; + + // Release a good amount of cinders during bullet hells. If this is too distracting this can be + // inverted so that less appear than usual instead. + if (scal.ModNPC().bulletHellCounter2 % 900 != 0) + return lifeRatio <= 0.1f ? 8 : 11; + + // Release more and more cinders at the end of the battle until the acceptance phase, where it all slows down dramatically, with just a few ashes. + if (lifeRatio < 0.1f) + { + if (lifeRatio <= 0.01f) + return 32; + + return (int)Math.Round(MathHelper.Lerp(2f, 11f, Utils.InverseLerp(0.03f, 0.1f, lifeRatio, true))); + } + + // Release a good amount of cinders while brothers or Sepulcher-1 are alive. Sepulcher-2 falls into an above case and does not execute this return. + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) + return 10; + + // Release a moderate amount of cinders normally. + return 18; + } + } + public static float CinderSpeed + { + get + { + if (!Main.npc.IndexInRange(CalamityGlobalNPC.SCal) || Main.npc[CalamityGlobalNPC.SCal].type != ModContent.NPCType()) + return 0f; + + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + float lifeRatio = scal.life / (float)scal.lifeMax; + + // Move more and more quickly at the end of the battle until the acceptance phase, where it all slows down dramatically. + if (lifeRatio < 0.1f) + { + if (lifeRatio <= 0.01f) + return 4.5f; + + return MathHelper.Lerp(10.75f, 6.7f, Utils.InverseLerp(0.03f, 0.1f, lifeRatio, true)); + } + + // Move a little quickly while brothers or Sepulcher-1 are alive. Sepulcher-2 falls into an above case and does not execute this return. + if (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) + return 7.4f; + + // Move moderately quickly usually. + return 5.6f; + } + } + public static float OverridingIntensity = 0f; + + public override void Update(GameTime gameTime) + { + if (isActive && intensity < 1f) + { + intensity += 0.01f; + } + else if (!isActive && intensity > 0f) + { + intensity -= 0.01f; + } + + Color selectCinderColor() + { + if (!Main.npc.IndexInRange(CalamityGlobalNPC.SCal) || Main.npc[CalamityGlobalNPC.SCal].type != ModContent.NPCType()) + return Color.Transparent; + + NPC scal = Main.npc[CalamityGlobalNPC.SCal]; + float lifeRatio = scal.life / (float)scal.lifeMax; + if (lifeRatio > 0.5f) + return Color.Lerp(Color.Red, Color.Orange, Main.rand.NextFloat(0.8f)); + else if (lifeRatio > 0.3f) + return Color.Lerp(Color.DarkRed, Color.Lerp(Color.Blue, Color.DarkBlue, Main.rand.NextFloat() * 0.65f), 0.45f); + else if (lifeRatio > 0.01f) + return Color.Lerp(Color.Red, Color.Yellow, Main.rand.NextFloat(0.2f, 0.9f)); + else + return Color.Gray; + } + + // Randomly add cinders. + if (intensity >= 1f && Main.rand.NextBool(CinderReleaseChance)) + { + int lifetime = Main.rand.Next(285, 445); + float depth = Main.rand.NextFloat(1.8f, 5f); + Vector2 startingPosition = Main.screenPosition + new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f); + Vector2 startingVelocity = -Vector2.UnitY.RotatedByRandom(0.91f); + Cinders.Add(new Cinder(lifetime, Cinders.Count, depth, selectCinderColor(), startingPosition, startingVelocity)); + } + + // Update all cinders. + for (int i = 0; i < Cinders.Count; i++) + { + Cinders[i].Scale = Utils.InverseLerp(Cinders[i].Lifetime, Cinders[i].Lifetime / 3, Cinders[i].Time, true); + Cinders[i].Scale *= MathHelper.Lerp(0.6f, 0.9f, Cinders[i].IdentityIndex % 6f / 6f); + + Vector2 idealVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.94f, 0.94f, (float)Math.Sin(Cinders[i].Time / 36f + Cinders[i].IdentityIndex) * 0.5f + 0.5f)) * CinderSpeed; + float movementInterpolant = MathHelper.Lerp(0.01f, 0.08f, Utils.InverseLerp(45f, 145f, Cinders[i].Time, true)); + Cinders[i].Velocity = Vector2.Lerp(Cinders[i].Velocity, idealVelocity, movementInterpolant); + Cinders[i].Velocity = Cinders[i].Velocity.SafeNormalize(-Vector2.UnitY) * CinderSpeed; + Cinders[i].Time++; + + Cinders[i].Center += Cinders[i].Velocity; + } + + // Clear away all dead cinders. + Cinders.RemoveAll(c => c.Time >= c.Lifetime); + } + + private float GetIntensity() + { + if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) + return OverridingIntensity; + + OverridingIntensity = 0f; + if (UpdateSCalIndex()) + { + float x = 0f; + if (SCalIndex != -1) + x = Vector2.Distance(Main.player[Main.myPlayer].Center, Main.npc[this.SCalIndex].Center); + + return 1f - Utils.SmoothStep(3000f, 6000f, x); + } + return 0f; + } + + public override Color OnTileColor(Color inColor) => new Color(Vector4.Lerp(new Vector4(0.5f, 0.8f, 1f, 1f), inColor.ToVector4(), 1f - GetIntensity())); + + private bool UpdateSCalIndex() + { + int SCalType = ModContent.NPCType(); + if (SCalIndex >= 0 && Main.npc[SCalIndex].active && Main.npc[SCalIndex].type == SCalType) + { + return true; + } + SCalIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == SCalType) + { + SCalIndex = i; + break; + } + } + return SCalIndex != -1; + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth >= 0 && minDepth < 0) + { + float intensity = GetIntensity(); + spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * intensity); + } + + // Draw cinders. + Texture2D cinderTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/CalamitasCinder"); + for (int i = 0; i < Cinders.Count; i++) + { + Vector2 drawPosition = Cinders[i].Center - Main.screenPosition; + for (int j = 0; j < 3; j++) + { + Vector2 offsetDrawPosition = drawPosition + (MathHelper.TwoPi * j / 3f).ToRotationVector2() * 1.4f; + Color offsetDrawColor = Color.Red * 0.56f; + offsetDrawColor.A = 0; + spriteBatch.Draw(cinderTexture, offsetDrawPosition, null, offsetDrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale * 1.5f, SpriteEffects.None, 0f); + } + spriteBatch.Draw(cinderTexture, drawPosition, null, Cinders[i].DrawColor, 0f, cinderTexture.Size() * 0.5f, Cinders[i].Scale, SpriteEffects.None, 0f); + } + } + + public override float GetCloudAlpha() + { + return 0f; + } + + public override void Activate(Vector2 position, params object[] args) + { + isActive = true; + } + + public override void Deactivate(params object[] args) + { + isActive = false; + } + + public override void Reset() + { + isActive = false; + } + + public override bool IsActive() + { + return isActive || intensity > 0f; + } + } +} diff --git a/Skies/StormWeaverFlashSky.cs b/Skies/StormWeaverFlashSky.cs new file mode 100644 index 0000000000..6481e2987d --- /dev/null +++ b/Skies/StormWeaverFlashSky.cs @@ -0,0 +1,56 @@ +using CalamityMod.NPCs.StormWeaver; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Effects; +using Terraria.ModLoader; + +namespace CalamityMod.Skies +{ + public class StormWeaverFlashSky : CustomSky + { + public int StormWeaverHeadIndex = -1; + + public override void Update(GameTime gameTime) + { + int weaverType = ModContent.NPCType(); + if (StormWeaverHeadIndex >= 0 && Main.npc[StormWeaverHeadIndex].active && Main.npc[StormWeaverHeadIndex].type == weaverType) + return; + + StormWeaverHeadIndex = -1; + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].active && Main.npc[i].type == weaverType) + { + StormWeaverHeadIndex = i; + break; + } + } + } + + public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth) + { + if (maxDepth < float.MaxValue || !Main.npc.IndexInRange(StormWeaverHeadIndex)) + return; + + // Draw lightning in the background based on Main.magicPixel. + // It is a long, white vertical strip that exists for some reason. + // This lightning effect is achieved by expanding this to fit the entire background and then drawing it as a distinct element. + float lightningFlashPower = (Main.npc[StormWeaverHeadIndex].modNPC as StormWeaverHeadNaked).lightning; + Vector2 scale = new Vector2(Main.screenWidth * 1.1f / Main.magicPixel.Width, Main.screenHeight * 1.1f / Main.magicPixel.Height); + Vector2 screenCenter = new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + Color drawColor = Color.White * MathHelper.Lerp(0f, 0.88f, lightningFlashPower); + + for (int i = 0; i < 2; i++) + spriteBatch.Draw(Main.magicPixel, screenCenter, null, drawColor, 0f, Main.magicPixel.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + + public override void Reset() { } + + public override void Activate(Vector2 position, params object[] args) { } + + public override void Deactivate(params object[] args) { } + + public override bool IsActive() => StormWeaverHeadIndex != -1 && !Main.gameMenu; + } +} diff --git a/Sounds/Custom/AngelicAllianceActivation.cs b/Sounds/Custom/AngelicAllianceActivation.cs new file mode 100644 index 0000000000..2df6ffa472 --- /dev/null +++ b/Sounds/Custom/AngelicAllianceActivation.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AngelicAllianceActivation : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AngelicAllianceActivation.ogg b/Sounds/Custom/AngelicAllianceActivation.ogg new file mode 100644 index 0000000000..db9575fa65 Binary files /dev/null and b/Sounds/Custom/AngelicAllianceActivation.ogg differ diff --git a/Sounds/Custom/AstralBeaconOrbPulse.cs b/Sounds/Custom/AstralBeaconOrbPulse.cs new file mode 100644 index 0000000000..9b0e26f8f1 --- /dev/null +++ b/Sounds/Custom/AstralBeaconOrbPulse.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AstralBeaconOrbPulse : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AstralBeaconOrbPulse.ogg b/Sounds/Custom/AstralBeaconOrbPulse.ogg new file mode 100644 index 0000000000..1e210861b7 Binary files /dev/null and b/Sounds/Custom/AstralBeaconOrbPulse.ogg differ diff --git a/Sounds/Custom/AstralBeaconUse.cs b/Sounds/Custom/AstralBeaconUse.cs new file mode 100644 index 0000000000..473d2ffd5a --- /dev/null +++ b/Sounds/Custom/AstralBeaconUse.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AstralBeaconUse : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AstralBeaconUse.ogg b/Sounds/Custom/AstralBeaconUse.ogg new file mode 100644 index 0000000000..397e45139d Binary files /dev/null and b/Sounds/Custom/AstralBeaconUse.ogg differ diff --git a/Sounds/Custom/AstrumDeusSpawn.cs b/Sounds/Custom/AstrumDeusSpawn.cs new file mode 100644 index 0000000000..25d234face --- /dev/null +++ b/Sounds/Custom/AstrumDeusSpawn.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AstrumDeusSpawn : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AstrumDeusSpawn.ogg b/Sounds/Custom/AstrumDeusSpawn.ogg new file mode 100644 index 0000000000..517cbc6f3b Binary files /dev/null and b/Sounds/Custom/AstrumDeusSpawn.ogg differ diff --git a/Sounds/Custom/AstrumDeusSplit.cs b/Sounds/Custom/AstrumDeusSplit.cs new file mode 100644 index 0000000000..0ab9568dd6 --- /dev/null +++ b/Sounds/Custom/AstrumDeusSplit.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class AstrumDeusSplit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/AstrumDeusSplit.ogg b/Sounds/Custom/AstrumDeusSplit.ogg new file mode 100644 index 0000000000..b0d12fc0bc Binary files /dev/null and b/Sounds/Custom/AstrumDeusSplit.ogg differ diff --git a/Sounds/Custom/BloodflareRangerActivation.cs b/Sounds/Custom/BloodflareRangerActivation.cs new file mode 100644 index 0000000000..93e5344498 --- /dev/null +++ b/Sounds/Custom/BloodflareRangerActivation.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class BloodflareRangerActivation : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/BloodflareRangerActivation.ogg b/Sounds/Custom/BloodflareRangerActivation.ogg new file mode 100644 index 0000000000..33a2871f9d Binary files /dev/null and b/Sounds/Custom/BloodflareRangerActivation.ogg differ diff --git a/Sounds/Custom/BloodflareRangerRecharge.cs b/Sounds/Custom/BloodflareRangerRecharge.cs new file mode 100644 index 0000000000..dd12c8d67b --- /dev/null +++ b/Sounds/Custom/BloodflareRangerRecharge.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class BloodflareRangerRecharge : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/BloodflareRangerRecharge.ogg b/Sounds/Custom/BloodflareRangerRecharge.ogg new file mode 100644 index 0000000000..66297ec216 Binary files /dev/null and b/Sounds/Custom/BloodflareRangerRecharge.ogg differ diff --git a/Sounds/Custom/DefenseDamage.cs b/Sounds/Custom/DefenseDamage.cs new file mode 100644 index 0000000000..ab5f7a07b7 --- /dev/null +++ b/Sounds/Custom/DefenseDamage.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DefenseDamage : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DefenseDamage.ogg b/Sounds/Custom/DefenseDamage.ogg new file mode 100644 index 0000000000..c41a3f48f5 Binary files /dev/null and b/Sounds/Custom/DefenseDamage.ogg differ diff --git a/Sounds/Custom/DemonshadeEnrage.cs b/Sounds/Custom/DemonshadeEnrage.cs new file mode 100644 index 0000000000..1880e41480 --- /dev/null +++ b/Sounds/Custom/DemonshadeEnrage.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DemonshadeEnrage : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DemonshadeEnrage.ogg b/Sounds/Custom/DemonshadeEnrage.ogg new file mode 100644 index 0000000000..94ac80dfcb Binary files /dev/null and b/Sounds/Custom/DemonshadeEnrage.ogg differ diff --git a/Sounds/Custom/DesertScourgeRoar.cs b/Sounds/Custom/DesertScourgeRoar.cs new file mode 100644 index 0000000000..e49b62cde3 --- /dev/null +++ b/Sounds/Custom/DesertScourgeRoar.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DesertScourgeRoar : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DesertScourgeRoar.ogg b/Sounds/Custom/DesertScourgeRoar.ogg new file mode 100644 index 0000000000..061185973f Binary files /dev/null and b/Sounds/Custom/DesertScourgeRoar.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGAttackSwitch1.cs b/Sounds/Custom/PlagueSounds/PBGAttackSwitch1.cs new file mode 100644 index 0000000000..ba5b5437dc --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PBGAttackSwitch1.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PBGAttackSwitch1 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PBGAttackSwitch1.ogg b/Sounds/Custom/PlagueSounds/PBGAttackSwitch1.ogg new file mode 100644 index 0000000000..69a654c63c Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGAttackSwitch1.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGAttackSwitch2.cs b/Sounds/Custom/PlagueSounds/PBGAttackSwitch2.cs new file mode 100644 index 0000000000..d5413dea03 --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PBGAttackSwitch2.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PBGAttackSwitch2 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PBGAttackSwitch2.ogg b/Sounds/Custom/PlagueSounds/PBGAttackSwitch2.ogg new file mode 100644 index 0000000000..54cb0b0662 Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGAttackSwitch2.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGBarrageLaunch.cs b/Sounds/Custom/PlagueSounds/PBGBarrageLaunch.cs new file mode 100644 index 0000000000..f02f87dad1 --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PBGBarrageLaunch.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PBGBarrageLaunch : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PBGBarrageLaunch.ogg b/Sounds/Custom/PlagueSounds/PBGBarrageLaunch.ogg new file mode 100644 index 0000000000..02e72e7388 Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGBarrageLaunch.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGDash.cs b/Sounds/Custom/PlagueSounds/PBGDash.cs new file mode 100644 index 0000000000..04e5d76618 --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PBGDash.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PBGDash : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PBGDash.ogg b/Sounds/Custom/PlagueSounds/PBGDash.ogg new file mode 100644 index 0000000000..d16923cd0b Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGDash.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PBGNukeWarning.cs b/Sounds/Custom/PlagueSounds/PBGNukeWarning.cs new file mode 100644 index 0000000000..05487222f3 --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PBGNukeWarning.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PBGNukeWarning : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PBGNukeWarning.ogg b/Sounds/Custom/PlagueSounds/PBGNukeWarning.ogg new file mode 100644 index 0000000000..9e0fc4077a Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PBGNukeWarning.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom1.cs b/Sounds/Custom/PlagueSounds/PlagueBoom1.cs new file mode 100644 index 0000000000..5b9254ea8b --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PlagueBoom1.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PlagueBoom1 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom1.ogg b/Sounds/Custom/PlagueSounds/PlagueBoom1.ogg new file mode 100644 index 0000000000..71f1ef82f9 Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PlagueBoom1.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom2.cs b/Sounds/Custom/PlagueSounds/PlagueBoom2.cs new file mode 100644 index 0000000000..9a864fe308 --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PlagueBoom2.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PlagueBoom2 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom2.ogg b/Sounds/Custom/PlagueSounds/PlagueBoom2.ogg new file mode 100644 index 0000000000..f74b47d4d5 Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PlagueBoom2.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom3.cs b/Sounds/Custom/PlagueSounds/PlagueBoom3.cs new file mode 100644 index 0000000000..b13ab47ede --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PlagueBoom3.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PlagueBoom3 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom3.ogg b/Sounds/Custom/PlagueSounds/PlagueBoom3.ogg new file mode 100644 index 0000000000..b2bb1c78db Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PlagueBoom3.ogg differ diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom4.cs b/Sounds/Custom/PlagueSounds/PlagueBoom4.cs new file mode 100644 index 0000000000..5bb6a468ad --- /dev/null +++ b/Sounds/Custom/PlagueSounds/PlagueBoom4.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.PlagueSounds +{ + public class PlagueBoom4 : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/PlagueSounds/PlagueBoom4.ogg b/Sounds/Custom/PlagueSounds/PlagueBoom4.ogg new file mode 100644 index 0000000000..4064c083da Binary files /dev/null and b/Sounds/Custom/PlagueSounds/PlagueBoom4.ogg differ diff --git a/Sounds/Custom/ProvidenceHolyBlastImpact.cs b/Sounds/Custom/ProvidenceHolyBlastImpact.cs new file mode 100644 index 0000000000..77bec70b4b --- /dev/null +++ b/Sounds/Custom/ProvidenceHolyBlastImpact.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class ProvidenceHolyBlastImpact : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/ProvidenceHolyBlastImpact.ogg b/Sounds/Custom/ProvidenceHolyBlastImpact.ogg new file mode 100644 index 0000000000..197891f115 Binary files /dev/null and b/Sounds/Custom/ProvidenceHolyBlastImpact.ogg differ diff --git a/Sounds/Custom/ProvidenceHolyBlastShoot.cs b/Sounds/Custom/ProvidenceHolyBlastShoot.cs new file mode 100644 index 0000000000..7aee6afceb --- /dev/null +++ b/Sounds/Custom/ProvidenceHolyBlastShoot.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class ProvidenceHolyBlastShoot : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/ProvidenceHolyBlastShoot.ogg b/Sounds/Custom/ProvidenceHolyBlastShoot.ogg new file mode 100644 index 0000000000..ebba3a8c63 Binary files /dev/null and b/Sounds/Custom/ProvidenceHolyBlastShoot.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneBigShoot.cs b/Sounds/Custom/SCalSounds/BrimstoneBigShoot.cs new file mode 100644 index 0000000000..be4a61e6f7 --- /dev/null +++ b/Sounds/Custom/SCalSounds/BrimstoneBigShoot.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class BrimstoneBigShoot : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/BrimstoneBigShoot.ogg b/Sounds/Custom/SCalSounds/BrimstoneBigShoot.ogg new file mode 100644 index 0000000000..7afaf0a822 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrimstoneBigShoot.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact.cs b/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact.cs new file mode 100644 index 0000000000..cef5892743 --- /dev/null +++ b/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class BrimstoneFireblastImpact : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact.ogg b/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact.ogg new file mode 100644 index 0000000000..4e309aaf5a Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact.cs b/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact.cs new file mode 100644 index 0000000000..6c74917986 --- /dev/null +++ b/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class BrimstoneGigablastImpact : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact.ogg b/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact.ogg new file mode 100644 index 0000000000..2a5e151e60 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneHellblastSound.cs b/Sounds/Custom/SCalSounds/BrimstoneHellblastSound.cs new file mode 100644 index 0000000000..5f37f1f7c2 --- /dev/null +++ b/Sounds/Custom/SCalSounds/BrimstoneHellblastSound.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class BrimstoneHellblastSound : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/BrimstoneHellblastSound.ogg b/Sounds/Custom/SCalSounds/BrimstoneHellblastSound.ogg new file mode 100644 index 0000000000..b2e6e44be2 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrimstoneHellblastSound.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneShoot.cs b/Sounds/Custom/SCalSounds/BrimstoneShoot.cs new file mode 100644 index 0000000000..5ad7667dc0 --- /dev/null +++ b/Sounds/Custom/SCalSounds/BrimstoneShoot.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class BrimstoneShoot : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/BrimstoneShoot.ogg b/Sounds/Custom/SCalSounds/BrimstoneShoot.ogg new file mode 100644 index 0000000000..fce1be6b0b Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrimstoneShoot.ogg differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneSkullSound.cs b/Sounds/Custom/SCalSounds/BrimstoneSkullSound.cs new file mode 100644 index 0000000000..2b6431347c --- /dev/null +++ b/Sounds/Custom/SCalSounds/BrimstoneSkullSound.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class BrimstoneSkullSound : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/BrimstoneSkullSound.ogg b/Sounds/Custom/SCalSounds/BrimstoneSkullSound.ogg new file mode 100644 index 0000000000..0b4c55ce85 Binary files /dev/null and b/Sounds/Custom/SCalSounds/BrimstoneSkullSound.ogg differ diff --git a/Sounds/Custom/SCalSounds/SCalDash.cs b/Sounds/Custom/SCalSounds/SCalDash.cs new file mode 100644 index 0000000000..af843af7e5 --- /dev/null +++ b/Sounds/Custom/SCalSounds/SCalDash.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class SCalDash : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/SCalDash.ogg b/Sounds/Custom/SCalSounds/SCalDash.ogg new file mode 100644 index 0000000000..3b8727578a Binary files /dev/null and b/Sounds/Custom/SCalSounds/SCalDash.ogg differ diff --git a/Sounds/Custom/SCalSounds/SepulcherSpawn.cs b/Sounds/Custom/SCalSounds/SepulcherSpawn.cs new file mode 100644 index 0000000000..45ffb992dd --- /dev/null +++ b/Sounds/Custom/SCalSounds/SepulcherSpawn.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom.SCalSounds +{ + public class SepulcherSpawn : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SCalSounds/SepulcherSpawn.ogg b/Sounds/Custom/SCalSounds/SepulcherSpawn.ogg new file mode 100644 index 0000000000..b0b6e2ccf8 Binary files /dev/null and b/Sounds/Custom/SCalSounds/SepulcherSpawn.ogg differ diff --git a/Sounds/Custom/SupremeCalamitasSpawn.cs b/Sounds/Custom/SupremeCalamitasSpawn.cs new file mode 100644 index 0000000000..48a6293bae --- /dev/null +++ b/Sounds/Custom/SupremeCalamitasSpawn.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SupremeCalamitasSpawn : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1.2f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SupremeCalamitasSpawn.ogg b/Sounds/Custom/SupremeCalamitasSpawn.ogg new file mode 100644 index 0000000000..eaf7921f2e Binary files /dev/null and b/Sounds/Custom/SupremeCalamitasSpawn.ogg differ diff --git a/Sounds/Custom/THanosLaser.cs b/Sounds/Custom/THanosLaser.cs new file mode 100644 index 0000000000..f0d95204a8 --- /dev/null +++ b/Sounds/Custom/THanosLaser.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class THanosLaser : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/THanosLaser.ogg b/Sounds/Custom/THanosLaser.ogg new file mode 100644 index 0000000000..7988df49f1 Binary files /dev/null and b/Sounds/Custom/THanosLaser.ogg differ diff --git a/Sounds/Custom/ThanatosVent.cs b/Sounds/Custom/ThanatosVent.cs new file mode 100644 index 0000000000..0f1a0799d7 --- /dev/null +++ b/Sounds/Custom/ThanatosVent.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class ThanatosVent : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/ThanatosVent.ogg b/Sounds/Custom/ThanatosVent.ogg new file mode 100644 index 0000000000..df12e263a2 Binary files /dev/null and b/Sounds/Custom/ThanatosVent.ogg differ diff --git a/Sounds/Custom/YharonFire.cs b/Sounds/Custom/YharonFire.cs new file mode 100644 index 0000000000..41c010f6b6 --- /dev/null +++ b/Sounds/Custom/YharonFire.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class YharonFire : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/YharonFire.ogg b/Sounds/Custom/YharonFire.ogg new file mode 100644 index 0000000000..e1684f2f2f Binary files /dev/null and b/Sounds/Custom/YharonFire.ogg differ diff --git a/Sounds/Item/OpalStrike.ogg b/Sounds/Item/OpalStrike.ogg index 8a96f1dac2..61b2230825 100644 Binary files a/Sounds/Item/OpalStrike.ogg and b/Sounds/Item/OpalStrike.ogg differ diff --git a/Sounds/Item/PlasmaGrenadeExplosion.cs b/Sounds/Item/PlasmaGrenadeExplosion.cs new file mode 100644 index 0000000000..8d2a7939b7 --- /dev/null +++ b/Sounds/Item/PlasmaGrenadeExplosion.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class PlasmaGrenadeExplosion : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Item/PlasmaGrenadeExplosion.ogg b/Sounds/Item/PlasmaGrenadeExplosion.ogg new file mode 100644 index 0000000000..782b24b685 Binary files /dev/null and b/Sounds/Item/PlasmaGrenadeExplosion.ogg differ diff --git a/Sounds/Item/PwnagehammerHoming.cs b/Sounds/Item/PwnagehammerHoming.cs index 341f6d9b99..79a04d1acf 100644 --- a/Sounds/Item/PwnagehammerHoming.cs +++ b/Sounds/Item/PwnagehammerHoming.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Sounds.Item public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; + soundInstance.Volume = volume * 0.8f; soundInstance.Pan = pan; Main.PlaySoundInstance(soundInstance); return soundInstance; diff --git a/Sounds/Item/PwnagehammerSound.cs b/Sounds/Item/PwnagehammerSound.cs index 7bc2da6813..6be408e339 100644 --- a/Sounds/Item/PwnagehammerSound.cs +++ b/Sounds/Item/PwnagehammerSound.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Sounds.Item public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) { soundInstance = sound.CreateInstance(); - soundInstance.Volume = volume * 1f; + soundInstance.Volume = volume * 0.8f; soundInstance.Pan = pan; Main.PlaySoundInstance(soundInstance); return soundInstance; diff --git a/Sounds/NPCHit/ProvidenceHurt.ogg b/Sounds/NPCHit/ProvidenceHurt.ogg index 167d3fbdf8..52299a9876 100644 Binary files a/Sounds/NPCHit/ProvidenceHurt.ogg and b/Sounds/NPCHit/ProvidenceHurt.ogg differ diff --git a/Sounds/NPCKilled/AstrumDeusDeath.cs b/Sounds/NPCKilled/AstrumDeusDeath.cs new file mode 100644 index 0000000000..cf224248cb --- /dev/null +++ b/Sounds/NPCKilled/AstrumDeusDeath.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCKilled +{ + public class AstralBeaconUse : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCKilled/AstrumDeusDeath.ogg b/Sounds/NPCKilled/AstrumDeusDeath.ogg new file mode 100644 index 0000000000..458739ceee Binary files /dev/null and b/Sounds/NPCKilled/AstrumDeusDeath.ogg differ diff --git a/Sounds/NPCKilled/SepulcherDeath.cs b/Sounds/NPCKilled/SepulcherDeath.cs new file mode 100644 index 0000000000..d4e74ea577 --- /dev/null +++ b/Sounds/NPCKilled/SepulcherDeath.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.NPCKilled +{ + public class SepulcherDeath : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/NPCKilled/SepulcherDeath.ogg b/Sounds/NPCKilled/SepulcherDeath.ogg new file mode 100644 index 0000000000..8da5bc6466 Binary files /dev/null and b/Sounds/NPCKilled/SepulcherDeath.ogg differ diff --git a/TileEntities/TEBaseTurret.cs b/TileEntities/TEBaseTurret.cs index f92b359ffe..41b0160005 100644 --- a/TileEntities/TEBaseTurret.cs +++ b/TileEntities/TEBaseTurret.cs @@ -1,132 +1,245 @@ -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles; using Microsoft.Xna.Framework; using System; using System.IO; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.TileEntities { - public abstract class TEBaseTurret : ModTileEntity - { - public int Time; - public int Direction; - public float Rotation; - public virtual float MaxAngleOffestShootPrompt => MathHelper.ToRadians(35f); - public abstract int ShootWaitTime { get; } - public abstract int ShootRate { get; } - public abstract int ProjectileDamage { get; } - public abstract float ShootSpeed { get; } - public abstract float ShootSpawnOffset { get; } - public abstract float ProjectileKnockback { get; } - public abstract int TileType { get; } - public abstract int ProjectileShot { get; } - public abstract Vector2 ShootCoordsOffset { get; } - public abstract float TargetDistanceCheck { get; } - public void SyncTile() - { - NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); - } - public virtual int AttemptToLocatePlayer(Vector2 shootTargetCoords) - { - int playerIndex = -1; - for (int i = 0; i < Main.player.Length; i++) - { - // Ignore dead/inactive players. They are irrelevant since we're supposed to target a player. - if (!Main.player[i].active || Main.player[i].dead) - continue; - if (Main.player[i].Distance(shootTargetCoords) < TargetDistanceCheck) - { - playerIndex = i; - break; - } - } - return playerIndex; - } - public virtual void AttemptToFireAtPlayer(int playerIndex, Vector2 shootTargetCoords) - { - Player player = Main.player[playerIndex]; - float angleToTarget = (player.Center - shootTargetCoords).ToRotation(); - float idealAngle = angleToTarget + (Direction == -1).ToInt() * MathHelper.Pi; + public abstract class TEBaseTurret : ModTileEntity + { + internal static readonly Vector2 InvalidTarget = new Vector2(float.NaN, float.NaN); - // Adjust the rotation before waiting, and then firing. - if (Time % ShootRate < ShootRate - ShootWaitTime) - { - AimTowardsPlayer(playerIndex, shootTargetCoords, angleToTarget, ref idealAngle); - SyncTile(); // The stupid rotation/direction doesn't sync otherwise. Don't ask me why. - } + // Fields specific to this instance of the turret tile entity + public int FiringTime = 0; + public float Angle = 0f; + public Vector2 TargetPos = InvalidTarget; - // If at the end of the shoot cycle, and the angle offset isn't too far away, fire at the player. - // Think of the angle offset as how close the turret is to aiming 100% perfectly at the player. - if (Time % ShootRate == ShootRate - 1 && Math.Abs(MathHelper.WrapAngle(idealAngle - Rotation)) < MaxAngleOffestShootPrompt) - { - ShootProjectile(shootTargetCoords); - SyncTile(); - } - } - public virtual void AimTowardsPlayer(int playerIndex, Vector2 shootTargetCoords, float angleToTarget, ref float idealAngle) - { - Player player = Main.player[playerIndex]; - int idealDirection = (player.Center.X - shootTargetCoords.X > 0).ToDirectionInt(); + // Tile which hosts this tile entity, and variables relating to it + public abstract int TileType { get; } + public abstract int HostTileWidth { get; } + public abstract int HostTileHeight { get; } - // Adjust the direction if the turret should do so, along with the angle. - if (Direction != idealDirection) - { - Direction = idealDirection; - idealAngle = angleToTarget + (Direction == -1).ToInt() * MathHelper.Pi; - Rotation = Rotation.AngleLerp(idealAngle, 0.4f); // Get a head start in rotating towards the ideal angle. - } - Rotation = Rotation.AngleLerp(idealAngle, 0.1f); - } - public virtual void ShootProjectile(Vector2 shootCoords) - { - float adjustedAngle = Rotation - (Direction == -1).ToInt() * MathHelper.Pi; - Vector2 velocity = adjustedAngle.ToRotationVector2() * ShootSpeed; - Projectile.NewProjectileDirect(shootCoords + adjustedAngle.ToRotationVector2() * ShootSpawnOffset, velocity, ProjectileShot, ProjectileDamage, ProjectileKnockback); - } - public override bool ValidTile(int i, int j) - { - Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == TileType; - } - public override void Update() - { - Vector2 positionWorldCoords = Position.ToVector2() * 16f; - Vector2 shootTargetCoords = positionWorldCoords + ShootCoordsOffset; - int playerIndex = AttemptToLocatePlayer(shootTargetCoords); - if (playerIndex != -1) - { - AttemptToFireAtPlayer(playerIndex, shootTargetCoords); - Time++; - } - else - { - Rotation = Rotation.AngleLerp(0f, 0.25f); - } - } - public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 3); - NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); - return -1; - } - return Place(i, j); - } - public override void NetSend(BinaryWriter writer, bool lightSend) - { - writer.Write(Time); - writer.Write(Direction); - writer.Write(Rotation); - } - public override void NetReceive(BinaryReader reader, bool lightReceive) - { - Time = reader.ReadInt32(); - Direction = reader.ReadInt32(); - Rotation = reader.ReadSingle(); - } - } + // Projectile variables + public abstract int ProjectileType { get; } + public abstract int ProjectileDamage { get; } + public abstract float ProjectileKnockback { get; } + public abstract float ShootSpeed { get; } + public abstract int FiringStartupDelay { get; } + public abstract int FiringUseTime { get; } + + // Projectile spawn location variables + public abstract Vector2 TurretCenterOffset { get; } + protected virtual float ShootForwardsOffset => 0f; + + // Targeting variables + + // If the target is more than this distance away, stop tracking them. + public abstract float MaxRange { get; } + // Subclasses MUST define their own targeting algorithm. + protected abstract Vector2 ChooseTarget(Vector2 targetingCenter); + // If the target is more than this angle away from the turret's current firing direction, don't fire. + protected virtual float MaxTargetAngleDeviance => MathHelper.ToRadians(16f); + // How far can the turret swivel every frame while trying to track a fast target? + protected virtual float MaxDeltaAnglePerFrame => MathHelper.ToRadians(4f); + // At what angle difference does the turret switch from fixed swiveling to lerp aiming? + protected virtual float CloseAimThreshold => MathHelper.ToRadians(8f); + // How effective is the turret's lerp aiming? 1f makes it an aimbot. + protected virtual float CloseAimLerpFactor => 1f; + + // "Calculator" properties which are calculated on the fly for the code. + // Some of these are quite recursive, so if you do call them, store them in locals. + public Vector2 TurretPosition => Position.ToWorldCoordinates(0f, 0f) + TurretCenterOffset; + protected bool TargetIsInvalid => TargetPos.HasNaNs(); + public int Direction => (Math.Cos(Angle) > 0D).ToDirectionInt(); + public virtual float RestingAngle => Direction == -1 ? MathHelper.Pi : 0f; + protected float TargetAngle => TargetIsInvalid ? RestingAngle : (TargetPos - TurretPosition).ToRotation(); + + // This guarantees that Turret tile entities will not persist if not placed directly on some part of their host tile. + public override bool ValidTile(int i, int j) + { + Tile tile = Main.tile[i, j]; + return tile.active() && tile.type == TileType; + } + + #region Update and Turret Behavior + public override void Update() + { + Vector2 turretPos = TurretPosition; + + // ChooseTarget runs every single frame for flexibility. + // If you're storing a target e.g. a player or NPC, do that in your subclass implementation of ChooseTarget. + TargetPos = ChooseTarget(turretPos); + bool validTarget = !TargetIsInvalid; + + // If there is a defined target, then this frame is spent aiming, and maybe even firing! + if (validTarget) + { + ActiveBehavior(turretPos, TargetPos); + FiringTime++; + } + + // Otherwise, reset the running "firing timer" and exhibit passive behavior. + else + { + PassiveBehavior(turretPos); + FiringTime = 0; + } + + UpdateAngle(); + } + + // This function does nothing by default, but turrets can use it if they need to update themselves manually on multiplayer clients. + // Calamity calls this function exactly once per frame. + public virtual void UpdateClient() { } + + // This function runs on both client and server side. Clients run it manually using Tile Entity Time Handler. + // This ensures that turrets aim at players visually in multiplayer without causing a packet storm. + public virtual void UpdateAngle() + { + float targetAngle = TargetAngle; + + // WrapAngle clamps things from -pi to pi, not from 0 to 2pi. + float deltaAngle = MathHelper.WrapAngle(Angle - targetAngle); + bool usingCloseAiming = Math.Abs(deltaAngle) <= Math.Max(CloseAimThreshold, MaxDeltaAnglePerFrame); + + // When far away from its target angle, the turret swivels at a fixed speed towards its exact target angle. + // When close in, the turret switches to lerping. The lerp strength is configurable. Set to 1 for an aimbot. + // Setting the lerp coefficient to be intentionally low makes it easy to dodge shots (albeit narrowly!) without moving super quickly. + Angle = usingCloseAiming + ? Utils.AngleLerp(Angle, targetAngle, CloseAimLerpFactor) + : MathHelper.WrapAngle(Angle - MaxDeltaAnglePerFrame * Math.Sign(deltaAngle)); + } + + // This function does nothing by default, but turrets can use it for flavor behaviors e.g. emitting sparks or beeping. + protected virtual void PassiveBehavior(Vector2 turretPos) {} + + protected virtual void ActiveBehavior(Vector2 turretPos, Vector2 targetPos) + { + // This function won't run without a valid target, so this will always be an angle to a real target. + float targetAngle = TargetAngle; + + // If the turret is too far off its mark or hasn't been around for long enough, don't fire at all. + float deltaAngle = MathHelper.WrapAngle(Angle - targetAngle); + bool angleCloseEnough = Math.Abs(deltaAngle) <= MaxTargetAngleDeviance; + if (!angleCloseEnough || FiringTime < FiringStartupDelay) + return; + + // Don't shoot every frame, but sync up the firing cadence to the startup delay. + if ((FiringTime - FiringStartupDelay) % FiringUseTime == 0) + Shoot(turretPos); + } + + // Orders the turret to fire exactly one projectile at its current heading. + // This function also sends a sync packet. As such, it refuses to run on mutliplayer clients. + public Projectile Shoot(Vector2 turretMuzzlePos, float ai0 = 0f, float ai1 = 0f) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + return null; + + SendSyncPacket(); + + Vector2 angleVec = Angle.ToRotationVector2(); + Vector2 pos = turretMuzzlePos + angleVec * ShootForwardsOffset; + Vector2 velocity = angleVec * ShootSpeed; + return Projectile.NewProjectileDirect(pos, velocity, ProjectileType, ProjectileDamage, ProjectileKnockback, ai0: ai0, ai1: ai1); + } + #endregion + + // This code is called as a hook when the player places the host tile so that the turret tile entity may be placed. + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed tiles in whatever space the host tile occupies. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, HostTileWidth, HostTileHeight); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + + // If in single player, just place the tile entity, no problems. + int id = Place(i, j); + return id; + } + + // This code is called on dedicated servers only. It is the server-side response to MessageID.TileEntityPlacement. + // When the server receives such a message from a client, it sends a MessageID.TileEntitySharing to all clients. + // This will cause them to Place the tile entity locally at that position, all with exactly the same ID. + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + // Normally, a bunch of other TML hooks would go here, namely: + // + // void OnKill() + // TagCompound Save() + // void Load(TagCompound tag) + // + // Subclasses can override these TML hooks as they please. The base turret does not need to use them. + + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(FiringTime); + writer.Write(Angle); + writer.WriteVector2(TargetPos); + } + + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + FiringTime = reader.ReadInt32(); + Angle = reader.ReadSingle(); + TargetPos = reader.ReadVector2(); + } + + protected internal void SendSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.Turret); + packet.Write(ID); + packet.Write(FiringTime); + packet.Write(Angle); + packet.WriteVector2(TargetPos); + WriteExtraData(packet); + packet.Send(-1, -1); + } + + protected internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) + { + int teID = reader.ReadInt32(); + bool exists = ByID.TryGetValue(teID, out TileEntity te); + + // The rest of the packet must be read even if it turns out the turret doesn't exist for whatever reason. + int firingTime = reader.ReadInt32(); + float angle = reader.ReadSingle(); + Vector2 targetVec = reader.ReadVector2(); + + if (exists && te is TEBaseTurret turret) + { + turret.FiringTime = firingTime; + turret.Angle = angle; + turret.TargetPos = targetVec; + turret.ReadExtraData(mod, reader); + return true; + } + else + { + // Otherwise, discard the fixed extra bytes so the message stream doesn't go haywire. + _ = reader.ReadBytes(NumExtraBytes); + return false; + } + } + + // Subclasses cannot override SendSyncPacket, but they can override these functions to sync their own extra data. + // Due to the limitations of TML packets, this data must be exactly 16 bytes in size. + // The default implementations here write 16 bytes of zeroes and dump all 16 bytes when read. + public const int NumExtraBytes = 16; + protected virtual void WriteExtraData(BinaryWriter writer) { + writer.Write(0Lu); + writer.Write(0Lu); + } + protected virtual void ReadExtraData(Mod mod, BinaryReader reader) => _ = reader.ReadBytes(NumExtraBytes); + } } diff --git a/TileEntities/TEChargingStation.cs b/TileEntities/TEChargingStation.cs new file mode 100644 index 0000000000..4749051a2d --- /dev/null +++ b/TileEntities/TEChargingStation.cs @@ -0,0 +1,305 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Tiles.DraedonStructures; +using Microsoft.Xna.Framework; +using System.IO; +using System.Reflection; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.TileEntities +{ + public class TEChargingStation : ModTileEntity + { + public Vector2 Center => Position.ToWorldCoordinates(8f * ChargingStation.Width, 8f * ChargingStation.Height); + private short ChargingTimer = 0; + private short _stack = 0; + public short CellStack + { + get => _stack; + set + { + _stack = value; + SendSyncPacket(); + } + } + public Item PluggedItem = new Item(); + private bool syncItemCharge = false; + public bool ClientChargingDust = false; + + // This returns whether the charging station's inserted ("plugged") item can actually be charged. + private bool PluggedItemCanCharge + { + get + { + if (PluggedItem is null || PluggedItem.IsAir) + return false; + CalamityGlobalItem modItem = PluggedItem.Calamity(); + return modItem.UsesCharge && modItem.Charge < modItem.MaxCharge; + } + } + public bool CanDoWork => _stack > 0 && PluggedItemCanCharge; + + // Red when not actively charging an item, green when charging + public Color LightColor => CanDoWork ? Color.MediumSpringGreen : Color.Red; + + // This guarantees that this tile entity will not persist if not placed directly on the top left corner of a Charging Station tile. + 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; + } + + public override void Update() + { + bool canWork = CanDoWork; + if (!canWork) + { + ChargingTimer = 0; + return; + } + + ++ChargingTimer; + + if (ChargingTimer >= ChargingStation.FramesPerChargeAction) + { + // Apply charge to the plugged item first, as this doesn't send a sync packet. + CalamityGlobalItem modItem = PluggedItem.Calamity(); + modItem.Charge += PowerCell.ChargeValue; + if (modItem.Charge >= modItem.MaxCharge) + modItem.Charge = modItem.MaxCharge; + + SpawnChargingDust(); + + // Set the flag for syncing the plugged item's charge as well. + syncItemCharge = true; + + // Then decrement the cell stack. With the sync flag set, this will sync both the cell stack and the plugged item. + CellStack--; + ChargingTimer = 0; + } + } + + public void SpawnChargingDust() + { + bool chargeComplete = false; + if (!PluggedItem.IsAir) + { + CalamityGlobalItem modItem = PluggedItem.Calamity(); + chargeComplete = modItem.Charge == modItem.MaxCharge; + } + + int dustID = 182; // Mechanical Cart laser dust. Looks epic. + int numDust = 18; + if (chargeComplete) + numDust *= 3; + Vector2 dustPos = Position.ToWorldCoordinates(ChargingStation.Width * 8f - 4f, 1f); + for (int i = 0; i < numDust; i += 2) + { + float pairSpeed = Main.rand.NextFloat(0.5f, 7f); + float pairScale = chargeComplete ? 2.4f : 1f; + + Dust d = Dust.NewDustDirect(dustPos, 0, 0, dustID); + d.velocity = Vector2.UnitX * pairSpeed; + d.scale = pairScale; + d.noGravity = true; + + d = Dust.NewDustDirect(dustPos, 0, 0, dustID); + d.velocity = Vector2.UnitX * -pairSpeed; + d.scale = pairScale; + d.noGravity = true; + } + } + + // This code is called as a hook when the player places the Charging Station tile so that the tile entity may be placed. + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed the 3x2 tiles that make up the Charging Station. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, ChargingStation.Width, ChargingStation.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + + // If in single player, just place the tile entity, no problems. + int id = Place(i, j); + return id; + } + + // This code is called on dedicated servers only. It is the server-side response to MessageID.TileEntityPlacement. + // When the server receives such a message from a client, it sends a MessageID.TileEntitySharing to all clients. + // This will cause them to Place the tile entity locally at that position, all with exactly the same ID. + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + // If this charging station breaks, anyone's who's viewing it is no longer viewing it. + public override void OnKill() + { + for (int i = 0; i < Main.maxPlayers; ++i) + { + Player p = Main.player[i]; + if (!p.active) + continue; + + // Use reflection to stop TML from spitting an error here. + // Try-catching will not stop this error, TML will print it to console anyway. The error is harmless. + ModPlayer[] mpStorageArray = (ModPlayer[])typeof(Player).GetField("modPlayers", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(p); + if (mpStorageArray.Length == 0) + continue; + + CalamityPlayer mp = p.Calamity(); + if (mp.CurrentlyViewedChargerID == ID) + mp.CurrentlyViewedChargerID = -1; + } + } + + public override TagCompound Save() + { + TagCompound ret = new TagCompound + { + { "time", ChargingTimer }, + { "cells", _stack } + }; + Item forSaving; + if (PluggedItem is null) + { + forSaving = new Item(); + forSaving.TurnToAir(); + } + else + forSaving = PluggedItem; + ret.Add("item", forSaving); + return ret; + } + + public override void Load(TagCompound tag) + { + ChargingTimer = tag.GetShort("time"); + _stack = tag.GetShort("cells"); + PluggedItem = ItemIO.Load(tag.GetCompound("item")); + } + + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(ChargingTimer); + writer.Write(_stack); + writer.WriteItem(PluggedItem, true); + } + + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + ChargingTimer = reader.ReadInt16(); + _stack = reader.ReadInt16(); + PluggedItem = reader.ReadItem(true); + } + + // This packet may or may not contain the plugged item's charge value. If it doesn't, it contains a dummy value (NaN) instead. + // The plugged item's charge is synced when syncItemCharge is true. + private void SendSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.ChargingStationStandard); + packet.Write(ID); + packet.Write(ChargingTimer); + packet.Write(_stack); + + // Either write the real charge or garbage data. If garbage data is written it will be ignored on the other end. + CalamityGlobalItem modItem = PluggedItem.IsAir ? null : PluggedItem.Calamity(); + packet.Write(syncItemCharge && modItem != null ? modItem.Charge : float.NaN); + packet.Send(-1, -1); + + // If this flag was set to true, set it to false for any further updates (until it gets set to true again). + syncItemCharge = false; + } + + internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) + { + int teID = reader.ReadInt32(); + bool exists = ByID.TryGetValue(teID, out TileEntity te); + + // The rest of the packet must be read even if it turns out the charging station doesn't exist for whatever reason. + short timer = reader.ReadInt16(); + short cellStack = reader.ReadInt16(); + float chargeOrNaN = reader.ReadSingle(); + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.netMode == NetmodeID.Server) + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.ChargingStationStandard); + packet.Write(teID); + packet.Write(timer); + packet.Write(cellStack); + packet.Write(chargeOrNaN); + packet.Send(-1, -1); + } + + if (exists && te is TEChargingStation charger) + { + // Only clients update their timer from this packet. When a server receives this packet it ignores the time variable. + if (Main.netMode == NetmodeID.MultiplayerClient) + charger.ChargingTimer = timer; + charger._stack = cellStack; + + // If the charge value sent is not garbage, then try to apply the new charge to the plugged item. + if (!float.IsNaN(chargeOrNaN)) + { + bool itemExists = charger.PluggedItem != null && !charger.PluggedItem.IsAir; + CalamityGlobalItem modItem = itemExists ? charger.PluggedItem.Calamity() : null; + if (modItem != null && modItem.UsesCharge) + { + if (modItem.Charge != chargeOrNaN && Main.netMode == NetmodeID.MultiplayerClient) + charger.ClientChargingDust = true; + modItem.Charge = chargeOrNaN; + } + } + return true; + } + return false; + } + + internal void SendItemSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + ModPacket packet = mod.GetPacket(1024); + packet.Write((byte)CalamityModMessageType.ChargingStationItemChange); + packet.Write(ID); + packet.WriteItem(PluggedItem, true); + packet.Send(-1, -1); + } + + internal static bool ReadItemSyncPacket(Mod mod, BinaryReader reader) + { + int teID = reader.ReadInt32(); + bool exists = ByID.TryGetValue(teID, out TileEntity te); + + // The rest of the packet must be read even if it turns out the charging station doesn't exist for whatever reason. + Item thePlug = reader.ReadItem(true); + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.netMode == NetmodeID.Server) + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.ChargingStationItemChange); + packet.Write(teID); + packet.WriteItem(thePlug, true); + packet.Send(-1, -1); + } + + if (exists && te is TEChargingStation charger) + { + charger.PluggedItem = thePlug; + return true; + } + return false; + } + } +} diff --git a/TileEntities/TEDraedonFieldGenerator.cs b/TileEntities/TEDraedonFieldGenerator.cs deleted file mode 100644 index 14014b3024..0000000000 --- a/TileEntities/TEDraedonFieldGenerator.cs +++ /dev/null @@ -1,76 +0,0 @@ -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.TileEntities -{ - public class TEDraedonFieldGenerator : ModTileEntity - { - public int Time; - public int ActiveTimer; - public const int ActiveTimerMax = 45; - public const float Radius = 660f; - public override bool ValidTile(int i, int j) - { - Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == ModContent.TileType(); - } - public override void Update() - { - Player player = Main.player[Player.FindClosest(Position.ToVector2() * 16, 1, 1)]; - Vector2 positionWorldCoords = Position.ToVector2() * 16f; - if (Vector2.Distance(player.Center, positionWorldCoords) < Radius && !player.dead) - { - if (ActiveTimer < ActiveTimerMax) - ActiveTimer++; - Time++; - - if (Time % 75 == 74) - { - float speed = 5f; - Vector2 aimOffset = (player.velocity + player.oldVelocity) * 0.5f * player.Distance(positionWorldCoords) / (speed * speed); - Vector2 velocity = Vector2.Normalize(player.Center - positionWorldCoords + aimOffset) * speed; - Projectile.NewProjectileDirect(positionWorldCoords, velocity, ModContent.ProjectileType(), 27, 4f); - } - if (Time % 150 == 149) - { - for (int i = 0; i < 9; i++) - { - float angle = i / 9f * MathHelper.TwoPi; - Projectile.NewProjectileDirect(positionWorldCoords, Vector2.Normalize(player.Center - positionWorldCoords).RotatedBy(angle) * 7f, ModContent.ProjectileType(), 27, 4f); - } - } - } - else if (ActiveTimer > 0) - { - ActiveTimer--; - ClientToServerSync(); - } - } - public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 3); - NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); - return -1; - } - return Place(i, j); - } - public void ClientToServerSync() - { - if (Main.netMode != NetmodeID.SinglePlayer) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DraedonFieldGeneratorSync); - netMessage.Write(Main.LocalPlayer.Calamity().CurrentlyViewedCharger.ID); - netMessage.Write(Time); - netMessage.Write(ActiveTimer); - netMessage.Send(); - } - } - } -} diff --git a/TileEntities/TEDraedonFuelFactory.cs b/TileEntities/TEDraedonFuelFactory.cs deleted file mode 100644 index 40436191fc..0000000000 --- a/TileEntities/TEDraedonFuelFactory.cs +++ /dev/null @@ -1,118 +0,0 @@ -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Tiles; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; - -namespace CalamityMod.TileEntities -{ - public class TEDraedonFuelFactory : ModTileEntity - { - public int Time = 0; - public Item HeldItem = new Item(); - - public void ClientToServerSync() - { - if (Main.netMode != NetmodeID.SinglePlayer) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DraedonGeneratorStackSync); - netMessage.Write(ID); - netMessage.Write(HeldItem.type); - netMessage.Write(HeldItem.stack); - netMessage.Send(); - } - } - - 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; - } - - public override void Update() - { - if (HeldItem is null || HeldItem.type != ModContent.ItemType()) - { - HeldItem = new Item(); - HeldItem.SetDefaults(ModContent.ItemType()); - HeldItem.stack = 0; - } - HeldItem.favorited = false; - Time++; - // Sometimes the item gets fucked up and it gets a maxStack of 0. Using it as a max can be unreliable as a result. - bool rightTimeToMakeCell = Time % 5 == 4 && Main.tileFrame[Main.tile[Position.X, Position.Y].type] == 43; - if (Main.netMode == NetmodeID.Server) - rightTimeToMakeCell = Time % (DraedonFuelFactory.CellCreationDelay + DraedonFuelFactory.TotalFrames * 5 + 5) == (DraedonFuelFactory.CellCreationDelay + DraedonFuelFactory.TotalFrames * 5 + 4); - if (HeldItem.stack < 999 && rightTimeToMakeCell) - { - HeldItem.stack++; - - // Forcibly sync the tile entity whenever a cell is made. - ClientToServerSync(); - } - } - - // If this factory breaks, anyone who's viewing it is no longer viewing it. - public override void OnKill() - { - for (int i = 0; i < Main.player.Length; i++) - { - if (Main.player[i].Calamity().CurrentlyViewedFactory == this) - Main.player[i].Calamity().CurrentlyViewedFactory = null; - } - base.OnKill(); - } - - public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 5); - NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); - return -1; - } - return Place(i, j); - } - - public override TagCompound Save() - { - TagCompound tag = new TagCompound - { - ["Stack"] = HeldItem.stack, - ["Prefix"] = HeldItem.prefix, - }; - CalamityUtils.SaveModItem(tag, HeldItem); - return tag; - } - - public override void Load(TagCompound tag) - { - HeldItem = CalamityUtils.LoadModItem(tag); - HeldItem.stack = tag.GetInt("Stack"); - HeldItem.prefix = tag.GetByte("Prefix"); - } - - public override void NetSend(BinaryWriter writer, bool lightSend) - { - writer.Write(Time); - writer.Write(HeldItem.type); - writer.Write(HeldItem.stack); - writer.Write(HeldItem.prefix); - } - - public override void NetReceive(BinaryReader reader, bool lightReceive) - { - Time = reader.ReadInt32(); - HeldItem = new Item - { - type = reader.ReadInt32() - }; - HeldItem.SetDefaults(HeldItem.type); - HeldItem.stack = reader.ReadInt32(); - HeldItem.prefix = reader.ReadByte(); - } - } -} diff --git a/TileEntities/TEDraedonHologram.cs b/TileEntities/TEDraedonHologram.cs deleted file mode 100644 index ae6f472a68..0000000000 --- a/TileEntities/TEDraedonHologram.cs +++ /dev/null @@ -1,36 +0,0 @@ -using CalamityMod.Tiles; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.TileEntities -{ - public class TEDraedonHologram : ModTileEntity - { - public bool CloseToPlayer; - public override bool ValidTile(int i, int j) - { - Tile tile = Main.tile[i, j]; - return tile.active() && tile.type == ModContent.TileType(); - } - public override void NetSend(BinaryWriter writer, bool lightSend) - { - writer.Write(CloseToPlayer); - } - public override void NetReceive(BinaryReader reader, bool lightReceive) - { - CloseToPlayer = reader.ReadBoolean(); - } - public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 7); - NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); - return -1; - } - return Place(i, j); - } - } -} diff --git a/TileEntities/TEDraedonItemCharger.cs b/TileEntities/TEDraedonItemCharger.cs deleted file mode 100644 index a6ff86c3e4..0000000000 --- a/TileEntities/TEDraedonItemCharger.cs +++ /dev/null @@ -1,287 +0,0 @@ -using CalamityMod.Items; -using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; - -namespace CalamityMod.TileEntities -{ - public class TEDraedonItemCharger : ModTileEntity - { - #region Spark Class - public class Spark - { - public int Steps; - public Vector2 Start; - public Vector2 End; - public Vector2 CurrentPosition; - public Vector2 Velocity; - public Vector2[] OldPositions = new Vector2[15]; - public const float SparkSpeed = 3.25f; - public void Update() - { - if (Steps > 12) - { - Velocity = Vector2.Lerp(Velocity, Vector2.Normalize(End - CurrentPosition) * SparkSpeed, 0.15f); - } - else if (Main.rand.NextBool(5)) - { - Velocity = Vector2.Normalize(End - CurrentPosition).RotatedByRandom(0.3f) * SparkSpeed; - } - - CurrentPosition += Velocity; - for (int i = OldPositions.Length - 1; i > 0; i--) - { - OldPositions[i] = OldPositions[i - 1]; - } - OldPositions[0] = CurrentPosition; - Steps++; - } - public bool ShouldDestroy() - { - for (int i = 0; i < OldPositions.Length; i++) - { - if (Vector2.Distance(End, OldPositions[i]) > 10f) - return false; - } - return true; - } - } - #endregion - - #region Fields - public int Time; - public int Charge; - public int ChargeMax; - public int ActiveTimer; - public int DepositWithdrawCooldown; - public Item FuelItem = new Item(); - public Item ItemBeingCharged = new Item(); - public Spark[] Sparks = new Spark[9]; - public const int TotalSparkUpdatesPerFrame = 3; - public const int ActiveTimerMax = 30; - - #endregion - - public void ClientToServerSync() - { - if (Main.netMode != NetmodeID.SinglePlayer) - { - var netMessage = CalamityMod.Instance.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DraedonChargerSync); - netMessage.Write(ID); - netMessage.Write(FuelItem.type); - netMessage.Write(FuelItem.stack); - netMessage.WriteVector2(FuelItem.position); - netMessage.Write(ItemBeingCharged.type); - netMessage.Write(ItemBeingCharged.stack); - netMessage.Write(ItemBeingCharged.prefix); - netMessage.WriteVector2(ItemBeingCharged.position); - netMessage.Write(Charge); - netMessage.Write(ChargeMax); - netMessage.Write(ActiveTimer); - netMessage.Write(DepositWithdrawCooldown); - netMessage.Send(); - } - } - public void AttemptToCreateNewSpark() - { - int i = 0; - while (Sparks[i] != null) - { - i++; - if (i >= Sparks.Length) - break; - } - if (i < Sparks.Length) - { - Sparks[i] = new Spark() - { - CurrentPosition = FuelItem.position, - Start = FuelItem.position + Main.rand.NextBool(2).ToDirectionInt() * Vector2.UnitX * 32f, - End = ItemBeingCharged.position + Utils.RandomVector2(Main.rand, -16f, 16f) * new Vector2(1f, 0.2f), - Velocity = Vector2.Normalize(ItemBeingCharged.position - FuelItem.position).RotatedBy(Main.rand.NextFloat(0.9f, 1.4f) * Main.rand.NextBool(2).ToDirectionInt()) * Spark.SparkSpeed - }; - } - } - public void DrawAllSparks(SpriteBatch spriteBatch) - { - Texture2D tinySparkTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); - for (int i = 0; i < Sparks.Length; i++) - { - if (Sparks[i] == null) - continue; - Spark spark = Sparks[i]; - - for (int j = 0; j < TotalSparkUpdatesPerFrame; j++) - { - spark.Update(); - } - - DelegateMethods.c_1 = Color.White; - DelegateMethods.f_1 = 1f; - for (int j = 0; j < spark.OldPositions.Length - 1; j++) - { - float scale = (float)Math.Sin(j / (float)spark.OldPositions.Length * MathHelper.Pi) * 2f; - scale = MathHelper.Clamp(scale, 0.25f, 2f) * 0.1f; - if (spark.OldPositions[j] != Vector2.Zero && - spark.OldPositions[j + 1] != Vector2.Zero) - { - Utils.DrawLaser(spriteBatch, tinySparkTexture, spark.OldPositions[j] - Main.screenPosition, spark.OldPositions[j + 1] - Main.screenPosition, new Vector2(scale), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); - } - } - if (spark.ShouldDestroy()) - { - Sparks[i] = null; - } - } - } - 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; - } - public override void Update() - { - if (FuelItem is null || FuelItem.type != ModContent.ItemType()) - { - FuelItem = new Item(); - FuelItem.SetDefaults(ModContent.ItemType()); - FuelItem.stack = 0; - ClientToServerSync(); - } - if (ItemBeingCharged is null) - { - ItemBeingCharged = new Item(); - ItemBeingCharged.stack = 0; - ClientToServerSync(); - } - FuelItem.favorited = false; - ItemBeingCharged.favorited = false; - Time++; - if (Time % 60 == 0) - { - ClientToServerSync(); - } - if (FuelItem.stack > 0 && - ItemBeingCharged.stack > 0 && - Charge < ChargeMax) - { - if (Time % 25 == 0) - { - for (int i = 0; i < Main.rand.Next(1, 3 + 1); i++) - { - AttemptToCreateNewSpark(); - } - Main.PlaySound(SoundID.Item15, FuelItem.position); - Charge++; - FuelItem.stack--; - ClientToServerSync(); - } - if (ActiveTimer < ActiveTimerMax) - ActiveTimer++; - } - else if (ActiveTimer > 0) ActiveTimer--; - - if (DepositWithdrawCooldown > 0) - DepositWithdrawCooldown--; - } - public override void OnKill() - { - if (Main.LocalPlayer.Calamity().CurrentlyViewedCharger == this) - Main.LocalPlayer.Calamity().CurrentlyViewedCharger = null; - base.OnKill(); - } - public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(Main.myPlayer, i, j, 5); - NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type, 0f, 0, 0, 0); - return -1; - } - return Place(i, j); - } - public override void NetSend(BinaryWriter writer, bool lightSend) - { - writer.Write(ID); - writer.Write(FuelItem.type); - writer.Write(FuelItem.stack); - writer.WriteVector2(FuelItem.position); - writer.Write(ItemBeingCharged.type); - writer.Write(ItemBeingCharged.stack); - writer.Write(ItemBeingCharged.prefix); - writer.WriteVector2(ItemBeingCharged.position); - writer.Write(Charge); - writer.Write(ChargeMax); - writer.Write(ActiveTimer); - } - public override void NetReceive(BinaryReader reader, bool lightReceive) - { - ID = reader.ReadInt32(); - FuelItem = new Item - { - type = reader.ReadInt32() - }; - FuelItem.SetDefaults(FuelItem.type); - FuelItem.stack = reader.ReadInt32(); - FuelItem.position = reader.ReadVector2(); - ItemBeingCharged.SetDefaults(reader.ReadInt32()); - ItemBeingCharged.stack = reader.ReadInt32(); - ItemBeingCharged.prefix = reader.ReadByte(); - ItemBeingCharged.position = reader.ReadVector2(); - Charge = reader.ReadInt32(); - ChargeMax = reader.ReadInt32(); - ActiveTimer = reader.ReadInt32(); - } - public override TagCompound Save() - { - TagCompound tag = new TagCompound - { - ["ID"] = ID, // Don't ask me why, but the ID doesn't get saved in MP otherwise. - ["StackFuel"] = FuelItem.stack, - ["PrefixFuel"] = FuelItem.prefix, - ["NetIDFuel"] = FuelItem.active && FuelItem.stack > 0 ? FuelItem.netID : 0, - ["FuelPosition"] = FuelItem.position, - - ["StackNotFuel"] = ItemBeingCharged.stack, - ["PrefixNotFuel"] = ItemBeingCharged.prefix, - ["PositionNotFuel"] = ItemBeingCharged.position, - ["Charge"] = Charge, - ["ChargeMax"] = ChargeMax, - ["NetIDNotFuel"] = ItemBeingCharged.active && FuelItem.stack > 0 ? FuelItem.netID : 0 - }; - CalamityUtils.SaveModItem(tag, FuelItem, 0); - CalamityUtils.SaveModItem(tag, ItemBeingCharged, 1); - return tag; - } - public override void Load(TagCompound tag) - { - ID = tag.GetInt("ID"); - FuelItem = CalamityUtils.LoadModItem(tag, 0); - FuelItem.stack = tag.GetInt("StackFuel"); - FuelItem.prefix = tag.GetByte("PrefixFuel"); - FuelItem.netID = tag.GetInt("NetIDFuel"); - FuelItem.position = tag.Get("FuelPosition"); - - ItemBeingCharged = CalamityUtils.LoadModItem(tag, 1); - ItemBeingCharged.stack = tag.GetInt("StackNotFuel"); - ItemBeingCharged.prefix = tag.GetByte("PrefixNotFuel"); - ItemBeingCharged.position = tag.Get("PositionNotFuel"); - if (ItemBeingCharged.type > ItemID.Count) - { - Charge = tag.GetInt("Charge"); - ChargeMax = tag.GetInt("ChargeMax"); - } - ItemBeingCharged.netID = tag.GetInt("NetIDNotFuel"); - } - } -} diff --git a/TileEntities/TEDraedonLabTurret.cs b/TileEntities/TEDraedonLabTurret.cs new file mode 100644 index 0000000000..abf7241696 --- /dev/null +++ b/TileEntities/TEDraedonLabTurret.cs @@ -0,0 +1,137 @@ +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles.DraedonStructures; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public class TEDraedonLabTurret : TEBaseTurret + { + // Tile which hosts this tile entity + public override int TileType => ModContent.TileType(); + public override int HostTileWidth => DraedonLabTurret.Width; + public override int HostTileHeight => DraedonLabTurret.Height; + + // Projectile variables + public override int ProjectileType => ModContent.ProjectileType(); + public override int ProjectileDamage => Main.expertMode ? 14 : 20; + public override float ProjectileKnockback => 6.5f; + public override float ShootSpeed => 5f; + public override int FiringStartupDelay => 10; + public override int FiringUseTime => 20; + + // Projectile spawn location variables + public override Vector2 TurretCenterOffset => new Vector2(22f + 4f * Direction, -2f); + protected override float ShootForwardsOffset => 6f; + + // Targeting variables + public override float MaxRange => 600f; + protected override float MaxTargetAngleDeviance => MathHelper.ToRadians(12f); + protected override float MaxDeltaAnglePerFrame => MathHelper.ToRadians(2f); + protected override float CloseAimThreshold => MathHelper.ToRadians(12f); + protected override float CloseAimLerpFactor => 0.08f; + + // Variables specific to this turret subclass + private int _playerTargetIndex = -1; + public int PlayerTargetIndex + { + get => _playerTargetIndex; + set + { + bool sync = _playerTargetIndex != value; + _playerTargetIndex = value; + if (sync) + SendSyncPacket(); + } + } + + // Lab turrets specifically must be placed on the top left corner of their host tile. + // This restriction is not shared by general turrets for flexibility reasons. + 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; + } + + protected override Vector2 ChooseTarget(Vector2 targetingCenter) + { + // Store the value that will be set into PlayerTargetIndex here. + // This local is used because changing the actual field will trigger a netcode auto-sync. + int indexToSet = PlayerTargetIndex; + + // If a player is already targeted, make sure they still exist and aren't dead. + if (indexToSet != -1) + { + Player p = Main.player[PlayerTargetIndex]; + + // If they don't exist, or are dead, then unmark them as a target and search for a new one. + if (!p.active || p.dead) + indexToSet = -1; + else + { + // If the existing target player is close enough, return their position. Otherwise unmark them as a target. + Vector2 playerPos = p.Center; + float distSQ = Vector2.DistanceSquared(targetingCenter, playerPos); + if (distSQ <= MaxRange * MaxRange) + return playerPos; + else + indexToSet = -1; + } + } + + // No valid target currently exists. Loop through players (efficiently!) to look for the closest new target. + Vector2 ret = InvalidTarget; + float distSQToBeat = MaxRange * MaxRange; + + for (int i = 0; i < Main.maxPlayers; ++i) + { + Player p = Main.player[i]; + if (!p.active || p.dead) + continue; + + float distSQ = p.DistanceSQ(targetingCenter); + if (distSQ < distSQToBeat) + { + distSQToBeat = distSQ; + ret = p.Center; + indexToSet = i; + } + } + + // Set PlayerTargetIndex now that we're sure what we're targeting. This triggers a netcode sync if the value is different. + PlayerTargetIndex = indexToSet; + return ret; + } + + // Makes turrets track their targeted player correctly client side. + // This doesn't improve their actual accuracy, because they only fire server side. + // However, it makes them rotate much more smoothly. + // Any targeting and rotation data derived from this update will be overridden by the turret's next sync. + public override void UpdateClient() + { + if (PlayerTargetIndex != -1) + { + Player p = Main.player[PlayerTargetIndex]; + if (p.active && !p.dead) + TargetPos = p.Center; + } + } + + // This type of turret syncs extra data: its player target index. + // This only takes 2 bytes so a junk array is written for the remainder of the space. + private const int BytesUsed = 2; + private static readonly byte[] JunkData = new byte[] { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA }; + protected override void WriteExtraData(BinaryWriter writer) + { + writer.Write((short)_playerTargetIndex); + writer.Write(JunkData); + } + protected override void ReadExtraData(Mod mod, BinaryReader reader) + { + _playerTargetIndex = reader.ReadInt16(); + _ = reader.ReadBytes(NumExtraBytes - BytesUsed); + } + } +} diff --git a/TileEntities/TEDraedonTurret.cs b/TileEntities/TEDraedonTurret.cs deleted file mode 100644 index c00656ed1d..0000000000 --- a/TileEntities/TEDraedonTurret.cs +++ /dev/null @@ -1,21 +0,0 @@ -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Tiles; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.TileEntities -{ - public class TEDraedonTurret : TEBaseTurret - { - public override int ShootWaitTime => 15; - public override int ShootRate => 90; - public override int ProjectileDamage => 20; - public override float ShootSpeed => 5f; - public override float ShootSpawnOffset => 32f; - public override float ProjectileKnockback => 3f; - public override int TileType => ModContent.TileType(); - public override int ProjectileShot => ModContent.ProjectileType(); - public override Vector2 ShootCoordsOffset => new Vector2(22f + 4f * Direction, -2f); - public override float TargetDistanceCheck => 600f; - } -} diff --git a/TileEntities/TELabHologramProjector.cs b/TileEntities/TELabHologramProjector.cs new file mode 100644 index 0000000000..aaaa91d535 --- /dev/null +++ b/TileEntities/TELabHologramProjector.cs @@ -0,0 +1,126 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Tiles.DraedonStructures; +using Microsoft.Xna.Framework; +using System.IO; +using System.Reflection; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public class TELabHologramProjector : ModTileEntity + { + public const float PopupDistance = 560f; + + public Vector2 Center => Position.ToWorldCoordinates(LabHologramProjector.Width * 8f, LabHologramProjector.Height * 8f); + public bool PoppingUp = false; + + 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; + } + + // Check if the hologram should become visible. + public override void Update() + { + bool wasPoppingUp = PoppingUp; + + // Stop popping up by default. + PoppingUp = false; + + // But check if a player is nearby. + // If one is, pop up. + Vector2 projectorCenterPos = Center; + float distSQ = PopupDistance * PopupDistance; + for(int i = 0; i < Main.maxPlayers; ++i) + { + Player p = Main.player[i]; + if (!p.active) // The lack of a dead check is intentional. Dead players keep hologram boxes on for amusement. + continue; + if (p.DistanceSQ(projectorCenterPos) < distSQ) + { + PoppingUp = true; + break; + } + } + + if (PoppingUp != wasPoppingUp) + SendSyncPacket(); + } + + // This code is called as a hook when the player places the Lab Hologram Projector tile so that the tile entity may be placed. + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed the 6x7 tiles that make up the Lab Hologram Projector. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, LabHologramProjector.Width, LabHologramProjector.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + return Place(i, j); + } + + // Sync the tile entity the moment it is place on the server. + // This is done to cause it to register among all clients. + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + // If this projector breaks, anyone who's viewing it is no longer viewing it. + public override void OnKill() + { + for (int i = 0; i < Main.maxPlayers; ++i) + { + Player p = Main.player[i]; + if (!p.active) + continue; + + // Use reflection to stop TML from spitting an error here. + // Try-catching will not stop this error, TML will print it to console anyway. The error is harmless. + ModPlayer[] mpStorageArray = (ModPlayer[])typeof(Player).GetField("modPlayers", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(p); + if (mpStorageArray.Length == 0) + continue; + + CalamityPlayer mp = p.Calamity(); + if (mp.CurrentlyViewedHologramID == ID) + { + mp.CurrentlyViewedHologramID = -1; + mp.CurrentlyViewedHologramText = string.Empty; + } + } + } + + public override void NetSend(BinaryWriter writer, bool lightSend) => writer.Write(PoppingUp); + public override void NetReceive(BinaryReader reader, bool lightReceive) => PoppingUp = reader.ReadBoolean(); + + private void SendSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.LabHologramProjector); + packet.Write(ID); + packet.Write(PoppingUp); + packet.Send(-1, -1); + } + + internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) + { + int teID = reader.ReadInt32(); + bool exists = ByID.TryGetValue(teID, out TileEntity te); + + // The rest of the packet must be read even if it turns out the projector doesn't exist for whatever reason. + bool pop = reader.ReadBoolean(); + + if (exists && te is TELabHologramProjector projector) + { + projector.PoppingUp = pop; + return true; + } + return false; + } + } +} diff --git a/TileEntities/TEPowerCellFactory.cs b/TileEntities/TEPowerCellFactory.cs new file mode 100644 index 0000000000..64517e90d9 --- /dev/null +++ b/TileEntities/TEPowerCellFactory.cs @@ -0,0 +1,191 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Tiles.DraedonStructures; +using Microsoft.Xna.Framework; +using System.IO; +using System.Reflection; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using CalamityMod.Items.DraedonMisc; + +namespace CalamityMod.TileEntities +{ + public class TEPowerCellFactory : ModTileEntity + { + public Vector2 Center => Position.ToWorldCoordinates(8f * PowerCellFactory.Width, 8f * PowerCellFactory.Height); + public long Time = 0; + private short _stack = 0; + + public short CellStack + { + get => _stack; + set + { + _stack = value; + SendSyncPacket(); + } + } + + private long CycleFrameCounter + { + get + { + long totalCycleTime = PowerCellFactory.BetweenCellDowntime + PowerCellFactory.TotalFrames * PowerCellFactory.AnimationFramerate; + return Time % totalCycleTime; + } + } + + private bool IsCellFrame + { + get + { + long magicFrame = PowerCellFactory.BetweenCellDowntime + PowerCellFactory.CellCreateFrame * PowerCellFactory.AnimationFramerate + PowerCellFactory.MagicFrameDelay; + return CycleFrameCounter == magicFrame; + } + } + + // Property which allows anyone to get the current animation frame of this specific factory. + public int AnimationFrame + { + get + { + int f = (int)CycleFrameCounter; + + // The animation sticks on the last frame throughout the entire downtime period. + if (f < PowerCellFactory.BetweenCellDowntime) + return PowerCellFactory.TotalFrames - 1; + + // Remove the starting downtime period for the framerate divisor calculation. + return (f - PowerCellFactory.BetweenCellDowntime) / PowerCellFactory.AnimationFramerate; + } + } + + // This guarantees that this tile entity will not persist if not placed directly on the top left corner of a Power Cell Factory tile. + 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; + } + + public override void Update() + { + ++Time; + int maxCellStack = ModContent.GetModItem(ModContent.ItemType()).item.maxStack; + if (IsCellFrame && CellStack < maxCellStack) + // The property setter will automatically send the necessary packet. + CellStack++; + } + + // This code is called as a hook when the player places the Power Cell Factory tile so that the tile entity may be placed. + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction) + { + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed the 4x4 tiles that make up the Power Cell Factory. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileRange(Main.myPlayer, i, j, PowerCellFactory.Width, PowerCellFactory.Height); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, i, j, Type); + return -1; + } + + // If in single player, just place the tile entity, no problems. + int id = Place(i, j); + return id; + } + + // This code is called on dedicated servers only. It is the server-side response to MessageID.TileEntityPlacement. + // When the server receives such a message from a client, it sends a MessageID.TileEntitySharing to all clients. + // This will cause them to Place the tile entity locally at that position, all with exactly the same ID. + public override void OnNetPlace() => NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + + // If this factory breaks, anyone who's viewing it is no longer viewing it. + public override void OnKill() + { + for (int i = 0; i < Main.maxPlayers; ++i) + { + Player p = Main.player[i]; + if (!p.active) + continue; + + // Use reflection to stop TML from spitting an error here. + // Try-catching will not stop this error, TML will print it to console anyway. The error is harmless. + ModPlayer[] mpStorageArray = (ModPlayer[])typeof(Player).GetField("modPlayers", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(p); + if (mpStorageArray.Length == 0) + continue; + + CalamityPlayer mp = p.Calamity(); + if (mp.CurrentlyViewedFactoryID == ID) + mp.CurrentlyViewedFactoryID = -1; + } + } + + public override TagCompound Save() => new TagCompound + { + { "time", Time }, + { "cells", _stack } + }; + + public override void Load(TagCompound tag) + { + Time = tag.GetLong("time"); + _stack = tag.GetShort("cells"); + } + + public override void NetSend(BinaryWriter writer, bool lightSend) + { + writer.Write(Time); + writer.Write(_stack); + } + + public override void NetReceive(BinaryReader reader, bool lightReceive) + { + Time = reader.ReadInt64(); + _stack = reader.ReadInt16(); + } + + private void SendSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.PowerCellFactory); + packet.Write(ID); + packet.Write(Time); + packet.Write(_stack); + packet.Send(-1, -1); + } + + internal static bool ReadSyncPacket(Mod mod, BinaryReader reader) + { + int teID = reader.ReadInt32(); + bool exists = ByID.TryGetValue(teID, out TileEntity te); + + // The rest of the packet must be read even if it turns out the factory doesn't exist for whatever reason. + long time = reader.ReadInt64(); + short cellStack = reader.ReadInt16(); + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.netMode == NetmodeID.Server) + { + ModPacket packet = mod.GetPacket(); + packet.Write((byte)CalamityModMessageType.PowerCellFactory); + packet.Write(teID); + packet.Write(time); + packet.Write(cellStack); + packet.Send(-1, -1); + } + + if (exists && te is TEPowerCellFactory factory) + { + // Only clients update their timer from this packet. When a server receives this packet it ignores the time variable. + if (Main.netMode == NetmodeID.MultiplayerClient) + factory.Time = time; + factory._stack = cellStack; + return true; + } + return false; + } + } +} diff --git a/TileEntities/TileEntityTimeHandler.cs b/TileEntities/TileEntityTimeHandler.cs new file mode 100644 index 0000000000..eadc860b7d --- /dev/null +++ b/TileEntities/TileEntityTimeHandler.cs @@ -0,0 +1,62 @@ +using Steamworks; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.TileEntities +{ + public static class TileEntityTimeHandler + { + public static void Update() + { + MultiplayerClientUpdateVisuals(); + } + private static void MultiplayerClientUpdateVisuals() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + return; + + byte factoryType = ModContent.GetInstance().type; + byte chargerType = ModContent.GetInstance().type; + + var enumerator = TileEntity.ByID.Values.GetEnumerator(); + do + { + TileEntity te = enumerator.Current; + if (te == null) + continue; + + if (te.type == factoryType) + { + // Specifically on multiplayer clients, manually update the time variables of Power Cell Factories every frame. + // This makes sure they animate. It will NOT produce cells; that code can only run server side. + // Time is manually synced from the server every time a cell is created, so even under heavy lag they cannot stay desynced indefinitely. + TEPowerCellFactory factory = (TEPowerCellFactory)te; + ++factory.Time; + } + else if (te.type == chargerType) + { + // Specifically on multiplayer clients, produce charging dust when the "should dust" flag is set by the most recent sync packet. + // This makes sure they produce charging dust for all clients. It will NOT actually charge items; that code can only run server side. + TEChargingStation charger = (TEChargingStation)te; + + if (charger.ClientChargingDust && charger.CanDoWork) + { + charger.ClientChargingDust = false; + charger.SpawnChargingDust(); + } + } + else if (te is TEBaseTurret turret) + { + // Perform any client-specific update tasks for this turret. + turret.UpdateClient(); + + // Specifically on multiplayer clients, manually update the turret's rotation every frame. This is exactly the same code run server side. + // This makes sure they visually track targets in multiplayer. It will NOT fire projectiles; that code can only run server side. + turret.UpdateAngle(); + } + } while (enumerator.MoveNext()); + } + } +} diff --git a/Tiles/Abyss/AcidWoodTree.png b/Tiles/Abyss/AcidWoodTree.png index a8d7c10bcd..fd3cd4d235 100644 Binary files a/Tiles/Abyss/AcidWoodTree.png and b/Tiles/Abyss/AcidWoodTree.png differ diff --git a/Tiles/Abyss/AcidWoodTreeSapling.png b/Tiles/Abyss/AcidWoodTreeSapling.png index a462af14c2..922b5adf61 100644 Binary files a/Tiles/Abyss/AcidWoodTreeSapling.png and b/Tiles/Abyss/AcidWoodTreeSapling.png differ diff --git a/Tiles/Abyss/AcidWoodTreeTops.png b/Tiles/Abyss/AcidWoodTreeTops.png index 4d803745c0..98c52ac4d1 100644 Binary files a/Tiles/Abyss/AcidWoodTreeTops.png and b/Tiles/Abyss/AcidWoodTreeTops.png differ diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index 96246262f5..5009eeb8b5 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Tiles.Abyss dustType = 32; drop = ModContent.ItemType(); AddMapEntry(new Color(76, 58, 59)); - mineResist = 1f; - minPick = 55; + mineResist = 1.45f; soundType = SoundID.Dig; } diff --git a/Tiles/Abyss/RustyChestTile.cs b/Tiles/Abyss/RustyChestTile.cs index 4111461e82..1459eb9784 100644 --- a/Tiles/Abyss/RustyChestTile.cs +++ b/Tiles/Abyss/RustyChestTile.cs @@ -28,29 +28,7 @@ namespace CalamityMod.Tiles.Abyss public override bool HasSmartInteract() => true; - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; - - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - if (chest == -1) - return name; - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/Abyss/SteamGeyser.cs b/Tiles/Abyss/SteamGeyser.cs index 9c0d254bc1..4076a5362a 100644 --- a/Tiles/Abyss/SteamGeyser.cs +++ b/Tiles/Abyss/SteamGeyser.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.Abyss { float yeetSpeed = MathHelper.Clamp(10f - (10f * Math.Abs(Main.LocalPlayer.Bottom.Y - j * 16) / 300f), 0f, 10f); Main.LocalPlayer.velocity.Y -= yeetSpeed; - Projectile.NewProjectile(i * 16 + 8, j * 16 - 20, 0f, -10f, ModContent.ProjectileType(), 25, 0f); + Projectile.NewProjectile(i * 16 + 8, j * 16 - 20, 0f, -10f, ModContent.ProjectileType(), Main.expertMode ? 12 : 15, 0f); } } } diff --git a/Tiles/Abyss/SulphurousCactus.cs b/Tiles/Abyss/SulphurousCactus.cs new file mode 100644 index 0000000000..f517239b1a --- /dev/null +++ b/Tiles/Abyss/SulphurousCactus.cs @@ -0,0 +1,10 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Abyss +{ + public class SulphurousCactus : ModCactus + { + public override Texture2D GetTexture() => ModContent.GetTexture("CalamityMod/Tiles/Abyss/SulphurousCactus"); + } +} diff --git a/Tiles/Abyss/SulphurousCactus.png b/Tiles/Abyss/SulphurousCactus.png new file mode 100644 index 0000000000..a19d1b55d2 Binary files /dev/null and b/Tiles/Abyss/SulphurousCactus.png differ diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 8b64748158..4b71230ae7 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -22,9 +22,9 @@ namespace CalamityMod.Tiles.Abyss drop = ModContent.ItemType(); AddMapEntry(new Color(150, 100, 50)); mineResist = 1f; - minPick = 55; soundType = SoundID.Dig; SetModPalmTree(new AcidWoodTree()); + SetModCactus(new SulphurousCactus()); } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index 4427a0dd15..d6f296f702 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Tiles.Abyss dustType = 32; drop = ModContent.ItemType(); AddMapEntry(new Color(113, 90, 71)); - mineResist = 1f; - minPick = 55; + mineResist = 1.2f; soundType = SoundID.Dig; } diff --git a/Tiles/Abyss/Tenebris.cs b/Tiles/Abyss/Tenebris.cs index 8a1297511f..f79e20827d 100644 --- a/Tiles/Abyss/Tenebris.cs +++ b/Tiles/Abyss/Tenebris.cs @@ -1,4 +1,3 @@ -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -27,12 +26,12 @@ namespace CalamityMod.Tiles.Abyss soundType = SoundID.Tink; } - public override bool CanExplode(int i, int j) - { - return NPC.downedPlantBoss || CalamityWorld.downedCalamitas; - } + public override bool CanExplode(int i, int j) + { + return false; + } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 3a6d4c379c..a504c42a61 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -9,8 +9,12 @@ namespace CalamityMod.Tiles.Abyss { public class Voidstone : ModTile { + internal static Texture2D GlowTexture; public override void SetDefaults() { + if (!Main.dedServ) + GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Abyss/Voidstone_Glowmask"); + Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; @@ -131,6 +135,9 @@ namespace CalamityMod.Tiles.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (GlowTexture is null) + return; + int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; int xOffset = 0; @@ -221,19 +228,18 @@ namespace CalamityMod.Tiles.Abyss } xOffset *= 288; xPos += xOffset; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Abyss/Voidstone_Glowmask"); 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)); Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; + if (!trackTile.halfBrick() && trackTile.slope() == 0) { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (trackTile.halfBrick()) { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } diff --git a/Tiles/AerialiteBarTile.cs b/Tiles/AerialiteBarTile.cs new file mode 100644 index 0000000000..103d7180ca --- /dev/null +++ b/Tiles/AerialiteBarTile.cs @@ -0,0 +1,54 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AerialiteBarTile : ModTile + { + public override void SetDefaults() + { + Main.tileShine[Type] = 1000; + Main.tileSolid[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + dustType = 187; + drop = ModContent.ItemType(); + + AddMapEntry(new Color(141, 232, 246)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + if (Main.rand.NextBool(2)) + { + type = 187; + } + else + { + type = 16; + } + return true; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/AerialiteBarTile.png b/Tiles/AerialiteBarTile.png new file mode 100644 index 0000000000..8985bb2d66 Binary files /dev/null and b/Tiles/AerialiteBarTile.png differ diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs index 44369421e9..70285acf2c 100644 --- a/Tiles/Astral/AstralBeacon.cs +++ b/Tiles/Astral/AstralBeacon.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.SummonItems; @@ -56,7 +57,7 @@ namespace CalamityMod.Tiles.Astral !Main.LocalPlayer.HasItem(ModContent.ItemType())) return true; - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(ModContent.NPCType()) || BossRushEvent.BossRushActive) return true; if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) @@ -66,19 +67,15 @@ namespace CalamityMod.Tiles.Astral if (Main.dayTime) { - string localizationKey = "Mods.CalamityMod.DeusAltarRejectNightText"; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(localizationKey), FailColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(localizationKey), FailColor); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.DeusAltarRejectNightText", FailColor); return false; } Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); ritualSpawnPosition += new Vector2(0f, -24f); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ProvidenceHolyRay"), ritualSpawnPosition); - Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Main.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) Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); diff --git a/Tiles/Astral/AstralChestLocked.cs b/Tiles/Astral/AstralChestLocked.cs index af401183b3..dd49aa368d 100644 --- a/Tiles/Astral/AstralChestLocked.cs +++ b/Tiles/Astral/AstralChestLocked.cs @@ -13,9 +13,15 @@ namespace CalamityMod.Tiles.Astral public override void SetDefaults() { this.SetUpChest(); + ModTranslation name = CreateMapEntryName("chestAstral"); name.SetDefault("Astral Chest"); AddMapEntry(new Color(174, 129, 92), name, MapChestName); + + name = CreateMapEntryName("chestAstral_Locked"); + name.SetDefault("Locked Astral Chest"); + AddMapEntry(new Color(174, 129, 92), name, MapChestName); + dustType = ModContent.DustType(); disableSmartCursor = true; adjTiles = new int[] { TileID.Containers }; @@ -37,27 +43,9 @@ namespace CalamityMod.Tiles.Astral return true; } - public string MapChestName(string name, int i, int j) - { - // Bounds check - if (i < 0 || i >= Main.maxTilesX || j < 0 || j >= Main.maxTilesY) - return name; + public override ushort GetMapOption(int i, int j) => (ushort)(Main.tile[i, j].frameX / 36); - // Tile null check - Tile tile = Main.tile[i, j]; - if (tile is null) - return name; - - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - return name + (Main.chest[chest].name != "" ? ": " + Main.chest[chest].name : ""); - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/AuricTeslaBar.cs b/Tiles/AuricTeslaBar.cs new file mode 100644 index 0000000000..bb47525683 --- /dev/null +++ b/Tiles/AuricTeslaBar.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class AuricTeslaBar : ModTile + { + public override void SetDefaults() + { + Main.tileShine[Type] = 1000; + Main.tileSolid[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + dustType = ModContent.DustType(); + drop = ModContent.ItemType(); + + AddMapEntry(new Color(255, 227, 81)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + type = ModContent.DustType(); + return true; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/AuricTeslaBar.png b/Tiles/AuricTeslaBar.png new file mode 100644 index 0000000000..489ba90d76 Binary files /dev/null and b/Tiles/AuricTeslaBar.png differ diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 7177990aa9..c8971770ab 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Events; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Environment; @@ -6,6 +7,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using CalamityMod.World; @@ -20,24 +22,24 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles { - public class CalamityGlobalTile : GlobalTile - { - public static IList WaterStyles => (IList)typeof(WaterStyleLoader).GetField("waterStyles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); + public class CalamityGlobalTile : GlobalTile + { + public static IList WaterStyles => (IList)typeof(WaterStyleLoader).GetField("waterStyles", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); public static ushort[] PlantTypes = new ushort[] - { - TileID.Plants, - TileID.CorruptPlants, - TileID.JunglePlants, - TileID.MushroomPlants, - TileID.Plants2, - TileID.JunglePlants2, - TileID.HallowedPlants, - TileID.HallowedPlants2, - TileID.FleshWeeds, - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType() - }; + { + TileID.Plants, + TileID.CorruptPlants, + TileID.JunglePlants, + TileID.MushroomPlants, + TileID.Plants2, + TileID.JunglePlants2, + TileID.HallowedPlants, + TileID.HallowedPlants2, + TileID.FleshWeeds, + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType() + }; public static List GrowthTiles = new List { @@ -46,121 +48,163 @@ namespace CalamityMod.Tiles (ushort)ModContent.TileType() }; + public override void SetDefaults() + { + Main.tileSpelunker[TileID.LunarOre] = true; + Main.tileValue[TileID.LunarOre] = 900; + } + public override bool PreHitWire(int i, int j, int type) { - return !CalamityWorld.bossRushActive; + return !BossRushEvent.BossRushActive; } public override bool TileFrame(int i, int j, int type, ref bool resetFrame, ref bool noBreak) - { - // Custom plant framing - for (int k = 0; k < PlantTypes.Length; k++) - if (type == PlantTypes[k]) - { - TileFraming.PlantFrame(i, j); - return false; - } + { + // Custom plant framing + for (int k = 0; k < PlantTypes.Length; k++) + if (type == PlantTypes[k]) + { + TileFraming.PlantFrame(i, j); + return false; + } - // Custom vine framing - if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType()) - { - TileFraming.VineFrame(i, j); - return false; - } - return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); - } + // Custom vine framing + if (type == TileID.Vines || type == TileID.CrimsonVines || type == TileID.HallowedVines || type == ModContent.TileType()) + { + TileFraming.VineFrame(i, j); + return false; + } + return base.TileFrame(i, j, type, ref resetFrame, ref noBreak); + } - public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) - { - // Guaranteed not null at this point - Tile tile = Main.tile[i, j]; + public override void PostDraw(int i, int j, int type, SpriteBatch spriteBatch) + { + // Guaranteed not null at this point + Tile tile = Main.tile[i, j]; - // This function is only for Astral Cactus. If the tile isn't even cactus, forget about it. - if (type != TileID.Cactus) - return; - - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - if (Main.drawToScreen) - zero = Vector2.Zero; - int frameX = tile.frameX; - int frameY = tile.frameY; - - // Search down the cactus to find out whether the block it is planted in is Astral Sand. - bool astralCactus = false; - if (!Main.canDrawColorTile(i, j)) - { - int xTile = i; - if (frameX == 36) // Cactus segment which splits left - xTile--; - if (frameX == 54) // Cactus segment which splits right - xTile++; - if (frameX == 108) // Cactus segment which splits both directions - 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) - { - if (Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active()) - { - slidingDownCactus = true; - } - yTile++; - // Cacti are assumed to be no more than 20 blocks tall. - if (yTile > i + 20) - break; - } - astralCactus = Main.tile[xTile, yTile].type == (ushort)ModContent.TileType(); - } - - // If it is actually astral cactus, then draw its glowmask. - if (astralCactus) - { - spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); - } - } - - // This function exists only to shatter adjacent Lumenyl or Sea Prism crystals when a neighboring solid tile is destroyed. - public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) - { - Tile tile = Main.tile[i, j]; - if(tile is null) + // This function is only for Astral Cactus. If the tile isn't even cactus, forget about it. + if (type != TileID.Cactus) return; - // Helper function to shatter crystals attached to neighboring solid tiles. - void CheckShatterCrystal(int xPos, int yPos) - { - 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))) - { - WorldGen.KillTile(xPos, yPos, false, false, false); - if (!Main.tile[xPos, yPos].active() && Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, xPos, yPos, 0f, 0, 0, 0); - } - } - - // 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()) - { - CheckShatterCrystal(i + 1, j); - CheckShatterCrystal(i - 1, j); - CheckShatterCrystal(i, j + 1); - CheckShatterCrystal(i, j - 1); - } - } + Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); + if (Main.drawToScreen) + zero = Vector2.Zero; + int frameX = tile.frameX; + int frameY = tile.frameY; - // LATER -- clean up copied decompiled pot code here - public override bool Drop(int i, int j, int type) - { - if (type == ModContent.TileType()) + // Search down the cactus to find out whether the block it is planted in is Astral Sand. + bool astralCactus = false; + if (!Main.canDrawColorTile(i, j)) { - Item.NewItem(i * 16, j * 16, 16, 16, ModContent.ItemType(), 1, false, 0, false, false); + int xTile = i; + if (frameX == 36) // Cactus segment which splits left + xTile--; + if (frameX == 54) // Cactus segment which splits right + xTile++; + if (frameX == 108) // Cactus segment which splits both directions + 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) + { + if (Main.tile[xTile, yTile].type == TileID.Cactus && Main.tile[xTile, yTile].active()) + { + slidingDownCactus = true; + } + yTile++; + // Cacti are assumed to be no more than 20 blocks tall. + if (yTile > i + 20) + break; + } + astralCactus = Main.tile[xTile, yTile].type == (ushort)ModContent.TileType(); } - else if (type == ModContent.TileType()) + + // If it is actually astral cactus, then draw its glowmask. + if (astralCactus) { - Item.NewItem(i * 16, j * 16, 16, 16, ModContent.ItemType(), 1, false, 0, false, false); + spriteBatch.Draw(CalamityMod.AstralCactusGlowTexture, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle((int)frameX, (int)frameY, 16, 18), Color.White * 0.75f, 0f, default, 1f, SpriteEffects.None, 0f); + } + } + + // This function exists only to shatter adjacent Lumenyl or Sea Prism crystals when a neighboring solid tile is destroyed. + public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Main.tile[i, j]; + Player player = Main.LocalPlayer; + + if (tile is null) + return; + + // Helper function to shatter crystals attached to neighboring solid tiles. + void CheckShatterCrystal(int xPos, int yPos) + { + 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))) + { + WorldGen.KillTile(xPos, yPos, false, false, false); + if (!Main.tile[xPos, yPos].active() && Main.netMode != NetmodeID.SinglePlayer) + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, xPos, yPos, 0f, 0, 0, 0); + } + } + + // 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()) + { + CheckShatterCrystal(i + 1, j); + CheckShatterCrystal(i - 1, j); + CheckShatterCrystal(i, j + 1); + CheckShatterCrystal(i, j - 1); + } + + if (player.Calamity().reaverExplore && !fail) + { + player.breath += 20; + if (player.breath > player.breathMax) + player.breath = player.breathMax; + } + } + + // LATER -- clean up copied decompiled pot code here + 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 (type == ModContent.TileType()) + { + Item.NewItem(i * 16, j * 16, 16, 16, ModContent.ItemType()); + + 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")); + } + } + else if (type == ModContent.TileType()) + { + Item.NewItem(i * 16, j * 16, 16, 16, ModContent.ItemType()); + + 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")); + } + } + else if (type == TileID.DemonAltar && CalamityConfig.Instance.EarlyHardmodeProgressionRework) + { + int quantity = 6; + Vector2 pos = new Vector2(i, j) * 16; + for (int k = 0; k < quantity; k += 1) + { + pos.X += Main.rand.NextFloat(-32f, 32f); + pos.Y += Main.rand.NextFloat(-32f, 32f); + Item.NewItem(pos, ItemID.SoulofNight, 1); + } + } } // This is old pot code, kept here for legacy reasons with old worlds. Should be removed in a future update after a sufficient amount of time. @@ -506,7 +550,7 @@ namespace CalamityMod.Tiles } } } - if (shootFlames && Main.netMode != NetmodeID.MultiplayerClient) + if (shootFlames) { float ai0 = 0f; if (type == ModContent.TileType() || type == ModContent.TileType()) @@ -520,40 +564,40 @@ namespace CalamityMod.Tiles } } - public override int[] AdjTiles (int type) - { - // Ashen, Ancient and Profaned Sinks all count as a lava source instead of a water source - if (type == ModContent.TileType() || - type == ModContent.TileType() || - type == ModContent.TileType()) - { - Main.LocalPlayer.adjLava = true; - } - // Botanic Sink counts as a honey source instead of a water source - if (type == ModContent.TileType()) - { - Main.LocalPlayer.adjHoney = true; - } + public override int[] AdjTiles (int type) + { + // Ashen, Ancient and Profaned Sinks all count as a lava source instead of a water source + if (type == ModContent.TileType() || + type == ModContent.TileType() || + type == ModContent.TileType()) + { + Main.LocalPlayer.adjLava = true; + } + // Botanic Sink counts as a honey source instead of a water source + if (type == ModContent.TileType()) + { + Main.LocalPlayer.adjHoney = true; + } - return new int[0]; - } - public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged) - { - int[] indestructableTiles = new int[] - { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType() - }; - // Prevent tiles below an astral beacon from being destroyed. - if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && - CalamityUtils.ParanoidTileRetrieval(i, j).type != - CalamityUtils.ParanoidTileRetrieval(i, j - 1).type && - indestructableTiles.Contains(CalamityUtils.ParanoidTileRetrieval(i, j - 1).type)) - { - return false; - } - return base.CanKillTile(i, j, type, ref blockDamaged); - } - } + return new int[0]; + } + + public override bool CanKillTile(int i, int j, int type, ref bool blockDamaged) + { + int[] invincibleTiles = new int[] + { + ModContent.TileType(), + ModContent.TileType() + }; + // Prevent tiles below invincible tiles from being destroyed. This is like chests in vanilla. + if (CalamityUtils.ParanoidTileRetrieval(i, j - 1).active() && + CalamityUtils.ParanoidTileRetrieval(i, j).type != + CalamityUtils.ParanoidTileRetrieval(i, j - 1).type && + invincibleTiles.Contains(CalamityUtils.ParanoidTileRetrieval(i, j - 1).type)) + { + return false; + } + return base.CanKillTile(i, j, type, ref blockDamaged); + } + } } diff --git a/Tiles/CellFabricator.png b/Tiles/CellFabricator.png deleted file mode 100644 index f0f6b924f9..0000000000 Binary files a/Tiles/CellFabricator.png and /dev/null differ diff --git a/Tiles/CosmiliteBarTile.cs b/Tiles/CosmiliteBarTile.cs new file mode 100644 index 0000000000..9386b88172 --- /dev/null +++ b/Tiles/CosmiliteBarTile.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CosmiliteBarTile : ModTile + { + public override void SetDefaults() + { + Main.tileShine[Type] = 1000; + Main.tileSolid[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + dustType = ModContent.DustType(); + drop = ModContent.ItemType(); + + AddMapEntry(new Color(229, 141, 246)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + type = ModContent.DustType(); + return true; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/CosmiliteBarTile.png b/Tiles/CosmiliteBarTile.png new file mode 100644 index 0000000000..d3244564b0 Binary files /dev/null and b/Tiles/CosmiliteBarTile.png differ diff --git a/Tiles/CryonicBar.cs b/Tiles/CryonicBar.cs index dca8aea5ac..eb887940d9 100644 --- a/Tiles/CryonicBar.cs +++ b/Tiles/CryonicBar.cs @@ -1,8 +1,8 @@ +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ObjectData; -using CalamityMod.Items.Materials; namespace CalamityMod.Tiles { diff --git a/Tiles/DraedonFactoryFieldGenerator.cs b/Tiles/DraedonFactoryFieldGenerator.cs deleted file mode 100644 index acbcf422cd..0000000000 --- a/Tiles/DraedonFactoryFieldGenerator.cs +++ /dev/null @@ -1,127 +0,0 @@ -using CalamityMod.TileEntities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.DataStructures; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class DraedonFactoryFieldGenerator : ModTile - { - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = false; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Field Generator"); - AddMapEntry(new Color(53, 49, 52), name); - minPick = 65; - } - - public TEDraedonFieldGenerator RetrieveTileEntity(int i, int j) - { - int determinedID = ModContent.GetInstance().Find(i, j); - if (determinedID == -1 || !(TileEntity.ByID[determinedID] is TEDraedonFieldGenerator)) - { - ModTileEntity modTileEntity = ModTileEntity.ConstructFromType(ModContent.GetInstance().type); - modTileEntity.Position = new Point16(i, j); - modTileEntity.ID = TileEntity.AssignNewID(); - modTileEntity.type = ModContent.GetInstance().type; - TileEntity.ByID[modTileEntity.ID] = modTileEntity; - TileEntity.ByPosition[modTileEntity.Position] = modTileEntity; - determinedID = modTileEntity.ID; - } - return (TEDraedonFieldGenerator)TileEntity.ByID[determinedID]; - } - - public override bool CanExplode(int i, int j) => false; - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TEDraedonFieldGenerator charger = RetrieveTileEntity(i, j); - Color drawColor = Color.Lerp(new Color(73, 68, 72), Color.Cyan, Utils.InverseLerp(0f, TEDraedonFieldGenerator.ActiveTimerMax, charger.ActiveTimer, true)); - - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonFactoryFieldGeneratorGlow"); - 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; - Tile trackTile = Main.tile[i, j]; - if (!trackTile.halfBrick() && trackTile.slope() == 0) - { - spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else if (trackTile.halfBrick()) - { - spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - - Vector2 positionWorldCoords = new Vector2(i, j) * 16f; - Player player = Main.player[Player.FindClosest(positionWorldCoords, 1, 1)]; - if (player.Distance(positionWorldCoords) < 1600f) - { - Texture2D laserTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); - Vector2[] pointsToDraw = new Vector2[65]; - for (int k = 0; k < pointsToDraw.Length; k++) - { - float angle = k / (float)pointsToDraw.Length * MathHelper.TwoPi; - pointsToDraw[k] = angle.ToRotationVector2() * TEDraedonFieldGenerator.Radius; - pointsToDraw[k] += drawOffset; - pointsToDraw[k] += Main.rand.NextVector2Circular(1f, 1f); - - angle = (k + 1) % pointsToDraw.Length / (float)pointsToDraw.Length * MathHelper.TwoPi; - pointsToDraw[(k + 1) % pointsToDraw.Length] = angle.ToRotationVector2() * TEDraedonFieldGenerator.Radius; - pointsToDraw[(k + 1) % pointsToDraw.Length] += drawOffset; - pointsToDraw[(k + 1) % pointsToDraw.Length] += Main.rand.NextVector2Circular(1f, 1f); - - if (trackTile.halfBrick()) - pointsToDraw[k] += Vector2.UnitY * 8f; - if (trackTile.halfBrick()) - pointsToDraw[(k + 1) % pointsToDraw.Length] += Vector2.UnitY * 8f; - - DelegateMethods.c_1 = Color.Cyan; - DelegateMethods.f_1 = 1f; - DelegateMethods.c_1 *= Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * - Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); - DelegateMethods.f_1 *= Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * - Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); - Utils.DrawLaser(spriteBatch, laserTexture, pointsToDraw[k], pointsToDraw[(k + 1) % pointsToDraw.Length], new Vector2(0.3f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); - - DelegateMethods.c_1 = Color.White * 0.7f; - DelegateMethods.f_1 = 0.7f; - DelegateMethods.c_1 *= Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * - Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); - DelegateMethods.f_1 *= Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.X - player.Center.X), true) * - Utils.InverseLerp(TEDraedonFieldGenerator.Radius, TEDraedonFieldGenerator.Radius - 300f, Math.Abs(positionWorldCoords.Y - player.Center.Y), true); - Utils.DrawLaser(spriteBatch, laserTexture, pointsToDraw[k], pointsToDraw[(k + 1) % pointsToDraw.Length], new Vector2(0.6f), new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); - } - } - } - - public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) - { - TEDraedonFieldGenerator generator = RetrieveTileEntity(i, j); - generator.Kill(i, j); - } - } -} diff --git a/Tiles/DraedonFactoryFieldGenerator.png b/Tiles/DraedonFactoryFieldGenerator.png deleted file mode 100644 index b7a19a3bdd..0000000000 Binary files a/Tiles/DraedonFactoryFieldGenerator.png and /dev/null differ diff --git a/Tiles/DraedonFactoryFieldGeneratorGlow.png b/Tiles/DraedonFactoryFieldGeneratorGlow.png deleted file mode 100644 index ae6117f78e..0000000000 Binary files a/Tiles/DraedonFactoryFieldGeneratorGlow.png and /dev/null differ diff --git a/Tiles/DraedonFuelFactory.cs b/Tiles/DraedonFuelFactory.cs deleted file mode 100644 index 0e7bef403f..0000000000 --- a/Tiles/DraedonFuelFactory.cs +++ /dev/null @@ -1,171 +0,0 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.TileEntities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Linq; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class DraedonFuelFactory : ModTile - { - public const int Width = 4; - public const int Height = 4; - public const int CellCreationDelay = 600; - public const int TotalFrames = 45; - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = false; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Fuel Factory"); - AddMapEntry(new Color(67, 72, 81), name); - animationFrameHeight = 68; - } - - public override bool CanExplode(int i, int j) => false; - - public TEDraedonFuelFactory RetrieveTileEntity(int i, int j) - { - // This is very fucking important. ByID and ByPostion can apparently be different and as a result using both together is fucking unreliable. - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - if (!TileEntity.ByID.Any(tileEntity => tileEntity.Value.Position == new Point16(left, top))) - { - var factory = ModTileEntity.ConstructFromType(ModContent.TileEntityType()); - factory.Position = new Point16(left, top); - TileEntity.ByID[TileEntity.ByID.Count] = factory; - } - return (TEDraedonFuelFactory)TileEntity.ByID.Where(tileEntity => tileEntity.Value.Position == new Point16(left, top)).First().Value; - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); - return false; - } - - public override bool HasSmartInteract() => true; - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - - TEDraedonFuelFactory factory = RetrieveTileEntity(i, j); - if (factory.HeldItem.stack > 0) - { - Item.NewItem(new Vector2(i, j) * 16f, factory.HeldItem.type, factory.HeldItem.stack); - } - factory.Kill(left, top); - } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - - // After CellCreationDelay frames, start the fuel cell generation animation, and make one at the end. - // Otherwise, just continue waiting. - if (frameCounter % (CellCreationDelay + TotalFrames * 5 + 5) >= CellCreationDelay) - { - if (frameCounter % 5 == 4) - { - frame++; - if (frame >= TotalFrames) - { - frame = 0; - } - } - } - else - { - frame = TotalFrames - 1; - } - } - - public override bool NewRightClick(int i, int j) - { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - - Player player = Main.LocalPlayer; - TEDraedonFuelFactory factory = RetrieveTileEntity(i, j); - Main.mouseRightRelease = false; - - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.Calamity().CurrentlyViewedFactory == factory) - { - player.Calamity().CurrentlyViewedFactory = null; - player.Calamity().CurrentlyViewedFactoryX = player.Calamity().CurrentlyViewedFactoryY = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - // Ensure that the UI position is always centered and above the tile. - player.Calamity().CurrentlyViewedFactoryX = left * 16 + 16; - player.Calamity().CurrentlyViewedFactoryY = top * 16; - - player.Calamity().CurrentlyViewedFactory = factory; - - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(player.Calamity().CurrentlyViewedFactory == null ? SoundID.MenuOpen : SoundID.MenuTick); - } - - Recipe.FindRecipes(); - return true; - } - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile trackTile = Main.tile[i, j]; - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - xPos += Main.tileFrame[trackTile.type] / 15 * 72; - yPos += Main.tileFrame[trackTile.type] % 15 * 72; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonFuelFactory"); - 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); - - if (!trackTile.halfBrick() && trackTile.slope() == 0) - spriteBatch.Draw(glowmask, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - else if (trackTile.halfBrick()) - spriteBatch.Draw(glowmask, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - return false; - } - } -} diff --git a/Tiles/DraedonItemCharger.cs b/Tiles/DraedonItemCharger.cs deleted file mode 100644 index 336c8cb397..0000000000 --- a/Tiles/DraedonItemCharger.cs +++ /dev/null @@ -1,145 +0,0 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.TileEntities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Linq; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class DraedonItemCharger : ModTile - { - public const int Width = 3; - public const int Height = 2; - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = false; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Item Charger"); - AddMapEntry(new Color(67, 72, 81), name); - } - - public override bool CanExplode(int i, int j) => false; - - public TEDraedonItemCharger RetrieveTileEntity(int i, int j) - { - // This is very fucking important. ByID and ByPostion can apparently be different and as a result using both together is fucking unreliable. - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - if (!TileEntity.ByID.Any(tileEntity => tileEntity.Value.Position == new Point16(left, top))) - { - var factory = ModTileEntity.ConstructFromType(ModContent.TileEntityType()); - factory.Position = new Point16(left, top); - TileEntity.ByID[TileEntity.ByID.Count] = factory; - } - return (TEDraedonItemCharger)TileEntity.ByID.Where(tileEntity => tileEntity.Value.Position == new Point16(left, top)).First().Value; - } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); - return false; - } - - public override bool HasSmartInteract() => true; - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - - TEDraedonItemCharger charger = RetrieveTileEntity(i, j); - if (charger.FuelItem.stack > 0) - { - Item.NewItem(new Vector2(i, j) * 16f, charger.FuelItem.type, charger.FuelItem.stack); - } - if (charger.ItemBeingCharged.stack > 0) - { - int idx = Item.NewItem(new Vector2(i, j) * 16f, charger.ItemBeingCharged.type, charger.ItemBeingCharged.stack); - Main.item[idx].Calamity().CurrentCharge = charger.Charge; - Main.item[idx].prefix = charger.ItemBeingCharged.prefix; - } - charger.Kill(left, top); - } - - public override bool NewRightClick(int i, int j) - { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - Player player = Main.LocalPlayer; - - TEDraedonItemCharger charger = RetrieveTileEntity(i, j); - Main.mouseRightRelease = false; - - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.Calamity().CurrentlyViewedCharger == charger) - { - player.Calamity().CurrentlyViewedCharger = null; - player.Calamity().CurrentlyViewedChargerX = player.Calamity().CurrentlyViewedChargerY = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.Calamity().CurrentlyViewedChargerX = left * 16; - player.Calamity().CurrentlyViewedChargerY = top * 16; - - player.Calamity().CurrentlyViewedCharger = charger; - - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(player.Calamity().CurrentlyViewedCharger == null ? SoundID.MenuOpen : SoundID.MenuTick); - } - - Recipe.FindRecipes(); - return true; - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - TEDraedonItemCharger charger = RetrieveTileEntity(i, j); - Color drawColor = Color.Lerp(Color.Red, Color.MediumSpringGreen, Utils.InverseLerp(0f, TEDraedonItemCharger.ActiveTimerMax, charger.ActiveTimer, true)); - - int xFrame = Main.tile[i, j].frameX; - int yFrame = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonItemChargerGlow"); - 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; - Tile trackTile = Main.tile[i, j]; - if (!trackTile.halfBrick() && trackTile.slope() == 0) - { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xFrame, yFrame, 18, 18)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else if (trackTile.halfBrick()) - { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xFrame, yFrame, 18, 8)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - } - } -} diff --git a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs index 22f0d08a03..abaf13d9fa 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs b/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs index 0b6431f9a5..0cc14fdb8a 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryContainmentBox.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs index 1779b0de16..46994b7a6a 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.Origin = new Point16(0, 2); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Aged Display"); diff --git a/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs b/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs index c139d4e2b6..1cd2c7b785 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDoorClosed.cs @@ -1,3 +1,4 @@ +using CalamityMod.ILEditing; using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; @@ -31,6 +32,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); diff --git a/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs b/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs index eca57a5ad0..aebac3bffc 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDoorOpen.cs @@ -1,3 +1,4 @@ +using CalamityMod.ILEditing; using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; @@ -31,6 +32,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); diff --git a/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs b/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs index 691e6e0774..e7ce79cb0d 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryElectricPanel.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorWall = true; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs index f2f8128850..4db2a1c1fd 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); TileObjectData.newTile.Height = 2; TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/DraedonStructures/AgedLaboratoryServer.cs b/Tiles/DraedonStructures/AgedLaboratoryServer.cs index b375bf41dd..d1afbd35ec 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryServer.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryServer.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs b/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs index c7df781b40..1bc8b5d738 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryTerminal.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.Origin = new Point16(0, 2); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; diff --git a/Tiles/DraedonStructures/AgedReinforcedCrate.cs b/Tiles/DraedonStructures/AgedReinforcedCrate.cs index 69ee0f8e4c..664e89a983 100644 --- a/Tiles/DraedonStructures/AgedReinforcedCrate.cs +++ b/Tiles/DraedonStructures/AgedReinforcedCrate.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Tiles.DraedonStructures Main.tileWaterDeath[Type] = false; Main.tileSolidTop[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Aged Reinforced Crate"); diff --git a/Tiles/AgedSecurityChestTile.cs b/Tiles/DraedonStructures/AgedSecurityChestTile.cs similarity index 75% rename from Tiles/AgedSecurityChestTile.cs rename to Tiles/DraedonStructures/AgedSecurityChestTile.cs index ae0a6493f0..9f1a3423f7 100644 --- a/Tiles/AgedSecurityChestTile.cs +++ b/Tiles/DraedonStructures/AgedSecurityChestTile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class AgedSecurityChestTile : ModTile { @@ -30,23 +30,7 @@ namespace CalamityMod.Tiles public override bool HasSmartInteract() => true; - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - return name; - else - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/AgedSecurityChestTile.png b/Tiles/DraedonStructures/AgedSecurityChestTile.png similarity index 100% rename from Tiles/AgedSecurityChestTile.png rename to Tiles/DraedonStructures/AgedSecurityChestTile.png diff --git a/Tiles/AgedSecurityChestTile_Highlight.png b/Tiles/DraedonStructures/AgedSecurityChestTile_Highlight.png similarity index 100% rename from Tiles/AgedSecurityChestTile_Highlight.png rename to Tiles/DraedonStructures/AgedSecurityChestTile_Highlight.png diff --git a/Tiles/DraedonStructures/ChargingStation.cs b/Tiles/DraedonStructures/ChargingStation.cs new file mode 100644 index 0000000000..cecb2b90b8 --- /dev/null +++ b/Tiles/DraedonStructures/ChargingStation.cs @@ -0,0 +1,134 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class ChargingStation : ModTile + { + // The origin offsets are not needed in this file but may be needed by other code. + public const int Width = 3; + public const int Height = 2; + public const int OriginOffsetX = 1; + public const int OriginOffsetY = 1; + public const int SheetSquare = 18; + + // 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() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + // No need to set width, height, origin, etc. here, Style3x2 is exactly what we want. + TileObjectData.newTile.LavaDeath = false; + + // When this tile is placed, it places the charging station tile entity. + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Charging Station"); + AddMapEntry(new Color(67, 72, 81), name); + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + // Drop the charging station itself. + 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; + + // Drop any cells contained in the charging station, as well as its plugged item. + Vector2 dropPos = new Vector2(i, j) * 16f; + TEChargingStation charger = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + int numCells = charger?.CellStack ?? 0; + if (numCells > 0) + Item.NewItem(dropPos, ModContent.ItemType(), numCells); + + // Netcode check is required because otherwise this will spawn two items. + // Force cloning items into the Main item array is weird. + Item pluggedItem = charger?.PluggedItem ?? null; + if (pluggedItem != null && !pluggedItem.IsAir && Main.netMode != NetmodeID.MultiplayerClient) + DropHelper.DropItemClone(pluggedItem, dropPos, pluggedItem.stack); + + charger?.Kill(left, top); + } + + public override bool NewRightClick(int i, int j) + { + TEChargingStation thisCharger = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + Player player = Main.LocalPlayer; + player.CancelSignsAndChests(); + CalamityPlayer mp = player.Calamity(); + + // If this is the charger the player is currently looking at OR this charger doesn't really exist, close the GUI. + if (thisCharger is null || thisCharger.ID == mp.CurrentlyViewedChargerID) + { + mp.CurrentlyViewedChargerID = -1; + Main.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); + mp.CurrentlyViewedChargerID = thisCharger.ID; + Main.playerInventory = true; + Main.recBigList = false; + } + + Recipe.FindRecipes(); + return true; + } + + // Draws the charger's glowing light on top of it. + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = Main.tile[i, j]; + int xFrame = t.frameX; + int yFrame = t.frameY; + + // 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"); + 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; + + if (!t.halfBrick() && t.slope() == 0) + Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xFrame, yFrame, 18, 18)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (t.halfBrick()) + Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xFrame, yFrame, 18, 8)), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/DraedonItemCharger.png b/Tiles/DraedonStructures/ChargingStation.png similarity index 100% rename from Tiles/DraedonItemCharger.png rename to Tiles/DraedonStructures/ChargingStation.png diff --git a/Tiles/DraedonItemChargerGlow.png b/Tiles/DraedonStructures/ChargingStation_Glow.png similarity index 100% rename from Tiles/DraedonItemChargerGlow.png rename to Tiles/DraedonStructures/ChargingStation_Glow.png diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs new file mode 100644 index 0000000000..32ab987461 --- /dev/null +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -0,0 +1,98 @@ +using CalamityMod.Items.Materials; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class DraedonLabTurret : ModTile + { + public const int Width = 3; + public const int Height = 2; + public const int OriginOffsetX = 1; + public const int OriginOffsetY = 1; + public const int SheetSquare = 18; + + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + // No need to set width, height, origin, etc. here, Style3x2 is exactly what we want. + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.LavaDeath = false; + + // When this tile is placed, it places the Draedon Lab Turret tile entity. + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Lab Turret"); + AddMapEntry(new Color(67, 72, 81), name); + soundType = SoundID.Item; + soundStyle = 14; + + // Has 500% durability. + mineResist = 5f; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + // TODO -- Turrets have no items and can't be picked up and placed by players. + // Instead, drop some raw Draedon materials. + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType(), 8); + 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; + + TEDraedonLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + te?.Kill(left, top); + } + + // The turret tile draws a pulse turret on top of itself. + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = Main.tile[i, j]; + if (t.frameX != 36 || t.frameY != 0) + return; + + TEDraedonLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + if (te is null) + return; + int drawDirection = te.Direction; + Color drawColor = Lighting.GetColor(i, j); + + Texture2D tex = ModContent.GetTexture("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; + drawOffset.X += drawDirection == -1 ? -10f : 2f; + + SpriteEffects sfx = drawDirection == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; + spriteBatch.Draw(tex, drawOffset, null, drawColor, te.Angle, tex.Size() * 0.5f, 1f, sfx, 0.0f); + } + } +} diff --git a/Tiles/DraedonTurretTile.png b/Tiles/DraedonStructures/DraedonLabTurret.png similarity index 100% rename from Tiles/DraedonTurretTile.png rename to Tiles/DraedonStructures/DraedonLabTurret.png diff --git a/Tiles/InactiveDraedonFuelFactory.cs b/Tiles/DraedonStructures/InactivePowerCellFactory.cs similarity index 67% rename from Tiles/InactiveDraedonFuelFactory.cs rename to Tiles/DraedonStructures/InactivePowerCellFactory.cs index 67477ff459..1ce1114b53 100644 --- a/Tiles/InactiveDraedonFuelFactory.cs +++ b/Tiles/DraedonStructures/InactivePowerCellFactory.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -6,28 +6,33 @@ using Terraria.Enums; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { - public class InactiveDraedonFuelFactory : ModTile + public class InactivePowerCellFactory : ModTile { + public const int Width = 4; + public const int Height = 4; + 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() { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; - Main.tileTable[Type] = true; Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Width = Width; + TileObjectData.newTile.Height = Height; + TileObjectData.newTile.Origin = new Point16(OriginOffsetX, OriginOffsetY); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; TileObjectData.newTile.CoordinatePadding = 0; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Inactive Fuel Factory"); + name.SetDefault("Inactive Power Cell Factory"); AddMapEntry(new Color(67, 72, 81), name); } @@ -46,7 +51,7 @@ namespace CalamityMod.Tiles public override void KillMultiTile(int i, int j, int frameX, int frameY) { - Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); + Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType()); } } } diff --git a/Tiles/InactiveDraedonFuelFactory.png b/Tiles/DraedonStructures/InactivePowerCellFactory.png similarity index 100% rename from Tiles/InactiveDraedonFuelFactory.png rename to Tiles/DraedonStructures/InactivePowerCellFactory.png diff --git a/Tiles/DraedonHologram.cs b/Tiles/DraedonStructures/LabHologramProjector.cs similarity index 50% rename from Tiles/DraedonHologram.cs rename to Tiles/DraedonStructures/LabHologramProjector.cs index 72aafa5862..700b415418 100644 --- a/Tiles/DraedonHologram.cs +++ b/Tiles/DraedonStructures/LabHologramProjector.cs @@ -1,29 +1,36 @@ -using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Placeables.DraedonStructures; using CalamityMod.TileEntities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ModLoader; -using Terraria.ID; -using Terraria.ObjectData; using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { - public class DraedonHologram : ModTile + public class LabHologramProjector : ModTile { public const int Width = 6; public const int Height = 7; + public const int SheetSquare = 16; public const int IdleFrames = 8; public const int TalkingFrames = 8; public const int FrameCount = IdleFrames + TalkingFrames; + public override void SetDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style6x3); - TileObjectData.newTile.Height = 7; + + // Manually reset the tile's coordinates to suit this tile, using the 6x3 style as a base. + TileObjectData.newTile.Height = Height; TileObjectData.newTile.Origin = new Point16(3, 6); TileObjectData.newTile.CoordinateHeights = new int[TileObjectData.newTile.Height]; TileObjectData.newTile.CoordinatePadding = 0; @@ -31,70 +38,74 @@ namespace CalamityMod.Tiles { TileObjectData.newTile.CoordinateHeights[i] = 16; } - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 6, 0); + TileObjectData.newTile.LavaDeath = false; + + // Set the respective hologram tile entity as a secondary element to incorporate when placing this tile. + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Lab Hologram Projector"); + AddMapEntry(new Color(99, 131, 199)); animationFrameHeight = 112; - soundType = SoundID.Tink; + // Spawn electric sparks when this tile is hit with a pickaxe. dustType = 229; - minPick = 100; - AddMapEntry(new Color(99, 131, 199)); + soundType = SoundID.Tink; } public override bool CanExplode(int i, int j) => false; - public TEDraedonHologram RetrieveTileEntity(int i, int j) + public override void KillMultiTile(int i, int j, int frameX, int frameY) { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - if (!TileEntity.ByPosition.ContainsKey(new Point16(left, top))) - { - TileEntity.ByPosition[new Point16(left, top)] = ModTileEntity.ConstructFromType(ModContent.TileEntityType()); - TileEntity.ByPosition[new Point16(left, top)].Position = new Point16(left, top); - } - return (TEDraedonHologram)TileEntity.ByPosition[new Point16(left, top)]; - } + // Drop the projector itself. + 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; + + // 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) { Player player = Main.LocalPlayer; - if (player.Calamity().CurrentlyViewedHologramX == -1 || - player.Calamity().CurrentlyViewedHologramY == -1) + CalamityPlayer mp = player.Calamity(); + + if (mp.CurrentlyViewedHologramID == -1) { - Main.PlaySound(SoundID.Chat, -1, -1, 1, 1f, 0f); - player.Calamity().CurrentlyViewedHologramX = i; - player.Calamity().CurrentlyViewedHologramY = j; - player.talkNPC = -1; + TELabHologramProjector projector = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + mp.CurrentlyViewedHologramID = projector?.ID ?? -1; + if (mp.CurrentlyViewedHologramID != -1) + { + Main.PlaySound(SoundID.Chat, -1, -1, 1, 1f, 0f); + player.talkNPC = -1; + } } else - { - player.Calamity().CurrentlyViewedHologramX = player.Calamity().CurrentlyViewedHologramY = -1; - } + mp.CurrentlyViewedHologramID = -1; + return true; } public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; Tile trackTile = Main.tile[i, j]; int time = (int)(Main.GlobalTime * 60); - TEDraedonHologram tileEntity = RetrieveTileEntity(i, j); - tileEntity.CloseToPlayer = false; - foreach (var player in Main.player) - { - if (!player.active) - continue; - if (player.Distance(new Point(left, top).ToWorldCoordinates()) < 560f) - { - tileEntity.CloseToPlayer = true; - break; - } - } - bool closeToPlayer = tileEntity.CloseToPlayer; + + TELabHologramProjector hologramTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + bool popup = false; + if (hologramTileEntity != null && hologramTileEntity.PoppingUp) + popup = true; + + // Frame cycling. Idly moves when the hologram is visible. int frame = time / 5 % FrameCount; - if (closeToPlayer) + if (popup) { if (frame <= IdleFrames) frame += IdleFrames; @@ -110,23 +121,21 @@ namespace CalamityMod.Tiles int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; + + // Accomodation for X frames textures. xPos += frame / 8 * 96; yPos += frame % 8 * 112; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/DraedonHologram"); + + Texture2D tileTexture = ModContent.GetTexture("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); if (!trackTile.halfBrick() && trackTile.slope() == 0) - spriteBatch.Draw(glowmask, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + spriteBatch.Draw(tileTexture, drawOffset, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); else if (trackTile.halfBrick()) - spriteBatch.Draw(glowmask, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + spriteBatch.Draw(tileTexture, drawOffset + Vector2.UnitY * 8f, new Rectangle(xPos, yPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); return false; } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(i * 16, j * 16, 16, 32, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonHologram.png b/Tiles/DraedonStructures/LabHologramProjector.png similarity index 100% rename from Tiles/DraedonHologram.png rename to Tiles/DraedonStructures/LabHologramProjector.png diff --git a/Tiles/DraedonStructures/LaboratoryConsole.cs b/Tiles/DraedonStructures/LaboratoryConsole.cs index 1c736617ab..7e54a2e199 100644 --- a/Tiles/DraedonStructures/LaboratoryConsole.cs +++ b/Tiles/DraedonStructures/LaboratoryConsole.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/LaboratoryContainmentBox.cs b/Tiles/DraedonStructures/LaboratoryContainmentBox.cs index 1f45fc75e4..d1e965e5c9 100644 --- a/Tiles/DraedonStructures/LaboratoryContainmentBox.cs +++ b/Tiles/DraedonStructures/LaboratoryContainmentBox.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/LaboratoryDisplay.cs b/Tiles/DraedonStructures/LaboratoryDisplay.cs index 9ba470b74e..6342b43c0c 100644 --- a/Tiles/DraedonStructures/LaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/LaboratoryDisplay.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/LaboratoryDoorClosed.cs b/Tiles/DraedonStructures/LaboratoryDoorClosed.cs index f20f8aed5e..d5dc4e26ca 100644 --- a/Tiles/DraedonStructures/LaboratoryDoorClosed.cs +++ b/Tiles/DraedonStructures/LaboratoryDoorClosed.cs @@ -1,3 +1,4 @@ +using CalamityMod.ILEditing; using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; @@ -31,6 +32,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); diff --git a/Tiles/DraedonStructures/LaboratoryDoorOpen.cs b/Tiles/DraedonStructures/LaboratoryDoorOpen.cs index c76e46273b..7adc586e95 100644 --- a/Tiles/DraedonStructures/LaboratoryDoorOpen.cs +++ b/Tiles/DraedonStructures/LaboratoryDoorOpen.cs @@ -1,3 +1,4 @@ +using CalamityMod.ILEditing; using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; @@ -31,6 +32,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); diff --git a/Tiles/DraedonStructures/LaboratoryElectricPanel.cs b/Tiles/DraedonStructures/LaboratoryElectricPanel.cs index 9b0766683a..71ef4babdd 100644 --- a/Tiles/DraedonStructures/LaboratoryElectricPanel.cs +++ b/Tiles/DraedonStructures/LaboratoryElectricPanel.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorWall = true; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/LaboratoryScreen.cs b/Tiles/DraedonStructures/LaboratoryScreen.cs index 9ad3fe319f..ea46eb46c8 100644 --- a/Tiles/DraedonStructures/LaboratoryScreen.cs +++ b/Tiles/DraedonStructures/LaboratoryScreen.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); TileObjectData.newTile.Height = 2; TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/DraedonStructures/LaboratoryServer.cs b/Tiles/DraedonStructures/LaboratoryServer.cs index 1a8a22318c..8c13fe72e8 100644 --- a/Tiles/DraedonStructures/LaboratoryServer.cs +++ b/Tiles/DraedonStructures/LaboratoryServer.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/LaboratoryTerminal.cs b/Tiles/DraedonStructures/LaboratoryTerminal.cs index 13a4f07d8f..508f6cdb3e 100644 --- a/Tiles/DraedonStructures/LaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/LaboratoryTerminal.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Tiles.DraedonStructures TileObjectData.newTile.StyleWrapLimit = 2; TileObjectData.newTile.StyleMultiplier = 2; TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs new file mode 100644 index 0000000000..851273c9a7 --- /dev/null +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -0,0 +1,147 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.Items.Placeables.DraedonStructures; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.DraedonStructures +{ + public class PowerCellFactory : ModTile + { + public const int Width = 4; + public const int Height = 4; + public const int OriginOffsetX = 1; + public const int OriginOffsetY = 3; + public const int SheetSquare = 18; + + // The number of animation frames is 45. Cells are created on animation frame 42. + public const int TotalFrames = 45; + private const int FramesPerColumn = 15; + public const int AnimationFramerate = 5; + + // 45 * 5 + 675 = 900 = 15 seconds per complete cell cycle. + // There are this many frames of downtime between cell creations. + public const int BetweenCellDowntime = 675; + // The cell is created on this animation frame. + public const int CellCreateFrame = 42; + // With a delay of this many extra frames after that animation frame starts. + public const int MagicFrameDelay = AnimationFramerate - 1; + + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Width = Width; + TileObjectData.newTile.Height = Height; + TileObjectData.newTile.Origin = new Point16(OriginOffsetX, OriginOffsetY); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = false; + + // When this tile is placed, it places the power cell factory tile entity. + ModTileEntity te = ModContent.GetInstance(); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(te.Hook_AfterPlacement, -1, 0, true); + + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Power Cell Factory"); + AddMapEntry(new Color(67, 72, 81), name); + animationFrameHeight = 68; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); + return false; + } + + public override bool HasSmartInteract() => true; + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + // Drop the factory itself. + 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; + + // Drop any cells contained in the factory. + TEPowerCellFactory factory = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + int numCells = factory?.CellStack ?? 0; + if (numCells > 0) + Item.NewItem(new Vector2(i, j) * 16f, ModContent.ItemType(), numCells); + + factory?.Kill(left, top); + } + + public override bool NewRightClick(int i, int j) + { + TEPowerCellFactory thisFactory = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + Player player = Main.LocalPlayer; + player.CancelSignsAndChests(); + CalamityPlayer mp = player.Calamity(); + + // If this is the factory the player is currently looking at OR this factory doesn't really exist, close the GUI. + if (thisFactory is null || thisFactory.ID == mp.CurrentlyViewedFactoryID) + { + mp.CurrentlyViewedFactoryID = -1; + Main.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); + mp.CurrentlyViewedFactoryID = thisFactory.ID; + Main.playerInventory = true; + Main.recBigList = false; + } + + Recipe.FindRecipes(); + return true; + } + + // All tile drawcode is done manually because the tile's animation is controlled by a tile entity. + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + // 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; + + // Grab the tile entity because its internal timer controls the animation. + TEPowerCellFactory factory = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); + int frameIndex = factory?.AnimationFrame ?? TotalFrames - 1; + frameXPos += frameIndex / FramesPerColumn * (Width * SheetSquare); + frameYPos += frameIndex % FramesPerColumn * (Height * SheetSquare); + + Texture2D tex = ModContent.GetTexture("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); + + if (!t.halfBrick() && t.slope() == 0) + spriteBatch.Draw(tex, drawOffset, new Rectangle(frameXPos, frameYPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (t.halfBrick()) + spriteBatch.Draw(tex, drawOffset + Vector2.UnitY * 8f, new Rectangle(frameXPos, frameYPos, 16, 16), drawColor, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + return false; + } + } +} diff --git a/Tiles/DraedonFuelFactory.png b/Tiles/DraedonStructures/PowerCellFactory.png similarity index 100% rename from Tiles/DraedonFuelFactory.png rename to Tiles/DraedonStructures/PowerCellFactory.png diff --git a/Tiles/DraedonStructures/ReinforcedCrate.cs b/Tiles/DraedonStructures/ReinforcedCrate.cs index 6145962191..91c0308eb7 100644 --- a/Tiles/DraedonStructures/ReinforcedCrate.cs +++ b/Tiles/DraedonStructures/ReinforcedCrate.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Tiles.DraedonStructures Main.tileWaterDeath[Type] = false; Main.tileSolidTop[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Reinforced Crate"); diff --git a/Tiles/SecurityChestTile.cs b/Tiles/DraedonStructures/SecurityChestTile.cs similarity index 74% rename from Tiles/SecurityChestTile.cs rename to Tiles/DraedonStructures/SecurityChestTile.cs index 727ecb07ac..5d79866916 100644 --- a/Tiles/SecurityChestTile.cs +++ b/Tiles/DraedonStructures/SecurityChestTile.cs @@ -1,10 +1,10 @@ -using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.DraedonStructures; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.DraedonStructures { public class SecurityChestTile : ModTile { @@ -30,23 +30,7 @@ namespace CalamityMod.Tiles public override bool HasSmartInteract() => true; - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - - if (tile.frameX % 36 != 0) - left--; - if (tile.frameY != 0) - top--; - - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - return name; - else - return name + ": " + Main.chest[chest].name; - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/SecurityChestTile.png b/Tiles/DraedonStructures/SecurityChestTile.png similarity index 100% rename from Tiles/SecurityChestTile.png rename to Tiles/DraedonStructures/SecurityChestTile.png diff --git a/Tiles/SecurityChestTile_Highlight.png b/Tiles/DraedonStructures/SecurityChestTile_Highlight.png similarity index 100% rename from Tiles/SecurityChestTile_Highlight.png rename to Tiles/DraedonStructures/SecurityChestTile_Highlight.png diff --git a/Tiles/DraedonTurretTile.cs b/Tiles/DraedonTurretTile.cs deleted file mode 100644 index b8d0a418fc..0000000000 --- a/Tiles/DraedonTurretTile.cs +++ /dev/null @@ -1,97 +0,0 @@ -using CalamityMod.Items.Placeables; -using CalamityMod.TileEntities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles -{ - public class DraedonTurretTile : ModTile - { - public const int Width = 3; - public const int Height = 2; - public override void SetDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, true); - TileObjectData.addTile(Type); - ModTranslation name = CreateMapEntryName(); - name.SetDefault("Turret"); - AddMapEntry(new Color(67, 72, 81), name); - soundType = SoundID.Item; - soundStyle = 14; - minPick = 55; - } - - public override bool CanExplode(int i, int j) => false; - - public TEDraedonTurret RetrieveTileEntity(int i, int j) - { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - int determinedID = ModContent.GetInstance().Find(left, top); - if (determinedID == -1 || !(TileEntity.ByID[determinedID] is TEDraedonTurret)) - { - ModTileEntity modTileEntity = ModTileEntity.ConstructFromType(ModContent.GetInstance().type); - modTileEntity.Position = new Point16(left, top); - modTileEntity.ID = TileEntity.AssignNewID(); - modTileEntity.type = ModContent.GetInstance().type; - TileEntity.ByID[modTileEntity.ID] = modTileEntity; - TileEntity.ByPosition[modTileEntity.Position] = modTileEntity; - determinedID = modTileEntity.ID; - } - return (TEDraedonTurret)TileEntity.ByID[determinedID]; - } - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 226); - return false; - } - - public override bool HasSmartInteract() => true; - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - int left = i - Main.tile[i, j].frameX % (Width * 18) / 18; - int top = j - Main.tile[i, j].frameY % (Height * 18) / 18; - - RetrieveTileEntity(i, j).Kill(left, top); - } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile trackTile = Main.tile[i, j]; - if (trackTile.frameX != 36 || trackTile.frameY != 0) - return; - - // This is done so that the turret has priority over, say, trees when drawing. - spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone); - - TEDraedonTurret charger = RetrieveTileEntity(i, j); - Color drawColor = Lighting.GetColor(i, j); - - Texture2D drawTexture = ModContent.GetTexture("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; - drawOffset.X += charger.Direction == -1 ? -10 : 2; - float adjustedAngle = charger.Rotation; - spriteBatch.Draw(drawTexture, drawOffset, null, drawColor, adjustedAngle, drawTexture.Size() * 0.5f, 1f, charger.Direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0.0f); - } - } -} diff --git a/Tiles/Furniture/BossTrophy.png b/Tiles/Furniture/BossTrophy.png index 563c6d4bf7..9eda024abc 100644 Binary files a/Tiles/Furniture/BossTrophy.png and b/Tiles/Furniture/BossTrophy.png differ diff --git a/Tiles/Furniture/CraftingStations/BotanicPlanter.cs b/Tiles/Furniture/CraftingStations/BotanicPlanter.cs index 559fee4265..3339045f1f 100644 --- a/Tiles/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Tiles/Furniture/CraftingStations/BotanicPlanter.cs @@ -13,15 +13,16 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Planter"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/Furniture/CraftingStations/DraedonsForge.cs b/Tiles/Furniture/CraftingStations/DraedonsForge.cs index 43b65c7039..d4519ddab1 100644 --- a/Tiles/Furniture/CraftingStations/DraedonsForge.cs +++ b/Tiles/Furniture/CraftingStations/DraedonsForge.cs @@ -6,23 +6,25 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.Furniture.CraftingStations { - public class DraedonsForge : ModTile + public class DraedonsForge : ModTile //Legacy names used to avoid fucking over people's placed forges and ensure they are converted properly. { - public override void SetDefaults() + + public override void SetDefaults() { - animationFrameHeight = 36; Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style4x2); //Changed from 3x2 to 4x2 due to sprite. + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); - name.SetDefault("Draedon's Forge"); + name.SetDefault("Cosmic Anvil"); AddMapEntry(new Color(0, 255, 0), name); disableSmartCursor = true; - adjTiles = new int[] { TileID.Anvils, TileID.Furnaces, TileID.WorkBenches, TileID.LunarCraftingStation, - TileID.MythrilAnvil, TileID.AdamantiteForge, TileID.Hellforge, TileID.DemonAltar }; + adjTiles = new int[] { TileID.Anvils, TileID.TinkerersWorkbench, TileID.WorkBenches, TileID.LunarCraftingStation, + TileID.MythrilAnvil, TileID.AdamantiteForge, TileID.DemonAltar }; //Specifically not furnaces } public override void KillMultiTile(int i, int j, int frameX, int frameY) @@ -36,19 +38,5 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations g = (float)Main.DiscoG / 255f; b = (float)Main.DiscoB / 255f; } - - public override void AnimateTile(ref int frame, ref int frameCounter) - { - frameCounter++; - if (frameCounter > 12) - { - frameCounter = 0; - frame++; - if (frame > 3) - { - frame = 0; - } - } - } } } diff --git a/Tiles/Furniture/CraftingStations/DraedonsForge.png b/Tiles/Furniture/CraftingStations/DraedonsForge.png index c61bdd80c5..f36dea2aad 100644 Binary files a/Tiles/Furniture/CraftingStations/DraedonsForge.png and b/Tiles/Furniture/CraftingStations/DraedonsForge.png differ diff --git a/Tiles/Furniture/CraftingStations/MonolithCrafting.cs b/Tiles/Furniture/CraftingStations/MonolithCrafting.cs index 705a4d1503..681bbc9ac1 100644 --- a/Tiles/Furniture/CraftingStations/MonolithCrafting.cs +++ b/Tiles/Furniture/CraftingStations/MonolithCrafting.cs @@ -11,12 +11,11 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { public override void SetDefaults() { - this.SetUpBookcase(solidTop: false); + this.SetUpBookcase(true, false); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Amalgam"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; - adjTiles = new int[] { TileID.Bookcases }; } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs index 26b9986987..69a5ca684d 100644 --- a/Tiles/Furniture/CraftingStations/PlagueInfuser.cs +++ b/Tiles/Furniture/CraftingStations/PlagueInfuser.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 4; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; diff --git a/Tiles/Furniture/CraftingStations/ProfanedBasin.cs b/Tiles/Furniture/CraftingStations/ProfanedBasin.cs index 2fe608cb69..e9d7fb7926 100644 --- a/Tiles/Furniture/CraftingStations/ProfanedBasin.cs +++ b/Tiles/Furniture/CraftingStations/ProfanedBasin.cs @@ -13,14 +13,16 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Crucible"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/Furniture/CraftingStations/SilvaBasin.cs b/Tiles/Furniture/CraftingStations/SilvaBasin.cs index 890557fb4a..154232df3b 100644 --- a/Tiles/Furniture/CraftingStations/SilvaBasin.cs +++ b/Tiles/Furniture/CraftingStations/SilvaBasin.cs @@ -13,15 +13,16 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Effulgent Manipulator"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/Furniture/CraftingStations/VoidCondenser.cs b/Tiles/Furniture/CraftingStations/VoidCondenser.cs index b32a0abd58..eb66374f5f 100644 --- a/Tiles/Furniture/CraftingStations/VoidCondenser.cs +++ b/Tiles/Furniture/CraftingStations/VoidCondenser.cs @@ -11,10 +11,11 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; Main.tileWaterDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Condenser"); diff --git a/Tiles/Furniture/CraftingStations/VoidCondenser.png b/Tiles/Furniture/CraftingStations/VoidCondenser.png index e8cadda56d..d3c0bf9005 100644 Binary files a/Tiles/Furniture/CraftingStations/VoidCondenser.png and b/Tiles/Furniture/CraftingStations/VoidCondenser.png differ diff --git a/Tiles/FurnitureAbyss/AbyssBath.cs b/Tiles/FurnitureAbyss/AbyssBath.cs index be56829128..1efcd46aa3 100644 --- a/Tiles/FurnitureAbyss/AbyssBath.cs +++ b/Tiles/FurnitureAbyss/AbyssBath.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssBed.cs b/Tiles/FurnitureAbyss/AbyssBed.cs index f280441e35..2e8c6f1776 100644 --- a/Tiles/FurnitureAbyss/AbyssBed.cs +++ b/Tiles/FurnitureAbyss/AbyssBed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssBookcase.cs b/Tiles/FurnitureAbyss/AbyssBookcase.cs index 36b5317fc1..b6d3e27dfa 100644 --- a/Tiles/FurnitureAbyss/AbyssBookcase.cs +++ b/Tiles/FurnitureAbyss/AbyssBookcase.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssCandelabra.cs b/Tiles/FurnitureAbyss/AbyssCandelabra.cs index 675df6d43b..5197dfa3ad 100644 --- a/Tiles/FurnitureAbyss/AbyssCandelabra.cs +++ b/Tiles/FurnitureAbyss/AbyssCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssCandle.cs b/Tiles/FurnitureAbyss/AbyssCandle.cs index 11d9a3c077..4cc49e7818 100644 --- a/Tiles/FurnitureAbyss/AbyssCandle.cs +++ b/Tiles/FurnitureAbyss/AbyssCandle.cs @@ -10,13 +10,8 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); - TileObjectData.newTile.CoordinateHeights = new int[] { 20 }; - TileObjectData.addTile(Type); + this.SetUpCandle(true, 0); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssChair.cs b/Tiles/FurnitureAbyss/AbyssChair.cs index 8218df02d2..6ef9a4bbe6 100644 --- a/Tiles/FurnitureAbyss/AbyssChair.cs +++ b/Tiles/FurnitureAbyss/AbyssChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssChandelier.cs b/Tiles/FurnitureAbyss/AbyssChandelier.cs index 61003db166..dcdb3d7e43 100644 --- a/Tiles/FurnitureAbyss/AbyssChandelier.cs +++ b/Tiles/FurnitureAbyss/AbyssChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssChest.cs b/Tiles/FurnitureAbyss/AbyssChest.cs index 41b136759f..26d2d4a0fa 100644 --- a/Tiles/FurnitureAbyss/AbyssChest.cs +++ b/Tiles/FurnitureAbyss/AbyssChest.cs @@ -35,29 +35,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureAbyss/AbyssClock.cs b/Tiles/FurnitureAbyss/AbyssClock.cs index b2a76142a0..5e8bb6ac62 100644 --- a/Tiles/FurnitureAbyss/AbyssClock.cs +++ b/Tiles/FurnitureAbyss/AbyssClock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs index f2db6f1480..b72d2521f9 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorClosed.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs index 01a156250e..d8228ff59a 100644 --- a/Tiles/FurnitureAbyss/AbyssDoorOpen.cs +++ b/Tiles/FurnitureAbyss/AbyssDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssLamp.cs b/Tiles/FurnitureAbyss/AbyssLamp.cs index 9703458159..3317d61aff 100644 --- a/Tiles/FurnitureAbyss/AbyssLamp.cs +++ b/Tiles/FurnitureAbyss/AbyssLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssLantern.cs b/Tiles/FurnitureAbyss/AbyssLantern.cs index 5301f21226..a5fcc4799e 100644 --- a/Tiles/FurnitureAbyss/AbyssLantern.cs +++ b/Tiles/FurnitureAbyss/AbyssLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssPiano.cs b/Tiles/FurnitureAbyss/AbyssPiano.cs index c99b695592..1efde13613 100644 --- a/Tiles/FurnitureAbyss/AbyssPiano.cs +++ b/Tiles/FurnitureAbyss/AbyssPiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Synth"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssSink.cs b/Tiles/FurnitureAbyss/AbyssSink.cs index f2efacc8e7..8c5f590063 100644 --- a/Tiles/FurnitureAbyss/AbyssSink.cs +++ b/Tiles/FurnitureAbyss/AbyssSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssSofa.cs b/Tiles/FurnitureAbyss/AbyssSofa.cs index 399f0ea036..130194317a 100644 --- a/Tiles/FurnitureAbyss/AbyssSofa.cs +++ b/Tiles/FurnitureAbyss/AbyssSofa.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssTable.cs b/Tiles/FurnitureAbyss/AbyssTable.cs index b7ab01d4b7..3e7ddfc279 100644 --- a/Tiles/FurnitureAbyss/AbyssTable.cs +++ b/Tiles/FurnitureAbyss/AbyssTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/AbyssTorch.cs b/Tiles/FurnitureAbyss/AbyssTorch.cs index d7224cb0aa..ec76fb1868 100644 --- a/Tiles/FurnitureAbyss/AbyssTorch.cs +++ b/Tiles/FurnitureAbyss/AbyssTorch.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpTorch(waterImmune: true); + this.SetUpTorch(true, true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Torch"); AddMapEntry(new Color(253, 221, 3), name); diff --git a/Tiles/FurnitureAbyss/AbyssWorkbench.cs b/Tiles/FurnitureAbyss/AbyssWorkbench.cs index 177c3822b3..4914e79012 100644 --- a/Tiles/FurnitureAbyss/AbyssWorkbench.cs +++ b/Tiles/FurnitureAbyss/AbyssWorkbench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Abyss Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs index 63af8d5bc3..77363a8ff6 100644 --- a/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs +++ b/Tiles/FurnitureAbyss/SmoothAbyssGravelPlatform.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAbyss { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); soundType = SoundID.Tink; AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); diff --git a/Tiles/FurnitureAncient/AncientBasin.cs b/Tiles/FurnitureAncient/AncientBasin.cs index 5c59623ee5..748c8c4a80 100644 --- a/Tiles/FurnitureAncient/AncientBasin.cs +++ b/Tiles/FurnitureAncient/AncientBasin.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Tiles.FurnitureAncient AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureAncient/AncientChandelier.cs b/Tiles/FurnitureAncient/AncientChandelier.cs index b664b2ac95..8234044626 100644 --- a/Tiles/FurnitureAncient/AncientChandelier.cs +++ b/Tiles/FurnitureAncient/AncientChandelier.cs @@ -36,6 +36,11 @@ namespace CalamityMod.Tiles.FurnitureAncient CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAncient/AncientChandelierFlame"), i, j); } + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + } + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index 1dc5958c6a..40295c533a 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -41,6 +41,12 @@ namespace CalamityMod.Tiles.FurnitureAncient CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureAncient/AncientLanternFlame"), i, j); } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + } + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) { Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureAshen/AshenBasin.cs b/Tiles/FurnitureAshen/AshenBasin.cs index 24f777d1e1..54b0988925 100644 --- a/Tiles/FurnitureAshen/AshenBasin.cs +++ b/Tiles/FurnitureAshen/AshenBasin.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Tiles.FurnitureAshen AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureAshen/AshenChest.cs b/Tiles/FurnitureAshen/AshenChest.cs index 40ba948270..baa98396ef 100644 --- a/Tiles/FurnitureAshen/AshenChest.cs +++ b/Tiles/FurnitureAshen/AshenChest.cs @@ -41,29 +41,7 @@ namespace CalamityMod.Tiles.FurnitureAshen return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 93e9d4bf63..45c58df56c 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) { - //Main.NewText(GetTileVariant(i, j)); int uniqueAnimationFrameX = Main.tileFrame[Type] + i; int uniqueAnimationFrameY = Main.tileFrame[Type] + j; int xPos = i % 2; diff --git a/Tiles/FurnitureAstral/MonolithBathtub.cs b/Tiles/FurnitureAstral/MonolithBathtub.cs index 4de7c09bec..a849f12d96 100644 --- a/Tiles/FurnitureAstral/MonolithBathtub.cs +++ b/Tiles/FurnitureAstral/MonolithBathtub.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithBed.cs b/Tiles/FurnitureAstral/MonolithBed.cs index be49ef4965..97556cbcbd 100644 --- a/Tiles/FurnitureAstral/MonolithBed.cs +++ b/Tiles/FurnitureAstral/MonolithBed.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithBench.cs b/Tiles/FurnitureAstral/MonolithBench.cs index 133afad2bd..d824e72a6a 100644 --- a/Tiles/FurnitureAstral/MonolithBench.cs +++ b/Tiles/FurnitureAstral/MonolithBench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithBookcase.cs b/Tiles/FurnitureAstral/MonolithBookcase.cs index e85c077c04..b110f3ba99 100644 --- a/Tiles/FurnitureAstral/MonolithBookcase.cs +++ b/Tiles/FurnitureAstral/MonolithBookcase.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpBookcase(solidTop: false); + this.SetUpBookcase(true, false); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithCandelabra.cs b/Tiles/FurnitureAstral/MonolithCandelabra.cs index d1b340ea27..da4b73c3de 100644 --- a/Tiles/FurnitureAstral/MonolithCandelabra.cs +++ b/Tiles/FurnitureAstral/MonolithCandelabra.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithCandle.cs b/Tiles/FurnitureAstral/MonolithCandle.cs index b80d86845a..62586d63d6 100644 --- a/Tiles/FurnitureAstral/MonolithCandle.cs +++ b/Tiles/FurnitureAstral/MonolithCandle.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithChair.cs b/Tiles/FurnitureAstral/MonolithChair.cs index cb6efe832e..096c532ddb 100644 --- a/Tiles/FurnitureAstral/MonolithChair.cs +++ b/Tiles/FurnitureAstral/MonolithChair.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithChandelier.cs b/Tiles/FurnitureAstral/MonolithChandelier.cs index 8c6b2832f1..97e808e688 100644 --- a/Tiles/FurnitureAstral/MonolithChandelier.cs +++ b/Tiles/FurnitureAstral/MonolithChandelier.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithChest.cs b/Tiles/FurnitureAstral/MonolithChest.cs index f0270e566e..6223834471 100644 --- a/Tiles/FurnitureAstral/MonolithChest.cs +++ b/Tiles/FurnitureAstral/MonolithChest.cs @@ -61,29 +61,7 @@ namespace CalamityMod.Tiles.FurnitureAstral return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureAstral/MonolithClock.cs b/Tiles/FurnitureAstral/MonolithClock.cs index 101bffb878..9d62a4d6f1 100644 --- a/Tiles/FurnitureAstral/MonolithClock.cs +++ b/Tiles/FurnitureAstral/MonolithClock.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithDoorClosed.cs b/Tiles/FurnitureAstral/MonolithDoorClosed.cs index d4578c36dc..f8d6d5f8a9 100644 --- a/Tiles/FurnitureAstral/MonolithDoorClosed.cs +++ b/Tiles/FurnitureAstral/MonolithDoorClosed.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithDoorOpen.cs b/Tiles/FurnitureAstral/MonolithDoorOpen.cs index 3eca8a2faa..dd927426a7 100644 --- a/Tiles/FurnitureAstral/MonolithDoorOpen.cs +++ b/Tiles/FurnitureAstral/MonolithDoorOpen.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithLamp.cs b/Tiles/FurnitureAstral/MonolithLamp.cs index 50f6539b19..9596f2c9b4 100644 --- a/Tiles/FurnitureAstral/MonolithLamp.cs +++ b/Tiles/FurnitureAstral/MonolithLamp.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithLantern.cs b/Tiles/FurnitureAstral/MonolithLantern.cs index f70c1451ee..4fd2b665a5 100644 --- a/Tiles/FurnitureAstral/MonolithLantern.cs +++ b/Tiles/FurnitureAstral/MonolithLantern.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithPiano.cs b/Tiles/FurnitureAstral/MonolithPiano.cs index 2b89b33ed7..bd125930eb 100644 --- a/Tiles/FurnitureAstral/MonolithPiano.cs +++ b/Tiles/FurnitureAstral/MonolithPiano.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithPlatform.cs b/Tiles/FurnitureAstral/MonolithPlatform.cs index a4e1588348..643765a99e 100644 --- a/Tiles/FurnitureAstral/MonolithPlatform.cs +++ b/Tiles/FurnitureAstral/MonolithPlatform.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureAstral/MonolithSink.cs b/Tiles/FurnitureAstral/MonolithSink.cs index ab38780a1f..0e6af2a72a 100644 --- a/Tiles/FurnitureAstral/MonolithSink.cs +++ b/Tiles/FurnitureAstral/MonolithSink.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithTable.cs b/Tiles/FurnitureAstral/MonolithTable.cs index a0e1a5ec28..344678aa06 100644 --- a/Tiles/FurnitureAstral/MonolithTable.cs +++ b/Tiles/FurnitureAstral/MonolithTable.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureAstral/MonolithWorkbench.cs b/Tiles/FurnitureAstral/MonolithWorkbench.cs index 10957c40de..57329eed22 100644 --- a/Tiles/FurnitureAstral/MonolithWorkbench.cs +++ b/Tiles/FurnitureAstral/MonolithWorkbench.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureAstral { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Monolith Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicBathtub.cs b/Tiles/FurnitureBotanic/BotanicBathtub.cs index 00cbff52fc..f2954b1e2b 100644 --- a/Tiles/FurnitureBotanic/BotanicBathtub.cs +++ b/Tiles/FurnitureBotanic/BotanicBathtub.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicBed.cs b/Tiles/FurnitureBotanic/BotanicBed.cs index e38443be80..d06213a403 100644 --- a/Tiles/FurnitureBotanic/BotanicBed.cs +++ b/Tiles/FurnitureBotanic/BotanicBed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicBench.cs b/Tiles/FurnitureBotanic/BotanicBench.cs index 5d9c44a0a2..f144ec35b3 100644 --- a/Tiles/FurnitureBotanic/BotanicBench.cs +++ b/Tiles/FurnitureBotanic/BotanicBench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicBookcase.cs b/Tiles/FurnitureBotanic/BotanicBookcase.cs index 7a72486aea..8ea38dcfce 100644 --- a/Tiles/FurnitureBotanic/BotanicBookcase.cs +++ b/Tiles/FurnitureBotanic/BotanicBookcase.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicCandelabra.cs b/Tiles/FurnitureBotanic/BotanicCandelabra.cs index f403e08ece..5db67b3b16 100644 --- a/Tiles/FurnitureBotanic/BotanicCandelabra.cs +++ b/Tiles/FurnitureBotanic/BotanicCandelabra.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicCandle.cs b/Tiles/FurnitureBotanic/BotanicCandle.cs index 4d95bdc1c1..da7d461831 100644 --- a/Tiles/FurnitureBotanic/BotanicCandle.cs +++ b/Tiles/FurnitureBotanic/BotanicCandle.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicChair.cs b/Tiles/FurnitureBotanic/BotanicChair.cs index 94472a0b41..db958da5a3 100644 --- a/Tiles/FurnitureBotanic/BotanicChair.cs +++ b/Tiles/FurnitureBotanic/BotanicChair.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicChandelier.cs b/Tiles/FurnitureBotanic/BotanicChandelier.cs index 9abd6913f6..29f176037e 100644 --- a/Tiles/FurnitureBotanic/BotanicChandelier.cs +++ b/Tiles/FurnitureBotanic/BotanicChandelier.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicChest.cs b/Tiles/FurnitureBotanic/BotanicChest.cs index a8bc8f0ea5..35520d7182 100644 --- a/Tiles/FurnitureBotanic/BotanicChest.cs +++ b/Tiles/FurnitureBotanic/BotanicChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureBotanic/BotanicClock.cs b/Tiles/FurnitureBotanic/BotanicClock.cs index 58c0d26079..878d3e54c3 100644 --- a/Tiles/FurnitureBotanic/BotanicClock.cs +++ b/Tiles/FurnitureBotanic/BotanicClock.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs index 518ffc9949..2d235959de 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorClosed.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorClosed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs index c7c7dc2b07..b7b9f267f9 100644 --- a/Tiles/FurnitureBotanic/BotanicDoorOpen.cs +++ b/Tiles/FurnitureBotanic/BotanicDoorOpen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicLamp.cs b/Tiles/FurnitureBotanic/BotanicLamp.cs index a814793861..2586fa1969 100644 --- a/Tiles/FurnitureBotanic/BotanicLamp.cs +++ b/Tiles/FurnitureBotanic/BotanicLamp.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicLantern.cs b/Tiles/FurnitureBotanic/BotanicLantern.cs index 27021b037e..819aadba16 100644 --- a/Tiles/FurnitureBotanic/BotanicLantern.cs +++ b/Tiles/FurnitureBotanic/BotanicLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicPiano.cs b/Tiles/FurnitureBotanic/BotanicPiano.cs index dc7a4376c7..bcd61cd7a9 100644 --- a/Tiles/FurnitureBotanic/BotanicPiano.cs +++ b/Tiles/FurnitureBotanic/BotanicPiano.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicPlatform.cs b/Tiles/FurnitureBotanic/BotanicPlatform.cs index 47718f5454..41c4512bbe 100644 --- a/Tiles/FurnitureBotanic/BotanicPlatform.cs +++ b/Tiles/FurnitureBotanic/BotanicPlatform.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureBotanic/BotanicSink.cs b/Tiles/FurnitureBotanic/BotanicSink.cs index 149e861c74..262aa5a7dd 100644 --- a/Tiles/FurnitureBotanic/BotanicSink.cs +++ b/Tiles/FurnitureBotanic/BotanicSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicTable.cs b/Tiles/FurnitureBotanic/BotanicTable.cs index 6295a2c4c3..9d4887c97a 100644 --- a/Tiles/FurnitureBotanic/BotanicTable.cs +++ b/Tiles/FurnitureBotanic/BotanicTable.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureBotanic/BotanicWorkBench.cs b/Tiles/FurnitureBotanic/BotanicWorkBench.cs index 3ede514034..2c96eb1a89 100644 --- a/Tiles/FurnitureBotanic/BotanicWorkBench.cs +++ b/Tiles/FurnitureBotanic/BotanicWorkBench.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureBotanic { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Botanic Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index 78d10a7148..bae7dca78c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -17,15 +17,17 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Basin"); AddMapEntry(new Color(238, 145, 105), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureCosmilite/CosmiliteBath.cs b/Tiles/FurnitureCosmilite/CosmiliteBath.cs index ef6791ed6d..8b2c9d242f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBath.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBath.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBed.cs b/Tiles/FurnitureCosmilite/CosmiliteBed.cs index baefb13234..86ebcb1cb2 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs index 4f96bd3e70..6257f55336 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBookcase.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs index 88d09d8bf7..d286ddbf1c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs index 8d648492ae..64f40910ea 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteCandle.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChair.cs b/Tiles/FurnitureCosmilite/CosmiliteChair.cs index 612ccc596f..d728829c70 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChair.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs index 65bd59f6a6..9804f2fca9 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.cs b/Tiles/FurnitureCosmilite/CosmiliteChest.cs index e7238b0804..99661e3e9c 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteChest.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteChest.cs @@ -31,29 +31,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest.png b/Tiles/FurnitureCosmilite/CosmiliteChest.png index 2b1bba6e4e..549491a7cd 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteChest.png and b/Tiles/FurnitureCosmilite/CosmiliteChest.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteChest_Highlight.png b/Tiles/FurnitureCosmilite/CosmiliteChest_Highlight.png index 6c696cc468..e1065e4438 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteChest_Highlight.png and b/Tiles/FurnitureCosmilite/CosmiliteChest_Highlight.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteClock.cs b/Tiles/FurnitureCosmilite/CosmiliteClock.cs index 7f60027a3a..2b6a0c3fa8 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteClock.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteClock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs index aed053387d..7279f215af 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs index b54e6169db..9fc3a2d8b9 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs index 944235d1e5..f33a0b939f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLamp.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs index 96562421a1..dfefc8657f 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteLantern.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmilitePiano.cs b/Tiles/FurnitureCosmilite/CosmilitePiano.cs index f62d474430..5bd4a722d1 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePiano.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs index aab34d9eae..fbd647b24f 100644 --- a/Tiles/FurnitureCosmilite/CosmilitePlatform.cs +++ b/Tiles/FurnitureCosmilite/CosmilitePlatform.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs index 49b66ae4e0..f645d78171 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSconce.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSconce.cs @@ -13,8 +13,9 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.Height = 3; TileObjectData.newTile.Width = 1; TileObjectData.newTile.CoordinateWidth = 16; @@ -32,6 +33,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite disableSmartCursor = true; adjTiles = new int[] { TileID.Torches }; TileID.Sets.FramesOnKillWall[Type] = true; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureCosmilite/CosmiliteSink.cs b/Tiles/FurnitureCosmilite/CosmiliteSink.cs index ccaf72f707..aeb9e53e6b 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSink.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs index 9978817732..5a29d61de4 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteSofa.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteSofa.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteTable.cs b/Tiles/FurnitureCosmilite/CosmiliteTable.cs index 9c34e8122c..17689182a1 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteTable.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs index ef6f95077a..c5a67b1f35 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteWorkbench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Cosmilite Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureEutrophic/EutrophicChest.cs index 4f878bfe51..9158f7e566 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureEutrophic/EutrophicChest.cs @@ -35,29 +35,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureOccult/OccultBathtub.cs b/Tiles/FurnitureOccult/OccultBathtub.cs index f0fa5ecbd1..0a8f1c48c2 100644 --- a/Tiles/FurnitureOccult/OccultBathtub.cs +++ b/Tiles/FurnitureOccult/OccultBathtub.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultBed.cs b/Tiles/FurnitureOccult/OccultBed.cs index af6fbd8359..4c89fc7e25 100644 --- a/Tiles/FurnitureOccult/OccultBed.cs +++ b/Tiles/FurnitureOccult/OccultBed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultBookcase.cs b/Tiles/FurnitureOccult/OccultBookcase.cs index 936028afc2..92b58a6a45 100644 --- a/Tiles/FurnitureOccult/OccultBookcase.cs +++ b/Tiles/FurnitureOccult/OccultBookcase.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultCandelabra.cs b/Tiles/FurnitureOccult/OccultCandelabra.cs index 75ee87c5b0..18a4f79913 100644 --- a/Tiles/FurnitureOccult/OccultCandelabra.cs +++ b/Tiles/FurnitureOccult/OccultCandelabra.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultCandle.cs b/Tiles/FurnitureOccult/OccultCandle.cs index 41ee78a185..a2683130fd 100644 --- a/Tiles/FurnitureOccult/OccultCandle.cs +++ b/Tiles/FurnitureOccult/OccultCandle.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultChair.cs b/Tiles/FurnitureOccult/OccultChair.cs index ac96949e67..cc10f96c57 100644 --- a/Tiles/FurnitureOccult/OccultChair.cs +++ b/Tiles/FurnitureOccult/OccultChair.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultChandelier.cs b/Tiles/FurnitureOccult/OccultChandelier.cs index 0dc8072b9c..40bcede389 100644 --- a/Tiles/FurnitureOccult/OccultChandelier.cs +++ b/Tiles/FurnitureOccult/OccultChandelier.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultChest.cs b/Tiles/FurnitureOccult/OccultChest.cs index 139ff362f4..a4bfbc56ee 100644 --- a/Tiles/FurnitureOccult/OccultChest.cs +++ b/Tiles/FurnitureOccult/OccultChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureOccult return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureOccult/OccultClock.cs b/Tiles/FurnitureOccult/OccultClock.cs index a56246afa8..7e9cd7fd61 100644 --- a/Tiles/FurnitureOccult/OccultClock.cs +++ b/Tiles/FurnitureOccult/OccultClock.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultDoorClosed.cs b/Tiles/FurnitureOccult/OccultDoorClosed.cs index a9cbec9694..700c57c38f 100644 --- a/Tiles/FurnitureOccult/OccultDoorClosed.cs +++ b/Tiles/FurnitureOccult/OccultDoorClosed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultDoorOpen.cs b/Tiles/FurnitureOccult/OccultDoorOpen.cs index 1f0c91cbd3..4414796543 100644 --- a/Tiles/FurnitureOccult/OccultDoorOpen.cs +++ b/Tiles/FurnitureOccult/OccultDoorOpen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultLamp.cs b/Tiles/FurnitureOccult/OccultLamp.cs index 0564f733e9..ed8cd5fa3b 100644 --- a/Tiles/FurnitureOccult/OccultLamp.cs +++ b/Tiles/FurnitureOccult/OccultLamp.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultLantern.cs b/Tiles/FurnitureOccult/OccultLantern.cs index c54d00e75e..bd3a7e4c80 100644 --- a/Tiles/FurnitureOccult/OccultLantern.cs +++ b/Tiles/FurnitureOccult/OccultLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultPiano.cs b/Tiles/FurnitureOccult/OccultPiano.cs index e1c2094e23..0949690a85 100644 --- a/Tiles/FurnitureOccult/OccultPiano.cs +++ b/Tiles/FurnitureOccult/OccultPiano.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultPlatform.cs b/Tiles/FurnitureOccult/OccultPlatform.cs index f765779440..3653c2c741 100644 --- a/Tiles/FurnitureOccult/OccultPlatform.cs +++ b/Tiles/FurnitureOccult/OccultPlatform.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureOccult/OccultSink.cs b/Tiles/FurnitureOccult/OccultSink.cs index 9a3382449d..5704660360 100644 --- a/Tiles/FurnitureOccult/OccultSink.cs +++ b/Tiles/FurnitureOccult/OccultSink.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultSofa.cs b/Tiles/FurnitureOccult/OccultSofa.cs index 2744ce6138..f3e84bdd70 100644 --- a/Tiles/FurnitureOccult/OccultSofa.cs +++ b/Tiles/FurnitureOccult/OccultSofa.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultTable.cs b/Tiles/FurnitureOccult/OccultTable.cs index 8277b56014..d93a3acd7f 100644 --- a/Tiles/FurnitureOccult/OccultTable.cs +++ b/Tiles/FurnitureOccult/OccultTable.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureOccult/OccultWorkbench.cs b/Tiles/FurnitureOccult/OccultWorkbench.cs index bbe6141914..826e151d3d 100644 --- a/Tiles/FurnitureOccult/OccultWorkbench.cs +++ b/Tiles/FurnitureOccult/OccultWorkbench.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureOccult { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Otherworldly Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs index b347cb7106..efdc89ac9c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBasin.cs @@ -12,14 +12,16 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Broken Plagued 'Bed'"); AddMapEntry(new Color(191, 142, 111), name); animationFrameHeight = 54; adjTiles = new int[] { TileID.Torches }; + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs index 19408b8b9e..35d0f23c78 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBathtub.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs index 49617315ee..20000e2ffa 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBed.cs @@ -11,9 +11,10 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void SetDefaults() { Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileID.Sets.HasOutlines[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This bed has different dimensions to conventional beds, using bookcase dimentions instead + TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs index d9e45274b3..0315ee1c7c 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateBookcase.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs index 03b0b1822f..04acb629ea 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs index 6984047344..b455643293 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs index fb5a52cb4b..38491e9e6f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs index 3b4e6e4908..f44b587b5f 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs index 887398dbfa..424e8a0ac2 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateChest.cs @@ -35,29 +35,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs index 2c7cb5285d..6b067a5ed0 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateClock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs index 597eb93cea..a5c6d298fd 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs index 8c758742c8..d97b3ef758 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs index 719a4f314b..2c09810fb0 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs index 8c1e9f1121..472d4315d0 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs index 441a7c2b65..6a9cd8c20a 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs index d0382cc708..a8d08d849a 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlatePlatform.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs index 2e4f15ec01..78901f9560 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs index 475c8e8907..2caf6af872 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateSofa.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs index f04d26e2f9..bc3185c123 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs index 6a824f0ec5..f3e497f9bf 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlateWorkbench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Plagued Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBath.cs b/Tiles/FurnitureProfaned/ProfanedBath.cs index e1e508d534..2753dabe74 100644 --- a/Tiles/FurnitureProfaned/ProfanedBath.cs +++ b/Tiles/FurnitureProfaned/ProfanedBath.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBed.cs b/Tiles/FurnitureProfaned/ProfanedBed.cs index 921ba7fa2c..df70a152f8 100644 --- a/Tiles/FurnitureProfaned/ProfanedBed.cs +++ b/Tiles/FurnitureProfaned/ProfanedBed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBench.cs b/Tiles/FurnitureProfaned/ProfanedBench.cs index 69b64a12bc..9a6e63ca75 100644 --- a/Tiles/FurnitureProfaned/ProfanedBench.cs +++ b/Tiles/FurnitureProfaned/ProfanedBench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedBookcase.cs b/Tiles/FurnitureProfaned/ProfanedBookcase.cs index 2172bb0099..09d17ee7d5 100644 --- a/Tiles/FurnitureProfaned/ProfanedBookcase.cs +++ b/Tiles/FurnitureProfaned/ProfanedBookcase.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs index f809a9a0c4..00de7fe7b3 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandelabra.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandelabra.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedCandle.cs b/Tiles/FurnitureProfaned/ProfanedCandle.cs index b183e2fc8c..4946095dbd 100644 --- a/Tiles/FurnitureProfaned/ProfanedCandle.cs +++ b/Tiles/FurnitureProfaned/ProfanedCandle.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedChair.cs b/Tiles/FurnitureProfaned/ProfanedChair.cs index 8aefc380f3..35f51165df 100644 --- a/Tiles/FurnitureProfaned/ProfanedChair.cs +++ b/Tiles/FurnitureProfaned/ProfanedChair.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.cs b/Tiles/FurnitureProfaned/ProfanedChandelier.cs index 4af1e58b3c..bbda287dfc 100644 --- a/Tiles/FurnitureProfaned/ProfanedChandelier.cs +++ b/Tiles/FurnitureProfaned/ProfanedChandelier.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Chandelier"); AddMapEntry(new Color(191, 142, 111), name); @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void HitWire(int i, int j) { - this.SetUpChandelier(); + CalamityUtils.LightHitWire(Type, i, j, 3, 3); } } } diff --git a/Tiles/FurnitureProfaned/ProfanedChandelier.png b/Tiles/FurnitureProfaned/ProfanedChandelier.png index 94b3a12493..c8a4139a2d 100644 Binary files a/Tiles/FurnitureProfaned/ProfanedChandelier.png and b/Tiles/FurnitureProfaned/ProfanedChandelier.png differ diff --git a/Tiles/FurnitureProfaned/ProfanedChest.cs b/Tiles/FurnitureProfaned/ProfanedChest.cs index 79dce48340..bb4a9b1c38 100644 --- a/Tiles/FurnitureProfaned/ProfanedChest.cs +++ b/Tiles/FurnitureProfaned/ProfanedChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureProfaned/ProfanedClock.cs b/Tiles/FurnitureProfaned/ProfanedClock.cs index 26e2ab6612..b3467a977d 100644 --- a/Tiles/FurnitureProfaned/ProfanedClock.cs +++ b/Tiles/FurnitureProfaned/ProfanedClock.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs index be0956c8e6..d558f89bdd 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorClosed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs index 377154f463..c4c37c6282 100644 --- a/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs +++ b/Tiles/FurnitureProfaned/ProfanedDoorOpen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedLamp.cs b/Tiles/FurnitureProfaned/ProfanedLamp.cs index bf5c0e956a..bce7c22619 100644 --- a/Tiles/FurnitureProfaned/ProfanedLamp.cs +++ b/Tiles/FurnitureProfaned/ProfanedLamp.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 3b6ebc8ad3..a4f836b7cf 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedPiano.cs b/Tiles/FurnitureProfaned/ProfanedPiano.cs index 032dcb77e6..b502bcf053 100644 --- a/Tiles/FurnitureProfaned/ProfanedPiano.cs +++ b/Tiles/FurnitureProfaned/ProfanedPiano.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,13 +13,15 @@ namespace CalamityMod.Tiles.FurnitureProfaned { Main.tileLighted[Type] = true; Main.tileFrameImportant[Type] = true; - Main.tileLavaDeath[Type] = true; + Main.tileLavaDeath[Type] = false; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Piano"); AddMapEntry(new Color(191, 142, 111), name); + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); } public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureProfaned/ProfanedPlatform.cs b/Tiles/FurnitureProfaned/ProfanedPlatform.cs index 28765ecb82..f1913ea446 100644 --- a/Tiles/FurnitureProfaned/ProfanedPlatform.cs +++ b/Tiles/FurnitureProfaned/ProfanedPlatform.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureProfaned/ProfanedSink.cs b/Tiles/FurnitureProfaned/ProfanedSink.cs index 67b47521e9..b0ede6764c 100644 --- a/Tiles/FurnitureProfaned/ProfanedSink.cs +++ b/Tiles/FurnitureProfaned/ProfanedSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedTable.cs b/Tiles/FurnitureProfaned/ProfanedTable.cs index d82d55e5ff..dc9d7a4b39 100644 --- a/Tiles/FurnitureProfaned/ProfanedTable.cs +++ b/Tiles/FurnitureProfaned/ProfanedTable.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs index 9036aa2f7a..d4ab248f64 100644 --- a/Tiles/FurnitureProfaned/ProfanedWorkbench.cs +++ b/Tiles/FurnitureProfaned/ProfanedWorkbench.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Profaned Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaBathtub.cs b/Tiles/FurnitureSilva/SilvaBathtub.cs index 2944f9a710..7fa48ba2f0 100644 --- a/Tiles/FurnitureSilva/SilvaBathtub.cs +++ b/Tiles/FurnitureSilva/SilvaBathtub.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaBed.cs b/Tiles/FurnitureSilva/SilvaBed.cs index 06edbda356..7fda4981bc 100644 --- a/Tiles/FurnitureSilva/SilvaBed.cs +++ b/Tiles/FurnitureSilva/SilvaBed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaBench.cs b/Tiles/FurnitureSilva/SilvaBench.cs index 1fa9d7de34..e383b751b7 100644 --- a/Tiles/FurnitureSilva/SilvaBench.cs +++ b/Tiles/FurnitureSilva/SilvaBench.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaBookcase.cs b/Tiles/FurnitureSilva/SilvaBookcase.cs index 90df04b038..e3126b7f00 100644 --- a/Tiles/FurnitureSilva/SilvaBookcase.cs +++ b/Tiles/FurnitureSilva/SilvaBookcase.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaCandelabra.cs b/Tiles/FurnitureSilva/SilvaCandelabra.cs index e0b15ebada..e8875670c6 100644 --- a/Tiles/FurnitureSilva/SilvaCandelabra.cs +++ b/Tiles/FurnitureSilva/SilvaCandelabra.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaCandle.cs b/Tiles/FurnitureSilva/SilvaCandle.cs index ece2028d95..4c0979016a 100644 --- a/Tiles/FurnitureSilva/SilvaCandle.cs +++ b/Tiles/FurnitureSilva/SilvaCandle.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaChair.cs b/Tiles/FurnitureSilva/SilvaChair.cs index 079844f226..7b51507d20 100644 --- a/Tiles/FurnitureSilva/SilvaChair.cs +++ b/Tiles/FurnitureSilva/SilvaChair.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaChandelier.cs b/Tiles/FurnitureSilva/SilvaChandelier.cs index b1cff31a2a..72206d4998 100644 --- a/Tiles/FurnitureSilva/SilvaChandelier.cs +++ b/Tiles/FurnitureSilva/SilvaChandelier.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaChest.cs b/Tiles/FurnitureSilva/SilvaChest.cs index 90e8e435de..17fe2b23be 100644 --- a/Tiles/FurnitureSilva/SilvaChest.cs +++ b/Tiles/FurnitureSilva/SilvaChest.cs @@ -37,29 +37,7 @@ namespace CalamityMod.Tiles.FurnitureSilva return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureSilva/SilvaClock.cs b/Tiles/FurnitureSilva/SilvaClock.cs index aebfb1db2b..9877c27032 100644 --- a/Tiles/FurnitureSilva/SilvaClock.cs +++ b/Tiles/FurnitureSilva/SilvaClock.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaDoorClosed.cs b/Tiles/FurnitureSilva/SilvaDoorClosed.cs index 8ef1bcc480..7626a98526 100644 --- a/Tiles/FurnitureSilva/SilvaDoorClosed.cs +++ b/Tiles/FurnitureSilva/SilvaDoorClosed.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaDoorOpen.cs b/Tiles/FurnitureSilva/SilvaDoorOpen.cs index 12ac6f22a3..9123dbf51f 100644 --- a/Tiles/FurnitureSilva/SilvaDoorOpen.cs +++ b/Tiles/FurnitureSilva/SilvaDoorOpen.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaLamp.cs b/Tiles/FurnitureSilva/SilvaLamp.cs index f923d990a3..5cf79c5eda 100644 --- a/Tiles/FurnitureSilva/SilvaLamp.cs +++ b/Tiles/FurnitureSilva/SilvaLamp.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaLantern.cs b/Tiles/FurnitureSilva/SilvaLantern.cs index eed93c6b63..5ab306771a 100644 --- a/Tiles/FurnitureSilva/SilvaLantern.cs +++ b/Tiles/FurnitureSilva/SilvaLantern.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaPiano.cs b/Tiles/FurnitureSilva/SilvaPiano.cs index 5e99787618..ac990dcc74 100644 --- a/Tiles/FurnitureSilva/SilvaPiano.cs +++ b/Tiles/FurnitureSilva/SilvaPiano.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaPlatform.cs b/Tiles/FurnitureSilva/SilvaPlatform.cs index a77404b170..570a00395c 100644 --- a/Tiles/FurnitureSilva/SilvaPlatform.cs +++ b/Tiles/FurnitureSilva/SilvaPlatform.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureSilva/SilvaSink.cs b/Tiles/FurnitureSilva/SilvaSink.cs index a4a8a3b74e..994187363c 100644 --- a/Tiles/FurnitureSilva/SilvaSink.cs +++ b/Tiles/FurnitureSilva/SilvaSink.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaTable.cs b/Tiles/FurnitureSilva/SilvaTable.cs index 9391c27cf6..e11812dd68 100644 --- a/Tiles/FurnitureSilva/SilvaTable.cs +++ b/Tiles/FurnitureSilva/SilvaTable.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureSilva/SilvaWorkBench.cs b/Tiles/FurnitureSilva/SilvaWorkBench.cs index ef8cf6f926..75f562b4ed 100644 --- a/Tiles/FurnitureSilva/SilvaWorkBench.cs +++ b/Tiles/FurnitureSilva/SilvaWorkBench.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Silva Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStatigel/StatigelChest.cs b/Tiles/FurnitureStatigel/StatigelChest.cs index 581d57cc64..dfb4a48336 100644 --- a/Tiles/FurnitureStatigel/StatigelChest.cs +++ b/Tiles/FurnitureStatigel/StatigelChest.cs @@ -30,29 +30,7 @@ namespace CalamityMod.Tiles.FurnitureStatigel return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureStratus/StratusBathtub.cs b/Tiles/FurnitureStratus/StratusBathtub.cs index 8947ee23f8..75ead49829 100644 --- a/Tiles/FurnitureStratus/StratusBathtub.cs +++ b/Tiles/FurnitureStratus/StratusBathtub.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusBathtub.png b/Tiles/FurnitureStratus/StratusBathtub.png index 3080c1f29d..d609433d54 100644 Binary files a/Tiles/FurnitureStratus/StratusBathtub.png and b/Tiles/FurnitureStratus/StratusBathtub.png differ diff --git a/Tiles/FurnitureStratus/StratusBed.cs b/Tiles/FurnitureStratus/StratusBed.cs index b347463b93..7226e77df3 100644 --- a/Tiles/FurnitureStratus/StratusBed.cs +++ b/Tiles/FurnitureStratus/StratusBed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusBed.png b/Tiles/FurnitureStratus/StratusBed.png index d6bd407bd8..95c63f3e68 100644 Binary files a/Tiles/FurnitureStratus/StratusBed.png and b/Tiles/FurnitureStratus/StratusBed.png differ diff --git a/Tiles/FurnitureStratus/StratusBed_Highlight.png b/Tiles/FurnitureStratus/StratusBed_Highlight.png index f308584d1a..c321e91212 100644 Binary files a/Tiles/FurnitureStratus/StratusBed_Highlight.png and b/Tiles/FurnitureStratus/StratusBed_Highlight.png differ diff --git a/Tiles/FurnitureStratus/StratusBookcase.cs b/Tiles/FurnitureStratus/StratusBookcase.cs index 025c7b4ecd..60729ec3e7 100644 --- a/Tiles/FurnitureStratus/StratusBookcase.cs +++ b/Tiles/FurnitureStratus/StratusBookcase.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusBookcase.png b/Tiles/FurnitureStratus/StratusBookcase.png index b56cb0c050..416889540b 100644 Binary files a/Tiles/FurnitureStratus/StratusBookcase.png and b/Tiles/FurnitureStratus/StratusBookcase.png differ diff --git a/Tiles/FurnitureStratus/StratusBricks.png b/Tiles/FurnitureStratus/StratusBricks.png index eb240d4d74..e07358f81a 100644 Binary files a/Tiles/FurnitureStratus/StratusBricks.png and b/Tiles/FurnitureStratus/StratusBricks.png differ diff --git a/Tiles/FurnitureStratus/StratusBricksGlow.png b/Tiles/FurnitureStratus/StratusBricksGlow.png index 78f0155d0a..407f5588ff 100644 Binary files a/Tiles/FurnitureStratus/StratusBricksGlow.png and b/Tiles/FurnitureStratus/StratusBricksGlow.png differ diff --git a/Tiles/FurnitureStratus/StratusCandelabra.cs b/Tiles/FurnitureStratus/StratusCandelabra.cs index bc1be94278..e4eedbe0e8 100644 --- a/Tiles/FurnitureStratus/StratusCandelabra.cs +++ b/Tiles/FurnitureStratus/StratusCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusCandelabra.png b/Tiles/FurnitureStratus/StratusCandelabra.png index 4eef54ec35..90c9321e42 100644 Binary files a/Tiles/FurnitureStratus/StratusCandelabra.png and b/Tiles/FurnitureStratus/StratusCandelabra.png differ diff --git a/Tiles/FurnitureStratus/StratusCandle.cs b/Tiles/FurnitureStratus/StratusCandle.cs index e990975b06..8c379b99c0 100644 --- a/Tiles/FurnitureStratus/StratusCandle.cs +++ b/Tiles/FurnitureStratus/StratusCandle.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Candle"); AddMapEntry(new Color(191, 142, 111), name); @@ -64,5 +65,10 @@ namespace CalamityMod.Tiles.FurnitureStratus CalamityUtils.RightClickBreak(i, j); return true; } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureStratus/StratusCandleFlame"), i, j, 0, -7); + } } } diff --git a/Tiles/FurnitureStratus/StratusCandle.png b/Tiles/FurnitureStratus/StratusCandle.png index 016be3600a..298249ba53 100644 Binary files a/Tiles/FurnitureStratus/StratusCandle.png and b/Tiles/FurnitureStratus/StratusCandle.png differ diff --git a/Tiles/FurnitureStratus/StratusCandleFlame.png b/Tiles/FurnitureStratus/StratusCandleFlame.png new file mode 100644 index 0000000000..ce7ffefb87 Binary files /dev/null and b/Tiles/FurnitureStratus/StratusCandleFlame.png differ diff --git a/Tiles/FurnitureStratus/StratusChair.cs b/Tiles/FurnitureStratus/StratusChair.cs index 9f48a73dd4..3e842fbc24 100644 --- a/Tiles/FurnitureStratus/StratusChair.cs +++ b/Tiles/FurnitureStratus/StratusChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusChair.png b/Tiles/FurnitureStratus/StratusChair.png index daab0b45b7..7d6ab412b2 100644 Binary files a/Tiles/FurnitureStratus/StratusChair.png and b/Tiles/FurnitureStratus/StratusChair.png differ diff --git a/Tiles/FurnitureStratus/StratusChandelier.cs b/Tiles/FurnitureStratus/StratusChandelier.cs index af549c2547..2038f36c3c 100644 --- a/Tiles/FurnitureStratus/StratusChandelier.cs +++ b/Tiles/FurnitureStratus/StratusChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusChandelier.png b/Tiles/FurnitureStratus/StratusChandelier.png index 8e8c42e889..bd9179cb7e 100644 Binary files a/Tiles/FurnitureStratus/StratusChandelier.png and b/Tiles/FurnitureStratus/StratusChandelier.png differ diff --git a/Tiles/FurnitureStratus/StratusChest.cs b/Tiles/FurnitureStratus/StratusChest.cs index 1a78b18ac9..7321369bfb 100644 --- a/Tiles/FurnitureStratus/StratusChest.cs +++ b/Tiles/FurnitureStratus/StratusChest.cs @@ -31,29 +31,7 @@ namespace CalamityMod.Tiles.FurnitureStratus return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureStratus/StratusChest.png b/Tiles/FurnitureStratus/StratusChest.png index c043568d65..4fc1586413 100644 Binary files a/Tiles/FurnitureStratus/StratusChest.png and b/Tiles/FurnitureStratus/StratusChest.png differ diff --git a/Tiles/FurnitureStratus/StratusChest_Highlight.png b/Tiles/FurnitureStratus/StratusChest_Highlight.png index 79a3f2c787..9ad1803341 100644 Binary files a/Tiles/FurnitureStratus/StratusChest_Highlight.png and b/Tiles/FurnitureStratus/StratusChest_Highlight.png differ diff --git a/Tiles/FurnitureStratus/StratusClock.cs b/Tiles/FurnitureStratus/StratusClock.cs index 689558c938..dd6fe9a800 100644 --- a/Tiles/FurnitureStratus/StratusClock.cs +++ b/Tiles/FurnitureStratus/StratusClock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Clock"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.cs b/Tiles/FurnitureStratus/StratusDoorClosed.cs index c5e0b4cafa..050e9f25f5 100644 --- a/Tiles/FurnitureStratus/StratusDoorClosed.cs +++ b/Tiles/FurnitureStratus/StratusDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusDoorClosed.png b/Tiles/FurnitureStratus/StratusDoorClosed.png index 18da6811a2..fe120ef595 100644 Binary files a/Tiles/FurnitureStratus/StratusDoorClosed.png and b/Tiles/FurnitureStratus/StratusDoorClosed.png differ diff --git a/Tiles/FurnitureStratus/StratusDoorClosed_Highlight.png b/Tiles/FurnitureStratus/StratusDoorClosed_Highlight.png index 68038eabfe..ee8db9686f 100644 Binary files a/Tiles/FurnitureStratus/StratusDoorClosed_Highlight.png and b/Tiles/FurnitureStratus/StratusDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.cs b/Tiles/FurnitureStratus/StratusDoorOpen.cs index 294d81ec5f..e5eb6e9c49 100644 --- a/Tiles/FurnitureStratus/StratusDoorOpen.cs +++ b/Tiles/FurnitureStratus/StratusDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusDoorOpen.png b/Tiles/FurnitureStratus/StratusDoorOpen.png index e597cf3901..dba691dcfe 100644 Binary files a/Tiles/FurnitureStratus/StratusDoorOpen.png and b/Tiles/FurnitureStratus/StratusDoorOpen.png differ diff --git a/Tiles/FurnitureStratus/StratusDoorOpen_Highlight.png b/Tiles/FurnitureStratus/StratusDoorOpen_Highlight.png index 9a3cdf851f..77bc6c4310 100644 Binary files a/Tiles/FurnitureStratus/StratusDoorOpen_Highlight.png and b/Tiles/FurnitureStratus/StratusDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureStratus/StratusDresser.png b/Tiles/FurnitureStratus/StratusDresser.png index af7e828ab2..76fad9a27d 100644 Binary files a/Tiles/FurnitureStratus/StratusDresser.png and b/Tiles/FurnitureStratus/StratusDresser.png differ diff --git a/Tiles/FurnitureStratus/StratusDresser_Highlight.png b/Tiles/FurnitureStratus/StratusDresser_Highlight.png index b2628bf7e7..e68696703f 100644 Binary files a/Tiles/FurnitureStratus/StratusDresser_Highlight.png and b/Tiles/FurnitureStratus/StratusDresser_Highlight.png differ diff --git a/Tiles/FurnitureStratus/StratusLamp.cs b/Tiles/FurnitureStratus/StratusLamp.cs index 33e87e40ad..6a9cbdf28e 100644 --- a/Tiles/FurnitureStratus/StratusLamp.cs +++ b/Tiles/FurnitureStratus/StratusLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusLamp.png b/Tiles/FurnitureStratus/StratusLamp.png index 8a55ceaddb..1470268dd6 100644 Binary files a/Tiles/FurnitureStratus/StratusLamp.png and b/Tiles/FurnitureStratus/StratusLamp.png differ diff --git a/Tiles/FurnitureStratus/StratusLantern.cs b/Tiles/FurnitureStratus/StratusLantern.cs index 70208aa655..e0bc5cb5ab 100644 --- a/Tiles/FurnitureStratus/StratusLantern.cs +++ b/Tiles/FurnitureStratus/StratusLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusLantern.png b/Tiles/FurnitureStratus/StratusLantern.png index efe32a2ab4..4874c0e6a8 100644 Binary files a/Tiles/FurnitureStratus/StratusLantern.png and b/Tiles/FurnitureStratus/StratusLantern.png differ diff --git a/Tiles/FurnitureStratus/StratusPiano.cs b/Tiles/FurnitureStratus/StratusPiano.cs index b00db1fe51..4593aa58ea 100644 --- a/Tiles/FurnitureStratus/StratusPiano.cs +++ b/Tiles/FurnitureStratus/StratusPiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusPiano.png b/Tiles/FurnitureStratus/StratusPiano.png index ba4bad7898..4568847188 100644 Binary files a/Tiles/FurnitureStratus/StratusPiano.png and b/Tiles/FurnitureStratus/StratusPiano.png differ diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index cb879e2dd3..8acbeac080 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; @@ -28,6 +29,20 @@ namespace CalamityMod.Tiles.FurnitureStratus Main.tileNoSunLight[Type] = false; } + 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"); + 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)) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + else if (trackTile.halfBrick()) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/FurnitureStratus/StratusPlatform.png b/Tiles/FurnitureStratus/StratusPlatform.png index 0626ac8520..31acd45e8d 100644 Binary files a/Tiles/FurnitureStratus/StratusPlatform.png and b/Tiles/FurnitureStratus/StratusPlatform.png differ diff --git a/Tiles/FurnitureStratus/StratusPlatformGlow.png b/Tiles/FurnitureStratus/StratusPlatformGlow.png new file mode 100644 index 0000000000..478a4f239e Binary files /dev/null and b/Tiles/FurnitureStratus/StratusPlatformGlow.png differ diff --git a/Tiles/FurnitureStratus/StratusSink.cs b/Tiles/FurnitureStratus/StratusSink.cs index 43daf0fd97..c5490be0c3 100644 --- a/Tiles/FurnitureStratus/StratusSink.cs +++ b/Tiles/FurnitureStratus/StratusSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusSink.png b/Tiles/FurnitureStratus/StratusSink.png index daefa6306d..3e146080e0 100644 Binary files a/Tiles/FurnitureStratus/StratusSink.png and b/Tiles/FurnitureStratus/StratusSink.png differ diff --git a/Tiles/FurnitureStratus/StratusSofa.cs b/Tiles/FurnitureStratus/StratusSofa.cs index 31234a38ff..3f8e2e5479 100644 --- a/Tiles/FurnitureStratus/StratusSofa.cs +++ b/Tiles/FurnitureStratus/StratusSofa.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusSofa.png b/Tiles/FurnitureStratus/StratusSofa.png index 5c1faa7695..15039f29a6 100644 Binary files a/Tiles/FurnitureStratus/StratusSofa.png and b/Tiles/FurnitureStratus/StratusSofa.png differ diff --git a/Tiles/FurnitureStratus/StratusStarPlatform.cs b/Tiles/FurnitureStratus/StratusStarPlatform.cs new file mode 100644 index 0000000000..aed1ca4564 --- /dev/null +++ b/Tiles/FurnitureStratus/StratusStarPlatform.cs @@ -0,0 +1,52 @@ +using CalamityMod.Items.Placeables.FurnitureStratus; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureStratus +{ + public class StratusStarPlatform : ModTile + { + public override void SetDefaults() + { + this.SetUpPlatform(true); + AddMapEntry(new Color(191, 142, 111)); + drop = ModContent.ItemType(); + disableSmartCursor = true; + adjTiles = new int[] { TileID.Platforms }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 130, 150), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 132, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + 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"); + 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)) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + + else if (trackTile.halfBrick()) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureStratus/StratusStarPlatform.png b/Tiles/FurnitureStratus/StratusStarPlatform.png new file mode 100644 index 0000000000..3e586083a1 Binary files /dev/null and b/Tiles/FurnitureStratus/StratusStarPlatform.png differ diff --git a/Tiles/FurnitureStratus/StratusStarPlatformGlow.png b/Tiles/FurnitureStratus/StratusStarPlatformGlow.png new file mode 100644 index 0000000000..bf5d980789 Binary files /dev/null and b/Tiles/FurnitureStratus/StratusStarPlatformGlow.png differ diff --git a/Tiles/FurnitureStratus/StratusTable.cs b/Tiles/FurnitureStratus/StratusTable.cs index ef4313f3d0..13c93b6582 100644 --- a/Tiles/FurnitureStratus/StratusTable.cs +++ b/Tiles/FurnitureStratus/StratusTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusTable.png b/Tiles/FurnitureStratus/StratusTable.png index d235023b2f..b12f51d70c 100644 Binary files a/Tiles/FurnitureStratus/StratusTable.png and b/Tiles/FurnitureStratus/StratusTable.png differ diff --git a/Tiles/FurnitureStratus/StratusWorkbench.cs b/Tiles/FurnitureStratus/StratusWorkbench.cs index 5d02910fd9..a371b40dd9 100644 --- a/Tiles/FurnitureStratus/StratusWorkbench.cs +++ b/Tiles/FurnitureStratus/StratusWorkbench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureStratus { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Stratus Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureStratus/StratusWorkbench.png b/Tiles/FurnitureStratus/StratusWorkbench.png index fb4fa6dfdc..55a8708c8e 100644 Binary files a/Tiles/FurnitureStratus/StratusWorkbench.png and b/Tiles/FurnitureStratus/StratusWorkbench.png differ diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs index efafa9544f..987ebfca08 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpPlatform(); + this.SetUpPlatform(true); AddMapEntry(new Color(191, 142, 111)); drop = ModContent.ItemType(); disableSmartCursor = true; diff --git a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.png b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.png index ef16a3b01d..4c458166ac 100644 Binary files a/Tiles/FurnitureVoid/SmoothVoidstonePlatform.png and b/Tiles/FurnitureVoid/SmoothVoidstonePlatform.png differ diff --git a/Tiles/FurnitureVoid/VoidBath.cs b/Tiles/FurnitureVoid/VoidBath.cs index b2a86409dd..6725fa6364 100644 --- a/Tiles/FurnitureVoid/VoidBath.cs +++ b/Tiles/FurnitureVoid/VoidBath.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpBathtub(); + this.SetUpBathtub(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Bathtub"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidBath.png b/Tiles/FurnitureVoid/VoidBath.png index 8b89dcde75..3db3a88a2c 100644 Binary files a/Tiles/FurnitureVoid/VoidBath.png and b/Tiles/FurnitureVoid/VoidBath.png differ diff --git a/Tiles/FurnitureVoid/VoidBed.cs b/Tiles/FurnitureVoid/VoidBed.cs index 3797a72a4c..f33f99cdce 100644 --- a/Tiles/FurnitureVoid/VoidBed.cs +++ b/Tiles/FurnitureVoid/VoidBed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpBed(); + this.SetUpBed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Bed"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidBed.png b/Tiles/FurnitureVoid/VoidBed.png index 478a548d49..36a5bcbbfb 100644 Binary files a/Tiles/FurnitureVoid/VoidBed.png and b/Tiles/FurnitureVoid/VoidBed.png differ diff --git a/Tiles/FurnitureVoid/VoidBed_Highlight.png b/Tiles/FurnitureVoid/VoidBed_Highlight.png index eedaccbc59..fe54af2044 100644 Binary files a/Tiles/FurnitureVoid/VoidBed_Highlight.png and b/Tiles/FurnitureVoid/VoidBed_Highlight.png differ diff --git a/Tiles/FurnitureVoid/VoidBookcase.cs b/Tiles/FurnitureVoid/VoidBookcase.cs index 6fdb9eb040..78835c1522 100644 --- a/Tiles/FurnitureVoid/VoidBookcase.cs +++ b/Tiles/FurnitureVoid/VoidBookcase.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpBookcase(); + this.SetUpBookcase(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Bookcase"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidBookcase.png b/Tiles/FurnitureVoid/VoidBookcase.png index fb64da53ee..583e659251 100644 Binary files a/Tiles/FurnitureVoid/VoidBookcase.png and b/Tiles/FurnitureVoid/VoidBookcase.png differ diff --git a/Tiles/FurnitureVoid/VoidCandelabra.cs b/Tiles/FurnitureVoid/VoidCandelabra.cs index 23afc38c57..075c9572d9 100644 --- a/Tiles/FurnitureVoid/VoidCandelabra.cs +++ b/Tiles/FurnitureVoid/VoidCandelabra.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpCandelabra(); + this.SetUpCandelabra(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Candelabra"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidCandelabra.png b/Tiles/FurnitureVoid/VoidCandelabra.png index a0adab10e7..adb9441ac9 100644 Binary files a/Tiles/FurnitureVoid/VoidCandelabra.png and b/Tiles/FurnitureVoid/VoidCandelabra.png differ diff --git a/Tiles/FurnitureVoid/VoidCandle.cs b/Tiles/FurnitureVoid/VoidCandle.cs index bc9e402040..522ada233e 100644 --- a/Tiles/FurnitureVoid/VoidCandle.cs +++ b/Tiles/FurnitureVoid/VoidCandle.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpCandle(); + this.SetUpCandle(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Candle"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidCandle.png b/Tiles/FurnitureVoid/VoidCandle.png index 3febb02854..32b109fca2 100644 Binary files a/Tiles/FurnitureVoid/VoidCandle.png and b/Tiles/FurnitureVoid/VoidCandle.png differ diff --git a/Tiles/FurnitureVoid/VoidChair.cs b/Tiles/FurnitureVoid/VoidChair.cs index d7870d874e..d060c0da73 100644 --- a/Tiles/FurnitureVoid/VoidChair.cs +++ b/Tiles/FurnitureVoid/VoidChair.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpChair(); + this.SetUpChair(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Chair"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidChair.png b/Tiles/FurnitureVoid/VoidChair.png index 3ff7115400..3db9215362 100644 Binary files a/Tiles/FurnitureVoid/VoidChair.png and b/Tiles/FurnitureVoid/VoidChair.png differ diff --git a/Tiles/FurnitureVoid/VoidChandelier.cs b/Tiles/FurnitureVoid/VoidChandelier.cs index 1f15ef52db..e41a7a0f1e 100644 --- a/Tiles/FurnitureVoid/VoidChandelier.cs +++ b/Tiles/FurnitureVoid/VoidChandelier.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpChandelier(); + this.SetUpChandelier(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Chandelier"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidChandelier.png b/Tiles/FurnitureVoid/VoidChandelier.png index 6c64eac4e7..d10126bc38 100644 Binary files a/Tiles/FurnitureVoid/VoidChandelier.png and b/Tiles/FurnitureVoid/VoidChandelier.png differ diff --git a/Tiles/FurnitureVoid/VoidChest.cs b/Tiles/FurnitureVoid/VoidChest.cs index 464bbf0d0d..b05d86daf7 100644 --- a/Tiles/FurnitureVoid/VoidChest.cs +++ b/Tiles/FurnitureVoid/VoidChest.cs @@ -30,29 +30,7 @@ namespace CalamityMod.Tiles.FurnitureVoid return true; } - public string MapChestName(string name, int i, int j) - { - int left = i; - int top = j; - Tile tile = Main.tile[i, j]; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - if (Main.chest[chest].name == "") - { - return name; - } - else - { - return name + ": " + Main.chest[chest].name; - } - } + public string MapChestName(string name, int i, int j) => CalamityUtils.GetMapChestName(name, i, j); public override void NumDust(int i, int j, bool fail, ref int num) { diff --git a/Tiles/FurnitureVoid/VoidChest.png b/Tiles/FurnitureVoid/VoidChest.png index d1977498b7..9f0813f231 100644 Binary files a/Tiles/FurnitureVoid/VoidChest.png and b/Tiles/FurnitureVoid/VoidChest.png differ diff --git a/Tiles/FurnitureVoid/VoidChest_Highlight.png b/Tiles/FurnitureVoid/VoidChest_Highlight.png index 88b1a6264c..263deacc31 100644 Binary files a/Tiles/FurnitureVoid/VoidChest_Highlight.png and b/Tiles/FurnitureVoid/VoidChest_Highlight.png differ diff --git a/Tiles/FurnitureVoid/VoidClock.cs b/Tiles/FurnitureVoid/VoidClock.cs index 506003f84a..f8991975ed 100644 --- a/Tiles/FurnitureVoid/VoidClock.cs +++ b/Tiles/FurnitureVoid/VoidClock.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpClock(); + this.SetUpClock(true); animationFrameHeight = 90; ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Obelisk"); diff --git a/Tiles/FurnitureVoid/VoidClock.png b/Tiles/FurnitureVoid/VoidClock.png index 35ca8cdfdf..80483130b5 100644 Binary files a/Tiles/FurnitureVoid/VoidClock.png and b/Tiles/FurnitureVoid/VoidClock.png differ diff --git a/Tiles/FurnitureVoid/VoidClock_Highlight.png b/Tiles/FurnitureVoid/VoidClock_Highlight.png index 70251f1435..906dd98af6 100644 Binary files a/Tiles/FurnitureVoid/VoidClock_Highlight.png and b/Tiles/FurnitureVoid/VoidClock_Highlight.png differ diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.cs b/Tiles/FurnitureVoid/VoidDoorClosed.cs index ecf7ac19ff..b6bced9a35 100644 --- a/Tiles/FurnitureVoid/VoidDoorClosed.cs +++ b/Tiles/FurnitureVoid/VoidDoorClosed.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpDoorClosed(); + this.SetUpDoorClosed(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidDoorClosed.png b/Tiles/FurnitureVoid/VoidDoorClosed.png index 67e4f6925d..ecb38a0280 100644 Binary files a/Tiles/FurnitureVoid/VoidDoorClosed.png and b/Tiles/FurnitureVoid/VoidDoorClosed.png differ diff --git a/Tiles/FurnitureVoid/VoidDoorClosed_Highlight.png b/Tiles/FurnitureVoid/VoidDoorClosed_Highlight.png index e392bbe097..207be55947 100644 Binary files a/Tiles/FurnitureVoid/VoidDoorClosed_Highlight.png and b/Tiles/FurnitureVoid/VoidDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.cs b/Tiles/FurnitureVoid/VoidDoorOpen.cs index 6e2be97437..1744fde6f7 100644 --- a/Tiles/FurnitureVoid/VoidDoorOpen.cs +++ b/Tiles/FurnitureVoid/VoidDoorOpen.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpDoorOpen(); + this.SetUpDoorOpen(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Door"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidDoorOpen.png b/Tiles/FurnitureVoid/VoidDoorOpen.png index b4598f2bfd..6e345688ea 100644 Binary files a/Tiles/FurnitureVoid/VoidDoorOpen.png and b/Tiles/FurnitureVoid/VoidDoorOpen.png differ diff --git a/Tiles/FurnitureVoid/VoidDoorOpen_Highlight.png b/Tiles/FurnitureVoid/VoidDoorOpen_Highlight.png index a1adcf98c1..0d39ed88cb 100644 Binary files a/Tiles/FurnitureVoid/VoidDoorOpen_Highlight.png and b/Tiles/FurnitureVoid/VoidDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureVoid/VoidDresser.png b/Tiles/FurnitureVoid/VoidDresser.png index 2b42cf3f14..a3ab988098 100644 Binary files a/Tiles/FurnitureVoid/VoidDresser.png and b/Tiles/FurnitureVoid/VoidDresser.png differ diff --git a/Tiles/FurnitureVoid/VoidDresser_Highlight.png b/Tiles/FurnitureVoid/VoidDresser_Highlight.png index e365224338..4cd60b6540 100644 Binary files a/Tiles/FurnitureVoid/VoidDresser_Highlight.png and b/Tiles/FurnitureVoid/VoidDresser_Highlight.png differ diff --git a/Tiles/FurnitureVoid/VoidLamp.cs b/Tiles/FurnitureVoid/VoidLamp.cs index d6ded956e8..10c6a12a0b 100644 --- a/Tiles/FurnitureVoid/VoidLamp.cs +++ b/Tiles/FurnitureVoid/VoidLamp.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpLamp(); + this.SetUpLamp(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Lamp"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidLamp.png b/Tiles/FurnitureVoid/VoidLamp.png index c5e0cfa480..bef9097dfa 100644 Binary files a/Tiles/FurnitureVoid/VoidLamp.png and b/Tiles/FurnitureVoid/VoidLamp.png differ diff --git a/Tiles/FurnitureVoid/VoidLantern.cs b/Tiles/FurnitureVoid/VoidLantern.cs index 88273c9e3e..7610071d71 100644 --- a/Tiles/FurnitureVoid/VoidLantern.cs +++ b/Tiles/FurnitureVoid/VoidLantern.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpLantern(); + this.SetUpLantern(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Lantern"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidLantern.png b/Tiles/FurnitureVoid/VoidLantern.png index 088769ea22..1f3a99faf9 100644 Binary files a/Tiles/FurnitureVoid/VoidLantern.png and b/Tiles/FurnitureVoid/VoidLantern.png differ diff --git a/Tiles/FurnitureVoid/VoidPiano.cs b/Tiles/FurnitureVoid/VoidPiano.cs index eaa3d72a7d..5910622376 100644 --- a/Tiles/FurnitureVoid/VoidPiano.cs +++ b/Tiles/FurnitureVoid/VoidPiano.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpPiano(); + this.SetUpPiano(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Piano"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidPiano.png b/Tiles/FurnitureVoid/VoidPiano.png index a4723c3804..ab83458354 100644 Binary files a/Tiles/FurnitureVoid/VoidPiano.png and b/Tiles/FurnitureVoid/VoidPiano.png differ diff --git a/Tiles/FurnitureVoid/VoidSink.cs b/Tiles/FurnitureVoid/VoidSink.cs index fd38170649..83208f8cd8 100644 --- a/Tiles/FurnitureVoid/VoidSink.cs +++ b/Tiles/FurnitureVoid/VoidSink.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpSink(); + this.SetUpSink(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Sink"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidSink.png b/Tiles/FurnitureVoid/VoidSink.png index 2ebdae0850..6fa1881be5 100644 Binary files a/Tiles/FurnitureVoid/VoidSink.png and b/Tiles/FurnitureVoid/VoidSink.png differ diff --git a/Tiles/FurnitureVoid/VoidSofa.cs b/Tiles/FurnitureVoid/VoidSofa.cs index af37badf8d..36dcc16caf 100644 --- a/Tiles/FurnitureVoid/VoidSofa.cs +++ b/Tiles/FurnitureVoid/VoidSofa.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpSofa(); + this.SetUpSofa(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Sofa"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidSofa.png b/Tiles/FurnitureVoid/VoidSofa.png index f352a378ff..c96ac58c62 100644 Binary files a/Tiles/FurnitureVoid/VoidSofa.png and b/Tiles/FurnitureVoid/VoidSofa.png differ diff --git a/Tiles/FurnitureVoid/VoidTable.cs b/Tiles/FurnitureVoid/VoidTable.cs index a0789a4658..212d408c1d 100644 --- a/Tiles/FurnitureVoid/VoidTable.cs +++ b/Tiles/FurnitureVoid/VoidTable.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpTable(); + this.SetUpTable(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Table"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidTable.png b/Tiles/FurnitureVoid/VoidTable.png index c7f028fc6c..220ca1f1c3 100644 Binary files a/Tiles/FurnitureVoid/VoidTable.png and b/Tiles/FurnitureVoid/VoidTable.png differ diff --git a/Tiles/FurnitureVoid/VoidWorkbench.cs b/Tiles/FurnitureVoid/VoidWorkbench.cs index 348ca1c050..5ba9e26185 100644 --- a/Tiles/FurnitureVoid/VoidWorkbench.cs +++ b/Tiles/FurnitureVoid/VoidWorkbench.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Tiles.FurnitureVoid { public override void SetDefaults() { - this.SetUpWorkBench(); + this.SetUpWorkBench(true); ModTranslation name = CreateMapEntryName(); name.SetDefault("Void Work Bench"); AddMapEntry(new Color(191, 142, 111), name); diff --git a/Tiles/FurnitureVoid/VoidWorkbench.png b/Tiles/FurnitureVoid/VoidWorkbench.png index 6f4b146096..01902e9b8f 100644 Binary files a/Tiles/FurnitureVoid/VoidWorkbench.png and b/Tiles/FurnitureVoid/VoidWorkbench.png differ diff --git a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs index e7a37e66cc..eb3597f6a3 100644 --- a/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs +++ b/Tiles/LivingFire/LivingBrimstoneFireBlockTile.cs @@ -69,7 +69,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] || CalamityMod.livingFireBlockList.Contains(tile.type))) + if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type))) { return true; } diff --git a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs index 039532b093..84d244b13e 100644 --- a/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs +++ b/Tiles/LivingFire/LivingGodSlayerFireBlockTile.cs @@ -68,7 +68,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] || CalamityMod.livingFireBlockList.Contains(tile.type))) + if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type))) { return true; } diff --git a/Tiles/LivingFire/LivingHolyFireBlockTile.cs b/Tiles/LivingFire/LivingHolyFireBlockTile.cs index 6d334a5e41..0a44490dcc 100644 --- a/Tiles/LivingFire/LivingHolyFireBlockTile.cs +++ b/Tiles/LivingFire/LivingHolyFireBlockTile.cs @@ -68,7 +68,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] || CalamityMod.livingFireBlockList.Contains(tile.type))) + if (tile.active() && (Main.tileSolid[tile.type] || CalamityLists.livingFireBlockList.Contains(tile.type))) { return true; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index c458c2b7fa..245ab5fbc8 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index eb0efe86ad..d6e8259014 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -26,11 +26,6 @@ namespace CalamityMod.Tiles.Ores Main.tileSpelunker[Type] = true; } - public override bool CanExplode(int i, int j) - { - return NPC.downedBoss2; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; diff --git a/Tiles/Ores/AstralOre.cs b/Tiles/Ores/AstralOre.cs index 0d6ea46047..41a27f994b 100644 --- a/Tiles/Ores/AstralOre.cs +++ b/Tiles/Ores/AstralOre.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedStarGod; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/AuricOre.cs b/Tiles/Ores/AuricOre.cs index cdde9877c3..ea89a4b39f 100644 --- a/Tiles/Ores/AuricOre.cs +++ b/Tiles/Ores/AuricOre.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedYharon; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/ChaoticOre.cs b/Tiles/Ores/ChaoticOre.cs index 605c9cdfcd..ee38d34235 100644 --- a/Tiles/Ores/ChaoticOre.cs +++ b/Tiles/Ores/ChaoticOre.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return NPC.downedGolemBoss; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/CharredOre.cs b/Tiles/Ores/CharredOre.cs index 413aef9b9f..a413f1f556 100644 --- a/Tiles/Ores/CharredOre.cs +++ b/Tiles/Ores/CharredOre.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.Ores name.SetDefault("Charred Ore"); AddMapEntry(new Color(17, 16, 26), name); mineResist = 6f; - minPick = 180; + minPick = 150; soundType = SoundID.Tink; dustType = 235; Main.tileSpelunker[Type] = true; @@ -40,7 +40,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedBrimstoneElemental; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/CryonicOre.cs b/Tiles/Ores/CryonicOre.cs index d16ea586ab..e10737a1a6 100644 --- a/Tiles/Ores/CryonicOre.cs +++ b/Tiles/Ores/CryonicOre.cs @@ -1,5 +1,3 @@ - -using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,7 +29,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return CalamityWorld.downedCryogen; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/ExodiumOre.cs b/Tiles/Ores/ExodiumOre.cs index d77178885a..858e3b3e67 100644 --- a/Tiles/Ores/ExodiumOre.cs +++ b/Tiles/Ores/ExodiumOre.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Tiles.Ores Main.tileBlockLight[Type] = true; CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithSet(Type, TileID.LunarOre); ModTranslation name = CreateMapEntryName(); name.SetDefault("Exodium Ore"); @@ -26,11 +27,12 @@ namespace CalamityMod.Tiles.Ores Main.tileSpelunker[Type] = true; drop = ModContent.ItemType(); base.SetDefaults(); + + TileID.Sets.ChecksForMerge[Type] = true; } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 2 : 4; - } + public override bool CanExplode(int i, int j) => false; + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 2 : 4; } } diff --git a/Tiles/Ores/HallowedOre.cs b/Tiles/Ores/HallowedOre.cs new file mode 100644 index 0000000000..9d0161b1ff --- /dev/null +++ b/Tiles/Ores/HallowedOre.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Ores +{ + public class HallowedOre : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileSolid[Type] = true; + Main.tileMergeDirt[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 690; + + CalamityUtils.MergeWithGeneral(Type); + drop = ModContent.ItemType(); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Hallowed Ore"); + AddMapEntry(new Color(250, 250, 150), name); + mineResist = 3f; + minPick = 180; + soundType = SoundID.Tink; + Main.tileSpelunker[Type] = true; + } + + public override bool CanExplode(int i, int j) + { + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0.07f; + g = 0.07f; + b = 0.04f; + } + } +} diff --git a/Tiles/Ores/PerennialOre.cs b/Tiles/Ores/PerennialOre.cs index ac1c95fe97..34c71a9f1a 100644 --- a/Tiles/Ores/PerennialOre.cs +++ b/Tiles/Ores/PerennialOre.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return NPC.downedPlantBoss; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Ores/PerennialOre.png b/Tiles/Ores/PerennialOre.png index 6e61b27a38..9e8f6cd3e5 100644 Binary files a/Tiles/Ores/PerennialOre.png and b/Tiles/Ores/PerennialOre.png differ diff --git a/Tiles/Ores/UelibloomOre.cs b/Tiles/Ores/UelibloomOre.cs index 070d71d91f..c0ce986162 100644 --- a/Tiles/Ores/UelibloomOre.cs +++ b/Tiles/Ores/UelibloomOre.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Tiles.Ores public override bool CanExplode(int i, int j) { - return NPC.downedMoonlord; + return false; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/PerennialBrick.png b/Tiles/PerennialBrick.png index 3cba54993c..e98f0d83c7 100644 Binary files a/Tiles/PerennialBrick.png and b/Tiles/PerennialBrick.png differ diff --git a/Tiles/PlacedRock.cs b/Tiles/PlacedRock.cs new file mode 100644 index 0000000000..742922575a --- /dev/null +++ b/Tiles/PlacedRock.cs @@ -0,0 +1,40 @@ +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class PlacedRock : ModTile + { + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + dustType = DustID.Stone; + drop = ModContent.ItemType(); + + AddMapEntry(new Color(83, 91, 102)); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/PlacedRock.png b/Tiles/PlacedRock.png new file mode 100644 index 0000000000..26f0ed28a1 Binary files /dev/null and b/Tiles/PlacedRock.png differ diff --git a/Tiles/Plates/Chaosplate.cs b/Tiles/Plates/Chaosplate.cs index 2e72391f1d..45a212a879 100644 --- a/Tiles/Plates/Chaosplate.cs +++ b/Tiles/Plates/Chaosplate.cs @@ -9,8 +9,19 @@ namespace CalamityMod.Tiles.Plates { public class Chaosplate : ModTile { + internal static Texture2D GlowTexture; + internal static Texture2D PulseTexture; + internal static Color[] PulseColors; + public override void SetDefaults() { + if (!Main.dedServ) + { + PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplatePulse"); + PulseColors = new Color[PulseTexture.Width]; + PulseTexture.GetData(PulseColors); + GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplateGlow"); + } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -38,18 +49,18 @@ namespace CalamityMod.Tiles.Plates public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null || PulseTexture is null) + return; + int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplateGlow"); 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; // Glowmask 'pulse' effect - Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/ChaosplatePulse"); - int factor = (int)Main.time % pulseMap.Width; - Color[] pulseColours = new Color[pulseMap.Width]; - pulseMap.GetData(pulseColours); - float brightness = pulseColours[factor].R / 255f; + int factor = (int)Main.time % PulseTexture.Width; + float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); @@ -57,14 +68,13 @@ namespace CalamityMod.Tiles.Plates //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (trackTile.halfBrick()) { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } diff --git a/Tiles/Plates/Cinderplate.cs b/Tiles/Plates/Cinderplate.cs index 9929c9dda5..fc2c77de8c 100644 --- a/Tiles/Plates/Cinderplate.cs +++ b/Tiles/Plates/Cinderplate.cs @@ -9,8 +9,18 @@ namespace CalamityMod.Tiles.Plates { public class Cinderplate : ModTile { + internal static Texture2D GlowTexture; + internal static Texture2D PulseTexture; + internal static Color[] PulseColors; public override void SetDefaults() { + if (!Main.dedServ) + { + PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplatePulse"); + PulseColors = new Color[PulseTexture.Width]; + PulseTexture.GetData(PulseColors); + GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplateGlow"); + } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -38,18 +48,18 @@ namespace CalamityMod.Tiles.Plates public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null || PulseTexture is null) + return; + int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplateGlow"); 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; // Glowmask 'pulse' effect - Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/CinderplatePulse"); - int factor = (int)Main.time % pulseMap.Width; - Color[] pulseColours = new Color[pulseMap.Width]; - pulseMap.GetData(pulseColours); - float brightness = pulseColours[factor].R / 255f; + int factor = (int)Main.time % PulseTexture.Width; + float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); @@ -57,14 +67,13 @@ namespace CalamityMod.Tiles.Plates //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (trackTile.halfBrick()) { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } diff --git a/Tiles/Plates/Elumplate.cs b/Tiles/Plates/Elumplate.cs index a9543aeee3..7edc8c1006 100644 --- a/Tiles/Plates/Elumplate.cs +++ b/Tiles/Plates/Elumplate.cs @@ -9,8 +9,18 @@ namespace CalamityMod.Tiles.Plates { public class Elumplate : ModTile { + internal static Texture2D GlowTexture; + internal static Texture2D PulseTexture; + internal static Color[] PulseColors; public override void SetDefaults() { + if (!Main.dedServ) + { + PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplatePulse"); + PulseColors = new Color[PulseTexture.Width]; + PulseTexture.GetData(PulseColors); + GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplateGlow"); + } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -38,18 +48,18 @@ namespace CalamityMod.Tiles.Plates public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null || PulseTexture is null) + return; + int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplateGlow"); 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; // Glowmask 'pulse' effect - Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/ElumplatePulse"); - int factor = (int)Main.time % pulseMap.Width; - Color[] pulseColours = new Color[pulseMap.Width]; - pulseMap.GetData(pulseColours); - float brightness = pulseColours[factor].R / 255f; + int factor = (int)Main.time % PulseTexture.Width; + float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); @@ -57,14 +67,13 @@ namespace CalamityMod.Tiles.Plates //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (trackTile.halfBrick()) { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } diff --git a/Tiles/Plates/Navyplate.cs b/Tiles/Plates/Navyplate.cs index 22d78b4f28..001b4bdbd9 100644 --- a/Tiles/Plates/Navyplate.cs +++ b/Tiles/Plates/Navyplate.cs @@ -9,8 +9,18 @@ namespace CalamityMod.Tiles.Plates { public class Navyplate : ModTile { + internal static Texture2D GlowTexture; + internal static Texture2D PulseTexture; + internal static Color[] PulseColors; public override void SetDefaults() { + if (!Main.dedServ) + { + PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplatePulse"); + PulseColors = new Color[PulseTexture.Width]; + PulseTexture.GetData(PulseColors); + GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplateGlow"); + } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -38,18 +48,18 @@ namespace CalamityMod.Tiles.Plates public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null || PulseTexture is null) + return; + int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplateGlow"); 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; // Glowmask 'pulse' effect - Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/NavyplatePulse"); - int factor = (int)Main.time % pulseMap.Width; - Color[] pulseColours = new Color[pulseMap.Width]; - pulseMap.GetData(pulseColours); - float brightness = pulseColours[factor].R / 255f; + int factor = (int)Main.time % PulseTexture.Width; + float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); @@ -57,14 +67,13 @@ namespace CalamityMod.Tiles.Plates //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (trackTile.halfBrick()) { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } diff --git a/Tiles/Plates/PlagueContainmentCells.cs b/Tiles/Plates/PlagueContainmentCells.cs index 29dfb1d420..6ad6dab9d4 100644 --- a/Tiles/Plates/PlagueContainmentCells.cs +++ b/Tiles/Plates/PlagueContainmentCells.cs @@ -9,8 +9,18 @@ namespace CalamityMod.Tiles.Plates { public class PlagueContainmentCells : ModTile { + internal static Texture2D GlowTexture; + internal static Texture2D PulseTexture; + internal static Color[] PulseColors; public override void SetDefaults() { + if (!Main.dedServ) + { + PulseTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); + PulseColors = new Color[PulseTexture.Width]; + PulseTexture.GetData(PulseColors); + GlowTexture = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"); + } Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; @@ -43,18 +53,18 @@ namespace CalamityMod.Tiles.Plates public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + // If the cached textures don't exist for some reason, don't bother using them. + if (GlowTexture is null || PulseTexture is null) + return; + int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsGlow"); 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; // Glowmask 'pulse' effect - Texture2D pulseMap = ModContent.GetTexture("CalamityMod/Tiles/Plates/PlagueContainmentCellsPulse"); - int factor = (int)Main.time % pulseMap.Width; - Color[] pulseColours = new Color[pulseMap.Width]; - pulseMap.GetData(pulseColours); - float brightness = pulseColours[factor].R / 255f; + int factor = (int)Main.time % PulseTexture.Width; + float brightness = PulseColors[factor].R / 255f; int drawBrightness = (int)(40 * brightness) + 10; Color drawColour = GetDrawColour(i, j, new Color(drawBrightness, drawBrightness, drawBrightness, drawBrightness)); @@ -62,14 +72,13 @@ namespace CalamityMod.Tiles.Plates //Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); Tile trackTile = Main.tile[i, j]; - double num6 = Main.time * 0.08; if (!trackTile.halfBrick() && trackTile.slope() == 0) { - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (trackTile.halfBrick()) { - Main.spriteBatch.Draw(glowmask, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } diff --git a/Tiles/SCalAltar.cs b/Tiles/SCalAltar.cs new file mode 100644 index 0000000000..74239da3d5 --- /dev/null +++ b/Tiles/SCalAltar.cs @@ -0,0 +1,112 @@ +using CalamityMod.Events; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class SCalAltar : ModTile + { + public const int Width = 4; + public const int Height = 3; + public override void SetDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSpelunker[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Altar"); + AddMapEntry(new Color(43, 19, 42), name); + disableSmartCursor = true; + } + + public override bool CanExplode(int i, int j) => false; + + public override bool CreateDust(int i, int j, ref int type) + { + // Fire dust. + type = 6; + return true; + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType()); + } + + public override bool NewRightClick(int i, int j) + { + Tile tile = Main.tile[i, j]; + + int left = i - tile.frameX / 18; + int top = j - tile.frameY / 18; + + if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && + !Main.LocalPlayer.HasItem(ModContent.ItemType())) + { + return true; + } + + if (NPC.AnyNPCs(ModContent.NPCType()) || BossRushEvent.BossRushActive) + return true; + + if (CalamityUtils.CountProjectiles(ModContent.ProjectileType()) > 0) + return true; + + bool usingSpecialItem = Main.LocalPlayer.HasItem(ModContent.ItemType()); + + Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); + ritualSpawnPosition += new Vector2(-10f, -24f); + + Main.PlaySound(SoundID.DD2_EtherianPortalOpen, ritualSpawnPosition); + Projectile.NewProjectile(ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + + if (!usingSpecialItem) + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + + return true; + } + + public override void MouseOver(int i, int j) + { + if (Main.LocalPlayer.HasItem(ModContent.ItemType())) + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + else + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.showItemIcon = true; + } + + public override void MouseOverFar(int i, int j) + { + if (Main.LocalPlayer.HasItem(ModContent.ItemType())) + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + else + Main.LocalPlayer.showItemIcon2 = ModContent.ItemType(); + + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.showItemIcon = true; + } + } +} diff --git a/Tiles/SCalAltar.png b/Tiles/SCalAltar.png new file mode 100644 index 0000000000..430144741e Binary files /dev/null and b/Tiles/SCalAltar.png differ diff --git a/Tiles/ShadowspecBarTile.cs b/Tiles/ShadowspecBarTile.cs new file mode 100644 index 0000000000..82bcb4d078 --- /dev/null +++ b/Tiles/ShadowspecBarTile.cs @@ -0,0 +1,48 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class ShadowspecBarTile : ModTile + { + public override void SetDefaults() + { + Main.tileShine[Type] = 1000; + Main.tileSolid[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + dustType = ModContent.DustType(); + drop = ModContent.ItemType(); + + AddMapEntry(new Color(128, 41, 149)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + type = ModContent.DustType(); + return true; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/ShadowspecBarTile.png b/Tiles/ShadowspecBarTile.png new file mode 100644 index 0000000000..4e11d12d08 Binary files /dev/null and b/Tiles/ShadowspecBarTile.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 657024ec36..83a85d5457 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Tiles.SunkenSea name.SetDefault("Navystone"); AddMapEntry(new Color(0, 50, 50), name); mineResist = 2f; - minPick = 55; soundType = SoundID.Tink; } diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 03acfe7ddd..6337a4a41e 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Tiles.SunkenSea name.SetDefault("Sea Prism"); AddMapEntry(new Color(0, 150, 200), name); mineResist = 3f; - minPick = 55; soundType = SoundID.Tink; Main.tileSpelunker[Type] = true; } diff --git a/Tiles/UelibloomBar.cs b/Tiles/UelibloomBar.cs new file mode 100644 index 0000000000..e342ad4b86 --- /dev/null +++ b/Tiles/UelibloomBar.cs @@ -0,0 +1,55 @@ +using CalamityMod.Dusts.Furniture; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class UelibloomBar : ModTile + { + public override void SetDefaults() + { + Main.tileShine[Type] = 1000; + Main.tileSolid[Type] = true; + Main.tileSolidTop[Type] = true; + Main.tileFrameImportant[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + + dustType = ModContent.DustType(); + drop = ModContent.ItemType(); + + AddMapEntry(new Color(134, 209, 102)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + if (Main.rand.NextBool(2)) + { + type = ModContent.DustType(); + } + else + { + type = ModContent.DustType(); + } + return true; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + WorldGen.Check1x1(i, j, Type); + return true; + } + + public override void PlaceInWorld(int i, int j, Item item) + { + Main.tile[i, j].frameX = 0; + Main.tile[i, j].frameY = 0; + } + } +} diff --git a/Tiles/UelibloomBar.png b/Tiles/UelibloomBar.png new file mode 100644 index 0000000000..a4ea595d59 Binary files /dev/null and b/Tiles/UelibloomBar.png differ diff --git a/TrailGeneration/PrimitiveTrail.cs b/TrailGeneration/PrimitiveTrail.cs new file mode 100644 index 0000000000..44754a9700 --- /dev/null +++ b/TrailGeneration/PrimitiveTrail.cs @@ -0,0 +1,279 @@ +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.Graphics.Shaders; + +namespace CalamityMod +{ + public class PrimitiveTrail + { + public struct VertexPosition2DColor : IVertexType + { + public Vector2 Position; + public Color Color; + public Vector2 TextureCoordinates; + public VertexDeclaration VertexDeclaration => _vertexDeclaration; + + private static readonly VertexDeclaration _vertexDeclaration = new VertexDeclaration(new VertexElement[] + { + new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0), + new VertexElement(8, VertexElementFormat.Color, VertexElementUsage.Color, 0), + new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), + }); + public VertexPosition2DColor(Vector2 position, Color color, Vector2 textureCoordinates) + { + Position = position; + Color = color; + TextureCoordinates = textureCoordinates; + } + } + + public delegate float VertexWidthFunction(float completionRatio); + public delegate Color VertexColorFunction(float completionRatio); + + public VertexWidthFunction WidthFunction; + public VertexColorFunction ColorFunction; + + public BasicEffect BaseEffect; + public MiscShaderData SpecialShader; + public TrailPointRetrievalFunction TrailPointFunction; + + public Vector2 OverridingStickPointStart = Vector2.Zero; + public Vector2 OverridingStickPointEnd = Vector2.Zero; + + public delegate List TrailPointRetrievalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable originalRotations = null); + + public PrimitiveTrail(VertexWidthFunction widthFunction, VertexColorFunction colorFunction, TrailPointRetrievalFunction pointFunction = null, MiscShaderData specialShader = null) + { + if (widthFunction is null || colorFunction is null) + throw new NullReferenceException($"In order to create a primitive trail, a non-null {(widthFunction is null ? "width" : "color")} function must be specified."); + WidthFunction = widthFunction; + ColorFunction = colorFunction; + + // Default to bezier smoothening if nothing else is inputted. + if (pointFunction is null) + pointFunction = SmoothBezierPointRetreivalFunction; + + TrailPointFunction = pointFunction; + + if (specialShader != null) + SpecialShader = specialShader; + + BaseEffect = new BasicEffect(Main.instance.GraphicsDevice) + { + VertexColorEnabled = true, + TextureEnabled = false + }; + UpdateBaseEffect(out _, out _); + } + + public void UpdateBaseEffect(out Matrix effectProjection, out Matrix effectView) + { + // Screen bounds. + int height = Main.instance.GraphicsDevice.Viewport.Height; + + Vector2 zoom = Main.GameViewMatrix.Zoom; + Matrix zoomScaleMatrix = Matrix.CreateScale(zoom.X, zoom.Y, 1f); + + // Get a matrix that aims towards the Z axis (these calculations are relative to a 2D world). + effectView = Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up); + + // Offset the matrix to the appropriate position. + effectView *= Matrix.CreateTranslation(0f, -height, 0f); + + // Flip the matrix around 180 degrees. + effectView *= Matrix.CreateRotationZ(MathHelper.Pi); + + // And account for the current zoom. + effectView *= zoomScaleMatrix; + + effectProjection = Matrix.CreateOrthographicOffCenter(0f, Main.screenWidth * zoom.X, 0f, Main.screenHeight * zoom.Y, 0f, 1f) * zoomScaleMatrix; + BaseEffect.View = effectView; + BaseEffect.Projection = effectProjection; + } + + public static List RigidPointRetreivalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable _ = null) + { + List basePoints = originalPositions.Where(originalPosition => originalPosition != Vector2.Zero).ToList(); + List endPoints = new List(); + + if (basePoints.Count < 3) + return endPoints; + + // Remap the original positions across a certain length. + for (int i = 0; i < totalTrailPoints; i++) + { + float completionRatio = i / (float)totalTrailPoints; + int currentColorIndex = (int)(completionRatio * (basePoints.Count - 1)); + Vector2 currentColor = basePoints[currentColorIndex]; + Vector2 nextColor = basePoints[(currentColorIndex + 1) % basePoints.Count]; + endPoints.Add(Vector2.Lerp(currentColor, nextColor, completionRatio * (basePoints.Count - 1) % 0.999f) + generalOffset); + } + return endPoints; + } + + // NOTE: Beziers can be laggy when a lot of control points are used, since our implementation + // uses a recursive Lerp that gets more computationally expensive the more original indices. + // n(n + 1)/2 linear interpolations to be precise, where n is the amount of original indices. + public static List SmoothBezierPointRetreivalFunction(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable originalRotations = null) + { + List controlPoints = new List(); + for (int i = 0; i < originalPositions.Count(); i++) + { + // Don't incorporate points that are zeroed out. + // They are almost certainly a result of incomplete oldPos arrays. + if (originalPositions.ElementAt(i) == Vector2.Zero) + continue; + controlPoints.Add(originalPositions.ElementAt(i) + generalOffset); + } + BezierCurve bezierCurve = new BezierCurve(controlPoints.ToArray()); + return controlPoints.Count <= 1 ? controlPoints : bezierCurve.GetPoints(totalTrailPoints); + } + + // Using this method requires oldRot be supplied to the Draw method for the sake of determining how many points need to be made at a given time step. + // Furthermore, since the point count is dynamic, the point count int parameter has no purpose. It can be supplied simply with zero. + public static List SmoothCatmullRomPointRetreivalFunction(IEnumerable originalPositions, Vector2 generalOffset, int _, IEnumerable originalRotations) + { + List smoothenedPoints = new List(); + for (int i = 0; i < originalPositions.Count() - 1; i++) + { + Vector2 currentPosition = originalPositions.ElementAt(i); + Vector2 aheadPosition = originalPositions.ElementAt(i + 1); + + // Don't incorporate points that are zeroed out. + // They are almost certainly a result of incomplete oldPos arrays. + if (currentPosition == Vector2.Zero || aheadPosition == Vector2.Zero) + continue; + + float currentRotation = MathHelper.WrapAngle(originalRotations.ElementAt(i)); + float aheadRotation = MathHelper.WrapAngle(originalRotations.ElementAt(i + 1)); + + // Determine the amount of extra points to draw based on the rotational offset between the two time steps. + int pointsToAdd = (int)Math.Round(Math.Abs(MathHelper.WrapAngle(aheadRotation - currentRotation)) * 8f / MathHelper.Pi); + + // Add a base point. + smoothenedPoints.Add(currentPosition + generalOffset); + + // If no new points are needed, skip this. + if (pointsToAdd == 0) + continue; + + float segmentLength = Vector2.Distance(currentPosition, aheadPosition); + float increment = 1f / (pointsToAdd + 2); + Vector2 backEnd = currentPosition + currentRotation.ToRotationVector2() * segmentLength; + Vector2 frontEnd = aheadPosition + aheadRotation.ToRotationVector2() * -segmentLength; + + // Create smoothened points based on a Catmull-Rom spline. + for (float j = increment; j < 1f; j += increment) + smoothenedPoints.Add(Vector2.CatmullRom(backEnd, currentPosition, aheadPosition, frontEnd, j) + generalOffset); + } + return smoothenedPoints; + } + + public VertexPosition2DColor[] GetVerticesFromTrailPoints(List trailPoints) + { + VertexPosition2DColor[] vertices = new VertexPosition2DColor[trailPoints.Count * 2 - 2]; + for (int i = 0; i < trailPoints.Count - 1; i++) + { + float completionRatio = i / (float)trailPoints.Count; + float widthAtVertex = WidthFunction(completionRatio); + Color vertexColor = ColorFunction(completionRatio); + + Vector2 currentPosition = trailPoints[i]; + Vector2 positionAhead = trailPoints[i + 1]; + Vector2 directionToAhead = (positionAhead - trailPoints[i]).SafeNormalize(Vector2.Zero); + + Vector2 leftCurrentTextureCoord = new Vector2(completionRatio, 0f); + Vector2 rightCurrentTextureCoord = new Vector2(completionRatio, 1f); + + // Point 90 degrees away from the direction towards the next point, and use it to mark the edges of the rectangle. + // This doesn't use RotatedBy for the sake of performance (there can potentially be a lot of trail points). + Vector2 sideDirection = new Vector2(-directionToAhead.Y, directionToAhead.X); + + Vector2 left = currentPosition - sideDirection * widthAtVertex; + Vector2 right = currentPosition + sideDirection * widthAtVertex; + if (i == 0 && OverridingStickPointStart != Vector2.Zero) + { + left = OverridingStickPointStart; + right = OverridingStickPointEnd; + } + + // What this is doing, at its core, is defining a rectangle based on two triangles. + // These triangles are defined based on the width of the strip at that point. + // The resulting rectangles combined are what make the trail itself. + vertices[i * 2] = new VertexPosition2DColor(left, vertexColor, leftCurrentTextureCoord); + vertices[i * 2 + 1] = new VertexPosition2DColor(right, vertexColor, rightCurrentTextureCoord); + } + + return vertices.ToArray(); + } + + public short[] GetIndicesFromTrailPoints(int pointCount) + { + // What this is doing is basically representing each point on the vertices list as + // indices. These indices should come together to create a tiny rectangle that acts + // as a segment on the trail. This is achieved here by splitting the indices (or rather, points) + // into 2 triangles, which requires 6 points. + // The logic here basically determines which indices are connected together. + int totalIndices = (pointCount - 1) * 6; + short[] indices = new short[totalIndices]; + + for (int i = 0; i < pointCount - 2; i++) + { + int startingTriangleIndex = i * 6; + int connectToIndex = i * 2; + indices[startingTriangleIndex] = (short)connectToIndex; + indices[startingTriangleIndex + 1] = (short)(connectToIndex + 1); + indices[startingTriangleIndex + 2] = (short)(connectToIndex + 2); + indices[startingTriangleIndex + 3] = (short)(connectToIndex + 2); + indices[startingTriangleIndex + 4] = (short)(connectToIndex + 1); + indices[startingTriangleIndex + 5] = (short)(connectToIndex + 3); + } + + return indices; + } + + public void Draw(IEnumerable originalPositions, Vector2 generalOffset, int totalTrailPoints, IEnumerable originalRotations = null) + { + Main.instance.GraphicsDevice.RasterizerState = RasterizerState.CullNone; + List trailPoints = TrailPointFunction(originalPositions, generalOffset, totalTrailPoints, originalRotations); + + // A trail with only one point or less has nothing to connect to, and therefore, can't make a trail. + if (trailPoints.Count <= 2) + return; + + // If the trail points have any NaN positions, don't draw anything. + if (trailPoints.Any(point => point.HasNaNs())) + return; + + // If the trail points are all equal, don't draw anything. + if (trailPoints.All(point => point == trailPoints[0])) + return; + + UpdateBaseEffect(out Matrix projection, out Matrix view); + VertexPosition2DColor[] vertices = GetVerticesFromTrailPoints(trailPoints); + + short[] triangleIndices = GetIndicesFromTrailPoints(trailPoints.Count); + + // Don't draw anything if the indicies/vertices are in any way invalid. + // If they are, the graphics engine, along with the entire game, will crash. + if (triangleIndices.Length % 6 != 0 || vertices.Length % 2 != 0) + return; + + if (SpecialShader != null) + { + SpecialShader.Shader.Parameters["uWorldViewProjection"].SetValue(view * projection); + SpecialShader.Apply(); + } + else + BaseEffect.CurrentTechnique.Passes[0].Apply(); + + Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length, triangleIndices, 0, triangleIndices.Length / 3); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + } + } +} \ No newline at end of file diff --git a/UI/AcidRainUI.cs b/UI/AcidRainUI.cs index 474e066518..ae342cdc6c 100644 --- a/UI/AcidRainUI.cs +++ b/UI/AcidRainUI.cs @@ -3,74 +3,16 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.UI { - public static class AcidRainUI + public class AcidRainUI : InvasionProgressUI { - public static void Draw(SpriteBatch spriteBatch) - { - bool draw = CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0; - if ((draw && !Main.LocalPlayer.Calamity().ZoneSulphur) || - (!draw && Main.LocalPlayer.Calamity().ZoneSulphur)) - return; - - float progressAlpha = 1f; - Vector2 screenCoords = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40); - if (Main.invasionProgressNearInvasion || Main.invasionProgressAlpha > 0f) - { - screenCoords.Y -= 85; - } - int sizeX = (int)(200f * progressAlpha); - int sizeY = (int)(45f * progressAlpha); - Rectangle screenCoordsRectangle = - new Rectangle((int)screenCoords.X - sizeX / 2, - (int)screenCoords.Y - sizeY / 2, sizeX, sizeY); - Texture2D barTexture = Main.colorBarTexture; - - // If you touch the netcode behind this without a good reason your life will come to an abrupt end -Dominic - if (CalamityWorld.rainingAcid || CalamityWorld.acidRainExtraDrawTime > 0) - { - Utils.DrawInvBG(spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); - - float progressRatio = 1f - CalamityWorld.AcidRainCompletionRatio; - string progressText = $"{((int)(100 * progressRatio)).ToString()}%"; - progressText = Language.GetTextValue("Game.WaveCleared", progressText); - spriteBatch.Draw(barTexture, screenCoords, null, Color.White, 0f, new Vector2(barTexture.Width / 2, 0f), progressAlpha, SpriteEffects.None, 0f); - Vector2 textMeasurement = Main.fontMouseText.MeasureString(progressText); - float adjustedAlpha = progressAlpha; - if (textMeasurement.Y > 22f) - { - adjustedAlpha *= 22f / textMeasurement.Y; - } - float barDrawOffsetX = 169f * progressAlpha; - float scaleY = 8f * progressAlpha; - Vector2 barDrawPosition = screenCoords + Vector2.UnitY * scaleY + Vector2.UnitX * 1f; - Utils.DrawBorderString(spriteBatch, progressText, barDrawPosition + new Vector2(0f, -4f), Color.White, adjustedAlpha, 0.5f, 1f, -1); - barDrawPosition += Vector2.UnitX * (progressRatio - 0.5f) * barDrawOffsetX; - spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 241, 51), 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * progressRatio, scaleY), SpriteEffects.None, 0f); - spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), new Color(255, 165, 0, 127), 0f, new Vector2(1f, 0.5f), new Vector2(2f, scaleY), SpriteEffects.None, 0f); - spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle?(new Rectangle(0, 0, 1, 1)), Color.Black, 0f, new Vector2(0f, 0.5f), new Vector2(barDrawOffsetX * (1f - progressRatio), scaleY), SpriteEffects.None, 0f); - - string invasionNameText = "Acid Rain"; - Vector2 textMeasurement2 = Main.fontMouseText.MeasureString(invasionNameText); - float x = 120f; - if (textMeasurement2.X > 200f) - { - x += textMeasurement2.X - 200f; - } - Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AcidRainIcon"); - Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80), (textMeasurement2 + new Vector2(iconTexture.Width + 12, 6f)) * progressAlpha); - if (Main.invasionProgressNearInvasion || Main.invasionProgressAlpha > 0f) - { - iconRectangle.Y -= 85; - } - Utils.DrawInvBG(spriteBatch, iconRectangle, AcidRainEvent.TextColor * 0.5f); - spriteBatch.Draw(iconTexture, iconRectangle.Left() + Vector2.UnitX * progressAlpha * 8f, null, Color.White, 0f, new Vector2(0f, iconTexture.Height / 2), progressAlpha * 0.8f, SpriteEffects.None, 0f); - Utils.DrawBorderString(spriteBatch, invasionNameText, iconRectangle.Right() + Vector2.UnitX * progressAlpha * -22f, Color.White, progressAlpha * 0.9f, 1f, 0.4f, -1); - } - } + public override bool IsActive => CalamityWorld.rainingAcid && Main.LocalPlayer.Calamity().ZoneSulphur; + 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"); } } diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index 508605e955..24ea2c6b89 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -1,5 +1,4 @@ - -using CalamityMod.World; +using CalamityMod.Events; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -66,12 +65,13 @@ namespace CalamityMod.UI public static void UpdateAndDraw(SpriteBatch sb) { //Don't do anything if not open - bool forceOpenAndTeleport = CalamityWorld.bossRushStage == 12 && !NPCs.CalamityGlobalNPC.AnyBossNPCS() && !Main.player[Main.myPlayer].ZoneUnderworldHeight; + bool forceOpenAndTeleport = BossRushEvent.BossRushStage < BossRushEvent.Bosses.Count - 1 && BossRushEvent.CurrentlyFoughtBoss == NPCID.WallofFlesh && + !CalamityUtils.AnyBossNPCS() && !Main.player[Main.myPlayer].ZoneUnderworldHeight; if (forceOpenAndTeleport) { Open = true; } - else if (CalamityWorld.bossRushActive) + else if (BossRushEvent.BossRushActive) Open = false; if (!Open) return; diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index a82d9af324..b8f786368e 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -1,11 +1,12 @@ using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.Calamitas; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Perforator; @@ -28,16 +29,18 @@ using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + namespace CalamityMod.UI { - /* + /* Heyo! Here's some things you might need to know about this class and where to change things: In the "Load" method is where the "OneToMany" dictionary is updated. If an NPC is made up of multiple segments (such as EoW, etc.) that all have separate health but would be considered a single boss, you can update the dictionary. The boss health bar will automatically keep track of all segments of that type and add up the health. - The "SetupExclusionList" method allows you to check for if certain mods are loaded and setup the exclusion list based on what mods are loaded. + The "SetupBossExclusionList" method allows you to check for if certain mods are loaded and setup the exclusion list based on what mods are loaded. For now I've had to load calamity separately, you might want to change that by just passing in Calamity itself etc. If you need to add a special kind of health bar, like the EoW one which counts the number of segments left, let me know. @@ -48,50 +51,62 @@ namespace CalamityMod.UI (although the flickering in the start animation will always happen in the first 20 frames or so) As for toggling, in the Mod File, you can simply add a boolean check and not draw or update the health bar manager. - There is a "SHOULD_DRAW_SMALLTEXT_HEALTH" field below here which is public, if that's false then the smalltext won't draw. + There is a "CanDrawExtraSmallText" field below here which is public, if that's false then the smalltext won't draw. That should be it -- ask if you have any questions! */ - internal static class BossHealthBarManager + public static class BossHealthBarManager { - private static readonly int MAX_BARS = 4; + public struct BossEntityExtension + { + public string NameOfExtensions; + public int[] TypesToSearchFor; + public BossEntityExtension(string name, params int[] types) + { + NameOfExtensions = name; + TypesToSearchFor = types; + } + } - public static bool SHOULD_DRAW_SMALLTEXT_HEALTH = true; + public static bool CanDrawExtraSmallText = true; + public static int MaximumBars = 4; - private static List Bars; + public static List Bars; - private static DynamicSpriteFont HPBarFont; - private static Texture2D BossMainHPBar; - private static Texture2D BossComboHPBar; - private static Texture2D BossSeperatorBar; + public static DynamicSpriteFont HPBarFont; + public static Texture2D BossMainHPBar; + public static Texture2D BossComboHPBar; + public static Texture2D BossSeperatorBar; public static Dictionary OneToMany; - private static List ExclusionList; + public static List BossExclusionList; public static List MinibossHPBarList; + public static Dictionary EntityExtensionHandler = new Dictionary(); + public static Dictionary SpecialHPRequirements = new Dictionary(); - public static void Load(Mod mod) + public delegate bool NPCSpecialHPGetRequirement(NPC npc); + public delegate long NPCSpecialHPGetFunction(NPC npc, bool checkingForMaxLife); + + internal static void Load(Mod mod) { Bars = new List(); if (!Main.dedServ) { - BossMainHPBar = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/BossHPMainBar"); - BossComboHPBar = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/BossHPComboBar"); - BossSeperatorBar = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/BossHPSeperatorBar"); + BossMainHPBar = GetTexture("CalamityMod/ExtraTextures/UI/BossHPMainBar"); + BossComboHPBar = GetTexture("CalamityMod/ExtraTextures/UI/BossHPComboBar"); + BossSeperatorBar = GetTexture("CalamityMod/ExtraTextures/UI/BossHPSeperatorBar"); PlatformID id = Environment.OSVersion.Platform; if (id == PlatformID.Win32NT && !Environment.Is64BitProcess) - { HPBarFont = mod.GetFont("Fonts/HPBarFont"); - } else - { HPBarFont = Main.fontMouseText; - } } OneToMany = new Dictionary(); + int[] EoW = new int[] { NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail }; OneToMany[NPCID.EaterofWorldsHead] = EoW; OneToMany[NPCID.EaterofWorldsBody] = EoW; @@ -133,36 +148,36 @@ namespace CalamityMod.UI OneToMany[NPCID.MoonLordHand] = MoonLord; OneToMany[NPCID.MoonLordCore] = MoonLord; - int[] Void = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Void; - OneToMany[ModContent.NPCType()] = Void; - OneToMany[ModContent.NPCType()] = Void; - OneToMany[ModContent.NPCType()] = Void; + int[] Void = new int[] { NPCType(), NPCType() }; + OneToMany[NPCType()] = Void; + OneToMany[NPCType()] = Void; - int[] Rav = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Rav; - OneToMany[ModContent.NPCType()] = Rav; - OneToMany[ModContent.NPCType()] = Rav; - OneToMany[ModContent.NPCType()] = Rav; - OneToMany[ModContent.NPCType()] = Rav; - OneToMany[ModContent.NPCType()] = Rav; + int[] Rav = new int[] { NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType() }; + OneToMany[NPCType()] = Rav; + OneToMany[NPCType()] = Rav; + OneToMany[NPCType()] = Rav; + OneToMany[NPCType()] = Rav; + OneToMany[NPCType()] = Rav; + OneToMany[NPCType()] = Rav; - int[] Slimes = new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType(), ModContent.NPCType() }; - OneToMany[ModContent.NPCType()] = Slimes; - OneToMany[ModContent.NPCType()] = Slimes; - OneToMany[ModContent.NPCType()] = Slimes; - OneToMany[ModContent.NPCType()] = Slimes; - OneToMany[ModContent.NPCType()] = Slimes; + int[] Slimes = new int[] { NPCType(), NPCType(), NPCType(), + NPCType(), NPCType() }; + OneToMany[NPCType()] = Slimes; + OneToMany[NPCType()] = Slimes; + OneToMany[NPCType()] = Slimes; + OneToMany[NPCType()] = Slimes; + OneToMany[NPCType()] = Slimes; - SetupExclusionList(); + SetupBossExclusionList(); SetupMinibossHPBarList(); + SetupExtensionHandlerList(); + SetupRequirementsList(); } - private static void SetupExclusionList() + public static void SetupBossExclusionList() { - ExclusionList = new List + BossExclusionList = new List { NPCID.MoonLordFreeEye, NPCID.MoonLordHead, @@ -173,42 +188,49 @@ namespace CalamityMod.UI NPCID.WyvernBody2, NPCID.WyvernBody3, NPCID.WyvernTail, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), }; } - private static void SetupMinibossHPBarList() + public static void SetupMinibossHPBarList() { MinibossHPBarList = new List { - //DD2 Event + // DD2 Event. NPCID.DD2Betsy, NPCID.DD2OgreT2, NPCID.DD2OgreT3, - NPCID.DD2DarkMageT1, //800 HP + NPCID.DD2DarkMageT1, // 800 HP, T1 variant. NPCID.DD2DarkMageT3, - //Prehardmode + // Prehardmode. NPCID.DungeonGuardian, - //Hardmode - NPCID.GoblinSummoner, //2000 HP - NPCID.WyvernHead, + // Hardmode. + NPCID.GoblinSummoner, // 2000 HP + NPCID.WyvernHead, NPCID.Paladin, NPCID.IceGolem, NPCID.SandElemental, @@ -216,788 +238,430 @@ namespace CalamityMod.UI NPCID.BigMimicCrimson, NPCID.BigMimicHallow, - //Moon Events + // Moon Events. NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, - //Eclipse + // Eclipse. NPCID.Mothron, - //Prehardmode - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), + // Martian Madness. + NPCID.MartianSaucerCore, - //Hardmode - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), //Clone's brothers - ModContent.NPCType(), + // Prehardmode Modded. + NPCType(), + NPCType(), + NPCType(), + NPCType(), - //Abyss - ModContent.NPCType(), + // Hardmode Modded. + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), //Clone's brothers + NPCType(), - //Post-ML - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType() + // Post-ML Modded. + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() }; MinibossHPBarList.AddRange(AcidRainEvent.AllMinibosses); } - public static void Unload() + public static void SetupExtensionHandlerList() + { + EntityExtensionHandler = new Dictionary() + { + [NPCID.EaterofWorldsHead] = new BossEntityExtension("Segments", NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail), + [NPCID.BrainofCthulhu] = new BossEntityExtension("Creepers", NPCID.Creeper), + [NPCID.SkeletronHead] = new BossEntityExtension("Hands", NPCID.SkeletronHand), + [NPCID.SkeletronPrime] = new BossEntityExtension("Arms", NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser), + [NPCID.MartianSaucerCore] = new BossEntityExtension("Guns", NPCID.MartianSaucerTurret, NPCID.MartianSaucerCannon), + [NPCID.PirateShip] = new BossEntityExtension("Cannons", NPCID.PirateShipCannon), + [NPCType()] = new BossEntityExtension("Dark Energy", NPCType()), + [NPCType()] = new BossEntityExtension("Body Parts", NPCType(), NPCType(), NPCType(), NPCType()), + [NPCType()] = new BossEntityExtension("Large Slimes", NPCType(), NPCType(), NPCType(), NPCType()), + }; + } + + // Collection simplification looks horrendous in the context of delegate creation. + // Warnings pertaining to it in this section are disabled as a result. +#pragma warning disable IDE0028 // Simplify collection initialization + public static void SetupRequirementsList() + { + SpecialHPRequirements = new Dictionary(); + SpecialHPRequirements.Add(npc => npc.Calamity().SplittingWorm, (npc, checkingForMaxLife) => + { + // Go across the entire worm and accumulate life. The expectation is that the boss follows the linked-list-esque standard + // where ai variables act as a way of accessing previous/next segments. In this case, the intent is to begin at the head and go to the tail. + long life = 0L; + NPC currentSegment = npc; + + // Head ... -> Main.npc[(int)currentSegment.ai[0]] -> currentSegment.whoAmI -> ... Tail. + + // What this is doing is checking if the next segment agrees with the fact that the previous segment is what it is attaching to. + // If it doesn't, that means that we have reached the end of the worm. + int failsafeCounter = 0; + while (Main.npc[(int)currentSegment.ai[0]].ai[1] == currentSegment.whoAmI) + { + // If a segment is not active for some reason, don't go any further. + if (!currentSegment.active) + break; + + life += checkingForMaxLife ? currentSegment.lifeMax : currentSegment.life; + currentSegment = Main.npc[(int)currentSegment.ai[0]]; + + failsafeCounter++; + if (failsafeCounter > Main.maxNPCs) + break; + } + + return life; + }); + } +#pragma warning restore IDE0028 // Simplify collection initialization + + internal static void Unload() { BossMainHPBar = null; BossComboHPBar = null; BossSeperatorBar = null; HPBarFont = null; Bars = null; - ExclusionList = null; + BossExclusionList = null; MinibossHPBarList = null; OneToMany = null; + EntityExtensionHandler = null; + SpecialHPRequirements = null; } public static void Update() { - for (int i = 0; i < Main.npc.Length; i++) + for (int i = 0; i < Main.maxNPCs; i++) { - //Is NPC active - if (!Main.npc[i].active) + // Ignore inactive NPCs and NPCs that should not be given a bar, even if it meets other criteria. + if (!Main.npc[i].active || BossExclusionList.Contains(Main.npc[i].type)) continue; - //Is npc in exclusion list - int type = Main.npc[i].type; - if (Main.npc[i].type == NPCID.MoonLordCore) - { - AttemptAddBar(i, NPCID.MoonLordCore); - } - if (ExclusionList.Contains(type)) - continue; - - if (Main.npc[i].type == NPCID.BrainofCthulhu) - { - AttemptAddBar(i, NPCID.BrainofCthulhu); - } - else if (Main.npc[i].type == NPCID.SkeletronHead) - { - AttemptAddBar(i, NPCID.SkeletronHead); - } - else if (Main.npc[i].type == NPCID.SkeletronPrime) - { - AttemptAddBar(i, NPCID.SkeletronPrime); - } - else if (Main.npc[i].type == NPCID.Golem) - { - AttemptAddBar(i, NPCID.Golem); - } - else if (Main.npc[i].type == NPCID.MartianSaucerCore) - { - AttemptAddBar(i, NPCID.MartianSaucerCore); - } - else if (Main.npc[i].type == NPCID.PirateShip) - { - AttemptAddBar(i, NPCID.PirateShip); - } - else if (Main.npc[i].type == ModContent.NPCType()) - { - AttemptAddBar(i, ModContent.NPCType()); - } - else if (Main.npc[i].type == ModContent.NPCType()) - { - AttemptAddBar(i, ModContent.NPCType()); - } - else if (Main.npc[i].type == ModContent.NPCType()) - { - AttemptAddBar(i, ModContent.NPCType()); - } - else if (Main.npc[i].type == ModContent.NPCType()) - { - AttemptAddBar(i, ModContent.NPCType()); - } - else if (Main.npc[i].type == ModContent.NPCType()) - { - AttemptAddBar(i, ModContent.NPCType()); - } - else if (Main.npc[i].boss || MinibossHPBarList.Contains(type)) - { - AttemptAddBar(i); - } - //If, specifically, they're the eater of worlds head - if (Main.npc[i].type == NPCID.EaterofWorldsHead) - { - AttemptAddBar(i, NPCID.EaterofWorldsHead); - } + bool isEoWSegment = Main.npc[i].type == NPCID.EaterofWorldsBody || Main.npc[i].type == NPCID.EaterofWorldsTail; + if ((Main.npc[i].IsABoss() && !isEoWSegment) || MinibossHPBarList.Contains(Main.npc[i].type)) + AttemptToAddBar(i); } for (int i = 0; i < Bars.Count; i++) { BossHPUI ui = Bars[i]; - //Update the bar + + // Update the bar. ui.Update(); - //Is the NPC the bar is attached to dead? - if (ui.IsDead()) + + // Remove the bar if it's done with its closing animation. + if (ui.CloseAnimationTimer >= BossHPUI.CloseAnimationTime) { - //begin closing anim of the UI - ui.StartClosing(); - } - if (ui.ShouldClose()) - { - //remove this bar Bars.RemoveAt(i); i--; } } } - private static void AttemptAddBar(int index, int type = -1) + public static void AttemptToAddBar(int index) { - //Limit the number of bars. - if (Bars.Count >= MAX_BARS) + // Limit the number of bars. + if (Bars.Count >= MaximumBars) return; - bool hasBar = false; + // Do not attempt to create a new bar for an NPC that's already in the list of bars. + bool canAddBar = Main.npc[index].active && Main.npc[index].life > 0 && Bars.All(b => b.NPCIndex != index); + if (Bars.Count <= 0) + canAddBar = true; - foreach (BossHPUI ui in Bars) - { - int id = ui.GetNPCID(); - if (id == index) - { - hasBar = true; - break; - } - //Sort out the eater of worlds splitting into multiple segments and multiple of them being heads - if (type == NPCID.EaterofWorldsHead) - { - if (Main.npc[id].type == NPCID.EaterofWorldsHead) - { - hasBar = true; - } - } - } - - if (!hasBar) - { - BossHPUI newUI = new BossHPUI(index); - - if (type != -1) - { - newUI.SetupForType(type); - } - - Bars.Add(newUI); - } + if (canAddBar) + Bars.Add(new BossHPUI(index)); } public static void Draw(SpriteBatch sb) { - int startHeight = 100; //100 - int heightPerOne = 70; //70 - + int startHeight = 100; + int x = Main.screenWidth - 420; int y = Main.screenHeight - startHeight; - int x = Main.screenWidth - 420 + ((Main.playerInventory || Main.invasionType > 0 || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing || CalamityWorld.rainingAcid) ? -250 : 0); + if (Main.playerInventory || Main.invasionType > 0 || Main.pumpkinMoon || Main.snowMoon || DD2Event.Ongoing || CalamityWorld.rainingAcid) + x -= 250; foreach (BossHPUI ui in Bars) { ui.Draw(sb, x, y); - y -= heightPerOne; + y -= BossHPUI.VerticalOffsetPerBar; } } - //Actual UI handling class - internal class BossHPUI + public class BossHPUI { - private static readonly Color OrangeColour = new Color(229, 189, 62); - private static readonly Color OrangeBorderColour = new Color(197, 127, 46); - - private static readonly int MainBarYOffset = 28; - private static readonly int SepBarYOffset = 18; - private static readonly int BarMaxWidth = 400; - private static readonly int OpenAnimTime = 80; - private static readonly int CloseAnimTime = 120; - - enum SpecialType : byte - { - None, - EaterOfWorlds, - Creep, - Skelet, - SkeletPrime, - MartSaucer, - PirShip - } - - enum SpecialType2 : byte - { - None, - Ceaseless, - Ravage, - SlimeCore - } - - private int _npcLocation; - private SpecialType _special = SpecialType.None; - private SpecialType2 _special2 = SpecialType2.None; - private int[] _specialData = new int[7]; - private int[] _specialData2 = new int[7]; - private float _maxHealth; - private int _prevLife; - private bool _inCombo = false; - private int _comboStartHealth; - private int _damageCountdown; - private NPC _npc + public int NPCIndex = -1; + public int IntendedNPCType = -1; + public int OpenAnimationTimer; + public int CloseAnimationTimer; + public int EnrageTimer; + public int ComboDamageCountdown; + public long PreviousLife; + public long HealthAtStartOfCombo; + public long InitialMaxLife; + public NPC AssociatedNPC => Main.npc.IndexInRange(NPCIndex) ? Main.npc[NPCIndex] : null; + public int NPCType => AssociatedNPC?.type ?? -1; + public long CombinedNPCLife { get { - return Main.npc[_npcLocation]; - } - } + if (AssociatedNPC is null || !AssociatedNPC.active) + return 0L; - private string _lastName = ""; + long life = AssociatedNPC.life; - private bool _oneToMany = false; - private int[] _arrayOfIds; - - //EDITABLE - public void SetupForType(int type) - { - if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.SlimeCore; - } - else if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.Ravage; - } - else if (type == ModContent.NPCType()) - { - _special2 = SpecialType2.Ceaseless; - } - else - { - switch (type) + // Immediately check for special logged edge-cases. If one is hit, go with what it says. + foreach (KeyValuePair requirement in SpecialHPRequirements) { - case NPCID.EaterofWorldsHead: - _special = SpecialType.EaterOfWorlds; - break; - case NPCID.BrainofCthulhu: - _special = SpecialType.Creep; - break; - case NPCID.SkeletronHead: - _special = SpecialType.Skelet; - break; - case NPCID.SkeletronPrime: - _special = SpecialType.SkeletPrime; - break; - case NPCID.MartianSaucerCore: - _special = SpecialType.MartSaucer; - break; - case NPCID.PirateShip: - _special = SpecialType.PirShip; - break; + if (requirement.Key(AssociatedNPC)) + return requirement.Value(AssociatedNPC, false); } - } - } - //ANIMATION FIELDS - private int _openAnimCounter = OpenAnimTime; - private int _closeAnimCounter; + // Don't check any further if the NPC is not a part of any one-to-many relationship. + if (!OneToMany.ContainsKey(NPCType)) + return life; - public BossHPUI(int id) - { - _npcLocation = id; - - _maxHealth = Main.npc[id].lifeMax; - - if (OneToMany.ContainsKey(Main.npc[id].type)) - { - _oneToMany = true; - _arrayOfIds = OneToMany[Main.npc[id].type]; - } - } - - public int GetNPCID() - { - return _npcLocation; - } - public bool ShouldClose() - { - return _closeAnimCounter >= CloseAnimTime; - } - public void StartClosing() - { - if (_closeAnimCounter == 0) - _closeAnimCounter = 1; - } - - public bool IsDead() - { - bool dead = false; - - if (_npc == null) - dead = true; - - int life = _npc.life; - if (life < 0 || !_npc.active || _npc.lifeMax < 800) - dead = true; - - if (_oneToMany) - { - for (int i = 0; i < Main.npc.Length; i++) + // Otherwise, check if any of said relationship NPCs are enraged. + for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) - { - dead = false; - } + if (!Main.npc[i].active || Main.npc[i].life <= 0 || !OneToMany[NPCType].Contains(Main.npc[i].type)) + continue; + + life += Main.npc[i].life; } - } - if (dead && _lastName == "") + return life; + } + } + public long CombinedNPCMaxLife + { + get { - _lastName = _npc.FullName; - } + if (AssociatedNPC is null || !AssociatedNPC.active) + return 0L; - return dead; + long maxLife = AssociatedNPC.lifeMax; + + // Immediately check for special logged edge-cases. If one is hit, go with what it says. + foreach (KeyValuePair requirement in SpecialHPRequirements) + { + if (requirement.Key(AssociatedNPC)) + return requirement.Value(AssociatedNPC, true); + } + + // Don't check any further if the NPC is not a part of any one-to-many relationship. + if (!OneToMany.ContainsKey(NPCType)) + return maxLife; + + // Otherwise, check if any of said relationship NPCs are enraged. + for (int i = 0; i < Main.maxNPCs; i++) + { + if (!Main.npc[i].active || Main.npc[i].life <= 0 || !OneToMany[NPCType].Contains(Main.npc[i].type)) + continue; + + maxLife += Main.npc[i].lifeMax; + } + + return maxLife; + } + } + public bool NPCIsEnraged + { + get + { + if (AssociatedNPC is null || !AssociatedNPC.active) + return false; + + if (AssociatedNPC.Calamity().CurrentlyEnraged) + return true; + + // Don't check any further if the NPC is not a part of any one-to-many relationship. + if (!OneToMany.ContainsKey(NPCType)) + return false; + + // Otherwise, check if any of said relationship NPCs are enraged. + for (int i = 0; i < Main.maxNPCs; i++) + { + if (!Main.npc[i].active || Main.npc[i].life <= 0 || !OneToMany[NPCType].Contains(Main.npc[i].type)) + continue; + + if (Main.npc[i].Calamity().CurrentlyEnraged) + return true; + } + return false; + } + } + public float NPCLifeRatio + { + get + { + float lifeRatio = CombinedNPCLife / (float)InitialMaxLife; + + // Handle division by 0 edge-cases. + if (float.IsNaN(lifeRatio) || float.IsInfinity(lifeRatio)) + return 0f; + + return lifeRatio; + } + } + + public const int MainBarYOffset = 28; + public const int SeparatorBarYOffset = 18; + public const int BarMaxWidth = 400; + public const int OpenAnimationTime = 80; + public const int CloseAnimationTime = 120; + public const int EnrageAnimationTime = 120; + public const int VerticalOffsetPerBar = 70; + public const float SmallTextScale = 0.75f; + public static Color MainColor = new Color(229, 189, 62); + public static Color MainBorderColour = new Color(197, 127, 46); + + public BossHPUI(int index) + { + NPCIndex = index; + + // Store the intended NPC type for this bar. + // This is necessary because it is possible for the NPC slot to become occupied by something else when the NPC becomes + // inactive. If this happens and the bar isn't done closing, it will simply think that the new occupant is what is should attach to, regardless + // of if it's actually supposed to have a bar in the first place. By verifying NPC type, we can be sure that this does not happen. + // And if an NPC of the same type does this, it doesn't matter, because that means it was valid to begin with. + if (AssociatedNPC != null && AssociatedNPC.active) + { + IntendedNPCType = AssociatedNPC.type; + PreviousLife = CombinedNPCLife; + } } public void Update() { - if (_closeAnimCounter != 0) + // Handle combos. + if (CombinedNPCLife != PreviousLife && PreviousLife != 0) + { + // If there's no ongoing combo, begin one. + if (ComboDamageCountdown <= 0) + HealthAtStartOfCombo = CombinedNPCLife; + + ComboDamageCountdown = 30; + } + PreviousLife = CombinedNPCLife; + + if (ComboDamageCountdown > 0) + ComboDamageCountdown--; + + // Update timers as necessary. + if (AssociatedNPC is null || !AssociatedNPC.active || NPCType != IntendedNPCType) + { + EnrageTimer = Utils.Clamp(EnrageTimer - 4, 0, EnrageAnimationTime); + CloseAnimationTimer = Utils.Clamp(CloseAnimationTimer + 1, 0, CloseAnimationTime); return; - - int currentLife = _npc.life; - - //Calculate current life based all types that are available and considered part of one boss - if (_oneToMany) - { - currentLife = 0; - int maxLife = 0; - for (int i = 0; i < Main.npc.Length; i++) - { - if (Main.npc[i].active && Main.npc[i].life > 0 && _arrayOfIds.Contains(Main.npc[i].type)) - { - if ((Main.npc[i].type == NPCID.MoonLordHead && (Main.npc[i].ai[0] == -2f || Main.npc[i].ai[0] == -3f || Main.npc[i].Calamity().newAI[0] == 1f)) || - (Main.npc[i].type == NPCID.MoonLordHand && (Main.npc[i].ai[0] == -2f || Main.npc[i].Calamity().newAI[0] == 1f)) || - (Main.npc[i].type == NPCID.MoonLordCore && Main.npc[i].ai[0] == 2f)) - continue; - - currentLife += Main.npc[i].life; - maxLife += Main.npc[i].lifeMax; - } - } - if (maxLife > _maxHealth) - { - _maxHealth = maxLife; - } } - //Damage countdown - if (_damageCountdown > 0) - { - _damageCountdown--; - if (_damageCountdown == 0) - { - //This means we need to finish the combo - _comboStartHealth = 0; - _inCombo = false; - } - } - //If the current life is not eqaul to the previous frame of life (_prevLife != 0 ensures it's not on it's first frame) - if (currentLife != _prevLife && _prevLife != 0) - { - //If there's no ongoing combo - if (!_inCombo) - { - //This means we need to start a combo - _comboStartHealth = _prevLife; - _inCombo = true; - } - _damageCountdown = 30; //60 - } - _prevLife = currentLife; + OpenAnimationTimer = Utils.Clamp(OpenAnimationTimer + 1, 0, OpenAnimationTime); + EnrageTimer = Utils.Clamp(EnrageTimer + NPCIsEnraged.ToDirectionInt(), 0, EnrageAnimationTime); - switch (_special) - { - default: - break; - case SpecialType.EaterOfWorlds: - //Count the segments of the EoW - int count = 0; - for (int i = 0; i < Main.npc.Length; i++) - { - if (IsEoW(i)) - { - count++; - } - } - _specialData[0] = count; - break; - case SpecialType.Creep: - int count2 = NPC.CountNPCS(NPCID.Creeper); - _specialData[1] = count2; - break; - case SpecialType.Skelet: - int count3 = NPC.CountNPCS(NPCID.SkeletronHand); - _specialData[2] = count3; - break; - case SpecialType.SkeletPrime: - int count4 = NPC.CountNPCS(NPCID.PrimeVice) + NPC.CountNPCS(NPCID.PrimeCannon) + - NPC.CountNPCS(NPCID.PrimeSaw) + NPC.CountNPCS(NPCID.PrimeLaser); - _specialData[3] = count4; - break; - case SpecialType.MartSaucer: - int count5 = NPC.CountNPCS(NPCID.MartianSaucerTurret) + NPC.CountNPCS(NPCID.MartianSaucerCannon); - _specialData[4] = count5; - break; - case SpecialType.PirShip: - int count6 = NPC.CountNPCS(NPCID.PirateShipCannon); - _specialData[5] = count6; - break; - } - - switch (_special2) - { - default: - break; - case SpecialType2.Ceaseless: - int count = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[0] = count; - break; - case SpecialType2.Ravage: - int count2 = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[1] = count2; - break; - case SpecialType2.SlimeCore: - int count3 = NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()) + - NPC.CountNPCS(ModContent.NPCType()); - _specialData2[2] = count3; - break; - } + if (CombinedNPCMaxLife != 0 && InitialMaxLife == 0) + InitialMaxLife = CombinedNPCMaxLife; } + public void Draw(SpriteBatch sb, int x, int y) { - //Draw the respective animations. - //Easier to separate them, even if it does result in more copy pasted code overall. - if (_openAnimCounter > 0) - { - DrawOpenAnim(sb, x, y); - return; - } + float animationCompletionRatio = MathHelper.Clamp(OpenAnimationTimer / (float)OpenAnimationTime, 0f, 1f); + if (CloseAnimationTimer > 0) + animationCompletionRatio = 1f - MathHelper.Clamp(CloseAnimationTimer / (float)CloseAnimationTime, 0f, 1f); - if (_closeAnimCounter > 0) - { - DrawCloseAnim(sb, x, y); - return; - } + float openAnimationFlicker = animationCompletionRatio; + if (OpenAnimationTimer == 4 || OpenAnimationTimer == 8 || OpenAnimationTimer == 16) + openAnimationFlicker = Main.rand.NextFloat(0.7f, 0.8f); + if (OpenAnimationTimer == 3 || OpenAnimationTimer == 7 || OpenAnimationTimer == 15) + openAnimationFlicker = Main.rand.NextFloat(0.4f, 0.5f); - float percentHealth = _prevLife / _maxHealth; - int mainBarWidth = (int)(BarMaxWidth * percentHealth); + // Draw the main health bar. + int mainBarWidth = (int)MathHelper.Min(BarMaxWidth * animationCompletionRatio, BarMaxWidth * NPCLifeRatio); + sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, BossMainHPBar.Height), Color.White); - if (_inCombo) + // Draw a red damage health bar if performing a conbo. + if (ComboDamageCountdown > 0) { - //DRAW COMBO HEALTH BAR - int comboBarWidth = (int)(BarMaxWidth * (_comboStartHealth / _maxHealth)) - mainBarWidth; + int comboBarWidth = (int)(BarMaxWidth * HealthAtStartOfCombo / (float)InitialMaxLife) - mainBarWidth; float alpha = 1f; - if (_damageCountdown < 6) - { - float val = _damageCountdown * 0.166f; - alpha *= val; - comboBarWidth = (int)(comboBarWidth * val); - } - sb.Draw(BossComboHPBar, new Rectangle(x + mainBarWidth, y + MainBarYOffset, comboBarWidth, 15), Color.White * alpha); + // Shrink the bar on the last 6 frames of the damage countdown. + if (ComboDamageCountdown < 6) + comboBarWidth = (int)(comboBarWidth * ComboDamageCountdown / 6f); + + sb.Draw(BossComboHPBar, new Rectangle(x + mainBarWidth, y + MainBarYOffset, comboBarWidth, BossComboHPBar.Height), Color.White * alpha); } - //DRAW MAIN HEALTH BAR - sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White); + // Draw a white separator bar. + Color separatorColor = Color.Lerp(new Color(240, 240, 255), Color.Red * 0.5f, EnrageTimer / (float)EnrageAnimationTime) * animationCompletionRatio; + sb.Draw(BossSeperatorBar, new Rectangle(x, y + SeparatorBarYOffset, BarMaxWidth, 6), separatorColor); - //DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255)); - - //DRAW TEXT - string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; - if (_prevLife == _maxHealth) - percentHealthText = "100%"; - Vector2 textSize = HPBarFont.MeasureString(percentHealthText); - DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour, OrangeBorderColour * 0.25f); - - string name = _npc.FullName; - Vector2 nameSize = Main.fontMouseText.MeasureString(name); - DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White, Color.Black * 0.2f); - - // TODO -- Make small text health a toggle in ModConfig. - if (SHOULD_DRAW_SMALLTEXT_HEALTH) - { - float textScale = 0.75f; - - switch (_special) - { - default: - break; - case SpecialType.EaterOfWorlds: - string count = "(Segments left: " + _specialData[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.Creep: - string count2 = "(Creepers left: " + _specialData[1] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.Skelet: - string count3 = "(Hands left: " + _specialData[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.SkeletPrime: - string count4 = "(Arms left: " + _specialData[3] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.MartSaucer: - string count5 = "(Guns left: " + _specialData[4] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType.PirShip: - string count6 = "(Cannons left: " + _specialData[5] + ")"; - Vector2 countSize6 = Main.fontItemStack.MeasureString(count6) * textScale; - float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - } - - switch (_special2) - { - default: - break; - case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[0] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[1] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[2] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - return; - } - - string actualLife = "(" + _npc.life + " / " + _npc.lifeMax + ")"; - Vector2 lifeSize = Main.fontItemStack.MeasureString(actualLife) * textScale; - float lifeX = Math.Max(x, x + mainBarWidth - lifeSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, actualLife, new Vector2(lifeX, y + MainBarYOffset + 17), Color.White, Color.Black * 0.24f, textScale); - } - } - public void DrawOpenAnim(SpriteBatch sb, int x, int y) - { - float percentThroughAnim = (OpenAnimTime - _openAnimCounter) / (float)OpenAnimTime; - int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, percentThroughAnim)); - - float flickerValue = percentThroughAnim; - //FLICKER 3 TIMES, QUICK AND DIRTY METHOD - if (_openAnimCounter == OpenAnimTime - 4 || _openAnimCounter == OpenAnimTime - 8 || _openAnimCounter == OpenAnimTime - 16) - { - flickerValue = Main.rand.NextFloat(0.7f, 0.8f); - } - else if (_openAnimCounter == OpenAnimTime - 5 || _openAnimCounter == OpenAnimTime - 9 || _openAnimCounter == OpenAnimTime - 17) - { - flickerValue = Main.rand.NextFloat(0.4f, 0.5f); - } - - //DRAW MAIN HEALTH BAR - sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White * flickerValue); - - //DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255) * flickerValue); - - //DRAW TEXT - string percentHealthText = "100%"; - Vector2 textSize = HPBarFont.MeasureString(percentHealthText); - DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * flickerValue, OrangeBorderColour * 0.25f * flickerValue); - - string name = _npc.FullName; - Vector2 nameSize = Main.fontMouseText.MeasureString(name); - DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White * flickerValue, Color.Black * 0.2f * flickerValue); - - if (SHOULD_DRAW_SMALLTEXT_HEALTH) - { - float textScale = 0.75f; - - switch (_special) - { - default: - break; - case SpecialType.EaterOfWorlds: - string count = "(Segments left: " + _specialData[0] + ")"; - Vector2 countSize = Main.fontItemStack.MeasureString(count) * textScale; - float countX = Math.Max(x, x + mainBarWidth - countSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count, new Vector2(countX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.Creep: - string count2 = "(Creepers left: " + _specialData[1] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.Skelet: - string count3 = "(Hands left: " + _specialData[2] + ")"; - Vector2 countSize3 = Main.fontItemStack.MeasureString(count3) * textScale; - float countX3 = Math.Max(x, x + mainBarWidth - countSize3.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count3, new Vector2(countX3, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.SkeletPrime: - string count4 = "(Arms left: " + _specialData[3] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.MartSaucer: - string count5 = "(Guns left: " + _specialData[4] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType.PirShip: - string count6 = "(Cannons left: " + _specialData[5] + ")"; - Vector2 countSize6 = Main.fontItemStack.MeasureString(count6) * textScale; - float countX6 = Math.Max(x, x + mainBarWidth - countSize6.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count6, new Vector2(countX6, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - } - - switch (_special2) - { - default: - break; - case SpecialType2.Ceaseless: - string count2 = "(Dark Energy left: " + _specialData2[0] + ")"; - Vector2 countSize2 = Main.fontItemStack.MeasureString(count2) * textScale; - float countX2 = Math.Max(x, x + mainBarWidth - countSize2.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count2, new Vector2(countX2, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.Ravage: - string count4 = "(Body Parts left: " + _specialData2[1] + ")"; - Vector2 countSize4 = Main.fontItemStack.MeasureString(count4) * textScale; - float countX4 = Math.Max(x, x + mainBarWidth - countSize4.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count4, new Vector2(countX4, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - case SpecialType2.SlimeCore: - string count5 = "(Large Slimes left: " + _specialData2[2] + ")"; - Vector2 countSize5 = Main.fontItemStack.MeasureString(count5) * textScale; - float countX5 = Math.Max(x, x + mainBarWidth - countSize5.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, count5, new Vector2(countX5, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - _openAnimCounter--; - return; - } - - string actualLife = "(" + _npc.life + " / " + _npc.lifeMax + ")"; - Vector2 lifeSize = Main.fontItemStack.MeasureString(actualLife) * textScale; - float lifeX = Math.Max(x, x + mainBarWidth - lifeSize.X); - DrawBorderStringEightWay(sb, Main.fontItemStack, actualLife, new Vector2(lifeX, y + MainBarYOffset + 17), Color.White * flickerValue, Color.Black * 0.24f * flickerValue, textScale); - } - - _openAnimCounter--; - } - public void DrawCloseAnim(SpriteBatch sb, int x, int y) - { - float percentThroughAnim = _closeAnimCounter / (float)CloseAnimTime; - float reversePercent = 1f - percentThroughAnim; - - float percentHealth = _prevLife / _maxHealth; - if (percentHealth < 0) - percentHealth = 0; - - int mainBarWidth = (int)(BarMaxWidth * MathHelper.SmoothStep(0f, 1f, reversePercent) * percentHealth); - - //DRAW MAIN HEALTH BAR - sb.Draw(BossMainHPBar, new Rectangle(x, y + MainBarYOffset, mainBarWidth, 15), Color.White * reversePercent); - - //DRAW WHITE(ISH) LINE - sb.Draw(BossSeperatorBar, new Rectangle(x, y + SepBarYOffset, BarMaxWidth, 6), new Color(240, 240, 255) * reversePercent); - - //DRAW TEXT - string percentHealthText = (percentHealth * 100).ToString("N1") + "%"; - if (_prevLife <= 0) + // Draw the text. + string percentHealthText = (NPCLifeRatio * 100).ToString("N1") + "%"; + if (NPCLifeRatio == 0f) percentHealthText = "0%"; - if (_prevLife == _maxHealth) - percentHealthText = "100%"; - Vector2 textSize = HPBarFont.MeasureString(percentHealthText); - DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), OrangeColour * reversePercent, OrangeBorderColour * 0.25f * reversePercent); - string name = _lastName; + CalamityUtils.DrawBorderStringEightWay(sb, HPBarFont, percentHealthText, new Vector2(x, y + 22 - textSize.Y), MainColor, MainBorderColour * 0.25f); + + // Draw a red back-glow of the text if the NPC is enraged. + string name = AssociatedNPC.FullName; Vector2 nameSize = Main.fontMouseText.MeasureString(name); - DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White * reversePercent, Color.Black * 0.2f * reversePercent); - - _closeAnimCounter++; - } - - //UTILS - private void DrawBorderStringEightWay(SpriteBatch sb, DynamicSpriteFont font, string text, Vector2 position, Color main, Color border, float scale = 1f) - { - for (int x = -1; x <= 1; x++) + if (EnrageTimer > 0) { - for (int y = -1; y <= 1; y++) + float pulse = (float)Math.Sin(Main.GlobalTime * 4.5f) * 0.5f + 0.5f; + float outwardness = EnrageTimer / (float)EnrageAnimationTime * 1.5f + pulse * 2f; + for (int i = 0; i < 4; i++) { - Vector2 pos = position + new Vector2(x, y); - if (x == 0 && y == 0) - { - continue; - } - - DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, pos, border, 0f, default, scale, SpriteEffects.None, 0f); + Vector2 drawOffset = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * outwardness; + CalamityUtils.DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y) + drawOffset, Color.Red * 0.6f, Color.Black * 0.2f); } } - DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, position, main, 0f, default, scale, SpriteEffects.None, 0f); - } - private bool IsEoW(int id) - { - NPC n = Main.npc[id]; - if (!n.active || n.life <= 0) - return false; + // And draw the text to indicate the name of the boss. + CalamityUtils.DrawBorderStringEightWay(sb, Main.fontMouseText, name, new Vector2(x + BarMaxWidth - nameSize.X, y + 23 - nameSize.Y), Color.White, Color.Black * 0.2f); - return n.type == NPCID.EaterofWorldsHead || - n.type == NPCID.EaterofWorldsBody || - n.type == NPCID.EaterofWorldsTail; + if (CanDrawExtraSmallText) + { + // Draw a smaller bar below for indications of secondary entities, such as servants or appendages. + if (EntityExtensionHandler.TryGetValue(NPCType, out BossEntityExtension extraEntityData)) + { + int totalExtraEntities = CalamityUtils.CountNPCsBetter(extraEntityData.TypesToSearchFor); + + string text = $"({extraEntityData.NameOfExtensions} left: {totalExtraEntities})"; + Vector2 textAreaSize = Main.fontItemStack.MeasureString(text) * SmallTextScale; + float horizontalDrawPosition = Math.Max(x, x + mainBarWidth - textAreaSize.X); + float verticalDrawPosition = y + MainBarYOffset + 17; + Vector2 smallBarDrawPosition = new Vector2(horizontalDrawPosition, verticalDrawPosition); + CalamityUtils.DrawBorderStringEightWay(sb, Main.fontItemStack, text, smallBarDrawPosition, Color.White * openAnimationFlicker, Color.Black * openAnimationFlicker * 0.24f, SmallTextScale); + } + + // If that isn't necessary, simply display the precise amount of remaining life for the boss. + else + { + // Draw the precise life. + string actualLifeText = $"({CombinedNPCLife} / {InitialMaxLife})"; + Vector2 textAreaSize = Main.fontItemStack.MeasureString(actualLifeText) * SmallTextScale; + float horizontalDrawPosition = Math.Max(x, x + mainBarWidth - textAreaSize.X); + float verticalDrawPosition = y + MainBarYOffset + 17; + Vector2 smallBarDrawPosition = new Vector2(horizontalDrawPosition, verticalDrawPosition); + CalamityUtils.DrawBorderStringEightWay(sb, Main.fontItemStack, actualLifeText, smallBarDrawPosition, Color.White * openAnimationFlicker, Color.Black * openAnimationFlicker * 0.24f, SmallTextScale); + } + } } } } diff --git a/UI/BossRushUI.cs b/UI/BossRushUI.cs new file mode 100644 index 0000000000..b587436dee --- /dev/null +++ b/UI/BossRushUI.cs @@ -0,0 +1,57 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Linq; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class BossRushUI : InvasionProgressUI + { + public override int SecondaryDigitPrecision => 1; + public override bool IsActive => BossRushEvent.BossRushActive; + public override float CompletionRatio + { + get + { + float invasionBasedCompletion = BossRushEvent.BossRushStage / (float)BossRushEvent.Bosses.Count; + if (!CalamityPlayer.areThereAnyDamnBosses || !BossRushEvent.Bosses.IndexInRange(BossRushEvent.BossRushStage)) + return invasionBasedCompletion; + + int bossIndex = NPC.FindFirstNPC(BossRushEvent.CurrentlyFoughtBoss); + + if (!Main.npc.IndexInRange(bossIndex)) + return invasionBasedCompletion; + + // Yes, this could be cached, but I personally don't see the need for it. In a typical situation, there won't be two of the same boss active during Boss Rush. + NPC currentBoss = Main.npc[bossIndex]; + float bossBasedCompletion = 1f - currentBoss.life / (float)currentBoss.lifeMax; + return invasionBasedCompletion + bossBasedCompletion / BossRushEvent.Bosses.Count; + } + } + public override string InvasionName => "Boss Rush"; + public override Color InvasionBarColor => Color.DarkSlateBlue; + public override Texture2D IconTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/UI/BossRushIcon"); + + public static float EvaluationLifeRatioFromNPCTypes(params int[] types) + { + int totalLife = 0; + int totalLifeMax = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + if (!Main.npc[i].active) + continue; + if (types.Contains(Main.npc[i].type)) + { + totalLife += Main.npc[i].life; + totalLifeMax += Main.npc[i].lifeMax; + } + } + + // Avoid division by zero, just in case. + return totalLifeMax == 0 ? 0f : totalLife / (float)totalLifeMax; + } + } +} diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs new file mode 100644 index 0000000000..71007090c9 --- /dev/null +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -0,0 +1,410 @@ +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI; +using Terraria.UI.Chat; + +namespace CalamityMod.UI.CalamitasEnchants +{ + public class CalamitasEnchantUI + { + public static int NPCIndex = -1; + public static int EnchantIndex = 0; + public static Enchantment? SelectedEnchantment = null; + public static Item CurrentlyHeldItem = new Item(); + public static float TopButtonClickCountdown = 0f; + public static float BottomButtonClickCountdown = 0f; + public static float ReforgeButtonClickCountdown = 0f; + + public static bool CurrentlyViewing = false; + + public static readonly Vector2 ReforgeUITopLeft = new Vector2(68f, 320f); + public static readonly float ResolutionRatio = Main.screenHeight / 1440f; + + public static Rectangle MouseScreenArea => Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + + public static bool InRangeOfNPC() + { + // Don't bother trying if no valid NPC has been selected yet. + if (!Main.npc.IndexInRange(NPCIndex) || !Main.npc[NPCIndex].active) + return false; + + Rectangle validTalkArea = Utils.CenteredRectangle(Main.LocalPlayer.Center, new Vector2(Player.tileRangeX * 2f, Player.tileRangeY) * 16f); + return validTalkArea.Intersects(Main.npc[NPCIndex].Hitbox); + } + + public static void Draw(SpriteBatch spriteBatch) + { + // Decrement click cooldowns. + // This is done so that click textures do not instantly disappear. + if (TopButtonClickCountdown > 0f) + TopButtonClickCountdown--; + if (BottomButtonClickCountdown > 0f) + BottomButtonClickCountdown--; + if (ReforgeButtonClickCountdown > 0f) + ReforgeButtonClickCountdown--; + + // Don't bother doing anything except resetting if not looking at the UI. + if (!CurrentlyViewing) + { + // If an item was stored, release it back into the world. + if (!CurrentlyHeldItem.IsAir) + { + Main.LocalPlayer.QuickSpawnClonedItem(CurrentlyHeldItem, CurrentlyHeldItem.stack); + CurrentlyHeldItem.TurnToAir(); + } + + EnchantIndex = 0; + NPCIndex = -1; + return; + } + + // Check if the player can still be in the UI. + if (Main.LocalPlayer.chest != -1 || Main.LocalPlayer.sign != -1 || Main.LocalPlayer.talkNPC == -1 || !Main.playerInventory || !InRangeOfNPC() || Main.InGuideCraftMenu) + { + CurrentlyViewing = false; + + // Check if the player has any items being held. + // If they do, drop it onto the ground. + Main.LocalPlayer.dropItemCheck(); + + // Reload visible recipes in case the dropped item was an ingredient. + Recipe.FindRecipes(); + return; + } + + // Open the inventory and stop talking to any NPCs by default while the UI is open, similar to the goblin tinkerer. + Main.playerInventory = true; + Main.npcChatText = string.Empty; + + Texture2D backgroundTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseBackground"); + Vector2 backgroundScale = Vector2.One * Main.UIScale; + + // Draw the background. + spriteBatch.Draw(backgroundTexture, ReforgeUITopLeft, null, Color.White, 0f, Vector2.Zero, backgroundScale, SpriteEffects.None, 0f); + + // Prevent the player from say, firing a weapon while the mouse is hovering over the UI. + DisableMouseWhenOverUI(backgroundTexture, backgroundScale); + + // Select the enchantment to use. + IEnumerable possibleEnchantments = SelectEnchantment(); + + // Draw the cost and description. + int cost = 0; + if (SelectedEnchantment.HasValue) + { + Point costDrawPositionTopLeft = (ReforgeUITopLeft + new Vector2(50f, 78f) * backgroundScale).ToPoint(); + cost = DrawEnchantmentCost(spriteBatch, costDrawPositionTopLeft); + Point descriptionDrawPositionTopLeft = costDrawPositionTopLeft; + descriptionDrawPositionTopLeft.Y += (int)(Main.UIScale * 70f); + Vector2 iconDrawPositionTopLeft = costDrawPositionTopLeft.ToVector2() + new Vector2(270f, -24f) * Main.UIScale; + + DrawEnchantmentDescription(spriteBatch, descriptionDrawPositionTopLeft); + if (!string.IsNullOrEmpty(SelectedEnchantment.Value.IconTexturePath)) + { + Texture2D iconTexture = ModContent.GetTexture(SelectedEnchantment.Value.IconTexturePath); + DrawIcon(spriteBatch, iconDrawPositionTopLeft, iconTexture); + } + } + + // Draw the item icon. + Vector2 itemSlotDrawPosition = ReforgeUITopLeft + new Vector2(30f, 50f) * backgroundScale; + Vector2 reforgeIconDrawPosition = ReforgeUITopLeft + new Vector2(84f, 60f) * backgroundScale; + DrawItemIcon(spriteBatch, itemSlotDrawPosition, reforgeIconDrawPosition, backgroundScale, out bool isHoveringOverItemIcon, out bool isHoveringOverReforgeIcon); + if (isHoveringOverItemIcon) + InteractWithItemSlot(); + + // Draw the buttons. + DrawAndInteractWithButtons(spriteBatch, possibleEnchantments, ReforgeUITopLeft + new Vector2(210f, 50f) * backgroundScale, ReforgeUITopLeft + new Vector2(210f, 90f) * backgroundScale, backgroundScale); + + // Draw the enchantment name. + if (SelectedEnchantment.HasValue) + DrawEnchantmentName(spriteBatch, ReforgeUITopLeft + new Vector2(216f, 66f) * backgroundScale); + + // Handle spending logic. + if (isHoveringOverReforgeIcon) + { + if (Main.mouseLeft && Main.mouseLeftRelease) + { + InteractWithEnchantIcon(cost); + ReforgeButtonClickCountdown = 15f; + } + } + } + + public static void DisableMouseWhenOverUI(Texture2D backgroundTexture, Vector2 backgroundScale) + { + Rectangle backgroundArea = new Rectangle((int)ReforgeUITopLeft.X, (int)ReforgeUITopLeft.Y, (int)(backgroundTexture.Width * backgroundScale.X), (int)(backgroundTexture.Width * backgroundScale.Y)); + + if (MouseScreenArea.Intersects(backgroundArea)) + { + Main.LocalPlayer.mouseInterface = false; + Main.blockMouse = true; + } + } + + public static IEnumerable SelectEnchantment() + { + IEnumerable possibleEnchantments = EnchantmentManager.GetValidEnchantmentsForItem(CurrentlyHeldItem); + + // Select the enchantment based on an index in the possible enchantments. + // If no possible enchantments were found, default to null. + SelectedEnchantment = null; + + if (possibleEnchantments.Count() > 0) + SelectedEnchantment = possibleEnchantments.ElementAt(EnchantIndex); + + return possibleEnchantments; + } + + public static int DrawEnchantmentCost(SpriteBatch spriteBatch, Point costDrawPositionTopLeft) + { + if (CurrentlyHeldItem.IsAir) + return 0; + + int cost = CurrentlyHeldItem.value * 4; + + // Increase the cost of enchanting significantly if doing so would upgrade the item directly. + if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) + cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; + + // Draw the coin costs. + string costText = "Cost: "; + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, costText, costDrawPositionTopLeft.X, costDrawPositionTopLeft.Y + 45f * Main.UIScale, Color.White * (Main.mouseTextColor / 255f), Color.Black, Vector2.Zero, Main.UIScale); + costDrawPositionTopLeft.X += (int)((Main.fontMouseText.MeasureString(costText).X * 0.5f + 12f) * Main.UIScale); + + int[] coinsArray = Utils.CoinsSplit(cost); + for (int i = 0; i < 4; i++) + { + Vector2 drawPosition = new Vector2(costDrawPositionTopLeft.X + (ChatManager.GetStringSize(Main.fontMouseText, costText, Vector2.One, -1f).X + ((24 * i) - 24f)) * Main.UIScale, costDrawPositionTopLeft.Y + 54f * Main.UIScale); + spriteBatch.Draw(Main.itemTexture[ItemID.PlatinumCoin - i], drawPosition, null, Color.White, 0f, Main.itemTexture[ItemID.PlatinumCoin - i].Size() * 0.5f, Main.UIScale, SpriteEffects.None, 0f); + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontItemStack, coinsArray[3 - i].ToString(), drawPosition.X - 11f, drawPosition.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f * Main.UIScale); + } + + return cost; + } + + public static void DrawEnchantmentDescription(SpriteBatch spriteBatch, Point descriptionDrawPositionTopLeft) + { + Vector2 vectorDrawPosition = descriptionDrawPositionTopLeft.ToVector2(); + Vector2 scale = new Vector2(0.67f, 0.7f) * MathHelper.Clamp(ResolutionRatio, 0.825f, 1f) * Main.UIScale; + foreach (string line in Utils.WordwrapString(SelectedEnchantment.Value.Description, Main.fontMouseText, 465, 10, out _)) + { + if (string.IsNullOrEmpty(line)) + continue; + + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, line, vectorDrawPosition, Color.Orange, 0f, Vector2.Zero, scale); + vectorDrawPosition.Y += Main.UIScale * 16f; + } + } + + public static void DrawIcon(SpriteBatch spriteBatch, Vector2 drawPositionTopLeft, Texture2D texture) + { + spriteBatch.Draw(texture, drawPositionTopLeft, null, Color.White, 0f, Vector2.Zero, Main.UIScale, SpriteEffects.None, 0f); + } + + 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 reforgeIconTexture = ModContent.GetTexture("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"); + isHoveringOverReforgeIcon = true; + } + + if (ReforgeButtonClickCountdown > 0f) + reforgeIconTexture = ModContent.GetTexture("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))); + + spriteBatch.Draw(itemSlotTexture, itemSlotDrawPosition, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + // Draw the draw the item within the slot, if it exists. + if (!CurrentlyHeldItem.IsAir) + AttemptToDrawItemInIcon(spriteBatch, itemSlotDrawPosition); + + spriteBatch.Draw(reforgeIconTexture, reforgeIconDrawPosition, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + } + + public static void AttemptToDrawItemInIcon(SpriteBatch spriteBatch, Vector2 drawPosition) + { + float inventoryScale = Main.inventoryScale; + Texture2D itemTexture = Main.itemTexture[CurrentlyHeldItem.type]; + Rectangle itemFrame = itemTexture.Frame(1, 1, 0, 0); + bool hasMultipleFrames = Main.itemAnimations[CurrentlyHeldItem.type] != null; + if (hasMultipleFrames) + itemFrame = Main.itemAnimations[CurrentlyHeldItem.type].GetFrame(itemTexture); + + float baseScale = Main.UIScale; + Color _ = Color.White; + ItemSlot.GetItemLight(ref _, ref baseScale, CurrentlyHeldItem, false); + + float itemScale = 1f; + + // Ensure that the item being drawn does not exceed a certain size. + // If it does, constrict its scale to prevent it from going beyond the maximum. + if (itemFrame.Width > 36 || itemFrame.Height > 36) + itemScale = 36f / MathHelper.Max(itemFrame.Width, itemFrame.Height); + + itemScale *= inventoryScale * baseScale; + drawPosition += Vector2.One * 23f * baseScale; + + if (Main.LocalPlayer.InventoryHas(ModContent.ItemType()) && EnchantmentManager.ItemUpgradeRelationship.ContainsKey(CurrentlyHeldItem.type)) + drawPosition -= itemFrame.Size() * 0.25f; + + // Draw the item. + if (hasMultipleFrames || ItemLoader.PreDrawInInventory(CurrentlyHeldItem, spriteBatch, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), CurrentlyHeldItem.GetColor(Color.White), itemTexture.Size() * 0.5f, itemScale)) + { + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetAlpha(Color.White), 0f, itemFrame.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, CurrentlyHeldItem.GetColor(Color.White), 0f, itemFrame.Size() * 0.5f, itemScale, SpriteEffects.None, 0f); + } + } + + public static void InteractWithItemSlot() + { + if (!CurrentlyHeldItem.IsAir) + { + // Display item stats. + Main.HoverItem = CurrentlyHeldItem.Clone(); + + // Force the HoverItem to be displayed. + Main.instance.MouseTextHackZoom(string.Empty); + } + + // Attempt to exchange if the slot is clicked. + if (Main.mouseLeftRelease && Main.mouseLeft && (Main.mouseItem.CanBeEnchantedBySomething() || Main.mouseItem.IsAir)) + { + EnchantIndex = 0; + Utils.Swap(ref Main.mouseItem, ref CurrentlyHeldItem); + Main.PlaySound(SoundID.Grab); + } + } + + public static void DrawAndInteractWithButtons(SpriteBatch spriteBatch, IEnumerable possibleEnchantments, Vector2 topButtonTopLeft, Vector2 bottomButtonTopLeft, Vector2 scale) + { + // Leave the arrows blank if no possible enchants exist. + if (possibleEnchantments.Count() == 0) + return; + + // Decide textures. + Texture2D topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUp"); + Texture2D bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDown"); + if (TopButtonClickCountdown > 0f) + topArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowUpClicked"); + if (BottomButtonClickCountdown > 0f) + bottomArrowTexture = ModContent.GetTexture("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"); + + if (hoveringOverBottomArrow) + bottomArrowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/CalamitasCurseUI_ArrowDownHovered"); + + // Draw the arrows. + if (EnchantIndex > 0) + spriteBatch.Draw(topArrowTexture, topButtonTopLeft, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + if (EnchantIndex < possibleEnchantments.Count() - 1) + spriteBatch.Draw(bottomArrowTexture, bottomButtonTopLeft, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + if (Main.mouseLeft && Main.mouseLeftRelease) + { + // Decement the enchantment index if the top button is pressed. + if (hoveringOverTopArrow && EnchantIndex > 0) + { + EnchantIndex--; + TopButtonClickCountdown = 15f; + Main.PlaySound(SoundID.MenuTick); + } + + // Increment the enchantment index if the bottom button is pressed. + if (hoveringOverBottomArrow && EnchantIndex < possibleEnchantments.Count() - 1) + { + EnchantIndex++; + BottomButtonClickCountdown = 15f; + Main.PlaySound(SoundID.MenuTick); + } + } + } + + public static void DrawEnchantmentName(SpriteBatch spriteBatch, Vector2 nameDrawCenter) + { + Vector2 scale = new Vector2(0.8f, 0.745f) * Main.UIScale; + float textWidth = Main.fontMouseText.MeasureString(SelectedEnchantment.Value.Name).X * scale.X; + Color drawColor = SelectedEnchantment.Value.Equals(EnchantmentManager.ClearEnchantment) ? Color.White : Color.Orange; + nameDrawCenter.X -= textWidth * 0.5f; + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, SelectedEnchantment.Value.Name, nameDrawCenter, drawColor, 0f, Vector2.Zero, scale); + } + + public static void InteractWithEnchantIcon(int cost) + { + // If there's no valid item in the slot, do nothing. + if (CurrentlyHeldItem.IsAir) + return; + + // If no enchantment has been selected, do nothing. + if (!SelectedEnchantment.HasValue) + return; + + // If there is no cost or the player cannot afford it, do nothing. + if (cost <= 0 || !Main.LocalPlayer.CanBuyItem(cost)) + return; + + Item originalItem = CurrentlyHeldItem.Clone(); + byte oldPrefix = CurrentlyHeldItem.prefix; + CurrentlyHeldItem.SetDefaults(CurrentlyHeldItem.type); + CurrentlyHeldItem.Prefix(oldPrefix); + CurrentlyHeldItem = CurrentlyHeldItem.CloneWithModdedDataFrom(originalItem); + + if (SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) + { + CurrentlyHeldItem.SetDefaults(EnchantmentManager.ItemUpgradeRelationship[CurrentlyHeldItem.type]); + CurrentlyHeldItem.Prefix(oldPrefix); + } + else + { + CurrentlyHeldItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; + SelectedEnchantment.Value.CreationEffect?.Invoke(CurrentlyHeldItem); + } + + // Update the compare item. This is used check comparisons when showing reforge tooltip bonuses. + // Updating it with the same bonuses as what was applied to the real item will negate the incorrect numbers, + // such as absurd damage boosts. + if (Main.cpItem is null) + Main.cpItem = new Item(); + Main.cpItem.SetDefaults(Main.cpItem.type); + + if (SelectedEnchantment.Value.Name != EnchantmentManager.UpgradeEnchantName) + { + Main.cpItem.Calamity().AppliedEnchantment = SelectedEnchantment.Value; + SelectedEnchantment.Value.CreationEffect?.Invoke(Main.cpItem); + } + + // Take away the money for the cost. + Main.LocalPlayer.BuyItem(cost); + + // Reset the enchantment index to prevent index problems on a different item. + EnchantIndex = 0; + + Main.PlaySound(SoundID.DD2_BetsyFlameBreath, Main.LocalPlayer.Center); + + if (SelectedEnchantment.Value.Name == EnchantmentManager.UpgradeEnchantName) + Main.PlaySound(SoundID.DD2_DarkMageHealImpact, Main.LocalPlayer.Center); + } + } +} diff --git a/UI/CalamitasEnchantments/Enchantment.cs b/UI/CalamitasEnchantments/Enchantment.cs new file mode 100644 index 0000000000..e24f411e0e --- /dev/null +++ b/UI/CalamitasEnchantments/Enchantment.cs @@ -0,0 +1,64 @@ +using System; +using Terraria; + +namespace CalamityMod.UI.CalamitasEnchants +{ + public struct Enchantment + { + public string Name; + public string Description; + public string IconTexturePath; + public Action CreationEffect; + public Action HoldEffect; + + public int ID { get; internal set; } + + // This is internal because CanBeAppliedTo should be used over this field directly. + // Using that has the benefit of null checks and is objectively superior to using the raw delegate. + internal Predicate ApplyRequirement; + public Enchantment(string name, string description, int id, string iconTexturePath, Action creationEffect, Action holdEffect, Predicate requirement) + { + Name = name; + Description = description; + CreationEffect = creationEffect; + HoldEffect = holdEffect; + ApplyRequirement = requirement; + ID = id; + IconTexturePath = iconTexturePath; + } + public Enchantment(string name, string description, int id, string iconTexturePath, Action holdEffect, Predicate requirement) + { + Name = name; + Description = description; + CreationEffect = null; + HoldEffect = holdEffect; + ApplyRequirement = requirement; + ID = id; + IconTexturePath = iconTexturePath; + } + public Enchantment(string name, string description, int id, string iconTexturePath, Action creationEffect, Predicate requirement) + { + Name = name; + Description = description; + CreationEffect = creationEffect; + HoldEffect = null; + ApplyRequirement = requirement; + ID = id; + IconTexturePath = iconTexturePath; + } + + public bool CanBeAppliedTo(Item item) + { + // "Empty" items can never be enchanted. + if (item is null || item.IsAir) + return false; + + // If there is no requirement, always return true, bar the above requirement. + if (ApplyRequirement is null) + return true; + + // Otherwise return what the defined requirement says is needed. + return ApplyRequirement(item); + } + } +} diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs new file mode 100644 index 0000000000..d2a42cae4d --- /dev/null +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -0,0 +1,319 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Other; +using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI.CalamitasEnchants +{ + public static class EnchantmentManager + { + internal const int ClearEnchantmentID = -18591774; + internal const string UpgradeEnchantName = "Exhume"; + public static List EnchantmentList { get; internal set; } = new List(); + public static Dictionary ItemUpgradeRelationship { get; internal set; } = new Dictionary(); + public static Enchantment ClearEnchantment { get; internal set; } + public static IEnumerable GetValidEnchantmentsForItem(Item item) + { + // Do nothing if the item cannot be enchanted. + if (item is null || item.IsAir || !item.CanBeEnchantedBySomething()) + yield break; + + // Don't allow any enchantments if the item is an upgrade item. + if (ItemUpgradeRelationship.ContainsValue(item.type)) + yield break; + + // Only give the option to clear if the item already has an enchantment. + if (item.Calamity().AppliedEnchantment.HasValue) + { + yield return ClearEnchantment; + yield break; + } + + // Check based on all the requirements for all enchantments. + foreach (Enchantment enchantment in EnchantmentList) + { + // Don't incorporate an enchantment in the list if the item already has it. + if (item.Calamity().AppliedEnchantment.HasValue && item.Calamity().AppliedEnchantment.Value.Equals(enchantment)) + continue; + + if (enchantment.ApplyRequirement(item)) + yield return enchantment; + } + } + + public static Enchantment? FindByID(int id) + { + Enchantment? enchantment = EnchantmentList.FirstOrDefault(enchant => enchant.ID == id); + if (enchantment.HasValue && !enchantment.Value.Equals(default(Enchantment))) + return enchantment; + return null; + } + + public static void ConstructFromModcall(IEnumerable parameters) + { + int secondaryArgumentCount = parameters.Count(); + if (secondaryArgumentCount < 5) + throw new ArgumentNullException("ERROR: A minimum of 4 arguments must be supplied to this command; a name, a description, an id, and a requirement predicate."); + if (secondaryArgumentCount > 7) + throw new ArgumentNullException("ERROR: A maximum of 6 arguments can be supplied to this command."); + + string name = string.Empty; + string description = string.Empty; + int id = -1; + string iconTexturePath = null; + Predicate requirement = null; + Action creationEffect = null; + Action holdEffect = null; + + // First element - the name. + if (parameters.ElementAt(0) is string nameElement) + name = nameElement; + else + throw new ArgumentException("The first argument to this command must be a string."); + + // Second element - the description. + if (parameters.ElementAt(1) is string descriptionElement) + description = descriptionElement; + else + throw new ArgumentException("The second argument to this command must be a string."); + + // Third element - the ID. + if (parameters.ElementAt(2) is int idElement) + id = idElement; + else + throw new ArgumentException("The third argument to this command must be an int."); + + // Fourth element - the requirement predicate. This determines if an item can be enchanted by said enchant or not. + if (parameters.ElementAt(3) is Predicate requirementElement) + requirement = requirementElement; + else + throw new ArgumentException("The fourth argument to this command must be an Item Predicate."); + + // Fifth element - the texture path. This determines what icon is drawn on the UI when selected. It may be null to specify that none should be drawn. + if (parameters.ElementAt(4) is string iconTexturePathElement) + iconTexturePath = iconTexturePathElement; + else + throw new ArgumentException("The fifth argument to this command must be a string."); + + // Optional elements - creation and hold effects. + switch (secondaryArgumentCount) + { + case 6: + object sixthElement = parameters.ElementAt(4); + if (sixthElement is Action creationElement) + creationEffect = creationElement; + else if (sixthElement is Action holdElement) + holdEffect = holdElement; + else + throw new ArgumentException("The sixth argument to this command must be an Item or Player Action."); + break; + case 7: + sixthElement = parameters.ElementAt(4); + object seventhElement = parameters.ElementAt(5); + if (sixthElement is Action creationElement2) + { + creationEffect = creationElement2; + holdEffect = seventhElement as Action; + } + else if (sixthElement is Action holdElement2) + { + creationEffect = seventhElement as Action; + holdEffect = holdElement2; + } + else + throw new ArgumentException("The sixth argument to this command must be an Item or Player Action and the sixth must be the other action type."); + break; + } + + // Ensure the enchantment's ID is not already claimed. + if (EnchantmentList.Any(enchant => enchant.ID == id) || id == ClearEnchantmentID) + throw new ArgumentException("An enchantment with this ID already exists. Another one must be specified."); + + EnchantmentList.Add(new Enchantment(name, description, id, iconTexturePathElement, creationEffect, holdEffect, requirement)); + } + + internal static void LoadAllEnchantments() + { + EnchantmentList = new List + { + new Enchantment(UpgradeEnchantName, "Transforms this item into something significantly stronger.", + 1, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Exhumed", + null, + null, + item => ItemUpgradeRelationship.ContainsKey(item.type)), + + new Enchantment("Indignant", "Summons demons that harm you but drop healing items on death on item usage.", + 100, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Indignant", + null, + player => player.Calamity().cursedSummonsEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.summon), + + new Enchantment("Aflame", "Lights enemies ablaze on hit but also causes the user to take damage over time when holding this item.", + 200, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Aflame", + null, + player => player.Calamity().flamingItemEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), + + new Enchantment("Oblatory", "Reduces mana cost and greatly increases damage but sometimes causes this item to use your life.", + 300, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Oblatory", + item => + { + item.damage = (int)(item.damage * 1.5); + item.mana = (int)Math.Ceiling(item.mana * 0.6); + }, + player => player.Calamity().lifeManaEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + + new Enchantment("Resentful", "Makes the damage of projectiles vary based on how far the hit target is from you. The farther, the more damage, and vice versa.", + 400, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Resentful", + null, + player => player.Calamity().farProximityRewardEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + + new Enchantment("Bloodthirsty", "Makes the damage of projectiles vary based on how far the hit target is from you. The closer, the more damage, and vice versa.", + 500, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Bloodthirsty", + null, + player => player.Calamity().closeProximityRewardEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + + new Enchantment("Ephemeral", "Causes the damage output of this item to discharge from exhaustive use. Its damage returns naturally when not being used. It starts off with more damage than it normally would have.", + 600, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral", + null, + player => player.Calamity().dischargingItemEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), + + new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer. Once it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", + 700, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Hellbound", + null, + player => player.Calamity().explosiveMinionsEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.summon), + + new Enchantment("Tainted", "Removes projectile shooting capabilities of this item. In exchange, two skeletal arms are released on use that slice at the mouse position.", + 800, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Tainted", + item => item.useTime = item.useAnimation = 25, + player => + { + if (Main.gameMenu) + return; + + player.Calamity().bladeArmEnchant = true; + bool armsArePresent = false; + int armType = ModContent.ProjectileType(); + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type != armType || Main.projectile[i].owner != player.whoAmI || !Main.projectile[i].active) + continue; + + armsArePresent = true; + break; + } + + if (Main.myPlayer == player.whoAmI && !armsArePresent) + { + // Yes, this is a LOT of damage but given the limited range of this thing it needs to be extremely powerful when it does actually hit. + int damage = (int)(player.ActiveItem().damage * player.MeleeDamage() * 5); + int blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, player.ActiveItem().type); + if (Main.projectile.IndexInRange(blade)) + Main.projectile[blade].localAI[0] = 0f; + + blade = Projectile.NewProjectile(player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, player.ActiveItem().type); + if (Main.projectile.IndexInRange(blade)) + Main.projectile[blade].localAI[0] = -80f; + } + }, + item => item.damage > 0 && item.maxStack == 1 && item.melee && !item.noUseGraphic && item.shoot > ProjectileID.None), + + new Enchantment("Traitorous", "Causes this item to sometimes release a monster that hurts both you and enemies when you have less than 50% mana.", + 900, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Traitorous", + null, + player => player.Calamity().manaMonsterEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.magic && item.mana > 0), + + new Enchantment("Withering", "You heal when hurt based on damage you've dealt. After being hurt, the weapon rapidly drains your life to deal massive damage.", + 1000, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Withered", + null, + player => player.Calamity().witheringWeaponEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && !item.summon), + + new Enchantment("Persecuted", "When attacked, or over time, demon portals appear near you. If sufficiently damaged they are friendly; otherwise they attack you.", + 1100, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Persecuted", + null, + player => player.Calamity().persecutedEnchant = true, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + + new Enchantment("Lecherous", "Spawns a resilient brimstone orb that stays between you and your mouse that interferes with your homing weapons. It releases a bunch of hearts on death.", + 1200, + "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Lecherous", + null, + player => + { + if (Main.gameMenu) + return; + + player.Calamity().lecherousOrbEnchant = true; + + bool orbIsPresent = false; + int orbType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != orbType || Main.npc[i].target != player.whoAmI || !Main.npc[i].active) + continue; + + orbIsPresent = true; + break; + } + + if (Main.myPlayer == player.whoAmI && !orbIsPresent && !player.Calamity().awaitingLecherousOrbSpawn) + { + player.Calamity().awaitingLecherousOrbSpawn = true; + CalamityNetcode.NewNPC_ClientSide(player.Center, orbType, player); + } + }, + item => item.damage > 0 && item.maxStack == 1 && item.shoot > ProjectileID.None), + }; + + // Special disenchantment thing. This is separated from the list on purpose. + ClearEnchantment = new Enchantment("Disenchant", + string.Empty, + ClearEnchantmentID, + null, + item => + { + item.Calamity().AppliedEnchantment = null; + item.Calamity().DischargeEnchantExhaustion = 0; + }, + item => item.maxStack == 1 && item.shoot >= ProjectileID.None); + + ItemUpgradeRelationship = new Dictionary() + { + [ModContent.ItemType()] = ModContent.ItemType(), + [ModContent.ItemType()] = ModContent.ItemType(), + }; + } + + internal static void UnloadAllEnchantments() + { + EnchantmentList = null; + ItemUpgradeRelationship = null; + } + } +} diff --git a/UI/ChargeMeterUI.cs b/UI/ChargeMeterUI.cs new file mode 100644 index 0000000000..f42a9b180b --- /dev/null +++ b/UI/ChargeMeterUI.cs @@ -0,0 +1,102 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class ChargeMeterUI + { + public static Vector2 DrawPosition = new Vector2(CalamityConfig.Instance.ChargeMeterPosX, CalamityConfig.Instance.ChargeMeterPosY); + public static Vector2 Offset = DrawPosition; + public static void Draw(SpriteBatch spriteBatch, Player player) + { + if (DrawPosition.X <= 60f && DrawPosition.Y <= 20f) + { + DrawPosition.X = Main.screenWidth / 2f; + DrawPosition.Y = Main.screenHeight / 2 + Main.LocalPlayer.height / 2f + 24f; + } + CalamityPlayer modPlayer = player.Calamity(); + Item heldItem = player.ActiveItem(); + if (!CalamityConfig.Instance.ChargeMeter || heldItem is null || heldItem.IsAir) + { + Reset(); + return; + } + CalamityGlobalItem modItem = heldItem.Calamity(); + if (!(modItem?.UsesCharge ?? false)) + { + Reset(); + return; + } + Texture2D edgeTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ChargeMeterBorder"); + Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ChargeMeter"); + float uiScale = Main.UIScale; + spriteBatch.Draw(edgeTexture, DrawPosition, null, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); + + Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * modItem.ChargeRatio), barTexture.Width); + spriteBatch.Draw(barTexture, DrawPosition, barRectangle, Color.White, 0f, edgeTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); + + Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); + Rectangle chargeBar = Utils.CenteredRectangle(DrawPosition, barTexture.Size() * uiScale); + + if (chargeBar.Intersects(mouse)) + { + if (modItem.UsesCharge) + { + Main.LocalPlayer.mouseInterface = true; + float displayedPercent = modItem.ChargeRatio * 100f; + string percentString = displayedPercent.ToString("n2"); + // Tooltip only goes to one decimal place, but the meter displays two. This doesn't help the player much at all but hey, it's a thing. + Main.instance.MouseText("Current Charge: " + percentString + "%", 0, 0, -1, -1, -1, -1); + } + } + if (!CalamityConfig.Instance.MeterPosLock) + { + if (chargeBar.Intersects(mouse)) + { + if (Mouse.GetState().LeftButton == ButtonState.Pressed) + { + Offset = new Vector2(Mouse.GetState().X, Mouse.GetState().Y); + DrawPosition.X = Offset.X; + DrawPosition.Y = Offset.Y; + } + if (Mouse.GetState().LeftButton == ButtonState.Released) + { + DrawPosition.X = Offset.X; + DrawPosition.Y = Offset.Y; + } + } + + if (CalamityConfig.Instance.ChargeMeterPosX != DrawPosition.X) + { + CalamityConfig.Instance.ChargeMeterPosX = DrawPosition.X; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + if (CalamityConfig.Instance.ChargeMeterPosY != DrawPosition.Y) + { + CalamityConfig.Instance.ChargeMeterPosY = DrawPosition.Y; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + } + } + + internal static void Reset() + { + if (CalamityConfig.Instance.ChargeMeterPosX != DrawPosition.X) + { + CalamityConfig.Instance.ChargeMeterPosX = DrawPosition.X; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + if (CalamityConfig.Instance.ChargeMeterPosY != DrawPosition.Y) + { + CalamityConfig.Instance.ChargeMeterPosY = DrawPosition.Y; + CalamityMod.SaveConfig(CalamityConfig.Instance); + } + } + } +} diff --git a/UI/ChargingStationUI.cs b/UI/ChargingStationUI.cs new file mode 100644 index 0000000000..4af97e1555 --- /dev/null +++ b/UI/ChargingStationUI.cs @@ -0,0 +1,238 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI; + +namespace CalamityMod.UI +{ + public class ChargingStationUI + { + public const float MaxPlayerDistance = 160f; + private const float IconScale = 0.7f; + private const int GuiWidth = 36; + private const int GuiHeight = 36; + private const int SlotSpacing = 8; + private const float SlotDrawOffsetX = 24f; + private const float CellDrawOffsetY = -20f; + private const float PluggedDrawOffsetY = CellDrawOffsetY - GuiHeight - SlotSpacing; + + public static void Draw(SpriteBatch spriteBatch) + { + Player p = Main.LocalPlayer; + CalamityPlayer mp = p.Calamity(); + int chargerID = mp.CurrentlyViewedChargerID; + + // The UI only draws if the player is viewing a charger. + if (chargerID == -1) + return; + + // Check if this tile entity ID is actually a charger. If it's not, immediately destroy this UI. + TEChargingStation charger; + bool chargerIsValid = TileEntity.ByID.TryGetValue(chargerID, out TileEntity te); + if (chargerIsValid && te is TEChargingStation cast) + charger = cast; + else + { + mp.CurrentlyViewedChargerID = -1; + return; + } + + // If the player's inventory isn't open, or they have a chest open, immediately destroy this UI. + if (!Main.playerInventory || p.chest != -1) + { + mp.CurrentlyViewedChargerID = -1; + return; + } + + // If the player is too far away from their viewed charger, immediately destroy this UI and play the menu close sound. + Vector2 chargerWorldCenter = charger.Center; + if (p.DistanceSQ(chargerWorldCenter) > MaxPlayerDistance * MaxPlayerDistance) + { + Main.PlaySound(SoundID.MenuClose); + mp.CurrentlyViewedChargerID = -1; + return; + } + + // What items are currently in the UI item slots? + // Normally they are empty, but the plugged item could be anything and the bottom slot may be a stack of power cells. + int powercellID = ModContent.ItemType(); + ref Item pluggedItem = ref charger.PluggedItem; + Item powercell = new Item(); + powercell.TurnToAir(); + + if (charger.CellStack > 0 || powercell.maxStack == 0) + { + powercell.SetDefaults(powercellID); + powercell.stack = charger.CellStack; + } + + Vector2 uiBasePos = charger.Position.ToWorldCoordinates(0f, 0f); + + // Draw the charger's plugged item and the power cells (if any) as inventory slots. + Vector2 pluggedDrawPos = uiBasePos + new Vector2(SlotDrawOffsetX, PluggedDrawOffsetY) - Main.screenPosition; + DrawWeaponSlot(spriteBatch, pluggedItem, pluggedDrawPos); + Vector2 powercellDrawPos = uiBasePos + new Vector2(SlotDrawOffsetX, CellDrawOffsetY) - Main.screenPosition; + CalamityUtils.DrawPowercellSlot(spriteBatch, powercell, powercellDrawPos); + + Rectangle mouseRect = CalamityUtils.MouseHitbox; + int slotRectX = (int)(uiBasePos.X - 1f); + int pluggedSlotRectY = (int)(uiBasePos.Y + PluggedDrawOffsetY - GuiHeight / 2); + Rectangle pluggedSlotRect = new Rectangle(slotRectX, pluggedSlotRectY, GuiWidth, GuiHeight); + int cellSlotRectY = (int)(uiBasePos.Y + CellDrawOffsetY - GuiHeight / 2); + Rectangle powercellSlotRect = new Rectangle(slotRectX, cellSlotRectY, GuiWidth, GuiHeight); + + // If the player's cursor is over the plugged slot, then interaction with that UI element is possible. + ref Item playerHandItem = ref Main.mouseItem; + if (mouseRect.Intersects(pluggedSlotRect)) + { + p.mouseInterface = Main.blockMouse = true; + + // Don't EVER have two pointers to the same Item object. You MUST clone it. + // Otherwise, knockback prefixes are applied twice per frame and stack infinitely. + // Worse, this infinite stacking persists until the world is unloaded. + if (!pluggedItem.IsAir) + Main.HoverItem = pluggedItem.Clone(); + + if (Main.mouseLeft && Main.mouseLeftRelease) + { + bool syncRequired = false; + + // If the player is holding shift and has space for the item, just spawn it on his or her face. + if (Main.keyState.PressingShift() && p.ItemSpace(pluggedItem)) + { + // This does not use DropHelper because it has to clone an existing item, not create one from nothing. + p.QuickSpawnClonedItem(pluggedItem, pluggedItem.stack); + + // Destroy the original plugged item because a clone of it was just spawned. + pluggedItem.TurnToAir(); + + // Immediately swap the now-empty slot with the player's held item as well, if said held item can be charged. + // Do not play a sound in this situation. The player is going to pick up the cloned item in a few frames, which will make sound. + if (!playerHandItem.IsAir && playerHandItem.Calamity().UsesCharge) + Utils.Swap(ref playerHandItem, ref pluggedItem); + + syncRequired = true; + } + + // Otherwise, if the slot is clicked, try to swap it with the player's held item. There are a few cases this succeeds: + // 1) The player's held item is air and the plugged item is NOT air. + // 2) The player's held item is chargeable. + // If neither case meets, then nothing happens + else if((playerHandItem.IsAir && !pluggedItem.IsAir) || (!playerHandItem.IsAir && playerHandItem.Calamity().UsesCharge)) + { + Utils.Swap(ref playerHandItem, ref pluggedItem); + Main.PlaySound(SoundID.Grab); + syncRequired = true; + } + + // If either type of click action succeeded, the charger must now sync its item slot. + if (syncRequired) + charger.SendItemSyncPacket(); + } + + // Since HoverItem is active, we don't need to input anything into this method. + Main.instance.MouseTextHackZoom(""); + } + + // Otherwise if the player's cursor is over the power cell slot, they can interact with that UI element instead. + else if (mouseRect.Intersects(powercellSlotRect)) + { + if (!powercell.IsAir) + Main.HoverItem = powercell; + + if (Main.mouseLeft && Main.mouseLeftRelease) + { + short chargerStackDiff = 0; + bool shiftClicked = false; + + // If the player is holding shift and has space for the power cells, just spawn all of them on his or her face. + if (Main.keyState.PressingShift() && p.ItemSpace(powercell)) + { + DropHelper.DropItem(p, powercellID, powercell.stack); + chargerStackDiff = (short)-powercell.stack; + + // Do not play a sound in this situation. The player is going to pick up the dropped cells in a few frames, which will make sound. + shiftClicked = true; + } + + // If the slot is normally clicked, behavior depends on whether the player is holding power cells. + else + { + bool holdingPowercell = playerHandItem.type == powercellID; + + // If the player's held power cells can be stacked on top of what's already in the charger, then stack them. + if (holdingPowercell && powercell.stack < powercell.maxStack) + { + int spaceLeft = powercell.maxStack - powercell.stack; + + // If the player has more cells than there is space left, insert as many as possible. Otherwise insert all the cells. + int cellsToInsert = Math.Min(playerHandItem.stack, spaceLeft); + chargerStackDiff = (short)cellsToInsert; + playerHandItem.stack -= cellsToInsert; + if (playerHandItem.stack == 0) + playerHandItem.TurnToAir(); + } + // If the player is holding nothing, then pick up all the power cells (if any exist). + else if (playerHandItem.IsAir && powercell.stack > 0) + { + chargerStackDiff = (short)-powercell.stack; + playerHandItem.SetDefaults(powercell.type); + playerHandItem.stack = powercell.stack; + powercell.TurnToAir(); + } + } + + // This assignment will automatically send the necessary sync packet. + if (chargerStackDiff != 0) + { + if (!shiftClicked) + Main.PlaySound(SoundID.Grab); + charger.CellStack += chargerStackDiff; + } + } + + // Since HoverItem is active, we don't need to input anything into this method. + Main.instance.MouseTextHackZoom(""); + // Specifically do not block mouse input if holding a pickaxe, so that you can mine blocks behind the UI. + Main.blockMouse = Main.LocalPlayer.ActiveItem().pick <= 0; + } + } + + public static void DrawWeaponSlot(SpriteBatch spriteBatch, Item item, Vector2 drawPosition) + { + Texture2D slotBackgroundTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ChargerWeaponSlot"); + spriteBatch.Draw(slotBackgroundTex, drawPosition, null, Color.White, 0f, slotBackgroundTex.Size() * 0.5f, IconScale, SpriteEffects.None, 0f); + + if (!item.IsAir) + { + float inventoryScale = Main.inventoryScale; + Texture2D itemTexture = Main.itemTexture[item.type]; + Rectangle itemFrame = Main.itemAnimations[item.type] == null ? itemTexture.Frame(1, 1, 0, 0) : Main.itemAnimations[item.type].GetFrame(itemTexture); + + float baseScale = 1f; + Color _ = Color.White; + ItemSlot.GetItemLight(ref _, ref baseScale, item, false); + float scaleRestrictor = 1f; + if (itemFrame.Width > 46 || itemFrame.Height > 46) + { + int restrictingDim = Math.Max(itemFrame.Width, itemFrame.Height); + scaleRestrictor = 46f / restrictingDim; + } + scaleRestrictor *= inventoryScale; + + if (ItemLoader.PreDrawInInventory(item, spriteBatch, drawPosition, itemFrame, item.GetAlpha(Color.White), item.GetColor(Color.White), itemTexture.Size() * 0.5f, scaleRestrictor * baseScale)) + { + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, item.GetAlpha(Color.White), 0f, itemTexture.Size() * 0.5f, scaleRestrictor * baseScale, SpriteEffects.None, 0f); + spriteBatch.Draw(itemTexture, drawPosition, itemFrame, item.GetColor(Color.White), 0f, itemTexture.Size() * 0.5f, scaleRestrictor * baseScale, SpriteEffects.None, 0f); + } + } + } + } +} diff --git a/UI/DraedonHologramChatUI.cs b/UI/DraedonHologramChatUI.cs deleted file mode 100644 index 6aa7babcf6..0000000000 --- a/UI/DraedonHologramChatUI.cs +++ /dev/null @@ -1,84 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System.Collections.Generic; -using Terraria; - -namespace CalamityMod.UI -{ - public class DraedonHologramChatUI - { - public const float TextPadding = 170f; - public const float TextAreaWidth = 800f; - public const float YOffsetPerLine = 30f; - public static string SelectDiaglog() - { - List potentialDiaglogOptions = new List() - { - "To any personnel engaged in the laboratories. Please wear your steel engraved ID badge at all times. It is the easiest method to discern your body if any accidents do occur.", - "To experiment is to fail. To fail is to learn. To learn is to advance.", - "Apparent danger while researching serves only to enhance the research experience.", - - "Laser-type weapon prototypes are incredibly lethal and are not to be used within presentation halls.", - "High-energy plasma emissions have adverse effects on both flesh and metal. Do not attempt to handle vented plasma.", - "Electric shocks from military equipment are intended to be fatal. If you survive such a shock, that is a clear indicator that the device is not functioning properly. Please report any such cases.", - "All employees are hereby notified that they will be held accountable for any collateral damage caused by Gauss weapon fire, even during sanctioned testing exercises.", - "Security Field Emitters will vaporize all unauthorized equipment and personnel. Please leave personal effects in the designated lockers off-site. This also means: Do not bring any family members who are not enlisted as personnel.", - - "If one does manage to breach restricted testing facilities, do at least record any unexpected burns, lacerations, bruising, fractur... ...trauma, shocks and otherwise. Thank you.", - "The power grid has been... ...eavily compromised. Abort research and proceed to the emergency exits located at... ...and egress with haste.", - "Notify the Security Department of any aggressive local fauna immediately." - }; - if (NPC.downedAncientCultist) - potentialDiaglogOptions.Add("Sensors have detected a significant breach in the spacetime continuum."); - if (Main.rand.NextBool(5000)) - return "Please help. I'm stuck in this hologram machine."; - return Main.rand.Next(potentialDiaglogOptions.ToArray()); - } - public static void Draw(SpriteBatch spriteBatch) - { - CalamityPlayer player = Main.LocalPlayer.Calamity(); - if (player.CurrentlyViewedHologramX == -1 || player.CurrentlyViewedHologramY == -1) - return; - - if (string.IsNullOrEmpty(player.CurrentlyViewedHologramText)) - player.CurrentlyViewedHologramText = SelectDiaglog(); - - Color backgroundColor = new Color(200, 200, 200, 200); - string[] dialogLines = Utils.WordwrapString(player.CurrentlyViewedHologramText, Main.fontMouseText, (int)(TextAreaWidth - TextPadding * 2), 10, out int lineCount); - spriteBatch.Draw(Main.chatBackTexture, - new Vector2(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2, 100f), - new Rectangle(0, 0, Main.chatBackTexture.Width, (lineCount + 2) * 30), - backgroundColor, - 0f, - Vector2.Zero, - 1f, - SpriteEffects.None, - 0f); - spriteBatch.Draw(Main.chatBackTexture, - new Vector2(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2, 100 + (lineCount + 2) * 30), - new Rectangle(0, Main.chatBackTexture.Height - 30, Main.chatBackTexture.Width, 30), - backgroundColor, - 0f, - Vector2.Zero, - 1f, - SpriteEffects.None, - 0f); - - for (int i = 0; i < lineCount + 1; i++) - { - if (dialogLines[i] != null) - { - Utils.DrawBorderStringFourWay(spriteBatch, - Main.fontMouseText, - dialogLines[i], - (int)TextPadding + (int)(Main.screenWidth - TextAreaWidth) / 2, - 120 + i * YOffsetPerLine, - Color.Cyan, - Color.Black, - Vector2.Zero); - } - } - } - } -} diff --git a/UI/DraedonsFactoryUI.cs b/UI/DraedonsFactoryUI.cs deleted file mode 100644 index 15e69d5fb6..0000000000 --- a/UI/DraedonsFactoryUI.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.UI.Chat; - -namespace CalamityMod.UI -{ - public class DraedonsFactoryUI - { - public const float IconScale = 0.7f; - public static void Draw(SpriteBatch spriteBatch) - { - if (Main.LocalPlayer.Calamity().CurrentlyViewedFactory != null) - { - var time = Terraria.DataStructures.TileEntity.ByID; - var stack = Main.LocalPlayer.Calamity().CurrentlyViewedFactory; - if (Main.LocalPlayer.chest != -1) - { - Main.LocalPlayer.Calamity().CurrentlyViewedFactory = null; - return; - } - Item fuel = Main.LocalPlayer.Calamity().CurrentlyViewedFactory.HeldItem; - Vector2 position = new Vector2(Main.LocalPlayer.Calamity().CurrentlyViewedFactoryX, Main.LocalPlayer.Calamity().CurrentlyViewedFactoryY); - - // Draw the fuel as an inventory slot. - DrawItemSlot(spriteBatch, ref fuel, position + new Vector2(16f, -34f) - Main.screenPosition); - - int width = 39, height = 39; - Rectangle mouseRectangle = new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 2, 2); - Rectangle drawnItemRectangle = new Rectangle((int)position.X, (int)position.Y - 60, width, height); - if (mouseRectangle.Intersects(drawnItemRectangle) && fuel.stack > 0) - { - Main.HoverItem.SetDefaults(fuel.type); - // Take items from the chest if the item is clicked. - bool alreadyUsedItem = UseFuel(ref Main.mouseItem, ref fuel); - if (!alreadyUsedItem) - UseFuel(ref Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem], ref fuel); - Main.instance.MouseTextHackZoom(""); // Since HoverItem is active, we don't need to input anything into this method. - Main.blockMouse = Main.LocalPlayer.ActiveItem().pick <= 0; // Block mouse input if hovering over the item UI and not holding a pickaxe. - } - } - } - - public static void DrawItemSlot(SpriteBatch spriteBatch, ref Item item, Vector2 drawPosition) - { - Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonFuelCellUISlot"); - - // This check is done twice because the draw order matters. We want to draw the background icon before any text. - if (item.stack > 0) - iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonFuelCellUISlotFilled"); - spriteBatch.Draw(iconTexture, drawPosition, null, Color.White, 0f, iconTexture.Size() * 0.5f, IconScale, SpriteEffects.None, 0f); - if (item.stack > 0) - { - float inventoryScale = Main.inventoryScale; - Vector2 numberOffset = iconTexture.Size() * 0.2f; - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, - Main.fontItemStack, - item.stack.ToString(), - drawPosition + numberOffset * inventoryScale, - Color.White, - 0f, - Vector2.Zero, - new Vector2(inventoryScale), - -1f, - inventoryScale); - } - } - - public static bool UseFuel(ref Item itemToUse, ref Item fuel) - { - if (Main.mouseLeft) - { - Main.playerInventory = true; - Main.recBigList = false; - if (itemToUse.type == fuel.type || itemToUse.type == ItemID.None) - { - itemToUse = fuel.Clone(); - int stack = itemToUse.stack; - itemToUse.SetDefaults(itemToUse.type); - itemToUse.stack = stack; - fuel.stack = 0; - return true; - } - } - return false; - } - } -} diff --git a/UI/DraedonsItemChargerUI.cs b/UI/DraedonsItemChargerUI.cs deleted file mode 100644 index 540a2879fe..0000000000 --- a/UI/DraedonsItemChargerUI.cs +++ /dev/null @@ -1,215 +0,0 @@ -using CalamityMod.Items.DraedonMisc; -using CalamityMod.TileEntities; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.UI; -using Terraria.UI.Chat; - -namespace CalamityMod.UI -{ - public class DraedonsItemChargerUI - { - public static int RectangleWidth => (int)(38 / Main.GameViewMatrix.Zoom.X); - public static int RectangleHeight => (int)(36 / Main.GameViewMatrix.Zoom.Y); - public static Vector2 ChargerPosition => new Vector2(Main.LocalPlayer.Calamity().CurrentlyViewedChargerX, Main.LocalPlayer.Calamity().CurrentlyViewedChargerY); - public static Rectangle FuelIconBounds => new Rectangle((int)ChargerPosition.X - RectangleWidth / 2 + 24, (int)ChargerPosition.Y - RectangleHeight / 2 - 44, RectangleWidth, RectangleHeight); - public static Rectangle ChargingItemIconBounds => new Rectangle((int)ChargerPosition.X - RectangleWidth / 2 + 24, (int)ChargerPosition.Y - RectangleHeight / 2 - 90, RectangleWidth, RectangleHeight); - public const float IconScale = 0.7f; - public static void Draw(SpriteBatch spriteBatch) - { - if (Main.LocalPlayer.Calamity().CurrentlyViewedCharger != null) - { - if (Main.LocalPlayer.chest != -1) - { - Main.LocalPlayer.Calamity().CurrentlyViewedCharger = null; - return; - } - ref TEDraedonItemCharger charger = ref Main.LocalPlayer.Calamity().CurrentlyViewedCharger; - ref int depositWithdrawCooldown = ref charger.DepositWithdrawCooldown; - ref Item itemBeingCharged = ref charger.ItemBeingCharged; - ref Item fuel = ref charger.FuelItem; - - // Draw the fuel as an inventory slot. - DrawItemSlot(spriteBatch, ref fuel, ChargerPosition + new Vector2(24f, -44f) - Main.screenPosition); - - // Draw the item being charged as an inventory slot. - DrawWeaponSlot(spriteBatch, ref itemBeingCharged, ChargerPosition + new Vector2(24f, -90f) - Main.screenPosition); - - Rectangle mouseRectangle = new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 2, 2); - bool cooldownComplete = depositWithdrawCooldown == 0; - if (Main.netMode != NetmodeID.SinglePlayer) - { - cooldownComplete = Main.time % 7 == 0; - } - if (mouseRectangle.Intersects(FuelIconBounds) && fuel.stack > 0) - Main.HoverItem = fuel.Clone(); - if (mouseRectangle.Intersects(ChargingItemIconBounds) && itemBeingCharged.stack > 0) - { - Main.HoverItem = itemBeingCharged.Clone(); - - // This effect is indeed purely aesthetic. - // Why not just use CurrentCharge instead of some wacky field in the tile entity, you might be asking? - // Well, as it turns out, multiplayer (and NBT tags) don't like taking data from the item. I was attempting to fix the issue for - // nearly 4 hours, to no avail. I'd consider this weird little piece of code here the lesser of two evils. - itemBeingCharged.Calamity().CurrentCharge = charger.Charge; - } - if (Main.mouseLeft && Main.LocalPlayer.itemAnimation == 0) - { - if (mouseRectangle.Intersects(FuelIconBounds)) - { - Main.playerInventory = true; - Main.recBigList = false; - - if (cooldownComplete) - { - if (!UseFuel(ref Main.mouseItem, ref fuel)) - UseFuel(ref Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem], ref fuel); - } - fuel.position = ChargerPosition + new Vector2(RectangleWidth, RectangleHeight) * 0.5f - Vector2.UnitY * 54f; - - depositWithdrawCooldown = 9; - } - if (mouseRectangle.Intersects(ChargingItemIconBounds)) - { - Main.playerInventory = true; - Main.recBigList = false; - - if (cooldownComplete) - { - if (!UseChargeItem(ref Main.mouseItem, ref itemBeingCharged, ref charger)) - UseChargeItem(ref Main.LocalPlayer.inventory[Main.LocalPlayer.selectedItem], ref itemBeingCharged, ref charger); - } - itemBeingCharged.position = ChargerPosition + new Vector2(RectangleWidth, RectangleHeight) * 0.5f - Vector2.UnitY * 94f; - - depositWithdrawCooldown = 9; - } - charger.ClientToServerSync(); - } - - if (mouseRectangle.Intersects(FuelIconBounds) || mouseRectangle.Intersects(ChargingItemIconBounds)) - { - Main.instance.MouseTextHackZoom(""); // Since HoverItem is active, we don't need to input anything into this method. - } - Main.blockMouse = mouseRectangle.Intersects(FuelIconBounds) || mouseRectangle.Intersects(ChargingItemIconBounds); // Block mouse input if hovering over the item UI but not holding a pickaxe. - Main.blockMouse &= Main.LocalPlayer.ActiveItem().pick <= 0; - - charger.DrawAllSparks(spriteBatch); - } - } - - public static void DrawItemSlot(SpriteBatch spriteBatch, ref Item item, Vector2 drawPosition) - { - Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonFuelCellUISlot"); - - // This check is done twice because the draw order matters. We want to draw the background icon before any text. - if (item.stack > 0) - iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonFuelCellUISlotFilled"); - spriteBatch.Draw(iconTexture, drawPosition, null, Color.White, 0f, iconTexture.Size() * 0.5f, IconScale, SpriteEffects.None, 0f); - if (item.stack > 0) - { - float inventoryScale = Main.inventoryScale; - Vector2 numberOffset = iconTexture.Size() * 0.2f; - ChatManager.DrawColorCodedStringWithShadow(spriteBatch, - Main.fontItemStack, - item.stack.ToString(), - drawPosition + numberOffset * inventoryScale, - Color.White, - 0f, - Vector2.Zero, - new Vector2(inventoryScale), - -1f, - inventoryScale); - } - } - - public static void DrawWeaponSlot(SpriteBatch spriteBatch, ref Item item, Vector2 drawPosition) - { - Texture2D iconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/DraedonWeaponUISlot"); - - spriteBatch.Draw(iconTexture, drawPosition, null, Color.White, 0f, iconTexture.Size() * 0.5f, IconScale, SpriteEffects.None, 0f); - if (!item.IsAir) - { - float inventoryScale = Main.inventoryScale; - Texture2D itemTexture = Main.itemTexture[item.type]; - Rectangle itemFrame = Main.itemAnimations[item.type] == null ? itemTexture.Frame(1, 1, 0, 0) : Main.itemAnimations[item.type].GetFrame(itemTexture); - - float baseScale = 1f; - Color _ = Color.White; - ItemSlot.GetItemLight(ref _, ref baseScale, item, false); - float scaleRestrictor = 1f; - if (itemFrame.Width > 46 || itemFrame.Height > 46) - { - if (itemFrame.Width > itemFrame.Height) - scaleRestrictor = 46f / itemFrame.Width; - else - scaleRestrictor = 46f / itemFrame.Height; - } - scaleRestrictor *= inventoryScale; - - if (ItemLoader.PreDrawInInventory(item, spriteBatch, drawPosition, itemFrame, item.GetAlpha(Color.White), item.GetColor(Color.White), itemTexture.Size() * 0.5f, scaleRestrictor * baseScale)) - { - spriteBatch.Draw(itemTexture, drawPosition, itemFrame, item.GetAlpha(Color.White), 0f, itemTexture.Size() * 0.5f, scaleRestrictor * baseScale, SpriteEffects.None, 0f); - spriteBatch.Draw(itemTexture, drawPosition, itemFrame, item.GetColor(Color.White), 0f, itemTexture.Size() * 0.5f, scaleRestrictor * baseScale, SpriteEffects.None, 0f); - } - } - } - - public static bool UseFuel(ref Item itemToUse, ref Item fuel) - { - // Withdraw the stored fuel. - if ((itemToUse.type == ModContent.ItemType() || itemToUse.type == ItemID.None) && fuel.stack > 0) - { - int oldMouseStack = itemToUse.stack; - itemToUse = fuel.Clone(); - itemToUse.SetDefaults(itemToUse.type); - itemToUse.stack = fuel.stack + oldMouseStack; - fuel.stack = 0; - return true; - } - // Deposit fuel. - else if (itemToUse.type == ModContent.ItemType() && itemToUse.stack > 0 && fuel.stack == 0) - { - int oldStack = itemToUse.stack; - fuel = itemToUse.Clone(); - fuel.SetDefaults(fuel.type); - fuel.stack = oldStack; - itemToUse.stack = 0; - return true; - } - return false; - } - - public static bool UseChargeItem(ref Item itemToUse, ref Item chargeItem, ref TEDraedonItemCharger charger) - { - // Withdraw the placed item. - if (itemToUse.type == ItemID.None && chargeItem.stack > 0) - { - int oldCharge = charger.Charge; - byte prefix = chargeItem.prefix; - itemToUse = chargeItem.Clone(); - itemToUse.SetDefaults(itemToUse.type); - itemToUse.Calamity().CurrentCharge = oldCharge; - itemToUse.prefix = prefix; - chargeItem.stack = 0; - return true; - } - // Insert an item. - else if (itemToUse.stack == 1 && chargeItem.stack == 0) - { - if (itemToUse is null || itemToUse.type < ItemID.Count) - return false; - if (!itemToUse.Calamity().Chargeable) - return false; - charger.Charge = itemToUse.Calamity().CurrentCharge; - charger.ChargeMax = itemToUse.Calamity().ChargeMax; - chargeItem = itemToUse.Clone(); - itemToUse = new Item(); - return true; - } - return false; - } - } -} diff --git a/UI/InvasionProgressUI.cs b/UI/InvasionProgressUI.cs new file mode 100644 index 0000000000..59d59af2cf --- /dev/null +++ b/UI/InvasionProgressUI.cs @@ -0,0 +1,92 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Events; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; + +namespace CalamityMod.UI +{ + public abstract class InvasionProgressUI + { + public virtual int SecondaryDigitPrecision { get; } = 0; + public abstract bool IsActive { get; } + public abstract float CompletionRatio { get; } + public abstract string InvasionName { get; } + public abstract Color InvasionBarColor { get; } + public abstract Texture2D IconTexture { get; } + public virtual void DrawBlueBar(SpriteBatch spriteBatch, Vector2 barDrawPosition, int barOffsetY) + { + int barWidth = 200; + int barHeight = 45; + + barDrawPosition.Y += barOffsetY; + + Rectangle screenCoordsRectangle = new Rectangle((int)barDrawPosition.X - barWidth / 2, (int)barDrawPosition.Y - barHeight / 2, barWidth, barHeight); + Texture2D barTexture = Main.colorBarTexture; + + Utils.DrawInvBG(spriteBatch, screenCoordsRectangle, new Color(63, 65, 151, 255) * 0.785f); + spriteBatch.Draw(barTexture, barDrawPosition, null, Color.White, 0f, new Vector2(barTexture.Width / 2, 0f), 1f, SpriteEffects.None, 0f); + } + public virtual void DrawProgressText(SpriteBatch spriteBatch, float yScale, Vector2 baseBarDrawPosition, int barOffsetY, out Vector2 newBarPosition) + { + string progressText = (100 * CompletionRatio).ToString($"N{SecondaryDigitPrecision}") + "%"; + progressText = Language.GetTextValue("Game.WaveCleared", progressText); + + Vector2 textSize = Main.fontMouseText.MeasureString(progressText); + float progressTextScale = 1f; + if (textSize.Y > 22f) + progressTextScale *= 22f / textSize.Y; + + newBarPosition = baseBarDrawPosition + Vector2.UnitY * (yScale + barOffsetY); + Utils.DrawBorderString(spriteBatch, progressText, newBarPosition - Vector2.UnitY * 4f, Color.White, progressTextScale, 0.5f, 1f, -1); + } + public virtual void DrawBackground(SpriteBatch spriteBatch, float yScale, Vector2 baseBarDrawPosition, int barOffsetY) + { + float barDrawOffsetX = 169f; + Vector2 barDrawPosition = baseBarDrawPosition + Vector2.UnitX * (CompletionRatio - 0.5f) * barDrawOffsetX; + spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle(0, 0, 1, 1), new Color(255, 241, 51), 0f, new Vector2(1f, 0.5f), new Vector2(barDrawOffsetX * CompletionRatio, yScale), SpriteEffects.None, 0f); + spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle(0, 0, 1, 1), new Color(255, 165, 0, 127), 0f, new Vector2(1f, 0.5f), new Vector2(2f, yScale), SpriteEffects.None, 0f); + spriteBatch.Draw(Main.magicPixel, barDrawPosition, new Rectangle(0, 0, 1, 1), Color.Black, 0f, Vector2.UnitY * 0.5f, new Vector2(barDrawOffsetX * (1f - CompletionRatio), yScale), SpriteEffects.None, 0f); + } + public virtual void DrawProgressTextAndIcons(SpriteBatch spriteBatch, int barOffsetY) + { + Vector2 textMeasurement = Main.fontMouseText.MeasureString(InvasionName); + float x = 120f; + if (textMeasurement.X > 200f) + { + x += textMeasurement.X - 200f; + } + Rectangle iconRectangle = Utils.CenteredRectangle(new Vector2(Main.screenWidth - x, Main.screenHeight - 80 + barOffsetY), textMeasurement + new Vector2(IconTexture.Width + 12, 6f)); + Utils.DrawInvBG(spriteBatch, iconRectangle, InvasionBarColor * 0.5f); + spriteBatch.Draw(IconTexture, iconRectangle.Left() + Vector2.UnitX * 8f, null, Color.White, 0f, Vector2.UnitY * IconTexture.Height / 2, 0.8f, SpriteEffects.None, 0f); + Utils.DrawBorderString(spriteBatch, InvasionName, iconRectangle.Right() + Vector2.UnitX * -16f, Color.White, 0.9f, 1f, 0.4f, -1); + } + public virtual void Draw(SpriteBatch spriteBatch) + { + if (!IsActive) + return; + + int barOffsetY = 0; + int totalBars = 0; + if (Main.invasionProgressNearInvasion || Main.invasionProgressAlpha > 0f) + totalBars++; + + // Incorporate the MGR boss health bar so that the two do not overlap. + // Also, keep the offset active during boss rush, so that it doesn't flip positions during cool-down periods. + if (CalamityPlayer.areThereAnyDamnBosses || BossRushEvent.BossRushActive) + totalBars++; + totalBars += InvasionProgressUIManager.TotalGUIsActive; + // Rise somewhat if there's other invasions going on. + barOffsetY -= 85 * (totalBars - 1); + + Vector2 barDrawPosition = new Vector2(Main.screenWidth - 120, Main.screenHeight - 40); + DrawBlueBar(spriteBatch, barDrawPosition, barOffsetY); + + float yScale = 8f; + DrawProgressText(spriteBatch, yScale, barDrawPosition, barOffsetY, out Vector2 newBarPosition); + DrawBackground(spriteBatch, yScale, newBarPosition, barOffsetY); + DrawProgressTextAndIcons(spriteBatch, barOffsetY); + } + } +} diff --git a/UI/InvasionProgressUIManager.cs b/UI/InvasionProgressUIManager.cs new file mode 100644 index 0000000000..d0144f27ca --- /dev/null +++ b/UI/InvasionProgressUIManager.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; + +namespace CalamityMod.UI +{ + public static class InvasionProgressUIManager + { + private static readonly List gUIs = new List(); + public static int TotalGUIsActive => gUIs.Count(gui => gui.IsActive); + public static bool AnyGUIsActive => TotalGUIsActive > 0; + public static InvasionProgressUI GetActiveGUI => gUIs.FirstOrDefault(gui => gui.IsActive); + public static void UpdateAndDraw(SpriteBatch spriteBatch) + { + if (AnyGUIsActive) + { + if (GetActiveGUI is null) + return; + GetActiveGUI.Draw(spriteBatch); + } + } + + public static void LoadGUIs() + { + // Look through every type in the mod, and check if it's derived from InvasionProgressUI. If it is, create a copy and save it in the static list. + foreach (Type type in typeof(CalamityMod).Assembly.GetTypes()) + { + // Don't load abstract classes since they cannot have instances. + if (type.IsAbstract) + continue; + if (type.IsSubclassOf(typeof(InvasionProgressUI))) + gUIs.Add(Activator.CreateInstance(type) as InvasionProgressUI); + } + } + public static void UnloadGUIs() => gUIs.Clear(); + } +} diff --git a/UI/LabHologramProjectorUI.cs b/UI/LabHologramProjectorUI.cs new file mode 100644 index 0000000000..94b275495c --- /dev/null +++ b/UI/LabHologramProjectorUI.cs @@ -0,0 +1,107 @@ +using CalamityMod.CalPlayer; +using CalamityMod.TileEntities; +using Terraria.ID; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.Collections.Generic; +using Terraria; +using Terraria.DataStructures; + +namespace CalamityMod.UI +{ + public class LabHologramProjectorUI + { + public const float MaxPlayerDistance = 120f; + public const float TextPadding = 170f; + public const float TextAreaWidth = 800f; + public const float YOffsetPerLine = 30f; + public static string ChooseDialogue() + { + List dialogueOptions = new List() + { + "To any personnel engaged in the laboratories. Please wear your steel engraved ID badge at all times. It is the easiest method to discern your body if any accidents do occur.", + "To experiment is to fail. To fail is to learn. To learn is to advance.", + "Apparent danger while researching serves only to enhance the research experience.", + + "Laser-type weapon prototypes are incredibly lethal and are not to be used within presentation halls.", + "High-energy plasma emissions have adverse effects on both flesh and metal. Do not attempt to handle vented plasma.", + "Electric shocks from military equipment are intended to be fatal. If you survive such a shock, that is a clear indicator that the device is not functioning properly. Please report any such cases.", + "All employees are hereby notified that they will be held accountable for any collateral damage caused by Gauss weapon fire, even during sanctioned testing exercises.", + "Security Field Emitters will vaporize all unauthorized equipment and personnel. Please leave personal effects in the designated lockers off-site. This also means: Do not bring any family members who are not enlisted as personnel.", + + "If one does manage to breach restricted testing facilities, do at least record any unexpected burns, lacerations, bruising, fractur... ...trauma, shocks and otherwise. Thank you.", + "The power grid has been... ...eavily compromised. Abort research and proceed to the emergency exits located at... ...and egress with haste.", + "Notify the Security Department of any aggressive local fauna immediately." + }; + if (NPC.downedAncientCultist) + dialogueOptions.Add("Sensors have detected a significant breach in the spacetime continuum."); + + return Main.rand.NextBool(5000) ? "Please help. I'm stuck in this hologram machine." : Main.rand.Next(dialogueOptions.ToArray()); + } + public static void Draw(SpriteBatch spriteBatch) + { + Player p = Main.LocalPlayer; + CalamityPlayer mp = p.Calamity(); + int projectorID = mp.CurrentlyViewedHologramID; + + // The UI only draws if the player is viewing a projector. + if (projectorID == -1) + return; + + // The UI cannot draw if the player is already occupied with an NPC. + if (p.talkNPC > 0 || Main.npcShop > 0) + return; + + // Check if this tile entity ID is actually a projector. If it's not, immediately destroy this UI. + TELabHologramProjector projector; + bool projectorIsValid = TileEntity.ByID.TryGetValue(projectorID, out TileEntity te); + if (projectorIsValid && te is TELabHologramProjector cast) + projector = cast; + else + { + mp.CurrentlyViewedHologramID = -1; + mp.CurrentlyViewedHologramText = string.Empty; + return; + } + + // If the player is too far away from their viewed projector, immediately destroy this UI and play the menu close sound. + Vector2 projectorWorldCenter = projector.Center; + if (p.DistanceSQ(projectorWorldCenter) > MaxPlayerDistance * MaxPlayerDistance) + { + Main.PlaySound(SoundID.MenuClose); + mp.CurrentlyViewedHologramID = -1; + mp.CurrentlyViewedHologramText = string.Empty; + return; + } + + // Pick text to display, if it has not already been picked. + if (string.IsNullOrEmpty(mp.CurrentlyViewedHologramText)) + mp.CurrentlyViewedHologramText = ChooseDialogue(); + + Color backgroundColor = new Color(200, 200, 200, 200); + + // Wrap the text so that it neatly fits in the dialogue box. + string[] dialogLines = Utils.WordwrapString(mp.CurrentlyViewedHologramText, Main.fontMouseText, (int)(TextAreaWidth - TextPadding * 2), 10, out int lineCount); + + // Draw the background of the text box. + spriteBatch.Draw(Main.chatBackTexture, new Vector2(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2, 100f), + new Rectangle(0, 0, Main.chatBackTexture.Width, (lineCount + 2) * 30), backgroundColor, 0f, Vector2.Zero, 1f, + SpriteEffects.None, 0f); + spriteBatch.Draw(Main.chatBackTexture, + new Vector2(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2, 100 + (lineCount + 2) * 30), + new Rectangle(0, Main.chatBackTexture.Height - 30, Main.chatBackTexture.Width, 30), backgroundColor, 0f, + Vector2.Zero, 1f, SpriteEffects.None, 0f); + + // Draw the dialogue itself. + for (int i = 0; i < lineCount + 1; i++) + { + string text = dialogLines[i]; + if (text is null) + continue; + Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, dialogLines[i], + (int)TextPadding + (int)(Main.screenWidth - TextAreaWidth) / 2, 120 + i * YOffsetPerLine, Color.Cyan, Color.Black, + Vector2.Zero); + } + } + } +} diff --git a/UI/ModeIndicatorUI.cs b/UI/ModeIndicatorUI.cs new file mode 100644 index 0000000000..5967268016 --- /dev/null +++ b/UI/ModeIndicatorUI.cs @@ -0,0 +1,72 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class ModeIndicatorUI + { + public static readonly Vector2 OffsetToAreaCenter = new Vector2(0f, 4f); + public static Vector2 DifficultyIconOffset => new Vector2(0f, -13f); + public static Vector2 ArmageddonIconOffset => new Vector2(12f, 7f); + public static Vector2 MaliceIconOffset => new Vector2(-12f, 7f); + public static void Draw(SpriteBatch spriteBatch) + { + // The mode indicator should only be displayed when the inventory is open, to prevent obstruction. + if (!Main.playerInventory) + return; + + Texture2D outerAreaTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorArea"); + Texture2D revengeanceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorRev"); + Texture2D deathIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorDeath"); + Texture2D armageddonIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorArma"); + Texture2D maliceIconTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/ModeIndicatorMalice"); + + Rectangle mouseRectangle = Utils.CenteredRectangle(Main.MouseScreen, Vector2.One * 2f); + + Vector2 drawCenter = new Vector2(Main.screenWidth - 400f, 72f) + outerAreaTexture.Size() * 0.5f; + + spriteBatch.Draw(outerAreaTexture, drawCenter, null, Color.White, 0f, outerAreaTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + Texture2D difficultyIconToUse = CalamityWorld.death ? deathIconTexture : revengeanceIconTexture; + bool modeIsActive = CalamityWorld.revenge; + bool renderingText = false; + if (CalamityWorld.revenge) + spriteBatch.Draw(difficultyIconToUse, drawCenter + DifficultyIconOffset, null, Color.White, 0f, difficultyIconToUse.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + // Rev/Death active text. + if (mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + DifficultyIconOffset, difficultyIconToUse.Size()))) + { + Main.instance.MouseText($"{(CalamityWorld.death ? "Death" : "Revengeance")} Mode is {(modeIsActive ? "active" : "not active")}."); + renderingText = true; + } + + if (CalamityWorld.armageddon) + { + spriteBatch.Draw(armageddonIconTexture, drawCenter + ArmageddonIconOffset, null, Color.White, 0f, armageddonIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + } + + // Armageddon active text. + if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + ArmageddonIconOffset, armageddonIconTexture.Size()))) + { + Main.instance.MouseText($"Armageddon is {(CalamityWorld.armageddon ? "active" : "not active")}."); + renderingText = true; + } + + if (CalamityWorld.malice) + spriteBatch.Draw(maliceIconTexture, drawCenter + MaliceIconOffset, null, Color.White, 0f, maliceIconTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0f); + + // Malice active text. + if (!renderingText && mouseRectangle.Intersects(Utils.CenteredRectangle(drawCenter + MaliceIconOffset, armageddonIconTexture.Size()))) + { + Main.instance.MouseText($"Malice Mode is {(CalamityWorld.malice ? "active" : "not active")}."); + renderingText = true; + } + + if (renderingText) + Main.instance.MouseTextHackZoom(string.Empty); + } + } +} diff --git a/UI/PowerCellFactoryUI.cs b/UI/PowerCellFactoryUI.cs new file mode 100644 index 0000000000..135645d728 --- /dev/null +++ b/UI/PowerCellFactoryUI.cs @@ -0,0 +1,161 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.DraedonMisc; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class PowerCellFactoryUI + { + public const float MaxPlayerDistance = 160f; + private const int GuiWidth = 36; + private const int GuiHeight = 36; + private const float SlotDrawOffsetX = 32f; + private const float SlotDrawOffsetY = -14f; + + public static void Draw(SpriteBatch spriteBatch) + { + Player p = Main.LocalPlayer; + CalamityPlayer mp = p.Calamity(); + int factoryID = mp.CurrentlyViewedFactoryID; + + // The UI only draws if the player is viewing a factory. + if (factoryID == -1) + return; + + // Check if this tile entity ID is actually a factory. If it's not, immediately destroy this UI. + TEPowerCellFactory factory; + bool factoryIsValid = TileEntity.ByID.TryGetValue(factoryID, out TileEntity te); + if (factoryIsValid && te is TEPowerCellFactory cast) + factory = cast; + else + { + mp.CurrentlyViewedFactoryID = -1; + return; + } + + // If the player's inventory isn't open, or they have a chest open, immediately destroy this UI. + if (!Main.playerInventory || p.chest != -1) + { + mp.CurrentlyViewedFactoryID = -1; + return; + } + + // If the player is too far away from their viewed factory, immediately destroy this UI and play the menu close sound. + Vector2 factoryWorldCenter = factory.Center; + if (p.DistanceSQ(factoryWorldCenter) > MaxPlayerDistance * MaxPlayerDistance) + { + Main.PlaySound(SoundID.MenuClose); + mp.CurrentlyViewedFactoryID = -1; + return; + } + + // What item is currently in the UI item slot? It's normally nothing, but it could be power cells. + int powercellID = ModContent.ItemType(); + Item powercell = new Item(); + powercell.TurnToAir(); + if (factory.CellStack > 0) + { + powercell.SetDefaults(powercellID); + powercell.stack = factory.CellStack; + } + + Vector2 uiBasePos = factory.Position.ToWorldCoordinates(0f, 0f); + + // Draw the factory's stored item as an inventory slot. + Vector2 powercellDrawPos = uiBasePos + new Vector2(SlotDrawOffsetX, SlotDrawOffsetY) - Main.screenPosition; + CalamityUtils.DrawPowercellSlot(spriteBatch, powercell, powercellDrawPos); + + Rectangle mouseRect = CalamityUtils.MouseHitbox; + int slotRectX = (int)(uiBasePos.X - 1f); + int cellSlotRectY = (int)(uiBasePos.Y + SlotDrawOffsetY - GuiHeight / 2); + Rectangle powercellSlotRect = new Rectangle(slotRectX, cellSlotRectY, GuiWidth, GuiHeight); + + // If the player's cursor is over the slot and there are power cells, then interaction with the UI is possible. + if (mouseRect.Intersects(powercellSlotRect) && powercell.stack > 0) + { + p.mouseInterface = Main.blockMouse = true; + + if (!powercell.IsAir) + Main.HoverItem = powercell; + + // If the slot is clicked, try to grab cells from the factory using both "current items" that a player can have. + int cellsGrabbed = 0; + bool shiftClicked = false; + if (Main.mouseLeft && Main.mouseLeftRelease) + { + // If the player is holding shift and has space for the power cells, just spawn all of them on his or her face. + if (Main.keyState.PressingShift() && p.ItemSpace(powercell)) + { + cellsGrabbed = powercell.stack; + shiftClicked = true; + DropHelper.DropItem(p, powercellID, cellsGrabbed); + } + else + { + cellsGrabbed = TryGrabCell(ref Main.mouseItem, ref powercell); + if (cellsGrabbed == 0) + cellsGrabbed = TryGrabCell(ref p.inventory[Main.LocalPlayer.selectedItem], ref powercell); + } + } + + // If any cells were actually grabbed, take them from the factory's stockpile. + // Using the CellStack property setter automatically sends the correct packet to update the entity server side. + if (cellsGrabbed > 0) + { + factory.CellStack -= (short)cellsGrabbed; + + // 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); + } + + // Since HoverItem is active, we don't need to input anything into this method. + Main.instance.MouseTextHackZoom(""); + } + } + + // Returns the number of cells grabbed. + public static int TryGrabCell(ref Item playerHandItem, ref Item cell) + { + Main.playerInventory = true; + Main.recBigList = false; + + // You can only grab cells if you're stacking them with other cells or holding nothing. + if (playerHandItem.IsAir) + { + playerHandItem.SetDefaults(cell.type); + playerHandItem.stack = cell.stack; + cell.TurnToAir(); + return playerHandItem.stack; + } + + // You can grab cells while holding cells, but your held stack can't go over the stack limit. + if (playerHandItem.type == cell.type) + { + int spaceLeft = playerHandItem.maxStack - playerHandItem.stack; + + // If there's more cells than space left, take as many as possible. Otherwise take all the cells. + int cellsToTake = Math.Min(cell.stack, spaceLeft); + if (cellsToTake <= 0) + return 0; + + playerHandItem.stack += cellsToTake; + cell.stack -= cellsToTake; + + if (cell.stack == 0) + cell.TurnToAir(); + + return cellsToTake; + } + return 0; + } + } +} diff --git a/UI/RipperUI.cs b/UI/RipperUI.cs index 5e260a66c7..77531b44e3 100644 --- a/UI/RipperUI.cs +++ b/UI/RipperUI.cs @@ -1,14 +1,16 @@ using CalamityMod.CalPlayer; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using System.Collections.Generic; +using System.Text; using Terraria; using Terraria.ModLoader; -using CalamityMod.World; -using Microsoft.Xna.Framework.Input; namespace CalamityMod.UI { - public class RipperUI + public static class RipperUI { public const float DefaultRagePosX = 500f; public const float DefaultRagePosY = 30f; @@ -24,13 +26,59 @@ namespace CalamityMod.UI public static Vector2 adrenDrawPos = new Vector2(DefaultAdrenPosX, DefaultAdrenPosY); private static Vector2? rageDragOffset = null; private static Vector2? adrenDragOffset = null; + private static Vector2 pearlOffsetLeft = Vector2.Zero; + private static Vector2 pearlOffsetCenter = Vector2.Zero; + private static Vector2 pearlOffsetRight = Vector2.Zero; + private static Vector2 PearlOffsetCenterLeft => 0.5f * (pearlOffsetLeft + pearlOffsetCenter); + private static Vector2 PearlOffsetCenterRight => 0.5f * (pearlOffsetRight + pearlOffsetCenter); private static int rageAnimFrame = -1; private static int rageAnimTimer = 0; private static int adrenAnimFrame = -1; private static int adrenAnimTimer = 0; - public static void Reset() + private static Texture2D rageBarTex, rageBorderTex, rageAnimTex; + private static Texture2D mushroomPlasmaTex, infernalBloodTex, redLightningTex; + private static Texture2D adrenBarTex, adrenBorderTex, adrenAnimTex; + private static Texture2D electrolyteGelTex, starlightFuelTex, ectoheartTex; + + 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"); + + adrenBarTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBar"); + adrenBorderTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBarBorder"); + adrenAnimTex = ModContent.GetTexture("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"); + + electrolyteGelTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_ElectrolyteGelPack"); + starlightFuelTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineDisplay_StarlightFuelCell"); + ectoheartTex = ModContent.GetTexture("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); + pearlOffsetRight = new Vector2(rageBorderTex.Width * 0.6667f - 6f, rageBorderTex.Height - 9f); + + Reset(); + } + + internal static void Unload() + { + Reset(); + + rageBarTex = rageBorderTex = rageAnimTex = null; + adrenBarTex = adrenBorderTex = adrenAnimTex = null; + mushroomPlasmaTex = infernalBloodTex = redLightningTex = null; + electrolyteGelTex = starlightFuelTex = ectoheartTex = null; + pearlOffsetLeft = pearlOffsetCenter = pearlOffsetRight = Vector2.Zero; + } + + internal static void Reset() { bool configExists = CalamityConfig.Instance != null; @@ -59,21 +107,15 @@ namespace CalamityMod.UI adrenDrawPos.X = (int)adrenDrawPos.X; adrenDrawPos.Y = (int)adrenDrawPos.Y; - // Grab all the textures and the player object and then start drawing - Texture2D rageBarTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageBar"); - Texture2D rageBorderTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageBarBorder"); - Texture2D rageAnimTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/RageFullAnimation"); - Texture2D adrenBarTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBar"); - Texture2D adrenBorderTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineBarBorder"); - Texture2D adrenAnimTex = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/AdrenalineFullAnimation"); + // Grab the ModPlayer object and then start drawing CalamityPlayer modPlayer = player.Calamity(); - DrawRage(spriteBatch, modPlayer, rageBarTex, rageBorderTex, rageAnimTex); - DrawAdrenaline(spriteBatch, modPlayer, adrenBarTex, adrenBorderTex, adrenAnimTex); + DrawRageBar(spriteBatch, modPlayer); + DrawAdrenalineBar(spriteBatch, modPlayer); HandleMouseInteraction(modPlayer, rageBorderTex.Size(), adrenBorderTex.Size()); } - private static void DrawRage(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Texture2D barTex, Texture2D borderTex, Texture2D animTex) + private static void DrawRageBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer) { Vector2 shakeOffset = modPlayer.rageModeActive ? GetShakeOffset() : Vector2.Zero; @@ -98,29 +140,45 @@ namespace CalamityMod.UI } } + float uiScale = Main.UIScale; + // Draw the border of the Rage Bar first - spriteBatch.Draw(borderTex, rageDrawPos + shakeOffset, Color.White); + spriteBatch.Draw(rageBorderTex, rageDrawPos + shakeOffset, null, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); // The amount of the bar to draw depends on the player's current Rage level // 7 pixels of dead space, 90 pixels of bar, 7 pixels of dead space. Bar is 24 pixels tall int deadSpace = 7; - int barWidth = barTex.Width - 2 * deadSpace; - Rectangle cropRect = new Rectangle(0, 0, deadSpace + (int)(barWidth * rageRatio), barTex.Height); - spriteBatch.Draw(barTex, rageDrawPos + shakeOffset, cropRect, Color.White); + int barWidth = rageBarTex.Width - 2 * deadSpace; + Rectangle cropRect = new Rectangle(0, 0, deadSpace + (int)(barWidth * rageRatio), rageBarTex.Height); + spriteBatch.Draw(rageBarTex, rageDrawPos + shakeOffset, cropRect, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); + + // Determine which pearls to draw (and their positions) based off of which Rage upgrades the player has. + IList pearls = new List(3); + if (modPlayer.rageBoostOne) // Mushroom Plasma Root + pearls.Add(mushroomPlasmaTex); + if (modPlayer.rageBoostTwo) // Infernal Blood + pearls.Add(infernalBloodTex); + if (modPlayer.rageBoostThree) // Red Lightning Container + pearls.Add(redLightningTex); + IList offsets = GetPearlOffsets(pearls.Count); + + // Draw pearls at appropriate positions. + for (int i = 0; i < pearls.Count; ++i) + spriteBatch.Draw(pearls[i], rageDrawPos + shakeOffset + offsets[i], null, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); // If the animation is active, draw the animation on top of both the border and the bar. if (animationActive) { - float xOffset = (borderTex.Width - animTex.Width) / 2f; - int frameHeight = (animTex.Height / RageAnimFrames) - 1; - float yOffset = (borderTex.Height - frameHeight) / 2f; + float xOffset = (rageBorderTex.Width - rageAnimTex.Width) / 2f; + int frameHeight = (rageAnimTex.Height / RageAnimFrames) - 1; + float yOffset = (rageBorderTex.Height - frameHeight) / 2f; Vector2 sizeDiffOffset = new Vector2(xOffset, yOffset); - Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * rageAnimFrame, animTex.Width, frameHeight); - spriteBatch.Draw(animTex, rageDrawPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White); + Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * rageAnimFrame, rageAnimTex.Width, frameHeight); + spriteBatch.Draw(rageAnimTex, rageDrawPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White, 0f, rageBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); } } - private static void DrawAdrenaline(SpriteBatch spriteBatch, CalamityPlayer modPlayer, Texture2D barTex, Texture2D borderTex, Texture2D animTex) + private static void DrawAdrenalineBar(SpriteBatch spriteBatch, CalamityPlayer modPlayer) { Vector2 shakeOffset = modPlayer.adrenalineModeActive ? GetShakeOffset() : Vector2.Zero; @@ -145,33 +203,50 @@ namespace CalamityMod.UI } } + float uiScale = Main.UIScale; + // Draw the border of the Adrenaline Bar first - spriteBatch.Draw(borderTex, adrenDrawPos + shakeOffset, Color.White); + spriteBatch.Draw(adrenBorderTex, adrenDrawPos + shakeOffset, null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); // The amount of the bar to draw depends on the player's current Adrenaline level // 7 pixels of dead space, 90 pixels of bar, 7 pixels of dead space. int deadSpace = 7; - int barWidth = barTex.Width - 2 * deadSpace; - Rectangle cropRect = new Rectangle(0, 0, deadSpace + (int)(barWidth * adrenRatio), barTex.Height); - spriteBatch.Draw(barTex, adrenDrawPos + shakeOffset, cropRect, Color.White); + int barWidth = adrenBarTex.Width - 2 * deadSpace; + Rectangle cropRect = new Rectangle(0, 0, deadSpace + (int)(barWidth * adrenRatio), adrenBarTex.Height); + spriteBatch.Draw(adrenBarTex, adrenDrawPos + shakeOffset, cropRect, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); + + // Determine which pearls to draw (and their positions) based off of which Adrenaline upgrades the player has. + IList pearls = new List(3); + if (modPlayer.adrenalineBoostOne) // Electrolyte Gel Pack + pearls.Add(electrolyteGelTex); + if (modPlayer.adrenalineBoostTwo) // Starlight Fuel Cell + pearls.Add(starlightFuelTex); + if (modPlayer.adrenalineBoostThree) // Ectoheart + pearls.Add(ectoheartTex); + IList offsets = GetPearlOffsets(pearls.Count); + + // Draw pearls at appropriate positions. + for (int i = 0; i < pearls.Count; ++i) + spriteBatch.Draw(pearls[i], adrenDrawPos + shakeOffset + offsets[i], null, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); // If the animation is active, draw the animation on top of both the border and the bar. if (animationActive) { - float xOffset = (borderTex.Width - animTex.Width) / 2f; - int frameHeight = (animTex.Height / AdrenAnimFrames) - 1; - float yOffset = (borderTex.Height - frameHeight) / 2f; + float xOffset = (adrenBorderTex.Width - adrenAnimTex.Width) / 2f; + int frameHeight = (adrenAnimTex.Height / AdrenAnimFrames) - 1; + float yOffset = (adrenBorderTex.Height - frameHeight) / 2f; Vector2 sizeDiffOffset = new Vector2(xOffset, yOffset); - Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * adrenAnimFrame, animTex.Width, frameHeight); - spriteBatch.Draw(animTex, adrenDrawPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White); + Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * adrenAnimFrame, adrenAnimTex.Width, frameHeight); + spriteBatch.Draw(adrenAnimTex, adrenDrawPos + shakeOffset + sizeDiffOffset, animCropRect, Color.White, 0f, adrenBorderTex.Size() * 0.5f, uiScale, SpriteEffects.None, 0); } } private static void HandleMouseInteraction(CalamityPlayer modPlayer, Vector2 rageBarSize, Vector2 adrenBarSize) { + float uiScale = Main.UIScale; Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); - Rectangle rageBar = new Rectangle((int)rageDrawPos.X, (int)rageDrawPos.Y, (int)rageBarSize.X, (int)rageBarSize.Y); - Rectangle adrenBar = new Rectangle((int)adrenDrawPos.X, (int)adrenDrawPos.Y, (int)adrenBarSize.X, (int)adrenBarSize.Y); + Rectangle rageBar = Utils.CenteredRectangle(rageDrawPos, rageBarSize * uiScale); + Rectangle adrenBar = Utils.CenteredRectangle(adrenDrawPos, adrenBarSize * uiScale); bool rageHover = mouse.Intersects(rageBar); bool adrenHover = mouse.Intersects(adrenBar); @@ -183,8 +258,10 @@ namespace CalamityMod.UI if (rageHover && !adrenHover) { // Add hover text if the mouse is over Rage bar - Main.LocalPlayer.mouseInterface = true; - Main.instance.MouseText($"Rage: {(int)modPlayer.rage} / {(int)modPlayer.rageMax}"); + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; + string rageStr = MakeRipperPercentString(modPlayer.rage, modPlayer.rageMax); + Main.instance.MouseText($"Rage: {rageStr}"); // The bar is draggable if enabled in config. if (!CalamityConfig.Instance.MeterPosLock && mouseInput.LeftButton == ButtonState.Pressed) @@ -197,8 +274,10 @@ namespace CalamityMod.UI else if (adrenHover) { // Add hover text if the mouse is over the bar - Main.LocalPlayer.mouseInterface = true; - Main.instance.MouseText($"Adrenaline: {(int)modPlayer.adrenaline} / {(int)modPlayer.adrenalineMax}"); + if (!CalamityConfig.Instance.MeterPosLock) + Main.LocalPlayer.mouseInterface = true; + string adrenStr = MakeRipperPercentString(modPlayer.adrenaline, modPlayer.adrenalineMax); + Main.instance.MouseText($"Adrenaline: {adrenStr}"); // The bar is draggable if enabled in config. if (!CalamityConfig.Instance.MeterPosLock && mouseInput.LeftButton == ButtonState.Pressed) @@ -273,6 +352,36 @@ namespace CalamityMod.UI float shakeX = Main.rand.NextFloat(-shake, shake); float shakeY = Main.rand.NextFloat(-shake, shake); return new Vector2(shakeX, shakeY); - } + } + + private static IList GetPearlOffsets(int count) + { + switch (count) + { + case 1: + return new List() { pearlOffsetCenter }; + case 2: + return new List() { PearlOffsetCenterLeft, PearlOffsetCenterRight }; + case 3: + return new List() { pearlOffsetLeft, pearlOffsetCenter, pearlOffsetRight }; + default: + return null; + } + } + + private static string MakeRipperPercentString(float value, float maxValue) + { + string topTwoDecimalPlaces = value.ToString("n2"); + string bottomTwoDecimalPlaces = maxValue.ToString("n2"); + string percent = (100f * value / maxValue).ToString("0.00"); + StringBuilder sb = new StringBuilder(32); + sb.Append(percent); + sb.Append("% ("); + sb.Append(topTwoDecimalPlaces); + sb.Append(" / "); + sb.Append(bottomTwoDecimalPlaces); + sb.Append(')'); + return sb.ToString(); + } } } diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index c6a5b04f96..79fedac613 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -38,18 +38,22 @@ namespace CalamityMod.UI Texture2D indicatorTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeterStrikeIndicator"); Texture2D barTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeterBar"); Texture2D fullBarTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/UI/StealthMeterBarFull"); - spriteBatch.Draw(edgeTexture, DrawPosition, null, Color.White * modPlayer.stealthUIAlpha, 0f, edgeTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0); + 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()) { - spriteBatch.Draw(indicatorTexture, DrawPosition, null, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0); + spriteBatch.Draw(indicatorTexture, DrawPosition, null, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); } float completionRatio = modPlayer.rogueStealth / modPlayer.rogueStealthMax; Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * completionRatio), barTexture.Width); bool full = modPlayer.rogueStealth >= modPlayer.rogueStealthMax; - spriteBatch.Draw(full ? fullBarTexture : barTexture, DrawPosition, barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, 1f, SpriteEffects.None, 0); - if (new Rectangle((int)(DrawPosition.X + Main.screenPosition.X - player.width / 2), (int)(DrawPosition.Y + Main.screenPosition.Y), barTexture.Width, barTexture.Height).Intersects( - new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 8, 8))) + spriteBatch.Draw(full ? fullBarTexture : barTexture, DrawPosition, barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0); + + Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); + Rectangle stealthBar = Utils.CenteredRectangle(DrawPosition, barTexture.Size() * uiScale); + + if (stealthBar.Intersects(mouse)) { if (modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f) { @@ -63,8 +67,7 @@ namespace CalamityMod.UI } if (!CalamityConfig.Instance.MeterPosLock) { - if (new Rectangle((int)(DrawPosition.X + Main.screenPosition.X - 26), (int)(DrawPosition.Y + Main.screenPosition.Y - 9), 52, 18).Intersects( - new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 8, 8))) + if (stealthBar.Intersects(mouse)) { if (Mouse.GetState().LeftButton == ButtonState.Pressed) { diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 7208c959e1..982e77fbef 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -7,8 +7,8 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Potions; -using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; using System.Collections.Generic; using System.Linq; @@ -27,11 +27,15 @@ namespace CalamityMod public static void AddRecipes() { - EditTerraBladeRecipe(); - EditFireGauntletRecipe(); + EditLeatherRecipe(); + EditTerraBladeRecipe(); + EditFireGauntletRecipe(); + EditMechBossSummonRecipes(); + EditWingRecipes(); + EditPhasesaberRecipes(); AstralAlternatives(); - AddPotionRecipes(); + AddPotionRecipes(); AddCookedFood(); AddToolRecipes(); AddProgressionRecipes(); @@ -43,7 +47,7 @@ namespace CalamityMod // Leather from Vertebrae, for Crimson worlds ModRecipe r = GetNewRecipe(); - r.AddIngredient(ItemID.Vertebrae, 5); + r.AddIngredient(ItemID.Vertebrae, 2); r.AddTile(TileID.WorkBenches); r.SetResult(ItemID.Leather); r.AddRecipe(); @@ -63,8 +67,15 @@ namespace CalamityMod r.SetResult(ItemID.FallenStar); r.AddRecipe(); - // Ectoplasm from Ectoblood - r = GetNewRecipe(); + // Hallowed Bars + r = GetNewRecipe(); + r.AddIngredient(ModContent.ItemType(), 4); + r.AddTile(TileID.AdamantiteForge); + r.SetResult(ItemID.HallowedBar); + r.AddRecipe(); + + // Ectoplasm from Ectoblood + r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType(), 3); r.AddTile(TileID.MythrilAnvil); r.SetResult(ItemID.Ectoplasm); @@ -80,10 +91,9 @@ namespace CalamityMod // Life Crystal r = GetNewRecipe(); - r.AddIngredient(ItemID.Bone, 5); - r.AddIngredient(ItemID.PinkGel); - r.AddIngredient(ItemID.HealingPotion); - r.AddIngredient(ItemID.Ruby); + r.AddIngredient(ItemID.StoneBlock, 5); + r.AddIngredient(ItemID.Ruby, 2); + r.AddIngredient(ItemID.HealingPotion); r.AddTile(TileID.Anvils); r.SetResult(ItemID.LifeCrystal); r.AddRecipe(); @@ -104,8 +114,18 @@ namespace CalamityMod r.AddRecipe(); } - // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) - private static void EditTerraBladeRecipe() + // Change Leather's recipe to require 2 Rotten Chunks/Vertebrae + private static void EditLeatherRecipe() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.Leather).ToList().ForEach(s => + { + s.requiredItem[0].stack = 2; + }); + } + + // Change Terra Blade's recipe to require 7 Living Shards (forces the Blade to be post-Plantera) + private static void EditTerraBladeRecipe() { List rec = Main.recipe.ToList(); rec.Where(x => x.createItem.type == ItemID.TerraBlade).ToList().ForEach(s => @@ -126,46 +146,75 @@ namespace CalamityMod }); } - // Change Fire Gauntlet's recipe to require 5 Chaotic Bars (forces the item to be post-Golem) - private static void EditFireGauntletRecipe() + // Change Fire Gauntlet's recipe to require 5 Chaotic Bars (forces the item to be post-Golem) + private static void EditFireGauntletRecipe() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.FireGauntlet).ToList().ForEach(s => + { + for (int i = 0; i < s.requiredItem.Length; i++) + { + s.requiredItem[i] = new Item(); + } + s.requiredItem[0].SetDefaults(ItemID.MagmaStone, false); + s.requiredItem[0].stack = 1; + s.requiredItem[1].SetDefaults(ItemID.MechanicalGlove, false); + s.requiredItem[1].stack = 1; + s.requiredItem[2].SetDefaults(ModContent.ItemType(), false); + s.requiredItem[2].stack = 5; + + s.createItem.SetDefaults(ItemID.FireGauntlet, false); + s.createItem.stack = 1; + }); + } + + private static void EditMechBossSummonRecipes() { List rec = Main.recipe.ToList(); - rec.Where(x => x.createItem.type == ItemID.FireGauntlet).ToList().ForEach(s => + rec.Where(x => x.createItem.type == ItemID.MechanicalWorm || x.createItem.type == ItemID.MechanicalEye || x.createItem.type == ItemID.MechanicalSkull).ToList().ForEach(s => { - for (int i = 0; i < s.requiredItem.Length; i++) - { - s.requiredItem[i] = new Item(); - } - s.requiredItem[0].SetDefaults(ItemID.MagmaStone, false); - s.requiredItem[0].stack = 1; - s.requiredItem[1].SetDefaults(ItemID.MechanicalGlove, false); - s.requiredItem[1].stack = 1; - s.requiredItem[2].SetDefaults(ModContent.ItemType(), false); - s.requiredItem[2].stack = 5; - - s.createItem.SetDefaults(ItemID.FireGauntlet, false); - s.createItem.stack = 1; + s.requiredTile[0] = TileID.Anvils; }); } - #region Astral Alternatives - private static void AstralAlternatives() + private static void EditWingRecipes() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.AngelWings || x.createItem.type == ItemID.DemonWings).ToList().ForEach(s => + { + s.requiredTile[0] = TileID.Anvils; + }); + } + + // Change Phasesaber recipes to require 20 Crystal Shards + private static void EditPhasesaberRecipes() + { + List rec = Main.recipe.ToList(); + rec.Where(x => x.createItem.type == ItemID.BluePhasesaber || x.createItem.type == ItemID.GreenPhasesaber || x.createItem.type == ItemID.PurplePhasesaber || + x.createItem.type == ItemID.RedPhasesaber || x.createItem.type == ItemID.WhitePhasesaber || x.createItem.type == ItemID.YellowPhasesaber).ToList().ForEach(s => + { + s.requiredItem[1].stack = 20; + }); + } + + #region Astral Alternatives + private static void AstralAlternatives() { - //Bowl + //Bowl ModRecipe r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType(), 2); r.AddTile(TileID.Furnaces); r.SetResult(ItemID.Bowl); r.AddRecipe(); - //Clay Pot + //Clay Pot r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType(), 2); r.AddTile(TileID.Furnaces); r.SetResult(ItemID.ClayPot); r.AddRecipe(); - //Pink Vase + //Pink Vase r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType(), 2); r.AddTile(TileID.Furnaces); @@ -174,9 +223,9 @@ namespace CalamityMod } #endregion - #region Potions - // Equivalent Blood Orb recipes for almost all vanilla potions - private static void AddPotionRecipes() + #region Potions + // Equivalent Blood Orb recipes for almost all vanilla potions + private static void AddPotionRecipes() { short[] potions = new[] { @@ -359,6 +408,42 @@ namespace CalamityMod r.AddTile(TileID.Loom); r.SetResult(ItemID.Umbrella); r.AddRecipe(); + + // Living Loom + r = GetNewRecipe(); + r.AddIngredient(ItemID.Loom); + r.AddIngredient(ItemID.Vine, 2); + r.AddTile(TileID.Sawmill); + r.SetResult(ItemID.LivingLoom); + r.AddRecipe(); + + // Living Wood Wand + r = GetNewRecipe(); + r.AddIngredient(ItemID.Wood, 30); + r.AddTile(TileID.LivingLoom); + r.SetResult(ItemID.LivingWoodWand); + r.AddRecipe(); + + // Living Leaf Wand + r = GetNewRecipe(); + r.AddIngredient(ItemID.Wood, 30); + r.AddTile(TileID.LivingLoom); + r.SetResult(ItemID.LeafWand); + r.AddRecipe(); + + // Living Mahogany Wand + r = GetNewRecipe(); + r.AddIngredient(ItemID.RichMahogany, 30); + r.AddTile(TileID.LivingLoom); + r.SetResult(ItemID.LivingMahoganyWand); + r.AddRecipe(); + + // Living Mahogany Leaf Wand + r = GetNewRecipe(); + r.AddIngredient(ItemID.RichMahogany, 30); + r.AddTile(TileID.LivingLoom); + r.SetResult(ItemID.LivingMahoganyLeafWand); + r.AddRecipe(); } #endregion @@ -369,7 +454,7 @@ namespace CalamityMod // Guide Voodoo Doll ModRecipe r = GetNewRecipe(); r.AddIngredient(ItemID.Leather, 2); - r.AddRecipeGroup("FetidBloodletting", 2); + r.AddRecipeGroup("EvilPowder", 10); r.AddTile(TileID.Hellforge); r.SetResult(ItemID.GuideVoodooDoll); r.AddRecipe(); @@ -478,7 +563,7 @@ namespace CalamityMod //Slime Staff r = GetNewRecipe(); r.AddIngredient(ItemID.Wood, 6); - r.anyWood = true; + r.anyWood = true; r.AddIngredient(ItemID.Gel, 40); r.AddIngredient(ItemID.PinkGel, 10); r.AddTile(TileID.Anvils); @@ -698,8 +783,21 @@ namespace CalamityMod r.AddTile(TileID.Loom); r.SetResult(ItemID.EskimoPants); r.AddRecipe(); + + // Pharaoh set + r = GetNewRecipe(); + r.AddIngredient(ItemID.AncientCloth, 3); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.PharaohsMask); + r.AddRecipe(); + + r = GetNewRecipe(); + r.AddIngredient(ItemID.AncientCloth, 4); + r.AddTile(TileID.Loom); + r.SetResult(ItemID.PharaohsRobe); + r.AddRecipe(); } - #endregion + #endregion #region AnkhShield // Every base component for the Ankh Shield @@ -739,8 +837,8 @@ namespace CalamityMod // Nazar (curse) r = GetNewRecipe(); - r.AddIngredient(ItemID.SoulofNight, 20); - r.AddIngredient(ItemID.Lens, 5); + r.AddIngredient(ItemID.SoulofNight, 15); + r.AddIngredient(ItemID.Lens, 3); r.AddTile(TileID.MythrilAnvil); r.SetResult(ItemID.Nazar); r.AddRecipe(); @@ -813,7 +911,7 @@ namespace CalamityMod r.AddIngredient(ItemID.SoulofMight, 10); r.AddIngredient(ItemID.SoulofLight, 5); r.AddIngredient(ItemID.SoulofNight, 5); - r.AddIngredient(ModContent.ItemType(), 3); + r.AddIngredient(ModContent.ItemType(), 3); r.AddTile(TileID.MythrilAnvil); r.SetResult(ItemID.CelestialMagnet); r.AddRecipe(); @@ -836,30 +934,6 @@ namespace CalamityMod r.SetResult(ItemID.MagicQuiver); r.AddRecipe(); - // Frost Helmet w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 6); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostHelmet); - r.AddRecipe(); - - // Frost Breastplate w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 10); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostBreastplate); - r.AddRecipe(); - - // Frost Leggings w/ Frigid Bars - r = GetNewRecipe(); - r.AddIngredient(ModContent.ItemType(), 8); - r.AddIngredient(ItemID.FrostCore); - r.AddTile(TileID.IceMachine); - r.SetResult(ItemID.FrostLeggings); - r.AddRecipe(); - // Terra Blade w/ True Bloody Edge r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType()); @@ -869,7 +943,7 @@ namespace CalamityMod r.SetResult(ItemID.TerraBlade); r.AddRecipe(); - // Turtle Shell with Giant Tortoise Shell + // Turtle Shell with Giant Tortoise Shell r = GetNewRecipe(); r.AddIngredient(ModContent.ItemType()); r.SetResult(ItemID.TurtleShell); @@ -879,17 +953,19 @@ namespace CalamityMod public static void AddRecipeGroups() { - //Modify Vanilla Recipe Groups - RecipeGroup firefly = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Fireflies"]]; - firefly.ValidItems.Add(ModContent.ItemType()); + //Modify Vanilla Recipe Groups + RecipeGroup firefly = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Fireflies"]]; + firefly.ValidItems.Add(ModContent.ItemType()); - RecipeGroup sand = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Sand"]]; - sand.ValidItems.Add(ModContent.ItemType()); + RecipeGroup sand = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Sand"]]; + sand.ValidItems.Add(ModContent.ItemType()); + sand.ValidItems.Add(ModContent.ItemType()); + sand.ValidItems.Add(ModContent.ItemType()); - RecipeGroup wood = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Wood"]]; - wood.ValidItems.Add(ModContent.ItemType()); //Astral Monolith was decidedly not wood-like enough + RecipeGroup wood = RecipeGroup.recipeGroups[RecipeGroup.recipeGroupIDs["Wood"]]; + wood.ValidItems.Add(ModContent.ItemType()); //Astral Monolith was decidedly not wood-like enough - //New Groups + //New Groups RecipeGroup group = new RecipeGroup(() => "Any Copper Bar", new int[] { ItemID.CopperBar, @@ -911,13 +987,6 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("AnyGoldBar", group); - group = new RecipeGroup(() => "Any Evil Ore", new int[] - { - ItemID.CrimtaneOre, - ItemID.DemoniteOre - }); - RecipeGroup.RegisterGroup("AnyEvilOre", group); - group = new RecipeGroup(() => "Any Evil Block", new int[] { ItemID.EbonstoneBlock, @@ -939,26 +1008,26 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("AnyCobaltBar", group); - group = new RecipeGroup(() => "Any Adamantite Bar", new int[] + group = new RecipeGroup(() => "Any Mythril Bar", new int[] + { + ItemID.MythrilBar, + ItemID.OrichalcumBar + }); + RecipeGroup.RegisterGroup("AnyMythrilBar", group); + + group = new RecipeGroup(() => "Any Adamantite Bar", new int[] { ItemID.AdamantiteBar, ItemID.TitaniumBar }); RecipeGroup.RegisterGroup("AnyAdamantiteBar", group); - group = new RecipeGroup(() => "Nightmare Fuel or Endothermic Energy", new int[] + group = new RecipeGroup(() => "Any Evil Powder", new int[] { - ModContent.ItemType(), - ModContent.ItemType() + ItemID.VilePowder, + ItemID.ViciousPowder }); - RecipeGroup.RegisterGroup("NForEE", group); - - group = new RecipeGroup(() => "Any Evil Essence", new int[] - { - ModContent.ItemType(), - ModContent.ItemType() - }); - RecipeGroup.RegisterGroup("FetidBloodletting", group); + RecipeGroup.RegisterGroup("EvilPowder", group); group = new RecipeGroup(() => "Shadow Scale or Tissue Sample", new int[] { @@ -1013,27 +1082,32 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("SiltGroup", group); - group = new RecipeGroup(() => "Any Phaseblade", new int[] + group = new RecipeGroup(() => "Any Hallowed Helmet", new int[] { - ItemID.WhitePhaseblade, - ItemID.RedPhaseblade, - ItemID.GreenPhaseblade, - ItemID.BluePhaseblade, - ItemID.PurplePhaseblade, - ItemID.YellowPhaseblade + ItemID.HallowedHelmet, + ItemID.HallowedHeadgear, + ItemID.HallowedMask/*, + ItemID.HallowedHood, + ItemID.AncientHallowedHelmet, + ItemID.AncientHallowedHeadgear, + ItemID.AncientHallowedMask, + ItemID.AncientHallowedHood*/ }); - RecipeGroup.RegisterGroup("AnyPhaseblade", group); + RecipeGroup.RegisterGroup("AnyHallowedHelmet", group); - group = new RecipeGroup(() => "Any Phasesaber", new int[] - { - ItemID.WhitePhasesaber, - ItemID.RedPhasesaber, - ItemID.GreenPhasesaber, - ItemID.BluePhasesaber, - ItemID.PurplePhasesaber, - ItemID.YellowPhasesaber - }); - RecipeGroup.RegisterGroup("AnyPhasesaber", group); + /*group = new RecipeGroup(() => "Any Hallowed Platemail", new int[] + { + ItemID.HallowedPlateMail, + ItemID.AncientHallowedPlateMail + }); + RecipeGroup.RegisterGroup("AnyHallowedPlatemail", group); + + group = new RecipeGroup(() => "Any Hallowed Greaves", new int[] + { + ItemID.HallowedGreaves, + ItemID.AncientHallowedGreaves + }); + RecipeGroup.RegisterGroup("AnyHallowedGreaves", group);*/ group = new RecipeGroup(() => "Any Hardmode Anvil", new int[] { @@ -1067,7 +1141,19 @@ namespace CalamityMod }); RecipeGroup.RegisterGroup("LunarHamaxe", group); - group = new RecipeGroup(() => "Any Food Item", new int[] + group = new RecipeGroup(() => "Any Large Gem", new int[] + { + ItemID.LargeAmber, + ItemID.LargeAmethyst, + ItemID.LargeDiamond, + ItemID.LargeEmerald, + ItemID.LargeRuby, + ItemID.LargeSapphire, + ItemID.LargeTopaz + }); + RecipeGroup.RegisterGroup("AnyLargeGem", group); + + group = new RecipeGroup(() => "Any Food Item", new int[] { ItemID.CookedFish, ItemID.CookedMarshmallow, @@ -1127,6 +1213,16 @@ namespace CalamityMod ItemID.BetsyWings, ItemID.ArkhalisWings, ItemID.LeinforsWings, + ItemID.BejeweledValkyrieWing, + /* + ItemID.GhostarsWings, + ItemID.GroxTheGreatWings, + ItemID.FoodBarbarianWings, + ItemID.SafemanWings, + ItemID.CreativeWings, + ItemID.RainbowWings, + ItemID.LongRainbowTrailWings, + */ ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs deleted file mode 100644 index 1568d67b54..0000000000 --- a/Utilities/CalamityUtils.cs +++ /dev/null @@ -1,4039 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Items; -using CalamityMod.Items.Tools.ClimateChange; -using CalamityMod.NPCs; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.Calamitas; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Tiles; -using CalamityMod.Tiles.Abyss; -using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.AstralDesert; -using CalamityMod.Tiles.AstralSnow; -using CalamityMod.Tiles.Crags; -using CalamityMod.Tiles.FurnitureAbyss; -using CalamityMod.Tiles.FurnitureAshen; -using CalamityMod.Tiles.FurnitureEutrophic; -using CalamityMod.Tiles.FurnitureOccult; -using CalamityMod.Tiles.FurnitureProfaned; -using CalamityMod.Tiles.FurnitureVoid; -using CalamityMod.Tiles.Ores; -using CalamityMod.Tiles.SunkenSea; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.ModLoader.IO; -using Terraria.ObjectData; - -namespace CalamityMod -{ - public static class CalamityUtils - { - public static readonly CalamityRarity[] postMLRarities = - { - CalamityRarity.Turquoise, - CalamityRarity.PureGreen, - CalamityRarity.DarkBlue, - CalamityRarity.Violet, - CalamityRarity.Developer, - CalamityRarity.Rainbow - }; - - #region Object Extensions - public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); - public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); - public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); - public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); - public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; - #endregion - - #region Player Utilities - // 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 bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); - public static bool StandingStill(this Player player, float velocity = 0.05f) => player.velocity.Length() < velocity; - public static bool InSpace(this Player player) - { - float x = Main.maxTilesX / 4200f; - x *= x; - float spaceGravityMult = (float)((player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); - return spaceGravityMult < 1f; - } - public static bool PillarZone(this Player player) => player.ZoneTowerStardust || player.ZoneTowerSolar || player.ZoneTowerVortex || player.ZoneTowerNebula; - public static bool InCalamity(this Player player) => player.Calamity().ZoneCalamity; - public static bool InSunkenSea(this Player player) => player.Calamity().ZoneSunkenSea; - public static bool InSulphur(this Player player) => player.Calamity().ZoneSulphur; - public static bool InAstral(this Player player, int biome = 0) //1 is above ground, 2 is underground, 3 is desert - { - switch (biome) - { - case 1: - return player.Calamity().ZoneAstral && (player.ZoneOverworldHeight || player.ZoneSkyHeight); - - case 2: - return player.Calamity().ZoneAstral && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight); - - case 3: - return player.Calamity().ZoneAstral && player.ZoneDesert; - - default: - return player.Calamity().ZoneAstral; - } - } - public static bool InAbyss(this Player player, int layer = 0) - { - switch (layer) - { - case 1: - return player.Calamity().ZoneAbyssLayer1; - - case 2: - return player.Calamity().ZoneAbyssLayer2; - - case 3: - return player.Calamity().ZoneAbyssLayer3; - - case 4: - return player.Calamity().ZoneAbyssLayer4; - - default: - return player.Calamity().ZoneAbyss; - } - } - public static bool InventoryHas(this Player player, params int[] items) - { - return player.inventory.Any(item => items.Contains(item.type)); - } - public static bool PortableStorageHas(this Player player, params int[] items) - { - bool hasItem = false; - if (player.bank.item.Any(item => items.Contains(item.type))) - hasItem = true; - if (player.bank2.item.Any(item => items.Contains(item.type))) - hasItem = true; - if (player.bank3.item.Any(item => items.Contains(item.type))) - hasItem = true; - return hasItem; - } - - /// - /// Inflict typical exo weapon debuffs in pvp. - /// - /// The Player attacked. - /// Debuff time multiplier if needed. - /// Inflicts debuffs if the target isn't immune. - public static void ExoDebuffs(this Player target, float multiplier = 1f) - { - target.AddBuff(ModContent.BuffType(), (int)(30 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(BuffID.CursedInferno, (int)(120 * multiplier)); - target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier)); - target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); - target.AddBuff(BuffID.Ichor, (int)(120 * multiplier)); - } - #endregion - - #region NPC Utilities - /// - /// Allows you to set the lifeMax value of a NPC to different values based on the mode. Called instead of npc.lifeMax = X. - /// - /// The NPC whose lifeMax value you are trying to set. - /// The value lifeMax will be set to in normal mode, this value gets doubled automatically in Expert mode. - /// The value lifeMax will be set to in Revegeneance mode. - /// The value lifeMax will be set to during the Boss Rush. - public static void LifeMaxNERB(this NPC npc, int normal, int? revengeance = null, int? bossRush = null) - { - npc.lifeMax = normal; - - if (bossRush.HasValue && CalamityWorld.bossRushActive) - { - npc.lifeMax = bossRush.Value; - } - else if (revengeance.HasValue && CalamityWorld.revenge) - { - npc.lifeMax = revengeance.Value; - } - } - /// - /// Allows you to set the DR value of a NPC to different values based on the mode. - /// - /// The NPC whose DR value you are trying to set. - /// The value DR will be set to in normal mode. - /// The value DR will be set to in Revegeneance mode. - /// The value DR will be set to during the Boss Rush. - public static void DR_NERD(this NPC npc, float normal, float? revengeance = null, float? death = null, float? bossRush = null, bool? customDR = null) - { - npc.Calamity().DR = normal; - - if (bossRush.HasValue && CalamityWorld.bossRushActive) - { - npc.Calamity().DR = bossRush.Value; - } - else if (revengeance.HasValue && CalamityWorld.revenge) - { - npc.Calamity().DR = CalamityWorld.death ? death.Value : revengeance.Value; - } - - if (customDR.HasValue) - npc.Calamity().customDR = true; - } - - /// - /// Get the aggression multiplier used for NPCs in Master Mode Calamity rev+ - /// Will also be used to modify certain boss size/scale - /// - /// The NPC that is having its aggression increased, used to modify the base 1.5x aggression multiplier - /// Used to modify the color of this NPC - public static float GetMasterModeNPCAggressionMultiplier(ref Color newColor, int? NPCType = null) - { - /*if (!Main.masterMode) - return 1f;*/ - - /*if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType() || NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else if (NPCType == ModContent.NPCType()) - { - - } - else - { - switch (NPCType) - { - case NPCID.KingSlime: - case NPCID.EyeofCthulhu: - case NPCID.EaterofWorldsHead: - case NPCID.BrainofCthulhu: - case NPCID.Creeper: - case NPCID.QueenBee: - case NPCID.SkeletronHead: - case NPCID.WallofFlesh: - case NPCID.WallofFleshEye: - case NPCID.Spazmatism: - case NPCID.Retinazer: - case NPCID.TheDestroyer: - case NPCID.SkeletronPrime: - case NPCID.Plantera: - case NPCID.Golem: - case NPCID.GolemHead: - case NPCID.DukeFishron: - case NPCID.CultistBoss: - case NPCID.MoonLordCore: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: - break; - } - }*/ - - return 1.5f; - } - - /// - /// Get the contact damage for NPCs in Master Mode Calamity rev+ - /// - /// The damage the npc does prior to being multiplied - /// The damage multiplier applied to the npc' contact damage - public static int GetMasterModeContactDamage(int damage, double damageMultiplier) - { - /*if (!Main.masterMode || !CalamityWorld.revenge) - return damage;*/ - - return damage; - - //return (int)(damage * damageMultiplier); - } - - /// - /// Get the damage for projectiles in Master Mode Calamity rev+ - /// - /// The damage the projectile does prior to being multiplied - /// The damage multiplier applied to the projectiles' damage - public static int GetMasterModeProjectileDamage(int damage, double damageMultiplier) - { - /*if (!Main.masterMode || !CalamityWorld.revenge) - return damage;*/ - - return damage; - - //return (int)(damage * damageMultiplier); - } - - /// - /// Detects nearby hostile NPCs from a given point - /// - /// The position where we wish to check for nearby NPCs - /// Maximum amount of pixels to check around the origin - /// Whether to ignore tiles when finding a target or not - /// Whether bosses should be prioritized in targetting or not - public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool ignoreTiles = true, bool bossPriority = false) - { - NPC closestTarget = null; - float distance = maxDistanceToCheck; - if (bossPriority) - { - bool bossFound = false; - for (int index = 0; index < Main.npc.Length; index++) - { - // If we've found a valid boss target, ignore ALL targets which aren't bosses. - if (bossFound && !(Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye)) - continue; - if (Main.npc[index].CanBeChasedBy(null, false)) - { - float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); - - bool canHit = true; - if (extraDistance < distance && !ignoreTiles) - canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); - - if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) - { - if (Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye) - bossFound = true; - distance = Vector2.Distance(origin, Main.npc[index].Center); - closestTarget = Main.npc[index]; - } - } - } - } - else - { - for (int index = 0; index < Main.npc.Length; index++) - { - if (Main.npc[index].CanBeChasedBy(null, false)) - { - float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); - - bool canHit = true; - if (extraDistance < distance && !ignoreTiles) - canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); - - if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) - { - distance = Vector2.Distance(origin, Main.npc[index].Center); - closestTarget = Main.npc[index]; - } - } - } - } - return closestTarget; - } - /// - /// Detects nearby hostile NPCs from a given point with minion support - /// - /// The position where we wish to check for nearby NPCs - /// Maximum amount of pixels to check around the origin - /// Owner of the minion - /// Whether to ignore tiles when finding a target or not - public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner, bool ignoreTiles = true) - { - if (owner is null || owner.whoAmI < 0 || owner.whoAmI > Main.maxPlayers || owner.MinionAttackTargetNPC < 0 || owner.MinionAttackTargetNPC > Main.maxNPCs) - return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); - NPC npc = Main.npc[owner.MinionAttackTargetNPC]; - bool canHit = true; - if (!ignoreTiles) - canHit = Collision.CanHit(origin, 1, 1, npc.Center, 1, 1); - if (owner.HasMinionAttackTargetNPC && canHit) - { - return npc; - } - return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); - } - - /// - /// Crude anti-butcher logic based on % max health. - /// - /// The NPC attacked. - /// How much damage the attack would deal. - /// Whether or not the anti-butcher was triggered. - public static bool AntiButcher(NPC npc, ref double damage, float healthPercent) - { - if (damage <= npc.lifeMax * healthPercent) - return false; - damage = 0D; - return true; - } - - /// - /// Check if an NPC is organic - /// - /// The NPC attacked. - /// Whether or not the NPC is organic. - public static bool Organic(this NPC target) - { - if ((target.HitSound != SoundID.NPCHit4 && target.HitSound != SoundID.NPCHit41 && target.HitSound != SoundID.NPCHit2 && - target.HitSound != SoundID.NPCHit5 && target.HitSound != SoundID.NPCHit11 && target.HitSound != SoundID.NPCHit30 && - target.HitSound != SoundID.NPCHit34 && target.HitSound != SoundID.NPCHit36 && target.HitSound != SoundID.NPCHit42 && - target.HitSound != SoundID.NPCHit49 && target.HitSound != SoundID.NPCHit52 && target.HitSound != SoundID.NPCHit53 && - target.HitSound != SoundID.NPCHit54 && target.HitSound != null) || target.type == ModContent.NPCType() || - target.type == ModContent.NPCType()) - { - return true; - } - return false; - } - - /// - /// Check if an NPC is inorganic - /// - /// The NPC attacked. - /// Whether or not the NPC is inorganic. - public static bool Inorganic(this NPC target) - { - if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 && - target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 && - target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 && - target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 && - target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 && - target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 && - target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 && - target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 && - target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 && - target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 && - target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 && - target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 && - target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57 && target.type != ModContent.NPCType() && - target.type != ModContent.NPCType() && target.type != ModContent.NPCType()) - { - return true; - } - return false; - } - - /// - /// Shortcut for the generic boss summon message. - /// - /// The whoAmI index of the summoned npc. - public static void BossAwakenMessage(int npcIndex) - { - string typeName = Main.npc[npcIndex].TypeName; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), new Color(175, 75, 255)); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[]{Main.npc[npcIndex].GetTypeNetName()}), new Color(175, 75, 255)); - } - } - - /// Inflict typical exo weapon debuffs. Duration multiplier optional. - /// - /// The NPC attacked. - /// Debuff time multiplier if needed. - /// Inflicts debuffs if they can. - public static void ExoDebuffs(this NPC target, float multiplier = 1f) - { - target.AddBuff(BuffID.Ichor, (int)(120 * multiplier)); - target.AddBuff(BuffID.CursedInferno, (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(30 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(ModContent.BuffType(), (int)(120 * multiplier)); - target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier)); - target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); - } - #endregion - - #region Item Utilities - public static bool IsPostML(this CalamityRarity calrare) - { - return calrare != CalamityRarity.NoEffect; - // TODO -- separate out whether an item is post-ML from its custom rarity. - // This is necessary because there are pre-ML rare variants, legendary weapons and dedicated items. - /* - for(int i = 0; i < postMLRarities.Length; ++i) - if (postMLRarities[i] == calrare) - return true; - return false; - */ - } - - /// - /// Converts the given ModHotKey into a string for insertion into item tooltips.

- /// This allows the user's actual keybind choices to be shown to them in tooltips. - ///
- /// The ModHotKey to convert to a string. - /// - public static string TooltipHotkeyString(this ModHotKey mhk) - { - if (Main.dedServ || mhk is null) - return ""; - - List keys = mhk.GetAssignedKeys(); - if (keys.Count == 0) - return "[NONE]"; - else - { - StringBuilder sb = new StringBuilder(16); - sb.Append(keys[0]); - - // In almost all cases, this code won't run, because there won't be multiple bindings for the hotkey. But just in case... - for (int i = 1; i < keys.Count; ++i) - sb.Append(" / ").Append(keys[i]); - return sb.ToString(); - } - } - - private const float WorldInsertionOffset = 15f; - /// - /// If the given item is outside the world, force it to be within the world boundaries. - /// - /// The item to possibly relocate. - /// The minimum distance in pixels the item can be from the world boundary. - /// Whether the item was relocated. - public static bool ForceItemIntoWorld(Item item, float desiredDist = WorldInsertionOffset) - { - if (item is null || !item.active) - return false; - - // The world edge needs to be accounted for regardless of the distance chosen as an argument. - float worldEdge = Main.offLimitBorderTiles * 16f; - float dist = worldEdge + desiredDist; - - float maxPosX = Main.maxTilesX * 16f; - float maxPosY = Main.maxTilesY * 16f; - bool moved = false; - if (item.position.X < worldEdge) - { - item.position.X = dist; - moved = true; - } - else if(item.position.X + item.width > maxPosX - worldEdge) - { - item.position.X = maxPosX - item.width - dist; - moved = true; - } - if(item.position.Y < worldEdge) - { - item.position.Y = dist; - moved = true; - } - else if(item.position.Y + item.height > maxPosY - worldEdge) - { - item.position.Y = maxPosY - item.height - dist; - moved = true; - } - return moved; - } - - public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) - { - Player player = Main.player[Main.myPlayer]; - Item item = player.ActiveItem(); - float hitbox_X, hitbox_Y; - float mountOffsetY = player.mount.PlayerOffsetHitbox; - - // Third hitbox shifting values - if (player.itemAnimation < player.itemAnimationMax * 0.333) - { - float shiftX = 10f; - if (hitboxWidth >= 92) - shiftX = 38f; - else if (hitboxWidth >= 64) - shiftX = 28f; - else if (hitboxWidth >= 52) - shiftX = 24f; - else if (hitboxWidth > 32) - shiftX = 14f; - hitbox_X = player.position.X + player.width * 0.5f + (hitboxWidth * 0.5f - shiftX) * player.direction; - hitbox_Y = player.position.Y + 24f + mountOffsetY; - } - - // Second hitbox shifting values - else if (player.itemAnimation < player.itemAnimationMax * 0.666) - { - float shift = 10f; - if (hitboxWidth >= 92) - shift = 38f; - else if (hitboxWidth >= 64) - shift = 28f; - else if (hitboxWidth >= 52) - shift = 24f; - else if (hitboxWidth > 32) - shift = 18f; - hitbox_X = player.position.X + (player.width * 0.5f + (hitboxWidth * 0.5f - shift) * player.direction); - - shift = 10f; - if (hitboxHeight > 64) - shift = 14f; - else if (hitboxHeight > 52) - shift = 12f; - else if (hitboxHeight > 32) - shift = 8f; - - hitbox_Y = player.position.Y + shift + mountOffsetY; - } - - // First hitbox shifting values - else - { - float shift = 6f; - if (hitboxWidth >= 92) - shift = 38f; - else if (hitboxWidth >= 64) - shift = 28f; - else if (hitboxWidth >= 52) - shift = 24f; - else if (hitboxWidth >= 48) - shift = 18f; - else if (hitboxWidth > 32) - shift = 14f; - hitbox_X = player.position.X + player.width * 0.5f - (hitboxWidth * 0.5f - shift) * player.direction; - - shift = 10f; - if (hitboxHeight > 64) - shift = 14f; - else if (hitboxHeight > 52) - shift = 12f; - else if (hitboxHeight > 32) - shift = 10f; - hitbox_Y = player.position.Y + shift + mountOffsetY; - } - - // Inversion due to grav potion - if (player.gravDir == -1f) - { - hitbox_Y = player.position.Y + player.height + (player.position.Y - hitbox_Y); - } - - // Hitbox size adjustments - Rectangle hitbox = new Rectangle((int)hitbox_X, (int)hitbox_Y, 32, 32); - if (item.damage >= 0 && item.type > ItemID.None && !item.noMelee && player.itemAnimation > 0) - { - if (!Main.dedServ) - { - hitbox = new Rectangle((int)hitbox_X, (int)hitbox_Y, (int)hitboxWidth, (int)hitboxHeight); - } - hitbox.Width = (int)(hitbox.Width * item.scale); - hitbox.Height = (int)(hitbox.Height * item.scale); - if (player.direction == -1) - { - hitbox.X -= hitbox.Width; - } - if (player.gravDir == 1f) - { - hitbox.Y -= hitbox.Height; - } - - // Broadsword use style - if (item.useStyle == ItemUseStyleID.SwingThrow) - { - // Third hitbox size adjustments - if (player.itemAnimation < player.itemAnimationMax * 0.333) - { - if (player.direction == -1) - { - hitbox.X -= (int)(hitbox.Width * 1.4 - hitbox.Width); - } - hitbox.Width = (int)(hitbox.Width * 1.4); - hitbox.Y += (int)(hitbox.Height * 0.5 * player.gravDir); - hitbox.Height = (int)(hitbox.Height * 1.1); - } - - // First hitbox size adjustments - else if (player.itemAnimation >= player.itemAnimationMax * 0.666) - { - if (player.direction == 1) - { - hitbox.X -= (int)(hitbox.Width * 1.2); - } - hitbox.Width *= 2; - hitbox.Y -= (int)((hitbox.Height * 1.4 - hitbox.Height) * player.gravDir); - hitbox.Height = (int)(hitbox.Height * 1.4); - } - } - } - return hitbox; - } - - public static void ConsumeItemViaQuickBuff(Player player, Item item, int buffType, int buffTime, bool reducedPotionSickness) - { - bool showsOver = false; - for (int l = 0; l < Player.MaxBuffs; l++) - { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 0 && hasBuff == buffType) - showsOver = true; - } - - if (!showsOver) - { - Main.PlaySound(item.UseSound, player.Center); - - int healAmt = player.Calamity().bloodPactBoost ? (int)(item.healLife * 1.5) : item.healLife; - if (CalamityWorld.ironHeart) - healAmt = 0; - if (healAmt > 0 && player.QuickHeal_GetItemToUse() != null) - { - if (player.QuickHeal_GetItemToUse().type != item.type) - healAmt = 0; - } - - player.statLife += healAmt; - player.statMana += item.healMana; - if (player.statMana > player.statManaMax2) - { - player.statMana = player.statManaMax2; - } - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - if (item.healMana > 0) - player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); - if (Main.myPlayer == player.whoAmI) - { - if (healAmt > 0) - player.HealEffect(healAmt, true); - if (item.healMana > 0) - player.ManaEffect(item.healMana); - } - if (item.potion) - { - int duration = reducedPotionSickness ? 3000 : 3600; - if (player.pStone) - duration = (int)(duration * 0.75); - player.AddBuff(BuffID.PotionSickness, duration); - } - - player.AddBuff(buffType, buffTime); - - --item.stack; - if (item.stack <= 0) - item.TurnToAir(); - Recipe.FindRecipes(); - } - } - #endregion - - #region Projectile Utilities - public static int CountProjectiles(int Type) => Main.projectile.Count(proj => proj.type == Type && proj.active); - - public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer); - - public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; - - public static void KillAllHostileProjectiles() - { - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) - { - projectile.Kill(); - } - } - } - - public static void KillShootProjectiles(bool shouldBreak, int projType, Player player) - { - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.owner == player.whoAmI && proj.type == projType) - { - proj.Kill(); - if (shouldBreak) - break; - } - } - } - - public static void KillShootProjectileMany(Player player, params int[] projTypes) - { - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.owner == player.whoAmI && projTypes.Contains(proj.type)) - { - proj.Kill(); - } - } - } - - public static int FindFirstProjectile(int Type) - { - int index = -1; - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile proj = Main.projectile[x]; - if (proj.active && proj.type == Type) - { - index = x; - break; - } - } - return index; - } - - /// - /// Call this function in the ai of your projectile so it can stick to enemies, also requires ModifyHitNPCSticky to be called in ModifyHitNPC - /// - /// The projectile you're adding sticky behaviour to - /// Number of seconds you want a projectile to cling to an NPC - public static void StickyProjAI (this Projectile projectile, int timeLeft) - { - if (projectile.ai[0] == 1f) - { - int seconds = timeLeft; - bool killProj = false; - bool spawnDust = false; - - //the projectile follows the NPC, even if it goes into blocks - projectile.tileCollide = false; - - //timer for triggering hit effects - projectile.localAI[0]++; - if (projectile.localAI[0] % 30f == 0f) - { - spawnDust = true; - } - - //So AI knows what NPC it is sticking to - int npcIndex = (int)projectile.ai[1]; - NPC npc = Main.npc[npcIndex]; - - //Kill projectile after so many seconds or if the NPC it is stuck to no longer exists - if (projectile.localAI[0] >= (float)(60 * seconds)) - { - killProj = true; - } - else if (npcIndex < 0 || npcIndex >= Main.maxNPCs) - { - killProj = true; - } - - else if (npc.active && !npc.dontTakeDamage) - { - //follow the NPC - projectile.Center = npc.Center - projectile.velocity * 2f; - projectile.gfxOffY = npc.gfxOffY; - - //if attached to npc, trigger npc hit effects every half a second - if (spawnDust) - { - npc.HitEffect(0, 1.0); - } - } - else - { - killProj = true; - } - - //Kill the projectile if needed - if (killProj) - { - projectile.Kill(); - } - } - } - - /// - /// Call this function in ModifyHitNPC to make your projectiles stick to enemies, needs StickyProjAI to be called in the AI of the projectile - /// - /// The projectile you're giving sticky behaviour to - /// How many projectiles of this type can stick to one enemy - /// Decides if you want the projectile to deal damage while its sticked to enemies or not - public static void ModifyHitNPCSticky(this Projectile projectile, int maxStick, bool constantDamage) - { - 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) - { - 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 && - ((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)) - { - bool stickingToNPC; - //Solar Crawltipede tail has special collision - if (npc.type == NPCID.SolarCrawltipedeTail) - { - Rectangle rect = npc.getRect(); - int num5 = 8; - rect.X -= num5; - rect.Y -= num5; - rect.Width += num5 * 2; - rect.Height += num5 * 2; - stickingToNPC = projectile.Colliding(myRect, rect); - } - else - { - stickingToNPC = projectile.Colliding(myRect, npc.getRect()); - } - if (stickingToNPC) - { - //reflect projectile if the npc can reflect it (like Selenians) - if (npc.reflectingProjectiles && projectile.CanReflect()) - { - 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] = (float)npcIndex; - - //follow the NPC - projectile.velocity = (npc.Center - projectile.Center) * 0.75f; - - projectile.netUpdate = true; - - //Set projectile damage to 0 if desired - if (!constantDamage) - projectile.damage = 0; - - //Count how many projectiles are attached, delete as necessary - Point[] array2 = new Point[maxStick]; - int projCount = 0; - 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) - { - array2[projCount++] = new Point(projIndex, proj.timeLeft); - if (projCount >= array2.Length) - { - break; - } - } - } - if (projCount >= array2.Length) - { - int num30 = 0; - for (int m = 1; m < array2.Length; m++) - { - if (array2[m].Y < array2[num30].Y) - { - num30 = m; - } - } - Main.projectile[array2[num30].X].Kill(); - } - } - } - } - } - } - } - - public static void StickToTiles(this Projectile projectile, bool ignorePlatforms, bool stickToEverything) - { - try - { - int xLeft = (int)(projectile.position.X / 16f) - 1; - int xRight = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; - int yBottom = (int)(projectile.position.Y / 16f) - 1; - int yTop = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; - if (xLeft < 0) - { - xLeft = 0; - } - if (xRight > Main.maxTilesX) - { - xRight = Main.maxTilesX; - } - if (yBottom < 0) - { - yBottom = 0; - } - if (yTop > Main.maxTilesY) - { - yTop = Main.maxTilesY; - } - for (int x = xLeft; x < xRight; x++) - { - for (int y = yBottom; y < yTop; y++) - { - Tile tile = Main.tile[x, y]; - bool platformCheck = true; - if (ignorePlatforms) - platformCheck = !TileID.Sets.Platforms[tile.type] && tile.type != 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)) - { - Vector2 tileSize; - tileSize.X = (float)(x * 16); - tileSize.Y = (float)(y * 16); - if (projectile.position.X + (float)projectile.width - 4f > tileSize.X && projectile.position.X + 4f < tileSize.X + 16f && projectile.position.Y + (float)projectile.height - 4f > tileSize.Y && projectile.position.Y + 4f < tileSize.Y + 16f) - { - projectile.velocity.X = 0f; - projectile.velocity.Y = -0.2f; - } - } - } - } - } catch - { - } - } - - public static Projectile ProjectileRain(Vector2 targetPos, float xLimit, float xVariance, float yLimitLower, float yLimitUpper, float projSpeed, int projType, int damage, float knockback, int owner, int forceType = 0, int immunitySetting = 0, int cooldown = 10) - { - float x = targetPos.X + Main.rand.NextFloat(-xLimit, xLimit); - if (projType == ModContent.ProjectileType()) - x = targetPos.X + xLimit; - float y = targetPos.Y - Main.rand.NextFloat(yLimitLower, yLimitUpper); - Vector2 source = new Vector2(x, y); - Vector2 velocity = targetPos - source; - velocity.X += Main.rand.NextFloat(-xVariance, xVariance); - float speed = projSpeed; - float targetDist = velocity.Length(); - targetDist = speed / targetDist; - velocity.X *= targetDist; - velocity.Y *= targetDist; - Projectile proj = Projectile.NewProjectileDirect(source, velocity, projType, damage, knockback, owner, 0f, 0f); - CalamityGlobalProjectile modProj = proj.Calamity(); - if (forceType > 0) - { - switch (forceType) - { - case 1: - modProj.forceMelee = true; - break; - case 2: - modProj.forceRanged = true; - break; - case 3: - modProj.forceMagic = true; - break; - case 4: - modProj.forceMinion = true; - break; - case 5: - modProj.forceRogue = true; - break; - case 6: - modProj.forceTypeless = true; - break; - } - } - if (immunitySetting > 0) - { - switch (forceType) - { - case 1: - proj.usesLocalNPCImmunity = true; - proj.localNPCHitCooldown = cooldown; - proj.usesIDStaticNPCImmunity = false; - break; - case 2: - proj.usesLocalNPCImmunity = false; - proj.idStaticNPCHitCooldown = cooldown; - proj.usesIDStaticNPCImmunity = true; - break; - } - } - return proj; - } - - public static Projectile ProjectileBarrage(Vector2 originVec, Vector2 targetPos, bool fromRight, float xOffsetMin, float xOffsetMax, float yOffsetMin, float yOffsetMax, float projSpeed, int projType, int damage, float knockback, int owner, bool clamped = false, float inaccuracyOffset = 5f) - { - float xPos = originVec.X + Main.rand.NextFloat(xOffsetMin, xOffsetMax) * fromRight.ToDirectionInt(); - float yPos = originVec.Y + Main.rand.NextFloat(yOffsetMin, yOffsetMax) * Main.rand.NextBool().ToDirectionInt(); - Vector2 spawnPosition = new Vector2(xPos, yPos); - Vector2 velocity = targetPos - spawnPosition; - velocity.X += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset); - velocity.Y += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset); - velocity.Normalize(); - velocity *= projSpeed * (clamped ? 150f : 1f); - //This clamp means the spawned projectiles only go at diagnals and are not accurate - if (clamped) - { - velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); - velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); - } - Projectile proj = Projectile.NewProjectileDirect(spawnPosition, velocity, projType, damage, knockback, owner); - return proj; - } - - public static int DamageSoftCap(double dmgInput, int cap) - { - int newDamage = (int)(dmgInput); - if (newDamage > cap) - { - newDamage = (int)((dmgInput - cap) * 0.1) + cap; - } - if (newDamage < 1) - newDamage = 1; - return newDamage; - } - - public static Vector2 RandomVelocity(float directionMult, float speedLowerLimit, float speedCap, float speedMult = 0.1f) - { - Vector2 velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); - //Rerolling to avoid dividing by zero - while (velocity.X == 0f && velocity.Y == 0f) - { - velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); - } - velocity.Normalize(); - velocity *= Main.rand.NextFloat(speedLowerLimit, speedCap) * speedMult; - return velocity; - } - - public static void SporeSacAI(this Projectile projectile) - { - Player player = Main.player[projectile.owner]; - - float scaleAmt = 1f - (float)projectile.alpha / 255f; - scaleAmt *= projectile.scale; - Lighting.AddLight(projectile.Center, 0.25f * scaleAmt, 0.025f * scaleAmt, 0.275f * scaleAmt); - - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] *= -1f; - } - if (projectile.localAI[0] >= 0f) - { - projectile.scale += 0.003f; - } - else - { - projectile.scale -= 0.003f; - } - projectile.rotation += 0.0025f * projectile.scale; - float yVel = 1f; - float xVel = 1f; - if (projectile.identity % 6 == 0) - { - xVel *= -1f; - } - if (projectile.identity % 6 == 1) - { - yVel *= -1f; - } - if (projectile.identity % 6 == 2) - { - xVel *= -1f; - yVel *= -1f; - } - if (projectile.identity % 6 == 3) - { - xVel = 0f; - } - if (projectile.identity % 6 == 4) - { - yVel = 0f; - } - projectile.localAI[1] += 1f; - if (projectile.localAI[1] > 60f) - { - projectile.localAI[1] = -180f; - } - if (projectile.localAI[1] >= -60f) - { - projectile.velocity.X += 0.002f * xVel; - projectile.velocity.Y += 0.002f * yVel; - } - else - { - projectile.velocity.X -= 0.002f * xVel; - projectile.velocity.Y -= 0.002f * yVel; - } - projectile.ai[0] += 1f; - if (projectile.ai[0] > 5400f) - { - projectile.damage = 0; - projectile.ai[1] = 1f; - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else - { - float playerDist = (projectile.Center - player.Center).Length() / 100f; - if (playerDist > 4f) - { - playerDist *= 1.1f; - } - if (playerDist > 5f) - { - playerDist *= 1.2f; - } - if (playerDist > 6f) - { - playerDist *= 1.3f; - } - if (playerDist > 7f) - { - playerDist *= 1.4f; - } - if (playerDist > 8f) - { - playerDist *= 1.5f; - } - if (playerDist > 9f) - { - playerDist *= 1.6f; - } - if (playerDist > 10f) - { - playerDist *= 1.7f; - } - projectile.ai[0] += playerDist; - if (projectile.alpha > 50) - { - projectile.alpha -= 10; - if (projectile.alpha < 50) - { - projectile.alpha = 50; - } - } - } - bool foundTarget = false; - Vector2 targetPos = new Vector2(0f, 0f); - float maxDist = 600f; - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC npc = Main.npc[i]; - if (npc.CanBeChasedBy(projectile, false)) - { - float targetDist = Vector2.Distance(projectile.Center, npc.Center); - if (targetDist < maxDist) - { - targetPos = npc.Center; - foundTarget = true; - break; - } - } - } - if (foundTarget) - { - Vector2 targetVec = targetPos - projectile.Center; - targetVec.Normalize(); - targetVec *= 0.75f; - projectile.velocity = (projectile.velocity * 10f + targetVec) / 11f; - return; - } - if (projectile.velocity.Length() > 0.2f) - { - projectile.velocity *= 0.98f; - } - } - - public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || 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 = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); - if (sameProjType && taxicabDist < projectile.width) - { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= pushForce; - else - projectile.velocity.X += pushForce; - - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= pushForce; - else - projectile.velocity.Y += pushForce; - } - } - } - - public static void ChargingMinionAI(this Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, Vector2 returnOffset, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging, int updateDifference = 1) - { - Player player = Main.player[projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - //Anti sticky movement to prevent stacking - projectile.MinionAntiClump(); - - //Breather time between charges as like a reset - bool chargeDelay = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = initialUpdates + updateDifference; - if (projectile.ai[1] > chargeDelayTime) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = initialUpdates; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - chargeDelay = true; - } - } - if (chargeDelay) - { - return; - } - - //Find a target - float maxDist = range; - Vector2 targetVec = projectile.position; - bool foundTarget = false; - bool isButterfly = projectile.type == ModContent.ProjectileType(); - //Prioritize the targeted enemy if possible - if (player.HasMinionAttackTargetNPC) - { - NPC npc = Main.npc[player.MinionAttackTargetNPC]; - bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; - if (npc.CanBeChasedBy(projectile, false) || fishronCheck) - { - //Check the size of the target to make it easier to hit fat targets like Levi - float extraDist = (npc.width / 2) + (npc.height / 2); - - 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 = true; - if (extraDist < maxDist && !tileVision) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) - { - maxDist = targetDist; - targetVec = npc.Center; - foundTarget = true; - } - } - } - //If no npc is specifically targetted or the selected enemy can't be found, check through the entire array - if (!foundTarget) - { - for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) - { - NPC npc = Main.npc[npcIndex]; - bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; - if (npc.CanBeChasedBy(projectile, false) || fishronCheck) - { - float extraDist = (npc.width / 2) + (npc.height / 2); - float targetDist = Vector2.Distance(npc.Center, projectile.Center); - bool canHit = true; - if (extraDist < maxDist && !tileVision) - canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); - if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) - { - maxDist = targetDist; - targetVec = npc.Center; - foundTarget = true; - } - } - } - } - - //If the player is too far, return to the player. Range is increased while attacking something. - float distBeforeForcedReturn = maxPlayerDist; - if (foundTarget) - { - distBeforeForcedReturn = extraMaxPlayerDist; - } - if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - - //Go to the target if you found one - if (foundTarget && projectile.ai[0] == 0f) - { - //Some minions don't ignore tiles while charging like brittle stars - projectile.tileCollide = !ignoreTilesWhenCharging; - Vector2 targetSpot = targetVec - projectile.Center; - float targetDist = targetSpot.Length(); - targetSpot.Normalize(); - //Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does - if (targetDist > 200f) - { - float speed = goToSpeed; //8 - targetSpot *= speed; - projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; - } - else - { - float speed = -goBackSpeed; //-4 - targetSpot *= speed; - projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41 - } - } - - //Movement for idle or returning to the player - else - { - //Ignore tiles so they don't get stuck everywhere like Optic Staff - projectile.tileCollide = false; - - bool returningToPlayer = false; - if (!returningToPlayer) - { - returningToPlayer = projectile.ai[0] == 1f; - } - - //Player distance calculations - Vector2 playerVec = player.Center - projectile.Center + returnOffset; - float playerDist = playerVec.Length(); - - //If the minion is actively returning, move faster - float playerHomeSpeed = 6f; - if (returningToPlayer) - { - playerHomeSpeed = 15f; - } - //Move somewhat faster if the player is kinda far~ish - if (playerDist > 200f && playerHomeSpeed < 8f) - { - playerHomeSpeed = 8f; - } - //Return to normal if close enough to the player - if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - //Teleport to the player if abnormally far - 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; - } - //If more than 70 pixels away, move toward the player - if (playerDist > 70f) - { - playerVec.Normalize(); - playerVec *= playerHomeSpeed; - projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; - } - //Minions never stay still - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.15f; - projectile.velocity.Y = -0.05f; - } - } - - //Increment attack counter randomly - if (projectile.ai[1] > 0f) - { - projectile.ai[1] += (float)Main.rand.Next(1, 4); - } - //If high enough, prepare to attack - if (projectile.ai[1] > chargeCounterMax) - { - projectile.ai[1] = 0f; - projectile.netUpdate = true; - } - - //Charge at an enemy if not on cooldown - if (projectile.ai[0] == 0f) - { - if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f) - { - projectile.ai[1] += 1f; - if (Main.myPlayer == projectile.owner) - { - projectile.ai[0] = 2f; - Vector2 targetPos = targetVec - projectile.Center; - targetPos.Normalize(); - projectile.velocity = targetPos * chargeSpeed; //8 - projectile.netUpdate = true; - } - } - } - } - - public static void FloatingPetAI(this Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) - { - Player player = Main.player[projectile.owner]; - - //anti sticking movement as a failsafe - float SAImovement = 0.05f; - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile otherProj = Main.projectile[k]; - // Short circuits to make the loop as fast as possible - if (!otherProj.active || otherProj.owner != projectile.owner || !Main.projPet[otherProj.type] || k == projectile.whoAmI) - continue; - - // If the other projectile is indeed another pet owned by the same player and they're too close, nudge them away. - bool isPet = Main.projPet[otherProj.type]; - float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); - if (isPet && taxicabDist < projectile.width) - { - if (projectile.position.X < otherProj.position.X) - projectile.velocity.X -= SAImovement; - else - projectile.velocity.X += SAImovement; - - if (projectile.position.Y < otherProj.position.Y) - projectile.velocity.Y -= SAImovement; - else - projectile.velocity.Y += SAImovement; - } - } - - float passiveMvtFloat = 0.5f; - projectile.tileCollide = false; - float range = 100f; - 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(-10, 20); - xDist += Main.rand.NextFloat(-10, 20); - //Light pets lead the player, normal pets trail the player - xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction); - yDist -= 60f; - Vector2 playerVector = new Vector2(xDist, yDist); - float playerDist = playerVector.Length(); - float returnSpeed = 18f; - - //If player is close enough, resume normal - 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 (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; - } - - if (playerDist < 50f) - { - if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) - { - projectile.velocity *= 0.99f; - } - passiveMvtFloat = 0.01f; - } - else - { - if (playerDist < 100f) - { - passiveMvtFloat = 0.1f; - } - if (playerDist > 300f) - { - passiveMvtFloat = 1f; - } - playerDist = returnSpeed / playerDist; - playerVector.X *= playerDist; - playerVector.Y *= playerDist; - } - if (projectile.velocity.X < playerVector.X) - { - projectile.velocity.X += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) - { - projectile.velocity.X += passiveMvtFloat; - } - } - if (projectile.velocity.X > playerVector.X) - { - projectile.velocity.X -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) - { - projectile.velocity.X -= passiveMvtFloat; - } - } - if (projectile.velocity.Y < playerVector.Y) - { - projectile.velocity.Y += passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) - { - projectile.velocity.Y += passiveMvtFloat * 2f; - } - } - if (projectile.velocity.Y > playerVector.Y) - { - projectile.velocity.Y -= passiveMvtFloat; - if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) - { - projectile.velocity.Y -= passiveMvtFloat * 2f; - } - } - if (projectile.velocity.X >= 0.25f) - { - projectile.direction = faceRight ? 1 : -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.direction = faceRight ? -1 : 1; - } - //Tilting and change directions - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * tiltFloat; - } - - public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float N, bool autoHomes = true, int timeCheck = 120) - { - int target = playerToHeal; - Player player = Main.player[target]; - float homingSpeed = homingVelocity; - if (player.lifeMagnet) - homingSpeed *= 1.5f; - - Vector2 playerVector = player.Center - projectile.Center; - float playerDist = playerVector.Length(); - if (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.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) - { - int healAmt = healing; - player.HealEffect(healAmt, false); - player.statLife += healAmt; - if (player.statLife > player.statLifeMax2) - { - player.statLife = player.statLifeMax2; - } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); - } - projectile.Kill(); - } - if (autoHomes) - { - playerDist = homingSpeed / 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); - } - else if (player.lifeMagnet && projectile.timeLeft < timeCheck) - { - playerDist = homingVelocity / 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); - } - } - - public static void ExplodeandDestroyTiles(Projectile projectile, int explosionRadius, bool checkExplosions, List tilesToCheck, List wallsToCheck) - { - int minTileX = (int)projectile.position.X / 16 - explosionRadius; - int maxTileX = (int)projectile.position.X / 16 + explosionRadius; - int minTileY = (int)projectile.position.Y / 16 - explosionRadius; - int maxTileY = (int)projectile.position.Y / 16 + explosionRadius; - if (minTileX < 0) - { - minTileX = 0; - } - if (maxTileX > Main.maxTilesX) - { - maxTileX = Main.maxTilesX; - } - if (minTileY < 0) - { - minTileY = 0; - } - if (maxTileY > Main.maxTilesY) - { - maxTileY = Main.maxTilesY; - } - - bool canKillWalls = false; - for (int x = minTileX; x <= maxTileX; x++) - { - for (int y = minTileY; y <= maxTileY; y++) - { - 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) - { - canKillWalls = true; - break; - } - } - } - - List tileExcludeList = new List() - { - TileID.DemonAltar, - TileID.ElderCrystalStand - }; - for (int i = 0; i < tilesToCheck.Count; ++i) - tileExcludeList.Add(tilesToCheck[i]); - List wallExcludeList = new List(); - for (int i = 0; i < wallsToCheck.Count; ++i) - wallExcludeList.Add(wallsToCheck[i]); - - List explosionCheckList = new List() - { - TileID.DemonAltar, - TileID.Cobalt, - TileID.Mythril, - TileID.Adamantite, - TileID.Palladium, - TileID.Orichalcum, - TileID.Titanium, - TileID.Chlorophyte, - TileID.LihzahrdBrick, - TileID.LihzahrdAltar, - TileID.DesertFossil - }; - CalamityUtils.AddWithCondition(explosionCheckList, TileID.Hellstone, !Main.hardMode); - - for (int i = minTileX; i <= maxTileX; i++) - { - for (int j = minTileY; j <= maxTileY; j++) - { - Tile tile = Main.tile[i, j]; - bool t = 1 == 1; bool f = 1 == 2; - - Vector2 explodeArea = new Vector2(Math.Abs(i - projectile.position.X / 16f), Math.Abs(j - projectile.position.Y / 16f)); - float distance = explodeArea.Length(); - if (distance < explosionRadius) - { - bool canKillTile = true; - if (tile != null && tile.active()) - { - if (checkExplosions) - { - if (Main.tileDungeon[tile.type] || explosionCheckList.Contains(tile.type)) - { - canKillTile = false; - } - if (!TileLoader.CanExplode(i, j)) - { - canKillTile = false; - } - } - if (Main.tileContainer[tile.type]) - canKillTile = false; - if (!TileLoader.CanKillTile(i, j, tile.type, ref t) || !TileLoader.CanKillTile(i, j, tile.type, ref f)) - canKillTile = false; - if (tileExcludeList.Contains(tile.type)) - canKillTile = false; - - if (canKillTile) - { - WorldGen.KillTile(i, j, false, false, false); - if (!tile.active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, i, j, 0f, 0, 0, 0); - } - } - } - if (canKillTile) - { - for (int x = i - 1; x <= i + 1; x++) - { - for (int y = j - 1; y <= j + 1; y++) - { - 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)) - canKillWalls = false; - if (Main.tile[x, y] != null && Main.tile[x, y].wall > WallID.None && canKillWalls && canExplode) - { - WorldGen.KillWall(x, y, false); - if (Main.tile[x, y].wall == WallID.None && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 2, x, y, 0f, 0, 0, 0); - } - } - } - } - } - } - } - } - } - #endregion - - #region Tile Utilities - public static void SafeSquareTileFrame(int x, int y, bool resetFrame = true) - { - if (Main.tile[x, y] is null) - return; - - for (int xIter = x - 1; xIter <= x + 1; ++xIter) - { - if (xIter < 0 || xIter >= Main.maxTilesX) - continue; - for (int yIter = y - 1; yIter <= y + 1; yIter++) - { - if (yIter < 0 || yIter >= Main.maxTilesY) - continue; - if (xIter == x && yIter == y) - { - WorldGen.TileFrame(x, y, resetFrame, false); - } - else - { - WorldGen.TileFrame(xIter, yIter, false, false); - } - } - } - } - - 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; - for (int l = x; l < x + tileX; l++) - { - for (int m = y; m < y + tileY; m++) - { - if (Main.tile[l, m] == null) - { - Main.tile[l, m] = new Tile(); - } - if (Main.tile[l, m].active() && Main.tile[l, m].type == type) - { - if (Main.tile[l, m].frameX < (18 * tileX)) - { - Main.tile[l, m].frameX += (short)(18 * tileX); - } - else - { - Main.tile[l, m].frameX -= (short)(18 * tileX); - } - } - } - } - if (Wiring.running) - { - for (int k = 0; k < tileX; k++) - { - for (int l = 0; l < tileY; l++) - { - Wiring.SkipWire(x + k, y + l); - } - } - } - } - - public static void DrawFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) - { - Tile tile = Main.tile[i, j]; - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - - int width = 16; - int height = 16; - int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; - - ulong num190 = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)(uint)i); - - for (int c = 0; c < 7; c++) - { - 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); - } - } - - 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; - 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; - for (int x = -1; x < 2; x++) - { - for (int y = -1; y < 2; y++) - { - Vector2 flameOffset = new Vector2(x, y).SafeNormalize(Vector2.Zero); - flameOffset *= 1.5f; - Main.spriteBatch.Draw(flameTexture, drawOffset + flameOffset, new Rectangle?(new Rectangle(xPos + offsetX, yPos + offsetY, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - } - } - - public static void DrawFlameSparks(int dustType, int rarity, int i, int j) - { - Tile tile = Main.tile[i, j]; - if (!Main.gamePaused && Main.instance.IsActive && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4))) - { - if (Main.rand.NextBool(rarity)) - { - int dust = Dust.NewDust(new Vector2(i * 16 + 4, j * 16 + 2), 4, 4, dustType, 0f, 0f, 100, default(Color), 1f); - if (Main.rand.Next(3) != 0) - { - Main.dust[dust].noGravity = true; - } - Main.dust[dust].velocity *= 0.3f; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1.5f; - } - } - } - - public static void DrawItemFlame(Texture2D flameTexture, Item item) - { - int width = flameTexture.Width; - int height = flameTexture.Height; - for (int c = 0; c < 7; c++) - { - float shakeX = Main.rand.Next(-10, 11) * 0.15f; - float shakeY = Main.rand.Next(-10, 1) * 0.35f; - Main.spriteBatch.Draw(flameTexture, new Vector2(item.position.X - Main.screenPosition.X + item.width * 0.5f + shakeX, item.position.Y - Main.screenPosition.Y + item.height - flameTexture.Height * 0.5f + 2f + shakeY), new Rectangle(0, 0, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); - } - } - public static Tile ParanoidTileRetrieval(int x, int y) - { - if (!WorldGen.InWorld(x, y)) - return new Tile(); - Tile tile = Main.tile[x, y]; - if (tile is null) - { - tile = new Tile(); - Main.tile[x, y] = tile; - } - return tile; - } - public static bool TileSelectionSolid(int x, int y, int width, int height) - { - for (int i = x; i != x + width; i += Math.Sign(width)) - { - for (int j = y; y != y + height; j += Math.Sign(height)) - { - if (!WorldGen.InWorld(i, j)) - return false; - if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) - return false; - } - } - return true; - } - public static bool TileSelectionSolidSquare(int x, int y, int width, int height) - { - for (int i = x - width; i != x + width; i += Math.Sign(width)) - { - for (int j = y - height; y != y + height; j += Math.Sign(height)) - { - if (!WorldGen.InWorld(i, j)) - return false; - if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) - return false; - } - } - return true; - } - public static bool TileActiveAndOfType(int x, int y, int type) - { - return ParanoidTileRetrieval(x, y).active() && ParanoidTileRetrieval(x, y).type == type; - } - - #region Tile Merge Utilities - /// - /// Sets the mergeability state of two tiles. By default, enables tile merging. - /// - /// The first tile type which should merge (or not). - /// The second tile type which should merge (or not). - /// The mergeability state of the tiles. Defaults to true if omitted. - public static void SetMerge(int type1, int type2, bool merge = true) - { - if (type1 != type2) - { - Main.tileMerge[type1][type2] = merge; - Main.tileMerge[type2][type1] = merge; - } - } - - /// - /// Makes the first tile type argument merge with all the other tile type arguments. Also accepts arrays. - /// - /// The tile whose merging properties will be set. - /// Every tile that should be merged with. - public static void MergeWithSet(int myType, params int[] otherTypes) - { - for (int i = 0; i < otherTypes.Length; ++i) - SetMerge(myType, otherTypes[i]); - } - - /// - /// Makes the specified tile merge with the most common types of tiles found in world generation.

- /// Notably excludes Ice. - ///
- /// The tile whose merging properties will be set. - public static void MergeWithGeneral(int type) => MergeWithSet(type, new int[] { - // Soils - TileID.Dirt, - TileID.Mud, - TileID.ClayBlock, - // Stones - TileID.Stone, - TileID.Ebonstone, - TileID.Crimstone, - TileID.Pearlstone, - // Sands - TileID.Sand, - TileID.Ebonsand, - TileID.Crimsand, - TileID.Pearlsand, - // Snows - TileID.SnowBlock, - // Calamity Tiles - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - }); - - /// - /// Makes the specified tile merge with all ores, vanilla and Calamity. Particularly useful for stone blocks. - /// - /// The tile whose merging properties will be set. - public static void MergeWithOres(int type) => MergeWithSet(type, new int[] { - // Vanilla Ores - TileID.Copper, - TileID.Tin, - TileID.Iron, - TileID.Lead, - TileID.Silver, - TileID.Tungsten, - TileID.Gold, - TileID.Platinum, - TileID.Demonite, - TileID.Crimtane, - TileID.Cobalt, - TileID.Palladium, - TileID.Mythril, - TileID.Orichalcum, - TileID.Adamantite, - TileID.Titanium, - TileID.LunarOre, - // Calamity Ores - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - }); - - /// - /// Makes the specified tile merge with all types of desert tiles, including the Calamity Sunken Sea. - /// - /// The tile whose merging properties will be set. - public static void MergeWithDesert(int type) => MergeWithSet(type, new int[] { - // Sands - TileID.Sand, - TileID.Ebonsand, - TileID.Crimsand, - TileID.Pearlsand, - // Hardened Sands - TileID.HardenedSand, - TileID.CorruptHardenedSand, - TileID.CrimsonHardenedSand, - TileID.HallowHardenedSand, - // Sandstones - TileID.Sandstone, - TileID.CorruptSandstone, - TileID.CrimsonSandstone, - TileID.HallowSandstone, - // Miscellaneous Desert Tiles - TileID.FossilOre, - TileID.DesertFossil, - // Astral Desert - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - // Sunken Sea - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - }); - - /// - /// Makes the specified tile merge with all types of snow and ice tiles. - /// - /// The tile whose merging properties will be set. - public static void MergeWithSnow(int type) => MergeWithSet(type, new int[] { - // Snows - TileID.SnowBlock, - // Ices - TileID.IceBlock, - TileID.CorruptIce, - TileID.FleshIce, - TileID.HallowedIce, - // Astral Snow - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - }); - - /// - /// Makes the specified tile merge with all tiles which generate in hell. Does not include Charred Ore. - /// - /// The tile whose merging properties will be set. - public static void MergeWithHell(int type) => MergeWithSet(type, new int[] { - TileID.Ash, - TileID.Hellstone, - TileID.ObsidianBrick, - TileID.HellstoneBrick, - ModContent.TileType(), - }); - - /// - /// Makes the specified tile merge with all tiles which generate in the Abyss or the Sulphurous Sea. Includes Chaotic Ore. - /// - /// The tile whose merging properties will be set. - public static void MergeWithAbyss(int type) => MergeWithSet(type, new int[] { - // Sulphurous Sea - ModContent.TileType(), - ModContent.TileType(), - // Abyss - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - }); - - /// - /// Makes the tile merge with all the tile types that generate within various types of astral tiles - /// - /// - public static void MergeAstralTiles(int type) - { - //Astral - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - //Astral Desert - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - //Astral Snow - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - } - - /// - /// Makes the tile merge with all the decorative 'smooth' tiles - /// - /// - public static void MergeSmoothTiles(int type) - { - //Vanilla - SetMerge(type, TileID.MarbleBlock); - SetMerge(type, TileID.GraniteBlock); - //Calam - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - } - - /// - /// Makes the tile merge with other mergable decorative tiles - /// - /// - public static void MergeDecorativeTiles(int type) - { - //Vanilla decor - Main.tileBrick[type] = true; - //Calam - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - SetMerge(type, ModContent.TileType()); - } - #endregion - - #region Furniture Interaction - public static void RightClickBreak(int i, int j) - { - if (Main.tile[i, j] != null && Main.tile[i, j].active()) - { - WorldGen.KillTile(i, j, false, false, false); - if (!Main.tile[i, j].active() && Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); - } - } - } - - public static bool BedRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int spawnX = i - tile.frameX / 18; - int spawnY = j + 2; - spawnX += tile.frameX >= 72 ? 5 : 2; - if (tile.frameY % 38 != 0) - { - spawnY--; - } - player.FindSpawn(); - if (player.SpawnX == spawnX && player.SpawnY == spawnY) - { - player.RemoveSpawn(); - Main.NewText("Spawn point removed!", 255, 240, 20, false); - } - else if (Player.CheckSpawn(spawnX, spawnY)) - { - player.ChangeSpawn(spawnX, spawnY); - Main.NewText("Spawn point set!", 255, 240, 20, false); - } - return true; - } - - public static bool ChestRightClick(int i, int j) - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - Main.mouseRightRelease = false; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - if (player.editedChestName) - { - NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - if (chest == player.chest) - { - player.chest = -1; - Main.PlaySound(SoundID.MenuClose); - } - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - Recipe.FindRecipes(); - } - } - return true; - } - - public static void ChestMouseOver(string chestName, int i, int j) where T : ModItem - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; - if (player.showItemIconText == chestName) - { - player.showItemIcon2 = ModContent.ItemType(); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } - - public static void ChestMouseFar(string name, int i, int j) where T : ModItem - { - ChestMouseOver(name, i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public static bool ClockRightClick() - { - string text = "AM"; - - // Get Terraria's current strange time variable - double time = Main.time; - - // Correct for night time (which for some reason isn't just a different number) by adding 54000. - if (!Main.dayTime) - time += 54000D; - - // Divide by seconds in an hour - time /= 3600D; - - // Terraria night starts at 7:30 PM, so offset accordingly - time -= 19.5; - - // Offset time to ensure it is not negative, then change to PM if necessary - if (time < 0D) - time += 24D; - if (time >= 12D) - text = "PM"; - - // Get the decimal (smaller than hours, so minutes) component of time. - int intTime = (int)time; - double deltaTime = time - intTime; - - // Convert decimal time into an exact number of minutes. - deltaTime = (int)(deltaTime * 60D); - - string minuteText = deltaTime.ToString(); - - // Ensure minutes has a leading zero - if (deltaTime < 10D) - minuteText = "0" + minuteText; - - // Convert from 24 to 12 hour time (PM already handled earlier) - if (intTime > 12) - intTime -= 12; - // 12 AM is actually hour zero in 24 hour time - if (intTime == 0) - intTime = 12; - - // Create an overall time readout and send it to chat - var newText = string.Concat("Time: ", intTime, ":", minuteText, " ", text); - Main.NewText(newText, 255, 240, 20); - return true; - } - - public static bool DresserRightClick() - { - Player player = Main.LocalPlayer; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) - { - Main.CancelClothesWindow(true); - - int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); - left %= 3; - left = Player.tileTargetX - left; - int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); - if (player.sign > -1) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = string.Empty; - } - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = string.Empty; - } - if (player.editedChestName) - { - NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient) - { - if (left == player.chestX && top == player.chestY && player.chest != -1) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else - { - NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - return true; - } - else - { - player.flyingPigChest = -1; - int num213 = Chest.FindChest(left, top); - if (num213 != -1) - { - Main.stackSplit = 600; - if (num213 == player.chest) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - else if (num213 != player.chest && player.chest == -1) - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuOpen); - player.chestX = left; - player.chestY = top; - } - else - { - player.chest = num213; - Main.playerInventory = true; - Main.recBigList = false; - Main.PlaySound(SoundID.MenuTick); - player.chestX = left; - player.chestY = top; - } - Recipe.FindRecipes(); - return true; - } - } - } - else - { - Main.playerInventory = false; - player.chest = -1; - Recipe.FindRecipes(); - Main.dresserX = Player.tileTargetX; - Main.dresserY = Player.tileTargetY; - Main.OpenClothesWindow(); - return true; - } - - return false; - } - - public static void DresserMouseFar(string chestName) where T : ModItem - { - Player player = Main.LocalPlayer; - 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) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chestName; - } - if (player.showItemIconText == chestName) - { - player.showItemIcon2 = ModContent.ItemType(); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - - public static void DresserMouseOver(string chestName) where T : ModItem - { - Player player = Main.LocalPlayer; - 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) - { - top--; - } - int chestIndex = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chestIndex < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); - } - else - { - if (Main.chest[chestIndex].name != "") - { - player.showItemIconText = Main.chest[chestIndex].name; - } - else - { - player.showItemIconText = chestName; - } - if (player.showItemIconText == chestName) - { - player.showItemIcon2 = ModContent.ItemType(); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) - { - player.showItemIcon2 = ItemID.FamiliarShirt; - } - } - - public static bool LockedChestRightClick(bool isLocked, int left, int top, int i, int j) - { - Player player = Main.LocalPlayer; - - // If the player right clicked the chest while editing a sign, finish that up - if (player.sign >= 0) - { - Main.PlaySound(SoundID.MenuClose); - player.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - - // If the player right clicked the chest while editing a chest, finish that up - if (Main.editChest) - { - Main.PlaySound(SoundID.MenuTick); - Main.editChest = false; - Main.npcChatText = ""; - } - - // If the player right clicked the chest after changing another chest's name, finish that up - if (player.editedChestName) - { - NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); - player.editedChestName = false; - } - if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) - { - // Right clicking the chest you currently have open closes it. This counts as interaction. - if (left == player.chestX && top == player.chestY && player.chest >= 0) - { - player.chest = -1; - Recipe.FindRecipes(); - Main.PlaySound(SoundID.MenuClose); - } - - // Right clicking this chest opens it if it's not already open. This counts as interaction. - else - { - NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); - Main.stackSplit = 600; - } - return true; - } - - else - { - if (isLocked) - { - // If you right click the locked chest and you can unlock it, it unlocks itself but does not open. This counts as interaction. - if (Chest.Unlock(left, top)) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); - } - return true; - } - } - else - { - int chest = Chest.FindChest(left, top); - if (chest >= 0) - { - Main.stackSplit = 600; - - // If you right click the same chest you already have open, it closes. This counts as interaction. - if (chest == player.chest) - { - player.chest = -1; - Main.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. - else - { - player.chest = chest; - Main.playerInventory = true; - Main.recBigList = false; - player.chestX = left; - player.chestY = top; - Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); - } - - Recipe.FindRecipes(); - return true; - } - } - } - - // This only occurs when the chest is locked and cannot be unlocked. You did not interact with the chest. - return false; - } - - public static void LockedChestMouseOver(string chestName, int i, int j) - where K : ModItem where C : ModItem - { - Player player = Main.LocalPlayer; - Tile tile = Main.tile[i, j]; - int left = i; - int top = j; - if (tile.frameX % 36 != 0) - { - left--; - } - if (tile.frameY != 0) - { - top--; - } - int chest = Chest.FindChest(left, top); - player.showItemIcon2 = -1; - if (chest < 0) - { - player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); - } - else - { - player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; - if (player.showItemIconText == chestName) - { - player.showItemIcon2 = ModContent.ItemType(); - if (Main.tile[left, top].frameX / 36 == 1) - player.showItemIcon2 = ModContent.ItemType(); - player.showItemIconText = ""; - } - } - player.noThrow = 2; - player.showItemIcon = true; - } - - public static void LockedChestMouseOverFar(string chestName, int i, int j) - where K : ModItem where C : ModItem - { - LockedChestMouseOver(chestName, i, j); - Player player = Main.LocalPlayer; - if (player.showItemIconText == "") - { - player.showItemIcon = false; - player.showItemIcon2 = 0; - } - } - #endregion - - #region Furniture SetDefaults - /// - /// Extension which initializes a ModTile to be a bathtub. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpBathtub(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(mt.Type); - - // All bathtubs count as tables. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - } - - /// - /// Extension which initializes a ModTile to be a bed. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpBed(this ModTile mt, bool lavaImmune = false) - { - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileID.Sets.HasOutlines[mt.Type] = true; - TileObjectData.newTile.Width = 4; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(mt.Type); - - // All beds count as chairs. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - } - - /// - /// Extension which initializes a ModTile to be a bookcase. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - /// Whether this tile is supposed to have a solid top. Defaults to true. - internal static void SetUpBookcase(this ModTile mt, bool lavaImmune = false, bool solidTop = true) - { - Main.tileSolidTop[mt.Type] = solidTop; - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileTable[mt.Type] = solidTop; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All bookcases count as tables. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - } - - /// - /// Extension which initializes a ModTile to be a candelabra. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpCandelabra(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = true; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All candelabras count as light sources. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - } - - /// - /// Extension which initializes a ModTile to be a candle. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpCandle(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); - TileObjectData.newTile.CoordinateHeights = new int[] { 20 }; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newTile.DrawYOffset = -4; - TileObjectData.addTile(mt.Type); - - // All candles count as light sources. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - } - - /// - /// Extension which initializes a ModTile to be a chair. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpChair(this ModTile mt, bool lavaImmune = false) - { - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); - TileObjectData.addTile(mt.Type); - - // As you could probably guess, all chairs count as chairs. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - } - - /// - /// Extension which initializes a ModTile to be a chandelier. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpChandelier(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All chandeliers count as light sources. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - } - - /// - /// Extension which initializes a ModTile to be a chest. - /// - /// The ModTile which is being initialized. - internal static void SetUpChest(this ModTile mt, bool offset = false) - { - Main.tileSpelunker[mt.Type] = true; - Main.tileContainer[mt.Type] = true; - Main.tileShine2[mt.Type] = true; - Main.tileShine[mt.Type] = 1200; - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileValue[mt.Type] = 500; - TileID.Sets.HasOutlines[mt.Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - if (offset) - TileObjectData.newTile.DrawYOffset = 4; - TileObjectData.newTile.Origin = new Point16(0, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(mt.Type); - } - - /// - /// Extension which initializes a ModTile to be a clock. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpClock(this ModTile mt, bool lavaImmune = false) - { - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - TileID.Sets.HasOutlines[mt.Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); - TileObjectData.newTile.Height = 5; - TileObjectData.newTile.CoordinateHeights = new int[] - { - 16, - 16, - 16, - 16, - 16 - }; - TileObjectData.newTile.Origin = new Point16(0, 4); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - } - - /// - /// Extension which initializes a ModTile to be a closed door. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpDoorClosed(this ModTile mt, bool lavaImmune = false) - { - Main.tileFrameImportant[mt.Type] = true; - Main.tileBlockLight[mt.Type] = true; - Main.tileSolid[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileID.Sets.NotReallySolid[mt.Type] = true; - TileID.Sets.DrawsWalls[mt.Type] = true; - TileID.Sets.HasOutlines[mt.Type] = true; - TileObjectData.newTile.Width = 1; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.addTile(mt.Type); - - // As you could probably guess, all closed doors count as doors. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - } - - /// - /// Extension which initializes a ModTile to be an open door. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpDoorOpen(this ModTile mt, bool lavaImmune = false) - { - Main.tileFrameImportant[mt.Type] = true; - Main.tileSolid[mt.Type] = false; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - Main.tileNoSunLight[mt.Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(0, 0); - TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.LavaDeath = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.StyleWrapLimit = 2; - TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 1); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(0, 2); - TileObjectData.addAlternate(0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 0); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 1); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.Origin = new Point16(1, 2); - TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; - TileObjectData.addAlternate(1); - TileObjectData.addTile(mt.Type); - TileID.Sets.HousingWalls[mt.Type] = true; - TileID.Sets.HasOutlines[mt.Type] = true; - - // As you could probably guess, all open doors count as doors. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - } - - /// - /// Extension which initializes a ModTile to be a dresser. - /// - /// The ModTile which is being initialized. - internal static void SetUpDresser(this ModTile mt) - { - Main.tileSolidTop[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileTable[mt.Type] = true; - Main.tileContainer[mt.Type] = true; - Main.tileWaterDeath[mt.Type] = false; - Main.tileLavaDeath[mt.Type] = false; - TileID.Sets.HasOutlines[mt.Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.Origin = new Point16(1, 1); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); - TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); - TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.addTile(mt.Type); - - // All dressers count as tables. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - } - - /// - /// Extension which initializes a ModTile to be a floor lamp. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpLamp(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All floor lamps count as light sources. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - } - - /// - /// Extension which initializes a ModTile to be a hanging lantern. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpLantern(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All hanging lanterns count as light sources. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - } - - /// - /// Extension which initializes a ModTile to be a piano. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpPiano(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.addTile(mt.Type); - - // All pianos count as tables. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - } - - /// - /// Extension which initializes a ModTile to be a platform. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpPlatform(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileSolidTop[mt.Type] = true; - Main.tileSolid[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileTable[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - TileID.Sets.Platforms[mt.Type] = true; - TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.StyleHorizontal = true; - TileObjectData.newTile.StyleMultiplier = 27; - TileObjectData.newTile.StyleWrapLimit = 27; - TileObjectData.newTile.UsesCustomCanPlace = false; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All platforms count as doors (so that you may have top-or-bottom entry/exit rooms) - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); - } - - /// - /// Extension which initializes a ModTile to be a sink. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpSink(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - } - - /// - /// Extension which initializes a ModTile to be a sofa. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpSofa(this ModTile mt, bool lavaImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All sofas count as chairs. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); - } - - /// - /// Extension which initializes a ModTile to be a table. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpTable(this ModTile mt, bool lavaImmune = false) - { - Main.tileSolidTop[mt.Type] = true; - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileTable[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - - TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // As you could probably guess, all tables count as tables. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - } - - /// - /// Extension which initializes a ModTile to be a torch. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpTorch(this ModTile mt, bool lavaImmune = false, bool waterImmune = false) - { - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileSolid[mt.Type] = false; - Main.tileNoAttach[mt.Type] = true; - Main.tileNoFail[mt.Type] = true; - Main.tileWaterDeath[mt.Type] = !waterImmune; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newTile.WaterDeath = !waterImmune; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newAlternate.WaterDeath = false; - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); - TileObjectData.newAlternate.AnchorAlternateTiles = new int[] { 124 }; - TileObjectData.addAlternate(1); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newAlternate.WaterDeath = false; - TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); - TileObjectData.newAlternate.AnchorAlternateTiles = new int[] { 124 }; - TileObjectData.addAlternate(2); - TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); - TileObjectData.newAlternate.WaterDeath = false; - TileObjectData.newAlternate.AnchorWall = true; - TileObjectData.addAlternate(0); - TileObjectData.addTile(mt.Type); - - // All torches count as light sources. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - } - - /// - /// Extension which initializes a ModTile to be a work bench. - /// - /// The ModTile which is being initialized. - /// Whether this tile is supposed to be immune to lava. Defaults to false. - internal static void SetUpWorkBench(this ModTile mt, bool lavaImmune = false) - { - Main.tileSolidTop[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileNoAttach[mt.Type] = true; - Main.tileTable[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = !lavaImmune; - Main.tileWaterDeath[mt.Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); - TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; - TileObjectData.newTile.LavaDeath = !lavaImmune; - TileObjectData.addTile(mt.Type); - - // All work benches count as tables. - mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); - } - - /// - /// Extension which initializes a ModTile to be a fountain. - /// - /// The ModTile which is being initialized. - internal static void SetUpFountain(this ModTile mt) - { - //All fountains are immune to lava - Main.tileLighted[mt.Type] = true; - Main.tileFrameImportant[mt.Type] = true; - Main.tileLavaDeath[mt.Type] = false; - Main.tileWaterDeath[mt.Type] = false; - //TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); - //TileObjectData.newTile.Width = 2; - TileObjectData.newTile.LavaDeath = false; - TileObjectData.addTile(mt.Type); - TileID.Sets.HasOutlines[mt.Type] = true; - - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.Origin = new Point16(0, 3); - TileObjectData.newTile.UsesCustomCanPlace = true; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); - TileObjectData.addTile(mt.Type); - } - #endregion - #endregion - - #region Drawing Utilities - public static void DrawItemGlowmask(this Item item, SpriteBatch spriteBatch, int frameCount, float rotation, Texture2D glowmaskTexture) - { - Vector2 center = new Vector2((float)(Main.itemTexture[item.type].Width / 2), (float)(Main.itemTexture[item.type].Height / frameCount / 2)); - Rectangle frame = Main.itemAnimations[item.type].GetFrame(glowmaskTexture); - Vector2 drawPosition = item.Center - Main.screenPosition; - - spriteBatch.Draw(glowmaskTexture, drawPosition, - new Rectangle?(frame), Color.White, rotation, center, 1f, SpriteEffects.None, 0f); - } - - public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) - { - Player player = Main.player[projectile.owner]; - Item item = Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; - if (projectile.bobber && item.holdStyle > 0) - { - float pPosX = player.MountedCenter.X; - float pPosY = player.MountedCenter.Y; - pPosY += player.gfxOffY; - int type = item.type; - float gravDir = player.gravDir; - - if (type == fishingRodType) - { - pPosX += (float)(xPositionAdditive * player.direction); - if (player.direction < 0) - { - pPosX -= 13f; - } - pPosY -= yPositionAdditive * gravDir; - } - - if (gravDir == -1f) - { - pPosY -= 12f; - } - Vector2 mountedCenter = new Vector2(pPosX, pPosY); - mountedCenter = player.RotatedRelativePoint(mountedCenter + new Vector2(8f), true) - new Vector2(8f); - float projPosX = projectile.position.X + (float)projectile.width * 0.5f - mountedCenter.X; - float projPosY = projectile.position.Y + (float)projectile.height * 0.5f - mountedCenter.Y; - Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); - bool canDraw = true; - if (projPosX == 0f && projPosY == 0f) - { - canDraw = false; - } - else - { - float projPosXY = (float)Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); - projPosXY = 12f / projPosXY; - projPosX *= projPosXY; - projPosY *= projPosXY; - mountedCenter.X -= projPosX; - mountedCenter.Y -= projPosY; - projPosX = projectile.position.X + (float)projectile.width * 0.5f - mountedCenter.X; - projPosY = projectile.position.Y + (float)projectile.height * 0.5f - mountedCenter.Y; - } - while (canDraw) - { - float height = 12f; - float positionMagnitude = (float)Math.Sqrt((double)(projPosX * projPosX + projPosY * projPosY)); - if (float.IsNaN(positionMagnitude) || float.IsNaN(positionMagnitude)) - { - canDraw = false; - } - else - { - if (positionMagnitude < 20f) - { - height = positionMagnitude - 8f; - canDraw = false; - } - positionMagnitude = 12f / positionMagnitude; - projPosX *= positionMagnitude; - projPosY *= positionMagnitude; - mountedCenter.X += projPosX; - mountedCenter.Y += projPosY; - projPosX = projectile.position.X + (float)projectile.width * 0.5f - mountedCenter.X; - projPosY = projectile.position.Y + (float)projectile.height * 0.1f - mountedCenter.Y; - if (positionMagnitude > 12f) - { - float positionInverseMultiplier = 0.3f; - float absVelocitySum = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); - if (absVelocitySum > 16f) - { - absVelocitySum = 16f; - } - absVelocitySum = 1f - absVelocitySum / 16f; - positionInverseMultiplier *= absVelocitySum; - absVelocitySum = positionMagnitude / 80f; - if (absVelocitySum > 1f) - { - absVelocitySum = 1f; - } - positionInverseMultiplier *= absVelocitySum; - if (positionInverseMultiplier < 0f) - { - positionInverseMultiplier = 0f; - } - absVelocitySum = 1f - projectile.localAI[0] / 100f; - positionInverseMultiplier *= absVelocitySum; - if (projPosY > 0f) - { - projPosY *= 1f + positionInverseMultiplier; - projPosX *= 1f - positionInverseMultiplier; - } - else - { - absVelocitySum = Math.Abs(projectile.velocity.X) / 3f; - if (absVelocitySum > 1f) - { - absVelocitySum = 1f; - } - absVelocitySum -= 0.5f; - positionInverseMultiplier *= absVelocitySum; - if (positionInverseMultiplier > 0f) - { - positionInverseMultiplier *= 2f; - } - projPosY *= 1f + positionInverseMultiplier; - projPosX *= 1f - positionInverseMultiplier; - } - } - float rotation2 = (float)Math.Atan2((double)projPosY, (double)projPosX) - MathHelper.PiOver2; - Color color2 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f), poleColor); - - Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2(mountedCenter.X - Main.screenPosition.X + (float)Main.fishingLineTexture.Width * 0.5f, mountedCenter.Y - Main.screenPosition.Y + (float)Main.fishingLineTexture.Height * 0.5f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.fishingLineTexture.Width, (int)height)), color2, rotation2, new Vector2((float)Main.fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); - } - } - } - } - - public static void DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) - { - Player player = Main.player[projectile.owner]; - Vector2 center = projectile.Center; - float angleToMountedCenter = projectile.AngleTo(player.MountedCenter) - MathHelper.PiOver2; - bool canShowHook = true; - while (canShowHook) - { - float distanceMagnitude = (player.MountedCenter - center).Length(); //Exact same as using a Sqrt - if (distanceMagnitude < hookTexture.Height + 1f) - { - canShowHook = false; - } - else if (float.IsNaN(distanceMagnitude)) - { - canShowHook = false; - } - else - { - center += projectile.DirectionTo(player.MountedCenter) * hookTexture.Height; - Color tileAtCenterColor = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(hookTexture, center - Main.screenPosition, - new Rectangle?(new Rectangle(0, 0, hookTexture.Width, hookTexture.Height)), - tileAtCenterColor, angleToMountedCenter + angleAdditive, - hookTexture.Size() / 2, 1f, SpriteEffects.None, 0f); - } - } - } - - internal static void IterateDisco(ref Color c, ref float aiParam, in byte discoIter = 7) - { - switch (aiParam) - { - case 0f: - c.G += discoIter; - if (c.G >= 255) - { - c.G = 255; - aiParam = 1f; - } - break; - case 1f: - c.R -= discoIter; - if (c.R <= 0) - { - c.R = 0; - aiParam = 2f; - } - break; - case 2f: - c.B += discoIter; - if (c.B >= 255) - { - c.B = 255; - aiParam = 3f; - } - break; - case 3f: - c.G -= discoIter; - if (c.G <= 0) - { - c.G = 0; - aiParam = 4f; - } - break; - case 4f: - c.R += discoIter; - if (c.R >= 255) - { - c.R = 255; - aiParam = 5f; - } - break; - case 5f: - c.B -= discoIter; - if (c.B <= 0) - { - c.B = 0; - aiParam = 0f; - } - break; - default: - aiParam = 0f; - c = Color.Red; - break; - } - } - - public static string ColorMessage(string msg, Color color) - { - StringBuilder sb = new StringBuilder(msg.Length + 12); - sb.Append("[c/").Append(color.Hex3()).Append(':').Append(msg).Append(']'); - return sb.ToString(); - } - - /// - /// Returns a color lerp that allows for smooth transitioning between two given colors - /// - /// The first color you want it to switch between - /// The second color you want it to switch between - /// How long you want it to take to swap between colors - public static Color ColorSwap(Color firstColor, Color secondColor, float seconds) - { - double timeMult = (double)(MathHelper.TwoPi / seconds); - float colorMePurple = (float)((Math.Sin(timeMult * Main.GlobalTime) + 1) * 0.5f); - return Color.Lerp(firstColor, secondColor, colorMePurple); - } - /// - /// Returns a color lerp that supports multiple colors. - /// - /// The 0-1 incremental value used when interpolating. - /// The various colors to interpolate across. - /// - public static Color MulticolorLerp(float increment, params Color[] colors) - { - int currentColorIndex = (int)(increment * colors.Length); - Color currentColor = colors[currentColorIndex]; - Color nextColor = colors[(currentColorIndex + 1) % colors.Length]; - return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); - } - #endregion - - #region Miscellaneous Utilities - public static T[] ShuffleArray(T[] array, Random rand = null) - { - if (rand is null) - rand = new Random(); - - for (int i = array.Length; i > 0; --i) - { - int j = rand.Next(i); - T tempElement = array[j]; - array[j] = array[i - 1]; - array[i - 1] = tempElement; - } - return array; - } - - /// - /// Retrieves all the colors from a and returns them as a 2D array. - /// - /// The texture to load. - /// - public static Color[,] GetColorsFromTexture(this Texture2D texture) - { - Color[] alignedColors = new Color[texture.Width * texture.Height]; - texture.GetData(alignedColors); // Fills the color array with all the colors in the texture - - Color[,] colors2D = new Color[texture.Width, texture.Height]; - for (int x = 0; x < texture.Width; x++) - { - for (int y = 0; y < texture.Height; y++) - { - colors2D[x, y] = alignedColors[x + y * texture.Width]; - } - } - return colors2D; - } - - public static string CombineStrings(params object[] args) - { - StringBuilder result = new StringBuilder(1024); - for(int i = 0; i < args.Length; ++i) - { - object o = args[i]; - result.Append(o.ToString()); - result.Append(' '); - } - return result.ToString(); - } - - /// - /// Calculates the sound volume and panning for a sound which is played at the specified location in the game world.
- /// Note that sound does not play on dedicated servers or during world generation. - ///
- /// The position the sound is emitting from. If either X or Y is -1, the sound does not fade with distance. - /// Whether the sound is considered ambient, which makes it use the ambient sound slider in the options. Defaults to false. - /// Volume and pan, in that order. Volume is always between 0 and 1. Pan is always between -1 and 1. - public static (float, float) CalculateSoundStats(Vector2 soundPos, bool ambient = false) - { - float volume = 0f; - float pan = 0f; - - if (soundPos.X == -1f || soundPos.Y == -1f) - volume = 1f; - else if (WorldGen.gen || Main.dedServ || Main.netMode == NetmodeID.Server) - volume = 0f; - else - { - float topLeftX = Main.screenPosition.X - Main.screenWidth * 2f; - float topLeftY = Main.screenPosition.Y - Main.screenHeight * 2f; - - // Sounds cannot be heard from more than ~2.5 screens away. - // This rectangle is 5x5 screens centered on the current screen center position. - Rectangle audibleArea = new Rectangle((int)topLeftX, (int)topLeftY, Main.screenWidth * 5, Main.screenHeight * 5); - Rectangle soundHitbox = new Rectangle((int)soundPos.X, (int)soundPos.Y, 1, 1); - Vector2 screenCenter = Main.screenPosition + new Vector2(Main.screenWidth * 0.5f, Main.screenHeight * 0.5f); - if (audibleArea.Intersects(soundHitbox)) - { - pan = (soundPos.X - screenCenter.X) / (Main.screenWidth * 0.5f); - float dist = Vector2.Distance(soundPos, screenCenter); - volume = 1f - (dist / (Main.screenWidth * 1.5f)); - } - } - - pan = MathHelper.Clamp(pan, -1f, 1f); - volume = MathHelper.Clamp(volume, 0f, 1f); - if (ambient) - volume = Main.gameInactive ? 0f : volume * Main.ambientVolume; - else - volume *= Main.soundVolume; - - // This is actually done by vanilla. I guess if the sound volume gets corrupted during gameplay, you can't blast your eardrums out. - volume = MathHelper.Clamp(volume, 0f, 1f); - return (volume, pan); - } - - /// - /// Convenience function to utilize CalculateSoundStats immediately on an existing sound effect.
- /// This allows updating a looping sound every single frame to have the correct volume and pan, even if the player drags the audio sliders around. - ///
- /// The SoundEffectInstance which is having its values updated. - /// The position the sound is emitting from. If either X or Y is -1, the sound does not fade with distance. - /// Whether the sound is considered ambient, which makes it use the ambient sound slider in the options. Defaults to false. - public static void ApplySoundStats(ref SoundEffectInstance sfx, Vector2 soundPos, bool ambient = false) - { - if (sfx is null || sfx.IsDisposed) - return; - (sfx.Volume, sfx.Pan) = CalculateSoundStats(soundPos, ambient); - } - - public static void StartRain(bool torrentialTear = false) - { - int num = 86400; - int num2 = num / 24; - Main.rainTime = Main.rand.Next(num2 * 8, num); - if (Main.rand.NextBool(3)) - { - Main.rainTime += Main.rand.Next(0, num2); - } - if (Main.rand.NextBool(4)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(5)) - { - Main.rainTime += Main.rand.Next(0, num2 * 2); - } - if (Main.rand.NextBool(6)) - { - Main.rainTime += Main.rand.Next(0, num2 * 3); - } - if (Main.rand.NextBool(7)) - { - Main.rainTime += Main.rand.Next(0, num2 * 4); - } - if (Main.rand.NextBool(8)) - { - Main.rainTime += Main.rand.Next(0, num2 * 5); - } - float num3 = 1f; - if (Main.rand.NextBool(2)) - { - num3 += 0.05f; - } - if (Main.rand.NextBool(3)) - { - num3 += 0.1f; - } - if (Main.rand.NextBool(4)) - { - num3 += 0.15f; - } - if (Main.rand.NextBool(5)) - { - num3 += 0.2f; - } - Main.rainTime = (int)(Main.rainTime * num3); - Main.raining = true; - if (torrentialTear) - TorrentialTear.AdjustRainSeverity(false); - CalamityMod.UpdateServerBoolean(); - } - - public static void StartSandstorm() - { - typeof(Terraria.GameContent.Events.Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); - } - - public static void StopSandstorm() - { - Terraria.GameContent.Events.Sandstorm.Happening = false; - } - - public static void AddWithCondition(this List list, T type, bool condition) - { - if (condition) - list.Add(type); - } - - public static void Inflict246DebuffsNPC(NPC target, int buff, float timeBase = 2f) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(buff, SecondsToFrames(timeBase * 3f), false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(buff, SecondsToFrames(timeBase * 2f), false); - } - else - { - target.AddBuff(buff, SecondsToFrames(timeBase), false); - } - } - - public static void Inflict246DebuffsPvp(Player target, int buff, float timeBase = 2f) - { - if (Main.rand.NextBool(4)) - { - target.AddBuff(buff, SecondsToFrames(timeBase * 3f), false); - } - else if (Main.rand.NextBool(2)) - { - target.AddBuff(buff, SecondsToFrames(timeBase * 2f), false); - } - else - { - target.AddBuff(buff, SecondsToFrames(timeBase), false); - } - } - - public static int SecondsToFrames(float seconds) => (int)(seconds * 60); - - /// - /// Call this function to spawn explosion clouds at the specified location. Good for when NPCs or projectiles die and need to explode. - /// - /// The spot to spawn the explosion clouds - /// Number of times it loops to spawn gores - public static void ExplosionGores (Vector2 goreSource, int goreAmt) - { - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (int)(goreAmt/3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (int)((2*goreAmt)/3)) - { - velocityMult = 1f; - } - int smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f); - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 Main.cs function - public static float GetLerpValue(float from, float to, float t, bool clamped = false) - { - if (clamped) - { - if (from < to) - { - if (t < from) - { - return 0f; - } - if (t > to) - { - return 1f; - } - } - else - { - if (t < to) - { - return 1f; - } - if (t > from) - { - return 0f; - } - } - } - return (t - from) / (to - from); - } - - /// - /// Clamps the distance between vectors via normalization. - /// - /// The starting point. - /// The ending point. - /// The maximum possible distance between the two vectors before they get clamped. - public static void DistanceClamp(ref Vector2 start, ref Vector2 end, float maxDistance) - { - if (Vector2.Distance(end, start) > maxDistance) - { - end = start + Vector2.Normalize(end - start) * maxDistance; - } - } - - // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function - public static Rectangle ClampToWorld(Rectangle tileRectangle) - { - int num = Math.Max(0, Math.Min(tileRectangle.Left, Main.maxTilesX)); - int num2 = Math.Max(0, Math.Min(tileRectangle.Top, Main.maxTilesY)); - int num3 = Math.Max(0, Math.Min(tileRectangle.Right, Main.maxTilesX)); - int num4 = Math.Max(0, Math.Min(tileRectangle.Bottom, Main.maxTilesY)); - return new Rectangle(num, num2, num3 - num, num4 - num2); - } - - public static void SaveModItem(TagCompound tag, Item itemToSave, int itemIndex = 0) - { - tag.Add($"mod{itemIndex}", itemToSave.modItem?.mod?.Name ?? string.Empty); - tag.Add($"name{itemIndex}", itemToSave.modItem?.Name ?? string.Empty); - } - - public static Item LoadModItem(TagCompound tag, int itemIndex = 0) - { - string modName = tag.GetString($"mod{itemIndex}"); - string itemName = tag.GetString($"name{itemIndex}"); - Item item = new Item(); - - // Don't bother checking any further if something is an empty string. - // Doing the checks below would result in checking for a mod with an empty string for a name. - // This can cause highly unpredictable/unstable behavior, such as the game crashing when you hover - // over the item in the GUI. - if (string.IsNullOrEmpty(modName) || string.IsNullOrEmpty(itemName)) - { - item.type = ItemID.None; - return item; - } - - int type = ModLoader.GetMod(modName)?.ItemType(itemName) ?? ItemID.None; - if (type > ItemID.None) - { - item.netDefaults(type); - item.modItem.Load(tag.GetCompound("data")); - object[] loadGlobalsParameters = new object[] { item, tag.GetList("globalData") }; - typeof(ItemIO).GetMethod("LoadGlobals", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(Item), typeof(IList) }, null).Invoke(null, loadGlobalsParameters); - } - return item; - } - #endregion - } -} diff --git a/Utilities/Circle.cs b/Utilities/Circle.cs deleted file mode 100644 index d918e9edda..0000000000 --- a/Utilities/Circle.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; - -namespace CalamityMod -{ - public class Circle - { - public float Radius; - public Vector2 Center; - - public Circle(Vector2 center, float radius) - { - this.Center = center; - this.Radius = radius; - } - - private Vector2 RandomPointUnitCircle() - { - double r = Math.Sqrt(Main.rand.NextDouble()); - double t = Main.rand.NextDouble() * MathHelper.TwoPi; - return new Vector2((float)(r * Math.Cos(t)), (float)(r * Math.Sin(t))); - } - - public Vector2 RandomPointInCircle() - { - return Center + RandomPointUnitCircle() * Radius; - } - - public Vector2 RandomPointOnCircleEdge() - { - Vector2 v = RandomPointUnitCircle(); - //Normalise so point is on edge of unit circle - v.Normalize(); - return Center + v * Radius; - } - } -} diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs new file mode 100644 index 0000000000..13537d71e1 --- /dev/null +++ b/Utilities/CollisionUtils.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Performs collision based a rotating hitbox for an entity by treating the hitbox as a line. By default uses the velocity of the entity as a direction. This can be overriden. + /// + /// The entity. + /// The top left coordinates of the target to check. + /// The hitbox size of the target to check. + /// An optional direction override + public static bool RotatingHitboxCollision(this Entity entity, Vector2 targetTopLeft, Vector2 targetHitboxDimensions, Vector2? directionOverride = null) + { + Vector2 lineDirection = directionOverride ?? entity.velocity; + + // Ensure that the line direction is a unit vector. + lineDirection = lineDirection.SafeNormalize(Vector2.UnitY); + Vector2 start = entity.Center - lineDirection * entity.height * 0.5f; + Vector2 end = entity.Center + lineDirection * entity.height * 0.5f; + + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetTopLeft, targetHitboxDimensions, start, end, entity.width, ref _); + } + + /// + /// Determines if a typical hitbox rectangle is intersecting a circular hitbox. + /// + /// The center of the circular hitbox. + /// The radius of the circular hitbox. + /// The hitbox of the target to check. + public static bool CircularHitboxCollision(Vector2 centerCheckPosition, float radius, Rectangle targetHitbox) + { + float topLeftDistance = Vector2.Distance(centerCheckPosition, targetHitbox.TopLeft()); + float topRightDistance = Vector2.Distance(centerCheckPosition, targetHitbox.TopRight()); + float bottomLeftDistance = Vector2.Distance(centerCheckPosition, targetHitbox.BottomLeft()); + float bottomRightDistance = Vector2.Distance(centerCheckPosition, targetHitbox.BottomRight()); + + float distanceToClosestPoint = topLeftDistance; + if (topRightDistance < distanceToClosestPoint) + distanceToClosestPoint = topRightDistance; + if (bottomLeftDistance < distanceToClosestPoint) + distanceToClosestPoint = bottomLeftDistance; + if (bottomRightDistance < distanceToClosestPoint) + distanceToClosestPoint = bottomRightDistance; + + return distanceToClosestPoint <= radius; + } + } +} diff --git a/Utilities/Downed.cs b/Utilities/Downed.cs deleted file mode 100644 index 298afa28ae..0000000000 --- a/Utilities/Downed.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.World; -using System; - -namespace CalamityMod -{ - internal class Downed - { - public static readonly Func DownedDesertScourge = () => CalamityWorld.downedDesertScourge; - public static readonly Func DownedGiantClam = () => CalamityWorld.downedCLAM; - public static readonly Func DownedCrabulon = () => CalamityWorld.downedCrabulon; - public static readonly Func DownedHiveMind = () => CalamityWorld.downedHiveMind; - public static readonly Func DownedPerfs = () => CalamityWorld.downedPerforator; - public static readonly Func DownedSlimeGod = () => CalamityWorld.downedSlimeGod; - public static readonly Func DownedCryogen = () => CalamityWorld.downedCryogen; - public static readonly Func DownedBrimstoneElemental = () => CalamityWorld.downedBrimstoneElemental; - public static readonly Func DownedAquaticScourge = () => CalamityWorld.downedAquaticScourge; - public static readonly Func DownedCalamitas = () => CalamityWorld.downedCalamitas; - public static readonly Func DownedGSS = () => CalamityWorld.downedGSS; - public static readonly Func DownedLeviathan = () => CalamityWorld.downedLeviathan; - public static readonly Func DownedAureus = () => CalamityWorld.downedAstrageldon; - public static readonly Func DownedPBG = () => CalamityWorld.downedPlaguebringer; - public static readonly Func DownedRavager = () => CalamityWorld.downedScavenger; - public static readonly Func DownedDeus = () => CalamityWorld.downedStarGod; - public static readonly Func DownedGuardians = () => CalamityWorld.downedGuardians; - public static readonly Func DownedBirb = () => CalamityWorld.downedBumble; - public static readonly Func DownedProvidence = () => CalamityWorld.downedProvidence; - public static readonly Func DownedCeaselessVoid = () => CalamityWorld.downedSentinel1; - public static readonly Func DownedStormWeaver = () => CalamityWorld.downedSentinel2; - public static readonly Func DownedSignus = () => CalamityWorld.downedSentinel3; - public static readonly Func DownedPolterghast = () => CalamityWorld.downedPolterghast; - public static readonly Func DownedBoomerDuke = () => CalamityWorld.downedBoomerDuke; - public static readonly Func DownedDoG = () => CalamityWorld.downedDoG; - public static readonly Func DownedYharon = () => CalamityWorld.downedYharon; - public static readonly Func DownedSCal = () => CalamityWorld.downedSCal; - - public static readonly Func DownedAcidRainInitial = () => CalamityWorld.downedEoCAcidRain; - public static readonly Func DownedAcidRainHardmode = () => CalamityWorld.downedAquaticScourgeAcidRain; - } -} diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs new file mode 100644 index 0000000000..a9c0dea443 --- /dev/null +++ b/Utilities/DrawingUtils.cs @@ -0,0 +1,505 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using System; +using System.Reflection; +using System.Text; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + #region Projectile Afterimages + /// + /// Draws a projectile as a series of afterimages. The first of these afterimages is centered on the center of the projectile's hitbox.
+ /// This function is guaranteed to draw the projectile itself, even if it has no afterimages and/or the Afterimages config option is turned off. + ///
+ /// The projectile to be drawn. + /// The type of afterimage drawing code to use. Vanilla Terraria has three options: 0, 1, and 2. + /// The light color to use for the afterimages. + /// If mode 1 is used, this controls the loop increment. Set it to more than 1 to skip afterimages. + /// The texture to draw. Set to null to draw the projectile's own loaded texture. + /// If false, the afterimages will be centered on the projectile's position instead of its own center. + public static void DrawAfterimagesCentered(Projectile proj, int mode, Color lightColor, int typeOneIncrement = 1, Texture2D texture = null, bool drawCentered = true) + { + if (texture is null) + texture = Main.projectileTexture[proj.type]; + + int frameHeight = texture.Height / Main.projFrames[proj.type]; + int frameY = frameHeight * proj.frame; + float scale = proj.scale; + float rotation = proj.rotation; + + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + Vector2 origin = rectangle.Size() / 2f; + + SpriteEffects spriteEffects = SpriteEffects.None; + if (proj.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + // If no afterimages are drawn due to an invalid mode being specified, ensure the projectile itself is drawn anyway. + bool failedToDrawAfterimages = false; + + if (CalamityConfig.Instance.Afterimages) + { + Vector2 centerOffset = drawCentered ? proj.Size / 2f : Vector2.Zero; + switch (mode) + { + // Standard afterimages. No customizable features other than total afterimage count. + // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 0: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, origin, scale, spriteEffects, 0f); + } + break; + + // Paladin's Hammer style afterimages. Can be optionally spaced out further by using the typeOneDistanceMultiplier variable. + // Type 1 afterimages linearly scale down from 66% to 0% opacity. They otherwise do not differ from type 0. + case 1: + // Safety check: the loop must increment + int increment = Math.Max(1, typeOneIncrement); + Color drawColor = proj.GetAlpha(lightColor); + int afterimageCount = ProjectileID.Sets.TrailCacheLength[proj.type]; + int k = 0; + while (k < afterimageCount) + { + Vector2 drawPos = proj.oldPos[k] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS EITHER. + if (k > 0) + { + float colorMult = (float)(afterimageCount - k); + drawColor *= colorMult / ((float)afterimageCount * 1.5f); + } + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), drawColor, rotation, origin, scale, spriteEffects, 0f); + k += increment; + } + break; + + // Standard afterimages with rotation. No customizable features other than total afterimage count. + // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 2: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + float afterimageRot = proj.oldRot[i]; + SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Vector2 drawPos = proj.oldPos[i] + centerOffset - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, scale, sfxForThisAfterimage, 0f); + } + break; + + default: + failedToDrawAfterimages = true; + break; + } + } + + // Draw the projectile itself. Only do this if no afterimages are drawn because afterimage 0 is the projectile itself. + if (!CalamityConfig.Instance.Afterimages || ProjectileID.Sets.TrailCacheLength[proj.type] <= 0 || failedToDrawAfterimages) + { + Vector2 startPos = drawCentered ? proj.Center : proj.position; + Main.spriteBatch.Draw(texture, startPos - Main.screenPosition + new Vector2(0f, proj.gfxOffY), rectangle, proj.GetAlpha(lightColor), rotation, origin, scale, spriteEffects, 0f); + } + } + + // Used for bullets. This lets you draw afterimages while keeping the hitbox at the front of the projectile. + // This supports type 0 and type 2 afterimages. Vanilla bullets never have type 2 afterimages. + public static void DrawAfterimagesFromEdge(Projectile proj, int mode, Color lightColor, Texture2D texture = null) + { + if (texture is null) + texture = Main.projectileTexture[proj.type]; + + int frameHeight = texture.Height / Main.projFrames[proj.type]; + int frameY = frameHeight * proj.frame; + float scale = proj.scale; + float rotation = proj.rotation; + + Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); + + SpriteEffects spriteEffects = SpriteEffects.None; + if (proj.spriteDirection == -1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Vector2 drawOrigin = new Vector2(texture.Width * 0.5f, proj.height * 0.5f); + + switch (mode) + { + default: // If you specify an afterimage mode other than 0 or 2, you get nothing. + return; + + // Standard afterimages. No customizable features other than total afterimage count. + // Type 0 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 0: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, rotation, drawOrigin, scale, spriteEffects, 0f); + } + return; + + // Standard afterimages with rotation. No customizable features other than total afterimage count. + // Type 2 afterimages linearly scale down from 100% to 0% opacity. Their color and lighting is equal to the main projectile's. + case 2: + for (int i = 0; i < proj.oldPos.Length; ++i) + { + float afterimageRot = proj.oldRot[i]; + SpriteEffects sfxForThisAfterimage = proj.oldSpriteDirection[i] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Vector2 drawPos = proj.oldPos[i] + drawOrigin - Main.screenPosition + new Vector2(0f, proj.gfxOffY); + // DO NOT REMOVE THESE "UNNECESSARY" FLOAT CASTS. THIS WILL BREAK THE AFTERIMAGES. + Color color = proj.GetAlpha(lightColor) * ((float)(proj.oldPos.Length - i) / (float)proj.oldPos.Length); + Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, drawOrigin, scale, sfxForThisAfterimage, 0f); + } + return; + } + } + #endregion + + /// + /// Sets a 's arbitrarily. + /// + /// The sprite batch. + /// The blend state to use. + public static void SetBlendState(this SpriteBatch spriteBatch, BlendState blendState) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, blendState, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); + } + + /// + /// Draws text with an eight-way one-pixel offset border. + /// + /// + /// + /// + /// + /// + /// + /// + public static void DrawBorderStringEightWay(SpriteBatch sb, DynamicSpriteFont font, string text, Vector2 baseDrawPosition, Color main, Color border, float scale = 1f) + { + for (int x = -1; x <= 1; x++) + { + for (int y = -1; y <= 1; y++) + { + Vector2 drawPosition = baseDrawPosition + new Vector2(x, y); + if (x == 0 && y == 0) + continue; + + DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, drawPosition, border, 0f, default, scale, SpriteEffects.None, 0f); + } + } + DynamicSpriteFontExtensionMethods.DrawString(sb, font, text, baseDrawPosition, main, 0f, default, scale, SpriteEffects.None, 0f); + } + + public static void DrawItemGlowmaskSingleFrame(this Item item, SpriteBatch spriteBatch, float rotation, Texture2D glowmaskTexture) + { + Vector2 origin = new Vector2(glowmaskTexture.Width / 2f, glowmaskTexture.Height / 2f - 2f); + spriteBatch.Draw(glowmaskTexture, item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public static Rectangle GetCurrentFrame(this Item item, ref int frame, ref int frameCounter, int frameDelay, int frameAmt, bool frameCounterUp = true) + { + if (frameCounter >= frameDelay) + { + frameCounter = -1; + frame = frame == frameAmt - 1 ? 0 : frame + 1; + } + if (frameCounterUp) + frameCounter++; + return new Rectangle(0, item.height * frame, item.width, item.height); + } + + public static bool DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) + { + Player player = Main.player[projectile.owner]; + Item item = player.HeldItem; + if (!projectile.bobber || item.holdStyle <= 0) + return false; + + float originX = player.MountedCenter.X; + float originY = player.MountedCenter.Y; + originY += player.gfxOffY; + //This variable is used to account for Gravitation Potions + float gravity = player.gravDir; + + if (item.type == fishingRodType) + { + originX += (float)(xPositionAdditive * player.direction); + if (player.direction < 0) + { + originX -= 13f; + } + originY -= yPositionAdditive * gravity; + } + + if (gravity == -1f) + { + originY -= 12f; + } + Vector2 mountedCenter = new Vector2(originX, originY); + mountedCenter = player.RotatedRelativePoint(mountedCenter + new Vector2(8f), true) - new Vector2(8f); + Vector2 lineOrigin = projectile.Center - mountedCenter; + bool canDraw = true; + if (lineOrigin.X == 0f && lineOrigin.Y == 0f) + return false; + + float projPosMagnitude = lineOrigin.Length(); + projPosMagnitude = 12f / projPosMagnitude; + lineOrigin.X *= projPosMagnitude; + lineOrigin.Y *= projPosMagnitude; + mountedCenter -= lineOrigin; + lineOrigin = projectile.Center - mountedCenter; + + while (canDraw) + { + float height = 12f; + float positionMagnitude = lineOrigin.Length(); + if (float.IsNaN(positionMagnitude) || float.IsNaN(positionMagnitude)) + break; + + if (positionMagnitude < 20f) + { + height = positionMagnitude - 8f; + canDraw = false; + } + positionMagnitude = 12f / positionMagnitude; + lineOrigin.X *= positionMagnitude; + lineOrigin.Y *= positionMagnitude; + mountedCenter += lineOrigin; + lineOrigin = projectile.Center - mountedCenter; + if (positionMagnitude > 12f) + { + float positionInverseMultiplier = 0.3f; + float absVelocitySum = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); + if (absVelocitySum > 16f) + { + absVelocitySum = 16f; + } + absVelocitySum = 1f - absVelocitySum / 16f; + positionInverseMultiplier *= absVelocitySum; + absVelocitySum = positionMagnitude / 80f; + if (absVelocitySum > 1f) + { + absVelocitySum = 1f; + } + positionInverseMultiplier *= absVelocitySum; + if (positionInverseMultiplier < 0f) + { + positionInverseMultiplier = 0f; + } + absVelocitySum = 1f - projectile.localAI[0] / 100f; + positionInverseMultiplier *= absVelocitySum; + if (lineOrigin.Y > 0f) + { + lineOrigin.Y *= 1f + positionInverseMultiplier; + lineOrigin.X *= 1f - positionInverseMultiplier; + } + else + { + absVelocitySum = Math.Abs(projectile.velocity.X) / 3f; + if (absVelocitySum > 1f) + { + absVelocitySum = 1f; + } + absVelocitySum -= 0.5f; + positionInverseMultiplier *= absVelocitySum; + if (positionInverseMultiplier > 0f) + { + positionInverseMultiplier *= 2f; + } + lineOrigin.Y *= 1f + positionInverseMultiplier; + lineOrigin.X *= 1f - positionInverseMultiplier; + } + } + //This color decides the color of the fishing line. + Color lineColor = Lighting.GetColor((int)mountedCenter.X / 16, (int)mountedCenter.Y / 16, poleColor); + float rotation = lineOrigin.ToRotation() - MathHelper.PiOver2; + + Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2(mountedCenter.X - Main.screenPosition.X + Main.fishingLineTexture.Width * 0.5f, mountedCenter.Y - Main.screenPosition.Y + Main.fishingLineTexture.Height * 0.5f), new Rectangle?(new Rectangle(0, 0, Main.fishingLineTexture.Width, (int)height)), lineColor, rotation, new Vector2(Main.fishingLineTexture.Width * 0.5f, 0f), 1f, SpriteEffects.None, 0f); + } + return false; + } + + public static void DrawHook(this Projectile projectile, Texture2D hookTexture, float angleAdditive = 0f) + { + Player player = Main.player[projectile.owner]; + Vector2 center = projectile.Center; + float angleToMountedCenter = projectile.AngleTo(player.MountedCenter) - MathHelper.PiOver2; + bool canShowHook = true; + while (canShowHook) + { + float distanceMagnitude = (player.MountedCenter - center).Length(); //Exact same as using a Sqrt + if (distanceMagnitude < hookTexture.Height + 1f) + { + canShowHook = false; + } + else if (float.IsNaN(distanceMagnitude)) + { + canShowHook = false; + } + else + { + center += projectile.SafeDirectionTo(player.MountedCenter) * hookTexture.Height; + Color tileAtCenterColor = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); + Main.spriteBatch.Draw(hookTexture, center - Main.screenPosition, + new Rectangle?(new Rectangle(0, 0, hookTexture.Width, hookTexture.Height)), + tileAtCenterColor, angleToMountedCenter + angleAdditive, + hookTexture.Size() / 2, 1f, SpriteEffects.None, 0f); + } + } + } + + internal static void IterateDisco(ref Color c, ref float aiParam, in byte discoIter = 7) + { + switch (aiParam) + { + case 0f: + c.G += discoIter; + if (c.G >= 255) + { + c.G = 255; + aiParam = 1f; + } + break; + case 1f: + c.R -= discoIter; + if (c.R <= 0) + { + c.R = 0; + aiParam = 2f; + } + break; + case 2f: + c.B += discoIter; + if (c.B >= 255) + { + c.B = 255; + aiParam = 3f; + } + break; + case 3f: + c.G -= discoIter; + if (c.G <= 0) + { + c.G = 0; + aiParam = 4f; + } + break; + case 4f: + c.R += discoIter; + if (c.R >= 255) + { + c.R = 255; + aiParam = 5f; + } + break; + case 5f: + c.B -= discoIter; + if (c.B <= 0) + { + c.B = 0; + aiParam = 0f; + } + break; + default: + aiParam = 0f; + c = Color.Red; + break; + } + } + + public static string ColorMessage(string msg, Color color) + { + StringBuilder sb = new StringBuilder(msg.Length + 12); + sb.Append("[c/").Append(color.Hex3()).Append(':').Append(msg).Append(']'); + return sb.ToString(); + } + + /// + /// Returns a color lerp that allows for smooth transitioning between two given colors + /// + /// The first color you want it to switch between + /// The second color you want it to switch between + /// How long you want it to take to swap between colors + public static Color ColorSwap(Color firstColor, Color secondColor, float seconds) + { + double timeMult = (double)(MathHelper.TwoPi / seconds); + float colorMePurple = (float)((Math.Sin(timeMult * Main.GlobalTime) + 1) * 0.5f); + return Color.Lerp(firstColor, secondColor, colorMePurple); + } + /// + /// Returns a color lerp that supports multiple colors. + /// + /// The 0-1 incremental value used when interpolating. + /// The various colors to interpolate across. + /// + public static Color MulticolorLerp(float increment, params Color[] colors) + { + increment %= 0.999f; + int currentColorIndex = (int)(increment * colors.Length); + Color currentColor = colors[currentColorIndex]; + Color nextColor = colors[(currentColorIndex + 1) % colors.Length]; + return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); + } + + // Cached for efficiency purposes. + internal static readonly FieldInfo UImageField = typeof(MiscShaderData).GetField("_uImage", BindingFlags.NonPublic | BindingFlags.Instance); + + /// + /// Manually sets the texture of a instance, since vanilla's implementation only supports strings that access vanilla textures. + /// + /// The shader to bind the texture to. + /// The texture to bind. + public static void SetShaderTexture(this MiscShaderData shader, Texture2D texture) => UImageField.SetValue(shader, new Ref(texture)); + + public static void EnterShaderRegion(this SpriteBatch spriteBatch) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + public static void ExitShaderRegion(this SpriteBatch spriteBatch) + { + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + 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"); + for (int i = 0; i < auroraCount; i++) + { + float incrementOffsetAngle = MathHelper.TwoPi * i / auroraCount; + float xOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f) * 20f; + float yOffset = (float)Math.Sin(time * MathHelper.TwoPi + incrementOffsetAngle * 2f + MathHelper.ToRadians(60f)) * 6f; + float rotation = (float)Math.Sin(incrementOffsetAngle) * MathHelper.Pi / 12f; + Vector2 offset = new Vector2(xOffset, yOffset - 14f); + DrawData drawData = new DrawData(auroraTexture, + player.Top + offset - Main.screenPosition, + null, + color * opacity, + rotation + MathHelper.PiOver2, + auroraTexture.Size() * 0.5f, + 0.135f, + SpriteEffects.None, + 1); + Main.playerDrawData.Add(drawData); + } + } + } +} diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 3c695ded29..c602406aca 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,9 +1,11 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo.FiniteUse; +using CalamityMod.NPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod @@ -11,47 +13,42 @@ namespace CalamityMod public static class DropHelper { #region Global Drop Chances - /// - /// The Defiled Rune boosts various low drop rates to one in this value. - /// - public const int DefiledDropRateInt = 20; /// - /// The Defiled Rune boosts various low drop rates to this chance (decimal number out of 1.0). + /// Weapons in Normal Mode typically have a 1 in X chance of dropping, where X is this variable. /// - public const float DefiledDropRateFloat = 0.05f; + public const int NormalWeaponDropRateInt = 4; /// - /// Legendary drops have a 1 in X chance of dropping, where X is this variable. + /// Weapons in Normal Mode typically have this chance to drop (decimal number out of 1.0). /// - public const int LegendaryDropRateInt = 100; + public const float NormalWeaponDropRateFloat = 0.25f; /// - /// Legendary weapons have this chance to drop (decimal number out of 1.0). + /// Weapons in Expert Mode typically have a 1 in X chance of dropping, where X is this variable. /// - public const float LegendaryDropRateFloat = 0.01f; + public const int BagWeaponDropRateInt = 3; /// - /// Rare Item Variants have a 1 in X chance of dropping, where X is this variable. - /// - public const int RareVariantDropRateInt = 40; - - /// - /// Rare Item Variants have this chance to drop (decimal number out of 1.0). - /// - public const float RareVariantDropRateFloat = 0.025f; - - /// - /// Direct weapon drops (straight from the boss in Normal Mode) have this chance to drop (decimal number out of 1.0). - /// - public const float DirectWeaponDropRateFloat = 0.25f; - - /// - /// Bag weapon drops (Expert Mode and higher) have this chance to drop (decimal number out of 1.0). + /// Weapons in Expert Mode typically have this chance to drop (decimal number out of 1.0). /// public const float BagWeaponDropRateFloat = 0.3333333f; #endregion + #region Block Drops + /// + /// Adds the specified items to TML's blockLoot list. Items on the list cannot spawn in the world via any means.
+ /// This is used to prevent vanilla loot code from spawning certain items.
+ /// You should only use this function inside NPCLoot or bag opening code. TML will clear the list for you when the loot event is over. + ///
+ /// The item IDs to prevent from spawning. + public static void BlockDrops(params int[] itemIDs) + { + foreach (int itemID in itemIDs) + NPCLoader.blockLoot.Add(itemID); + } + #endregion + #region Weighted Item Sets public const float DefaultWeight = 1f; public const float MinisiculeWeight = 1E-6f; @@ -316,15 +313,6 @@ namespace CalamityMod bagsDropped += DeathExtraBags; } - // If Defiled is active, possibly drop extra bags. - if (CalamityWorld.defiled) - { - for (int i = 0; i < DefiledExtraBags; ++i) - theBoss.DropBossBags(); - - bagsDropped += DefiledExtraBags; - } - return bagsDropped; } @@ -332,10 +320,10 @@ namespace CalamityMod /// Drops the correct number of boss bags for Armageddon. /// /// The NPC to drop boss bags for. - /// The number of boss bags dropped. + /// The number of boss bags dropped. No bags are dropped if the boss has been downed already. public static int DropArmageddonBags(NPC theBoss) { - if (!CalamityWorld.armageddon) + if (!CalamityWorld.armageddon || CalamityGlobalNPC.GetDownedBossVariable(theBoss.type)) return 0; for (int i = 0; i < ArmageddonExtraBags; ++i) @@ -345,6 +333,31 @@ namespace CalamityMod #endregion #region Specific Drop Helpers + // Code copied from Player.QuickSpawnClonedItem, which was added by TML. + /// + /// Clones the given item and spawns it into the world at the given position. You can also customize stack count as necessary.

+ /// The default stack count of -1 makes it copy the stack count of the given item. + ///
+ /// The item to clone and spawn. + /// Where the item should be spawned. + /// The stack count to use. Leave at -1 to use the stack of the item parameter. + /// The spawned clone of the item. NEVER equal to the input item. + public static Item DropItemClone(Item item, Vector2 position, int stack = -1) + { + int index = Item.NewItem(position, item.type, stack, false, -1, false, false); + Item theClone = Main.item[index] = item.Clone(); + theClone.whoAmI = index; + theClone.position = position; + if (stack != -1) + theClone.stack = stack; + + // If in multiplayer, broadcast that this item was spawned. + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.SyncItem, -1, -1, null, index, 1f); + + return theClone; + } + /// /// Finds the worm segment nearest to an NPC's target by combing the NPC array for the closest NPC that is one of the specified types.

/// Return the specified NPC's index if no matching worm segment was found. @@ -380,27 +393,6 @@ namespace CalamityMod return DropItemFromSetCondition(p, CalamityWorld.revenge, 0.05f, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); } - /// - /// Drops finite use "Resident Evil" ammunition from the given NPC, if the downed boolean isn't already true. - /// - /// The NPC to drop ammo from. - /// A downed boolean corresponding to this NPC. Use "false" to always drop ammo. - /// The number of Magnum Rounds to drop. - /// The number of Grenade Rounds to drop. - /// The number of Explosive Shells to drop. - /// The total amount of ammunition dropped. - public static int DropResidentEvilAmmo(NPC theBoss, bool alreadyKilled, int magnum, int bazooka, int hydra) - { - if (alreadyKilled) - return 0; - - int dropped = 0; - dropped += DropItem(theBoss, ModContent.ItemType(), magnum); - dropped += DropItem(theBoss, ModContent.ItemType(), bazooka); - dropped += DropItem(theBoss, ModContent.ItemType(), hydra); - return dropped; - } - /// /// Randomly peppers stacks of 1 of the specified item all across the given NPC's hitbox.

/// Makes it appear as though the NPC "explodes" into a cloud of many identical items. Best used with floating items such as Souls. @@ -435,50 +427,6 @@ namespace CalamityMod return dropped; } - - /// - /// Drops an item that may instead be replaced by a given Rare Item Variant (RIV). - /// - /// The NPC which should drop the item. - /// The ID of the normal item to drop. - /// The ID of the rare item to drop. - /// The chance that one of the two will drop. A decimal number <= 1.0. - /// The chance that the RIV will drop. A decimal number <= 1.0. - /// Whether an item was spawned. - public static bool DropItemRIV(NPC npc, int itemID, int rareID, float itemChance, float rareChance = RareVariantDropRateFloat) - { - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= rareChance; // 1/X chance overall of getting RIV - if (f <= itemChance) // 1/X chance of getting original OR the RIV replacing it - { - DropItemCondition(npc, itemID, !replaceWithRare); - DropItemCondition(npc, rareID, replaceWithRare); - return true; - } - return false; - } - - /// - /// Drops an item that may instead be replaced by a given Rare Item Variant (RIV). - /// - /// The player which should receive the item. - /// The ID of the normal item to drop. - /// The ID of the rare item to drop. - /// The chance that one of the two will drop. A decimal number <= 1.0. - /// The chance that the RIV will drop. A decimal number <= 1.0. - /// Whether an item was spawned. - public static bool DropItemRIV(Player player, int itemID, int rareID, float itemChance, float rareChance = RareVariantDropRateFloat) - { - float f = Main.rand.NextFloat(); - bool replaceWithRare = f <= rareChance; // 1/X chance overall of getting RIV - if (f <= itemChance) // 1/X chance of getting original OR the RIV replacing it - { - DropItemCondition(player, itemID, !replaceWithRare); - DropItemCondition(player, rareID, replaceWithRare); - return true; - } - return false; - } #endregion #region NPC Item Drops 100% Chance diff --git a/Utilities/EntityUtils.cs b/Utilities/EntityUtils.cs new file mode 100644 index 0000000000..bcd867859c --- /dev/null +++ b/Utilities/EntityUtils.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Gets a unit direction towards an arbitrary destination for an entity based on its center. Has safety in the form of a fallback vector. + /// + /// The entity to check from. + /// The destination to get the direction to. + /// A fallback value to use in the event of an unsafe normalization. + public static Vector2 SafeDirectionTo(this Entity entity, Vector2 destination, Vector2? fallback = null) + { + // Fall back to zero by default. default(Vector2) could be used in the parameter definition, but + // this is more clear. + if (!fallback.HasValue) + fallback = Vector2.Zero; + + return (destination - entity.Center).SafeNormalize(fallback.Value); + } + } +} diff --git a/Utilities/Enums.cs b/Utilities/Enums.cs deleted file mode 100644 index 831072c3f1..0000000000 --- a/Utilities/Enums.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace CalamityMod -{ - public enum ConvertType - { - Pure, - Corrupt, - Crimson, - Hallow - } - - public enum CalamityRarity - { - ItemSpecific = -1, - NoEffect = 0, - Turquoise = 12, - PureGreen = 13, - DarkBlue = 14, - Violet = 15, - Developer = 16, - Rainbow = 30, - RareVariant = 31, - Dedicated = 32, - DraedonRust = 33, - } -} diff --git a/Utilities/FurnitureSetupUtils.cs b/Utilities/FurnitureSetupUtils.cs new file mode 100644 index 0000000000..39c2d8a640 --- /dev/null +++ b/Utilities/FurnitureSetupUtils.cs @@ -0,0 +1,1129 @@ +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + public static void RightClickBreak(int i, int j) + { + if (Main.tile[i, j] != null && Main.tile[i, j].active()) + { + WorldGen.KillTile(i, j, false, false, false); + if (!Main.tile[i, j].active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, (float)i, (float)j, 0f, 0, 0, 0); + } + } + } + + public static bool BedRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int spawnX = i - tile.frameX / 18; + int spawnY = j + 2; + spawnX += tile.frameX >= 72 ? 5 : 2; + if (tile.frameY % 38 != 0) + { + spawnY--; + } + player.FindSpawn(); + if (player.SpawnX == spawnX && player.SpawnY == spawnY) + { + player.RemoveSpawn(); + Main.NewText("Spawn point removed!", 255, 240, 20, false); + } + else if (Player.CheckSpawn(spawnX, spawnY)) + { + player.ChangeSpawn(spawnX, spawnY); + Main.NewText("Spawn point set!", 255, 240, 20, false); + } + return true; + } + + public static bool ChestRightClick(int i, int j) + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + Main.mouseRightRelease = false; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + if (chest == player.chest) + { + player.chest = -1; + Main.PlaySound(SoundID.MenuClose); + } + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + Recipe.FindRecipes(); + } + } + return true; + } + + public static void ChestMouseOver(string chestName, int i, int j) where T : ModItem + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; + if (player.showItemIconText == chestName) + { + player.showItemIcon2 = ItemType(); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } + + public static void ChestMouseFar(string name, int i, int j) where T : ModItem + { + ChestMouseOver(name, i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public static bool ClockRightClick() + { + string text = "AM"; + + // Get Terraria's current strange time variable + double time = Main.time; + + // Correct for night time (which for some reason isn't just a different number) by adding 54000. + if (!Main.dayTime) + time += 54000D; + + // Divide by seconds in an hour + time /= 3600D; + + // Terraria night starts at 7:30 PM, so offset accordingly + time -= 19.5; + + // Offset time to ensure it is not negative, then change to PM if necessary + if (time < 0D) + time += 24D; + if (time >= 12D) + text = "PM"; + + // Get the decimal (smaller than hours, so minutes) component of time. + int intTime = (int)time; + double deltaTime = time - intTime; + + // Convert decimal time into an exact number of minutes. + deltaTime = (int)(deltaTime * 60D); + + string minuteText = deltaTime.ToString(); + + // Ensure minutes has a leading zero + if (deltaTime < 10D) + minuteText = "0" + minuteText; + + // Convert from 24 to 12 hour time (PM already handled earlier) + if (intTime > 12) + intTime -= 12; + // 12 AM is actually hour zero in 24 hour time + if (intTime == 0) + intTime = 12; + + // Create an overall time readout and send it to chat + var newText = string.Concat("Time: ", intTime, ":", minuteText, " ", text); + Main.NewText(newText, 255, 240, 20); + return true; + } + + public static bool DresserRightClick() + { + Player player = Main.LocalPlayer; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY == 0) + { + Main.CancelClothesWindow(true); + + int left = (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 18); + left %= 3; + left = Player.tileTargetX - left; + int top = Player.tileTargetY - (int)(Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 18); + if (player.sign > -1) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = string.Empty; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = string.Empty; + } + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + if (left == player.chestX && top == player.chestY && player.chest != -1) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + else + { + player.flyingPigChest = -1; + int num213 = Chest.FindChest(left, top); + if (num213 != -1) + { + Main.stackSplit = 600; + if (num213 == player.chest) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + else if (num213 != player.chest && player.chest == -1) + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuOpen); + player.chestX = left; + player.chestY = top; + } + else + { + player.chest = num213; + Main.playerInventory = true; + Main.recBigList = false; + Main.PlaySound(SoundID.MenuTick); + player.chestX = left; + player.chestY = top; + } + Recipe.FindRecipes(); + return true; + } + } + } + else + { + Main.playerInventory = false; + player.chest = -1; + Recipe.FindRecipes(); + Main.dresserX = Player.tileTargetX; + Main.dresserY = Player.tileTargetY; + Main.OpenClothesWindow(); + return true; + } + + return false; + } + + public static void DresserMouseFar(string chestName) where T : ModItem + { + Player player = Main.LocalPlayer; + 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) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chestName; + } + if (player.showItemIconText == chestName) + { + player.showItemIcon2 = ItemType(); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + public static void DresserMouseOver(string chestName) where T : ModItem + { + Player player = Main.LocalPlayer; + 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) + { + top--; + } + int chestIndex = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chestIndex < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyDresserType.0"); + } + else + { + if (Main.chest[chestIndex].name != "") + { + player.showItemIconText = Main.chest[chestIndex].name; + } + else + { + player.showItemIconText = chestName; + } + if (player.showItemIconText == chestName) + { + player.showItemIcon2 = ItemType(); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY > 0) + { + player.showItemIcon2 = ItemID.FamiliarShirt; + } + } + + public static bool LockedChestRightClick(bool isLocked, int left, int top, int i, int j) + { + Player player = Main.LocalPlayer; + + // If the player right clicked the chest while editing a sign, finish that up + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + + // If the player right clicked the chest while editing a chest, finish that up + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + + // If the player right clicked the chest after changing another chest's name, finish that up + if (player.editedChestName) + { + NetMessage.SendData(MessageID.SyncPlayerChest, -1, -1, NetworkText.FromLiteral(Main.chest[player.chest].name), player.chest, 1f, 0f, 0f, 0, 0, 0); + player.editedChestName = false; + } + if (Main.netMode == NetmodeID.MultiplayerClient && !isLocked) + { + // Right clicking the chest you currently have open closes it. This counts as interaction. + if (left == player.chestX && top == player.chestY && player.chest >= 0) + { + player.chest = -1; + Recipe.FindRecipes(); + Main.PlaySound(SoundID.MenuClose); + } + + // Right clicking this chest opens it if it's not already open. This counts as interaction. + else + { + NetMessage.SendData(MessageID.RequestChestOpen, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0); + Main.stackSplit = 600; + } + return true; + } + + else + { + if (isLocked) + { + // If you right click the locked chest and you can unlock it, it unlocks itself but does not open. This counts as interaction. + if (Chest.Unlock(left, top)) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.Unlock, -1, -1, null, player.whoAmI, 1f, (float)left, (float)top); + } + return true; + } + } + else + { + int chest = Chest.FindChest(left, top); + if (chest >= 0) + { + Main.stackSplit = 600; + + // If you right click the same chest you already have open, it closes. This counts as interaction. + if (chest == player.chest) + { + player.chest = -1; + Main.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. + else + { + player.chest = chest; + Main.playerInventory = true; + Main.recBigList = false; + player.chestX = left; + player.chestY = top; + Main.PlaySound(player.chest < 0 ? SoundID.MenuOpen : SoundID.MenuTick); + } + + Recipe.FindRecipes(); + return true; + } + } + } + + // This only occurs when the chest is locked and cannot be unlocked. You did not interact with the chest. + return false; + } + + public static void LockedChestMouseOver(string chestName, int i, int j) + where K : ModItem where C : ModItem + { + Player player = Main.LocalPlayer; + Tile tile = Main.tile[i, j]; + int left = i; + int top = j; + if (tile.frameX % 36 != 0) + { + left--; + } + if (tile.frameY != 0) + { + top--; + } + int chest = Chest.FindChest(left, top); + player.showItemIcon2 = -1; + if (chest < 0) + { + player.showItemIconText = Language.GetTextValue("LegacyChestType.0"); + } + else + { + player.showItemIconText = Main.chest[chest].name.Length > 0 ? Main.chest[chest].name : chestName; + if (player.showItemIconText == chestName) + { + player.showItemIcon2 = ItemType(); + if (Main.tile[left, top].frameX / 36 == 1) + player.showItemIcon2 = ItemType(); + player.showItemIconText = ""; + } + } + player.noThrow = 2; + player.showItemIcon = true; + } + + public static void LockedChestMouseOverFar(string chestName, int i, int j) + where K : ModItem where C : ModItem + { + LockedChestMouseOver(chestName, i, j); + Player player = Main.LocalPlayer; + if (player.showItemIconText == "") + { + player.showItemIcon = false; + player.showItemIcon2 = 0; + } + } + + /// + /// Extension which initializes a ModTile to be a bathtub. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpBathtub(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(mt.Type); + + // All bathtubs count as tables. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + /// + /// Extension which initializes a ModTile to be a bed. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpBed(this ModTile mt, bool lavaImmune = false) + { + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.HasOutlines[mt.Type] = true; + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 4, 0); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(mt.Type); + + // All beds count as chairs. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + } + + /// + /// Extension which initializes a ModTile to be a bookcase. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + /// Whether this tile is supposed to have a solid top. Defaults to true. + internal static void SetUpBookcase(this ModTile mt, bool lavaImmune = false, bool solidTop = true) + { + Main.tileSolidTop[mt.Type] = solidTop; + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileTable[mt.Type] = solidTop; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All bookcases count as tables. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + /// + /// Extension which initializes a ModTile to be a candelabra. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpCandelabra(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = true; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All candelabras count as light sources. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + } + + /// + /// Extension which initializes a ModTile to be a candle. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpCandle(this ModTile mt, bool lavaImmune = false, int offset = -4) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.StyleOnTable1x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 20 }; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newTile.DrawYOffset = offset; + TileObjectData.addTile(mt.Type); + + // All candles count as light sources. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + } + + /// + /// Extension which initializes a ModTile to be a chair. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpChair(this ModTile mt, bool lavaImmune = false) + { + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(mt.Type); + + // As you could probably guess, all chairs count as chairs. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + } + + /// + /// Extension which initializes a ModTile to be a chandelier. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpChandelier(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All chandeliers count as light sources. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + } + + /// + /// Extension which initializes a ModTile to be a chest. + /// + /// The ModTile which is being initialized. + internal static void SetUpChest(this ModTile mt, bool offset = false) + { + Main.tileSpelunker[mt.Type] = true; + Main.tileContainer[mt.Type] = true; + Main.tileShine2[mt.Type] = true; + Main.tileShine[mt.Type] = 1200; + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileValue[mt.Type] = 500; + TileID.Sets.HasOutlines[mt.Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + if (offset) + TileObjectData.newTile.DrawYOffset = 4; + TileObjectData.newTile.Origin = new Point16(0, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(mt.Type); + } + + /// + /// Extension which initializes a ModTile to be a clock. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpClock(this ModTile mt, bool lavaImmune = false) + { + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + TileID.Sets.HasOutlines[mt.Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX); + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] + { + 16, + 16, + 16, + 16, + 16 + }; + TileObjectData.newTile.Origin = new Point16(0, 4); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + } + + /// + /// Extension which initializes a ModTile to be a closed door. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpDoorClosed(this ModTile mt, bool lavaImmune = false) + { + Main.tileFrameImportant[mt.Type] = true; + Main.tileBlockLight[mt.Type] = true; + Main.tileSolid[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileID.Sets.NotReallySolid[mt.Type] = true; + TileID.Sets.DrawsWalls[mt.Type] = true; + TileID.Sets.HasOutlines[mt.Type] = true; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.addTile(mt.Type); + + // As you could probably guess, all closed doors count as doors. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + } + + /// + /// Extension which initializes a ModTile to be an open door. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpDoorOpen(this ModTile mt, bool lavaImmune = false) + { + Main.tileFrameImportant[mt.Type] = true; + Main.tileSolid[mt.Type] = false; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + Main.tileNoSunLight[mt.Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 0); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceRight; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 1); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(0, 2); + TileObjectData.addAlternate(0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 0); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 1); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Origin = new Point16(1, 2); + TileObjectData.newAlternate.AnchorTop = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.AnchorBottom = new AnchorData(AnchorType.SolidTile, 1, 1); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.addAlternate(1); + TileObjectData.addTile(mt.Type); + TileID.Sets.HousingWalls[mt.Type] = true; + TileID.Sets.HasOutlines[mt.Type] = true; + + // As you could probably guess, all open doors count as doors. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + } + + /// + /// Extension which initializes a ModTile to be a dresser. + /// + /// The ModTile which is being initialized. + internal static void SetUpDresser(this ModTile mt) + { + Main.tileSolidTop[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileTable[mt.Type] = true; + Main.tileContainer[mt.Type] = true; + Main.tileWaterDeath[mt.Type] = false; + Main.tileLavaDeath[mt.Type] = false; + TileID.Sets.HasOutlines[mt.Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Origin = new Point16(1, 1); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.HookCheck = new PlacementHook(new Func(Chest.FindEmptyChest), -1, 0, true); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func(Chest.AfterPlacement_Hook), -1, 0, false); + TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 }; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.addTile(mt.Type); + + // All dressers count as tables. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + /// + /// Extension which initializes a ModTile to be a floor lamp. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpLamp(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1xX); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All floor lamps count as light sources. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + } + + /// + /// Extension which initializes a ModTile to be a hanging lantern. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpLantern(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All hanging lanterns count as light sources. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + } + + /// + /// Extension which initializes a ModTile to be a piano. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpPiano(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.addTile(mt.Type); + + // All pianos count as tables. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + /// + /// Extension which initializes a ModTile to be a platform. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpPlatform(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileSolidTop[mt.Type] = true; + Main.tileSolid[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileTable[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + TileID.Sets.Platforms[mt.Type] = true; + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 27; + TileObjectData.newTile.StyleWrapLimit = 27; + TileObjectData.newTile.UsesCustomCanPlace = false; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All platforms count as doors (so that you may have top-or-bottom entry/exit rooms) + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsDoor); + } + + /// + /// Extension which initializes a ModTile to be a sink. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpSink(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + } + + /// + /// Extension which initializes a ModTile to be a sofa. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpSofa(this ModTile mt, bool lavaImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All sofas count as chairs. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + } + + /// + /// Extension which initializes a ModTile to be a table. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpTable(this ModTile mt, bool lavaImmune = false) + { + Main.tileSolidTop[mt.Type] = true; + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileTable[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // As you could probably guess, all tables count as tables. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + /// + /// Extension which initializes a ModTile to be a torch. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpTorch(this ModTile mt, bool lavaImmune = false, bool waterImmune = false) + { + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileSolid[mt.Type] = false; + Main.tileNoAttach[mt.Type] = true; + Main.tileNoFail[mt.Type] = true; + Main.tileWaterDeath[mt.Type] = !waterImmune; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + TileObjectData.newTile.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newTile.WaterDeath = !waterImmune; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.WaterDeath = false; + TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); + TileObjectData.newAlternate.AnchorAlternateTiles = new int[] { 124 }; + TileObjectData.addAlternate(1); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.WaterDeath = false; + TileObjectData.newAlternate.AnchorRight = new AnchorData(AnchorType.SolidTile | AnchorType.SolidSide | AnchorType.Tree | AnchorType.AlternateTile, TileObjectData.newTile.Height, 0); + TileObjectData.newAlternate.AnchorAlternateTiles = new int[] { 124 }; + TileObjectData.addAlternate(2); + TileObjectData.newAlternate.CopyFrom(TileObjectData.StyleTorch); + TileObjectData.newAlternate.WaterDeath = false; + TileObjectData.newAlternate.AnchorWall = true; + TileObjectData.addAlternate(0); + TileObjectData.addTile(mt.Type); + + // All torches count as light sources. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); + } + + /// + /// Extension which initializes a ModTile to be a work bench. + /// + /// The ModTile which is being initialized. + /// Whether this tile is supposed to be immune to lava. Defaults to false. + internal static void SetUpWorkBench(this ModTile mt, bool lavaImmune = false) + { + Main.tileSolidTop[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileNoAttach[mt.Type] = true; + Main.tileTable[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = !lavaImmune; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.CoordinateHeights = new int[] { 18 }; + TileObjectData.newTile.LavaDeath = !lavaImmune; + TileObjectData.addTile(mt.Type); + + // All work benches count as tables. + mt.AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTable); + } + + /// + /// Extension which initializes a ModTile to be a fountain. + /// + /// The ModTile which is being initialized. + internal static void SetUpFountain(this ModTile mt) + { + //All fountains are immune to lava + Main.tileLighted[mt.Type] = true; + Main.tileFrameImportant[mt.Type] = true; + Main.tileLavaDeath[mt.Type] = false; + Main.tileWaterDeath[mt.Type] = false; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(mt.Type); + TileID.Sets.HasOutlines[mt.Type] = true; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Origin = new Point16(0, 3); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 2, 0); + TileObjectData.addTile(mt.Type); + } + } +} diff --git a/Utilities/GeneralExtensionUtils.cs b/Utilities/GeneralExtensionUtils.cs new file mode 100644 index 0000000000..255c5e6bbc --- /dev/null +++ b/Utilities/GeneralExtensionUtils.cs @@ -0,0 +1,17 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items; +using CalamityMod.NPCs; +using CalamityMod.Projectiles; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); + public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); + public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); + public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); + public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; + } +} diff --git a/Utilities/GenericAIUtils.cs b/Utilities/GenericAIUtils.cs new file mode 100644 index 0000000000..87e8070b90 --- /dev/null +++ b/Utilities/GenericAIUtils.cs @@ -0,0 +1,762 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + // TODO: This does not properly utilize OOP. Destroy this file and convert everything here into a base entity at some point. + public static partial class CalamityUtils + { + public static void SporeSacAI(this Projectile projectile) + { + Player player = Main.player[projectile.owner]; + + float scaleAmt = 1f - (float)projectile.alpha / 255f; + scaleAmt *= projectile.scale; + Lighting.AddLight(projectile.Center, 0.25f * scaleAmt, 0.025f * scaleAmt, 0.275f * scaleAmt); + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] *= -1f; + } + if (projectile.localAI[0] >= 0f) + { + projectile.scale += 0.003f; + } + else + { + projectile.scale -= 0.003f; + } + projectile.rotation += 0.0025f * projectile.scale; + float yVel = 1f; + float xVel = 1f; + if (projectile.identity % 6 == 0) + { + xVel *= -1f; + } + if (projectile.identity % 6 == 1) + { + yVel *= -1f; + } + if (projectile.identity % 6 == 2) + { + xVel *= -1f; + yVel *= -1f; + } + if (projectile.identity % 6 == 3) + { + xVel = 0f; + } + if (projectile.identity % 6 == 4) + { + yVel = 0f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 60f) + { + projectile.localAI[1] = -180f; + } + if (projectile.localAI[1] >= -60f) + { + projectile.velocity.X += 0.002f * xVel; + projectile.velocity.Y += 0.002f * yVel; + } + else + { + projectile.velocity.X -= 0.002f * xVel; + projectile.velocity.Y -= 0.002f * yVel; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5400f) + { + projectile.damage = 0; + projectile.ai[1] = 1f; + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else + { + float playerDist = (projectile.Center - player.Center).Length() / 100f; + if (playerDist > 4f) + { + playerDist *= 1.1f; + } + if (playerDist > 5f) + { + playerDist *= 1.2f; + } + if (playerDist > 6f) + { + playerDist *= 1.3f; + } + if (playerDist > 7f) + { + playerDist *= 1.4f; + } + if (playerDist > 8f) + { + playerDist *= 1.5f; + } + if (playerDist > 9f) + { + playerDist *= 1.6f; + } + if (playerDist > 10f) + { + playerDist *= 1.7f; + } + projectile.ai[0] += playerDist; + if (projectile.alpha > 50) + { + projectile.alpha -= 10; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + } + if (projectile.Calamity().lineColor != 1 || projectile.timeLeft < (3300 + projectile.localAI[0])) + { + bool foundTarget = false; + Vector2 targetPos = new Vector2(0f, 0f); + float maxDist = 600f; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC npc = Main.npc[i]; + if (npc.CanBeChasedBy(projectile, false)) + { + float targetDist = Vector2.Distance(projectile.Center, npc.Center); + if (targetDist < maxDist) + { + targetPos = npc.Center; + foundTarget = true; + break; + } + } + } + if (foundTarget) + { + if (projectile.Calamity().lineColor == 1) + projectile.extraUpdates = 5; + + Vector2 targetVec = targetPos - projectile.Center; + targetVec.Normalize(); + targetVec *= 0.75f; + projectile.velocity = (projectile.velocity * 10f + targetVec) / 11f; + return; + } + } + if (projectile.velocity.Length() > 0.2f) + { + projectile.velocity *= 0.98f; + } + } + + public static void ChargingMinionAI(this Projectile projectile, float range, float maxPlayerDist, float extraMaxPlayerDist, float safeDist, int initialUpdates, float chargeDelayTime, float goToSpeed, float goBackSpeed, Vector2 returnOffset, float chargeCounterMax, float chargeSpeed, bool tileVision, bool ignoreTilesWhenCharging, int updateDifference = 1) + { + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + //Anti sticky movement to prevent stacking + projectile.MinionAntiClump(); + + //Breather time between charges as like a reset + bool chargeDelay = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = initialUpdates + updateDifference; + if (projectile.ai[1] > chargeDelayTime) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = initialUpdates; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + chargeDelay = true; + } + } + if (chargeDelay) + { + return; + } + + //Find a target + float maxDist = range; + Vector2 targetVec = projectile.position; + bool foundTarget = false; + bool isButterfly = projectile.type == ProjectileType(); + //Prioritize the targeted enemy if possible + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; + if (npc.CanBeChasedBy(projectile, false) || fishronCheck) + { + //Check the size of the target to make it easier to hit fat targets like Levi + float extraDist = (npc.width / 2) + (npc.height / 2); + + 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 = true; + if (extraDist < maxDist && !tileVision) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) + { + maxDist = targetDist; + targetVec = npc.Center; + foundTarget = true; + } + } + } + //If no npc is specifically targetted or the selected enemy can't be found, check through the entire array + if (!foundTarget) + { + for (int npcIndex = 0; npcIndex < Main.maxNPCs; npcIndex++) + { + NPC npc = Main.npc[npcIndex]; + bool fishronCheck = npc.type == NPCID.DukeFishron && npc.active && isButterfly; + if (npc.CanBeChasedBy(projectile, false) || fishronCheck) + { + float extraDist = (npc.width / 2) + (npc.height / 2); + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + bool canHit = true; + if (extraDist < maxDist && !tileVision) + canHit = Collision.CanHit(projectile.Center, 1, 1, npc.Center, 1, 1); + if (!foundTarget && targetDist < (maxDist + extraDist) && canHit) + { + maxDist = targetDist; + targetVec = npc.Center; + foundTarget = true; + } + } + } + } + + //If the player is too far, return to the player. Range is increased while attacking something. + float distBeforeForcedReturn = maxPlayerDist; + if (foundTarget) + { + distBeforeForcedReturn = extraMaxPlayerDist; + } + if (Vector2.Distance(player.Center, projectile.Center) > distBeforeForcedReturn) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + + //Go to the target if you found one + if (foundTarget && projectile.ai[0] == 0f) + { + //Some minions don't ignore tiles while charging like brittle stars + projectile.tileCollide = !ignoreTilesWhenCharging; + Vector2 targetSpot = targetVec - projectile.Center; + float targetDist = targetSpot.Length(); + targetSpot.Normalize(); + //Tries to get the minion in the sweet spot of 200 pixels away but the minion also charges so idk what good it does + if (targetDist > 200f) + { + float speed = goToSpeed; //8 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; + } + else + { + float speed = -goBackSpeed; //-4 + targetSpot *= speed; + projectile.velocity = (projectile.velocity * 40f + targetSpot) / 41f; //41 + } + } + + //Movement for idle or returning to the player + else + { + //Ignore tiles so they don't get stuck everywhere like Optic Staff + projectile.tileCollide = false; + + bool returningToPlayer = false; + if (!returningToPlayer) + { + returningToPlayer = projectile.ai[0] == 1f; + } + + //Player distance calculations + Vector2 playerVec = player.Center - projectile.Center + returnOffset; + float playerDist = playerVec.Length(); + + //If the minion is actively returning, move faster + float playerHomeSpeed = 6f; + if (returningToPlayer) + { + playerHomeSpeed = 15f; + } + //Move somewhat faster if the player is kinda far~ish + if (playerDist > 200f && playerHomeSpeed < 8f) + { + playerHomeSpeed = 8f; + } + //Return to normal if close enough to the player + if (playerDist < safeDist && returningToPlayer && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + //Teleport to the player if abnormally far + 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; + } + //If more than 70 pixels away, move toward the player + if (playerDist > 70f) + { + playerVec.Normalize(); + playerVec *= playerHomeSpeed; + projectile.velocity = (projectile.velocity * 40f + playerVec) / 41f; + } + //Minions never stay still + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + + //Increment attack counter randomly + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + //If high enough, prepare to attack + if (projectile.ai[1] > chargeCounterMax) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + + //Charge at an enemy if not on cooldown + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && foundTarget && maxDist < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 targetPos = targetVec - projectile.Center; + targetPos.Normalize(); + projectile.velocity = targetPos * chargeSpeed; //8 + projectile.netUpdate = true; + } + } + } + } + + public static void FloatingPetAI(this Projectile projectile, bool faceRight, float tiltFloat, bool lightPet = false) + { + Player player = Main.player[projectile.owner]; + + //anti sticking movement as a failsafe + float SAImovement = 0.05f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || otherProj.owner != projectile.owner || !Main.projPet[otherProj.type] || k == projectile.whoAmI) + continue; + + // If the other projectile is indeed another pet owned by the same player and they're too close, nudge them away. + bool isPet = Main.projPet[otherProj.type]; + float taxicabDist = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); + if (isPet && taxicabDist < projectile.width) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= SAImovement; + else + projectile.velocity.X += SAImovement; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= SAImovement; + else + projectile.velocity.Y += SAImovement; + } + } + + float passiveMvtFloat = 0.5f; + projectile.tileCollide = false; + float range = 100f; + 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(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + //Light pets lead the player, normal pets trail the player + xDist += 60f * (lightPet ? (float)player.direction : -(float)player.direction); + yDist -= 60f; + Vector2 playerVector = new Vector2(xDist, yDist); + float playerDist = playerVector.Length(); + float returnSpeed = 18f; + + //If player is close enough, resume normal + 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 (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; + } + + if (playerDist < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (playerDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (playerDist > 300f) + { + passiveMvtFloat = 1f; + } + playerDist = returnSpeed / playerDist; + playerVector.X *= playerDist; + playerVector.Y *= playerDist; + } + if (projectile.velocity.X < playerVector.X) + { + projectile.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X += passiveMvtFloat; + } + } + if (projectile.velocity.X > playerVector.X) + { + projectile.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X -= passiveMvtFloat; + } + } + if (projectile.velocity.Y < playerVector.Y) + { + projectile.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y += passiveMvtFloat * 2f; + } + } + if (projectile.velocity.Y > playerVector.Y) + { + projectile.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (projectile.velocity.X >= 0.25f) + { + projectile.direction = faceRight ? 1 : -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.direction = faceRight ? -1 : 1; + } + //Tilting and change directions + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * tiltFloat; + } + + public static void HealingProjectile(this Projectile projectile, int healing, int playerToHeal, float homingVelocity, float N, bool autoHomes = true, int timeCheck = 120) + { + int target = playerToHeal; + Player player = Main.player[target]; + float homingSpeed = homingVelocity; + if (player.lifeMagnet) + homingSpeed *= 1.5f; + + Vector2 playerVector = player.Center - projectile.Center; + float playerDist = playerVector.Length(); + if (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.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech) + { + int healAmt = healing; + player.HealEffect(healAmt, false); + player.statLife += healAmt; + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, target, healAmt, 0f, 0f, 0, 0, 0); + } + projectile.Kill(); + } + if (autoHomes) + { + playerDist = homingSpeed / 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); + } + else if (player.lifeMagnet && projectile.timeLeft < timeCheck) + { + playerDist = homingVelocity / 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); + } + } + + /// + /// Call this function in the ai of your projectile so it can stick to enemies, also requires ModifyHitNPCSticky to be called in ModifyHitNPC + /// + /// The projectile you're adding sticky behaviour to + /// Number of seconds you want a projectile to cling to an NPC + public static void StickyProjAI(this Projectile projectile, int timeLeft, bool findNewNPC = false) + { + if (projectile.ai[0] == 1f) + { + int seconds = timeLeft; + bool killProj = false; + bool spawnDust = false; + + //the projectile follows the NPC, even if it goes into blocks + projectile.tileCollide = false; + + //timer for triggering hit effects + projectile.localAI[0]++; + if (projectile.localAI[0] % 30f == 0f) + { + spawnDust = true; + } + + //So AI knows what NPC it is sticking to + int npcIndex = (int)projectile.ai[1]; + NPC npc = Main.npc[npcIndex]; + + //Kill projectile after so many seconds or if the NPC it is stuck to no longer exists + if (projectile.localAI[0] >= (float)(60 * seconds)) + { + killProj = true; + } + else if (!npcIndex.WithinBounds(Main.maxNPCs)) + { + killProj = true; + } + + else if (npc.active && !npc.dontTakeDamage) + { + //follow the NPC + projectile.Center = npc.Center - projectile.velocity * 2f; + projectile.gfxOffY = npc.gfxOffY; + + //if attached to npc, trigger npc hit effects every half a second + if (spawnDust) + { + npc.HitEffect(0, 1.0); + } + } + else + { + killProj = true; + } + + //Kill the projectile or reset stats if needed + if (killProj) + { + if (findNewNPC) + projectile.ai[0] = 0f; + else + projectile.Kill(); + } + } + } + + /// + /// Call this function in ModifyHitNPC to make your projectiles stick to enemies, needs StickyProjAI to be called in the AI of the projectile + /// + /// The projectile you're giving sticky behaviour to + /// How many projectiles of this type can stick to one enemy + /// Decides if you want the projectile to deal damage while its sticked to enemies or not + public static void ModifyHitNPCSticky(this Projectile projectile, int maxStick, bool constantDamage) + { + Player player = Main.player[projectile.owner]; + Rectangle myRect = projectile.Hitbox; + + 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 && + ((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)) + { + bool stickingToNPC; + //Solar Crawltipede tail has special collision + if (npc.type == NPCID.SolarCrawltipedeTail) + { + Rectangle rect = npc.Hitbox; + int num5 = 8; + rect.X -= num5; + rect.Y -= num5; + rect.Width += num5 * 2; + rect.Height += num5 * 2; + stickingToNPC = projectile.Colliding(myRect, rect); + } + else + { + stickingToNPC = projectile.Colliding(myRect, npc.Hitbox); + } + if (stickingToNPC) + { + //reflect projectile if the npc can reflect it (like Selenians) + if (npc.reflectingProjectiles && projectile.CanReflect()) + { + 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] = (float)npcIndex; + + //follow the NPC + projectile.velocity = (npc.Center - projectile.Center) * 0.75f; + + projectile.netUpdate = true; + + //Set projectile damage to 0 if desired + if (!constantDamage) + projectile.damage = 0; + + //Count how many projectiles are attached, delete as necessary + Point[] array2 = new Point[maxStick]; + int projCount = 0; + 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) + { + array2[projCount++] = new Point(projIndex, proj.timeLeft); + if (projCount >= array2.Length) + { + break; + } + } + } + if (projCount >= array2.Length) + { + int num30 = 0; + for (int m = 1; m < array2.Length; m++) + { + if (array2[m].Y < array2[num30].Y) + { + num30 = m; + } + } + Main.projectile[array2[num30].X].Kill(); + } + } + } + } + } + } + } + + public static void StickToTiles(this Projectile projectile, bool ignorePlatforms, bool stickToEverything) + { + try + { + int xLeft = (int)(projectile.position.X / 16f) - 1; + int xRight = (int)((projectile.position.X + (float)projectile.width) / 16f) + 2; + int yBottom = (int)(projectile.position.Y / 16f) - 1; + int yTop = (int)((projectile.position.Y + (float)projectile.height) / 16f) + 2; + if (xLeft < 0) + { + xLeft = 0; + } + if (xRight > Main.maxTilesX) + { + xRight = Main.maxTilesX; + } + if (yBottom < 0) + { + yBottom = 0; + } + if (yTop > Main.maxTilesY) + { + yTop = Main.maxTilesY; + } + for (int x = xLeft; x < xRight; x++) + { + for (int y = yBottom; y < yTop; y++) + { + Tile tile = Main.tile[x, y]; + bool platformCheck = true; + if (ignorePlatforms) + platformCheck = !TileID.Sets.Platforms[tile.type] && tile.type != 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)) + { + Vector2 tileSize; + tileSize.X = (float)(x * 16); + tileSize.Y = (float)(y * 16); + if (projectile.position.X + (float)projectile.width - 4f > tileSize.X && projectile.position.X + 4f < tileSize.X + 16f && projectile.position.Y + (float)projectile.height - 4f > tileSize.Y && projectile.position.Y + 4f < tileSize.Y + 16f) + { + projectile.velocity.X = 0f; + projectile.velocity.Y = -0.2f; + } + } + } + } + } + catch + { + } + } + } +} diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs new file mode 100644 index 0000000000..00b12acb8e --- /dev/null +++ b/Utilities/ItemUtils.cs @@ -0,0 +1,459 @@ +using CalamityMod.UI.CalamitasEnchants; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + #region Item Rarity Utilities + internal const int TurquoiseRarityValue = 12; + internal static readonly Color TurquoiseRarityColor = new Color(0, 255, 200); + internal const int PureGreenRarityValue = 13; + internal static readonly Color PureGreenRarityColor = new Color(0, 255, 0); + internal const int DarkBlueRarityValue = 14; + internal static readonly Color DarkBlueRarityColor = new Color(43, 96, 222); + internal const int VioletRarityValue = 15; + internal static readonly Color VioletRarityColor = new Color(108, 45, 199); + internal const int HotPinkRarityValue = 16; + internal static readonly Color HotPinkRarityColor = new Color(255, 0, 255); + internal const int RainbowRarityValue = 30; + // The rainbow rarity has an ever-shifting color, not a stored constant + internal const int DraedonRustRarityValue = 33; + internal static readonly Color DraedonRustRarityColor = new Color(204, 71, 35); + // The donator rarity isn't technically a rarity, but is a constant color used in tooltips + internal static readonly Color DonatorItemColor = new Color(139, 0, 0); + // The Challenge Drop rarity isn't technically a rarity, but is a constant color used in tooltips + internal static readonly Color ChallengeDropColor = new Color(255, 140, 0); + + public static readonly CalamityRarity[] postMLRarities = + { + CalamityRarity.Turquoise, + CalamityRarity.PureGreen, + CalamityRarity.DarkBlue, + CalamityRarity.Violet, + CalamityRarity.HotPink + }; + + public static bool IsPostML(this CalamityRarity calrare) + { + for(int i = 0; i < postMLRarities.Length; ++i) + if (postMLRarities[i] == calrare) + return true; + return false; + } + + public static Color? GetRarityColor(CalamityRarity calrare) + { + switch (calrare) + { + default: + return null; + case CalamityRarity.Turquoise: + return TurquoiseRarityColor; + case CalamityRarity.PureGreen: + return PureGreenRarityColor; + case CalamityRarity.DarkBlue: + return DarkBlueRarityColor; + case CalamityRarity.Violet: + return VioletRarityColor; + case CalamityRarity.HotPink: + return HotPinkRarityColor; + + case CalamityRarity.Rainbow: + return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + case CalamityRarity.DraedonRust: + return DraedonRustRarityColor; + } + } + #endregion + + // TODO -- This probably isn't the best place to put this but it needs to be somewhere easily accessible. + #region Accessory Prefix Stats + internal static int GetScalingDefense(int prefixID) + { + switch (prefixID) + { + default: + return 0; + case PrefixID.Hard: + return CalamityWorld.downedDoG ? 4 : CalamityWorld.downedProvidence || CalamityWorld.downedPolterghast ? 3 : NPC.downedMoonlord || NPC.downedGolemBoss ? 2 : 1; + case PrefixID.Guarding: + if (CalamityWorld.downedDoG) + return 8; + else if (CalamityWorld.downedPolterghast) + return 7; + else if (CalamityWorld.downedProvidence) + return 6; + else if (NPC.downedMoonlord) + return 5; + else if (NPC.downedGolemBoss) + return 4; + else if (Main.hardMode) + return 3; + return 2; + case PrefixID.Armored: + if (CalamityWorld.downedDoG) + return 12; + else if (CalamityWorld.downedPolterghast) + return 10; + else if (CalamityWorld.downedProvidence) + return 9; + else if (NPC.downedMoonlord) + return 7; + else if (NPC.downedGolemBoss) + return 6; + else if (Main.hardMode) + return 4; + return 3; + case PrefixID.Warding: + if (CalamityWorld.downedDoG) + return 16; + else if (CalamityWorld.downedPolterghast) + return 14; + else if (CalamityWorld.downedProvidence) + return 12; + else if (NPC.downedMoonlord) + return 10; + else if (NPC.downedGolemBoss) + return 8; + else if (Main.hardMode) + return 6; + return 4; + } + } + #endregion + + /// + /// Converts the given ModHotKey into a string for insertion into item tooltips.

+ /// This allows the user's actual keybind choices to be shown to them in tooltips. + ///
+ /// The ModHotKey to convert to a string. + /// + public static string TooltipHotkeyString(this ModHotKey mhk) + { + if (Main.dedServ || mhk is null) + return ""; + + List keys = mhk.GetAssignedKeys(); + if (keys.Count == 0) + return "[NONE]"; + else + { + StringBuilder sb = new StringBuilder(16); + sb.Append(keys[0]); + + // In almost all cases, this code won't run, because there won't be multiple bindings for the hotkey. But just in case... + for (int i = 1; i < keys.Count; ++i) + sb.Append(" / ").Append(keys[i]); + return sb.ToString(); + } + } + + private const float WorldInsertionOffset = 15f; + /// + /// If the given item is outside the world, force it to be within the world boundaries. + /// + /// The item to possibly relocate. + /// The minimum distance in pixels the item can be from the world boundary. + /// Whether the item was relocated. + public static bool ForceItemIntoWorld(Item item, float desiredDist = WorldInsertionOffset) + { + if (item is null || !item.active) + return false; + + // The world edge needs to be accounted for regardless of the distance chosen as an argument. + float worldEdge = Main.offLimitBorderTiles * 16f; + float dist = worldEdge + desiredDist; + + float maxPosX = Main.maxTilesX * 16f; + float maxPosY = Main.maxTilesY * 16f; + bool moved = false; + if (item.position.X < worldEdge) + { + item.position.X = dist; + moved = true; + } + else if (item.position.X + item.width > maxPosX - worldEdge) + { + item.position.X = maxPosX - item.width - dist; + moved = true; + } + if (item.position.Y < worldEdge) + { + item.position.Y = dist; + moved = true; + } + else if (item.position.Y + item.height > maxPosY - worldEdge) + { + item.position.Y = maxPosY - item.height - dist; + moved = true; + } + return moved; + } + + /// + /// Determines if a given item is enchanted based on Calamitas' special system. + /// + /// The item to check. + public static bool IsEnchanted(this Item item) + { + // If the item is air just immediately return false. + // It will not have a CalamityGlobalItem instance to use and attempting to do anything with it + // would just result in errors. + if (item.IsAir) + return false; + + // If the item is contained in the enchant upgrade result relationship, return true. + if (EnchantmentManager.ItemUpgradeRelationship.ContainsValue(item.type)) + return true; + + return item.Calamity().AppliedEnchantment.HasValue; + } + + public static Rectangle FixSwingHitbox(float hitboxWidth, float hitboxHeight) + { + Player player = Main.player[Main.myPlayer]; + Item item = player.ActiveItem(); + float hitbox_X, hitbox_Y; + float mountOffsetY = player.mount.PlayerOffsetHitbox; + + // Third hitbox shifting values + if (player.itemAnimation < player.itemAnimationMax * 0.333) + { + float shiftX = 10f; + if (hitboxWidth >= 92) + shiftX = 38f; + else if (hitboxWidth >= 64) + shiftX = 28f; + else if (hitboxWidth >= 52) + shiftX = 24f; + else if (hitboxWidth > 32) + shiftX = 14f; + hitbox_X = player.position.X + player.width * 0.5f + (hitboxWidth * 0.5f - shiftX) * player.direction; + hitbox_Y = player.position.Y + 24f + mountOffsetY; + } + + // Second hitbox shifting values + else if (player.itemAnimation < player.itemAnimationMax * 0.666) + { + float shift = 10f; + if (hitboxWidth >= 92) + shift = 38f; + else if (hitboxWidth >= 64) + shift = 28f; + else if (hitboxWidth >= 52) + shift = 24f; + else if (hitboxWidth > 32) + shift = 18f; + hitbox_X = player.position.X + (player.width * 0.5f + (hitboxWidth * 0.5f - shift) * player.direction); + + shift = 10f; + if (hitboxHeight > 64) + shift = 14f; + else if (hitboxHeight > 52) + shift = 12f; + else if (hitboxHeight > 32) + shift = 8f; + + hitbox_Y = player.position.Y + shift + mountOffsetY; + } + + // First hitbox shifting values + else + { + float shift = 6f; + if (hitboxWidth >= 92) + shift = 38f; + else if (hitboxWidth >= 64) + shift = 28f; + else if (hitboxWidth >= 52) + shift = 24f; + else if (hitboxWidth >= 48) + shift = 18f; + else if (hitboxWidth > 32) + shift = 14f; + hitbox_X = player.position.X + player.width * 0.5f - (hitboxWidth * 0.5f - shift) * player.direction; + + shift = 10f; + if (hitboxHeight > 64) + shift = 14f; + else if (hitboxHeight > 52) + shift = 12f; + else if (hitboxHeight > 32) + shift = 10f; + hitbox_Y = player.position.Y + shift + mountOffsetY; + } + + // Inversion due to grav potion + if (player.gravDir == -1f) + { + hitbox_Y = player.position.Y + player.height + (player.position.Y - hitbox_Y); + } + + // Hitbox size adjustments + Rectangle hitbox = new Rectangle((int)hitbox_X, (int)hitbox_Y, 32, 32); + if (item.damage >= 0 && item.type > ItemID.None && !item.noMelee && player.itemAnimation > 0) + { + if (!Main.dedServ) + { + hitbox = new Rectangle((int)hitbox_X, (int)hitbox_Y, (int)hitboxWidth, (int)hitboxHeight); + } + hitbox.Width = (int)(hitbox.Width * item.scale); + hitbox.Height = (int)(hitbox.Height * item.scale); + if (player.direction == -1) + { + hitbox.X -= hitbox.Width; + } + if (player.gravDir == 1f) + { + hitbox.Y -= hitbox.Height; + } + + // Broadsword use style + if (item.useStyle == ItemUseStyleID.SwingThrow) + { + // Third hitbox size adjustments + if (player.itemAnimation < player.itemAnimationMax * 0.333) + { + if (player.direction == -1) + { + hitbox.X -= (int)(hitbox.Width * 1.4 - hitbox.Width); + } + hitbox.Width = (int)(hitbox.Width * 1.4); + hitbox.Y += (int)(hitbox.Height * 0.5 * player.gravDir); + hitbox.Height = (int)(hitbox.Height * 1.1); + } + + // First hitbox size adjustments + else if (player.itemAnimation >= player.itemAnimationMax * 0.666) + { + if (player.direction == 1) + { + hitbox.X -= (int)(hitbox.Width * 1.2); + } + hitbox.Width *= 2; + hitbox.Y -= (int)((hitbox.Height * 1.4 - hitbox.Height) * player.gravDir); + hitbox.Height = (int)(hitbox.Height * 1.4); + } + } + } + return hitbox; + } + + // TODO -- this is not very well understood old boffin code. It should probably be inspected thoroughly and re-documented. + #region Melee Dust Helper + /// + /// Dust helper to spawn dust for an item. Allows you to specify where on the item to spawn the dust, essentially. (ONLY WORKS FOR SWINGING WEAPONS?) + /// + /// The player using the item. + /// The type of dust to use. + /// The chance per frame to spawn the dust (0f-1f) + /// The minimum distance between the player and the dust + /// The maximum distance between the player and the dust + /// The minimum random rotation offset for the dust + /// The maximum random rotation offset for the dust + /// The minimum speed that the dust should travel + /// The maximum speed that the dust should travel + public static Dust MeleeDustHelper(Player player, int dustType, float chancePerFrame, float minDistance, float maxDistance, float minRandRot = -0.2f, float maxRandRot = 0.2f, float minSpeed = 0.9f, float maxSpeed = 1.1f) + { + if (Main.rand.NextFloat(1f) < chancePerFrame) + { + //Calculate values + //distance from player, + //the vector offset from the player center + //the vector between the pos and the player + float distance = Main.rand.NextFloat(minDistance, maxDistance); + Vector2 offset = (player.itemRotation - (MathHelper.PiOver4 * player.direction) + Main.rand.NextFloat(minRandRot, maxRandRot)).ToRotationVector2() * distance * player.direction; + Vector2 pos = player.Center + offset; + Vector2 vec = pos - player.Center; + //spawn the dust + Dust d = Dust.NewDustPerfect(pos, dustType); + //normalise vector and multiply by velocity magnitude + vec.Normalize(); + d.velocity = vec * Main.rand.NextFloat(minSpeed, maxSpeed); + return d; + } + return null; + } + #endregion + + /// + /// Determines if an item can be enchanted by any item at all via Calamitas' enchantment system. + /// + /// The item to check. + public static bool CanBeEnchantedBySomething(this Item item) => EnchantmentManager.EnchantmentList.Any(enchantment => enchantment.ApplyRequirement(item)); + + public static void ConsumeItemViaQuickBuff(Player player, Item item, int buffType, int buffTime, bool reducedPotionSickness) + { + bool showsOver = false; + //Fail if you have the buff + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 0 && hasBuff == buffType) + showsOver = true; + } + //Fail if you have potion sickness + if (player.potionDelay > 0 || player.Calamity().potionTimer > 0) + showsOver = true; + + if (!showsOver) + { + Main.PlaySound(item.UseSound, player.Center); + + double healMult = 1D + + (player.Calamity().coreOfTheBloodGod ? 0.15 : 0) + + (player.Calamity().bloodPactBoost ? 0.5 : 0); + int healAmt = (int)(item.healLife * healMult); + if (CalamityWorld.ironHeart) + healAmt = 0; + if (healAmt > 0 && player.QuickHeal_GetItemToUse() != null) + { + if (player.QuickHeal_GetItemToUse().type != item.type) + healAmt = 0; + } + + player.statLife += healAmt; + player.statMana += item.healMana; + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (item.healMana > 0) + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime, true); + if (Main.myPlayer == player.whoAmI) + { + if (healAmt > 0) + player.HealEffect(healAmt, true); + if (item.healMana > 0) + player.ManaEffect(item.healMana); + } + if (item.potion && healAmt > 0) //Don't inflict Potion Sickness if you don't actually heal + { + int duration = reducedPotionSickness ? 3000 : 3600; + if (player.pStone) + duration = (int)(duration * 0.75); + player.AddBuff(BuffID.PotionSickness, duration); + } + + player.AddBuff(buffType, buffTime); + + --item.stack; + if (item.stack <= 0) + item.TurnToAir(); + Recipe.FindRecipes(); + } + } + } +} diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs new file mode 100644 index 0000000000..bee488ebe1 --- /dev/null +++ b/Utilities/MathematicalUtils.cs @@ -0,0 +1,144 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + + internal static readonly List Directions = new List() + { + new Vector2(-1f, -1f), + new Vector2(1f, -1f), + new Vector2(-1f, 1f), + new Vector2(1f, 1f), + new Vector2(0f, -1f), + new Vector2(-1f, 0f), + new Vector2(0f, 1f), + new Vector2(1f, 0f), + }; + + /// + /// Computes 2-dimensional Perlin Noise, which gives "random" but continuous values. + /// + /// The X position on the map. + /// The Y position on the map. + /// A metric of "instability" of the noise. The higher this is, the more unstable. Lower of bounds of 2-3 are preferable. + /// The seed for the noise. + /// + public static float PerlinNoise2D(float x, float y, int octaves, int seed) + { + float SmoothFunction(float n) => 3f * n * n - 2f * n * n * n; + float NoiseGradient(int s, int noiseX, int noiseY, float xd, float yd) + { + int hash = s; + hash ^= 1619 * noiseX; + hash ^= 31337 * noiseY; + + hash = hash * hash * hash * 60493; + hash = (hash >> 13) ^ hash; + + Vector2 g = Directions[hash & 7]; + + return xd * g.X + yd * g.Y; + } + + int frequency = (int)Math.Pow(2D, octaves); + x *= frequency; + y *= frequency; + + int flooredX = (int)x; + int flooredY = (int)y; + int ceilingX = flooredX + 1; + int ceilingY = flooredY + 1; + float interpolatedX = x - flooredX; + float interpolatedY = y - flooredY; + float interpolatedX2 = interpolatedX - 1; + float interpolatedY2 = interpolatedY - 1; + + float fadeX = SmoothFunction(interpolatedX); + float fadeY = SmoothFunction(interpolatedY); + + float smoothX = MathHelper.Lerp(NoiseGradient(seed, flooredX, flooredY, interpolatedX, interpolatedY), NoiseGradient(seed, ceilingX, flooredY, interpolatedX2, interpolatedY), fadeX); + float smoothY = MathHelper.Lerp(NoiseGradient(seed, flooredX, ceilingY, interpolatedX, interpolatedY2), NoiseGradient(seed, ceilingX, ceilingY, interpolatedX2, interpolatedY2), fadeX); + return MathHelper.Lerp(smoothX, smoothY, fadeY); + } + + /// + /// Computes the Manhattan Distance between two points. This is typically used as a cheaper alternative to Euclidean Distance. + /// + /// The first point. + /// The second point. + public static float ManhattanDistance(this Vector2 a, Vector2 b) => Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y); + + /// + /// Determines the angular distance between two vectors based on dot product comparisons. This method ensures underlying normalization is performed safely. + /// + /// The first vector. + /// The second vector. + public static float AngleBetween(this Vector2 v1, Vector2 v2) => (float)Math.Acos(Vector2.Dot(v1.SafeNormalize(Vector2.Zero), v2.SafeNormalize(Vector2.Zero))); + + // NOTE: A similar function to this one exists in 1.4, but it is not the same underlying function. Check Turn01ToCyclic010 in Utils.cs to see the effect. + + /// + /// Converts a 0-1 bound to a 0-1-0 bump. This function automatically clamps the value to the necessary 0-1 range. + /// + /// The value to convert. + public static float Convert01To010(float value) => (float)Math.Sin(MathHelper.Pi * MathHelper.Clamp(value, 0f, 1f)); + + /// + /// Uses a rewritten horizontal range formula to determine the direction to fire a projectile in order for it to hit a destination. Falls back on a certain value if no such direction can exist. If no fallback is provided, a clamp is used. + /// + /// The starting position of the projectile. + /// The destination for the projectile to land at. + /// The gravity of the projectile. + /// The magnitude + /// The direction to fall back to if the calculations result in any NaNs. If nothing is specified, a clamp is performed to prevent any chance of NaNs at all. + public static Vector2 GetProjectilePhysicsFiringVelocity(Vector2 shootingPosition, Vector2 destination, float gravity, float shootSpeed, Vector2? nanFallback = null) + { + // Ensure that the gravity has the right sign for Terraria's coordinate system. + gravity = -Math.Abs(gravity); + + float horizontalRange = MathHelper.Distance(shootingPosition.X, destination.X); + float fireAngleSine = gravity * horizontalRange / (float)Math.Pow(shootSpeed, 2); + + // Clamp the sine if no fallback is provided. + if (nanFallback is null) + fireAngleSine = MathHelper.Clamp(fireAngleSine, -1f, 1f); + + float fireAngle = (float)Math.Asin(fireAngleSine) * 0.5f; + + // Get out of here if no valid firing angle exists. This can only happen if a fallback does indeed exist. + if (float.IsNaN(fireAngle)) + return nanFallback.Value * shootSpeed; + + Vector2 fireVelocity = new Vector2(0f, -shootSpeed).RotatedBy(fireAngle); + fireVelocity.X *= (destination.X - shootingPosition.X < 0).ToDirectionInt(); + return fireVelocity; + } + + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function. + // Due to its temporary state, this method will not receive an XML documentation comment. + public static Rectangle ClampToWorld(Rectangle tileRectangle) + { + int num = Math.Max(0, Math.Min(tileRectangle.Left, Main.maxTilesX)); + int num2 = Math.Max(0, Math.Min(tileRectangle.Top, Main.maxTilesY)); + int num3 = Math.Max(0, Math.Min(tileRectangle.Right, Main.maxTilesX)); + int num4 = Math.Max(0, Math.Min(tileRectangle.Bottom, Main.maxTilesY)); + return new Rectangle(num, num2, num3 - num, num4 - num2); + } + + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 Utils.cs function. + // Due to its temporary state, this method will not receive an XML documentation comment. + public static Vector2 MoveTowards(this Vector2 currentPosition, Vector2 targetPosition, float maxAmountAllowedToMove) + { + Vector2 v = targetPosition - currentPosition; + if (v.Length() < maxAmountAllowedToMove) + return targetPosition; + + return currentPosition + v.SafeNormalize(Vector2.Zero) * maxAmountAllowedToMove; + } + } +} diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs new file mode 100644 index 0000000000..31d3f21c91 --- /dev/null +++ b/Utilities/MiscUtils.cs @@ -0,0 +1,318 @@ +using CalamityMod.Items.Tools.ClimateChange; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + public static void DisplayLocalizedText(string key, Color? textColor = null) + { + // An attempt to bypass the need for a separate method and runtime/compile-time parameter + // constraints by using nulls for defaults. + if (!textColor.HasValue) + textColor = Color.White; + + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), textColor.Value); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), textColor.Value); + } + + public static T[] ShuffleArray(T[] array, Random rand = null) + { + if (rand is null) + rand = new Random(); + + for (int i = array.Length; i > 0; --i) + { + int j = rand.Next(i); + T tempElement = array[j]; + array[j] = array[i - 1]; + array[i - 1] = tempElement; + } + return array; + } + + public static T[,] ShaveOffEdge(this T[,] array) + { + T[,] result = new T[array.GetLength(0) - 2, array.GetLength(1) - 2]; + for (int i = 0; i < result.GetLength(0); i++) + { + for (int j = 0; j < result.GetLength(1); j++) + { + result[i, j] = array[i + 1, j + 1]; + } + } + return result; + } + + /// + /// Retrieves all the colors from a and returns them as a 2D array. + /// + /// The texture to load. + /// + public static Color[,] GetColorsFromTexture(this Texture2D texture) + { + Color[] alignedColors = new Color[texture.Width * texture.Height]; + texture.GetData(alignedColors); // Fills the color array with all the colors in the texture + + Color[,] colors2D = new Color[texture.Width, texture.Height]; + for (int x = 0; x < texture.Width; x++) + { + for (int y = 0; y < texture.Height; y++) + { + colors2D[x, y] = alignedColors[x + y * texture.Width]; + } + } + return colors2D; + } + + public static string CombineStrings(params object[] args) + { + StringBuilder result = new StringBuilder(1024); + for (int i = 0; i < args.Length; ++i) + { + object o = args[i]; + result.Append(o.ToString()); + result.Append(' '); + } + return result.ToString(); + } + + /// + /// Determines if a list contains an entry of a specific type. Specifically intended to account for derived types. + /// + /// The base type of the collection. + /// The collection. + /// The type to search for. + public static bool ContainsType(this IEnumerable collection, Type type) => collection.Any(entry => entry.GetType() == type.GetType()); + + /// + /// Calculates the sound volume and panning for a sound which is played at the specified location in the game world.
+ /// Note that sound does not play on dedicated servers or during world generation. + ///
+ /// The position the sound is emitting from. If either X or Y is -1, the sound does not fade with distance. + /// Whether the sound is considered ambient, which makes it use the ambient sound slider in the options. Defaults to false. + /// Volume and pan, in that order. Volume is always between 0 and 1. Pan is always between -1 and 1. + public static (float, float) CalculateSoundStats(Vector2 soundPos, bool ambient = false) + { + float volume = 0f; + float pan = 0f; + + if (soundPos.X == -1f || soundPos.Y == -1f) + volume = 1f; + else if (WorldGen.gen || Main.dedServ || Main.netMode == NetmodeID.Server) + volume = 0f; + else + { + float topLeftX = Main.screenPosition.X - Main.screenWidth * 2f; + float topLeftY = Main.screenPosition.Y - Main.screenHeight * 2f; + + // Sounds cannot be heard from more than ~2.5 screens away. + // This rectangle is 5x5 screens centered on the current screen center position. + Rectangle audibleArea = new Rectangle((int)topLeftX, (int)topLeftY, Main.screenWidth * 5, Main.screenHeight * 5); + Rectangle soundHitbox = new Rectangle((int)soundPos.X, (int)soundPos.Y, 1, 1); + Vector2 screenCenter = Main.screenPosition + new Vector2(Main.screenWidth * 0.5f, Main.screenHeight * 0.5f); + if (audibleArea.Intersects(soundHitbox)) + { + pan = (soundPos.X - screenCenter.X) / (Main.screenWidth * 0.5f); + float dist = Vector2.Distance(soundPos, screenCenter); + volume = 1f - (dist / (Main.screenWidth * 1.5f)); + } + } + + pan = MathHelper.Clamp(pan, -1f, 1f); + volume = MathHelper.Clamp(volume, 0f, 1f); + if (ambient) + volume = Main.gameInactive ? 0f : volume * Main.ambientVolume; + else + volume *= Main.soundVolume; + + // This is actually done by vanilla. I guess if the sound volume gets corrupted during gameplay, you can't blast your eardrums out. + volume = MathHelper.Clamp(volume, 0f, 1f); + return (volume, pan); + } + + /// + /// Convenience function to utilize CalculateSoundStats immediately on an existing sound effect.
+ /// This allows updating a looping sound every single frame to have the correct volume and pan, even if the player drags the audio sliders around. + ///
+ /// The SoundEffectInstance which is having its values updated. + /// The position the sound is emitting from. If either X or Y is -1, the sound does not fade with distance. + /// Whether the sound is considered ambient, which makes it use the ambient sound slider in the options. Defaults to false. + public static void ApplySoundStats(ref SoundEffectInstance sfx, Vector2 soundPos, bool ambient = false) + { + if (sfx is null || sfx.IsDisposed) + return; + (sfx.Volume, sfx.Pan) = CalculateSoundStats(soundPos, ambient); + } + + public static void StartRain(bool torrentialTear = false, bool maxSeverity = false) + { + int num = 86400; + int num2 = num / 24; + Main.rainTime = Main.rand.Next(num2 * 8, num); + if (Main.rand.NextBool(3)) + { + Main.rainTime += Main.rand.Next(0, num2); + } + if (Main.rand.NextBool(4)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(5)) + { + Main.rainTime += Main.rand.Next(0, num2 * 2); + } + if (Main.rand.NextBool(6)) + { + Main.rainTime += Main.rand.Next(0, num2 * 3); + } + if (Main.rand.NextBool(7)) + { + Main.rainTime += Main.rand.Next(0, num2 * 4); + } + if (Main.rand.NextBool(8)) + { + Main.rainTime += Main.rand.Next(0, num2 * 5); + } + float num3 = 1f; + if (Main.rand.NextBool(2)) + { + num3 += 0.05f; + } + if (Main.rand.NextBool(3)) + { + num3 += 0.1f; + } + if (Main.rand.NextBool(4)) + { + num3 += 0.15f; + } + if (Main.rand.NextBool(5)) + { + num3 += 0.2f; + } + Main.rainTime = (int)(Main.rainTime * num3); + Main.raining = true; + if (torrentialTear) + TorrentialTear.AdjustRainSeverity(maxSeverity); + CalamityNetcode.SyncWorld(); + } + + public static void StartSandstorm() + { + typeof(Terraria.GameContent.Events.Sandstorm).GetMethod("StartSandstorm", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, null); + } + + public static void StopSandstorm() + { + Terraria.GameContent.Events.Sandstorm.Happening = false; + } + + public static void AddWithCondition(this List list, T type, bool condition) + { + if (condition) + list.Add(type); + } + + public static int SecondsToFrames(int seconds) => seconds * 60; + public static int SecondsToFrames(float seconds) => (int)(seconds * 60); + + /// + /// Call this function to spawn explosion clouds at the specified location. Good for when NPCs or projectiles die and need to explode. + /// + /// The spot to spawn the explosion clouds + /// Number of times it loops to spawn gores + public static void ExplosionGores(Vector2 goreSource, int goreAmt, bool thanatos = false, Vector2 thanatosVelocity = default) + { + Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); + for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + { + float velocityMult = 0.33f; + if (goreIndex < (goreAmt / 3)) + { + velocityMult = 0.66f; + } + if (goreIndex >= (2 * goreAmt / 3)) + { + velocityMult = 1f; + } + Mod mod = ModContent.GetInstance(); + int type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + int smoke = Gore.NewGore(source, default, type, 1f); + Gore gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y += 1f; + type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + smoke = Gore.NewGore(source, default, type, 1f); + gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y += 1f; + type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + smoke = Gore.NewGore(source, default, type, 1f); + gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } + gore.velocity *= velocityMult; + gore.velocity.X += 1f; + gore.velocity.Y -= 1f; + type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64); + smoke = Gore.NewGore(source, default, type, 1f); + gore = Main.gore[smoke]; + if (thanatos) + { + gore.velocity = thanatosVelocity * -0.5f; + } + gore.velocity *= velocityMult; + gore.velocity.X -= 1f; + gore.velocity.Y -= 1f; + } + } + + public static bool WithinBounds(this int index, int cap) => index >= 0 && index < cap; + + /// Clamps the distance between vectors via normalization. + ///
+ /// The starting point. + /// The ending point. + /// The maximum possible distance between the two vectors before they get clamped. + public static void DistanceClamp(ref Vector2 start, ref Vector2 end, float maxDistance) + { + if (Vector2.Distance(end, start) > maxDistance) + { + end = start + Vector2.Normalize(end - start) * maxDistance; + } + } + + public static void ChangeTime(bool changeToDay) + { + Main.time = 0D; + Main.dayTime = changeToDay; + CalamityNetcode.SyncWorld(); + } + } +} diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs new file mode 100644 index 0000000000..0bd6769842 --- /dev/null +++ b/Utilities/NPCDebuffs.cs @@ -0,0 +1,344 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SulphurousSea; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public static partial class NPCStats + { + #region Boss Stats Container Struct + internal partial struct EnemyStats + { + public static SortedDictionary> DebuffImmunities; + }; + #endregion + + #region Stat Retrieval Methods + public static void SetNPCDebuffImmunities(this NPC npc) + { + // Safety check: If for some reason the debuff array is not initialized yet, return and do nothing. + // If the npc is not in the dictionary, return and do nothing. + // Also, can I just say that I hate Sorted Dictionaries and Tuples and want to make something explode? -Ben + var stupidTupleThing = new Tuple(true, new int[] {}); + bool exists = EnemyStats.DebuffImmunities.TryGetValue(npc.type, out stupidTupleThing); + if (npc.modNPC is null || !exists) + return; + + // If the npc is immune to everything, make it immune to everything + if (stupidTupleThing.Item1) + { + for (int k = 0; k < npc.buffImmune.Length; k++) + npc.buffImmune[k] = true; + } + + // Then set debuff vulnerabilities, or immunities if not immune to everything + for (int i = 0; i < stupidTupleThing.Item2.Length; ++i) + npc.buffImmune[stupidTupleThing.Item2[i]] = !stupidTupleThing.Item1; + } + #endregion + + #region Load/Unload + // A static function, called exactly once, which initializes the EnemyStats struct at a predictable time. + // This is necessary to ensure this dictionary is populated as early as possible. + // Any boss not listed in here is only immune to Confusion and Pearl Aura. + internal static void LoadDebuffs() + { + EnemyStats.DebuffImmunities = new SortedDictionary> + { + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + + { NPCID.Plantera, new Tuple(false, new int[] { BuffID.Venom }) }, + { NPCID.PlanterasTentacle, new Tuple(false, new int[] { BuffID.Venom }) }, + + // She resists the cold because of her ice-related abilities. + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { NPCID.MoonLordCore, new Tuple(false, new int[] { ModContent.BuffType() }) }, + { NPCID.MoonLordHand, new Tuple(false, new int[] { ModContent.BuffType() }) }, + { NPCID.MoonLordHead, new Tuple(false, new int[] { ModContent.BuffType() }) }, + { NPCID.MoonLordLeechBlob, new Tuple(false, new int[] { ModContent.BuffType() }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.Electrified }) }, + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.Electrified }) }, + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.Electrified }) }, + + { ModContent.NPCType(), new Tuple(false, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, new int[] { ModContent.BuffType(), ModContent.BuffType() }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.OnFire }) }, + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.OnFire }) }, + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.OnFire }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sulphurEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.sunkenSeaEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.abyssEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.cragEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.astralEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.plagueEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.holyEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + { ModContent.NPCType(), new Tuple(true, new int[] { }) }, + + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.Poisoned, BuffID.Venom }) }, + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.Poisoned, BuffID.Venom }) }, + + { ModContent.NPCType(), new Tuple(false, new int[] { BuffID.Electrified }) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.slimeEnemyImmunities) }, + + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + { ModContent.NPCType(), new Tuple(false, CalamityMod.iceEnemyImmunities) }, + }; + } + + // Destroys the EnemyStats struct to save memory because mod assemblies will not be fully unloaded until TML 1.4. + internal static void UnloadDebuffs() + { + EnemyStats.DebuffImmunities = null; + } + #endregion + } +} diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs new file mode 100644 index 0000000000..416ec2a220 --- /dev/null +++ b/Utilities/NPCStats.cs @@ -0,0 +1,843 @@ +using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.World; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod +{ + public static partial class NPCStats + { + private const double ExpertContactVanillaMultiplier = 2D; + private const double NormalProjectileVanillaMultiplier = 2D; + private const double ExpertProjectileVanillaMultiplier = 4D; + + #region Enemy Stats Container Struct + internal partial struct EnemyStats + { + public static SortedDictionary ExpertDamageMultiplier; + public static SortedDictionary ContactDamageValues; + public static SortedDictionary, int[]> ProjectileDamageValues; + }; + #endregion + + #region Stat Retrieval Methods + public static void GetNPCDamage(this NPC npc) + { + double damageAdjustment = GetExpertDamageMultiplier(npc) * ExpertContactVanillaMultiplier; + + // Safety check: If for some reason the contact damage array is not initialized yet, set the NPC's damage to 1. + bool exists = EnemyStats.ContactDamageValues.TryGetValue(npc.type, out int[] contactDamage); + if (!exists) + npc.damage = 1; + + int normalDamage = contactDamage[0]; + int expertDamage = (int)Math.Round(contactDamage[1] / damageAdjustment); + int revengeanceDamage = (int)Math.Round(contactDamage[2] / damageAdjustment); + int deathDamage = (int)Math.Round(contactDamage[3] / damageAdjustment); + int masterDamage = (int)Math.Round(contactDamage[4] / damageAdjustment); + + // If the assigned value would be -1, don't actually assign it. This allows for conditionally disabling the system. + int damageToUse = CalamityWorld.death ? deathDamage : CalamityWorld.revenge ? revengeanceDamage : Main.expertMode ? expertDamage : normalDamage; + if (CalamityWorld.malice) + damageToUse = (int)Math.Round(damageToUse * CalamityGlobalNPC.MaliceModeDamageMultiplier); + if (damageToUse != -1) + npc.damage = damageToUse; + } + + // Gets the amount of damage a given projectile should do from this NPC. + // Automatically compensates for Terraria's internal spaghetti scaling. + public static int GetProjectileDamage(this NPC npc, int projType) + { + double damageAdjustment = Main.expertMode ? ExpertProjectileVanillaMultiplier : NormalProjectileVanillaMultiplier; + + // Safety check: If for some reason the projectile damage array is not initialized yet, return 1. + bool exists = EnemyStats.ProjectileDamageValues.TryGetValue(new Tuple(npc.type, projType), out int[] projectileDamage); + if (!exists) + return 1; + + int normalDamage = (int)Math.Round(projectileDamage[0] / damageAdjustment); + int expertDamage = (int)Math.Round(projectileDamage[1] / damageAdjustment); + int revengeanceDamage = (int)Math.Round(projectileDamage[2] / damageAdjustment); + int deathDamage = (int)Math.Round(projectileDamage[3] / damageAdjustment); + int masterDamage = (int)Math.Round(projectileDamage[4] / damageAdjustment); + + int damageToUse = CalamityWorld.death ? deathDamage : CalamityWorld.revenge ? revengeanceDamage : Main.expertMode ? expertDamage : normalDamage; + if (CalamityWorld.malice) + damageToUse = (int)Math.Round(damageToUse * CalamityGlobalNPC.MaliceModeDamageMultiplier); + + return damageToUse; + } + + // Gets the amount of damage this projectile should do from a given NPC. + // Automatically compensates for Terraria's internal spaghetti scaling. + public static int GetProjectileDamage(this Projectile projectile, int npcType) + { + double damageAdjustment = Main.expertMode ? ExpertProjectileVanillaMultiplier : NormalProjectileVanillaMultiplier; + + // Safety check: If for some reason the projectile damage array is not initialized yet, return 1. + bool exists = EnemyStats.ProjectileDamageValues.TryGetValue(new Tuple(npcType, projectile.type), out int[] projectileDamage); + if (!exists) + return 1; + + int normalDamage = (int)Math.Round(projectileDamage[0] / damageAdjustment); + int expertDamage = (int)Math.Round(projectileDamage[1] / damageAdjustment); + int revengeanceDamage = (int)Math.Round(projectileDamage[2] / damageAdjustment); + int deathDamage = (int)Math.Round(projectileDamage[3] / damageAdjustment); + int masterDamage = (int)Math.Round(projectileDamage[4] / damageAdjustment); + + int damageToUse = CalamityWorld.death ? deathDamage : CalamityWorld.revenge ? revengeanceDamage : Main.expertMode ? expertDamage : normalDamage; + if (CalamityWorld.malice) + damageToUse = (int)Math.Round(damageToUse * CalamityGlobalNPC.MaliceModeDamageMultiplier); + + return damageToUse; + } + + // Gets the raw amount of damage a projectile should do from this NPC. + // That is, this doesn't adjust the value to compensate for Terraria's internal spaghetti scaling. + public static int GetProjectileDamageNoScaling(this NPC npc, int projType) + { + bool exists = EnemyStats.ProjectileDamageValues.TryGetValue(new Tuple(npc.type, projType), out int[] projectileDamage); + return !exists ? 1 // Base case for safety, in case the array is not initialized yet. + : (CalamityWorld.death || CalamityWorld.malice) ? projectileDamage[3] + : CalamityWorld.revenge ? projectileDamage[2] + : Main.expertMode ? projectileDamage[1] + : projectileDamage[0]; + } + + /// + /// Gets the Expert/Master Mode damage multiplier for the specified boss NPC. + /// Useful for determining the base damage a boss NPC should have prior to being run through the Expert/Master scaling code. + /// + /// The NPC you want to get the damage multiplier for + /// Whether Master Mode is enabled or not + /// + public static double GetExpertDamageMultiplier(this NPC npc, bool? master = null) + { + bool exists = EnemyStats.ExpertDamageMultiplier.TryGetValue(npc.type, out double damageMult); + return exists ? damageMult : 1D; + } + #endregion + + #region Load/Unload + internal static void Load() + { + LoadEnemyStats(); + LoadDebuffs(); + } + internal static void Unload() + { + UnloadEnemyStats(); + UnloadDebuffs(); + } + + // A static function, called exactly once, which initializes the EnemyStats struct at a predictable time. + // This is necessary to ensure this dictionary is populated as early as possible. + internal static void LoadEnemyStats() + { + EnemyStats.ExpertDamageMultiplier = new SortedDictionary + { + { NPCID.KingSlime, 0.8 }, + + { ModContent.NPCType(), 1.1 }, + + { ModContent.NPCType(), 0.8 }, + + { NPCID.EaterofWorldsHead, 1.1 }, + { NPCID.EaterofWorldsBody, 0.8 }, + { NPCID.EaterofWorldsTail, 0.8 }, + + { NPCID.BrainofCthulhu, 0.9 }, + + { ModContent.NPCType(), 0.9 }, + { ModContent.NPCType(), 0.9 }, + + { ModContent.NPCType(), 0.9 }, + + { NPCID.QueenBee, 0.9 }, + { NPCID.Bee, 0.6 }, + { NPCID.BeeSmall, 0.6 }, + + { NPCID.SkeletronHead, 1.1 }, + { NPCID.SkeletronHand, 1.1 }, + + { NPCID.WallofFlesh, 1.5 }, + { NPCID.WallofFleshEye, 1.5 }, + + { ModContent.NPCType(), 1.15 }, + + { NPCID.Spazmatism, 0.85 }, + { NPCID.Retinazer, 0.85 }, + + { ModContent.NPCType(), 1.1 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { NPCID.TheDestroyer, 2 }, + { NPCID.TheDestroyerBody, 0.85 }, + { NPCID.TheDestroyerTail, 0.85 }, + + { ModContent.NPCType(), 0.8 }, + + { NPCID.SkeletronPrime, 0.85 }, + { NPCID.PrimeCannon, 0.85 }, + { NPCID.PrimeLaser, 0.85 }, + { NPCID.PrimeSaw, 0.85 }, + { NPCID.PrimeVice, 0.85 }, + + { ModContent.NPCType(), 0.8 }, + + { NPCID.Plantera, 1.15 }, + { NPCID.PlanterasTentacle, 1.15 }, + + { ModContent.NPCType(), 1.2 }, + { ModContent.NPCType(), 0.8 }, + { NPCID.DetonatingBubble, 0.75 }, + + { ModContent.NPCType(), 1.1 }, + + { NPCID.Golem, 0.8 }, + { NPCID.GolemHead, 0.8 }, + { NPCID.GolemFistLeft, 0.8 }, + { NPCID.GolemFistRight, 0.8 }, + + { ModContent.NPCType(), 0.9 }, + + { NPCID.DukeFishron, 0.7 }, + { NPCID.Sharkron, 0.75 }, + { NPCID.Sharkron2, 0.75 }, + + { ModContent.NPCType(), 0.8 }, + + { NPCID.CultistDragonHead, 0.75 }, + { NPCID.CultistDragonBody1, 0.75 }, + { NPCID.CultistDragonBody2, 0.75 }, + { NPCID.CultistDragonBody3, 0.75 }, + { NPCID.CultistDragonBody4, 0.75 }, + { NPCID.CultistDragonTail, 0.75 }, + { NPCID.AncientDoom, 0.75 }, + { NPCID.AncientLight, 0.75 }, + + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.9 }, + + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.7 }, + { ModContent.NPCType(), 0.75 }, + { ModContent.NPCType(), 0.75 }, + + { ModContent.NPCType(), 0.85 }, + { ModContent.NPCType(), 0.85 }, + { ModContent.NPCType(), 0.85 }, + { ModContent.NPCType(), 0.85 }, + + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, + + { ModContent.NPCType(), 0.8 } + }; + + EnemyStats.ContactDamageValues = new SortedDictionary + { + { NPCID.KingSlime, new int[] { 40, 64, 80, 88, 96 } }, + + { ModContent.NPCType(), new int[] { 30, 66, 88, 99, 132 } }, + { ModContent.NPCType(), new int[] { 16, 32, 40, 44, 60 } }, + { ModContent.NPCType(), new int[] { 12, 24, 30, 32, 42 } }, + { ModContent.NPCType(), new int[] { 20, 44, 60, 70, 90 } }, + { ModContent.NPCType(), new int[] { 14, 28, 32, 36, 45 } }, + { ModContent.NPCType(), new int[] { 8, 16, 20, 24, 30 } }, + { ModContent.NPCType(), new int[] { 14, 28, 36, 40, 51 } }, + { ModContent.NPCType(), new int[] { 8, 16, 20, 24, 30 } }, + { ModContent.NPCType(), new int[] { 6, 12, 16, 18, 24 } }, + + { NPCID.EyeofCthulhu, new int[] { + 15, // 23 in phase 2 + 30, // 36 in phase 2, 40 in phase 3 + 40, // 48 in phase 2, 56 in phase 3 + 60, // Same for all phases + 51 } }, // Vanilla: 54 in phase 2, 60 in phase 3; Rev: 61 in phase 2, 71 in phase 3; Death: 71 at all times + { NPCID.ServantofCthulhu, new int[] { 12, 24, 30, 34, 42 } }, + + { ModContent.NPCType(), new int[] { 40, 64, 80, 88, 120 } }, + { ModContent.NPCType(), new int[] { 25, 50, 62, 70, 75 } }, + + { NPCID.EaterofWorldsHead, new int[] { 25, 55, 77, 88, 132 } }, + { NPCID.EaterofWorldsBody, new int[] { 15, 24, 32, 40, 60 } }, + { NPCID.EaterofWorldsTail, new int[] { 10, 16, 24, 32, 42 } }, + { NPCID.VileSpit, new int[] { -1, 64, 64, 64, 96 } }, + + { NPCID.BrainofCthulhu, new int[] { 30, 54, 81, 99, 135 } }, + { NPCID.Creeper, new int[] { 20, 36, 54, 72, 90 } }, + + { ModContent.NPCType(), new int[] { 20, 36, 45, 54, 81 } }, + { ModContent.NPCType(), new int[] { 35, 63, 81, 90, 135 } }, + { ModContent.NPCType(), new int[] { 25, 50, 62, 68, 90 } }, + + { ModContent.NPCType(), new int[] { 30, 54, 63, 72, 108 } }, + { ModContent.NPCType(), new int[] { 45, 90, 108, 118, 150 } }, + { ModContent.NPCType(), new int[] { 24, 48, 56, 60, 75 } }, + { ModContent.NPCType(), new int[] { 18, 36, 42, 46, 60 } }, + { ModContent.NPCType(), new int[] { 35, 70, 84, 92, 126 } }, + { ModContent.NPCType(), new int[] { 21, 42, 50, 54, 69 } }, + { ModContent.NPCType(), new int[] { 14, 28, 34, 38, 54 } }, + { ModContent.NPCType(), new int[] { 30, 60, 72, 80, 102 } }, + { ModContent.NPCType(), new int[] { 18, 36, 42, 46, 60 } }, + { ModContent.NPCType(), new int[] { 10, 20, 26, 30, 45 } }, + + { NPCID.QueenBee, new int[] { 30, 54, 81, 99, 135 } }, + { NPCID.Bee, new int[] { 20, 24, 30, 36, 54 } }, + { NPCID.BeeSmall, new int[] { 15, 18, 24, 30, 45 } }, + + { NPCID.SkeletronHead, new int[] { + 35, // Same for all phases + 77, // 100 while spinning + 88, // 114 while spinning + 99, // 128 while spinning + 132 } }, // 171 while spinning + { NPCID.SkeletronHand, new int[] { 20, 44, 55, 66, 99 } }, + { NPCID.ChaosBall, new int[] { -1, -1, -1, 40, 60 } }, + + { ModContent.NPCType(), new int[] { 40, 80, 96, 104, 135 } }, + { ModContent.NPCType(), new int[] { 45, 90, 108, 118, 150 } }, + { ModContent.NPCType(), new int[] { 40, 80, 96, 104, 135 } }, + { ModContent.NPCType(), new int[] { 50, 100, 120, 130, 171 } }, + { ModContent.NPCType(), new int[] { 45, 90, 108, 118, 150 } }, + { ModContent.NPCType(), new int[] { 30, 60, 72, 78, 99 } }, + { ModContent.NPCType(), new int[] { 20, 40, 48, 52, 66 } }, + { ModContent.NPCType(), new int[] { 35, 70, 84, 92, 120 } }, + { ModContent.NPCType(), new int[] { 25, 50, 60, 66, 84 } }, + + { NPCID.WallofFlesh, new int[] { 50, 150, 180, 195, 225 } }, + { NPCID.WallofFleshEye, new int[] { 50, 150, 180, 195, 225 } }, + { NPCID.TheHungry, new int[] { + 30, // Ranges from 30 to 75 depending on WoF life + 60, // Ranges from 60 to 150 depending on WoF life + 60, // Ranges from 60 to 150 depending on WoF life + 60, // Ranges from 60 to 150 depending on WoF life + 90 } }, // Ranges from 90 to 225 depending on WoF life + { NPCID.TheHungryII, new int[] { 30, 60, 74, 80, 90 } }, + { NPCID.LeechHead, new int[] { 26, 52, 62, 68, 78 } }, + { NPCID.LeechBody, new int[] { 22, 44, 52, 56, 66 } }, + { NPCID.LeechTail, new int[] { 18, 36, 42, 44, 54 } }, + + { ModContent.NPCType(), new int[] { 50, 115, 138, 161, 207 } }, + { ModContent.NPCType(), new int[] { 50, 100, 120, 134, 150 } }, + { ModContent.NPCType(), new int[] { 35, 70, 84, 92, 105 } }, + { ModContent.NPCType(), new int[] { 40, 80, 96, 106, 120 } }, + { ModContent.NPCType(), new int[] { 40, 80, 96, 106, 120 } }, + + { NPCID.Spazmatism, new int[] { + 60, // 90 in phase 2 + 102, // 153 in phase 2 + 119, // 178 in phase 2 + 136, // 204 in phase 2 + 204 } }, // 306 in phase 2 + { NPCID.Retinazer, new int[] { + 50, // 75 in phase 2 + 85, // 127 in phase 2 + 102, // 153 in phase 2 + 119, // 178 in phase 2 + 153 } }, // 229 in phase 2 + + { ModContent.NPCType(), new int[] { 80, 176, 187, 198, 264 } }, + { ModContent.NPCType(), new int[] { 65, 104, 128, 136, 168 } }, + { ModContent.NPCType(), new int[] { 55, 88, 112, 120, 144 } }, + { ModContent.NPCType(), new int[] { 45, 72, 96, 104, 120 } }, + + { NPCID.TheDestroyer, new int[] { 70, 280, 320, 340, 420 } }, + { NPCID.TheDestroyerBody, new int[] { 60, 102, 119, 136, 204 } }, + { NPCID.TheDestroyerTail, new int[] { 40, 68, 85, 102, 153 } }, + + { ModContent.NPCType(), new int[] { 60, 96, 120, 136, 180 } }, + + { NPCID.SkeletronPrime, new int[] { + 50, // 100 while spinning + 85, // 170 while spinning + 102, // 204 while spinning + 119, // 238 while spinning + 153 } }, // 306 while spinning + { NPCID.PrimeVice, new int[] { 60, 102, 119, 136, 204 } }, + { NPCID.PrimeSaw, new int[] { 60, 102, 119, 136, 204 } }, + { NPCID.PrimeCannon, new int[] { 30, 51, 68, 85, 102 } }, + { NPCID.PrimeLaser, new int[] { 30, 51, 68, 85, 102 } }, + + { ModContent.NPCType(), new int[] { 70, 112, 128, 136, 168 } }, + { ModContent.NPCType(), new int[] { 60, 120, 138, 148, 198 } }, + { ModContent.NPCType(), new int[] { 65, 130, 150, 162, 216 } }, + + { NPCID.Plantera, new int[] { + 50, // 70 in phase 2, vanilla is retarded and doesn't use the expert multiplier for plantera's damage + 100, // 140 in phase 2, vanilla is retarded and doesn't use the expert multiplier for plantera's damage + 138, // 193 in phase 2 + 161, // 225 in phase 2 + 207 } }, // Vanilla: Is retarded, so plantera does 150 in phase 1 and 210 in phase 2; Rev and Death: 289 in phase 2 + { NPCID.PlanterasTentacle, new int[] { 60, 138, 161, 207, 276 } }, + { NPCID.Spore, new int[] { 70, 140, 160, 170, 210 } }, + + { ModContent.NPCType(), new int[] { 90, 216, 240, 252, 324 } }, + { ModContent.NPCType(), new int[] { + 70, // 105 during charge + 112, // 168 during charge + 136, // 204 during charge + 144, // 216 during charge + 192 } }, // 288 during charge + { ModContent.NPCType(), new int[] { 55, 110, 126, 136, 165 } }, + { NPCID.DetonatingBubble, new int[] { 100, 150, 180, 195, 225 } }, + { ModContent.NPCType(), new int[] { 55, 110, 126, 136, 165 } }, + { ModContent.NPCType(), new int[] { 50, 100, 116, 128, 150 } }, + + { ModContent.NPCType(), new int[] { 80, 176, 198, 209, 264 } }, + { ModContent.NPCType(), new int[] { 65, 130, 150, 180, 240 } }, + + { NPCID.Golem, new int[] { 90, 144, 176, 192, 240 } }, + { NPCID.GolemHead, new int[] { 80, 128, 144, 160, 192 } }, + { NPCID.GolemFistLeft, new int[] { 70, 112, 144, 160, 180 } }, + { NPCID.GolemFistRight, new int[] { 70, 112, 144, 160, 180 } }, + + { ModContent.NPCType(), new int[] { 100, 180, 216, 234, 297 } }, + { ModContent.NPCType(), new int[] { 70, 140, 160, 170, 240 } }, + { ModContent.NPCType(), new int[] { 90, 180, 210, 224, 270 } }, + { ModContent.NPCType(), new int[] { 100, 200, 240, 260, 330 } }, + { ModContent.NPCType(), new int[] { 60, 120, 140, 150, 195 } }, + { ModContent.NPCType(), new int[] { 65, 130, 150, 160, 210 } }, + + { NPCID.DukeFishron, new int[] { + 100, // 120 in phase 2 + 140, // 201 in phase 2, 184 in phase 3 + 168, // 241 in phase 2, 221 in phase 3 + 182, // 262 in phase 2, 240 in phase 3 + 210 } }, // 302 in phase 2, 277 in phase 3 + { NPCID.Sharkron, new int[] { 100, 150, 180, 195, 225 } }, + { NPCID.Sharkron2, new int[] { 120, 180, 210, 225, 270 } }, + + { ModContent.NPCType(), new int[] { 120, 192, 224, 232, 288 } }, + { ModContent.NPCType(), new int[] { 80, 160, 180, 200, 240 } }, + { ModContent.NPCType(), new int[] { 80, 160, 180, 200, 240 } }, + { ModContent.NPCType(), new int[] { 120, 192, 224, 232, 288 } }, + { ModContent.NPCType(), new int[] { 100, 160, 192, 200, 216 } }, + + { NPCID.CultistDragonHead, new int[] { 120, 180, 210, 225, 270 } }, + { NPCID.CultistDragonBody1, new int[] { 60, 90, 105, 120, 135 } }, + { NPCID.CultistDragonBody2, new int[] { 60, 90, 105, 120, 135 } }, + { NPCID.CultistDragonBody3, new int[] { 60, 90, 105, 120, 135 } }, + { NPCID.CultistDragonBody4, new int[] { 60, 90, 105, 120, 135 } }, + { NPCID.CultistDragonTail, new int[] { 60, 90, 105, 120, 135 } }, + { NPCID.AncientCultistSquidhead, new int[] { 90, 180, 210, 225, 270 } }, + { NPCID.AncientDoom, new int[] { 30, 45, 0, 0, 90 } }, // Vanilla: 90 in Master Mode; Rev and Death: 0 in Master Mode + { NPCID.AncientLight, new int[] { 120, 180, 210, 225, 270 } }, + + { ModContent.NPCType(), new int[] { 120, 240, 268, 280, 360 } }, + { ModContent.NPCType(), new int[] { 100, 160, 192, 200, 240 } }, + { ModContent.NPCType(), new int[] { 80, 128, 160, 168, 192 } }, + + { ModContent.NPCType(), new int[] { 140, 224, 256, 280, 336 } }, + { ModContent.NPCType(), new int[] { 110, 176, 200, 216, 264 } }, + { ModContent.NPCType(), new int[] { 90, 144, 168, 184, 216 } }, + + { ModContent.NPCType(), new int[] { 160, 256, 288, 304, 384 } }, + { ModContent.NPCType(), new int[] { 110, 220, 242, 256, 330 } }, + + { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 336 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 270 } }, + + { ModContent.NPCType(), new int[] { 150, 300, 330, 348, 450 } }, + { ModContent.NPCType(), new int[] { 120, 240, 264, 278, 360 } }, + + { ModContent.NPCType(), new int[] { 140, 280, 308, 324, 420 } }, + { ModContent.NPCType(), new int[] { 100, 160, 192, 208, 300 } }, + { ModContent.NPCType(), new int[] { 80, 128, 160, 176, 240 } }, + { ModContent.NPCType(), new int[] { 180, 360, 396, 418, 540 } }, + { ModContent.NPCType(), new int[] { 120, 192, 224, 250, 330 } }, + { ModContent.NPCType(), new int[] { 100, 160, 192, 210, 270 } }, + + { ModContent.NPCType(), new int[] { 175, 315, 351, 369, 459 } }, + { ModContent.NPCType(), new int[] { 110, 220, 242, 256, 336 } }, + { ModContent.NPCType(), new int[] { 140, 280, 300, 320, 390 } }, + + { ModContent.NPCType(), new int[] { + 150, // 180 in phase 2, 210 in phase 3 + 240, // 288 in phase 2, 336 in phase 3 + 264, // 316 in phase 2, 369 in phase 3 + 280, // 336 in phase 2, 392 in phase 3 + 384 } }, // 460 in phase 2, 537 in phase 3 + { ModContent.NPCType(), new int[] { 210, 336, 360, 392, 528 } }, + + { ModContent.NPCType(), new int[] { + 160, // 192 in phase 2, 208 in phase 3 + 224, // 268 in phase 2, 291 in phase 3 + 280, // 336 in phase 2, 364 in phase 3 + 294, // 352 in phase 2, 382 in phase 3 + 378 } }, // 453 in phase 2, 491 in phase 3 + { ModContent.NPCType(), new int[] { 180, 270, 300, 315, 405 } }, + { ModContent.NPCType(), new int[] { 180, 270, 300, 315, 405 } }, + + { ModContent.NPCType(), new int[] { 300, 600, 650, 680, 760 } }, + { ModContent.NPCType(), new int[] { 180, 306, 340, 357, 510 } }, + { ModContent.NPCType(), new int[] { 150, 255, 289, 306, 408 } }, + { ModContent.NPCType(), new int[] { 350, 700, 750, 780, 880 } }, + { ModContent.NPCType(), new int[] { 220, 374, 425, 442, 561 } }, + { ModContent.NPCType(), new int[] { 180, 306, 340, 357, 459 } }, + { ModContent.NPCType(), new int[] { 180, 360, 396, 420, 510 } }, + { ModContent.NPCType(), new int[] { 130, 260, 290, 320, 420 } }, + { ModContent.NPCType(), new int[] { 100, 200, 230, 260, 330 } }, + + { ModContent.NPCType(), new int[] { 330, 528, 560, 576, 690 } }, + { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, + { ModContent.NPCType(), new int[] { 220, 440, 462, 476, 540 } }, + + { ModContent.NPCType(), new int[] { 350, 560, 592, 608, 768 } }, + + { ModContent.NPCType(), new int[] { 350, 560, 592, 608, 768 } }, + { ModContent.NPCType(), new int[] { 330, 528, 560, 576, 690 } }, + + { ModContent.NPCType(), new int[] { 400, 640, 680, 704, 864 } }, + { ModContent.NPCType(), new int[] { 330, 528, 560, 576, 690 } }, + { ModContent.NPCType(), new int[] { 330, 528, 560, 576, 690 } }, + { ModContent.NPCType(), new int[] { 260, 416, 446, 464, 570 } }, + + { ModContent.NPCType(), new int[] { 400, 800, 850, 880, 1000 } } + }; + + EnemyStats.ProjectileDamageValues = new SortedDictionary, int[]> + { + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 48, 66 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 44, 60, 68, 90 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 40, 80, 96, 108, 144 } }, + + { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 32, 48, 60, 68, 90 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 68, 90 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 68, 90 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 76, 102 } }, + + { new Tuple(NPCID.QueenBee, ProjectileID.Stinger), new int[] { 22, 44, 64, 72, 96 } }, // 66 damage in non-rev master mode + + { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 68, 84, 92, 126 } }, // 102 damage in non-rev master mode + { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 40, 60, 76, 84, 114 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 96, 116, 128, 174 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 54, 88, 108, 116, 162 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 92, 126 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 96, 116, 128, 174 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 54, 88, 108, 116, 162 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 84, 114 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 54, 88, 104, 112, 156 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 74, 102 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 48, 80, 100, 108, 150 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 68, 90 } }, + + { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { + 22, // 22 to 30, depending on life + 44, // 44 to 60, depending on life + 68, + 76, + 102 } }, // 66 to 90, depending on life + { new Tuple(NPCID.WallofFleshEye, ProjectileID.DeathLaser), new int[] { 40, 72, 88, 96, 132 } }, + { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 40, 72, 88, 96, 132 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 46, 80, 96, 108, 144 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 58, 100, 120, 132, 180 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 124, 168 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 46, 80, 96, 108, 144 } }, + + { new Tuple(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 76, 92, 100, 138 } }, // 114 damage in non-rev master mode + { new Tuple(NPCID.Retinazer, ProjectileID.DeathLaser), new int[] { + 50, // 36 in rapid fire + 92, // 68 in rapid fire + 112, // 84 in rapid fire + 124, // 92 in rapid fire + 168 } }, // 126 in rapid fire; 138 in non-rev master mode, 102 in rapid fire in non-rev master mode + { new Tuple(NPCID.Retinazer, ModContent.ProjectileType()), new int[] { 66, 96, 120, 132, 180 } }, + { new Tuple(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 88, 108, 120, 162 } }, // 132 in non-rev master mode + { new Tuple(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 108, 0, 0, 162 } }, // Only used in non-rev modes + { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 108, 132, 144, 198 } }, + { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 56, 100, 124, 136, 186 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 56, 92, 116, 128, 174 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 66, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 132, 180 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 56, 92, 116, 128, 174 } }, + + { new Tuple(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 72, 108, 116, 162 } }, // 108 in non-rev master mode + { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 46, 76, 112, 120, 168 } }, + { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 48, 80, 116, 124, 174 } }, + { new Tuple(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 92, 100, 138 } }, // 132 in non-rev master mode + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 108, 116, 162 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 108, 116, 162 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 184, 200, 276 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + + { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 44, 88, 112, 124, 168 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 54, 108, 132, 144, 198 } }, + { new Tuple(NPCID.SkeletronPrime, ProjectileID.SaucerMissile), new int[] { 54, 108, 132, 144, 198 } }, + { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 54, 108, 132, 144, 198 } }, + { new Tuple(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 240 } }, + { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 100, 124, 136, 186 } }, // 150 in non-rev master mode + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { + 70, // 52 in rapid fire + 112, // 84 in rapid fire + 128, // 96 in rapid fire + 140, // 104 in rapid fire + 192 } }, // 144 in rapid fire + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 136, 156, 168, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 136, 156, 168, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 136, 156, 168, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 76, 120, 140, 152, 210 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 72, 116, 136, 144, 204 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 108, 116, 162 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.PinkLaser), new int[] { 50, 88, 88, 88, 132 } }, + + { new Tuple(NPCID.Plantera, ProjectileID.SeedPlantera), new int[] { 44, 76, 96, 108, 144 } }, // 114 in non-rev master mode + { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 54, 96, 120, 132, 180 } }, // 144 in non-rev master mode + { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 62, 108, 136, 148, 204 } }, // 162 in non-rev master mode + { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 64, 104, 140, 152, 210 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 140, 160, 172, 252 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 72, 116, 136, 144, 204 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 72, 116, 136, 144, 204 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 72, 116, 136, 144, 204 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 74, 128, 148, 160, 222 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 172, 240 } }, + + { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 58, 116, 148, 160, 222 } }, + { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 56, 112, 140, 152, 210 } }, + { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { + 36, // 36 to 58 depending on life + 72, // 72 to 116 depending on life + 148, + 160, + 222 } }, // 108 to 174 depending on life in non-rev master mode + { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 56, 112, 140, 152, 210 } }, // 168 in non-rev master mode + { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { + 36, // 36 to 58 depending on life + 72, // 72 to 116 depending on life + 148, + 160, + 222 } }, // 108 to 174 depending on life in non-rev master mode + { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 56, 112, 140, 152, 210 } }, // 168 in non-rev master mode + { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 64, 128, 160, 176, 240 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 136, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 136, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 240, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 104, 120, 136, 180 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 168, 180, 252 } }, + + { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 116, 124, 174 } }, // 150 in non-rev master mode + { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 248, 348 } }, // 300 in non-rev master mode + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 136, 160, 180, 240 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 188, 258 } }, + + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossFireBall), new int[] { 60, 80, 160, 180, 240 } }, // 80 in non-rev master mode + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossIceMist), new int[] { 70, 100, 172, 188, 258 } }, // 100 in non-rev master mode + { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossLightningOrb), new int[] { 90, 120, 208, 224, 312 } }, // 120 in non-rev master mode + { new Tuple(NPCID.CultistBossClone, ProjectileID.CultistBossFireBallClone), new int[] { 36, 72, 144, 164, 216 } }, // 72 in non-rev master mode + { new Tuple(NPCID.AncientDoom, ProjectileID.AncientDoomProjectile), new int[] { 60, 180, 200, 220, 300 } }, // 402 in non-rev master mode + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 152, 176, 188, 264 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 224, 312 } }, + + { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalDeathray), new int[] { 150, 300, 380, 420, 570 } }, // 450 in non-rev master mode + { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalBolt), new int[] { 60, 120, 160, 176, 240 } }, // 180 in non-rev master mode + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalEye), new int[] { 60, 120, 160, 176, 240 } }, // 180 in non-rev master mode + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalSphere), new int[] { 100, 200, 260, 284, 390 } }, // 300 in non-rev master mode + { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalBolt), new int[] { 60, 120, 160, 176, 240 } }, // 180 in non-rev master mode + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalBolt), new int[] { 70, 140, 180, 200, 270 } }, // 210 in non-rev master mode + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalEye), new int[] { 70, 140, 180, 200, 270 } }, // 210 in non-rev master mode + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalSphere), new int[] { 110, 220, 260, 284, 390 } }, // 330 in non-rev master mode + { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 100, 200, 260, 284, 390 } }, // 300 in non-rev master mode + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 220, 232, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 220, 232, 330 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 220, 232, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 356, 498 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 130, 208, 228, 240, 342 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { -100, -150, -180, -200, -250 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 110, 168, 196, 208, 294 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 110, 168, 196, 208, 294 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 236, 330 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 130, 208, 228, 240, 342 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 264, 378 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 400, 440, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 220, 232, 330 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 232, 248, 348 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 232, 248, 348 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 232, 248, 348 } }, + + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 300, 432 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 300, 432 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 212, 224, 318 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 212, 224, 318 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 130, 212, 236, 248, 354 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 280, 396 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 260, 288, 304, 432 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 212, 224, 318 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 260, 288, 304, 432 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 130, 212, 236, 248, 354 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 400, 440, 464, 660 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 264, 292, 396 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 252, 272, 378 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 256, 366 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 300, 332, 348, 498 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 320, 456 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 564, 822 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 300, 332, 348, 498 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 396, 564 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 564, 822 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 564, 822 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 300, 332, 348, 498 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 476, 696 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBall), new int[] { 180, 300, 332, 348, 498 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, // 25% increased damage in bullet hell 1 + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + + // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, + + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1182 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 648, 948 } } + }; + } + + // Destroys the EnemyStats struct to save memory because mod assemblies will not be fully unloaded until TML 1.4. + internal static void UnloadEnemyStats() + { + EnemyStats.ExpertDamageMultiplier = null; + EnemyStats.ContactDamageValues = null; + EnemyStats.ProjectileDamageValues = null; + } + #endregion + } +} diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs new file mode 100644 index 0000000000..b3733b5bf6 --- /dev/null +++ b/Utilities/NPCUtils.cs @@ -0,0 +1,445 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Efficiently counts the amount of existing enemies. May be used for multiple enemies. + /// + /// + /// + public static int CountNPCsBetter(params int[] typesToCheck) + { + // Don't waste time if the type check list is empty for some reason. + if (typesToCheck.Length <= 0) + return 0; + + int count = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (!typesToCheck.Contains(Main.npc[i].type) || !Main.npc[i].active) + continue; + + count++; + } + + return count; + } + + /// + /// Syncs position and velocity from a client to the server. This is to be used in contexts where these things are reliant on client-side information, such as . + /// + /// + public static void SyncMotionToServer(this NPC npc) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + return; + + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncNPCMotionDataToServer); + netMessage.Write(npc.whoAmI); + netMessage.WriteVector2(npc.Center); + netMessage.WriteVector2(npc.velocity); + netMessage.Send(); + } + + /// + /// Allows you to set the lifeMax value of a NPC to different values based on the mode. Called instead of npc.lifeMax = X. + /// + /// The NPC whose lifeMax value you are trying to set. + /// The value lifeMax will be set to in normal mode, this value gets doubled automatically in Expert mode. + /// The value lifeMax will be set to in Revegeneance mode. + /// The value lifeMax will be set to during the Boss Rush. + public static void LifeMaxNERB(this NPC npc, int normal, int? revengeance = null, int? bossRush = null) + { + npc.lifeMax = normal; + + if (bossRush.HasValue && BossRushEvent.BossRushActive) + { + npc.lifeMax = bossRush.Value; + } + else if (revengeance.HasValue && CalamityWorld.revenge) + { + npc.lifeMax = revengeance.Value; + } + } + + /// + /// Allows you to set the DR value of a NPC to different values based on the mode. + /// + /// The NPC whose DR value you are trying to set. + /// The value DR will be set to in normal mode. + /// The value DR will be set to in Revegeneance mode. + /// The value DR will be set to during the Boss Rush. + public static void DR_NERD(this NPC npc, float normal, float? revengeance = null, float? death = null, float? bossRush = null, bool? customDR = null) + { + npc.Calamity().DR = normal; + + if (bossRush.HasValue && BossRushEvent.BossRushActive) + { + npc.Calamity().DR = bossRush.Value; + } + else if (revengeance.HasValue && CalamityWorld.revenge) + { + npc.Calamity().DR = CalamityWorld.death ? death.Value : revengeance.Value; + } + + if (customDR.HasValue) + npc.Calamity().customDR = true; + } + + public static bool IsAnEnemy(this NPC npc) + { + // Null, inactive, town NPCs, friendlies, statue spawns, "non-enemies" (e.g. butterflies or projectile enemies), + // or anything else with no contact damage (exception: Providence and Celestial Pillars) don't count for rage. + if (npc is null || !npc.active || npc.townNPC || npc.friendly || npc.SpawnedFromStatue || npc.lifeMax <= 5 || (npc.damage <= 5 && npc.lifeMax <= 2000)) + return false; + // Also explicitly exclude dummies and anything with a ridiculous health pool (dummies from Fargo's for example). + if (npc.type == NPCID.TargetDummy || npc.type == NPCType() || npc.lifeMax > 100000000) + return false; + // Finally, exclude boss spawners. + if (npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) + return false; + + // Anything else is considered a valid enemy target. + return true; + } + + // This function follows the behavior of Adrenaline. + // Vanilla worm segments and Slime God slimes are specifically included. + // Martian Saucers are specifically excluded. + public static bool IsABoss(this NPC npc) + { + if (npc is null || !npc.active) + return false; + if (npc.boss && npc.type != NPCID.MartianSaucerCore) + return true; + if (npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsTail) + return true; + return npc.type == NPCType() || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType(); + } + + public static bool AnyBossNPCS(bool checkForMechs = false) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i] != null) + { + NPC npc = Main.npc[i]; + if (npc.IsABoss()) + { + // Added due to the new mech boss ore progression, return true if any mech is alive and checkForMechs is true, reduces mech boss projectile damage if true. + if (checkForMechs) + return npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer; + return true; + } + } + } + return FindFirstProjectile(ProjectileType()) != -1; + } + + /// + /// Syncs . This exists specifically for AIs manipulated in a global context, as has no netUpdate related hooks. + /// + /// + public static void SyncExtraAI(this NPC npc) + { + // Don't bother attempting to send packets in singleplayer. + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + ModPacket packet = CalamityMod.Instance.GetPacket(); + packet.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + packet.Write((byte)npc.whoAmI); + + for (int i = 0; i < npc.Calamity().newAI.Length; i++) + packet.Write(npc.Calamity().newAI[i]); + + packet.Send(); + } + + /// + /// Detects nearby hostile NPCs from a given point + /// + /// The position where we wish to check for nearby NPCs + /// Maximum amount of pixels to check around the origin + /// Whether to ignore tiles when finding a target or not + /// Whether bosses should be prioritized in targetting or not + public static NPC ClosestNPCAt(this Vector2 origin, float maxDistanceToCheck, bool ignoreTiles = true, bool bossPriority = false) + { + NPC closestTarget = null; + float distance = maxDistanceToCheck; + if (bossPriority) + { + bool bossFound = false; + for (int index = 0; index < Main.npc.Length; index++) + { + // If we've found a valid boss target, ignore ALL targets which aren't bosses. + if (bossFound && !(Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye)) + continue; + if (Main.npc[index].CanBeChasedBy(null, false)) + { + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + if (extraDistance < distance && !ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) + { + if (Main.npc[index].boss || Main.npc[index].type == NPCID.WallofFleshEye) + bossFound = true; + distance = Vector2.Distance(origin, Main.npc[index].Center); + closestTarget = Main.npc[index]; + } + } + } + } + else + { + for (int index = 0; index < Main.npc.Length; index++) + { + if (Main.npc[index].CanBeChasedBy(null, false)) + { + float extraDistance = (Main.npc[index].width / 2) + (Main.npc[index].height / 2); + + bool canHit = true; + if (extraDistance < distance && !ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, Main.npc[index].Center, 1, 1); + + if (Vector2.Distance(origin, Main.npc[index].Center) < (distance + extraDistance) && canHit) + { + distance = Vector2.Distance(origin, Main.npc[index].Center); + closestTarget = Main.npc[index]; + } + } + } + } + return closestTarget; + } + + /// + /// Detects nearby hostile NPCs from a given point with minion support + /// + /// The position where we wish to check for nearby NPCs + /// Maximum amount of pixels to check around the origin + /// Owner of the minion + /// Whether to ignore tiles when finding a target or not + public static NPC MinionHoming(this Vector2 origin, float maxDistanceToCheck, Player owner, bool ignoreTiles = true, bool checksRange = false) + { + if (owner is null || !owner.whoAmI.WithinBounds(Main.maxPlayers) || !owner.MinionAttackTargetNPC.WithinBounds(Main.maxNPCs)) + return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); + NPC npc = Main.npc[owner.MinionAttackTargetNPC]; + bool canHit = true; + if (!ignoreTiles) + canHit = Collision.CanHit(origin, 1, 1, npc.Center, 1, 1); + float extraDistance = (npc.width / 2) + (npc.height / 2); + bool distCheck = Vector2.Distance(origin, npc.Center) < (maxDistanceToCheck + extraDistance) || !checksRange; + if (owner.HasMinionAttackTargetNPC && canHit && distCheck) + { + return npc; + } + return ClosestNPCAt(origin, maxDistanceToCheck, ignoreTiles); + } + + /// + /// Crude anti-butcher logic based on % max health. + /// + /// The NPC attacked. + /// How much damage the attack would deal. + /// Whether or not the anti-butcher was triggered. + public static bool AntiButcher(NPC npc, ref double damage, float healthPercent) + { + if (damage <= npc.lifeMax * healthPercent) + return false; + damage = 0D; + return true; + } + + /// + /// Check if an NPC is organic + /// + /// The NPC attacked. + /// Whether or not the NPC is organic. + public static bool Organic(this NPC target) + { + if ((target.HitSound != SoundID.NPCHit4 && target.HitSound != SoundID.NPCHit41 && target.HitSound != SoundID.NPCHit2 && + target.HitSound != SoundID.NPCHit5 && target.HitSound != SoundID.NPCHit11 && target.HitSound != SoundID.NPCHit30 && + target.HitSound != SoundID.NPCHit34 && target.HitSound != SoundID.NPCHit36 && target.HitSound != SoundID.NPCHit42 && + target.HitSound != SoundID.NPCHit49 && target.HitSound != SoundID.NPCHit52 && target.HitSound != SoundID.NPCHit53 && + target.HitSound != SoundID.NPCHit54 && target.HitSound != null) || target.type == NPCType() || + target.type == NPCType()) + { + return true; + } + return false; + } + + /// + /// Check if an NPC is inorganic + /// + /// The NPC attacked. + /// Whether or not the NPC is inorganic. + public static bool Inorganic(this NPC target) + { + if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 && + target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 && + target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 && + target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 && + target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 && + target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 && + target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 && + target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 && + target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 && + target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 && + target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 && + target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 && + target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57 && target.type != NPCType() && + target.type != NPCType() && target.type != NPCType()) + { + return true; + } + return false; + } + + /// + /// Shortcut for the generic boss summon message. + /// + /// The whoAmI index of the summoned npc. + public static void BossAwakenMessage(int npcIndex) + { + // TODO -- this should use MiscUtils DisplayLocalizedText. + string typeName = Main.npc[npcIndex].TypeName; + if (Main.netMode == NetmodeID.SinglePlayer) + { + Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), new Color(175, 75, 255)); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] { Main.npc[npcIndex].GetTypeNetName() }), new Color(175, 75, 255)); + } + } + + public static void Inflict246DebuffsNPC(NPC target, int buff, float timeBase = 2f) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(buff, SecondsToFrames(timeBase * 3f), false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(buff, SecondsToFrames(timeBase * 2f), false); + } + else + { + target.AddBuff(buff, SecondsToFrames(timeBase), false); + } + } + + /// Inflict typical exo weapon debuffs. Duration multiplier optional. + ///
+ /// The NPC attacked. + /// Debuff time multiplier if needed. + /// Inflicts debuffs if they can. + public static void ExoDebuffs(this NPC target, float multiplier = 1f) + { + target.AddBuff(BuffID.Ichor, (int)(120 * multiplier)); + target.AddBuff(BuffID.CursedInferno, (int)(120 * multiplier)); + target.AddBuff(BuffType(), (int)(30 * multiplier)); + target.AddBuff(BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier)); + target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); + } + + public static T ModNPC(this NPC npc) where T : ModNPC => npc.modNPC as T; + + /// + /// Summons a boss near a particular area depending on a specific spawn context. + /// + /// The relative spawn position. + /// The NPC type ID of the boss to spawn. + /// The context in which the direct spawn position is decided. + /// The optional 1st ai parameter for the boss. + /// The optional 2nd ai parameter for the boss. + /// The optional 3rd ai parameter for the boss. + /// The optional 4th ai parameter for the boss. + public static NPC SpawnBossBetter(Vector2 relativeSpawnPosition, int bossType, BaseBossSpawnContext spawnContext = null, float ai0 = 0f, float ai1 = 0f, float ai2 = 0f, float ai3 = 0f) + { + // Don't spawn entities client-side. + if (Main.netMode == NetmodeID.MultiplayerClient) + return null; + + // Fall back to an exact spawn position if nothing else is inputted. + if (spawnContext is null) + spawnContext = new ExactPositionBossSpawnContext(); + + Vector2 spawnPosition = spawnContext.DetermineSpawnPosition(relativeSpawnPosition); + int bossIndex = NPC.NewNPC((int)spawnPosition.X, (int)spawnPosition.Y, bossType, 0, ai0, ai1, ai2, ai3); + + // Broadcast a spawn message to indicate the summoning of the boss if it was successfully spawned. + if (Main.npc.IndexInRange(bossIndex)) + { + BossAwakenMessage(bossIndex); + return Main.npc[bossIndex]; + } + else + return null; + } + + /// + /// Spawns Old Duke on a player. Only works server side, and only works if the player owns a fishing bobber.
+ /// Old Duke will spawn above the fishing bobber if one is found. + ///
+ /// The index of the player who will spawn Old Duke. + internal static void SpawnOldDuke(int playerIndex) + { + if (Main.netMode != NetmodeID.Server) + return; + + Player player = Main.player[playerIndex]; + if (!player.active || player.dead) + return; + + Projectile projectile = null; + for (int i = 0; i < Main.maxProjectiles; i++) + { + projectile = Main.projectile[i]; + if (Main.projectile[i].active && Main.projectile[i].bobber && Main.projectile[i].owner == playerIndex) + { + projectile = Main.projectile[i]; + break; + } + } + + if (projectile is null) + return; + + int oldDuke = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y + 100, NPCType()); + BossAwakenMessage(oldDuke); + } + } +} diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs new file mode 100644 index 0000000000..42b6fcaac2 --- /dev/null +++ b/Utilities/PlayerUtils.cs @@ -0,0 +1,174 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.CalPlayer; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + // 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 bool IsUnderwater(this Player player) => Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); + public static bool StandingStill(this Player player, float velocity = 0.05f) => player.velocity.Length() < velocity; + public static bool InSpace(this Player player) + { + float x = Main.maxTilesX / 4200f; + x *= x; + float spaceGravityMult = (float)((player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); + return spaceGravityMult < 1f; + } + public static bool PillarZone(this Player player) => player.ZoneTowerStardust || player.ZoneTowerSolar || player.ZoneTowerVortex || player.ZoneTowerNebula; + public static bool InCalamity(this Player player) => player.Calamity().ZoneCalamity; + public static bool InSunkenSea(this Player player) => player.Calamity().ZoneSunkenSea; + public static bool InSulphur(this Player player) => player.Calamity().ZoneSulphur; + public static bool InAstral(this Player player, int biome = 0) //1 is above ground, 2 is underground, 3 is desert + { + switch (biome) + { + case 1: + return player.Calamity().ZoneAstral && (player.ZoneOverworldHeight || player.ZoneSkyHeight); + + case 2: + return player.Calamity().ZoneAstral && (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight || player.ZoneUnderworldHeight); + + case 3: + return player.Calamity().ZoneAstral && player.ZoneDesert; + + default: + return player.Calamity().ZoneAstral; + } + } + public static bool InAbyss(this Player player, int layer = 0) + { + switch (layer) + { + case 1: + return player.Calamity().ZoneAbyssLayer1; + + case 2: + return player.Calamity().ZoneAbyssLayer2; + + case 3: + return player.Calamity().ZoneAbyssLayer3; + + case 4: + return player.Calamity().ZoneAbyssLayer4; + + default: + return player.Calamity().ZoneAbyss; + } + } + public static bool InventoryHas(this Player player, params int[] items) + { + return player.inventory.Any(item => items.Contains(item.type)); + } + public static bool PortableStorageHas(this Player player, params int[] items) + { + bool hasItem = false; + if (player.bank.item.Any(item => items.Contains(item.type))) + hasItem = true; + if (player.bank2.item.Any(item => items.Contains(item.type))) + hasItem = true; + if (player.bank3.item.Any(item => items.Contains(item.type))) + hasItem = true; + return hasItem; + } + + /// + /// Returns the damage multiplier Adrenaline Mode provides for the given player. + /// + /// + /// + public static double GetAdrenalineDamage(this CalamityPlayer mp) + { + double adrenalineBoost = CalamityPlayer.AdrenalineDamageBoost; + if (mp.adrenalineBoostOne) + adrenalineBoost += CalamityPlayer.AdrenalineDamagePerBooster; + if (mp.adrenalineBoostTwo) + adrenalineBoost += CalamityPlayer.AdrenalineDamagePerBooster; + if (mp.adrenalineBoostThree) + adrenalineBoost += CalamityPlayer.AdrenalineDamagePerBooster; + + return adrenalineBoost; + } + + /// + /// Applies Rage and Adrenaline to the given damage multiplier. The values controlling the so-called "Rippers" can be found in CalamityPlayer. + /// + /// The CalamityPlayer who may or may not be using Rage or Adrenaline. + /// A reference to the current in-use damage multiplier. This will be increased in-place. + public static void ApplyRippersToDamage(CalamityPlayer mp, ref double damageMult) + { + // Rage and Adrenaline now stack additively with no special cases. + if (mp.rageModeActive) + damageMult += mp.RageDamageBoost; + if (mp.adrenalineModeActive) + damageMult += mp.GetAdrenalineDamage(); + } + + public static void Inflict246DebuffsPvp(Player target, int buff, float timeBase = 2f) + { + if (Main.rand.NextBool(4)) + { + target.AddBuff(buff, SecondsToFrames(timeBase * 3f), false); + } + else if (Main.rand.NextBool(2)) + { + target.AddBuff(buff, SecondsToFrames(timeBase * 2f), false); + } + else + { + target.AddBuff(buff, SecondsToFrames(timeBase), false); + } + } + + /// + /// Inflict typical exo weapon debuffs in pvp. + /// + /// The Player attacked. + /// Debuff time multiplier if needed. + /// Inflicts debuffs if the target isn't immune. + public static void ExoDebuffs(this Player target, float multiplier = 1f) + { + target.AddBuff(BuffType(), (int)(30 * multiplier)); + target.AddBuff(BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffType(), (int)(120 * multiplier)); + target.AddBuff(BuffID.CursedInferno, (int)(120 * multiplier)); + target.AddBuff(BuffID.Frostburn, (int)(120 * multiplier)); + target.AddBuff(BuffID.OnFire, (int)(120 * multiplier)); + target.AddBuff(BuffID.Ichor, (int)(120 * multiplier)); + } + + /// + /// Makes the given player send the given packet to all appropriate receivers.
+ /// If server is false, the packet is sent only to the multiplayer host.
+ /// If server is true, the packet is sent to all clients except the player it pertains to. + ///
+ /// The player to whom the packet's data pertains. + /// The packet to send with certain parameters. + /// True if a dedicated server is broadcasting information to all players. + public static void SendPacket(this Player player, ModPacket packet, bool server) + { + // Client: Send the packet only to the host. + if (!server) + packet.Send(); + + // Server: Send the packet to every OTHER client. + else + packet.Send(-1, player.whoAmI); + } + } +} diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs new file mode 100644 index 0000000000..b13a4c3b1a --- /dev/null +++ b/Utilities/ProjectileUtils.cs @@ -0,0 +1,390 @@ +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + public static int CountProjectiles(int Type) => Main.projectile.Count(proj => proj.type == Type && proj.active); + + public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer); + + public static bool FinalExtraUpdate(this Projectile proj) => proj.numUpdates == -1; + + public static bool IsSummon(this Projectile proj) => proj.minion || proj.sentry || CalamityLists.projectileMinionList.Contains(proj.type) || ProjectileID.Sets.MinionShot[proj.type] || ProjectileID.Sets.SentryShot[proj.type]; + + public static T ModProjectile(this Projectile projectile) where T : ModProjectile + { + return projectile.modProjectile as T; + } + + public static void KillAllHostileProjectiles() + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) + { + projectile.Kill(); + } + } + } + + public static void KillShootProjectiles(bool shouldBreak, int projType, Player player) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && proj.type == projType) + { + proj.Kill(); + if (shouldBreak) + break; + } + } + } + + public static void KillShootProjectileMany(Player player, params int[] projTypes) + { + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.owner == player.whoAmI && projTypes.Contains(proj.type)) + { + proj.Kill(); + } + } + } + + public static int FindFirstProjectile(int Type) + { + int index = -1; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile proj = Main.projectile[x]; + if (proj.active && proj.type == Type) + { + index = x; + break; + } + } + return index; + } + + public static void OnlyOneSentry(Player player, int Type) + { + int existingTurrets = player.ownedProjectileCounts[Type]; + if (existingTurrets > 0) + { + for (int i = 0; i < Main.maxProjectiles; i++) + { + if (Main.projectile[i].type == Type && + Main.projectile[i].owner == player.whoAmI && + Main.projectile[i].active) + { + Main.projectile[i].Kill(); + existingTurrets--; + if (existingTurrets <= 0) + break; + } + } + } + } + + public static Projectile ProjectileRain(Vector2 targetPos, float xLimit, float xVariance, float yLimitLower, float yLimitUpper, float projSpeed, int projType, int damage, float knockback, int owner) + { + float x = targetPos.X + Main.rand.NextFloat(-xLimit, xLimit); + if (projType == ProjectileType()) + x = targetPos.X + xLimit; + float y = targetPos.Y - Main.rand.NextFloat(yLimitLower, yLimitUpper); + Vector2 source = new Vector2(x, y); + Vector2 velocity = targetPos - source; + velocity.X += Main.rand.NextFloat(-xVariance, xVariance); + float speed = projSpeed; + float targetDist = velocity.Length(); + targetDist = speed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + return Projectile.NewProjectileDirect(source, velocity, projType, damage, knockback, owner); + } + + public static Projectile ProjectileBarrage(Vector2 originVec, Vector2 targetPos, bool fromRight, float xOffsetMin, float xOffsetMax, float yOffsetMin, float yOffsetMax, float projSpeed, int projType, int damage, float knockback, int owner, bool clamped = false, float inaccuracyOffset = 5f) + { + float xPos = originVec.X + Main.rand.NextFloat(xOffsetMin, xOffsetMax) * fromRight.ToDirectionInt(); + float yPos = originVec.Y + Main.rand.NextFloat(yOffsetMin, yOffsetMax) * Main.rand.NextBool().ToDirectionInt(); + Vector2 spawnPosition = new Vector2(xPos, yPos); + Vector2 velocity = targetPos - spawnPosition; + velocity.X += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset); + velocity.Y += Main.rand.NextFloat(-inaccuracyOffset, inaccuracyOffset); + velocity.Normalize(); + velocity *= projSpeed * (clamped ? 150f : 1f); + //This clamp means the spawned projectiles only go at diagnals and are not accurate + if (clamped) + { + velocity.X = MathHelper.Clamp(velocity.X, -15f, 15f); + velocity.Y = MathHelper.Clamp(velocity.Y, -15f, 15f); + } + return Projectile.NewProjectileDirect(spawnPosition, velocity, projType, damage, knockback, owner); + } + + public static int DamageSoftCap(double dmgInput, int cap) + { + int newDamage = (int)dmgInput; + if (newDamage > cap) + { + newDamage = (int)((dmgInput - cap) * 0.1) + cap; + } + if (newDamage < 1) + newDamage = 1; + return newDamage; + } + + public static Vector2 RandomVelocity(float directionMult, float speedLowerLimit, float speedCap, float speedMult = 0.1f) + { + Vector2 velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); + //Rerolling to avoid dividing by zero + while (velocity.X == 0f && velocity.Y == 0f) + { + velocity = new Vector2(Main.rand.NextFloat(-directionMult, directionMult), Main.rand.NextFloat(-directionMult, directionMult)); + } + velocity.Normalize(); + velocity *= Main.rand.NextFloat(speedLowerLimit, speedCap) * speedMult; + return velocity; + } + + public static void MinionAntiClump(this Projectile projectile, float pushForce = 0.05f) + { + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || otherProj.owner != projectile.owner || !otherProj.minion || 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 = Math.Abs(projectile.position.X - otherProj.position.X) + Math.Abs(projectile.position.Y - otherProj.position.Y); + if (sameProjType && taxicabDist < projectile.width) + { + if (projectile.position.X < otherProj.position.X) + projectile.velocity.X -= pushForce; + else + projectile.velocity.X += pushForce; + + if (projectile.position.Y < otherProj.position.Y) + projectile.velocity.Y -= pushForce; + else + projectile.velocity.Y += pushForce; + } + } + } + + public static bool DrawBeam(this Projectile projectile, float length, float width, Color lightColor, Texture2D texture = null) + { + if (texture is null) + texture = Main.projectileTexture[projectile.type]; + + float widthOffset = (float)(texture.Width - projectile.width) * 0.5f + (float)projectile.width * 0.5f; + float heightOffset = (float)(projectile.height / 2); + Vector2 origin = new Vector2(widthOffset, heightOffset); + SpriteEffects spriteEffects = SpriteEffects.None; + if (projectile.spriteDirection == -1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Rectangle roughScreenBounds = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); + if (projectile.getRect().Intersects(roughScreenBounds)) + { + Vector2 drawPos = projectile.position - Main.screenPosition + origin; + drawPos.Y += projectile.gfxOffY; + float maxTrailPoints = length; + float wide = width; + if (projectile.ai[1] == 1f) + { + maxTrailPoints = (int)projectile.localAI[0]; + } + for (int i = 1; i <= (int)projectile.localAI[0]; i++) + { + Vector2 offset = Vector2.Normalize(projectile.velocity) * (float)i * wide; + Color color = projectile.GetAlpha(lightColor); + color *= (maxTrailPoints - (float)i) / maxTrailPoints; + color.A = 0; + Main.spriteBatch.Draw(texture, drawPos - offset, null, color, projectile.rotation, origin, projectile.scale, spriteEffects, 0f); + } + } + return false; + } + + public static void ExplodeandDestroyTiles(Projectile projectile, int explosionRadius, bool checkExplosions, List tilesToCheck, List wallsToCheck) + { + int minTileX = (int)projectile.position.X / 16 - explosionRadius; + int maxTileX = (int)projectile.position.X / 16 + explosionRadius; + int minTileY = (int)projectile.position.Y / 16 - explosionRadius; + int maxTileY = (int)projectile.position.Y / 16 + explosionRadius; + if (minTileX < 0) + { + minTileX = 0; + } + if (maxTileX > Main.maxTilesX) + { + maxTileX = Main.maxTilesX; + } + if (minTileY < 0) + { + minTileY = 0; + } + if (maxTileY > Main.maxTilesY) + { + maxTileY = Main.maxTilesY; + } + + bool canKillWalls = false; + for (int x = minTileX; x <= maxTileX; x++) + { + for (int y = minTileY; y <= maxTileY; y++) + { + 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) + { + canKillWalls = true; + break; + } + } + } + + List tileExcludeList = new List() + { + TileID.DemonAltar, + TileID.ElderCrystalStand + }; + for (int i = 0; i < tilesToCheck.Count; ++i) + tileExcludeList.Add(tilesToCheck[i]); + List wallExcludeList = new List(); + for (int i = 0; i < wallsToCheck.Count; ++i) + wallExcludeList.Add(wallsToCheck[i]); + + List explosionCheckList = new List() + { + TileID.DemonAltar, + TileID.Cobalt, + TileID.Mythril, + TileID.Adamantite, + TileID.Palladium, + TileID.Orichalcum, + TileID.Titanium, + TileID.Chlorophyte, + TileID.LihzahrdBrick, + TileID.LihzahrdAltar, + TileID.DesertFossil + }; + AddWithCondition(explosionCheckList, TileID.Hellstone, !Main.hardMode); + + for (int i = minTileX; i <= maxTileX; i++) + { + for (int j = minTileY; j <= maxTileY; j++) + { + Tile tile = Main.tile[i, j]; + bool t = 1 == 1; bool f = 1 == 2; + + Vector2 explodeArea = new Vector2(Math.Abs(i - projectile.position.X / 16f), Math.Abs(j - projectile.position.Y / 16f)); + float distance = explodeArea.Length(); + if (distance < explosionRadius) + { + bool canKillTile = true; + if (tile != null && tile.active()) + { + if (checkExplosions) + { + if (Main.tileDungeon[tile.type] || explosionCheckList.Contains(tile.type)) + { + canKillTile = false; + } + if (!TileLoader.CanExplode(i, j)) + { + canKillTile = false; + } + } + if (Main.tileContainer[tile.type]) + canKillTile = false; + if (!TileLoader.CanKillTile(i, j, tile.type, ref t) || !TileLoader.CanKillTile(i, j, tile.type, ref f)) + canKillTile = false; + if (tileExcludeList.Contains(tile.type)) + canKillTile = false; + + if (canKillTile) + { + WorldGen.KillTile(i, j, false, false, false); + if (!tile.active() && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, i, j, 0f, 0, 0, 0); + } + } + } + if (canKillTile) + { + for (int x = i - 1; x <= i + 1; x++) + { + for (int y = j - 1; y <= j + 1; y++) + { + 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)) + canKillWalls = false; + if (Main.tile[x, y] != null && Main.tile[x, y].wall > WallID.None && canKillWalls && canExplode) + { + WorldGen.KillWall(x, y, false); + if (Main.tile[x, y].wall == WallID.None && Main.netMode != NetmodeID.SinglePlayer) + { + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 2, x, y, 0f, 0, 0, 0); + } + } + } + } + } + } + } + } + } + + /// + /// Creates an explosion which is visually identical to vanilla's Rocket III and Rocket IV on-hit explosions. + /// + /// The projectile which is exploding. + public static void LargeFieryExplosion(this Projectile projectile) + { + // Sparks and such + Vector2 corner = projectile.position; + for (int i = 0; i < 40; i++) + { + 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)) + { + Main.dust[idx].scale = 0.5f; + Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int i = 0; i < 70; i++) + { + 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); + Main.dust[idx].velocity *= 2f; + } + + // Smoke, which counts as a Gore + ExplosionGores(projectile.Center, 3); + } + } +} diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs new file mode 100644 index 0000000000..c3535b2d59 --- /dev/null +++ b/Utilities/TileEntityUtils.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// A hitbox that should approximately represent the tip of the mouse cursor. Used for UI stuff. + /// + public static Rectangle MouseHitbox => new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 2, 2); + + /// + /// Finds the Calamity tile entity that is associated with the tile at the given world coordinates (i, j).

+ /// Can return null if nothing is found. + ///
+ /// The Type of Tile Entity to look for. Must be a modded tile entity. + /// The X coordinate of the tile in the world. + /// The Y coordinate of the tile in the world. + /// The width of the FrameImportant Tile that hosts the tile entity. + /// The height of the FrameImportant Tile that hosts the tile entity. + /// The width in pixels of each tile-square on the Tile's sprite sheet. Usually 16. Can be 18 if the sprite sheet has pink lines. + /// A ModTileEntity of the proper type, or null. + public static T FindTileEntity(int i, int j, int width, int height, int sheetSquare = 16) where T : ModTileEntity + { + // 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; + + byte chargerType = GetInstance().type; + bool exists = TileEntity.ByPosition.TryGetValue(new Point16(left, top), out TileEntity te); + return exists && te.type == chargerType ? (T)te : null; + } + + /// + /// Cancels any currently active sign or chest name edits, and closes any chest the player may have open. + /// + /// The player to act upon. Should basically always be Main.LocalPlayer. + public static void CancelSignsAndChests(this Player player) + { + Main.mouseRightRelease = false; + + // If a sign or chest was in use previously, close those GUIs. + if (player.sign >= 0) + { + Main.PlaySound(SoundID.MenuClose); + player.sign = -1; + Main.editSign = false; + Main.npcChatText = ""; + } + if (Main.editChest) + { + Main.PlaySound(SoundID.MenuTick); + Main.editChest = false; + Main.npcChatText = ""; + } + if (player.chest >= 0) + player.chest = -1; + } + + // Draws the Power Cell item slot in a UI. Used by both the Power Cell Factory and Charging Station. + internal static void DrawPowercellSlot(SpriteBatch spriteBatch, Item item, Vector2 drawPosition, float iconScale = 0.7f) + { + Texture2D slotBackgroundTex = GetTexture("CalamityMod/ExtraTextures/UI/PowerCellSlot_Empty"); + + // This check is done twice because the draw order matters. We want to draw the background icon before any text. + if (item.stack > 0) + slotBackgroundTex = GetTexture("CalamityMod/ExtraTextures/UI/PowerCellSlot_Filled"); + + spriteBatch.Draw(slotBackgroundTex, drawPosition, null, Color.White, 0f, slotBackgroundTex.Size() * 0.5f, iconScale, SpriteEffects.None, 0f); + if (item.stack > 0) + { + float inventoryScale = Main.inventoryScale; + Vector2 numberOffset = slotBackgroundTex.Size() * 0.2f; + numberOffset.X -= 17f; + ChatManager.DrawColorCodedStringWithShadow(spriteBatch, + Main.fontItemStack, + item.stack.ToString(), + drawPosition + numberOffset * inventoryScale, + Color.White, + 0f, + Vector2.Zero, + new Vector2(inventoryScale), + -1f, + inventoryScale); + } + } + } +} diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs new file mode 100644 index 0000000000..a383821d66 --- /dev/null +++ b/Utilities/TileUtils.cs @@ -0,0 +1,468 @@ +using CalamityMod.Tiles; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FurnitureAbyss; +using CalamityMod.Tiles.FurnitureAshen; +using CalamityMod.Tiles.FurnitureEutrophic; +using CalamityMod.Tiles.FurnitureOccult; +using CalamityMod.Tiles.FurnitureProfaned; +using CalamityMod.Tiles.FurnitureVoid; +using CalamityMod.Tiles.Ores; +using CalamityMod.Tiles.SunkenSea; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ObjectData; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + public static string GetMapChestName(string baseName, int x, int y) + { + // Bounds check. + if (!WorldGen.InWorld(x, y, 2)) + return baseName; + + // Tile null check. + Tile tile = Main.tile[x, y]; + if (tile is null) + return baseName; + + int left = x; + int top = y; + if (tile.frameX % 36 != 0) + left--; + if (tile.frameY != 0) + top--; + + int chest = Chest.FindChest(left, top); + + // Valid chest index check. + if (chest < 0) + return baseName; + + string name = baseName; + + // Concatenate the chest's custom name if it has one. + if (!string.IsNullOrEmpty(Main.chest[chest].name)) + name += $": {Main.chest[chest].name}"; + + return name; + } + + public static void SafeSquareTileFrame(int x, int y, bool resetFrame = true) + { + if (Main.tile[x, y] is null) + return; + + for (int xIter = x - 1; xIter <= x + 1; ++xIter) + { + if (xIter < 0 || xIter >= Main.maxTilesX) + continue; + for (int yIter = y - 1; yIter <= y + 1; yIter++) + { + if (yIter < 0 || yIter >= Main.maxTilesY) + continue; + if (xIter == x && yIter == y) + { + WorldGen.TileFrame(x, y, resetFrame, false); + } + else + { + WorldGen.TileFrame(xIter, yIter, false, false); + } + } + } + } + + 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; + for (int l = x; l < x + tileX; l++) + { + for (int m = y; m < y + tileY; m++) + { + if (Main.tile[l, m] == null) + { + Main.tile[l, m] = new Tile(); + } + if (Main.tile[l, m].active() && Main.tile[l, m].type == type) + { + if (Main.tile[l, m].frameX < (18 * tileX)) + { + Main.tile[l, m].frameX += (short)(18 * tileX); + } + else + { + Main.tile[l, m].frameX -= (short)(18 * tileX); + } + } + } + } + if (Wiring.running) + { + for (int k = 0; k < tileX; k++) + { + for (int l = 0; l < tileY; l++) + { + Wiring.SkipWire(x + k, y + l); + } + } + } + } + + public static void DrawFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) + { + Tile tile = Main.tile[i, j]; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); + + int width = 16; + int height = 16; + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; + + ulong num190 = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)(uint)i); + + for (int c = 0; c < 7; c++) + { + 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); + } + } + + 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; + 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; + for (int x = -1; x < 2; x++) + { + for (int y = -1; y < 2; y++) + { + Vector2 flameOffset = new Vector2(x, y).SafeNormalize(Vector2.Zero); + flameOffset *= 1.5f; + Main.spriteBatch.Draw(flameTexture, drawOffset + flameOffset, new Rectangle?(new Rectangle(xPos + offsetX, yPos + offsetY, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } + } + + public static void DrawFlameSparks(int dustType, int rarity, int i, int j) + { + if (!Main.gamePaused && Main.instance.IsActive && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4))) + { + if (Main.rand.NextBool(rarity)) + { + int dust = Dust.NewDust(new Vector2(i * 16 + 4, j * 16 + 2), 4, 4, dustType, 0f, 0f, 100, default, 1f); + if (Main.rand.Next(3) != 0) + { + Main.dust[dust].noGravity = true; + } + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1.5f; + } + } + } + + public static void DrawItemFlame(Texture2D flameTexture, Item item) + { + int width = flameTexture.Width; + int height = flameTexture.Height; + for (int c = 0; c < 7; c++) + { + float shakeX = Main.rand.Next(-10, 11) * 0.15f; + float shakeY = Main.rand.Next(-10, 1) * 0.35f; + Main.spriteBatch.Draw(flameTexture, new Vector2(item.position.X - Main.screenPosition.X + item.width * 0.5f + shakeX, item.position.Y - Main.screenPosition.Y + item.height - flameTexture.Height * 0.5f + 2f + shakeY), new Rectangle(0, 0, width, height), new Color(100, 100, 100, 0), 0f, default, 1f, SpriteEffects.None, 0f); + } + } + public static Tile ParanoidTileRetrieval(int x, int y) + { + if (!WorldGen.InWorld(x, y)) + return new Tile(); + Tile tile = Main.tile[x, y]; + if (tile is null) + { + tile = new Tile(); + Main.tile[x, y] = tile; + } + return tile; + } + public static bool TileSelectionSolid(int x, int y, int width, int height) + { + for (int i = x; i != x + width; i += Math.Sign(width)) + { + for (int j = y; y != y + height; j += Math.Sign(height)) + { + if (!WorldGen.InWorld(i, j)) + return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) + return false; + } + } + return true; + } + public static bool TileSelectionSolidSquare(int x, int y, int width, int height) + { + for (int i = x - width; i != x + width; i += Math.Sign(width)) + { + for (int j = y - height; y != y + height; j += Math.Sign(height)) + { + if (!WorldGen.InWorld(i, j)) + return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) + return false; + } + } + return true; + } + public static bool TileActiveAndOfType(int x, int y, int type) + { + return ParanoidTileRetrieval(x, y).active() && ParanoidTileRetrieval(x, y).type == type; + } + + /// + /// Sets the mergeability state of two tiles. By default, enables tile merging. + /// + /// The first tile type which should merge (or not). + /// The second tile type which should merge (or not). + /// The mergeability state of the tiles. Defaults to true if omitted. + public static void SetMerge(int type1, int type2, bool merge = true) + { + if (type1 != type2) + { + Main.tileMerge[type1][type2] = merge; + Main.tileMerge[type2][type1] = merge; + } + } + + /// + /// Makes the first tile type argument merge with all the other tile type arguments. Also accepts arrays. + /// + /// The tile whose merging properties will be set. + /// Every tile that should be merged with. + public static void MergeWithSet(int myType, params int[] otherTypes) + { + for (int i = 0; i < otherTypes.Length; ++i) + SetMerge(myType, otherTypes[i]); + } + + /// + /// Makes the specified tile merge with the most common types of tiles found in world generation.

+ /// Notably excludes Ice. + ///
+ /// The tile whose merging properties will be set. + public static void MergeWithGeneral(int type) => MergeWithSet(type, new int[] { + // Soils + TileID.Dirt, + TileID.Mud, + TileID.ClayBlock, + // Stones + TileID.Stone, + TileID.Ebonstone, + TileID.Crimstone, + TileID.Pearlstone, + // Sands + TileID.Sand, + TileID.Ebonsand, + TileID.Crimsand, + TileID.Pearlsand, + // Snows + TileID.SnowBlock, + // Calamity Tiles + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + }); + + /// + /// Makes the specified tile merge with all ores, vanilla and Calamity. Particularly useful for stone blocks. + /// + /// The tile whose merging properties will be set. + public static void MergeWithOres(int type) => MergeWithSet(type, new int[] { + // Vanilla Ores + TileID.Copper, + TileID.Tin, + TileID.Iron, + TileID.Lead, + TileID.Silver, + TileID.Tungsten, + TileID.Gold, + TileID.Platinum, + TileID.Demonite, + TileID.Crimtane, + TileID.Cobalt, + TileID.Palladium, + TileID.Mythril, + TileID.Orichalcum, + TileID.Adamantite, + TileID.Titanium, + TileID.LunarOre, + // Calamity Ores + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + }); + + /// + /// Makes the specified tile merge with all types of desert tiles, including the Calamity Sunken Sea. + /// + /// The tile whose merging properties will be set. + public static void MergeWithDesert(int type) => MergeWithSet(type, new int[] { + // Sands + TileID.Sand, + TileID.Ebonsand, + TileID.Crimsand, + TileID.Pearlsand, + // Hardened Sands + TileID.HardenedSand, + TileID.CorruptHardenedSand, + TileID.CrimsonHardenedSand, + TileID.HallowHardenedSand, + // Sandstones + TileID.Sandstone, + TileID.CorruptSandstone, + TileID.CrimsonSandstone, + TileID.HallowSandstone, + // Miscellaneous Desert Tiles + TileID.FossilOre, + TileID.DesertFossil, + // Astral Desert + TileType(), + TileType(), + TileType(), + TileType(), + // Sunken Sea + TileType(), + TileType(), + TileType(), + }); + + /// + /// Makes the specified tile merge with all types of snow and ice tiles. + /// + /// The tile whose merging properties will be set. + public static void MergeWithSnow(int type) => MergeWithSet(type, new int[] { + // Snows + TileID.SnowBlock, + // Ices + TileID.IceBlock, + TileID.CorruptIce, + TileID.FleshIce, + TileID.HallowedIce, + // Astral Snow + TileType(), + TileType(), + TileType(), + }); + + /// + /// Makes the specified tile merge with all tiles which generate in hell. Does not include Charred Ore. + /// + /// The tile whose merging properties will be set. + public static void MergeWithHell(int type) => MergeWithSet(type, new int[] { + TileID.Ash, + TileID.Hellstone, + TileID.ObsidianBrick, + TileID.HellstoneBrick, + TileType(), + }); + + /// + /// Makes the specified tile merge with all tiles which generate in the Abyss or the Sulphurous Sea. Includes Chaotic Ore. + /// + /// The tile whose merging properties will be set. + public static void MergeWithAbyss(int type) => MergeWithSet(type, new int[] { + // Sulphurous Sea + TileType(), + TileType(), + // Abyss + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + }); + + /// + /// Makes the tile merge with all the tile types that generate within various types of astral tiles + /// + /// + public static void MergeAstralTiles(int type) + { + //Astral + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + //Astral Desert + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + //Astral Snow + SetMerge(type, TileType()); + SetMerge(type, TileType()); + } + + /// + /// Makes the tile merge with all the decorative 'smooth' tiles + /// + /// + public static void MergeSmoothTiles(int type) + { + //Vanilla + SetMerge(type, TileID.MarbleBlock); + SetMerge(type, TileID.GraniteBlock); + //Calam + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + } + + /// + /// Makes the tile merge with other mergable decorative tiles + /// + /// + public static void MergeDecorativeTiles(int type) + { + //Vanilla decor + Main.tileBrick[type] = true; + //Calam + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + SetMerge(type, TileType()); + } + + /// + /// 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]); + } +} diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs new file mode 100644 index 0000000000..7552177cc3 --- /dev/null +++ b/Utilities/WorldgenUtils.cs @@ -0,0 +1,35 @@ +using System.Linq; +using Terraria; +using Terraria.ID; + +namespace CalamityMod +{ + public static partial class CalamityUtils + { + /// + /// Generates clusters of ore across the world based on various requirements and with various strengths/frequencies. + /// + /// + /// + /// + /// + /// + /// + /// + public static void SpawnOre(int type, double frequency, float verticalStartFactor, float verticalEndFactor, int strengthMin, int strengthMax, params int[] convertibleTiles) + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int k = 0; k < (int)(x * y * frequency); k++) + { + 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)) + WorldGen.OreRunner(tilesX, tilesY, WorldGen.genRand.Next(strengthMin, strengthMax), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + } + } +} diff --git a/Walls/ChaoticBrickWall.png b/Walls/ChaoticBrickWall.png index 359d068c30..778942e540 100644 Binary files a/Walls/ChaoticBrickWall.png and b/Walls/ChaoticBrickWall.png differ diff --git a/Walls/PerennialBrickWall.png b/Walls/PerennialBrickWall.png index e7a9b74ad3..20ffd5394d 100644 Binary files a/Walls/PerennialBrickWall.png and b/Walls/PerennialBrickWall.png differ diff --git a/Walls/StratusWall.png b/Walls/StratusWall.png index bd1b9317f0..6445aa515b 100644 Binary files a/Walls/StratusWall.png and b/Walls/StratusWall.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index a56558ebdf..3bb51503c8 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -1,863 +1,25 @@ -using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Tools.ClimateChange; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.FurnitureVoid; +using CalamityMod.Tiles.Ores; using CalamityMod.Walls; using Microsoft.Xna.Framework; using System; -using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.World { - public class Abyss : ModWorld + public class Abyss { - public static int BiomeWidth - { - get - { - // Small world - if (Main.maxTilesX == 4200) - { - return 370; - } - // Medium world - else if (Main.maxTilesX == 6400) - { - return 445; - } - // Large world - else - { - return 500; - } - } - } - - public static int BlockDepth - { - get - { - // Small world - if (Main.maxTilesX == 4200) - { - return (int)((Main.rockLayer + 20 - YStart) * 0.65); - } - // Medium world - else if (Main.maxTilesX == 6400) - { - return (int)((Main.rockLayer + 20 - YStart) * 0.8); - } - // Large world - else - { - return (int)((Main.rockLayer + 20 - YStart) * 0.925); - } - } - } - - public static int YStart = 0; - public static readonly List SulphSeaTiles = new List() - { - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType() - }; - - public static void PlaceSulphurSea() - { - CalamityWorld.abyssSide = Main.dungeonX < Main.maxTilesX / 2; - DetermineYStart(); - CreateStartingBlock(); - CreateWater(); - GenerateHardenedSandstone(); - RemoveStupidTilesAboveSea(); - SettleWater(); // The island Y spawn position calculations are relative to water. Settling the water before doing these calculations is ideal. - GenerateIslands(); - GenerateVentsAndFossils(); - SmoothenTheEntireSea(); - } - - public static void FinishGeneratingSulphurSea() - { - PlaceStalactites(); - PlaceColumns(); - PlaceRustyChests(); - } - - #region Perlin Noise - public static float NoiseFunction(int seed) - { - seed = (seed << 13) ^ seed; - return 1.0f - ((seed * (seed * seed * 15731) + 1376312589) & 0x7fffffff) / 1073741824.0f; - } - public static float PerlinNoise2D(float x, float y, int octave, int seed) - { - float frequency = (float)Math.Pow(2, octave); - float xFrequency = x * frequency; - float yFrequency = y * frequency; - int flooredXFrequency = (int)xFrequency; - int flooredYFrequency = (int)yFrequency; - float fractionXFrequency = xFrequency - flooredXFrequency; - float fractionYFrequency = yFrequency - flooredYFrequency; - - float noise1 = NoiseFunction(flooredXFrequency + flooredYFrequency * 54 + seed); - float noise2 = NoiseFunction(flooredXFrequency + 1 + flooredYFrequency * 54 + seed); - float noise3 = NoiseFunction(flooredXFrequency + (1 + flooredYFrequency) * 54 + seed); - float noise4 = NoiseFunction(flooredXFrequency + 1 + (1 + flooredYFrequency) * 54 + seed); - - float lerpStart = MathHelper.Lerp(noise1, noise2, fractionXFrequency); - float lerpEnd = MathHelper.Lerp(noise3, noise4, fractionXFrequency); - return MathHelper.Lerp(lerpStart, lerpEnd, fractionYFrequency); - } - #endregion - - #region Generating Initial Block - public static void CreateStartingBlock() - { - float randomValue1 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); - while (Math.Abs(randomValue1) < 0.22f) - { - randomValue1 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); - } - float randomValue2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); - while (Math.Abs(randomValue2) < 0.07f) - { - randomValue2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); - } - for (int x = 1; x < BiomeWidth; x++) - { - float xRatio = x / (float)BiomeWidth; - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - float yRatio = (y - YStart) / (float)BlockDepth; - float xAngleWrap = x / (float)BiomeWidth * MathHelper.TwoPi - MathHelper.Pi; - bool generateSand = yRatio < SandstoneYMinimum(xAngleWrap, randomValue1, randomValue2); - if (WorldGen.InWorld(trueX, y)) - { - if (y - YStart < BlockDepth - (int)(BlockDepth * 0.35f) + (int)(Math.Sin(xRatio * MathHelper.Pi) * (int)(BlockDepth * 0.35f))) - { - Main.tile[trueX, y] = new Tile() - { - type = generateSand ? (ushort)ModContent.TileType() : (ushort)ModContent.TileType(), - wall = generateSand ? (ushort)ModContent.WallType() : (ushort)ModContent.WallType() - }; - Main.tile[trueX, y].active(true); - } - } - } - } - } - public static float SandstoneYMinimum(float xAsAngle, float randomValue1, float randomValue2) - { - float sineSquaredRandom1 = randomValue1 * (float)Math.Cos(xAsAngle * randomValue1) * (float)Math.Cos(xAsAngle * randomValue1); - float sineSquaredRandom2 = randomValue1 * (float)Math.Sin(xAsAngle * randomValue1) * (float)Math.Sin(xAsAngle * randomValue1); - float sineSquaredRandom3 = randomValue2 * (float)Math.Sin(xAsAngle * randomValue2); - float sineSquaredRandom4 = (float)Math.Sin(randomValue1 / randomValue2 * xAsAngle) * (float)Math.Cos(randomValue1 * MathHelper.Pi); - return 0.25f * Math.Abs(sineSquaredRandom1 + 0.5f * sineSquaredRandom2 + sineSquaredRandom3 - sineSquaredRandom4) + 0.25f; - } - #endregion - - #region Generating Water - public const int PerlinIterations = 1; - public const int PerlinOctaves = 4; - public const int PerlinXEdgeClamp = 20; - public const float PerlinYDelta = 40; - public const float PerlinNoiseMax = 0.05f; - public const float PerlinThreshold = 0.1f; // Be careful with this number - public static void CreateWater() - { - // Generate water underground. - int[] seeds = new int[PerlinIterations]; - for (int i = 0; i < seeds.Length; i++) - { - seeds[i] = WorldGen.genRand.Next(); - } - for (int x = 1; x < BiomeWidth; x++) - { - float xRatio = x / (float)BiomeWidth; - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - float yRatio = (y - YStart) / (float)BlockDepth; - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - if (y - YStart < BlockDepth - (int)(BlockDepth * 0.35f) + (int)(Math.Sin(xRatio * MathHelper.Pi) * (int)(BlockDepth * 0.35f)) - PerlinYDelta) - { - if (x < PerlinXEdgeClamp || x > BiomeWidth - PerlinXEdgeClamp) - continue; - float perlinAverage = 0f; - for (int k = 0; k < seeds.Length; k++) - { - perlinAverage += PerlinNoise2D(xRatio, yRatio, PerlinOctaves, seeds[k]) / PerlinIterations; - } - if (perlinAverage > PerlinThreshold * WorldGen.genRand.NextFloat(1f - PerlinNoiseMax, 1f + PerlinNoiseMax)) - { - ushort oldWall = Main.tile[trueX, y].wall; - Main.tile[trueX, y] = new Tile() - { - wall = oldWall, - liquid = 255 - }; - } - } - } - } - - // Generate water above-ground. - int startingDepth = (int)(WorldGen.genRand.Next(4, 8 + 1) * Main.maxTilesX / 4200f); - int endingDepth = (int)(WorldGen.genRand.Next(27, 35 + 1) * Main.maxTilesX / 4200f); - float waterFinishingAngle = WorldGen.genRand.NextFloat(MathHelper.ToRadians(145f), MathHelper.ToRadians(170f)); - for (int x = 30; x < BiomeWidth - 30; x++) - { - float xRatio = (x - 30) / (BiomeWidth - 30f); - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart; y <= YStart + (int)(Math.Sin((1f - xRatio) * waterFinishingAngle) * (endingDepth - startingDepth) + startingDepth); y++) - { - ushort oldWall = Main.tile[trueX, y].wall; - Main.tile[trueX, y] = new Tile() - { - wall = oldWall, - liquid = 255 - }; - } - } - } - #endregion - - #region Generating Edge Sandstone - public const int EdgeCheckMinX = 6; - public const int EdgeCheckMaxX = 8; - public const int EdgeCheckMinY = 4; - public const int EdgeCheckMaxY = 6; - public const int MinimumEdgeScore = 4; - public const int SpotWidth = 4; - public static void GenerateHardenedSandstone() - { - for (int x = 1; x < BiomeWidth; x++) - { - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - int edgeScore = GetEdgeScore(trueX, y); - - if (edgeScore >= MinimumEdgeScore) - { - for (int dx = -SpotWidth / 2; dx <= SpotWidth; dx++) - { - for (int dy = -SpotWidth / 2; dy <= SpotWidth / 2; dy++) - { - 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)) - { - Main.tile[trueX + dx, y + dy].type = (ushort)ModContent.TileType(); - } - } - } - } - } - } - } - } - public static int GetEdgeScore(int x, int y) - { - int edgeScore = 0; - for (int dx = x - WorldGen.genRand.Next(EdgeCheckMinX, EdgeCheckMaxX + 1); dx <= x + WorldGen.genRand.Next(EdgeCheckMinX, EdgeCheckMaxX + 1); dx++) - { - if (dx == x) - continue; - if (CalamityUtils.ParanoidTileRetrieval(dx, y).liquid == 255) - edgeScore++; - } - for (int dy = y - WorldGen.genRand.Next(EdgeCheckMinY, EdgeCheckMaxY + 1); dy <= y + WorldGen.genRand.Next(EdgeCheckMinY, EdgeCheckMaxY + 1); dy++) - { - if (dy == y) - continue; - if (CalamityUtils.ParanoidTileRetrieval(x, dy).liquid == 255) - edgeScore++; - } - return edgeScore; - } - #endregion - - #region Generating Islands - public const int IslandCount = 6; - public const int IslandXPadding = 20; - - public const int IslandMinWidth = 15; - public const int IslandMaxWidth = 22; - - public const int IslandMinDepth = 5; - public const int IslandMaxDepth = 10; - - public static void SettleWater() - { - Liquid.QuickWater(3, -1, -1); - WorldGen.WaterCheck(); - int counter = 0; - Liquid.quickSettle = true; - while (counter < 10) - { - counter++; - while (Liquid.numLiquid > 0) - { - Liquid.UpdateLiquid(); - } - WorldGen.WaterCheck(); - } - Liquid.quickSettle = false; - } - public static void GenerateIslands() - { - for (int i = 0; i < IslandCount; i++) - { - int y = YStart - 240; - int x = WorldGen.genRand.Next(IslandMaxWidth + IslandXPadding, BiomeWidth - IslandMaxWidth - IslandXPadding); - if (!CalamityWorld.abyssSide) - x = Main.maxTilesX - x; - while (CalamityUtils.ParanoidTileRetrieval(x, y).liquid == 0) - { - y++; - if (y > Main.rockLayer - 35) - { - break; - } - } - if (y > Main.rockLayer - 35) - { - i--; - continue; // Try again - } - int height = 2 * WorldGen.genRand.Next(IslandMinDepth, IslandMaxDepth + 1); - int width = WorldGen.genRand.Next(IslandMinWidth, IslandMaxWidth + 1); - int treePosition = WorldGen.genRand.Next(-width + 4, width - 4); - - for (float theta = 0f; theta <= MathHelper.TwoPi; theta += 0.05f) - { - for (int dx = 0; dx != (int)(height * Math.Cos(theta)); dx += (height * Math.Cos(theta) > 0).ToDirectionInt()) - { - for (int dy = 0; dy != (int)(width * Math.Sin(theta)); dy += (width * Math.Sin(theta) > 0).ToDirectionInt()) - { - if (WorldGen.InWorld(x + dx, y + dy)) - { - if (dy >= -2 - WorldGen.genRand.Next(-2, 3)) - { - 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].slope(0); - Main.tile[x + dx, y + dy - y2].halfBrick(false); - Main.tile[x + dx, y + dy - y2].active(true); - } - if (dy == -2 && dx == treePosition) - { - WorldGen.PlaceTile(x + dx, y + dy - extraHeight - 1, ModContent.TileType()); - GrowSaplingImmediately(x + dx, y + dy - extraHeight - 1); - } - } - else - { - Main.tile[x + dx, y + dy].liquid = 0; - } - } - } - } - } - } - } - #endregion - - #region Smoothening Everything - public static void SmoothenTheEntireSea() - { - for (int x = 2; x < BiomeWidth - 2; x++) - { - int trueX = x; - if (!CalamityWorld.abyssSide) - trueX = Main.maxTilesX - x; - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - Tile.SmoothSlope(trueX, y); - } - } - } - #endregion - - #region Generating Scenery - public const int ColumnMinDistanceX = 8; - public const int ColumnMinHeight = 10; - public const int ColumnMaxHeight = 27; - public const int StalactitePairMinDistance = 6; - public const int StalactitePairMaxDistance = 44; - public static void GenerateVentsAndFossils() - { - for (int x = 1; x < BiomeWidth; x++) - { - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - // Generate vents in the top 45% - if (y - YStart < BlockDepth * 0.45f) - { - if (WorldGen.SolidTile(trueX, y + 1) && WorldGen.genRand.NextBool(20)) - { - PlaceMiscTile(trueX, y, 1, 2, (ushort)ModContent.TileType()); - } - } - // And fossils in the bottom 55% - else - { - if (WorldGen.SolidTile(trueX, y + 1)) - { - // Generate ribs such that they're all nearby - if (WorldGen.genRand.NextBool(25)) - { - ushort type = (ushort)Utils.SelectRandom(WorldGen.genRand, - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType(), - ModContent.TileType()); - int height; - if (type == ModContent.TileType() || type == ModContent.TileType()) - { - height = 3; - } - else if (type == ModContent.TileType()) - { - height = 2; - } - else if (type == ModContent.TileType()) - { - height = 4; - } - else - { - height = 1; - } - PlaceMiscTile(trueX, y, 1, height, type); - } - else if (WorldGen.genRand.NextBool(16)) - { - PlaceMiscTile(trueX, y, 3, 2, (ushort)Utils.SelectRandom(WorldGen.genRand, ModContent.TileType(), ModContent.TileType(), ModContent.TileType())); - } - } - } - } - } - } - public static void PlaceColumns() - { - int previousX = 0; - int style; - for (int x = 1; x < BiomeWidth; x++) - { - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - if (y - YStart > BlockDepth * 0.5f) - { - if (WorldGen.SolidTile(trueX, y + 1) && - WorldGen.SolidTile(trueX + 1, y + 1) && - SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y + 1).type) && - WorldGen.genRand.NextBool(3) && - Math.Abs(trueX - previousX) >= ColumnMinDistanceX) - { - int top = y; - int height = 0; - while (!(WorldGen.SolidTile(trueX - 1, top) && WorldGen.SolidTile(trueX, top) && WorldGen.SolidTile(trueX + 1, top))) - { - top--; - height++; - if (height > ColumnMaxHeight + 1) - break; - } - if (height <= ColumnMaxHeight && height >= ColumnMinHeight) - { - for (int dy = 0; dy < height; dy++) - { - style = WorldGen.genRand.Next(3); - short yFrame = 18; - if (dy == 0) - yFrame = 36; - if (dy == height - 1) - 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; - Main.tile[trueX, y - dy] = new Tile - { - type = (ushort)ModContent.TileType(), - frameX = (short)(style * 36), - frameY = yFrame, - liquid = 255, - wall = oldWall - }; - Main.tile[trueX, y - dy].active(true); - - 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; - Main.tile[trueX + 1, y - dy] = new Tile - { - type = (ushort)ModContent.TileType(), - frameX = (short)(style * 36 + 18), - frameY = yFrame, - liquid = 255, - wall = oldWall - }; - Main.tile[trueX + 1, y - dy].active(true); - } - previousX = trueX; - } - } - } - } - } - } - public static void PlaceStalactites() - { - int heightFromType(int type) - { - if (type <= 2) - return 2; - else if (type <= 4) - return 3; - else - return 4; - }; - for (int x = 1; x < BiomeWidth; x++) - { - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart; y <= YStart + BlockDepth; y++) - { - if (y - YStart > BlockDepth * 0.25f) - { - if (WorldGen.SolidTile(trueX, y - 1) && WorldGen.genRand.NextBool(10)) - { - int dy = 1; - while (!CalamityUtils.ParanoidTileRetrieval(trueX, y + dy).active()) - { - dy++; - if (dy > StalactitePairMaxDistance) - break; - } - if (dy <= StalactitePairMaxDistance && dy >= StalactitePairMinDistance) - { - int type = WorldGen.genRand.Next(6); - type++; - int height = heightFromType(type); - PlaceStalactite(trueX, y, height, (ushort)CalamityMod.Instance.TileType($"SulphurousStalactite{type}")); - if (WorldGen.SolidTile(trueX, y + dy + 1)) - { - PlaceStalacmite(trueX, y + dy, height, (ushort)CalamityMod.Instance.TileType($"SulphurousStalacmite{type}")); - } - - // Reset the slope/half brick variables for the tiles below/above the pairs, so that it doesn't look like there's an - // imaginary gap between the stalactite and tile it's attached to. - Main.tile[trueX, y - 1].slope(0); - Main.tile[trueX, y - 1].halfBrick(false); - - Main.tile[trueX, y + dy + 1].slope(0); - Main.tile[trueX, y + dy + 1].halfBrick(false); - } - } - } - } - } - } - public static void PlaceMiscTile(int x, int y, int width, int height, ushort type, int style = 0) - { - try - { - bool canGenerate = true; - for (int i = x; i < x + width; i++) - { - for (int j = y - (int)Math.Ceiling(height / 2.0); j < y + (int)Math.Ceiling(height / 2.0); j++) - { - if (Main.tile[i, j] is null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active()) - { - canGenerate = false; - } - } - if (Main.tile[i, y + 1] is null) - { - 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]) - { - canGenerate = false; - } - } - if (canGenerate) - { - WorldGen.PlaceTile(x, y, type, style: style); - } - } - catch - { - return; // This should only ever happen from an index error, and there's really no point in continuing if that happens - } - } - public static void PlaceStalactite(int x, int y, int height, ushort type) - { - for (int dy = 0; dy < height; dy++) - { - ushort oldWall = Main.tile[x, y + dy].wall; - Main.tile[x, y + dy] = new Tile - { - wall = oldWall, - type = type, - frameY = (short)(dy * 18) - }; - Main.tile[x, y + dy].active(true); - } - } - public static void PlaceStalacmite(int x, int y, int height, ushort type) - { - for (int dy = height - 1; dy >= 0; dy--) - { - ushort oldWall = Main.tile[x, y + dy].wall; - Main.tile[x, y - dy] = new Tile - { - type = type, - frameY = (short)(height * 18 - dy * 18), - wall = oldWall - }; - Main.tile[x, y - dy].active(true); - } - } - #endregion - - #region Generating Chests - public const int CheckCutoffDistance = 15; - public static void PlaceRustyChests() - { - // Ambiguity bullshit. - int[] ItemTypes = { ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() }; - - for (int i = 0; i < ItemTypes.Length; ++i) - { - Chest chest = null; - int attempts = 0; - - while (chest is null) - { - attempts++; - int x = WorldGen.genRand.Next(CheckCutoffDistance, BiomeWidth - CheckCutoffDistance); - if (!CalamityWorld.abyssSide) - { - x = Main.maxTilesX - x; - } - int y = WorldGen.genRand.Next(YStart + CheckCutoffDistance, YStart + BlockDepth - CheckCutoffDistance); - if (WorldGen.InWorld(x, y)) - { - if (!CalamityUtils.ParanoidTileRetrieval(x, y).active() && - SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type) && - CalamityUtils.ParanoidTileRetrieval(x, y + 1).active()) - { - chest = WorldGenerationMethods.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); - } - } - } - - // If a chest was placed, force its first item to be the unique item. - if (chest != null) - { - chest.item[0].SetDefaults(ItemTypes[i]); - chest.item[0].Prefix(-1); - } - } - } - #endregion - - #region Removal of stupid Tiles above the Sea - - public static List OtherTilesForSulphSeaToDestroy = new List() - { - TileID.PalmTree, - TileID.Sunflower, - TileID.CorruptThorns, - TileID.CrimtaneThorns, - TileID.CorruptGrass, - TileID.CorruptPlants, - TileID.Stalactite, - TileID.ImmatureHerbs, - TileID.MatureHerbs, - }; - - public static List WallsForSulphSeaToDestroy = new List() - { - WallID.Dirt, - WallID.DirtUnsafe, - WallID.DirtUnsafe1, - WallID.DirtUnsafe2, - WallID.DirtUnsafe3, - WallID.DirtUnsafe4, - WallID.Cave6Unsafe, // Rocky dirt wall - WallID.GrassUnsafe, - WallID.CorruptGrassUnsafe, - WallID.EbonstoneUnsafe, - WallID.CrimstoneUnsafe, - }; - public static void RemoveStupidTilesAboveSea() - { - for (int x = 0; x < BiomeWidth; x++) - { - int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; - for (int y = YStart - 140; y < YStart + 80; y++) - { - int type = CalamityUtils.ParanoidTileRetrieval(trueX, y).type; - if (YStartWhitelist.Contains(type) || - OtherTilesForSulphSeaToDestroy.Contains(type)) - { - if (Main.tile[trueX, y] is null) - Main.tile[trueX, y] = new Tile(); - Main.tile[trueX, y].active(false); - } - if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].wall)) - { - Main.tile[trueX, y].wall = 0; - } - } - } - } - #endregion - - #region Misc Functions - public static List YStartWhitelist = new List() - { - TileID.Stone, - TileID.Dirt, - TileID.Sand, - TileID.Ebonsand, - TileID.Crimsand, - TileID.Grass, - TileID.CorruptGrass, - TileID.FleshGrass, - TileID.ClayBlock, - TileID.Mud, - TileID.Copper, - TileID.Tin, - TileID.Iron, - TileID.Lead, - TileID.Silver, - TileID.Tungsten, - TileID.Crimstone, - TileID.Ebonstone, - TileID.HardenedSand, - TileID.CorruptHardenedSand, - TileID.CrimsonHardenedSand, - TileID.Coral, - TileID.BeachPiles, - TileID.Plants, - TileID.Plants2, - TileID.SmallPiles, - TileID.LargePiles, - TileID.LargePiles2, - TileID.Trees, - TileID.Vines, - TileID.CrimsonVines, - TileID.Containers, - TileID.JungleGrass // Yes, this can happen on rare occasion - }; - public static void DetermineYStart() - { - int maxHeight = 0; - for (int i = 40; i < BiomeWidth + 30; i++) - { - int xCheck = CalamityWorld.abyssSide ? i : Main.maxTilesX - i; - int YStart = (int)WorldGen.worldSurfaceLow - 20; // 30 tiles below the absolute lowest a floating island can spawn - while (!Main.tile[xCheck, YStart].active() || !YStartWhitelist.Contains(Main.tile[xCheck, YStart].type)) - { - YStart++; - if (YStart > Main.rockLayer - 40) - break; - } - maxHeight += YStart; - } - YStart = maxHeight / BiomeWidth; - } - public static void GrowSaplingImmediately(int i, int j) - { - int trueStartingPositionY = j; - while (TileLoader.IsSapling(Main.tile[i, trueStartingPositionY].type)) - { - trueStartingPositionY++; - } - Tile tileAtPosition = Main.tile[i, trueStartingPositionY]; - Tile tileAbovePosition = Main.tile[i, trueStartingPositionY - 1]; - if (!tileAtPosition.active() || tileAtPosition.halfBrick() || tileAtPosition.slope() != 0) - { - return; - } - if (tileAbovePosition.wall != 0) - { - return; - } - if (!WorldGen.EmptyTileCheck(i - 1, i + 1, trueStartingPositionY - 30, trueStartingPositionY - 1, 20)) - { - return; - } - int treeHeight = WorldGen.genRand.Next(10, 21); - int frameYIdeal = WorldGen.genRand.Next(-8, 9); - frameYIdeal *= 2; - short frameY = 0; - for (int k = 0; k < treeHeight; k++) - { - tileAtPosition = Main.tile[i, trueStartingPositionY - 1 - k]; - if (k == 0) - { - tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = 66; - tileAtPosition.frameY = 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; - } - else - { - if (frameY != frameYIdeal) - { - float heightRatio = k / (float)treeHeight; - bool increaseFrameY = heightRatio >= 0.25f && ((heightRatio < 0.5f && WorldGen.genRand.Next(13) == 0) || (heightRatio < 0.7f && WorldGen.genRand.Next(9) == 0) || heightRatio >= 0.95f || WorldGen.genRand.Next(5) != 0 || true); - if (increaseFrameY) - { - frameY += (short)(Math.Sign(frameYIdeal) * 2); - } - } - tileAtPosition.active(true); - tileAtPosition.type = TileID.PalmTree; - tileAtPosition.frameX = (short)(22 * WorldGen.genRand.Next(0, 3)); - tileAtPosition.frameY = frameY; - } - } - WorldGen.RangeFrame(i - 2, trueStartingPositionY - treeHeight - 1, i + 2, trueStartingPositionY + 1); - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, i, (int)(trueStartingPositionY - treeHeight * 0.5), treeHeight + 1, TileChangeType.None); - } - } - #endregion - public static void PlaceAbyss() { int x = Main.maxTilesX; @@ -1068,7 +230,7 @@ namespace CalamityMod.World } } - WorldGenerationMethods.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, CalamityWorld.abyssChasmBottom, true); + MiscWorldgenRoutines.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, CalamityWorld.abyssChasmBottom, true); int maxAbyssIslands = 11; //Small World if (y > 2100) @@ -1076,8 +238,9 @@ namespace CalamityMod.World else if (y > 1500) maxAbyssIslands = 16; //Medium World - WorldGenerationMethods.SpecialHut((ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.WallType(), 8, abyssChasmX, CalamityWorld.abyssChasmBottom); + // Place the Terminus shrine. + UndergroundShrines.SpecialHut((ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.WallType(), UndergroundShrines.UndergroundShrineType.Abyss, abyssChasmX, CalamityWorld.abyssChasmBottom); int islandLocationOffset = 30; int islandLocationY = rockLayer; @@ -1090,32 +253,32 @@ namespace CalamityMod.World switch (randomIsland) { case 0: - WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); break; case 1: - WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX += 30; break; case 2: - WorldGenerationMethods.AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX -= 30; break; case 3: - WorldGenerationMethods.AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX += 25; break; case 4: - WorldGenerationMethods.AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - WorldGenerationMethods.AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX -= 25; break; } @@ -1132,7 +295,7 @@ namespace CalamityMod.World for (int abyssHouse = 0; abyssHouse < CalamityWorld.numAbyssIslands; abyssHouse++) //11 15 19 { if (abyssHouse != 20) - WorldGenerationMethods.AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], + AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], CalamityWorld.AbyssIslandY[abyssHouse], CalamityWorld.AbyssItemArray[abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse], //10 choices 0 to 9 CalamityWorld.AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); @@ -1199,5 +362,460 @@ namespace CalamityMod.World } } } - } + + #region Houses + public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) + { + int sizeMinSmall = sizeMin / 5; + int sizeMaxSmall = sizeMax / 5; + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); + CalamityUtils.SafeSquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = isVoid ? ModContent.TileType() : ModContent.TileType(); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = hasChest ? ModContent.TileType() : ModContent.TileType(); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + 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; + CalamityUtils.SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + if (hasTenebris) + { + int p = num3; + int num150; + for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) + { + int num14 = num6; + while (!Main.tile[p, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); //-3 4 + num150 = 1; //4 8 + int num16 = ModContent.TileType(); + for (int n = p - num150; n <= p + num150; n++) + { + for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - p); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + 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; + CalamityUtils.SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + } + int sizeMinSmall2 = sizeMin2 / 8; + int sizeMaxSmall2 = sizeMax2 / 8; + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = isVoid ? ModContent.TileType() : ModContent.TileType(); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + 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; + CalamityUtils.SafeSquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (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())) + { + 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())) + { + 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())) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + CalamityUtils.SafeSquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + CalamityUtils.SafeSquareTileFrame(num34, num35, true); + } + } + } + + public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) + { + ushort type = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); //tile + ushort wall = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(5, 9); + int num3 = 3; + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + 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].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) + { + Main.tile[n, num8].active(false); + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + switch (itemChoice) + { + case 0: + itemChoice = ModContent.ItemType(); + break; //rain item + case 1: + itemChoice = ModContent.ItemType(); + break; //movement acc + case 2: + itemChoice = ModContent.ItemType(); + break; //regen acc + case 3: + itemChoice = ModContent.ItemType(); + break; //ranged + case 4: + itemChoice = ModContent.ItemType(); + break; //defense acc + case 5: + itemChoice = ModContent.ItemType(); + break; //melee + case 6: + itemChoice = ModContent.ItemType(); + break; //light pet + case 7: + itemChoice = ModContent.ItemType(); + break; //summon + case 8: + itemChoice = ModContent.ItemType(); + break; //magic + case 9: + itemChoice = ModContent.ItemType(); + break; //throwing + default: + itemChoice = 497; + break; + } + WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest + } + #endregion + + } } diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs new file mode 100644 index 0000000000..8d44f12849 --- /dev/null +++ b/World/AstralBiome.cs @@ -0,0 +1,1175 @@ +using CalamityMod.Schematics; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.AstralDesert; +using CalamityMod.Tiles.AstralSnow; +using CalamityMod.Tiles.FurnitureVoid; +using CalamityMod.Tiles.Ores; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public class AstralBiome + { + public static bool CanAstralMeteorSpawn() + { + int astralOreCount = 0; + float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 + int astralOreAllowed = (int)(200f * worldSizeFactor); // Small = 201 Medium = 305 Large = 401 + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + int y = 5; + while (y < Main.worldSurface) + { + if (Main.tile[x, y].active() && Main.tile[x, y].type == ModContent.TileType()) + { + astralOreCount++; + if (astralOreCount > astralOreAllowed) + return false; + } + y++; + } + } + return true; + } + + public static bool CanAstralBiomeSpawn() + { + int astralTileCount = 0; + float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 + int astralTilesAllowed = (int)(400f * worldSizeFactor); // Small = 401 Medium = 605 Large = 801 + for (int x = 5; x < Main.maxTilesX - 5; x++) + { + int y = 5; + 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())) + { + astralTileCount++; + if (astralTileCount > astralTilesAllowed) + return false; + } + y++; + } + } + return true; + } + + public static void PlaceAstralMeteor() + { + Mod ancientsAwakened = CalamityMod.Instance.ancientsAwakened; + + // This flag is also used to determine whether players are nearby. + bool meteorDropped = true; + + // Clients in multiplayer don't drop meteors. + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active) + { + meteorDropped = false; + break; + } + } + + // Check whether there is already too much ore. + if (!CanAstralMeteorSpawn()) + return; + + UnifiedRandom rand = WorldGen.genRand; + float solidTileRequirement = 600f; + bool localAbyssSide = WorldGen.dungeonX < Main.maxTilesX / 2; + while (!meteorDropped) + { + float worldEdgeMargin = (float)Main.maxTilesX * 0.08f; + int xLimit = Main.maxTilesX / 2; + int x = CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); + while ((float)x > (float)Main.spawnTileX - worldEdgeMargin && (float)x < (float)Main.spawnTileX + worldEdgeMargin) + { + x = CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); + } + //world surface = 920 large 740 medium 560 small + 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]) + { + int suitableTiles = 0; + int checkRadius = 15; + for (int l = x - checkRadius; l < x + checkRadius; l++) + { + for (int m = y - checkRadius; m < y + checkRadius; m++) + { + if (WorldGen.SolidTile(l, m)) + { + 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) + { + 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()) + { + suitableTiles -= 100; + } + + // 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")) + { + suitableTiles -= 100; + } + } + } + + // Liquid aversion makes meteors less likely to fall in lakes + else if (Main.tile[l, m].liquid > 0) + { + suitableTiles--; + } + } + } + + if ((float)suitableTiles < solidTileRequirement) + { + solidTileRequirement -= 0.5f; + break; + } + meteorDropped = GenerateAstralMeteor(x, y); + + // If the meteor actually dropped, post the message stating as such. + if (meteorDropped) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + + CalamityUtils.DisplayLocalizedText(key, messageColor); + break; + } + break; + } + else + { + y++; + } + } + if (solidTileRequirement < 100f) + { + return; + } + } + } + + public static bool GenerateAstralMeteor(int i, int j) + { + UnifiedRandom rand = WorldGen.genRand; + if (i < 50 || i > Main.maxTilesX - 50) + { + return false; + } + // Avoid the dungeon so that the beacon doesn't eat it. + if (Math.Abs(i - WorldGen.dungeonX) < 65) + { + return false; + } + if (j < 50 || j > Main.maxTilesY - 50) + { + return false; + } + int num = 35; + Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); + for (int k = 0; k < 255; k++) + { + if (Main.player[k].active) + { + Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); + if (rectangle.Intersects(value)) + { + return false; + } + } + } + for (int l = 0; l < 200; l++) + { + if (Main.npc[l].active) + { + Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); + if (rectangle.Intersects(value2)) + { + return false; + } + } + } + for (int m = i - num; m < i + num; m++) + { + for (int n = j - num; n < j + num; n++) + { + if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) + { + return false; + } + } + } + num = rand.Next(17, 23); + for (int num2 = i - num; num2 < i + num; num2++) + { + for (int num3 = j - num; num3 < j + num; num3++) + { + if (num3 > j + rand.Next(-2, 3) - 5) + { + float num4 = (float)Math.Abs(i - num2); + float num5 = (float)Math.Abs(j - num3); + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + if ((double)num6 < (double)num * 0.9 + (double)rand.Next(-4, 5)) + { + if (Main.tile[num2, num3] != null) + { + if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) + { + Main.tile[num2, num3].active(false); + } + Main.tile[num2, num3].type = (ushort)ModContent.TileType(); + } + } + } + } + } + num = WorldGen.genRand.Next(8, 14); + for (int num7 = i - num; num7 < i + num; num7++) + { + for (int num8 = j - num; num8 < j + num; num8++) + { + if (num8 > j + rand.Next(-2, 3) - 4) + { + float num9 = (float)Math.Abs(i - num7); + float num10 = (float)Math.Abs(j - num8); + float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); + if ((double)num11 < (double)num * 0.8 + (double)rand.Next(-3, 4)) + { + if (Main.tile[num7, num8] != null) + Main.tile[num7, num8].active(false); + } + } + } + } + num = WorldGen.genRand.Next(25, 35); + for (int num12 = i - num; num12 < i + num; num12++) + { + for (int num13 = j - num; num13 < j + num; num13++) + { + float num14 = (float)Math.Abs(i - num12); + float num15 = (float)Math.Abs(j - num13); + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.tile[num12, num13] != null) + { + 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) + { + try + { WorldGen.KillTile(num12, num13, false, false, true); } + catch (NullReferenceException) + { } + } + Main.tile[num12, num13].liquid = 0; + } + if (Main.tile[num12, num13].type == (ushort)ModContent.TileType()) + { + if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + } + WorldGen.SquareTileFrame(num12, num13, true); + WorldGen.SquareWallFrame(num12, num13, true); + } + } + } + num = WorldGen.genRand.Next(23, 32); + for (int num17 = i - num; num17 < i + num; num17++) + { + for (int num18 = j - num; num18 < j + num; num18++) + { + if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && rand.NextBool(10)) + { + float num19 = (float)Math.Abs(i - num17); + float num20 = (float)Math.Abs(j - num18); + float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); + if ((double)num21 < (double)num * 0.8) + { + 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) + { + WorldGen.KillTile(num17, num18, false, false, false); + } + Main.tile[num17, num18].type = (ushort)ModContent.TileType(); + WorldGen.SquareTileFrame(num17, num18, true); + } + } + } + } + } + num = WorldGen.genRand.Next(30, 38); + for (int num22 = i - num; num22 < i + num; num22++) + { + for (int num23 = j - num; num23 < j + num; num23++) + { + if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && rand.NextBool(20)) + { + float num24 = (float)Math.Abs(i - num22); + float num25 = (float)Math.Abs(j - num23); + float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); + if ((double)num26 < (double)num * 0.85) + { + 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) + { + WorldGen.KillTile(num22, num23, false, false, false); + } + Main.tile[num22, num23].type = (ushort)ModContent.TileType(); + WorldGen.SquareTileFrame(num22, num23, true); + } + } + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); + if (CanAstralBiomeSpawn()) + { + DoAstralConversion(new Point(i, j)); + + // Upward checks go up 180 tiles. If for whatever reason the placement Y position + // would cause this upward movement to go outside of the world, clamp it to prevent index problems. + if (j < 181) + j = 181; + + int checkWidth = 180; + float averageHeight = 0f; + float lowestHeight = 0f; + + int xAreaToSpawn = i; + + Dictionary xAreaHeightMap = new Dictionary(); + + // Gauge the bumpiness of various potential locations. + // The least bumpy one will be selected as the place to spawn the monolith. + for (int tries = 0; tries < 30; tries++) + { + int x = i + Main.rand.Next(-60, 61); + + // Don't attempt to add duplicate keys. + if (xAreaHeightMap.ContainsKey(x)) + continue; + + float averageRelativeHeight = 0f; + for (int dx = -30; dx <= 30; dx++) + { + WorldUtils.Find(new Point(x + dx, j - 180), Searches.Chain(new Searches.Down(360), new Conditions.IsSolid()), out Point result); + averageRelativeHeight += Math.Abs(result.Y - j); + } + averageRelativeHeight /= 60f; + xAreaHeightMap.Add(x, averageRelativeHeight); + } + + i = xAreaHeightMap.OrderBy(x => x.Value).First().Key; + + for (int x = i - checkWidth / 2; x < i + checkWidth / 2; x++) + { + int y = j - 200; + Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); + while (!Main.tileSolid[tileAtPosition.type] || + !tileAtPosition.active() || + TileID.Sets.Platforms[tileAtPosition.type]) + { + y++; + if (y > j - 10) + break; + tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); + } + lowestHeight = (int)MathHelper.Max(lowestHeight, y); + averageHeight += y; + } + lowestHeight -= 35f; + averageHeight /= checkWidth; + float height = lowestHeight; + + // If there's a sudden change between the average and lowest height (which is indicative of holes/chasms), go with the average. + if (Math.Abs(lowestHeight - averageHeight) > 50f) + height = averageHeight; + + // WorldGen.gen prevents NewItem from working, and thus prevents a bunch of dumb items from being spawned immediately and deleting the WoF/Aureus loot in the process. + WorldGen.gen = true; + // Add the average height of a tree to the Y position to offset trees usually messing with the calculation. + // Then also add 10 blocks because these things seem to always like to appear standing on the floor. + int finalVerticalOffset = 18; + bool _ = true; + SchematicManager.PlaceSchematic>("Astral Beacon", new Point(i, (int)height + finalVerticalOffset), SchematicAnchor.Center, ref _); + WorldGen.gen = false; + } + } + return true; + } + + public static void DoAstralConversion(object obj) + { + //Pre-calculate all variables necessary for elliptical area checking + Point origin = (Point)obj; + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; + + int distanceInTiles = 150 + (Main.maxTilesX - 4200) / 4200 * 200; + float distance = distanceInTiles * 16f; + float constant = distance * 2f / (float)Math.Sin(angle); + + float fociSpacing = distance * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); + int verticalRadius = (int)(constant / 16f); + + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; + + UnifiedRandom rand = WorldGen.genRand; + for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) + { + for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) + { + if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out float dist, y < origin.Y)) + { + //If we're in the outer blurPercent% of the ellipse + float percent = dist / constant; + float blurPercent = 0.98f; + if (percent > blurPercent) + { + float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent); + if (rand.NextFloat(1f) > outerEdgePercent) + { + ConvertToAstral(x, y); + } + } + else + { + ConvertToAstral(x, y); + } + } + } + } + } + + public static void ConvertToAstral(int startX, int endX, int startY, int endY) + { + for (int x = startX; x <= endX; x++) + { + for (int y = startY; y <= endY; y++) + { + ConvertToAstral(x, y); + } + } + } + + public static void ConvertToAstral(int x, int y) + { + if (WorldGen.InWorld(x, y, 1)) + { + int type = Main.tile[x, y].type; + int wallType = Main.tile[x, y].wall; + + if (Main.tile[x, y] != null) + { + if (WallID.Sets.Conversion.Grass[wallType]) + { + Main.tile[x, y].wall = (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(); + 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(); + 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(); + WorldGen.SquareWallFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + } + else + { + switch (wallType) + { + case WallID.DirtUnsafe: + case WallID.DirtUnsafe1: + case WallID.DirtUnsafe2: + case WallID.DirtUnsafe3: + case WallID.DirtUnsafe4: + case WallID.Cave6Unsafe: + case WallID.Dirt: + Main.tile[x, y].wall = (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(); + WorldGen.SquareWallFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + break; + case WallID.DesertFossil: + Main.tile[x, y].wall = (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(); + WorldGen.SquareWallFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + break; + case WallID.LivingWood: + Main.tile[x, y].wall = (ushort)ModContent.WallType(); + WorldGen.SquareWallFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + break; + } + } + if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) + { + Main.tile[x, y].type = (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(); + 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(); + 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(); + 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(); + 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(); + WorldGen.SquareTileFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + } + else + { + Tile tile = Main.tile[x, y]; + switch (type) + { + case TileID.Dirt: + Main.tile[x, y].type = (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(); + 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(); + WorldGen.SquareTileFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + break; + case TileID.DesertFossil: + Main.tile[x, y].type = (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(); + WorldGen.SquareTileFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + break; + case TileID.Vines: + Main.tile[x, y].type = (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(); + WorldGen.SquareTileFrame(x, y, true); + NetMessage.SendTileSquare(-1, x, y, 1); + break; + case TileID.LeafBlock: + case TileID.Sunflower: + WorldGen.KillTile(x, y); + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, x, y); + } + break; + case TileID.LargePiles: + if (tile.frameX <= 1170) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 0, 1170, 0, 18); + } + if (tile.frameX >= 1728) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 1728, 1872, 0, 18); + } + if (tile.frameX >= 1404 && tile.frameX <= 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) + { + RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)ModContent.TileType(), x, y, 324, 1566, 1872, 0, 18); + } + if (tile.frameX >= 756 && tile.frameX <= 900) + { + RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)ModContent.TileType(), x, y, 324, 756, 900, 0, 18); + } + break; + case TileID.SmallPiles: + if (tile.frameY == 18) + { + ushort newType; + if (tile.frameX >= 1476 && tile.frameX <= 1674) + { + newType = (ushort)ModContent.TileType(); + } + else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) + { + newType = (ushort)ModContent.TileType(); + } + else if (tile.frameX >= 900 && tile.frameX <= 1098) + { + newType = (ushort)ModContent.TileType(); + } + else + { + break; + } + int leftMost = x; + if (tile.frameX % 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; + 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; + WorldGen.SquareTileFrame(leftMost + 1, y, true); + NetMessage.SendTileSquare(-1, leftMost + 1, y, 1); + } + while (Main.tile[leftMost, y].frameX >= 216) + { + if (Main.tile[leftMost, y] != null) + Main.tile[leftMost, y].frameX -= 216; + if (Main.tile[leftMost + 1, y] != null) + Main.tile[leftMost + 1, y].frameX -= 216; + } + } + else if (tile.frameY == 0) + { + ushort newType3; + if (tile.frameX >= 972 && tile.frameX <= 1062) + { + newType3 = (ushort)ModContent.TileType(); + } + else if (tile.frameX <= 486) + { + newType3 = (ushort)ModContent.TileType(); + } + else if (tile.frameX >= 648 && tile.frameX <= 846) + { + newType3 = (ushort)ModContent.TileType(); + } + else + { + break; + } + Main.tile[x, y].type = newType3; + while (Main.tile[x, y].frameX >= 108) //REFRAME IT + { + Main.tile[x, y].frameX -= 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; + ushort newType2; + if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT + { + newType2 = (ushort)ModContent.TileType(); + } + else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) + { + newType2 = (ushort)ModContent.TileType(); + } + else if (tile.frameX <= 36) + { + newType2 = (ushort)ModContent.TileType(); + } + else + { + break; + } + + //Set types + if (Main.tile[x, topMost] != null) + { + Main.tile[x, topMost].type = newType2; + } + if (twoTall) + { + if (Main.tile[x, topMost + 1] != null) + Main.tile[x, topMost + 1].type = newType2; + } + + //Fix frames + while (Main.tile[x, topMost].frameX >= 54) + { + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].frameX -= 54; + if (twoTall) + { + if (Main.tile[x, topMost + 1] != null) + Main.tile[x, topMost + 1].frameX -= 54; + } + } + + if (Main.tile[x, topMost] != null) + { + WorldGen.SquareTileFrame(x, topMost, true); + NetMessage.SendTileSquare(-1, x, topMost, 1); + } + + if (Main.tile[x, topMost + 1] != null) + { + WorldGen.SquareTileFrame(x, topMost + 1, true); + NetMessage.SendTileSquare(-1, x, topMost + 1, 1); + } + + if (hanging) + { + ConvertToAstral(x, topMost - 1); + break; + } + else + { + if (twoTall) + { + ConvertToAstral(x, topMost + 2); + break; + } + ConvertToAstral(x, topMost + 1); + break; + } + } + } + } + } + } + + 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; + + if (WorldGen.InWorld(x, y, 1)) + { + #region WALL + if (Main.tile[x, y] != null) + { + if (wallType == ModContent.WallType()) + { + Main.tile[x, y].wall = WallID.DirtUnsafe; + } + else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) + { + Main.tile[x, y].wall = WallID.SnowWallUnsafe; + } + else if (wallType == ModContent.WallType()) + { + Main.tile[x, y].wall = WallID.DesertFossil; + } + else if (wallType == ModContent.WallType()) + { + switch (convert) + { + case ConvertType.Corrupt: + Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; + break; + case ConvertType.Crimson: + Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; + break; + case ConvertType.Hallow: + Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; + break; + case ConvertType.Pure: + Main.tile[x, y].wall = WallID.GrassUnsafe; + break; + } + } + else if (wallType == ModContent.WallType()) + { + Main.tile[x, y].wall = WallID.IceUnsafe; + } + else if (wallType == ModContent.WallType()) + { + Main.tile[x, y].wall = WallID.LivingWood; + } + else if (wallType == ModContent.WallType()) + { + switch (convert) + { + case ConvertType.Corrupt: + Main.tile[x, y].wall = WallID.EbonstoneUnsafe; + break; + case ConvertType.Crimson: + Main.tile[x, y].wall = WallID.CrimstoneUnsafe; + break; + case ConvertType.Hallow: + Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; + break; + case ConvertType.Pure: + Main.tile[x, y].wall = WallID.Stone; + break; + } + } + } + #endregion + + #region TILE + if (Main.tile[x, y] != null) + { + if (type == ModContent.TileType()) + { + tile.type = TileID.Dirt; + } + else if (type == ModContent.TileType()) + { + tile.type = TileID.SnowBlock; + } + else if (type == ModContent.TileType()) + { + tile.type = TileID.Silt; + } + else if (type == ModContent.TileType()) + { + tile.type = TileID.DesertFossil; + } + else if (type == ModContent.TileType()) + { + tile.type = TileID.ClayBlock; + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone); + } + else if (type == ModContent.TileType()) + { + tile.type = TileID.LivingWood; + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants); + } + else if (type == ModContent.TileType()) + { + SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18); + } + else if (type == ModContent.TileType()) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); + } + else if (type == ModContent.TileType()) + { + ushort originType = TileID.Stone; + switch (convert) + { + case ConvertType.Corrupt: + originType = TileID.Ebonstone; + break; + case ConvertType.Crimson: + originType = TileID.Crimstone; + break; + case ConvertType.Hallow: + originType = TileID.Pearlstone; + break; + } + ReplaceAstralStalactite(TileID.Stalactite, originType, x, y); + } + else if (type == ModContent.TileType()) + { + ushort originType = TileID.Sandstone; + switch (convert) + { + case ConvertType.Corrupt: + originType = TileID.CorruptSandstone; + break; + case ConvertType.Crimson: + originType = TileID.CrimsonSandstone; + break; + case ConvertType.Hallow: + originType = TileID.HallowSandstone; + break; + } + ReplaceAstralStalactite(TileID.Stalactite, originType, x, y); + } + else if (type == ModContent.TileType()) + { + ReplaceAstralStalactite(TileID.Stalactite, TileID.IceBlock, x, y); + } + if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt) + { + WorldGen.SquareTileFrame(x, y); + } + } + #endregion + + if (tileframe) + { + if (Main.netMode == NetmodeID.SinglePlayer) + { + WorldGen.SquareTileFrame(x, y, true); + } + else if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, x, y, 1); + } + } + } + } + + public static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure) + { + switch (convert) + { + case ConvertType.Corrupt: + if (corrupt != ushort.MaxValue) + { + Main.tile[x, y].type = corrupt; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Crimson: + if (crimson != ushort.MaxValue) + { + Main.tile[x, y].type = crimson; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Hallow: + if (hallow != ushort.MaxValue) + { + Main.tile[x, y].type = hallow; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Pure: + if (pure != ushort.MaxValue) + { + Main.tile[x, y].type = pure; + WorldGen.SquareTileFrame(x, y); + } + break; + } + } + + 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) + return; + + Main.tile[x, y].type = replaceType; + while (Main.tile[x, y].frameX >= replaceTextureWidth) + { + Main.tile[x, y].frameX -= (short)replaceTextureWidth; + } + + if (Main.tile[x - 1, y] != null) + RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x + 1, y] != null) + RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x, y - 1] != null) + RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x, y + 1] != null) + RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + } + + 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) + return; + + Main.tile[x, y].type = replaceType; + Main.tile[x, y].frameX += (short)addFrameX; + Main.tile[x, y].frameY += (short)addFrameY; + + if (Main.tile[x - 1, y] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); + if (Main.tile[x + 1, y] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY); + if (Main.tile[x, y - 1] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY); + if (Main.tile[x, y + 1] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY); + } + + public static void ReplaceAstralStalactite(ushort replaceType, ushort replaceOriginTile, int x, int y) + { + 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 yOriginTile = hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1); + + if (Main.tile[x, topMost++] != null) + Main.tile[x, topMost++].type = replaceType; + if (twoTall) + { + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].type = replaceType; + } + if (Main.tile[x, yOriginTile] != null) + Main.tile[x, yOriginTile].type = replaceOriginTile; + } + + public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) + { + Vector2 point = tile.ToWorldCoordinates(); + if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. + { + float distY = center.Y - point.Y; + point.Y -= distY * 8f; + } + float distance1 = Vector2.Distance(point, focus1); + float distance2 = Vector2.Distance(point, focus2); + distance = distance1 + distance2; + return distance <= distanceConstant; + } + } +} diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index f85a5bfcdf..117c270abb 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -1,12 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.Calamitas; using CalamityMod.NPCs.CeaselessVoid; @@ -15,23 +12,14 @@ using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Schematics; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; @@ -40,67 +28,62 @@ using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.World.Planets; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.IO; +using System.Linq; using Terraria; using Terraria.GameContent.Events; using Terraria.GameContent.Generation; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.World.Generation; namespace CalamityMod.World { - public class CalamityWorld : ModWorld + public class CalamityWorld : ModWorld { #region Vars public static int DoGSecondStageCountdown = 0; - public static bool dragonScalesBought = false; private const int saveVersion = 0; public static int ArmoredDiggerSpawnCooldown = 0; public static int MoneyStolenByBandit = 0; public static int Reforges; - public static Dictionary ScreenShakeSpots = new Dictionary(); - //Boss Rush - public static bool bossRushActive = false; //Whether Boss Rush is active or not - public static bool deactivateStupidFuckingBullshit = false; //Force Boss Rush to inactive - public static int bossRushStage = 0; //Boss Rush Stage - public static int bossRushSpawnCountdown = 180; //Delay before another Boss Rush boss can spawn - public static int bossRushHostileProjKillCounter = 0; + // Boss Rush + public static int bossRushHostileProjKillCounter = 0; - //Death Mode natural boss spawns - public static int bossSpawnCountdown = 0; //Death Mode natural boss spawn countdown - public static int bossType = 0; //Death Mode natural boss spawn type - public static int deathBossSpawnCooldown = 0; //Cooldown between Death Mode natural boss spawns + // Death Mode natural boss spawns + public static int bossSpawnCountdown = 0; // Death Mode natural boss spawn countdown + public static int bossType = 0; // Death Mode natural boss spawn type + public static int deathBossSpawnCooldown = 0; // Cooldown between Death Mode natural boss spawns - //Modes - public static bool demonMode = false; //Spawn rate boost - public static bool onionMode = false; //Extra accessory from Moon Lord - public static bool revenge = false; //Revengeance Mode - public static bool death = false; //Death Mode - public static bool defiled = false; //Defiled Mode - public static bool armageddon = false; //Armageddon Mode - public static bool ironHeart = false; //Iron Heart Mode + // Modes + public static bool demonMode = false; // Spawn rate boost + public static bool onionMode = false; // Extra accessory from Moon Lord + public static bool revenge = false; // Revengeance Mode + public static bool death = false; // Death Mode + public static bool armageddon = false; // Armageddon Mode + public static bool ironHeart = false; // Iron Heart Mode + public static bool malice = false; // Malice Mode, enrages all bosses and makes them drop good shit - // New Temple Altar - public static int newAltarX = 0; - public static int newAltarY = 0; + // New Temple Altar + public static int newAltarX = 0; + public static int newAltarY = 0; - //Evil Islands + // Evil Islands public static int fehX = 0; public static int fehY = 0; - //Brimstone Crag + // Brimstone Crag public static int fuhX = 0; public static int fuhY = 0; public static int calamityTiles = 0; - //Abyss & Sulphur + // Abyss & Sulphur public static int numAbyssIslands = 0; public static int[] AbyssIslandX = new int[20]; public static int[] AbyssIslandY = new int[20]; @@ -111,11 +94,11 @@ namespace CalamityMod.World public static int abyssChasmBottom = 0; public static bool rainingAcid; public static int acidRainPoints = 0; - public static int acidRainExtraDrawTime = 0; public static bool triedToSummonOldDuke = false; public static bool startAcidicDownpour = false; public static bool forcedRainAlready = false; public static bool forcedDownpourWithTear = false; + public static bool encounteredOldDuke = false; public static int forceRainTimer = 0; public static int timeSinceAcidRainKill = 0; public static int timeSinceAcidStarted = 0; @@ -127,44 +110,57 @@ namespace CalamityMod.World } } - //Astral + // Astral public static int astralTiles = 0; - //Sunken Sea + // Sunken Sea public static int sunkenSeaTiles = 0; public static Rectangle SunkenSeaLocation = Rectangle.Empty; - //Shrines + // Shrines public static int[] SChestX = new int[10]; public static int[] SChestY = new int[10]; public static bool roxShrinePlaced = false; - //Town NPC bools + // Planetoids + public static bool HasGeneratedLuminitePlanetoids = false; + + // Town NPC spawn/home bools public static bool spawnedBandit = false; public static bool spawnedCirrus = false; - public static bool foundHomePermafrost = false; - public static bool guideName = false; - public static bool wizardName = false; - public static bool steampunkerName = false; - public static bool stylistName = false; - public static bool witchDoctorName = false; - public static bool taxCollectorName = false; - public static bool pirateName = false; - public static bool mechanicName = false; - public static bool armsDealerName = false; - public static bool dryadName = false; - public static bool nurseName = false; - public static bool anglerName = false; - public static bool clothierName = false; + public static bool foundHomePermafrost = false; + + // Town NPC name chosen bools + public static bool anglerName = false; + public static bool armsDealerName = false; + public static bool clothierName = false; + public static bool cyborgName = false; + public static bool demolitionistName = false; + public static bool dryadName = false; + public static bool dyeTraderName = false; + public static bool goblinTinkererName = false; + public static bool guideName = false; + public static bool mechanicName = false; + public static bool merchantName = false; + public static bool nurseName = false; + public static bool painterName = false; + public static bool partyGirlName = false; + public static bool pirateName = false; + public static bool skeletonMerchantName = false; + public static bool steampunkerName = false; + public static bool stylistName = false; + public static bool tavernkeepName = false; + public static bool taxCollectorName = false; + public static bool truffleName = false; + public static bool witchDoctorName = false; + public static bool wizardName = false; #region Downed Bools - public static bool downedBossAny = false; //Any boss public static bool downedDesertScourge = false; public static bool downedCrabulon = false; public static bool downedHiveMind = false; public static bool downedPerforator = false; public static bool downedSlimeGod = false; - public static bool spawnedHardBoss = false; //Hardmode boss spawned public static bool downedCryogen = false; public static bool downedAquaticScourge = false; public static bool downedBrimstoneElemental = false; @@ -180,14 +176,14 @@ namespace CalamityMod.World public static bool downedSentinel1 = false; // Ceaseless Void public static bool downedSentinel2 = false; // Storm Weaver public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer - public static bool downedSecondSentinels = false; - public static bool downedPolterghast = false; + public static bool downedSecondSentinels = false; + public static bool downedPolterghast = false; public static bool downedDoG = false; public static bool downedBumble = false; - public static bool buffedEclipse = false; - public static bool downedBuffedMothron = false; public static bool downedYharon = false; + public static bool downedExoMechs = false; public static bool downedSCal = false; + public static bool downedAdultEidolonWyrm = false; public static bool downedGSS = false; public static bool downedCLAM = false; public static bool downedCLAMHardMode = false; @@ -203,9 +199,8 @@ namespace CalamityMod.World public override void Initialize() { if (CalamityConfig.Instance.NerfExpertPillars) - { NPC.LunarShieldPowerExpert = 100; - } + CalamityGlobalNPC.holyBoss = -1; CalamityGlobalNPC.doughnutBoss = -1; CalamityGlobalNPC.voidBoss = -1; @@ -213,8 +208,8 @@ namespace CalamityMod.World CalamityGlobalNPC.hiveMind = -1; CalamityGlobalNPC.scavenger = -1; - for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) - CalamityGlobalNPC.bobbitWormBottom[i] = -1; + for (int i = 0; i < CalamityGlobalNPC.bobbitWormBottom.Length; i++) + CalamityGlobalNPC.bobbitWormBottom[i] = -1; CalamityGlobalNPC.DoGHead = -1; CalamityGlobalNPC.SCal = -1; @@ -222,36 +217,54 @@ namespace CalamityMod.World CalamityGlobalNPC.laserEye = -1; CalamityGlobalNPC.fireEye = -1; CalamityGlobalNPC.brimstoneElemental = -1; - CalamityGlobalNPC.signus = -1; - bossRushStage = 0; + CalamityGlobalNPC.signus = -1; + CalamityGlobalNPC.draedonExoMechPrime = -1; + CalamityGlobalNPC.draedonExoMechTwinGreen = -1; + CalamityGlobalNPC.draedonExoMechTwinRed = -1; + CalamityGlobalNPC.draedonExoMechWorm = -1; + CalamityGlobalNPC.adultEidolonWyrmHead = -1; + BossRushEvent.BossRushStage = 0; DoGSecondStageCountdown = 0; ArmoredDiggerSpawnCooldown = 0; - bossRushActive = false; - bossRushSpawnCountdown = 180; + BossRushEvent.BossRushActive = false; + BossRushEvent.BossRushSpawnCountdown = 180; bossSpawnCountdown = 0; - bossRushHostileProjKillCounter = 0; - deathBossSpawnCooldown = 0; + bossRushHostileProjKillCounter = 0; + deathBossSpawnCooldown = 0; bossType = 0; - newAltarX = 0; - newAltarY = 0; + newAltarX = 0; + newAltarY = 0; abyssChasmBottom = 0; abyssSide = false; - spawnedBandit = false; - spawnedCirrus = false; - foundHomePermafrost = false; - guideName = false; - wizardName = false; - steampunkerName = false; - stylistName = false; - witchDoctorName = false; - taxCollectorName = false; - pirateName = false; - mechanicName = false; - armsDealerName = false; - dryadName = false; - nurseName = false; - anglerName = false; - clothierName = false; + + spawnedBandit = false; + spawnedCirrus = false; + foundHomePermafrost = false; + + anglerName = false; + armsDealerName = false; + clothierName = false; + cyborgName = false; + demolitionistName = false; + dryadName = false; + dyeTraderName = false; + goblinTinkererName = false; + guideName = false; + mechanicName = false; + merchantName = false; + nurseName = false; + painterName = false; + partyGirlName = false; + pirateName = false; + skeletonMerchantName = false; + steampunkerName = false; + stylistName = false; + tavernkeepName = false; + taxCollectorName = false; + truffleName = false; + witchDoctorName = false; + wizardName = false; + downedDesertScourge = false; downedAquaticScourge = false; downedHiveMind = false; @@ -270,15 +283,14 @@ namespace CalamityMod.World downedSentinel2 = false; downedSentinel3 = false; downedYharon = false; - buffedEclipse = false; + downedExoMechs = false; downedSCal = false; + downedAdultEidolonWyrm = false; downedCLAM = false; downedCLAMHardMode = false; downedBumble = false; downedCrabulon = false; downedBetsy = false; - downedBossAny = false; - spawnedHardBoss = false; demonMode = false; onionMode = false; revenge = false; @@ -286,18 +298,16 @@ namespace CalamityMod.World downedAstrageldon = false; downedPolterghast = false; downedGSS = false; - downedBuffedMothron = false; downedBoomerDuke = false; - downedSecondSentinels = false; + downedSecondSentinels = false; death = false; - defiled = false; armageddon = false; ironHeart = false; - dragonScalesBought = false; + malice = false; rainingAcid = false; downedEoCAcidRain = false; downedAquaticScourgeAcidRain = false; - forceRainTimer = 0; + forceRainTimer = 0; } #endregion @@ -337,14 +347,16 @@ namespace CalamityMod.World downed.Add("stormWeaver"); if (downedSentinel3) downed.Add("signus"); - if (downedSecondSentinels) - downed.Add("secondSentinels"); + if (downedSecondSentinels) + downed.Add("secondSentinels"); if (downedYharon) downed.Add("yharon"); - if (buffedEclipse) - downed.Add("eclipse"); + if (downedExoMechs) + downed.Add("exoMechs"); if (downedSCal) downed.Add("supremeCalamitas"); + if (downedAdultEidolonWyrm) + downed.Add("adultEidolonWyrm"); if (downedBumble) downed.Add("bumblebirb"); if (downedCrabulon) @@ -353,8 +365,6 @@ namespace CalamityMod.World downed.Add("betsy"); if (downedScavenger) downed.Add("scavenger"); - if (downedBossAny) - downed.Add("anyBoss"); if (demonMode) downed.Add("demonMode"); if (onionMode) @@ -365,34 +375,28 @@ namespace CalamityMod.World downed.Add("starGod"); if (downedAstrageldon) downed.Add("astrageldon"); - if (spawnedHardBoss) - downed.Add("hardBoss"); if (downedPolterghast) downed.Add("polterghast"); if (downedGSS) downed.Add("greatSandShark"); - if (downedBuffedMothron) - downed.Add("moth"); if (downedBoomerDuke) downed.Add("oldDuke"); if (death) downed.Add("death"); - if (defiled) - downed.Add("defiled"); if (armageddon) downed.Add("armageddon"); if (ironHeart) downed.Add("ironHeart"); + if (malice) + downed.Add("malice"); if (abyssSide) downed.Add("abyssSide"); - if (bossRushActive) + if (BossRushEvent.BossRushActive) downed.Add("bossRushActive"); if (downedCLAM) downed.Add("clam"); if (downedCLAMHardMode) downed.Add("clamHardmode"); - if (dragonScalesBought) - downed.Add("scales"); if (rainingAcid) downed.Add("acidRain"); if (spawnedBandit) @@ -401,44 +405,72 @@ namespace CalamityMod.World downed.Add("drunkPrincess"); if (foundHomePermafrost) downed.Add("archmageHome"); + + #region Save NPC Names + if (anglerName) + downed.Add("anglerName"); + if (armsDealerName) + downed.Add("armsDealerName"); + if (clothierName) + downed.Add("clothierName"); + if (cyborgName) + downed.Add("cyborgName"); + if (demolitionistName) + downed.Add("demolitionistName"); + if (dryadName) + downed.Add("dryadName"); + if (dyeTraderName) + downed.Add("dyeTraderName"); + if (goblinTinkererName) + downed.Add("goblinTinkererName"); if (guideName) downed.Add("guideName"); - if (wizardName) - downed.Add("wizardName"); + if (mechanicName) + downed.Add("mechanicName"); + if (merchantName) + downed.Add("merchantName"); + if (nurseName) + downed.Add("nurseName"); + if (painterName) + downed.Add("painterName"); + if (partyGirlName) + downed.Add("partyGirlName"); + if (pirateName) + downed.Add("pirateName"); + if (skeletonMerchantName) + downed.Add("skeletonMerchantName"); if (steampunkerName) downed.Add("steampunkerName"); if (stylistName) downed.Add("stylistName"); - if (witchDoctorName) - downed.Add("witchDoctorName"); + if (tavernkeepName) + downed.Add("tavernkeepName"); if (taxCollectorName) downed.Add("taxCollectorName"); - if (pirateName) - downed.Add("pirateName"); - if (mechanicName) - downed.Add("mechanicName"); - if (armsDealerName) - downed.Add("armsDealerName"); - if (dryadName) - downed.Add("dryadName"); - if (nurseName) - downed.Add("nurseName"); - if (anglerName) - downed.Add("anglerName"); - if (clothierName) - downed.Add("clothierName"); + if (truffleName) + downed.Add("truffleName"); + if (witchDoctorName) + downed.Add("witchDoctorName"); + if (wizardName) + downed.Add("wizardName"); + #endregion + if (downedEoCAcidRain) downed.Add("eocRain"); if (downedAquaticScourgeAcidRain) downed.Add("hmRain"); if (triedToSummonOldDuke) downed.Add("spawnedBoomer"); - if (startAcidicDownpour) - downed.Add("startDownpour"); - if (forcedRainAlready) - downed.Add("forcedRain"); + if (startAcidicDownpour) + downed.Add("startDownpour"); + if (forcedRainAlready) + downed.Add("forcedRain"); if (forcedDownpourWithTear) downed.Add("forcedTear"); + if (encounteredOldDuke) + downed.Add("encounteredOldDuke"); + if (HasGeneratedLuminitePlanetoids) + downed.Add("HasGeneratedLuminitePlanetoids"); return new TagCompound { @@ -481,57 +513,71 @@ namespace CalamityMod.World downedSentinel1 = downed.Contains("ceaselessVoid"); downedSentinel2 = downed.Contains("stormWeaver"); downedSentinel3 = downed.Contains("signus"); - downedSecondSentinels = downed.Contains("secondSentinels"); + downedSecondSentinels = downed.Contains("secondSentinels"); downedYharon = downed.Contains("yharon"); - buffedEclipse = downed.Contains("eclipse"); + downedExoMechs = downed.Contains("exoMechs"); downedSCal = downed.Contains("supremeCalamitas"); + downedAdultEidolonWyrm = downed.Contains("adultEidolonWyrm"); downedBumble = downed.Contains("bumblebirb"); downedCrabulon = downed.Contains("crabulon"); downedBetsy = downed.Contains("betsy"); downedScavenger = downed.Contains("scavenger"); - downedBossAny = downed.Contains("anyBoss"); demonMode = downed.Contains("demonMode"); onionMode = downed.Contains("onionMode"); revenge = downed.Contains("revenge"); downedStarGod = downed.Contains("starGod"); downedAstrageldon = downed.Contains("astrageldon"); - spawnedHardBoss = downed.Contains("hardBoss"); downedPolterghast = downed.Contains("polterghast"); downedGSS = downed.Contains("greatSandShark"); - downedBuffedMothron = downed.Contains("moth"); downedBoomerDuke = downed.Contains("oldDuke"); death = downed.Contains("death"); - defiled = downed.Contains("defiled"); armageddon = downed.Contains("armageddon"); ironHeart = downed.Contains("ironHeart"); + malice = downed.Contains("malice"); abyssSide = downed.Contains("abyssSide"); - bossRushActive = downed.Contains("bossRushActive"); + BossRushEvent.BossRushActive = downed.Contains("bossRushActive"); downedCLAM = downed.Contains("clam"); downedCLAMHardMode = downed.Contains("clamHardmode"); - dragonScalesBought = downed.Contains("scales"); rainingAcid = downed.Contains("acidRain"); + spawnedBandit = downed.Contains("bandit"); spawnedCirrus = downed.Contains("drunkPrincess"); foundHomePermafrost = downed.Contains("archmageHome"); - guideName = downed.Contains("guideName"); - wizardName = downed.Contains("wizardName"); - steampunkerName = downed.Contains("stylistName"); - stylistName = downed.Contains("stylistName"); - witchDoctorName = downed.Contains("witchDoctorName"); - taxCollectorName = downed.Contains("taxCollectorName"); - pirateName = downed.Contains("pirateName"); - mechanicName = downed.Contains("mechanicName"); - armsDealerName = downed.Contains("armsDealerName"); - dryadName = downed.Contains("dryadName"); - nurseName = downed.Contains("nurseName"); - anglerName = downed.Contains("anglerName"); - clothierName = downed.Contains("clothierName"); + + #region Load NPC Names + anglerName = downed.Contains("anglerName"); + armsDealerName = downed.Contains("armsDealerName"); + clothierName = downed.Contains("clothierName"); + cyborgName = downed.Contains("cyborgName"); + demolitionistName = downed.Contains("demolitionistName"); + dryadName = downed.Contains("dryadName"); + dyeTraderName = downed.Contains("dyeTraderName"); + goblinTinkererName = downed.Contains("goblinTinkererName"); + guideName = downed.Contains("guideName"); + mechanicName = downed.Contains("mechanicName"); + merchantName = downed.Contains("merchantName"); + nurseName = downed.Contains("nurseName"); + painterName = downed.Contains("painterName"); + partyGirlName = downed.Contains("partyGirlName"); + pirateName = downed.Contains("pirateName"); + skeletonMerchantName = downed.Contains("skeletonMerchantName"); + steampunkerName = downed.Contains("steampunkerName"); + stylistName = downed.Contains("stylistName"); + tavernkeepName = downed.Contains("tavernkeepName"); + taxCollectorName = downed.Contains("taxCollectorName"); + truffleName = downed.Contains("truffleName"); + witchDoctorName = downed.Contains("witchDoctorName"); + wizardName = downed.Contains("wizardName"); + #endregion + downedEoCAcidRain = downed.Contains("eocRain"); downedAquaticScourgeAcidRain = downed.Contains("hmRain"); triedToSummonOldDuke = downed.Contains("spawnedBoomer"); - startAcidicDownpour = downed.Contains("startDownpour"); - forcedRainAlready = downed.Contains("forcedRain"); + startAcidicDownpour = downed.Contains("startDownpour"); + forcedRainAlready = downed.Contains("forcedRain"); forcedDownpourWithTear = downed.Contains("forcedTear"); + encounteredOldDuke = downed.Contains("encounteredOldDuke"); + HasGeneratedLuminitePlanetoids = downed.Contains("HasGeneratedLuminitePlanetoids"); abyssChasmBottom = tag.GetInt("abyssChasmBottom"); acidRainPoints = tag.GetInt("acidRainPoints"); @@ -587,7 +633,7 @@ namespace CalamityMod.World _ = flags4[1]; _ = flags4[2]; _ = flags4[3]; - downedBossAny = flags4[4]; + _ = flags4[4]; demonMode = flags4[5]; onionMode = flags4[6]; revenge = flags4[7]; @@ -597,7 +643,7 @@ namespace CalamityMod.World spawnedBandit = flags5[1]; spawnedCirrus = flags5[2]; startAcidicDownpour = flags5[3]; - spawnedHardBoss = flags5[4]; + _ = flags5[4]; downedPolterghast = flags5[5]; death = flags5[6]; downedGSS = flags5[7]; @@ -606,17 +652,17 @@ namespace CalamityMod.World abyssSide = flags6[0]; downedAquaticScourge = flags6[1]; downedAstrageldon = flags6[2]; - buffedEclipse = flags6[3]; + _ = flags6[3]; armageddon = flags6[4]; - defiled = flags6[5]; - downedBuffedMothron = flags6[6]; + _ = flags6[5]; + _ = flags6[6]; ironHeart = flags6[7]; BitsByte flags7 = reader.ReadByte(); - bossRushActive = flags7[0]; + BossRushEvent.BossRushActive = flags7[0]; downedBoomerDuke = flags7[1]; downedCLAM = flags7[2]; - dragonScalesBought = flags7[3]; + _ = flags7[3]; rainingAcid = flags7[4]; downedEoCAcidRain = flags7[5]; downedAquaticScourgeAcidRain = flags7[6]; @@ -645,12 +691,18 @@ namespace CalamityMod.World BitsByte flags10 = reader.ReadByte(); anglerName = flags10[0]; clothierName = flags10[1]; - _ = flags10[2]; + encounteredOldDuke = flags10[2]; _ = flags10[3]; _ = flags10[4]; _ = flags10[5]; _ = flags10[6]; _ = flags10[7]; + + BitsByte flags11 = reader.ReadByte(); + malice = flags11[0]; + HasGeneratedLuminitePlanetoids = flags11[1]; + downedAdultEidolonWyrm = flags11[2]; + downedExoMechs = flags11[3]; } else { @@ -698,7 +750,7 @@ namespace CalamityMod.World flags4[1] = false; flags4[2] = false; flags4[3] = false; - flags4[4] = downedBossAny; + flags4[4] = false; flags4[5] = demonMode; flags4[6] = onionMode; flags4[7] = revenge; @@ -708,7 +760,7 @@ namespace CalamityMod.World flags5[1] = spawnedBandit; flags5[2] = spawnedCirrus; flags5[3] = startAcidicDownpour; - flags5[4] = spawnedHardBoss; + flags5[4] = false; flags5[5] = downedPolterghast; flags5[6] = death; flags5[7] = downedGSS; @@ -717,17 +769,17 @@ namespace CalamityMod.World flags6[0] = abyssSide; flags6[1] = downedAquaticScourge; flags6[2] = downedAstrageldon; - flags6[3] = buffedEclipse; + flags6[3] = false; flags6[4] = armageddon; - flags6[5] = defiled; - flags6[6] = downedBuffedMothron; + flags6[5] = false; + flags6[6] = false; flags6[7] = ironHeart; BitsByte flags7 = new BitsByte(); - flags7[0] = bossRushActive; + flags7[0] = BossRushEvent.BossRushActive; flags7[1] = downedBoomerDuke; flags7[2] = downedCLAM; - flags7[3] = dragonScalesBought; + flags7[3] = false; flags7[4] = rainingAcid; flags7[5] = downedEoCAcidRain; flags7[6] = downedAquaticScourgeAcidRain; @@ -756,14 +808,20 @@ namespace CalamityMod.World BitsByte flags10 = new BitsByte(); flags10[0] = anglerName; flags10[1] = clothierName; - flags10[2] = false; + flags10[2] = encounteredOldDuke; flags10[3] = false; flags10[4] = false; flags10[5] = false; flags10[6] = false; flags10[7] = false; - writer.Write(flags); + BitsByte flags11 = new BitsByte(); + flags11[0] = malice; + flags11[1] = HasGeneratedLuminitePlanetoids; + flags11[2] = downedAdultEidolonWyrm; + flags11[3] = downedExoMechs; + + writer.Write(flags); writer.Write(flags2); writer.Write(flags3); writer.Write(flags4); @@ -773,6 +831,7 @@ namespace CalamityMod.World writer.Write(flags8); writer.Write(flags9); writer.Write(flags10); + writer.Write(flags11); writer.Write(abyssChasmBottom); writer.Write(acidRainPoints); writer.Write(Reforges); @@ -819,7 +878,7 @@ namespace CalamityMod.World _ = flags4[1]; _ = flags4[2]; _ = flags4[3]; - downedBossAny = flags4[4]; + _ = flags4[4]; demonMode = flags4[5]; onionMode = flags4[6]; revenge = flags4[7]; @@ -829,7 +888,7 @@ namespace CalamityMod.World spawnedBandit = flags5[1]; spawnedCirrus = flags5[2]; startAcidicDownpour = flags5[3]; - spawnedHardBoss = flags5[4]; + _ = flags5[4]; downedPolterghast = flags5[5]; death = flags5[6]; downedGSS = flags5[7]; @@ -838,17 +897,17 @@ namespace CalamityMod.World abyssSide = flags6[0]; downedAquaticScourge = flags6[1]; downedAstrageldon = flags6[2]; - buffedEclipse = flags6[3]; + _ = flags6[3]; armageddon = flags6[4]; - defiled = flags6[5]; - downedBuffedMothron = flags6[6]; + _ = flags6[5]; + _ = flags6[6]; ironHeart = flags6[7]; BitsByte flags7 = reader.ReadByte(); - bossRushActive = flags7[0]; + BossRushEvent.BossRushActive = flags7[0]; downedBoomerDuke = flags7[1]; downedCLAM = flags7[2]; - dragonScalesBought = flags7[3]; + _ = flags7[3]; rainingAcid = flags7[4]; downedEoCAcidRain = flags7[5]; downedAquaticScourgeAcidRain = flags7[6]; @@ -860,31 +919,37 @@ namespace CalamityMod.World downedSecondSentinels = flags8[2]; foundHomePermafrost = flags8[3]; downedCLAMHardMode = flags8[4]; - guideName = flags8[5]; - wizardName = flags8[6]; - steampunkerName = flags8[7]; + guideName = flags8[5]; + wizardName = flags8[6]; + steampunkerName = flags8[7]; - BitsByte flags9 = reader.ReadByte(); - stylistName = flags9[0]; - witchDoctorName = flags9[1]; - taxCollectorName = flags9[2]; - pirateName = flags9[3]; - mechanicName = flags9[4]; - armsDealerName = flags9[5]; - dryadName = flags9[6]; - nurseName = flags9[7]; + BitsByte flags9 = reader.ReadByte(); + stylistName = flags9[0]; + witchDoctorName = flags9[1]; + taxCollectorName = flags9[2]; + pirateName = flags9[3]; + mechanicName = flags9[4]; + armsDealerName = flags9[5]; + dryadName = flags9[6]; + nurseName = flags9[7]; - BitsByte flags10 = reader.ReadByte(); - anglerName = flags10[0]; - clothierName = flags10[1]; - _ = flags10[2]; - _ = flags10[3]; - _ = flags10[4]; - _ = flags10[5]; - _ = flags10[6]; - _ = flags10[7]; + BitsByte flags10 = reader.ReadByte(); + anglerName = flags10[0]; + clothierName = flags10[1]; + encounteredOldDuke = flags10[2]; + _ = flags10[3]; + _ = flags10[4]; + _ = flags10[5]; + _ = flags10[6]; + _ = flags10[7]; - abyssChasmBottom = reader.ReadInt32(); + BitsByte flags11 = reader.ReadByte(); + malice = flags11[0]; + HasGeneratedLuminitePlanetoids = flags11[1]; + downedAdultEidolonWyrm = flags11[2]; + downedExoMechs = flags11[3]; + + abyssChasmBottom = reader.ReadInt32(); acidRainPoints = reader.ReadInt32(); Reforges = reader.ReadInt32(); MoneyStolenByBandit = reader.ReadInt32(); @@ -931,20 +996,20 @@ namespace CalamityMod.World #region ModifyWorldGenTasks public override void ModifyWorldGenTasks(List tasks, ref float totalWeight) { - int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies")); - if (ShiniesIndex != -1) + int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); + if (islandIndex != -1) { - tasks.Insert(ShiniesIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress) + tasks.Insert(islandIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress) { progress.Message = "Evil Island"; - SmallBiomes.PlaceEvilIsland(); + WorldEvilIsland.PlaceEvilIsland(); })); } int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); if (DungeonChestIndex != -1) { - tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", WorldGenerationMethods.GenerateBiomeChests)); + tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", MiscWorldgenRoutines.GenerateBiomeChests)); } int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); @@ -957,29 +1022,29 @@ namespace CalamityMod.World })); } - int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); - tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", delegate (GenerationProgress progress) - { - progress.Message = "Building the jungle temple (Calamity)"; - WorldGenerationMethods.NewJungleTemple(); - }); + int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); + tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", delegate (GenerationProgress progress) + { + progress.Message = "Building the jungle temple (Calamity)"; + CustomTemple.NewJungleTemple(); + }); int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); - tasks[JungleTempleIndex2] = new PassLegacy("Temple", delegate (GenerationProgress progress) - { - progress.Message = "Building the jungle temple (Calamity)"; - Main.tileSolid[162] = false; - Main.tileSolid[226] = true; - WorldGenerationMethods.NewJungleTemplePart2(); - Main.tileSolid[232] = false; - }); + tasks[JungleTempleIndex2] = new PassLegacy("Temple", delegate (GenerationProgress progress) + { + progress.Message = "Building the jungle temple (Calamity)"; + Main.tileSolid[162] = false; + Main.tileSolid[226] = true; + CustomTemple.NewJungleTemplePart2(); + Main.tileSolid[232] = false; + }); - int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); - tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", delegate (GenerationProgress progress) - { - progress.Message = "Placing a Lihzahrd altar (Calamity)"; - WorldGenerationMethods.NewJungleTempleLihzahrdAltar(); - }); + int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); + tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", delegate (GenerationProgress progress) + { + progress.Message = "Placing a Lihzahrd altar (Calamity)"; + CustomTemple.NewJungleTempleLihzahrdAltar(); + }); int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) @@ -998,27 +1063,27 @@ namespace CalamityMod.World fuhX = xUnderworldGen; fuhY = yUnderworldGen; - WorldGenerationMethods.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); - WorldGenerationMethods.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); - WorldGenerationMethods.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + MiscWorldgenRoutines.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + MiscWorldgenRoutines.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); + MiscWorldgenRoutines.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); - WorldGenerationMethods.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); - WorldGenerationMethods.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); - WorldGenerationMethods.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); + MiscWorldgenRoutines.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); })); #endregion @@ -1028,14 +1093,14 @@ namespace CalamityMod.World tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) { progress.Message = "Sulphur Sea"; - Abyss.PlaceSulphurSea(); + SulphurousSea.PlaceSulphurSea(); })); } tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", delegate (GenerationProgress progress) { progress.Message = "Special Shrines"; - SmallBiomes.PlaceShrines(); + UndergroundShrines.PlaceShrines(); })); @@ -1078,17 +1143,17 @@ namespace CalamityMod.World tasks.Insert(FinalIndex + 5, new PassLegacy("Sulphur2", delegate (GenerationProgress progress) { progress.Message = "Finishing Sulphur Sea"; - Abyss.FinishGeneratingSulphurSea(); + SulphurousSea.FinishGeneratingSulphurSea(); })); tasks.Insert(FinalIndex + 6, new PassLegacy("IWannaRock", delegate (GenerationProgress progress) { progress.Message = "I Wanna Rock"; - WorldGenerationMethods.PlaceRoxShrine(); + MiscWorldgenRoutines.PlaceRoxShrine(); })); } - tasks.Add(new PassLegacy("Planetoid Test", WorldGenerationMethods.Planetoids)); + tasks.Add(new PassLegacy("Planetoid Test", Planetoid.GenerateAllBasePlanetoids)); } // An Astral Meteor always falls at the beginning of Hardmode. @@ -1100,1237 +1165,13 @@ namespace CalamityMod.World // Insert the Astral biome generation right before the final hardmode announcement. tasks.Insert(announceIndex, new PassLegacy("AstralMeteor", delegate (GenerationProgress progress) { - WorldGenerationMethods.PlaceAstralMeteor(); + AstralBiome.PlaceAstralMeteor(); })); } #endregion #region PostUpdate - public override void PostUpdate() - { - // Sunken Sea Location...duh - SunkenSeaLocation = new Rectangle(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom, - WorldGen.UndergroundDesertLocation.Width, WorldGen.UndergroundDesertLocation.Height / 2); - - // Player variable, always finds the closest player relative to the center of the map - int closestPlayer = Player.FindClosest(new Vector2(Main.maxTilesX / 2, (float)Main.worldSurface / 2f) * 16f, 0, 0); - Player player = Main.player[closestPlayer]; - CalamityPlayer modPlayer = player.Calamity(); - - // Force boss rush to off - if (!deactivateStupidFuckingBullshit) - { - deactivateStupidFuckingBullshit = true; - bossRushActive = false; - CalamityMod.UpdateServerBoolean(); - } - - // Attempt to start the acid rain at the 4:29AM - bool moreRain = !downedEoCAcidRain || (!downedAquaticScourgeAcidRain && downedAquaticScourge) || (!downedBoomerDuke && downedPolterghast); - if (Main.time == 32399 && !Main.dayTime && Main.rand.NextBool(moreRain ? 3 : 300) && !Main.LocalPlayer.Calamity().noStupidNaturalARSpawns) - { - AcidRainEvent.TryStartEvent(); - CalamityMod.UpdateServerBoolean(); - } - if (NPC.downedBoss1 && !downedEoCAcidRain && !forcedRainAlready) - { - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - if (Main.player[playerIndex].active) - { - if (Main.player[playerIndex].Calamity().ZoneSulphur) - { - forcedRainAlready = true; - AcidRainEvent.TryStartEvent(); - CalamityMod.UpdateServerBoolean(); - } - } - } - } - if (forceRainTimer == 1) - { - AcidRainEvent.TryStartEvent(); - CalamityMod.UpdateServerBoolean(); - } - if (forceRainTimer > 0) - forceRainTimer--; - - if (rainingAcid) - { - timeSinceAcidRainKill++; - timeSinceAcidStarted++; - - // If enough time has passed, and no enemy has been killed, end the invasion early. - // The player almost certainly does not want to deal with it. - if (timeSinceAcidRainKill >= AcidRainEvent.InvasionNoKillPersistTime) - { - acidRainPoints = 0; - triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } - if (!startAcidicDownpour) - { - int sulphSeaWidth = Abyss.BiomeWidth; - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - // A variable named "player" already exists above, which retrieves the player who is closest to the map center. - Player player2 = Main.player[playerIndex]; - if (player2.active) - { - // An artificial biome can be made, and therefore, the event could be started by an artificial biome. - // While fighting the event in an artificial biome is not bad, having it be started by a patch of Sulphurous Sand - // would definitely be strange. - // Because of this, this code is executed based on if the player is in the sea (based on tile count) AND position relative to the naturally generated sea. - if (((player2.Center.X <= (sulphSeaWidth + 60f) * 16f && abyssSide) || - (player2.Center.X >= (Main.maxTilesX - (sulphSeaWidth + 60f)) * 16f && !abyssSide)) && - player2.Calamity().ZoneSulphur) - { - // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) - // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! - startAcidicDownpour = true; - CalamityMod.UpdateServerBoolean(); - break; - } - } - } - } - - // Stop the rain if the Old Duke is present for visibility during the fight. - if (Main.raining && NPC.AnyNPCs(ModContent.NPCType())) - { - Main.raining = false; - CalamityMod.UpdateServerBoolean(); - } - - // If the rain stops for whatever reason, end the invasion. - // This is primarily done for compatibility, so that if another mod wants to manipulate the weather, - // they can without having to deal with endless rain. - if (!Main.raining && !NPC.AnyNPCs(ModContent.NPCType()) && timeSinceAcidStarted > 20) - { - acidRainPoints = 0; - triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } - else if (timeSinceAcidStarted < 20) - { - Main.raining = true; - Main.cloudBGActive = 1f; - Main.numCloudsTemp = Main.cloudLimit; - Main.numClouds = Main.numCloudsTemp; - Main.windSpeedTemp = 0.72f; - Main.windSpeedSet = Main.windSpeedTemp; - Main.weatherCounter = 60 * 60 * 10; // 10 minutes of rain. Remember, once the rain goes away, so does the invasion. - Main.rainTime = Main.weatherCounter; - Main.maxRaining = 0.89f; - } - - // Summon Old Duke tornado post-Polter as needed - if (downedPolterghast && acidRainPoints == 1) - { - if (!NPC.AnyNPCs(ModContent.NPCType()) && - CalamityUtils.CountProjectiles(ModContent.ProjectileType()) <= 0) - { - if (triedToSummonOldDuke) - { - acidRainPoints = 0; - triedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - } - else - { - int playerClosestToAbyss = Player.FindClosest(new Vector2(abyssSide ? 0 : Main.maxTilesX * 16, (int)Main.worldSurface), 0, 0); - Player closestToAbyss = Main.player[playerClosestToAbyss]; - if (Main.netMode != NetmodeID.MultiplayerClient && Math.Abs(closestToAbyss.Center.X - (abyssSide ? 0 : Main.maxTilesX * 16)) <= 12000f) - { - Projectile.NewProjectile(closestToAbyss.Center + Vector2.UnitY * 160f, Vector2.Zero, - ModContent.ProjectileType(), 120, 8f, Main.myPlayer); - } - } - } - } - } - else - { - if (timeSinceAcidStarted != 0) - timeSinceAcidStarted = 0; - startAcidicDownpour = false; - } - - // Lumenyl crystal, tenebris spread and sea prism crystal spawn rates - int l = 0; - float mult2 = 1.5E-05f * Main.worldRate; - while (l < Main.maxTilesX * Main.maxTilesY * mult2) - { - int x = WorldGen.genRand.Next(10, Main.maxTilesX - 10); - int y = WorldGen.genRand.Next((int)Main.worldSurface - 1, Main.maxTilesY - 20); - - int y2 = y - 1; - if (y2 < 10) - y2 = 10; - - if (Main.tile[x, y] != null) - { - if (Main.tile[x, y].nactive()) - { - if (Main.tile[x, y].liquid <= 32) - { - if (Main.tile[x, y].type == TileID.JungleGrass) - { - if (Main.tile[x, y2].liquid == 0) - { - // Plantera Bulbs pre-mech - if (WorldGen.genRand.Next(1500) == 0) - { - if (Main.hardMode && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)) - { - bool placeBulb = true; - int minDistanceFromOtherBulbs = 150; - for (int i = x - minDistanceFromOtherBulbs; i < x + minDistanceFromOtherBulbs; i += 2) - { - 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) - { - placeBulb = false; - break; - } - } - } - - if (placeBulb) - { - WorldGen.PlaceJunglePlant(x, y2, TileID.PlanteraBulb, 0, 0); - 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) - { - NetMessage.SendTileSquare(-1, x, y2, 5); - } - } - } - } - - // Life Fruit pre-mech - int random = Main.expertMode ? 90 : 120; - if (WorldGen.genRand.Next(random) == 0) - { - if (Main.hardMode && !NPC.downedMechBossAny) - { - bool placeFruit = true; - int minDistanceFromOtherFruit = Main.expertMode ? 50 : 60; - for (int i = x - minDistanceFromOtherFruit; i < x + minDistanceFromOtherFruit; i += 2) - { - 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) - { - placeFruit = false; - break; - } - } - } - - if (placeFruit) - { - 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) - { - NetMessage.SendTileSquare(-1, x, y2, 4); - } - } - } - } - } - } - } - - int tileType = Main.tile[x, y].type; - bool tenebris = tileType == ModContent.TileType() && downedCalamitas; - - if (CalamityGlobalTile.GrowthTiles.Contains(tileType) || tenebris) - { - int growthChance = tenebris ? 4 : 2; - if (tileType == ModContent.TileType()) - growthChance *= 5; - - if (Main.rand.NextBool(growthChance)) - { - switch (WorldGen.genRand.Next(4)) - { - case 0: - x++; - break; - case 1: - x--; - break; - case 2: - y++; - break; - case 3: - y--; - break; - default: - break; - } - - 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 isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType() || tileType == ModContent.TileType(); - bool meetsAdditionalGrowConditions = tile.slope() == 0 && !tile.halfBrick() && !tile.lava(); - - if (growTile && meetsAdditionalGrowConditions) - { - int tileType2 = ModContent.TileType(); - - if (tileType == ModContent.TileType()) - tileType2 = ModContent.TileType(); - - bool canPlaceBasedOnAttached = true; - if (tileType2 == ModContent.TileType() && !isSunkenSeaTile) - canPlaceBasedOnAttached = false; - - if (canPlaceBasedOnAttached && (CanPlaceBasedOnProximity(x, y, tileType2) || tenebris)) - { - tile.type = 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()) - { - tile.frameY = 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()) - { - tile.frameY = 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()) - { - tile.frameY = 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()) - { - tile.frameY = 54; - } - tile.frameX = (short)(WorldGen.genRand.Next(18) * 18); - } - - WorldGen.SquareTileFrame(x, y, true); - - if (Main.netMode == 2) - NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); - } - } - } - } - } - } - } - l++; - } - - // Boss Rush shit - if (bossRushActive) - { - // Prevent Moon Lord from spawning naturally - if (NPC.MoonLordCountdown > 0) - { - NPC.MoonLordCountdown = 0; - } - - // Do boss rush countdown and shit if no boss is alive - if (!CalamityPlayer.areThereAnyDamnBosses) - { - // Stage text - if (bossRushSpawnCountdown > 0) - { - bossRushSpawnCountdown--; - if (bossRushSpawnCountdown == 180) - { - // After Fishron is dead - if (bossRushStage == 28) - { - string key = "Mods.CalamityMod.BossRushTierThreeEndText2"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - - // After Providence is dead - else if (bossRushStage == 37) - { - string key = "Mods.CalamityMod.BossRushTierFourEndText2"; - Color messageColor = Color.LightCoral; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - } - - // Cooldown and boss spawn - if (bossRushSpawnCountdown <= 0) - { - // Cooldown before next boss spawns - bossRushSpawnCountdown = 60; - - // Increase cooldown post-Fishron - if (bossRushStage >= 27) - { - bossRushSpawnCountdown += 300; - } - - // Change cooldown based on stage - switch (bossRushStage) - { - // When Destroyer or Cultist dies, increase time to show text - case 9: - case 18: - bossRushSpawnCountdown = 300; - break; - - // When Signus dies, increase time to give players a moment to get in a good spot for Ravager - case 25: - bossRushSpawnCountdown = 360; - break; - - // When Calamitas Clone dies, increase time to give players a moment to relax - case 32: - bossRushSpawnCountdown = 420; - break; - default: - break; - } - - // Post-Wall of Flesh teleport back to spawn - if (bossRushStage == 13) - { - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player2 = Main.player[playerIndex]; - player2.Spawn(); - } - } - } - - // Remove Providence debuff for next boss fight - else if (bossRushStage == 37) - { - for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player2 = Main.player[playerIndex]; - if (player2.FindBuffIndex(ModContent.BuffType()) > -1) - { - player2.ClearBuff(ModContent.BuffType()); - } - } - } - } - - // Spawn bosses - if (Main.netMode != NetmodeID.MultiplayerClient) - { - bool playSpecialSound = false; - switch (bossRushStage) - { - case 0: - NPC.SpawnOnPlayer(closestPlayer, NPCID.QueenBee); - break; - case 1: - NPC.SpawnOnPlayer(closestPlayer, NPCID.BrainofCthulhu); - break; - case 2: - NPC.SpawnOnPlayer(closestPlayer, NPCID.KingSlime); - break; - case 3: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.EyeofCthulhu); - break; - case 4: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.SkeletronPrime); - break; - case 5: - ChangeTime(true); - int npc = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.Golem, 1); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - break; - case 6: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 7: - NPC.SpawnOnPlayer(closestPlayer, NPCID.EaterofWorldsHead); - break; - case 8: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 9: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.TheDestroyer); - break; - case 10: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, NPCID.Spazmatism); - NPC.SpawnOnPlayer(closestPlayer, NPCID.Retinazer); - break; - case 11: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 12: - NPC.SpawnWOF(player.position); - break; - case 13: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 14: - ChangeTime(false); - int npc6 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.SkeletronHead, 1); - Main.npc[npc6].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc6); - break; - case 15: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 16: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 17: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 18: - int npc2 = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y - 400, NPCID.CultistBoss, 1); - Main.npc[npc2].direction = Main.npc[npc2].spriteDirection = Math.Sign(player.Center.X - player.Center.X - 90f); - Main.npc[npc2].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc2); - break; - case 19: - for (int doom = 0; doom < Main.maxNPCs; doom++) - { - bool isPillar = Main.npc[doom].type == NPCID.LunarTowerStardust || Main.npc[doom].type == NPCID.LunarTowerVortex || - Main.npc[doom].type == NPCID.LunarTowerNebula || Main.npc[doom].type == NPCID.LunarTowerSolar; - if (Main.npc[doom].active && isPillar) - { - Main.npc[doom].active = false; - Main.npc[doom].netUpdate = true; - } - } - int npc3 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 1); - Main.npc[npc3].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc3); - break; - case 20: - NPC.SpawnOnPlayer(closestPlayer, NPCID.Plantera); - break; - case 21: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 22: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 23: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 24: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 25: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 26: - playSpecialSound = true; - Main.PlaySound(SoundID.Roar, player.position, 2); - int npc4 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 1); - Main.npc[npc4].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc4); - break; - case 27: - int npc5 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), NPCID.DukeFishron, 1); - Main.npc[npc5].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc5); - break; - case 28: - NPC.SpawnOnPlayer(closestPlayer, NPCID.MoonLordCore); - break; - case 29: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 30: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 31: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 32: - ChangeTime(false); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 33: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 34: - int npc7 = NPC.NewNPC((int)(player.position.X + Main.rand.Next(-100, 101)), (int)(player.position.Y - 400f), ModContent.NPCType(), 1); - Main.npc[npc7].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc7); - break; - case 35: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 36: - ChangeTime(true); - playSpecialSound = true; - Main.PlaySound(mod.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), ModContent.NPCType(), 1); - Main.npc[prov].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(prov); - break; - case 37: - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 38: - ChangeTime(true); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - case 39: - playSpecialSound = true; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), player.Center); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - break; - } - if (!playSpecialSound) - Main.PlaySound(SoundID.Roar, player.position, 0); - } - } - } - } - else - { - bossRushSpawnCountdown = 180; - if (bossRushStage != 0) - { - bossRushStage = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(bossRushStage); - netMessage.Send(); - } - } - } - if (bossRushHostileProjKillCounter > 0) - { - bossRushHostileProjKillCounter--; - if (bossRushHostileProjKillCounter == 1) - CalamityUtils.KillAllHostileProjectiles(); - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BRHostileProjKillSync); - netMessage.Write(bossRushHostileProjKillCounter); - netMessage.Send(); - } - } - - if (DoGSecondStageCountdown > 0) - { - DoGSecondStageCountdown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(DoGSecondStageCountdown); - netMessage.Send(); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (DoGSecondStageCountdown == 21540) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } - if (DoGSecondStageCountdown == 14340) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } - if (DoGSecondStageCountdown == 7140) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } - if (DoGSecondStageCountdown <= 60) - { - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - string key = "Mods.CalamityMod.EdgyBossText10"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - } - } - - if (player.ZoneDungeon && !NPC.downedBoss3 && !player.dead) - { - if (!NPC.AnyNPCs(NPCID.DungeonGuardian) && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, NPCID.DungeonGuardian); //your hell is as vast as my bonergrin, pray your life ends quickly - } - - if (player.ZoneRockLayerHeight && - !player.ZoneUnderworldHeight && - !player.ZoneDungeon && - !player.ZoneJungle && - !modPlayer.ZoneSunkenSea && - !CalamityPlayer.areThereAnyDamnBosses) - { - if (NPC.downedPlantBoss && - !modPlayer.ZoneAbyss && - player.townNPCs < 3f) - { - double spawnRate = 100000D; - - if (revenge) - spawnRate *= 0.85D; - - if (demonMode) - spawnRate *= 0.75D; - - if (death && Main.bloodMoon) - spawnRate *= 0.2D; - if (modPlayer.zerg) - spawnRate *= 0.5D; - if (modPlayer.chaosCandle) - spawnRate *= 0.6D; - if (player.enemySpawns) - spawnRate *= 0.7D; - if (Main.waterCandles > 0) - spawnRate *= 0.8D; - - if (modPlayer.bossZen || DoGSecondStageCountdown > 0) - spawnRate *= 50D; - if (modPlayer.zen || (CalamityConfig.Instance.DisableExpertTownSpawns && player.townNPCs > 1f && Main.expertMode)) - spawnRate *= 2D; - if (modPlayer.tranquilityCandle) - spawnRate *= 1.67D; - if (player.calmed) - spawnRate *= 1.43D; - if (Main.peaceCandles > 0) - spawnRate *= 1.25D; - - int chance = (int)spawnRate; - if (Main.rand.Next(chance) == 0) - { - if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient && - ArmoredDiggerSpawnCooldown <= 0) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - ArmoredDiggerSpawnCooldown = 3600; - } - } - } - } - if (ArmoredDiggerSpawnCooldown > 0) - { - ArmoredDiggerSpawnCooldown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.ArmoredDiggerCountdownSync); - netMessage.Write(ArmoredDiggerSpawnCooldown); - netMessage.Send(); - } - } - - if (Main.dayTime && Main.hardMode) - { - if (player.townNPCs >= 2f) - { - if (Main.rand.NextBool(2000)) - { - int steamGril = NPC.FindFirstNPC(NPCID.Steampunker); - if (steamGril == -1 && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, NPCID.Steampunker); //Steampunker has awoken! - } - } - } - - if (modPlayer.ZoneAbyss) - { - if (player.chaosState) - { - if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient) - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } - } - - // DO NOT REMOVE -- this code is being kept for April Fools 2020 - if (Main.rand.NextBool(100000000) && DateTime.Now.Month == 4 && DateTime.Now.Day == 1) - { - string key = "Mods.CalamityMod.AprilFools"; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - - if (death && !CalamityPlayer.areThereAnyDamnBosses && !Main.snowMoon && !Main.pumpkinMoon && !DD2Event.Ongoing && player.statLifeMax2 >= 300 && !WorldGen.spawnEye && WorldGen.spawnHardBoss <= 0) //does not occur while a boss is alive or during certain events - { - if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check for countdown and cooldown being 0 - { - if (Main.rand.NextBool(50000)) - { - // Only set countdown and boss type if conditions are met - // Night time bosses set message only before 11pm. Day time bosses only before 2pm. - if (!NPC.downedBoss1 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) - { - BossText(); - bossType = NPCID.EyeofCthulhu; - bossSpawnCountdown = 3600; // 1 minute - } - - if (!NPC.downedBoss2 && bossType == 0) - if (player.ZoneCorrupt) - { - BossText(); - bossType = NPCID.EaterofWorldsHead; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedBoss2 && bossType == 0) - if (player.ZoneCrimson) - { - BossText(); - bossType = NPCID.BrainofCthulhu; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedQueenBee && bossType == 0) - if (player.ZoneJungle && (player.ZoneOverworldHeight || player.ZoneSkyHeight)) - { - BossText(); - bossType = NPCID.QueenBee; - bossSpawnCountdown = 3600; - } - - if (!downedDesertScourge && bossType == 0) - if (player.ZoneDesert) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedPerforator && bossType == 0) - if (player.ZoneCrimson) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedHiveMind && bossType == 0) - if (player.ZoneCorrupt) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedCrabulon && bossType == 0) - if (player.ZoneGlowshroom) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (Main.hardMode) - { - if (!NPC.downedMechBoss1 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) - { - BossText(); - bossType = NPCID.TheDestroyer; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedMechBoss2 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) - { - BossText(); - bossType = NPCID.Spazmatism; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedMechBoss3 && bossType == 0) - if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) - { - BossText(); - bossType = NPCID.SkeletronPrime; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedPlantBoss && bossType == 0) - if (player.ZoneJungle && !player.ZoneOverworldHeight && !player.ZoneSkyHeight) - { - BossText(); - bossType = NPCID.Plantera; - bossSpawnCountdown = 3600; - } - - if (!NPC.downedFishron && bossType == 0) - if (player.ZoneBeach && !modPlayer.ZoneSulphur) - { - BossText(); - bossType = NPCID.DukeFishron; - bossSpawnCountdown = 3600; - } - - if (!downedCryogen && bossType == 0) - if (player.ZoneSnow && player.ZoneOverworldHeight) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedCalamitas && bossType == 0) - if (!Main.dayTime && player.ZoneOverworldHeight && Main.time < 12600) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedAstrageldon && bossType == 0) - if (modPlayer.ZoneAstral && - !Main.dayTime && player.ZoneOverworldHeight) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedPlaguebringer && bossType == 0) - if (player.ZoneJungle && NPC.downedGolemBoss && !player.ZoneOverworldHeight && !player.ZoneSkyHeight) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (NPC.downedMoonlord) - { - if (!downedGuardians && bossType == 0) - if (Main.dayTime && (player.ZoneUnderworldHeight || - (player.ZoneHoly && player.ZoneOverworldHeight)) && Main.time < 34200) //only before 2pm - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - - if (!downedBumble && bossType == 0) - if (player.ZoneJungle && player.ZoneOverworldHeight) - { - BossText(); - bossType = ModContent.NPCType(); - bossSpawnCountdown = 3600; - } - } - } - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); - netMessage.Write(bossSpawnCountdown); - netMessage.Send(); - var netMessage2 = mod.GetPacket(); - netMessage2.Write((byte)CalamityModMessageType.BossTypeSync); - netMessage2.Write(bossType); - netMessage2.Send(); - } - } - } - else - { - if (bossSpawnCountdown > 0) - { - bossSpawnCountdown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); - netMessage.Write(bossSpawnCountdown); - netMessage.Send(); - } - } - - if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check both cooldowns again here to avoid infinite message possibilities - { - bool canSpawn = true; - switch (bossType) - { - case NPCID.EyeofCthulhu: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) - canSpawn = false; - break; - case NPCID.EaterofWorldsHead: - if (!player.ZoneCorrupt) - canSpawn = false; - break; - case NPCID.BrainofCthulhu: - if (!player.ZoneCrimson) - canSpawn = false; - break; - case NPCID.QueenBee: - if (!player.ZoneJungle || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight)) - canSpawn = false; - break; - case NPCID.TheDestroyer: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) - canSpawn = false; - break; - case NPCID.Spazmatism: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) - canSpawn = false; - break; - case NPCID.SkeletronPrime: - if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) - canSpawn = false; - break; - case NPCID.Plantera: - if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight) - canSpawn = false; - break; - case NPCID.DukeFishron: - if (!player.ZoneBeach) - canSpawn = false; - break; - } - - if (bossType == ModContent.NPCType()) - { - if (!player.ZoneDesert) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!player.ZoneCrimson) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!player.ZoneCorrupt) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!player.ZoneGlowshroom) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!player.ZoneSnow || !player.ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (Main.dayTime || !player.ZoneOverworldHeight || Main.time > 16200) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!modPlayer.ZoneAstral || - Main.dayTime || !player.ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!player.ZoneJungle || !player.ZoneOverworldHeight) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!Main.dayTime || (!player.ZoneUnderworldHeight && - (!player.ZoneHoly || !player.ZoneOverworldHeight)) || Main.time > 37800) - canSpawn = false; - } - else if (bossType == ModContent.NPCType()) - { - if (!player.ZoneJungle || !player.ZoneOverworldHeight) - canSpawn = false; - } - - if (canSpawn) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (bossType == NPCID.Spazmatism) - NPC.SpawnOnPlayer(closestPlayer, NPCID.Retinazer); - else if (bossType == ModContent.NPCType()) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } - else if (bossType == ModContent.NPCType()) - { - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType()); - } - if (bossType == NPCID.DukeFishron) - { - NPC.NewNPC((int)player.Center.X - 300, (int)player.Center.Y - 300, bossType); - } - else - { - NPC.SpawnOnPlayer(closestPlayer, bossType); - } - } - - deathBossSpawnCooldown = 86400; // 24 minutes (1 full Terraria day) - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DeathBossSpawnCountdownSync); - netMessage.Write(deathBossSpawnCooldown); - netMessage.Send(); - } - } - - bossType = 0; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossTypeSync); - netMessage.Write(bossType); - netMessage.Send(); - } - } - - // IMPORTANT! Decrement this cooldown AFTER everything else to avoid infinite possibilities - if (deathBossSpawnCooldown > 0) - { - deathBossSpawnCooldown--; - if (Main.netMode == NetmodeID.Server) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DeathBossSpawnCountdownSync); - netMessage.Write(deathBossSpawnCooldown); - netMessage.Send(); - } - } - } - } - - if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) - CalamityUtils.StopSandstorm(); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CultistRitual.delay -= Main.dayRate * 10; - if (CultistRitual.delay < 0) - { - CultistRitual.delay = 0; - } - CultistRitual.recheck -= Main.dayRate * 10; - if (CultistRitual.recheck < 0) - { - CultistRitual.recheck = 0; - } - } - } - #endregion - - #region Check Placement Proximity - private bool CanPlaceBasedOnProximity(int x, int y, int tileType) - { - if (tileType == ModContent.TileType() && !downedCalamitas) - return false; - - int minDistanceFromOtherTiles = 6; - int sameTilesNearby = 0; - for (int i = x - minDistanceFromOtherTiles; i < x + minDistanceFromOtherTiles; i++) - { - for (int j = y - minDistanceFromOtherTiles; j < y + minDistanceFromOtherTiles; j++) - { - if (Main.tile[i, j].active() && Main.tile[i, j].type == tileType) - { - sameTilesNearby++; - if (sameTilesNearby > 1) - return false; - } - } - } - - return true; - } - #endregion - - #region ChangeTime - public static void ChangeTime(bool day) - { - Main.time = 0.0; - Main.dayTime = day; - CalamityMod.UpdateServerBoolean(); - } - #endregion - - #region BossText - public void BossText() - { - string key = "Mods.CalamityMod.BossSpawnText"; - Color messageColor = Color.Crimson; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } + public override void PostUpdate() => WorldUpdateMiscEffects.PerformWorldUpdates(); #endregion } } diff --git a/World/CustomActions.cs b/World/CustomActions.cs index 6f21af366a..19781906c4 100644 --- a/World/CustomActions.cs +++ b/World/CustomActions.cs @@ -40,6 +40,20 @@ namespace CalamityMod.World } } + public class SetPaint : GenAction + { + private readonly byte _paintID; + public SetPaint(byte paintID) => _paintID = paintID; + public override bool Apply(Point origin, int x, int y, params object[] args) + { + if (!WorldGen.InWorld(x, y)) + return false; + + WorldGen.paintTile(x, y, _paintID); + return UnitApply(origin, x, y, args); + } + } + public class JungleGrass : GenAction { private bool _tryMushrooms; @@ -95,6 +109,7 @@ namespace CalamityMod.World return _actions[index].Apply(origin, x, y, args); } } + public class DistanceFromOrigin : GenAction { private float _distance; diff --git a/World/CustomShapes.cs b/World/CustomShapes.cs new file mode 100644 index 0000000000..788e14472d --- /dev/null +++ b/World/CustomShapes.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public static class CustomShapes + { + public class DistortedCircle : GenShape + { + private readonly int baseRadius; + private readonly float distortionFactor; + + public DistortedCircle(int radius, float distortionFactor) + { + baseRadius = radius; + this.distortionFactor = distortionFactor; + } + + public override bool Perform(Point origin, GenAction action) + { + float offsetAngle = WorldGen.genRand.NextFloat(-10f, 10f); + for (float angle = 0f; angle < MathHelper.TwoPi; angle += MathHelper.Pi * 0.0084f) + { + // Adding two sinusoids with irrational periods results in final sinusoid having no period at all. + // This behavior is ideal for creating a unique distortion surface with many varying hills and valleys. + float distortionQuantity = (float)(Math.Sin(MathHelper.PiOver2 * angle + offsetAngle) + Math.Sin(Math.E * angle * 0.5f + offsetAngle)) * distortionFactor * 0.5f; + int currentRadius = (int)(baseRadius - distortionQuantity * baseRadius); + if (currentRadius <= 0) + continue; + + int horizontalOffset = (int)(Math.Cos(angle) * currentRadius); + int verticalOffset = (int)(Math.Sin(angle) * currentRadius); + for (int dx = 0; dx != horizontalOffset; dx += Math.Sign(horizontalOffset)) + { + for (int dy = 0; dy != verticalOffset; dy += Math.Sign(verticalOffset)) + UnitApply(action, origin, origin.X + dx, origin.Y + dy, new object[0]); + } + } + return true; + } + } + } +} diff --git a/World/CustomTemple.cs b/World/CustomTemple.cs new file mode 100644 index 0000000000..de659c6913 --- /dev/null +++ b/World/CustomTemple.cs @@ -0,0 +1,922 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public class CustomTemple + { + public static void NewJungleTemple() + { + bool success = false; + while (!success) + { + int x; + if (WorldGen.dungeonX < Main.maxTilesX / 2) + x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.6), (int)(Main.maxTilesX * 0.85)); + else + x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15), (int)(Main.maxTilesX * 0.4)); + + int y = WorldGen.genRand.Next((int)Main.rockLayer, Main.maxTilesY - 500); + + if (Main.tile[x, y].active() && Main.tile[x, y].type == 60) + { + success = true; + GenNewTemple(x, y); + } + } + } + + public static void GenNewTemple(int x, int y) + { + Rectangle[] roomBounds = new Rectangle[200]; + float worldScale = Main.maxTilesX / 4200f; + int totalRooms = (int)(worldScale * WorldGen.genRand.Next(12, 16)); + int xDirection = WorldGen.genRand.NextBool(2).ToDirectionInt(); + int initalDirection = xDirection; + int pathPositionX = x; + int pathPositionY = y; + int currentRoomPositionX = x; + int currentRoomPositionY = y; + int xDirectionChangePromptThreshold = WorldGen.genRand.Next(1, 3); + int totalAttempts = 0; + + // Temple room sizes. + for (int i = 0; i < totalRooms; i++) + { + totalAttempts++; + int currentXDirection = xDirection; + int roomPositionX = currentRoomPositionX; + int roomPositionY = currentRoomPositionY; + bool isValidRoom = false; + int width = 0; + int height = 0; + int xOffset = -10; + Rectangle rectangle = new Rectangle(roomPositionX - width / 2, roomPositionY - height / 2, width, height); + while (!isValidRoom) + { + roomPositionX = currentRoomPositionX; + roomPositionY = currentRoomPositionY; + + // Typical temple room size. + width = WorldGen.genRand.Next(30, 46); + height = WorldGen.genRand.Next(25, 31); + + // Final temple room size. + if (i == totalRooms - 1) + { + width = WorldGen.genRand.Next(105, 116); + height = WorldGen.genRand.Next(90, 106); + roomPositionY += WorldGen.genRand.Next(6, 9); + } + + if (totalAttempts > xDirectionChangePromptThreshold) + { + roomPositionY += WorldGen.genRand.Next(height + 1, height + 3) + xOffset; + roomPositionX += WorldGen.genRand.Next(-2, 3); + currentXDirection = xDirection * -1; + } + else + { + roomPositionX += (WorldGen.genRand.Next(width + 1, width + 3) + xOffset) * currentXDirection; + roomPositionY += WorldGen.genRand.Next(-2, 3); + } + + // Ensure that the new room doesn't intersect any other existing rooms. + isValidRoom = true; + rectangle = new Rectangle(roomPositionX - width / 2, roomPositionY - height / 2, width, height); + for (int j = 0; j < i; j++) + { + if (rectangle.Intersects(roomBounds[j])) + isValidRoom = false; + if (WorldGen.genRand.Next(100) == 0) + { + xOffset++; + } + } + } + if (totalAttempts > xDirectionChangePromptThreshold) + { + xDirectionChangePromptThreshold++; + totalAttempts = 1; + } + + // Update the old values after valid room bounds have been determined. + roomBounds[i] = rectangle; + xDirection = currentXDirection; + currentRoomPositionX = roomPositionX; + currentRoomPositionY = roomPositionY; + } + + for (int i = 0; i < totalRooms; i++) + { + for (int j = 0; j < 2; j++) + { + for (int k = 0; k < totalRooms; k++) + { + for (int l = 0; l < 2; l++) + { + int roomPositionX = roomBounds[i].X; + if (j == 1) + roomPositionX += roomBounds[i].Width - 1; + + int roomTop = roomBounds[i].Y; + int roomBottom = roomTop + roomBounds[i].Height; + int checkRoomPositionX = roomBounds[k].X; + + if (l == 1) + checkRoomPositionX += roomBounds[k].Width - 1; + + int checkRoomTop = roomBounds[k].Y; + int checkRoomBottom = checkRoomTop + roomBounds[k].Height; + while (roomPositionX != checkRoomPositionX || roomTop != checkRoomTop || roomBottom != checkRoomBottom) + { + if (roomPositionX < checkRoomPositionX) + { + roomPositionX++; + } + if (roomPositionX > checkRoomPositionX) + { + roomPositionX--; + } + if (roomTop < checkRoomTop) + { + roomTop++; + } + if (roomTop > checkRoomTop) + { + roomTop--; + } + if (roomBottom < checkRoomBottom) + { + roomBottom++; + } + if (roomBottom > checkRoomBottom) + { + roomBottom--; + } + for (int roomPositionY = roomTop; roomPositionY < roomBottom; roomPositionY++) + { + Main.tile[roomPositionX, roomPositionY].active(true); + Main.tile[roomPositionX, roomPositionY].type = TileID.LihzahrdBrick; + Main.tile[roomPositionX, roomPositionY].liquid = 0; + Main.tile[roomPositionX, roomPositionY].slope(0); + Main.tile[roomPositionX, roomPositionY].halfBrick(false); + } + } + } + } + } + } + + // Cut out rooms and replace the empty space with walls. + for (int i = 0; i < totalRooms; i++) + { + bool isLastRoom = i == totalRooms - 1; + for (int roomPositionX = roomBounds[i].X; roomPositionX < roomBounds[i].X + roomBounds[i].Width; roomPositionX++) + { + 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].liquid = 0; + Main.tile[roomPositionX, roomPositionY].slope(0); + Main.tile[roomPositionX, roomPositionY].halfBrick(false); + } + } + + if (!isLastRoom) + GenerateGenericRoom(roomBounds[i]); + else + GenerateShrineRoom(roomBounds[i]); + } + + Vector2 pathPosition = new Vector2(pathPositionX, pathPositionY); + + // Cut out areas between rooms, creating corridors. + for (int i = 0; i < totalRooms; i++) + { + Rectangle destinationArea = roomBounds[i]; + destinationArea.X += 8; + destinationArea.Y += 8; + destinationArea.Width -= 16; + destinationArea.Height -= 16; + + // Recursively attempt to reach the next room and empty anything in said path. + bool reachedDestination = false; + while (!reachedDestination) + { + int destinationX = WorldGen.genRand.Next(destinationArea.X, destinationArea.X + destinationArea.Width); + int destinationY = WorldGen.genRand.Next(destinationArea.Y, destinationArea.Y + destinationArea.Height); + pathPosition = WorldGen.templePather(pathPosition, destinationX, destinationY); + + if (pathPosition.X == destinationX && pathPosition.Y == destinationY) + reachedDestination = true; + } + if (i < totalRooms - 1) + { + reachedDestination = false; + if (WorldGen.genRand.Next(3) != 0) + { + Rectangle nextRoom = roomBounds[i + 1]; + if (nextRoom.Y >= roomBounds[i].Y + roomBounds[i].Height) + { + destinationArea.X = nextRoom.X; + + if (nextRoom.X < roomBounds[i].X) + destinationArea.X += (int)(nextRoom.Width * 0.2); + else destinationArea.X += (int)(nextRoom.Width * 0.8f); + + destinationArea.Y = nextRoom.Y; + } + else + { + destinationArea.X = (roomBounds[i].X + roomBounds[i].Width / 2 + nextRoom.X + nextRoom.Width / 2) / 2; + destinationArea.Y = (int)(nextRoom.Y + nextRoom.Height * 0.8); + } + while (!reachedDestination) + { + int destinationX = WorldGen.genRand.Next(destinationArea.X - 4, destinationArea.X + 5); + int destinationY = WorldGen.genRand.Next(destinationArea.Y - 4, destinationArea.Y + 5); + pathPosition = WorldGen.templePather(pathPosition, destinationX, destinationY); + if (pathPosition.X == destinationX && pathPosition.Y == destinationY) + reachedDestination = true; + } + } + else + { + Rectangle nextRoom = roomBounds[i + 1]; + int roomCenterMidpointX = (roomBounds[i].X + roomBounds[i].Width / 2 + nextRoom.X + nextRoom.Width / 2) / 2; + int roomCenterMidpointY = (roomBounds[i].Y + roomBounds[i].Height / 2 + nextRoom.Y + nextRoom.Height / 2) / 2; + while (!reachedDestination) + { + int destinationX = WorldGen.genRand.Next(roomCenterMidpointX - 4, roomCenterMidpointX + 5); + int destinationY = WorldGen.genRand.Next(roomCenterMidpointY - 4, roomCenterMidpointY + 5); + pathPosition = WorldGen.templePather(pathPosition, destinationX, destinationY); + if (pathPosition.X == destinationX && pathPosition.Y == destinationY) + reachedDestination = true; + } + } + } + } + + int farthestRoomLeft = Main.maxTilesX - 20; + int farthestRoomRight = 20; + int farthestRoomTop = Main.maxTilesY - 20; + int farthestRoomBottom = 20; + for (int i = 0; i < totalRooms; i++) + { + if (roomBounds[i].X < farthestRoomLeft) + { + farthestRoomLeft = roomBounds[i].X; + } + if (roomBounds[i].X + roomBounds[i].Width > farthestRoomRight) + { + farthestRoomRight = roomBounds[i].X + roomBounds[i].Width; + } + if (roomBounds[i].Y < farthestRoomTop) + { + farthestRoomTop = roomBounds[i].Y; + } + if (roomBounds[i].Y + roomBounds[i].Height > farthestRoomBottom) + { + farthestRoomBottom = roomBounds[i].Y + roomBounds[i].Height; + } + } + + // Create outer temple shape. + farthestRoomLeft -= 10; + farthestRoomRight += 10; + farthestRoomTop -= 10; + farthestRoomBottom += 10; + + for (int xRoomPosition = farthestRoomLeft; xRoomPosition < farthestRoomRight; xRoomPosition++) + { + for (int roomPositionY = farthestRoomTop; roomPositionY < farthestRoomBottom; roomPositionY++) + { + WorldGen.outerTempled(xRoomPosition, roomPositionY); + } + } + for (int xRoomPosition = farthestRoomRight; xRoomPosition >= farthestRoomLeft; xRoomPosition--) + { + for (int yRoomPosition = farthestRoomTop; yRoomPosition < farthestRoomBottom / 2; yRoomPosition++) + { + WorldGen.outerTempled(xRoomPosition, yRoomPosition); + } + } + for (int yRoomPosition = farthestRoomTop; yRoomPosition < farthestRoomBottom; yRoomPosition++) + { + for (int xRoomPosition = farthestRoomLeft; xRoomPosition < farthestRoomRight; xRoomPosition++) + { + WorldGen.outerTempled(xRoomPosition, yRoomPosition); + } + } + for (int yRoomPosition = farthestRoomBottom; yRoomPosition >= farthestRoomTop; yRoomPosition--) + { + for (int xRoomPosition = farthestRoomLeft; xRoomPosition < farthestRoomRight; xRoomPosition++) + { + WorldGen.outerTempled(xRoomPosition, yRoomPosition); + } + } + + // Move downward and prepare to have the tunnel go in the opposite direction(?) + xDirection = -initalDirection; + Vector2 endPathPosition = new Vector2(pathPositionX, pathPositionY); + int yArea = 4; + bool success = false; + int totralDescentTries = 0; + int endPathRisePrompt = WorldGen.genRand.Next(12, 14); + while (!success) + { + totralDescentTries++; + if (totralDescentTries >= endPathRisePrompt) + { + totralDescentTries = 0; + endPathPosition.Y--; + } + endPathPosition.X += xDirection; + success = true; + 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)) + { + success = false; + } + if (Main.tile[(int)endPathPosition.X, dy].active() && Main.tile[(int)endPathPosition.X, dy].type == TileID.LihzahrdBrick) + { + Main.tile[(int)endPathPosition.X, dy].active(false); + Main.tile[(int)endPathPosition.X, dy].wall = WallID.LihzahrdBrickUnsafe; + } + dy++; + } + } + + // Place bricks and walls around temple door. + int doorPositionX = pathPositionX; + int doorPositionY = pathPositionY; + while (!Main.tile[doorPositionX, doorPositionY].active()) + { + doorPositionY++; + } + 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) + { + doorTop--; + } + doorTop += 2; + for (int dx = doorPositionX - 1; dx <= doorPositionX + 1; dx++) + { + for (int dy = doorTop; dy <= doorPositionY; dy++) + { + Main.tile[dx, dy].active(true); + Main.tile[dx, dy].type = TileID.LihzahrdBrick; + Main.tile[dx, dy].liquid = 0; + Main.tile[dx, dy].slope(0); + Main.tile[dx, dy].halfBrick(false); + } + } + for (int dx = doorPositionX - 4; dx <= doorPositionX + 4; dx++) + { + for (int dy = doorPositionY - 1; dy < doorPositionY + 3; dy++) + { + Main.tile[dx, dy].active(false); + Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + } + } + for (int dx = doorPositionX - 1; dx <= doorPositionX + 1; dx++) + { + 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].liquid = 0; + Main.tile[dx, dy].slope(0); + Main.tile[dx, dy].halfBrick(false); + } + } + for (int dx = doorPositionX - 1; dx <= doorPositionX + 1; dx++) + { + for (int dy = doorPositionY; dy < doorPositionY + 3; dy++) + { + Main.tile[dx, dy].active(false); + Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + } + } + + // Temple Door + WorldGen.PlaceTile(doorPositionX, doorPositionY, 10, true, false, -1, 11); + + // Clear space in temple + for (int dx = farthestRoomLeft; dx < farthestRoomRight; dx++) + { + for (int dy = farthestRoomTop; dy < farthestRoomBottom; dy++) + { + WorldGen.templeCleaner(dx, dy); + } + } + for (int dx = farthestRoomBottom; dx >= farthestRoomTop; dx--) + { + for (int dy = farthestRoomRight; dy >= farthestRoomLeft; dy--) + { + WorldGen.templeCleaner(dy, dx); + } + } + + // Place walls + for (int dx = farthestRoomLeft; dx < farthestRoomRight; dx++) + { + for (int dy = farthestRoomTop; dy < farthestRoomBottom; dy++) + { + bool shouldPlaceWalls = true; + for (int dx2 = dx - 1; dx2 <= dx + 1; dx2++) + { + 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) + { + shouldPlaceWalls = false; + break; + } + } + } + if (shouldPlaceWalls) + { + Main.tile[dx, dy].wall = WallID.LihzahrdBrickUnsafe; + } + } + } + + // Create temple spikes + float totalSpikeAreasToSawpn = totalRooms * 1.3f; + int spikeAreaSpawnAttempts = 0; + while (totalSpikeAreasToSawpn > 0f) + { + spikeAreaSpawnAttempts++; + 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()) + { + bool successPlacingSpikes = false; + if (WorldGen.genRand.Next(2) == 0) + { + int xMoveDirection = WorldGen.genRand.NextBool(2).ToDirectionInt(); + while (!Main.tile[randomPointInRoomX, randomPointInRoomY].active()) + { + randomPointInRoomY += xMoveDirection; + } + randomPointInRoomY -= xMoveDirection; + int yMoveDirection = WorldGen.genRand.Next(2); + int areaToCheck = WorldGen.genRand.Next(8, 10); + bool noDoorInWay = true; + for (int dx = randomPointInRoomX - areaToCheck; dx < randomPointInRoomX + areaToCheck; dx++) + { + for (int dy = randomPointInRoomY - areaToCheck; dy < randomPointInRoomY + areaToCheck; dy++) + { + if (Main.tile[dx, dy].active() && Main.tile[dx, dy].type == 10) + { + noDoorInWay = false; + break; + } + } + } + if (noDoorInWay) + { + for (int dx = randomPointInRoomX - areaToCheck; dx < randomPointInRoomX + areaToCheck; dx++) + { + 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)) + { + Main.tile[dx, dy].type = TileID.WoodenSpikes; + successPlacingSpikes = true; + if (yMoveDirection == 0) + { + Main.tile[dx, dy - 1].type = TileID.WoodenSpikes; + Main.tile[dx, dy - 1].active(true); + } + else + { + Main.tile[dx, dy + 1].type = TileID.WoodenSpikes; + Main.tile[dx, dy + 1].active(true); + } + yMoveDirection++; + if (yMoveDirection > 1) + { + yMoveDirection = 0; + } + } + } + } + } + if (successPlacingSpikes) + { + spikeAreaSpawnAttempts = 0; + totalSpikeAreasToSawpn--; + } + } + else + { + int xMoveDirection = WorldGen.genRand.NextBool(2).ToDirectionInt(); + while (!Main.tile[randomPointInRoomX, randomPointInRoomY].active()) + { + randomPointInRoomX += xMoveDirection; + } + randomPointInRoomX -= xMoveDirection; + int yMoveDirection = WorldGen.genRand.Next(2); + int areaToCheck = WorldGen.genRand.Next(8, 10); + bool noDoorInWay = true; + for (int dx = randomPointInRoomX - areaToCheck; dx < randomPointInRoomX + areaToCheck; dx++) + { + for (int dy = randomPointInRoomY - areaToCheck; dy < randomPointInRoomY + areaToCheck; dy++) + { + if (Main.tile[dx, dy].active() && Main.tile[dx, dy].type == 10) + { + noDoorInWay = false; + break; + } + } + } + if (noDoorInWay) + { + for (int dx = randomPointInRoomX - areaToCheck; dx < randomPointInRoomX + areaToCheck; dx++) + { + 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)) + { + Main.tile[dx, dy].type = TileID.WoodenSpikes; + successPlacingSpikes = true; + if (yMoveDirection == 0) + { + Main.tile[dx - 1, dy].type = TileID.WoodenSpikes; + Main.tile[dx - 1, dy].active(true); + } + else + { + Main.tile[dx + 1, dy].type = TileID.WoodenSpikes; + Main.tile[dx + 1, dy].active(true); + } + yMoveDirection++; + if (yMoveDirection > 1) + { + yMoveDirection = 0; + } + } + } + } + } + if (successPlacingSpikes) + { + spikeAreaSpawnAttempts = 0; + totalSpikeAreasToSawpn--; + } + } + } + if (spikeAreaSpawnAttempts > 1000) + { + spikeAreaSpawnAttempts = 0; + totalSpikeAreasToSawpn--; + } + } + + // Set variables for the bounds and room count of the temple. + WorldGen.tLeft = farthestRoomLeft; + WorldGen.tRight = farthestRoomRight; + WorldGen.tTop = farthestRoomTop; + WorldGen.tBottom = farthestRoomBottom; + WorldGen.tRooms = totalRooms; + } + + public static void GenerateGenericRoom(Rectangle roomBounds) + { + int roomLeft = roomBounds.X; + int roomRight = roomLeft + roomBounds.Width; + int roomTop = roomBounds.Y; + int roomBottom = roomTop + roomBounds.Height; + + roomLeft += WorldGen.genRand.Next(4, 7); + roomRight -= WorldGen.genRand.Next(4, 7); + roomTop += WorldGen.genRand.Next(4, 7); + roomBottom -= WorldGen.genRand.Next(4, 7); + + int offsettedRoomLeft = roomLeft; + int offsettedRoomRight = roomRight; + int offsettedRoomTop = roomTop; + int offsettedRoomBottom = roomBottom; + + int roomCenterX = (roomLeft + roomRight) / 2; + int roomCenterY = (roomTop + roomBottom) / 2; + + // Cut out the rooms with a bit of randomness incorporated, so that the room is not entirely square. + for (int dx = roomLeft; dx < roomRight; dx++) + { + for (int dy = roomTop; dy < roomBottom; dy++) + { + if (WorldGen.genRand.NextBool(20)) + offsettedRoomTop += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + if (WorldGen.genRand.NextBool(20)) + offsettedRoomBottom += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + if (WorldGen.genRand.NextBool(20)) + offsettedRoomLeft += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + if (WorldGen.genRand.NextBool(20)) + offsettedRoomRight += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + offsettedRoomLeft = Utils.Clamp(offsettedRoomLeft, roomLeft, roomCenterX); + offsettedRoomRight = Utils.Clamp(offsettedRoomRight, roomCenterX, roomRight); + offsettedRoomTop = Utils.Clamp(offsettedRoomTop, roomTop, roomCenterY); + offsettedRoomBottom = Utils.Clamp(offsettedRoomBottom, roomCenterY, roomBottom); + + if (dx >= offsettedRoomLeft && (dx < offsettedRoomRight & dy >= offsettedRoomTop) && dy <= offsettedRoomBottom) + { + 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; + } + } + } + for (int dy = roomBottom; dy > roomTop; dy--) + { + for (int dx = roomRight; dx > roomLeft; dx--) + { + if (WorldGen.genRand.NextBool(20)) + offsettedRoomTop += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + if (WorldGen.genRand.NextBool(20)) + offsettedRoomBottom += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + if (WorldGen.genRand.NextBool(20)) + offsettedRoomLeft += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + if (WorldGen.genRand.NextBool(20)) + offsettedRoomRight += WorldGen.genRand.NextBool(2).ToDirectionInt(); + + offsettedRoomLeft = Utils.Clamp(offsettedRoomLeft, roomLeft, roomCenterX); + offsettedRoomRight = Utils.Clamp(offsettedRoomRight, roomCenterX, roomRight); + offsettedRoomTop = Utils.Clamp(offsettedRoomTop, roomTop, roomCenterY); + offsettedRoomBottom = Utils.Clamp(offsettedRoomBottom, roomCenterY, roomBottom); + + if (dx >= offsettedRoomLeft && (dx < offsettedRoomRight & dy >= offsettedRoomTop) && dy <= offsettedRoomBottom) + { + 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; + } + } + } + } + + public static void GenerateShrineRoom(Rectangle roomBounds) + { + // Cut out the room. + for (int dx = roomBounds.Left; dx < roomBounds.Right; dx++) + { + for (int dy = roomBounds.Top; dy < roomBounds.Bottom; dy++) + { + 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; + } + } + + // Place the shrine atop a pedestal. + int roomCenterX = roomBounds.Center.X; + int roomTop = roomBounds.Top; + int roomBottom = roomBounds.Bottom; + int shrinePedestalWidth = roomBounds.Width / 6 + WorldGen.genRand.Next(6); + + // Ensure that the pedestal is always an even number, so that the shrine can be placed atop symmetrically. + if (shrinePedestalWidth % 2 != 0) + shrinePedestalWidth++; + + int calculateHeightFromOutwardness(int outwardness) + { + int height = Math.Max(outwardness, 4); // 8 tile wide area on top. + + return (shrinePedestalWidth / 2) - height; // Invert height so that it ascends instead of descends. + } + + // Place the pedestal. + for (int dx = 0; dx < shrinePedestalWidth / 2; dx++) + { + int height = calculateHeightFromOutwardness(dx); + + 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].active(true); + Main.tile[roomCenterX + dx, y].type = TileID.LihzahrdBrick; + } + } + + // And place the shrine. + CalamityWorld.newAltarX = roomCenterX - 1; + CalamityWorld.newAltarY = roomBottom - calculateHeightFromOutwardness(0) - 2; + + // Place some lanterns on the top of the room. + for (int dx = 6; dx < roomBounds.Width - 6; dx += 10) + { + WorldGen.PlaceTile(roomBounds.Left + dx, roomTop + 1, TileID.HangingLanterns, style: 20); + } + + int totalTables = roomBounds.Width / 8; + int tries = 0; + for (int i = 0; i < totalTables; i++) + { + tries++; + if (tries >= 1600) + break; + int x = WorldGen.genRand.Next(5, roomBounds.Width - 5) + roomBounds.Left; + 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) + { + i--; + continue; + } + WorldGen.PlaceTile(x, roomBottom - 3, TileID.Candles, style: 11); + } + } + + public static void NewJungleTemplePart2() + { + int templeLeft = WorldGen.tLeft; + int templeRight = WorldGen.tRight; + int templeTop = WorldGen.tTop; + int templeBottom = WorldGen.tBottom; + int totalRooms = WorldGen.tRooms; + float totalTrapsToPlace = totalRooms * 2.1f; + float totalStatuesToPlace = totalRooms * 1.6f; + float totalChestsToPlace = totalRooms * 0.4f; + + int placementAttempts = 0; + while (totalTrapsToPlace > 0f) + { + 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 (WorldGen.mayanTrap(randomPointInRoomX, randomPointInRoomY)) + { + totalTrapsToPlace--; + placementAttempts = 0; + } + else + { + placementAttempts++; + } + } + else + { + placementAttempts++; + } + if (placementAttempts > 100) + { + placementAttempts = 0; + totalTrapsToPlace--; + } + } + + // Bit of a weird solution that makes wooden spikes non-solid so that nothing is placed on top of them. + Main.tileSolid[TileID.WoodenSpikes] = false; + + placementAttempts = 0; + while (totalChestsToPlace > 0f) + { + 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() && + WorldGen.AddBuriedChest(randomPointInTempleX, randomPointInTempleY, ItemID.LihzahrdPowerCell, true, 16)) + { + totalChestsToPlace--; + placementAttempts = 0; + } + placementAttempts++; + if (placementAttempts > 10000) + { + break; + } + } + placementAttempts = 0; + while (totalStatuesToPlace > 0f) + { + 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()) + { + int statuePlacementPositionY = randomPointInTempleY; + while (!Main.tile[randomPointInTempleX, statuePlacementPositionY].active()) + { + statuePlacementPositionY++; + if (statuePlacementPositionY > templeBottom) + { + break; + } + } + statuePlacementPositionY--; + 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) + { + totalStatuesToPlace--; + } + } + } + } + + float totalFurnitureElementsToPlace = totalRooms * 1.1f; + + placementAttempts = 0; + while (totalFurnitureElementsToPlace > 0f) + { + 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()) + { + int furniturePlacementPositionY = randomPointInTempleY; + while (!Main.tile[randomPointInTempleX, furniturePlacementPositionY].active()) + { + furniturePlacementPositionY++; + if (furniturePlacementPositionY > templeBottom) + { + break; + } + } + furniturePlacementPositionY--; + if (furniturePlacementPositionY <= templeBottom) + { + switch (WorldGen.genRand.Next(3)) + { + case 0: + WorldGen.PlaceTile(randomPointInTempleX, furniturePlacementPositionY, TileID.WorkBenches, true, false, -1, 10); + if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].type == TileID.WorkBenches) + { + totalFurnitureElementsToPlace--; + } + break; + case 1: + WorldGen.PlaceTile(randomPointInTempleX, furniturePlacementPositionY, TileID.Tables, true, false, -1, 9); + if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].type == TileID.Tables) + { + totalFurnitureElementsToPlace--; + } + break; + case 2: + WorldGen.PlaceTile(randomPointInTempleX, furniturePlacementPositionY, TileID.Chairs, true, false, -1, 12); + if (Main.tile[randomPointInTempleX, furniturePlacementPositionY].type == TileID.Chairs) + { + totalFurnitureElementsToPlace--; + } + break; + } + } + } + if (placementAttempts > 10000) + { + break; + } + } + + // Return wood spikes back to normal after the above placements are done. + Main.tileSolid[TileID.WoodenSpikes] = true; + } + + public static void NewJungleTempleLihzahrdAltar() + { + int alterPositionX = CalamityWorld.newAltarX; + int alterPositionY = CalamityWorld.newAltarY; + for (int i = 0; i <= 2; i++) + { + for (int j = 0; j < 2; j++) + { + 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); + } + + // 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; + } + } + } +} diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 7c6315ff6c..f10e8a59d7 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -2,32 +2,48 @@ using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Schematics; -using CalamityMod.Tiles; -using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; +using System; using System.Collections.Generic; using System.Linq; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using static CalamityMod.Schematics.SchematicLoader; -using static CalamityMod.Schematics.SchematicPlacementHelpers; +using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { - internal struct ChestItem - { - internal int Type; - internal int Stack; - internal ChestItem(int type, int stack) - { - Type = type; - Stack = stack; - } - } public static class DraedonStructures { + private static int[] otherModTilesToAvoid; + + internal static void Load() + { + IList avoid = new List(16); + + // Mod of Redemption's labs use modded blocks, but must still be avoided. + Mod mor = CalamityMod.Instance.redemption; + if (mor != null) + { + // Thanks to Hallam to providing these tile names. + string[] redemptionAvoidTiles = new string[] + { + "LabTileUnsafe", + "OvergrownLabTile" + }; + foreach (string tileName in redemptionAvoidTiles) + avoid.Add(mor.TileType(tileName)); + } + + otherModTilesToAvoid = avoid.ToArray(); + } + + internal static void Unload() + { + otherModTilesToAvoid = null; + } + public static bool ShouldAvoidLocation(Point placementPoint, bool careAboutLava = true) { Tile tile = CalamityUtils.ParanoidTileRetrieval(placementPoint.X, placementPoint.Y); @@ -51,7 +67,16 @@ namespace CalamityMod.World { return true; } - return false; + + // + // Below this line: Avoiding other mod worldgen. + // + + // 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) + return true; + // Avoid all other registered modded tiles to avoid. + return otherModTilesToAvoid.Any(id => tile.type == id); } #region Workshop @@ -79,41 +104,43 @@ namespace CalamityMod.World int tries = 0; string mapKey = "Workshop"; - TryAgain: - int underworldTop = Main.maxTilesY - 200; - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next(underworldTop - 550, underworldTop - 50); - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int activeTilesInArea = 0; - int xCheckArea = 40; - bool canGenerateInLocation = true; - - // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. - bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); - float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; - for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + do { - for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); + int placementPositionY = WorldGen.genRand.Next(underworldTop - 550, underworldTop - 50); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int activeTilesInArea = 0; + int xCheckArea = 40; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active()) + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - activeTilesInArea++; + + if (tile.active()) + activeTilesInArea++; } } - } - if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) - { - tries++; - if (tries > 25000) - return; - goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) - } - PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), PlacementAnchorType.TopLeft, FillWorkshopChest); + if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) + tries++; + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillWorkshopChest)); + break; + } + + } while (tries <= 25000); } #endregion @@ -142,41 +169,43 @@ namespace CalamityMod.World int tries = 0; string mapKey = "Research Facility"; - TryAgain: - int underworldTop = Main.maxTilesY - 200; - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f)); - int placementPositionY = WorldGen.genRand.Next(underworldTop - 400, underworldTop - 50); - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int activeTilesInArea = 0; - int xCheckArea = 30; - bool canGenerateInLocation = true; - - // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. - bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); - float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; - for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + do { - for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.15f), (int)(Main.maxTilesX * 0.85f)); + int placementPositionY = WorldGen.genRand.Next(underworldTop - 400, underworldTop - 50); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + int activeTilesInArea = 0; + int xCheckArea = 30; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 240f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active()) + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - activeTilesInArea++; + + if (tile.active()) + activeTilesInArea++; } } + if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) + tries++; + else + { + bool _ = true; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillLaboratoryChest)); + break; + } } - if (!canGenerateInLocation || nearbyOtherWorkshop || activeTilesInArea / totalTiles > 0.35f) - { - tries++; - if (tries > 25000) - return; - goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) - } - PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), PlacementAnchorType.TopLeft, FillLaboratoryChest); + while (tries <= 25000); } #endregion @@ -212,42 +241,42 @@ namespace CalamityMod.World int tries = 0; string mapKey = "Hell Laboratory"; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); - ColorTileCombination[,] schematic = TileMaps[mapKey]; + SchematicMetaTile[,] schematic = TileMaps[mapKey]; - TryAgain: - int underworldTop = Main.maxTilesY - 200; - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.82), (int)(Main.maxTilesX * 0.925)); - int placementPositionY = WorldGen.genRand.Next(Main.maxTilesY - 150, Main.maxTilesY - 125); - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int xCheckArea = 30; - bool canGenerateInLocation = true; - - // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. - float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; - for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + do { - for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.82), (int)(Main.maxTilesX * 0.925)); + int placementPositionY = WorldGen.genRand.Next(Main.maxTilesY - 150, Main.maxTilesY - 125); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + int xCheckArea = 30; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active()) + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y), false)) canGenerateInLocation = false; } } + if (!canGenerateInLocation) + { + tries++; + } + else + { + bool hasPlacedMurasama = false; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedMurasama, new Action(FillHellLaboratoryChest)); + break; + } } - if (!canGenerateInLocation) - { - tries++; - if (tries > 50000) - return; - goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) - } - - bool hasPlacedMurasama = false; - PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), PlacementAnchorType.TopLeft, ref hasPlacedMurasama, FillHellLaboratoryChest); + while (tries <= 50000); } #endregion @@ -283,7 +312,7 @@ namespace CalamityMod.World int tries = 0; string mapKey = "Sunken Sea Laboratory"; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); - ColorTileCombination[,] schematic = TileMaps[mapKey]; + SchematicMetaTile[,] schematic = TileMaps[mapKey]; do { @@ -294,7 +323,7 @@ namespace CalamityMod.World int placementPositionY = WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Bottom + sunkenSeaHeight - 25, WorldGen.UndergroundDesertLocation.Bottom + sunkenSeaHeight + 10); placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); int xCheckArea = 25; bool shouldAvoidArea = false; @@ -315,7 +344,7 @@ namespace CalamityMod.World while (tries < 50000); bool hasPlacedLogAndSchematic = false; - PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), PlacementAnchorType.TopLeft, ref hasPlacedLogAndSchematic, FillSunkenSeaLaboratoryChest); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillSunkenSeaLaboratoryChest)); } #endregion @@ -356,48 +385,49 @@ namespace CalamityMod.World int tries = 0; string mapKey = "Ice Laboratory"; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); - ColorTileCombination[,] schematic = TileMaps[mapKey]; + SchematicMetaTile[,] schematic = TileMaps[mapKey]; - TryAgain: - int underworldTop = Main.maxTilesY - 200; - int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); - int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop); - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int activeTilesInArea = 0; - int iceTilesInArea = 0; - int xCheckArea = 30; - bool canGenerateInLocation = true; - - // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. - bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 180f); - float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; - for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + do { - for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); + int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + int activeTilesInArea = 0; + int iceTilesInArea = 0; + int xCheckArea = 30; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 180f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active()) + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + if (tile.active()) + { + if (tile.type == TileID.SnowBlock || tile.type == TileID.IceBlock) + iceTilesInArea++; + activeTilesInArea++; + } if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - if (tile.type == TileID.SnowBlock || tile.type == TileID.IceBlock) - iceTilesInArea++; - activeTilesInArea++; } } + if (!canGenerateInLocation || nearbyOtherWorkshop || iceTilesInArea < totalTiles * 0.35f) + tries++; + else + { + bool hasPlacedLogAndSchematic = false; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillIceLaboratoryChest)); + break; + } } - if (!canGenerateInLocation || nearbyOtherWorkshop || iceTilesInArea < totalTiles * 0.35f) - { - tries++; - if (tries > 50000) - return; - goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) - } - - bool hasPlacedLogAndSchematic = false; - PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), PlacementAnchorType.TopLeft, ref hasPlacedLogAndSchematic, FillIceLaboratoryChest); + while (tries <= 50000); } #endregion @@ -432,48 +462,51 @@ namespace CalamityMod.World int tries = 0; string mapKey = "Plague Laboratory"; PilePlacementMaps.TryGetValue(mapKey, out PilePlacementFunction pilePlacementFunction); - ColorTileCombination[,] schematic = TileMaps[mapKey]; + SchematicMetaTile[,] schematic = TileMaps[mapKey]; - TryAgain: - int underworldTop = Main.maxTilesY - 200; - int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); - int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop); - - placementPoint = new Point(placementPositionX, placementPositionY); - Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); - int activeTilesInArea = 0; - int jungleTilesInArea = 0; - int xCheckArea = 30; - bool canGenerateInLocation = true; - - // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. - bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 200f); - float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; - for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) + do { - for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + int underworldTop = Main.maxTilesY - 200; + int placementPositionX = WorldGen.genRand.Next(120, Main.maxTilesX - 120); + int placementPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 160, underworldTop); + + placementPoint = new Point(placementPositionX, placementPositionY); + Vector2 schematicSize = new Vector2(schematic.GetLength(0), schematic.GetLength(1)); + int activeTilesInArea = 0; + int jungleTilesInArea = 0; + int xCheckArea = 30; + bool canGenerateInLocation = true; + + // new Vector2 is used here since a lambda expression cannot capture a ref, out, or in parameter. + bool nearbyOtherWorkshop = workshopPoints.Any(point => Vector2.Distance(point.ToVector2(), new Vector2(placementPositionX, placementPositionY)) < 200f); + float totalTiles = (schematicSize.X + xCheckArea * 2) * schematicSize.Y; + for (int x = placementPoint.X - xCheckArea; x < placementPoint.X + schematicSize.X + xCheckArea; x++) { - Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); - if (tile.active()) + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); if (ShouldAvoidLocation(new Point(x, y))) canGenerateInLocation = false; - if (tile.type == TileID.Mud || tile.type == TileID.JungleGrass) - jungleTilesInArea++; - activeTilesInArea++; + if (tile.active()) + { + if (tile.type == TileID.Mud || tile.type == TileID.JungleGrass) + jungleTilesInArea++; + activeTilesInArea++; + } } } + if (!canGenerateInLocation || nearbyOtherWorkshop || jungleTilesInArea < totalTiles * 0.4f) + { + tries++; + } + else + { + bool hasPlacedLogAndSchematic = false; + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(FillPlagueLaboratoryChest)); + break; + } } - if (!canGenerateInLocation || nearbyOtherWorkshop || jungleTilesInArea < totalTiles * 0.4f) - { - tries++; - if (tries > 50000) - return; - goto TryAgain; // Try again elsewhere if the correct conditions are not met. (Yes, I'm using a goto. Please don't kill me) - } - - bool hasPlacedLogAndSchematic = false; - PlaceStructure(mapKey, new Point(placementPoint.X, placementPoint.Y), PlacementAnchorType.TopLeft, ref hasPlacedLogAndSchematic, FillPlagueLaboratoryChest); + while (tries <= 50000); } #endregion @@ -501,7 +534,7 @@ namespace CalamityMod.World new ChestItem(potionType, WorldGen.genRand.Next(3, 5 + 1)), }; - Mod thorium = ModLoader.GetMod("ThoriumMod"); + Mod thorium = CalamityMod.Instance.thorium; if (thorium != null) contents.Add(new ChestItem(thorium.ItemType("MarineKelpPlanterBox"), WorldGen.genRand.Next(5, 9 + 1))); diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs new file mode 100644 index 0000000000..14f9a10476 --- /dev/null +++ b/World/MiscWorldgenRoutines.cs @@ -0,0 +1,832 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.FurnitureAncient; +using CalamityMod.Tiles.Ores; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using System; +using System.Reflection; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public class MiscWorldgenRoutines + { + #region Dungeon Biome Chests + public static void GenerateBiomeChests(GenerationProgress progress) + { + progress.Message = "Calamity Mod: Biome Chests"; + + // Get dungeon size field infos. These fields are private for some reason + int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; + int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + + int[] ChestTypes = { ModContent.TileType() }; + int[] ItemTypes = { ModContent.ItemType() }; + int[] ChestStyles = { 1 }; // Astral Chest generates in style 1, which is locked + + for (int i = 0; i < ChestTypes.Length; ++i) + { + Chest chest = null; + int attempts = 0; + + // Try 1000 times to place the chest somewhere in the dungeon. + // The placement algorithm ensures that if it tries to appear in midair, it is moved down to the floor. + while (chest == null && attempts < 1000) + { + 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()) + chest = AddChestWithLoot(x, y, (ushort)ChestTypes[i], tileStyle: ChestStyles[i]); + } + + // If a chest was placed, force its first item to be the unique Biome Chest weapon. + if (chest != null) + { + chest.item[0].SetDefaults(ItemTypes[i]); + chest.item[0].Prefix(-1); + } + } + } + + internal static Chest AddChestWithLoot(int i, int j, ushort type = TileID.Containers, uint startingSlot = 1, int tileStyle = 0) + { + int chestIndex = -1; + + // Slide downwards on the Y axis trying to find the floor beneath the empty position initially picked + while (j < Main.maxTilesY - 210) + { + if (!WorldGen.SolidTile(i, j)) + { + j++; + continue; + } + + // If there are already 1,000 chests in the world and this one fails to place, just give up. + chestIndex = WorldGen.PlaceChest(i - 1, j - 1, type, false, tileStyle); + break; + } + + if (chestIndex < 0) + return null; + Chest chest = Main.chest[chestIndex]; + PlaceLootInChest(ref chest, type, startingSlot); + return chest; + } + + internal static void PlaceLootInChest(ref Chest chest, ushort type, uint startingSlot) + { + uint itemIndex = startingSlot; + + void PutItemInChest(ref Chest c, int id, int minQuantity = 0, int maxQuantity = 0, bool condition = true) + { + if (!condition) + return; + c.item[itemIndex].SetDefaults(id, false); + + // Don't set quantity unless quantity is specified + if(minQuantity > 0) + { + // Max quantity cannot be less than min quantity. It's zero if not specified, meaning you get exactly minQuantity. + if (maxQuantity < minQuantity) + maxQuantity = minQuantity; + c.item[itemIndex].stack = WorldGen.genRand.Next(minQuantity, maxQuantity + 1); + } + itemIndex++; + } + + // Astral Chest has completely different loot in it + if (type == ModContent.TileType()) + { + PutItemInChest(ref chest, ModContent.ItemType(), 30, 80); + PutItemInChest(ref chest, ModContent.ItemType(), 10, 14); + PutItemInChest(ref chest, ModContent.ItemType(), 8); + PutItemInChest(ref chest, ModContent.ItemType(), 3, 5); + PutItemInChest(ref chest, ItemID.FallenStar, 12, 30); + + // Gold Coins don't stack above 100, so this efficiently lets you stuff over a platinum into a chest + int goldCoins = WorldGen.genRand.Next(30, 120); + if (goldCoins > 100) + { + PutItemInChest(ref chest, ItemID.PlatinumCoin); + goldCoins -= 100; + } + PutItemInChest(ref chest, ItemID.GoldCoin, goldCoins); + } + else if (type == ModContent.TileType()) + { + // 15-29 torches (in accordence with vanilla) + PutItemInChest(ref chest, ItemID.Torch, 15, 29); + + // 50% chance of 1 or 2 of the following potions + int[] potions = new int[] + { + ModContent.ItemType(), ItemID.WaterWalkingPotion, ItemID.ShinePotion, ItemID.GillsPotion, ItemID.FlipperPotion + }; + PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); + PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); + + // 33% chance of flippers + PutItemInChest(ref chest, ItemID.Flipper, condition: WorldGen.genRand.NextBool(3)); + + // Typical coins + PutItemInChest(ref chest, ItemID.GoldCoin, 2, 4); + } + // Default loot + else + { + // Silver, Tungsten, Gold or Platinum bars (following worldgen choice) + int barID = WorldGen.genRand.NextBool() ? WorldGen.goldBar : WorldGen.silverBar; + PutItemInChest(ref chest, barID, 3, 10); + + // 50% chance of 25-50 Holy Arrows + PutItemInChest(ref chest, ItemID.HolyArrow, 25, 50, WorldGen.genRand.NextBool()); + + // 50% chance of 1 or 2 of the following potions + int[] potions = new int[] { + ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.NightOwlPotion, + ItemID.WaterWalkingPotion, ItemID.ArcheryPotion, ItemID.GravitationPotion + }; + PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); + + // 50% chance of 1 or 2 of the following potions + // Yes, in vanilla, Dangersense Potions have double the chance to appear. + potions = new int[] { + ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.InvisibilityPotion, + ItemID.ManaRegenerationPotion, ItemID.TeleportationPotion, ItemID.TrapsightPotion, ItemID.TrapsightPotion + }; + + PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); + PutItemInChest(ref chest, ItemID.RecallPotion, 1, 2, WorldGen.genRand.NextBool()); + PutItemInChest(ref chest, ItemID.GoldCoin, 1, 2); + } + } + #endregion + + #region Place Rox Shrine + public static void PlaceRoxShrine() + { + while (!CalamityWorld.roxShrinePlaced) + { + CalamityWorld.roxShrinePlaced = true; + for (int x = 0; x < Main.maxTilesX; x++) + { + 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].frameX == 18 && Main.tile[x, y].frameY == 0) || (Main.tile[x, y].frameX == 45 && Main.tile[x, y].frameY == 0)) + { + if (WorldGen.genRand.Next(3) == 0) + { + for (int dx = -1; dx < 2; dx++) + { + for (int dy = -1; dy < 2; dy++) + Main.tile[x + dx, y + dy].active(false); + } + + WorldGen.PlaceTile(x, y + 1, ModContent.TileType()); + return; + } + else + CalamityWorld.roxShrinePlaced = false; + } + } + } + } + } + } + #endregion + + // NOTE - The crag gen is scheduled for a rework soon. As such, its code will not be moved. + + #region UnderworldIsland + public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) + { + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < Main.maxTilesY - 270) + { + num9 = Main.maxTilesY - 270; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)ModContent.TileType(); + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + if (num14 < Main.maxTilesX - WorldGen.genRand.Next(265, 275 + 1)) + break; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = ModContent.TileType(); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = ModContent.TileType(); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + 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; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = ModContent.TileType(); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + 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; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (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()) + { + 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()) + { + 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()) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + } + #endregion + + #region UnderworldIslandHouse + public static void UnderworldIslandHouse(int i, int j, int item) + { + ushort type = (ushort)ModContent.TileType(); //tile + byte wall = (byte)ModContent.WallType(); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + 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].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, ModContent.TileType(), true, false, -1); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + 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].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest + int num22 = i + (num2 / 2 + 1) * -num; + 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 tile2 = Main.tile[num22 - 2, num7 - 2]; + tile2.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, ModContent.TileType(), true, false, 0); //chair + } + #endregion + + #region ChasmGenerator + public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) + { + float num = steps; //850 small 1450 medium 2050 large + if (ocean) + { + int tileYLookup = j; + if (CalamityWorld.abyssSide) + { + while (!Main.tile[i + 125, tileYLookup].active()) + { + tileYLookup++; + } + } + else + { + while (!Main.tile[i - 125, tileYLookup].active()) + { + tileYLookup++; + } + } + j = tileYLookup; + } + Vector2 vector; + vector.X = i; + vector.Y = j; + Vector2 vector2; + vector2.X = WorldGen.genRand.Next(-1, 2) * 0.1f; + vector2.Y = WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; + int num2 = 5; + double num3 = WorldGen.genRand.Next(5, 7) + 20; //start width + while (num3 > 0.0) + { + if (num > 0f) + { + num3 += WorldGen.genRand.Next(2); + num3 -= WorldGen.genRand.Next(2); + float smallHoleLimit = 790f; //small + if (Main.maxTilesY > 1500) + { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } + if (ocean && num > smallHoleLimit) + { + if (num3 < 7.0) //min width + { + num3 = 7.0; //min width + } + if (num3 > 11.0) //max width + { + num3 = 11.0; //max width + } + } + else //dig large hole + { + if (num3 < (ocean ? 45.0 : 8.0)) //min width + { + num3 = ocean ? 45.0 : 8.0; //min width + } + if (num3 > (ocean ? 50.0 : 20.0)) //max width + { + num3 = ocean ? 50.0 : 20.0; //max width + } + if (num == 1f && num3 < (ocean ? 50.0 : 15.0)) + { + num3 = ocean ? 50.0 : 15.0; + } + } + } + else + { + if ((double)vector.Y > CalamityWorld.abyssChasmBottom) + { + num3 -= WorldGen.genRand.Next(5) + 8; + } + } + if (Main.maxTilesY > 2100) + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + (vector.Y >= Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else if (Main.maxTilesY > 1500) + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + (vector.Y > Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + (vector.Y > Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + num -= 1f; + int num4; + int num5; + int num6; + int num7; + if (num > num2) + { + num4 = (int)(vector.X - num3 * 0.5); + num5 = (int)(vector.X + num3 * 0.5); + num6 = (int)(vector.Y - num3 * 0.5); + num7 = (int)(vector.Y + num3 * 0.5); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int k = num4; k < num5; k++) + { + for (int l = num6; l < num7; l++) + { + if ((Math.Abs(k - vector.X) + Math.Abs(l - vector.Y)) < num3 * 0.5 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(false); + } + else + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(true); + } + } + } + } + } + /*if (num <= 2f && vector.Y < (Main.rockLayer + Main.maxTilesY * 0.3)) + { + num = 2f; + }*/ + vector += vector2; + vector2.X += WorldGen.genRand.Next(-1, 2) * 0.01f; + if (vector2.X > 0.02) + { + vector2.X = 0.02f; + } + if (vector2.X < -0.02) + { + vector2.X = -0.02f; + } + num4 = (int)(vector.X - num3 * 1.1); + num5 = (int)(vector.X + num3 * 1.1); + num6 = (int)(vector.Y - num3 * 1.1); + num7 = (int)(vector.Y + num3 * 1.1); + if (num4 < 1) + { + num4 = 1; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int m = num4; m < num5; m++) + { + for (int n = num6; n < num7; n++) + { + if ((Math.Abs(m - vector.X) + Math.Abs(n - vector.Y)) < num3 * 1.1 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (n > j + WorldGen.genRand.Next(7, 16)) + { + Main.tile[m, n].active(false); + } + if (steps <= num2) + { + Main.tile[m, n].active(false); + } + if (ocean) + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(false); + } + else + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(true); + } + } + } + } + for (int num11 = num4; num11 < num5; num11++) + { + for (int num12 = num6; num12 < num7; num12++) + { + if ((Math.Abs(num11 - vector.X) + Math.Abs(num12 - vector.Y)) < num3 * 1.1 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(false); + } + else + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(true); + } + if (steps <= num2) + { + Main.tile[num11, num12].active(false); + } + } + } + } + } + } + #endregion + } +} diff --git a/World/Planets/GrassPlanet.cs b/World/Planets/GrassPlanet.cs index 7a6c000dca..97cc474fd1 100644 --- a/World/Planets/GrassPlanet.cs +++ b/World/Planets/GrassPlanet.cs @@ -1,3 +1,4 @@ +using CalamityMod.DataStructures; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; diff --git a/World/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs new file mode 100644 index 0000000000..7886b6dc64 --- /dev/null +++ b/World/Planets/LuminitePlanet.cs @@ -0,0 +1,94 @@ +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.World.Planets +{ + public class LuminitePlanet : Planetoid + { + public static void GenerateLuminitePlanetoids() + { + // Don't attempt to generate these things client-side. + if (Main.netMode == NetmodeID.MultiplayerClient) + return; + + // The worldgen structure map only gets created/regenerated when you generate a world, for some reason. + // This means if you simply enter a world and generate this planetoid, the map will not exist yet, and errors will arise. + // As a result, a new one is generated as necessary. + if (WorldGen.structures is null) + WorldGen.structures = new StructureMap(); + + int totalPlanetoidsToGenerate = Main.maxTilesX / 4200 + 1; + for (int i = 0; i < totalPlanetoidsToGenerate; i++) + { + for (int tries = 0; tries < 3000; tries++) + { + Point planetoidOrigin = new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 700, Main.maxTilesX / 2 + 700), WorldGen.genRand.Next(85, 110)); + if (WorldGen.genRand.NextBool(2)) + { + if (Biomes.Place(planetoidOrigin, WorldGen.structures)) + break; + } + else + { + if (Biomes.Place(planetoidOrigin, WorldGen.structures)) + break; + } + } + } + } + + public override bool Place(Point origin, StructureMap structures) + { + int radius = _random.Next(18, 21); + + if (!CheckIfPlaceable(origin, radius, structures)) + return false; + + PlacePlanet(origin, radius); + return base.Place(origin, structures); + } + + public void PlacePlanet(Point origin, int radius) + { + // Place outer shell that's somewhat randomized in shape. + for (int i = 0; i < 6; i++) + { + Vector2 offset = WorldGen.genRand.NextVector2Circular(7f, 7f); + Point offsetedOrigin = new Point((int)(origin.X + offset.X), (int)(origin.Y + offset.Y)); + + // Create an outer exodium shell. + WorldUtils.Gen(offsetedOrigin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + + // Create walls. + WorldUtils.Gen(offsetedOrigin, new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall(WallID.Stone) + })); + + // Place an inner luminite core. + WorldUtils.Gen(origin, new Shapes.Circle(radius - 3), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile(TileID.LunarOre, true) + })); + } + + // Smoothen the structure. + WorldUtils.Gen(origin, new Shapes.Circle(radius + 16), Actions.Chain(new GenAction[] + { + new Actions.Smooth() + })); + + // And sync the entire thing. + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileRange(-1, origin.X - radius - 16, origin.Y - radius - 16, radius * 2 + 16, radius * 2 + 16); + } + } +} diff --git a/World/Planets/LuminitePlanet2.cs b/World/Planets/LuminitePlanet2.cs new file mode 100644 index 0000000000..d54e4e765a --- /dev/null +++ b/World/Planets/LuminitePlanet2.cs @@ -0,0 +1,101 @@ +using CalamityMod.Tiles.Ores; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.World.Planets +{ + public class LuminitePlanet2 : Planetoid + { + public override bool Place(Point origin, StructureMap structures) + { + int radius = _random.Next(19, 21); + + if (!CheckIfPlaceable(origin, radius, structures)) + return false; + + PlacePlanet(origin, radius); + return base.Place(origin, structures); + } + + public void PlacePlanet(Point origin, int radius) + { + // Place outer shell that's somewhat randomized in shape. + for (int i = 0; i < 6; i++) + { + Vector2 offset = WorldGen.genRand.NextVector2Circular(7f, 7f); + Point offsetedOrigin = new Point((int)(origin.X + offset.X), (int)(origin.Y + offset.Y)); + + // Create an outer exodium shell. + WorldUtils.Gen(offsetedOrigin, new Shapes.Circle(radius), Actions.Chain(new GenAction[] + { + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.SetFrames() + })); + + // Create walls. + WorldUtils.Gen(offsetedOrigin, new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall(WallID.Stone) + })); + + // Place an inner luminite core. + WorldUtils.Gen(origin, new Shapes.Circle(radius - 2), Actions.Chain(new GenAction[] + { + new Modifiers.Blotches(2, 0.3), + new Actions.SetTile(TileID.LunarOre, true), + new Actions.SetFrames() + })); + } + + // Generate a bunch of exodium tendrils that appear in an arced formation. + float outwardTentacleReach = radius + 18f; + float initialRotationalOffset = WorldGen.genRand.NextFloat(MathHelper.TwoPi); + Vector2[] initialTendrilDirections = new Vector2[5]; + for (int i = 0; i < initialTendrilDirections.Length; i++) + { + // Determine the base control points for the tendril. + // They are all determined relative to the previous point. + Vector2[] veinDirections = new Vector2[4]; + + veinDirections[0] = (MathHelper.TwoPi * i / initialTendrilDirections.Length + initialRotationalOffset).ToRotationVector2(); + + // RotatedByRandom uses Main.rand, not WorldGen.genRand. + veinDirections[0] = veinDirections[0].RotatedBy(WorldGen.genRand.NextFloat(-0.19f, 0.19f)); + + for (int j = 1; j < veinDirections.Length; j++) + veinDirections[j] = veinDirections[j - 1].RotatedBy(WorldGen.genRand.NextFloat(-0.87f, 0.87f)); + + for (int j = 0; j <= 18; j++) + { + float completionRatio = j / 18f; + + // Smoothen the control points based on a catmull-rom spline. + Vector2 offset = Vector2.CatmullRom(veinDirections[0], veinDirections[1], veinDirections[2], veinDirections[3], j / 18f); + offset *= completionRatio * outwardTentacleReach; + + Point spawnPosition = new Point((int)(origin.X + offset.X), (int)(origin.Y + offset.Y)); + int strength = (int)(4f - completionRatio * 4f) + 1; + + // And generate the current tendril segment. + WorldUtils.Gen(spawnPosition, new Shapes.Circle(strength), Actions.Chain(new GenAction[] + { + new Actions.SetTile((ushort)ModContent.TileType(), true) + })); + } + } + + // Smoothen the structure. + WorldUtils.Gen(origin, new Shapes.Circle(radius + 36), Actions.Chain(new GenAction[] + { + new Actions.Smooth() + })); + + // And sync the entire thing. + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileRange(-1, origin.X - radius - 36, origin.Y - radius - 36, radius * 2 + 36, radius * 2 + 36); + } + } +} diff --git a/World/Planets/MainPlanet.cs b/World/Planets/MainPlanet.cs index 71ac6e3f1c..f2ec4f0f5e 100644 --- a/World/Planets/MainPlanet.cs +++ b/World/Planets/MainPlanet.cs @@ -1,3 +1,4 @@ +using CalamityMod.DataStructures; using CalamityMod.Schematics; using Microsoft.Xna.Framework; using System; @@ -105,8 +106,9 @@ namespace CalamityMod.World.Planets new Actions.SetFrames(true) })); + // TODO -- This should probably use PlacementAnchor.Center and just provide the center of the planetoid... bool hasPlacedLogAndSchematic = false; - SchematicPlacementHelpers.PlaceStructure("Planetoid Laboratory", new Point(origin.X - 33, origin.Y - 17), SchematicPlacementHelpers.PlacementAnchorType.TopLeft, ref hasPlacedLogAndSchematic, DraedonStructures.FillPlanetoidLaboratoryChest); + SchematicManager.PlaceSchematic("Planetoid Laboratory", new Point(origin.X - 33, origin.Y - 17), SchematicAnchor.TopLeft, ref hasPlacedLogAndSchematic, new Action(DraedonStructures.FillPlanetoidLaboratoryChest)); //PLACE BREAKABLE GRASS AND TREES WorldUtils.Gen(origin, new ModShapes.OuterOutline(mainShape, true, true), Actions.Chain(new GenAction[] diff --git a/World/Planets/Planetoid.cs b/World/Planets/Planetoid.cs index 5d5043a34f..d3e882d2c7 100644 --- a/World/Planets/Planetoid.cs +++ b/World/Planets/Planetoid.cs @@ -11,6 +11,88 @@ namespace CalamityMod.World.Planets { private Rectangle _area; + public static void GenerateAllBasePlanetoids(GenerationProgress progress) + { + progress.Message = "Generating Planetoids..."; + + int GrassPlanetoidCount = Main.maxTilesX / 1100; + int LCPlanetoidCount = Main.maxTilesX / 800; + int MudPlanetoidCount = Main.maxTilesX / 1100; + + const int MainPlanetoidAttempts = 3000; + int i = 0; + while (i < MainPlanetoidAttempts) + { + if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 300, Main.maxTilesX / 2 + 300), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) + { + break; + } + i++; + } + + const int CrystalHeartPlanetoidAttempts = 15000; + i = 0; + while (LCPlanetoidCount > 0 && i < CrystalHeartPlanetoidAttempts) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); + int y = WorldGen.genRand.Next(70, 101); + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + LCPlanetoidCount--; + i++; + } + + const int GrassPlanetoidAttempts = 12000; + i = 0; + while (GrassPlanetoidCount > 0 && i < GrassPlanetoidAttempts) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); + int y = WorldGen.genRand.Next(100, 131); + + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + GrassPlanetoidCount--; + i++; + } + + const int MudPlanetoidAttempts = 12000; + i = 0; + while (MudPlanetoidCount > 0 && i < MudPlanetoidAttempts) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int y = WorldGen.genRand.Next(100, 131); + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + MudPlanetoidCount--; + i++; + } + } + + public static bool InvalidSkyPlacementArea(Rectangle area) + { + Mod varia = CalamityMod.Instance.varia; + for (int i = area.Left; i < area.Right; i++) + { + 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) + return false; + + if (varia != null && + (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud"))) + { + return false; + } + } + } + return true; + } public bool CheckIfPlaceable(Point origin, int radius, StructureMap structures) { //Fluff is used to create padding between the planets. this is the minimum distance between planets (they can't be within "fluff" blocks) @@ -19,24 +101,8 @@ namespace CalamityMod.World.Planets int diameter = myRadius * 2; _area = new Rectangle(origin.X - myRadius, origin.Y - myRadius, diameter, diameter); - Mod varia = ModLoader.GetMod("Varia"); - for (int i = _area.Left; i < _area.Right; i++) - { - 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) - { - return false; - } - if (varia != null) - { - if (Main.tile[i, j].type == varia.TileType("StarplateBrick") || Main.tile[i, j].type == varia.TileType("ForgottenCloud")) - { - return false; - } - } - } - } + if (!InvalidSkyPlacementArea(_area)) + return false; if (!structures.CanPlace(_area)) { diff --git a/World/SmallBiomes.cs b/World/SmallBiomes.cs deleted file mode 100644 index 8ca6397570..0000000000 --- a/World/SmallBiomes.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.World -{ - public class SmallBiomes : ModWorld - { - public static void PlaceEvilIsland() - { - int x = Main.maxTilesX; - int xIslandGen = WorldGen.crimson ? - WorldGen.genRand.Next((int)(x * 0.1), (int)(x * 0.15)) : - WorldGen.genRand.Next((int)(x * 0.85), (int)(x * 0.9)); - int yIslandGen = WorldGen.genRand.Next(90, 151); - yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50); - - int tileXLookup = xIslandGen; - if (WorldGen.crimson) - { - while (Main.tile[tileXLookup, yIslandGen].active()) - tileXLookup++; - } - else - { - while (Main.tile[tileXLookup, yIslandGen].active()) - tileXLookup--; - } - - xIslandGen = tileXLookup; - CalamityWorld.fehX = xIslandGen; - CalamityWorld.fehY = yIslandGen; - WorldGenerationMethods.EvilIsland(xIslandGen, yIslandGen); - WorldGenerationMethods.EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); - } - - public static void PlaceShrines() - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - double shrineChance = 100E-05; - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Surface Shrine - { - int tilesX = WorldGen.genRand.Next((int)(x * 0.35), generateBack); - 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) - { - WorldGenerationMethods.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) - { - WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Evil Shrine - { - 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)) - { - WorldGenerationMethods.SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, - WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, - WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern Shrine - { - int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); - 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) - { - WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].type == TileID.Stone) - { - WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX2, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Ice Shrine - { - 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) - { - WorldGenerationMethods.SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Desert Shrine - { - 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) - { - WorldGenerationMethods.SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Mushroom Shrine - { - 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) - { - WorldGenerationMethods.SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Granite Shrine - { - 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) - { - WorldGenerationMethods.SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Marble Shrine - { - 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) - { - WorldGenerationMethods.SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX, tilesY); - break; - } - } - } - } -} diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs new file mode 100644 index 0000000000..10f12bc482 --- /dev/null +++ b/World/SulphurousSea.cs @@ -0,0 +1,1035 @@ +using CalamityMod.Items; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Schematics; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Walls; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public class SulphurousSea + { + #region Fields and Properties + public static int BiomeWidth + { + get + { + // Small world + if (Main.maxTilesX == 4200) + { + return 370; + } + // Medium world + else if (Main.maxTilesX == 6400) + { + return 445; + } + // Large world + else + { + return 500; + } + } + } + + public static int BlockDepth + { + get + { + // Small world + if (Main.maxTilesX == 4200) + { + return (int)((Main.rockLayer + 20 - YStart) * 0.8); + } + // Medium world + else if (Main.maxTilesX == 6400) + { + return (int)((Main.rockLayer + 20 - YStart) * 0.85); + } + // Large world + else + { + return (int)((Main.rockLayer + 20 - YStart) * 0.925); + } + } + } + + public static int YStart = 0; + public static readonly List SulphSeaTiles = new List() + { + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType() + }; + #endregion + + #region Placement Methods + public static void PlaceSulphurSea() + { + CalamityWorld.abyssSide = Main.dungeonX < Main.maxTilesX / 2; + DetermineYStart(); + CreateStartingBlock(); + CreateWater(); + GenerateHardenedSandstone(); + RemoveStupidTilesAboveSea(); + GenerateLake(); + SettleWater(); // The island Y spawn position calculations are relative to water. Settling the water before doing these calculations is ideal. + GenerateIslands(); + GenerateVentsAndFossils(); + SmoothenTheEntireSea(); + } + + public static void FinishGeneratingSulphurSea() + { + PlaceStalactites(); + PlaceColumns(); + PlaceRustyChests(); + CreateBeachNearSea(); + PlaceScrapPiles(); + } + #endregion + + #region Perlin Noise + public static float NoiseFunction(int seed) + { + seed = (seed << 13) ^ seed; + return 1.0f - ((seed * (seed * seed * 15731) + 1376312589) & 0x7fffffff) / 1073741824.0f; + } + public static float PerlinNoise2D(float x, float y, int octave, int seed) + { + float frequency = (float)Math.Pow(2, octave); + float xFrequency = x * frequency; + float yFrequency = y * frequency; + int flooredXFrequency = (int)xFrequency; + int flooredYFrequency = (int)yFrequency; + float fractionXFrequency = xFrequency - flooredXFrequency; + float fractionYFrequency = yFrequency - flooredYFrequency; + + float noise1 = NoiseFunction(flooredXFrequency + flooredYFrequency * 54 + seed); + float noise2 = NoiseFunction(flooredXFrequency + 1 + flooredYFrequency * 54 + seed); + float noise3 = NoiseFunction(flooredXFrequency + (1 + flooredYFrequency) * 54 + seed); + float noise4 = NoiseFunction(flooredXFrequency + 1 + (1 + flooredYFrequency) * 54 + seed); + + float lerpStart = MathHelper.Lerp(noise1, noise2, fractionXFrequency); + float lerpEnd = MathHelper.Lerp(noise3, noise4, fractionXFrequency); + return MathHelper.Lerp(lerpStart, lerpEnd, fractionYFrequency); + } + #endregion + + #region Generating Initial Block + public static void CreateStartingBlock() + { + // Set above for general performance. + ushort sandTileType = (ushort)ModContent.TileType(); + ushort sandstoneTileType = (ushort)ModContent.TileType(); + + ushort sandWallType = (ushort)ModContent.WallType(); + ushort sandstoneWallType = (ushort)ModContent.WallType(); + + + float randomValue1 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); + while (Math.Abs(randomValue1) < 0.22f) + { + randomValue1 = WorldGen.genRand.NextFloat(-0.4f, 0.4f); + } + float randomValue2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); + while (Math.Abs(randomValue2) < 0.07f) + { + randomValue2 = WorldGen.genRand.NextFloat(-0.2f, 0.2f); + } + + float randomValue3 = WorldGen.genRand.NextFloat(0.42f, 0.96f) * WorldGen.genRand.NextBool(2).ToDirectionInt(); + float wallBoundAtPosition(float xRatio) => (float)(Math.Sin(randomValue3 * MathHelper.Pi * xRatio) + Math.Cos(randomValue3 * Math.E / 2f * xRatio)) * 0.5f * 28f; + + for (int x = 1; x < BiomeWidth; x++) + { + float xRatio = x / (float)BiomeWidth; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + float yRatio = (y - YStart) / (float)BlockDepth; + float xAngleWrap = x / (float)BiomeWidth * MathHelper.TwoPi - MathHelper.Pi; + bool generateSand = yRatio < SandstoneYMinimum(xAngleWrap, randomValue1, randomValue2); + if (WorldGen.InWorld(trueX, y)) + { + if (y - YStart < BlockDepth - (int)(BlockDepth * 0.35f) + (int)(Math.Sin(xRatio * MathHelper.Pi) * (int)(BlockDepth * 0.35f))) + { + Main.tile[trueX, y] = new Tile() + { + type = generateSand ? sandTileType : sandstoneTileType, + wall = generateSand ? sandWallType : sandstoneWallType + }; + if (y - YStart - 6 < wallBoundAtPosition(xRatio * MathHelper.TwoPi * 4f)) + Main.tile[trueX, y].wall = WallID.None; + + Main.tile[trueX, y].active(true); + } + } + } + } + } + public static float SandstoneYMinimum(float xAsAngle, float randomValue1, float randomValue2) + { + float sineSquaredRandom1 = randomValue1 * (float)Math.Cos(xAsAngle * randomValue1) * (float)Math.Cos(xAsAngle * randomValue1); + float sineSquaredRandom2 = randomValue1 * (float)Math.Sin(xAsAngle * randomValue1) * (float)Math.Sin(xAsAngle * randomValue1); + float sineSquaredRandom3 = randomValue2 * (float)Math.Sin(xAsAngle * randomValue2); + float sineSquaredRandom4 = (float)Math.Sin(randomValue1 / randomValue2 * xAsAngle) * (float)Math.Cos(randomValue1 * MathHelper.Pi); + return 0.25f * Math.Abs(sineSquaredRandom1 + 0.5f * sineSquaredRandom2 + sineSquaredRandom3 - sineSquaredRandom4) + 0.25f; + } + #endregion + + #region Generating Water + public const int PerlinIterations = 1; + public const int PerlinOctaves = 4; + public const int PerlinXEdgeClamp = 20; + public const float PerlinYDelta = 40; + public const float PerlinNoiseMax = 0.05f; + public const float PerlinThreshold = 0.1f; // Be careful with this number + + public static void GenerateLake() + { + int lakeDepthMax = WorldGen.genRand.Next(36, 52 + 1); + float lakeSteepness = WorldGen.genRand.NextFloat(1.2f, 1.5f); + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + float xRatio = x / (float)BiomeWidth; + 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; + Main.tile[trueX, y] = new Tile() + { + wall = oldWall, + liquid = 255 + }; + } + } + } + + public static void CreateWater() + { + int[] seeds = new int[PerlinIterations]; + for (int i = 0; i < seeds.Length; i++) + { + seeds[i] = WorldGen.genRand.Next(); + } + for (int x = 1; x < BiomeWidth; x++) + { + float xRatio = x / (float)BiomeWidth; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + float yRatio = (y - YStart) / (float)BlockDepth; + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + if (y - YStart < BlockDepth - (int)(BlockDepth * 0.35f) + (int)(Math.Sin(xRatio * MathHelper.Pi) * (int)(BlockDepth * 0.35f)) - PerlinYDelta) + { + if (x < PerlinXEdgeClamp || x > BiomeWidth - PerlinXEdgeClamp) + continue; + float perlinAverage = 0f; + for (int k = 0; k < seeds.Length; k++) + { + perlinAverage += PerlinNoise2D(xRatio, yRatio, PerlinOctaves, seeds[k]) / PerlinIterations; + } + if (perlinAverage > PerlinThreshold * WorldGen.genRand.NextFloat(1f - PerlinNoiseMax, 1f + PerlinNoiseMax)) + { + ushort oldWall = Main.tile[trueX, y].wall; + Main.tile[trueX, y] = new Tile() + { + wall = oldWall, + liquid = 255 + }; + } + } + } + } + } + #endregion + + #region Generating Edge Sandstone + public const int EdgeCheckMinX = 6; + public const int EdgeCheckMaxX = 8; + public const int EdgeCheckMinY = 4; + public const int EdgeCheckMaxY = 6; + public const int MinimumEdgeScore = 4; + public const int SpotWidth = 4; + public static void GenerateHardenedSandstone() + { + for (int x = 1; x < BiomeWidth; x++) + { + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + int edgeScore = GetEdgeScore(trueX, y); + + if (edgeScore >= MinimumEdgeScore) + { + for (int dx = -SpotWidth / 2; dx <= SpotWidth; dx++) + { + for (int dy = -SpotWidth / 2; dy <= SpotWidth / 2; dy++) + { + 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)) + { + Main.tile[trueX + dx, y + dy].type = (ushort)ModContent.TileType(); + } + } + } + } + } + } + } + } + public static int GetEdgeScore(int x, int y) + { + int edgeScore = 0; + for (int dx = x - WorldGen.genRand.Next(EdgeCheckMinX, EdgeCheckMaxX + 1); dx <= x + WorldGen.genRand.Next(EdgeCheckMinX, EdgeCheckMaxX + 1); dx++) + { + if (dx == x) + continue; + if (CalamityUtils.ParanoidTileRetrieval(dx, y).liquid == 255) + edgeScore++; + } + for (int dy = y - WorldGen.genRand.Next(EdgeCheckMinY, EdgeCheckMaxY + 1); dy <= y + WorldGen.genRand.Next(EdgeCheckMinY, EdgeCheckMaxY + 1); dy++) + { + if (dy == y) + continue; + if (CalamityUtils.ParanoidTileRetrieval(x, dy).liquid == 255) + edgeScore++; + } + return edgeScore; + } + #endregion + + #region Generating Islands + public const int IslandCount = 4; + public const int IslandXPadding = 20; + + public const int IslandMinWidth = 15; + public const int IslandMaxWidth = 22; + + public const int IslandMinDepth = 5; + public const int IslandMaxDepth = 10; + public static void SettleWater() + { + Liquid.QuickWater(3, -1, -1); + WorldGen.WaterCheck(); + int counter = 0; + Liquid.quickSettle = true; + while (counter < 10) + { + counter++; + while (Liquid.numLiquid > 0) + { + Liquid.UpdateLiquid(); + } + WorldGen.WaterCheck(); + } + Liquid.quickSettle = false; + } + public static void GenerateIslands() + { + for (int i = 0; i < IslandCount; i++) + { + int y = YStart - 240; + int x = WorldGen.genRand.Next(IslandMaxWidth + IslandXPadding, BiomeWidth - IslandMaxWidth - IslandXPadding); + if (!CalamityWorld.abyssSide) + x = Main.maxTilesX - x; + while (CalamityUtils.ParanoidTileRetrieval(x, y).liquid == 0) + { + y++; + if (y > Main.rockLayer - 35) + { + break; + } + } + if (y > Main.rockLayer - 35) + { + i--; + continue; // Try again + } + int height = 2 * WorldGen.genRand.Next(IslandMinDepth, IslandMaxDepth + 1); + int width = WorldGen.genRand.Next(IslandMinWidth, IslandMaxWidth + 1); + int treePosition = WorldGen.genRand.Next(-width + 4, width - 4); + + for (float theta = 0f; theta <= MathHelper.TwoPi; theta += 0.05f) + { + for (int dx = 0; dx != (int)(height * Math.Cos(theta)); dx += (height * Math.Cos(theta) > 0).ToDirectionInt()) + { + for (int dy = 0; dy != (int)(width * Math.Sin(theta)); dy += (width * Math.Sin(theta) > 0).ToDirectionInt()) + { + if (WorldGen.InWorld(x + dx, y + dy)) + { + if (dy >= -2 - WorldGen.genRand.Next(-2, 3)) + { + 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].slope(0); + Main.tile[x + dx, y + dy - y2].halfBrick(false); + Main.tile[x + dx, y + dy - y2].active(true); + } + if (dy == -2 && dx == treePosition) + { + WorldGen.PlaceTile(x + dx, y + dy - extraHeight - 1, ModContent.TileType()); + GrowSaplingImmediately(x + dx, y + dy - extraHeight - 1); + } + } + else + { + Main.tile[x + dx, y + dy].liquid = 0; + } + } + } + } + } + } + } + #endregion + + #region Smoothening Everything + public static void SmoothenTheEntireSea() + { + for (int x = 2; x < BiomeWidth - 2; x++) + { + int trueX = x; + if (!CalamityWorld.abyssSide) + trueX = Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + Tile.SmoothSlope(trueX, y); + } + } + } + #endregion + + #region Generating Scenery + public const int ColumnMinDistanceX = 8; + public const int ColumnMinHeight = 10; + public const int ColumnMaxHeight = 27; + public const int StalactitePairMinDistance = 6; + public const int StalactitePairMaxDistance = 44; + public static void GenerateVentsAndFossils() + { + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + // Generate vents in the top 45% + if (y - YStart < BlockDepth * 0.45f) + { + if (WorldGen.SolidTile(trueX, y + 1) && WorldGen.genRand.NextBool(20)) + { + PlaceMiscTile(trueX, y, 1, 2, (ushort)ModContent.TileType()); + } + } + // And fossils in the bottom 55% + else + { + if (WorldGen.SolidTile(trueX, y + 1)) + { + // Generate ribs such that they're all nearby + if (WorldGen.genRand.NextBool(25)) + { + ushort type = (ushort)Utils.SelectRandom(WorldGen.genRand, + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType(), + ModContent.TileType()); + int height; + if (type == ModContent.TileType() || type == ModContent.TileType()) + { + height = 3; + } + else if (type == ModContent.TileType()) + { + height = 2; + } + else if (type == ModContent.TileType()) + { + height = 4; + } + else + { + height = 1; + } + PlaceMiscTile(trueX, y, 1, height, type); + } + else if (WorldGen.genRand.NextBool(16)) + { + PlaceMiscTile(trueX, y, 3, 2, (ushort)Utils.SelectRandom(WorldGen.genRand, ModContent.TileType(), ModContent.TileType(), ModContent.TileType())); + } + } + } + } + } + } + public static void PlaceColumns() + { + int previousX = 0; + int style; + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + if (y - YStart > BlockDepth * 0.5f) + { + if (WorldGen.SolidTile(trueX, y + 1) && + WorldGen.SolidTile(trueX + 1, y + 1) && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(trueX, y + 1).type) && + WorldGen.genRand.NextBool(3) && + Math.Abs(trueX - previousX) >= ColumnMinDistanceX) + { + int top = y; + int height = 0; + while (!(WorldGen.SolidTile(trueX - 1, top) && WorldGen.SolidTile(trueX, top) && WorldGen.SolidTile(trueX + 1, top))) + { + top--; + height++; + if (height > ColumnMaxHeight + 1) + break; + } + if (height <= ColumnMaxHeight && height >= ColumnMinHeight) + { + for (int dy = 0; dy < height; dy++) + { + style = WorldGen.genRand.Next(3); + short yFrame = 18; + if (dy == 0) + yFrame = 36; + if (dy == height - 1) + 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; + Main.tile[trueX, y - dy] = new Tile + { + type = (ushort)ModContent.TileType(), + frameX = (short)(style * 36), + frameY = yFrame, + liquid = 255, + wall = oldWall + }; + Main.tile[trueX, y - dy].active(true); + + 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; + Main.tile[trueX + 1, y - dy] = new Tile + { + type = (ushort)ModContent.TileType(), + frameX = (short)(style * 36 + 18), + frameY = yFrame, + liquid = 255, + wall = oldWall + }; + Main.tile[trueX + 1, y - dy].active(true); + } + previousX = trueX; + } + } + } + } + } + } + public static void PlaceStalactites() + { + int heightFromType(int type) + { + if (type <= 2) + return 2; + else if (type <= 4) + return 3; + else + return 4; + }; + for (int x = 1; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart; y <= YStart + BlockDepth; y++) + { + if (y - YStart > BlockDepth * 0.25f) + { + if (WorldGen.SolidTile(trueX, y - 1) && WorldGen.genRand.NextBool(10)) + { + int dy = 1; + while (!CalamityUtils.ParanoidTileRetrieval(trueX, y + dy).active()) + { + dy++; + if (dy > StalactitePairMaxDistance) + break; + } + if (dy <= StalactitePairMaxDistance && dy >= StalactitePairMinDistance) + { + int type = WorldGen.genRand.Next(6); + type++; + int height = heightFromType(type); + + PlaceStalactite(trueX, y, height, (ushort)CalamityMod.Instance.TileType($"SulphurousStalactite{type}")); + if (WorldGen.SolidTile(trueX, y + dy + 1)) + PlaceStalacmite(trueX, y + dy, height, (ushort)CalamityMod.Instance.TileType($"SulphurousStalacmite{type}")); + } + } + } + } + } + } + public static void PlaceMiscTile(int x, int y, int width, int height, ushort type, int style = 0) + { + try + { + bool canGenerate = true; + for (int i = x; i < x + width; i++) + { + for (int j = y - (int)Math.Ceiling(height / 2.0); j < y + (int)Math.Ceiling(height / 2.0); j++) + { + if (Main.tile[i, j] is null) + { + Main.tile[i, j] = new Tile(); + } + if (Main.tile[i, j].active()) + { + canGenerate = false; + } + } + if (Main.tile[i, y + 1] is null) + { + 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]) + { + canGenerate = false; + } + } + if (canGenerate) + { + WorldGen.PlaceTile(x, y, type, style: style); + } + } + catch + { + return; // This should only ever happen from an index error, and there's really no point in continuing if that happens + } + } + public static void PlaceStalactite(int x, int y, int height, ushort type) + { + for (int dy = 0; dy < height; dy++) + { + ushort oldWall = Main.tile[x, y + dy].wall; + Main.tile[x, y + dy] = new Tile + { + wall = oldWall, + type = type, + frameY = (short)(dy * 18) + }; + Main.tile[x, y + dy].active(true); + } + } + public static void PlaceStalacmite(int x, int y, int height, ushort type) + { + for (int dy = height - 1; dy > 0; dy--) + { + ushort oldWall = Main.tile[x, y + dy].wall; + Main.tile[x, y - dy] = new Tile + { + type = type, + frameY = (short)(height * 18 - dy * 18), + wall = oldWall + }; + Main.tile[x, y - dy].active(true); + } + } + #endregion + + #region Generating Chests + public const int CheckCutoffDistance = 15; + public static void PlaceRustyChests() + { + // Ambiguity bullshit. + int[] ItemTypes = { ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() }; + + for (int i = 0; i < ItemTypes.Length; ++i) + { + Chest chest = null; + int attempts = 0; + + while (chest is null) + { + attempts++; + int x = WorldGen.genRand.Next(CheckCutoffDistance, BiomeWidth - CheckCutoffDistance); + if (!CalamityWorld.abyssSide) + { + x = Main.maxTilesX - x; + } + int y = WorldGen.genRand.Next(YStart + CheckCutoffDistance, YStart + BlockDepth - CheckCutoffDistance); + if (WorldGen.InWorld(x, y)) + { + if (!CalamityUtils.ParanoidTileRetrieval(x, y).active() && + SulphSeaTiles.Contains(CalamityUtils.ParanoidTileRetrieval(x, y + 1).type) && + CalamityUtils.ParanoidTileRetrieval(x, y + 1).active()) + { + chest = MiscWorldgenRoutines.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); + } + } + } + + // If a chest was placed, force its first item to be the unique item. + if (chest != null) + { + chest.item[0].SetDefaults(ItemTypes[i]); + chest.item[0].Prefix(-1); + } + } + } + #endregion + + #region Removal of stupid Tiles above the Sea + + public static List OtherTilesForSulphSeaToDestroy = new List() + { + TileID.PalmTree, + TileID.Sunflower, + TileID.CorruptThorns, + TileID.CrimtaneThorns, + TileID.CorruptGrass, + TileID.CorruptPlants, + TileID.Stalactite, + TileID.ImmatureHerbs, + TileID.MatureHerbs, + TileID.Pots, + TileID.Pumpkins, // Happens during Halloween + }; + + public static List WallsForSulphSeaToDestroy = new List() + { + WallID.Dirt, + WallID.DirtUnsafe, + WallID.DirtUnsafe1, + WallID.DirtUnsafe2, + WallID.DirtUnsafe3, + WallID.DirtUnsafe4, + WallID.Cave6Unsafe, // Rocky dirt wall + WallID.Grass, + WallID.GrassUnsafe, + WallID.Flower, + WallID.FlowerUnsafe, + WallID.CorruptGrassUnsafe, + WallID.EbonstoneUnsafe, + WallID.CrimstoneUnsafe, + }; + public static void RemoveStupidTilesAboveSea() + { + for (int x = 0; x < BiomeWidth; x++) + { + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + for (int y = YStart - 140; y < YStart + 80; y++) + { + int type = CalamityUtils.ParanoidTileRetrieval(trueX, y).type; + if (YStartWhitelist.Contains(type) || + OtherTilesForSulphSeaToDestroy.Contains(type)) + { + if (Main.tile[trueX, y] is null) + Main.tile[trueX, y] = new Tile(); + Main.tile[trueX, y].active(false); + } + if (WallsForSulphSeaToDestroy.Contains(Main.tile[trueX, y].wall)) + { + Main.tile[trueX, y].wall = 0; + } + } + } + } + #endregion + + #region Nearby Beach + public static readonly List ValidBeachCovertTiles = new List() + { + TileID.Dirt, + TileID.Stone, + TileID.Crimstone, + TileID.Ebonstone, + TileID.Sand, + TileID.Ebonsand, + TileID.Crimsand, + TileID.Grass, + TileID.CorruptGrass, + TileID.FleshGrass, + TileID.ClayBlock, + TileID.Mud, + }; + public static readonly List ValidBeachDestroyTiles = new List() + { + TileID.Coral, + TileID.BeachPiles, + TileID.Plants, + TileID.Plants2, + TileID.SmallPiles, + TileID.LargePiles, + TileID.LargePiles2, + TileID.CorruptThorns, + TileID.CrimtaneThorns, + TileID.DyePlants, + TileID.Trees, + TileID.Sunflower, + }; + public static void CreateBeachNearSea() + { + int beachWidth = WorldGen.genRand.Next(150, 190 + 1); + + var searchCondition = Searches.Chain(new Searches.Down(3000), new Conditions.IsSolid()); + WorldUtils.Find(new Point(BiomeWidth + 4, (int)WorldGen.worldSurfaceLow - 20), searchCondition, out Point determinedPoint); + 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) + { + beachWidth += 85; + } + + for (int x = BiomeWidth - 10; x <= BiomeWidth + beachWidth; x++) + { + float xRatio = Utils.InverseLerp(BiomeWidth - 10, BiomeWidth + beachWidth, x, true); + int trueX = CalamityWorld.abyssSide ? x : Main.maxTilesX - x; + int depth = (int)(Math.Sin((1f - xRatio) * MathHelper.PiOver2) * 45 + 1); + for (int y = YStart - 40; y < YStart + depth; y++) + { + Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(trueX, y); + if (tileAtPosition.active() && ValidBeachDestroyTiles.Contains(tileAtPosition.type)) + { + // Kill trees manually so that no leftover tiles are present. + if (Main.tile[trueX, y].type == TileID.Trees) + WorldGen.KillTile(trueX, y); + else + Main.tile[trueX, y].active(false); + } + + else if (tileAtPosition.active() && ValidBeachCovertTiles.Contains(tileAtPosition.type)) + { + Main.tile[trueX, y].type = (ushort)ModContent.TileType(); + } + } + } + } + #endregion + + #region Scrap Piles + public static void PlaceScrapPiles() + { + int tries = 0; + List pastPlacementPostiion = new List(); + for (int i = 0; i < 3; i++) + { + tries++; + if (tries > 20000) + continue; + + int x = WorldGen.genRand.Next(75, BiomeWidth - 85); + if (!CalamityWorld.abyssSide) + x = Main.maxTilesX - x; + int y = WorldGen.genRand.Next(YStart + (int)(BlockDepth * 0.3f), YStart + (int)(BlockDepth * 0.8f)); + + Point pilePlacementPosition = new Point(x, y); + + // If the selected position is sitting inside of a tile, try again. + if (WorldGen.SolidTile(pilePlacementPosition.X, pilePlacementPosition.Y)) + { + i--; + continue; + } + + // If the selected position is close to other piles, try again. + if (pastPlacementPostiion.Any(p => Vector2.Distance(p, pilePlacementPosition.ToVector2()) < 85f)) + { + i--; + continue; + } + + // Otherwise, decide which pile should be created. + bool createLargePile = WorldGen.genRand.NextBool(3); + int pileVariant = WorldGen.genRand.Next(4); + string schematicName = $"{(createLargePile ? "Large " : string.Empty)}Sulphurous Scrap {pileVariant + 1}"; + Vector2? wrappedSchematicArea = SchematicManager.GetSchematicArea(schematicName); + + // Create a log message if for some reason the schematic in question doesn't exist. + if (!wrappedSchematicArea.HasValue) + { + CalamityMod.Instance.Logger.Warn($"Tried to place a schematic with name \"{schematicName}\". No matching schematic file found."); + continue; + } + + Vector2 schematicArea = wrappedSchematicArea.Value; + + // Decide the placement position by searching downward and looking for the lowest point. + // If the position is quite steep, try again. + Vector2 left = pilePlacementPosition.ToVector2() - Vector2.UnitX * schematicArea.X * 0.5f; + Vector2 right = pilePlacementPosition.ToVector2() + Vector2.UnitX * schematicArea.X * 0.5f; + while (!WorldGen.SolidTile(CalamityUtils.ParanoidTileRetrieval((int)left.X, (int)left.Y))) + left.Y++; + while (!WorldGen.SolidTile(CalamityUtils.ParanoidTileRetrieval((int)right.X, (int)right.Y))) + right.Y++; + + if (Math.Abs(left.Y - right.Y) >= 20f) + { + i--; + continue; + } + + // If the placement position ended up in the abyss, try again. + if (left.Y >= YStart + BlockDepth + 5 || right.Y >= YStart + BlockDepth + 5) + { + i--; + continue; + } + + // Pick the lowest point vertically. + Point bottomCenter = new Point(pilePlacementPosition.X, (int)Math.Max(left.Y, right.Y) + 6); + bool _ = false; + SchematicManager.PlaceSchematic>(schematicName, bottomCenter, SchematicAnchor.BottomCenter, ref _); + + pastPlacementPostiion.Add(bottomCenter.ToVector2()); + tries = 0; + } + } + #endregion Scrap Piles + + #region Misc Functions + public static List YStartWhitelist = new List() + { + TileID.Stone, + TileID.Dirt, + TileID.Sand, + TileID.Ebonsand, + TileID.Crimsand, + TileID.Grass, + TileID.CorruptGrass, + TileID.FleshGrass, + TileID.ClayBlock, + TileID.Mud, + TileID.Copper, + TileID.Tin, + TileID.Iron, + TileID.Lead, + TileID.Silver, + TileID.Tungsten, + TileID.Crimstone, + TileID.Ebonstone, + TileID.HardenedSand, + TileID.CorruptHardenedSand, + TileID.CrimsonHardenedSand, + TileID.Coral, + TileID.BeachPiles, + TileID.Plants, + TileID.Plants2, + TileID.SmallPiles, + TileID.LargePiles, + TileID.LargePiles2, + TileID.Trees, + TileID.Vines, + TileID.CorruptThorns, + TileID.CrimtaneThorns, + TileID.CrimsonVines, + TileID.Containers, + TileID.DyePlants, + TileID.JungleGrass // Yes, this can happen on rare occasion + }; + public static void DetermineYStart() + { + int xCheckPosition = CalamityWorld.abyssSide ? BiomeWidth + 1 : Main.maxTilesX - BiomeWidth - 1; + var searchCondition = Searches.Chain(new Searches.Down(3000), new Conditions.IsSolid()); + Point determinedPoint; + + do + { + 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); + YStart = determinedPoint.Y; + } + public static void GrowSaplingImmediately(int i, int j) + { + int trueStartingPositionY = j; + while (TileLoader.IsSapling(Main.tile[i, trueStartingPositionY].type)) + { + trueStartingPositionY++; + } + Tile tileAtPosition = Main.tile[i, trueStartingPositionY]; + Tile tileAbovePosition = Main.tile[i, trueStartingPositionY - 1]; + if (!tileAtPosition.active() || tileAtPosition.halfBrick() || tileAtPosition.slope() != 0) + { + return; + } + if (tileAbovePosition.wall != 0) + { + return; + } + if (!WorldGen.EmptyTileCheck(i - 1, i + 1, trueStartingPositionY - 30, trueStartingPositionY - 1, 20)) + { + return; + } + int treeHeight = WorldGen.genRand.Next(10, 21); + int frameYIdeal = WorldGen.genRand.Next(-8, 9); + frameYIdeal *= 2; + short frameY = 0; + for (int k = 0; k < treeHeight; k++) + { + tileAtPosition = Main.tile[i, trueStartingPositionY - 1 - k]; + if (k == 0) + { + tileAtPosition.active(true); + tileAtPosition.type = TileID.PalmTree; + tileAtPosition.frameX = 66; + tileAtPosition.frameY = 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; + } + else + { + if (frameY != frameYIdeal) + { + float heightRatio = k / (float)treeHeight; + bool increaseFrameY = heightRatio >= 0.25f && ((heightRatio < 0.5f && WorldGen.genRand.Next(13) == 0) || (heightRatio < 0.7f && WorldGen.genRand.Next(9) == 0) || heightRatio >= 0.95f || WorldGen.genRand.Next(5) != 0 || true); + if (increaseFrameY) + { + frameY += (short)(Math.Sign(frameYIdeal) * 2); + } + } + tileAtPosition.active(true); + tileAtPosition.type = TileID.PalmTree; + tileAtPosition.frameX = (short)(22 * WorldGen.genRand.Next(0, 3)); + tileAtPosition.frameY = frameY; + } + } + WorldGen.RangeFrame(i - 2, trueStartingPositionY - treeHeight - 1, i + 2, trueStartingPositionY + 1); + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendTileSquare(-1, i, (int)(trueStartingPositionY - treeHeight * 0.5), treeHeight + 1, TileChangeType.None); + } + } + #endregion + } +} diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 72f0cbac25..271e4536ee 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -9,7 +9,7 @@ using Terraria.World.Generation; namespace CalamityMod.World { - public class SunkenSea : ModWorld + public class SunkenSea { private struct Hub { @@ -537,7 +537,7 @@ namespace CalamityMod.World { if (WorldGen.genRand.Next(5) == 0) { - WorldGenerationMethods.PlaceTit(num5, num6, (ushort)ModContent.TileType()); + PlaceTit(num5, num6, (ushort)ModContent.TileType()); } if (WorldGen.genRand.Next(8) == 0) { @@ -602,5 +602,76 @@ namespace CalamityMod.World } return true; } + + public static void PlaceTit(int x, int y, ushort type = 165) + { + if (Main.tile[x, y - 1] == null) + { + Main.tile[x, y - 1] = new Tile(); + } + if (Main.tile[x, y] == null) + { + Main.tile[x, y] = new Tile(); + } + if (Main.tile[x, y + 1] == null) + { + Main.tile[x, y + 1] = new Tile(); + } + 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 (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].active(true); + Main.tile[x, y].frameX = (short)num2; + Main.tile[x, y].frameY = 72; + } + else + { + int num3 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = 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 + 1].active(true); + Main.tile[x, y + 1].frameX = (short)num3; + Main.tile[x, y + 1].frameY = 18; + } + } + } + else + { + 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 (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].active(true); + Main.tile[x, y].frameX = (short)num13; + Main.tile[x, y].frameY = 90; + } + else + { + int num14 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y - 1].type = 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].active(true); + Main.tile[x, y].frameX = (short)num14; + Main.tile[x, y].frameY = 54; + } + } + } + } + } } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs new file mode 100644 index 0000000000..933ae2dbaa --- /dev/null +++ b/World/UndergroundShrines.cs @@ -0,0 +1,301 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Mounts; +using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.SummonItems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.World +{ + public class UndergroundShrines + { + #region Enumeration + public enum UndergroundShrineType + { + Surface, + Cavern, + WorldEvil, + Ice, + Desert, + Mushroom, + Granite, + Marble, + Abyss + } + #endregion + + #region Hut Outline Creation + + // Special Hut: Takes arguments of tile type 1, tile type 2, wall type, hut type (useful if you use this method to generate different huts), and location of the shrine (x and y) + public static void SpecialHut(ushort tile, ushort tile2, ushort wall, UndergroundShrineType hutType, int shrineLocationX, int shrineLocationY) + { + // Random variables for shrine size + int randomX = WorldGen.genRand.Next(2, 4); + int randomY = WorldGen.genRand.Next(2, 4); + + // Replace tiles in shrine area with shrine tile type 1 + for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + { + 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].slope(0); + Main.tile[x, y].liquid = 0; + Main.tile[x, y].lava(false); + } + } + + // Replace walls in shrine area with shrine wall type + for (int x = shrineLocationX - randomX; x <= shrineLocationX + randomX; x++) + { + for (int y = shrineLocationY - randomY; y <= shrineLocationY + randomY; y++) + { + Main.tile[x, y].active(false); + Main.tile[x, y].wall = wall; + } + } + + // Remove tiles from the inner part of the shrine area + for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + { + for (int y = shrineLocationY + randomY - 2; y <= shrineLocationY + randomY; y++) + Main.tile[x, y].active(false); + } + for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + { + for (int y = shrineLocationY + randomY - 2; y <= shrineLocationY + randomY - 1; y++) + Main.tile[x, y].active(false); + } + + // Replace tiles from bottom of shrine area with shrine tile type 2 + for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + { + int verticalOffset = 4; + int y = shrineLocationY + randomY + 2; + 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].slope(0); + y++; + verticalOffset--; + } + } + + // Replace tiles from top of shrine with shrine tile type 1 + randomX -= WorldGen.genRand.Next(1, 3); + int num21 = shrineLocationY - randomY - 2; + while (randomX > -1) + { + for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + { + Main.tile[x, num21].active(true); + Main.tile[x, num21].type = tile; + } + randomX -= WorldGen.genRand.Next(1, 3); + num21--; + } + + // Place shrine chest + CalamityWorld.SChestX[(int)hutType] = shrineLocationX; + CalamityWorld.SChestY[(int)hutType] = shrineLocationY; + SpecialChest(hutType); + } + #endregion + + #region Chest Creation + // Special Chest: Used for placing shrine chests, takes argument of the shrine type which dictates what item will spawn in the first slot of this chest + public static void SpecialChest(UndergroundShrineType shrineType) + { + int item = 0; + int chestType = 0; + + switch (shrineType) + { + case UndergroundShrineType.Surface: + item = ModContent.ItemType(); + break; + case UndergroundShrineType.Cavern: + item = ModContent.ItemType(); + chestType = 44; + break; + case UndergroundShrineType.WorldEvil: + item = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); + chestType = WorldGen.crimson ? 43 : 3; + break; + case UndergroundShrineType.Ice: + item = ModContent.ItemType(); + chestType = 47; + break; + case UndergroundShrineType.Desert: + item = ModContent.ItemType(); + chestType = 30; + break; + case UndergroundShrineType.Mushroom: + item = ModContent.ItemType(); + chestType = 32; + break; + case UndergroundShrineType.Granite: + item = ModContent.ItemType(); + chestType = 50; + break; + case UndergroundShrineType.Marble: + item = ModContent.ItemType(); + chestType = 51; + break; + case UndergroundShrineType.Abyss: + item = ModContent.ItemType(); + chestType = 4; + break; + } + + // Destroy tiles in chest spawn location + for (int j = CalamityWorld.SChestX[(int)shrineType] - 1; j <= CalamityWorld.SChestX[(int)shrineType] + 1; j++) + { + for (int k = CalamityWorld.SChestY[(int)shrineType]; k <= CalamityWorld.SChestY[(int)shrineType] + 2; k++) + WorldGen.KillTile(j, k, false, false, false); + } + + // Attempt to fix sloped tiles under the chest to prevent the chest from killing itself (literally) + for (int l = CalamityWorld.SChestX[(int)shrineType] - 1; l <= CalamityWorld.SChestX[(int)shrineType] + 1; l++) + { + for (int m = CalamityWorld.SChestY[(int)shrineType]; m <= CalamityWorld.SChestY[(int)shrineType] + 3; m++) + { + if (m < Main.maxTilesY) + { + Main.tile[l, m].slope(0); + Main.tile[l, m].halfBrick(false); + } + } + } + + // Place the chest, finally + WorldGen.AddBuriedChest(CalamityWorld.SChestX[(int)shrineType], CalamityWorld.SChestY[(int)shrineType], item, false, chestType); + } + #endregion + + #region Direct Gen + public static void PlaceShrines() + { + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int generateBack = genLimit - 80; //Small = 2020 + int generateForward = genLimit + 80; //Small = 2180 + double shrineChance = 100E-05; + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Surface Shrine + { + int tilesX = WorldGen.genRand.Next((int)(x * 0.35), generateBack); + 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) + { + 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) + { + SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Evil Shrine + { + 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)) + { + SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, + WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, + WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, UndergroundShrineType.WorldEvil, tilesX, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern Shrine + { + int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); + 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) + { + SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX, tilesY); + break; + } + if (Main.tile[tilesX2, tilesY].type == TileID.Stone) + { + SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX2, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Ice Shrine + { + 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) + { + SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, UndergroundShrineType.Ice, tilesX, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Desert Shrine + { + 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) + { + SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, UndergroundShrineType.Desert, tilesX, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Mushroom Shrine + { + 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) + { + SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, UndergroundShrineType.Mushroom, tilesX, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Granite Shrine + { + 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) + { + SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, UndergroundShrineType.Granite, tilesX, tilesY); + break; + } + } + + for (int k = 0; k < (int)(x * y * shrineChance); k++) //Marble Shrine + { + 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) + { + SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, UndergroundShrineType.Marble, tilesX, tilesY); + break; + } + } + } + #endregion + } +} diff --git a/World/WorldEvilIsland.cs b/World/WorldEvilIsland.cs new file mode 100644 index 0000000000..6f3b99fc3d --- /dev/null +++ b/World/WorldEvilIsland.cs @@ -0,0 +1,388 @@ +using CalamityMod.DataStructures; +using CalamityMod.World.Planets; +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; + +namespace CalamityMod.World +{ + public class WorldEvilIsland + { + public static void PlaceEvilIsland() + { + int x = Main.maxTilesX; + int xIslandGen; + int yIslandGen; + Rectangle potentialArea; + + do + { + xIslandGen = WorldGen.crimson ? + WorldGen.genRand.Next((int)(x * 0.1), (int)(x * 0.2)) : + WorldGen.genRand.Next((int)(x * 0.8), (int)(x * 0.9)); + yIslandGen = WorldGen.genRand.Next(95, 126); + yIslandGen = Math.Min(yIslandGen, (int)WorldGen.worldSurfaceLow - 50); + + int checkAreaX = 180; + int checkAreaY = 95; + potentialArea = Utils.CenteredRectangle(new Vector2(xIslandGen, yIslandGen), new Vector2(checkAreaX, checkAreaY)); + } + while (!Planetoid.InvalidSkyPlacementArea(potentialArea)); + + int tileXLookup = xIslandGen; + if (WorldGen.crimson) + { + while (Main.tile[tileXLookup, yIslandGen].active()) + tileXLookup++; + } + else + { + while (Main.tile[tileXLookup, yIslandGen].active()) + tileXLookup--; + } + + xIslandGen = tileXLookup; + CalamityWorld.fehX = xIslandGen; + CalamityWorld.fehY = yIslandGen; + EvilIsland(xIslandGen, yIslandGen); + EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); + } + + public static void EvilIsland(int i, int j) + { + // Generate puffy clouds along the bottom. + int leftOffset = 86; + int rightOffset = 86; + int maxVerticalOffset = 24; + List cloudPositions = new List(); + for (int dx = -leftOffset; dx < rightOffset; dx += WorldGen.genRand.Next(21, 26)) + { + float completionRatio = Utils.InverseLerp(-leftOffset - 22f, rightOffset + 22f, dx, true); + float completionRatio010 = CalamityUtils.Convert01To010(completionRatio); + int verticalOffset = (int)(completionRatio010 * maxVerticalOffset); + Point cloudPosition = new Point(i + dx, j + verticalOffset); + + int radius = WorldGen.genRand.Next(22, 26) - (int)((1f - completionRatio010) * 15); + WorldUtils.Gen(cloudPosition, new CustomShapes.DistortedCircle(radius, 0.1f), Actions.Chain( + new Actions.SetTile(TileID.Cloud), + new Modifiers.Blotches(4, 1f))); + + cloudPositions.Add(cloudPosition); + } + + // Clear out a hole. + WorldUtils.Gen(new Point(i, j - 4), new Shapes.Circle((leftOffset + rightOffset - 30) / 2, 16), new Actions.ClearTile()); + + // Create random smaller clouds with offsets to fill in the cut out area. + foreach (Point cloudPosition in cloudPositions) + { + Vector2 offsetCloudPosition = cloudPosition.ToVector2(); + while (!CalamityUtils.ParanoidTileRetrieval((int)offsetCloudPosition.X, (int)offsetCloudPosition.Y).active()) + offsetCloudPosition.Y++; + + for (int k = 0; k < 3; k++) + { + int radius = WorldGen.genRand.Next(6, 9); + Vector2 randomCloudPosition = offsetCloudPosition + WorldGen.genRand.NextVector2Circular(radius, radius) * 0.75f; + + // Account for centering, somewhat. + randomCloudPosition.Y -= radius * 0.4f; + randomCloudPosition.Y += 5f; + + WorldUtils.Gen(randomCloudPosition.ToPoint(), new Shapes.Circle(radius / 2), new Actions.SetTile(TileID.Cloud)); + } + } + + // Fill the not cloud area with evil sandstone. + for (int dx = -leftOffset + 10; dx < rightOffset - 10; dx++) + { + float completionRatio = Utils.InverseLerp(-leftOffset - 22f, rightOffset + 22f, dx, true); + float completionRatio010 = CalamityUtils.Convert01To010(completionRatio); + int verticalOffset = (int)((1f - completionRatio010) * maxVerticalOffset); + for (int dy = -5; dy < maxVerticalOffset + 13 - verticalOffset; dy++) + { + 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].active(true); + } + } + } + + // Determine the lines at which clouds begin to form. + List borderPoints = new List(); + for (int dx = -leftOffset + 14; dx < rightOffset - 14; dx++) + { + int verticalBorder = j - 10; + while (CalamityUtils.ParanoidTileRetrieval(i + dx, verticalBorder).type != TileID.Cloud) + { + verticalBorder++; + if (verticalBorder > j + 35) + break; + } + + if (verticalBorder >= j + 35) + continue; + + borderPoints.Add(new Point(i + dx, verticalBorder)); + } + + // And generate blotches at those borders. + for (int k = 0; k < 10; k++) + { + Point borderToGenerateAt = borderPoints[WorldGen.genRand.Next(borderPoints.Count)]; + Vector2 moveDirection = Vector2.UnitY.RotatedBy(WorldGen.genRand.NextFloat(-0.4f, 0.4f)); + for (int l = 0; l < 4; l++) + { + Point blotchPosition = (borderToGenerateAt.ToVector2() + Main.rand.NextVector2Circular(5f, 5f) + moveDirection * l * 3f).ToPoint(); + WorldUtils.Gen(blotchPosition, new CustomShapes.DistortedCircle(WorldGen.genRand.Next(8, 10) - l, 0.4f), Actions.Chain( + new Actions.SetTile(WorldGen.crimson ? TileID.CorruptSandstone : TileID.CrimsonSandstone), + new Modifiers.IsSolid(), + new Modifiers.Blotches(5, 1f), + new Modifiers.OnlyTiles(TileID.CorruptSandstone, TileID.CrimsonSandstone))); + } + } + + // Create some blotches of hardened evil sand and evil ore. + for (int k = 0; k < 12; k++) + { + int radius = WorldGen.genRand.Next(6, 8); + ushort tileType = WorldGen.crimson ? TileID.CorruptHardenedSand : TileID.CrimsonHardenedSand; + + Point blotchPosition = new Point(i + WorldGen.genRand.Next(-leftOffset + 20, rightOffset - 20), j + WorldGen.genRand.Next(-3, 12)); + if (k > 4) + { + if (blotchPosition.Y > j + 3) + { + radius -= WorldGen.genRand.Next(3); + tileType = WorldGen.crimson ? TileID.Demonite : TileID.Crimtane; + } + else + continue; + } + + WorldUtils.Gen(blotchPosition, new CustomShapes.DistortedCircle(radius, 0.35f), Actions.Chain( + new Actions.SetTile(tileType), + new Modifiers.IsSolid(), + new Modifiers.Blotches(5, 1f), + new Modifiers.OnlyTiles(TileID.CorruptSandstone, TileID.CrimsonSandstone))); + } + + // Determine the lines at which ground begins to appear. This only applies if the ground is an evil tile. + List surfacePoints = new List(); + for (int dx = -leftOffset + 24; dx < rightOffset - 24; dx++) + { + // Ignore points near the center because bumps there could cause the house to offset in weird ways. + if (Math.Abs(dx) < 15) + continue; + + int surface = j - 15; + bool hitCloud = false; + while (!CalamityUtils.ParanoidTileRetrieval(i + dx, surface).active()) + { + surface++; + if (CalamityUtils.ParanoidTileRetrieval(i + dx, surface).type == TileID.Cloud) + { + hitCloud = true; + break; + } + if (surface > j + 35) + break; + } + + if (hitCloud || surface >= j + 35) + continue; + + surfacePoints.Add(new Point(i + dx, surface)); + } + + // Create "bumps" on the top by creating blotches just a bit below the surface. + for (int k = 0; k < 4; k++) + { + 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 Modifiers.SkipTiles(TileID.Demonite, TileID.Crimtane), + new Modifiers.Blotches(5, 1f))); + } + + // Generate one large chunk of ore somewhere, just in case there isn't much otherwise. + Vector2 oreStartPosition = new Vector2(i + WorldGen.genRand.Next(-leftOffset + 28, rightOffset - 28), j + WorldGen.genRand.Next(8, 14)); + Vector2 oreEndPosition = oreStartPosition + Vector2.UnitX.RotatedBy(WorldGen.genRand.NextFloat(-0.36f, -0.14f)) * WorldGen.genRand.NextBool(2).ToDirectionInt() * WorldGen.genRand.NextFloat(18f, 25f); + Vector2 oreMiddlePosition = (oreStartPosition + oreEndPosition) * 0.5f + WorldGen.genRand.NextVector2Circular(6f, 6f); + List smoothOrePositions = new BezierCurve(oreStartPosition, oreMiddlePosition, oreStartPosition).GetPoints(25); + for (int k = 0; k < smoothOrePositions.Count; k++) + { + float strength = MathHelper.Lerp(1f, 4f, CalamityUtils.Convert01To010(k / (float)smoothOrePositions.Count)); + Point orePosition = smoothOrePositions[k].ToPoint(); + + WorldUtils.Gen(orePosition, new Shapes.Circle((int)strength), Actions.Chain( + new Actions.SetTile(WorldGen.crimson ? TileID.Demonite : TileID.Crimtane))); + } + + // Paint all clouds. + for (int dx = -leftOffset - 30; dx < rightOffset + 30; dx++) + { + for (int dy = -8; dy < 55; dy++) + { + if (CalamityUtils.ParanoidTileRetrieval(i + dx, j + dy).type == TileID.Cloud) + WorldGen.paintTile(i + dx, j + dy, WorldGen.crimson ? PaintID.Purple : PaintID.Red); + } + } + } + + public static void EvilIslandHouse(int i, int j) + { + ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile + byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + 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].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, WorldGen.crimson ? 1 : 10); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + 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].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + int contain; + if (WorldGen.crimson) + { + contain = 1571; //scourge + } + else + { + contain = 1569; //vampire + } + WorldGen.AddBuriedChest(i, num10 - 3, contain, false, WorldGen.crimson ? 19 : 20); //chest + int num14 = i - num2 / 2 + 1; + int num15 = i + num2 / 2 - 1; + int num16 = 1; + if (num2 > 10) + { + num16 = 2; + } + int num17 = (num6 + num7) / 2 - 1; + for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) + { + for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) + { + Main.tile[num18, num19].wall = 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 + } + } + 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 tile2 = Main.tile[num22 - 2, num7 - 2]; + tile2.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, WorldGen.crimson ? 2 : 11); //chair + } + } +} diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs deleted file mode 100644 index 44ad4d103b..0000000000 --- a/World/WorldGenerationMethods.cs +++ /dev/null @@ -1,4198 +0,0 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Mounts; -using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Items.Potions; -using CalamityMod.Items.SummonItems; -using CalamityMod.Items.Tools.ClimateChange; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.Schematics; -using CalamityMod.Tiles; -using CalamityMod.Tiles.Abyss; -using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.AstralDesert; -using CalamityMod.Tiles.AstralSnow; -using CalamityMod.Tiles.Crags; -using CalamityMod.Tiles.FurnitureAncient; -using CalamityMod.Tiles.Ores; -using CalamityMod.Tiles.SunkenSea; -using CalamityMod.Walls; -using CalamityMod.World.Planets; -using Microsoft.Xna.Framework; -using System; -using System.Reflection; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.Utilities; -using Terraria.World.Generation; - -namespace CalamityMod.World -{ - public class WorldGenerationMethods : ModWorld - { - #region Dungeon Biome Chests - public static void GenerateBiomeChests(GenerationProgress progress) - { - progress.Message = "Calamity Mod: Biome Chests"; - - // Get dungeon size field infos. These fields are private for some reason - int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; - int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - - int[] ChestTypes = { ModContent.TileType() }; - int[] ItemTypes = { ModContent.ItemType() }; - int[] ChestStyles = { 1 }; // Astral Chest generates in style 1, which is locked - - for (int i = 0; i < ChestTypes.Length; ++i) - { - Chest chest = null; - int attempts = 0; - - // Try 1000 times to place the chest somewhere in the dungeon. - // The placement algorithm ensures that if it tries to appear in midair, it is moved down to the floor. - while (chest == null && attempts < 1000) - { - 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()) - chest = AddChestWithLoot(x, y, (ushort)ChestTypes[i], tileStyle: ChestStyles[i]); - } - - // If a chest was placed, force its first item to be the unique Biome Chest weapon. - if (chest != null) - { - chest.item[0].SetDefaults(ItemTypes[i]); - chest.item[0].Prefix(-1); - } - } - } - - internal static Chest AddChestWithLoot(int i, int j, ushort type = TileID.Containers, uint startingSlot = 1, int tileStyle = 0) - { - int chestIndex = -1; - - // Slide downwards on the Y axis trying to find the floor beneath the empty position initially picked - while (j < Main.maxTilesY - 210) - { - if (!WorldGen.SolidTile(i, j)) - { - j++; - continue; - } - - // If there are already 1,000 chests in the world and this one fails to place, just give up. - chestIndex = WorldGen.PlaceChest(i - 1, j - 1, type, false, tileStyle); - break; - } - - if (chestIndex < 0) - return null; - Chest chest = Main.chest[chestIndex]; - PlaceLootInChest(ref chest, type, startingSlot); - return chest; - } - - internal static void PlaceLootInChest(ref Chest chest, ushort type, uint startingSlot) - { - uint itemIndex = startingSlot; - - void PutItemInChest(ref Chest c, int id, int minQuantity = 0, int maxQuantity = 0, bool condition = true) - { - if (!condition) - return; - c.item[itemIndex].SetDefaults(id, false); - - // Don't set quantity unless quantity is specified - if(minQuantity > 0) - { - // Max quantity cannot be less than min quantity. It's zero if not specified, meaning you get exactly minQuantity. - if (maxQuantity < minQuantity) - maxQuantity = minQuantity; - c.item[itemIndex].stack = WorldGen.genRand.Next(minQuantity, maxQuantity + 1); - } - itemIndex++; - } - - // Astral Chest has completely different loot in it - if (type == ModContent.TileType()) - { - PutItemInChest(ref chest, ModContent.ItemType(), 30, 80); - PutItemInChest(ref chest, ModContent.ItemType(), 10, 14); - PutItemInChest(ref chest, ModContent.ItemType(), 8); - PutItemInChest(ref chest, ModContent.ItemType(), 3, 5); - PutItemInChest(ref chest, ItemID.FallenStar, 12, 30); - - // Gold Coins don't stack above 100, so this efficiently lets you stuff over a platinum into a chest - int goldCoins = WorldGen.genRand.Next(30, 120); - if (goldCoins > 100) - { - PutItemInChest(ref chest, ItemID.PlatinumCoin); - goldCoins -= 100; - } - PutItemInChest(ref chest, ItemID.GoldCoin, goldCoins); - } - else if (type == ModContent.TileType()) - { - // 15-29 torches (in accordence with vanilla) - PutItemInChest(ref chest, ItemID.Torch, 15, 29); - - // 50% chance of 1 or 2 of the following potions - int[] potions = new int[] - { - ModContent.ItemType(), ItemID.WaterWalkingPotion, ItemID.ShinePotion, ItemID.GillsPotion, ItemID.FlipperPotion - }; - PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); - PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); - - // 33% chance of flippers - PutItemInChest(ref chest, ItemID.Flipper, condition: WorldGen.genRand.NextBool(3)); - - // Typical coins - PutItemInChest(ref chest, ItemID.GoldCoin, 2, 4); - } - // Default loot - else - { - // Silver, Tungsten, Gold or Platinum bars (following worldgen choice) - int barID = WorldGen.genRand.NextBool() ? WorldGen.goldBar : WorldGen.silverBar; - PutItemInChest(ref chest, barID, 3, 10); - - // 50% chance of 25-50 Holy Arrows - PutItemInChest(ref chest, ItemID.HolyArrow, 25, 50, WorldGen.genRand.NextBool()); - - // 50% chance of 1 or 2 of the following potions - int[] potions = new int[] { - ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.NightOwlPotion, - ItemID.WaterWalkingPotion, ItemID.ArcheryPotion, ItemID.GravitationPotion - }; - PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); - - // 50% chance of 1 or 2 of the following potions - // Yes, in vanilla, Dangersense Potions have double the chance to appear. - potions = new int[] { - ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.InvisibilityPotion, - ItemID.ManaRegenerationPotion, ItemID.TeleportationPotion, ItemID.TrapsightPotion, ItemID.TrapsightPotion - }; - - PutItemInChest(ref chest, WorldGen.genRand.Next(potions), 1, 2, WorldGen.genRand.NextBool()); - PutItemInChest(ref chest, ItemID.RecallPotion, 1, 2, WorldGen.genRand.NextBool()); - PutItemInChest(ref chest, ItemID.GoldCoin, 1, 2); - } - } - #endregion - - #region New Temple - public static void NewJungleTemple() - { - bool flag2 = true; - while (flag2) - { - int num = WorldGen.genRand.Next((int)Main.rockLayer, Main.maxTilesY - 500); - int num2; - if (WorldGen.dungeonX < Main.maxTilesX / 2) - { - num2 = WorldGen.genRand.Next((int)((double)Main.maxTilesX * 0.6), (int)((double)Main.maxTilesX * 0.85)); - } - else - { - num2 = WorldGen.genRand.Next((int)((double)Main.maxTilesX * 0.15), (int)((double)Main.maxTilesX * 0.4)); - } - if (Main.tile[num2, num].active() && Main.tile[num2, num].type == 60) - { - flag2 = false; - GenNewTemple(num2, num); - } - } - } - - public static void GenNewTemple(int x, int y) - { - Rectangle[] array = new Rectangle[200]; - float num = (float)(Main.maxTilesX / 4200); - int num2 = WorldGen.genRand.Next((int)(num * 12f), (int)(num * 16f)); - int num3 = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num3 = -1; - } - int num4 = num3; - int num5 = x; - int num6 = y; - int num7 = x; - int num8 = y; - int num9 = WorldGen.genRand.Next(1, 3); - int num10 = 0; - - // Temple room sizes - for (int i = 0; i < num2; i++) - { - num10++; - int num11 = num3; - int num12 = num7; - int num13 = num8; - bool flag = true; - int num14 = 0; - int num15 = 0; - int num16 = -10; - Rectangle rectangle = new Rectangle(num12 - num14 / 2, num13 - num15 / 2, num14, num15); - while (flag) - { - num12 = num7; - num13 = num8; - num14 = WorldGen.genRand.Next(30, 46); - num15 = WorldGen.genRand.Next(25, 31); - - // Final temple room size - if (i == num2 - 1) - { - num14 = WorldGen.genRand.Next(105, 116); - num15 = WorldGen.genRand.Next(90, 106); - num13 += WorldGen.genRand.Next(6, 9); - } - - if (num10 > num9) - { - num13 += WorldGen.genRand.Next(num15 + 1, num15 + 3) + num16; - num12 += WorldGen.genRand.Next(-2, 3); - num11 = num3 * -1; - } - else - { - num12 += (WorldGen.genRand.Next(num14 + 1, num14 + 3) + num16) * num11; - num13 += WorldGen.genRand.Next(-2, 3); - } - - flag = false; - rectangle = new Rectangle(num12 - num14 / 2, num13 - num15 / 2, num14, num15); - for (int j = 0; j < i; j++) - { - if (rectangle.Intersects(array[j])) - { - flag = true; - } - if (WorldGen.genRand.Next(100) == 0) - { - num16++; - } - } - } - if (num10 > num9) - { - num9++; - num10 = 1; - } - array[i] = rectangle; - num3 = num11; - num7 = num12; - num8 = num13; - } - - for (int k = 0; k < num2; k++) - { - for (int l = 0; l < 2; l++) - { - for (int m = 0; m < num2; m++) - { - for (int n = 0; n < 2; n++) - { - int num17 = array[k].X; - if (l == 1) - { - num17 += array[k].Width - 1; - } - int num18 = array[k].Y; - int num19 = num18 + array[k].Height; - int num20 = array[m].X; - if (n == 1) - { - num20 += array[m].Width - 1; - } - int y2 = array[m].Y; - int num21 = y2 + array[m].Height; - while (num17 != num20 || num18 != y2 || num19 != num21) - { - if (num17 < num20) - { - num17++; - } - if (num17 > num20) - { - num17--; - } - if (num18 < y2) - { - num18++; - } - if (num18 > y2) - { - num18--; - } - if (num19 < num21) - { - num19++; - } - if (num19 > num21) - { - num19--; - } - int num22 = num17; - for (int num23 = num18; num23 < num19; num23++) - { - Main.tile[num22, num23].active(true); - Main.tile[num22, num23].type = 226; - Main.tile[num22, num23].liquid = 0; - Main.tile[num22, num23].slope(0); - Main.tile[num22, num23].halfBrick(false); - } - } - } - } - } - } - - for (int num24 = 0; num24 < num2; num24++) - { - for (int num25 = array[num24].X; num25 < array[num24].X + array[num24].Width; num25++) - { - for (int num26 = array[num24].Y; num26 < array[num24].Y + array[num24].Height; num26++) - { - Main.tile[num25, num26].active(true); - Main.tile[num25, num26].type = 226; - Main.tile[num25, num26].liquid = 0; - Main.tile[num25, num26].slope(0); - Main.tile[num25, num26].halfBrick(false); - } - } - int num27 = array[num24].X; - int num28 = num27 + array[num24].Width; - int num29 = array[num24].Y; - int num30 = num29 + array[num24].Height; - num27 += WorldGen.genRand.Next(4, 7); - num28 -= WorldGen.genRand.Next(4, 7); - num29 += WorldGen.genRand.Next(4, 7); - num30 -= WorldGen.genRand.Next(4, 7); - int num31 = num27; - int num32 = num28; - int num33 = num29; - int num34 = num30; - int num35 = (num27 + num28) / 2; - int num36 = (num29 + num30) / 2; - for (int num37 = num27; num37 < num28; num37++) - { - for (int num38 = num29; num38 < num30; num38++) - { - if (WorldGen.genRand.Next(20) == 0) - { - num33 += WorldGen.genRand.Next(-1, 2); - } - if (WorldGen.genRand.Next(20) == 0) - { - num34 += WorldGen.genRand.Next(-1, 2); - } - if (WorldGen.genRand.Next(20) == 0) - { - num31 += WorldGen.genRand.Next(-1, 2); - } - if (WorldGen.genRand.Next(20) == 0) - { - num32 += WorldGen.genRand.Next(-1, 2); - } - if (num31 < num27) - { - num31 = num27; - } - if (num32 > num28) - { - num32 = num28; - } - if (num33 < num29) - { - num33 = num29; - } - if (num34 > num30) - { - num34 = num30; - } - if (num31 > num35) - { - num31 = num35; - } - if (num32 < num35) - { - num32 = num35; - } - if (num33 > num36) - { - num33 = num36; - } - if (num34 < num36) - { - num34 = num36; - } - if (num37 >= num31 && (num37 < num32 & num38 >= num33) && num38 <= num34) - { - Main.tile[num37, num38].active(false); - Main.tile[num37, num38].wall = 87; - } - } - } - for (int num39 = num30; num39 > num29; num39--) - { - for (int num40 = num28; num40 > num27; num40--) - { - if (WorldGen.genRand.Next(20) == 0) - { - num33 += WorldGen.genRand.Next(-1, 2); - } - if (WorldGen.genRand.Next(20) == 0) - { - num34 += WorldGen.genRand.Next(-1, 2); - } - if (WorldGen.genRand.Next(20) == 0) - { - num31 += WorldGen.genRand.Next(-1, 2); - } - if (WorldGen.genRand.Next(20) == 0) - { - num32 += WorldGen.genRand.Next(-1, 2); - } - if (num31 < num27) - { - num31 = num27; - } - if (num32 > num28) - { - num32 = num28; - } - if (num33 < num29) - { - num33 = num29; - } - if (num34 > num30) - { - num34 = num30; - } - if (num31 > num35) - { - num31 = num35; - } - if (num32 < num35) - { - num32 = num35; - } - if (num33 > num36) - { - num33 = num36; - } - if (num34 < num36) - { - num34 = num36; - } - if (num40 >= num31 && (num40 < num32 & num39 >= num33) && num39 <= num34) - { - Main.tile[num40, num39].active(false); - Main.tile[num40, num39].wall = 87; - } - } - } - } - - Vector2 vector = new Vector2((float)num5, (float)num6); - for (int num41 = 0; num41 < num2; num41++) - { - Rectangle rectangle2 = array[num41]; - rectangle2.X += 8; - rectangle2.Y += 8; - rectangle2.Width -= 16; - rectangle2.Height -= 16; - bool flag2 = true; - while (flag2) - { - int num42 = WorldGen.genRand.Next(rectangle2.X, rectangle2.X + rectangle2.Width); - int num43 = WorldGen.genRand.Next(rectangle2.Y, rectangle2.Y + rectangle2.Height); - vector = WorldGen.templePather(vector, num42, num43); - if (vector.X == (float)num42 && vector.Y == (float)num43) - { - flag2 = false; - } - } - if (num41 < num2 - 1) - { - if (WorldGen.genRand.Next(3) != 0) - { - int num44 = num41 + 1; - if (array[num44].Y >= array[num41].Y + array[num41].Height) - { - rectangle2.X = array[num44].X; - if (array[num44].X < array[num41].X) - { - rectangle2.X += (int)((double)((float)array[num44].Width) * 0.2); - } - else - { - rectangle2.X += (int)((double)((float)array[num44].Width) * 0.8); - } - rectangle2.Y = array[num44].Y; - } - else - { - rectangle2.X = (array[num41].X + array[num41].Width / 2 + (array[num44].X + array[num44].Width / 2)) / 2; - rectangle2.Y = (int)((double)array[num44].Y + (double)array[num44].Height * 0.8); - } - int x2 = rectangle2.X; - int y3 = rectangle2.Y; - flag2 = true; - while (flag2) - { - int num45 = WorldGen.genRand.Next(x2 - 4, x2 + 5); - int num46 = WorldGen.genRand.Next(y3 - 4, y3 + 5); - vector = WorldGen.templePather(vector, num45, num46); - if (vector.X == (float)num45 && vector.Y == (float)num46) - { - flag2 = false; - } - } - } - else - { - int num47 = num41 + 1; - int num48 = (array[num41].X + array[num41].Width / 2 + (array[num47].X + array[num47].Width / 2)) / 2; - int num49 = (array[num41].Y + array[num41].Height / 2 + (array[num47].Y + array[num47].Height / 2)) / 2; - flag2 = true; - while (flag2) - { - int num50 = WorldGen.genRand.Next(num48 - 4, num48 + 5); - int num51 = WorldGen.genRand.Next(num49 - 4, num49 + 5); - vector = WorldGen.templePather(vector, num50, num51); - if (vector.X == (float)num50 && vector.Y == (float)num51) - { - flag2 = false; - } - } - } - } - } - int num52 = Main.maxTilesX - 20; - int num53 = 20; - int num54 = Main.maxTilesY - 20; - int num55 = 20; - for (int num56 = 0; num56 < num2; num56++) - { - if (array[num56].X < num52) - { - num52 = array[num56].X; - } - if (array[num56].X + array[num56].Width > num53) - { - num53 = array[num56].X + array[num56].Width; - } - if (array[num56].Y < num54) - { - num54 = array[num56].Y; - } - if (array[num56].Y + array[num56].Height > num55) - { - num55 = array[num56].Y + array[num56].Height; - } - } - - // Create outer temple shape - num52 -= 10; - num53 += 10; - num54 -= 10; - num55 += 10; - for (int num57 = num52; num57 < num53; num57++) - { - for (int num58 = num54; num58 < num55; num58++) - { - WorldGen.outerTempled(num57, num58); - } - } - for (int num59 = num53; num59 >= num52; num59--) - { - for (int num60 = num54; num60 < num55 / 2; num60++) - { - WorldGen.outerTempled(num59, num60); - } - } - for (int num61 = num54; num61 < num55; num61++) - { - for (int num62 = num52; num62 < num53; num62++) - { - WorldGen.outerTempled(num62, num61); - } - } - for (int num63 = num55; num63 >= num54; num63--) - { - for (int num64 = num52; num64 < num53; num64++) - { - WorldGen.outerTempled(num64, num63); - } - } - - // Definitely does something - num3 = -num4; - Vector2 vector2 = new Vector2((float)num5, (float)num6); - int num65 = 4; - bool flag3 = true; - int num66 = 0; - int num67 = WorldGen.genRand.Next(12, 14); - while (flag3) - { - num66++; - if (num66 >= num67) - { - num66 = 0; - vector2.Y -= 1f; - } - vector2.X += (float)num3; - int num68 = (int)vector2.X; - flag3 = false; - int num69 = (int)vector2.Y - num65; - while ((float)num69 < vector2.Y + (float)num65) - { - if (Main.tile[num68, num69].wall == 87 || (Main.tile[num68, num69].active() && Main.tile[num68, num69].type == 226)) - { - flag3 = true; - } - if (Main.tile[num68, num69].active() && Main.tile[num68, num69].type == 226) - { - Main.tile[num68, num69].active(false); - Main.tile[num68, num69].wall = 87; - } - num69++; - } - } - - // Place bricks and walls - int num70 = num5; - int num71 = num6; - while (!Main.tile[num70, num71].active()) - { - num71++; - } - num71 -= 4; - int num72 = num71; - while ((Main.tile[num70, num72].active() && Main.tile[num70, num72].type == 226) || Main.tile[num70, num72].wall == 87) - { - num72--; - } - num72 += 2; - for (int num73 = num70 - 1; num73 <= num70 + 1; num73++) - { - for (int num74 = num72; num74 <= num71; num74++) - { - Main.tile[num73, num74].active(true); - Main.tile[num73, num74].type = 226; - Main.tile[num73, num74].liquid = 0; - Main.tile[num73, num74].slope(0); - Main.tile[num73, num74].halfBrick(false); - } - } - for (int num75 = num70 - 4; num75 <= num70 + 4; num75++) - { - for (int num76 = num71 - 1; num76 < num71 + 3; num76++) - { - Main.tile[num75, num76].active(false); - Main.tile[num75, num76].wall = 87; - } - } - for (int num77 = num70 - 1; num77 <= num70 + 1; num77++) - { - for (int num78 = num71 - 5; num78 <= num71 + 8; num78++) - { - Main.tile[num77, num78].active(true); - Main.tile[num77, num78].type = 226; - Main.tile[num77, num78].liquid = 0; - Main.tile[num77, num78].slope(0); - Main.tile[num77, num78].halfBrick(false); - } - } - for (int num79 = num70 - 1; num79 <= num70 + 1; num79++) - { - for (int num80 = num71; num80 < num71 + 3; num80++) - { - Main.tile[num79, num80].active(false); - Main.tile[num79, num80].wall = 87; - } - } - - // Temple Door - WorldGen.PlaceTile(num70, num71, 10, true, false, -1, 11); - - // Clear space in temple - for (int num81 = num52; num81 < num53; num81++) - { - for (int num82 = num54; num82 < num55; num82++) - { - WorldGen.templeCleaner(num81, num82); - } - } - for (int num83 = num55; num83 >= num54; num83--) - { - for (int num84 = num53; num84 >= num52; num84--) - { - WorldGen.templeCleaner(num84, num83); - } - } - - // Place walls - for (int num85 = num52; num85 < num53; num85++) - { - for (int num86 = num54; num86 < num55; num86++) - { - bool flag4 = true; - for (int num87 = num85 - 1; num87 <= num85 + 1; num87++) - { - for (int num88 = num86 - 1; num88 <= num86 + 1; num88++) - { - if ((!Main.tile[num87, num88].active() || Main.tile[num87, num88].type != 226) && Main.tile[num87, num88].wall != 87) - { - flag4 = false; - break; - } - } - } - if (flag4) - { - Main.tile[num85, num86].wall = 87; - } - } - } - - // Lihzahrd Altar - int num89 = 0; - Rectangle rectangle3; - int num90; - int num91; - while (true) - { - num89++; - rectangle3 = array[num2 - 1]; - num90 = rectangle3.X + WorldGen.genRand.Next(rectangle3.Width); - num91 = rectangle3.Y + WorldGen.genRand.Next(rectangle3.Height); - WorldGen.PlaceTile(num90, num91, 237, false, false, -1, 0); - if (Main.tile[num90, num91].type == 237) - { - break; - } - if (num89 >= 1000) - { - goto Block_117; - } - } - - // Set Altar location - CalamityWorld.newAltarX = num90 - (int)(Main.tile[num90, num91].frameX / 18); - CalamityWorld.newAltarY = num91 - (int)(Main.tile[num90, num91].frameY / 18); - - // If Altar is spawned, continue to temple spike spawn - goto IL_1548; - - // Force spawn Altar if previous code fails - Block_117: - num90 = rectangle3.X + rectangle3.Width / 2; - num91 = rectangle3.Y + rectangle3.Height / 2; - num90 += WorldGen.genRand.Next(-10, 11); - num91 += WorldGen.genRand.Next(-10, 11); - while (!Main.tile[num90, num91].active()) - { - num91++; - } - Main.tile[num90 - 1, num91].active(true); - Main.tile[num90 - 1, num91].slope(0); - Main.tile[num90 - 1, num91].halfBrick(false); - Main.tile[num90 - 1, num91].type = 226; - Main.tile[num90, num91].active(true); - Main.tile[num90, num91].slope(0); - Main.tile[num90, num91].halfBrick(false); - Main.tile[num90, num91].type = 226; - Main.tile[num90 + 1, num91].active(true); - Main.tile[num90 + 1, num91].slope(0); - Main.tile[num90 + 1, num91].halfBrick(false); - Main.tile[num90 + 1, num91].type = 226; - num91 -= 2; - num90--; - for (int num92 = -1; num92 <= 3; num92++) - { - for (int num93 = -1; num93 <= 1; num93++) - { - x = num90 + num92; - y = num91 + num93; - Main.tile[x, y].active(false); - } - } - for (int num94 = 0; num94 <= 2; num94++) - { - for (int num95 = 0; num95 <= 1; num95++) - { - x = num90 + num94; - y = num91 + num95; - Main.tile[x, y].active(true); - Main.tile[x, y].type = 237; - Main.tile[x, y].frameX = (short)(num94 * 18); - Main.tile[x, y].frameY = (short)(num95 * 18); - } - } - - // Set Altar location - CalamityWorld.newAltarX = num90; - CalamityWorld.newAltarY = num91; - - // Skip previous code if first Altar spawn works - IL_1548: - - // Create temple spikes - float num96 = (float)num2 * 1.3f; - int num97 = 0; - while (num96 > 0f) - { - num97++; - int num98 = WorldGen.genRand.Next(num2); - int num99 = WorldGen.genRand.Next(array[num98].X, array[num98].X + array[num98].Width); - int num100 = WorldGen.genRand.Next(array[num98].Y, array[num98].Y + array[num98].Height); - if (Main.tile[num99, num100].wall == 87 && !Main.tile[num99, num100].active()) - { - bool flag5 = false; - if (WorldGen.genRand.Next(2) == 0) - { - int num101 = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num101 = -1; - } - while (!Main.tile[num99, num100].active()) - { - num100 += num101; - } - num100 -= num101; - int num102 = WorldGen.genRand.Next(2); - int num103 = WorldGen.genRand.Next(8, 10); - bool flag6 = true; - for (int num104 = num99 - num103; num104 < num99 + num103; num104++) - { - for (int num105 = num100 - num103; num105 < num100 + num103; num105++) - { - if (Main.tile[num104, num105].active() && Main.tile[num104, num105].type == 10) - { - flag6 = false; - break; - } - } - } - if (flag6) - { - for (int num106 = num99 - num103; num106 < num99 + num103; num106++) - { - for (int num107 = num100 - num103; num107 < num100 + num103; num107++) - { - if (WorldGen.SolidTile(num106, num107) && Main.tile[num106, num107].type != 232 && !WorldGen.SolidTile(num106, num107 - num101)) - { - Main.tile[num106, num107].type = 232; - flag5 = true; - if (num102 == 0) - { - Main.tile[num106, num107 - 1].type = 232; - Main.tile[num106, num107 - 1].active(true); - } - else - { - Main.tile[num106, num107 + 1].type = 232; - Main.tile[num106, num107 + 1].active(true); - } - num102++; - if (num102 > 1) - { - num102 = 0; - } - } - } - } - } - if (flag5) - { - num97 = 0; - num96 -= 1f; - } - } - else - { - int num108 = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num108 = -1; - } - while (!Main.tile[num99, num100].active()) - { - num99 += num108; - } - num99 -= num108; - int num109 = WorldGen.genRand.Next(2); - int num110 = WorldGen.genRand.Next(8, 10); - bool flag7 = true; - for (int num111 = num99 - num110; num111 < num99 + num110; num111++) - { - for (int num112 = num100 - num110; num112 < num100 + num110; num112++) - { - if (Main.tile[num111, num112].active() && Main.tile[num111, num112].type == 10) - { - flag7 = false; - break; - } - } - } - if (flag7) - { - for (int num113 = num99 - num110; num113 < num99 + num110; num113++) - { - for (int num114 = num100 - num110; num114 < num100 + num110; num114++) - { - if (WorldGen.SolidTile(num113, num114) && Main.tile[num113, num114].type != 232 && !WorldGen.SolidTile(num113 - num108, num114)) - { - Main.tile[num113, num114].type = 232; - flag5 = true; - if (num109 == 0) - { - Main.tile[num113 - 1, num114].type = 232; - Main.tile[num113 - 1, num114].active(true); - } - else - { - Main.tile[num113 + 1, num114].type = 232; - Main.tile[num113 + 1, num114].active(true); - } - num109++; - if (num109 > 1) - { - num109 = 0; - } - } - } - } - } - if (flag5) - { - num97 = 0; - num96 -= 1f; - } - } - } - if (num97 > 1000) - { - num97 = 0; - num96 -= 1f; - } - } - - // Set temple variables for temple chest, chair, table, workbench, etc. locations - WorldGen.tLeft = num52; - WorldGen.tRight = num53; - WorldGen.tTop = num54; - WorldGen.tBottom = num55; - WorldGen.tRooms = num2; - } - - public static void NewJungleTemplePart2() - { - int minValue = WorldGen.tLeft; - int maxValue = WorldGen.tRight; - int minValue2 = WorldGen.tTop; - int num = WorldGen.tBottom; - int num2 = WorldGen.tRooms; - float num3 = (float)num2 * 2.1f; - int num4 = 0; - while (num3 > 0f) - { - int num5 = WorldGen.genRand.Next(minValue, maxValue); - int num6 = WorldGen.genRand.Next(minValue2, num); - if (Main.tile[num5, num6].wall == 87 && !Main.tile[num5, num6].active()) - { - if (WorldGen.mayanTrap(num5, num6)) - { - num3 -= 1f; - num4 = 0; - } - else - { - num4++; - } - } - else - { - num4++; - } - if (num4 > 100) - { - num4 = 0; - num3 -= 1f; - } - } - Main.tileSolid[232] = false; - float num7 = (float)num2 * 0.4f; - int contain = 1293; - num4 = 0; - while (num7 > 0f) - { - int num8 = WorldGen.genRand.Next(minValue, maxValue); - int num9 = WorldGen.genRand.Next(minValue2, num); - if (Main.tile[num8, num9].wall == 87 && !Main.tile[num8, num9].active() && WorldGen.AddBuriedChest(num8, num9, contain, true, 16)) - { - num7 -= 1f; - num4 = 0; - } - num4++; - if (num4 > 10000) - { - break; - } - } - float num10 = (float)num2 * 1.6f; - num4 = 0; - while (num10 > 0f) - { - num4++; - int num11 = WorldGen.genRand.Next(minValue, maxValue); - int num12 = WorldGen.genRand.Next(minValue2, num); - if (Main.tile[num11, num12].wall == 87 && !Main.tile[num11, num12].active()) - { - int num13 = num11; - int num14 = num12; - while (!Main.tile[num13, num14].active()) - { - num14++; - if (num14 > num) - { - break; - } - } - num14--; - if (num14 <= num) - { - WorldGen.PlaceTile(num13, num14, 105, true, false, -1, WorldGen.genRand.Next(43, 46)); - if (Main.tile[num13, num14].type == 105) - { - num10 -= 1f; - } - } - } - } - float num15 = (float)num2 * 1.6f; - num4 = 0; - while (num15 > 0f) - { - num4++; - int num16 = WorldGen.genRand.Next(minValue, maxValue); - int num17 = WorldGen.genRand.Next(minValue2, num); - if (Main.tile[num16, num17].wall == 87 && !Main.tile[num16, num17].active()) - { - int num18 = num16; - int num19 = num17; - while (!Main.tile[num18, num19].active()) - { - num19++; - if (num19 > num) - { - break; - } - } - num19--; - if (num19 <= num) - { - int num20 = WorldGen.genRand.Next(3); - if (num20 == 0) - { - WorldGen.PlaceTile(num18, num19, 18, true, false, -1, 10); - if (Main.tile[num18, num19].type == 18) - { - num15 -= 1f; - } - } - else if (num20 == 1) - { - WorldGen.PlaceTile(num18, num19, 14, true, false, -1, 9); - if (Main.tile[num18, num19].type == 14) - { - num15 -= 1f; - } - } - else if (num20 == 2) - { - WorldGen.PlaceTile(num18, num19, 15, true, false, -1, 12); - if (Main.tile[num18, num19].type == 15) - { - num15 -= 1f; - } - } - } - } - if (num4 > 10000) - { - break; - } - } - Main.tileSolid[232] = true; - } - - public static void NewJungleTempleLihzahrdAltar() - { - int lAltarX = CalamityWorld.newAltarX; - int lAltarY = CalamityWorld.newAltarY; - for (int i = 0; i <= 2; i++) - { - for (int j = 0; j <= 1; j++) - { - int num = lAltarX + i; - int num2 = lAltarY + j; - Main.tile[num, num2].active(true); - Main.tile[num, num2].type = 237; - Main.tile[num, num2].frameX = (short)(i * 18); - Main.tile[num, num2].frameY = (short)(j * 18); - } - Main.tile[i, lAltarY + 2].active(true); - Main.tile[i, lAltarY + 2].slope(0); - Main.tile[i, lAltarY + 2].halfBrick(false); - Main.tile[i, lAltarY + 2].type = 226; - } - } - #endregion - - #region Place Rox Shrine - public static void PlaceRoxShrine() - { - while (!CalamityWorld.roxShrinePlaced) - { - CalamityWorld.roxShrinePlaced = true; - for (int x = 0; x < Main.maxTilesX; x++) - { - 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].frameX == 18 && Main.tile[x, y].frameY == 0) || (Main.tile[x, y].frameX == 45 && Main.tile[x, y].frameY == 0)) - { - if (WorldGen.genRand.Next(3) == 0) - { - for (int dx = -1; dx < 2; dx++) - { - for (int dy = -1; dy < 2; dy++) - Main.tile[x + dx, y + dy].active(false); - } - - WorldGen.PlaceTile(x, y + 1, ModContent.TileType()); - return; - } - else - CalamityWorld.roxShrinePlaced = false; - } - } - } - } - } - } - #endregion - - #region OreSpawn - public static void SpawnOre(int type, double frequency, float depth, float depthLimit) - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - if (type == ModContent.TileType()) - { - depthLimit = 0.14f; - if (y > 1500) - { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int k = 0; k < (int)((double)(x * y) * frequency); k++) - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); - if (type == ModContent.TileType()) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); - } - else if (type == ModContent.TileType()) - { //mud - if (Main.tile[tilesX, tilesY].type == 59) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == ModContent.TileType()) - { //dirt, stone - if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == ModContent.TileType()) - { //snow, ice, purple ice, pink ice, red ice, astral snow, astral ice - if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200 || Main.tile[tilesX, tilesY].type == ModContent.TileType() || Main.tile[tilesX, tilesY].type == ModContent.TileType()) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - } - } - #endregion - - #region AstralMeteor - public static bool CanAstralMeteorSpawn() - { - int astralOreCount = 0; - float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 - int astralOreAllowed = (int)(200f * worldSizeFactor); // Small = 201 Medium = 305 Large = 401 - for (int x = 5; x < Main.maxTilesX - 5; x++) - { - int y = 5; - while (y < Main.worldSurface) - { - if (Main.tile[x, y].active() && Main.tile[x, y].type == ModContent.TileType()) - { - astralOreCount++; - if (astralOreCount > astralOreAllowed) - return false; - } - y++; - } - } - return true; - } - - public static bool CanAstralBiomeSpawn() - { - int astralTileCount = 0; - float worldSizeFactor = Main.maxTilesX / 4200f; // Small = 4200, Medium = 6400, Large = 8400 - int astralTilesAllowed = (int)(400f * worldSizeFactor); // Small = 401 Medium = 605 Large = 801 - for (int x = 5; x < Main.maxTilesX - 5; x++) - { - int y = 5; - 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())) - { - astralTileCount++; - if (astralTileCount > astralTilesAllowed) - return false; - } - y++; - } - } - return true; - } - - public static void AstralMeteorThreadWrapper(object context) - { - PlaceAstralMeteor(); - } - - public static void PlaceAstralMeteor() - { - Mod ancientsAwakened = ModLoader.GetMod("AAMod"); - - // This flag is also used to determine whether players are nearby. - bool meteorDropped = true; - - // Clients in multiplayer don't drop meteors. - if (Main.netMode == NetmodeID.MultiplayerClient) - return; - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active) - { - meteorDropped = false; - break; - } - } - - // Check whether there is already too much ore. - if (!CanAstralMeteorSpawn()) - return; - - UnifiedRandom rand = WorldGen.genRand; - float solidTileRequirement = 600f; - bool localAbyssSide = WorldGen.dungeonX < Main.maxTilesX / 2; - while (!meteorDropped) - { - float worldEdgeMargin = (float)Main.maxTilesX * 0.08f; - int xLimit = Main.maxTilesX / 2; - int x = CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); - while ((float)x > (float)Main.spawnTileX - worldEdgeMargin && (float)x < (float)Main.spawnTileX + worldEdgeMargin) - { - x = CalamityWorld.abyssSide ? rand.Next(400, xLimit) : rand.Next(xLimit, Main.maxTilesX - 400); - } - //world surface = 920 large 740 medium 560 small - 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]) - { - int suitableTiles = 0; - int checkRadius = 15; - for (int l = x - checkRadius; l < x + checkRadius; l++) - { - for (int m = y - checkRadius; m < y + checkRadius; m++) - { - if (WorldGen.SolidTile(l, m)) - { - 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) - { - 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()) - { - suitableTiles -= 100; - } - - // 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")) - { - suitableTiles -= 100; - } - } - } - - // Liquid aversion makes meteors less likely to fall in lakes - else if (Main.tile[l, m].liquid > 0) - { - suitableTiles--; - } - } - } - - if ((float)suitableTiles < solidTileRequirement) - { - solidTileRequirement -= 0.5f; - break; - } - meteorDropped = GenerateAstralMeteor(x, y); - - // If the meteor actually dropped, post the message stating as such. - if (meteorDropped) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue(key), messageColor); - else if (Main.netMode == NetmodeID.Server) - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - break; - } - break; - } - else - { - y++; - } - } - if (solidTileRequirement < 100f) - { - return; - } - } - } - - public static bool GenerateAstralMeteor(int i, int j) - { - UnifiedRandom rand = WorldGen.genRand; - if (i < 50 || i > Main.maxTilesX - 50) - { - return false; - } - // Avoid the dungeon so that the beacon doesn't eat it. - if (Math.Abs(i - WorldGen.dungeonX) < 65) - { - return false; - } - if (j < 50 || j > Main.maxTilesY - 50) - { - return false; - } - int num = 35; - Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); - for (int k = 0; k < 255; k++) - { - if (Main.player[k].active) - { - Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); - if (rectangle.Intersects(value)) - { - return false; - } - } - } - for (int l = 0; l < 200; l++) - { - if (Main.npc[l].active) - { - Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); - if (rectangle.Intersects(value2)) - { - return false; - } - } - } - for (int m = i - num; m < i + num; m++) - { - for (int n = j - num; n < j + num; n++) - { - if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) - { - return false; - } - } - } - num = rand.Next(17, 23); - for (int num2 = i - num; num2 < i + num; num2++) - { - for (int num3 = j - num; num3 < j + num; num3++) - { - if (num3 > j + rand.Next(-2, 3) - 5) - { - float num4 = (float)Math.Abs(i - num2); - float num5 = (float)Math.Abs(j - num3); - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - if ((double)num6 < (double)num * 0.9 + (double)rand.Next(-4, 5)) - { - if (Main.tile[num2, num3] != null) - { - if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) - { - Main.tile[num2, num3].active(false); - } - Main.tile[num2, num3].type = (ushort)ModContent.TileType(); - } - } - } - } - } - num = WorldGen.genRand.Next(8, 14); - for (int num7 = i - num; num7 < i + num; num7++) - { - for (int num8 = j - num; num8 < j + num; num8++) - { - if (num8 > j + rand.Next(-2, 3) - 4) - { - float num9 = (float)Math.Abs(i - num7); - float num10 = (float)Math.Abs(j - num8); - float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); - if ((double)num11 < (double)num * 0.8 + (double)rand.Next(-3, 4)) - { - if (Main.tile[num7, num8] != null) - Main.tile[num7, num8].active(false); - } - } - } - } - num = WorldGen.genRand.Next(25, 35); - for (int num12 = i - num; num12 < i + num; num12++) - { - for (int num13 = j - num; num13 < j + num; num13++) - { - float num14 = (float)Math.Abs(i - num12); - float num15 = (float)Math.Abs(j - num13); - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.tile[num12, num13] != null) - { - 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) - { - try - { WorldGen.KillTile(num12, num13, false, false, true); } - catch (NullReferenceException) - { } - } - Main.tile[num12, num13].liquid = 0; - } - if (Main.tile[num12, num13].type == (ushort)ModContent.TileType()) - { - if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - } - WorldGen.SquareTileFrame(num12, num13, true); - WorldGen.SquareWallFrame(num12, num13, true); - } - } - } - num = WorldGen.genRand.Next(23, 32); - for (int num17 = i - num; num17 < i + num; num17++) - { - for (int num18 = j - num; num18 < j + num; num18++) - { - if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && rand.NextBool(10)) - { - float num19 = (float)Math.Abs(i - num17); - float num20 = (float)Math.Abs(j - num18); - float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); - if ((double)num21 < (double)num * 0.8) - { - 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) - { - WorldGen.KillTile(num17, num18, false, false, false); - } - Main.tile[num17, num18].type = (ushort)ModContent.TileType(); - WorldGen.SquareTileFrame(num17, num18, true); - } - } - } - } - } - num = WorldGen.genRand.Next(30, 38); - for (int num22 = i - num; num22 < i + num; num22++) - { - for (int num23 = j - num; num23 < j + num; num23++) - { - if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && rand.NextBool(20)) - { - float num24 = (float)Math.Abs(i - num22); - float num25 = (float)Math.Abs(j - num23); - float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); - if ((double)num26 < (double)num * 0.85) - { - 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) - { - WorldGen.KillTile(num22, num23, false, false, false); - } - Main.tile[num22, num23].type = (ushort)ModContent.TileType(); - WorldGen.SquareTileFrame(num22, num23, true); - } - } - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); - if (CanAstralBiomeSpawn()) - { - DoAstralConversion(new Point(i, j)); - int checkWidth = 180; - float averageHeight = 0f; - float lowestHeight = 0f; - for (int x = i - checkWidth / 2; x < i + checkWidth / 2; x++) - { - int y = j - 200; - while (!Main.tileSolid[CalamityUtils.ParanoidTileRetrieval(x, y).type] || !CalamityUtils.ParanoidTileRetrieval(x, y).active()) - { - y++; - if (y > j - 10) - break; - } - lowestHeight = (int)MathHelper.Max(lowestHeight, y); - averageHeight += y; - } - lowestHeight -= 35f; - averageHeight /= checkWidth; - float height = lowestHeight; - - // If there's a sudden change between the average and lowest height (which is indicative of holes/chasms), go with the average. - if (Math.Abs(lowestHeight - averageHeight) > 50f) - height = averageHeight; - - // WorldGen.gen prevents NewItem from working, and thus prevents a bunch of dumb items from being spawned immediately and deleting the WoF/Aureus loot in the process. - WorldGen.gen = true; - SchematicPlacementHelpers.PlaceStructure("Astral Beacon", new Point(i, (int)height - 30), SchematicPlacementHelpers.PlacementAnchorType.Center); - WorldGen.gen = false; - } - } - return true; - } - - public static void DoAstralConversion(object obj) - { - //Pre-calculate all variables necessary for elliptical area checking - Point origin = (Point)obj; - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int distanceInTiles = 150 + (Main.maxTilesX - 4200) / 4200 * 200; - float distance = distanceInTiles * 16f; - float constant = distance * 2f / (float)Math.Sin(angle); - - float fociSpacing = distance * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - UnifiedRandom rand = WorldGen.genRand; - for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) - { - for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) - { - if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out float dist, y < origin.Y)) - { - //If we're in the outer blurPercent% of the ellipse - float percent = dist / constant; - float blurPercent = 0.98f; - if (percent > blurPercent) - { - float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent); - if (rand.NextFloat(1f) > outerEdgePercent) - { - ConvertToAstral(x, y); - } - } - else - { - ConvertToAstral(x, y); - } - } - } - } - } - - public static void ConvertToAstral(int startX, int endX, int startY, int endY) - { - for (int x = startX; x <= endX; x++) - { - for (int y = startY; y <= endY; y++) - { - ConvertToAstral(x, y); - } - } - } - - public static void ConvertToAstral(int x, int y, bool tileframe = true) - { - if (WorldGen.InWorld(x, y, 1)) - { - int type = Main.tile[x, y].type; - int wallType = Main.tile[x, y].wall; - - if (Main.tile[x, y] != null) - { - if (WallID.Sets.Conversion.Grass[wallType]) - { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - } - else if (WallID.Sets.Conversion.HardenedSand[wallType]) - { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - } - else if (WallID.Sets.Conversion.Sandstone[wallType]) - { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - } - else if (WallID.Sets.Conversion.Stone[wallType]) - { - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - } - else - { - switch (wallType) - { - case WallID.DirtUnsafe: - case WallID.DirtUnsafe1: - case WallID.DirtUnsafe2: - case WallID.DirtUnsafe3: - case WallID.DirtUnsafe4: - case WallID.Cave6Unsafe: - case WallID.Dirt: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - break; - case WallID.SnowWallUnsafe: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - break; - case WallID.DesertFossil: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - break; - case WallID.IceUnsafe: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - break; - case WallID.LivingWood: - Main.tile[x, y].wall = (ushort)ModContent.WallType(); - break; - } - } - if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) - { - Main.tile[x, y].type = (ushort)ModContent.TileType(); - } - else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type]) - { - Main.tile[x, y].type = (ushort)ModContent.TileType(); - } - else if (TileID.Sets.Conversion.Sand[type]) - { - Main.tile[x, y].type = (ushort)ModContent.TileType(); - } - else if (TileID.Sets.Conversion.HardenedSand[type]) - { - Main.tile[x, y].type = (ushort)ModContent.TileType(); - } - else if (TileID.Sets.Conversion.Sandstone[type]) - { - Main.tile[x, y].type = (ushort)ModContent.TileType(); - } - else if (TileID.Sets.Conversion.Ice[type]) - { - Main.tile[x, y].type = (ushort)ModContent.TileType(); - } - else - { - Tile tile = Main.tile[x, y]; - switch (type) - { - case TileID.Dirt: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.SnowBlock: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.Silt: - case TileID.Slush: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.DesertFossil: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.ClayBlock: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.Vines: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.LivingWood: - Main.tile[x, y].type = (ushort)ModContent.TileType(); - break; - case TileID.LeafBlock: - WorldGen.KillTile(x, y); - if (Main.netMode == NetmodeID.MultiplayerClient) - { - NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, x, y); - } - break; - case TileID.LargePiles: - if (tile.frameX <= 1170) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 0, 1170, 0, 18); - } - if (tile.frameX >= 1728) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)ModContent.TileType(), x, y, 324, 1728, 1872, 0, 18); - } - if (tile.frameX >= 1404 && tile.frameX <= 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) - { - RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)ModContent.TileType(), x, y, 324, 1566, 1872, 0, 18); - } - if (tile.frameX >= 756 && tile.frameX <= 900) - { - RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)ModContent.TileType(), x, y, 324, 756, 900, 0, 18); - } - break; - case TileID.SmallPiles: - if (tile.frameY == 18) - { - ushort newType; - if (tile.frameX >= 1476 && tile.frameX <= 1674) - { - newType = (ushort)ModContent.TileType(); - } - else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) - { - newType = (ushort)ModContent.TileType(); - } - else if (tile.frameX >= 900 && tile.frameX <= 1098) - { - newType = (ushort)ModContent.TileType(); - } - else - { - break; - } - int leftMost = x; - if (tile.frameX % 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; - if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].type = newType; - while (Main.tile[leftMost, y].frameX >= 216) - { - if (Main.tile[leftMost, y] != null) - Main.tile[leftMost, y].frameX -= 216; - if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].frameX -= 216; - } - } - else if (tile.frameY == 0) - { - ushort newType3; - if (tile.frameX >= 972 && tile.frameX <= 1062) - { - newType3 = (ushort)ModContent.TileType(); - } - else if (tile.frameX <= 486) - { - newType3 = (ushort)ModContent.TileType(); - } - else if (tile.frameX >= 648 && tile.frameX <= 846) - { - newType3 = (ushort)ModContent.TileType(); - } - else - { - break; - } - Main.tile[x, y].type = newType3; - while (Main.tile[x, y].frameX >= 108) //REFRAME IT - { - Main.tile[x, y].frameX -= 108; - } - } - 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; - ushort newType2; - if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT - { - newType2 = (ushort)ModContent.TileType(); - } - else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) - { - newType2 = (ushort)ModContent.TileType(); - } - else if (tile.frameX <= 36) - { - newType2 = (ushort)ModContent.TileType(); - } - else - { - break; - } - - //Set types - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = newType2; - if (twoTall) - { - if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].type = newType2; - } - - //Fix frames - while (Main.tile[x, topMost].frameX >= 54) - { - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].frameX -= 54; - if (twoTall) - { - if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].frameX -= 54; - } - } - - if (hanging) - { - ConvertToAstral(x, topMost - 1); - break; - } - else - { - if (twoTall) - { - ConvertToAstral(x, topMost + 2); - break; - } - ConvertToAstral(x, topMost + 1); - break; - } - } - } - if (tileframe) - { - if (Main.netMode == NetmodeID.SinglePlayer) - { - WorldGen.SquareTileFrame(x, y, true); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendTileSquare(-1, x, y, 1); - } - } - } - } - } - - public static void ConvertFromAstral(int x, int y, ConvertType convert) - { - Tile tile = Main.tile[x, y]; - int type = tile.type; - int wallType = tile.wall; - Mod mod = ModContent.GetInstance(); - - if (WorldGen.InWorld(x, y, 1)) - { - #region WALL - if (Main.tile[x, y] != null) - { - if (wallType == ModContent.WallType()) - { - Main.tile[x, y].wall = WallID.DirtUnsafe; - } - else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) - { - Main.tile[x, y].wall = WallID.SnowWallUnsafe; - } - else if (wallType == ModContent.WallType()) - { - Main.tile[x, y].wall = WallID.DesertFossil; - } - else if (wallType == ModContent.WallType()) - { - switch (convert) - { - case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; - break; - case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; - break; - case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; - break; - case ConvertType.Pure: - Main.tile[x, y].wall = WallID.GrassUnsafe; - break; - } - } - else if (wallType == ModContent.WallType()) - { - Main.tile[x, y].wall = WallID.IceUnsafe; - } - else if (wallType == ModContent.WallType()) - { - Main.tile[x, y].wall = WallID.LivingWood; - } - else if (wallType == ModContent.WallType()) - { - switch (convert) - { - case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.EbonstoneUnsafe; - break; - case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimstoneUnsafe; - break; - case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; - break; - case ConvertType.Pure: - Main.tile[x, y].wall = WallID.Stone; - break; - } - } - } - #endregion - - #region TILE - if (Main.tile[x, y] != null) - { - if (type == ModContent.TileType()) - { - tile.type = TileID.Dirt; - } - else if (type == ModContent.TileType()) - { - tile.type = TileID.SnowBlock; - } - else if (type == ModContent.TileType()) - { - tile.type = TileID.Silt; - } - else if (type == ModContent.TileType()) - { - tile.type = TileID.DesertFossil; - } - else if (type == ModContent.TileType()) - { - tile.type = TileID.ClayBlock; - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone); - } - else if (type == ModContent.TileType()) - { - tile.type = TileID.LivingWood; - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants); - } - else if (type == ModContent.TileType()) - { - SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18); - } - else if (type == ModContent.TileType()) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); - } - else if (type == ModContent.TileType()) - { - ushort originType = TileID.Stone; - int frameXAdd = 54; - switch (convert) - { - case ConvertType.Corrupt: - originType = TileID.Ebonstone; - frameXAdd = 324; - break; - case ConvertType.Crimson: - originType = TileID.Crimstone; - frameXAdd = 270; - break; - case ConvertType.Hallow: - originType = TileID.Pearlstone; - frameXAdd = 216; - break; - } - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); - } - else if (type == ModContent.TileType()) - { - ushort originType = TileID.Sandstone; - int frameXAdd = 378; - switch (convert) - { - case ConvertType.Corrupt: - originType = TileID.CorruptSandstone; - frameXAdd = 324; - break; - case ConvertType.Crimson: - originType = TileID.CrimsonSandstone; - frameXAdd = 270; - break; - case ConvertType.Hallow: - originType = TileID.HallowSandstone; - frameXAdd = 216; - break; - } - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); - } - else if (type == ModContent.TileType()) - { - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, TileID.IceBlock, x, y, 0, 0); - } - if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt) - { - WorldGen.SquareTileFrame(x, y); - } - } - #endregion - } - } - - public static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure) - { - switch (convert) - { - case ConvertType.Corrupt: - if (corrupt != ushort.MaxValue) - { - Main.tile[x, y].type = corrupt; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Crimson: - if (crimson != ushort.MaxValue) - { - Main.tile[x, y].type = crimson; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Hallow: - if (hallow != ushort.MaxValue) - { - Main.tile[x, y].type = hallow; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Pure: - if (pure != ushort.MaxValue) - { - Main.tile[x, y].type = pure; - WorldGen.SquareTileFrame(x, y); - } - break; - } - } - - 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) - return; - - Main.tile[x, y].type = replaceType; - while (Main.tile[x, y].frameX >= replaceTextureWidth) - { - Main.tile[x, y].frameX -= (short)replaceTextureWidth; - } - - if (Main.tile[x - 1, y] != null) - RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x + 1, y] != null) - RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x, y - 1] != null) - RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x, y + 1] != null) - RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - } - - 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) - return; - - Main.tile[x, y].type = replaceType; - Main.tile[x, y].frameX += (short)addFrameX; - Main.tile[x, y].frameY += (short)addFrameY; - - if (Main.tile[x - 1, y] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); - if (Main.tile[x + 1, y] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY); - if (Main.tile[x, y - 1] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY); - if (Main.tile[x, y + 1] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY); - } - - public static void ReplaceAstralStalactite(ushort checkType, ushort replaceType, ushort replaceOriginTile, int x, int y, int addFrameX, int addFrameY) - { - 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 yOriginTile = hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1); - - if (Main.tile[x, topMost++] != null) - Main.tile[x, topMost++].type = replaceType; - if (twoTall) - { - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = replaceType; - } - if (Main.tile[x, yOriginTile] != null) - Main.tile[x, yOriginTile].type = replaceOriginTile; - } - - public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) - { - Vector2 point = tile.ToVector2() * 16f + new Vector2(8f); - if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. - { - float distY = center.Y - point.Y; - point.Y -= distY * 8f; - } - float distance1 = Vector2.Distance(point, focus1); - float distance2 = Vector2.Distance(point, focus2); - distance = distance1 + distance2; - return distance <= distanceConstant; - } - #endregion - - #region EvilIsland - public static void EvilIsland(int i, int j) - { - double num = (double)WorldGen.genRand.Next(100, 150); - float num2 = (float)WorldGen.genRand.Next(20, 30); - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = WorldGen.crimson ? 400 : 401; - if (WorldGen.genRand.Next(4) == 0) - { - num16 = WorldGen.crimson ? 398 : 399; - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - 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; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(80, 95); - num2 = (float)WorldGen.genRand.Next(10, 15); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = num5 - 1; - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; - float num19 = vector.Y + 1f; - for (int num20 = num7; num20 < num8; num20++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num19 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num19 < vector.Y) - { - num19 = vector.Y; - } - if (num19 > vector.Y + 2f) - { - num19 = vector.Y + 2f; - } - for (int num21 = num9; num21 < num10; num21++) - { - if ((float)num21 > num19) - { - float arg_69E_0 = Math.Abs((float)num20 - vector.X); - float num22 = Math.Abs((float)num21 - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && - Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore - WorldGen.SquareTileFrame(num20, num21, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = WorldGen.crimson ? 400 : 401; - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - 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; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - 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 == (WorldGen.crimson ? 400 : 401)) - { - 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 == (WorldGen.crimson ? 400 : 401)) - { - 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 == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - int num38 = WorldGen.genRand.Next(4); - for (int num39 = 0; num39 <= num38; num39++) - { - int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); - int num41 = num5 - WorldGen.genRand.Next(20, 40); - int num42 = WorldGen.genRand.Next(4, 8); - int num43 = WorldGen.crimson ? 400 : 401; - if (WorldGen.genRand.Next(2) == 0) - { - num43 = WorldGen.crimson ? 398 : 399; - } - for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) - { - for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) - { - float arg_C74_0 = (float)Math.Abs(num44 - num40); - float num46 = (float)(Math.Abs(num45 - num41) * 2); - if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) - { - Main.tile[num44, num45].active(true); - Main.tile[num44, num45].type = (ushort)num43; - WorldGen.SquareTileFrame(num44, num45, true); - } - } - } - for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) - { - int num48 = num41 - num42; - while (!Main.tile[num47, num48].active()) - { - num48++; - } - Main.tile[num47, num48].active(false); - Main.tile[num47, num48].liquid = 255; - WorldGen.SquareTileFrame(num47, num48, true); - } - } - } - #endregion - - #region EvilIslandHouse - public static void EvilIslandHouse(int i, int j) - { - ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile - byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - 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].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, WorldGen.crimson ? 1 : 10); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - 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].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - int contain; - if (WorldGen.crimson) - { - contain = 1571; //scourge - } - else - { - contain = 1569; //vampire - } - WorldGen.AddBuriedChest(i, num10 - 3, contain, false, WorldGen.crimson ? 19 : 20); //chest - int num14 = i - num2 / 2 + 1; - int num15 = i + num2 / 2 - 1; - int num16 = 1; - if (num2 > 10) - { - num16 = 2; - } - int num17 = (num6 + num7) / 2 - 1; - for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) - { - for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) - { - Main.tile[num18, num19].wall = 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 - } - } - 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 tile2 = Main.tile[num22 - 2, num7 - 2]; - tile2.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, WorldGen.crimson ? 2 : 11); //chair - } - #endregion - - #region UnderworldIsland - public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) - { - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)ModContent.TileType(); - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = ModContent.TileType(); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = ModContent.TileType(); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - 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; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = ModContent.TileType(); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - 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; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (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()) - { - 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()) - { - 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()) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region UnderworldIslandHouse - public static void UnderworldIslandHouse(int i, int j, int item) - { - ushort type = (ushort)ModContent.TileType(); //tile - byte wall = (byte)ModContent.WallType(); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - 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].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, ModContent.TileType(), true, false, -1); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - 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].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest - int num22 = i + (num2 / 2 + 1) * -num; - 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 tile2 = Main.tile[num22 - 2, num7 - 2]; - tile2.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, ModContent.TileType(), true, false, 0); //chair - } - #endregion - - #region AbyssIsland - public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) - { - int sizeMinSmall = sizeMin / 5; - int sizeMaxSmall = sizeMax / 5; - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); - CalamityUtils.SafeSquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = isVoid ? ModContent.TileType() : ModContent.TileType(); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = hasChest ? ModContent.TileType() : ModContent.TileType(); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - 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; - CalamityUtils.SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - if (hasTenebris) - { - int p = num3; - int num150; - for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) - { - int num14 = num6; - while (!Main.tile[p, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); //-3 4 - num150 = 1; //4 8 - int num16 = ModContent.TileType(); - for (int n = p - num150; n <= p + num150; n++) - { - for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - p); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - 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; - CalamityUtils.SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - } - int sizeMinSmall2 = sizeMin2 / 8; - int sizeMaxSmall2 = sizeMax2 / 8; - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = isVoid ? ModContent.TileType() : ModContent.TileType(); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - 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; - CalamityUtils.SafeSquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (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())) - { - 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())) - { - 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())) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - CalamityUtils.SafeSquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - CalamityUtils.SafeSquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region AbyssIslandHouse - public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) - { - ushort type = (ushort)(isVoid ? ModContent.TileType() : ModContent.TileType()); //tile - ushort wall = (ushort)(isVoid ? ModContent.WallType() : ModContent.WallType()); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(5, 9); - int num3 = 3; - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - 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].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) - { - Main.tile[n, num8].active(false); - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - switch (itemChoice) - { - case 0: - itemChoice = ModContent.ItemType(); - break; //rain item - case 1: - itemChoice = ModContent.ItemType(); - break; //movement acc - case 2: - itemChoice = ModContent.ItemType(); - break; //regen acc - case 3: - itemChoice = ModContent.ItemType(); - break; //ranged - case 4: - itemChoice = ModContent.ItemType(); - break; //defense acc - case 5: - itemChoice = ModContent.ItemType(); - break; //melee - case 6: - itemChoice = ModContent.ItemType(); - break; //light pet - case 7: - itemChoice = ModContent.ItemType(); - break; //summon - case 8: - itemChoice = ModContent.ItemType(); - break; //magic - case 9: - itemChoice = ModContent.ItemType(); - break; //throwing - default: - itemChoice = 497; - break; - } - WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest - } - #endregion - - #region SpecialHut - // Special Hut: Takes arguments of tile type 1, tile type 2, wall type, hut type (useful if you use this method to generate different huts), and location of the shrine (x and y) - public static void SpecialHut(ushort tile, ushort tile2, ushort wall, int hutType, int shrineLocationX, int shrineLocationY) - { - // Random variables for shrine size - int randomX = WorldGen.genRand.Next(2, 4); - int randomY = WorldGen.genRand.Next(2, 4); - - // Replace tiles in shrine area with shrine tile type 1 - for (int n = shrineLocationX - randomX - 1; n <= shrineLocationX + randomX + 1; n++) - { - for (int num8 = shrineLocationY - randomY - 1; num8 <= shrineLocationY + randomY + 1; num8++) - { - Main.tile[n, num8].active(true); - Main.tile[n, num8].type = tile; - Main.tile[n, num8].slope(0); - Main.tile[n, num8].liquid = 0; - Main.tile[n, num8].lava(false); - } - } - - // Replace walls in shrine area with shrine wall type - for (int num9 = shrineLocationX - randomX; num9 <= shrineLocationX + randomX; num9++) - { - for (int num10 = shrineLocationY - randomY; num10 <= shrineLocationY + randomY; num10++) - { - Main.tile[num9, num10].active(false); - Main.tile[num9, num10].wall = wall; - } - } - - // Remove tiles from the inner part of the shrine area - for (int num14 = shrineLocationX - randomX - 1; num14 <= shrineLocationX + randomX + 1; num14++) - { - for (int num15 = shrineLocationY + randomY - 2; num15 <= shrineLocationY + randomY; num15++) - Main.tile[num14, num15].active(false); - } - for (int num16 = shrineLocationX - randomX - 1; num16 <= shrineLocationX + randomX + 1; num16++) - { - for (int num17 = shrineLocationY + randomY - 2; num17 <= shrineLocationY + randomY - 1; num17++) - Main.tile[num16, num17].active(false); - } - - // Replace tiles from bottom of shrine area with shrine tile type 2 - for (int num18 = shrineLocationX - randomX - 1; num18 <= shrineLocationX + randomX + 1; num18++) - { - int num19 = 4; - int num20 = shrineLocationY + randomY + 2; - while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) - { - Main.tile[num18, num20].active(true); - Main.tile[num18, num20].type = tile2; - Main.tile[num18, num20].slope(0); - num20++; - num19--; - } - } - - // Replace tiles from top of shrine with shrine tile type 1 - randomX -= WorldGen.genRand.Next(1, 3); - int num21 = shrineLocationY - randomY - 2; - while (randomX > -1) - { - for (int num22 = shrineLocationX - randomX - 1; num22 <= shrineLocationX + randomX + 1; num22++) - { - Main.tile[num22, num21].active(true); - Main.tile[num22, num21].type = tile; - } - randomX -= WorldGen.genRand.Next(1, 3); - num21--; - } - - // Place shrine chest - CalamityWorld.SChestX[hutType] = shrineLocationX; - CalamityWorld.SChestY[hutType] = shrineLocationY; - SpecialChest(hutType); - } - #endregion - - #region SpecialChest - // Special Chest: Used for placing shrine chests, takes argument of item choice which dictates what item will spawn in the first slot of this chest - public static void SpecialChest(int itemChoice) - { - int item = 0; - int chestType = 0; - - switch (itemChoice) //0 to 9 - { - case 0: - item = ModContent.ItemType(); - break; - case 1: - item = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); - chestType = WorldGen.crimson ? 43 : 3; - break; - case 2: - item = ModContent.ItemType(); - chestType = 44; - break; - case 3: - item = ModContent.ItemType(); - chestType = 47; - break; - case 4: - item = ModContent.ItemType(); - chestType = 30; - break; - case 5: - item = ModContent.ItemType(); - chestType = 32; - break; - case 6: - item = ModContent.ItemType(); - chestType = 50; - break; - case 7: - item = ModContent.ItemType(); - chestType = 51; - break; - case 8: - item = ModContent.ItemType(); - chestType = 4; - break; - } - - // Destroy tiles in chest spawn location - for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) - { - for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) - WorldGen.KillTile(j, k, false, false, false); - } - - // Attempt to fix sloped tiles under the chest to prevent the chest from killing itself (literally) - for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) - { - for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) - { - if (m < Main.maxTilesY) - { - Main.tile[l, m].slope(0); - Main.tile[l, m].halfBrick(false); - } - } - } - - // Place the chest, finally - WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); - } - #endregion - - #region ChasmGenerator - public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) - { - float num = steps; //850 small 1450 medium 2050 large - if (ocean) - { - int tileYLookup = j; - if (CalamityWorld.abyssSide) - { - while (!Main.tile[i + 125, tileYLookup].active()) - { - tileYLookup++; - } - } - else - { - while (!Main.tile[i - 125, tileYLookup].active()) - { - tileYLookup++; - } - } - j = tileYLookup; - } - Vector2 vector; - vector.X = i; - vector.Y = j; - Vector2 vector2; - vector2.X = WorldGen.genRand.Next(-1, 2) * 0.1f; - vector2.Y = WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; - int num2 = 5; - double num3 = WorldGen.genRand.Next(5, 7) + 20; //start width - while (num3 > 0.0) - { - if (num > 0f) - { - num3 += WorldGen.genRand.Next(2); - num3 -= WorldGen.genRand.Next(2); - float smallHoleLimit = 790f; //small - if (Main.maxTilesY > 1500) - { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } - if (ocean && num > smallHoleLimit) - { - if (num3 < 7.0) //min width - { - num3 = 7.0; //min width - } - if (num3 > 11.0) //max width - { - num3 = 11.0; //max width - } - } - else //dig large hole - { - if (num3 < (ocean ? 45.0 : 8.0)) //min width - { - num3 = ocean ? 45.0 : 8.0; //min width - } - if (num3 > (ocean ? 50.0 : 20.0)) //max width - { - num3 = ocean ? 50.0 : 20.0; //max width - } - if (num == 1f && num3 < (ocean ? 50.0 : 15.0)) - { - num3 = ocean ? 50.0 : 15.0; - } - } - } - else - { - if ((double)vector.Y > CalamityWorld.abyssChasmBottom) - { - num3 -= WorldGen.genRand.Next(5) + 8; - } - } - if (Main.maxTilesY > 2100) - { - if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - (vector.Y >= Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - else if (Main.maxTilesY > 1500) - { - if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - (vector.Y > Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - else - { - if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || - (vector.Y > Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - num -= 1f; - int num4; - int num5; - int num6; - int num7; - if (num > num2) - { - num4 = (int)(vector.X - num3 * 0.5); - num5 = (int)(vector.X + num3 * 0.5); - num6 = (int)(vector.Y - num3 * 0.5); - num7 = (int)(vector.Y + num3 * 0.5); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int k = num4; k < num5; k++) - { - for (int l = num6; l < num7; l++) - { - if ((Math.Abs(k - vector.X) + Math.Abs(l - vector.Y)) < num3 * 0.5 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(false); - } - else - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(true); - } - } - } - } - } - /*if (num <= 2f && vector.Y < (Main.rockLayer + Main.maxTilesY * 0.3)) - { - num = 2f; - }*/ - vector += vector2; - vector2.X += WorldGen.genRand.Next(-1, 2) * 0.01f; - if (vector2.X > 0.02) - { - vector2.X = 0.02f; - } - if (vector2.X < -0.02) - { - vector2.X = -0.02f; - } - num4 = (int)(vector.X - num3 * 1.1); - num5 = (int)(vector.X + num3 * 1.1); - num6 = (int)(vector.Y - num3 * 1.1); - num7 = (int)(vector.Y + num3 * 1.1); - if (num4 < 1) - { - num4 = 1; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int m = num4; m < num5; m++) - { - for (int n = num6; n < num7; n++) - { - if ((Math.Abs(m - vector.X) + Math.Abs(n - vector.Y)) < num3 * 1.1 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (n > j + WorldGen.genRand.Next(7, 16)) - { - Main.tile[m, n].active(false); - } - if (steps <= num2) - { - Main.tile[m, n].active(false); - } - if (ocean) - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(false); - } - else - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(true); - } - } - } - } - for (int num11 = num4; num11 < num5; num11++) - { - for (int num12 = num6; num12 < num7; num12++) - { - if ((Math.Abs(num11 - vector.X) + Math.Abs(num12 - vector.Y)) < num3 * 1.1 * (1.0 + WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(false); - } - else - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(true); - } - if (steps <= num2) - { - Main.tile[num11, num12].active(false); - } - } - } - } - } - } - #endregion - - #region PlaceTits - public static void PlaceTit(int x, int y, ushort type = 165) - { - if (Main.tile[x, y - 1] == null) - { - Main.tile[x, y - 1] = new Tile(); - } - if (Main.tile[x, y] == null) - { - Main.tile[x, y] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - 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 (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].active(true); - Main.tile[x, y].frameX = (short)num2; - Main.tile[x, y].frameY = 72; - } - else - { - int num3 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = 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 + 1].active(true); - Main.tile[x, y + 1].frameX = (short)num3; - Main.tile[x, y + 1].frameY = 18; - } - } - } - else - { - 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 (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].active(true); - Main.tile[x, y].frameX = (short)num13; - Main.tile[x, y].frameY = 90; - } - else - { - int num14 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y - 1].type = 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].active(true); - Main.tile[x, y].frameX = (short)num14; - Main.tile[x, y].frameY = 54; - } - } - } - } - } - #endregion - - #region Planetoids - public static void Planetoids(GenerationProgress progress) - { - progress.Message = "Generating Planetoids..."; - - int GrassPlanetoidCount = Main.maxTilesX / 1100; - int LCPlanetoidCount = Main.maxTilesX / 800; - int MudPlanetoidCount = Main.maxTilesX / 1100; - - const int MainPlanetoidAttempts = 3000; - int i = 0; - while (i < MainPlanetoidAttempts) - { - if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 300, Main.maxTilesX / 2 + 300), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) - { - break; - } - i++; - } - - const int CrystalHeartPlanetoidAttempts = 15000; - i = 0; - while (LCPlanetoidCount > 0 && i < CrystalHeartPlanetoidAttempts) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); - int y = WorldGen.genRand.Next(70, 101); - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - LCPlanetoidCount--; - i++; - } - - const int GrassPlanetoidAttempts = 12000; - i = 0; - while (GrassPlanetoidCount > 0 && i < GrassPlanetoidAttempts) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); - int y = WorldGen.genRand.Next(100, 131); - - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - GrassPlanetoidCount--; - i++; - } - - const int MudPlanetoidAttempts = 12000; - i = 0; - while (MudPlanetoidCount > 0 && i < MudPlanetoidAttempts) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); - int y = WorldGen.genRand.Next(100, 131); - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - MudPlanetoidCount--; - i++; - } - } - #endregion - } -} diff --git a/World/WorldUpdateMiscEffects.cs b/World/WorldUpdateMiscEffects.cs new file mode 100644 index 0000000000..56cda44b62 --- /dev/null +++ b/World/WorldUpdateMiscEffects.cs @@ -0,0 +1,808 @@ +using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; +using CalamityMod.Events; +using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.Calamitas; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.Tiles; +using CalamityMod.Tiles.Abyss; +using CalamityMod.Tiles.SunkenSea; +using Microsoft.Xna.Framework; +using System; +using System.Linq; +using Terraria; +using Terraria.GameContent.Events; +using Terraria.ID; +using Terraria.ModLoader; + +using static CalamityMod.World.CalamityWorld; + +namespace CalamityMod.World +{ + public class WorldUpdateMiscEffects + { + public static void PerformWorldUpdates() + { + // Sunken Sea Location...duh + SunkenSeaLocation = new Rectangle(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom, WorldGen.UndergroundDesertLocation.Width, WorldGen.UndergroundDesertLocation.Height / 2); + + // Player variable, always finds the closest player relative to the center of the map + int closestPlayer = Player.FindClosest(new Vector2(Main.maxTilesX / 2, (float)Main.worldSurface / 2f) * 16f, 0, 0); + Player player = Main.player[closestPlayer]; + CalamityPlayer modPlayer = player.Calamity(); + + // Force boss rush to off if necessary. + if (!BossRushEvent.DeactivateStupidFuckingBullshit) + { + BossRushEvent.DeactivateStupidFuckingBullshit = true; + BossRushEvent.BossRushActive = false; + CalamityNetcode.SyncWorld(); + } + + // Handle Acid Rain update logic. + if (rainingAcid) + AcidRainEvent.Update(); + else + { + if (timeSinceAcidStarted != 0) + timeSinceAcidStarted = 0; + startAcidicDownpour = false; + } + + // Lumenyl crystal, tenebris spread and sea prism crystal spawn rates + HandleTileGrowth(); + + // Update Boss Rush. + BossRushEvent.Update(); + + // Handle Phase 2 DoG's summon-code, for both DoG directly and his sentinels. + HandleDoGP2Countdown(player); + + // Handle conditional summons. + TrySpawnArmoredDigger(player, modPlayer); + TrySpawnDungeonGuardian(player); + TrySpawnAEoW(player, modPlayer); + TrySpawnRandomDeathmodeBosses(player, modPlayer); + + // Very, very, very rarely display a Lorde joke text if the system clock is set to April Fools Day. + if (Main.rand.NextBool(100000000) && DateTime.Now.Month == 4 && DateTime.Now.Day == 1) + { + string key = "Mods.CalamityMod.AprilFools"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + + // Disable sandstorms if the Desert Scourge is still alive and Hardmode hasn't begun. + if (!downedDesertScourge && Main.netMode != NetmodeID.MultiplayerClient && !Main.hardMode) + CalamityUtils.StopSandstorm(); + + // Make the cultist countdown happen much more quickly. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + CultistRitual.delay -= Main.dayRate * 10; + CultistRitual.recheck -= Main.dayRate * 10; + if (CultistRitual.recheck < 0) + CultistRitual.recheck = 0; + if (CultistRitual.delay < 0) + CultistRitual.delay = 0; + } + } + + #region Handle Tile Growing + + public static void HandleTileGrowth() + { + int l = 0; + float mult2 = 1.5E-05f * Main.worldRate; + while (l < Main.maxTilesX * Main.maxTilesY * mult2) + { + int x = WorldGen.genRand.Next(10, Main.maxTilesX - 10); + int y = WorldGen.genRand.Next((int)Main.worldSurface - 1, Main.maxTilesY - 20); + + int y2 = y - 1; + if (y2 < 10) + y2 = 10; + + if (Main.tile[x, y] != null) + { + if (Main.tile[x, y].nactive()) + { + if (Main.tile[x, y].liquid <= 32) + { + if (Main.tile[x, y].type == TileID.JungleGrass) + { + if (Main.tile[x, y2].liquid == 0) + { + // Plantera Bulbs pre-mech + if (WorldGen.genRand.Next(1500) == 0) + { + if (Main.hardMode && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)) + { + bool placeBulb = true; + int minDistanceFromOtherBulbs = 150; + for (int i = x - minDistanceFromOtherBulbs; i < x + minDistanceFromOtherBulbs; i += 2) + { + 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) + { + placeBulb = false; + break; + } + } + } + + if (placeBulb) + { + WorldGen.PlaceJunglePlant(x, y2, TileID.PlanteraBulb, 0, 0); + 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) + { + NetMessage.SendTileSquare(-1, x, y2, 5); + } + } + } + } + + // Life Fruit pre-mech + int random = Main.expertMode ? 90 : 120; + if (WorldGen.genRand.Next(random) == 0) + { + if (Main.hardMode && !NPC.downedMechBossAny) + { + bool placeFruit = true; + int minDistanceFromOtherFruit = Main.expertMode ? 50 : 60; + for (int i = x - minDistanceFromOtherFruit; i < x + minDistanceFromOtherFruit; i += 2) + { + 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) + { + placeFruit = false; + break; + } + } + } + + if (placeFruit) + { + 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) + { + NetMessage.SendTileSquare(-1, x, y2, 4); + } + } + } + } + } + } + } + + int tileType = Main.tile[x, y].type; + bool tenebris = tileType == ModContent.TileType() && downedCalamitas; + + if (CalamityGlobalTile.GrowthTiles.Contains(tileType) || tenebris) + { + int growthChance = tenebris ? 4 : 2; + if (tileType == ModContent.TileType()) + growthChance *= 5; + + if (Main.rand.NextBool(growthChance)) + { + switch (WorldGen.genRand.Next(4)) + { + case 0: + x++; + break; + case 1: + x--; + break; + case 2: + y++; + break; + case 3: + y--; + break; + default: + break; + } + + 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 isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType() || tileType == ModContent.TileType(); + bool meetsAdditionalGrowConditions = tile.slope() == 0 && !tile.halfBrick() && !tile.lava(); + + if (growTile && meetsAdditionalGrowConditions) + { + int tileType2 = ModContent.TileType(); + + if (tileType == ModContent.TileType()) + tileType2 = ModContent.TileType(); + + bool canPlaceBasedOnAttached = true; + if (tileType2 == ModContent.TileType() && !isSunkenSeaTile) + canPlaceBasedOnAttached = false; + + if (canPlaceBasedOnAttached && (CanPlaceBasedOnProximity(x, y, tileType2) || tenebris)) + { + tile.type = 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()) + { + tile.frameY = 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()) + { + tile.frameY = 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()) + { + tile.frameY = 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()) + { + tile.frameY = 54; + } + tile.frameX = (short)(WorldGen.genRand.Next(18) * 18); + } + + WorldGen.SquareTileFrame(x, y); + + if (Main.netMode == NetmodeID.Server) + NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); + } + } + } + } + } + } + } + l++; + } + + } + + public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) + { + if (tileType == ModContent.TileType() && !downedCalamitas) + return false; + + int minDistanceFromOtherTiles = 6; + int sameTilesNearby = 0; + for (int i = x - minDistanceFromOtherTiles; i < x + minDistanceFromOtherTiles; i++) + { + for (int j = y - minDistanceFromOtherTiles; j < y + minDistanceFromOtherTiles; j++) + { + if (Main.tile[i, j].active() && Main.tile[i, j].type == tileType) + { + sameTilesNearby++; + if (sameTilesNearby > 1) + return false; + } + } + } + + return true; + } + #endregion + + #region Handle Phase 2 DoG's Summoning + public static void HandleDoGP2Countdown(Player player) + { + if (DoGSecondStageCountdown <= 0) + return; + + DoGSecondStageCountdown--; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (DoGSecondStageCountdown == 21540) + CalamityUtils.SpawnBossBetter(player.Center, ModContent.NPCType(), new OffscreenBossSpawnContext()); + if (DoGSecondStageCountdown == 14340) + CalamityUtils.SpawnBossBetter(player.Center, ModContent.NPCType(), new OffscreenBossSpawnContext()); + if (DoGSecondStageCountdown == 7140) + CalamityUtils.SpawnBossBetter(player.Center, ModContent.NPCType(), new OffscreenBossSpawnContext()); + + if (DoGSecondStageCountdown <= 60) + { + int freeNPCSlots = Main.maxNPCs - Main.npc.Take(Main.maxNPCs).Where(npc => npc.active).Count(); + + // If there are too many slots occupied, make a note in the logs, + // and don't attempt to spawn the Devourer of Gods. + if (freeNPCSlots < 102) + { + CalamityMod.Instance.Logger.Warn("You have too many occupied NPC slots for DoG to spawn. Remove dummies or kill excessive town NPCs."); + DoGSecondStageCountdown = 0; + } + else if (!NPC.AnyNPCs(ModContent.NPCType())) + { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + string key = "Mods.CalamityMod.EdgyBossText10"; + Color messageColor = Color.Cyan; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + } + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(DoGSecondStageCountdown); + netMessage.Send(); + } + } + #endregion + + #region Handle Armored Digger Random Spawns + public static void TrySpawnArmoredDigger(Player player, CalamityPlayer modPlayer) + { + if (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneDungeon && !player.ZoneJungle && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses) + { + if (NPC.downedPlantBoss && player.townNPCs < 3f) + { + double spawnRate = 100000D; + + if (revenge) + spawnRate *= 0.85D; + + if (demonMode) + spawnRate *= 0.75D; + + if (death && Main.bloodMoon) + spawnRate *= 0.2D; + if (modPlayer.zerg) + spawnRate *= 0.5D; + if (modPlayer.chaosCandle) + spawnRate *= 0.6D; + if (player.enemySpawns) + spawnRate *= 0.7D; + if (Main.waterCandles > 0) + spawnRate *= 0.8D; + + if (modPlayer.bossZen || DoGSecondStageCountdown > 0) + spawnRate *= 50D; + if (modPlayer.zen || (CalamityConfig.Instance.DisableExpertTownSpawns && player.townNPCs > 1f && Main.expertMode)) + spawnRate *= 2D; + if (modPlayer.tranquilityCandle) + spawnRate *= 1.67D; + if (player.calmed) + spawnRate *= 1.43D; + if (Main.peaceCandles > 0) + spawnRate *= 1.25D; + + int chance = (int)spawnRate; + if (Main.rand.NextBool(chance)) + { + if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient && + ArmoredDiggerSpawnCooldown <= 0) + { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + ArmoredDiggerSpawnCooldown = 3600; + } + } + } + } + if (ArmoredDiggerSpawnCooldown > 0) + { + ArmoredDiggerSpawnCooldown--; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.ArmoredDiggerCountdownSync); + netMessage.Write(ArmoredDiggerSpawnCooldown); + netMessage.Send(); + } + } + } + #endregion + + #region Handle Dungeon Guardian Spawns + public static void TrySpawnDungeonGuardian(Player player) + { + if (Main.netMode == NetmodeID.MultiplayerClient || !player.ZoneDungeon || NPC.downedBoss3 || player.dead) + return; + + if (!NPC.AnyNPCs(NPCID.DungeonGuardian)) + NPC.SpawnOnPlayer(player.whoAmI, NPCID.DungeonGuardian); //your hell is as vast as my bonergrin, pray your life ends quickly + } + #endregion + + #region Handle Adult Eidolon Wyrm Spawns + public static void TrySpawnAEoW(Player player, CalamityPlayer modPlayer) + { + if (Main.netMode == NetmodeID.MultiplayerClient || !modPlayer.ZoneAbyss || !player.chaosState || player.dead) + return; + + bool adultWyrmAlive = CalamityGlobalNPC.adultEidolonWyrmHead != -1 && Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active; + if (!adultWyrmAlive) + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + #endregion + + #region Handle Deathmode Random Boss Spawns + + public static void TrySpawnRandomDeathmodeBosses(Player player, CalamityPlayer modPlayer) + { + void BossText() + { + string key = "Mods.CalamityMod.BossSpawnText"; + Color messageColor = Color.Crimson; + CalamityUtils.DisplayLocalizedText(key, messageColor); + } + + //does not occur while a boss is alive or during certain events) + if (!death || CalamityPlayer.areThereAnyDamnBosses || Main.snowMoon || Main.pumpkinMoon || DD2Event.Ongoing || player.statLifeMax2 < 300 || WorldGen.spawnEye || WorldGen.spawnHardBoss > 0) + return; + + if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check for countdown and cooldown being 0 + { + if (Main.rand.NextBool(50000)) + { + // Only set countdown and boss type if conditions are met + // Night time bosses set message only before 11pm. Day time bosses only before 2pm. + if (!NPC.downedBoss1 && bossType == 0) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) + { + BossText(); + bossType = NPCID.EyeofCthulhu; + bossSpawnCountdown = 3600; // 1 minute + } + + if (!NPC.downedBoss2 && bossType == 0) + if (player.ZoneCorrupt) + { + BossText(); + bossType = NPCID.EaterofWorldsHead; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedBoss2 && bossType == 0) + if (player.ZoneCrimson) + { + BossText(); + bossType = NPCID.BrainofCthulhu; + bossSpawnCountdown = 3600; + } + + /*if (!NPC.downedQueenBee && bossType == 0) + if (player.ZoneJungle && !player.ZoneOverworldHeight && !player.ZoneSkyHeight) + { + BossText(); + bossType = NPCID.QueenBee; + bossSpawnCountdown = 3600; + }*/ + + if (!downedDesertScourge && bossType == 0) + if (player.ZoneDesert) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (!downedPerforator && bossType == 0) + if (player.ZoneCrimson) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (!downedHiveMind && bossType == 0) + if (player.ZoneCorrupt) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (!downedCrabulon && bossType == 0) + if (player.ZoneGlowshroom) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (Main.hardMode) + { + if (!NPC.downedMechBoss1 && bossType == 0) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) + { + BossText(); + bossType = NPCID.TheDestroyer; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedMechBoss2 && bossType == 0) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) + { + BossText(); + bossType = NPCID.Spazmatism; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedMechBoss3 && bossType == 0) + if (!Main.dayTime && (player.ZoneOverworldHeight || player.ZoneSkyHeight) && Main.time < 12600) + { + BossText(); + bossType = NPCID.SkeletronPrime; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedPlantBoss && bossType == 0) + if (player.ZoneJungle && !player.ZoneOverworldHeight && !player.ZoneSkyHeight) + { + BossText(); + bossType = NPCID.Plantera; + bossSpawnCountdown = 3600; + } + + if (!NPC.downedFishron && bossType == 0) + if (player.ZoneBeach && !modPlayer.ZoneSulphur) + { + BossText(); + bossType = NPCID.DukeFishron; + bossSpawnCountdown = 3600; + } + + if (!downedCryogen && bossType == 0) + if (player.ZoneSnow && player.ZoneOverworldHeight) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (!downedCalamitas && bossType == 0) + if (!Main.dayTime && player.ZoneOverworldHeight && Main.time < 12600) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (!downedAstrageldon && bossType == 0) + if (modPlayer.ZoneAstral && + !Main.dayTime && player.ZoneOverworldHeight) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + /*if (!downedPlaguebringer && bossType == 0) + if (player.ZoneJungle && NPC.downedGolemBoss && !player.ZoneOverworldHeight && !player.ZoneSkyHeight) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + }*/ + + if (NPC.downedMoonlord) + { + if (!downedGuardians && bossType == 0) + if (Main.dayTime && (player.ZoneUnderworldHeight || + (player.ZoneHoly && player.ZoneOverworldHeight)) && Main.time < 34200) //only before 2pm + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + + if (!downedBumble && bossType == 0) + if (player.ZoneJungle && player.ZoneOverworldHeight) + { + BossText(); + bossType = ModContent.NPCType(); + bossSpawnCountdown = 3600; + } + } + } + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); + netMessage.Write(bossSpawnCountdown); + netMessage.Send(); + var netMessage2 = CalamityMod.Instance.GetPacket(); + netMessage2.Write((byte)CalamityModMessageType.BossTypeSync); + netMessage2.Write(bossType); + netMessage2.Send(); + } + } + } + else + { + if (bossSpawnCountdown > 0) + { + bossSpawnCountdown--; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossSpawnCountdownSync); + netMessage.Write(bossSpawnCountdown); + netMessage.Send(); + } + } + + if (bossSpawnCountdown <= 0 && deathBossSpawnCooldown <= 0) // Check both cooldowns again here to avoid infinite message possibilities + { + bool canSpawn = true; + switch (bossType) + { + case NPCID.EyeofCthulhu: + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) + canSpawn = false; + break; + case NPCID.EaterofWorldsHead: + if (!player.ZoneCorrupt) + canSpawn = false; + break; + case NPCID.BrainofCthulhu: + if (!player.ZoneCrimson) + canSpawn = false; + break; + /*case NPCID.QueenBee: + if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight) + canSpawn = false; + break;*/ + case NPCID.TheDestroyer: + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) + canSpawn = false; + break; + case NPCID.Spazmatism: + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) + canSpawn = false; + break; + case NPCID.SkeletronPrime: + if (Main.dayTime || (!player.ZoneOverworldHeight && !player.ZoneSkyHeight) || Main.time > 16200) + canSpawn = false; + break; + case NPCID.Plantera: + if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight) + canSpawn = false; + break; + case NPCID.DukeFishron: + if (!player.ZoneBeach) + canSpawn = false; + break; + } + + if (bossType == ModContent.NPCType()) + { + if (!player.ZoneDesert) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (!player.ZoneCrimson) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (!player.ZoneCorrupt) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (!player.ZoneGlowshroom) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (!player.ZoneSnow || !player.ZoneOverworldHeight) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (Main.dayTime || !player.ZoneOverworldHeight || Main.time > 16200) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (!modPlayer.ZoneAstral || + Main.dayTime || !player.ZoneOverworldHeight) + canSpawn = false; + } + /*else if (bossType == ModContent.NPCType()) + { + if (!player.ZoneJungle || player.ZoneOverworldHeight || player.ZoneSkyHeight) + canSpawn = false; + }*/ + else if (bossType == ModContent.NPCType()) + { + if (!Main.dayTime || (!player.ZoneUnderworldHeight && + (!player.ZoneHoly || !player.ZoneOverworldHeight)) || Main.time > 37800) + canSpawn = false; + } + else if (bossType == ModContent.NPCType()) + { + if (!player.ZoneJungle || !player.ZoneOverworldHeight) + canSpawn = false; + } + + if (canSpawn) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (bossType == NPCID.Spazmatism) + NPC.SpawnOnPlayer(player.whoAmI, NPCID.Retinazer); + else if (bossType == ModContent.NPCType()) + { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + else if (bossType == ModContent.NPCType()) + { + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + } + if (bossType == NPCID.DukeFishron) + { + NPC.NewNPC((int)player.Center.X - 300, (int)player.Center.Y - 300, bossType); + } + else + { + NPC.SpawnOnPlayer(player.whoAmI, bossType); + } + } + + deathBossSpawnCooldown = 86400; // 24 minutes (1 full Terraria day) + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DeathBossSpawnCountdownSync); + netMessage.Write(deathBossSpawnCooldown); + netMessage.Send(); + } + } + + bossType = 0; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossTypeSync); + netMessage.Write(bossType); + netMessage.Send(); + } + } + + // IMPORTANT! Decrement this cooldown AFTER everything else to avoid infinite possibilities + if (deathBossSpawnCooldown > 0) + { + deathBossSpawnCooldown--; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = CalamityMod.Instance.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DeathBossSpawnCountdownSync); + netMessage.Write(deathBossSpawnCooldown); + netMessage.Send(); + } + } + } + } + #endregion + } +} diff --git a/build.txt b/build.txt index 10f7c9f146..6c8216d4c6 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 1.4.5.001 +version = 1.5.0.001 displayName = Calamity Mod (No Calamity Music) homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes